@jolibox/implement 1.3.8 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Kf=Object.create;var zi=Object.defineProperty,Wf=Object.defineProperties,zf=Object.getOwnPropertyDescriptor,Qf=Object.getOwnPropertyDescriptors,Xf=Object.getOwnPropertyNames,nn=Object.getOwnPropertySymbols,Ws=Object.getPrototypeOf,Qi=Object.prototype.hasOwnProperty,zs=Object.prototype.propertyIsEnumerable,Yf=Reflect.get;var Ks=(e,t,r)=>t in e?zi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Q=(e,t)=>{for(var r in t||(t={}))Qi.call(t,r)&&Ks(e,r,t[r]);if(nn)for(var r of nn(t))zs.call(t,r)&&Ks(e,r,t[r]);return e},Oe=(e,t)=>Wf(e,Qf(t));var gr=(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 Qs=(e,t)=>{var r={};for(var n in e)Qi.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nn)for(var n of nn(e))t.indexOf(n)<0&&zs.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var Xi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Zf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xf(t))!Qi.call(e,i)&&i!==r&&zi(e,i,{get:()=>t[i],enumerable:!(n=zf(t,i))||n.enumerable});return e};var Yi=(e,t,r)=>(r=e!=null?Kf(Ws(e)):{},Zf(t||!e||!e.__esModule?zi(r,"default",{value:e,enumerable:!0}):r,e));var Xs=(e,t,r)=>Yf(Ws(e),r,t);var A=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function sh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function sa(e){return typeof e=="string"}function il(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function al(e){return typeof e=="object"&&Array.isArray(e)}function lh(e){return typeof e=="undefined"}function ch(e){return lh(e)||e===null}function dh(e){return typeof e=="function"}function ol(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function sl(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,a){for(let o in a)if(Object.prototype.hasOwnProperty.call(a,o)){let s=i[o],l=a[o],c=r(s,l,o,i,a);c!==void 0?i[o]=c:el(l)&&el(s)?i[o]=n(oa({},s),l):Array.isArray(l)&&Array.isArray(s)?i[o]=[...s,...l]:i[o]=l}return i}return n(e,t)}function el(e){return e&&typeof e=="object"&&e.constructor===Object}function ll(e,t){if(Array.isArray(e))return e.concat(t)}function wr(e,t,r={}){let n=null,i,a,o,{leading:s=!1,trailing:l=!0}=r,c=()=>(o=e.apply(a,i),i=void 0,a=void 0,o),p=function(...u){i=u,a=this;let m=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!m&&c()},t),m)return c()};return p.cancel=()=>{n&&clearTimeout(n),n=null,i=a=void 0},p.flush=()=>{if(n)return clearTimeout(n),n=null,c()},p}function hh(e,t){return(...r)=>t(e,...r)}function fl(e){return t=>hh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new fh(`${i}`))}})}function _r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function an(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,a)=>(i[a]=String(n[a]),i),{})}return e[r]})}function yh(e){let t=e.location?an(e.location,rl):null,r=e.target?an(e.target,rl):null;return an(ah(oa({},e),{location:t,target:r}),gh)}function fa(e){let t=e.events.map(n=>yh(n)),r=an(e.device,_h);return[e.protocolVersion,t,r,e.project]}function bh(){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 pa(e,t,r){let n=window.location.hostname,i=n.split("."),a=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${a}.jolibox.com`;if(i.length>=2){let o=i.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com"||o==="mporia.com"||o==="pingplus.ai")return`${a}.${o}`}return`${a}.jolibox.com`}function pl(e){return pa("app","stg-app",e)}function Kt(e){return`https://${pa("api","stg-api",e)}`}function Rh(e){return pa("collect","stg-collect",e)}function vl(e){return`https://${Rh(e)}`}function xh(e){return new Promise(t=>gl(e)(t))}function gl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Nh(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new br(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function Dh(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Lh(e[n],t[n])}function Lh(e,t){if(sa(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(dh(t)){try{if(e instanceof t)return}catch(r){}if(!ch(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 Uh(){return typeof globalThis!="undefined"?globalThis[_l]:void 0}function Bh(e){typeof globalThis!="undefined"&&(globalThis[_l]=e)}function Ee(e=!1){let t=Uh();if(!e&&t)return t;let r=new on,n=new ia,i={registerCommand(a,o,s){r.registerCommand({id:a,handler:o,metadata:s})},executeCommand(a,...o){return n.executeCommand(a,...o)},excuteCommandSync(a,...o){return n.executeCommandThowErr(a,...o)}};return Bh(i),i}var aa,eh,th,rh,Ys,nh,ih,Zs,oa,ah,oh,nl,Ot,uh,la,ca,cl,dl,fh,ul,sn,ln,da,Me,ea,mh,ua,tl,ph,kt,$t,vh,rl,gh,_h,$e,Vt,wh,ke,Eh,Ih,Ah,hl,ha,ma,Sh,Ch,ml,Tt,ta,ae,Oh,kh,yr,br,ze,na,Th,Zi,Ph,Et,on,ia,_l,$=re(()=>{"use strict";aa=Object.defineProperty,eh=Object.defineProperties,th=Object.getOwnPropertyDescriptor,rh=Object.getOwnPropertyDescriptors,Ys=Object.getOwnPropertySymbols,nh=Object.prototype.hasOwnProperty,ih=Object.prototype.propertyIsEnumerable,Zs=(e,t,r)=>t in e?aa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oa=(e,t)=>{for(var r in t||(t={}))nh.call(t,r)&&Zs(e,r,t[r]);if(Ys)for(var r of Ys(t))ih.call(t,r)&&Zs(e,r,t[r]);return e},ah=(e,t)=>eh(e,rh(t)),oh=(e,t)=>{for(var r in t)aa(e,r,{get:t[r],enumerable:!0})},nl=(e,t,r,n)=>{for(var i=n>1?void 0:n?th(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&aa(t,r,i),i},Ot=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);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}uh=(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))(uh||{}),la=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}},ca=class extends la{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},cl=class extends la{constructor(){super(...arguments),this.kind="USER_ERROR"}},dl=class extends cl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},fh=class extends cl{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))}},ul=class extends ca{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},sn=class extends ca{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},ln=class extends la{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}}},da=class extends ca{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Me={log:_r("log"),warn:_r("warn"),info:_r("info"),error:_r("error"),debug:_r("debug")};Object.assign(globalThis,{logger:Me});ea=Symbol.for("Jolibox.canIUseMap"),mh={};globalThis[ea]||(globalThis[ea]=mh);ua={get config(){return globalThis[ea]}},tl=Symbol.for("Jolibox.canIUseMap.native"),ph={};globalThis[tl]||(globalThis[tl]=ph);kt=(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))(kt||{}),$t=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))($t||{}),vh=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(vh||{}),rl=["name","params"],gh=["name","type","location","target","extra","timestamp","userId"],_h=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];$e=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});bh();Vt=typeof window=="undefined",wh=()=>!Vt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),ke={isiOS:!Vt&&(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:!Vt&&navigator.userAgent.includes("Android"),isMac:!Vt&&navigator.userAgent.includes("Mac"),isFacebook:!Vt&&navigator.userAgent.includes("FB_IAB"),isPC:!Vt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Eh=()=>ke.isiOS?"iOS":ke.isAndroid?"Android":ke.isMac?"Mac":ke.isFacebook?"Facebook":"PC",Ih="device_id",Ah="advertising_id",hl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,$e()),window.__joliboxLocalStorage__.getItem(e)),ha=()=>new URLSearchParams(window.location.search).get("deviceId")||hl(Ih),ma=()=>new URLSearchParams(window.location.search).get("advertisingId")||hl(Ah),Sh=e=>e.charAt(0).toUpperCase()+e.slice(1),Ch=()=>{var e;let t=new URLSearchParams(window.location.search);return Sh((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},ml=e=>{if(wh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=Eh(),n=navigator.language,i=ha(),a=ma();return`${t} (${Ch()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${a} version/${e||""}`};Tt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=oa({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Ot(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),a=this.createTimeoutPromise(),o=Promise.race([i,a]).catch(s=>Ot(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,o),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 o}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Ot(this,null,function*(){var r,n,i,a;let o=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(o);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),m=this.requestAdapter.extractRealTimeData(u),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(o,h,s),u):this.requestAdapter.mergeData(l,m)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),p=(a=(i=this.requestAdapter).extractCacheableData)==null?void 0:a.call(i,c);return p&&this.setCachedDataWithSequence(o,p,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 a=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:a,expiresAt:a+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 Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Ot(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),a=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${a})`);let o=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,o);return s&&(this.setCachedDataWithSequence(i,s,a),console.log(`[RequestCacheService] Force updated cache for ${e}`)),o})}warmupCache(e,t){return Ot(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)}},ta=class ra{constructor(t){this.element=t,this.next=ra.Undefined,this.prev=ra.Undefined}};ta.Undefined=new ta(void 0);ae=ta,Oh=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},kh=0,yr=class{constructor(e){this.value=e,this.id=kh++}},br=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,a,o,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,(o=(a=this.options)==null?void 0:a.onDidFirstListener)==null||o.call(a,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var p,u,m,h;if(!this._disposed){if(this._listeners instanceof yr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||u.call(p));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((h=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||h.call(m)))}}}}),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}},ze=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 br,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),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 Oh,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)}},na={};oh(na,{None:()=>Th,filter:()=>Nh,once:()=>gl,toPromise:()=>xh});Th=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Zi=Symbol.for("Jolibox.hostEmitter"),Ph=()=>{let e=new ze;return globalThis[Zi]||(globalThis[Zi]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Zi]},Et=Ph();on=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new br,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 Dh(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}};on=nl([ol],on);ia=class{constructor(){this._onWillExecuteCommand=new br,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new br,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new on,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=sh(3e4)),this._starActivation}executeCommand(e,...t){return Ot(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),na.toPromise(na.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}}};ia=nl([ol],ia);_l=Symbol.for("Jolibox.commands")});function Ge(e,t={}){va.emit("ERROR_REPORT",{error:e,options:t})}var va,xt,nt=re(()=>{"use strict";$();$();va=new ze,xt=new ze;Ge.debounce=wr(Ge,50,{leading:!0})});var ga,Mh,yl,bl,wl=re(()=>{"use strict";$();nt();ga=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{}}},Mh=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},yl=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[a,o,s]=i;return{headerJson:ga(a),payloadJson:ga(o),signature:ga(s)}}else throw"joli_source is missing"}catch(r){return Ge(new ul(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},bl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Mh(e),a=r[2];return`${n}.${i}.${a}`}return t}});var Gh,cn,El,_a=re(()=>{"use strict";$();Gh="1.3.8",cn=()=>Gh,El=()=>{let e=cn();return`${ml(e)}`}});function ba(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var Jh,Il,ya,Al,oe,Fh,D,he=re(()=>{"use strict";$();wl();_a();$();Jh={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:ha(),adId:ma(),pixelRatio:window.devicePixelRatio||1,platform:ke.isAndroid?"android":ke.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:cn()},schema:window.location.href,platform:ke.isAndroid?"android":ke.isiOS?"ios":"h5"},ya=(Il=globalThis.joliboxJSCore)==null?void 0:Il.env,oe=Object.assign({},(Al=ya==null?void 0:ya())!=null?Al:Jh);Fh=()=>{var E,I,w,R,k,L,J,S,P,F,H;let{payloadJson:e,headerJson:t,signature:r}=oe.schema.length?yl(oe.schema):{},n=`${oe.deviceInfo.did}-${new Date().getTime()}`,a=new URL(oe.schema.length?oe.schema:window.location.href).searchParams,o=(w=(I=(E=a.get("mpId"))!=null?E:a.get("appId"))!=null?I:a.get("gameId"))!=null?w:"",s=(L=(k=(R=oe.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?k:a.get("sessionId"))!=null?L:n,l=!!((S=(J=e==null?void 0:e.testAdsMode)!=null?J:e==null?void 0:e.__testAdsMode)!=null?S:a.get("testAdsMode")==="true"),c=(H=(F=(P=e==null?void 0:e.joliboxEnv)!=null?P:e==null?void 0:e.__joliboxEnv)!=null?F:a.get("joliboxEnv"))!=null?H:"production",p=c==="staging",u=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,b=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return p},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,M;return(M=(U=h.get("joliSource"))!=null?U:a.get("joliSource"))!=null?M:null},get mpId(){var U;return(U=o!=null?o:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:cn()},get mpType(){var U,M;return(M=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?M:"game"},get platform(){var U;return((U=oe.platform)!=null?U:oe.deviceInfo.platform).toLowerCase()},get deviceInfo(){return oe.deviceInfo},get sdkInfo(){return oe.sdkInfo},get hostInfo(){return oe.hostInfo},get hostUserInfo(){return oe.hostUserInfo},get sessionId(){var U,M;return(M=(U=oe.clientSessionId)!=null?U:s)!=null?M:n},get channel(){return u},get webviewId(){var U;return(U=oe.webviewId)!=null?U:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return pl(p)},get adId(){var U;return(U=oe.deviceInfo.adId)!=null?U:oe.deviceInfo.did},get language(){return oe.deviceInfo.lang},get sdkEnvironment(){return ba("dlightek","jolibox")?"dlightek":a.get("huaweiQuick")==="true"?"huaweiQuick":ba("gamedistribution","jolibox")?"gamedistribution":ba("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var q,V,Be;let U=(q=oe.deviceInfo.pixelRatio)!=null?q:1,M=(V=oe.deviceInfo.statusBarHeight)!=null?V:e==null?void 0:e.__androidStatusBarHeight,G=(Be=oe.deviceInfo.navigationBarHeight)!=null?Be:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:M!==void 0?M/U:20,navigationBarHeight:G!==void 0?G/U:10}},get abTests(){var U,M;return(M=(U=oe.abValues)==null?void 0:U.split(","))!=null?M:[]},get mpInfo(){var U;return(U=oe.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{sl(oe,U,ll)},encodeJoliSourceQuery:U=>{var M,G;return t&&r?bl(Q(Q({},e),U),(M=a.get("joliSource"))!=null?M:""):(G=a.get("joliSource"))!=null?G:""},setDoExitDirectly:()=>{b=!1}}},D=Fh()});var wa,Cl,jh,Hh,Sl,qh,Rl=re(()=>{"use strict";$();nt();he();$();wa=!1,Cl=(e,t)=>e==null?!1:t in e,jh=e=>Cl(e,"kind"),Hh=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Sl=(e,t={},r)=>{var a,o,s;let n={user_id:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:"",device_id:(s=D.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:Hh(e.name)},i=Oe(Q({},n),{env:t.environment,isFromUser:r});r?xt.emit("GLOBAL_USER_ERROR",e,i):xt.emit("GLOBAL_ERROR",e,i)},qh=e=>Cl(e,"kind")&&e.kind==="USER_ERROR";va.on("ERROR_REPORT",({error:e,options:t})=>{if(wa)return;wa=!0;let r=jh(e)&&e.raw?e.raw:e;try{let n=qh(e);Sl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),a=new da(`${i}, origin error: ${r.message}`);Me.error(a),Sl(new da(a.message),{environment:t.environment},!1)}finally{wa=!1}})});var Ea,Ia=re(()=>{"use strict";nt();$();nt();Ea=e=>new dl(e)});function Ol(e,t){let r=(n,i,a)=>{let c=i!=null?i:{},{eventType:o}=c,s=Qs(c,["eventType"]),l=Oe(Q({tag:n,eventType:a!=null?a:o!=null?o:kt.Other},t),{extra:Q({},s)});n=="globalJsError"?Ge(new sn(JSON.stringify(l))):e("systemLog",l,D.webviewId)};return r.debounce=wr(r,500,{leading:!0}),r}function kl(e){let t=(r,n,i)=>{var s;let a=(s=i&&JSON.stringify(i))!=null?s:0,o={speed_value_type:r,total_duration:n};a&&Object.assign(o,{extra:a}),e("joliboxSpeedAnalysis",o)};return t.debounce=wr(t,500,{leading:!0}),t}var Tl=re(()=>{"use strict";$();$();nt();he()});function xl(e,t){let r=Ol(e,t),n=kl(r);return{track:r,trackPerformance:n}}var Nl=re(()=>{"use strict";Tl()});var Aa=re(()=>{"use strict"});var dn,Pl=re(()=>{"use strict";he();$();$();dn=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,a,o,s;let{nativeSDKVersion:t,jssdkVersion:r}=D.sdkInfo;return{platform:1e3,os:D.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(a=(i=D.hostInfo)==null?void 0:i.aid)!=null?a:"1",model:(o=D.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=D.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:D.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 u;if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),a=t.target||null,o=t.extra||null,{hostUserInfo:s}=D;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,p={protocolVersion:"1.0.0",events:[Oe(Q({},t),{location:i,target:a,extra:o,timestamp:Date.now(),userId:(u=s==null?void 0:s.uid)!=null?u:null})],device:l,project:r};try{n?yield this.doReport(fa(p),n):yield this.doReport(fa(p))}catch(m){Me.log("[Jolibox SDK] report API error",m)}})}}});var Sa=re(()=>{"use strict";Nl();Aa();Pl()});var Ca,Dl,it,un,Ke,Wt=re(()=>{"use strict";_a();he();$();Ca=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Dl=AbortSignal.timeout)!=null||(AbortSignal.timeout=Ca);it=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 un(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},un=class{constructor(t){this.xua=El();this.getJoliSource=()=>D.joliSource;var n;let r=Kt(D.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:a}=r!=null?r:{},o=n?new URLSearchParams(n):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,p=this.getJoliSource();a=Object.assign({},a!=null?a:{},c?{"x-user-agent":c}:{},p?{"x-joli-source":p}:{});let u=yield fetch(l,{method:"GET",headers:a,credentials:"include",signal:Ca(i!=null?i:3e4)});return it.getInstance().recordNetworkRequest(!0),yield u.json()}catch(n){throw it.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{},{"x-os-type":ke.isAndroid?"ANDROID":ke.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let m=yield fetch(c,{method:"POST",headers:o,body:JSON.stringify(n),signal:Ca(a!=null?a:3e4),credentials:"include"});it.getInstance().recordNetworkRequest(!0);let h=m.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return m.blob()}catch(b){return yield m.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return m.formData()}catch(b){return yield m.text()}if(h!=null&&h.includes("application/json"))try{return yield m.json()}catch(b){return yield m.text()}return m}catch(n){throw it.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{});let m=yield fetch(c,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!m.ok)throw it.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${m.status}`);return it.getInstance().recordNetworkRequest(!0),yield m.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=un;Ke=it.getInstance()});var Ra,fn,Oa=re(()=>{"use strict";he();Sa();Wt();$();Ra=class extends dn{constructor(){super(...arguments);this.httpClient=Ke.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return vl((r=D.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},fn=new Ra(Kt(D.testMode))});var Vh,Ll=re(()=>{"use strict";Rl();$();Ia();$();Oa();he();Vh=(e,t)=>{var i,a,o;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:kt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:null};fn.trackEvent(n,$t.WebSDK)};xt.on("GLOBAL_ERROR",(e,t)=>{Vh(t.tag,e)});xt.on("GLOBAL_USER_ERROR",(e,t)=>{Me.log("UserError",e,t)})});var hn,Ul=re(()=>{"use strict";hn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(t)});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,a=!1,o=0,s=()=>{if(!a)return;let h=Date.now(),b=h-r;b>=this.interval&&(this.visible&&(o+=Math.min(b,this.interval+1e3),t(o)),r=h),n=requestAnimationFrame(s)},l=()=>{p(),r=Date.now(),i=window.setInterval(()=>{if(!a)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},p=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{a&&(console.log("visible",h),h?c():l())});let m=this.visible;return{start(){a||(a=!0,m?c():l())},stop(){a=!1,p(),u()}}}}});var Bl,Ml=re(()=>{"use strict";Bl=`-----BEGIN PUBLIC KEY-----
1
+ var qu=Object.create;var Da=Object.defineProperty,Vu=Object.defineProperties,$u=Object.getOwnPropertyDescriptor,Ku=Object.getOwnPropertyDescriptors,Wu=Object.getOwnPropertyNames,Xr=Object.getOwnPropertySymbols,vs=Object.getPrototypeOf,Na=Object.prototype.hasOwnProperty,gs=Object.prototype.propertyIsEnumerable,zu=Reflect.get;var ps=(t,e,r)=>e in t?Da(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X=(t,e)=>{for(var r in e||(e={}))Na.call(e,r)&&ps(t,r,e[r]);if(Xr)for(var r of Xr(e))gs.call(e,r)&&ps(t,r,e[r]);return t},Re=(t,e)=>Vu(t,Ku(e));var fr=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var _s=(t,e)=>{var r={};for(var n in t)Na.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Xr)for(var n of Xr(t))e.indexOf(n)<0&&gs.call(t,n)&&(r[n]=t[n]);return r};var re=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ua=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Xu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Wu(e))!Na.call(t,a)&&a!==r&&Da(t,a,{get:()=>e[a],enumerable:!(n=$u(e,a))||n.enumerable});return t};var Ba=(t,e,r)=>(r=t!=null?qu(vs(t)):{},Xu(e||!t||!t.__esModule?Da(r,"default",{value:t,enumerable:!0}):r,t));var ys=(t,e,r)=>zu(vs(t),r,e);var E=(t,e,r)=>new Promise((n,a)=>{var i=l=>{try{s(r.next(l))}catch(d){a(d)}},o=l=>{try{s(r.throw(l))}catch(d){a(d)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,o);s((r=r.apply(t,e)).next())});function af(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}function $a(t){return typeof t=="string"}function Cs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}function Rs(t){return typeof t=="object"&&Array.isArray(t)}function of(t){return typeof t=="undefined"}function sf(t){return of(t)||t===null}function lf(t){return typeof t=="function"}function Os(t){let e=t,r=null,n=function(...a){return r||(r=new e(...a)),r};return n.prototype=e.prototype,n}function ks(t,e,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(a,i){for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o)){let s=a[o],l=i[o],d=r(s,l,o,a,i);d!==void 0?a[o]=d:Es(l)&&Es(s)?a[o]=n(Va({},s),l):Array.isArray(l)&&Array.isArray(s)?a[o]=[...s,...l]:a[o]=l}return a}return n(t,e)}function Es(t){return t&&typeof t=="object"&&t.constructor===Object}function Ts(t,e){if(Array.isArray(t))return t.concat(e)}function vr(t,e,r={}){let n=null,a,i,o,{leading:s=!1,trailing:l=!0}=r,d=()=>(o=t.apply(i,a),a=void 0,i=void 0,o),g=function(...f){a=f,i=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&d()},e),p)return d()};return g.cancel=()=>{n&&clearTimeout(n),n=null,a=i=void 0},g.flush=()=>{if(n)return clearTimeout(n),n=null,d()},g}function uf(t,e){return(...r)=>e(t,...r)}function Ds(t){return e=>uf(e,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(a){t(new df(`${a}`))}})}function hr(t){return(...e)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[t])!=null?n:globalThis.console[t])(...e)}}function Yr(t,e){return e.map(r=>{if(r==="params"&&t[r]){let n=t[r];return Object.keys(n).reduce((a,i)=>(a[i]=String(n[i]),a),{})}return t[r]})}function gf(t){let e=t.location?Yr(t.location,As):null,r=t.target?Yr(t.target,As):null;return Yr(rf(Va({},t),{location:e,target:r}),pf)}function Ya(t){let e=t.events.map(n=>gf(n)),r=Yr(t.device,vf);return[t.protocolVersion,e,r,t.project]}function _f(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let t=Object.getOwnPropertyDescriptor(window,"localStorage");if(t&&t.get){let n=t.get.call(window);return window.__joliboxLocalStorage__=n,n}if(t=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),t&&t.get)return t.get.call(window);let e=Window.prototype,r=Object.getOwnPropertyDescriptor(e,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(t){return console.warn("Failed to get original localStorage, fallback to default implementation",t),localStorage}}function ei(t,e,r){let n=window.location.hostname,a=n.split("."),i=r?e:t;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${i}.jolibox.com`;if(a.length>=2){let o=a.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com"||o==="mporia.com"||o==="pingplus.ai")return`${i}.${o}`}return`${i}.jolibox.com`}function Bs(t){return ei("app","stg-app",t)}function jt(t){return`https://${ei("api","stg-api",t)}`}function Sf(t){return ei("collect","stg-collect",t)}function Ms(t){return`https://${Sf(t)}`}function kf(t){return new Promise(e=>Gs(t)(e))}function Gs(t){return(e,r=null)=>{let n=!1;return t(a=>{if(!n)return n=!0,e.call(r,a)},null)}}function Tf(t,e){return(r=>{let n,a={onWillAddFirstListener(){n=r(i.fire,i)}},i=new pr(a);return i.event})((r,n=null)=>t(a=>e(a)&&r.call(n,a),null))}function Pf(t,e){let r=Math.min(t.length,e.length);for(let n=0;n<r;n++)Lf(t[n],e[n])}function Lf(t,e){if($a(e)){if(typeof t!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(lf(e)){try{if(t instanceof e)return}catch(r){}if(!sf(t)&&t.constructor===e||e.length===1&&e.call(void 0,t)===!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 Df(){return typeof globalThis!="undefined"?globalThis[Fs]:void 0}function Nf(t){typeof globalThis!="undefined"&&(globalThis[Fs]=t)}function Ee(t=!1){let e=Df();if(!t&&e)return e;let r=new Qr,n=new ja,a={registerCommand(i,o,s){r.registerCommand({id:i,handler:o,metadata:s})},executeCommand(i,...o){return n.executeCommand(i,...o)},excuteCommandSync(i,...o){return n.executeCommandThowErr(i,...o)}};return Nf(a),a}var qa,Yu,Qu,Zu,ws,ef,tf,bs,Va,rf,nf,Ss,At,cf,Ka,Wa,xs,Ps,df,Ls,Zr,en,za,ke,Ga,ff,Xa,Is,hf,St,Ht,mf,As,pf,vf,qe,Jt,yf,Oe,wf,bf,Ef,Ns,Qa,Za,If,Af,Us,Ct,Fa,ie,Cf,Rf,mr,pr,ze,Ha,Of,Ma,xf,yt,Qr,ja,Fs,K=re(()=>{"use strict";qa=Object.defineProperty,Yu=Object.defineProperties,Qu=Object.getOwnPropertyDescriptor,Zu=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertySymbols,ef=Object.prototype.hasOwnProperty,tf=Object.prototype.propertyIsEnumerable,bs=(t,e,r)=>e in t?qa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Va=(t,e)=>{for(var r in e||(e={}))ef.call(e,r)&&bs(t,r,e[r]);if(ws)for(var r of ws(e))tf.call(e,r)&&bs(t,r,e[r]);return t},rf=(t,e)=>Yu(t,Zu(e)),nf=(t,e)=>{for(var r in e)qa(t,r,{get:e[r],enumerable:!0})},Ss=(t,e,r,n)=>{for(var a=n>1?void 0:n?Qu(e,r):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(a=(n?o(e,r,a):o(a))||a);return n&&a&&qa(e,r,a),a},At=(t,e,r)=>new Promise((n,a)=>{var i=l=>{try{s(r.next(l))}catch(d){a(d)}},o=l=>{try{s(r.throw(l))}catch(d){a(d)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,o);s((r=r.apply(t,e)).next())});if(typeof window!="undefined"&&!window.AbortController){let t=function(){this.signal=new e};t.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 e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},e.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let a=this._eventListeners[r].indexOf(n);a!==-1&&this._eventListeners[r].splice(a,1)},e.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=t,window.AbortSignal=e}cf=(t=>(t[t.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",t[t.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",t[t.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",t[t.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",t[t.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",t[t.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",t[t.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",t[t.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",t))(cf||{}),Ka=class extends Error{constructor(t){if(typeof t=="string"){super(t),this.priority="P1";return}super(t.message),this.priority="P1",this.stack=t.stack,this.raw=t}},Wa=class extends Ka{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},xs=class extends Ka{constructor(){super(...arguments),this.kind="USER_ERROR"}},Ps=class extends xs{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},df=class extends xs{constructor(t,e,r){super(t),this.message=t,this.errNo=e,this.name="USER_CUSTOM_ERROR",this.errMsg=t,r&&(this.extra=Object.assign({},this.extra,r))}},Ls=class extends Wa{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Zr=class extends Wa{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},en=class extends Ka{constructor(t,e,r,n,a){super(t),this.message=t,this.code=e,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},za=class extends Wa{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ke={log:hr("log"),warn:hr("warn"),info:hr("info"),error:hr("error"),debug:hr("debug")};Object.assign(globalThis,{logger:ke});Ga=Symbol.for("Jolibox.canIUseMap"),ff={};globalThis[Ga]||(globalThis[Ga]=ff);Xa={get config(){return globalThis[Ga]}},Is=Symbol.for("Jolibox.canIUseMap.native"),hf={};globalThis[Is]||(globalThis[Is]=hf);St=(t=>(t[t.Other=0]="Other",t[t.Route=1]="Route",t[t.Click=2]="Click",t[t.View=3]="View",t[t.Expose=4]="Expose",t[t.Swipe=5]="Swipe",t[t.Input=6]="Input",t[t.Select=7]="Select",t[t.SwitchOn=8]="SwitchOn",t[t.SwitchOff=9]="SwitchOff",t[t.Submit=10]="Submit",t[t.Scroll=11]="Scroll",t[t.Hide=12]="Hide",t[t.System=1e3]="System",t[t.ErrorTrace=1001]="ErrorTrace",t[t.UserDefined=1002]="UserDefined",t))(St||{}),Ht=(t=>(t.MiniGame="mini-game",t.MiniDrama="mini-drama",t.App="app",t.WebSDK="web-sdk",t.AppSDK="app-sdk",t))(Ht||{}),mf=(t=>(t[t.App=0]="App",t[t.H5=1]="H5",t[t.Weapp=2]="Weapp",t[t.Alipay=3]="Alipay",t[t.Gcash=4]="Gcash",t[t.Dana=5]="Dana",t[t.Umma=6]="Umma",t[t.WebSDK=1e3]="WebSDK",t[t.AppSDK=1001]="AppSDK",t[t.Other=9999]="Other",t))(mf||{}),As=["name","params"],pf=["name","type","location","target","extra","timestamp","userId"],vf=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];qe=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)});_f();Jt=typeof window=="undefined",yf=()=>!Jt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Oe={isiOS:!Jt&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),iosVersion:()=>{let t=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3]||"0",10)]},isAndroid:!Jt&&navigator.userAgent.includes("Android"),isMac:!Jt&&navigator.userAgent.includes("Mac"),isFacebook:!Jt&&navigator.userAgent.includes("FB_IAB"),isPC:!Jt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},wf=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",bf="device_id",Ef="advertising_id",Ns=t=>(window.__joliboxLocalStorage__.getItem(t)||window.__joliboxLocalStorage__.setItem(t,qe()),window.__joliboxLocalStorage__.getItem(t)),Qa=()=>new URLSearchParams(window.location.search).get("deviceId")||Ns(bf),Za=()=>new URLSearchParams(window.location.search).get("advertisingId")||Ns(Ef),If=t=>t.charAt(0).toUpperCase()+t.slice(1),Af=()=>{var t;let e=new URLSearchParams(window.location.search);return If((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Us=t=>{if(yf())return window.navigator.userAgent;let e="JoliboxWebSDK",r=wf(),n=navigator.language,a=Qa(),i=Za();return`${e} (${Af()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${a} adid/${i} version/${t||""}`};Ct=class{constructor(t,e={}){this.requestAdapter=t,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=Va({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},e)}request(t,e){return At(this,null,function*(){let r=this.config.keyGenerator(t,e),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${t}`),n;let a=this.requestInternal(t,e),i=this.createTimeoutPromise(),o=Promise.race([a,i]).catch(s=>At(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 ${t}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,o),a.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${t}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${t}:`,s)});try{return yield o}finally{this.pendingRequests.delete(r)}})}requestInternal(t,e){return At(this,null,function*(){var r,n,a,i;let o=this.config.keyGenerator(t,e),s=++this.requestSequence,l=this.getValidCachedData(o);if(console.log("[RequestCacheService] requestInternal start",t,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let f=yield this.requestAdapter.execute(t,e),p=this.requestAdapter.extractRealTimeData(f),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,f);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${t}`),this.setCachedDataWithSequence(o,h,s),f):this.requestAdapter.mergeData(l,p)}catch(f){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${t}:`,f),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${t}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${t} (sequence: ${s})`);let d=yield this.requestAdapter.execute(t,e),g=(i=(a=this.requestAdapter).extractCacheableData)==null?void 0:i.call(a,d);return g&&this.setCachedDataWithSequence(o,g,s),d})}createTimeoutPromise(){return new Promise((t,e)=>{setTimeout(()=>{e(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(t){let e=this.cache.get(t);return e?Date.now()>e.expiresAt?(this.cache.delete(t),null):e.data:null}setCachedDataWithSequence(t,e,r,n){let a=this.cache.get(t);if(a&&a.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${t} (current: ${a.sequence}, incoming: ${r})`);return}let i=Date.now();this.cache.set(t,{data:JSON.parse(JSON.stringify(e)),timestamp:i,expiresAt:i+this.config.duration,key:t,sequence:r,metadata:n}),this.cacheSequences.set(t,r),console.log(`[RequestCacheService] Updated cache for ${t} with sequence ${r}`)}refreshCache(t,e){return At(this,null,function*(){let r=this.config.keyGenerator(t,e);return this.cache.delete(r),this.request(t,e)})}forceRequest(t,e){return At(this,null,function*(){var r,n;let a=this.config.keyGenerator(t,e),i=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${t} (sequence: ${i})`);let o=yield this.requestAdapter.execute(t,e),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,o);return s&&(this.setCachedDataWithSequence(a,s,i),console.log(`[RequestCacheService] Force updated cache for ${t}`)),o})}warmupCache(t,e){return At(this,null,function*(){let r=this.config.keyGenerator(t,e);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${t} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${t} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${t}`),yield this.forceRequest(t,e)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${t}:`,n)}})}clearCache(t){t?(this.cache.delete(t),this.cacheSequences.delete(t),this.pendingRequests.delete(t),console.log(`[RequestCacheService] Cleared cache for ${t}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let t=Date.now();for(let[e,r]of this.cache)t>r.expiresAt&&(this.cache.delete(e),this.cacheSequences.delete(e));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let t=Date.now(),e=0,r=0;for(let n of this.cache.values())t>n.expiresAt?r++:e++;return{cacheCount:this.cache.size,validCount:e,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(t){let e=this.cache.get(t);return e?Date.now()<=e.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(t){return this.pendingRequests.has(t)}getCacheSequence(t){return this.cacheSequences.get(t)}},Fa=class Ja{constructor(e){this.element=e,this.next=Ja.Undefined,this.prev=Ja.Undefined}};Fa.Undefined=new Fa(void 0);ie=Fa,Cf=class{constructor(){this._first=ie.Undefined,this._last=ie.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ie.Undefined}clear(){let t=this._first;for(;t!==ie.Undefined;){let e=t.next;t.prev=ie.Undefined,t.next=ie.Undefined,t=e}this._first=ie.Undefined,this._last=ie.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let r=new ie(t);if(this._first===ie.Undefined)this._first=r,this._last=r;else if(e){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ie.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==ie.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==ie.Undefined&&t.next!==ie.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===ie.Undefined&&t.next===ie.Undefined?(this._first=ie.Undefined,this._last=ie.Undefined):t.next===ie.Undefined?(this._last=this._last.prev,this._last.next=ie.Undefined):t.prev===ie.Undefined&&(this._first=this._first.next,this._first.prev=ie.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==ie.Undefined;)yield t.element,t=t.next}},Rf=0,mr=class{constructor(t){this.value=t,this.id=Rf++}},pr=class{constructor(t){this.options=t,this._size=0}dispose(t){var e,r;this._disposed||(this._disposed=!0,this._listeners&&(t?(this._listeners instanceof mr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===t)):(this._listeners=void 0,this._size=0)),(r=(e=this.options)==null?void 0:e.onDidRemoveLastListener)==null||r.call(e))}get event(){var t;return(t=this._event)!=null||(this._event=(e,r)=>{var n,a,i,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(e=e.bind(r));let d=new mr(e);return this._listeners?this._listeners instanceof mr?this._listeners=[this._listeners,d]:this._listeners.push(d):((a=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||a.call(n,this),this._listeners=d,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var g,f,p,h;if(!this._disposed){if(this._listeners instanceof mr)this._listeners.id===d.id&&(this._listeners=void 0,this._size=0,(f=(g=this.options)==null?void 0:g.onDidRemoveLastListener)==null||f.call(g));else if(this._listeners){let b=this._listeners.indexOf(d);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((h=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||h.call(p)))}}}}),this._event}_deliver(t,e){var r;if(!t)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){t.value(e);return}try{t.value(e)}catch(a){n(a)}}fire(t){this._listeners&&(this._listeners instanceof mr?this._deliver(this._listeners,t):this._listeners.forEach(e=>this._deliver(e,t)))}hasListeners(){return this._size>0}},ze=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(t,e,r=!0){var n;let a=(n=this.listeners.get(t))!=null?n:new pr,i=l=>e(...l.args),o=a.event(i);this.listerHandlerMap.set(e,{handler:i,dispose:o}),this.listeners.set(t,a);let s=this.cachedEventQueue.get(t);if(s&&r)for(let l of s)e(...l.args)}flushCachedEvent(t){t?this.cachedEventQueue.delete(t):this.cachedEventQueue.clear()}off(t,e){let r=this.listerHandlerMap.get(e);r&&(r.dispose(),this.listerHandlerMap.delete(e))}emit(t,...e){let r=this.listeners.get(t),n=this.cachedEventQueue.get(t);n||(n=new Cf,this.cachedEventQueue.set(t,n)),n.push({args:e}),r&&r.fire({event:t,args:e})}once(t,e){let r=(...n)=>{e(...n),this.off(t,r)};this.on(t,r,!1)}},Ha={};nf(Ha,{None:()=>Of,filter:()=>Tf,once:()=>Gs,toPromise:()=>kf});Of=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Ma=Symbol.for("Jolibox.hostEmitter"),xf=()=>{let t=new ze;return globalThis[Ma]||(globalThis[Ma]={on:t.on.bind(t),off:t.off.bind(t),emit:t.emit.bind(t),once:t.once.bind(t)}),globalThis[Ma]},yt=xf();Qr=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new pr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(t){if(!t)throw new Error("invalid command");if(t.metadata&&Array.isArray(t.metadata.args)){let r=[];for(let a of t.metadata.args)r.push(a.constraint);let n=t.handler;t.handler=function(...a){return Pf(a,r),n(...a)}}let{id:e}=t;this._commands.get(e)&&console.info(`[Jolibox SDK] duplicated command is registered ${e}`),this._commands.set(e,t),this._onDidRegisterCommand.fire(e)}getCommand(t){return this._commands.get(t)}getCommands(){let t=new Map;for(let e of this._commands.keys()){let r=this.getCommand(e);r&&t.set(e,r)}return t}};Qr=Ss([Os],Qr);ja=class{constructor(){this._onWillExecuteCommand=new pr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new pr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Qr,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=af(3e4)),this._starActivation}executeCommand(t,...e){return At(this,null,function*(){return this.registry.getCommand(t)?this._tryExecuteCommand(t,e):(yield Promise.all([Promise.race([this._activateStar(),Ha.toPromise(Ha.filter(this.registry.onDidRegisterCommand,r=>r===t))])]),this._tryExecuteCommand(t,e))})}executeCommandThowErr(t,...e){if(!this.registry.getCommand(t))throw new Error(`command '${t}' not found`);let r=this.registry.getCommand(t);this._onWillExecuteCommand.fire({commandId:t,args:e});let n=this.invokeFunction(r.handler,...e);return this._onDidExecuteCommand.fire({commandId:t,args:e}),n}_tryExecuteCommand(t,e){let r=this.registry.getCommand(t);if(!r)return Promise.reject(new Error(`command '${t}' not found`));try{this._onWillExecuteCommand.fire({commandId:t,args:e});let n=this.invokeFunction(r.handler,...e);return this._onDidExecuteCommand.fire({commandId:t,args:e}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(t,...e){let r=!1;try{return t(...e)}finally{r=!0}}};ja=Ss([Os],ja);Fs=Symbol.for("Jolibox.commands")});function Me(t,e={}){ti.emit("ERROR_REPORT",{error:t,options:e})}var ti,Rt,nt=re(()=>{"use strict";K();K();ti=new ze,Rt=new ze;Me.debounce=vr(Me,50,{leading:!0})});var ri,Uf,Js,Hs,js=re(()=>{"use strict";K();nt();ri=t=>{let e=t.replace(/-/g,"+").replace(/_/g,"/"),r=e.length%4===0?"":"=".repeat(4-e.length%4),n=atob(e+r);try{return JSON.parse(n)}catch(a){return{}}},Uf=t=>{let e=JSON.stringify(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Js=t=>{var e;try{let a=(e=new URL(t).searchParams.get("joliSource"))==null?void 0:e.split(".");if(a!=null&&a.length){let[i,o,s]=a;return{headerJson:ri(i),payloadJson:ri(o),signature:ri(s)}}else throw"joli_source is missing"}catch(r){return Me(new Ls(`${t} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Hs=(t,e)=>{let r=e.split(".");if(r&&r.length===3){let n=r[0],a=Uf(t),i=r[2];return`${n}.${a}.${i}`}return e}});var Bf,tn,qs,ni=re(()=>{"use strict";K();Bf="1.4.0",tn=()=>Bf,qs=()=>{let t=tn();return`${Us(t)}`}});function ii(t,e){return(document==null?void 0:document.head.querySelector(`meta[name="${t}"][content="${e}"]`))!==null}var Mf,Vs,ai,$s,oe,Gf,D,fe=re(()=>{"use strict";K();js();ni();K();Mf={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Qa(),adId:Za(),pixelRatio:window.devicePixelRatio||1,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:tn()},schema:window.location.href,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5"},ai=(Vs=globalThis.joliboxJSCore)==null?void 0:Vs.env,oe=Object.assign({},($s=ai==null?void 0:ai())!=null?$s:Mf);Gf=()=>{var I,S,w,O,L,U,J,A,P,H,q;let{payloadJson:t,headerJson:e,signature:r}=oe.schema.length?Js(oe.schema):{},n=`${oe.deviceInfo.did}-${new Date().getTime()}`,i=new URL(oe.schema.length?oe.schema:window.location.href).searchParams,o=(w=(S=(I=i.get("mpId"))!=null?I:i.get("appId"))!=null?S:i.get("gameId"))!=null?w:"",s=(U=(L=(O=oe.clientSessionId)!=null?O:t==null?void 0:t.sessionId)!=null?L:i.get("sessionId"))!=null?U:n,l=!!((A=(J=t==null?void 0:t.testAdsMode)!=null?J:t==null?void 0:t.__testAdsMode)!=null?A:i.get("testAdsMode")==="true"),d=(q=(H=(P=t==null?void 0:t.joliboxEnv)!=null?P:t==null?void 0:t.__joliboxEnv)!=null?H:i.get("joliboxEnv"))!=null?q:"production",g=d==="staging",f=e==null?void 0:e.channel,h=new URL(window.location.href).searchParams,b=t==null?void 0:t.__shouldInterupt;return{get startTime(){var N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return g},get testAdsMode(){return l},get joliboxEnv(){return d},get joliSource(){var N,M;return(M=(N=h.get("joliSource"))!=null?N:i.get("joliSource"))!=null?M:null},get mpId(){var N;return(N=o!=null?o:t==null?void 0:t.id)!=null?N:""},get mpVersion(){var N;return(N=e==null?void 0:e.ver)!=null?N:tn()},get mpType(){var N,M;return(M=(N=e==null?void 0:e.__mpType)!=null?N:t==null?void 0:t.__mpType)!=null?M:"game"},get platform(){var N;return((N=oe.platform)!=null?N:oe.deviceInfo.platform).toLowerCase()},get deviceInfo(){return oe.deviceInfo},get sdkInfo(){return oe.sdkInfo},get hostInfo(){return oe.hostInfo},get hostUserInfo(){return oe.hostUserInfo},get sessionId(){var N,M;return(M=(N=oe.clientSessionId)!=null?N:s)!=null?M:n},get channel(){return f},get webviewId(){var N;return(N=oe.webviewId)!=null?N:-1},get shouldInterupt(){return b},get from(){return t==null?void 0:t.__from},get baseApiHost(){return Bs(g)},get adId(){var N;return(N=oe.deviceInfo.adId)!=null?N:oe.deviceInfo.did},get language(){return oe.deviceInfo.lang},get sdkEnvironment(){return ii("dlightek","jolibox")?"dlightek":i.get("huaweiQuick")==="true"?"huaweiQuick":ii("gamedistribution","jolibox")?"gamedistribution":ii("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var V,$,Be;let N=(V=oe.deviceInfo.pixelRatio)!=null?V:1,M=($=oe.deviceInfo.statusBarHeight)!=null?$:t==null?void 0:t.__androidStatusBarHeight,F=(Be=oe.deviceInfo.navigationBarHeight)!=null?Be:t==null?void 0:t.__androidNavigationBarHeight;return{statusBarHeight:M!==void 0?M/N:20,navigationBarHeight:F!==void 0?F/N:10}},get abTests(){var N,M;return(M=(N=oe.abValues)==null?void 0:N.split(","))!=null?M:[]},get mpInfo(){var N;return(N=oe.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{ks(oe,N,Ts)},encodeJoliSourceQuery:N=>{var M,F;return e&&r?Hs(X(X({},t),N),(M=i.get("joliSource"))!=null?M:""):(F=i.get("joliSource"))!=null?F:""},setDoExitDirectly:()=>{b=!1}}},D=Gf()});var oi,Ws,Ff,Jf,Ks,Hf,zs=re(()=>{"use strict";K();nt();fe();K();oi=!1,Ws=(t,e)=>t==null?!1:e in t,Ff=t=>Ws(t,"kind"),Jf=t=>{let e=t.toLowerCase().split("_");return e[0]+e.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Ks=(t,e={},r)=>{var i,o,s;let n={user_id:(o=(i=D.hostUserInfo)==null?void 0:i.uid)!=null?o:"",device_id:(s=D.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:Jf(t.name)},a=Re(X({},n),{env:e.environment,isFromUser:r});r?Rt.emit("GLOBAL_USER_ERROR",t,a):Rt.emit("GLOBAL_ERROR",t,a)},Hf=t=>Ws(t,"kind")&&t.kind==="USER_ERROR";ti.on("ERROR_REPORT",({error:t,options:e})=>{if(oi)return;oi=!0;let r=Ff(t)&&t.raw?t.raw:t;try{let n=Hf(t);Ks(t,e,n)}catch(n){let a=n instanceof Error?n.message:String(n),i=new za(`${a}, origin error: ${r.message}`);ke.error(i),Ks(new za(i.message),{environment:e.environment},!1)}finally{oi=!1}})});var si,li=re(()=>{"use strict";nt();K();nt();si=t=>new Ps(t)});function Xs(t,e){let r=(n,a,i)=>{let d=a!=null?a:{},{eventType:o}=d,s=_s(d,["eventType"]),l=Re(X({tag:n,eventType:i!=null?i:o!=null?o:St.Other},e),{extra:X({},s)});n=="globalJsError"?Me(new Zr(JSON.stringify(l))):t("systemLog",l,D.webviewId)};return r.debounce=vr(r,500,{leading:!0}),r}function Ys(t){let e=(r,n,a)=>{var s;let i=(s=a&&JSON.stringify(a))!=null?s:0,o={speed_value_type:r,total_duration:n};i&&Object.assign(o,{extra:i}),t("joliboxSpeedAnalysis",o)};return e.debounce=vr(e,500,{leading:!0}),e}var Qs=re(()=>{"use strict";K();K();nt();fe()});function Zs(t,e){let r=Xs(t,e),n=Ys(r);return{track:r,trackPerformance:n}}var el=re(()=>{"use strict";Qs()});var ci=re(()=>{"use strict"});var rn,tl=re(()=>{"use strict";fe();K();K();rn=class{constructor(e){this.apiHost=e;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return E(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(e){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,a]of Object.entries(r))if(a.includes(e.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,a,i,o,s;let{nativeSDKVersion:e,jssdkVersion:r}=D.sdkInfo;return{platform:1e3,os:D.deviceInfo.platform,appVersion:(n=e!=null?e:r)!=null?n:"1.0.0",appId:(i=(a=D.hostInfo)==null?void 0:a.aid)!=null?i:"1",model:(o=D.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=D.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:D.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let e=new URLSearchParams(window.location.search),r={};return e.forEach((n,a)=>{r[a]=n}),{name:"GamePage",params:r}}trackEvent(e,r,n){return E(this,null,function*(){var f;if(this.checkIsSampled(e))return;let a=e.location?e.location:yield this.getLocation(),i=e.target||null,o=e.extra||null,{hostUserInfo:s}=D;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,g={protocolVersion:"1.0.0",events:[Re(X({},e),{location:a,target:i,extra:o,timestamp:Date.now(),userId:(f=s==null?void 0:s.uid)!=null?f:null})],device:l,project:r};try{n?yield this.doReport(Ya(g),n):yield this.doReport(Ya(g))}catch(p){ke.log("[Jolibox SDK] report API error",p)}})}}});var di=re(()=>{"use strict";el();ci();tl()});var ui,rl,at,nn,Ve,qt=re(()=>{"use strict";ni();fe();K();ui=t=>{let e=new AbortController;return setTimeout(()=>e.abort(),t),e.signal};(rl=AbortSignal.timeout)!=null||(AbortSignal.timeout=ui);at=class t{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 t._instance||(t._instance=new t),t._instance}create(e){let r=new nn(e);return t.getInstance().httpClients.add(r),r}recordNetworkRequest(e){this.networkRequests.push(e),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},nn=class{constructor(e){this.xua=qs();this.getJoliSource=()=>D.joliSource;var n;let r=jt(D.testMode);this.baseUrl=(n=e==null?void 0:e.baseUrl)!=null?n:r}get(e,r){return E(this,null,function*(){try{let{query:n,timeout:a}=r!=null?r:{},{headers:i}=r!=null?r:{},o=n?new URLSearchParams(n):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${e}${s?`?${s}`:""}`,d=this.xua,g=this.getJoliSource();i=Object.assign({},i!=null?i:{},d?{"x-user-agent":d}:{},g?{"x-joli-source":g}:{});let f=yield fetch(l,{method:"GET",headers:i,credentials:"include",signal:ui(a!=null?a:3e4)});return at.getInstance().recordNetworkRequest(!0),yield f.json()}catch(n){throw at.getInstance().recordNetworkRequest(!1),n}})}post(e,r){return E(this,null,function*(){try{let{data:n,query:a,timeout:i}=r!=null?r:{},{headers:o}=r!=null?r:{},s=a?new URLSearchParams(a):null,l=s==null?void 0:s.toString(),d=`${this.baseUrl}${e}${l?`?${l}`:""}`,g=this.xua,f=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},g?{"x-user-agent":g}:{},f?{"x-joli-source":f}:{},{"x-os-type":Oe.isAndroid?"ANDROID":Oe.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(d,{method:"POST",headers:o,body:JSON.stringify(n),signal:ui(i!=null?i:3e4),credentials:"include"});at.getInstance().recordNetworkRequest(!0);let h=p.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return p.blob()}catch(b){return yield p.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(b){return yield p.text()}if(h!=null&&h.includes("application/json"))try{return yield p.json()}catch(b){return yield p.text()}return p}catch(n){throw at.getInstance().recordNetworkRequest(!1),n}})}put(e,r){return E(this,null,function*(){try{let{data:n,query:a,timeout:i}=r!=null?r:{},{headers:o}=r!=null?r:{},s=a?new URLSearchParams(a):null,l=s==null?void 0:s.toString(),d=`${this.baseUrl}${e}${l?`?${l}`:""}`,g=this.xua,f=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},g?{"x-user-agent":g}:{},f?{"x-joli-source":f}:{});let p=yield fetch(d,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!p.ok)throw at.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return at.getInstance().recordNetworkRequest(!0),yield p.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=nn;Ve=at.getInstance()});var fi,an,hi=re(()=>{"use strict";fe();di();qt();K();fi=class extends rn{constructor(){super(...arguments);this.httpClient=Ve.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return Ms((r=D.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},an=new fi(jt(D.testMode))});var jf,nl=re(()=>{"use strict";zs();K();li();K();hi();fe();jf=(t,e)=>{var a,i,o;let r={message:e.message,stack:(a=e.stack)!=null?a:"",errorType:e.name,source:0},n={name:t,type:St.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(i=D.hostUserInfo)==null?void 0:i.uid)!=null?o:null};an.trackEvent(n,Ht.WebSDK)};Rt.on("GLOBAL_ERROR",(t,e)=>{jf(e.tag,t)});Rt.on("GLOBAL_USER_ERROR",(t,e)=>{ke.log("UserError",t,e)})});var on,al=re(()=>{"use strict";on=class{constructor(e,r){this.eventEmitter=e;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(e,r)=>{window.parent&&window.parent.postMessage({type:e,data:r},"*")};this.playGame=e=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:e}}),this.tracker("PlayGame",{duration:e}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:e}))};this.timer=this.createRAFTimer(e=>{this.playGame(e)});this.interval=r!=null?r:5*1e3,e.on("visible",n=>{this.visible=n})}start(e){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:e!=null?e:0}}),this.tracker("OpenGame",{duration:e!=null?e:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:e!=null?e:0}),this.timer.start()}close(e){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:e}}),this.tracker("CloseGame",{duration:e}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:e}),this.timer.stop()}createRAFTimer(e){let r=Date.now(),n,a,i=!1,o=0,s=()=>{if(!i)return;let h=Date.now(),b=h-r;b>=this.interval&&(this.visible&&(o+=Math.min(b,this.interval+1e3),e(o)),r=h),n=requestAnimationFrame(s)},l=()=>{g(),r=Date.now(),a=window.setInterval(()=>{if(!i)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},d=()=>{f(),r=Date.now(),n=requestAnimationFrame(s)},g=()=>{n&&(cancelAnimationFrame(n),n=0)},f=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",h=>{i&&(console.log("visible",h),h?d():l())});let p=this.visible;return{start(){i||(i=!0,p?d():l())},stop(){i=!1,g(),f()}}}}});var il,ol=re(()=>{"use strict";il=`-----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 Gl(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 $h(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),a=new Uint8Array(i.length);for(let o=0;o<i.length;o++)a[o]=i.charCodeAt(o);return a.buffer}function Jl(e){return A(this,null,function*(){let t=window.crypto,r=t.subtle,n=$h(Bl),i=yield r.importKey("spki",n,{name:"RSA-OAEP",hash:"SHA-1"},!1,["encrypt"]),a=t.getRandomValues(new Uint8Array(32)),o=yield r.importKey("raw",a,"AES-GCM",!1,["encrypt"]),s=yield r.encrypt({name:"RSA-OAEP"},i,a),l=Gl(s),p={timestamp:Date.now(),data:e},m=new TextEncoder().encode(JSON.stringify(p)),h=t.getRandomValues(new Uint8Array(12)),b=yield r.encrypt({name:"AES-GCM",iv:h,tagLength:128},o,m),E=new Uint8Array(b),I=new Uint8Array(h.length+E.length);I.set(h,0),I.set(E,h.length);let w=Gl(I.buffer);return{k:l,v:"1.0",payload:w}})}var Fl=re(()=>{"use strict";Ml()});var mn,jl=re(()=>{"use strict";he();Ul();Wt();Fl();mn=class extends hn{constructor(r,n,i){super(n,i);this.httpClient=Ke.create();this.gameId=D.mpId,this.sessionId=D.sessionId,this.track=r}reporter(r){return A(this,null,function*(){let{event:n,params:i,extraParams:a}=r,o={eventType:n,gameInfo:Q({gameId:this.gameId,sessionId:this.sessionId},i)};a&&Object.assign(o,a);try{let s=yield Jl(o);yield this.httpClient.post("/api/base/app-event/v2",{data:s})}catch(s){yield this.httpClient.post("/api/base/app-event",{data:o})}})}tracker(r,n=null){this.track(r,n)}}});var Hl,Kh,_e,Wh,ka,at,ot=re(()=>{"use strict";Ll();$();$();Sa();Oa();jl();he();Aa();Hl=Ee(),Kh={type:$t.WebSDK,platform:"h5",jssdk_version:D.sdkInfo.jssdkVersion,mp_id:D.mpId,mp_version:D.mpVersion},{track:_e,trackPerformance:Wh}=xl((...e)=>{var o,s,l,c;let[,t]=e,r=t,n=il(r.extra)?r.extra:sa(r.extra)?JSON.parse(r.extra):{},i=Oe(Q({},n),{mp_id:(o=r.mp_id)!=null?o:"",mp_version:(s=r.mp_version)!=null?s:""}),a={name:t.tag,type:kt.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(c=(l=D.hostUserInfo)==null?void 0:l.uid)!=null?c:null};fn.trackEvent(a,$t.WebSDK)},Kh);Hl.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Wh(e,t,r)});Hl.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{_e(e,t)});ka=new ze,at=new mn(_e,ka)});function ql(e){let t=ua.config[e];return t||(t={},ua.config[e]=t),(r,n)=>{if(t[r]){Me.warn(`[can i use] ${r} already registered`);return}t[r]=Q({},n)}}var Vl=re(()=>{"use strict";$()});function Ta(e){$l=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 st(e){return typeof e=="number"}function xa(e){let t=Na(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Na(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var $l,me,vn,gn,_n,yn,zt,bn,wn,En,In,An,Sn,Cn,Rn,On,kn,Tn,xn,Pa=re(()=>{"use strict";$l=!1;me=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if($l)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 ${xa(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}};vn=class extends me{validate(t){return this._optional&&t===void 0?!0:st(t)?st(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):st(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):st(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}},gn=class extends me{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},_n=class extends me{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(st(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(st(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}},yn=class extends me{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},zt=class extends me{validate(t){return!0}},bn=class extends me{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},wn=class extends me{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},En=class extends me{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},In=class extends me{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 ${xa(t)}`)}return!0}},An=class extends me{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(st(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(st(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(st(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((a,o)=>{if(n.path=`${this.path}[${o}]`,n.errors=this.errors,a===void 0&&n.hasDefault){r[o]=n.defaultValue;return}n.validate(a)||(n.hasFallback?r[o]=n.fallbackValue:i=!1)}),this._uniqueItems){let a=new Map;for(let o in r)a.has(r[o])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${a.get(r[o])}] and ${this.path}[${o}] are identical)`):a.set(r[o],o)}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}},Sn=class extends me{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Na(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,a=this._value;a.errors=this.errors;let o=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?a.path=`${this.path}.${s}`:a.path=`${this.path}["${s}"]`,!(l===void 0&&a._optional)){if(l===void 0&&a.hasDefault){i[s]=a.defaultValue;continue}a.validate(l)||(a.hasFallback?i[s]=a.fallbackValue:o=!1)}}return o}},Cn=class extends me{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Na(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let a in this._object){let o=n[a],s=this._object[a];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?s.path=`${this.path}.${a}`:s.path=`${this.path}["${a}"]`,!(s._optional&&o===void 0)){if(o===void 0&&s.hasDefault){n[a]=s.defaultValue;continue}s.validate(o)||(s.hasFallback?n[a]=s.fallbackValue:i=!1)}}return i}},Rn=class extends me{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:xa(this.value),actual:r}):!0}},On=class extends me{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 a=0;a<i;a++){let o=this._items[a];if(o.errors=[],o.path=this.path,!o.validate(t))r.push(o.errors.join("; "));else if(!n){n=!0;break}}if(!n){let a=r.join(`
10
- or `);this.errors.push(a)}return n}},kn=class extends me{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}},Tn=class extends me{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},xn=class extends me{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 Da(e,t,r="param"){if(e.errors=[],e.path=r,Ta(!0),!e.validate(t)){let n=e.errors.join(`
11
- `);throw e.errors.length=0,Ta(!1),new TypeError(n)}}var K,La=re(()=>{"use strict";Pa();Pa();K={object(e){return new Cn(e)},array(e){return new An(e)},tuple(...e){return new kn(...e)},literal(e){return new Rn(e)},or(...e){return new On(...e)},symbol(){return new yn},record(e){return new Sn(e)},function(){return new En},boolean(){return new gn},string(){return new _n},number(){return new vn},undefined(){return new bn},null(){return new wn},unknown(){return new zt},any(){return new zt},as(){return new zt},arraybuffer(){return new Tn},enum(...e){return new In(...e)},typedarray(e){return new xn(e)}}});var Nn,Kl,Wl=re(()=>{"use strict";$();nt();La();Ia();Nn=1,Kl=e=>{function t(n,i){return(...a)=>{var u,m,h,b;let o=Date.now(),s={method:n,trace_id:Nn};Nn+=1;let l="SUCCESS",c=`${n}:ok`,p=0;try{if(i.paramsSchema)try{Da(i.paramsSchema,a,"params")}catch(R){throw Ea(`${n}:fail ${R.message}`)}let E=i.implement(...a),I=E,w=`${n}:ok`;if(E&&"code"in E){let{code:R,data:k,message:L}=E;l=R,I=k,w=L}return{code:l,message:w,data:I}}catch(E){let I=E;p=(m=(u=I.code)!=null?u:I.errNo)!=null?m:2e3,l="FAILURE";let w=(b=(h=I.message)!=null?h:I.errMsg)!=null?b:`${E}`;return c=`${n}:${l} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`,Ge(new ln(c,p)),{code:l,message:c}}finally{let E=Date.now()-o}}}function r(n,i){return(...a)=>A(this,null,function*(){var m,h,b,E;let o=al(a)?a:[a],s=Date.now(),l={method:n,trace_id:Nn};Nn+=1;let c=`${n}:ok`,p="SUCCESS",u={code:p,message:c};try{if(i.paramsSchema)try{Da(i.paramsSchema,o,"params")}catch(R){throw Ea(R.message)}let w=yield i.implement(...o);if(w&&"code"in w){let{code:R,data:k,message:L}=w;p=R,c=L,w=k}return Object.assign(u,{code:p,message:c,data:w}),u}catch(I){let w=I,R=(h=(m=w.code)!=null?m:w.errNo)!=null?h:2e3;p="FAILURE";let k=(E=(b=w.message)!=null?b:w.errMsg)!=null?E:`${I}`,L=`${n}:${p} ${k.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:p,message:L}),Ge(new ln(L,R)),u}finally{let I=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var lt,Nt,Ie,Er=re(()=>{"use strict";Vl();ot();Wl();La();({createAPI:lt,createSyncAPI:Nt}=Kl(_e)),Ie=ql("h5")});var Yl=Xi((Xl,Ga)=>{(function(e){if(typeof Xl=="object"&&typeof Ga!="undefined")Ga.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,a,o){function s(p,u){if(!a[p]){if(!i[p]){var m=typeof gr=="function"&&gr;if(!u&&m)return m(p,!0);if(l)return l(p,!0);var h=new Error("Cannot find module '"+p+"'");throw h.code="MODULE_NOT_FOUND",h}var b=a[p]={exports:{}};i[p][0].call(b.exports,function(E){var I=i[p][1][E];return s(I||E)},b,b.exports,n,i,a,o)}return a[p].exports}for(var l=typeof gr=="function"&&gr,c=0;c<o.length;c++)s(o[c]);return s}({1:[function(n,i,a){(function(o){"use strict";var s=o.MutationObserver||o.WebKitMutationObserver,l;if(s){var c=0,p=new s(E),u=o.document.createTextNode("");p.observe(u,{characterData:!0}),l=function(){u.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var m=new o.MessageChannel;m.port1.onmessage=E,l=function(){m.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var w=o.document.createElement("script");w.onreadystatechange=function(){E(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},o.document.documentElement.appendChild(w)}:l=function(){setTimeout(E,0)};var h,b=[];function E(){h=!0;for(var w,R,k=b.length;k;){for(R=b,b=[],w=-1;++w<k;)R[w]();k=b.length}h=!1}i.exports=I;function I(w){b.push(w)===1&&!h&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,a){"use strict";var o=n(1);function s(){}var l={},c=["REJECTED"],p=["FULFILLED"],u=["PENDING"];i.exports=m;function m(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,S!==s&&I(this,S)}m.prototype.catch=function(S){return this.then(null,S)},m.prototype.then=function(S,P){if(typeof S!="function"&&this.state===p||typeof P!="function"&&this.state===c)return this;var F=new this.constructor(s);if(this.state!==u){var H=this.state===p?S:P;b(F,H,this.outcome)}else this.queue.push(new h(F,S,P));return F};function h(S,P,F){this.promise=S,typeof P=="function"&&(this.onFulfilled=P,this.callFulfilled=this.otherCallFulfilled),typeof F=="function"&&(this.onRejected=F,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},h.prototype.otherCallFulfilled=function(S){b(this.promise,this.onFulfilled,S)},h.prototype.callRejected=function(S){l.reject(this.promise,S)},h.prototype.otherCallRejected=function(S){b(this.promise,this.onRejected,S)};function b(S,P,F){o(function(){var H;try{H=P(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,P){var F=w(E,P);if(F.status==="error")return l.reject(S,F.value);var H=F.value;if(H)I(S,H);else{S.state=p,S.outcome=P;for(var U=-1,M=S.queue.length;++U<M;)S.queue[U].callFulfilled(P)}return S},l.reject=function(S,P){S.state=c,S.outcome=P;for(var F=-1,H=S.queue.length;++F<H;)S.queue[F].callRejected(P);return S};function E(S){var P=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof P=="function")return function(){P.apply(S,arguments)}}function I(S,P){var F=!1;function H(q){F||(F=!0,l.reject(S,q))}function U(q){F||(F=!0,l.resolve(S,q))}function M(){P(U,H)}var G=w(M);G.status==="error"&&H(G.value)}function w(S,P){var F={};try{F.value=S(P),F.status="success"}catch(H){F.status="error",F.value=H}return F}m.resolve=R;function R(S){return S instanceof this?S:l.resolve(new this(s),S)}m.reject=k;function k(S){var P=new this(s);return l.reject(P,S)}m.all=L;function L(S){var P=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),M=0,G=-1,q=new this(s);++G<F;)V(S[G],G);return q;function V(Be,jt){P.resolve(Be).then(Ht,function(tt){H||(H=!0,l.reject(q,tt))});function Ht(tt){U[jt]=tt,++M===F&&!H&&(H=!0,l.resolve(q,U))}}}m.race=J;function J(S){var P=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,M=new this(s);++U<F;)G(S[U]);return M;function G(q){P.resolve(q).then(function(V){H||(H=!0,l.resolve(M,V))},function(V){H||(H=!0,l.reject(M,V))})}}},{1:1}],3:[function(n,i,a){(function(o){"use strict";typeof o.Promise!="function"&&(o.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,i,a){"use strict";var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function s(d,v){if(!(d 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(d){return}}var c=l();function p(){try{if(!c||!c.open)return!1;var d=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(!d||v)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(f){return!1}}function u(d,v){d=d||[],v=v||{};try{return new Blob(d,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<d.length;y+=1)_.append(d[y]);return _.getBlob(v.type)}}typeof Promise=="undefined"&&n(3);var m=Promise;function h(d,v){v&&d.then(function(f){v(null,f)},function(f){v(f)})}function b(d,v,f){typeof v=="function"&&d.then(v),typeof f=="function"&&d.catch(f)}function E(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}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={},L=Object.prototype.toString,J="readonly",S="readwrite";function P(d){for(var v=d.length,f=new ArrayBuffer(v),_=new Uint8Array(f),y=0;y<v;y++)_[y]=d.charCodeAt(y);return f}function F(d){return new m(function(v){var f=d.transaction(w,S),_=u([""]);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(d){return typeof R=="boolean"?m.resolve(R):F(d).then(function(v){return R=v,R})}function U(d){var v=k[d.name],f={};f.promise=new m(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 M(d){var v=k[d.name],f=v.deferredOperations.pop();if(f)return f.resolve(),f.promise}function G(d,v){var f=k[d.name],_=f.deferredOperations.pop();if(_)return _.reject(v),_.promise}function q(d,v){return new m(function(f,_){if(k[d.name]=k[d.name]||Rs(),d.db)if(v)U(d),d.db.close();else return f(d.db);var y=[d.name];v&&y.push(d.version);var g=c.open.apply(c,y);v&&(g.onupgradeneeded=function(C){var O=g.result;try{O.createObjectStore(d.storeName),C.oldVersion<=1&&O.createObjectStore(w)}catch(T){if(T.name==="ConstraintError")console.warn('The database "'+d.name+'" has been upgraded from version '+C.oldVersion+" to version "+C.newVersion+', but the storage "'+d.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),M(d)}})}function V(d){return q(d,!1)}function Be(d){return q(d,!0)}function jt(d,v){if(!d.db)return!0;var f=!d.db.objectStoreNames.contains(d.storeName),_=d.version<d.db.version,y=d.version>d.db.version;if(_&&(d.version!==v&&console.warn('The database "'+d.name+`" can't be downgraded from version `+d.db.version+" to version "+d.version+"."),d.version=d.db.version),y||f){if(f){var g=d.db.version+1;g>d.version&&(d.version=g)}return!0}return!1}function Ht(d){return new m(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:d.type})},_.readAsBinaryString(d)})}function tt(d){var v=P(atob(d.data));return u([v],{type:d.type})}function Cs(d){return d&&d.__local_forage_encoded_blob}function Ku(d){var v=this,f=v._initReady().then(function(){var _=k[v._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return b(f,d,d),f}function Wu(d){U(d);for(var v=k[d.name],f=v.forages,_=0;_<f.length;_++){var y=f[_];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return d.db=null,V(d).then(function(g){return d.db=g,jt(d)?Be(d):g}).then(function(g){d.db=v.db=g;for(var C=0;C<f.length;C++)f[C]._dbInfo.db=g}).catch(function(g){throw G(d,g),g})}function rt(d,v,f,_){_===void 0&&(_=1);try{var y=d.db.transaction(d.storeName,v);f(null,y)}catch(g){if(_>0&&(!d.db||g.name==="InvalidStateError"||g.name==="NotFoundError"))return m.resolve().then(function(){if(!d.db||g.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Be(d)}).then(function(){return Wu(d).then(function(){rt(d,v,f,_-1)})}).catch(f);f(g)}}function Rs(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function zu(d){var v=this,f={db:null};if(d)for(var _ in d)f[_]=d[_];var y=k[f.name];y||(y=Rs(),k[f.name]=y),y.forages.push(v),v._initReady||(v._initReady=v.ready,v.ready=Ku);var g=[];function C(){return m.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 m.all(g).then(function(){return f.db=y.db,V(f)}).then(function(N){return f.db=N,jt(f,v._defaultConfig.version)?Be(f):N}).then(function(N){f.db=y.db=N,v._dbInfo=f;for(var B=0;B<x.length;B++){var W=x[B];W!==v&&(W._dbInfo.db=f.db,W._dbInfo.version=f.version)}})}function Qu(d,v){var f=this;d=E(d);var _=new m(function(y,g){f.ready().then(function(){rt(f._dbInfo,J,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=T.get(d);x.onsuccess=function(){var N=x.result;N===void 0&&(N=null),Cs(N)&&(N=tt(N)),y(N)},x.onerror=function(){g(x.error)}}catch(N){g(N)}})}).catch(g)});return h(_,v),_}function Xu(d,v){var f=this,_=new m(function(y,g){f.ready().then(function(){rt(f._dbInfo,J,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 B=x.result;if(B){var W=B.value;Cs(W)&&(W=tt(W));var ee=d(W,B.key,N++);ee!==void 0?y(ee):B.continue()}else y()},x.onerror=function(){g(x.error)}}catch(B){g(B)}})}).catch(g)});return h(_,v),_}function Yu(d,v,f){var _=this;d=E(d);var y=new m(function(g,C){var O;_.ready().then(function(){return O=_._dbInfo,L.call(v)==="[object Blob]"?H(O.db).then(function(T){return T?v:Ht(v)}):v}).then(function(T){rt(_._dbInfo,S,function(x,N){if(x)return C(x);try{var B=N.objectStore(_._dbInfo.storeName);T===null&&(T=void 0);var W=B.put(T,d);N.oncomplete=function(){T===void 0&&(T=null),g(T)},N.onabort=N.onerror=function(){var ee=W.error?W.error:W.transaction.error;C(ee)}}catch(ee){C(ee)}})}).catch(C)});return h(y,f),y}function Zu(d,v){var f=this;d=E(d);var _=new m(function(y,g){f.ready().then(function(){rt(f._dbInfo,S,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=T.delete(d);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 h(_,v),_}function ef(d){var v=this,f=new m(function(_,y){v.ready().then(function(){rt(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 h(f,d),f}function tf(d){var v=this,f=new m(function(_,y){v.ready().then(function(){rt(v._dbInfo,J,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 h(f,d),f}function rf(d,v){var f=this,_=new m(function(y,g){if(d<0){y(null);return}f.ready().then(function(){rt(f._dbInfo,J,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 B=N.result;if(!B){y(null);return}d===0||x?y(B.key):(x=!0,B.advance(d))},N.onerror=function(){g(N.error)}}catch(B){g(B)}})}).catch(g)});return h(_,v),_}function nf(d){var v=this,f=new m(function(_,y){v.ready().then(function(){rt(v._dbInfo,J,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 h(f,d),f}function af(d,v){v=I.apply(this,arguments);var f=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||f.name,d.storeName=d.storeName||f.storeName);var _=this,y;if(!d.name)y=m.reject("Invalid arguments");else{var g=d.name===f.name&&_._dbInfo.db,C=g?m.resolve(_._dbInfo.db):V(d).then(function(O){var T=k[d.name],x=T.forages;T.db=O;for(var N=0;N<x.length;N++)x[N]._dbInfo.db=O;return O});d.storeName?y=C.then(function(O){if(O.objectStoreNames.contains(d.storeName)){var T=O.version+1;U(d);var x=k[d.name],N=x.forages;O.close();for(var B=0;B<N.length;B++){var W=N[B];W._dbInfo.db=null,W._dbInfo.version=T}var ee=new m(function(te,fe){var de=c.open(d.name,T);de.onerror=function(qe){var vr=de.result;vr.close(),fe(qe)},de.onupgradeneeded=function(){var qe=de.result;qe.deleteObjectStore(d.storeName)},de.onsuccess=function(){var qe=de.result;qe.close(),te(qe)}});return ee.then(function(te){x.db=te;for(var fe=0;fe<N.length;fe++){var de=N[fe];de._dbInfo.db=te,M(de._dbInfo)}}).catch(function(te){throw(G(d,te)||m.resolve()).catch(function(){}),te})}}):y=C.then(function(O){U(d);var T=k[d.name],x=T.forages;O.close();for(var N=0;N<x.length;N++){var B=x[N];B._dbInfo.db=null}var W=new m(function(ee,te){var fe=c.deleteDatabase(d.name);fe.onerror=function(){var de=fe.result;de&&de.close(),te(fe.error)},fe.onblocked=function(){console.warn('dropInstance blocked for database "'+d.name+'" until all open connections are closed')},fe.onsuccess=function(){var de=fe.result;de&&de.close(),ee(de)}});return W.then(function(ee){T.db=ee;for(var te=0;te<x.length;te++){var fe=x[te];M(fe._dbInfo)}}).catch(function(ee){throw(G(d,ee)||m.resolve()).catch(function(){}),ee})})}return h(y,v),y}var of={_driver:"asyncStorage",_initStorage:zu,_support:p(),iterate:Xu,getItem:Qu,setItem:Yu,removeItem:Zu,clear:ef,length:tf,key:rf,keys:nf,dropInstance:af};function sf(){return typeof openDatabase=="function"}var bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lf="~~local_forage_type~",Os=/^~~local_forage_type~([^~]+)~/,tn="__lfsc__:",Ji=tn.length,Fi="arbf",ji="blob",ks="si08",Ts="ui08",xs="uic8",Ns="si16",Ps="si32",Ds="ur16",Ls="ui32",Us="fl32",Bs="fl64",Ms=Ji+Fi.length,Gs=Object.prototype.toString;function Js(d){var v=d.length*.75,f=d.length,_,y=0,g,C,O,T;d[d.length-1]==="="&&(v--,d[d.length-2]==="="&&v--);var x=new ArrayBuffer(v),N=new Uint8Array(x);for(_=0;_<f;_+=4)g=bt.indexOf(d[_]),C=bt.indexOf(d[_+1]),O=bt.indexOf(d[_+2]),T=bt.indexOf(d[_+3]),N[y++]=g<<2|C>>4,N[y++]=(C&15)<<4|O>>2,N[y++]=(O&3)<<6|T&63;return x}function Hi(d){var v=new Uint8Array(d),f="",_;for(_=0;_<v.length;_+=3)f+=bt[v[_]>>2],f+=bt[(v[_]&3)<<4|v[_+1]>>4],f+=bt[(v[_+1]&15)<<2|v[_+2]>>6],f+=bt[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 cf(d,v){var f="";if(d&&(f=Gs.call(d)),d&&(f==="[object ArrayBuffer]"||d.buffer&&Gs.call(d.buffer)==="[object ArrayBuffer]")){var _,y=tn;d instanceof ArrayBuffer?(_=d,y+=Fi):(_=d.buffer,f==="[object Int8Array]"?y+=ks:f==="[object Uint8Array]"?y+=Ts:f==="[object Uint8ClampedArray]"?y+=xs:f==="[object Int16Array]"?y+=Ns:f==="[object Uint16Array]"?y+=Ds:f==="[object Int32Array]"?y+=Ps:f==="[object Uint32Array]"?y+=Ls:f==="[object Float32Array]"?y+=Us:f==="[object Float64Array]"?y+=Bs:v(new Error("Failed to get type for BinaryArray"))),v(y+Hi(_))}else if(f==="[object Blob]"){var g=new FileReader;g.onload=function(){var C=lf+d.type+"~"+Hi(this.result);v(tn+ji+C)},g.readAsArrayBuffer(d)}else try{v(JSON.stringify(d))}catch(C){console.error("Couldn't convert value into a JSON string: ",d),v(null,C)}}function df(d){if(d.substring(0,Ji)!==tn)return JSON.parse(d);var v=d.substring(Ms),f=d.substring(Ji,Ms),_;if(f===ji&&Os.test(v)){var y=v.match(Os);_=y[1],v=v.substring(y[0].length)}var g=Js(v);switch(f){case Fi:return g;case ji:return u([g],{type:_});case ks:return new Int8Array(g);case Ts:return new Uint8Array(g);case xs:return new Uint8ClampedArray(g);case Ns:return new Int16Array(g);case Ds:return new Uint16Array(g);case Ps:return new Int32Array(g);case Ls:return new Uint32Array(g);case Us:return new Float32Array(g);case Bs:return new Float64Array(g);default:throw new Error("Unkown type: "+f)}}var qi={serialize:cf,deserialize:df,stringToBuffer:Js,bufferToString:Hi};function Fs(d,v,f,_){d.executeSql("CREATE TABLE IF NOT EXISTS "+v.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,_)}function uf(d){var v=this,f={db:null};if(d)for(var _ in d)f[_]=typeof d[_]!="string"?d[_].toString():d[_];var y=new m(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){Fs(O,f,function(){v._dbInfo=f,g()},function(T,x){C(x)})},C)});return f.serializer=qi,y}function wt(d,v,f,_,y,g){d.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):Fs(T,v,function(){T.executeSql(f,_,y,g)},g)},g):g(C,O)},g)}function ff(d,v){var f=this;d=E(d);var _=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){wt(O,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[d],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 h(_,v),_}function hf(d,v){var f=this,_=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){wt(O,C,"SELECT * FROM "+C.storeName,[],function(T,x){for(var N=x.rows,B=N.length,W=0;W<B;W++){var ee=N.item(W),te=ee.value;if(te&&(te=C.serializer.deserialize(te)),te=d(te,ee.key,W+1),te!==void 0){y(te);return}}y()},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function js(d,v,f,_){var y=this;d=E(d);var g=new m(function(C,O){y.ready().then(function(){v===void 0&&(v=null);var T=v,x=y._dbInfo;x.serializer.serialize(v,function(N,B){B?O(B):x.db.transaction(function(W){wt(W,x,"INSERT OR REPLACE INTO "+x.storeName+" (key, value) VALUES (?, ?)",[d,N],function(){C(T)},function(ee,te){O(te)})},function(W){if(W.code===W.QUOTA_ERR){if(_>0){C(js.apply(y,[d,T,f,_-1]));return}O(W)}})})}).catch(O)});return h(g,f),g}function mf(d,v,f){return js.apply(this,[d,v,f,1])}function pf(d,v){var f=this;d=E(d);var _=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){wt(O,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[d],function(){y()},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function vf(d){var v=this,f=new m(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){wt(C,g,"DELETE FROM "+g.storeName,[],function(){_()},function(O,T){y(T)})})}).catch(y)});return h(f,d),f}function gf(d){var v=this,f=new m(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){wt(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 h(f,d),f}function _f(d,v){var f=this,_=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){wt(O,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[d+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 h(_,v),_}function yf(d){var v=this,f=new m(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){wt(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 h(f,d),f}function bf(d){return new m(function(v,f){d.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:d,storeNames:C})},function(y,g){f(g)})},function(_){f(_)})})}function wf(d,v){v=I.apply(this,arguments);var f=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||f.name,d.storeName=d.storeName||f.storeName);var _=this,y;return d.name?y=new m(function(g){var C;d.name===f.name?C=_._dbInfo.db:C=openDatabase(d.name,"","",0),d.storeName?g({db:C,storeNames:[d.storeName]}):g(bf(C))}).then(function(g){return new m(function(C,O){g.db.transaction(function(T){function x(ee){return new m(function(te,fe){T.executeSql("DROP TABLE IF EXISTS "+ee,[],function(){te()},function(de,qe){fe(qe)})})}for(var N=[],B=0,W=g.storeNames.length;B<W;B++)N.push(x(g.storeNames[B]));m.all(N).then(function(){C()}).catch(function(ee){O(ee)})},function(T){O(T)})})}):y=m.reject("Invalid arguments"),h(y,v),y}var Ef={_driver:"webSQLStorage",_initStorage:uf,_support:sf(),iterate:hf,getItem:ff,setItem:mf,removeItem:pf,clear:vf,length:gf,key:_f,keys:yf,dropInstance:wf};function If(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(d){return!1}}function Hs(d,v){var f=d.name+"/";return d.storeName!==v.storeName&&(f+=d.storeName+"/"),f}function Af(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch(v){return!0}}function Sf(){return!Af()||localStorage.length>0}function Cf(d){var v=this,f={};if(d)for(var _ in d)f[_]=d[_];return f.keyPrefix=Hs(d,v._defaultConfig),Sf()?(v._dbInfo=f,f.serializer=qi,m.resolve()):m.reject()}function Rf(d){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 h(f,d),f}function Of(d,v){var f=this;d=E(d);var _=f.ready().then(function(){var y=f._dbInfo,g=localStorage.getItem(y.keyPrefix+d);return g&&(g=y.serializer.deserialize(g)),g});return h(_,v),_}function kf(d,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 B=localStorage.getItem(N);if(B&&(B=y.serializer.deserialize(B)),B=d(B,N.substring(C),T++),B!==void 0)return B}}});return h(_,v),_}function Tf(d,v){var f=this,_=f.ready().then(function(){var y=f._dbInfo,g;try{g=localStorage.key(d)}catch(C){g=null}return g&&(g=g.substring(y.keyPrefix.length)),g});return h(_,v),_}function xf(d){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 h(f,d),f}function Nf(d){var v=this,f=v.keys().then(function(_){return _.length});return h(f,d),f}function Pf(d,v){var f=this;d=E(d);var _=f.ready().then(function(){var y=f._dbInfo;localStorage.removeItem(y.keyPrefix+d)});return h(_,v),_}function Df(d,v,f){var _=this;d=E(d);var y=_.ready().then(function(){v===void 0&&(v=null);var g=v;return new m(function(C,O){var T=_._dbInfo;T.serializer.serialize(v,function(x,N){if(N)O(N);else try{localStorage.setItem(T.keyPrefix+d,x),C(g)}catch(B){(B.name==="QuotaExceededError"||B.name==="NS_ERROR_DOM_QUOTA_REACHED")&&O(B),O(B)}})})});return h(y,f),y}function Lf(d,v){if(v=I.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var f=this.config();d.name=d.name||f.name,d.storeName=d.storeName||f.storeName}var _=this,y;return d.name?y=new m(function(g){d.storeName?g(Hs(d,_._defaultConfig)):g(d.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=m.reject("Invalid arguments"),h(y,v),y}var Uf={_driver:"localStorageWrapper",_initStorage:Cf,_support:If(),iterate:kf,getItem:Of,setItem:Df,removeItem:Pf,clear:Rf,length:Nf,key:Tf,keys:xf,dropInstance:Lf},Bf=function(v,f){return v===f||typeof v=="number"&&typeof f=="number"&&isNaN(v)&&isNaN(f)},Mf=function(v,f){for(var _=v.length,y=0;y<_;){if(Bf(v[y],f))return!0;y++}return!1},qs=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},pr={},Vs={},qt={INDEXEDDB:of,WEBSQL:Ef,LOCALSTORAGE:Uf},Gf=[qt.INDEXEDDB._driver,qt.WEBSQL._driver,qt.LOCALSTORAGE._driver],rn=["dropInstance"],Vi=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(rn),Jf={description:"",driver:Gf.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Ff(d,v){d[v]=function(){var f=arguments;return d.ready().then(function(){return d[v].apply(d,f)})}}function $i(){for(var d=1;d<arguments.length;d++){var v=arguments[d];if(v)for(var f in v)v.hasOwnProperty(f)&&(qs(v[f])?arguments[0][f]=v[f].slice():arguments[0][f]=v[f])}return arguments[0]}var jf=function(){function d(v){s(this,d);for(var f in qt)if(qt.hasOwnProperty(f)){var _=qt[f],y=_._driver;this[f]=y,pr[y]||this.defineDriver(_)}this._defaultConfig=$i({},Jf),this._config=$i({},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 d.prototype.config=function(f){if((typeof f=="undefined"?"undefined":o(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},d.prototype.defineDriver=function(f,_,y){var g=new m(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=Vi.concat("_initStorage"),B=0,W=N.length;B<W;B++){var ee=N[B],te=!Mf(rn,ee);if((te||f[ee])&&typeof f[ee]!="function"){O(x);return}}var fe=function(){for(var vr=function(Vf){return function(){var $f=new Error("Method "+Vf+" is not implemented by the current driver"),$s=m.reject($f);return h($s,arguments[arguments.length-1]),$s}},Ki=0,qf=rn.length;Ki<qf;Ki++){var Wi=rn[Ki];f[Wi]||(f[Wi]=vr(Wi))}};fe();var de=function(vr){pr[T]&&console.info("Redefining LocalForage driver: "+T),pr[T]=f,Vs[T]=vr,C()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(de,O):de(!!f._support):de(!0)}catch(qe){O(qe)}});return b(g,_,y),g},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(f,_,y){var g=pr[f]?m.resolve(pr[f]):m.reject(new Error("Driver not found."));return b(g,_,y),g},d.prototype.getSerializer=function(f){var _=m.resolve(qi);return b(_,f),_},d.prototype.ready=function(f){var _=this,y=_._driverSet.then(function(){return _._ready===null&&(_._ready=_._initDriver()),_._ready});return b(y,f,f),y},d.prototype.setDriver=function(f,_,y){var g=this;qs(f)||(f=[f]);var C=this._getSupportedDrivers(f);function O(){g._config.driver=g.driver()}function T(B){return g._extend(B),O(),g._ready=g._initStorage(g._config),g._ready}function x(B){return function(){var W=0;function ee(){for(;W<B.length;){var te=B[W];return W++,g._dbInfo=null,g._ready=null,g.getDriver(te).then(T).catch(ee)}O();var fe=new Error("No available storage method found.");return g._driverSet=m.reject(fe),g._driverSet}return ee()}}var N=this._driverSet!==null?this._driverSet.catch(function(){return m.resolve()}):m.resolve();return this._driverSet=N.then(function(){var B=C[0];return g._dbInfo=null,g._ready=null,g.getDriver(B).then(function(W){g._driver=W._driver,O(),g._wrapLibraryMethodsWithReady(),g._initDriver=x(C)})}).catch(function(){O();var B=new Error("No available storage method found.");return g._driverSet=m.reject(B),g._driverSet}),b(this._driverSet,_,y),this._driverSet},d.prototype.supports=function(f){return!!Vs[f]},d.prototype._extend=function(f){$i(this,f)},d.prototype._getSupportedDrivers=function(f){for(var _=[],y=0,g=f.length;y<g;y++){var C=f[y];this.supports(C)&&_.push(C)}return _},d.prototype._wrapLibraryMethodsWithReady=function(){for(var f=0,_=Vi.length;f<_;f++)Ff(this,Vi[f])},d.prototype.createInstance=function(f){return new d(f)},d}(),Hf=new jf;i.exports=Hf},{3:3}]},{},[4])(4)})});var ec=Xi(Bn=>{"use strict";$();Er();ot();var Fa=(e,t)=>{window.parent&&window.parent.postMessage({type:e,data:t},"*")},ja=Ee(),fm=lt("levelFinished",{paramsSchema:K.tuple(K.object({levelId:K.or(K.string(),K.number()),duration:K.number().optional(),rating:K.number().optional(),score:K.number().optional(),variation:K.string().optional()})),implement:e=>A(Bn,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:a}=e;Me.info("onLevelFinished",r,n,i,a),Fa("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:r,rating:n,score:i,variation:a}),yield Promise.all([at.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}}),at.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:a})])})}),hm=lt("gamePlayEnded",{paramsSchema:K.tuple(K.object({duration:K.number().optional(),rating:K.number().optional(),score:K.number(),variation:K.string().optional()})),implement:e=>A(Bn,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e;Me.info("onGamePlayEnded",t,r,n,i),Fa("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:r,score:n,variation:i}),yield Promise.all([at.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i}),at.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})])})}),mm=lt("levelUpgrade",{paramsSchema:K.tuple(K.object({levelId:K.or(K.string(),K.number()),name:K.string().optional()})),implement:r=>A(Bn,[r],function*({levelId:e,name:t}){Me.info("onLevelUpgrade",e,t),Fa("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:e,name:t}),yield Promise.all([at.tracker("LevelUpgrade",{name:t,levelId:e}),at.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})])})});ja.registerCommand("TaskTrackerSDK.levelFinished",fm);ja.registerCommand("TaskTrackerSDK.gamePlayEnded",hm);ja.registerCommand("TaskTrackerSDK.levelUpgrade",mm);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"}}})});var Ne,Qt,tc,Ha,pm,Pt,Ar=re(()=>{"use strict";Ne=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")},Qt=new Map,tc=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let r=Qt.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)}},Ha=!1,pm=()=>{Ha||(window.addEventListener("message",tc),Ha=!0)},Pt=(e,t)=>{pm(),Qt.has(e)||Qt.set(e,new Set);let r=Qt.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&Qt.delete(e),Qt.size===0&&(window.removeEventListener("message",tc),Ha=!1)}}});var Mn,Gn,Jn,Fn,jn,qa,Hn,qn,Vn,$n,Xt,vm,ne,ct,dt,Pe=re(()=>{"use strict";$();Mn="UNLOCK_OPTIONS_CHANGED",Gn="INVOKE_PAYMENT",Jn="ON_PAYMENT_RESULT",Fn="ON_USE_MODAL_EVENT",jn="ON_USE_MODAL_RESULT",qa="ON_USE_MODAL_FREQUENCY",Hn="ON_USE_UNLOGIN_MODAL_EVENT",qn="INVOKE_UNLOGIN_MODAL_EVENT",Vn="INVOKE_SUBSCRIPTION_EVENT",$n="ON_USE_SUBSCRIPTION_RESULT",Xt=new ze,vm=()=>({on:Xt.on.bind(Xt),off:Xt.off.bind(Xt),emit:Xt.emit.bind(Xt)}),ne=vm(),ct={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},dt={show:!0,minInterval:8*60*60*1e3}});var Ru=Xi(Di=>{"use strict";he();Pe();Ar();$();var Cu={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};Pt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",Cu[e.result],e.result),ne.emit(jn,{useModalResult:Cu[e.result]})});ne.on(Fn,(e,t)=>{var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ne("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:$e()})});Pt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{ne.emit(Jn,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});ne.on(Gn,(e,t)=>A(Di,null,function*(){var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ne("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:$e()})}));Pt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,r,n,i,a;ne.emit(Hn,{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:(a=e.isFirstLogin)!=null?a:!1}}),e.result==="SUCCESS"&&D.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});ne.on(qn,e=>A(Di,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ne("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:$e(),type:e})}));Pt("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),ne.emit($n,{result:e.result})});ne.on(Vn,e=>A(Di,null,function*(){console.log("----notify custom event-----",e),Ne("JOLIBOX_SUB_EVENT",{sequenceId:$e()})}))});ot();he();Er();$();var zl=Ee(),Qh="env",Xh="getSystemInfoSync",Yh=()=>{var i,a,o,s;let e={system:D.deviceInfo.system,platform:D.deviceInfo.platform.toLowerCase(),brand:D.deviceInfo.brand,pixelRatio:D.deviceInfo.pixelRatio,language:D.deviceInfo.lang,version:D.sdkInfo.jssdkVersion,appName:(i=D.hostInfo)==null?void 0:i.appName,SDKVersion:D.sdkInfo.nativeSDKVersion},t=(a=D.hostInfo)==null?void 0:a.version;t&&(e=Oe(Q({},e),{version:t}));let r=(o=D.hostInfo)==null?void 0:o.appName;r&&(e=Oe(Q({},e),{appName:r}));let n=(s=D.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(e=Oe(Q({},e),{SDKVersion:n})),e},Zh=Nt(Xh,{implement:Yh}),em=Nt(Qh,{implement:()=>Oe(Q({},D.hostInfo),{sdkInfo:D.sdkInfo,platform:D.platform,deviceInfo:D.deviceInfo})});zl.registerCommand("API.env",em);zl.registerCommand("API.getSystemInfoSync",Zh);Ie("env",{version:"1.0.0"});Ie("getSystemInfoSync",{version:"1.0.0"});$();Er();nt();ot();var tm="onJoliboxShow",rm="onJoliboxHide",nm="onReady",Ba=Ee(),Ma=fl(Ge),Ua=!0,Ir=!0,Pn=0,Dn=ka;function im(){let e=Date.now();if(e-Pn<100)return;Pn=e;let t=document.visibilityState==="visible";t!==Ua&&(Ua=t,Dn.emit("visible",Ua))}function Ql(e){let t=Date.now();t-Pn<100||(Pn=t,e==="focus"&&!Ir?Ir=!0:e==="blur"&&Ir&&(Ir=!1),Dn.emit("visible",Ir))}document.addEventListener("visibilitychange",im);window.addEventListener("focus",()=>Ql("focus"));window.addEventListener("blur",()=>Ql("blur"));var am=Nt(tm,{paramsSchema:K.tuple(K.function()),implement(e){let t=Ma(e);Dn.on("visible",r=>{r&&t()})}}),om=Nt(rm,{paramsSchema:K.tuple(K.function()),implement(e){let t=Ma(e);Dn.on("visible",r=>{!r&&t()})}}),sm=Nt(nm,{paramsSchema:K.tuple(K.function()),implement(e){let t=Ma(e);Et.on("LifecycleEvent.onReady",r=>{t(r)})}});Ba.registerCommand("LifecycleSDK.onReady",sm);Ba.registerCommand("LifecycleSDK.onJoliboxShow",am);Ba.registerCommand("LifecycleSDK.onJoliboxHide",om);Ie("lifeCycle.onReady",{version:"1.0.0"});Ie("lifeCycle.onJoliboxShow",{version:"1.0.0"});Ie("lifeCycle.onJoliboxHide",{version:"1.0.0"});Er();$();Wt();he();var Zl=Yi(Yl());var Ln=Ee(),Ja=class{constructor(){this.httpClient=Ke.create({baseUrl:Kt(D.testMode)});this.getGameId=()=>D.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}}),a=n==null?void 0:n.value,o=i;return r!=="SUCCESS"&&(a=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",a),o+="fallback to localstorage"),{code:r,message:o,data:a&&a!=="undefined"?a:null}});this.setItem=(t,r)=>A(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:i,message:a}=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:a}});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=Zl.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Un=new Ja,lm=lt("getLocalStorage",{paramsSchema:K.tuple(K.string()),implement(e){return A(this,null,function*(){return yield Un.getItem(e)})}});Ln.registerCommand("StorageSDK.getItem",lm);Ie("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var cm=lt("setStorage",{paramsSchema:K.tuple(K.string(),K.or(K.string(),K.boolean(),K.number())),implement(e,t){return A(this,null,function*(){return yield Un.setItem(e,t)})}});Ln.registerCommand("StorageSDK.setItem",cm);Ie("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var dm=lt("removeStorage",{paramsSchema:K.tuple(K.string()),implement(e){return A(this,null,function*(){return yield Un.removeItem(e)})}});Ln.registerCommand("StorageSDK.removeItem",dm);Ie("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var um=lt("clearStorage",{implement(){return A(this,null,function*(){return yield Un.clear()})}});Ln.registerCommand("StorageSDK.clear",um);Ie("storage.clear",{version:"1.0.0"});var UC=Yi(ec());ot();$();Wt();Ar();he();Pe();var rc=D.testMode;function nc(){let e=new Map,t,r;return{registerRewardHandler(i,a){e.set(i,a)},handleReward(i,...a){return A(this,null,function*(){return yield i.reduce((s,l)=>A(this,null,function*(){let c=yield s;if(c===!0)return!0;rc&&console.log(`handleReward ${l}`);let p=e.get(l),u=p?yield p(...a):c;return rc&&console.log(`handleReward ${l} ${u}`),u}),Promise.resolve(!1))})},registerRewardsFetcher(i){return A(this,null,function*(){t=(...a)=>A(this,null,function*(){try{return yield i(...a)}catch(o){return console.error("getRewardOptions error:",o),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return A(this,null,function*(){r=(...a)=>A(this,null,function*(){try{return yield i(...a)}catch(o){return console.error("getRewardOptions error:",o),{joliCoinUseAndCharge:ct,loginGuide:dt}}})})},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:ct,loginGuide:dt}})}}}$();var Va=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}}}},$a=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 Q({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}}},Kn=class{constructor(t){this.unlockOptionsService=new Tt(new Va(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((i,a)=>{var s,l;let o=n.unlockOptions[a];return i.type===o.type&&((s=i.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=o.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new Tt(new $a(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()}};Pe();$();var gm=()=>(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]},_m=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],ym=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(gm())},Ka=null;function Wa(e){return Ka||(Ka=new Kn(e)),Ka}var za=e=>{e.registerRewardsFetcher(t=>A(void 0,null,function*(){var i,a,o,s,l;let r=["ADS"],n=Wa(t);try{let c=yield n.getUnlockOptions({});if(c.code!=="SUCCESS")return r;ne.emit(Mn,{options:((i=c.data)==null?void 0:i.unlockOptions)||[],userJoliCoin:((a=c.extra)==null?void 0:a.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((o=c.extra)==null?void 0:o.joliGem)||{balance:0,enableAutoDeduct:!1}});let p=((l=(s=c.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(u=>u.type))||Array.from(r);return ym(p)}catch(c){return console.error("getRewardOptions error (cached):",c),r}}))},Qa=e=>{e.registerRewardFrequencyConfigFetcher(t=>A(void 0,null,function*(){var n,i,a,o;let r=Wa(t);try{let s=yield r.getGlobalConfig();return ne.emit(qa,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||ct,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||dt}),s.data&&Et.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((a=s.data)==null?void 0:a.joliCoinUseAndCharge)||ct,loginGuide:((o=s.data)==null?void 0:o.loginGuide)||dt}}catch(s){return console.error("getGlobalConfig error (cached):",s),ne.emit(qa,{joliCoinUseAndCharge:ct,loginGuide:dt}),Et.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:ct,loginGuide:dt,supportedHostMethods:_m}}),{joliCoinUseAndCharge:ct,loginGuide:dt}}}))};var Xa=e=>A(void 0,null,function*(){yield Wa(e).warmupCache(),console.log("Reward cache warmed up")});var ic=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});Pe();function Qe(e,t){let r=null,n=null,i=null,a=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(o=>{n=o})};return a(),e.on(t,(...o)=>{let s=o[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||a(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,a(),r),updateData:o=>{if(i)return i=Q(Q({},i),o),r=Promise.resolve(i),n&&(n(i),n=null),i}}}Pe();var Ae=Qe(ne,Mn),Sr=(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()))};he();$();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 Ve=Ee();Pe();Pe();$();var eo=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}}}},to=class{constructor(t){this.balanceService=new Tt(new eo(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()}},Za=null;function ro(e){return Za||(Za=new to(e)),Za}var no=(e,t="JOLI_COIN")=>A(void 0,null,function*(){return yield ro(e).getBalance(t)}),Dt=(e,t="JOLI_COIN")=>A(void 0,null,function*(){let n=yield ro(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n}),Wn=(e,t="JOLI_COIN")=>A(void 0,null,function*(){yield ro(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});$();var ao=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}}}},oo=class{constructor(t){this.gemBalanceService=new Tt(new ao(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()}},io=null;function ac(e){return io||(io=new oo(e)),io}var so=(e,t="GEM")=>A(void 0,null,function*(){return yield ac(e).getGemBalance(t)}),Yt=(e,t="GEM")=>A(void 0,null,function*(){let n=yield ac(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n});var Xe={JOLI_COIN:{fetchBalance:no,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(a=>{var o;return a.joliCoinQuantity<=((o=t==null?void 0:t.balance)!=null?o:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:so,getQuantity:e=>{var t,r,n,i;return(i=(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(a=>a.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,a;let r=e==null?void 0:e.options.find(o=>o.type==="JOLI_GEM");return r?((i=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0)<=((a=t==null?void 0:t.balance)!=null?a:0):!1}}};var zn=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;Ve.registerCommand(`Rewards.${e}.useJolicoin`,()=>A(void 0,null,function*(){let i=yield Ae.getData(),a=Xe[t],o=a.getCurrentUser(i),s=a.getQuantity(i),l=!!(o!=null&&o.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",i,l,s),(yield n({enableAutoDeduct:l,userCurrency:o,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},Lt=(e,t)=>r=>A(void 0,null,function*(){let n=Qe(ne,jn);return ne.emit(Fn,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult});Pe();Pe();var Qn=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;Ve.registerCommand(`Rewards.${e}.usePayment`,()=>A(void 0,null,function*(){var m;let a=yield Ae.getData(),o=Xe[t],s=yield o.fetchBalance(n),l=o.getQuantity(a),c=o.getCurrentUser(a),p=o.createUpdatedUser((m=s==null?void 0:s.balance)!=null?m:0,c.enableAutoDeduct),u=o.getUpdateKey();if(Ae.updateData({[u]:p}),console.log("-----unlockOptions payment-----",a,p,l,t),!o.isEnough(a,p)){let h=yield i({userCurrency:p,currencyQuantity:l,currency:t});return t==="JOLI_GEM"?Yt(n):Dt(n),{result:h==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Ut=(e,t)=>r=>A(void 0,null,function*(){let n=Qe(ne,Jn);return ne.emit(Gn,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult});he();Pe();Pe();$();var Bt=(e,t)=>r=>A(void 0,null,function*(){let n=Qe(ne,Hn);return ne.emit(qn,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()});var Em=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:a,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:c}})=>{Qn(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:o}),zn(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let p=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return u=>A(void 0,null,function*(){var m,h,b,E;try{let I=yield a.getData();if(Sr(I,c)){let L=Xe.JOLI_COIN,J=yield L.fetchBalance(t),S=L.getCurrentUser(I),P=L.createUpdatedUser((m=J==null?void 0:J.balance)!=null?m:0,S.enableAutoDeduct);if(!L.isEnough(I,P))return i==null||i(u),!1}else{let L=!0;for(let J of p){let S=yield Ve.executeCommand(J);if(L=L&&S.result!=="FAILED",S.result!=="CONTINUE")break}if(!L)return i==null||i(u),!1}let R=Ya[r],k=yield t.post(R.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${$e()}-${D.mpType}-${Date.now()}`,gameInfo:{gameId:D.mpId}}});if(console.log("-----unlockWithCurrency request result-----",k),k.code=="SUCCESS"){try{(b=u.adBreakDone)==null||b.call(u,{breakType:u.type,breakName:"name"in u&&(h=u.name)!=null?h:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in u&&((E=u.adViewed)==null||E.call(u)),Dt(t)}catch(L){console.error("-----unlockWithJolicoin adBreakDone error-----",L)}return n==null||n({quantity:k.data.quantity,balance:k.data.balance}),!0}return i==null||i(u),!1}catch(I){if(console.info("JolicoinRewardHandler error:",I),I instanceof Error&&I.message=="CANCEL")throw I;return i==null||i(u),!1}finally{a.clearCache()}})},Xn=(e,t,r)=>Em(e,t,"JOLI_COIN",r);var oc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},a=Lt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),o=Ut("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Bt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return Xn("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Ae,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:n}})};var sc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=c=>{var p;r==null||r(),(p=c.adBreakDone)==null||p.call(c,{breakType:c.type,breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},a=Lt("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),o=Ut("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Bt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return Xn("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Ae,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:n}})};he();$();Pe();Pe();var lc=e=>{let{showSubscriptionModal:t}=e;Ve.registerCommand("Rewards.subscription",()=>A(void 0,null,function*(){var s,l;let r=yield Ae.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=Xe[n?"JOLI_GEM":"JOLI_COIN"],a=i.getCurrentUser(r);return i.isEnough(r,a)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},cc=e=>()=>A(void 0,null,function*(){let t=Qe(ne,$n);return ne.emit(Vn,e),(yield t.getFreshData()).result});he();var dc=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:a,hasSubscription:o}})=>{lc({showSubscriptionModal:a});let s=["Rewards.subscription"];return l=>A(void 0,null,function*(){var c,p,u,m,h,b;try{let E=yield i.getData();if(!Sr(E,o))return!1;let w=!0;for(let R of s){let k=yield Ve.executeCommand(R);if(w=w&&k.result!=="FAILED",k.result!=="CONTINUE")break}if(Dt(t),Yt(t),console.log("-----unlockWithSubscription result-----",w),w){try{(p=l.adBreakDone)==null||p.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&&((u=l.adViewed)==null||u.call(l)),(b=(h=D).onEnvConfigChanged)==null||b.call(h,{hostUserInfo:Oe(Q({},(m=D.hostUserInfo)!=null?m:{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 uc=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},a=cc("SUBSCRIPTION");return dc("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Ae,showSubscriptionModal:a,hasSubscription:n}})};var Ye=nc();za(Ye);Qa(Ye);var ti,j,vc,uo,Mt,fc,gc,_c,yc,fo,lo,co,Am,Cr={},bc=[],Sm=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Rr=Array.isArray;function ut(e,t){for(var r in t)e[r]=t[r];return e}function ho(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Or(e,t,r){var n,i,a,o={};for(a in t)a=="key"?n=t[a]:a=="ref"?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?ti.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return Zn(e,o,n,i,null)}function Zn(e,t,r,n,i){var a={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++vc:i,__i:-1,__u:0};return i==null&&j.vnode!=null&&j.vnode(a),a}function It(e){return e.children}function Je(e,t){this.props=e,this.context=t}function Zt(e,t){if(t==null)return e.__?Zt(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"?Zt(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 hc(e){(!e.__d&&(e.__d=!0)&&Mt.push(e)&&!ei.__r++||fc!==j.debounceRendering)&&((fc=j.debounceRendering)||gc)(ei)}function ei(){for(var e,t,r,n,i,a,o,s=1;Mt.length;)Mt.length>s&&Mt.sort(_c),e=Mt.shift(),s=Mt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,a=[],o=[],t.__P&&((r=ut({},n)).__v=n.__v+1,j.vnode&&j.vnode(r),mo(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,a,i==null?Zt(n):i,!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,Ac(a,r,o),r.__e!=i&&wc(r)));ei.__r=0}function Ec(e,t,r,n,i,a,o,s,l,c,p){var u,m,h,b,E,I,w=n&&n.__k||bc,R=t.length;for(l=Cm(r,t,w,l,R),u=0;u<R;u++)(h=r.__k[u])!=null&&(m=h.__i===-1?Cr:w[h.__i]||Cr,h.__i=u,I=mo(e,h,m,i,a,o,s,l,c,p),b=h.__e,h.ref&&m.ref!=h.ref&&(m.ref&&po(m.ref,null,h),p.push(h.ref,h.__c||b,h)),E==null&&b!=null&&(E=b),4&h.__u||m.__k===h.__k?l=Ic(h,l,e):typeof h.type=="function"&&I!==void 0?l=I:b&&(l=b.nextSibling),h.__u&=-7);return r.__e=E,l}function Cm(e,t,r,n,i){var a,o,s,l,c,p=r.length,u=p,m=0;for(e.__k=new Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=a+m,(o=e.__k[a]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Zn(null,o,null,null,null):Rr(o)?Zn(It,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Zn(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(c=o.__i=Rm(o,r,l,u))!==-1&&(u--,(s=r[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&(i>p?m--:i<p&&m++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?m--:c==l+1?m++:(c>l?m--:m++,o.__u|=4))):e.__k[a]=null;if(u)for(a=0;a<p;a++)(s=r[a])!=null&&!(2&s.__u)&&(s.__e==n&&(n=Zt(s)),Cc(s,s));return n}function Ic(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=Ic(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Zt(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function kr(e,t){return t=t||[],e==null||typeof e=="boolean"||(Rr(e)?e.some(function(r){kr(r,t)}):t.push(e)),t}function Rm(e,t,r,n){var i,a,o=e.key,s=e.type,l=t[r];if(l===null&&e.key==null||l&&o==l.key&&s===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(i=r-1,a=r+1;i>=0||a<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&o==l.key&&s===l.type)return i;i--}if(a<t.length){if((l=t[a])&&!(2&l.__u)&&o==l.key&&s===l.type)return a;a++}}return-1}function mc(e,t,r){t[0]=="-"?e.setProperty(t,r==null?"":r):e[t]=r==null?"":typeof r!="number"||Sm.test(t)?r:r+"px"}function Yn(e,t,r,n,i){var a;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||mc(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||mc(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(yc,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=r,r?n?r.t=n.t:(r.t=fo,e.addEventListener(t,a?co:lo,a)):e.removeEventListener(t,a?co:lo,a);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(o){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function pc(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=fo++;else if(t.u<r.t)return;return r(j.event?j.event(t):t)}}}function mo(e,t,r,n,i,a,o,s,l,c){var p,u,m,h,b,E,I,w,R,k,L,J,S,P,F,H,U,M=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),a=[s=t.__e=r.__e]),(p=j.__b)&&p(t);e:if(typeof M=="function")try{if(w=t.props,R="prototype"in M&&M.prototype.render,k=(p=M.contextType)&&n[p.__c],L=p?k?k.props.value:p.__:n,r.__c?I=(u=t.__c=r.__c).__=u.__E:(R?t.__c=u=new M(w,L):(t.__c=u=new Je(w,L),u.constructor=M,u.render=km),k&&k.sub(u),u.props=w,u.state||(u.state={}),u.context=L,u.__n=n,m=u.__d=!0,u.__h=[],u._sb=[]),R&&u.__s==null&&(u.__s=u.state),R&&M.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=ut({},u.__s)),ut(u.__s,M.getDerivedStateFromProps(w,u.__s))),h=u.props,b=u.state,u.__v=t,m)R&&M.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),R&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(R&&M.getDerivedStateFromProps==null&&w!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(w,L),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(w,u.__s,L)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(u.props=w,u.state=u.__s,u.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(G){G&&(G.__=t)}),J=0;J<u._sb.length;J++)u.__h.push(u._sb[J]);u._sb=[],u.__h.length&&o.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(w,u.__s,L),R&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,b,E)})}if(u.context=L,u.props=w,u.__P=e,u.__e=!1,S=j.__r,P=0,R){for(u.state=u.__s,u.__d=!1,S&&S(t),p=u.render(u.props,u.state,u.context),F=0;F<u._sb.length;F++)u.__h.push(u._sb[F]);u._sb=[]}else do u.__d=!1,S&&S(t),p=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++P<25);u.state=u.__s,u.getChildContext!=null&&(n=ut(ut({},n),u.getChildContext())),R&&!m&&u.getSnapshotBeforeUpdate!=null&&(E=u.getSnapshotBeforeUpdate(h,b)),H=p,p!=null&&p.type===It&&p.key==null&&(H=Sc(p.props.children)),s=Ec(e,Rr(H)?H:[H],t,r,n,i,a,o,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&o.push(u),I&&(u.__E=u.__=null)}catch(G){if(t.__v=null,l||a!=null)if(G.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else for(U=a.length;U--;)ho(a[U]);else t.__e=r.__e,t.__k=r.__k;j.__e(G,t,r)}else a==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):s=t.__e=Om(r.__e,t,r,n,i,a,o,l,c);return(p=j.diffed)&&p(t),128&t.__u?void 0:s}function Ac(e,t,r){for(var n=0;n<r.length;n++)po(r[n],r[++n],r[++n]);j.__c&&j.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){j.__e(a,i.__v)}})}function Sc(e){return typeof e!="object"||e==null?e:Rr(e)?e.map(Sc):ut({},e)}function Om(e,t,r,n,i,a,o,s,l){var c,p,u,m,h,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"),a!=null){for(c=0;c<a.length;c++)if((h=a[c])&&"setAttribute"in h==!!R&&(R?h.localName==R:h.nodeType==3)){e=h,a[c]=null;break}}if(e==null){if(R==null)return document.createTextNode(w);e=document.createElementNS(i,R,w.is&&w),s&&(j.__m&&j.__m(t,a),s=!1),a=null}if(R===null)I===w||s&&e.data===w||(e.data=w);else{if(a=a&&ti.call(e.childNodes),I=r.props||Cr,!s&&a!=null)for(I={},c=0;c<e.attributes.length;c++)I[(h=e.attributes[c]).name]=h.value;for(c in I)if(h=I[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=h;else if(!(c in w)){if(c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w)continue;Yn(e,c,null,h,i)}}for(c in w)h=w[c],c=="children"?m=h:c=="dangerouslySetInnerHTML"?p=h:c=="value"?b=h:c=="checked"?E=h:s&&typeof h!="function"||I[c]===h||Yn(e,c,h,I[c],i);if(p)s||u&&(p.__html===u.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(u&&(e.innerHTML=""),Ec(t.type==="template"?e.content:e,Rr(m)?m:[m],t,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,o,a?a[0]:r.__k&&Zt(r,0),s,l),a!=null)for(c=a.length;c--;)ho(a[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])&&Yn(e,c,b,I[c],i),c="checked",E!==void 0&&E!==e[c]&&Yn(e,c,E,I[c],i))}return e}function po(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){j.__e(i,r)}}function Cc(e,t,r){var n,i;if(j.unmount&&j.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||po(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(a){j.__e(a,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Cc(n[i],t,r||typeof e.type!="function");r||ho(e.__e),e.__c=e.__=e.__e=void 0}function km(e,t,r){return this.constructor(e,r)}function Rc(e,t,r){var n,i,a,o;t==document&&(t=document.documentElement),j.__&&j.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,a=[],o=[],mo(t,e=(!n&&r||t).__k=Or(It,null,[e]),i||Cr,Cr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?ti.call(t.childNodes):null,a,!n&&r?r:i?i.__e:t.firstChild,n,o),Ac(a,e,o)}ti=bc.slice,j={__e:function(e,t,r,n){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),o=i.__d),o)return i.__E=i}catch(s){e=s}throw e}},vc=0,uo=function(e){return e!=null&&e.constructor==null},Je.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ut({},this.state),typeof e=="function"&&(e=e(ut({},r),this.props)),e&&ut(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),hc(this))},Je.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),hc(this))},Je.prototype.render=It,Mt=[],gc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_c=function(e,t){return e.__v.__b-t.__v.__b},ei.__r=0,yc=/(PointerCapture)$|Capture$/i,fo=0,lo=pc(!1),co=pc(!0),Am=0;var er,ce,vo,Oc,Tr=0,Uc=[],ue=j,kc=ue.__b,Tc=ue.__r,xc=ue.diffed,Nc=ue.__c,Pc=ue.unmount,Dc=ue.__;function ni(e,t){ue.__h&&ue.__h(ce,e,Tr||t),Tr=0;var r=ce.__H||(ce.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ft(e){return Tr=1,Bc(Mc,e)}function Bc(e,t,r){var n=ni(er++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Mc(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=ce,!ce.__f)){var i=function(s,l,c){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(m){return!!m.__c});if(p.every(function(m){return!m.__N}))return!a||a.call(this,s,l,c);var u=n.__c.props!==s;return p.forEach(function(m){if(m.__N){var h=m.__[0];m.__=m.__N,m.__N=void 0,h!==m.__[0]&&(u=!0)}}),a&&a.call(this,s,l,c)||u};ce.__f=!0;var a=ce.shouldComponentUpdate,o=ce.componentWillUpdate;ce.componentWillUpdate=function(s,l,c){if(this.__e){var p=a;a=void 0,i(s,l,c),a=p}o&&o.call(this,s,l,c)},ce.shouldComponentUpdate=i}return n.__N||n.__}function Gt(e,t){var r=ni(er++,3);!ue.__s&&yo(r.__H,t)&&(r.__=e,r.u=t,ce.__H.__h.push(r))}function _o(e,t){var r=ni(er++,4);!ue.__s&&yo(r.__H,t)&&(r.__=e,r.u=t,ce.__h.push(r))}function ii(e){return Tr=5,xr(function(){return{current:e}},[])}function xr(e,t){var r=ni(er++,7);return yo(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Nr(e,t){return Tr=8,xr(function(){return e},t)}function Tm(){for(var e;e=Uc.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ri),e.__H.__h.forEach(go),e.__H.__h=[]}catch(t){e.__H.__h=[],ue.__e(t,e.__v)}}ue.__b=function(e){ce=null,kc&&kc(e)},ue.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Dc&&Dc(e,t)},ue.__r=function(e){Tc&&Tc(e),er=0;var t=(ce=e.__c).__H;t&&(vo===ce?(t.__h=[],ce.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(ri),t.__h.forEach(go),t.__h=[],er=0)),vo=ce},ue.diffed=function(e){xc&&xc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Uc.push(t)!==1&&Oc===ue.requestAnimationFrame||((Oc=ue.requestAnimationFrame)||xm)(Tm)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),vo=ce=null},ue.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ri),r.__h=r.__h.filter(function(n){return!n.__||go(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ue.__e(n,r.__v)}}),Nc&&Nc(e,t)},ue.unmount=function(e){Pc&&Pc(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ri(n)}catch(i){t=i}}),r.__H=void 0,t&&ue.__e(t,r.__v))};var Lc=typeof requestAnimationFrame=="function";function xm(e){var t,r=function(){clearTimeout(n),Lc&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Lc&&(t=requestAnimationFrame(r))}function ri(e){var t=ce,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),ce=t}function go(e){var t=ce;e.__c=e.__(),ce=t}function yo(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Mc(e,t){return typeof t=="function"?t(e):t}function Pm(e,t){for(var r in t)e[r]=t[r];return e}function Gc(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 Jc(e,t){this.props=e,this.context=t}(Jc.prototype=new Je).isPureReactComponent=!0,Jc.prototype.shouldComponentUpdate=function(e,t){return Gc(this.props,e)||Gc(this.state,t)};var Fc=j.__b;j.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Fc&&Fc(e)};var lS=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Dm=j.__e;j.__e=function(e,t,r,n){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t)}Dm(e,t,r,n)};var jc=j.unmount;function zc(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=Pm({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return zc(n,t,r)})),e}function Qc(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Qc(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 bo(){this.__u=0,this.o=null,this.__b=null}function Xc(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ai(){this.i=null,this.l=null}j.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),jc&&jc(e)},(bo.prototype=new Je).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=Xc(n.__v),a=!1,o=function(){a||(a=!0,r.__R=null,i?i(s):s())};r.__R=o;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=Qc(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(o,o)},bo.prototype.componentWillUnmount=function(){this.o=[]},bo.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]=zc(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&Or(It,null,e.fallback);return i&&(i.__u&=-33),[Or(It,null,t.__a?null:e.children),i]};var Hc=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 Je).__a=function(e){var t=this,r=Xc(t.__v),n=t.l.get(e);return n[0]++,function(i){var a=function(){t.props.revealOrder?(n.push(i),Hc(t,e,n)):i()};r?r(a):a()}},ai.prototype.render=function(e){this.i=null,this.l=new Map;var t=kr(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){Hc(e,r,t)})};var Lm=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Um=/^(?: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]/,Bm=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Mm=/[A-Z0-9]/g,Gm=typeof document!="undefined",Jm=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function oi(e,t,r){return t.__k==null&&(t.textContent=""),Rc(e,t),typeof r=="function"&&r(),e?e.__c:null}Je.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Je.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var qc=j.event;function Fm(){}function jm(){return this.cancelBubble}function Hm(){return this.defaultPrevented}j.event=function(e){return qc&&(e=qc(e)),e.persist=Fm,e.isPropagationStopped=jm,e.isDefaultPrevented=Hm,e.nativeEvent=e};var Yc,qm={enumerable:!1,configurable:!0,get:function(){return this.class}},Vc=j.vnode;j.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={},a=n.indexOf("-")===-1;for(var o in r){var s=r[o];if(!(o==="value"&&"defaultValue"in r&&s==null||Gm&&o==="children"&&n==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in r&&r.value==null?o="value":o==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||Jm(r.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Bm.test(o)&&(o=l):l=o="oninput":a&&Um.test(o)?o=o.replace(Mm,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&i[o=l]&&(o="oninputCapture"),i[o]=s}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=kr(r.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=kr(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",qm)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=Lm,Vc&&Vc(e)};var $c=j.__r;j.__r=function(e){$c&&$c(e),Yc=e.__c};var Kc=j.diffed;j.diffed=function(e){Kc&&Kc(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),Yc=null};var Vm=Object.defineProperty,$m=Object.defineProperties,Km=Object.getOwnPropertyDescriptors,ci=Object.getOwnPropertySymbols,sd=Object.prototype.hasOwnProperty,ld=Object.prototype.propertyIsEnumerable,Zc=(e,t,r)=>t in e?Vm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ht=(e,t)=>{for(var r in t||(t={}))sd.call(t,r)&&Zc(e,r,t[r]);if(ci)for(var r of ci(t))ld.call(t,r)&&Zc(e,r,t[r]);return e},Wm=(e,t)=>$m(e,Km(t)),zm=(e,t)=>{var r={};for(var n in e)sd.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&&ld.call(e,n)&&(r[n]=e[n]);return r},di=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function Qm(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 Ro(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!Qm(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 Ym=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 Zm(e={},t=!1){let r=e,n=[];for(let[i,a]of Object.entries(r))if(a!==void 0&&a instanceof ArrayBuffer&&a.byteLength!==void 0){let o=t?{value:a,key:i}:{base64:Ym(a),key:i};n.push(o),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var cd=Object.defineProperty,ep=Object.getOwnPropertyDescriptor,tp=(e,t)=>{for(var r in t)cd(e,r,{get:t[r],enumerable:!0})},dd=(e,t,r,n)=>{for(var i=n>1?void 0:n?ep(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&cd(t,r,i),i},rp=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);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 np(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var ip=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 rr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function ed(e){return typeof e=="number"&&!isNaN(e)}function ap(e){return typeof e=="undefined"}function op(e){return ap(e)||e===null}function fd(e){return typeof e=="function"}function sp(e){return rr(e)&&fd(e.then)}function hd(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}var lp=(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))(lp||{}),cp=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}},ui=class extends cp{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},dp=class extends ui{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},up=class extends ui{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},fp=class extends ui{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},wo=class extends ui{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function Pr(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var fi={log:Pr("log"),warn:Pr("warn"),info:Pr("info"),error:Pr("error"),debug:Pr("debug")};Object.assign(globalThis,{logger:fi});var td=Symbol.for("Jolibox.canIUseMap"),hp={};globalThis[td]||(globalThis[td]=hp);function mp(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 Oo=Symbol.for("Jolibox.canIUseMap.native"),pp={};globalThis[Oo]||(globalThis[Oo]=pp);var ko={get config(){return globalThis[Oo]}},vp=(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))(vp||{}),gp=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(gp||{}),_p=(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))(_p||{});function yp(){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}}yp();var tr=typeof window=="undefined",bp=()=>!tr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),fS={isiOS:!tr&&(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:!tr&&navigator.userAgent.includes("Android"),isMac:!tr&&navigator.userAgent.includes("Mac"),isFacebook:!tr&&navigator.userAgent.includes("FB_IAB"),isPC:!tr&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},To=class xo{constructor(t){this.element=t,this.next=xo.Undefined,this.prev=xo.Undefined}};To.Undefined=new To(void 0);var se=To,wp=class{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let e=this._first;for(;e!==se.Undefined;){let t=e.next;e.prev=se.Undefined,e.next=se.Undefined,e=t}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new se(e);if(this._first===se.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==se.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==se.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==se.Undefined&&e.next!==se.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===se.Undefined&&e.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):e.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):e.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==se.Undefined;)yield e.element,e=e.next}},Ep=0,Dr=class{constructor(e){this.value=e,this.id=Ep++}},Ur=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,a,o,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,(o=(a=this.options)==null?void 0:a.onDidFirstListener)==null||o.call(a,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var p,u,m,h;if(!this._disposed){if(this._listeners instanceof Dr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||u.call(p));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((h=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||h.call(m)))}}}}),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}},No=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 Ur,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),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 wp,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)}},Po={};tp(Po,{None:()=>Ip,filter:()=>Sp,once:()=>md,toPromise:()=>Ap});var Ip=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Ap(e){return new Promise(t=>md(e)(t))}function md(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Sp(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new Ur(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}var Eo=Symbol.for("Jolibox.hostEmitter"),Cp=()=>{let e=new No;return globalThis[Eo]||(globalThis[Eo]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Eo]},hS=Cp();function Rp(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Op(e[n],t[n])}function Op(e,t){if(ud(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(fd(t)){try{if(e instanceof t)return}catch(r){}if(!op(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 Do=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ur,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 Rp(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}};Do=dd([hd],Do);var rd=class{constructor(){this._onWillExecuteCommand=new Ur,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ur,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Do,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=np(3e4)),this._starActivation}executeCommand(e,...t){return rp(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Po.toPromise(Po.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=dd([hd],rd);var mS=Symbol.for("Jolibox.commands");Fe("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Fe("requestProductDetailsAsync",{version:102e4});Fe("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Fe("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Fe("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Fe("userTrackAsync",{version:1e6});Fe("openMiniapp",{version:1050100});Fe("requestCoinDetailsSync",{version:1070100});Fe("requestCoinDetailsAsync",{version:1070100});Fe("sendServerEventAsync",{version:1070100});Fe("loadAdsAsync",{version:1070200});Fe("showAdAsync",{version:1070200});Fe("onJoliboxHideLoading",{version:1070300});function Fe(e,t){if(ko.config[e]){fi.warn(`[can i use] ${e} already registered`);return}ko.config[e]=ht({},t)}var pd=(e,t)=>{function r(i){var a;let[o,...s]=i.split(":");if(!o)return!1;let l=ko.config[o];if(!l)return!1;let c=(a=t==null?void 0:t())!=null?a:"",p=l.version;if(l.platforms&&c in l.platforms){let m=l.platforms[c];if(m===!1)return!1;typeof m=="number"&&(p=m)}if(typeof p!="number")return!1;let u=e();return typeof u!="number"||u<p?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,a,o){if(!i)return!1;let s=mp(i,a);if(!s)return!1;if(rr(s)){let l=s.version;return ed(l)?typeof o=="number"&&o>=l:!0}return ed(s)?typeof o=="number"&&o>=s:s===!0}return{canIUseNative:r}};function nd(e,t){return`[${e}]:${t}`}var kp=()=>bp(),Lr="custom_event_",Tp=[],xp=[],Np=["env","createRequestTask","login"],vd="__batch_event__",Pp="__native_batch_event__",Dp=e=>e==="pv"?e:"default",li=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:a,type:o}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=a,this.type=Dp(o)}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,a)=>{let o=n.shift();if(o){let s=a[o];r[s]||(r[s]={}),t(r[s],n,i,a)}else r[i]||(r[i]=[]),r[i].push(a[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,a,o)=>{let s=i.shift();if(!s&&rr(o))throw new wo(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(rr(o))l.push(...Object.keys(o));else if(ud(o)){if(i.length>0)throw new wo(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(o)}else throw new wo(`expected metric value to be a string, but got a(n) ${typeof o}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let p=rr(o)?o[c]:o;t(n[c],[...i],a,p)})}else n[a]?n[a]++:n[a]=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={}}},id=!1,Io,Ao,So;function Lp(e,t){id||(Io=new li({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ao=new li({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),So=new li({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Io.flush(),Ao.flush(),So.flush()}),id=!0);function r(i){var a,o;let{method:s,args:l,startTime:c,isForeground:p,errMsg:u=`${s}:fail no errMsg`,errNo:m=0,__timing:h={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:b,invokeCallback:E}=h,I=(o=(a=u.match(/\S:(\S+)\s?/))==null?void 0:a[1])!=null?o:"fail";Io.report({status:I,method:n(s,l),errNo:`${m}`,errMsg:u,isForeground:p,duration:Date.now()-c}),c&&b&&E&&(Ao.report({status:I,method:s,isForeground:p,duration:Number((b-c).toFixed(3))}),So.report({status:I,method:s,isForeground:p,duration:Number((Date.now()-E).toFixed(3))}))}function n(i,a){return(i==="callHostMethod"||i==="callHostMethodSync")&&a!=null&&a.method?`${i}-${a.method}`:i}return r}var Co=[],Up=!1,Lo=Symbol.for("Jolibox.invokeResolverInstance"),Bp=new Map;globalThis[Lo]||(globalThis[Lo]=Bp);var Mp={get resolveMap(){return globalThis[Lo]}};function Gp(e,t){let r=0,n=!0,i=Mp.resolveMap,a=Lp(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Co.forEach(l=>di(this,[l],function*({method:c,args:p,resolve:u}){let m=yield s(c,p);u(m)})),Co.length=0});let o=(l,c)=>{let p=i.get(Number(l));if(!p)return;let u=Ro(c);p(u),i.delete(Number(l))},s=(l,c)=>{var p,u;let m=Date.now(),h=`${n}`;r+=1;let b=new ip;if(i.set(r,b.resolve),!n&&xp.includes(l))return new Promise(L=>{Co.push({method:l,args:c,resolve:L})});let E=Wm(ht({},{method:l,startTime:m,args:c,isForeground:h}),{invokeType:"js-bridge"}),I=!Up&&Tp.includes(l),w=Zm(c,I),R=I?w:JSON.stringify(w),k;if(l.endsWith("Sync")||Np.includes(l)?k=(p=e.call)==null?void 0:p.call(e,l,w,r):typeof R=="string"?k=e.invoke(l,R,r):k=(u=e.call)==null?void 0:u.call(e,l,R,r),k){try{typeof k=="string"&&(k=JSON.parse(k)),k=Ro(k)}catch(L){fi.error(L)}return i.delete(r),k.errorCode&&(k.errorCode=nd(l,k.errorCode)),a(ht(ht({},E),k)),k}return l.endsWith("Sync")&&i.delete(r),b.promise.then(L=>(L.errorCode&&(L.errorCode=nd(l,L.errorCode)),a(ht(ht({},E),L)),L))};return{invokeNative:s,applyNative:(l,c)=>{let p=s(l,c);return sp(p)?p.then(u=>ad(l,u)):ad(l,p)},invokeHandler:o}}function ad(e,t){if(!rr(t)){fi.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:a,errorCode:o}=r,s=zm(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new up(n,i,a,o);return s}var si=Symbol.for("Jolibox.subscribeInstance");function Jp(e){if(globalThis[si])return globalThis[si];let t=new No,r=new No,n=new li({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[si]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,a,o){let s=Ro(a),l;if(s.__extra){l=s.params;let{type:c,startTime:p}=s.__extra;n.report({type:c,event:i,duration:Date.now()-p})}else l=s;if(i===vd){l.forEach(c=>{let[p,u]=c;try{r.emit(p.slice(Lr.length),u,o)}catch(m){}});return}if(i.startsWith(Lr)){r.emit(i.slice(Lr.length),l,o);return}t.emit(i,l,o)}},globalThis[si]}function Fp(e){let t=new Map,r=new Map,n,i;return{publish:(a,o,s,l)=>{if(l){let p=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Lr}${a}`,o,p);return}n||(n=Promise.resolve().then(()=>{t.forEach((p,u)=>{try{let m=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(vd,p,m)}catch(m){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Lr}${a}`,o])},emitNative:(a,o,s,l)=>{if(l){let p=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(a,o,p),console.log("emitNative",a,o,p);return}i||(i=Promise.resolve().then(()=>{r.forEach((p,u)=>{try{let m=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(Pp,p,m)}catch(m){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([a,o])}}}function jp(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:a}=Jp(e),{invokeNative:o,invokeHandler:s,applyNative:l}=Gp(e,r),{publish:c,emitNative:p}=Fp(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:o,onNative:r,offNative:n,emitNative:p,publish:c,subscribe:i,unsubscribe:a}}function gd(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Uo,At={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){At.trigger=e},onDoExit(e){At.exit=e},onDoBackPress(e){At.backPress=e}},_d=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new dp("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="")=>{At.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>di(void 0,null,function*(){let a=yield At.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:a})});Uo={onDocumentReady:t,doExit:r,invoke(i,a,o){e.invoke.postMessage({event:i,paramsString:a,callbackId:o})},publish(i,a,o){let s=gd(a,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:o}))},call(i,a,o){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(a),callbackId:o}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:_d,doExit:r};globalThis.joliboxJSCore=ht({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(a="")=>{At.trigger(),t.onDocumentReady(JSON.stringify({path:a}))},n=a=>di(void 0,null,function*(){let o=yield At.exit();t.doExit(JSON.stringify({uuid:a,shouldInterrupt:o}))});Uo={onDocumentReady:r,invoke(a,o,s){t.invoke(JSON.stringify({event:a,paramsString:o,callbackId:s}))},doExit:n,publish(a,o,s){let l=gd(o,"joliboxJSCore");t.publish(JSON.stringify({event:a,paramsString:JSON.stringify(l),webviewIds:s}))},call(a,o,s){let l=window.prompt("invoke",JSON.stringify({event:a,paramsString:JSON.stringify(o),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(a){return di(this,null,function*(){let o=yield At.backPress();t.doBackPress(JSON.stringify({uuid:a,shouldInterrupt:o}))})}};let i={onDocumentReady:r,env:_d,doExit:n};globalThis.joliboxJSCore=ht({},i)}var yd=Uo;if(!yd&&kp())throw new fp("No joliboxJScore is found, native bridge not found.");var Hp=ht({},yd),bd=jp(Hp),{invokeHandler:od}=bd,{applyNative:pS,invokeNative:hi,onNative:wd,offNative:Ed,subscribeHandler:qp,publish:vS,emitNative:gS,subscribe:_S,unsubscribe:yS}=bd;globalThis.joliboxJSBridge={callHandler:od,invokeHandler:od,subscribeHandler:qp};var Vp=Object.defineProperty,$p=Object.defineProperties,Kp=Object.getOwnPropertyDescriptors,Ii=Object.getOwnPropertySymbols,Wd=Object.prototype.hasOwnProperty,zd=Object.prototype.propertyIsEnumerable,Id=(e,t,r)=>t in e?Vp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Qd=(e,t)=>{for(var r in t||(t={}))Wd.call(t,r)&&Id(e,r,t[r]);if(Ii)for(var r of Ii(t))zd.call(t,r)&&Id(e,r,t[r]);return e},Wp=(e,t)=>$p(e,Kp(t)),zp=(e,t)=>{var r={};for(var n in e)Wd.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ii)for(var n of Ii(e))t.indexOf(n)<0&&zd.call(e,n)&&(r[n]=e[n]);return r},Xd=Object.defineProperty,Qp=Object.defineProperties,Xp=Object.getOwnPropertyDescriptors,Ad=Object.getOwnPropertySymbols,Yp=Object.prototype.hasOwnProperty,Zp=Object.prototype.propertyIsEnumerable,Sd=(e,t,r)=>t in e?Xd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ev=(e,t)=>{for(var r in t||(t={}))Yp.call(t,r)&&Sd(e,r,t[r]);if(Ad)for(var r of Ad(t))Zp.call(t,r)&&Sd(e,r,t[r]);return e},tv=(e,t)=>Qp(e,Xp(t)),rv=(e,t)=>{for(var r in t)Xd(e,r,{get:t[r],enumerable:!0})},Yd=(e,t,r,n)=>{for(var i=t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},nv=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);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 iv(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function av(e){return typeof e=="string"}function ov(e){return typeof e=="undefined"}function sv(e){return ov(e)||e===null}function lv(e){return typeof e=="function"}function Zd(e){let t=e,r=null,n=function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}var cv=(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))(cv||{});function Br(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var dv={log:Br("log"),warn:Br("warn"),info:Br("info"),error:Br("error"),debug:Br("debug")};Object.assign(globalThis,{logger:dv});var Cd=Symbol.for("Jolibox.canIUseMap"),uv={};globalThis[Cd]||(globalThis[Cd]=uv);var Rd=Symbol.for("Jolibox.canIUseMap.native"),fv={};globalThis[Rd]||(globalThis[Rd]=fv);var eu=(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))(eu||{}),tu=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(tu||{}),ru=(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))(ru||{}),Od=["name","params"],hv=["name","type","location","target","extra","timestamp","userId"],mv=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function gi(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,a)=>(i[a]=String(n[a]),i),{})}return e[r]})}function pv(e){let t=e.location?gi(e.location,Od):null,r=e.target?gi(e.target,Od):null;return gi(tv(ev({},e),{location:t,target:r}),hv)}function vv(e){let t=e.events.map(n=>pv(n)),r=gi(e.device,mv);return[e.protocolVersion,t,r,e.project]}function gv(){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}}gv();var ar=typeof window=="undefined",Ho=()=>!ar&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!ar&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!ar&&navigator.userAgent.includes("Android"),!ar&&navigator.userAgent.includes("Mac"),!ar&&navigator.userAgent.includes("FB_IAB"),!ar&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var qo=class Vo{constructor(t){this.element=t,this.next=Vo.Undefined,this.prev=Vo.Undefined}};qo.Undefined=new qo(void 0);var le=qo,_v=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}},yv=0,Mr=class{constructor(e){this.value=e,this.id=yv++}},Hr=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 Mr&&(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,a,o,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new Mr(e);return this._listeners?this._listeners instanceof Mr?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,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(s=(o=this.options)==null?void 0:o.onDidAddListener)==null||s.call(o,this),this._size++,()=>{var c,p,u,m;if(!this._disposed){if(this._listeners instanceof Mr)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(p=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||p.call(c));else if(this._listeners){let h=this._listeners.indexOf(l);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((m=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||m.call(u)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Mr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},bv=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 Hr,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),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),a=1;a<n;a++)i[a-1]=arguments[a];r||(r=new _v,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)}},$o={};rv($o,{None:()=>wv,filter:()=>Iv,once:()=>nu,toPromise:()=>Ev});var wv=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Ev(e){return new Promise(t=>nu(e)(t))}function nu(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 Iv(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Hr(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 Bo=Symbol.for("Jolibox.hostEmitter"),Av=()=>{let e=new bv;return globalThis[Bo]||(globalThis[Bo]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Bo]};Av();function Sv(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Cv(e[n],t[n])}function Cv(e,t){if(av(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(lv(t)){try{if(e instanceof t)return}catch(r){}if(!sv(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 Ko=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Hr,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,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Sv(a,r),n(...a)}}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}};Ko=Yd([Zd],Ko);var kd=class{constructor(){this._onWillExecuteCommand=new Hr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Hr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ko,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=iv(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 nv(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),$o.toPromise($o.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 a=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),a}_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{}}};kd=Yd([Zd],kd);function De(e,t,r){return(t=Rv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rv(e){var t=Ov(e,"string");return typeof t=="symbol"?t:t+""}function Ov(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 nr=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")},Wo=class{constructor(t){De(this,"context",void 0),De(this,"continueCallback",void 0),De(this,"adIsShowingCallback",void 0),De(this,"isBeforeAdCalled",!1),De(this,"isBeforeRewardCalled",!1),De(this,"isAdDismissedCalled",!1),De(this,"isAdViewedCalled",!1),De(this,"isAfterAdCalled",!1),De(this,"currentProvider",void 0),De(this,"currentClientParams",void 0),De(this,"adsHasResponse",!1),De(this,"videoChecker",window.document.createElement("video")),De(this,"contextInfo",void 0),De(this,"wrapShowAdFn",r=>()=>{var n,i,a;this.adsHasResponse=!0;let o=!1;this.videoChecker.play().catch(()=>{o=!1}),o=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:o},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",Qd({userEvent:o},this.paramsToTrack)),Ho()&&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}),(a=this.adIsShowingCallback)==null||a.call(this,!0);let s=nr(r);s==null||s()}),this.context=t,this.contextInfo=t.getContextInfo()}notifyIframeAdsEvent(t,r){window.parent&&window.parent.postMessage({type:t,data:r},"*"),window.dispatchEvent(new CustomEvent(t,{detail:r}))}get paramsToTrack(){var t,r,n,i,a,o;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:(o=(a=this.currentClientParams)==null?void 0:a.name)!=null?o:""}}wrapBeforeAd(t){return()=>{var r,n,i,a;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 o=nr(t);o==null||o(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),Ho()&&this.context.track("mmp_ad_impression",{ad_network:(a=(i=this.currentProvider)==null?void 0:i.name)!=null?a:"",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=nr(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=nr(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=nr(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,a,o,s,l,c,p,u;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(a=r.breakName)!=null?a:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(o=this.currentProvider)==null?void 0:o.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 m=nr(t);m==null||m(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(p=this.continueCallback)==null||p.call(this,[!1,r]);break}default:{(u=this.continueCallback)==null||u.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(a=>{this.continueCallback=a,this.adIsShowingCallback=i;let o;switch(r.type){case"preroll":{o={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{o={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:{o={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,p,u,m,h;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:(p=(c=this.currentProvider)==null?void 0:c.name)!=null?p:null}),(m=this.continueCallback)==null||m.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(u=r.name)!=null?u:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(h=this.adIsShowingCallback)==null||h.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),t.adBreak(o,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};function mi(e,t,r){return(t=kv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kv(e){var t=Tv(e,"string");return typeof t=="symbol"?t:t+""}function Tv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var zo=class{constructor(t){mi(this,"context",void 0),mi(this,"adBreakIsShowing",!1),mi(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),mi(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 pi(e,t,r){return(t=xv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xv(e){var t=Nv(e,"string");return typeof t=="symbol"?t:t+""}function Nv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Qo=class{constructor(t){pi(this,"configs",null),pi(this,"firstRun",!0),pi(this,"context",void 0),pi(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:"",a=this.configs[i],o=(r=a==null?void 0:a.interstitialRate)!=null?r:1;n=Math.random()<o}return this.firstRun=!1,n}};function mt(e,t,r){return(t=Pv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pv(e){var t=Dv(e,"string");return typeof t=="symbol"?t:t+""}function Dv(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 Xo=class{constructor(t,r){mt(this,"name","ADSENSE"),mt(this,"context",void 0),mt(this,"contextInfo",void 0),mt(this,"configured",!1),mt(this,"initParams",void 0),mt(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),mt(this,"adConfig",n=>{let i=n,{onReady:a}=i,o=zp(i,["onReady"]);this.context.track("CallAdConfig",o),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),mt(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),mt(this,"adUnit",n=>A(this,null,function*(){var i,a,o,s;if(this.context.track("CallAdUnit",{adFormat:(a=(i=n.adFormat)==null?void 0:i.toString())!=null?a:null,fullWidthResponsive:(o=n.fullWidthResponsive)!=null?o:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:p,fullWidthResponsive:u,style:m}=n,h;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?h=document.querySelector(l):h=l,!h)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 p=="object"&&Array.isArray(p)?p.join(", "):p,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),u&&I.setAttribute("data-full-width-responsive",u),m&&I.setAttribute("style",m),(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",h.appendChild(I),I.appendChild(w)}else h.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 Lv(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 Uv(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 Bv=function(){function e(r){var n=this;this._insertTag=function(i){var a;n.tags.length===0?n.insertionPoint?a=n.insertionPoint.nextSibling:n.prepend?a=n.container.firstChild:a=n.before:a=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,a),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(Uv(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=Lv(n);try{i.insertRule(r,i.cssRules.length)}catch(a){}}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}(),Ce="-ms-",Ai="-moz-",Y="-webkit-",iu="comm",vs="rule",gs="decl",Mv="@import",au="@keyframes",Gv="@layer",Jv=Math.abs,Ti=String.fromCharCode,Fv=Object.assign;function jv(e,t){return ye(e,0)^45?(((t<<2^ye(e,0))<<2^ye(e,1))<<2^ye(e,2))<<2^ye(e,3):0}function ou(e){return e.trim()}function Hv(e,t){return(e=t.exec(e))?e[0]:e}function Z(e,t,r){return e.replace(t,r)}function Yo(e,t){return e.indexOf(t)}function ye(e,t){return e.charCodeAt(t)|0}function qr(e,t,r){return e.slice(t,r)}function Ze(e){return e.length}function _s(e){return e.length}function vi(e,t){return t.push(e),e}function qv(e,t){return e.map(t).join("")}var xi=1,lr=1,su=0,Ue=0,pe=0,cr="";function Ni(e,t,r,n,i,a,o){return{value:e,root:t,parent:r,type:n,props:i,children:a,line:xi,column:lr,length:o,return:""}}function Gr(e,t){return Fv(Ni("",null,null,"",null,null,0),e,{length:-e.length},t)}function Vv(){return pe}function $v(){return pe=Ue>0?ye(cr,--Ue):0,lr--,pe===10&&(lr=1,xi--),pe}function He(){return pe=Ue<su?ye(cr,Ue++):0,lr++,pe===10&&(lr=1,xi++),pe}function et(){return ye(cr,Ue)}function _i(){return Ue}function Kr(e,t){return qr(cr,e,t)}function Vr(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 lu(e){return xi=lr=1,su=Ze(cr=e),Ue=0,[]}function cu(e){return cr="",e}function yi(e){return ou(Kr(Ue-1,Zo(e===91?e+2:e===40?e+1:e)))}function Kv(e){for(;(pe=et())&&pe<33;)He();return Vr(e)>2||Vr(pe)>3?"":" "}function Wv(e,t){for(;--t&&He()&&!(pe<48||pe>102||pe>57&&pe<65||pe>70&&pe<97););return Kr(e,_i()+(t<6&&et()==32&&He()==32))}function Zo(e){for(;He();)switch(pe){case e:return Ue;case 34:case 39:e!==34&&e!==39&&Zo(pe);break;case 40:e===41&&Zo(e);break;case 92:He();break}return Ue}function zv(e,t){for(;He()&&e+pe!==57&&!(e+pe===84&&et()===47););return"/*"+Kr(t,Ue-1)+"*"+Ti(e===47?e:He())}function Qv(e){for(;!Vr(et());)He();return Kr(e,Ue)}function Xv(e){return cu(bi("",null,null,null,[""],e=lu(e),0,[0],e))}function bi(e,t,r,n,i,a,o,s,l){for(var c=0,p=0,u=o,m=0,h=0,b=0,E=1,I=1,w=1,R=0,k="",L=i,J=a,S=n,P=k;I;)switch(b=R,R=He()){case 40:if(b!=108&&ye(P,u-1)==58){Yo(P+=Z(yi(R),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:P+=yi(R);break;case 9:case 10:case 13:case 32:P+=Kv(b);break;case 92:P+=Wv(_i()-1,7);continue;case 47:switch(et()){case 42:case 47:vi(Yv(zv(He(),_i()),t,r),l);break;default:P+="/"}break;case 123*E:s[c++]=Ze(P)*w;case 125*E:case 59:case 0:switch(R){case 0:case 125:I=0;case 59+p:w==-1&&(P=Z(P,/\f/g,"")),h>0&&Ze(P)-u&&vi(h>32?xd(P+";",n,r,u-1):xd(Z(P," ","")+";",n,r,u-2),l);break;case 59:P+=";";default:if(vi(S=Td(P,t,r,c,p,i,s,k,L=[],J=[],u),a),R===123)if(p===0)bi(P,t,S,S,L,a,u,s,J);else switch(m===99&&ye(P,3)===110?100:m){case 100:case 108:case 109:case 115:bi(e,S,S,n&&vi(Td(e,S,S,0,0,i,s,k,i,L=[],u),J),i,J,u,s,n?L:J);break;default:bi(P,S,S,S,[""],J,0,s,J)}}c=p=h=0,E=w=1,k=P="",u=o;break;case 58:u=1+Ze(P),h=b;default:if(E<1){if(R==123)--E;else if(R==125&&E++==0&&$v()==125)continue}switch(P+=Ti(R),R*E){case 38:w=p>0?1:(P+="\f",-1);break;case 44:s[c++]=(Ze(P)-1)*w,w=1;break;case 64:et()===45&&(P+=yi(He())),m=et(),p=u=Ze(k=P+=Qv(_i())),R++;break;case 45:b===45&&Ze(P)==2&&(E=0)}}return a}function Td(e,t,r,n,i,a,o,s,l,c,p){for(var u=i-1,m=i===0?a:[""],h=_s(m),b=0,E=0,I=0;b<n;++b)for(var w=0,R=qr(e,u+1,u=Jv(E=o[b])),k=e;w<h;++w)(k=ou(E>0?m[w]+" "+R:Z(R,/&\f/g,m[w])))&&(l[I++]=k);return Ni(e,t,r,i===0?vs:s,l,c,p)}function Yv(e,t,r){return Ni(e,t,r,iu,Ti(Vv()),qr(e,2,-2),0)}function xd(e,t,r,n){return Ni(e,t,r,gs,qr(e,0,n),qr(e,n+1,-1),n)}function sr(e,t){for(var r="",n=_s(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function Zv(e,t,r,n){switch(e.type){case Gv:if(e.children.length)break;case Mv:case gs:return e.return=e.return||e.value;case iu:return"";case au:return e.return=e.value+"{"+sr(e.children,n)+"}";case vs:e.value=e.props.join(",")}return Ze(r=sr(e.children,n))?e.return=e.value+"{"+r+"}":""}function eg(e){var t=_s(e);return function(r,n,i,a){for(var o="",s=0;s<t;s++)o+=e[s](r,n,i,a)||"";return o}}function tg(e){return function(t){t.root||(t=t.return)&&e(t)}}function rg(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var ng=function(e,t,r){for(var n=0,i=0;n=i,i=et(),n===38&&i===12&&(t[r]=1),!Vr(i);)He();return Kr(e,Ue)},ig=function(e,t){var r=-1,n=44;do switch(Vr(n)){case 0:n===38&&et()===12&&(t[r]=1),e[r]+=ng(Ue-1,t,r);break;case 2:e[r]+=yi(n);break;case 4:if(n===44){e[++r]=et()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Ti(n)}while(n=He());return e},ag=function(e,t){return cu(ig(lu(e),t))},Nd=new WeakMap,og=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&&!Nd.get(r))&&!n){Nd.set(e,!0);for(var i=[],a=ag(t,i),o=r.props,s=0,l=0;s<a.length;s++)for(var c=0;c<o.length;c++,l++)e.props[l]=i[s]?a[s].replace(/&\f/g,o[c]):o[c]+" "+a[s]}}},sg=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function du(e,t){switch(jv(e,t)){case 5103:return Y+"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 Y+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Y+e+Ai+e+Ce+e+e;case 6828:case 4268:return Y+e+Ce+e+e;case 6165:return Y+e+Ce+"flex-"+e+e;case 5187:return Y+e+Z(e,/(\w+).+(:[^]+)/,Y+"box-$1$2"+Ce+"flex-$1$2")+e;case 5443:return Y+e+Ce+"flex-item-"+Z(e,/flex-|-self/,"")+e;case 4675:return Y+e+Ce+"flex-line-pack"+Z(e,/align-content|flex-|-self/,"")+e;case 5548:return Y+e+Ce+Z(e,"shrink","negative")+e;case 5292:return Y+e+Ce+Z(e,"basis","preferred-size")+e;case 6060:return Y+"box-"+Z(e,"-grow","")+Y+e+Ce+Z(e,"grow","positive")+e;case 4554:return Y+Z(e,/([^-])(transform)/g,"$1"+Y+"$2")+e;case 6187:return Z(Z(Z(e,/(zoom-|grab)/,Y+"$1"),/(image-set)/,Y+"$1"),e,"")+e;case 5495:case 3959:return Z(e,/(image-set\([^]*)/,Y+"$1$`$1");case 4968:return Z(Z(e,/(.+:)(flex-)?(.*)/,Y+"box-pack:$3"+Ce+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Y+e+e;case 4095:case 3583:case 4068:case 2532:return Z(e,/(.+)-inline(.+)/,Y+"$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(Ze(e)-1-t>6)switch(ye(e,t+1)){case 109:if(ye(e,t+4)!==45)break;case 102:return Z(e,/(.+:)(.+)-([^]+)/,"$1"+Y+"$2-$3$1"+Ai+(ye(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Yo(e,"stretch")?du(Z(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(ye(e,t+1)!==115)break;case 6444:switch(ye(e,Ze(e)-3-(~Yo(e,"!important")&&10))){case 107:return Z(e,":",":"+Y)+e;case 101:return Z(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Y+(ye(e,14)===45?"inline-":"")+"box$3$1"+Y+"$2$3$1"+Ce+"$2box$3")+e}break;case 5936:switch(ye(e,t+11)){case 114:return Y+e+Ce+Z(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Y+e+Ce+Z(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Y+e+Ce+Z(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Y+e+Ce+e+e}return e}var lg=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case gs:e.return=du(e.value,e.length);break;case au:return sr([Gr(e,{value:Z(e.value,"@","@"+Y)})],n);case vs:if(e.length)return qv(e.props,function(i){switch(Hv(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return sr([Gr(e,{props:[Z(i,/:(read-\w+)/,":"+Ai+"$1")]})],n);case"::placeholder":return sr([Gr(e,{props:[Z(i,/:(plac\w+)/,":"+Y+"input-$1")]}),Gr(e,{props:[Z(i,/:(plac\w+)/,":"+Ai+"$1")]}),Gr(e,{props:[Z(i,/:(plac\w+)/,Ce+"input-$1")]})],n)}return""})}},cg=[lg],dg=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||cg,i={},a,o=[];a=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;o.push(b)});var s,l=[og,sg];{var c,p=[Zv,tg(function(b){c.insert(b)})],u=eg(l.concat(n,p)),m=function(b){return sr(Xv(b),u)};s=function(b,E,I,w){c=I,m(b?b+"{"+E.styles+"}":E.styles),w&&(h.inserted[E.name]=!0)}}var h={key:t,sheet:new Bv({key:t,container:a,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:s};return h.sheet.hydrate(o),h};function ug(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 fg={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},hg=/[A-Z]|^ms/g,mg=/_EMO_([^_]+?)_([^]*?)_EMO_/g,uu=function(e){return e.charCodeAt(1)===45},Pd=function(e){return e!=null&&typeof e!="boolean"},Mo=rg(function(e){return uu(e)?e:e.replace(hg,"-$&").toLowerCase()}),Dd=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(mg,function(r,n,i){return St={name:n,styles:i,next:St},n})}return fg[e]!==1&&!uu(e)&&typeof t=="number"&&t!==0?t+"px":t};function Si(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 St={name:i.name,styles:i.styles,next:St},i.name;var a=r;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)St={name:o.name,styles:o.styles,next:St},o=o.next;var s=a.styles+";";return s}return pg(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function pg(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Si(e,t,r[i])+";";else for(var a in r){var o=r[a];if(typeof o!="object"){var s=o;t!=null&&t[s]!==void 0?n+=a+"{"+t[s]+"}":Pd(s)&&(n+=Mo(a)+":"+Dd(a,s)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(t==null||t[o[0]]===void 0))for(var l=0;l<o.length;l++)Pd(o[l])&&(n+=Mo(a)+":"+Dd(a,o[l])+";");else{var c=Si(e,t,o);switch(a){case"animation":case"animationName":{n+=Mo(a)+":"+c+";";break}default:n+=a+"{"+c+"}"}}}return n}var Ld=/label:\s*([^\s;{]+)\s*(;|$)/g,St;function Go(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="";St=void 0;var a=e[0];if(a==null||a.raw===void 0)n=!1,i+=Si(r,t,a);else{var o=a;i+=o[0]}for(var s=1;s<e.length;s++)if(i+=Si(r,t,e[s]),n){var l=a;i+=l[s]}Ld.lastIndex=0;for(var c="",p;(p=Ld.exec(i))!==null;)c+="-"+p[1];var u=ug(i)+c;return{name:u,styles:i,next:St}}function fu(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}var vg=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},gg=function(e,t,r){vg(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 Ud(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function Bd(e,t,r){var n=[],i=fu(e,n,r);return n.length<2?r:i+t(n)}var _g=function(e){var t=dg(e);t.sheet.speedy=function(o){this.isSpeedy=o},t.compat=!0;var r=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var c=Go(s,t.registered,void 0);return gg(t,c),t.key+"-"+c.name},n=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var c=Go(s,t.registered),p="animation-"+c.name;return Ud(t,{name:c.name,styles:"@keyframes "+p+"{"+c.styles+"}"}),p},i=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var c=Go(s,t.registered);Ud(t,c)},a=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return Bd(t.registered,r,yg(s))};return{css:r,cx:a,injectGlobal:i,keyframes:n,hydrate:function(o){o.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:fu.bind(null,t.registered),merge:Bd.bind(null,t.registered,r)}},yg=function e(t){for(var r="",n=0;n<t.length;n++){var i=t[n];if(i!=null){var a=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))a=e(i);else{a="";for(var o in i)i[o]&&o&&(a&&(a+=" "),a+=o)}break}default:a=i}a&&(r&&(r+=" "),r+=a)}}return r},bg=_g({key:"css"}),Re=bg.css,es,je,Jo,Md,Gd=0,hu=[],ve=j,Jd=ve.__b,Fd=ve.__r,jd=ve.diffed,Hd=ve.__c,qd=ve.unmount,Vd=ve.__;function wg(e,t){ve.__h&&ve.__h(je,e,Gd||t),Gd=0;var r=je.__H||(je.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function mu(e,t){var r=wg(es++,7);return Ag(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Eg(){for(var e;e=hu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wi),e.__H.__h.forEach(ts),e.__H.__h=[]}catch(t){e.__H.__h=[],ve.__e(t,e.__v)}}ve.__b=function(e){je=null,Jd&&Jd(e)},ve.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Vd&&Vd(e,t)},ve.__r=function(e){Fd&&Fd(e),es=0;var t=(je=e.__c).__H;t&&(Jo===je?(t.__h=[],je.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(wi),t.__h.forEach(ts),t.__h=[],es=0)),Jo=je},ve.diffed=function(e){jd&&jd(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(hu.push(t)!==1&&Md===ve.requestAnimationFrame||((Md=ve.requestAnimationFrame)||Ig)(Eg)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Jo=je=null},ve.__c=function(e,t){t.some(function(r){try{r.__h.forEach(wi),r.__h=r.__h.filter(function(n){return!n.__||ts(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ve.__e(n,r.__v)}}),Hd&&Hd(e,t)},ve.unmount=function(e){qd&&qd(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{wi(n)}catch(i){t=i}}),r.__H=void 0,t&&ve.__e(t,r.__v))};var $d=typeof requestAnimationFrame=="function";function Ig(e){var t,r=function(){clearTimeout(n),$d&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);$d&&(t=requestAnimationFrame(r))}function wi(e){var t=je,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),je=t}function ts(e){var t=je;e.__c=e.__(),je=t}function Ag(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var Sg=Symbol.for("preact-signals");function Pi(){if(Ct>1)Ct--;else{for(var e,t=!1;Fr!==void 0;){var r=Fr;for(Fr=void 0,rs++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&vu(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(rs=0,Ct--,t)throw e}}function be(e){if(Ct>0)return e();Ct++;try{return e()}finally{Pi()}}var ie=void 0,Fr=void 0,Ct=0,rs=0,Ci=0;function pu(e){if(ie!==void 0){var t=e.n;if(t===void 0||t.t!==ie)return t={i:0,S:e,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:t},ie.s!==void 0&&(ie.s.n=t),ie.s=t,e.n=t,32&ie.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=ie.s,t.n=void 0,ie.s.n=t,ie.s=t),t}}function we(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}we.prototype.brand=Sg;we.prototype.h=function(){return!0};we.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)};we.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)}};we.prototype.subscribe=function(e){var t=this;return zr(function(){var r=t.value,n=ie;ie=void 0;try{e(r)}finally{ie=n}})};we.prototype.valueOf=function(){return this.value};we.prototype.toString=function(){return this.value+""};we.prototype.toJSON=function(){return this.value};we.prototype.peek=function(){var e=ie;ie=void 0;try{return this.value}finally{ie=e}};Object.defineProperty(we.prototype,"value",{get:function(){var e=pu(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(rs>100)throw new Error("Cycle detected");this.v=e,this.i++,Ci++,Ct++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Pi()}}}});function z(e){return new we(e)}function vu(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 gu(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 _u(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 dr(e){we.call(this,void 0),this.x=e,this.s=void 0,this.g=Ci-1,this.f=4}(dr.prototype=new we).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ci))return!0;if(this.g=Ci,this.f|=1,this.i>0&&!vu(this))return this.f&=-2,!0;var e=ie;try{gu(this),ie=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 ie=e,_u(this),this.f&=-2,!0};dr.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)}we.prototype.S.call(this,e)};dr.prototype.U=function(e){if(this.t!==void 0&&(we.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)}};dr.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(dr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=pu(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function jr(e){return new dr(e)}function yu(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Ct++;var r=ie;ie=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,ys(e),n}finally{ie=r,Pi()}}}function ys(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,yu(e)}function Cg(e){if(ie!==this)throw new Error("Out-of-order effect");_u(this),ie=e,this.f&=-2,8&this.f&&ys(this),Pi()}function Wr(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Wr.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()}};Wr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,yu(this),gu(this),Ct++;var e=ie;return ie=this,Cg.bind(this,e)};Wr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Fr,Fr=this)};Wr.prototype.d=function(){this.f|=8,1&this.f||ys(this)};function zr(e){var t=new Wr(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var bu,Fo,wu=[];zr(function(){bu=this.N})();function ur(e,t){j[e]=t.bind(null,j[e]||function(){})}function Ri(e){Fo&&Fo(),Fo=e&&e.S()}function Eu(e){var t=this,r=e.data,n=Iu(r);n.value=r;var i=mu(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=jr(function(){var h=n.value.value;return h===0?0:h===!0?"":h||""}),p=jr(function(){return!Array.isArray(c.value)&&!uo(c.value)}),u=zr(function(){if(this.N=Au,p.value){var h=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=h)}}),m=t.__$u.d;return t.__$u.d=function(){u(),m.call(this)},[p,c]},[]),a=i[0],o=i[1];return a.value?o.peek():o.value}Eu.displayName="_st";Object.defineProperties(we.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Eu},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});ur("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var a=n[i];a instanceof we&&(r||(t.__np=r={}),r[i]=a,n[i]=a.peek())}}e(t)});ur("__r",function(e,t){Ri();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var a;return zr(function(){a=this}),a.c=function(){n.__$f|=1,n.setState({})},a}())),Ri(r),e(t)});ur("__e",function(e,t,r,n){Ri(),e(t,r,n)});ur("diffed",function(e,t){Ri();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var a=r.U;if(a)for(var o in a){var s=a[o];s!==void 0&&!(o in n)&&(s.d(),a[o]=void 0)}else a={},r.U=a;for(var l in n){var c=a[l],p=n[l];c===void 0?(c=Rg(r,l,p,i),a[l]=c):c.o(p,i)}}}e(t)});function Rg(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,a=z(r);return{o:function(o,s){a.value=o,n=s},d:zr(function(){this.N=Au;var o=a.value.value;n[t]!==o&&(n[t]=o,i?e[t]=o:o?e.setAttribute(t,o):e.removeAttribute(t))})}}ur("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 a=n[i];a&&a.d()}}}}else{var o=t.__c;if(o){var s=o.__$u;s&&(o.__$u=void 0,s.d())}}e(t)});ur("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Je.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 a=2&this.__$f;if(!(n||a||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Iu(e){return mu(function(){return z(e)},[])}var Og=function(e){queueMicrotask(function(){queueMicrotask(e)})};function kg(){be(function(){for(var e;e=wu.shift();)bu.call(e)})}function Au(){wu.push(this)===1&&(j.requestAnimationFrame||Og)(kg)}var ge=Re`
9
+ -----END PUBLIC KEY-----`});function sl(t){let e="",r=new Uint8Array(t),n=r.byteLength;for(let a=0;a<n;a++)e+=String.fromCharCode(r[a]);return window.btoa(e)}function qf(t){let e="-----BEGIN PUBLIC KEY-----",n=t.substring(t.indexOf(e)+e.length,t.indexOf("-----END PUBLIC KEY-----")).replace(/\s+/g,""),a=window.atob(n),i=new Uint8Array(a.length);for(let o=0;o<a.length;o++)i[o]=a.charCodeAt(o);return i.buffer}function ll(t){return E(this,null,function*(){let e=window.crypto,r=e.subtle,n=qf(il),a=yield r.importKey("spki",n,{name:"RSA-OAEP",hash:"SHA-1"},!1,["encrypt"]),i=e.getRandomValues(new Uint8Array(32)),o=yield r.importKey("raw",i,"AES-GCM",!1,["encrypt"]),s=yield r.encrypt({name:"RSA-OAEP"},a,i),l=sl(s),g={timestamp:Date.now(),data:t},p=new TextEncoder().encode(JSON.stringify(g)),h=e.getRandomValues(new Uint8Array(12)),b=yield r.encrypt({name:"AES-GCM",iv:h,tagLength:128},o,p),I=new Uint8Array(b),S=new Uint8Array(h.length+I.length);S.set(h,0),S.set(I,h.length);let w=sl(S.buffer);return{k:l,v:"1.0",payload:w}})}var cl=re(()=>{"use strict";ol()});var sn,dl=re(()=>{"use strict";fe();al();qt();cl();sn=class extends on{constructor(r,n,a){super(n,a);this.httpClient=Ve.create();this.gameId=D.mpId,this.sessionId=D.sessionId,this.track=r}reporter(r){return E(this,null,function*(){let{event:n,params:a,extraParams:i}=r,o={eventType:n,gameInfo:X({gameId:this.gameId,sessionId:this.sessionId},a)};i&&Object.assign(o,i);try{let s=yield ll(o);yield this.httpClient.post("/api/base/app-event/v2",{data:s})}catch(s){yield this.httpClient.post("/api/base/app-event",{data:o})}})}tracker(r,n=null){this.track(r,n)}}});var ul,Vf,ge,$f,mi,$e,it=re(()=>{"use strict";nl();K();K();di();hi();dl();fe();ci();ul=Ee(),Vf={type:Ht.WebSDK,platform:"h5",jssdk_version:D.sdkInfo.jssdkVersion,mp_id:D.mpId,mp_version:D.mpVersion},{track:ge,trackPerformance:$f}=Zs((...t)=>{var o,s,l,d;let[,e]=t,r=e,n=Cs(r.extra)?r.extra:$a(r.extra)?JSON.parse(r.extra):{},a=Re(X({},n),{mp_id:(o=r.mp_id)!=null?o:"",mp_version:(s=r.mp_version)!=null?s:""}),i={name:e.tag,type:St.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(d=(l=D.hostUserInfo)==null?void 0:l.uid)!=null?d:null};an.trackEvent(i,Ht.WebSDK)},Vf);ul.registerCommand("ReportSDK.traceSystemTimeline",({event:t,duration:e,extra:r})=>{$f(t,e,r)});ul.registerCommand("ReportSDK.traceSystem",({event:t,info:e})=>{ge(t,e)});mi=new ze,$e=new sn(ge,mi)});function fl(t){let e=Xa.config[t];return e||(e={},Xa.config[t]=e),(r,n)=>{if(e[r]){ke.warn(`[can i use] ${r} already registered`);return}e[r]=X({},n)}}var hl=re(()=>{"use strict";K()});function pi(t){ml=t}function ln(t){return t===null||typeof t!="object"?t:Array.isArray(t)?t.map(e=>ln(e)):Object.keys(t).reduce((e,r)=>(e[r]=ln(t[r]),e),{})}function ot(t){return typeof t=="number"}function vi(t){let e=gi(t);switch(e){case"string":return`"${t}"`;case"number":case"boolean":case"null":case"undefined":return String(t);default:return`a(n) ${e}`}}function gi(t){return typeof t=="function"?"function":Object.prototype.toString.call(t).slice(8).slice(0,-1).toLowerCase()}var ml,he,cn,dn,un,fn,Vt,hn,mn,pn,vn,gn,_n,yn,wn,bn,En,In,An,_i=re(()=>{"use strict";ml=!1;he=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(e){if(ml)if(typeof e=="string")this.errors.push(e);else{let r=`${this.path} should be ${e.expect}`;this._optional&&e.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${vi(e.actual)}`,this.errors.push(r)}return!1}fallback(e){return this.hasFallback=!0,this._fallback=e,this}get fallbackValue(){return ln(this._fallback)}default(e){return this.hasDefault=!0,this._default=e,this}get defaultValue(){return typeof this._default=="function"?this._default:ln(this._default)}optional(){return this._optional=!0,this}};cn=class extends he{validate(e){return this._optional&&e===void 0?!0:ot(e)?ot(this._min)&&e<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ot(this._max)&&e>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ot(this._greater)&&e<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&e!==Math.floor(e)?this.fail(`the value of ${this.path} should be integer but got ${e}`):!0:this.fail({expect:"number",actual:e})}min(e){return this._min=e,this}max(e){return this._max=e,this}isInt(e){return this._isInt=e,this}greater(e){return this._greater=e,this}},dn=class extends he{validate(e){return this._optional&&e===void 0?!0:typeof e!="boolean"?this.fail({expect:"boolean",actual:e}):!0}},un=class extends he{validate(e){if(this._optional&&e===void 0)return!0;if(typeof e!="string")return this.fail({expect:"string",actual:e});if(ot(this._maxLength)&&e.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ot(this._minLength)&&e.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(e))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(e))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(e){return this._minLength=e,this}maxLength(e){return this._maxLength=e,this}pattern(e){return this._pattern=e,this}},fn=class extends he{validate(e){return this._optional&&e===void 0?!0:typeof e!="symbol"?this.fail({expect:"symbol",actual:e}):!0}},Vt=class extends he{validate(e){return!0}},hn=class extends he{validate(e){return e!==void 0?this.fail({expect:"undefined",actual:e}):!0}},mn=class extends he{validate(e){return this._optional&&e===void 0?!0:e!==null?this.fail({expect:"null",actual:e}):!0}},pn=class extends he{validate(e){return this._optional&&e===void 0?!0:typeof e!="function"?this.fail({expect:"function",actual:e}):!0}},vn=class extends he{constructor(...e){super(),this._items=e}validate(e){if(this._optional&&e===void 0)return!0;if(!this._items.includes(e)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${vi(e)}`)}return!0}},gn=class extends he{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(ot(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ot(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ot(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 a=!0;if(r.forEach((i,o)=>{if(n.path=`${this.path}[${o}]`,n.errors=this.errors,i===void 0&&n.hasDefault){r[o]=n.defaultValue;return}n.validate(i)||(n.hasFallback?r[o]=n.fallbackValue:a=!1)}),this._uniqueItems){let i=new Map;for(let o in r)i.has(r[o])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${i.get(r[o])}] and ${this.path}[${o}] are identical)`):i.set(r[o],o)}return a}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}},_n=class extends he{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(gi(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,i=this._value;i.errors=this.errors;let o=!0;for(let s in a){let l=a[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?i.path=`${this.path}.${s}`:i.path=`${this.path}["${s}"]`,!(l===void 0&&i._optional)){if(l===void 0&&i.hasDefault){a[s]=i.defaultValue;continue}i.validate(l)||(i.hasFallback?a[s]=i.fallbackValue:o=!1)}}return o}},yn=class extends he{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(gi(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,a=!0;for(let i in this._object){let o=n[i],s=this._object[i];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(i)?s.path=`${this.path}.${i}`:s.path=`${this.path}["${i}"]`,!(s._optional&&o===void 0)){if(o===void 0&&s.hasDefault){n[i]=s.defaultValue;continue}s.validate(o)||(s.hasFallback?n[i]=s.fallbackValue:a=!1)}}return a}},wn=class extends he{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:vi(this.value),actual:r}):!0}},bn=class extends he{constructor(...e){super(),this._items=e}validate(e){if(e===void 0&&this._optional)return!0;let r=[],n=!1,a=this._items.length;for(let i=0;i<a;i++){let o=this._items[i];if(o.errors=[],o.path=this.path,!o.validate(e))r.push(o.errors.join("; "));else if(!n){n=!0;break}}if(!n){let i=r.join(`
10
+ or `);this.errors.push(i)}return n}},En=class extends he{constructor(...e){super(),this._items=e;let r=0,n=e.length-1;for(;n>=0;n--){let a=e[n];if(a._optional||a.hasDefault)r+=1;else break}this._minItems=e.length-r}validate(e){if(e===void 0&&this._optional)return!0;if(!Array.isArray(e))return this.fail({expect:"array",actual:e});if(e.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,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,e[a]===void 0&&n.hasDefault){e[a]=n.defaultValue;return}n.validate(e[a])||(n.hasFallback?e[a]=n._fallback:r=!1)}),r}},In=class extends he{validate(e){return e===void 0&&this._optional||e instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:e})}},An=class extends he{constructor(e){super(),this._ctor=e}validate(e){return e===void 0&&this._optional||e instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:e})}}});function yi(t,e,r="param"){if(t.errors=[],t.path=r,pi(!0),!t.validate(e)){let n=t.errors.join(`
11
+ `);throw t.errors.length=0,pi(!1),new TypeError(n)}}var G,wi=re(()=>{"use strict";_i();_i();G={object(t){return new yn(t)},array(t){return new gn(t)},tuple(...t){return new En(...t)},literal(t){return new wn(t)},or(...t){return new bn(...t)},symbol(){return new fn},record(t){return new _n(t)},function(){return new pn},boolean(){return new dn},string(){return new un},number(){return new cn},undefined(){return new hn},null(){return new mn},unknown(){return new Vt},any(){return new Vt},as(){return new Vt},arraybuffer(){return new In},enum(...t){return new vn(...t)},typedarray(t){return new An(t)}}});var Sn,pl,vl=re(()=>{"use strict";K();nt();wi();li();Sn=1,pl=t=>{function e(n,a){return(...i)=>{var f,p,h,b;let o=Date.now(),s={method:n,trace_id:Sn};Sn+=1;let l="SUCCESS",d=`${n}:ok`,g=0;try{if(a.paramsSchema)try{yi(a.paramsSchema,i,"params")}catch(O){throw si(`${n}:fail ${O.message}`)}let I=a.implement(...i),S=I,w=`${n}:ok`;if(I&&"code"in I){let{code:O,data:L,message:U}=I;l=O,S=L,w=U}return{code:l,message:w,data:S}}catch(I){let S=I;g=(p=(f=S.code)!=null?f:S.errNo)!=null?p:2e3,l="FAILURE";let w=(b=(h=S.message)!=null?h:S.errMsg)!=null?b:`${I}`;return d=`${n}:${l} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`,Me(new en(d,g)),{code:l,message:d}}finally{let I=Date.now()-o}}}function r(n,a){return(...i)=>E(this,null,function*(){var p,h,b,I;let o=Rs(i)?i:[i],s=Date.now(),l={method:n,trace_id:Sn};Sn+=1;let d=`${n}:ok`,g="SUCCESS",f={code:g,message:d};try{if(a.paramsSchema)try{yi(a.paramsSchema,o,"params")}catch(O){throw si(O.message)}let w=yield a.implement(...o);if(w&&"code"in w){let{code:O,data:L,message:U}=w;g=O,d=U,w=L}return Object.assign(f,{code:g,message:d,data:w}),f}catch(S){let w=S,O=(h=(p=w.code)!=null?p:w.errNo)!=null?h:2e3;g="FAILURE";let L=(I=(b=w.message)!=null?b:w.errMsg)!=null?I:`${S}`,U=`${n}:${g} ${L.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(f,{code:g,message:U}),Me(new en(U,O)),f}finally{let S=Date.now()-s}})}return{createAPI:r,createSyncAPI:e}}});var Ke,Ot,_e,gr=re(()=>{"use strict";hl();it();vl();wi();({createAPI:Ke,createSyncAPI:Ot}=pl(ge)),_e=fl("h5")});var wl=Ua((yl,Ai)=>{(function(t){if(typeof yl=="object"&&typeof Ai!="undefined")Ai.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return function n(a,i,o){function s(g,f){if(!i[g]){if(!a[g]){var p=typeof fr=="function"&&fr;if(!f&&p)return p(g,!0);if(l)return l(g,!0);var h=new Error("Cannot find module '"+g+"'");throw h.code="MODULE_NOT_FOUND",h}var b=i[g]={exports:{}};a[g][0].call(b.exports,function(I){var S=a[g][1][I];return s(S||I)},b,b.exports,n,a,i,o)}return i[g].exports}for(var l=typeof fr=="function"&&fr,d=0;d<o.length;d++)s(o[d]);return s}({1:[function(n,a,i){(function(o){"use strict";var s=o.MutationObserver||o.WebKitMutationObserver,l;if(s){var d=0,g=new s(I),f=o.document.createTextNode("");g.observe(f,{characterData:!0}),l=function(){f.data=d=++d%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var p=new o.MessageChannel;p.port1.onmessage=I,l=function(){p.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var w=o.document.createElement("script");w.onreadystatechange=function(){I(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},o.document.documentElement.appendChild(w)}:l=function(){setTimeout(I,0)};var h,b=[];function I(){h=!0;for(var w,O,L=b.length;L;){for(O=b,b=[],w=-1;++w<L;)O[w]();L=b.length}h=!1}a.exports=S;function S(w){b.push(w)===1&&!h&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,a,i){"use strict";var o=n(1);function s(){}var l={},d=["REJECTED"],g=["FULFILLED"],f=["PENDING"];a.exports=p;function p(A){if(typeof A!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,A!==s&&S(this,A)}p.prototype.catch=function(A){return this.then(null,A)},p.prototype.then=function(A,P){if(typeof A!="function"&&this.state===g||typeof P!="function"&&this.state===d)return this;var H=new this.constructor(s);if(this.state!==f){var q=this.state===g?A:P;b(H,q,this.outcome)}else this.queue.push(new h(H,A,P));return H};function h(A,P,H){this.promise=A,typeof P=="function"&&(this.onFulfilled=P,this.callFulfilled=this.otherCallFulfilled),typeof H=="function"&&(this.onRejected=H,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(A){l.resolve(this.promise,A)},h.prototype.otherCallFulfilled=function(A){b(this.promise,this.onFulfilled,A)},h.prototype.callRejected=function(A){l.reject(this.promise,A)},h.prototype.otherCallRejected=function(A){b(this.promise,this.onRejected,A)};function b(A,P,H){o(function(){var q;try{q=P(H)}catch(N){return l.reject(A,N)}q===A?l.reject(A,new TypeError("Cannot resolve promise with itself")):l.resolve(A,q)})}l.resolve=function(A,P){var H=w(I,P);if(H.status==="error")return l.reject(A,H.value);var q=H.value;if(q)S(A,q);else{A.state=g,A.outcome=P;for(var N=-1,M=A.queue.length;++N<M;)A.queue[N].callFulfilled(P)}return A},l.reject=function(A,P){A.state=d,A.outcome=P;for(var H=-1,q=A.queue.length;++H<q;)A.queue[H].callRejected(P);return A};function I(A){var P=A&&A.then;if(A&&(typeof A=="object"||typeof A=="function")&&typeof P=="function")return function(){P.apply(A,arguments)}}function S(A,P){var H=!1;function q(V){H||(H=!0,l.reject(A,V))}function N(V){H||(H=!0,l.resolve(A,V))}function M(){P(N,q)}var F=w(M);F.status==="error"&&q(F.value)}function w(A,P){var H={};try{H.value=A(P),H.status="success"}catch(q){H.status="error",H.value=q}return H}p.resolve=O;function O(A){return A instanceof this?A:l.resolve(new this(s),A)}p.reject=L;function L(A){var P=new this(s);return l.reject(P,A)}p.all=U;function U(A){var P=this;if(Object.prototype.toString.call(A)!=="[object Array]")return this.reject(new TypeError("must be an array"));var H=A.length,q=!1;if(!H)return this.resolve([]);for(var N=new Array(H),M=0,F=-1,V=new this(s);++F<H;)$(A[F],F);return V;function $(Be,Mt){P.resolve(Be).then(Gt,function(tt){q||(q=!0,l.reject(V,tt))});function Gt(tt){N[Mt]=tt,++M===H&&!q&&(q=!0,l.resolve(V,N))}}}p.race=J;function J(A){var P=this;if(Object.prototype.toString.call(A)!=="[object Array]")return this.reject(new TypeError("must be an array"));var H=A.length,q=!1;if(!H)return this.resolve([]);for(var N=-1,M=new this(s);++N<H;)F(A[N]);return M;function F(V){P.resolve(V).then(function($){q||(q=!0,l.resolve(M,$))},function($){q||(q=!0,l.reject(M,$))})}}},{1:1}],3:[function(n,a,i){(function(o){"use strict";typeof o.Promise!="function"&&(o.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,a,i){"use strict";var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c};function s(c,m){if(!(c instanceof m))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(c){return}}var d=l();function g(){try{if(!d||!d.open)return!1;var c=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!c||m)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(u){return!1}}function f(c,m){c=c||[],m=m||{};try{return new Blob(c,m)}catch(v){if(v.name!=="TypeError")throw v;for(var u=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,_=new u,y=0;y<c.length;y+=1)_.append(c[y]);return _.getBlob(m.type)}}typeof Promise=="undefined"&&n(3);var p=Promise;function h(c,m){m&&c.then(function(u){m(null,u)},function(u){m(u)})}function b(c,m,u){typeof m=="function"&&c.then(m),typeof u=="function"&&c.catch(u)}function I(c){return typeof c!="string"&&(console.warn(c+" used as a key, but it is not a string."),c=String(c)),c}function S(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var w="local-forage-detect-blob-support",O=void 0,L={},U=Object.prototype.toString,J="readonly",A="readwrite";function P(c){for(var m=c.length,u=new ArrayBuffer(m),_=new Uint8Array(u),y=0;y<m;y++)_[y]=c.charCodeAt(y);return u}function H(c){return new p(function(m){var u=c.transaction(w,A),_=f([""]);u.objectStore(w).put(_,"key"),u.onabort=function(y){y.preventDefault(),y.stopPropagation(),m(!1)},u.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),v=navigator.userAgent.match(/Edge\//);m(v||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function q(c){return typeof O=="boolean"?p.resolve(O):H(c).then(function(m){return O=m,O})}function N(c){var m=L[c.name],u={};u.promise=new p(function(_,y){u.resolve=_,u.reject=y}),m.deferredOperations.push(u),m.dbReady?m.dbReady=m.dbReady.then(function(){return u.promise}):m.dbReady=u.promise}function M(c){var m=L[c.name],u=m.deferredOperations.pop();if(u)return u.resolve(),u.promise}function F(c,m){var u=L[c.name],_=u.deferredOperations.pop();if(_)return _.reject(m),_.promise}function V(c,m){return new p(function(u,_){if(L[c.name]=L[c.name]||zo(),c.db)if(m)N(c),c.db.close();else return u(c.db);var y=[c.name];m&&y.push(c.version);var v=d.open.apply(d,y);m&&(v.onupgradeneeded=function(C){var R=v.result;try{R.createObjectStore(c.storeName),C.oldVersion<=1&&R.createObjectStore(w)}catch(k){if(k.name==="ConstraintError")console.warn('The database "'+c.name+'" has been upgraded from version '+C.oldVersion+" to version "+C.newVersion+', but the storage "'+c.storeName+'" already exists.');else throw k}}),v.onerror=function(C){C.preventDefault(),_(v.error)},v.onsuccess=function(){var C=v.result;C.onversionchange=function(R){R.target.close()},u(C),M(c)}})}function $(c){return V(c,!1)}function Be(c){return V(c,!0)}function Mt(c,m){if(!c.db)return!0;var u=!c.db.objectStoreNames.contains(c.storeName),_=c.version<c.db.version,y=c.version>c.db.version;if(_&&(c.version!==m&&console.warn('The database "'+c.name+`" can't be downgraded from version `+c.db.version+" to version "+c.version+"."),c.version=c.db.version),y||u){if(u){var v=c.db.version+1;v>c.version&&(c.version=v)}return!0}return!1}function Gt(c){return new p(function(m,u){var _=new FileReader;_.onerror=u,_.onloadend=function(y){var v=btoa(y.target.result||"");m({__local_forage_encoded_blob:!0,data:v,type:c.type})},_.readAsBinaryString(c)})}function tt(c){var m=P(atob(c.data));return f([m],{type:c.type})}function Wo(c){return c&&c.__local_forage_encoded_blob}function Vd(c){var m=this,u=m._initReady().then(function(){var _=L[m._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return b(u,c,c),u}function $d(c){N(c);for(var m=L[c.name],u=m.forages,_=0;_<u.length;_++){var y=u[_];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return c.db=null,$(c).then(function(v){return c.db=v,Mt(c)?Be(c):v}).then(function(v){c.db=m.db=v;for(var C=0;C<u.length;C++)u[C]._dbInfo.db=v}).catch(function(v){throw F(c,v),v})}function rt(c,m,u,_){_===void 0&&(_=1);try{var y=c.db.transaction(c.storeName,m);u(null,y)}catch(v){if(_>0&&(!c.db||v.name==="InvalidStateError"||v.name==="NotFoundError"))return p.resolve().then(function(){if(!c.db||v.name==="NotFoundError"&&!c.db.objectStoreNames.contains(c.storeName)&&c.version<=c.db.version)return c.db&&(c.version=c.db.version+1),Be(c)}).then(function(){return $d(c).then(function(){rt(c,m,u,_-1)})}).catch(u);u(v)}}function zo(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Kd(c){var m=this,u={db:null};if(c)for(var _ in c)u[_]=c[_];var y=L[u.name];y||(y=zo(),L[u.name]=y),y.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=Vd);var v=[];function C(){return p.resolve()}for(var R=0;R<y.forages.length;R++){var k=y.forages[R];k!==m&&v.push(k._initReady().catch(C))}var T=y.forages.slice(0);return p.all(v).then(function(){return u.db=y.db,$(u)}).then(function(x){return u.db=x,Mt(u,m._defaultConfig.version)?Be(u):x}).then(function(x){u.db=y.db=x,m._dbInfo=u;for(var B=0;B<T.length;B++){var W=T[B];W!==m&&(W._dbInfo.db=u.db,W._dbInfo.version=u.version)}})}function Wd(c,m){var u=this;c=I(c);var _=new p(function(y,v){u.ready().then(function(){rt(u._dbInfo,J,function(C,R){if(C)return v(C);try{var k=R.objectStore(u._dbInfo.storeName),T=k.get(c);T.onsuccess=function(){var x=T.result;x===void 0&&(x=null),Wo(x)&&(x=tt(x)),y(x)},T.onerror=function(){v(T.error)}}catch(x){v(x)}})}).catch(v)});return h(_,m),_}function zd(c,m){var u=this,_=new p(function(y,v){u.ready().then(function(){rt(u._dbInfo,J,function(C,R){if(C)return v(C);try{var k=R.objectStore(u._dbInfo.storeName),T=k.openCursor(),x=1;T.onsuccess=function(){var B=T.result;if(B){var W=B.value;Wo(W)&&(W=tt(W));var ee=c(W,B.key,x++);ee!==void 0?y(ee):B.continue()}else y()},T.onerror=function(){v(T.error)}}catch(B){v(B)}})}).catch(v)});return h(_,m),_}function Xd(c,m,u){var _=this;c=I(c);var y=new p(function(v,C){var R;_.ready().then(function(){return R=_._dbInfo,U.call(m)==="[object Blob]"?q(R.db).then(function(k){return k?m:Gt(m)}):m}).then(function(k){rt(_._dbInfo,A,function(T,x){if(T)return C(T);try{var B=x.objectStore(_._dbInfo.storeName);k===null&&(k=void 0);var W=B.put(k,c);x.oncomplete=function(){k===void 0&&(k=null),v(k)},x.onabort=x.onerror=function(){var ee=W.error?W.error:W.transaction.error;C(ee)}}catch(ee){C(ee)}})}).catch(C)});return h(y,u),y}function Yd(c,m){var u=this;c=I(c);var _=new p(function(y,v){u.ready().then(function(){rt(u._dbInfo,A,function(C,R){if(C)return v(C);try{var k=R.objectStore(u._dbInfo.storeName),T=k.delete(c);R.oncomplete=function(){y()},R.onerror=function(){v(T.error)},R.onabort=function(){var x=T.error?T.error:T.transaction.error;v(x)}}catch(x){v(x)}})}).catch(v)});return h(_,m),_}function Qd(c){var m=this,u=new p(function(_,y){m.ready().then(function(){rt(m._dbInfo,A,function(v,C){if(v)return y(v);try{var R=C.objectStore(m._dbInfo.storeName),k=R.clear();C.oncomplete=function(){_()},C.onabort=C.onerror=function(){var T=k.error?k.error:k.transaction.error;y(T)}}catch(T){y(T)}})}).catch(y)});return h(u,c),u}function Zd(c){var m=this,u=new p(function(_,y){m.ready().then(function(){rt(m._dbInfo,J,function(v,C){if(v)return y(v);try{var R=C.objectStore(m._dbInfo.storeName),k=R.count();k.onsuccess=function(){_(k.result)},k.onerror=function(){y(k.error)}}catch(T){y(T)}})}).catch(y)});return h(u,c),u}function eu(c,m){var u=this,_=new p(function(y,v){if(c<0){y(null);return}u.ready().then(function(){rt(u._dbInfo,J,function(C,R){if(C)return v(C);try{var k=R.objectStore(u._dbInfo.storeName),T=!1,x=k.openKeyCursor();x.onsuccess=function(){var B=x.result;if(!B){y(null);return}c===0||T?y(B.key):(T=!0,B.advance(c))},x.onerror=function(){v(x.error)}}catch(B){v(B)}})}).catch(v)});return h(_,m),_}function tu(c){var m=this,u=new p(function(_,y){m.ready().then(function(){rt(m._dbInfo,J,function(v,C){if(v)return y(v);try{var R=C.objectStore(m._dbInfo.storeName),k=R.openKeyCursor(),T=[];k.onsuccess=function(){var x=k.result;if(!x){_(T);return}T.push(x.key),x.continue()},k.onerror=function(){y(k.error)}}catch(x){y(x)}})}).catch(y)});return h(u,c),u}function ru(c,m){m=S.apply(this,arguments);var u=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||u.name,c.storeName=c.storeName||u.storeName);var _=this,y;if(!c.name)y=p.reject("Invalid arguments");else{var v=c.name===u.name&&_._dbInfo.db,C=v?p.resolve(_._dbInfo.db):$(c).then(function(R){var k=L[c.name],T=k.forages;k.db=R;for(var x=0;x<T.length;x++)T[x]._dbInfo.db=R;return R});c.storeName?y=C.then(function(R){if(R.objectStoreNames.contains(c.storeName)){var k=R.version+1;N(c);var T=L[c.name],x=T.forages;R.close();for(var B=0;B<x.length;B++){var W=x[B];W._dbInfo.db=null,W._dbInfo.version=k}var ee=new p(function(te,ue){var ce=d.open(c.name,k);ce.onerror=function(He){var ur=ce.result;ur.close(),ue(He)},ce.onupgradeneeded=function(){var He=ce.result;He.deleteObjectStore(c.storeName)},ce.onsuccess=function(){var He=ce.result;He.close(),te(He)}});return ee.then(function(te){T.db=te;for(var ue=0;ue<x.length;ue++){var ce=x[ue];ce._dbInfo.db=te,M(ce._dbInfo)}}).catch(function(te){throw(F(c,te)||p.resolve()).catch(function(){}),te})}}):y=C.then(function(R){N(c);var k=L[c.name],T=k.forages;R.close();for(var x=0;x<T.length;x++){var B=T[x];B._dbInfo.db=null}var W=new p(function(ee,te){var ue=d.deleteDatabase(c.name);ue.onerror=function(){var ce=ue.result;ce&&ce.close(),te(ue.error)},ue.onblocked=function(){console.warn('dropInstance blocked for database "'+c.name+'" until all open connections are closed')},ue.onsuccess=function(){var ce=ue.result;ce&&ce.close(),ee(ce)}});return W.then(function(ee){k.db=ee;for(var te=0;te<T.length;te++){var ue=T[te];M(ue._dbInfo)}}).catch(function(ee){throw(F(c,ee)||p.resolve()).catch(function(){}),ee})})}return h(y,m),y}var nu={_driver:"asyncStorage",_initStorage:Kd,_support:g(),iterate:zd,getItem:Wd,setItem:Xd,removeItem:Yd,clear:Qd,length:Zd,key:eu,keys:tu,dropInstance:ru};function au(){return typeof openDatabase=="function"}var gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",iu="~~local_forage_type~",Xo=/^~~local_forage_type~([^~]+)~/,Wr="__lfsc__:",Sa=Wr.length,Ca="arbf",Ra="blob",Yo="si08",Qo="ui08",Zo="uic8",es="si16",ts="si32",rs="ur16",ns="ui32",as="fl32",is="fl64",os=Sa+Ca.length,ss=Object.prototype.toString;function ls(c){var m=c.length*.75,u=c.length,_,y=0,v,C,R,k;c[c.length-1]==="="&&(m--,c[c.length-2]==="="&&m--);var T=new ArrayBuffer(m),x=new Uint8Array(T);for(_=0;_<u;_+=4)v=gt.indexOf(c[_]),C=gt.indexOf(c[_+1]),R=gt.indexOf(c[_+2]),k=gt.indexOf(c[_+3]),x[y++]=v<<2|C>>4,x[y++]=(C&15)<<4|R>>2,x[y++]=(R&3)<<6|k&63;return T}function Oa(c){var m=new Uint8Array(c),u="",_;for(_=0;_<m.length;_+=3)u+=gt[m[_]>>2],u+=gt[(m[_]&3)<<4|m[_+1]>>4],u+=gt[(m[_+1]&15)<<2|m[_+2]>>6],u+=gt[m[_+2]&63];return m.length%3===2?u=u.substring(0,u.length-1)+"=":m.length%3===1&&(u=u.substring(0,u.length-2)+"=="),u}function ou(c,m){var u="";if(c&&(u=ss.call(c)),c&&(u==="[object ArrayBuffer]"||c.buffer&&ss.call(c.buffer)==="[object ArrayBuffer]")){var _,y=Wr;c instanceof ArrayBuffer?(_=c,y+=Ca):(_=c.buffer,u==="[object Int8Array]"?y+=Yo:u==="[object Uint8Array]"?y+=Qo:u==="[object Uint8ClampedArray]"?y+=Zo:u==="[object Int16Array]"?y+=es:u==="[object Uint16Array]"?y+=rs:u==="[object Int32Array]"?y+=ts:u==="[object Uint32Array]"?y+=ns:u==="[object Float32Array]"?y+=as:u==="[object Float64Array]"?y+=is:m(new Error("Failed to get type for BinaryArray"))),m(y+Oa(_))}else if(u==="[object Blob]"){var v=new FileReader;v.onload=function(){var C=iu+c.type+"~"+Oa(this.result);m(Wr+Ra+C)},v.readAsArrayBuffer(c)}else try{m(JSON.stringify(c))}catch(C){console.error("Couldn't convert value into a JSON string: ",c),m(null,C)}}function su(c){if(c.substring(0,Sa)!==Wr)return JSON.parse(c);var m=c.substring(os),u=c.substring(Sa,os),_;if(u===Ra&&Xo.test(m)){var y=m.match(Xo);_=y[1],m=m.substring(y[0].length)}var v=ls(m);switch(u){case Ca:return v;case Ra:return f([v],{type:_});case Yo:return new Int8Array(v);case Qo:return new Uint8Array(v);case Zo:return new Uint8ClampedArray(v);case es:return new Int16Array(v);case rs:return new Uint16Array(v);case ts:return new Int32Array(v);case ns:return new Uint32Array(v);case as:return new Float32Array(v);case is:return new Float64Array(v);default:throw new Error("Unkown type: "+u)}}var ka={serialize:ou,deserialize:su,stringToBuffer:ls,bufferToString:Oa};function cs(c,m,u,_){c.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],u,_)}function lu(c){var m=this,u={db:null};if(c)for(var _ in c)u[_]=typeof c[_]!="string"?c[_].toString():c[_];var y=new p(function(v,C){try{u.db=openDatabase(u.name,String(u.version),u.description,u.size)}catch(R){return C(R)}u.db.transaction(function(R){cs(R,u,function(){m._dbInfo=u,v()},function(k,T){C(T)})},C)});return u.serializer=ka,y}function _t(c,m,u,_,y,v){c.executeSql(u,_,y,function(C,R){R.code===R.SYNTAX_ERR?C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(k,T){T.rows.length?v(k,R):cs(k,m,function(){k.executeSql(u,_,y,v)},v)},v):v(C,R)},v)}function cu(c,m){var u=this;c=I(c);var _=new p(function(y,v){u.ready().then(function(){var C=u._dbInfo;C.db.transaction(function(R){_t(R,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[c],function(k,T){var x=T.rows.length?T.rows.item(0).value:null;x&&(x=C.serializer.deserialize(x)),y(x)},function(k,T){v(T)})})}).catch(v)});return h(_,m),_}function du(c,m){var u=this,_=new p(function(y,v){u.ready().then(function(){var C=u._dbInfo;C.db.transaction(function(R){_t(R,C,"SELECT * FROM "+C.storeName,[],function(k,T){for(var x=T.rows,B=x.length,W=0;W<B;W++){var ee=x.item(W),te=ee.value;if(te&&(te=C.serializer.deserialize(te)),te=c(te,ee.key,W+1),te!==void 0){y(te);return}}y()},function(k,T){v(T)})})}).catch(v)});return h(_,m),_}function ds(c,m,u,_){var y=this;c=I(c);var v=new p(function(C,R){y.ready().then(function(){m===void 0&&(m=null);var k=m,T=y._dbInfo;T.serializer.serialize(m,function(x,B){B?R(B):T.db.transaction(function(W){_t(W,T,"INSERT OR REPLACE INTO "+T.storeName+" (key, value) VALUES (?, ?)",[c,x],function(){C(k)},function(ee,te){R(te)})},function(W){if(W.code===W.QUOTA_ERR){if(_>0){C(ds.apply(y,[c,k,u,_-1]));return}R(W)}})})}).catch(R)});return h(v,u),v}function uu(c,m,u){return ds.apply(this,[c,m,u,1])}function fu(c,m){var u=this;c=I(c);var _=new p(function(y,v){u.ready().then(function(){var C=u._dbInfo;C.db.transaction(function(R){_t(R,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[c],function(){y()},function(k,T){v(T)})})}).catch(v)});return h(_,m),_}function hu(c){var m=this,u=new p(function(_,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(C){_t(C,v,"DELETE FROM "+v.storeName,[],function(){_()},function(R,k){y(k)})})}).catch(y)});return h(u,c),u}function mu(c){var m=this,u=new p(function(_,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(C){_t(C,v,"SELECT COUNT(key) as c FROM "+v.storeName,[],function(R,k){var T=k.rows.item(0).c;_(T)},function(R,k){y(k)})})}).catch(y)});return h(u,c),u}function pu(c,m){var u=this,_=new p(function(y,v){u.ready().then(function(){var C=u._dbInfo;C.db.transaction(function(R){_t(R,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[c+1],function(k,T){var x=T.rows.length?T.rows.item(0).key:null;y(x)},function(k,T){v(T)})})}).catch(v)});return h(_,m),_}function vu(c){var m=this,u=new p(function(_,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(C){_t(C,v,"SELECT key FROM "+v.storeName,[],function(R,k){for(var T=[],x=0;x<k.rows.length;x++)T.push(k.rows.item(x).key);_(T)},function(R,k){y(k)})})}).catch(y)});return h(u,c),u}function gu(c){return new p(function(m,u){c.transaction(function(_){_.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,v){for(var C=[],R=0;R<v.rows.length;R++)C.push(v.rows.item(R).name);m({db:c,storeNames:C})},function(y,v){u(v)})},function(_){u(_)})})}function _u(c,m){m=S.apply(this,arguments);var u=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||u.name,c.storeName=c.storeName||u.storeName);var _=this,y;return c.name?y=new p(function(v){var C;c.name===u.name?C=_._dbInfo.db:C=openDatabase(c.name,"","",0),c.storeName?v({db:C,storeNames:[c.storeName]}):v(gu(C))}).then(function(v){return new p(function(C,R){v.db.transaction(function(k){function T(ee){return new p(function(te,ue){k.executeSql("DROP TABLE IF EXISTS "+ee,[],function(){te()},function(ce,He){ue(He)})})}for(var x=[],B=0,W=v.storeNames.length;B<W;B++)x.push(T(v.storeNames[B]));p.all(x).then(function(){C()}).catch(function(ee){R(ee)})},function(k){R(k)})})}):y=p.reject("Invalid arguments"),h(y,m),y}var yu={_driver:"webSQLStorage",_initStorage:lu,_support:au(),iterate:du,getItem:cu,setItem:uu,removeItem:fu,clear:hu,length:mu,key:pu,keys:vu,dropInstance:_u};function wu(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(c){return!1}}function us(c,m){var u=c.name+"/";return c.storeName!==m.storeName&&(u+=c.storeName+"/"),u}function bu(){var c="_localforage_support_test";try{return localStorage.setItem(c,!0),localStorage.removeItem(c),!1}catch(m){return!0}}function Eu(){return!bu()||localStorage.length>0}function Iu(c){var m=this,u={};if(c)for(var _ in c)u[_]=c[_];return u.keyPrefix=us(c,m._defaultConfig),Eu()?(m._dbInfo=u,u.serializer=ka,p.resolve()):p.reject()}function Au(c){var m=this,u=m.ready().then(function(){for(var _=m._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var v=localStorage.key(y);v.indexOf(_)===0&&localStorage.removeItem(v)}});return h(u,c),u}function Su(c,m){var u=this;c=I(c);var _=u.ready().then(function(){var y=u._dbInfo,v=localStorage.getItem(y.keyPrefix+c);return v&&(v=y.serializer.deserialize(v)),v});return h(_,m),_}function Cu(c,m){var u=this,_=u.ready().then(function(){for(var y=u._dbInfo,v=y.keyPrefix,C=v.length,R=localStorage.length,k=1,T=0;T<R;T++){var x=localStorage.key(T);if(x.indexOf(v)===0){var B=localStorage.getItem(x);if(B&&(B=y.serializer.deserialize(B)),B=c(B,x.substring(C),k++),B!==void 0)return B}}});return h(_,m),_}function Ru(c,m){var u=this,_=u.ready().then(function(){var y=u._dbInfo,v;try{v=localStorage.key(c)}catch(C){v=null}return v&&(v=v.substring(y.keyPrefix.length)),v});return h(_,m),_}function Ou(c){var m=this,u=m.ready().then(function(){for(var _=m._dbInfo,y=localStorage.length,v=[],C=0;C<y;C++){var R=localStorage.key(C);R.indexOf(_.keyPrefix)===0&&v.push(R.substring(_.keyPrefix.length))}return v});return h(u,c),u}function ku(c){var m=this,u=m.keys().then(function(_){return _.length});return h(u,c),u}function Tu(c,m){var u=this;c=I(c);var _=u.ready().then(function(){var y=u._dbInfo;localStorage.removeItem(y.keyPrefix+c)});return h(_,m),_}function xu(c,m,u){var _=this;c=I(c);var y=_.ready().then(function(){m===void 0&&(m=null);var v=m;return new p(function(C,R){var k=_._dbInfo;k.serializer.serialize(m,function(T,x){if(x)R(x);else try{localStorage.setItem(k.keyPrefix+c,T),C(v)}catch(B){(B.name==="QuotaExceededError"||B.name==="NS_ERROR_DOM_QUOTA_REACHED")&&R(B),R(B)}})})});return h(y,u),y}function Pu(c,m){if(m=S.apply(this,arguments),c=typeof c!="function"&&c||{},!c.name){var u=this.config();c.name=c.name||u.name,c.storeName=c.storeName||u.storeName}var _=this,y;return c.name?y=new p(function(v){c.storeName?v(us(c,_._defaultConfig)):v(c.name+"/")}).then(function(v){for(var C=localStorage.length-1;C>=0;C--){var R=localStorage.key(C);R.indexOf(v)===0&&localStorage.removeItem(R)}}):y=p.reject("Invalid arguments"),h(y,m),y}var Lu={_driver:"localStorageWrapper",_initStorage:Iu,_support:wu(),iterate:Cu,getItem:Su,setItem:xu,removeItem:Tu,clear:Au,length:ku,key:Ru,keys:Ou,dropInstance:Pu},Du=function(m,u){return m===u||typeof m=="number"&&typeof u=="number"&&isNaN(m)&&isNaN(u)},Nu=function(m,u){for(var _=m.length,y=0;y<_;){if(Du(m[y],u))return!0;y++}return!1},fs=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},dr={},hs={},Ft={INDEXEDDB:nu,WEBSQL:yu,LOCALSTORAGE:Lu},Uu=[Ft.INDEXEDDB._driver,Ft.WEBSQL._driver,Ft.LOCALSTORAGE._driver],zr=["dropInstance"],Ta=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(zr),Bu={description:"",driver:Uu.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Mu(c,m){c[m]=function(){var u=arguments;return c.ready().then(function(){return c[m].apply(c,u)})}}function xa(){for(var c=1;c<arguments.length;c++){var m=arguments[c];if(m)for(var u in m)m.hasOwnProperty(u)&&(fs(m[u])?arguments[0][u]=m[u].slice():arguments[0][u]=m[u])}return arguments[0]}var Gu=function(){function c(m){s(this,c);for(var u in Ft)if(Ft.hasOwnProperty(u)){var _=Ft[u],y=_._driver;this[u]=y,dr[y]||this.defineDriver(_)}this._defaultConfig=xa({},Bu),this._config=xa({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return c.prototype.config=function(u){if((typeof u=="undefined"?"undefined":o(u))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var _ in u){if(_==="storeName"&&(u[_]=u[_].replace(/\W/g,"_")),_==="version"&&typeof u[_]!="number")return new Error("Database version must be a number.");this._config[_]=u[_]}return"driver"in u&&u.driver?this.setDriver(this._config.driver):!0}else return typeof u=="string"?this._config[u]:this._config},c.prototype.defineDriver=function(u,_,y){var v=new p(function(C,R){try{var k=u._driver,T=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver){R(T);return}for(var x=Ta.concat("_initStorage"),B=0,W=x.length;B<W;B++){var ee=x[B],te=!Nu(zr,ee);if((te||u[ee])&&typeof u[ee]!="function"){R(T);return}}var ue=function(){for(var ur=function(Hu){return function(){var ju=new Error("Method "+Hu+" is not implemented by the current driver"),ms=p.reject(ju);return h(ms,arguments[arguments.length-1]),ms}},Pa=0,Ju=zr.length;Pa<Ju;Pa++){var La=zr[Pa];u[La]||(u[La]=ur(La))}};ue();var ce=function(ur){dr[k]&&console.info("Redefining LocalForage driver: "+k),dr[k]=u,hs[k]=ur,C()};"_support"in u?u._support&&typeof u._support=="function"?u._support().then(ce,R):ce(!!u._support):ce(!0)}catch(He){R(He)}});return b(v,_,y),v},c.prototype.driver=function(){return this._driver||null},c.prototype.getDriver=function(u,_,y){var v=dr[u]?p.resolve(dr[u]):p.reject(new Error("Driver not found."));return b(v,_,y),v},c.prototype.getSerializer=function(u){var _=p.resolve(ka);return b(_,u),_},c.prototype.ready=function(u){var _=this,y=_._driverSet.then(function(){return _._ready===null&&(_._ready=_._initDriver()),_._ready});return b(y,u,u),y},c.prototype.setDriver=function(u,_,y){var v=this;fs(u)||(u=[u]);var C=this._getSupportedDrivers(u);function R(){v._config.driver=v.driver()}function k(B){return v._extend(B),R(),v._ready=v._initStorage(v._config),v._ready}function T(B){return function(){var W=0;function ee(){for(;W<B.length;){var te=B[W];return W++,v._dbInfo=null,v._ready=null,v.getDriver(te).then(k).catch(ee)}R();var ue=new Error("No available storage method found.");return v._driverSet=p.reject(ue),v._driverSet}return ee()}}var x=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=x.then(function(){var B=C[0];return v._dbInfo=null,v._ready=null,v.getDriver(B).then(function(W){v._driver=W._driver,R(),v._wrapLibraryMethodsWithReady(),v._initDriver=T(C)})}).catch(function(){R();var B=new Error("No available storage method found.");return v._driverSet=p.reject(B),v._driverSet}),b(this._driverSet,_,y),this._driverSet},c.prototype.supports=function(u){return!!hs[u]},c.prototype._extend=function(u){xa(this,u)},c.prototype._getSupportedDrivers=function(u){for(var _=[],y=0,v=u.length;y<v;y++){var C=u[y];this.supports(C)&&_.push(C)}return _},c.prototype._wrapLibraryMethodsWithReady=function(){for(var u=0,_=Ta.length;u<_;u++)Mu(this,Ta[u])},c.prototype.createInstance=function(u){return new c(u)},c}(),Fu=new Gu;a.exports=Fu},{3:3}]},{},[4])(4)})});var El=Ua($t=>{"use strict";K();gr();it();var yr=(t,e)=>{window.parent&&window.parent.postMessage({type:t,data:e},"*")},wr=Ee(),dh=Ke("levelFinished",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number()),duration:G.number().optional(),rating:G.number().optional(),score:G.number().optional(),variation:G.string().optional()})),implement:t=>E($t,null,function*(){let{levelId:e,duration:r,rating:n,score:a,variation:i}=t;ke.info("onLevelFinished",r,n,a,i),yr("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:e,duration:r,rating:n,score:a,variation:i}),yield Promise.all([$e.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:e,duration:r,rating:n,score:a}}}),$e.tracker("LevelFinished",{levelId:e,duration:r,rating:n,score:a,variation:i})])})}),uh=Ke("gamePlayEnded",{paramsSchema:G.tuple(G.object({duration:G.number().optional(),rating:G.number().optional(),score:G.number(),variation:G.string().optional()})),implement:t=>E($t,null,function*(){let{duration:e,rating:r,score:n,variation:a}=t;ke.info("onGamePlayEnded",e,r,n,a),yr("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:e,rating:r,score:n,variation:a}),yield Promise.all([$e.tracker("GamePlayEnded",{duration:e,rating:r,score:n,variation:a}),$e.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:e,rating:r,score:n}}})])})}),fh=Ke("levelUpgrade",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number()),name:G.string().optional()})),implement:r=>E($t,[r],function*({levelId:t,name:e}){ke.info("onLevelUpgrade",t,e),yr("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:t,name:e}),yield Promise.all([$e.tracker("LevelUpgrade",{name:e,levelId:t}),$e.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:t,levelName:e}}})])})}),hh=Ke("levelStart",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number())})),implement:t=>E($t,null,function*(){let{levelId:e}=t;ke.info("onLevelStart",e),yr("JOLIBOX_GAME_TASK_LEVEL_START",{levelId:e}),yield $e.tracker("LevelStart",{levelId:e})})}),mh=Ke("levelFailed",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number()),score:G.number().optional(),rating:G.number().optional(),duration:G.number().optional()})),implement:t=>E($t,null,function*(){let{levelId:e,score:r,rating:n,duration:a}=t;ke.info("onLevelFailed",e,r,n,a),yr("JOLIBOX_GAME_TASK_LEVEL_FAILED",{levelId:e,score:r,rating:n,duration:a}),yield $e.tracker("LevelFailed",{levelId:e,score:r,rating:n,duration:a})})});wr.registerCommand("TaskTrackerSDK.levelFinished",dh);wr.registerCommand("TaskTrackerSDK.gamePlayEnded",uh);wr.registerCommand("TaskTrackerSDK.levelUpgrade",fh);wr.registerCommand("TaskTrackerSDK.levelStart",hh);wr.registerCommand("TaskTrackerSDK.levelFailed",mh);_e("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"}}});_e("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});_e("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});_e("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});_e("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 Pe,Kt,Il,Ci,ph,kt,br=re(()=>{"use strict";Pe=(t,e)=>{var r;window.dispatchEvent(new CustomEvent(t,{detail:e})),(r=window.parent)==null||r.postMessage({type:t,data:{detail:e}},"*")},Kt=new Map,Il=t=>{if(t.source===window.parent)try{let e=t.data;if(e&&e.type){let r=Kt.get(e.type);r&&r.forEach(n=>{try{n(e.data)}catch(a){console.warn("Callback execution failed:",a)}})}}catch(e){console.warn("Failed to parse message:",e)}},Ci=!1,ph=()=>{Ci||(window.addEventListener("message",Il),Ci=!0)},kt=(t,e)=>{ph(),Kt.has(t)||Kt.set(t,new Set);let r=Kt.get(t);return r.add(e),()=>{r.delete(e),r.size===0&&Kt.delete(t),Kt.size===0&&(window.removeEventListener("message",Il),Ci=!1)}}});var Tn,xn,Pn,Ln,Dn,Ri,Nn,Un,Bn,Mn,Wt,vh,ne,st,lt,Le=re(()=>{"use strict";K();Tn="UNLOCK_OPTIONS_CHANGED",xn="INVOKE_PAYMENT",Pn="ON_PAYMENT_RESULT",Ln="ON_USE_MODAL_EVENT",Dn="ON_USE_MODAL_RESULT",Ri="ON_USE_MODAL_FREQUENCY",Nn="ON_USE_UNLOGIN_MODAL_EVENT",Un="INVOKE_UNLOGIN_MODAL_EVENT",Bn="INVOKE_SUBSCRIPTION_EVENT",Mn="ON_USE_SUBSCRIPTION_RESULT",Wt=new ze,vh=()=>({on:Wt.on.bind(Wt),off:Wt.off.bind(Wt),emit:Wt.emit.bind(Wt)}),ne=vh(),st={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},lt={show:!0,minInterval:8*60*60*1e3}});var Sd=Ua(ya=>{"use strict";fe();Le();br();K();var Ad={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};kt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",t=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",Ad[t.result],t.result),ne.emit(Dn,{useModalResult:Ad[t.result]})});ne.on(Ln,(t,e)=>{var r;t=="ADS-JOLI_GEM"||t=="JOLI_GEM"||Pe("JOLIBOX_JOLI_COIN_USE_EVENT",{JOLI_COIN:{quantity:e.quantity,balance:e.userCurrency.balance,enableAutoDeduct:e.enableAutoDeduct},type:t,sequenceId:(r=e.sequenceId)!=null?r:qe()})});kt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",t=>{ne.emit(Pn,{paymentResult:t.result=="ADS"?"FAILED":t.result,userJoliCoin:t.joliCoin,currency:"JOLI_COIN"})});ne.on(xn,(t,e)=>E(ya,null,function*(){var r;t=="ADS-JOLI_GEM"||t=="JOLI_GEM"||Pe("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:e.quantity,balance:e.userCurrency.balance,enableAutoDeduct:e.enableAutoDeduct},type:t,sequenceId:(r=e.sequenceId)!=null?r:qe()})}));kt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",t=>{var e,r,n,a,i;ne.emit(Nn,{result:t.result=="ADS"?"FAILED":t.result,rewards:{claimedRewardValue:(a=(n=(r=(e=t.extra)==null?void 0:e.firstLogin)==null?void 0:r.reward)==null?void 0:n.rewardValue)!=null?a:0,isFirstLogin:(i=t.isFirstLogin)!=null?i:!1}}),t.result==="SUCCESS"&&D.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});ne.on(Un,t=>E(ya,null,function*(){t=="ADS-JOLI_GEM"||t=="JOLI_GEM"||Pe("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:qe(),type:t})}));kt("ON_JOLIBOX_SUB_RESULT_EVENT",t=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",t),ne.emit(Mn,{result:t.result})});ne.on(Bn,t=>E(ya,null,function*(){console.log("----notify custom event-----",t),Pe("JOLIBOX_SUB_EVENT",{sequenceId:qe()})}))});it();fe();gr();K();var gl=Ee(),Wf="env",zf="getSystemInfoSync",Xf=()=>{var a,i,o,s;let t={system:D.deviceInfo.system,platform:D.deviceInfo.platform.toLowerCase(),brand:D.deviceInfo.brand,pixelRatio:D.deviceInfo.pixelRatio,language:D.deviceInfo.lang,version:D.sdkInfo.jssdkVersion,appName:(a=D.hostInfo)==null?void 0:a.appName,SDKVersion:D.sdkInfo.nativeSDKVersion},e=(i=D.hostInfo)==null?void 0:i.version;e&&(t=Re(X({},t),{version:e}));let r=(o=D.hostInfo)==null?void 0:o.appName;r&&(t=Re(X({},t),{appName:r}));let n=(s=D.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(t=Re(X({},t),{SDKVersion:n})),t},Yf=Ot(zf,{implement:Xf}),Qf=Ot(Wf,{implement:()=>Re(X({},D.hostInfo),{sdkInfo:D.sdkInfo,platform:D.platform,deviceInfo:D.deviceInfo})});gl.registerCommand("API.env",Qf);gl.registerCommand("API.getSystemInfoSync",Yf);_e("env",{version:"1.0.0"});_e("getSystemInfoSync",{version:"1.0.0"});K();gr();nt();it();var Zf="onJoliboxShow",eh="onJoliboxHide",th="onReady",Ei=Ee(),Ii=Ds(Me),bi=!0,_r=!0,Cn=0,Rn=mi;function rh(){let t=Date.now();if(t-Cn<100)return;Cn=t;let e=document.visibilityState==="visible";e!==bi&&(bi=e,Rn.emit("visible",bi))}function _l(t){let e=Date.now();e-Cn<100||(Cn=e,t==="focus"&&!_r?_r=!0:t==="blur"&&_r&&(_r=!1),Rn.emit("visible",_r))}document.addEventListener("visibilitychange",rh);window.addEventListener("focus",()=>_l("focus"));window.addEventListener("blur",()=>_l("blur"));var nh=Ot(Zf,{paramsSchema:G.tuple(G.function()),implement(t){let e=Ii(t);Rn.on("visible",r=>{r&&e()})}}),ah=Ot(eh,{paramsSchema:G.tuple(G.function()),implement(t){let e=Ii(t);Rn.on("visible",r=>{!r&&e()})}}),ih=Ot(th,{paramsSchema:G.tuple(G.function()),implement(t){let e=Ii(t);yt.on("LifecycleEvent.onReady",r=>{e(r)})}});Ei.registerCommand("LifecycleSDK.onReady",ih);Ei.registerCommand("LifecycleSDK.onJoliboxShow",nh);Ei.registerCommand("LifecycleSDK.onJoliboxHide",ah);_e("lifeCycle.onReady",{version:"1.0.0"});_e("lifeCycle.onJoliboxShow",{version:"1.0.0"});_e("lifeCycle.onJoliboxHide",{version:"1.0.0"});gr();K();qt();fe();var bl=Ba(wl());var On=Ee(),Si=class{constructor(){this.httpClient=Ve.create({baseUrl:jt(D.testMode)});this.getGameId=()=>D.mpId;this.getItem=e=>E(this,null,function*(){let{code:r,data:n,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:e}}),i=n==null?void 0:n.value,o=a;return r!=="SUCCESS"&&(i=yield this.gameStore.getItem(e),console.info("[SDK] cloud storage getItem failed, read from localstorage",i),o+="fallback to localstorage"),{code:r,message:o,data:i&&i!=="undefined"?i:null}});this.setItem=(e,r)=>E(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:a,message:i}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:e,value:n}});return yield this.gameStore.setItem(e,n),{code:a,message:i}});this.removeItem=e=>E(this,null,function*(){yield this.gameStore.removeItem(e);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:e}});return{code:r,message:n}});this.clear=()=>E(this,null,function*(){yield this.gameStore.clear();let{code:e,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:e,message:r}});this.gameId=this.getGameId(),this.gameStore=bl.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},kn=new Si,oh=Ke("getLocalStorage",{paramsSchema:G.tuple(G.string()),implement(t){return E(this,null,function*(){return yield kn.getItem(t)})}});On.registerCommand("StorageSDK.getItem",oh);_e("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var sh=Ke("setStorage",{paramsSchema:G.tuple(G.string(),G.or(G.string(),G.boolean(),G.number())),implement(t,e){return E(this,null,function*(){return yield kn.setItem(t,e)})}});On.registerCommand("StorageSDK.setItem",sh);_e("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var lh=Ke("removeStorage",{paramsSchema:G.tuple(G.string()),implement(t){return E(this,null,function*(){return yield kn.removeItem(t)})}});On.registerCommand("StorageSDK.removeItem",lh);_e("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var ch=Ke("clearStorage",{implement(){return E(this,null,function*(){return yield kn.clear()})}});On.registerCommand("StorageSDK.clear",ch);_e("storage.clear",{version:"1.0.0"});var vA=Ba(El());it();K();qt();br();fe();Le();var Al=D.testMode;function Sl(){let t=new Map,e,r;return{registerRewardHandler(a,i){t.set(a,i)},handleReward(a,...i){return E(this,null,function*(){return yield a.reduce((s,l)=>E(this,null,function*(){let d=yield s;if(d===!0)return!0;Al&&console.log(`handleReward ${l}`);let g=t.get(l),f=g?yield g(...i):d;return Al&&console.log(`handleReward ${l} ${f}`),f}),Promise.resolve(!1))})},registerRewardsFetcher(a){return E(this,null,function*(){e=(...i)=>E(this,null,function*(){try{return yield a(...i)}catch(o){return console.error("getRewardOptions error:",o),["ADS"]}})})},registerRewardFrequencyConfigFetcher(a){return E(this,null,function*(){r=(...i)=>E(this,null,function*(){try{return yield a(...i)}catch(o){return console.error("getRewardOptions error:",o),{joliCoinUseAndCharge:st,loginGuide:lt}}})})},getRewardsTypes(...a){return E(this,null,function*(){return e?yield e(...a):["ADS"]})},getRewardFrequencyConfig(...a){return E(this,null,function*(){return r?yield r(...a):{joliCoinUseAndCharge:st,loginGuide:lt}})}}}K();var Oi=class{constructor(e){this.httpClient=e}execute(e,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"POST",a=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(e,a):yield this.httpClient.post(e,a)})}extractCacheableData(e){var r,n,a;return{unlockOptions:((r=e.data)==null?void 0:r.unlockOptions)||[],joliCoin:((n=e.extra)==null?void 0:n.joliCoin)||{balance:0,enableAutoDeduct:!1},joliGem:((a=e.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(e,r){return{code:"SUCCESS",message:"success",data:{unlockOptions:e.unlockOptions},extra:{joliCoin:e.joliCoin||{balance:0,enableAutoDeduct:!1},joliGem:e.joliGem||{balance:0,enableAutoDeduct:!1}}}}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:e.unlockOptions},extra:{joliCoin:e.joliCoin,joliGem:e.joliGem}}}},ki=class{constructor(e){this.httpClient=e}execute(e,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",a=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(e,a):yield this.httpClient.post(e,a)})}extractCacheableData(e){let r=e.data;return X({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:e}}},Gn=class{constructor(e){this.unlockOptionsService=new Ct(new Oi(e),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((a,i)=>{var s,l;let o=n.unlockOptions[i];return a.type===o.type&&((s=a.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=o.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new Ct(new ki(e),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return E(this,arguments,function*(e={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:e,method:"POST"})})}getGlobalConfig(){return E(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 E(this,arguments,function*(e={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:e,method:"POST"})})}refreshGlobalConfig(){return E(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 E(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()}};Le();K();var gh=()=>(t,e)=>{let r={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return r[e]-r[t]},_h=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],yh=t=>{if(!t.length)return["ADS"];if(t.includes("JOLI_GEM")){if(t.length===1)return["JOLI_GEM_ONLY"];if(t.includes("SUBSCRIPTION")&&t.length===2)return["SUBSCRIPTION","JOLI_GEM_ONLY"]}if(t.includes("JOLI_COIN")){if(t.length===1)return["JOLI_COIN_ONLY"];if(t.includes("SUBSCRIPTION")&&t.length===2)return["SUBSCRIPTION","JOLI_COIN_ONLY"]}return t.sort(gh())},Ti=null;function xi(t){return Ti||(Ti=new Gn(t)),Ti}var Pi=t=>{t.registerRewardsFetcher(e=>E(void 0,null,function*(){var a,i,o,s,l;let r=["ADS"],n=xi(e);try{let d=yield n.getUnlockOptions({});if(d.code!=="SUCCESS")return r;ne.emit(Tn,{options:((a=d.data)==null?void 0:a.unlockOptions)||[],userJoliCoin:((i=d.extra)==null?void 0:i.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((o=d.extra)==null?void 0:o.joliGem)||{balance:0,enableAutoDeduct:!1}});let g=((l=(s=d.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(f=>f.type))||Array.from(r);return yh(g)}catch(d){return console.error("getRewardOptions error (cached):",d),r}}))},Li=t=>{t.registerRewardFrequencyConfigFetcher(e=>E(void 0,null,function*(){var n,a,i,o;let r=xi(e);try{let s=yield r.getGlobalConfig();return ne.emit(Ri,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||st,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||lt}),s.data&&yt.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((i=s.data)==null?void 0:i.joliCoinUseAndCharge)||st,loginGuide:((o=s.data)==null?void 0:o.loginGuide)||lt}}catch(s){return console.error("getGlobalConfig error (cached):",s),ne.emit(Ri,{joliCoinUseAndCharge:st,loginGuide:lt}),yt.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:st,loginGuide:lt,supportedHostMethods:_h}}),{joliCoinUseAndCharge:st,loginGuide:lt}}}))};var Di=t=>E(void 0,null,function*(){yield xi(t).warmupCache(),console.log("Reward cache warmed up")});var Cl=t=>e=>E(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",e),yield t.adBreak(e)}catch(r){console.error("-----createAdsRewardHandler error-----",r)}return!0});Le();function Xe(t,e){let r=null,n=null,a=null,i=()=>{if(a){r=Promise.resolve(a);return}r=new Promise(o=>{n=o})};return i(),t.on(e,(...o)=>{let s=o[0];a=s,n&&(n(s),n=null)}),{getData:()=>(r||i(),r),getCachedData:()=>a,clearCache:()=>{a=null,r=null},getFreshData:()=>(a=null,r=null,i(),r),updateData:o=>{if(a)return a=X(X({},a),o),r=Promise.resolve(a),n&&(n(a),n=null),a}}}Le();var Ie=Xe(ne,Tn),Er=(t,e)=>{var n;let r=(n=t.options)==null?void 0:n.some(a=>a.type==="SUBSCRIPTION");return console.log("typeof extraCheck",typeof e,e==null?void 0:e()),r&&(!e||(e==null?void 0:e()))};fe();K();var Ni={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"}};K();var je=Ee();Le();Le();K();var Bi=class{constructor(e){this.httpClient=e}execute(e,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",a=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(e,{query:a}):yield this.httpClient.post(e,{query:a})})}extractCacheableData(e){var r;return{balance:((r=e.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:{balance:e.balance}}}},Mi=class{constructor(e){this.balanceService=new Ct(new Bi(e),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let a=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${a}`}})}getBalance(e="JOLI_COIN"){return E(this,null,function*(){return(yield this.balanceService.request("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:e},method:"GET"})).data})}refreshBalance(e="JOLI_COIN"){return E(this,null,function*(){return(yield this.balanceService.forceRequest("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:e},method:"GET"})).data})}warmupBalance(e="JOLI_COIN"){return E(this,null,function*(){yield this.balanceService.warmupCache("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:e},method:"GET"})})}clearBalanceCache(){this.balanceService.clearCache()}getBalanceCacheStats(){return this.balanceService.getCacheStats()}clearExpiredCache(){this.balanceService.clearExpiredCache()}},Ui=null;function Gi(t){return Ui||(Ui=new Mi(t)),Ui}var Fi=(t,e="JOLI_COIN")=>E(void 0,null,function*(){return yield Gi(t).getBalance(e)}),Tt=(t,e="JOLI_COIN")=>E(void 0,null,function*(){let n=yield Gi(t).refreshBalance(e);return console.log(`Balance cache refreshed for type: ${e}`),n}),Fn=(t,e="JOLI_COIN")=>E(void 0,null,function*(){yield Gi(t).warmupBalance(e),console.log(`Balance cache warmed up for type: ${e}`)});K();var Hi=class{constructor(e){this.httpClient=e}execute(e,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",a=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(e,{query:a}):yield this.httpClient.post(e,{query:a})})}extractCacheableData(e){var r;return{balance:((r=e.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:{balance:e.balance}}}},ji=class{constructor(e){this.gemBalanceService=new Ct(new Hi(e),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let a=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${a}`}})}getGemBalance(e="GEM"){return E(this,null,function*(){return(yield this.gemBalanceService.request("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:e},method:"GET"})).data})}refreshGemBalance(e="GEM"){return E(this,null,function*(){return(yield this.gemBalanceService.forceRequest("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:e},method:"GET"})).data})}warmupGemBalance(e="GEM"){return E(this,null,function*(){yield this.gemBalanceService.warmupCache("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:e},method:"GET"})})}clearGemBalanceCache(){this.gemBalanceService.clearCache()}getGemBalanceCacheStats(){return this.gemBalanceService.getCacheStats()}clearExpiredCache(){this.gemBalanceService.clearExpiredCache()}},Ji=null;function Rl(t){return Ji||(Ji=new ji(t)),Ji}var qi=(t,e="GEM")=>E(void 0,null,function*(){return yield Rl(t).getGemBalance(e)}),zt=(t,e="GEM")=>E(void 0,null,function*(){let n=yield Rl(t).refreshGemBalance(e);return console.log(`Gem balance cache refreshed for type: ${e}`),n});var Ye={JOLI_COIN:{fetchBalance:Fi,getQuantity:t=>{var e,r,n;return(n=(r=(e=t==null?void 0:t.options)==null?void 0:e.find(a=>a.type==="JOLI_COIN"))==null?void 0:r.joliCoinChoices[0].joliCoinQuantity)!=null?n:0},getCurrentUser:t=>{var e;return(e=t==null?void 0:t.userJoliCoin)!=null?e:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(t,e)=>({balance:t,enableAutoDeduct:e}),getUpdateKey:()=>"userJoliCoin",isEnough:(t,e)=>{var r,n;return(n=(r=t==null?void 0:t.options)==null?void 0:r.some(a=>a.type==="JOLI_COIN"&&a.joliCoinChoices.some(i=>{var o;return i.joliCoinQuantity<=((o=e==null?void 0:e.balance)!=null?o:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:qi,getQuantity:t=>{var e,r,n,a;return(a=(n=(r=(e=t==null?void 0:t.options)==null?void 0:e.find(i=>i.type==="JOLI_GEM"))==null?void 0:r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?a:0},getCurrentUser:t=>{var e;return(e=t==null?void 0:t.userGem)!=null?e:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(t,e)=>({balance:t,enableAutoDeduct:e}),getUpdateKey:()=>"userGem",isEnough:(t,e)=>{var n,a,i;let r=t==null?void 0:t.options.find(o=>o.type==="JOLI_GEM");return r?((a=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?a:0)<=((i=e==null?void 0:e.balance)!=null?i:0):!1}}};var Jn=(t,e,r)=>{let{showUnlockWithCurrencyModal:n}=r;je.registerCommand(`Rewards.${t}.useJolicoin`,()=>E(void 0,null,function*(){let a=yield Ie.getData(),i=Ye[e],o=i.getCurrentUser(a),s=i.getQuantity(a),l=!!(o!=null&&o.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",a,l,s),(yield n({enableAutoDeduct:l,userCurrency:o,quantity:s,currency:e}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},xt=(t,e)=>r=>E(void 0,null,function*(){let n=Xe(ne,Dn);return ne.emit(Ln,t,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:e.confirmButtonText,cancelButtonText:e.cancelButtonText}),(yield n.getFreshData()).useModalResult});Le();Le();var Hn=(t,e,r)=>{let{httpClient:n,initiateAndAwaitPayment:a}=r;je.registerCommand(`Rewards.${t}.usePayment`,()=>E(void 0,null,function*(){var p;let i=yield Ie.getData(),o=Ye[e],s=yield o.fetchBalance(n),l=o.getQuantity(i),d=o.getCurrentUser(i),g=o.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,d.enableAutoDeduct),f=o.getUpdateKey();if(Ie.updateData({[f]:g}),console.log("-----unlockOptions payment-----",i,g,l,e),!o.isEnough(i,g)){let h=yield a({userCurrency:g,currencyQuantity:l,currency:e});return e==="JOLI_GEM"?zt(n):Tt(n),{result:h==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Pt=(t,e)=>r=>E(void 0,null,function*(){let n=Xe(ne,Pn);return ne.emit(xn,t,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:e.confirmButtonText,cancelButtonText:e.cancelButtonText}),(yield n.getFreshData()).paymentResult});fe();Le();Le();K();var Lt=(t,e)=>r=>E(void 0,null,function*(){let n=Xe(ne,Nn);return ne.emit(Un,t,{confirmButtonText:e.confirmButtonText,cancelButtonText:e.cancelButtonText,currency:r}),yield n.getFreshData()});var Eh=(t,e,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:a,unlockOptionsHandler:i,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:d}})=>{Hn(t,"JOLI_COIN",{httpClient:e,initiateAndAwaitPayment:o}),Jn(t,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let g=[`Rewards.${t}.usePayment`,`Rewards.${t}.useJolicoin`];return f=>E(void 0,null,function*(){var p,h,b,I;try{let S=yield i.getData();if(Er(S,d)){let U=Ye.JOLI_COIN,J=yield U.fetchBalance(e),A=U.getCurrentUser(S),P=U.createUpdatedUser((p=J==null?void 0:J.balance)!=null?p:0,A.enableAutoDeduct);if(!U.isEnough(S,P))return a==null||a(f),!1}else{let U=!0;for(let J of g){let A=yield je.executeCommand(J);if(U=U&&A.result!=="FAILED",A.result!=="CONTINUE")break}if(!U)return a==null||a(f),!1}let O=Ni[r],L=yield e.post(O.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${qe()}-${D.mpType}-${Date.now()}`,gameInfo:{gameId:D.mpId}}});if(console.log("-----unlockWithCurrency request result-----",L),L.code=="SUCCESS"){try{(b=f.adBreakDone)==null||b.call(f,{breakType:f.type,breakName:"name"in f&&(h=f.name)!=null?h:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in f&&((I=f.adViewed)==null||I.call(f)),Tt(e)}catch(U){console.error("-----unlockWithJolicoin adBreakDone error-----",U)}return n==null||n({quantity:L.data.quantity,balance:L.data.balance}),!0}return a==null||a(f),!1}catch(S){if(console.info("JolicoinRewardHandler error:",S),S instanceof Error&&S.message=="CANCEL")throw S;return a==null||a(f),!1}finally{i.clearCache()}})},jn=(t,e,r)=>Eh(t,e,"JOLI_COIN",r);var Ol=(t,{onUnlockSuccess:e,onUnlockFailed:r,hasSubscription:n})=>{let a=()=>{r==null||r()},i=xt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),o=Pt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Lt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return jn("ADS-JOLI_COIN",t,{handlers:{handleUnlockSuccess:e,handleUnlockFailed:a,unlockOptionsHandler:Ie,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:i,showUnloginModal:s,hasSubscription:n}})};var kl=(t,{onUnlockSuccess:e,onUnlockFailed:r,hasSubscription:n})=>{let a=d=>{var g;r==null||r(),(g=d.adBreakDone)==null||g.call(d,{breakType:d.type,breakFormat:d.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},i=xt("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),o=Pt("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Lt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return jn("JOLI_COIN",t,{handlers:{handleUnlockSuccess:e,handleUnlockFailed:a,unlockOptionsHandler:Ie,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:i,showUnloginModal:s,hasSubscription:n}})};fe();K();Le();Le();var Tl=t=>{let{showSubscriptionModal:e}=t;je.registerCommand("Rewards.subscription",()=>E(void 0,null,function*(){var s,l;let r=yield Ie.getData(),n=(l=(s=r==null?void 0:r.options)==null?void 0:s.find(d=>d.type==="JOLI_GEM"))==null?void 0:l.type,a=Ye[n?"JOLI_GEM":"JOLI_COIN"],i=a.getCurrentUser(r);return a.isEnough(r,i)?{result:"FAILED"}:{result:(yield e())==="SUCCESS"?"SUCCESS":"FAILED"}}))},xl=t=>()=>E(void 0,null,function*(){let e=Xe(ne,Mn);return ne.emit(Bn,t),(yield e.getFreshData()).result});fe();var Pl=(t,e,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:a,showSubscriptionModal:i,hasSubscription:o}})=>{Tl({showSubscriptionModal:i});let s=["Rewards.subscription"];return l=>E(void 0,null,function*(){var d,g,f,p,h,b;try{let I=yield a.getData();if(!Er(I,o))return!1;let w=!0;for(let O of s){let L=yield je.executeCommand(O);if(w=w&&L.result!=="FAILED",L.result!=="CONTINUE")break}if(Tt(e),zt(e),console.log("-----unlockWithSubscription result-----",w),w){try{(g=l.adBreakDone)==null||g.call(l,{breakType:l.type,breakName:"name"in l&&(d=l.name)!=null?d:"",breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in l&&((f=l.adViewed)==null||f.call(l)),(b=(h=D).onEnvConfigChanged)==null||b.call(h,{hostUserInfo:Re(X({},(p=D.hostUserInfo)!=null?p:{isLogin:!1}),{isSubUser:!0})})}catch(O){console.error("-----unlockWithSubscription adBreakDone error-----",O)}return r==null||r(),!0}return n==null||n(l),!1}catch(I){if(console.info("SubscriptionRewardHandler error:",I),I instanceof Error&&I.message=="CANCEL")throw I;return n==null||n(l),!1}finally{}})};var Ll=(t,{onSubSuccess:e,onSubFailed:r,hasSubscription:n})=>{let a=()=>{r==null||r()},i=xl("SUBSCRIPTION");return Pl("SUBSCRIPTION",t,{handlers:{handleSubSuccess:e,handleSubFailed:a,unlockOptionsHandler:Ie,showSubscriptionModal:i,hasSubscription:n}})};var Qe=Sl();Pi(Qe);Li(Qe);var Kn,j,Ml,Ki,Dt,Dl,Gl,Fl,Jl,Wi,Vi,$i,Ah,Ir={},Hl=[],Sh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ar=Array.isArray;function ct(t,e){for(var r in e)t[r]=e[r];return t}function zi(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Sr(t,e,r){var n,a,i,o={};for(i in e)i=="key"?n=e[i]:i=="ref"?a=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?Kn.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)o[i]===void 0&&(o[i]=t.defaultProps[i]);return Vn(t,o,n,a,null)}function Vn(t,e,r,n,a){var i={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a==null?++Ml:a,__i:-1,__u:0};return a==null&&j.vnode!=null&&j.vnode(i),i}function wt(t){return t.children}function Ge(t,e){this.props=t,this.context=e}function Xt(t,e){if(e==null)return t.__?Xt(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Xt(t):null}function jl(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return jl(t)}}function Nl(t){(!t.__d&&(t.__d=!0)&&Dt.push(t)&&!$n.__r++||Dl!==j.debounceRendering)&&((Dl=j.debounceRendering)||Gl)($n)}function $n(){for(var t,e,r,n,a,i,o,s=1;Dt.length;)Dt.length>s&&Dt.sort(Fl),t=Dt.shift(),s=Dt.length,t.__d&&(r=void 0,a=(n=(e=t).__v).__e,i=[],o=[],e.__P&&((r=ct({},n)).__v=n.__v+1,j.vnode&&j.vnode(r),Xi(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[a]:null,i,a==null?Xt(n):a,!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,$l(i,r,o),r.__e!=a&&jl(r)));$n.__r=0}function ql(t,e,r,n,a,i,o,s,l,d,g){var f,p,h,b,I,S,w=n&&n.__k||Hl,O=e.length;for(l=Ch(r,e,w,l,O),f=0;f<O;f++)(h=r.__k[f])!=null&&(p=h.__i===-1?Ir:w[h.__i]||Ir,h.__i=f,S=Xi(t,h,p,a,i,o,s,l,d,g),b=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&Yi(p.ref,null,h),g.push(h.ref,h.__c||b,h)),I==null&&b!=null&&(I=b),4&h.__u||p.__k===h.__k?l=Vl(h,l,t):typeof h.type=="function"&&S!==void 0?l=S:b&&(l=b.nextSibling),h.__u&=-7);return r.__e=I,l}function Ch(t,e,r,n,a){var i,o,s,l,d,g=r.length,f=g,p=0;for(t.__k=new Array(a),i=0;i<a;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=i+p,(o=t.__k[i]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Vn(null,o,null,null,null):Ar(o)?Vn(wt,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Vn(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,s=null,(d=o.__i=Rh(o,r,l,f))!==-1&&(f--,(s=r[d])&&(s.__u|=2)),s==null||s.__v===null?(d==-1&&(a>g?p--:a<g&&p++),typeof o.type!="function"&&(o.__u|=4)):d!=l&&(d==l-1?p--:d==l+1?p++:(d>l?p--:p++,o.__u|=4))):t.__k[i]=null;if(f)for(i=0;i<g;i++)(s=r[i])!=null&&!(2&s.__u)&&(s.__e==n&&(n=Xt(s)),Wl(s,s));return n}function Vl(t,e,r){var n,a;if(typeof t.type=="function"){for(n=t.__k,a=0;n&&a<n.length;a++)n[a]&&(n[a].__=t,e=Vl(n[a],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Xt(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Cr(t,e){return e=e||[],t==null||typeof t=="boolean"||(Ar(t)?t.some(function(r){Cr(r,e)}):e.push(t)),e}function Rh(t,e,r,n){var a,i,o=t.key,s=t.type,l=e[r];if(l===null&&t.key==null||l&&o==l.key&&s===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(a=r-1,i=r+1;a>=0||i<e.length;){if(a>=0){if((l=e[a])&&!(2&l.__u)&&o==l.key&&s===l.type)return a;a--}if(i<e.length){if((l=e[i])&&!(2&l.__u)&&o==l.key&&s===l.type)return i;i++}}return-1}function Ul(t,e,r){e[0]=="-"?t.setProperty(e,r==null?"":r):t[e]=r==null?"":typeof r!="number"||Sh.test(e)?r:r+"px"}function qn(t,e,r,n,a){var i;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Ul(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||Ul(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Jl,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=r,r?n?r.t=n.t:(r.t=Wi,t.addEventListener(e,i?$i:Vi,i)):t.removeEventListener(e,i?$i:Vi,i);else{if(a=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r==null?"":r;break e}catch(o){}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Bl(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.u==null)e.u=Wi++;else if(e.u<r.t)return;return r(j.event?j.event(e):e)}}}function Xi(t,e,r,n,a,i,o,s,l,d){var g,f,p,h,b,I,S,w,O,L,U,J,A,P,H,q,N,M=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[s=e.__e=r.__e]),(g=j.__b)&&g(e);e:if(typeof M=="function")try{if(w=e.props,O="prototype"in M&&M.prototype.render,L=(g=M.contextType)&&n[g.__c],U=g?L?L.props.value:g.__:n,r.__c?S=(f=e.__c=r.__c).__=f.__E:(O?e.__c=f=new M(w,U):(e.__c=f=new Ge(w,U),f.constructor=M,f.render=kh),L&&L.sub(f),f.props=w,f.state||(f.state={}),f.context=U,f.__n=n,p=f.__d=!0,f.__h=[],f._sb=[]),O&&f.__s==null&&(f.__s=f.state),O&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ct({},f.__s)),ct(f.__s,M.getDerivedStateFromProps(w,f.__s))),h=f.props,b=f.state,f.__v=e,p)O&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),O&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(O&&M.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,U),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,U)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(f.props=w,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(F){F&&(F.__=e)}),J=0;J<f._sb.length;J++)f.__h.push(f._sb[J]);f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,U),O&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,b,I)})}if(f.context=U,f.props=w,f.__P=t,f.__e=!1,A=j.__r,P=0,O){for(f.state=f.__s,f.__d=!1,A&&A(e),g=f.render(f.props,f.state,f.context),H=0;H<f._sb.length;H++)f.__h.push(f._sb[H]);f._sb=[]}else do f.__d=!1,A&&A(e),g=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(n=ct(ct({},n),f.getChildContext())),O&&!p&&f.getSnapshotBeforeUpdate!=null&&(I=f.getSnapshotBeforeUpdate(h,b)),q=g,g!=null&&g.type===wt&&g.key==null&&(q=Kl(g.props.children)),s=ql(t,Ar(q)?q:[q],e,r,n,a,i,o,s,l,d),f.base=e.__e,e.__u&=-161,f.__h.length&&o.push(f),S&&(f.__E=f.__=null)}catch(F){if(e.__v=null,l||i!=null)if(F.then){for(e.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,e.__e=s}else for(N=i.length;N--;)zi(i[N]);else e.__e=r.__e,e.__k=r.__k;j.__e(F,e,r)}else i==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):s=e.__e=Oh(r.__e,e,r,n,a,i,o,l,d);return(g=j.diffed)&&g(e),128&e.__u?void 0:s}function $l(t,e,r){for(var n=0;n<r.length;n++)Yi(r[n],r[++n],r[++n]);j.__c&&j.__c(e,t),t.some(function(a){try{t=a.__h,a.__h=[],t.some(function(i){i.call(a)})}catch(i){j.__e(i,a.__v)}})}function Kl(t){return typeof t!="object"||t==null?t:Ar(t)?t.map(Kl):ct({},t)}function Oh(t,e,r,n,a,i,o,s,l){var d,g,f,p,h,b,I,S=r.props,w=e.props,O=e.type;if(O=="svg"?a="http://www.w3.org/2000/svg":O=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(d=0;d<i.length;d++)if((h=i[d])&&"setAttribute"in h==!!O&&(O?h.localName==O:h.nodeType==3)){t=h,i[d]=null;break}}if(t==null){if(O==null)return document.createTextNode(w);t=document.createElementNS(a,O,w.is&&w),s&&(j.__m&&j.__m(e,i),s=!1),i=null}if(O===null)S===w||s&&t.data===w||(t.data=w);else{if(i=i&&Kn.call(t.childNodes),S=r.props||Ir,!s&&i!=null)for(S={},d=0;d<t.attributes.length;d++)S[(h=t.attributes[d]).name]=h.value;for(d in S)if(h=S[d],d!="children"){if(d=="dangerouslySetInnerHTML")f=h;else if(!(d in w)){if(d=="value"&&"defaultValue"in w||d=="checked"&&"defaultChecked"in w)continue;qn(t,d,null,h,a)}}for(d in w)h=w[d],d=="children"?p=h:d=="dangerouslySetInnerHTML"?g=h:d=="value"?b=h:d=="checked"?I=h:s&&typeof h!="function"||S[d]===h||qn(t,d,h,S[d],a);if(g)s||f&&(g.__html===f.__html||g.__html===t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(f&&(t.innerHTML=""),ql(e.type==="template"?t.content:t,Ar(p)?p:[p],e,r,n,O=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,o,i?i[0]:r.__k&&Xt(r,0),s,l),i!=null)for(d=i.length;d--;)zi(i[d]);s||(d="value",O=="progress"&&b==null?t.removeAttribute("value"):b!==void 0&&(b!==t[d]||O=="progress"&&!b||O=="option"&&b!==S[d])&&qn(t,d,b,S[d],a),d="checked",I!==void 0&&I!==t[d]&&qn(t,d,I,S[d],a))}return t}function Yi(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(a){j.__e(a,r)}}function Wl(t,e,r){var n,a;if(j.unmount&&j.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Yi(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){j.__e(i,e)}n.base=n.__P=null}if(n=t.__k)for(a=0;a<n.length;a++)n[a]&&Wl(n[a],e,r||typeof t.type!="function");r||zi(t.__e),t.__c=t.__=t.__e=void 0}function kh(t,e,r){return this.constructor(t,r)}function zl(t,e,r){var n,a,i,o;e==document&&(e=document.documentElement),j.__&&j.__(t,e),a=(n=typeof r=="function")?null:r&&r.__k||e.__k,i=[],o=[],Xi(e,t=(!n&&r||e).__k=Sr(wt,null,[t]),a||Ir,Ir,e.namespaceURI,!n&&r?[r]:a?null:e.firstChild?Kn.call(e.childNodes):null,i,!n&&r?r:a?a.__e:e.firstChild,n,o),$l(i,t,o)}Kn=Hl.slice,j={__e:function(t,e,r,n){for(var a,i,o;e=e.__;)if((a=e.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(t)),o=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(t,n||{}),o=a.__d),o)return a.__E=a}catch(s){t=s}throw t}},Ml=0,Ki=function(t){return t!=null&&t.constructor==null},Ge.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ct({},this.state),typeof t=="function"&&(t=t(ct({},r),this.props)),t&&ct(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Nl(this))},Ge.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Nl(this))},Ge.prototype.render=wt,Dt=[],Gl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fl=function(t,e){return t.__v.__b-e.__v.__b},$n.__r=0,Jl=/(PointerCapture)$|Capture$/i,Wi=0,Vi=Bl(!1),$i=Bl(!0),Ah=0;var Yt,le,Qi,Xl,Rr=0,ac=[],de=j,Yl=de.__b,Ql=de.__r,Zl=de.diffed,ec=de.__c,tc=de.unmount,rc=de.__;function zn(t,e){de.__h&&de.__h(le,t,Rr||e),Rr=0;var r=le.__H||(le.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function dt(t){return Rr=1,ic(oc,t)}function ic(t,e,r){var n=zn(Yt++,2);if(n.t=t,!n.__c&&(n.__=[r?r(e):oc(void 0,e),function(s){var l=n.__N?n.__N[0]:n.__[0],d=n.t(l,s);l!==d&&(n.__N=[d,n.__[1]],n.__c.setState({}))}],n.__c=le,!le.__f)){var a=function(s,l,d){if(!n.__c.__H)return!0;var g=n.__c.__H.__.filter(function(p){return!!p.__c});if(g.every(function(p){return!p.__N}))return!i||i.call(this,s,l,d);var f=n.__c.props!==s;return g.forEach(function(p){if(p.__N){var h=p.__[0];p.__=p.__N,p.__N=void 0,h!==p.__[0]&&(f=!0)}}),i&&i.call(this,s,l,d)||f};le.__f=!0;var i=le.shouldComponentUpdate,o=le.componentWillUpdate;le.componentWillUpdate=function(s,l,d){if(this.__e){var g=i;i=void 0,a(s,l,d),i=g}o&&o.call(this,s,l,d)},le.shouldComponentUpdate=a}return n.__N||n.__}function Nt(t,e){var r=zn(Yt++,3);!de.__s&&to(r.__H,e)&&(r.__=t,r.u=e,le.__H.__h.push(r))}function eo(t,e){var r=zn(Yt++,4);!de.__s&&to(r.__H,e)&&(r.__=t,r.u=e,le.__h.push(r))}function Xn(t){return Rr=5,Or(function(){return{current:t}},[])}function Or(t,e){var r=zn(Yt++,7);return to(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function kr(t,e){return Rr=8,Or(function(){return t},e)}function Th(){for(var t;t=ac.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Wn),t.__H.__h.forEach(Zi),t.__H.__h=[]}catch(e){t.__H.__h=[],de.__e(e,t.__v)}}de.__b=function(t){le=null,Yl&&Yl(t)},de.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),rc&&rc(t,e)},de.__r=function(t){Ql&&Ql(t),Yt=0;var e=(le=t.__c).__H;e&&(Qi===le?(e.__h=[],le.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Wn),e.__h.forEach(Zi),e.__h=[],Yt=0)),Qi=le},de.diffed=function(t){Zl&&Zl(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ac.push(e)!==1&&Xl===de.requestAnimationFrame||((Xl=de.requestAnimationFrame)||xh)(Th)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Qi=le=null},de.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Wn),r.__h=r.__h.filter(function(n){return!n.__||Zi(n)})}catch(n){e.some(function(a){a.__h&&(a.__h=[])}),e=[],de.__e(n,r.__v)}}),ec&&ec(t,e)},de.unmount=function(t){tc&&tc(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Wn(n)}catch(a){e=a}}),r.__H=void 0,e&&de.__e(e,r.__v))};var nc=typeof requestAnimationFrame=="function";function xh(t){var e,r=function(){clearTimeout(n),nc&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);nc&&(e=requestAnimationFrame(r))}function Wn(t){var e=le,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),le=e}function Zi(t){var e=le;t.__c=t.__(),le=e}function to(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function oc(t,e){return typeof e=="function"?e(t):e}function Lh(t,e){for(var r in e)t[r]=e[r];return t}function sc(t,e){for(var r in t)if(r!=="__source"&&!(r in e))return!0;for(var n in e)if(n!=="__source"&&t[n]!==e[n])return!0;return!1}function lc(t,e){this.props=t,this.context=e}(lc.prototype=new Ge).isPureReactComponent=!0,lc.prototype.shouldComponentUpdate=function(t,e){return sc(this.props,t)||sc(this.state,e)};var cc=j.__b;j.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),cc&&cc(t)};var uI=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Dh=j.__e;j.__e=function(t,e,r,n){if(t.then){for(var a,i=e;i=i.__;)if((a=i.__c)&&a.__c)return e.__e==null&&(e.__e=r.__e,e.__k=r.__k),a.__c(t,e)}Dh(t,e,r,n)};var dc=j.unmount;function gc(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),t.__c.__H=null),(t=Lh({},t)).__c!=null&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(n){return gc(n,e,r)})),t}function _c(t,e,r){return t&&r&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(n){return _c(n,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=r)),t}function ro(){this.__u=0,this.o=null,this.__b=null}function yc(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Yn(){this.i=null,this.l=null}j.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),dc&&dc(t)},(ro.prototype=new Ge).__c=function(t,e){var r=e.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var a=yc(n.__v),i=!1,o=function(){i||(i=!0,r.__R=null,a?a(s):s())};r.__R=o;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=_c(l,l.__c.__P,l.__c.__O)}var d;for(n.setState({__a:n.__b=null});d=n.o.pop();)d.forceUpdate()}};n.__u++||32&e.__u||n.setState({__a:n.__b=n.__v.__k[0]}),t.then(o,o)},ro.prototype.componentWillUnmount=function(){this.o=[]},ro.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=gc(this.__b,r,n.__O=n.__P)}this.__b=null}var a=e.__a&&Sr(wt,null,t.fallback);return a&&(a.__u&=-33),[Sr(wt,null,e.__a?null:t.children),a]};var uc=function(t,e,r){if(++r[1]===r[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(r=t.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;t.i=r=r[2]}};(Yn.prototype=new Ge).__a=function(t){var e=this,r=yc(e.__v),n=e.l.get(t);return n[0]++,function(a){var i=function(){e.props.revealOrder?(n.push(a),uc(e,t,n)):a()};r?r(i):i()}},Yn.prototype.render=function(t){this.i=null,this.l=new Map;var e=Cr(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var r=e.length;r--;)this.l.set(e[r],this.i=[1,0,this.i]);return t.children},Yn.prototype.componentDidUpdate=Yn.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,r){uc(t,r,e)})};var Nh=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Uh=/^(?: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]/,Bh=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Mh=/[A-Z0-9]/g,Gh=typeof document!="undefined",Fh=function(t){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function Qn(t,e,r){return e.__k==null&&(e.textContent=""),zl(t,e),typeof r=="function"&&r(),t?t.__c:null}Ge.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Ge.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var fc=j.event;function Jh(){}function Hh(){return this.cancelBubble}function jh(){return this.defaultPrevented}j.event=function(t){return fc&&(t=fc(t)),t.persist=Jh,t.isPropagationStopped=Hh,t.isDefaultPrevented=jh,t.nativeEvent=t};var wc,qh={enumerable:!1,configurable:!0,get:function(){return this.class}},hc=j.vnode;j.vnode=function(t){typeof t.type=="string"&&function(e){var r=e.props,n=e.type,a={},i=n.indexOf("-")===-1;for(var o in r){var s=r[o];if(!(o==="value"&&"defaultValue"in r&&s==null||Gh&&o==="children"&&n==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in r&&r.value==null?o="value":o==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||Fh(r.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Bh.test(o)&&(o=l):l=o="oninput":i&&Uh.test(o)?o=o.replace(Mh,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&a[o=l]&&(o="oninputCapture"),a[o]=s}}n=="select"&&a.multiple&&Array.isArray(a.value)&&(a.value=Cr(r.children).forEach(function(d){d.props.selected=a.value.indexOf(d.props.value)!=-1})),n=="select"&&a.defaultValue!=null&&(a.value=Cr(r.children).forEach(function(d){d.props.selected=a.multiple?a.defaultValue.indexOf(d.props.value)!=-1:a.defaultValue==d.props.value})),r.class&&!r.className?(a.class=r.class,Object.defineProperty(a,"className",qh)):(r.className&&!r.class||r.class&&r.className)&&(a.class=a.className=r.className),e.props=a}(t),t.$$typeof=Nh,hc&&hc(t)};var mc=j.__r;j.__r=function(t){mc&&mc(t),wc=t.__c};var pc=j.diffed;j.diffed=function(t){pc&&pc(t);var e=t.props,r=t.__e;r!=null&&t.type==="textarea"&&"value"in e&&e.value!==r.value&&(r.value=e.value==null?"":e.value),wc=null};import{registerCanIUseContext as Xh,invokeNative as no,offNative as Yh,onNative as Qh}from"@jolibox/native-bridge";var Vh=Object.defineProperty,$h=Object.defineProperties,Kh=Object.getOwnPropertyDescriptors,la=Object.getOwnPropertySymbols,$c=Object.prototype.hasOwnProperty,Kc=Object.prototype.propertyIsEnumerable,bc=(t,e,r)=>e in t?Vh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wc=(t,e)=>{for(var r in e||(e={}))$c.call(e,r)&&bc(t,r,e[r]);if(la)for(var r of la(e))Kc.call(e,r)&&bc(t,r,e[r]);return t},Wh=(t,e)=>$h(t,Kh(e)),zh=(t,e)=>{var r={};for(var n in t)$c.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&la)for(var n of la(t))e.indexOf(n)<0&&Kc.call(t,n)&&(r[n]=t[n]);return r},zc=Object.defineProperty,Zh=Object.defineProperties,em=Object.getOwnPropertyDescriptors,Ec=Object.getOwnPropertySymbols,tm=Object.prototype.hasOwnProperty,rm=Object.prototype.propertyIsEnumerable,Ic=(t,e,r)=>e in t?zc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nm=(t,e)=>{for(var r in e||(e={}))tm.call(e,r)&&Ic(t,r,e[r]);if(Ec)for(var r of Ec(e))rm.call(e,r)&&Ic(t,r,e[r]);return t},am=(t,e)=>Zh(t,em(e)),im=(t,e)=>{for(var r in e)zc(t,r,{get:e[r],enumerable:!0})},Xc=(t,e,r,n)=>{for(var a=e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(a=o(a)||a);return a},om=(t,e,r)=>new Promise((n,a)=>{var i=l=>{try{s(r.next(l))}catch(d){a(d)}},o=l=>{try{s(r.throw(l))}catch(d){a(d)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,o);s((r=r.apply(t,e)).next())});if(typeof window!="undefined"&&!window.AbortController){let t=function(){this.signal=new e};t.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 e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},e.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let a=this._eventListeners[r].indexOf(n);a!==-1&&this._eventListeners[r].splice(a,1)},e.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=t,window.AbortSignal=e}function sm(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}function lm(t){return typeof t=="string"}function cm(t){return typeof t=="undefined"}function dm(t){return cm(t)||t===null}function um(t){return typeof t=="function"}function Yc(t){let e=t,r=null,n=function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return r||(r=new e(...i)),r};return n.prototype=e.prototype,n}var fm=(t=>(t[t.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",t[t.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",t[t.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",t[t.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",t[t.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",t[t.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",t[t.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",t[t.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",t))(fm||{});function Tr(t){return function(){var e,r;((r=(e=globalThis.VConsole)==null?void 0:e[t])!=null?r:globalThis.console[t])(...arguments)}}var hm={log:Tr("log"),warn:Tr("warn"),info:Tr("info"),error:Tr("error"),debug:Tr("debug")};Object.assign(globalThis,{logger:hm});var Ac=Symbol.for("Jolibox.canIUseMap"),mm={};globalThis[Ac]||(globalThis[Ac]=mm);var Sc=Symbol.for("Jolibox.canIUseMap.native"),pm={};globalThis[Sc]||(globalThis[Sc]=pm);var Qc=(t=>(t[t.Other=0]="Other",t[t.Route=1]="Route",t[t.Click=2]="Click",t[t.View=3]="View",t[t.Expose=4]="Expose",t[t.Swipe=5]="Swipe",t[t.Input=6]="Input",t[t.Select=7]="Select",t[t.SwitchOn=8]="SwitchOn",t[t.SwitchOff=9]="SwitchOff",t[t.Submit=10]="Submit",t[t.Scroll=11]="Scroll",t[t.Hide=12]="Hide",t[t.System=1e3]="System",t[t.ErrorTrace=1001]="ErrorTrace",t[t.UserDefined=1002]="UserDefined",t))(Qc||{}),Zc=(t=>(t.MiniGame="mini-game",t.MiniDrama="mini-drama",t.App="app",t.WebSDK="web-sdk",t.AppSDK="app-sdk",t))(Zc||{}),ed=(t=>(t[t.App=0]="App",t[t.H5=1]="H5",t[t.Weapp=2]="Weapp",t[t.Alipay=3]="Alipay",t[t.Gcash=4]="Gcash",t[t.Dana=5]="Dana",t[t.Umma=6]="Umma",t[t.WebSDK=1e3]="WebSDK",t[t.AppSDK=1001]="AppSDK",t[t.Other=9999]="Other",t))(ed||{}),Cc=["name","params"],vm=["name","type","location","target","extra","timestamp","userId"],gm=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function ra(t,e){return e.map(r=>{if(r==="params"&&t[r]){let n=t[r];return Object.keys(n).reduce((a,i)=>(a[i]=String(n[i]),a),{})}return t[r]})}function _m(t){let e=t.location?ra(t.location,Cc):null,r=t.target?ra(t.target,Cc):null;return ra(am(nm({},t),{location:e,target:r}),vm)}function ym(t){let e=t.events.map(n=>_m(n)),r=ra(t.device,gm);return[t.protocolVersion,e,r,t.project]}function wm(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let t=Object.getOwnPropertyDescriptor(window,"localStorage");if(t&&t.get){let n=t.get.call(window);return window.__joliboxLocalStorage__=n,n}if(t=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),t&&t.get)return t.get.call(window);let e=Window.prototype,r=Object.getOwnPropertyDescriptor(e,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(t){return console.warn("Failed to get original localStorage, fallback to default implementation",t),localStorage}}wm();var er=typeof window=="undefined",uo=()=>!er&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!er&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!er&&navigator.userAgent.includes("Android"),!er&&navigator.userAgent.includes("Mac"),!er&&navigator.userAgent.includes("FB_IAB"),!er&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var fo=class ho{constructor(e){this.element=e,this.next=ho.Undefined,this.prev=ho.Undefined}};fo.Undefined=new fo(void 0);var se=fo,bm=class{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let t=this._first;for(;t!==se.Undefined;){let e=t.next;t.prev=se.Undefined,t.next=se.Undefined,t=e}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let r=new se(t);if(this._first===se.Undefined)this._first=r,this._last=r;else if(e){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==se.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==se.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==se.Undefined&&t.next!==se.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===se.Undefined&&t.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):t.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):t.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==se.Undefined;)yield t.element,t=t.next}},Em=0,xr=class{constructor(t){this.value=t,this.id=Em++}},Ur=class{constructor(t){this.options=t,this._size=0}dispose(t){var e,r;this._disposed||(this._disposed=!0,this._listeners&&(t?(this._listeners instanceof xr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===t)):(this._listeners=void 0,this._size=0)),(r=(e=this.options)==null?void 0:e.onDidRemoveLastListener)==null||r.call(e))}get event(){return this._event!=null||(this._event=(t,e)=>{var r,n,a,i,o,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};e&&(t=t.bind(e));let l=new xr(t);return this._listeners?this._listeners instanceof xr?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,(i=(a=this.options)==null?void 0:a.onDidFirstListener)==null||i.call(a,this)),(s=(o=this.options)==null?void 0:o.onDidAddListener)==null||s.call(o,this),this._size++,()=>{var d,g,f,p;if(!this._disposed){if(this._listeners instanceof xr)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(g=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||g.call(d));else if(this._listeners){let h=this._listeners.indexOf(l);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((p=(f=this.options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f)))}}}}),this._event}_deliver(t,e){var r;if(!t)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){t.value(e);return}try{t.value(e)}catch(a){n(a)}}fire(t){this._listeners&&(this._listeners instanceof xr?this._deliver(this._listeners,t):this._listeners.forEach(e=>this._deliver(e,t)))}hasListeners(){return this._size>0}},Im=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var n;let a=(n=this.listeners.get(t))!=null?n:new Ur,i=l=>e(...l.args),o=a.event(i);this.listerHandlerMap.set(e,{handler:i,dispose:o}),this.listeners.set(t,a);let s=this.cachedEventQueue.get(t);if(s&&r)for(let l of s)e(...l.args)}flushCachedEvent(t){t?this.cachedEventQueue.delete(t):this.cachedEventQueue.clear()}off(t,e){let r=this.listerHandlerMap.get(e);r&&(r.dispose(),this.listerHandlerMap.delete(e))}emit(t){let e=this.listeners.get(t),r=this.cachedEventQueue.get(t);for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];r||(r=new bm,this.cachedEventQueue.set(t,r)),r.push({args:a}),e&&e.fire({event:t,args:a})}once(t,e){var r=this;let n=function(){e(...arguments),r.off(t,n)};this.on(t,n,!1)}},mo={};im(mo,{None:()=>Am,filter:()=>Cm,once:()=>td,toPromise:()=>Sm});var Am=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Sm(t){return new Promise(e=>td(t)(e))}function td(t){return function(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return t(a=>{if(!n)return n=!0,e.call(r,a)},null)}}function Cm(t,e){return(r=>{let n={onWillAddFirstListener(){r(a.fire,a)}},a=new Ur(n);return a.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return t(a=>e(a)&&r.call(n,a),null)})}var ao=Symbol.for("Jolibox.hostEmitter"),Rm=()=>{let t=new Im;return globalThis[ao]||(globalThis[ao]={on:t.on.bind(t),off:t.off.bind(t),emit:t.emit.bind(t),once:t.once.bind(t)}),globalThis[ao]};Rm();function Om(t,e){let r=Math.min(t.length,e.length);for(let n=0;n<r;n++)km(t[n],e[n])}function km(t,e){if(lm(e)){if(typeof t!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(um(e)){try{if(t instanceof e)return}catch(r){}if(!dm(t)&&t.constructor===e||e.length===1&&e.call(void 0,t)===!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 po=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ur,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(t){if(!t)throw new Error("invalid command");if(t.metadata&&Array.isArray(t.metadata.args)){let r=[];for(let a of t.metadata.args)r.push(a.constraint);let n=t.handler;t.handler=function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return Om(i,r),n(...i)}}let{id:e}=t;this._commands.get(e)&&console.info(`[Jolibox SDK] duplicated command is registered ${e}`),this._commands.set(e,t),this._onDidRegisterCommand.fire(e)}getCommand(t){return this._commands.get(t)}getCommands(){let t=new Map;for(let e of this._commands.keys()){let r=this.getCommand(e);r&&t.set(e,r)}return t}};po=Xc([Yc],po);var Rc=class{constructor(){this._onWillExecuteCommand=new Ur,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ur,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new po,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=sm(3e4)),this._starActivation}executeCommand(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return om(this,null,function*(){return this.registry.getCommand(t)?this._tryExecuteCommand(t,r):(yield Promise.all([Promise.race([this._activateStar(),mo.toPromise(mo.filter(this.registry.onDidRegisterCommand,a=>a===t))])]),this._tryExecuteCommand(t,r))})}executeCommandThowErr(t){if(!this.registry.getCommand(t))throw new Error(`command '${t}' not found`);let e=this.registry.getCommand(t);for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];this._onWillExecuteCommand.fire({commandId:t,args:n});let i=this.invokeFunction(e.handler,...n);return this._onDidExecuteCommand.fire({commandId:t,args:n}),i}_tryExecuteCommand(t,e){let r=this.registry.getCommand(t);if(!r)return Promise.reject(new Error(`command '${t}' not found`));try{this._onWillExecuteCommand.fire({commandId:t,args:e});let n=this.invokeFunction(r.handler,...e);return this._onDidExecuteCommand.fire({commandId:t,args:e}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(t){try{for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return t(...r)}finally{}}};Rc=Xc([Yc],Rc);function De(t,e,r){return(e=Tm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Tm(t){var e=xm(t,"string");return typeof e=="symbol"?e:e+""}function xm(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qt=t=>t?function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];t==null||t(...r)}catch(a){console.error("Error calling function",a)}}:()=>{console.log("wrapUserFunction: fn is undefined")},vo=class{constructor(e){De(this,"context",void 0),De(this,"continueCallback",void 0),De(this,"adIsShowingCallback",void 0),De(this,"isBeforeAdCalled",!1),De(this,"isBeforeRewardCalled",!1),De(this,"isAdDismissedCalled",!1),De(this,"isAdViewedCalled",!1),De(this,"isAfterAdCalled",!1),De(this,"currentProvider",void 0),De(this,"currentClientParams",void 0),De(this,"adsHasResponse",!1),De(this,"videoChecker",window.document.createElement("video")),De(this,"contextInfo",void 0),De(this,"wrapShowAdFn",r=>()=>{var n,a,i;this.adsHasResponse=!0;let o=!1;this.videoChecker.play().catch(()=>{o=!1}),o=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:o},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",Wc({userEvent:o},this.paramsToTrack)),uo()&&this.context.track("mmp_ad_impression",{ad_network:(a=(n=this.currentProvider)==null?void 0:n.name)!=null?a:"",ad_format:"rewarded",module:"game",game_id:this.contextInfo.objectId}),(i=this.adIsShowingCallback)==null||i.call(this,!0);let s=Qt(r);s==null||s()}),this.context=e,this.contextInfo=e.getContextInfo()}notifyIframeAdsEvent(e,r){window.parent&&window.parent.postMessage({type:e,data:r},"*"),window.dispatchEvent(new CustomEvent(e,{detail:r}))}get paramsToTrack(){var e,r,n,a,i,o;return{provider:(r=(e=this.currentProvider)==null?void 0:e.name)!=null?r:null,type:(n=this.currentClientParams)==null?void 0:n.type,name:((a=this.currentClientParams)==null?void 0:a.type)==="preroll"?null:(o=(i=this.currentClientParams)==null?void 0:i.name)!=null?o:""}}wrapBeforeAd(e){return()=>{var r,n,a,i;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 o=Qt(e);o==null||o(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),uo()&&this.context.track("mmp_ad_impression",{ad_network:(i=(a=this.currentProvider)==null?void 0:a.name)!=null?i:"",ad_format:"interstitial",module:"game",game_id:this.contextInfo.objectId}))}}}wrapBeforeReward(e){return r=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(r)():(this.isBeforeRewardCalled=!0,e==null||e(this.wrapShowAdFn(r)))}}wrapAdDismissed(e){return()=>{if(this.adsHasResponse=!0,!this.isAdDismissedCalled){this.isAdDismissedCalled=!0;let r=Qt(e);r==null||r()}}}wrapAdViewed(e){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=Qt(e);r==null||r()}}}wrapAfterAd(e){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=Qt(e);r==null||r()}}}wrapAdBreakDone(e){return r=>{var n,a,i,o,s,l,d,g,f;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(a=(n=this.currentProvider)==null?void 0:n.name)!=null?a:null,breakType:r.breakType,breakName:(i=r.breakName)!=null?i:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(o=this.currentProvider)==null?void 0:o.name)!=null?s:null,breakType:r.breakType,breakName:(l=r.breakName)!=null?l:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=Qt(e);p==null||p(r),(d=this.adIsShowingCallback)==null||d.call(this,!1),(g=this.continueCallback)==null||g.call(this,[!1,r]);break}default:{(f=this.continueCallback)==null||f.call(this,[!0,r]);break}}}}callAdBreakAndContinue(e,r,n,a){return E(this,null,function*(){return this.currentProvider=e,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(i=>{this.continueCallback=i,this.adIsShowingCallback=a;let o;switch(r.type){case"preroll":{o={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{o={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:{o={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,d,g,f,p,h;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:(g=(d=this.currentProvider)==null?void 0:d.name)!=null?g:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(f=r.name)!=null?f:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(h=this.adIsShowingCallback)==null||h.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),e.adBreak(o,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};function Zn(t,e,r){return(e=Pm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pm(t){var e=Lm(t,"string");return typeof e=="symbol"?e:e+""}function Lm(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var go=class{constructor(e){Zn(this,"context",void 0),Zn(this,"adBreakIsShowing",!1),Zn(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Zn(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=e,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};function ea(t,e,r){return(e=Dm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Dm(t){var e=Nm(t,"string");return typeof e=="symbol"?e:e+""}function Nm(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _o=class{constructor(e){ea(this,"configs",null),ea(this,"firstRun",!0),ea(this,"context",void 0),ea(this,"contextInfo",void 0),this.context=e,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return E(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(e){}})}shouldBypassCallingInterstitial(){var e,r;let n;if(!this.configs)this.init(),n=!this.firstRun;else{let a=(e=this.contextInfo.channel)!=null?e:"",i=this.configs[a],o=(r=i==null?void 0:i.interstitialRate)!=null?r:1;n=Math.random()<o}return this.firstRun=!1,n}};function ut(t,e,r){return(e=Um(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Um(t){var e=Bm(t,"string");return typeof e=="symbol"?e:e+""}function Bm(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yo=class{constructor(e,r){ut(this,"name","ADSENSE"),ut(this,"context",void 0),ut(this,"contextInfo",void 0),ut(this,"configured",!1),ut(this,"initParams",void 0),ut(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),ut(this,"adConfig",n=>{let a=n,{onReady:i}=a,o=zh(a,["onReady"]);this.context.track("CallAdConfig",o),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),ut(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),ut(this,"adUnit",n=>E(this,null,function*(){var a,i,o,s;if(this.context.track("CallAdUnit",{adFormat:(i=(a=n.adFormat)==null?void 0:a.toString())!=null?i:null,fullWidthResponsive:(o=n.fullWidthResponsive)!=null?o:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:d,adFormat:g,fullWidthResponsive:f,style:p}=n,h;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?h=document.querySelector(l):h=l,!h)throw new Error("targeting element not found");let b=d;if(b||(b=this.initParams.unitId),!b)throw new Error("slot is required");let I=typeof g=="object"&&Array.isArray(g)?g.join(", "):g,S=document.createElement("ins");if(S.className="adsbygoogle",S.id="jolibox-ads",S.style.display="block",S.setAttribute("data-ad-client",this.initParams.clientId),S.setAttribute("data-ad-slot",b),I&&S.setAttribute("data-ad-format",I),f&&S.setAttribute("data-full-width-responsive",f),p&&S.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",S.style.position="relative",h.appendChild(S),S.appendChild(w)}else h.appendChild(S),new MutationObserver(w=>{w.forEach(O=>{if(O.type==="attributes"&&O.attributeName==="data-ad-status"){let L=S.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:L!=null?L:"null"})}})}).observe(S,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=e,this.contextInfo=this.context.getContextInfo(),this.initParams=r,window.adsbygoogle=window.adsbygoogle||[]}init(){return E(this,null,function*(){var e;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let r="google-adsense",n=(e=this.contextInfo.testAdsMode)!=null?e:!1;if(!document.getElementById(r)&&this.initParams.clientId){let a=document.createElement("script");a.id=r,a.async=!0,a.crossOrigin="anonymous",a.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,n&&a.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&a.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&a.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),this.initParams.admobRewardedSlot&&a.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&a.setAttribute("data-admob-ads-only","on"),document.head.appendChild(a),this.context.track("LoadAdsenseCompleted",null)}})}};function Mm(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function Gm(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var Fm=function(){function t(r){var n=this;this._insertTag=function(a){var i;n.tags.length===0?n.insertionPoint?i=n.insertionPoint.nextSibling:n.prepend?i=n.container.firstChild:i=n.before:i=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(a,i),n.tags.push(a)},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 e=t.prototype;return e.hydrate=function(r){r.forEach(this._insertTag)},e.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Gm(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var a=Mm(n);try{a.insertRule(r,a.cssRules.length)}catch(i){}}else n.appendChild(document.createTextNode(r));this.ctr++},e.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},t}(),Se="-ms-",ca="-moz-",Q="-webkit-",rd="comm",Mo="rule",Go="decl",Jm="@import",nd="@keyframes",Hm="@layer",jm=Math.abs,pa=String.fromCharCode,qm=Object.assign;function Vm(t,e){return ye(t,0)^45?(((e<<2^ye(t,0))<<2^ye(t,1))<<2^ye(t,2))<<2^ye(t,3):0}function ad(t){return t.trim()}function $m(t,e){return(t=e.exec(t))?t[0]:t}function Z(t,e,r){return t.replace(e,r)}function wo(t,e){return t.indexOf(e)}function ye(t,e){return t.charCodeAt(e)|0}function Br(t,e,r){return t.slice(e,r)}function Ze(t){return t.length}function Fo(t){return t.length}function ta(t,e){return e.push(t),t}function Km(t,e){return t.map(e).join("")}var va=1,nr=1,id=0,Ue=0,me=0,ar="";function ga(t,e,r,n,a,i,o){return{value:t,root:e,parent:r,type:n,props:a,children:i,line:va,column:nr,length:o,return:""}}function Pr(t,e){return qm(ga("",null,null,"",null,null,0),t,{length:-t.length},e)}function Wm(){return me}function zm(){return me=Ue>0?ye(ar,--Ue):0,nr--,me===10&&(nr=1,va--),me}function Je(){return me=Ue<id?ye(ar,Ue++):0,nr++,me===10&&(nr=1,va++),me}function et(){return ye(ar,Ue)}function na(){return Ue}function Fr(t,e){return Br(ar,t,e)}function Mr(t){switch(t){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 od(t){return va=nr=1,id=Ze(ar=t),Ue=0,[]}function sd(t){return ar="",t}function aa(t){return ad(Fr(Ue-1,bo(t===91?t+2:t===40?t+1:t)))}function Xm(t){for(;(me=et())&&me<33;)Je();return Mr(t)>2||Mr(me)>3?"":" "}function Ym(t,e){for(;--e&&Je()&&!(me<48||me>102||me>57&&me<65||me>70&&me<97););return Fr(t,na()+(e<6&&et()==32&&Je()==32))}function bo(t){for(;Je();)switch(me){case t:return Ue;case 34:case 39:t!==34&&t!==39&&bo(me);break;case 40:t===41&&bo(t);break;case 92:Je();break}return Ue}function Qm(t,e){for(;Je()&&t+me!==57&&!(t+me===84&&et()===47););return"/*"+Fr(e,Ue-1)+"*"+pa(t===47?t:Je())}function Zm(t){for(;!Mr(et());)Je();return Fr(t,Ue)}function ep(t){return sd(ia("",null,null,null,[""],t=od(t),0,[0],t))}function ia(t,e,r,n,a,i,o,s,l){for(var d=0,g=0,f=o,p=0,h=0,b=0,I=1,S=1,w=1,O=0,L="",U=a,J=i,A=n,P=L;S;)switch(b=O,O=Je()){case 40:if(b!=108&&ye(P,f-1)==58){wo(P+=Z(aa(O),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:P+=aa(O);break;case 9:case 10:case 13:case 32:P+=Xm(b);break;case 92:P+=Ym(na()-1,7);continue;case 47:switch(et()){case 42:case 47:ta(tp(Qm(Je(),na()),e,r),l);break;default:P+="/"}break;case 123*I:s[d++]=Ze(P)*w;case 125*I:case 59:case 0:switch(O){case 0:case 125:S=0;case 59+g:w==-1&&(P=Z(P,/\f/g,"")),h>0&&Ze(P)-f&&ta(h>32?kc(P+";",n,r,f-1):kc(Z(P," ","")+";",n,r,f-2),l);break;case 59:P+=";";default:if(ta(A=Oc(P,e,r,d,g,a,s,L,U=[],J=[],f),i),O===123)if(g===0)ia(P,e,A,A,U,i,f,s,J);else switch(p===99&&ye(P,3)===110?100:p){case 100:case 108:case 109:case 115:ia(t,A,A,n&&ta(Oc(t,A,A,0,0,a,s,L,a,U=[],f),J),a,J,f,s,n?U:J);break;default:ia(P,A,A,A,[""],J,0,s,J)}}d=g=h=0,I=w=1,L=P="",f=o;break;case 58:f=1+Ze(P),h=b;default:if(I<1){if(O==123)--I;else if(O==125&&I++==0&&zm()==125)continue}switch(P+=pa(O),O*I){case 38:w=g>0?1:(P+="\f",-1);break;case 44:s[d++]=(Ze(P)-1)*w,w=1;break;case 64:et()===45&&(P+=aa(Je())),p=et(),g=f=Ze(L=P+=Zm(na())),O++;break;case 45:b===45&&Ze(P)==2&&(I=0)}}return i}function Oc(t,e,r,n,a,i,o,s,l,d,g){for(var f=a-1,p=a===0?i:[""],h=Fo(p),b=0,I=0,S=0;b<n;++b)for(var w=0,O=Br(t,f+1,f=jm(I=o[b])),L=t;w<h;++w)(L=ad(I>0?p[w]+" "+O:Z(O,/&\f/g,p[w])))&&(l[S++]=L);return ga(t,e,r,a===0?Mo:s,l,d,g)}function tp(t,e,r){return ga(t,e,r,rd,pa(Wm()),Br(t,2,-2),0)}function kc(t,e,r,n){return ga(t,e,r,Go,Br(t,0,n),Br(t,n+1,-1),n)}function rr(t,e){for(var r="",n=Fo(t),a=0;a<n;a++)r+=e(t[a],a,t,e)||"";return r}function rp(t,e,r,n){switch(t.type){case Hm:if(t.children.length)break;case Jm:case Go:return t.return=t.return||t.value;case rd:return"";case nd:return t.return=t.value+"{"+rr(t.children,n)+"}";case Mo:t.value=t.props.join(",")}return Ze(r=rr(t.children,n))?t.return=t.value+"{"+r+"}":""}function np(t){var e=Fo(t);return function(r,n,a,i){for(var o="",s=0;s<e;s++)o+=t[s](r,n,a,i)||"";return o}}function ap(t){return function(e){e.root||(e=e.return)&&t(e)}}function ip(t){var e=Object.create(null);return function(r){return e[r]===void 0&&(e[r]=t(r)),e[r]}}var op=function(t,e,r){for(var n=0,a=0;n=a,a=et(),n===38&&a===12&&(e[r]=1),!Mr(a);)Je();return Fr(t,Ue)},sp=function(t,e){var r=-1,n=44;do switch(Mr(n)){case 0:n===38&&et()===12&&(e[r]=1),t[r]+=op(Ue-1,e,r);break;case 2:t[r]+=aa(n);break;case 4:if(n===44){t[++r]=et()===58?"&\f":"",e[r]=t[r].length;break}default:t[r]+=pa(n)}while(n=Je());return t},lp=function(t,e){return sd(sp(od(t),e))},Tc=new WeakMap,cp=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var e=t.value,r=t.parent,n=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&e.charCodeAt(0)!==58&&!Tc.get(r))&&!n){Tc.set(t,!0);for(var a=[],i=lp(e,a),o=r.props,s=0,l=0;s<i.length;s++)for(var d=0;d<o.length;d++,l++)t.props[l]=a[s]?i[s].replace(/&\f/g,o[d]):o[d]+" "+i[s]}}},dp=function(t){if(t.type==="decl"){var e=t.value;e.charCodeAt(0)===108&&e.charCodeAt(2)===98&&(t.return="",t.value="")}};function ld(t,e){switch(Vm(t,e)){case 5103:return Q+"print-"+t+t;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 Q+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Q+t+ca+t+Se+t+t;case 6828:case 4268:return Q+t+Se+t+t;case 6165:return Q+t+Se+"flex-"+t+t;case 5187:return Q+t+Z(t,/(\w+).+(:[^]+)/,Q+"box-$1$2"+Se+"flex-$1$2")+t;case 5443:return Q+t+Se+"flex-item-"+Z(t,/flex-|-self/,"")+t;case 4675:return Q+t+Se+"flex-line-pack"+Z(t,/align-content|flex-|-self/,"")+t;case 5548:return Q+t+Se+Z(t,"shrink","negative")+t;case 5292:return Q+t+Se+Z(t,"basis","preferred-size")+t;case 6060:return Q+"box-"+Z(t,"-grow","")+Q+t+Se+Z(t,"grow","positive")+t;case 4554:return Q+Z(t,/([^-])(transform)/g,"$1"+Q+"$2")+t;case 6187:return Z(Z(Z(t,/(zoom-|grab)/,Q+"$1"),/(image-set)/,Q+"$1"),t,"")+t;case 5495:case 3959:return Z(t,/(image-set\([^]*)/,Q+"$1$`$1");case 4968:return Z(Z(t,/(.+:)(flex-)?(.*)/,Q+"box-pack:$3"+Se+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Q+t+t;case 4095:case 3583:case 4068:case 2532:return Z(t,/(.+)-inline(.+)/,Q+"$1$2")+t;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(Ze(t)-1-e>6)switch(ye(t,e+1)){case 109:if(ye(t,e+4)!==45)break;case 102:return Z(t,/(.+:)(.+)-([^]+)/,"$1"+Q+"$2-$3$1"+ca+(ye(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~wo(t,"stretch")?ld(Z(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(ye(t,e+1)!==115)break;case 6444:switch(ye(t,Ze(t)-3-(~wo(t,"!important")&&10))){case 107:return Z(t,":",":"+Q)+t;case 101:return Z(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Q+(ye(t,14)===45?"inline-":"")+"box$3$1"+Q+"$2$3$1"+Se+"$2box$3")+t}break;case 5936:switch(ye(t,e+11)){case 114:return Q+t+Se+Z(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Q+t+Se+Z(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Q+t+Se+Z(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Q+t+Se+t+t}return t}var up=function(t,e,r,n){if(t.length>-1&&!t.return)switch(t.type){case Go:t.return=ld(t.value,t.length);break;case nd:return rr([Pr(t,{value:Z(t.value,"@","@"+Q)})],n);case Mo:if(t.length)return Km(t.props,function(a){switch($m(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return rr([Pr(t,{props:[Z(a,/:(read-\w+)/,":"+ca+"$1")]})],n);case"::placeholder":return rr([Pr(t,{props:[Z(a,/:(plac\w+)/,":"+Q+"input-$1")]}),Pr(t,{props:[Z(a,/:(plac\w+)/,":"+ca+"$1")]}),Pr(t,{props:[Z(a,/:(plac\w+)/,Se+"input-$1")]})],n)}return""})}},fp=[up],hp=function(t){var e=t.key;if(e==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(b){var I=b.getAttribute("data-emotion");I.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var n=t.stylisPlugins||fp,a={},i,o=[];i=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+e+' "]'),function(b){for(var I=b.getAttribute("data-emotion").split(" "),S=1;S<I.length;S++)a[I[S]]=!0;o.push(b)});var s,l=[cp,dp];{var d,g=[rp,ap(function(b){d.insert(b)})],f=np(l.concat(n,g)),p=function(b){return rr(ep(b),f)};s=function(b,I,S,w){d=S,p(b?b+"{"+I.styles+"}":I.styles),w&&(h.inserted[I.name]=!0)}}var h={key:e,sheet:new Fm({key:e,container:i,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:a,registered:{},insert:s};return h.sheet.hydrate(o),h};function mp(t){for(var e=0,r,n=0,a=t.length;a>=4;++n,a-=4)r=t.charCodeAt(n)&255|(t.charCodeAt(++n)&255)<<8|(t.charCodeAt(++n)&255)<<16|(t.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,e=(r&65535)*1540483477+((r>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(a){case 3:e^=(t.charCodeAt(n+2)&255)<<16;case 2:e^=(t.charCodeAt(n+1)&255)<<8;case 1:e^=t.charCodeAt(n)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var pp={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},vp=/[A-Z]|^ms/g,gp=/_EMO_([^_]+?)_([^]*?)_EMO_/g,cd=function(t){return t.charCodeAt(1)===45},xc=function(t){return t!=null&&typeof t!="boolean"},io=ip(function(t){return cd(t)?t:t.replace(vp,"-$&").toLowerCase()}),Pc=function(t,e){switch(t){case"animation":case"animationName":if(typeof e=="string")return e.replace(gp,function(r,n,a){return bt={name:n,styles:a,next:bt},n})}return pp[t]!==1&&!cd(t)&&typeof e=="number"&&e!==0?e+"px":e};function da(t,e,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 a=r;if(a.anim===1)return bt={name:a.name,styles:a.styles,next:bt},a.name;var i=r;if(i.styles!==void 0){var o=i.next;if(o!==void 0)for(;o!==void 0;)bt={name:o.name,styles:o.styles,next:bt},o=o.next;var s=i.styles+";";return s}return _p(t,e,r)}}var l=r;if(e==null)return l;var d=e[l];return d!==void 0?d:l}function _p(t,e,r){var n="";if(Array.isArray(r))for(var a=0;a<r.length;a++)n+=da(t,e,r[a])+";";else for(var i in r){var o=r[i];if(typeof o!="object"){var s=o;e!=null&&e[s]!==void 0?n+=i+"{"+e[s]+"}":xc(s)&&(n+=io(i)+":"+Pc(i,s)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(e==null||e[o[0]]===void 0))for(var l=0;l<o.length;l++)xc(o[l])&&(n+=io(i)+":"+Pc(i,o[l])+";");else{var d=da(t,e,o);switch(i){case"animation":case"animationName":{n+=io(i)+":"+d+";";break}default:n+=i+"{"+d+"}"}}}return n}var Lc=/label:\s*([^\s;{]+)\s*(;|$)/g,bt;function oo(t,e,r){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var n=!0,a="";bt=void 0;var i=t[0];if(i==null||i.raw===void 0)n=!1,a+=da(r,e,i);else{var o=i;a+=o[0]}for(var s=1;s<t.length;s++)if(a+=da(r,e,t[s]),n){var l=i;a+=l[s]}Lc.lastIndex=0;for(var d="",g;(g=Lc.exec(a))!==null;)d+="-"+g[1];var f=mp(a)+d;return{name:f,styles:a,next:bt}}function dd(t,e,r){var n="";return r.split(" ").forEach(function(a){t[a]!==void 0?e.push(t[a]+";"):a&&(n+=a+" ")}),n}var yp=function(t,e,r){var n=t.key+"-"+e.name;t.registered[n]===void 0&&(t.registered[n]=e.styles)},wp=function(t,e,r){yp(t,e);var n=t.key+"-"+e.name;if(t.inserted[e.name]===void 0){var a=e;do t.insert(e===a?"."+n:"",a,t.sheet,!0),a=a.next;while(a!==void 0)}};function Dc(t,e){if(t.inserted[e.name]===void 0)return t.insert("",e,t.sheet,!0)}function Nc(t,e,r){var n=[],a=dd(t,n,r);return n.length<2?r:a+e(n)}var bp=function(t){var e=hp(t);e.sheet.speedy=function(o){this.isSpeedy=o},e.compat=!0;var r=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=oo(s,e.registered,void 0);return wp(e,d),e.key+"-"+d.name},n=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=oo(s,e.registered),g="animation-"+d.name;return Dc(e,{name:d.name,styles:"@keyframes "+g+"{"+d.styles+"}"}),g},a=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=oo(s,e.registered);Dc(e,d)},i=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return Nc(e.registered,r,Ep(s))};return{css:r,cx:i,injectGlobal:a,keyframes:n,hydrate:function(o){o.forEach(function(s){e.inserted[s]=!0})},flush:function(){e.registered={},e.inserted={},e.sheet.flush()},sheet:e.sheet,cache:e,getRegisteredStyles:dd.bind(null,e.registered),merge:Nc.bind(null,e.registered,r)}},Ep=function t(e){for(var r="",n=0;n<e.length;n++){var a=e[n];if(a!=null){var i=void 0;switch(typeof a){case"boolean":break;case"object":{if(Array.isArray(a))i=t(a);else{i="";for(var o in a)a[o]&&o&&(i&&(i+=" "),i+=o)}break}default:i=a}i&&(r&&(r+=" "),r+=i)}}return r},Ip=bp({key:"css"}),Ce=Ip.css,Eo,Fe,so,Uc,Bc=0,ud=[],pe=j,Mc=pe.__b,Gc=pe.__r,Fc=pe.diffed,Jc=pe.__c,Hc=pe.unmount,jc=pe.__;function Ap(t,e){pe.__h&&pe.__h(Fe,t,Bc||e),Bc=0;var r=Fe.__H||(Fe.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function fd(t,e){var r=Ap(Eo++,7);return Rp(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Sp(){for(var t;t=ud.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(oa),t.__H.__h.forEach(Io),t.__H.__h=[]}catch(e){t.__H.__h=[],pe.__e(e,t.__v)}}pe.__b=function(t){Fe=null,Mc&&Mc(t)},pe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),jc&&jc(t,e)},pe.__r=function(t){Gc&&Gc(t),Eo=0;var e=(Fe=t.__c).__H;e&&(so===Fe?(e.__h=[],Fe.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(oa),e.__h.forEach(Io),e.__h=[],Eo=0)),so=Fe},pe.diffed=function(t){Fc&&Fc(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ud.push(e)!==1&&Uc===pe.requestAnimationFrame||((Uc=pe.requestAnimationFrame)||Cp)(Sp)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),so=Fe=null},pe.__c=function(t,e){e.some(function(r){try{r.__h.forEach(oa),r.__h=r.__h.filter(function(n){return!n.__||Io(n)})}catch(n){e.some(function(a){a.__h&&(a.__h=[])}),e=[],pe.__e(n,r.__v)}}),Jc&&Jc(t,e)},pe.unmount=function(t){Hc&&Hc(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{oa(n)}catch(a){e=a}}),r.__H=void 0,e&&pe.__e(e,r.__v))};var qc=typeof requestAnimationFrame=="function";function Cp(t){var e,r=function(){clearTimeout(n),qc&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);qc&&(e=requestAnimationFrame(r))}function oa(t){var e=Fe,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Fe=e}function Io(t){var e=Fe;t.__c=t.__(),Fe=e}function Rp(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Op=Symbol.for("preact-signals");function _a(){if(Et>1)Et--;else{for(var t,e=!1;Dr!==void 0;){var r=Dr;for(Dr=void 0,Ao++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&md(r))try{r.c()}catch(a){e||(t=a,e=!0)}r=n}}if(Ao=0,Et--,e)throw t}}function we(t){if(Et>0)return t();Et++;try{return t()}finally{_a()}}var ae=void 0,Dr=void 0,Et=0,Ao=0,ua=0;function hd(t){if(ae!==void 0){var e=t.n;if(e===void 0||e.t!==ae)return e={i:0,S:t,p:ae.s,n:void 0,t:ae,e:void 0,x:void 0,r:e},ae.s!==void 0&&(ae.s.n=e),ae.s=e,t.n=e,32&ae.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=ae.s,e.n=void 0,ae.s.n=e,ae.s=e),e}}function be(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}be.prototype.brand=Op;be.prototype.h=function(){return!0};be.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};be.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};be.prototype.subscribe=function(t){var e=this;return Hr(function(){var r=e.value,n=ae;ae=void 0;try{t(r)}finally{ae=n}})};be.prototype.valueOf=function(){return this.value};be.prototype.toString=function(){return this.value+""};be.prototype.toJSON=function(){return this.value};be.prototype.peek=function(){var t=ae;ae=void 0;try{return this.value}finally{ae=t}};Object.defineProperty(be.prototype,"value",{get:function(){var t=hd(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Ao>100)throw new Error("Cycle detected");this.v=t,this.i++,ua++,Et++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{_a()}}}});function z(t){return new be(t)}function md(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function pd(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function vd(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function ir(t){be.call(this,void 0),this.x=t,this.s=void 0,this.g=ua-1,this.f=4}(ir.prototype=new be).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ua))return!0;if(this.g=ua,this.f|=1,this.i>0&&!md(this))return this.f&=-2,!0;var t=ae;try{pd(this),ae=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return ae=t,vd(this),this.f&=-2,!0};ir.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}be.prototype.S.call(this,t)};ir.prototype.U=function(t){if(this.t!==void 0&&(be.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};ir.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(ir.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=hd(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Nr(t){return new ir(t)}function gd(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Et++;var r=ae;ae=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Jo(t),n}finally{ae=r,_a()}}}function Jo(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,gd(t)}function kp(t){if(ae!==this)throw new Error("Out-of-order effect");vd(this),ae=t,this.f&=-2,8&this.f&&Jo(this),_a()}function Jr(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Jr.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Jr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,gd(this),pd(this),Et++;var t=ae;return ae=this,kp.bind(this,t)};Jr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Dr,Dr=this)};Jr.prototype.d=function(){this.f|=8,1&this.f||Jo(this)};function Hr(t){var e=new Jr(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var _d,lo,yd=[];Hr(function(){_d=this.N})();function or(t,e){j[t]=e.bind(null,j[t]||function(){})}function fa(t){lo&&lo(),lo=t&&t.S()}function wd(t){var e=this,r=t.data,n=bd(r);n.value=r;var a=fd(function(){for(var s=e,l=e.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var d=Nr(function(){var h=n.value.value;return h===0?0:h===!0?"":h||""}),g=Nr(function(){return!Array.isArray(d.value)&&!Ki(d.value)}),f=Hr(function(){if(this.N=Ed,g.value){var h=d.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=h)}}),p=e.__$u.d;return e.__$u.d=function(){f(),p.call(this)},[g,d]},[]),i=a[0],o=a[1];return i.value?o.peek():o.value}wd.displayName="_st";Object.defineProperties(be.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:wd},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});or("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var a in n)if(a!=="children"){var i=n[a];i instanceof be&&(r||(e.__np=r={}),r[a]=i,n[a]=i.peek())}}t(e)});or("__r",function(t,e){fa();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(a){var i;return Hr(function(){i=this}),i.c=function(){n.__$f|=1,n.setState({})},i}())),fa(r),t(e)});or("__e",function(t,e,r,n){fa(),t(e,r,n)});or("diffed",function(t,e){fa();var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,a=e.props;if(n){var i=r.U;if(i)for(var o in i){var s=i[o];s!==void 0&&!(o in n)&&(s.d(),i[o]=void 0)}else i={},r.U=i;for(var l in n){var d=i[l],g=n[l];d===void 0?(d=Tp(r,l,g,a),i[l]=d):d.o(g,a)}}}t(e)});function Tp(t,e,r,n){var a=e in t&&t.ownerSVGElement===void 0,i=z(r);return{o:function(o,s){i.value=o,n=s},d:Hr(function(){this.N=Ed;var o=i.value.value;n[e]!==o&&(n[e]=o,a?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}or("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var a in n){var i=n[a];i&&i.d()}}}}else{var o=e.__c;if(o){var s=o.__$u;s&&(o.__$u=void 0,s.d())}}t(e)});or("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Ge.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var a in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var i=2&this.__$f;if(!(n||i||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function bd(t){return fd(function(){return z(t)},[])}var xp=function(t){queueMicrotask(function(){queueMicrotask(t)})};function Pp(){we(function(){for(var t;t=yd.shift();)_d.call(t)})}function Ed(){yd.push(this)===1&&(j.requestAnimationFrame||xp)(Pp)}var ve=Ce`
12
12
  inset: 0;
13
13
  clear: none;
14
14
  float: none;
@@ -26,8 +26,8 @@ or `);this.errors.push(a)}return n}},kn=class extends me{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 Tg(e,t){let r=ii(e);_o(()=>{r.current=e},[e]),Gt(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}var xg=0;function X(e,t,r,n,i,a){t||(t={});var o,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?o=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--xg,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(o=e.defaultProps))for(s in o)l[s]===void 0&&(l[s]=o[s]);return j.vnode&&j.vnode(c),c}var Ng=Re`
30
- ${ge}
29
+ `;function Lp(t,e){let r=Xn(t);eo(()=>{r.current=t},[t]),Nt(()=>{if(e===null)return;let n=setInterval(()=>{r.current()},e);return()=>{clearInterval(n)}},[e])}var Dp=0;function Y(t,e,r,n,a,i){e||(e={});var o,s,l=e;if("ref"in l)for(s in l={},e)s=="ref"?o=e[s]:l[s]=e[s];var d={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Dp,__i:-1,__u:0,__source:a,__self:i};if(typeof t=="function"&&(o=t.defaultProps))for(s in o)l[s]===void 0&&(l[s]=o[s]);return j.vnode&&j.vnode(d),d}var Np=Ce`
30
+ ${ve}
31
31
  position: fixed;
32
32
  top: 0;
33
33
  left: 0;
@@ -40,7 +40,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
40
40
  height: 100vh;
41
41
 
42
42
  .card-wrapper {
43
- ${ge}
43
+ ${ve}
44
44
  position: relative;
45
45
  display: flex;
46
46
  flex-direction: column;
@@ -54,7 +54,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
54
54
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
55
55
 
56
56
  .body {
57
- ${ge}
57
+ ${ve}
58
58
  display: flex;
59
59
  flex-direction: column;
60
60
  width: 100%;
@@ -63,7 +63,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
63
63
  box-sizing: border-box;
64
64
  justify-content: center;
65
65
  .title {
66
- ${ge}
66
+ ${ve}
67
67
  text-align: center;
68
68
  font-size: 16px;
69
69
  font-weight: bold;
@@ -71,7 +71,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
71
71
  }
72
72
 
73
73
  .content {
74
- ${ge}
74
+ ${ve}
75
75
  font-size: 14px;
76
76
  color: #888;
77
77
  margin-bottom: 16px;
@@ -79,13 +79,13 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
79
79
  }
80
80
 
81
81
  .footer {
82
- ${ge}
82
+ ${ve}
83
83
  display: flex;
84
84
  align-items: center;
85
85
  width: 100%;
86
86
  height: 40px;
87
87
  button {
88
- ${ge}
88
+ ${ve}
89
89
  border: none;
90
90
  outline: none;
91
91
  height: 100%;
@@ -101,8 +101,8 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
101
101
  }
102
102
  }
103
103
  }
104
- `,yt=z(null),ns=z(""),is=z(""),Ei=z(!1),Pg=()=>{var e;(e=yt.value)==null||e.call(yt,!1)},Dg=()=>{var e;(e=yt.value)==null||e.call(yt,!0)},Lg=e=>A(void 0,null,function*(){let{title:t,content:r}=e;return yt.value&&(yt.value(!1),be(()=>{yt.value=null,Ei.value=!1})),be(()=>{ns.value=t||"",is.value=r||"",Ei.value=!0}),new Promise(n=>{yt.value=i=>{be(()=>{yt.value=null,Ei.value=!1,ns.value="",is.value=""}),n(i)}})}),Ug=()=>Ei.value?X("div",{className:Ng,children:X("div",{className:"card-wrapper",children:[X("div",{className:"body",children:[X("div",{className:"title",children:ns.value}),X("div",{className:"content",children:is.value})]}),X("div",{className:"footer",children:[X("button",{onClick:Pg,className:"cancel-btn",children:"Cancel"}),X("button",{onClick:Dg,className:"confirm-btm",children:"Confirm"})]})]})}):null,Bg=Re`
105
- ${ge}
104
+ `,vt=z(null),So=z(""),Co=z(""),sa=z(!1),Up=()=>{var t;(t=vt.value)==null||t.call(vt,!1)},Bp=()=>{var t;(t=vt.value)==null||t.call(vt,!0)},Mp=t=>E(void 0,null,function*(){let{title:e,content:r}=t;return vt.value&&(vt.value(!1),we(()=>{vt.value=null,sa.value=!1})),we(()=>{So.value=e||"",Co.value=r||"",sa.value=!0}),new Promise(n=>{vt.value=a=>{we(()=>{vt.value=null,sa.value=!1,So.value="",Co.value=""}),n(a)}})}),Gp=()=>sa.value?Y("div",{className:Np,children:Y("div",{className:"card-wrapper",children:[Y("div",{className:"body",children:[Y("div",{className:"title",children:So.value}),Y("div",{className:"content",children:Co.value})]}),Y("div",{className:"footer",children:[Y("button",{onClick:Up,className:"cancel-btn",children:"Cancel"}),Y("button",{onClick:Bp,className:"confirm-btm",children:"Confirm"})]})]})}):null,Fp=Ce`
105
+ ${ve}
106
106
  position: relative;
107
107
  display: flex;
108
108
  align-items: center;
@@ -120,7 +120,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
120
120
  }
121
121
 
122
122
  button {
123
- ${ge}
123
+ ${ve}
124
124
  padding: 0 20px;
125
125
  height: 30px;
126
126
  line-height: 30px;
@@ -134,8 +134,8 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
134
134
  cursor: not-allowed;
135
135
  }
136
136
  }
137
- `,Mg=()=>{let e=z(!1),t=z(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{be(()=>{t.value=Date.now(),e.value=!1})}}},Gg=e=>{let{countdown:t=0,mode:r,onClose:n,state:i}=e,{startTimestamp:a,timerPaused:o}=i,s=Iu(t);Tg(()=>{s.value>0?s.value-=1:be(()=>{o.value=!0,s.value=0})},o.value?null:1e3);let l=jr(()=>{if(r==="interstitial"||r==="rewarded_insterstitial"||!a.value)return!1;let h=Date.now()-a.value;return s.value>0&&t-s.value>=5&&h>=5e3}),c=jr(()=>{if(r==="interstitial")return!0;if(!a.value)return!1;let h=Date.now()-a.value;return s.value<=0&&h>=(t-1)*1e3&&t>5}),p=jr(()=>r==="interstitial"?!1:!l.value&&!c.value),u=()=>A(void 0,null,function*(){if(o.value=!0,!(yield Lg({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){o.value=!1;return}n("dismiss"),be(()=>{o.value=!0,s.value=0,a.value=null})}),m=()=>{n("viewed"),be(()=>{o.value=!0,s.value=0,a.value=null})};return X("div",{className:Bg,children:[s.value>0&&r!=="interstitial"&&X("div",{className:"timer",children:[s.value,"s"]}),X("button",{onClick:l.value?u:c.value?m:void 0,disabled:p.value,children:X("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:X("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"})})})]})},Jg=()=>{let e=z(),t=z(),r=z(),n=z(),i=z(),a=z(!1),o=z(15),s=z(""),l=z("reward");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,visible:a,countdown:o,src:s,mode:l}},Fg=Re`
138
- ${ge}
137
+ `,Jp=()=>{let t=z(!1),e=z(null);return{timerPaused:t,startTimestamp:e,startTimer:()=>{we(()=>{e.value=Date.now(),t.value=!1})}}},Hp=t=>{let{countdown:e=0,mode:r,onClose:n,state:a}=t,{startTimestamp:i,timerPaused:o}=a,s=bd(e);Lp(()=>{s.value>0?s.value-=1:we(()=>{o.value=!0,s.value=0})},o.value?null:1e3);let l=Nr(()=>{if(r==="interstitial"||r==="rewarded_insterstitial"||!i.value)return!1;let h=Date.now()-i.value;return s.value>0&&e-s.value>=5&&h>=5e3}),d=Nr(()=>{if(r==="interstitial")return!0;if(!i.value)return!1;let h=Date.now()-i.value;return s.value<=0&&h>=(e-1)*1e3&&e>5}),g=Nr(()=>r==="interstitial"?!1:!l.value&&!d.value),f=()=>E(void 0,null,function*(){if(o.value=!0,!(yield Mp({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){o.value=!1;return}n("dismiss"),we(()=>{o.value=!0,s.value=0,i.value=null})}),p=()=>{n("viewed"),we(()=>{o.value=!0,s.value=0,i.value=null})};return Y("div",{className:Fp,children:[s.value>0&&r!=="interstitial"&&Y("div",{className:"timer",children:[s.value,"s"]}),Y("button",{onClick:l.value?f:d.value?p:void 0,disabled:g.value,children:Y("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Y("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"})})})]})},jp=()=>{let t=z(),e=z(),r=z(),n=z(),a=z(),i=z(!1),o=z(15),s=z(""),l=z("reward");return{afterAd:t,adDismissed:e,adViewed:r,adBreakDone:n,adLoaded:a,visible:i,countdown:o,src:s,mode:l}},qp=Ce`
138
+ ${ve}
139
139
  position: fixed;
140
140
  z-index: 2147483647;
141
141
  background: white;
@@ -145,7 +145,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
145
145
  flex-direction: column;
146
146
 
147
147
  iframe {
148
- ${ge}
148
+ ${ve}
149
149
  flex: 1;
150
150
  position: relative;
151
151
  display: block;
@@ -153,22 +153,22 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
153
153
  width: 100%;
154
154
  height: 100%;
155
155
  }
156
- `,jg=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,visible:s,countdown:l,src:c,mode:p}=t,u=xr(()=>Mg(),[]),[m,h]=ft(!1),b=I=>{var w,R,k,L;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),(L=a.value)==null||L.call(a),h(!1)},E=Nr(()=>{var I;m||(h(!0),(I=o.value)==null||I.call(o))},[m]);return Gt(()=>{m&&(p.value==="reward"||p.value==="rewarded_insterstitial")&&setTimeout(()=>{u.startTimer()},100)},[m,p.value]),s.value?X("div",{className:Fg,children:[X(Gg,{mode:p.value,onClose:b,countdown:l.value,state:u}),s.value&&X("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"}),X(Ug,{})]}):null};function pt(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=qg(e,"string");return typeof t=="symbol"?t:t+""}function qg(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 as=class{constructor(t,r){pt(this,"name","OKSPIN"),pt(this,"initialized",!1),pt(this,"initCompleter",null),pt(this,"context",void 0),pt(this,"initParams",void 0),pt(this,"adsOverlay",null),pt(this,"adsIsShowing",!1),pt(this,"lastUnDisplayedAdBreak",null),pt(this,"state",Jg()),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"),oi(X(jg,{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,a,o,s,l,c,p;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":{(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=t.beforeAd)==null||o.call(t);let u=()=>{var h;this.adsIsShowing=!1,(h=t.afterAd)==null||h.call(t)},m=()=>{var h;this.adsIsShowing=!1,(h=t.adBreakDone)==null||h.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})};be(()=>{this.adsIsShowing=!0,this.state.afterAd.value=u,this.state.adBreakDone.value=m,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 u=()=>{var w;this.adsIsShowing=!1,(w=t.afterAd)==null||w.call(t)},m={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},h=()=>{var w;this.adsIsShowing=!1,m.breakStatus="dismissed",(w=t.adDismissed)==null||w.call(t)},b=()=>{var w;this.adsIsShowing=!1,m.breakStatus="viewed",(w=t.adViewed)==null||w.call(t)},E=()=>{var w;this.adsIsShowing=!1,(w=t.adBreakDone)==null||w.call(t,m)};be(()=>{this.state.afterAd.value=u,this.state.adDismissed.value=h,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,be(()=>{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,(p=t.beforeReward)==null||p.call(t,I);break}}})}},Vg=()=>{let e=z(null),t=z(null),r=z(null),n=z(null),i=z(null),a=z(null),o=z(!1),s=z(null);return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adError:a,visible:o,payload:s}},$g=Re`
157
- ${ge}
156
+ `,Vp=t=>{let{state:e}=t,{afterAd:r,adDismissed:n,adViewed:a,adBreakDone:i,adLoaded:o,visible:s,countdown:l,src:d,mode:g}=e,f=Or(()=>Jp(),[]),[p,h]=dt(!1),b=S=>{var w,O,L,U;s.value=!1,S==="dismiss"?(w=n.value)==null||w.call(n):S==="viewed"&&((O=a.value)==null||O.call(a)),(L=r.value)==null||L.call(r),(U=i.value)==null||U.call(i),h(!1)},I=kr(()=>{var S;p||(h(!0),(S=o.value)==null||S.call(o))},[p]);return Nt(()=>{p&&(g.value==="reward"||g.value==="rewarded_insterstitial")&&setTimeout(()=>{f.startTimer()},100)},[p,g.value]),s.value?Y("div",{className:qp,children:[Y(Hp,{mode:g.value,onClose:b,countdown:l.value,state:f}),s.value&&Y("iframe",{src:d.value,onLoad:I,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"}),Y(Gp,{})]}):null};function ft(t,e,r){return(e=$p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $p(t){var e=Kp(t,"string");return typeof e=="symbol"?e:e+""}function Kp(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ro=class{constructor(e,r){ft(this,"name","OKSPIN"),ft(this,"initialized",!1),ft(this,"initCompleter",null),ft(this,"context",void 0),ft(this,"initParams",void 0),ft(this,"adsOverlay",null),ft(this,"adsIsShowing",!1),ft(this,"lastUnDisplayedAdBreak",null),ft(this,"state",jp()),this.context=e,this.initParams=r}init(){return E(this,null,function*(){var e;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),Qn(Y(Vp,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(e=this.initCompleter)==null||e.call(this)})}adConfig(e){var r;if(this.initialized){(r=e.onReady)==null||r.call(e);return}this.initCompleter=()=>{var n;(n=e.onReady)==null||n.call(e)}}adBreak(e,r){return E(this,null,function*(){var n,a,i,o,s,l,d,g;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}switch(e.type){case"preroll":{(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=e.beforeAd)==null||o.call(e);let f=()=>{var h;this.adsIsShowing=!1,(h=e.afterAd)==null||h.call(e)},p=()=>{var h;this.adsIsShowing=!1,(h=e.adBreakDone)==null||h.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"viewed"})};we(()=>{this.adsIsShowing=!0,this.state.afterAd.value=f,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),(d=e.beforeAd)==null||d.call(e);let f=()=>{var w;this.adsIsShowing=!1,(w=e.afterAd)==null||w.call(e)},p={breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"ignored"},h=()=>{var w;this.adsIsShowing=!1,p.breakStatus="dismissed",(w=e.adDismissed)==null||w.call(e)},b=()=>{var w;this.adsIsShowing=!1,p.breakStatus="viewed",(w=e.adViewed)==null||w.call(e)},I=()=>{var w;this.adsIsShowing=!1,(w=e.adBreakDone)==null||w.call(e,p)};we(()=>{this.state.afterAd.value=f,this.state.adDismissed.value=h,this.state.adViewed.value=b,this.state.adBreakDone.value=I});let S=()=>{var w;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(w=e.adBreakDone)==null||w.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,we(()=>{var O;this.state.countdown.value=(O=r.params.countdown)!=null?O:15,this.state.src.value=r.params.url,this.state.mode.value="reward",this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=e,(g=e.beforeReward)==null||g.call(e,S);break}}})}},Wp=()=>{let t=z(null),e=z(null),r=z(null),n=z(null),a=z(null),i=z(null),o=z(!1),s=z(null);return{afterAd:t,adDismissed:e,adViewed:r,adBreakDone:n,adLoaded:a,adError:i,visible:o,payload:s}},zp=Ce`
157
+ ${ve}
158
158
  position: fixed;
159
159
  inset: 0;
160
160
  z-index: 2147483647;
161
161
  display: flex;
162
162
  background: #000000;
163
- `,Kg=Re`
164
- ${ge}
163
+ `,Xp=Ce`
164
+ ${ve}
165
165
  position: relative;
166
166
  width: 100%;
167
167
  height: 100%;
168
168
  display: flex;
169
169
  flex-direction: column;
170
170
  color: #f7f9fc;
171
- `,Wg=Re`
171
+ `,Yp=Ce`
172
172
  position: absolute;
173
173
  top: 24px;
174
174
  left: 24px;
@@ -179,23 +179,23 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
179
179
  border-radius: 999px;
180
180
  background: rgba(0, 0, 0, 0.65);
181
181
  border: 1px solid rgba(255, 255, 255, 0.08);
182
- `,zg=Re`
182
+ `,Qp=Ce`
183
183
  font-size: 11px;
184
184
  letter-spacing: 0.08em;
185
185
  text-transform: uppercase;
186
186
  color: #c7d4ef;
187
- `,Qg=Re`
187
+ `,Zp=Ce`
188
188
  font-size: 14px;
189
189
  font-weight: 500;
190
- `,Xg=Re`
191
- ${ge}
190
+ `,ev=Ce`
191
+ ${ve}
192
192
  flex: 1;
193
193
  background: #050505;
194
194
  display: flex;
195
195
  align-items: center;
196
196
  justify-content: center;
197
197
  padding: 0;
198
- `,Kd=Re`
198
+ `,Vc=Ce`
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(a)}return n}},kn=class extends me{constructor(...t){super
204
204
  justify-content: center;
205
205
  color: #6e7da1;
206
206
  font-size: 14px;
207
- `,Yg=Re`
207
+ `,tv=Ce`
208
208
  position: absolute;
209
209
  bottom: 32px;
210
210
  right: 32px;
211
211
  display: flex;
212
212
  gap: 12px;
213
- `,Zg=Re`
213
+ `,rv=Ce`
214
214
  min-width: 160px;
215
215
  min-height: 48px;
216
216
  border-radius: 999px;
@@ -226,7 +226,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
226
226
  opacity: 0.4;
227
227
  cursor: not-allowed;
228
228
  }
229
- `,e_=Re`
229
+ `,nv=Ce`
230
230
  min-width: 120px;
231
231
  min-height: 44px;
232
232
  border-radius: 999px;
@@ -236,8 +236,8 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
236
236
  font-size: 14px;
237
237
  font-weight: 500;
238
238
  cursor: pointer;
239
- `,t_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adError:s,visible:l,payload:c}=t,[p,u]=ft(!1),[m,h]=ft(0),[b,E]=ft(!1),[I,w]=ft(!1),[R,k]=ft("Loading next content..."),L=ii(null),J=c.value,S=Nr(U=>{var M,G,q,V;u(!1),l.value=!1,U==="dismiss"?(M=n.value)==null||M.call(n):(G=i.value)==null||G.call(i),(q=r.value)==null||q.call(r),(V=a.value)==null||V.call(a)},[l,n,i,r,a]),P=Nr(()=>{var U;u(!1),l.value=!1,(U=s.value)==null||U.call(s)},[l,s]);if(Gt(()=>{var U;if(!l.value||!J){h(0),E(!1),w(!1),k("Loading next content...");return}let M=J.mode==="reward"?15:0,G=Math.max(Math.floor((U=J.countdown)!=null?U:M),0);if(h(G),w(J.mode==="reward"?G===0:!0),E(J.mode==="interstitial"?G===0:!1),G===0)return;let q=G,V=window.setInterval(()=>{q-=1,h(Math.max(q,0)),q<=0&&(window.clearInterval(V),J.mode==="reward"?w(!0):E(!0))},1e3);return()=>{window.clearInterval(V)}},[l.value,J,S]),Gt(()=>{var U;if(!l.value||!J)return;let M=L.current;if(!M)return;if(M.innerHTML="",k("Loading next content..."),u(!1),J.testMode){let V=document.createElement("div");V.className=Kd,V.innerText="Preview slot placeholder",M.appendChild(V),u(!0),(U=o.value)==null||U.call(o);return}if(typeof window=="undefined"){P();return}let G=document.createElement("ins");G.className="adsbygoogle",G.style.display="block",G.style.width="100%",G.style.height="100%",G.setAttribute("data-ad-client",J.clientId),G.setAttribute("data-ad-slot",J.unitId),G.setAttribute("data-ad-format","auto"),G.setAttribute("data-full-width-responsive","true"),J.channelId&&G.setAttribute("data-ad-channel",J.channelId),M.appendChild(G);let q=new MutationObserver(()=>{var V;let Be=G.getAttribute("data-ad-status");Be==="filled"?(u(!0),k(""),(V=o.value)==null||V.call(o),q.disconnect()):Be==="unfilled"&&(k("Slot currently unavailable."),u(!1),q.disconnect())});q.observe(G,{attributes:!0,attributeFilter:["data-ad-status"]});try{let V=window;V.adsbygoogle=V.adsbygoogle||[],V.adsbygoogle.push({})}catch(V){q.disconnect(),P()}return()=>{q.disconnect(),M.innerHTML=""}},[l.value,J,o,P]),!l.value||!J)return null;let F=J.mode==="reward"?"Next content unlocking":"Content paused",H=m>0?`Content resumes in ${m}s`:"Content ready";return X("div",{className:$g,children:X("div",{className:Kg,children:[X("div",{className:Wg,children:[X("div",{className:zg,children:F}),X("div",{className:Qg,children:H})]}),X("div",{className:Xg,ref:L,children:!p&&X("div",{className:Kd,children:R})}),X("div",{className:Yg,children:J.mode==="reward"?X("button",{className:Zg,type:"button",onClick:()=>S("viewed"),disabled:!I,children:I?"Continue":`Continue in ${m}s`}):b&&X("button",{className:e_,type:"button",onClick:()=>S("viewed"),children:"Continue"})})]})})};function Te(e,t,r){return(t=r_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r_(e){var t=n_(e,"string");return typeof t=="symbol"?t:t+""}function n_(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){if(Te(this,"name","ADSENSE_BANNER_AS_AFG"),Te(this,"initialized",!1),Te(this,"initCompleter",null),Te(this,"context",void 0),Te(this,"contextInfo",void 0),Te(this,"initParams",void 0),Te(this,"defaultCountdown",5),Te(this,"adsOverlay",null),Te(this,"adsIsShowing",!1),Te(this,"lastUnDisplayedAdBreak",null),Te(this,"requestCounter",0),Te(this,"scriptPromise",null),Te(this,"scriptReady",!1),Te(this,"scriptFailed",!1),Te(this,"state",Vg()),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"),oi(X(t_,{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 a=document.createElement("script");a.id="google-adsense",a.async=!0,a.crossOrigin="anonymous",a.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,r&&a.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&a.setAttribute("data-ad-channel",this.initParams.channelId),a.onload=()=>{this.scriptReady=!0,n()},a.onerror=()=>{this.scriptFailed=!0,i(new Error("Failed to fetch Google AdSense script."))},document.head.appendChild(a)}),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 a=Math.max(Math.floor((n=r.countdown)!=null?n:t==="reward"?15:0),0),o={requestId:++this.requestCounter,clientId:this.initParams.clientId,unitId:t==="reward"?this.initParams.rewardUnitId:this.initParams.interstitialUnitId,channelId:r.channelId,countdown:a,mode:t,testMode:(i=this.contextInfo.testAdsMode)!=null?i:!1};this.state.payload.value=o,this.state.visible.value=!0}adBreak(t,r){var n,i,a,o,s,l,c,p,u;let m=t.type==="preroll"?"":t.name,h=t.type==="reward"?"reward":"interstitial";if(!this.initialized||!this.adsOverlay){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:m,breakFormat:h,breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:m,breakFormat:h,breakStatus:"frequencyCapped"});return}let b=this.resolveOverlayConfig(r);if(!this.canDisplay(b.rewardUnitId)){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:m,breakFormat:h,breakStatus:"notReady"});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":{(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,L;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(k=t.afterAd)==null||k.call(t),(L=t.adBreakDone)==null||L.call(t,E)};be(()=>{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),(p=t.beforeAd)==null||p.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)},L=()=>{var S,P;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(S=t.afterAd)==null||S.call(t),(P=t.adBreakDone)==null||P.call(t,E)};be(()=>{this.state.afterAd.value=I,this.state.adDismissed.value=w,this.state.adViewed.value=R,this.state.adBreakDone.value=k,this.state.adError.value=L});let J=()=>{var S,P;if(!this.canDisplay(b.rewardUnitId)){this.lastUnDisplayedAdBreak=null,(S=t.afterAd)==null||S.call(t),(P=t.adBreakDone)==null||P.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.lastUnDisplayedAdBreak=null,this.adsIsShowing=!0,be(()=>{this.showBannerOverlay("reward",b)})};this.lastUnDisplayedAdBreak=t,(u=t.beforeReward)==null||u.call(t,J);break}}}},or={};window.addEventListener("message",e=>{e.origin!=="https://ads.appsrockets.com"&&e.origin!=="https://stg-ads.appsrockets.com"||or[e.data.type]&&or[e.data.type].forEach(t=>{t(e.data.data)})});var ir=(e,t)=>{Gt(()=>(or[e]||(or[e]=new Set),or[e].add(t),()=>{or[e].delete(t)}),[e,t])},i_=()=>{let e=z(),t=z(),r=z(),n=z(),i=z(),a=z(),o=z(),s=z(!1),l=z("");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adLinkClicked:a,adError:o,visible:s,src:l}},a_=Re`
240
- ${ge}
239
+ `,av=t=>{let{state:e}=t,{afterAd:r,adDismissed:n,adViewed:a,adBreakDone:i,adLoaded:o,adError:s,visible:l,payload:d}=e,[g,f]=dt(!1),[p,h]=dt(0),[b,I]=dt(!1),[S,w]=dt(!1),[O,L]=dt("Loading next content..."),U=Xn(null),J=d.value,A=kr(N=>{var M,F,V,$;f(!1),l.value=!1,N==="dismiss"?(M=n.value)==null||M.call(n):(F=a.value)==null||F.call(a),(V=r.value)==null||V.call(r),($=i.value)==null||$.call(i)},[l,n,a,r,i]),P=kr(()=>{var N;f(!1),l.value=!1,(N=s.value)==null||N.call(s)},[l,s]);if(Nt(()=>{var N;if(!l.value||!J){h(0),I(!1),w(!1),L("Loading next content...");return}let M=J.mode==="reward"?15:0,F=Math.max(Math.floor((N=J.countdown)!=null?N:M),0);if(h(F),w(J.mode==="reward"?F===0:!0),I(J.mode==="interstitial"?F===0:!1),F===0)return;let V=F,$=window.setInterval(()=>{V-=1,h(Math.max(V,0)),V<=0&&(window.clearInterval($),J.mode==="reward"?w(!0):I(!0))},1e3);return()=>{window.clearInterval($)}},[l.value,J,A]),Nt(()=>{var N;if(!l.value||!J)return;let M=U.current;if(!M)return;if(M.innerHTML="",L("Loading next content..."),f(!1),J.testMode){let $=document.createElement("div");$.className=Vc,$.innerText="Preview slot placeholder",M.appendChild($),f(!0),(N=o.value)==null||N.call(o);return}if(typeof window=="undefined"){P();return}let F=document.createElement("ins");F.className="adsbygoogle",F.style.display="block",F.style.width="100%",F.style.height="100%",F.setAttribute("data-ad-client",J.clientId),F.setAttribute("data-ad-slot",J.unitId),F.setAttribute("data-ad-format","auto"),F.setAttribute("data-full-width-responsive","true"),J.channelId&&F.setAttribute("data-ad-channel",J.channelId),M.appendChild(F);let V=new MutationObserver(()=>{var $;let Be=F.getAttribute("data-ad-status");Be==="filled"?(f(!0),L(""),($=o.value)==null||$.call(o),V.disconnect()):Be==="unfilled"&&(L("Slot currently unavailable."),f(!1),V.disconnect())});V.observe(F,{attributes:!0,attributeFilter:["data-ad-status"]});try{let $=window;$.adsbygoogle=$.adsbygoogle||[],$.adsbygoogle.push({})}catch($){V.disconnect(),P()}return()=>{V.disconnect(),M.innerHTML=""}},[l.value,J,o,P]),!l.value||!J)return null;let H=J.mode==="reward"?"Next content unlocking":"Content paused",q=p>0?`Content resumes in ${p}s`:"Content ready";return Y("div",{className:zp,children:Y("div",{className:Xp,children:[Y("div",{className:Yp,children:[Y("div",{className:Qp,children:H}),Y("div",{className:Zp,children:q})]}),Y("div",{className:ev,ref:U,children:!g&&Y("div",{className:Vc,children:O})}),Y("div",{className:tv,children:J.mode==="reward"?Y("button",{className:rv,type:"button",onClick:()=>A("viewed"),disabled:!S,children:S?"Continue":`Continue in ${p}s`}):b&&Y("button",{className:nv,type:"button",onClick:()=>A("viewed"),children:"Continue"})})]})})};function Te(t,e,r){return(e=iv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function iv(t){var e=ov(t,"string");return typeof e=="symbol"?e:e+""}function ov(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Oo=class{constructor(e,r){if(Te(this,"name","ADSENSE_BANNER_AS_AFG"),Te(this,"initialized",!1),Te(this,"initCompleter",null),Te(this,"context",void 0),Te(this,"contextInfo",void 0),Te(this,"initParams",void 0),Te(this,"defaultCountdown",5),Te(this,"adsOverlay",null),Te(this,"adsIsShowing",!1),Te(this,"lastUnDisplayedAdBreak",null),Te(this,"requestCounter",0),Te(this,"scriptPromise",null),Te(this,"scriptReady",!1),Te(this,"scriptFailed",!1),Te(this,"state",Wp()),this.context=e,this.contextInfo=this.context.getContextInfo(),this.initParams=r,typeof window!="undefined"){let n=window;n.adsbygoogle=n.adsbygoogle||[]}}init(){return E(this,null,function*(){var e;if(typeof document!="undefined"){this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-banner-as-afg"),Qn(Y(av,{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,(e=this.initCompleter)==null||e.call(this)}})}ensureAdSenseScript(){var e;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=(e=this.contextInfo.testAdsMode)!=null?e:!1;return this.scriptPromise=new Promise((n,a)=>{let i=document.createElement("script");i.id="google-adsense",i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,r&&i.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&i.setAttribute("data-ad-channel",this.initParams.channelId),i.onload=()=>{this.scriptReady=!0,n()},i.onerror=()=>{this.scriptFailed=!0,a(new Error("Failed to fetch Google AdSense script."))},document.head.appendChild(i)}),this.scriptPromise}adConfig(e){var r;if(this.initialized){(r=e.onReady)==null||r.call(e);return}this.initCompleter=()=>{var n;(n=e.onReady)==null||n.call(e)}}resolveOverlayConfig(e){var r,n;let a=(n=(r=e==null?void 0:e.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(a),0)}}canDisplay(e){return!!e&&!!this.initParams.clientId&&!!this.adsOverlay&&this.initialized&&!this.scriptFailed&&this.scriptReady}showBannerOverlay(e,r){var n,a;let i=Math.max(Math.floor((n=r.countdown)!=null?n:e==="reward"?15:0),0),o={requestId:++this.requestCounter,clientId:this.initParams.clientId,unitId:e==="reward"?this.initParams.rewardUnitId:this.initParams.interstitialUnitId,channelId:r.channelId,countdown:i,mode:e,testMode:(a=this.contextInfo.testAdsMode)!=null?a:!1};this.state.payload.value=o,this.state.visible.value=!0}adBreak(e,r){var n,a,i,o,s,l,d,g,f;let p=e.type==="preroll"?"":e.name,h=e.type==="reward"?"reward":"interstitial";if(!this.initialized||!this.adsOverlay){(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:p,breakFormat:h,breakStatus:"notReady"});return}if(this.adsIsShowing){(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:p,breakFormat:h,breakStatus:"frequencyCapped"});return}let b=this.resolveOverlayConfig(r);if(!this.canDisplay(b.rewardUnitId)){(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:p,breakFormat:h,breakStatus:"notReady"});return}switch(e.type){case"preroll":{(o=e.adBreakDone)==null||o.call(e,{breakType:e.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(s=e.beforeAd)==null||s.call(e);let I={breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"viewed"},S=()=>{var L;this.adsIsShowing=!1,(L=e.afterAd)==null||L.call(e)},w=()=>{var L;this.adsIsShowing=!1,(L=e.adBreakDone)==null||L.call(e,I)},O=()=>{var L,U;this.adsIsShowing=!1,I.breakStatus="noAdPreloaded",(L=e.afterAd)==null||L.call(e),(U=e.adBreakDone)==null||U.call(e,I)};we(()=>{this.adsIsShowing=!0,this.state.afterAd.value=S,this.state.adBreakDone.value=w,this.state.adDismissed.value=null,this.state.adViewed.value=null,this.state.adError.value=O,this.showBannerOverlay("interstitial",b)});break}case"reward":{this.lastUnDisplayedAdBreak&&((d=(l=this.lastUnDisplayedAdBreak).adBreakDone)==null||d.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),(g=e.beforeAd)==null||g.call(e);let I={breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"ignored"},S=()=>{var A;this.adsIsShowing=!1,(A=e.afterAd)==null||A.call(e)},w=()=>{var A;this.adsIsShowing=!1,I.breakStatus="dismissed",(A=e.adDismissed)==null||A.call(e)},O=()=>{var A;this.adsIsShowing=!1,I.breakStatus="viewed",(A=e.adViewed)==null||A.call(e)},L=()=>{var A;this.adsIsShowing=!1,(A=e.adBreakDone)==null||A.call(e,I)},U=()=>{var A,P;this.adsIsShowing=!1,I.breakStatus="noAdPreloaded",(A=e.afterAd)==null||A.call(e),(P=e.adBreakDone)==null||P.call(e,I)};we(()=>{this.state.afterAd.value=S,this.state.adDismissed.value=w,this.state.adViewed.value=O,this.state.adBreakDone.value=L,this.state.adError.value=U});let J=()=>{var A,P;if(!this.canDisplay(b.rewardUnitId)){this.lastUnDisplayedAdBreak=null,(A=e.afterAd)==null||A.call(e),(P=e.adBreakDone)==null||P.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"notReady"});return}this.lastUnDisplayedAdBreak=null,this.adsIsShowing=!0,we(()=>{this.showBannerOverlay("reward",b)})};this.lastUnDisplayedAdBreak=e,(f=e.beforeReward)==null||f.call(e,J);break}}}},tr={};window.addEventListener("message",t=>{t.origin!=="https://ads.appsrockets.com"&&t.origin!=="https://stg-ads.appsrockets.com"||tr[t.data.type]&&tr[t.data.type].forEach(e=>{e(t.data.data)})});var Zt=(t,e)=>{Nt(()=>(tr[t]||(tr[t]=new Set),tr[t].add(e),()=>{tr[t].delete(e)}),[t,e])},sv=()=>{let t=z(),e=z(),r=z(),n=z(),a=z(),i=z(),o=z(),s=z(!1),l=z("");return{afterAd:t,adDismissed:e,adViewed:r,adBreakDone:n,adLoaded:a,adLinkClicked:i,adError:o,visible:s,src:l}},lv=Ce`
240
+ ${ve}
241
241
  position: fixed;
242
242
  z-index: 2147483647;
243
243
  background: white;
@@ -247,7 +247,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
247
247
  flex-direction: column;
248
248
 
249
249
  iframe {
250
- ${ge}
250
+ ${ve}
251
251
  flex: 1;
252
252
  position: relative;
253
253
  display: block;
@@ -255,8 +255,8 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
255
255
  width: 100%;
256
256
  height: 100%;
257
257
  }
258
- `,o_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adLinkClicked:s,visible:l,src:c}=t,[p,u]=ft(!1),m=b=>{var E,I,w,R;u(!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=a.value)==null||R.call(a)},h=()=>{var b;(b=o.value)==null||b.call(o)};return ir("appsrockets_ad_dismissed",()=>m("dismiss")),ir("appsrockets_ad_rewarded",()=>m("viewed")),ir("appsrockets_ad_completed",()=>m("viewed")),ir("appsrockets_ad_skipped",()=>m("viewed")),ir("appsrockets_ad_clicked",b=>{var E;return(E=s.value)==null?void 0:E.call(s,b)}),ir("appsrockets_ad_loaded",()=>u(!0)),l.value?X("div",{className:a_,style:{display:p?"flex":"none"},children:l.value&&X("iframe",{src:c.value,onLoad:h,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 vt(e,t,r){return(t=s_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s_(e){var t=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 ss=class{constructor(t,r){vt(this,"name","APPSROCKETS"),vt(this,"initialized",!1),vt(this,"initCompleter",null),vt(this,"context",void 0),vt(this,"adsOverlay",null),vt(this,"adsIsShowing",!1),vt(this,"lastUnDisplayedAdBreak",null),vt(this,"state",i_()),vt(this,"processUrl",(n,i)=>{var a;let o=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",o.joliSource),l.get("osType")||l.set("osType",o.osType),l.get("runtimeType")||l.set("runtimeType",o.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",o.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((a=this.context.getWindowInfo().statusBarHeight)!=null?a: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"),oi(X(o_,{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,a,o,s,l,c,p;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 u=h=>{var b,E;(E=(b=this.context).handleLinkClicked)==null||E.call(b,h)},m=t.type==="reward"?"REWARD":"INTERSTITIAL";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":{(o=t.beforeAd)==null||o.call(t);let h=()=>{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"})};be(()=>{this.adsIsShowing=!0,this.state.afterAd.value=h,this.state.adBreakDone.value=b,this.state.src.value=this.processUrl(r.params.url,m),this.state.adLinkClicked.value=u,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 h=()=>{var L;this.adsIsShowing=!1,(L=t.afterAd)==null||L.call(t)},b={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var L;this.adsIsShowing=!1,b.breakStatus="dismissed",(L=t.adDismissed)==null||L.call(t)},I=()=>{var L;this.adsIsShowing=!1,b.breakStatus="viewed",(L=t.adViewed)==null||L.call(t)},w=()=>{var L;this.adsIsShowing=!1,(L=t.adBreakDone)==null||L.call(t,b)},R=()=>{this.adsIsShowing=!1,b.breakStatus="noAdPreloaded"};be(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=E,this.state.adViewed.value=I,this.state.adBreakDone.value=w,this.state.adLinkClicked.value=u,this.state.adError.value=R});let k=()=>{var L;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(L=t.adBreakDone)==null||L.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,be(()=>{this.state.src.value=this.processUrl(r.params.url,m),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(p=t.beforeReward)==null||p.call(t,k);break}}}},Su=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Se(e,t,r){return(t=c_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c_(e){var t=d_(e,"string");return typeof t=="symbol"?t:t+""}function d_(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,n){Se(this,"adUnit",void 0),Se(this,"project",void 0),Se(this,"keyValue",void 0),Se(this,"adsContext",null),Se(this,"rewardedSlot",null),Se(this,"rewardedPayload",null),Se(this,"readyEvent",null),Se(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Se(this,"init",()=>{var i;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(a=>{var o;(o=this.rewardedSlot)==null||o.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(i=this.rewardedSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Se(this,"destroy",i=>{var a,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=(a=this.adsContext)==null?void 0:a.adBreakDone)==null||o.call(a,i),i!=="ignored"&&(this.adsContext=null)}),Se(this,"reinit",i=>{this.destroy(i),this.init()}),Se(this,"handleSlotReady",i=>{i.slot===this.rewardedSlot&&(this.readyEvent=i)}),Se(this,"handleSlotClosed",i=>{var a,o;if(this.adsContext&&i.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(a=this.adsContext).afterAd)==null||o.call(a),this.withCommand(()=>{this.reinit(s)})}}),Se(this,"handleSlotGranted",i=>{this.adsContext&&i.slot===this.rewardedSlot&&(this.rewardedPayload=i.payload)}),Se(this,"handleSlotRenderEnded",i=>{i.slot===this.rewardedSlot&&i.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Se(this,"requestAds",i=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=i,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var a,o,s;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let a=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",a),this.readyEvent=o,this.adsContext.beforeReward(()=>{var s,l,c;(l=(s=this.adsContext)==null?void 0:s.beforeAd)==null||l.call(s),(c=this.readyEvent)==null||c.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",a),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",a))},500)}})}),this.adUnit=t,this.project=r,this.keyValue=n,Su(),this.withCommand(()=>{this.init()})}};function Le(e,t,r){return(t=u_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u_(e){var t=f_(e,"string");return typeof t=="symbol"?t:t+""}function f_(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 cs=class{constructor(t,r,n){var i=this;Le(this,"adUnit",void 0),Le(this,"project",void 0),Le(this,"keyValue",void 0),Le(this,"adsContext",null),Le(this,"gamingInterstitialSlot",null),Le(this,"readyEvent",null),Le(this,"isRetrying",!1),Le(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Le(this,"init",()=>{var a;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(o=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(a=this.gamingInterstitialSlot)==null||a.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),Le(this,"destroy",function(a){var o,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(o=i.adsContext)==null?void 0:o.onEnd)==null||s.call(o,a),a!=="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)}),Le(this,"reinit",function(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(a,o),i.init()}),Le(this,"handleSlotReady",a=>{this.gamingInterstitialSlot===a.slot&&(this.readyEvent=a)}),Le(this,"handleSlotClosed",a=>{var o,s;this.adsContext&&this.gamingInterstitialSlot===a.slot&&((s=(o=this.adsContext).afterAd)==null||s.call(o),this.withCommand(()=>{this.reinit("viewed")}))}),Le(this,"requestAds",a=>{this.withCommand(()=>{var o,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=a,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((o=a.beforeAd)==null||o.call(a),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)))})}),Su(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Jt(e,t,r){return(t=h_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h_(e){var t=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 ds=class{constructor(t,r){Jt(this,"name","GOOGLE_GPT"),Jt(this,"context",void 0),Jt(this,"contextInfo",void 0),Jt(this,"initParams",void 0),Jt(this,"rewardAdManager",void 0),Jt(this,"interstitialManager",void 0),Jt(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 ls(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new cs(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,a;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:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o})}});break}default:{if(!this.interstitialManager){(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:o})}});break}}}};function jo(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=v_(e,"string");return typeof t=="symbol"?t:t+""}function v_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var us=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";jo(this,"context",void 0),jo(this,"placement","GAME"),jo(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:ru.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:eu.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 vv(i)}};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=__(e,"string");return typeof t=="symbol"?t:t+""}function __(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Oi=class{constructor(t){xe(this,"context",void 0),xe(this,"adsTrackSerializer",void 0),xe(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new us(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:a}=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:a}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},fs=class{constructor(t,r){var n=this;xe(this,"context",void 0),xe(this,"contextInfo",void 0),xe(this,"requestContext",void 0),xe(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),xe(this,"pendingAFVAdsInfo",Promise.resolve(null)),xe(this,"doFetchAdsInfo",i=>A(this,null,function*(){let a=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",o=[];switch(i){case"afv":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{o=["INTERSTITIAL"];break}}let s=i==="afv"?void 0:"cached",{data:l,code:c}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(a),bizParams:this.requestContext.getRequestBizParams(),adsTypes:o,testAdsMode:this.contextInfo.testAdsMode,name:s}});return c==="SUCCESS"||c==="BYPASS_ADS"?{code:c,data:l}:null})),xe(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),xe(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),xe(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),xe(this,"cacheNextAFGAdsInfo",i=>A(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),xe(this,"getAFGAdsInfo",i=>A(this,null,function*(){let a=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),a})),xe(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 Oi(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function y_(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=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 E_=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)}},ki=class{constructor(t){this.context=t,y_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=pd(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return A(this,null,function*(){try{let{errNo:r,errMsg:n}=yield hi("loadAdsAsync",{params:{providers:t.providers}});return r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){return Ho()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return A(this,null,function*(){try{let r=yield hi("showAdAsync",{params:{providers:t.providers}});if(r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(t.callbacks){let i=t.timeout!==void 0?t.timeout:-1,a=null,o=()=>{Ed("onAdsStateChange",s),a&&(clearTimeout(a),a=null)},s=l=>{var c;if(l.UUID!==n)return;let p=(c=t.callbacks)==null?void 0:c[l.event];p&&E_(p,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&o()};wd("onAdsStateChange",s),i>0&&(a=setTimeout(()=>{o(),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{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(t){try{let{errNo:r,data:n}=hi("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 gt(e,t,r){return(t=I_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I_(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 hs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){gt(this,"providers",void 0),gt(this,"helper",void 0),gt(this,"adsContext",null),gt(this,"_isAdsReady",!1),gt(this,"init",()=>A(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),gt(this,"destroy",n=>{var i,a;this._isAdsReady=!1,(a=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||a.call(i,n),n!=="ignored"&&(this.adsContext=null)}),gt(this,"reinit",n=>A(this,null,function*(){this.destroy(n),yield this.init()})),gt(this,"requestAds",(n,i)=>A(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=n,i&&i.length>0&&(this.providers=i);try{this.isAdsReady?this.showAd():yield this.reinit("frequencyCapped")}catch(a){this.destroy("notReady")}})),gt(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>A(this,null,function*(){var a,o;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a);let s=c=>{var p,u,m;i||(i=!0,c==="dismissed"&&((p=this.adsContext)==null||p.adDismissed()),(m=(u=this.adsContext)==null?void 0:u.afterAd)==null||m.call(u),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var c;n=!0,(c=this.adsContext)==null||c.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new ki(t),this.init()}};function _t(e,t,r){return(t=S_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S_(e){var t=C_(e,"string");return typeof t=="symbol"?t:t+""}function C_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ms=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;_t(this,"providers",void 0),_t(this,"helper",void 0),_t(this,"adsContext",null),_t(this,"_isAdsReady",!1),_t(this,"init",()=>A(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),_t(this,"destroy",function(i){var a,o;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n._isAdsReady=!1,s&&((o=(a=n.adsContext)==null?void 0:a.onEnd)==null||o.call(a,i),i!=="ignored"&&(n.adsContext=null))}),_t(this,"reinit",function(a){return A(this,arguments,function*(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,o),yield n.init()})}),_t(this,"requestAds",(i,a)=>A(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=i,a&&a.length>0&&(this.providers=a);try{this.isAdsReady?yield this.showAd():yield this.reinit("frequencyCapped")}catch(o){this.destroy("notReady")}})),_t(this,"showAd",()=>A(this,null,function*(){var i,a;if(!this.adsContext){this.destroy("error");return}let o=!1;(a=(i=this.adsContext).beforeAd)==null||a.call(i);let s=c=>{var p,u;o||(o=!0,(u=(p=this.adsContext)==null?void 0:p.afterAd)==null||u.call(p),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new ki(t),this.init()}};function Jr(e,t,r){return(t=R_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R_(e){var t=O_(e,"string");return typeof t=="symbol"?t:t+""}function O_(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){Jr(this,"name","INTERNAL_NATIVE"),Jr(this,"context",void 0),Jr(this,"rewardAdManager",void 0),Jr(this,"interstitialManager",void 0),Jr(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);n.length>0&&(this.rewardAdManager=new hs(this.context,n)),i.length>0&&(this.interstitialManager=new ms(this.context,i))}getConfigsByTypes(t,r,n){let i=[];return(n?n.map(a=>r.find(o=>o.provider===a.provider)).filter(a=>!!a):r).forEach(a=>{t.forEach(o=>{let s="";o==="REWARD"&&(s=a.params.adUnitId.reward),o==="REWARD_INTERSTITIAL"&&(s=a.params.adUnitId.rewardInterstitial),o==="INTERSTITIAL"&&(s=a.params.adUnitId.interstitial),o==="NATIVE"&&(s=a.params.adUnitId.nativeAds),s&&i.push({provider:a.provider,params:{placementId:s,adsType:o,extra:a.params.extra}})})}),i}init(){return A(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,a;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:"reward",breakStatus:"noAdPreloaded"});return}let o=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],this.initProviders,r.params);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})}},o);break}default:{let o=t;if(!this.interstitialManager){(a=t.adBreakDone)==null||a.call(t,{breakName:o.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);this.interstitialManager.requestAds({beforeAd:o.beforeAd,afterAd:o.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:o.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}};function We(e,t,r){return(t=k_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k_(e){var t=T_(e,"string");return typeof t=="symbol"?t:t+""}function T_(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 $r=class{constructor(t){if(We(this,"context",void 0),We(this,"contextInfo",void 0),We(this,"providers",{}),We(this,"channelPolicy",void 0),We(this,"adsActionDetection",void 0),We(this,"requestContext",void 0),We(this,"adsRequest",void 0),We(this,"initialized",!1),We(this,"adsIsShowing",!1),We(this,"lastAdBreak",void 0),We(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Qo(this.context),this.adsActionDetection=new zo(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new fs(t),this.requestContext=new Oi(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return A(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:r}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((r==null?void 0:r.length)>0){let n=r.filter(s=>s.isNative),i=r.filter(s=>!s.isNative),a={provider:"INTERNAL_NATIVE",params:{providers:n}},o=i.concat([a]);for(let s of o)switch(s.provider){case"GOOGLE_GPT":{let l=new ds(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new Xo(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new as(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new ss(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new os(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new ps(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;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,a,o,s,l,c,p,u,m,h,b,E,I,w;let R=Date.now();if(R-this.initializedTimeStamp<3e3){(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&&R-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads] You can't call adBreak too frequently"),(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=R,this.adsIsShowing){console.warn("[Jolibox SDK Ads] You can't call adBreak while ad is showing"),(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||(yield this.init()),t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let k=yield this.adsRequest.getAFGAdsInfo(t.type),L=k==null?void 0:k.data,J=k==null?void 0:k.code;if(J==="BYPASS_ADS"){switch(t.type){case"preroll":{(s=t.adBreakDone)==null||s.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{t.beforeReward(()=>{var S,P,F,H;(S=t.beforeAd)==null||S.call(t),(P=t.adViewed)==null||P.call(t),(F=t.afterAd)==null||F.call(t),(H=t.adBreakDone)==null||H.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=t.beforeAd)==null||l.call(t),(c=t.afterAd)==null||c.call(t),(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!L||J!=="SUCCESS"){(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(L.length===0){(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"});return}let S=!0,P=null,F=new Wo(this.context);this.adsActionDetection.adBreakIsShowing=!0;let H=L.filter(q=>q.isNative).sort((q,V)=>q.seq-V.seq),U=L.filter(q=>!q.isNative).sort((q,V)=>q.seq-V.seq),M={seq:(b=(h=H[0])==null?void 0:h.seq)!=null?b:0,provider:"INTERNAL_NATIVE",params:H},G;for(H.length>0?G=[M].concat(U):G=U,G=G.sort((q,V)=>q.seq-V.seq).map((q,V)=>Wp(Qd({},q),{seq:V}));G.length>0;){let q=G.shift(),V=this.providers[q.provider];if(V){let[Be,jt]=yield F.callAdBreakAndContinue(V,t,q,Ht=>{var tt;this.adsIsShowing=Ht,(tt=this.context.eventEmitter)==null||tt.emit("isAdShowing",Ht)});S=Be,P=jt}else S=!0,P={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!S)break}S&&P&&((E=t.adBreakDone)==null||E.call(t,P))}}catch(k){(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(w=this.context.eventEmitter)==null||w.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.")}};var MS=Re`
259
- ${ge}
258
+ `,cv=t=>{let{state:e}=t,{afterAd:r,adDismissed:n,adViewed:a,adBreakDone:i,adLoaded:o,adLinkClicked:s,visible:l,src:d}=e,[g,f]=dt(!1),p=b=>{var I,S,w,O;f(!1),l.value=!1,b==="dismiss"?(I=n.value)==null||I.call(n):b==="viewed"&&((S=a.value)==null||S.call(a)),(w=r.value)==null||w.call(r),(O=i.value)==null||O.call(i)},h=()=>{var b;(b=o.value)==null||b.call(o)};return Zt("appsrockets_ad_dismissed",()=>p("dismiss")),Zt("appsrockets_ad_rewarded",()=>p("viewed")),Zt("appsrockets_ad_completed",()=>p("viewed")),Zt("appsrockets_ad_skipped",()=>p("viewed")),Zt("appsrockets_ad_clicked",b=>{var I;return(I=s.value)==null?void 0:I.call(s,b)}),Zt("appsrockets_ad_loaded",()=>f(!0)),l.value?Y("div",{className:lv,style:{display:g?"flex":"none"},children:l.value&&Y("iframe",{src:d.value,onLoad:h,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 ht(t,e,r){return(e=dv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dv(t){var e=uv(t,"string");return typeof e=="symbol"?e:e+""}function uv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ko=class{constructor(e,r){ht(this,"name","APPSROCKETS"),ht(this,"initialized",!1),ht(this,"initCompleter",null),ht(this,"context",void 0),ht(this,"adsOverlay",null),ht(this,"adsIsShowing",!1),ht(this,"lastUnDisplayedAdBreak",null),ht(this,"state",sv()),ht(this,"processUrl",(n,a)=>{var i;let o=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",o.joliSource),l.get("osType")||l.set("osType",o.osType),l.get("runtimeType")||l.set("runtimeType",o.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",o.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((i=this.context.getWindowInfo().statusBarHeight)!=null?i:0).toString()),l.get("adsType")||l.set("adsType",a),s.search=l.toString(),s.toString()}),this.context=e}init(){return E(this,null,function*(){var e;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),Qn(Y(cv,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(e=this.initCompleter)==null||e.call(this)})}adConfig(e){var r;if(this.initialized){(r=e.onReady)==null||r.call(e);return}this.initCompleter=()=>{var n;(n=e.onReady)==null||n.call(e)}}adBreak(e,r){var n,a,i,o,s,l,d,g;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let f=h=>{var b,I;(I=(b=this.context).handleLinkClicked)==null||I.call(b,h)},p=e.type==="reward"?"REWARD":"INTERSTITIAL";switch(e.type){case"preroll":{(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=e.beforeAd)==null||o.call(e);let h=()=>{var S;this.adsIsShowing=!1,(S=e.afterAd)==null||S.call(e)},b=()=>{var S;this.adsIsShowing=!1,(S=e.adBreakDone)==null||S.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"viewed"})},I=()=>{var S;this.adsIsShowing=!1,(S=e.adBreakDone)==null||S.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};we(()=>{this.adsIsShowing=!0,this.state.afterAd.value=h,this.state.adBreakDone.value=b,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=f,this.state.adError.value=I,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),(d=e.beforeAd)==null||d.call(e);let h=()=>{var U;this.adsIsShowing=!1,(U=e.afterAd)==null||U.call(e)},b={breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"ignored"},I=()=>{var U;this.adsIsShowing=!1,b.breakStatus="dismissed",(U=e.adDismissed)==null||U.call(e)},S=()=>{var U;this.adsIsShowing=!1,b.breakStatus="viewed",(U=e.adViewed)==null||U.call(e)},w=()=>{var U;this.adsIsShowing=!1,(U=e.adBreakDone)==null||U.call(e,b)},O=()=>{this.adsIsShowing=!1,b.breakStatus="noAdPreloaded"};we(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=I,this.state.adViewed.value=S,this.state.adBreakDone.value=w,this.state.adLinkClicked.value=f,this.state.adError.value=O});let L=()=>{var U;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(U=e.adBreakDone)==null||U.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,we(()=>{this.state.src.value=this.processUrl(r.params.url,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=e,(g=e.beforeReward)==null||g.call(e,L);break}}}},Id=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Ae(t,e,r){return(e=fv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fv(t){var e=hv(t,"string");return typeof e=="symbol"?e:e+""}function hv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var To=class{constructor(e,r,n){Ae(this,"adUnit",void 0),Ae(this,"project",void 0),Ae(this,"keyValue",void 0),Ae(this,"adsContext",null),Ae(this,"rewardedSlot",null),Ae(this,"rewardedPayload",null),Ae(this,"readyEvent",null),Ae(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ae(this,"init",()=>{var a;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")||(a=this.rewardedSlot)==null||a.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Ae(this,"destroy",a=>{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,a),a!=="ignored"&&(this.adsContext=null)}),Ae(this,"reinit",a=>{this.destroy(a),this.init()}),Ae(this,"handleSlotReady",a=>{a.slot===this.rewardedSlot&&(this.readyEvent=a)}),Ae(this,"handleSlotClosed",a=>{var i,o;if(this.adsContext&&a.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(i=this.adsContext).afterAd)==null||o.call(i),this.withCommand(()=>{this.reinit(s)})}}),Ae(this,"handleSlotGranted",a=>{this.adsContext&&a.slot===this.rewardedSlot&&(this.rewardedPayload=a.payload)}),Ae(this,"handleSlotRenderEnded",a=>{a.slot===this.rewardedSlot&&a.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Ae(this,"requestAds",a=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=a,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,o,s;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let i=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=o,this.adsContext.beforeReward(()=>{var s,l,d;(l=(s=this.adsContext)==null?void 0:s.beforeAd)==null||l.call(s),(d=this.readyEvent)==null||d.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=r,this.keyValue=n,Id(),this.withCommand(()=>{this.init()})}};function Ne(t,e,r){return(e=mv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mv(t){var e=pv(t,"string");return typeof e=="symbol"?e:e+""}function pv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var xo=class{constructor(e,r,n){var a=this;Ne(this,"adUnit",void 0),Ne(this,"project",void 0),Ne(this,"keyValue",void 0),Ne(this,"adsContext",null),Ne(this,"gamingInterstitialSlot",null),Ne(this,"readyEvent",null),Ne(this,"isRetrying",!1),Ne(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ne(this,"init",()=>{var i;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(o=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(i=this.gamingInterstitialSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),Ne(this,"destroy",function(i){var o,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(o=a.adsContext)==null?void 0:o.onEnd)==null||s.call(o,i),i!=="ignored"&&(a.adsContext=null)),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",a.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",a.handleSlotClosed),a.gamingInterstitialSlot&&(googletag.destroySlots([a.gamingInterstitialSlot]),a.gamingInterstitialSlot=null,a.readyEvent=null)}),Ne(this,"reinit",function(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a.destroy(i,o),a.init()}),Ne(this,"handleSlotReady",i=>{this.gamingInterstitialSlot===i.slot&&(this.readyEvent=i)}),Ne(this,"handleSlotClosed",i=>{var o,s;this.adsContext&&this.gamingInterstitialSlot===i.slot&&((s=(o=this.adsContext).afterAd)==null||s.call(o),this.withCommand(()=>{this.reinit("viewed")}))}),Ne(this,"requestAds",i=>{this.withCommand(()=>{var o,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=i,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((o=i.beforeAd)==null||o.call(i),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)))})}),Id(),this.adUnit=e,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Ut(t,e,r){return(e=vv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vv(t){var e=gv(t,"string");return typeof e=="symbol"?e:e+""}function gv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Po=class{constructor(e,r){Ut(this,"name","GOOGLE_GPT"),Ut(this,"context",void 0),Ut(this,"contextInfo",void 0),Ut(this,"initParams",void 0),Ut(this,"rewardAdManager",void 0),Ut(this,"interstitialManager",void 0),Ut(this,"insertScript",()=>{let n="jolibox-google-gpt",a=document.getElementById(n);a||(a=window.document.createElement("script"),a.id=n,a.async=!0,a.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",a.crossOrigin="anonymous",document.head.appendChild(a))}),this.context=e,this.contextInfo=this.context.getContextInfo(),this.initParams=r,this.insertScript()}init(){return E(this,null,function*(){let e=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"}`;e&&(this.rewardAdManager=new To(e,n,this.initParams.keyValue)),r&&(this.interstitialManager=new xo(r,n,this.initParams.keyValue))})}adConfig(e,r){}adBreak(e,r){var n,a,i;switch(e.type){case"preroll":{(n=e.adBreakDone)==null||n.call(e,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(a=e.adBreakDone)==null||a.call(e,{breakName:e.name,breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:e.beforeAd,afterAd:e.afterAd,adDismissed:e.adDismissed,adViewed:e.adViewed,beforeReward:e.beforeReward,adBreakDone:o=>{var s;(s=e.adBreakDone)==null||s.call(e,{breakName:e.name,breakType:e.type,breakFormat:"reward",breakStatus:o})}});break}default:{if(!this.interstitialManager){(i=e.adBreakDone)==null||i.call(e,{breakName:e.name,breakType:e.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:e.beforeAd,afterAd:e.afterAd,onEnd:o=>{var s;(s=e.adBreakDone)==null||s.call(e,{breakName:e.name,breakType:e.type,breakFormat:"interstitial",breakStatus:o})}});break}}}};function co(t,e,r){return(e=_v(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _v(t){var e=yv(t,"string");return typeof e=="symbol"?e:e+""}function yv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lo=class{constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";co(this,"context",void 0),co(this,"placement","GAME"),co(this,"contextInfo",void 0),this.context=e,this.placement=r,this.contextInfo=this.context.getContextInfo()}getLocation(){let e=new URLSearchParams(window.location.search),r={};return e.forEach((n,a)=>{r[a]=n}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:r}}getDevice(){var e,r,n,a;return{platform:(e=this.contextInfo.platform)!=null?e:ed.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:(a=this.contextInfo.deviceBrand)!=null?a:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(e,r){var n;let a={protocolVersion:"1.0.0",events:[{name:e,type:Qc.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Zc.WebSDK};return ym(a)}};function xe(t,e,r){return(e=wv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wv(t){var e=bv(t,"string");return typeof e=="symbol"?e:e+""}function bv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ha=class{constructor(e){xe(this,"context",void 0),xe(this,"adsTrackSerializer",void 0),xe(this,"contextInfo",void 0),this.context=e,this.contextInfo=e.getContextInfo(),this.adsTrackSerializer=new Lo(this.context)}getRequestContextData(e){var r,n;this.contextInfo=this.context.getContextInfo();let{width:a,height:i}=this.context.getWindowInfo();return{report:JSON.stringify(this.adsTrackSerializer.serialize(e,{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:a,height:i}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},Do=class{constructor(e,r){var n=this;xe(this,"context",void 0),xe(this,"contextInfo",void 0),xe(this,"requestContext",void 0),xe(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),xe(this,"pendingAFVAdsInfo",Promise.resolve(null)),xe(this,"doFetchAdsInfo",a=>E(this,null,function*(){let i=a==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",o=[];switch(a){case"afv":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{o=["INTERSTITIAL"];break}}let s=a==="afv"?void 0:"cached",{data:l,code:d}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(i),bizParams:this.requestContext.getRequestBizParams(),adsTypes:o,testAdsMode:this.contextInfo.testAdsMode,name:s}});return d==="SUCCESS"||d==="BYPASS_ADS"?{code:d,data:l}:null})),xe(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),xe(this,"cacheInterstitialInfo",a=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(a).catch(()=>null)}),xe(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),xe(this,"cacheNextAFGAdsInfo",a=>E(this,null,function*(){a==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(a)})),xe(this,"getAFGAdsInfo",a=>E(this,null,function*(){let i=yield a==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(a),i})),xe(this,"getAFVAdsInfo",function(){return E(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let a=yield n.pendingAFVAdsInfo;return n.cacheAFVInfo(),a}else return n.cacheAFVInfo(),yield n.pendingAFVAdsInfo})}),this.context=e,this.contextInfo=this.context.getContextInfo(),this.requestContext=new ha(e),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function Ev(t,e,r){return(e=Iv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Iv(t){var e=Av(t,"string");return typeof e=="symbol"?e:e+""}function Av(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Sv=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];if(t)try{t(...r)}catch(a){console.error("[JoliboxSDK] Callback error:",a)}},ma=class{constructor(e){this.context=e,Ev(this,"canIUseHelper",void 0),this.context=e;let{canIUseNative:r}=Xh(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(e){return E(this,null,function*(){try{let{errNo:r,errMsg:n}=yield no("loadAdsAsync",{params:{providers:e.providers}});return r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){return uo()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(e){return E(this,null,function*(){try{let r=yield no("showAdAsync",{params:{providers:e.providers}});if(r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(e.callbacks){let a=e.timeout!==void 0?e.timeout:-1,i=null,o=()=>{Yh("onAdsStateChange",s),i&&(clearTimeout(i),i=null)},s=l=>{var d;if(l.UUID!==n)return;let g=(d=e.callbacks)==null?void 0:d[l.event];g&&Sv(g,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&o()};Qh("onAdsStateChange",s),a>0&&(i=setTimeout(()=>{o(),console.warn(`[JoliboxSDK] Event listener for ad ${n} auto-cleaned after ${a}ms timeout`)},a))}return{code:"SUCCESS",message:"Ad shown successfully"}}catch(r){return{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(e){try{let{errNo:r,data:n}=no("isAdsReadySync",{params:{providers:e.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 mt(t,e,r){return(e=Cv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cv(t){var e=Rv(t,"string");return typeof e=="symbol"?e:e+""}function Rv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var No=class{get isAdsReady(){return this._isAdsReady}constructor(e,r){mt(this,"providers",void 0),mt(this,"helper",void 0),mt(this,"adsContext",null),mt(this,"_isAdsReady",!1),mt(this,"init",()=>E(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),mt(this,"destroy",n=>{var a,i;this._isAdsReady=!1,(i=(a=this.adsContext)==null?void 0:a.adBreakDone)==null||i.call(a,n),n!=="ignored"&&(this.adsContext=null)}),mt(this,"reinit",n=>E(this,null,function*(){this.destroy(n),yield this.init()})),mt(this,"requestAds",(n,a)=>E(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=n,a&&a.length>0&&(this.providers=a);try{this.isAdsReady?this.showAd():yield this.reinit("frequencyCapped")}catch(i){this.destroy("notReady")}})),mt(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,a=!1;this.adsContext.beforeReward(()=>E(this,null,function*(){var i,o;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i);let s=d=>{var g,f,p;a||(a=!0,d==="dismissed"&&((g=this.adsContext)==null||g.adDismissed()),(p=(f=this.adsContext)==null?void 0:f.afterAd)==null||p.call(f),this.reinit(d))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var d;n=!0,(d=this.adsContext)==null||d.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new ma(e),this.init()}};function pt(t,e,r){return(e=Ov(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ov(t){var e=kv(t,"string");return typeof e=="symbol"?e:e+""}function kv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Uo=class{get isAdsReady(){return this._isAdsReady}constructor(e,r){var n=this;pt(this,"providers",void 0),pt(this,"helper",void 0),pt(this,"adsContext",null),pt(this,"_isAdsReady",!1),pt(this,"init",()=>E(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),pt(this,"destroy",function(a){var i,o;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n._isAdsReady=!1,s&&((o=(i=n.adsContext)==null?void 0:i.onEnd)==null||o.call(i,a),a!=="ignored"&&(n.adsContext=null))}),pt(this,"reinit",function(i){return E(this,arguments,function*(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(a,o),yield n.init()})}),pt(this,"requestAds",(a,i)=>E(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=a,i&&i.length>0&&(this.providers=i);try{this.isAdsReady?yield this.showAd():yield this.reinit("frequencyCapped")}catch(o){this.destroy("notReady")}})),pt(this,"showAd",()=>E(this,null,function*(){var a,i;if(!this.adsContext){this.destroy("error");return}let o=!1;(i=(a=this.adsContext).beforeAd)==null||i.call(a);let s=d=>{var g,f;o||(o=!0,(f=(g=this.adsContext)==null?void 0:g.afterAd)==null||f.call(g),this.reinit(d))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new ma(e),this.init()}};function Lr(t,e,r){return(e=Tv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Tv(t){var e=xv(t,"string");return typeof e=="symbol"?e:e+""}function xv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Bo=class{constructor(e,r){Lr(this,"name","INTERNAL_NATIVE"),Lr(this,"context",void 0),Lr(this,"rewardAdManager",void 0),Lr(this,"interstitialManager",void 0),Lr(this,"initProviders",void 0),this.context=e,this.initProviders=r.providers;let n=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],r.providers),a=this.getConfigsByTypes(["INTERSTITIAL"],r.providers);n.length>0&&(this.rewardAdManager=new No(this.context,n)),a.length>0&&(this.interstitialManager=new Uo(this.context,a))}getConfigsByTypes(e,r,n){let a=[];return(n?n.map(i=>r.find(o=>o.provider===i.provider)).filter(i=>!!i):r).forEach(i=>{e.forEach(o=>{let s="";o==="REWARD"&&(s=i.params.adUnitId.reward),o==="REWARD_INTERSTITIAL"&&(s=i.params.adUnitId.rewardInterstitial),o==="INTERSTITIAL"&&(s=i.params.adUnitId.interstitial),o==="NATIVE"&&(s=i.params.adUnitId.nativeAds),s&&a.push({provider:i.provider,params:{placementId:s,adsType:o,extra:i.params.extra}})})}),a}init(){return E(this,null,function*(){})}adConfig(e,r){}adBreak(e,r){var n,a,i;switch(e.type){case"preroll":{(n=e.adBreakDone)==null||n.call(e,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(a=e.adBreakDone)==null||a.call(e,{breakName:e.name,breakType:e.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}let o=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],this.initProviders,r.params);this.rewardAdManager.requestAds({beforeAd:e.beforeAd,afterAd:e.afterAd,adDismissed:e.adDismissed,adViewed:e.adViewed,beforeReward:e.beforeReward,adBreakDone:s=>{var l;(l=e.adBreakDone)==null||l.call(e,{breakName:e.name,breakType:e.type,breakFormat:"reward",breakStatus:s})}},o);break}default:{let o=e;if(!this.interstitialManager){(i=e.adBreakDone)==null||i.call(e,{breakName:o.name,breakType:e.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);this.interstitialManager.requestAds({beforeAd:o.beforeAd,afterAd:o.afterAd,onEnd:l=>{var d;(d=e.adBreakDone)==null||d.call(e,{breakName:o.name,breakType:e.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}};function We(t,e,r){return(e=Pv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pv(t){var e=Lv(t,"string");return typeof e=="symbol"?e:e+""}function Lv(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Gr=class{constructor(e){if(We(this,"context",void 0),We(this,"contextInfo",void 0),We(this,"providers",{}),We(this,"channelPolicy",void 0),We(this,"adsActionDetection",void 0),We(this,"requestContext",void 0),We(this,"adsRequest",void 0),We(this,"initialized",!1),We(this,"adsIsShowing",!1),We(this,"lastAdBreak",void 0),We(this,"initializedTimeStamp",Date.now()),e)this.context=e,this.channelPolicy=new _o(this.context),this.adsActionDetection=new go(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new Do(e),this.requestContext=new ha(e);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(e){return E(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:r}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((r==null?void 0:r.length)>0){let n=r.filter(s=>s.isNative),a=r.filter(s=>!s.isNative),i={provider:"INTERNAL_NATIVE",params:{providers:n}},o=a.concat([i]);for(let s of o)switch(s.provider){case"GOOGLE_GPT":{let l=new Po(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new yo(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new Ro(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new ko(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Oo(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new Bo(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;break}}}this.adsRequest.cacheInterstitialInfo("start"),this.adsRequest.cacheRewardInfo(),this.initialized=!0})}adConfig(e){this.providers.ADSENSE?this.providers.ADSENSE.adConfig(e):window.adsbygoogle.push(e)}adBreak(e){return E(this,null,function*(){var r,n,a,i,o,s,l,d,g,f,p,h,b,I,S,w;let O=Date.now();if(O-this.initializedTimeStamp<3e3){(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}if(this.lastAdBreak&&O-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads] You can't call adBreak too frequently"),(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.lastAdBreak=O,this.adsIsShowing){console.warn("[Jolibox SDK Ads] You can't call adBreak while ad is showing"),(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.initialized||(yield this.init()),e.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(o=e.adBreakDone)==null||o.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let L=yield this.adsRequest.getAFGAdsInfo(e.type),U=L==null?void 0:L.data,J=L==null?void 0:L.code;if(J==="BYPASS_ADS"){switch(e.type){case"preroll":{(s=e.adBreakDone)==null||s.call(e,{breakType:e.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{e.beforeReward(()=>{var A,P,H,q;(A=e.beforeAd)==null||A.call(e),(P=e.adViewed)==null||P.call(e),(H=e.afterAd)==null||H.call(e),(q=e.adBreakDone)==null||q.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=e.beforeAd)==null||l.call(e),(d=e.afterAd)==null||d.call(e),(g=e.adBreakDone)==null||g.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!U||J!=="SUCCESS"){(f=e.adBreakDone)==null||f.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(U.length===0){(p=e.adBreakDone)==null||p.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let A=!0,P=null,H=new vo(this.context);this.adsActionDetection.adBreakIsShowing=!0;let q=U.filter(V=>V.isNative).sort((V,$)=>V.seq-$.seq),N=U.filter(V=>!V.isNative).sort((V,$)=>V.seq-$.seq),M={seq:(b=(h=q[0])==null?void 0:h.seq)!=null?b:0,provider:"INTERNAL_NATIVE",params:q},F;for(q.length>0?F=[M].concat(N):F=N,F=F.sort((V,$)=>V.seq-$.seq).map((V,$)=>Wh(Wc({},V),{seq:$}));F.length>0;){let V=F.shift(),$=this.providers[V.provider];if($){let[Be,Mt]=yield H.callAdBreakAndContinue($,e,V,Gt=>{var tt;this.adsIsShowing=Gt,(tt=this.context.eventEmitter)==null||tt.emit("isAdShowing",Gt)});A=Be,P=Mt}else A=!0,P={breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!A)break}A&&P&&((I=e.adBreakDone)==null||I.call(e,P))}}catch(L){(S=e.adBreakDone)==null||S.call(e,{breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(w=this.context.eventEmitter)==null||w.emit("isAdShowing",!1),this.adsActionDetection.adBreakIsShowing=!1}})}adUnit(e){console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.")}};var _I=Ce`
259
+ ${ve}
260
260
  position: fixed;
261
261
  left: 0;
262
262
  top: 0;
@@ -267,7 +267,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
267
267
  height: 100vh;
268
268
 
269
269
  .ads-wrapper {
270
- ${ge}
270
+ ${ve}
271
271
  position: relative;
272
272
  width: 100%;
273
273
  height: 100%;
@@ -290,7 +290,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
290
290
  }
291
291
 
292
292
  .retry-button {
293
- ${ge}
293
+ ${ve}
294
294
  position: absolute;
295
295
  width: 100%;
296
296
  height: 100%;
@@ -300,7 +300,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
300
300
  cursor: pointer;
301
301
  }
302
302
  }
303
- `;he();var EC=Yi(Ru());var Qr=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(){}};ot();var Xr=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,a,o,s,l,c,p;if(console.log(`HuaweiQuickAdsHandler,event => ${t}`),t.origin==window.location.origin&&t.data&&t.data.type==null){let u=JSON.parse(t.data);switch(console.log(`HuaweiQuickAdsHandler type => ${u.type}`),u.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",u);break;case"huawei_quick_ads_on_message_ad_config":{let m=u.callbackId;if(m){let h=this.callbackMap.get(m);(r=h==null?void 0:h.onReady)==null||r.call(h)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",u)}break;case"huawei_quick_ads_on_message_ad_break":{let m=u.callbackId;if(m){let h=this.callbackMap.get(m),b="noAdPreloaded",E=!1;switch(u.adsRes){case"viewed":b="viewed",(n=h==null?void 0:h.adViewed)==null||n.call(h),E=!1;break;case"dismissed":b="dismissed",(i=h==null?void 0:h.adDismissed)==null||i.call(h),E=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":b=u.adsRes,E=!0;break;case"breakDone":b=u.params,E=!0;break;case"beforeReward":(a=h==null?void 0:h.beforeReward)==null||a.call(h,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),E=!1;break;case"beforeAd":_e("HuaweiQuickAdsAdBreakBeforeAd",{type:"beforeAd",format:(h==null?void 0:h.breakType)==="reward"?"reward":"interstitial"}),(o=h==null?void 0:h.beforeAd)==null||o.call(h),E=!1;break;case"afterAd":(s=h==null?void 0:h.afterAd)==null||s.call(h),E=!1;break}E&&((p=h==null?void 0:h.adBreakDone)==null||p.call(h,{breakType:(l=h.breakType)!=null?l:"",breakName:h.breakName,breakFormat:(c=h.breakFormat)!=null?c:"interstitial",breakStatus:b}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",u)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",u);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),_e("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 a=Q(Q({type:t},r!==void 0&&{callbackId:r}),n!==void 0&&{data:n});window.system.postMessage(JSON.stringify(a))}catch(a){throw console.error("sendPostMessage failed",a),a}}};var Yr=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 a,o,s,l,c;(a=i==null?void 0:i.args)!=null&&a.success?(o=t.adViewed)==null||o.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 a;console.log("showReward error => ",i),(a=t.adBreakDone)==null||a.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(){}};he();var Ft=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=D.hostUserInfo)==null?void 0:n.isSubUser){this.wrapAdBreadDoneViewed(t);return}if(t.type==="reward")try{let a=yield Ye.getRewardsTypes(this.httpClient);if(!(yield Ye.handleReward(a,t)))throw new Error("handleReward failed: fallback to unlock failed")}catch(a){console.info("handleReward failed",a),(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 Zr=class e extends Ft{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}}Xs(e.prototype,this,"adBreak").call(this,t)})}};var bs=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new Qr(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=Xr.getInstance();break}case"gamedistribution":{this.cacheHandler=Yr.getInstance();break}case"funmax":{let r=new $r(this.context);this.cacheHandler=new Zr(r,Rt);break}default:{let r=new $r(this.context);this.cacheHandler=new Ft(r,Rt);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},Li=Ee(),Ou=new ze,Rt=Ke.create(),x_={httpClient:Rt,checkNetwork:()=>Ke.getNetworkStatus(),track:_e,eventEmitter:Ou,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,a,o,s,l;return{hostAppId:(t=(e=D.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=D.deviceInfo.did)!=null?r:"",adId:(n=D.deviceInfo.adId)!=null?n:"",sessionId:(i=D.sessionId)!=null?i:"",userId:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:"",objectType:"GAME",objectId:D.mpId,testAdsMode:D.testAdsMode,channel:(s=D.joliSource)!=null?s:"",deviceBrand:D.deviceInfo.brand,deviceModel:D.deviceInfo.model,osType:ke.isAndroid?"ANDROID":ke.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=D.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},ku=e=>{Ne("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e}),_e("jolicoin_unlock_success",{quantity:e.quantity})},N_=()=>{_e("subscription_unlock_success",{})},P_=new bs(x_),en=P_.getAdsHandler(D.sdkEnvironment);Ye.registerRewardHandler("ADS",ic(en.getAdsInstance()));Ye.registerRewardHandler("JOLI_COIN",oc(Rt,{onUnlockSuccess:ku.bind(void 0),hasSubscription:()=>!0}));Ye.registerRewardHandler("JOLI_COIN_ONLY",sc(Rt,{onUnlockSuccess:ku.bind(void 0),hasSubscription:()=>!0}));Ye.registerRewardHandler("SUBSCRIPTION",uc(Rt,{onSubSuccess:N_.bind(void 0),hasSubscription:()=>!0}));Xa(Rt);Wn(Rt);Ou.on("isAdShowing",e=>{Ne("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Li.registerCommand("AdsSDK.init",e=>{en.init(e)});Li.registerCommand("AdsSDK.adConfig",e=>{en.adConfig(e)});Li.registerCommand("AdsSDK.adBreak",e=>{en.adBreak(e)});Li.registerCommand("AdsSDK.adUnit",e=>{en.adUnit(e)});$();ot();Ar();var ws=Ee();ws.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();Ne("CP_LOAD_FINISH",{duration:e}),_e("loadFinished",{duration:e})});ws.registerCommand("RuntimeSDK.loadProgressEvent",e=>{Ne("CP_LOAD_PROGRESS",{progress:e}),console.log("RuntimeSDK.loadProgressEvent",e)});ws.registerCommand("RuntimeSDK.gameTTIEvent",()=>{Ne("CP_GAME_TTI",{duration:performance.now()}),_e("gameTTI",{duration:performance.now()})});$();ot();var Lu=-1,Bi=function(e){addEventListener("pageshow",function(t){t.persisted&&(Lu=t.timeStamp,e(t))},!0)},Is=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Mi=function(){var e=Is();return e&&e.activationStart||0},hr=function(e,t){var r=Is(),n="navigate";return Lu>=0?n="back-forward-cache":r&&(document.prerendering||Mi()>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}},Uu=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){}},mr=function(e,t,r,n){var i,a;return function(o){t.value>=0&&(o||n)&&((a=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=a,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,r),e(t))}},Bu=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},Mu=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},Gu=function(e){var t=!1;return function(){t||(e(),t=!0)}},fr=-1,Tu=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Ui=function(e){document.visibilityState==="hidden"&&fr>-1&&(fr=e.type==="visibilitychange"?e.timeStamp:0,D_())},xu=function(){addEventListener("visibilitychange",Ui,!0),addEventListener("prerenderingchange",Ui,!0)},D_=function(){removeEventListener("visibilitychange",Ui,!0),removeEventListener("prerenderingchange",Ui,!0)},Ju=function(){return fr<0&&(fr=Tu(),xu(),Bi(function(){setTimeout(function(){fr=Tu(),xu()},0)})),{get firstHiddenTime(){return fr}}},As=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Nu=[1800,3e3],Fu=function(e,t){t=t||{},As(function(){var r,n=Ju(),i=hr("FCP"),a=Uu("paint",function(o){o.forEach(function(s){s.name==="first-contentful-paint"&&(a.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-Mi(),0),i.entries.push(s),r(!0)))})});a&&(r=mr(e,i,Nu,t.reportAllChanges),Bi(function(o){i=hr("FCP"),r=mr(e,i,Nu,t.reportAllChanges),Bu(function(){i.value=performance.now()-o.timeStamp,r(!0)})}))})};var L_=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=Gu(e),document.visibilityState==="hidden"?e():(r=t(e),Mu(e)),r};var Pu=[2500,4e3],Es={},ju=function(e,t){t=t||{},As(function(){var r,n=Ju(),i=hr("LCP"),a=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-Mi(),0),i.entries=[c],r())})},o=Uu("largest-contentful-paint",a);if(o){r=mr(e,i,Pu,t.reportAllChanges);var s=Gu(function(){Es[i.id]||(a(o.takeRecords()),o.disconnect(),Es[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return L_(s)},{once:!0,capture:!0})}),Mu(s),Bi(function(l){i=hr("LCP"),r=mr(e,i,Pu,t.reportAllChanges),Bu(function(){i.value=performance.now()-l.timeStamp,Es[i.id]=!0,r(!0)})})}})},Du=[800,1800],U_=function e(t){document.prerendering?As(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Hu=function(e,t){t=t||{};var r=hr("TTFB"),n=mr(e,r,Du,t.reportAllChanges);U_(function(){var i=Is();i&&(r.value=Math.max(i.responseStart-Mi(),0),r.entries=[i],n(!0),Bi(function(){r=hr("TTFB",0),(n=mr(e,r,Du,t.reportAllChanges))(!0)}))})};he();Wt();nt();$();Ar();$();var Gi=new Map,qu=!1,B_=()=>{qu||(Pt("ON_JOLIBOX_GET_USER_SUB_STATUS",e=>{let t=Gi.get(e.sequenceId);if(t){clearTimeout(t.timeoutId);let{isSubUser:r,userId:n}=e;t.resolve({isSubUser:r,userId:n}),Gi.delete(e.sequenceId)}}),qu=!0)};function Ss(){return A(this,null,function*(){return B_(),new Promise((e,t)=>{let r=$e(),n=setTimeout(()=>{Gi.delete(r),t(new Error("Timeout waiting for user sub status response"))},3e3);Gi.set(r,{resolve:e,reject:t,timeoutId:n}),Ne("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function Vu(){return A(this,null,function*(){let e=Ke.create();try{let t=yield e.get("/api/users/info");return!(t.code!=="SUCCESS"||!t.data)}catch(t){return Ge(new sn(t)),!1}})}function M_(){Fu(e=>{_e("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),ju(e=>{_e("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Hu(e=>{_e("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function G_(){Et.on("onDocumentReady",e=>A(this,null,function*(){let t=yield Vu(),{isSubUser:r,userId:n}=yield Ss().catch(()=>({isSubUser:!1,userId:void 0}));D.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:r,uid:n}}),Et.emit("LifecycleEvent.onReady",Q({},D.hostUserInfo?D.hostUserInfo:{isLogin:!1})),D.mpType==="game"&&at.start(Date.now()-e)}))}function $u(){G_(),M_()}$u();
303
+ `;fe();var rA=Ba(Sd());var jr=class{constructor(e){this.ads=e}getAdsInstance(){return this.ads}init(){}adConfig(e){var r,n;(n=(r=this.ads)==null?void 0:r.adConfig)==null||n.call(r,e)}adBreak(e){this.ads.adBreak(e)}adUnit(){}};it();var qr=class t{constructor(){this.callbacksId=0,this.callbackMap=new Map,this.initOnMessage()}static getInstance(){return t.instance||(t.instance=new t),t.instance}initOnMessage(){window.addEventListener("message",e=>{var r,n,a,i,o,s,l,d,g;if(console.log(`HuaweiQuickAdsHandler,event => ${e}`),e.origin==window.location.origin&&e.data&&e.data.type==null){let f=JSON.parse(e.data);switch(console.log(`HuaweiQuickAdsHandler type => ${f.type}`),f.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",f);break;case"huawei_quick_ads_on_message_ad_config":{let p=f.callbackId;if(p){let h=this.callbackMap.get(p);(r=h==null?void 0:h.onReady)==null||r.call(h)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",f)}break;case"huawei_quick_ads_on_message_ad_break":{let p=f.callbackId;if(p){let h=this.callbackMap.get(p),b="noAdPreloaded",I=!1;switch(f.adsRes){case"viewed":b="viewed",(n=h==null?void 0:h.adViewed)==null||n.call(h),I=!1;break;case"dismissed":b="dismissed",(a=h==null?void 0:h.adDismissed)==null||a.call(h),I=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":b=f.adsRes,I=!0;break;case"breakDone":b=f.params,I=!0;break;case"beforeReward":(i=h==null?void 0:h.beforeReward)==null||i.call(h,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),I=!1;break;case"beforeAd":ge("HuaweiQuickAdsAdBreakBeforeAd",{type:"beforeAd",format:(h==null?void 0:h.breakType)==="reward"?"reward":"interstitial"}),(o=h==null?void 0:h.beforeAd)==null||o.call(h),I=!1;break;case"afterAd":(s=h==null?void 0:h.afterAd)==null||s.call(h),I=!1;break}I&&((g=h==null?void 0:h.adBreakDone)==null||g.call(h,{breakType:(l=h.breakType)!=null?l:"",breakName:h.breakName,breakFormat:(d=h.breakFormat)!=null?d:"interstitial",breakStatus:b}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",f)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",f);break;default:break}}})}getAdsInstance(){return t.getInstance()}init(e){try{this.sendPostMessage("huawei_quick_ads_init",void 0,e)}catch(r){console.error("init failed",r)}}adConfig(e){try{let r;e.onReady&&(r=++this.callbacksId,this.callbackMap.set(r,{onReady:e.onReady})),this.sendPostMessage("huawei_quick_ads_ad_config",r,e)}catch(r){console.error("adConfig failed",r)}}adBreak(e){var r;try{let n=++this.callbacksId,a={};a.breakType=e.type,e.type!=="preroll"&&e.name&&(a.breakName=e.name),a.breakFormat=e.type==="reward"?"reward":"interstitial",e.adBreakDone&&(a.adBreakDone=e.adBreakDone),e.type!=="preroll"&&e.beforeAd&&(a.beforeAd=e.beforeAd),e.type!=="preroll"&&e.afterAd&&(a.afterAd=e.afterAd),e.type==="reward"&&e.beforeReward&&(a.beforeReward=e.beforeReward),e.type==="reward"&&e.adDismissed&&(a.adDismissed=e.adDismissed),e.type==="reward"&&e.adViewed&&(a.adViewed=e.adViewed),this.callbackMap.set(n,a),ge("HuaweiQuickAdsAdBreak",{type:e.type,format:e.type==="reward"?"reward":"interstitial"}),this.sendPostMessage("huawei_quick_ads_ad_break",n,e)}catch(n){(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}}adUnit(e){try{this.sendPostMessage("huawei_quick_ads_ad_unit",void 0,e)}catch(r){console.error("adUnit failed",r)}}sendPostMessage(e,r,n){var a;try{if(!((a=window.system)!=null&&a.postMessage))throw new Error("window.system.postMessage is not available");let i=X(X({type:e},r!==void 0&&{callbackId:r}),n!==void 0&&{data:n});window.system.postMessage(JSON.stringify(i))}catch(i){throw console.error("sendPostMessage failed",i),i}}};var Vr=class t{constructor(){}static getInstance(){return t.instance||(t.instance=new t),t.instance}getAdsInstance(){return t.getInstance()}init(){}adConfig(e){e.onReady&&e.onReady()}adBreak(e){var r;try{e.type==="reward"?window.gdsdk.preloadAd("rewarded").then(()=>{var n;(n=e.beforeReward)==null||n.call(e,()=>{e.beforeAd&&e.beforeAd(),window.gdsdk.showAd("rewarded").then(a=>{var i,o,s,l,d;(i=a==null?void 0:a.args)!=null&&i.success?(o=e.adViewed)==null||o.call(e):(s=e.adDismissed)==null||s.call(e),e.afterAd&&e.afterAd(),(d=e.adBreakDone)==null||d.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:(l=a==null?void 0:a.args)!=null&&l.success?"viewed":"dismissed"})}).catch(a=>{var i;console.log("showReward error => ",a),(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})})})}).catch(n=>{var a;console.log("preloadAd error => ",n),(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})}):(e.type!=="preroll"&&e.beforeAd&&e.beforeAd(),window.gdsdk.showAd("interstitial").then(()=>{var n;e.type!=="preroll"&&e.afterAd&&e.afterAd(),(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:"interstitial",breakStatus:"viewed"})}))}catch(n){console.log("adBreak error => ",n),(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"error"})}}adUnit(){}};fe();var Bt=class{constructor(e,r){this.ads=e;this.httpClient=r}getAdsInstance(){return this.ads}init(e){this.ads.init(e)}adConfig(e){this.ads.adConfig(e)}adBreak(e){return E(this,null,function*(){var n,a;if((n=D.hostUserInfo)==null?void 0:n.isSubUser){this.wrapAdBreadDoneViewed(e);return}if(e.type==="reward")try{let i=yield Qe.getRewardsTypes(this.httpClient);if(!(yield Qe.handleReward(i,e)))throw new Error("handleReward failed: fallback to unlock failed")}catch(i){console.info("handleReward failed",i),(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}else this.ads.adBreak(e)})}adUnit(e){this.ads.adUnit(e)}wrapAdBreadDoneViewed(e){var r,n,a;(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:"name"in e&&(r=e.name)!=null?r:"",breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in e&&((a=e.adViewed)==null||a.call(e))}};var $r=class t extends Bt{constructor(e,r){super(e,r),this.startTimes=Date.now()}adBreak(e){return E(this,null,function*(){var r,n;if(e.type!=="reward"){if(e.type==="preroll"){(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let a=Date.now();if(console.log("FunmaxAdsHandler time => ",a-this.startTimes),a-this.startTimes<4e4){(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}}ys(t.prototype,this,"adBreak").call(this,e)})}};var Ho=class{constructor(e){this.cacheHandler=null;this.context=e}createAdsHandler(e){if(this.cacheHandler)return this.cacheHandler;switch(e){case"dlightek":{this.cacheHandler=new jr(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=qr.getInstance();break}case"gamedistribution":{this.cacheHandler=Vr.getInstance();break}case"funmax":{let r=new Gr(this.context);this.cacheHandler=new $r(r,It);break}default:{let r=new Gr(this.context);this.cacheHandler=new Bt(r,It);break}}return this.cacheHandler}getAdsHandler(e){return this.createAdsHandler(e)}},wa=Ee(),Cd=new ze,It=Ve.create(),Dv={httpClient:It,checkNetwork:()=>Ve.getNetworkStatus(),track:ge,eventEmitter:Cd,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:0}),handleLinkClicked:t=>{window.open(t,"_blank")},getContextInfo:()=>{var t,e,r,n,a,i,o,s,l;return{hostAppId:(e=(t=D.hostInfo)==null?void 0:t.aid)!=null?e:"1",deviceId:(r=D.deviceInfo.did)!=null?r:"",adId:(n=D.deviceInfo.adId)!=null?n:"",sessionId:(a=D.sessionId)!=null?a:"",userId:(o=(i=D.hostUserInfo)==null?void 0:i.uid)!=null?o:"",objectType:"GAME",objectId:D.mpId,testAdsMode:D.testAdsMode,channel:(s=D.joliSource)!=null?s:"",deviceBrand:D.deviceInfo.brand,deviceModel:D.deviceInfo.model,osType:Oe.isAndroid?"ANDROID":Oe.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=D.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},Rd=t=>{Pe("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:t}),ge("jolicoin_unlock_success",{quantity:t.quantity})},Nv=()=>{ge("subscription_unlock_success",{})},Uv=new Ho(Dv),Kr=Uv.getAdsHandler(D.sdkEnvironment);Qe.registerRewardHandler("ADS",Cl(Kr.getAdsInstance()));Qe.registerRewardHandler("JOLI_COIN",Ol(It,{onUnlockSuccess:Rd.bind(void 0),hasSubscription:()=>!0}));Qe.registerRewardHandler("JOLI_COIN_ONLY",kl(It,{onUnlockSuccess:Rd.bind(void 0),hasSubscription:()=>!0}));Qe.registerRewardHandler("SUBSCRIPTION",Ll(It,{onSubSuccess:Nv.bind(void 0),hasSubscription:()=>!0}));Di(It);Fn(It);Cd.on("isAdShowing",t=>{Pe("JOLIBOX_ADS_EVENT",{isAdShowing:t})});wa.registerCommand("AdsSDK.init",t=>{Kr.init(t)});wa.registerCommand("AdsSDK.adConfig",t=>{Kr.adConfig(t)});wa.registerCommand("AdsSDK.adBreak",t=>{Kr.adBreak(t)});wa.registerCommand("AdsSDK.adUnit",t=>{Kr.adUnit(t)});K();it();br();var jo=Ee();jo.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let t=performance.now();Pe("CP_LOAD_FINISH",{duration:t}),ge("loadFinished",{duration:t})});jo.registerCommand("RuntimeSDK.loadProgressEvent",t=>{Pe("CP_LOAD_PROGRESS",{progress:t}),console.log("RuntimeSDK.loadProgressEvent",t)});jo.registerCommand("RuntimeSDK.gameTTIEvent",()=>{Pe("CP_GAME_TTI",{duration:performance.now()}),ge("gameTTI",{duration:performance.now()})});K();it();var Ld=-1,Ea=function(t){addEventListener("pageshow",function(e){e.persisted&&(Ld=e.timeStamp,t(e))},!0)},Vo=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Ia=function(){var t=Vo();return t&&t.activationStart||0},lr=function(t,e){var r=Vo(),n="navigate";return Ld>=0?n="back-forward-cache":r&&(document.prerendering||Ia()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:t,value:e===void 0?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},Dd=function(t,e,r){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver(function(a){Promise.resolve().then(function(){e(a.getEntries())})});return n.observe(Object.assign({type:t,buffered:!0},r||{})),n}}catch(a){}},cr=function(t,e,r,n){var a,i;return function(o){e.value>=0&&(o||n)&&((i=e.value-(a||0))||a===void 0)&&(a=e.value,e.delta=i,e.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(e.value,r),t(e))}},Nd=function(t){requestAnimationFrame(function(){return requestAnimationFrame(function(){return t()})})},Ud=function(t){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&t()})},Bd=function(t){var e=!1;return function(){e||(t(),e=!0)}},sr=-1,Od=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},ba=function(t){document.visibilityState==="hidden"&&sr>-1&&(sr=t.type==="visibilitychange"?t.timeStamp:0,Bv())},kd=function(){addEventListener("visibilitychange",ba,!0),addEventListener("prerenderingchange",ba,!0)},Bv=function(){removeEventListener("visibilitychange",ba,!0),removeEventListener("prerenderingchange",ba,!0)},Md=function(){return sr<0&&(sr=Od(),kd(),Ea(function(){setTimeout(function(){sr=Od(),kd()},0)})),{get firstHiddenTime(){return sr}}},$o=function(t){document.prerendering?addEventListener("prerenderingchange",function(){return t()},!0):t()},Td=[1800,3e3],Gd=function(t,e){e=e||{},$o(function(){var r,n=Md(),a=lr("FCP"),i=Dd("paint",function(o){o.forEach(function(s){s.name==="first-contentful-paint"&&(i.disconnect(),s.startTime<n.firstHiddenTime&&(a.value=Math.max(s.startTime-Ia(),0),a.entries.push(s),r(!0)))})});i&&(r=cr(t,a,Td,e.reportAllChanges),Ea(function(o){a=lr("FCP"),r=cr(t,a,Td,e.reportAllChanges),Nd(function(){a.value=performance.now()-o.timeStamp,r(!0)})}))})};var Mv=function(t){var e=self.requestIdleCallback||self.setTimeout,r=-1;return t=Bd(t),document.visibilityState==="hidden"?t():(r=e(t),Ud(t)),r};var xd=[2500,4e3],qo={},Fd=function(t,e){e=e||{},$o(function(){var r,n=Md(),a=lr("LCP"),i=function(l){e.reportAllChanges||(l=l.slice(-1)),l.forEach(function(d){d.startTime<n.firstHiddenTime&&(a.value=Math.max(d.startTime-Ia(),0),a.entries=[d],r())})},o=Dd("largest-contentful-paint",i);if(o){r=cr(t,a,xd,e.reportAllChanges);var s=Bd(function(){qo[a.id]||(i(o.takeRecords()),o.disconnect(),qo[a.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return Mv(s)},{once:!0,capture:!0})}),Ud(s),Ea(function(l){a=lr("LCP"),r=cr(t,a,xd,e.reportAllChanges),Nd(function(){a.value=performance.now()-l.timeStamp,qo[a.id]=!0,r(!0)})})}})},Pd=[800,1800],Gv=function t(e){document.prerendering?$o(function(){return t(e)}):document.readyState!=="complete"?addEventListener("load",function(){return t(e)},!0):setTimeout(e,0)},Jd=function(t,e){e=e||{};var r=lr("TTFB"),n=cr(t,r,Pd,e.reportAllChanges);Gv(function(){var a=Vo();a&&(r.value=Math.max(a.responseStart-Ia(),0),r.entries=[a],n(!0),Ea(function(){r=lr("TTFB",0),(n=cr(t,r,Pd,e.reportAllChanges))(!0)}))})};fe();qt();nt();K();br();K();var Aa=new Map,Hd=!1,Fv=()=>{Hd||(kt("ON_JOLIBOX_GET_USER_SUB_STATUS",t=>{let e=Aa.get(t.sequenceId);if(e){clearTimeout(e.timeoutId);let{isSubUser:r,userId:n}=t;e.resolve({isSubUser:r,userId:n}),Aa.delete(t.sequenceId)}}),Hd=!0)};function Ko(){return E(this,null,function*(){return Fv(),new Promise((t,e)=>{let r=qe(),n=setTimeout(()=>{Aa.delete(r),e(new Error("Timeout waiting for user sub status response"))},3e3);Aa.set(r,{resolve:t,reject:e,timeoutId:n}),Pe("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function jd(){return E(this,null,function*(){let t=Ve.create();try{let e=yield t.get("/api/users/info");return!(e.code!=="SUCCESS"||!e.data)}catch(e){return Me(new Zr(e)),!1}})}function Jv(){Gd(t=>{ge("GameFCP",{value:t.value,rating:t.rating,navigationType:t.navigationType})}),Fd(t=>{ge("GameLCP",{value:t.value,rating:t.rating,navigationType:t.navigationType})}),Jd(t=>{ge("GameTTFB",{value:t.value,rating:t.rating,navigationType:t.navigationType})})}function Hv(){yt.on("onDocumentReady",t=>E(this,null,function*(){let e=yield jd(),{isSubUser:r,userId:n}=yield Ko().catch(()=>({isSubUser:!1,userId:void 0}));D.onEnvConfigChanged({hostUserInfo:{isLogin:e,isSubUser:r,uid:n}}),yt.emit("LifecycleEvent.onReady",X({},D.hostUserInfo?D.hostUserInfo:{isLogin:!1})),D.mpType==="game"&&$e.start(Date.now()-t)}))}function qd(){Hv(),Jv()}qd();
304
304
  /*! Bundled license information:
305
305
 
306
306
  localforage/dist/localforage.js: