@jolibox/implement 1.4.7 → 1.4.8

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 eh=Object.create;var Zi=Object.defineProperty,th=Object.defineProperties,rh=Object.getOwnPropertyDescriptor,nh=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertyNames,ln=Object.getOwnPropertySymbols,Ys=Object.getPrototypeOf,ea=Object.prototype.hasOwnProperty,Zs=Object.prototype.propertyIsEnumerable,ah=Reflect.get;var Qs=(e,t,r)=>t in e?Zi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))ea.call(t,r)&&Qs(e,r,t[r]);if(ln)for(var r of ln(t))Zs.call(t,r)&&Qs(e,r,t[r]);return e},ke=(e,t)=>th(e,nh(t));var yr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var el=(e,t)=>{var r={};for(var n in e)ea.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ln)for(var n of ln(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 ta=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var oh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ih(t))!ea.call(e,i)&&i!==r&&Zi(e,i,{get:()=>t[i],enumerable:!(n=rh(t,i))||n.enumerable});return e};var ra=(e,t,r)=>(r=e!=null?eh(Ys(e)):{},oh(t||!e||!e.__esModule?Zi(r,"default",{value:e,enumerable:!0}):r,e));var tl=(e,t,r)=>ah(Ys(e),r,t);var I=(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 mh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ua(e){return typeof e=="string"}function ll(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function cl(e){return typeof e=="object"&&Array.isArray(e)}function ph(e){return typeof e=="undefined"}function vh(e){return ph(e)||e===null}function gh(e){return typeof e=="function"}function dl(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function ul(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:il(l)&&il(s)?i[o]=n(da({},s),l):Array.isArray(l)&&Array.isArray(s)?i[o]=[...s,...l]:i[o]=l}return i}return n(e,t)}function il(e){return e&&typeof e=="object"&&e.constructor===Object}function fl(e,t){if(Array.isArray(e))return e.concat(t)}function Ir(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),m=function(...u){i=u,a=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return m.cancel=()=>{n&&clearTimeout(n),n=null,i=a=void 0},m.flush=()=>{if(n)return clearTimeout(n),n=null,c()},m}function wh(e,t){return(...r)=>t(e,...r)}function vl(e){return t=>wh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new yh(`${i}`))}})}function wr(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function cn(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 Ch(e){let t=e.location?cn(e.location,ol):null,r=e.target?cn(e.target,ol):null;return cn(fh(da({},e),{location:t,target:r}),Ah)}function va(e){let t=e.events.map(n=>Ch(n)),r=cn(e.device,Sh);return[e.protocolVersion,t,r,e.project]}function Rh(){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 ya(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 yl(e){return ya("app","stg-app",e)}function Wt(e){return`https://${ya("api","stg-api",e)}`}function Dh(e){return ya("collect","stg-collect",e)}function wl(e){return`https://${Dh(e)}`}function Mh(e){return new Promise(t=>bl(e)(t))}function bl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Gh(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new Er(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function Fh(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)jh(e[n],t[n])}function jh(e,t){if(ua(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(gh(t)){try{if(e instanceof t)return}catch(r){}if(!vh(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 Hh(){return typeof globalThis!="undefined"?globalThis[El]:void 0}function qh(e){typeof globalThis!="undefined"&&(globalThis[El]=e)}function Ie(e=!1){let t=Hh();if(!e&&t)return t;let r=new dn,n=new la,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 qh(i),i}var ca,sh,lh,ch,rl,dh,uh,nl,da,fh,hh,sl,kt,_h,fa,ha,hl,ml,yh,pl,un,fn,ma,xe,ia,bh,pa,al,Eh,Tt,Kt,Ih,ol,Ah,Sh,$e,$t,Oh,Te,kh,Th,xh,gl,ga,_a,Ph,Nh,_l,xt,aa,ae,Lh,Uh,br,Er,Qe,sa,Bh,na,Jh,Et,dn,la,El,K=re(()=>{"use strict";ca=Object.defineProperty,sh=Object.defineProperties,lh=Object.getOwnPropertyDescriptor,ch=Object.getOwnPropertyDescriptors,rl=Object.getOwnPropertySymbols,dh=Object.prototype.hasOwnProperty,uh=Object.prototype.propertyIsEnumerable,nl=(e,t,r)=>t in e?ca(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,da=(e,t)=>{for(var r in t||(t={}))dh.call(t,r)&&nl(e,r,t[r]);if(rl)for(var r of rl(t))uh.call(t,r)&&nl(e,r,t[r]);return e},fh=(e,t)=>sh(e,ch(t)),hh=(e,t)=>{for(var r in t)ca(e,r,{get:t[r],enumerable:!0})},sl=(e,t,r,n)=>{for(var i=n>1?void 0:n?lh(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&&ca(t,r,i),i},kt=(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}_h=(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))(_h||{}),fa=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}},ha=class extends fa{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},hl=class extends fa{constructor(){super(...arguments),this.kind="USER_ERROR"}},ml=class extends hl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},yh=class extends hl{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},pl=class extends ha{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},un=class extends ha{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},fn=class extends fa{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}}},ma=class extends ha{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};xe={log:wr("log"),warn:wr("warn"),info:wr("info"),error:wr("error"),debug:wr("debug")};Object.assign(globalThis,{logger:xe});ia=Symbol.for("Jolibox.canIUseMap"),bh={};globalThis[ia]||(globalThis[ia]=bh);pa={get config(){return globalThis[ia]}},al=Symbol.for("Jolibox.canIUseMap.native"),Eh={};globalThis[al]||(globalThis[al]=Eh);Tt=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Tt||{}),Kt=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Kt||{}),Ih=(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))(Ih||{}),ol=["name","params"],Ah=["name","type","location","target","extra","timestamp","userId"],Sh=["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)});Rh();$t=typeof window=="undefined",Oh=()=>!$t&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Te={isiOS:!$t&&(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:!$t&&navigator.userAgent.includes("Android"),isMac:!$t&&navigator.userAgent.includes("Mac"),isFacebook:!$t&&navigator.userAgent.includes("FB_IAB"),isPC:!$t&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},kh=()=>Te.isiOS?"iOS":Te.isAndroid?"Android":Te.isMac?"Mac":Te.isFacebook?"Facebook":"PC",Th="device_id",xh="advertising_id",gl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,$e()),window.__joliboxLocalStorage__.getItem(e)),ga=()=>new URLSearchParams(window.location.search).get("deviceId")||gl(Th),_a=()=>new URLSearchParams(window.location.search).get("advertisingId")||gl(xh),Ph=e=>e.charAt(0).toUpperCase()+e.slice(1),Nh=()=>{var e;let t=new URLSearchParams(window.location.search);return Ph((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},_l=e=>{if(Oh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=kh(),n=navigator.language,i=ga(),a=_a();return`${t} (${Nh()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${a} version/${e||""}`};xt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=da({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return kt(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=>kt(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 kt(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),p=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,p)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),m=(a=(i=this.requestAdapter).extractCacheableData)==null?void 0:a.call(i,c);return m&&this.setCachedDataWithSequence(o,m,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let 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 kt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return kt(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 kt(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)}},aa=class oa{constructor(t){this.element=t,this.next=oa.Undefined,this.prev=oa.Undefined}};aa.Undefined=new aa(void 0);ae=aa,Lh=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}},Uh=0,br=class{constructor(e){this.value=e,this.id=Uh++}},Er=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 br&&(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 br(t);return this._listeners?this._listeners instanceof br?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 m,u,p,h;if(!this._disposed){if(this._listeners instanceof br)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||u.call(m));else if(this._listeners){let w=this._listeners.indexOf(c);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((h=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||h.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof br?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Qe=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 Er,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 Lh,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)}},sa={};hh(sa,{None:()=>Bh,filter:()=>Gh,once:()=>bl,toPromise:()=>Mh});Bh=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});na=Symbol.for("Jolibox.hostEmitter"),Jh=()=>{let e=new Qe;return globalThis[na]||(globalThis[na]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[na]},Et=Jh();dn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Er,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 Fh(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}};dn=sl([dl],dn);la=class{constructor(){this._onWillExecuteCommand=new Er,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Er,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new dn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=mh(3e4)),this._starActivation}executeCommand(e,...t){return kt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),sa.toPromise(sa.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}}};la=sl([dl],la);El=Symbol.for("Jolibox.commands")});function Je(e,t={}){wa.emit("ERROR_REPORT",{error:e,options:t})}var wa,Pt,at=re(()=>{"use strict";K();K();wa=new Qe,Pt=new Qe;Je.debounce=Ir(Je,50,{leading:!0})});var ba,Vh,Il,Al,Sl=re(()=>{"use strict";K();at();ba=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{}}},Vh=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Il=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:ba(a),payloadJson:ba(o),signature:ba(s)}}else throw"joli_source is missing"}catch(r){return Je(new pl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Al=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Vh(e),a=r[2];return`${n}.${i}.${a}`}return t}});var $h,hn,Cl,Ea=re(()=>{"use strict";K();$h="1.4.7",hn=()=>$h,Cl=()=>{let e=hn();return`${_l(e)}`}});function Aa(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var Kh,Rl,Ia,Ol,oe,Wh,D,he=re(()=>{"use strict";K();Sl();Ea();K();Kh={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:ga(),adId:_a(),pixelRatio:window.devicePixelRatio||1,platform:Te.isAndroid?"android":Te.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:hn()},schema:window.location.href,platform:Te.isAndroid?"android":Te.isiOS?"ios":"h5"},Ia=(Rl=globalThis.joliboxJSCore)==null?void 0:Rl.env,oe=Object.assign({},(Ol=Ia==null?void 0:Ia())!=null?Ol:Kh);Wh=()=>{var E,A,b,R,k,L,F,S,N,j,q;let{payloadJson:e,headerJson:t,signature:r}=oe.schema.length?Il(oe.schema):{},n=`${oe.deviceInfo.did}-${new Date().getTime()}`,a=new URL(oe.schema.length?oe.schema:window.location.href).searchParams,o=(b=(A=(E=a.get("mpId"))!=null?E:a.get("appId"))!=null?A:a.get("gameId"))!=null?b:"",s=(L=(k=(R=oe.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?k:a.get("sessionId"))!=null?L:n,l=!!((S=(F=e==null?void 0:e.testAdsMode)!=null?F:e==null?void 0:e.__testAdsMode)!=null?S:a.get("testAdsMode")==="true"),c=(q=(j=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?j:a.get("joliboxEnv"))!=null?q:"production",m=c==="staging",u=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,w=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return m},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,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:hn()},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 w},get from(){return e==null?void 0:e.__from},get baseApiHost(){return yl(m)},get adId(){var U;return(U=oe.deviceInfo.adId)!=null?U:oe.deviceInfo.did},get language(){return oe.deviceInfo.lang},get sdkEnvironment(){return Aa("dlightek","jolibox")?"dlightek":a.get("huaweiQuick")==="true"?"huaweiQuick":Aa("gamedistribution","jolibox")?"gamedistribution":Aa("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var V,$,Ge;let U=(V=oe.deviceInfo.pixelRatio)!=null?V:1,M=($=oe.deviceInfo.statusBarHeight)!=null?$:e==null?void 0:e.__androidStatusBarHeight,J=(Ge=oe.deviceInfo.navigationBarHeight)!=null?Ge:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:M!==void 0?M/U:20,navigationBarHeight:J!==void 0?J/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=>{ul(oe,U,fl)},encodeJoliSourceQuery:U=>{var M,J;return t&&r?Al(X(X({},e),U),(M=a.get("joliSource"))!=null?M:""):(J=a.get("joliSource"))!=null?J:""},setDoExitDirectly:()=>{w=!1}}},D=Wh()});var Sa,Tl,zh,Xh,kl,Qh,xl=re(()=>{"use strict";K();at();he();K();Sa=!1,Tl=(e,t)=>e==null?!1:t in e,zh=e=>Tl(e,"kind"),Xh=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},kl=(e,t={},r)=>{var 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:Xh(e.name)},i=ke(X({},n),{env:t.environment,isFromUser:r});r?Pt.emit("GLOBAL_USER_ERROR",e,i):Pt.emit("GLOBAL_ERROR",e,i)},Qh=e=>Tl(e,"kind")&&e.kind==="USER_ERROR";wa.on("ERROR_REPORT",({error:e,options:t})=>{if(Sa)return;Sa=!0;let r=zh(e)&&e.raw?e.raw:e;try{let n=Qh(e);kl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),a=new ma(`${i}, origin error: ${r.message}`);xe.error(a),kl(new ma(a.message),{environment:t.environment},!1)}finally{Sa=!1}})});var Ca,Ra=re(()=>{"use strict";at();K();at();Ca=e=>new ml(e)});function Pl(e,t){let r=(n,i,a)=>{let c=i!=null?i:{},{eventType:o}=c,s=el(c,["eventType"]),l=ke(X({tag:n,eventType:a!=null?a:o!=null?o:Tt.Other},t),{extra:X({},s)});n=="globalJsError"?Je(new un(JSON.stringify(l))):e("systemLog",l,D.webviewId)};return r.debounce=Ir(r,500,{leading:!0}),r}function Nl(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=Ir(t,500,{leading:!0}),t}var Dl=re(()=>{"use strict";K();K();at();he()});function Ll(e,t){let r=Pl(e,t),n=Nl(r);return{track:r,trackPerformance:n}}var Ul=re(()=>{"use strict";Dl()});var Oa=re(()=>{"use strict"});var mn,Bl=re(()=>{"use strict";he();K();K();mn=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return I(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 I(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,m={protocolVersion:"1.0.0",events:[ke(X({},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(va(m),n):yield this.doReport(va(m))}catch(p){xe.log("[Jolibox SDK] report API error",p)}})}}});var ka=re(()=>{"use strict";Ul();Oa();Bl()});var Ta,Ml,ot,pn,Ke,zt=re(()=>{"use strict";Ea();he();K();Ta=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Ml=AbortSignal.timeout)!=null||(AbortSignal.timeout=Ta);ot=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 pn(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},pn=class{constructor(t){this.xua=Cl();this.getJoliSource=()=>D.joliSource;var n;let r=Wt(D.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return I(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,m=this.getJoliSource();a=Object.assign({},a!=null?a:{},c?{"x-user-agent":c}:{},m?{"x-joli-source":m}:{});let u=yield fetch(l,{method:"GET",headers:a,credentials:"include",signal:Ta(i!=null?i:3e4)});return ot.getInstance().recordNetworkRequest(!0),yield u.json()}catch(n){throw ot.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return I(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}`:""}`,m=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},u?{"x-joli-source":u}:{},{"x-os-type":Te.isAndroid?"ANDROID":Te.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(c,{method:"POST",headers:o,body:JSON.stringify(n),signal:Ta(a!=null?a:3e4),credentials:"include"});ot.getInstance().recordNetworkRequest(!0);let h=p.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return p.blob()}catch(w){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(w){return yield p.text()}if(h!=null&&h.includes("application/json"))try{return yield p.json()}catch(w){return yield p.text()}return p}catch(n){throw ot.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return I(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}`:""}`,m=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},u?{"x-joli-source":u}:{});let p=yield fetch(c,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!p.ok)throw ot.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return ot.getInstance().recordNetworkRequest(!0),yield p.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=pn;Ke=ot.getInstance()});var xa,vn,Pa=re(()=>{"use strict";he();ka();zt();K();xa=class extends mn{constructor(){super(...arguments);this.httpClient=Ke.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return wl((r=D.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},vn=new xa(Wt(D.testMode))});var Yh,Gl=re(()=>{"use strict";xl();K();Ra();K();Pa();he();Yh=(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:Tt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:null};vn.trackEvent(n,Kt.WebSDK)};Pt.on("GLOBAL_ERROR",(e,t)=>{Yh(t.tag,e)});Pt.on("GLOBAL_USER_ERROR",(e,t)=>{xe.log("UserError",e,t)})});var gn,Jl=re(()=>{"use strict";gn=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(),w=h-r;w>=this.interval&&(this.visible&&(o+=Math.min(w,this.interval+1e3),t(o)),r=h),n=requestAnimationFrame(s)},l=()=>{m(),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)},m=()=>{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 p=this.visible;return{start(){a||(a=!0,p?c():l())},stop(){a=!1,m(),u()}}}}});var Fl,jl=re(()=>{"use strict";Fl=`-----BEGIN PUBLIC KEY-----
1
+ var Eh=Object.create;var fa=Object.defineProperty,Ih=Object.defineProperties,Ah=Object.getOwnPropertyDescriptor,Sh=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertyNames,_n=Object.getOwnPropertySymbols,vl=Object.getPrototypeOf,ha=Object.prototype.hasOwnProperty,gl=Object.prototype.propertyIsEnumerable,Rh=Reflect.get;var pl=(e,t,r)=>t in e?fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))ha.call(t,r)&&pl(e,r,t[r]);if(_n)for(var r of _n(t))gl.call(t,r)&&pl(e,r,t[r]);return e},xe=(e,t)=>Ih(e,Sh(t));var Rr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _l=(e,t)=>{var r={};for(var n in e)ha.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_n)for(var n of _n(e))t.indexOf(n)<0&&gl.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var ma=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ch(t))!ha.call(e,i)&&i!==r&&fa(e,i,{get:()=>t[i],enumerable:!(n=Ah(t,i))||n.enumerable});return e};var pa=(e,t,r)=>(r=e!=null?Eh(vl(e)):{},Oh(t||!e||!e.__esModule?fa(r,"default",{value:e,enumerable:!0}):r,e));var yl=(e,t,r)=>Rh(vl(e),r,t);var I=(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 Uh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Aa(e){return typeof e=="string"}function Cl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Rl(e){return typeof e=="object"&&Array.isArray(e)}function Bh(e){return typeof e=="undefined"}function Mh(e){return Bh(e)||e===null}function Gh(e){return typeof e=="function"}function Ol(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function kl(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,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(Ia({},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 Tl(e,t){if(Array.isArray(e))return e.concat(t)}function xr(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),h=function(...u){i=u,a=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return h.cancel=()=>{n&&clearTimeout(n),n=null,i=a=void 0},h.flush=()=>{if(n)return clearTimeout(n),n=null,c()},h}function jh(e,t){return(...r)=>t(e,...r)}function Dl(e){return t=>jh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Fh(`${i}`))}})}function Or(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function yn(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,a)=>(i[a]=String(n[a]),i),{})}return e[r]})}function Wh(e){let t=e.location?yn(e.location,Al):null,r=e.target?yn(e.target,Al):null;return yn(Dh(Ia({},e),{location:t,target:r}),$h)}function ka(e){let t=e.events.map(n=>Wh(n)),r=yn(e.device,Kh);return[e.protocolVersion,t,r,e.project]}function zh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function Na(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 Bl(e){return Na("app","stg-app",e)}function rr(e){return`https://${Na("api","stg-api",e)}`}function rm(e){return Na("collect","stg-collect",e)}function Ml(e){return`https://${rm(e)}`}function om(e){return new Promise(t=>Gl(e)(t))}function Gl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function sm(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new Tr(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function cm(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)dm(e[n],t[n])}function dm(e,t){if(Aa(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gh(t)){try{if(e instanceof t)return}catch(r){}if(!Mh(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function um(){return typeof globalThis!="undefined"?globalThis[Jl]:void 0}function fm(e){typeof globalThis!="undefined"&&(globalThis[Jl]=e)}function Ae(e=!1){let t=um();if(!e&&t)return t;let r=new bn,n=new wa,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 fm(i),i}var Ea,kh,Th,xh,bl,Nh,Ph,wl,Ia,Dh,Lh,Sl,Mt,Jh,Sa,Ca,xl,Nl,Fh,Pl,wn,En,Ra,Pe,ga,Hh,Oa,Il,qh,Gt,tr,Vh,Al,$h,Kh,We,er,Yh,Ne,Xh,Qh,Zh,Ll,Ta,xa,em,tm,Ul,Jt,_a,oe,nm,im,kr,Tr,et,ba,am,va,lm,kt,bn,wa,Jl,W=re(()=>{"use strict";Ea=Object.defineProperty,kh=Object.defineProperties,Th=Object.getOwnPropertyDescriptor,xh=Object.getOwnPropertyDescriptors,bl=Object.getOwnPropertySymbols,Nh=Object.prototype.hasOwnProperty,Ph=Object.prototype.propertyIsEnumerable,wl=(e,t,r)=>t in e?Ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ia=(e,t)=>{for(var r in t||(t={}))Nh.call(t,r)&&wl(e,r,t[r]);if(bl)for(var r of bl(t))Ph.call(t,r)&&wl(e,r,t[r]);return e},Dh=(e,t)=>kh(e,xh(t)),Lh=(e,t)=>{for(var r in t)Ea(e,r,{get:t[r],enumerable:!0})},Sl=(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&&Ea(t,r,i),i},Mt=(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}Jh=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(Jh||{}),Sa=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 Sa{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},xl=class extends Sa{constructor(){super(...arguments),this.kind="USER_ERROR"}},Nl=class extends xl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fh=class extends xl{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Pl=class extends Ca{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},wn=class extends Ca{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},En=class extends Sa{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}}},Ra=class extends Ca{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Pe={log:Or("log"),warn:Or("warn"),info:Or("info"),error:Or("error"),debug:Or("debug")};Object.assign(globalThis,{logger:Pe});ga=Symbol.for("Jolibox.canIUseMap"),Hh={};globalThis[ga]||(globalThis[ga]=Hh);Oa={get config(){return globalThis[ga]}},Il=Symbol.for("Jolibox.canIUseMap.native"),qh={};globalThis[Il]||(globalThis[Il]=qh);Gt=(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))(Gt||{}),tr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(tr||{}),Vh=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(Vh||{}),Al=["name","params"],$h=["name","type","location","target","extra","timestamp","userId"],Kh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];We=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});zh();er=typeof window=="undefined",Yh=()=>!er&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ne={isiOS:!er&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:!er&&navigator.userAgent.includes("Android"),isMac:!er&&navigator.userAgent.includes("Mac"),isFacebook:!er&&navigator.userAgent.includes("FB_IAB"),isPC:!er&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Xh=()=>Ne.isiOS?"iOS":Ne.isAndroid?"Android":Ne.isMac?"Mac":Ne.isFacebook?"Facebook":"PC",Qh="device_id",Zh="advertising_id",Ll=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,We()),window.__joliboxLocalStorage__.getItem(e)),Ta=()=>new URLSearchParams(window.location.search).get("deviceId")||Ll(Qh),xa=()=>new URLSearchParams(window.location.search).get("advertisingId")||Ll(Zh),em=e=>e.charAt(0).toUpperCase()+e.slice(1),tm=()=>{var e;let t=new URLSearchParams(window.location.search);return em((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Ul=e=>{if(Yh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=Xh(),n=navigator.language,i=Ta(),a=xa();return`${t} (${tm()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${a} version/${e||""}`};Jt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=Ia({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Mt(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=>Mt(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 Mt(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),p=this.requestAdapter.extractRealTimeData(u),m=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return m&&!this.config.consistencyChecker(l,m)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(o,m,s),u):this.requestAdapter.mergeData(l,p)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),h=(a=(i=this.requestAdapter).extractCacheableData)==null?void 0:a.call(i,c);return h&&this.setCachedDataWithSequence(o,h,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let 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 Mt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Mt(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 Mt(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)}},_a=class ya{constructor(t){this.element=t,this.next=ya.Undefined,this.prev=ya.Undefined}};_a.Undefined=new _a(void 0);oe=_a,nm=class{constructor(){this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oe.Undefined}clear(){let e=this._first;for(;e!==oe.Undefined;){let t=e.next;e.prev=oe.Undefined,e.next=oe.Undefined,e=t}this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new oe(e);if(this._first===oe.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!==oe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==oe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==oe.Undefined&&e.next!==oe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===oe.Undefined&&e.next===oe.Undefined?(this._first=oe.Undefined,this._last=oe.Undefined):e.next===oe.Undefined?(this._last=this._last.prev,this._last.next=oe.Undefined):e.prev===oe.Undefined&&(this._first=this._first.next,this._first.prev=oe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==oe.Undefined;)yield e.element,e=e.next}},im=0,kr=class{constructor(e){this.value=e,this.id=im++}},Tr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof kr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,a,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new kr(t);return this._listeners?this._listeners instanceof kr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(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 h,u,p,m;if(!this._disposed){if(this._listeners instanceof kr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||u.call(h));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((m=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||m.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof kr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},et=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new Tr,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 nm,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},ba={};Lh(ba,{None:()=>am,filter:()=>sm,once:()=>Gl,toPromise:()=>om});am=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});va=Symbol.for("Jolibox.hostEmitter"),lm=()=>{let e=new et;return globalThis[va]||(globalThis[va]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[va]},kt=lm();bn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Tr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return cm(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};bn=Sl([Ol],bn);wa=class{constructor(){this._onWillExecuteCommand=new Tr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Tr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new bn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uh(3e4)),this._starActivation}executeCommand(e,...t){return Mt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ba.toPromise(ba.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}}};wa=Sl([Ol],wa);Jl=Symbol.for("Jolibox.commands")});function je(e,t={}){Pa.emit("ERROR_REPORT",{error:e,options:t})}var Pa,Ft,ut=re(()=>{"use strict";W();W();Pa=new et,Ft=new et;je.debounce=xr(je,50,{leading:!0})});var Da,hm,Fl,jl,Hl=re(()=>{"use strict";W();ut();Da=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},hm=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Fl=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[a,o,s]=i;return{headerJson:Da(a),payloadJson:Da(o),signature:Da(s)}}else throw"joli_source is missing"}catch(r){return je(new Pl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},jl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=hm(e),a=r[2];return`${n}.${i}.${a}`}return t}});var mm,In,ql,La=re(()=>{"use strict";W();mm="1.4.8",In=()=>mm,ql=()=>{let e=In();return`${Ul(e)}`}});function Ba(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var pm,Vl,Ua,$l,se,vm,L,pe=re(()=>{"use strict";W();Hl();La();W();pm={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Ta(),adId:xa(),pixelRatio:window.devicePixelRatio||1,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:In()},schema:window.location.href,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5"},Ua=(Vl=globalThis.joliboxJSCore)==null?void 0:Vl.env,se=Object.assign({},($l=Ua==null?void 0:Ua())!=null?$l:pm);vm=()=>{var E,A,w,R,O,D,M,S,N,J,q;let{payloadJson:e,headerJson:t,signature:r}=se.schema.length?Fl(se.schema):{},n=`${se.deviceInfo.did}-${new Date().getTime()}`,a=new URL(se.schema.length?se.schema:window.location.href).searchParams,o=(w=(A=(E=a.get("mpId"))!=null?E:a.get("appId"))!=null?A:a.get("gameId"))!=null?w:"",s=(D=(O=(R=se.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?O:a.get("sessionId"))!=null?D:n,l=!!((S=(M=e==null?void 0:e.testAdsMode)!=null?M:e==null?void 0:e.__testAdsMode)!=null?S:a.get("testAdsMode")==="true"),c=(q=(J=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?J:a.get("joliboxEnv"))!=null?q:"production",h=c==="staging",u=t==null?void 0:t.channel,m=new URL(window.location.href).searchParams,b=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return h},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=m.get("joliSource"))!=null?U:a.get("joliSource"))!=null?G: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:In()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=se.platform)!=null?U:se.deviceInfo.platform).toLowerCase()},get deviceInfo(){return se.deviceInfo},get sdkInfo(){return se.sdkInfo},get hostInfo(){return se.hostInfo},get hostUserInfo(){return se.hostUserInfo},get sessionId(){var U,G;return(G=(U=se.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return u},get webviewId(){var U;return(U=se.webviewId)!=null?U:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Bl(h)},get adId(){var U;return(U=se.deviceInfo.adId)!=null?U:se.deviceInfo.did},get language(){return se.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 V,K,Fe;let U=(V=se.deviceInfo.pixelRatio)!=null?V:1,G=(K=se.deviceInfo.statusBarHeight)!=null?K:e==null?void 0:e.__androidStatusBarHeight,j=(Fe=se.deviceInfo.navigationBarHeight)!=null?Fe:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:j!==void 0?j/U:10}},get abTests(){var U,G;return(G=(U=se.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=se.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{kl(se,U,Tl)},encodeJoliSourceQuery:U=>{var G,j;return t&&r?jl(X(X({},e),U),(G=a.get("joliSource"))!=null?G:""):(j=a.get("joliSource"))!=null?j:""},setDoExitDirectly:()=>{b=!1}}},L=vm()});var Ma,Wl,gm,_m,Kl,ym,zl=re(()=>{"use strict";W();ut();pe();W();Ma=!1,Wl=(e,t)=>e==null?!1:t in e,gm=e=>Wl(e,"kind"),_m=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Kl=(e,t={},r)=>{var a,o,s;let n={user_id:(o=(a=L.hostUserInfo)==null?void 0:a.uid)!=null?o:"",device_id:(s=L.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_m(e.name)},i=xe(X({},n),{env:t.environment,isFromUser:r});r?Ft.emit("GLOBAL_USER_ERROR",e,i):Ft.emit("GLOBAL_ERROR",e,i)},ym=e=>Wl(e,"kind")&&e.kind==="USER_ERROR";Pa.on("ERROR_REPORT",({error:e,options:t})=>{if(Ma)return;Ma=!0;let r=gm(e)&&e.raw?e.raw:e;try{let n=ym(e);Kl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),a=new Ra(`${i}, origin error: ${r.message}`);Pe.error(a),Kl(new Ra(a.message),{environment:t.environment},!1)}finally{Ma=!1}})});var Ga,Ja=re(()=>{"use strict";ut();W();ut();Ga=e=>new Nl(e)});function Yl(e,t){let r=(n,i,a)=>{let c=i!=null?i:{},{eventType:o}=c,s=_l(c,["eventType"]),l=xe(X({tag:n,eventType:a!=null?a:o!=null?o:Gt.Other},t),{extra:X({},s)});n=="globalJsError"?je(new wn(JSON.stringify(l))):e("systemLog",l,L.webviewId)};return r.debounce=xr(r,500,{leading:!0}),r}function Xl(e){let t=(r,n,i)=>{var s;let 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=xr(t,500,{leading:!0}),t}var Ql=re(()=>{"use strict";W();W();ut();pe()});function Zl(e,t){let r=Yl(e,t),n=Xl(r);return{track:r,trackPerformance:n}}var ec=re(()=>{"use strict";Ql()});var Fa=re(()=>{"use strict"});var An,tc=re(()=>{"use strict";pe();W();W();An=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return I(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}=L.sdkInfo;return{platform:1e3,os:L.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(a=(i=L.hostInfo)==null?void 0:i.aid)!=null?a:"1",model:(o=L.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=L.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:L.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return I(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}=L;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,h={protocolVersion:"1.0.0",events:[xe(X({},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(ka(h),n):yield this.doReport(ka(h))}catch(p){Pe.log("[Jolibox SDK] report API error",p)}})}}});var ja=re(()=>{"use strict";ec();Fa();tc()});var Ha,rc,ft,Sn,ze,nr=re(()=>{"use strict";La();pe();W();Ha=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(rc=AbortSignal.timeout)!=null||(AbortSignal.timeout=Ha);ft=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new Sn(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},Sn=class{constructor(t){this.xua=ql();this.getJoliSource=()=>L.joliSource;var n;let r=rr(L.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return I(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,h=this.getJoliSource();a=Object.assign({},a!=null?a:{},c?{"x-user-agent":c}:{},h?{"x-joli-source":h}:{});let u=yield fetch(l,{method:"GET",headers:a,credentials:"include",signal:Ha(i!=null?i:3e4)});return ft.getInstance().recordNetworkRequest(!0),yield u.json()}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return I(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}`:""}`,h=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},h?{"x-user-agent":h}:{},u?{"x-joli-source":u}:{},{"x-os-type":Ne.isAndroid?"ANDROID":Ne.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(c,{method:"POST",headers:o,body:JSON.stringify(n),signal:Ha(a!=null?a:3e4),credentials:"include"});ft.getInstance().recordNetworkRequest(!0);let m=p.headers.get("content-type");if(m!=null&&m.includes("application/octet-stream"))try{return p.blob()}catch(b){return yield p.arrayBuffer()}if(m!=null&&m.includes("multipart/form-data")||m!=null&&m.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(b){return yield p.text()}if(m!=null&&m.includes("application/json"))try{return yield p.json()}catch(b){return yield p.text()}return p}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return I(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}`:""}`,h=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},h?{"x-user-agent":h}:{},u?{"x-joli-source":u}:{});let p=yield fetch(c,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!p.ok)throw ft.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return ft.getInstance().recordNetworkRequest(!0),yield p.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=Sn;ze=ft.getInstance()});var qa,Cn,Va=re(()=>{"use strict";pe();ja();nr();W();qa=class extends An{constructor(){super(...arguments);this.httpClient=ze.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return Ml((r=L.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},Cn=new qa(rr(L.testMode))});var bm,nc=re(()=>{"use strict";zl();W();Ja();W();Va();pe();bm=(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:Gt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(a=L.hostUserInfo)==null?void 0:a.uid)!=null?o:null};Cn.trackEvent(n,tr.WebSDK)};Ft.on("GLOBAL_ERROR",(e,t)=>{bm(t.tag,e)});Ft.on("GLOBAL_USER_ERROR",(e,t)=>{Pe.log("UserError",e,t)})});var Rn,ic=re(()=>{"use strict";Rn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(t)});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,a=!1,o=0,s=()=>{if(!a)return;let m=Date.now(),b=m-r;b>=this.interval&&(this.visible&&(o+=Math.min(b,this.interval+1e3),t(o)),r=m),n=requestAnimationFrame(s)},l=()=>{h(),r=Date.now(),i=window.setInterval(()=>{if(!a)return;let m=Date.now();m-r>=this.interval&&(r=m)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},h=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",m=>{a&&(console.log("visible",m),m?c():l())});let p=this.visible;return{start(){a||(a=!0,p?c():l())},stop(){a=!1,h(),u()}}}}});var ac,oc=re(()=>{"use strict";ac=`-----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 Hl(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 Zh(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 ql(e){return I(this,null,function*(){let t=window.crypto,r=t.subtle,n=Zh(Fl),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=Hl(s),m={timestamp:Date.now(),data:e},p=new TextEncoder().encode(JSON.stringify(m)),h=t.getRandomValues(new Uint8Array(12)),w=yield r.encrypt({name:"AES-GCM",iv:h,tagLength:128},o,p),E=new Uint8Array(w),A=new Uint8Array(h.length+E.length);A.set(h,0),A.set(E,h.length);let b=Hl(A.buffer);return{k:l,v:"1.0",payload:b}})}var Vl=re(()=>{"use strict";jl()});var _n,$l=re(()=>{"use strict";he();Jl();zt();Vl();_n=class extends gn{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 I(this,null,function*(){let{event:n,params:i,extraParams:a}=r,o={eventType:n,gameInfo:X({gameId:this.gameId,sessionId:this.sessionId},i)};a&&Object.assign(o,a);try{let s=yield ql(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 Kl,em,_e,tm,Na,We,st=re(()=>{"use strict";Gl();K();K();ka();Pa();$l();he();Oa();Kl=Ie(),em={type:Kt.WebSDK,platform:"h5",jssdk_version:D.sdkInfo.jssdkVersion,mp_id:D.mpId,mp_version:D.mpVersion},{track:_e,trackPerformance:tm}=Ll((...e)=>{var o,s,l,c;let[,t]=e,r=t,n=ll(r.extra)?r.extra:ua(r.extra)?JSON.parse(r.extra):{},i=ke(X({},n),{mp_id:(o=r.mp_id)!=null?o:"",mp_version:(s=r.mp_version)!=null?s:""}),a={name:t.tag,type:Tt.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(c=(l=D.hostUserInfo)==null?void 0:l.uid)!=null?c:null};vn.trackEvent(a,Kt.WebSDK)},em);Kl.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{tm(e,t,r)});Kl.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{_e(e,t)});Na=new Qe,We=new _n(_e,Na)});function Wl(e){let t=pa.config[e];return t||(t={},pa.config[e]=t),(r,n)=>{if(t[r]){xe.warn(`[can i use] ${r} already registered`);return}t[r]=X({},n)}}var zl=re(()=>{"use strict";K()});function Da(e){Xl=e}function yn(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>yn(t)):Object.keys(e).reduce((t,r)=>(t[r]=yn(e[r]),t),{})}function lt(e){return typeof e=="number"}function La(e){let t=Ua(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Ua(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Xl,me,wn,bn,En,In,Xt,An,Sn,Cn,Rn,On,kn,Tn,xn,Pn,Nn,Dn,Ln,Ba=re(()=>{"use strict";Xl=!1;me=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Xl)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 ${La(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return yn(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:yn(this._default)}optional(){return this._optional=!0,this}};wn=class extends me{validate(t){return this._optional&&t===void 0?!0:lt(t)?lt(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):lt(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):lt(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}},bn=class extends me{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},En=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(lt(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(lt(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}},In=class extends me{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Xt=class extends me{validate(t){return!0}},An=class extends me{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Sn=class extends me{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Cn=class extends me{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Rn=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 ${La(t)}`)}return!0}},On=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(lt(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(lt(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(lt(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}},kn=class extends me{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ua(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}},Tn=class extends me{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ua(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}},xn=class extends me{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:La(this.value),actual:r}):!0}},Pn=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}},Nn=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}},Dn=class extends me{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Ln=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 Ma(e,t,r="param"){if(e.errors=[],e.path=r,Da(!0),!e.validate(t)){let n=e.errors.join(`
11
- `);throw e.errors.length=0,Da(!1),new TypeError(n)}}var G,Ga=re(()=>{"use strict";Ba();Ba();G={object(e){return new Tn(e)},array(e){return new On(e)},tuple(...e){return new Nn(...e)},literal(e){return new xn(e)},or(...e){return new Pn(...e)},symbol(){return new In},record(e){return new kn(e)},function(){return new Cn},boolean(){return new bn},string(){return new En},number(){return new wn},undefined(){return new An},null(){return new Sn},unknown(){return new Xt},any(){return new Xt},as(){return new Xt},arraybuffer(){return new Dn},enum(...e){return new Rn(...e)},typedarray(e){return new Ln(e)}}});var Un,Ql,Yl=re(()=>{"use strict";K();at();Ga();Ra();Un=1,Ql=e=>{function t(n,i){return(...a)=>{var u,p,h,w;let o=Date.now(),s={method:n,trace_id:Un};Un+=1;let l="SUCCESS",c=`${n}:ok`,m=0;try{if(i.paramsSchema)try{Ma(i.paramsSchema,a,"params")}catch(R){throw Ca(`${n}:fail ${R.message}`)}let E=i.implement(...a),A=E,b=`${n}:ok`;if(E&&"code"in E){let{code:R,data:k,message:L}=E;l=R,A=k,b=L}return{code:l,message:b,data:A}}catch(E){let A=E;m=(p=(u=A.code)!=null?u:A.errNo)!=null?p:2e3,l="FAILURE";let b=(w=(h=A.message)!=null?h:A.errMsg)!=null?w:`${E}`;return c=`${n}:${l} ${b.replace(/^\S+:(fail|cancel)\s?/,"")}`,Je(new fn(c,m)),{code:l,message:c}}finally{let E=Date.now()-o}}}function r(n,i){return(...a)=>I(this,null,function*(){var p,h,w,E;let o=cl(a)?a:[a],s=Date.now(),l={method:n,trace_id:Un};Un+=1;let c=`${n}:ok`,m="SUCCESS",u={code:m,message:c};try{if(i.paramsSchema)try{Ma(i.paramsSchema,o,"params")}catch(R){throw Ca(R.message)}let b=yield i.implement(...o);if(b&&"code"in b){let{code:R,data:k,message:L}=b;m=R,c=L,b=k}return Object.assign(u,{code:m,message:c,data:b}),u}catch(A){let b=A,R=(h=(p=b.code)!=null?p:b.errNo)!=null?h:2e3;m="FAILURE";let k=(E=(w=b.message)!=null?w:b.errMsg)!=null?E:`${A}`,L=`${n}:${m} ${k.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:m,message:L}),Je(new fn(L,R)),u}finally{let A=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var ze,Nt,ye,Ar=re(()=>{"use strict";zl();st();Yl();Ga();({createAPI:ze,createSyncAPI:Nt}=Ql(_e)),ye=Wl("h5")});var rc=ta((tc,Ha)=>{(function(e){if(typeof tc=="object"&&typeof Ha!="undefined")Ha.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(m,u){if(!a[m]){if(!i[m]){var p=typeof yr=="function"&&yr;if(!u&&p)return p(m,!0);if(l)return l(m,!0);var h=new Error("Cannot find module '"+m+"'");throw h.code="MODULE_NOT_FOUND",h}var w=a[m]={exports:{}};i[m][0].call(w.exports,function(E){var A=i[m][1][E];return s(A||E)},w,w.exports,n,i,a,o)}return a[m].exports}for(var l=typeof yr=="function"&&yr,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,m=new s(E),u=o.document.createTextNode("");m.observe(u,{characterData:!0}),l=function(){u.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var p=new o.MessageChannel;p.port1.onmessage=E,l=function(){p.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var b=o.document.createElement("script");b.onreadystatechange=function(){E(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},o.document.documentElement.appendChild(b)}:l=function(){setTimeout(E,0)};var h,w=[];function E(){h=!0;for(var b,R,k=w.length;k;){for(R=w,w=[],b=-1;++b<k;)R[b]();k=w.length}h=!1}i.exports=A;function A(b){w.push(b)===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"],m=["FULFILLED"],u=["PENDING"];i.exports=p;function p(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,S!==s&&A(this,S)}p.prototype.catch=function(S){return this.then(null,S)},p.prototype.then=function(S,N){if(typeof S!="function"&&this.state===m||typeof N!="function"&&this.state===c)return this;var j=new this.constructor(s);if(this.state!==u){var q=this.state===m?S:N;w(j,q,this.outcome)}else this.queue.push(new h(j,S,N));return j};function h(S,N,j){this.promise=S,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof j=="function"&&(this.onRejected=j,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},h.prototype.otherCallFulfilled=function(S){w(this.promise,this.onFulfilled,S)},h.prototype.callRejected=function(S){l.reject(this.promise,S)},h.prototype.otherCallRejected=function(S){w(this.promise,this.onRejected,S)};function w(S,N,j){o(function(){var q;try{q=N(j)}catch(U){return l.reject(S,U)}q===S?l.reject(S,new TypeError("Cannot resolve promise with itself")):l.resolve(S,q)})}l.resolve=function(S,N){var j=b(E,N);if(j.status==="error")return l.reject(S,j.value);var q=j.value;if(q)A(S,q);else{S.state=m,S.outcome=N;for(var U=-1,M=S.queue.length;++U<M;)S.queue[U].callFulfilled(N)}return S},l.reject=function(S,N){S.state=c,S.outcome=N;for(var j=-1,q=S.queue.length;++j<q;)S.queue[j].callRejected(N);return S};function E(S){var N=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof N=="function")return function(){N.apply(S,arguments)}}function A(S,N){var j=!1;function q(V){j||(j=!0,l.reject(S,V))}function U(V){j||(j=!0,l.resolve(S,V))}function M(){N(U,q)}var J=b(M);J.status==="error"&&q(J.value)}function b(S,N){var j={};try{j.value=S(N),j.status="success"}catch(q){j.status="error",j.value=q}return j}p.resolve=R;function R(S){return S instanceof this?S:l.resolve(new this(s),S)}p.reject=k;function k(S){var N=new this(s);return l.reject(N,S)}p.all=L;function L(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var j=S.length,q=!1;if(!j)return this.resolve([]);for(var U=new Array(j),M=0,J=-1,V=new this(s);++J<j;)$(S[J],J);return V;function $(Ge,Ht){N.resolve(Ge).then(qt,function(nt){q||(q=!0,l.reject(V,nt))});function qt(nt){U[Ht]=nt,++M===j&&!q&&(q=!0,l.resolve(V,U))}}}p.race=F;function F(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var j=S.length,q=!1;if(!j)return this.resolve([]);for(var U=-1,M=new this(s);++U<j;)J(S[U]);return M;function J(V){N.resolve(V).then(function($){q||(q=!0,l.resolve(M,$))},function($){q||(q=!0,l.reject(M,$))})}}},{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 m(){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 p=Promise;function h(d,v){v&&d.then(function(f){v(null,f)},function(f){v(f)})}function w(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 A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var b="local-forage-detect-blob-support",R=void 0,k={},L=Object.prototype.toString,F="readonly",S="readwrite";function N(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 j(d){return new p(function(v){var f=d.transaction(b,S),_=u([""]);f.objectStore(b).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 q(d){return typeof R=="boolean"?p.resolve(R):j(d).then(function(v){return R=v,R})}function U(d){var v=k[d.name],f={};f.promise=new p(function(_,y){f.resolve=_,f.reject=y}),v.deferredOperations.push(f),v.dbReady?v.dbReady=v.dbReady.then(function(){return f.promise}):v.dbReady=f.promise}function M(d){var v=k[d.name],f=v.deferredOperations.pop();if(f)return f.resolve(),f.promise}function J(d,v){var f=k[d.name],_=f.deferredOperations.pop();if(_)return _.reject(v),_.promise}function V(d,v){return new p(function(f,_){if(k[d.name]=k[d.name]||xs(),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(b)}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 $(d){return V(d,!1)}function Ge(d){return V(d,!0)}function Ht(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 qt(d){return new p(function(v,f){var _=new FileReader;_.onerror=f,_.onloadend=function(y){var g=btoa(y.target.result||"");v({__local_forage_encoded_blob:!0,data:g,type:d.type})},_.readAsBinaryString(d)})}function nt(d){var v=N(atob(d.data));return u([v],{type:d.type})}function Ts(d){return d&&d.__local_forage_encoded_blob}function ef(d){var v=this,f=v._initReady().then(function(){var _=k[v._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return w(f,d,d),f}function tf(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,$(d).then(function(g){return d.db=g,Ht(d)?Ge(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 J(d,g),g})}function it(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 p.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),Ge(d)}).then(function(){return tf(d).then(function(){it(d,v,f,_-1)})}).catch(f);f(g)}}function xs(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function rf(d){var v=this,f={db:null};if(d)for(var _ in d)f[_]=d[_];var y=k[f.name];y||(y=xs(),k[f.name]=y),y.forages.push(v),v._initReady||(v._initReady=v.ready,v.ready=ef);var g=[];function C(){return p.resolve()}for(var O=0;O<y.forages.length;O++){var T=y.forages[O];T!==v&&g.push(T._initReady().catch(C))}var x=y.forages.slice(0);return p.all(g).then(function(){return f.db=y.db,$(f)}).then(function(P){return f.db=P,Ht(f,v._defaultConfig.version)?Ge(f):P}).then(function(P){f.db=y.db=P,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 nf(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){it(f._dbInfo,F,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=T.get(d);x.onsuccess=function(){var P=x.result;P===void 0&&(P=null),Ts(P)&&(P=nt(P)),y(P)},x.onerror=function(){g(x.error)}}catch(P){g(P)}})}).catch(g)});return h(_,v),_}function af(d,v){var f=this,_=new p(function(y,g){f.ready().then(function(){it(f._dbInfo,F,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=T.openCursor(),P=1;x.onsuccess=function(){var B=x.result;if(B){var W=B.value;Ts(W)&&(W=nt(W));var ee=d(W,B.key,P++);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 of(d,v,f){var _=this;d=E(d);var y=new p(function(g,C){var O;_.ready().then(function(){return O=_._dbInfo,L.call(v)==="[object Blob]"?q(O.db).then(function(T){return T?v:qt(v)}):v}).then(function(T){it(_._dbInfo,S,function(x,P){if(x)return C(x);try{var B=P.objectStore(_._dbInfo.storeName);T===null&&(T=void 0);var W=B.put(T,d);P.oncomplete=function(){T===void 0&&(T=null),g(T)},P.onabort=P.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 sf(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){it(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 P=x.error?x.error:x.transaction.error;g(P)}}catch(P){g(P)}})}).catch(g)});return h(_,v),_}function lf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){it(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 cf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){it(v._dbInfo,F,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 df(d,v){var f=this,_=new p(function(y,g){if(d<0){y(null);return}f.ready().then(function(){it(f._dbInfo,F,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=!1,P=T.openKeyCursor();P.onsuccess=function(){var B=P.result;if(!B){y(null);return}d===0||x?y(B.key):(x=!0,B.advance(d))},P.onerror=function(){g(P.error)}}catch(B){g(B)}})}).catch(g)});return h(_,v),_}function uf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){it(v._dbInfo,F,function(g,C){if(g)return y(g);try{var O=C.objectStore(v._dbInfo.storeName),T=O.openKeyCursor(),x=[];T.onsuccess=function(){var P=T.result;if(!P){_(x);return}x.push(P.key),P.continue()},T.onerror=function(){y(T.error)}}catch(P){y(P)}})}).catch(y)});return h(f,d),f}function ff(d,v){v=A.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=p.reject("Invalid arguments");else{var g=d.name===f.name&&_._dbInfo.db,C=g?p.resolve(_._dbInfo.db):$(d).then(function(O){var T=k[d.name],x=T.forages;T.db=O;for(var P=0;P<x.length;P++)x[P]._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],P=x.forages;O.close();for(var B=0;B<P.length;B++){var W=P[B];W._dbInfo.db=null,W._dbInfo.version=T}var ee=new p(function(te,fe){var de=c.open(d.name,T);de.onerror=function(qe){var _r=de.result;_r.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<P.length;fe++){var de=P[fe];de._dbInfo.db=te,M(de._dbInfo)}}).catch(function(te){throw(J(d,te)||p.resolve()).catch(function(){}),te})}}):y=C.then(function(O){U(d);var T=k[d.name],x=T.forages;O.close();for(var P=0;P<x.length;P++){var B=x[P];B._dbInfo.db=null}var W=new p(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(J(d,ee)||p.resolve()).catch(function(){}),ee})})}return h(y,v),y}var hf={_driver:"asyncStorage",_initStorage:rf,_support:m(),iterate:af,getItem:nf,setItem:of,removeItem:sf,clear:lf,length:cf,key:df,keys:uf,dropInstance:ff};function mf(){return typeof openDatabase=="function"}var wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pf="~~local_forage_type~",Ps=/^~~local_forage_type~([^~]+)~/,on="__lfsc__:",qi=on.length,Vi="arbf",$i="blob",Ns="si08",Ds="ui08",Ls="uic8",Us="si16",Bs="si32",Ms="ur16",Gs="ui32",Js="fl32",Fs="fl64",js=qi+Vi.length,Hs=Object.prototype.toString;function qs(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),P=new Uint8Array(x);for(_=0;_<f;_+=4)g=wt.indexOf(d[_]),C=wt.indexOf(d[_+1]),O=wt.indexOf(d[_+2]),T=wt.indexOf(d[_+3]),P[y++]=g<<2|C>>4,P[y++]=(C&15)<<4|O>>2,P[y++]=(O&3)<<6|T&63;return x}function Ki(d){var v=new Uint8Array(d),f="",_;for(_=0;_<v.length;_+=3)f+=wt[v[_]>>2],f+=wt[(v[_]&3)<<4|v[_+1]>>4],f+=wt[(v[_+1]&15)<<2|v[_+2]>>6],f+=wt[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 vf(d,v){var f="";if(d&&(f=Hs.call(d)),d&&(f==="[object ArrayBuffer]"||d.buffer&&Hs.call(d.buffer)==="[object ArrayBuffer]")){var _,y=on;d instanceof ArrayBuffer?(_=d,y+=Vi):(_=d.buffer,f==="[object Int8Array]"?y+=Ns:f==="[object Uint8Array]"?y+=Ds:f==="[object Uint8ClampedArray]"?y+=Ls:f==="[object Int16Array]"?y+=Us:f==="[object Uint16Array]"?y+=Ms:f==="[object Int32Array]"?y+=Bs:f==="[object Uint32Array]"?y+=Gs:f==="[object Float32Array]"?y+=Js:f==="[object Float64Array]"?y+=Fs:v(new Error("Failed to get type for BinaryArray"))),v(y+Ki(_))}else if(f==="[object Blob]"){var g=new FileReader;g.onload=function(){var C=pf+d.type+"~"+Ki(this.result);v(on+$i+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 gf(d){if(d.substring(0,qi)!==on)return JSON.parse(d);var v=d.substring(js),f=d.substring(qi,js),_;if(f===$i&&Ps.test(v)){var y=v.match(Ps);_=y[1],v=v.substring(y[0].length)}var g=qs(v);switch(f){case Vi:return g;case $i:return u([g],{type:_});case Ns:return new Int8Array(g);case Ds:return new Uint8Array(g);case Ls:return new Uint8ClampedArray(g);case Us:return new Int16Array(g);case Ms:return new Uint16Array(g);case Bs:return new Int32Array(g);case Gs:return new Uint32Array(g);case Js:return new Float32Array(g);case Fs:return new Float64Array(g);default:throw new Error("Unkown type: "+f)}}var Wi={serialize:vf,deserialize:gf,stringToBuffer:qs,bufferToString:Ki};function Vs(d,v,f,_){d.executeSql("CREATE TABLE IF NOT EXISTS "+v.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,_)}function _f(d){var v=this,f={db:null};if(d)for(var _ in d)f[_]=typeof d[_]!="string"?d[_].toString():d[_];var y=new p(function(g,C){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch(O){return C(O)}f.db.transaction(function(O){Vs(O,f,function(){v._dbInfo=f,g()},function(T,x){C(x)})},C)});return f.serializer=Wi,y}function bt(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):Vs(T,v,function(){T.executeSql(f,_,y,g)},g)},g):g(C,O)},g)}function yf(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){bt(O,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[d],function(T,x){var P=x.rows.length?x.rows.item(0).value:null;P&&(P=C.serializer.deserialize(P)),y(P)},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function wf(d,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){bt(O,C,"SELECT * FROM "+C.storeName,[],function(T,x){for(var P=x.rows,B=P.length,W=0;W<B;W++){var ee=P.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 $s(d,v,f,_){var y=this;d=E(d);var g=new p(function(C,O){y.ready().then(function(){v===void 0&&(v=null);var T=v,x=y._dbInfo;x.serializer.serialize(v,function(P,B){B?O(B):x.db.transaction(function(W){bt(W,x,"INSERT OR REPLACE INTO "+x.storeName+" (key, value) VALUES (?, ?)",[d,P],function(){C(T)},function(ee,te){O(te)})},function(W){if(W.code===W.QUOTA_ERR){if(_>0){C($s.apply(y,[d,T,f,_-1]));return}O(W)}})})}).catch(O)});return h(g,f),g}function bf(d,v,f){return $s.apply(this,[d,v,f,1])}function Ef(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){bt(O,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[d],function(){y()},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function If(d){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){bt(C,g,"DELETE FROM "+g.storeName,[],function(){_()},function(O,T){y(T)})})}).catch(y)});return h(f,d),f}function Af(d){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){bt(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 Sf(d,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){bt(O,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[d+1],function(T,x){var P=x.rows.length?x.rows.item(0).key:null;y(P)},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function Cf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){bt(C,g,"SELECT key FROM "+g.storeName,[],function(O,T){for(var x=[],P=0;P<T.rows.length;P++)x.push(T.rows.item(P).key);_(x)},function(O,T){y(T)})})}).catch(y)});return h(f,d),f}function Rf(d){return new p(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 Of(d,v){v=A.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 p(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(Rf(C))}).then(function(g){return new p(function(C,O){g.db.transaction(function(T){function x(ee){return new p(function(te,fe){T.executeSql("DROP TABLE IF EXISTS "+ee,[],function(){te()},function(de,qe){fe(qe)})})}for(var P=[],B=0,W=g.storeNames.length;B<W;B++)P.push(x(g.storeNames[B]));p.all(P).then(function(){C()}).catch(function(ee){O(ee)})},function(T){O(T)})})}):y=p.reject("Invalid arguments"),h(y,v),y}var kf={_driver:"webSQLStorage",_initStorage:_f,_support:mf(),iterate:wf,getItem:yf,setItem:bf,removeItem:Ef,clear:If,length:Af,key:Sf,keys:Cf,dropInstance:Of};function Tf(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(d){return!1}}function Ks(d,v){var f=d.name+"/";return d.storeName!==v.storeName&&(f+=d.storeName+"/"),f}function xf(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch(v){return!0}}function Pf(){return!xf()||localStorage.length>0}function Nf(d){var v=this,f={};if(d)for(var _ in d)f[_]=d[_];return f.keyPrefix=Ks(d,v._defaultConfig),Pf()?(v._dbInfo=f,f.serializer=Wi,p.resolve()):p.reject()}function Df(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 Lf(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 Uf(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 P=localStorage.key(x);if(P.indexOf(g)===0){var B=localStorage.getItem(P);if(B&&(B=y.serializer.deserialize(B)),B=d(B,P.substring(C),T++),B!==void 0)return B}}});return h(_,v),_}function Bf(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 Mf(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 Gf(d){var v=this,f=v.keys().then(function(_){return _.length});return h(f,d),f}function Jf(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 Ff(d,v,f){var _=this;d=E(d);var y=_.ready().then(function(){v===void 0&&(v=null);var g=v;return new p(function(C,O){var T=_._dbInfo;T.serializer.serialize(v,function(x,P){if(P)O(P);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 jf(d,v){if(v=A.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 p(function(g){d.storeName?g(Ks(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=p.reject("Invalid arguments"),h(y,v),y}var Hf={_driver:"localStorageWrapper",_initStorage:Nf,_support:Tf(),iterate:Uf,getItem:Lf,setItem:Ff,removeItem:Jf,clear:Df,length:Gf,key:Bf,keys:Mf,dropInstance:jf},qf=function(v,f){return v===f||typeof v=="number"&&typeof f=="number"&&isNaN(v)&&isNaN(f)},Vf=function(v,f){for(var _=v.length,y=0;y<_;){if(qf(v[y],f))return!0;y++}return!1},Ws=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},gr={},zs={},Vt={INDEXEDDB:hf,WEBSQL:kf,LOCALSTORAGE:Hf},$f=[Vt.INDEXEDDB._driver,Vt.WEBSQL._driver,Vt.LOCALSTORAGE._driver],sn=["dropInstance"],zi=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(sn),Kf={description:"",driver:$f.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Wf(d,v){d[v]=function(){var f=arguments;return d.ready().then(function(){return d[v].apply(d,f)})}}function Xi(){for(var d=1;d<arguments.length;d++){var v=arguments[d];if(v)for(var f in v)v.hasOwnProperty(f)&&(Ws(v[f])?arguments[0][f]=v[f].slice():arguments[0][f]=v[f])}return arguments[0]}var zf=function(){function d(v){s(this,d);for(var f in Vt)if(Vt.hasOwnProperty(f)){var _=Vt[f],y=_._driver;this[f]=y,gr[y]||this.defineDriver(_)}this._defaultConfig=Xi({},Kf),this._config=Xi({},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 p(function(C,O){try{var T=f._driver,x=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){O(x);return}for(var P=zi.concat("_initStorage"),B=0,W=P.length;B<W;B++){var ee=P[B],te=!Vf(sn,ee);if((te||f[ee])&&typeof f[ee]!="function"){O(x);return}}var fe=function(){for(var _r=function(Yf){return function(){var Zf=new Error("Method "+Yf+" is not implemented by the current driver"),Xs=p.reject(Zf);return h(Xs,arguments[arguments.length-1]),Xs}},Qi=0,Qf=sn.length;Qi<Qf;Qi++){var Yi=sn[Qi];f[Yi]||(f[Yi]=_r(Yi))}};fe();var de=function(_r){gr[T]&&console.info("Redefining LocalForage driver: "+T),gr[T]=f,zs[T]=_r,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 w(g,_,y),g},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(f,_,y){var g=gr[f]?p.resolve(gr[f]):p.reject(new Error("Driver not found."));return w(g,_,y),g},d.prototype.getSerializer=function(f){var _=p.resolve(Wi);return w(_,f),_},d.prototype.ready=function(f){var _=this,y=_._driverSet.then(function(){return _._ready===null&&(_._ready=_._initDriver()),_._ready});return w(y,f,f),y},d.prototype.setDriver=function(f,_,y){var g=this;Ws(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=p.reject(fe),g._driverSet}return ee()}}var P=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=P.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=p.reject(B),g._driverSet}),w(this._driverSet,_,y),this._driverSet},d.prototype.supports=function(f){return!!zs[f]},d.prototype._extend=function(f){Xi(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,_=zi.length;f<_;f++)Wf(this,zi[f])},d.prototype.createInstance=function(f){return new d(f)},d}(),Xf=new zf;i.exports=Xf},{3:3}]},{},[4])(4)})});var ic=ta(Qt=>{"use strict";K();Ar();st();var Cr=(e,t)=>{window.parent&&window.parent.postMessage({type:e,data:t},"*")},Rr=Ie(),ym=ze("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:e=>I(Qt,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:a}=e;xe.info("onLevelFinished",r,n,i,a),Cr("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:r,rating:n,score:i,variation:a}),yield Promise.all([We.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}}),We.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:a})])})}),wm=ze("gamePlayEnded",{paramsSchema:G.tuple(G.object({duration:G.number().optional(),rating:G.number().optional(),score:G.number(),variation:G.string().optional()})),implement:e=>I(Qt,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e;xe.info("onGamePlayEnded",t,r,n,i),Cr("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:r,score:n,variation:i}),yield Promise.all([We.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i}),We.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})])})}),bm=ze("levelUpgrade",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number()),name:G.string().optional()})),implement:r=>I(Qt,[r],function*({levelId:e,name:t}){xe.info("onLevelUpgrade",e,t),Cr("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:e,name:t}),yield Promise.all([We.tracker("LevelUpgrade",{name:t,levelId:e}),We.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})])})}),Em=ze("levelStart",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number())})),implement:e=>I(Qt,null,function*(){let{levelId:t}=e;xe.info("onLevelStart",t),Cr("JOLIBOX_GAME_TASK_LEVEL_START",{levelId:t}),yield We.tracker("LevelStart",{levelId:t})})}),Im=ze("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:e=>I(Qt,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;xe.info("onLevelFailed",t,r,n,i),Cr("JOLIBOX_GAME_TASK_LEVEL_FAILED",{levelId:t,score:r,rating:n,duration:i}),yield We.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});Rr.registerCommand("TaskTrackerSDK.levelFinished",ym);Rr.registerCommand("TaskTrackerSDK.gamePlayEnded",wm);Rr.registerCommand("TaskTrackerSDK.levelUpgrade",bm);Rr.registerCommand("TaskTrackerSDK.levelStart",Em);Rr.registerCommand("TaskTrackerSDK.levelFailed",Im);ye("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"}}});ye("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});ye("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});ye("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});ye("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 De,Yt,ac,Va,Am,Dt,Or=re(()=>{"use strict";De=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")},Yt=new Map,ac=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let r=Yt.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)}},Va=!1,Am=()=>{Va||(window.addEventListener("message",ac),Va=!0)},Dt=(e,t)=>{Am(),Yt.has(e)||Yt.set(e,new Set);let r=Yt.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&Yt.delete(e),Yt.size===0&&(window.removeEventListener("message",ac),Va=!1)}}});var Fn,jn,Hn,qn,Vn,$a,$n,Kn,Wn,zn,Zt,Sm,ne,ct,dt,Le=re(()=>{"use strict";K();Fn="UNLOCK_OPTIONS_CHANGED",jn="INVOKE_PAYMENT",Hn="ON_PAYMENT_RESULT",qn="ON_USE_MODAL_EVENT",Vn="ON_USE_MODAL_RESULT",$a="ON_USE_MODAL_FREQUENCY",$n="ON_USE_UNLOGIN_MODAL_EVENT",Kn="INVOKE_UNLOGIN_MODAL_EVENT",Wn="INVOKE_SUBSCRIPTION_EVENT",zn="ON_USE_SUBSCRIPTION_RESULT",Zt=new Qe,Sm=()=>({on:Zt.on.bind(Zt),off:Zt.off.bind(Zt),emit:Zt.emit.bind(Zt)}),ne=Sm(),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 Du=ta(Mi=>{"use strict";he();Le();Or();K();var Nu={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};Dt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",Nu[e.result],e.result),ne.emit(Vn,{useModalResult:Nu[e.result]})});ne.on(qn,(e,t)=>{var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||De("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()})});Dt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{ne.emit(Hn,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});ne.on(jn,(e,t)=>I(Mi,null,function*(){var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||De("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:$e()})}));Dt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,r,n,i,a;ne.emit($n,{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(Kn,e=>I(Mi,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||De("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:$e(),type:e})}));Dt("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),ne.emit(zn,{result:e.result})});ne.on(Wn,e=>I(Mi,null,function*(){console.log("----notify custom event-----",e),De("JOLIBOX_SUB_EVENT",{sequenceId:$e()})}))});st();he();Ar();K();var Zl=Ie(),nm="env",im="getSystemInfoSync",am=()=>{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=ke(X({},e),{version:t}));let r=(o=D.hostInfo)==null?void 0:o.appName;r&&(e=ke(X({},e),{appName:r}));let n=(s=D.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(e=ke(X({},e),{SDKVersion:n})),e},om=Nt(im,{implement:am}),sm=Nt(nm,{implement:()=>ke(X({},D.hostInfo),{sdkInfo:D.sdkInfo,platform:D.platform,deviceInfo:D.deviceInfo})});Zl.registerCommand("API.env",sm);Zl.registerCommand("API.getSystemInfoSync",om);ye("env",{version:"1.0.0"});ye("getSystemInfoSync",{version:"1.0.0"});K();Ar();at();st();var lm="onJoliboxShow",cm="onJoliboxHide",dm="onReady",Fa=Ie(),ja=vl(Je),Ja=!0,Sr=!0,Bn=0,Mn=Na;function um(){let e=Date.now();if(e-Bn<100)return;Bn=e;let t=document.visibilityState==="visible";t!==Ja&&(Ja=t,Mn.emit("visible",Ja))}function ec(e){let t=Date.now();t-Bn<100||(Bn=t,e==="focus"&&!Sr?Sr=!0:e==="blur"&&Sr&&(Sr=!1),Mn.emit("visible",Sr))}document.addEventListener("visibilitychange",um);window.addEventListener("focus",()=>ec("focus"));window.addEventListener("blur",()=>ec("blur"));var fm=Nt(lm,{paramsSchema:G.tuple(G.function()),implement(e){let t=ja(e);Mn.on("visible",r=>{r&&t()})}}),hm=Nt(cm,{paramsSchema:G.tuple(G.function()),implement(e){let t=ja(e);Mn.on("visible",r=>{!r&&t()})}}),mm=Nt(dm,{paramsSchema:G.tuple(G.function()),implement(e){let t=ja(e);Et.on("LifecycleEvent.onReady",r=>{t(r)})}});Fa.registerCommand("LifecycleSDK.onReady",mm);Fa.registerCommand("LifecycleSDK.onJoliboxShow",fm);Fa.registerCommand("LifecycleSDK.onJoliboxHide",hm);ye("lifeCycle.onReady",{version:"1.0.0"});ye("lifeCycle.onJoliboxShow",{version:"1.0.0"});ye("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ar();K();zt();he();var nc=ra(rc());var Gn=Ie(),qa=class{constructor(){this.httpClient=Ke.create({baseUrl:Wt(D.testMode)});this.getGameId=()=>D.mpId;this.getItem=t=>I(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)=>I(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=>I(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=()=>I(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=nc.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Jn=new qa,pm=ze("getLocalStorage",{paramsSchema:G.tuple(G.string()),implement(e){return I(this,null,function*(){return yield Jn.getItem(e)})}});Gn.registerCommand("StorageSDK.getItem",pm);ye("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var vm=ze("setStorage",{paramsSchema:G.tuple(G.string(),G.or(G.string(),G.boolean(),G.number())),implement(e,t){return I(this,null,function*(){return yield Jn.setItem(e,t)})}});Gn.registerCommand("StorageSDK.setItem",vm);ye("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var gm=ze("removeStorage",{paramsSchema:G.tuple(G.string()),implement(e){return I(this,null,function*(){return yield Jn.removeItem(e)})}});Gn.registerCommand("StorageSDK.removeItem",gm);ye("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var _m=ze("clearStorage",{implement(){return I(this,null,function*(){return yield Jn.clear()})}});Gn.registerCommand("StorageSDK.clear",_m);ye("storage.clear",{version:"1.0.0"});var ZC=ra(ic());st();K();zt();Or();he();Le();var oc=D.testMode;function sc(){let e=new Map,t,r;return{registerRewardHandler(i,a){e.set(i,a)},handleReward(i,...a){return I(this,null,function*(){return yield i.reduce((s,l)=>I(this,null,function*(){let c=yield s;if(c===!0)return!0;oc&&console.log(`handleReward ${l}`);let m=e.get(l),u=m?yield m(...a):c;return oc&&console.log(`handleReward ${l} ${u}`),u}),Promise.resolve(!1))})},registerRewardsFetcher(i){return I(this,null,function*(){t=(...a)=>I(this,null,function*(){try{return yield i(...a)}catch(o){return console.error("getRewardOptions error:",o),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return I(this,null,function*(){r=(...a)=>I(this,null,function*(){try{return yield i(...a)}catch(o){return console.error("getRewardOptions error:",o),{joliCoinUseAndCharge:ct,loginGuide:dt}}})})},getRewardsTypes(...i){return I(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return I(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:ct,loginGuide:dt}})}}}K();var Ka=class{constructor(t){this.httpClient=t}execute(t,r){return I(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}}}},Wa=class{constructor(t){this.httpClient=t}execute(t,r){return I(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return X({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},Xn=class{constructor(t){this.unlockOptionsService=new xt(new Ka(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 xt(new Wa(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return I(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return I(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 I(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return I(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 I(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 Cm=()=>(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]},Rm=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],Om=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(Cm())},za=null;function Xa(e){return za||(za=new Xn(e)),za}var Qa=e=>{e.registerRewardsFetcher(t=>I(void 0,null,function*(){var i,a,o,s,l;let r=["ADS"],n=Xa(t);try{let c=yield n.getUnlockOptions({});if(c.code!=="SUCCESS")return r;ne.emit(Fn,{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 m=((l=(s=c.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(u=>u.type))||Array.from(r);return Om(m)}catch(c){return console.error("getRewardOptions error (cached):",c),r}}))},Ya=e=>{e.registerRewardFrequencyConfigFetcher(t=>I(void 0,null,function*(){var n,i,a,o;let r=Xa(t);try{let s=yield r.getGlobalConfig();return ne.emit($a,{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($a,{joliCoinUseAndCharge:ct,loginGuide:dt}),Et.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:ct,loginGuide:dt,supportedHostMethods:Rm}}),{joliCoinUseAndCharge:ct,loginGuide:dt}}}))};var Za=e=>I(void 0,null,function*(){yield Xa(e).warmupCache(),console.log("Reward cache warmed up")});var lc=e=>t=>I(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});Le();function Ye(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=X(X({},i),o),r=Promise.resolve(i),n&&(n(i),n=null),i}}}Le();var Ae=Ye(ne,Fn),kr=(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();K();var eo={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 Ve=Ie();Le();Le();K();var ro=class{constructor(t){this.httpClient=t}execute(t,r){return I(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}}}},no=class{constructor(t){this.balanceService=new xt(new ro(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 I(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 I(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 I(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()}},to=null;function io(e){return to||(to=new no(e)),to}var ao=(e,t="JOLI_COIN")=>I(void 0,null,function*(){return yield io(e).getBalance(t)}),Lt=(e,t="JOLI_COIN")=>I(void 0,null,function*(){let n=yield io(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n}),Qn=(e,t="JOLI_COIN")=>I(void 0,null,function*(){yield io(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});K();var so=class{constructor(t){this.httpClient=t}execute(t,r){return I(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}}}},lo=class{constructor(t){this.gemBalanceService=new xt(new so(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 I(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 I(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 I(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()}},oo=null;function cc(e){return oo||(oo=new lo(e)),oo}var co=(e,t="GEM")=>I(void 0,null,function*(){return yield cc(e).getGemBalance(t)}),er=(e,t="GEM")=>I(void 0,null,function*(){let n=yield cc(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n});var Ze={JOLI_COIN:{fetchBalance:ao,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:co,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 Yn=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;Ve.registerCommand(`Rewards.${e}.useJolicoin`,()=>I(void 0,null,function*(){let i=yield Ae.getData(),a=Ze[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"}}))},Ut=(e,t)=>r=>I(void 0,null,function*(){let n=Ye(ne,Vn);return ne.emit(qn,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult});Le();Le();var Zn=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;Ve.registerCommand(`Rewards.${e}.usePayment`,()=>I(void 0,null,function*(){var p;let a=yield Ae.getData(),o=Ze[t],s=yield o.fetchBalance(n),l=o.getQuantity(a),c=o.getCurrentUser(a),m=o.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,c.enableAutoDeduct),u=o.getUpdateKey();if(Ae.updateData({[u]:m}),console.log("-----unlockOptions payment-----",a,m,l,t),!o.isEnough(a,m)){let h=yield i({userCurrency:m,currencyQuantity:l,currency:t});return t==="JOLI_GEM"?er(n):Lt(n),{result:h==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Bt=(e,t)=>r=>I(void 0,null,function*(){let n=Ye(ne,Hn);return ne.emit(jn,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();Le();Le();K();var Mt=(e,t)=>r=>I(void 0,null,function*(){let n=Ye(ne,$n);return ne.emit(Kn,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()});var xm=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:a,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:c}})=>{Zn(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:o}),Yn(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let m=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return u=>I(void 0,null,function*(){var p,h,w,E;try{let A=yield a.getData();if(kr(A,c)){let L=Ze.JOLI_COIN,F=yield L.fetchBalance(t),S=L.getCurrentUser(A),N=L.createUpdatedUser((p=F==null?void 0:F.balance)!=null?p:0,S.enableAutoDeduct);if(!L.isEnough(A,N))return i==null||i(u),!1}else{let L=!0;for(let F of m){let S=yield Ve.executeCommand(F);if(L=L&&S.result!=="FAILED",S.result!=="CONTINUE")break}if(!L)return i==null||i(u),!1}let R=eo[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{(w=u.adBreakDone)==null||w.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)),Lt(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(A){if(console.info("JolicoinRewardHandler error:",A),A instanceof Error&&A.message=="CANCEL")throw A;return i==null||i(u),!1}finally{a.clearCache()}})},ei=(e,t,r)=>xm(e,t,"JOLI_COIN",r);var dc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},a=Ut("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),o=Bt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Mt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return ei("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Ae,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:n}})};var uc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=c=>{var m;r==null||r(),(m=c.adBreakDone)==null||m.call(c,{breakType:c.type,breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},a=Ut("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),o=Bt("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Mt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return ei("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Ae,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:n}})};he();K();Le();Le();var fc=e=>{let{showSubscriptionModal:t}=e;Ve.registerCommand("Rewards.subscription",()=>I(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=Ze[n?"JOLI_GEM":"JOLI_COIN"],a=i.getCurrentUser(r);return i.isEnough(r,a)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},hc=e=>()=>I(void 0,null,function*(){let t=Ye(ne,zn);return ne.emit(Wn,e),(yield t.getFreshData()).result});he();var mc=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:a,hasSubscription:o}})=>{fc({showSubscriptionModal:a});let s=["Rewards.subscription"];return l=>I(void 0,null,function*(){var c,m,u,p,h,w;try{let E=yield i.getData();if(!kr(E,o))return!1;let b=!0;for(let R of s){let k=yield Ve.executeCommand(R);if(b=b&&k.result!=="FAILED",k.result!=="CONTINUE")break}if(Lt(t),er(t),console.log("-----unlockWithSubscription result-----",b),b){try{(m=l.adBreakDone)==null||m.call(l,{breakType:l.type,breakName:"name"in l&&(c=l.name)!=null?c:"",breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in l&&((u=l.adViewed)==null||u.call(l)),(w=(h=D).onEnvConfigChanged)==null||w.call(h,{hostUserInfo:ke(X({},(p=D.hostUserInfo)!=null?p:{isLogin:!1}),{isSubUser:!0})})}catch(R){console.error("-----unlockWithSubscription adBreakDone error-----",R)}return r==null||r(),!0}return n==null||n(l),!1}catch(E){if(console.info("SubscriptionRewardHandler error:",E),E instanceof Error&&E.message=="CANCEL")throw E;return n==null||n(l),!1}finally{}})};var pc=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},a=hc("SUBSCRIPTION");return mc("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Ae,showSubscriptionModal:a,hasSubscription:n}})};var et=sc();Qa(et);Ya(et);var ii,H,wc,ho,Gt,vc,bc,Ec,Ic,mo,uo,fo,Nm,Tr={},Ac=[],Dm=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,xr=Array.isArray;function ut(e,t){for(var r in t)e[r]=t[r];return e}function po(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Pr(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?ii.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 ri(e,o,n,i,null)}function ri(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?++wc:i,__i:-1,__u:0};return i==null&&H.vnode!=null&&H.vnode(a),a}function It(e){return e.children}function Fe(e,t){this.props=e,this.context=t}function tr(e,t){if(t==null)return e.__?tr(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"?tr(e):null}function Sc(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 Sc(e)}}function gc(e){(!e.__d&&(e.__d=!0)&&Gt.push(e)&&!ni.__r++||vc!==H.debounceRendering)&&((vc=H.debounceRendering)||bc)(ni)}function ni(){for(var e,t,r,n,i,a,o,s=1;Gt.length;)Gt.length>s&&Gt.sort(Ec),e=Gt.shift(),s=Gt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,a=[],o=[],t.__P&&((r=ut({},n)).__v=n.__v+1,H.vnode&&H.vnode(r),vo(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,a,i==null?tr(n):i,!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,Oc(a,r,o),r.__e!=i&&Sc(r)));ni.__r=0}function Cc(e,t,r,n,i,a,o,s,l,c,m){var u,p,h,w,E,A,b=n&&n.__k||Ac,R=t.length;for(l=Lm(r,t,b,l,R),u=0;u<R;u++)(h=r.__k[u])!=null&&(p=h.__i===-1?Tr:b[h.__i]||Tr,h.__i=u,A=vo(e,h,p,i,a,o,s,l,c,m),w=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&go(p.ref,null,h),m.push(h.ref,h.__c||w,h)),E==null&&w!=null&&(E=w),4&h.__u||p.__k===h.__k?l=Rc(h,l,e):typeof h.type=="function"&&A!==void 0?l=A:w&&(l=w.nextSibling),h.__u&=-7);return r.__e=E,l}function Lm(e,t,r,n,i){var a,o,s,l,c,m=r.length,u=m,p=0;for(e.__k=new Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=a+p,(o=e.__k[a]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?ri(null,o,null,null,null):xr(o)?ri(It,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?ri(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=Um(o,r,l,u))!==-1&&(u--,(s=r[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&(i>m?p--:i<m&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,o.__u|=4))):e.__k[a]=null;if(u)for(a=0;a<m;a++)(s=r[a])!=null&&!(2&s.__u)&&(s.__e==n&&(n=tr(s)),Tc(s,s));return n}function Rc(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=Rc(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=tr(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Nr(e,t){return t=t||[],e==null||typeof e=="boolean"||(xr(e)?e.some(function(r){Nr(r,t)}):t.push(e)),t}function Um(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 _c(e,t,r){t[0]=="-"?e.setProperty(t,r==null?"":r):e[t]=r==null?"":typeof r!="number"||Dm.test(t)?r:r+"px"}function ti(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||_c(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||_c(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Ic,"$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=mo,e.addEventListener(t,a?fo:uo,a)):e.removeEventListener(t,a?fo:uo,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 yc(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=mo++;else if(t.u<r.t)return;return r(H.event?H.event(t):t)}}}function vo(e,t,r,n,i,a,o,s,l,c){var m,u,p,h,w,E,A,b,R,k,L,F,S,N,j,q,U,M=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),a=[s=t.__e=r.__e]),(m=H.__b)&&m(t);e:if(typeof M=="function")try{if(b=t.props,R="prototype"in M&&M.prototype.render,k=(m=M.contextType)&&n[m.__c],L=m?k?k.props.value:m.__:n,r.__c?A=(u=t.__c=r.__c).__=u.__E:(R?t.__c=u=new M(b,L):(t.__c=u=new Fe(b,L),u.constructor=M,u.render=Mm),k&&k.sub(u),u.props=b,u.state||(u.state={}),u.context=L,u.__n=n,p=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(b,u.__s))),h=u.props,w=u.state,u.__v=t,p)R&&M.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),R&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(R&&M.getDerivedStateFromProps==null&&b!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(b,L),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(b,u.__s,L)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(u.props=b,u.state=u.__s,u.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(J){J&&(J.__=t)}),F=0;F<u._sb.length;F++)u.__h.push(u._sb[F]);u._sb=[],u.__h.length&&o.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(b,u.__s,L),R&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,w,E)})}if(u.context=L,u.props=b,u.__P=e,u.__e=!1,S=H.__r,N=0,R){for(u.state=u.__s,u.__d=!1,S&&S(t),m=u.render(u.props,u.state,u.context),j=0;j<u._sb.length;j++)u.__h.push(u._sb[j]);u._sb=[]}else do u.__d=!1,S&&S(t),m=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++N<25);u.state=u.__s,u.getChildContext!=null&&(n=ut(ut({},n),u.getChildContext())),R&&!p&&u.getSnapshotBeforeUpdate!=null&&(E=u.getSnapshotBeforeUpdate(h,w)),q=m,m!=null&&m.type===It&&m.key==null&&(q=kc(m.props.children)),s=Cc(e,xr(q)?q:[q],t,r,n,i,a,o,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&o.push(u),A&&(u.__E=u.__=null)}catch(J){if(t.__v=null,l||a!=null)if(J.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--;)po(a[U]);else t.__e=r.__e,t.__k=r.__k;H.__e(J,t,r)}else a==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):s=t.__e=Bm(r.__e,t,r,n,i,a,o,l,c);return(m=H.diffed)&&m(t),128&t.__u?void 0:s}function Oc(e,t,r){for(var n=0;n<r.length;n++)go(r[n],r[++n],r[++n]);H.__c&&H.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){H.__e(a,i.__v)}})}function kc(e){return typeof e!="object"||e==null?e:xr(e)?e.map(kc):ut({},e)}function Bm(e,t,r,n,i,a,o,s,l){var c,m,u,p,h,w,E,A=r.props,b=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(b);e=document.createElementNS(i,R,b.is&&b),s&&(H.__m&&H.__m(t,a),s=!1),a=null}if(R===null)A===b||s&&e.data===b||(e.data=b);else{if(a=a&&ii.call(e.childNodes),A=r.props||Tr,!s&&a!=null)for(A={},c=0;c<e.attributes.length;c++)A[(h=e.attributes[c]).name]=h.value;for(c in A)if(h=A[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=h;else if(!(c in b)){if(c=="value"&&"defaultValue"in b||c=="checked"&&"defaultChecked"in b)continue;ti(e,c,null,h,i)}}for(c in b)h=b[c],c=="children"?p=h:c=="dangerouslySetInnerHTML"?m=h:c=="value"?w=h:c=="checked"?E=h:s&&typeof h!="function"||A[c]===h||ti(e,c,h,A[c],i);if(m)s||u&&(m.__html===u.__html||m.__html===e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(u&&(e.innerHTML=""),Cc(t.type==="template"?e.content:e,xr(p)?p:[p],t,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,o,a?a[0]:r.__k&&tr(r,0),s,l),a!=null)for(c=a.length;c--;)po(a[c]);s||(c="value",R=="progress"&&w==null?e.removeAttribute("value"):w!==void 0&&(w!==e[c]||R=="progress"&&!w||R=="option"&&w!==A[c])&&ti(e,c,w,A[c],i),c="checked",E!==void 0&&E!==e[c]&&ti(e,c,E,A[c],i))}return e}function go(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){H.__e(i,r)}}function Tc(e,t,r){var n,i;if(H.unmount&&H.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||go(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(a){H.__e(a,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Tc(n[i],t,r||typeof e.type!="function");r||po(e.__e),e.__c=e.__=e.__e=void 0}function Mm(e,t,r){return this.constructor(e,r)}function xc(e,t,r){var n,i,a,o;t==document&&(t=document.documentElement),H.__&&H.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,a=[],o=[],vo(t,e=(!n&&r||t).__k=Pr(It,null,[e]),i||Tr,Tr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?ii.call(t.childNodes):null,a,!n&&r?r:i?i.__e:t.firstChild,n,o),Oc(a,e,o)}ii=Ac.slice,H={__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}},wc=0,ho=function(e){return e!=null&&e.constructor==null},Fe.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),gc(this))},Fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gc(this))},Fe.prototype.render=It,Gt=[],bc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ec=function(e,t){return e.__v.__b-t.__v.__b},ni.__r=0,Ic=/(PointerCapture)$|Capture$/i,mo=0,uo=yc(!1),fo=yc(!0),Nm=0;var rr,ce,_o,Pc,Dr=0,Jc=[],ue=H,Nc=ue.__b,Dc=ue.__r,Lc=ue.diffed,Uc=ue.__c,Bc=ue.unmount,Mc=ue.__;function oi(e,t){ue.__h&&ue.__h(ce,e,Dr||t),Dr=0;var r=ce.__H||(ce.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ft(e){return Dr=1,Fc(jc,e)}function Fc(e,t,r){var n=oi(rr++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):jc(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 m=n.__c.__H.__.filter(function(p){return!!p.__c});if(m.every(function(p){return!p.__N}))return!a||a.call(this,s,l,c);var u=n.__c.props!==s;return m.forEach(function(p){if(p.__N){var h=p.__[0];p.__=p.__N,p.__N=void 0,h!==p.__[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 m=a;a=void 0,i(s,l,c),a=m}o&&o.call(this,s,l,c)},ce.shouldComponentUpdate=i}return n.__N||n.__}function Jt(e,t){var r=oi(rr++,3);!ue.__s&&bo(r.__H,t)&&(r.__=e,r.u=t,ce.__H.__h.push(r))}function wo(e,t){var r=oi(rr++,4);!ue.__s&&bo(r.__H,t)&&(r.__=e,r.u=t,ce.__h.push(r))}function si(e){return Dr=5,Lr(function(){return{current:e}},[])}function Lr(e,t){var r=oi(rr++,7);return bo(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Ur(e,t){return Dr=8,Lr(function(){return e},t)}function Gm(){for(var e;e=Jc.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ai),e.__H.__h.forEach(yo),e.__H.__h=[]}catch(t){e.__H.__h=[],ue.__e(t,e.__v)}}ue.__b=function(e){ce=null,Nc&&Nc(e)},ue.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Mc&&Mc(e,t)},ue.__r=function(e){Dc&&Dc(e),rr=0;var t=(ce=e.__c).__H;t&&(_o===ce?(t.__h=[],ce.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(ai),t.__h.forEach(yo),t.__h=[],rr=0)),_o=ce},ue.diffed=function(e){Lc&&Lc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Jc.push(t)!==1&&Pc===ue.requestAnimationFrame||((Pc=ue.requestAnimationFrame)||Jm)(Gm)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),_o=ce=null},ue.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ai),r.__h=r.__h.filter(function(n){return!n.__||yo(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ue.__e(n,r.__v)}}),Uc&&Uc(e,t)},ue.unmount=function(e){Bc&&Bc(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ai(n)}catch(i){t=i}}),r.__H=void 0,t&&ue.__e(t,r.__v))};var Gc=typeof requestAnimationFrame=="function";function Jm(e){var t,r=function(){clearTimeout(n),Gc&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Gc&&(t=requestAnimationFrame(r))}function ai(e){var t=ce,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),ce=t}function yo(e){var t=ce;e.__c=e.__(),ce=t}function bo(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function jc(e,t){return typeof t=="function"?t(e):t}function jm(e,t){for(var r in t)e[r]=t[r];return e}function Hc(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 qc(e,t){this.props=e,this.context=t}(qc.prototype=new Fe).isPureReactComponent=!0,qc.prototype.shouldComponentUpdate=function(e,t){return Hc(this.props,e)||Hc(this.state,t)};var Vc=H.__b;H.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Vc&&Vc(e)};var AS=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Hm=H.__e;H.__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)}Hm(e,t,r,n)};var $c=H.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=jm({},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 ed(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return ed(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 Eo(){this.__u=0,this.o=null,this.__b=null}function td(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function li(){this.i=null,this.l=null}H.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),$c&&$c(e)},(Eo.prototype=new Fe).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=td(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]=ed(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)},Eo.prototype.componentWillUnmount=function(){this.o=[]},Eo.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&&Pr(It,null,e.fallback);return i&&(i.__u&=-33),[Pr(It,null,t.__a?null:e.children),i]};var Kc=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]}};(li.prototype=new Fe).__a=function(e){var t=this,r=td(t.__v),n=t.l.get(e);return n[0]++,function(i){var a=function(){t.props.revealOrder?(n.push(i),Kc(t,e,n)):i()};r?r(a):a()}},li.prototype.render=function(e){this.i=null,this.l=new Map;var t=Nr(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},li.prototype.componentDidUpdate=li.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Kc(e,r,t)})};var qm=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,Vm=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,$m=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Km=/[A-Z0-9]/g,Wm=typeof document!="undefined",zm=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function ci(e,t,r){return t.__k==null&&(t.textContent=""),xc(e,t),typeof r=="function"&&r(),e?e.__c:null}Fe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Fe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Wc=H.event;function Xm(){}function Qm(){return this.cancelBubble}function Ym(){return this.defaultPrevented}H.event=function(e){return Wc&&(e=Wc(e)),e.persist=Xm,e.isPropagationStopped=Qm,e.isDefaultPrevented=Ym,e.nativeEvent=e};var rd,Zm={enumerable:!1,configurable:!0,get:function(){return this.class}},zc=H.vnode;H.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||Wm&&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"||zm(r.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":$m.test(o)&&(o=l):l=o="oninput":a&&Vm.test(o)?o=o.replace(Km,"-$&").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=Nr(r.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=Nr(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",Zm)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=qm,zc&&zc(e)};var Xc=H.__r;H.__r=function(e){Xc&&Xc(e),rd=e.__c};var Qc=H.diffed;H.diffed=function(e){Qc&&Qc(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),rd=null};var ep=Object.defineProperty,tp=Object.defineProperties,rp=Object.getOwnPropertyDescriptors,fi=Object.getOwnPropertySymbols,ud=Object.prototype.hasOwnProperty,fd=Object.prototype.propertyIsEnumerable,nd=(e,t,r)=>t in e?ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ht=(e,t)=>{for(var r in t||(t={}))ud.call(t,r)&&nd(e,r,t[r]);if(fi)for(var r of fi(t))fd.call(t,r)&&nd(e,r,t[r]);return e},np=(e,t)=>tp(e,rp(t)),ip=(e,t)=>{var r={};for(var n in e)ud.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&fi)for(var n of fi(e))t.indexOf(n)<0&&fd.call(e,n)&&(r[n]=e[n]);return r},hi=(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 ap(e){return!!(e!=null&&e.__nativeBuffers__)}var op=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 ko(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!ap(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=op(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var sp=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 lp(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:sp(a),key:i};n.push(o),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var hd=Object.defineProperty,cp=Object.getOwnPropertyDescriptor,dp=(e,t)=>{for(var r in t)hd(e,r,{get:t[r],enumerable:!0})},md=(e,t,r,n)=>{for(var i=n>1?void 0:n?cp(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&&hd(t,r,i),i},up=(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 fp(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var hp=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 pd(e){return typeof e=="string"}function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function id(e){return typeof e=="number"&&!isNaN(e)}function mp(e){return typeof e=="undefined"}function pp(e){return mp(e)||e===null}function vd(e){return typeof e=="function"}function vp(e){return ir(e)&&vd(e.then)}function gd(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}var gp=(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))(gp||{}),_p=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}},mi=class extends _p{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},yp=class extends mi{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},wp=class extends mi{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},bp=class extends mi{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Io=class extends mi{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function Br(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var pi={log:Br("log"),warn:Br("warn"),info:Br("info"),error:Br("error"),debug:Br("debug")};Object.assign(globalThis,{logger:pi});var ad=Symbol.for("Jolibox.canIUseMap"),Ep={};globalThis[ad]||(globalThis[ad]=Ep);function Ip(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 To=Symbol.for("Jolibox.canIUseMap.native"),Ap={};globalThis[To]||(globalThis[To]=Ap);var xo={get config(){return globalThis[To]}},Sp=(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))(Sp||{}),Cp=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Cp||{}),Rp=(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))(Rp||{});function Op(){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}}Op();var nr=typeof window=="undefined",kp=()=>!nr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),OS={isiOS:!nr&&(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:!nr&&navigator.userAgent.includes("Android"),isMac:!nr&&navigator.userAgent.includes("Mac"),isFacebook:!nr&&navigator.userAgent.includes("FB_IAB"),isPC:!nr&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Po=class No{constructor(t){this.element=t,this.next=No.Undefined,this.prev=No.Undefined}};Po.Undefined=new Po(void 0);var se=Po,Tp=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}},xp=0,Mr=class{constructor(e){this.value=e,this.id=xp++}},Jr=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(){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 Mr(t);return this._listeners?this._listeners instanceof Mr?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 m,u,p,h;if(!this._disposed){if(this._listeners instanceof Mr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||u.call(m));else if(this._listeners){let w=this._listeners.indexOf(c);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((h=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||h.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Mr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Do=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 Jr,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 Tp,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)}},Lo={};dp(Lo,{None:()=>Pp,filter:()=>Dp,once:()=>_d,toPromise:()=>Np});var Pp=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Np(e){return new Promise(t=>_d(e)(t))}function _d(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Dp(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new Jr(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}var Ao=Symbol.for("Jolibox.hostEmitter"),Lp=()=>{let e=new Do;return globalThis[Ao]||(globalThis[Ao]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Ao]},kS=Lp();function Up(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Bp(e[n],t[n])}function Bp(e,t){if(pd(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(vd(t)){try{if(e instanceof t)return}catch(r){}if(!pp(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 Uo=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Jr,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 Up(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}};Uo=md([gd],Uo);var od=class{constructor(){this._onWillExecuteCommand=new Jr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Jr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Uo,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=fp(3e4)),this._starActivation}executeCommand(e,...t){return up(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Lo.toPromise(Lo.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}}};od=md([gd],od);var TS=Symbol.for("Jolibox.commands");Se("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Se("requestProductDetailsAsync",{version:102e4});Se("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Se("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Se("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Se("userTrackAsync",{version:1e6});Se("openMiniapp",{version:1050100});Se("requestCoinDetailsSync",{version:1070100});Se("requestCoinDetailsAsync",{version:1070100});Se("sendServerEventAsync",{version:1070100});Se("requestGameLeaderboardSync",{version:108e4});Se("requestGameLeaderboardAsync",{version:108e4});Se("notifyTaskGameInfoAsync",{version:1080100});Se("loadAdsAsync",{version:1070200});Se("showAdAsync",{version:1070200});Se("onJoliboxHideLoading",{version:1070300});function Se(e,t){if(xo.config[e]){pi.warn(`[can i use] ${e} already registered`);return}xo.config[e]=ht({},t)}var yd=(e,t)=>{function r(i){var a;let[o,...s]=i.split(":");if(!o)return!1;let l=xo.config[o];if(!l)return!1;let c=(a=t==null?void 0:t())!=null?a:"",m=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(m=p)}if(typeof m!="number")return!1;let u=e();return typeof u!="number"||u<m?!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=Ip(i,a);if(!s)return!1;if(ir(s)){let l=s.version;return id(l)?typeof o=="number"&&o>=l:!0}return id(s)?typeof o=="number"&&o>=s:s===!0}return{canIUseNative:r}};function sd(e,t){return`[${e}]:${t}`}var Mp=()=>kp(),Gr="custom_event_",Gp=[],Jp=[],Fp=["env","createRequestTask","login"],wd="__batch_event__",jp="__native_batch_event__",Hp=e=>e==="pv"?e:"default",ui=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=Hp(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&&ir(o))throw new Io(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(ir(o))l.push(...Object.keys(o));else if(pd(o)){if(i.length>0)throw new Io(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(o)}else throw new Io(`expected metric value to be a string, but got a(n) ${typeof o}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let m=ir(o)?o[c]:o;t(n[c],[...i],a,m)})}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={}}},ld=!1,So,Co,Ro;function qp(e,t){ld||(So=new ui({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Co=new ui({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ro=new ui({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{So.flush(),Co.flush(),Ro.flush()}),ld=!0);function r(i){var a,o;let{method:s,args:l,startTime:c,isForeground:m,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:h={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:w,invokeCallback:E}=h,A=(o=(a=u.match(/\S:(\S+)\s?/))==null?void 0:a[1])!=null?o:"fail";So.report({status:A,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:m,duration:Date.now()-c}),c&&w&&E&&(Co.report({status:A,method:s,isForeground:m,duration:Number((w-c).toFixed(3))}),Ro.report({status:A,method:s,isForeground:m,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 Oo=[],Vp=!1,Bo=Symbol.for("Jolibox.invokeResolverInstance"),$p=new Map;globalThis[Bo]||(globalThis[Bo]=$p);var Kp={get resolveMap(){return globalThis[Bo]}};function Wp(e,t){let r=0,n=!0,i=Kp.resolveMap,a=qp(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Oo.forEach(l=>hi(this,[l],function*({method:c,args:m,resolve:u}){let p=yield s(c,m);u(p)})),Oo.length=0});let o=(l,c)=>{let m=i.get(Number(l));if(!m)return;let u=ko(c);m(u),i.delete(Number(l))},s=(l,c)=>{var m,u;let p=Date.now(),h=`${n}`;r+=1;let w=new hp;if(i.set(r,w.resolve),!n&&Jp.includes(l))return new Promise(L=>{Oo.push({method:l,args:c,resolve:L})});let E=np(ht({},{method:l,startTime:p,args:c,isForeground:h}),{invokeType:"js-bridge"}),A=!Vp&&Gp.includes(l),b=lp(c,A),R=A?b:JSON.stringify(b),k;if(l.endsWith("Sync")||Fp.includes(l)?k=(m=e.call)==null?void 0:m.call(e,l,b,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=ko(k)}catch(L){pi.error(L)}return i.delete(r),k.errorCode&&(k.errorCode=sd(l,k.errorCode)),a(ht(ht({},E),k)),k}return l.endsWith("Sync")&&i.delete(r),w.promise.then(L=>(L.errorCode&&(L.errorCode=sd(l,L.errorCode)),a(ht(ht({},E),L)),L))};return{invokeNative:s,applyNative:(l,c)=>{let m=s(l,c);return vp(m)?m.then(u=>cd(l,u)):cd(l,m)},invokeHandler:o}}function cd(e,t){if(!ir(t)){pi.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:a,errorCode:o}=r,s=ip(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new wp(n,i,a,o);return s}var di=Symbol.for("Jolibox.subscribeInstance");function zp(e){if(globalThis[di])return globalThis[di];let t=new Do,r=new Do,n=new ui({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[di]={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=ko(a),l;if(s.__extra){l=s.params;let{type:c,startTime:m}=s.__extra;n.report({type:c,event:i,duration:Date.now()-m})}else l=s;if(i===wd){l.forEach(c=>{let[m,u]=c;try{r.emit(m.slice(Gr.length),u,o)}catch(p){}});return}if(i.startsWith(Gr)){r.emit(i.slice(Gr.length),l,o);return}t.emit(i,l,o)}},globalThis[di]}function Xp(e){let t=new Map,r=new Map,n,i;return{publish:(a,o,s,l)=>{if(l){let m=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Gr}${a}`,o,m);return}n||(n=Promise.resolve().then(()=>{t.forEach((m,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(wd,m,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Gr}${a}`,o])},emitNative:(a,o,s,l)=>{if(l){let m=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(a,o,m),console.log("emitNative",a,o,m);return}i||(i=Promise.resolve().then(()=>{r.forEach((m,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(jp,m,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([a,o])}}}function Qp(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:a}=zp(e),{invokeNative:o,invokeHandler:s,applyNative:l}=Wp(e,r),{publish:c,emitNative:m}=Xp(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:o,onNative:r,offNative:n,emitNative:m,publish:c,subscribe:i,unsubscribe:a}}function bd(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Mo,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}},Ed=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new yp("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=>hi(void 0,null,function*(){let a=yield At.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:a})});Mo={onDocumentReady:t,doExit:r,invoke(i,a,o){e.invoke.postMessage({event:i,paramsString:a,callbackId:o})},publish(i,a,o){let s=bd(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:Ed,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=>hi(void 0,null,function*(){let o=yield At.exit();t.doExit(JSON.stringify({uuid:a,shouldInterrupt:o}))});Mo={onDocumentReady:r,invoke(a,o,s){t.invoke(JSON.stringify({event:a,paramsString:o,callbackId:s}))},doExit:n,publish(a,o,s){let l=bd(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 hi(this,null,function*(){let o=yield At.backPress();t.doBackPress(JSON.stringify({uuid:a,shouldInterrupt:o}))})}};let i={onDocumentReady:r,env:Ed,doExit:n};globalThis.joliboxJSCore=ht({},i)}var Id=Mo;if(!Id&&Mp())throw new bp("No joliboxJScore is found, native bridge not found.");var Yp=ht({},Id),Ad=Qp(Yp),{invokeHandler:dd}=Ad,{applyNative:xS,invokeNative:vi,onNative:Sd,offNative:Cd,subscribeHandler:Zp,publish:PS,emitNative:NS,subscribe:DS,unsubscribe:LS}=Ad;globalThis.joliboxJSBridge={callHandler:dd,invokeHandler:dd,subscribeHandler:Zp};var ev=Object.defineProperty,tv=Object.defineProperties,rv=Object.getOwnPropertyDescriptors,Ri=Object.getOwnPropertySymbols,eu=Object.prototype.hasOwnProperty,tu=Object.prototype.propertyIsEnumerable,Rd=(e,t,r)=>t in e?ev(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ru=(e,t)=>{for(var r in t||(t={}))eu.call(t,r)&&Rd(e,r,t[r]);if(Ri)for(var r of Ri(t))tu.call(t,r)&&Rd(e,r,t[r]);return e},nv=(e,t)=>tv(e,rv(t)),iv=(e,t)=>{var r={};for(var n in e)eu.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ri)for(var n of Ri(e))t.indexOf(n)<0&&tu.call(e,n)&&(r[n]=e[n]);return r},nu=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,Od=Object.getOwnPropertySymbols,sv=Object.prototype.hasOwnProperty,lv=Object.prototype.propertyIsEnumerable,kd=(e,t,r)=>t in e?nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cv=(e,t)=>{for(var r in t||(t={}))sv.call(t,r)&&kd(e,r,t[r]);if(Od)for(var r of Od(t))lv.call(t,r)&&kd(e,r,t[r]);return e},dv=(e,t)=>av(e,ov(t)),uv=(e,t)=>{for(var r in t)nu(e,r,{get:t[r],enumerable:!0})},iu=(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},fv=(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 hv(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function mv(e){return typeof e=="string"}function pv(e){return typeof e=="undefined"}function vv(e){return pv(e)||e===null}function gv(e){return typeof e=="function"}function au(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 _v=(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))(_v||{});function Fr(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var yv={log:Fr("log"),warn:Fr("warn"),info:Fr("info"),error:Fr("error"),debug:Fr("debug")};Object.assign(globalThis,{logger:yv});var Td=Symbol.for("Jolibox.canIUseMap"),wv={};globalThis[Td]||(globalThis[Td]=wv);var xd=Symbol.for("Jolibox.canIUseMap.native"),bv={};globalThis[xd]||(globalThis[xd]=bv);var ou=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(ou||{}),su=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(su||{}),lu=(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))(lu||{}),Pd=["name","params"],Ev=["name","type","location","target","extra","timestamp","userId"],Iv=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function wi(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 Av(e){let t=e.location?wi(e.location,Pd):null,r=e.target?wi(e.target,Pd):null;return wi(dv(cv({},e),{location:t,target:r}),Ev)}function Sv(e){let t=e.events.map(n=>Av(n)),r=wi(e.device,Iv);return[e.protocolVersion,t,r,e.project]}function Cv(){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}}Cv();var sr=typeof window=="undefined",$o=()=>!sr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!sr&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!sr&&navigator.userAgent.includes("Android"),!sr&&navigator.userAgent.includes("Mac"),!sr&&navigator.userAgent.includes("FB_IAB"),!sr&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var Ko=class Wo{constructor(t){this.element=t,this.next=Wo.Undefined,this.prev=Wo.Undefined}};Ko.Undefined=new Ko(void 0);var le=Ko,Rv=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}},Ov=0,jr=class{constructor(e){this.value=e,this.id=Ov++}},Kr=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 jr&&(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 jr(e);return this._listeners?this._listeners instanceof jr?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,m,u,p;if(!this._disposed){if(this._listeners instanceof jr)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(m=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||m.call(c));else if(this._listeners){let h=this._listeners.indexOf(l);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((p=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||p.call(u)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof jr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},kv=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 Kr,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 Rv,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)}},zo={};uv(zo,{None:()=>Tv,filter:()=>Pv,once:()=>cu,toPromise:()=>xv});var Tv=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function xv(e){return new Promise(t=>cu(e)(t))}function cu(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 Pv(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Kr(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 Go=Symbol.for("Jolibox.hostEmitter"),Nv=()=>{let e=new kv;return globalThis[Go]||(globalThis[Go]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Go]};Nv();function Dv(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Lv(e[n],t[n])}function Lv(e,t){if(mv(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(gv(t)){try{if(e instanceof t)return}catch(r){}if(!vv(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 Xo=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Kr,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 Dv(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}};Xo=iu([au],Xo);var Nd=class{constructor(){this._onWillExecuteCommand=new Kr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Kr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Xo,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=hv(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 fv(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),zo.toPromise(zo.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{}}};Nd=iu([au],Nd);function Ue(e,t,r){return(t=Uv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Uv(e){var t=Bv(e,"string");return typeof t=="symbol"?t:t+""}function Bv(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 ar=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")},Qo=class{constructor(t){Ue(this,"context",void 0),Ue(this,"continueCallback",void 0),Ue(this,"adIsShowingCallback",void 0),Ue(this,"isBeforeAdCalled",!1),Ue(this,"isBeforeRewardCalled",!1),Ue(this,"isAdDismissedCalled",!1),Ue(this,"isAdViewedCalled",!1),Ue(this,"isAfterAdCalled",!1),Ue(this,"currentProvider",void 0),Ue(this,"currentClientParams",void 0),Ue(this,"adsHasResponse",!1),Ue(this,"videoChecker",window.document.createElement("video")),Ue(this,"contextInfo",void 0),Ue(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",ru({userEvent:o},this.paramsToTrack)),$o()&&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=ar(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=ar(t);o==null||o(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),$o()&&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=ar(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=ar(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=ar(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,a,o,s,l,c,m,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 p=ar(t);p==null||p(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(m=this.continueCallback)==null||m.call(this,[!1,r]);break}default:{(u=this.continueCallback)==null||u.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return I(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,m,u,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:(m=(c=this.currentProvider)==null?void 0:c.name)!=null?m:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(u=r.name)!=null?u:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(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 gi(e,t,r){return(t=Mv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mv(e){var t=Gv(e,"string");return typeof t=="symbol"?t:t+""}function Gv(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 Yo=class{constructor(t){gi(this,"context",void 0),gi(this,"adBreakIsShowing",!1),gi(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),gi(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 _i(e,t,r){return(t=Jv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jv(e){var t=Fv(e,"string");return typeof t=="symbol"?t:t+""}function Fv(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){_i(this,"configs",null),_i(this,"firstRun",!0),_i(this,"context",void 0),_i(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return I(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=jv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jv(e){var t=Hv(e,"string");return typeof t=="symbol"?t:t+""}function Hv(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 es=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=iv(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=>I(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:m,fullWidthResponsive:u,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 w=c;if(w||(w=this.initParams.unitId),!w)throw new Error("slot is required");let E=typeof m=="object"&&Array.isArray(m)?m.join(", "):m,A=document.createElement("ins");if(A.className="adsbygoogle",A.id="jolibox-ads",A.style.display="block",A.setAttribute("data-ad-client",this.initParams.clientId),A.setAttribute("data-ad-slot",w),E&&A.setAttribute("data-ad-format",E),u&&A.setAttribute("data-full-width-responsive",u),p&&A.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let b=document.createElement("div");b.style.position="absolute",b.style.top="0",b.style.left="0",b.style.width="100%",b.style.height="100%",b.style.display="flex",b.style.justifyContent="center",b.style.alignItems="center",b.style.backgroundColor="rgba(0, 0, 0, 0.5)",b.style.color="white",b.innerHTML="Test Ad",A.style.position="relative",h.appendChild(A),A.appendChild(b)}else h.appendChild(A),new MutationObserver(b=>{b.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let k=A.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:k!=null?k:"null"})}})}).observe(A,{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 I(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 qv(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 Vv(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 $v=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(Vv(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=qv(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}(),Re="-ms-",Oi="-moz-",Y="-webkit-",du="comm",ws="rule",bs="decl",Kv="@import",uu="@keyframes",Wv="@layer",zv=Math.abs,Di=String.fromCharCode,Xv=Object.assign;function Qv(e,t){return we(e,0)^45?(((t<<2^we(e,0))<<2^we(e,1))<<2^we(e,2))<<2^we(e,3):0}function fu(e){return e.trim()}function Yv(e,t){return(e=t.exec(e))?e[0]:e}function Z(e,t,r){return e.replace(t,r)}function ts(e,t){return e.indexOf(t)}function we(e,t){return e.charCodeAt(t)|0}function Wr(e,t,r){return e.slice(t,r)}function tt(e){return e.length}function Es(e){return e.length}function yi(e,t){return t.push(e),e}function Zv(e,t){return e.map(t).join("")}var Li=1,dr=1,hu=0,Me=0,pe=0,ur="";function Ui(e,t,r,n,i,a,o){return{value:e,root:t,parent:r,type:n,props:i,children:a,line:Li,column:dr,length:o,return:""}}function Hr(e,t){return Xv(Ui("",null,null,"",null,null,0),e,{length:-e.length},t)}function eg(){return pe}function tg(){return pe=Me>0?we(ur,--Me):0,dr--,pe===10&&(dr=1,Li--),pe}function He(){return pe=Me<hu?we(ur,Me++):0,dr++,pe===10&&(dr=1,Li++),pe}function rt(){return we(ur,Me)}function bi(){return Me}function Qr(e,t){return Wr(ur,e,t)}function zr(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 mu(e){return Li=dr=1,hu=tt(ur=e),Me=0,[]}function pu(e){return ur="",e}function Ei(e){return fu(Qr(Me-1,rs(e===91?e+2:e===40?e+1:e)))}function rg(e){for(;(pe=rt())&&pe<33;)He();return zr(e)>2||zr(pe)>3?"":" "}function ng(e,t){for(;--t&&He()&&!(pe<48||pe>102||pe>57&&pe<65||pe>70&&pe<97););return Qr(e,bi()+(t<6&&rt()==32&&He()==32))}function rs(e){for(;He();)switch(pe){case e:return Me;case 34:case 39:e!==34&&e!==39&&rs(pe);break;case 40:e===41&&rs(e);break;case 92:He();break}return Me}function ig(e,t){for(;He()&&e+pe!==57&&!(e+pe===84&&rt()===47););return"/*"+Qr(t,Me-1)+"*"+Di(e===47?e:He())}function ag(e){for(;!zr(rt());)He();return Qr(e,Me)}function og(e){return pu(Ii("",null,null,null,[""],e=mu(e),0,[0],e))}function Ii(e,t,r,n,i,a,o,s,l){for(var c=0,m=0,u=o,p=0,h=0,w=0,E=1,A=1,b=1,R=0,k="",L=i,F=a,S=n,N=k;A;)switch(w=R,R=He()){case 40:if(w!=108&&we(N,u-1)==58){ts(N+=Z(Ei(R),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=Ei(R);break;case 9:case 10:case 13:case 32:N+=rg(w);break;case 92:N+=ng(bi()-1,7);continue;case 47:switch(rt()){case 42:case 47:yi(sg(ig(He(),bi()),t,r),l);break;default:N+="/"}break;case 123*E:s[c++]=tt(N)*b;case 125*E:case 59:case 0:switch(R){case 0:case 125:A=0;case 59+m:b==-1&&(N=Z(N,/\f/g,"")),h>0&&tt(N)-u&&yi(h>32?Ld(N+";",n,r,u-1):Ld(Z(N," ","")+";",n,r,u-2),l);break;case 59:N+=";";default:if(yi(S=Dd(N,t,r,c,m,i,s,k,L=[],F=[],u),a),R===123)if(m===0)Ii(N,t,S,S,L,a,u,s,F);else switch(p===99&&we(N,3)===110?100:p){case 100:case 108:case 109:case 115:Ii(e,S,S,n&&yi(Dd(e,S,S,0,0,i,s,k,i,L=[],u),F),i,F,u,s,n?L:F);break;default:Ii(N,S,S,S,[""],F,0,s,F)}}c=m=h=0,E=b=1,k=N="",u=o;break;case 58:u=1+tt(N),h=w;default:if(E<1){if(R==123)--E;else if(R==125&&E++==0&&tg()==125)continue}switch(N+=Di(R),R*E){case 38:b=m>0?1:(N+="\f",-1);break;case 44:s[c++]=(tt(N)-1)*b,b=1;break;case 64:rt()===45&&(N+=Ei(He())),p=rt(),m=u=tt(k=N+=ag(bi())),R++;break;case 45:w===45&&tt(N)==2&&(E=0)}}return a}function Dd(e,t,r,n,i,a,o,s,l,c,m){for(var u=i-1,p=i===0?a:[""],h=Es(p),w=0,E=0,A=0;w<n;++w)for(var b=0,R=Wr(e,u+1,u=zv(E=o[w])),k=e;b<h;++b)(k=fu(E>0?p[b]+" "+R:Z(R,/&\f/g,p[b])))&&(l[A++]=k);return Ui(e,t,r,i===0?ws:s,l,c,m)}function sg(e,t,r){return Ui(e,t,r,du,Di(eg()),Wr(e,2,-2),0)}function Ld(e,t,r,n){return Ui(e,t,r,bs,Wr(e,0,n),Wr(e,n+1,-1),n)}function cr(e,t){for(var r="",n=Es(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function lg(e,t,r,n){switch(e.type){case Wv:if(e.children.length)break;case Kv:case bs:return e.return=e.return||e.value;case du:return"";case uu:return e.return=e.value+"{"+cr(e.children,n)+"}";case ws:e.value=e.props.join(",")}return tt(r=cr(e.children,n))?e.return=e.value+"{"+r+"}":""}function cg(e){var t=Es(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 dg(e){return function(t){t.root||(t=t.return)&&e(t)}}function ug(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var fg=function(e,t,r){for(var n=0,i=0;n=i,i=rt(),n===38&&i===12&&(t[r]=1),!zr(i);)He();return Qr(e,Me)},hg=function(e,t){var r=-1,n=44;do switch(zr(n)){case 0:n===38&&rt()===12&&(t[r]=1),e[r]+=fg(Me-1,t,r);break;case 2:e[r]+=Ei(n);break;case 4:if(n===44){e[++r]=rt()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Di(n)}while(n=He());return e},mg=function(e,t){return pu(hg(mu(e),t))},Ud=new WeakMap,pg=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&&!Ud.get(r))&&!n){Ud.set(e,!0);for(var i=[],a=mg(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]}}},vg=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function vu(e,t){switch(Qv(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+Oi+e+Re+e+e;case 6828:case 4268:return Y+e+Re+e+e;case 6165:return Y+e+Re+"flex-"+e+e;case 5187:return Y+e+Z(e,/(\w+).+(:[^]+)/,Y+"box-$1$2"+Re+"flex-$1$2")+e;case 5443:return Y+e+Re+"flex-item-"+Z(e,/flex-|-self/,"")+e;case 4675:return Y+e+Re+"flex-line-pack"+Z(e,/align-content|flex-|-self/,"")+e;case 5548:return Y+e+Re+Z(e,"shrink","negative")+e;case 5292:return Y+e+Re+Z(e,"basis","preferred-size")+e;case 6060:return Y+"box-"+Z(e,"-grow","")+Y+e+Re+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"+Re+"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(tt(e)-1-t>6)switch(we(e,t+1)){case 109:if(we(e,t+4)!==45)break;case 102:return Z(e,/(.+:)(.+)-([^]+)/,"$1"+Y+"$2-$3$1"+Oi+(we(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~ts(e,"stretch")?vu(Z(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(we(e,t+1)!==115)break;case 6444:switch(we(e,tt(e)-3-(~ts(e,"!important")&&10))){case 107:return Z(e,":",":"+Y)+e;case 101:return Z(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Y+(we(e,14)===45?"inline-":"")+"box$3$1"+Y+"$2$3$1"+Re+"$2box$3")+e}break;case 5936:switch(we(e,t+11)){case 114:return Y+e+Re+Z(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Y+e+Re+Z(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Y+e+Re+Z(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Y+e+Re+e+e}return e}var gg=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case bs:e.return=vu(e.value,e.length);break;case uu:return cr([Hr(e,{value:Z(e.value,"@","@"+Y)})],n);case ws:if(e.length)return Zv(e.props,function(i){switch(Yv(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return cr([Hr(e,{props:[Z(i,/:(read-\w+)/,":"+Oi+"$1")]})],n);case"::placeholder":return cr([Hr(e,{props:[Z(i,/:(plac\w+)/,":"+Y+"input-$1")]}),Hr(e,{props:[Z(i,/:(plac\w+)/,":"+Oi+"$1")]}),Hr(e,{props:[Z(i,/:(plac\w+)/,Re+"input-$1")]})],n)}return""})}},_g=[gg],yg=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(w){var E=w.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var n=e.stylisPlugins||_g,i={},a,o=[];a=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(w){for(var E=w.getAttribute("data-emotion").split(" "),A=1;A<E.length;A++)i[E[A]]=!0;o.push(w)});var s,l=[pg,vg];{var c,m=[lg,dg(function(w){c.insert(w)})],u=cg(l.concat(n,m)),p=function(w){return cr(og(w),u)};s=function(w,E,A,b){c=A,p(w?w+"{"+E.styles+"}":E.styles),b&&(h.inserted[E.name]=!0)}}var h={key:t,sheet:new $v({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 wg(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 bg={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},Eg=/[A-Z]|^ms/g,Ig=/_EMO_([^_]+?)_([^]*?)_EMO_/g,gu=function(e){return e.charCodeAt(1)===45},Bd=function(e){return e!=null&&typeof e!="boolean"},Jo=ug(function(e){return gu(e)?e:e.replace(Eg,"-$&").toLowerCase()}),Md=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(Ig,function(r,n,i){return Ct={name:n,styles:i,next:Ct},n})}return bg[e]!==1&&!gu(e)&&typeof t=="number"&&t!==0?t+"px":t};function ki(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return Ct={name:i.name,styles:i.styles,next:Ct},i.name;var a=r;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)Ct={name:o.name,styles:o.styles,next:Ct},o=o.next;var s=a.styles+";";return s}return Ag(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function Ag(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=ki(e,t,r[i])+";";else for(var a in r){var o=r[a];if(typeof o!="object"){var s=o;t!=null&&t[s]!==void 0?n+=a+"{"+t[s]+"}":Bd(s)&&(n+=Jo(a)+":"+Md(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++)Bd(o[l])&&(n+=Jo(a)+":"+Md(a,o[l])+";");else{var c=ki(e,t,o);switch(a){case"animation":case"animationName":{n+=Jo(a)+":"+c+";";break}default:n+=a+"{"+c+"}"}}}return n}var Gd=/label:\s*([^\s;{]+)\s*(;|$)/g,Ct;function Fo(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="";Ct=void 0;var a=e[0];if(a==null||a.raw===void 0)n=!1,i+=ki(r,t,a);else{var o=a;i+=o[0]}for(var s=1;s<e.length;s++)if(i+=ki(r,t,e[s]),n){var l=a;i+=l[s]}Gd.lastIndex=0;for(var c="",m;(m=Gd.exec(i))!==null;)c+="-"+m[1];var u=wg(i)+c;return{name:u,styles:i,next:Ct}}function _u(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}var Sg=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},Cg=function(e,t,r){Sg(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 Jd(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function Fd(e,t,r){var n=[],i=_u(e,n,r);return n.length<2?r:i+t(n)}var Rg=function(e){var t=yg(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=Fo(s,t.registered,void 0);return Cg(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=Fo(s,t.registered),m="animation-"+c.name;return Jd(t,{name:c.name,styles:"@keyframes "+m+"{"+c.styles+"}"}),m},i=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var c=Fo(s,t.registered);Jd(t,c)},a=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return Fd(t.registered,r,Og(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:_u.bind(null,t.registered),merge:Fd.bind(null,t.registered,r)}},Og=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},kg=Rg({key:"css"}),Oe=kg.css,ns,je,jo,jd,Hd=0,yu=[],ve=H,qd=ve.__b,Vd=ve.__r,$d=ve.diffed,Kd=ve.__c,Wd=ve.unmount,zd=ve.__;function Tg(e,t){ve.__h&&ve.__h(je,e,Hd||t),Hd=0;var r=je.__H||(je.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function wu(e,t){var r=Tg(ns++,7);return Ng(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function xg(){for(var e;e=yu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ai),e.__H.__h.forEach(is),e.__H.__h=[]}catch(t){e.__H.__h=[],ve.__e(t,e.__v)}}ve.__b=function(e){je=null,qd&&qd(e)},ve.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),zd&&zd(e,t)},ve.__r=function(e){Vd&&Vd(e),ns=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(Ai),t.__h.forEach(is),t.__h=[],ns=0)),jo=je},ve.diffed=function(e){$d&&$d(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(yu.push(t)!==1&&jd===ve.requestAnimationFrame||((jd=ve.requestAnimationFrame)||Pg)(xg)),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(Ai),r.__h=r.__h.filter(function(n){return!n.__||is(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ve.__e(n,r.__v)}}),Kd&&Kd(e,t)},ve.unmount=function(e){Wd&&Wd(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Ai(n)}catch(i){t=i}}),r.__H=void 0,t&&ve.__e(t,r.__v))};var Xd=typeof requestAnimationFrame=="function";function Pg(e){var t,r=function(){clearTimeout(n),Xd&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Xd&&(t=requestAnimationFrame(r))}function Ai(e){var t=je,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),je=t}function is(e){var t=je;e.__c=e.__(),je=t}function Ng(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var Dg=Symbol.for("preact-signals");function Bi(){if(Rt>1)Rt--;else{for(var e,t=!1;Vr!==void 0;){var r=Vr;for(Vr=void 0,as++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Eu(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(as=0,Rt--,t)throw e}}function be(e){if(Rt>0)return e();Rt++;try{return e()}finally{Bi()}}var ie=void 0,Vr=void 0,Rt=0,as=0,Ti=0;function bu(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 Ee(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Ee.prototype.brand=Dg;Ee.prototype.h=function(){return!0};Ee.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)};Ee.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)}};Ee.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}})};Ee.prototype.valueOf=function(){return this.value};Ee.prototype.toString=function(){return this.value+""};Ee.prototype.toJSON=function(){return this.value};Ee.prototype.peek=function(){var e=ie;ie=void 0;try{return this.value}finally{ie=e}};Object.defineProperty(Ee.prototype,"value",{get:function(){var e=bu(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(as>100)throw new Error("Cycle detected");this.v=e,this.i++,Ti++,Rt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Bi()}}}});function z(e){return new Ee(e)}function Eu(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 Iu(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 Au(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 fr(e){Ee.call(this,void 0),this.x=e,this.s=void 0,this.g=Ti-1,this.f=4}(fr.prototype=new Ee).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ti))return!0;if(this.g=Ti,this.f|=1,this.i>0&&!Eu(this))return this.f&=-2,!0;var e=ie;try{Iu(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,Au(this),this.f&=-2,!0};fr.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)}Ee.prototype.S.call(this,e)};fr.prototype.U=function(e){if(this.t!==void 0&&(Ee.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)}};fr.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(fr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=bu(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function $r(e){return new fr(e)}function Su(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Rt++;var r=ie;ie=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Is(e),n}finally{ie=r,Bi()}}}function Is(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Su(e)}function Lg(e){if(ie!==this)throw new Error("Out-of-order effect");Au(this),ie=e,this.f&=-2,8&this.f&&Is(this),Bi()}function Yr(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Yr.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()}};Yr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Su(this),Iu(this),Rt++;var e=ie;return ie=this,Lg.bind(this,e)};Yr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Vr,Vr=this)};Yr.prototype.d=function(){this.f|=8,1&this.f||Is(this)};function Zr(e){var t=new Yr(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Cu,Ho,Ru=[];Zr(function(){Cu=this.N})();function hr(e,t){H[e]=t.bind(null,H[e]||function(){})}function xi(e){Ho&&Ho(),Ho=e&&e.S()}function Ou(e){var t=this,r=e.data,n=ku(r);n.value=r;var i=wu(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=$r(function(){var h=n.value.value;return h===0?0:h===!0?"":h||""}),m=$r(function(){return!Array.isArray(c.value)&&!ho(c.value)}),u=Zr(function(){if(this.N=Tu,m.value){var h=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=h)}}),p=t.__$u.d;return t.__$u.d=function(){u(),p.call(this)},[m,c]},[]),a=i[0],o=i[1];return a.value?o.peek():o.value}Ou.displayName="_st";Object.defineProperties(Ee.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ou},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});hr("__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 Ee&&(r||(t.__np=r={}),r[i]=a,n[i]=a.peek())}}e(t)});hr("__r",function(e,t){xi();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}())),xi(r),e(t)});hr("__e",function(e,t,r,n){xi(),e(t,r,n)});hr("diffed",function(e,t){xi();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],m=n[l];c===void 0?(c=Ug(r,l,m,i),a[l]=c):c.o(m,i)}}}e(t)});function Ug(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=Tu;var o=a.value.value;n[t]!==o&&(n[t]=o,i?e[t]=o:o?e.setAttribute(t,o):e.removeAttribute(t))})}}hr("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)});hr("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Fe.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 ku(e){return wu(function(){return z(e)},[])}var Bg=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Mg(){be(function(){for(var e;e=Ru.shift();)Cu.call(e)})}function Tu(){Ru.push(this)===1&&(H.requestAnimationFrame||Bg)(Mg)}var ge=Oe`
9
+ -----END PUBLIC KEY-----`});function sc(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 wm(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 lc(e){return I(this,null,function*(){let t=window.crypto,r=t.subtle,n=wm(ac),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=sc(s),h={timestamp:Date.now(),data:e},p=new TextEncoder().encode(JSON.stringify(h)),m=t.getRandomValues(new Uint8Array(12)),b=yield r.encrypt({name:"AES-GCM",iv:m,tagLength:128},o,p),E=new Uint8Array(b),A=new Uint8Array(m.length+E.length);A.set(m,0),A.set(E,m.length);let w=sc(A.buffer);return{k:l,v:"1.0",payload:w}})}var cc=re(()=>{"use strict";oc()});var On,dc=re(()=>{"use strict";pe();ic();nr();cc();On=class extends Rn{constructor(r,n,i){super(n,i);this.httpClient=ze.create();this.gameId=L.mpId,this.sessionId=L.sessionId,this.track=r}reporter(r){return I(this,null,function*(){let{event:n,params:i,extraParams:a}=r,o={eventType:n,gameInfo:X({gameId:this.gameId,sessionId:this.sessionId},i)};a&&Object.assign(o,a);try{let s=yield lc(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 uc,Em,be,Im,$a,Ye,ht=re(()=>{"use strict";nc();W();W();ja();Va();dc();pe();Fa();uc=Ae(),Em={type:tr.WebSDK,platform:"h5",jssdk_version:L.sdkInfo.jssdkVersion,mp_id:L.mpId,mp_version:L.mpVersion},{track:be,trackPerformance:Im}=Zl((...e)=>{var o,s,l,c;let[,t]=e,r=t,n=Cl(r.extra)?r.extra:Aa(r.extra)?JSON.parse(r.extra):{},i=xe(X({},n),{mp_id:(o=r.mp_id)!=null?o:"",mp_version:(s=r.mp_version)!=null?s:""}),a={name:t.tag,type:Gt.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(c=(l=L.hostUserInfo)==null?void 0:l.uid)!=null?c:null};Cn.trackEvent(a,tr.WebSDK)},Em);uc.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Im(e,t,r)});uc.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{be(e,t)});$a=new et,Ye=new On(be,$a)});function fc(e){let t=Oa.config[e];return t||(t={},Oa.config[e]=t),(r,n)=>{if(t[r]){Pe.warn(`[can i use] ${r} already registered`);return}t[r]=X({},n)}}var hc=re(()=>{"use strict";W()});function Ka(e){mc=e}function kn(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>kn(t)):Object.keys(e).reduce((t,r)=>(t[r]=kn(e[r]),t),{})}function mt(e){return typeof e=="number"}function Wa(e){let t=za(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function za(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var mc,ve,Tn,xn,Nn,Pn,ir,Dn,Ln,Un,Bn,Mn,Gn,Jn,Fn,jn,Hn,qn,Vn,Ya=re(()=>{"use strict";mc=!1;ve=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(mc)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 ${Wa(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return kn(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:kn(this._default)}optional(){return this._optional=!0,this}};Tn=class extends ve{validate(t){return this._optional&&t===void 0?!0:mt(t)?mt(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):mt(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):mt(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}},xn=class extends ve{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Nn=class extends ve{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(mt(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(mt(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}},Pn=class extends ve{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ir=class extends ve{validate(t){return!0}},Dn=class extends ve{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Ln=class extends ve{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Un=class extends ve{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Bn=class extends ve{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 ${Wa(t)}`)}return!0}},Mn=class extends ve{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(mt(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(mt(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(mt(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}},Gn=class extends ve{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(za(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}},Jn=class extends ve{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(za(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}},Fn=class extends ve{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Wa(this.value),actual:r}):!0}},jn=class extends ve{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}},Hn=class extends ve{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}},qn=class extends ve{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Vn=class extends ve{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 Xa(e,t,r="param"){if(e.errors=[],e.path=r,Ka(!0),!e.validate(t)){let n=e.errors.join(`
11
+ `);throw e.errors.length=0,Ka(!1),new TypeError(n)}}var F,Qa=re(()=>{"use strict";Ya();Ya();F={object(e){return new Jn(e)},array(e){return new Mn(e)},tuple(...e){return new Hn(...e)},literal(e){return new Fn(e)},or(...e){return new jn(...e)},symbol(){return new Pn},record(e){return new Gn(e)},function(){return new Un},boolean(){return new xn},string(){return new Nn},number(){return new Tn},undefined(){return new Dn},null(){return new Ln},unknown(){return new ir},any(){return new ir},as(){return new ir},arraybuffer(){return new qn},enum(...e){return new Bn(...e)},typedarray(e){return new Vn(e)}}});var $n,pc,vc=re(()=>{"use strict";W();ut();Qa();Ja();$n=1,pc=e=>{function t(n,i){return(...a)=>{var u,p,m,b;let o=Date.now(),s={method:n,trace_id:$n};$n+=1;let l="SUCCESS",c=`${n}:ok`,h=0;try{if(i.paramsSchema)try{Xa(i.paramsSchema,a,"params")}catch(R){throw Ga(`${n}:fail ${R.message}`)}let E=i.implement(...a),A=E,w=`${n}:ok`;if(E&&"code"in E){let{code:R,data:O,message:D}=E;l=R,A=O,w=D}return{code:l,message:w,data:A}}catch(E){let A=E;h=(p=(u=A.code)!=null?u:A.errNo)!=null?p:2e3,l="FAILURE";let w=(b=(m=A.message)!=null?m:A.errMsg)!=null?b:`${E}`;return c=`${n}:${l} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`,je(new En(c,h)),{code:l,message:c}}finally{let E=Date.now()-o}}}function r(n,i){return(...a)=>I(this,null,function*(){var p,m,b,E;let o=Rl(a)?a:[a],s=Date.now(),l={method:n,trace_id:$n};$n+=1;let c=`${n}:ok`,h="SUCCESS",u={code:h,message:c};try{if(i.paramsSchema)try{Xa(i.paramsSchema,o,"params")}catch(R){throw Ga(R.message)}let w=yield i.implement(...o);if(w&&"code"in w){let{code:R,data:O,message:D}=w;h=R,c=D,w=O}return Object.assign(u,{code:h,message:c,data:w}),u}catch(A){let w=A,R=(m=(p=w.code)!=null?p:w.errNo)!=null?m:2e3;h="FAILURE";let O=(E=(b=w.message)!=null?b:w.errMsg)!=null?E:`${A}`,D=`${n}:${h} ${O.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:h,message:D}),je(new En(D,R)),u}finally{let A=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var Xe,jt,we,Nr=re(()=>{"use strict";hc();ht();vc();Qa();({createAPI:Xe,createSyncAPI:jt}=pc(be)),we=fc("h5")});var bc=ma((yc,ro)=>{(function(e){if(typeof yc=="object"&&typeof ro!="undefined")ro.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(h,u){if(!a[h]){if(!i[h]){var p=typeof Rr=="function"&&Rr;if(!u&&p)return p(h,!0);if(l)return l(h,!0);var m=new Error("Cannot find module '"+h+"'");throw m.code="MODULE_NOT_FOUND",m}var b=a[h]={exports:{}};i[h][0].call(b.exports,function(E){var A=i[h][1][E];return s(A||E)},b,b.exports,n,i,a,o)}return a[h].exports}for(var l=typeof Rr=="function"&&Rr,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,h=new s(E),u=o.document.createTextNode("");h.observe(u,{characterData:!0}),l=function(){u.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var p=new o.MessageChannel;p.port1.onmessage=E,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(){E(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},o.document.documentElement.appendChild(w)}:l=function(){setTimeout(E,0)};var m,b=[];function E(){m=!0;for(var w,R,O=b.length;O;){for(R=b,b=[],w=-1;++w<O;)R[w]();O=b.length}m=!1}i.exports=A;function A(w){b.push(w)===1&&!m&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,a){"use strict";var o=n(1);function s(){}var l={},c=["REJECTED"],h=["FULFILLED"],u=["PENDING"];i.exports=p;function p(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,S!==s&&A(this,S)}p.prototype.catch=function(S){return this.then(null,S)},p.prototype.then=function(S,N){if(typeof S!="function"&&this.state===h||typeof N!="function"&&this.state===c)return this;var J=new this.constructor(s);if(this.state!==u){var q=this.state===h?S:N;b(J,q,this.outcome)}else this.queue.push(new m(J,S,N));return J};function m(S,N,J){this.promise=S,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof J=="function"&&(this.onRejected=J,this.callRejected=this.otherCallRejected)}m.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},m.prototype.otherCallFulfilled=function(S){b(this.promise,this.onFulfilled,S)},m.prototype.callRejected=function(S){l.reject(this.promise,S)},m.prototype.otherCallRejected=function(S){b(this.promise,this.onRejected,S)};function b(S,N,J){o(function(){var q;try{q=N(J)}catch(U){return l.reject(S,U)}q===S?l.reject(S,new TypeError("Cannot resolve promise with itself")):l.resolve(S,q)})}l.resolve=function(S,N){var J=w(E,N);if(J.status==="error")return l.reject(S,J.value);var q=J.value;if(q)A(S,q);else{S.state=h,S.outcome=N;for(var U=-1,G=S.queue.length;++U<G;)S.queue[U].callFulfilled(N)}return S},l.reject=function(S,N){S.state=c,S.outcome=N;for(var J=-1,q=S.queue.length;++J<q;)S.queue[J].callRejected(N);return S};function E(S){var N=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof N=="function")return function(){N.apply(S,arguments)}}function A(S,N){var J=!1;function q(V){J||(J=!0,l.reject(S,V))}function U(V){J||(J=!0,l.resolve(S,V))}function G(){N(U,q)}var j=w(G);j.status==="error"&&q(j.value)}function w(S,N){var J={};try{J.value=S(N),J.status="success"}catch(q){J.status="error",J.value=q}return J}p.resolve=R;function R(S){return S instanceof this?S:l.resolve(new this(s),S)}p.reject=O;function O(S){var N=new this(s);return l.reject(N,S)}p.all=D;function D(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=S.length,q=!1;if(!J)return this.resolve([]);for(var U=new Array(J),G=0,j=-1,V=new this(s);++j<J;)K(S[j],j);return V;function K(Fe,Xt){N.resolve(Fe).then(Qt,function(ct){q||(q=!0,l.reject(V,ct))});function Qt(ct){U[Xt]=ct,++G===J&&!q&&(q=!0,l.resolve(V,U))}}}p.race=M;function M(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=S.length,q=!1;if(!J)return this.resolve([]);for(var U=-1,G=new this(s);++U<J;)j(S[U]);return G;function j(V){N.resolve(V).then(function(K){q||(q=!0,l.resolve(G,K))},function(K){q||(q=!0,l.reject(G,K))})}}},{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 h(){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 p=Promise;function m(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 A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var w="local-forage-detect-blob-support",R=void 0,O={},D=Object.prototype.toString,M="readonly",S="readwrite";function N(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 J(d){return new p(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 q(d){return typeof R=="boolean"?p.resolve(R):J(d).then(function(v){return R=v,R})}function U(d){var v=O[d.name],f={};f.promise=new p(function(_,y){f.resolve=_,f.reject=y}),v.deferredOperations.push(f),v.dbReady?v.dbReady=v.dbReady.then(function(){return f.promise}):v.dbReady=f.promise}function G(d){var v=O[d.name],f=v.deferredOperations.pop();if(f)return f.resolve(),f.promise}function j(d,v){var f=O[d.name],_=f.deferredOperations.pop();if(_)return _.reject(v),_.promise}function V(d,v){return new p(function(f,_){if(O[d.name]=O[d.name]||zs(),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 k=g.result;try{k.createObjectStore(d.storeName),C.oldVersion<=1&&k.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(k){k.target.close()},f(C),G(d)}})}function K(d){return V(d,!1)}function Fe(d){return V(d,!0)}function Xt(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 Qt(d){return new p(function(v,f){var _=new FileReader;_.onerror=f,_.onloadend=function(y){var g=btoa(y.target.result||"");v({__local_forage_encoded_blob:!0,data:g,type:d.type})},_.readAsBinaryString(d)})}function ct(d){var v=N(atob(d.data));return u([v],{type:d.type})}function Ws(d){return d&&d.__local_forage_encoded_blob}function If(d){var v=this,f=v._initReady().then(function(){var _=O[v._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return b(f,d,d),f}function Af(d){U(d);for(var v=O[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,K(d).then(function(g){return d.db=g,Xt(d)?Fe(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 j(d,g),g})}function dt(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 p.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),Fe(d)}).then(function(){return Af(d).then(function(){dt(d,v,f,_-1)})}).catch(f);f(g)}}function zs(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Sf(d){var v=this,f={db:null};if(d)for(var _ in d)f[_]=d[_];var y=O[f.name];y||(y=zs(),O[f.name]=y),y.forages.push(v),v._initReady||(v._initReady=v.ready,v.ready=If);var g=[];function C(){return p.resolve()}for(var k=0;k<y.forages.length;k++){var T=y.forages[k];T!==v&&g.push(T._initReady().catch(C))}var x=y.forages.slice(0);return p.all(g).then(function(){return f.db=y.db,K(f)}).then(function(P){return f.db=P,Xt(f,v._defaultConfig.version)?Fe(f):P}).then(function(P){f.db=y.db=P,v._dbInfo=f;for(var B=0;B<x.length;B++){var z=x[B];z!==v&&(z._dbInfo.db=f.db,z._dbInfo.version=f.version)}})}function Cf(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){dt(f._dbInfo,M,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=T.get(d);x.onsuccess=function(){var P=x.result;P===void 0&&(P=null),Ws(P)&&(P=ct(P)),y(P)},x.onerror=function(){g(x.error)}}catch(P){g(P)}})}).catch(g)});return m(_,v),_}function Rf(d,v){var f=this,_=new p(function(y,g){f.ready().then(function(){dt(f._dbInfo,M,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=T.openCursor(),P=1;x.onsuccess=function(){var B=x.result;if(B){var z=B.value;Ws(z)&&(z=ct(z));var ee=d(z,B.key,P++);ee!==void 0?y(ee):B.continue()}else y()},x.onerror=function(){g(x.error)}}catch(B){g(B)}})}).catch(g)});return m(_,v),_}function Of(d,v,f){var _=this;d=E(d);var y=new p(function(g,C){var k;_.ready().then(function(){return k=_._dbInfo,D.call(v)==="[object Blob]"?q(k.db).then(function(T){return T?v:Qt(v)}):v}).then(function(T){dt(_._dbInfo,S,function(x,P){if(x)return C(x);try{var B=P.objectStore(_._dbInfo.storeName);T===null&&(T=void 0);var z=B.put(T,d);P.oncomplete=function(){T===void 0&&(T=null),g(T)},P.onabort=P.onerror=function(){var ee=z.error?z.error:z.transaction.error;C(ee)}}catch(ee){C(ee)}})}).catch(C)});return m(y,f),y}function kf(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){dt(f._dbInfo,S,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=T.delete(d);k.oncomplete=function(){y()},k.onerror=function(){g(x.error)},k.onabort=function(){var P=x.error?x.error:x.transaction.error;g(P)}}catch(P){g(P)}})}).catch(g)});return m(_,v),_}function Tf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){dt(v._dbInfo,S,function(g,C){if(g)return y(g);try{var k=C.objectStore(v._dbInfo.storeName),T=k.clear();C.oncomplete=function(){_()},C.onabort=C.onerror=function(){var x=T.error?T.error:T.transaction.error;y(x)}}catch(x){y(x)}})}).catch(y)});return m(f,d),f}function xf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){dt(v._dbInfo,M,function(g,C){if(g)return y(g);try{var k=C.objectStore(v._dbInfo.storeName),T=k.count();T.onsuccess=function(){_(T.result)},T.onerror=function(){y(T.error)}}catch(x){y(x)}})}).catch(y)});return m(f,d),f}function Nf(d,v){var f=this,_=new p(function(y,g){if(d<0){y(null);return}f.ready().then(function(){dt(f._dbInfo,M,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=!1,P=T.openKeyCursor();P.onsuccess=function(){var B=P.result;if(!B){y(null);return}d===0||x?y(B.key):(x=!0,B.advance(d))},P.onerror=function(){g(P.error)}}catch(B){g(B)}})}).catch(g)});return m(_,v),_}function Pf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){dt(v._dbInfo,M,function(g,C){if(g)return y(g);try{var k=C.objectStore(v._dbInfo.storeName),T=k.openKeyCursor(),x=[];T.onsuccess=function(){var P=T.result;if(!P){_(x);return}x.push(P.key),P.continue()},T.onerror=function(){y(T.error)}}catch(P){y(P)}})}).catch(y)});return m(f,d),f}function Df(d,v){v=A.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=p.reject("Invalid arguments");else{var g=d.name===f.name&&_._dbInfo.db,C=g?p.resolve(_._dbInfo.db):K(d).then(function(k){var T=O[d.name],x=T.forages;T.db=k;for(var P=0;P<x.length;P++)x[P]._dbInfo.db=k;return k});d.storeName?y=C.then(function(k){if(k.objectStoreNames.contains(d.storeName)){var T=k.version+1;U(d);var x=O[d.name],P=x.forages;k.close();for(var B=0;B<P.length;B++){var z=P[B];z._dbInfo.db=null,z._dbInfo.version=T}var ee=new p(function(te,me){var fe=c.open(d.name,T);fe.onerror=function($e){var Cr=fe.result;Cr.close(),me($e)},fe.onupgradeneeded=function(){var $e=fe.result;$e.deleteObjectStore(d.storeName)},fe.onsuccess=function(){var $e=fe.result;$e.close(),te($e)}});return ee.then(function(te){x.db=te;for(var me=0;me<P.length;me++){var fe=P[me];fe._dbInfo.db=te,G(fe._dbInfo)}}).catch(function(te){throw(j(d,te)||p.resolve()).catch(function(){}),te})}}):y=C.then(function(k){U(d);var T=O[d.name],x=T.forages;k.close();for(var P=0;P<x.length;P++){var B=x[P];B._dbInfo.db=null}var z=new p(function(ee,te){var me=c.deleteDatabase(d.name);me.onerror=function(){var fe=me.result;fe&&fe.close(),te(me.error)},me.onblocked=function(){console.warn('dropInstance blocked for database "'+d.name+'" until all open connections are closed')},me.onsuccess=function(){var fe=me.result;fe&&fe.close(),ee(fe)}});return z.then(function(ee){T.db=ee;for(var te=0;te<x.length;te++){var me=x[te];G(me._dbInfo)}}).catch(function(ee){throw(j(d,ee)||p.resolve()).catch(function(){}),ee})})}return m(y,v),y}var Lf={_driver:"asyncStorage",_initStorage:Sf,_support:h(),iterate:Rf,getItem:Cf,setItem:Of,removeItem:kf,clear:Tf,length:xf,key:Nf,keys:Pf,dropInstance:Df};function Uf(){return typeof openDatabase=="function"}var Rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bf="~~local_forage_type~",Ys=/^~~local_forage_type~([^~]+)~/,vn="__lfsc__:",na=vn.length,ia="arbf",aa="blob",Xs="si08",Qs="ui08",Zs="uic8",el="si16",tl="si32",rl="ur16",nl="ui32",il="fl32",al="fl64",ol=na+ia.length,sl=Object.prototype.toString;function ll(d){var v=d.length*.75,f=d.length,_,y=0,g,C,k,T;d[d.length-1]==="="&&(v--,d[d.length-2]==="="&&v--);var x=new ArrayBuffer(v),P=new Uint8Array(x);for(_=0;_<f;_+=4)g=Rt.indexOf(d[_]),C=Rt.indexOf(d[_+1]),k=Rt.indexOf(d[_+2]),T=Rt.indexOf(d[_+3]),P[y++]=g<<2|C>>4,P[y++]=(C&15)<<4|k>>2,P[y++]=(k&3)<<6|T&63;return x}function oa(d){var v=new Uint8Array(d),f="",_;for(_=0;_<v.length;_+=3)f+=Rt[v[_]>>2],f+=Rt[(v[_]&3)<<4|v[_+1]>>4],f+=Rt[(v[_+1]&15)<<2|v[_+2]>>6],f+=Rt[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 Mf(d,v){var f="";if(d&&(f=sl.call(d)),d&&(f==="[object ArrayBuffer]"||d.buffer&&sl.call(d.buffer)==="[object ArrayBuffer]")){var _,y=vn;d instanceof ArrayBuffer?(_=d,y+=ia):(_=d.buffer,f==="[object Int8Array]"?y+=Xs:f==="[object Uint8Array]"?y+=Qs:f==="[object Uint8ClampedArray]"?y+=Zs:f==="[object Int16Array]"?y+=el:f==="[object Uint16Array]"?y+=rl:f==="[object Int32Array]"?y+=tl:f==="[object Uint32Array]"?y+=nl:f==="[object Float32Array]"?y+=il:f==="[object Float64Array]"?y+=al:v(new Error("Failed to get type for BinaryArray"))),v(y+oa(_))}else if(f==="[object Blob]"){var g=new FileReader;g.onload=function(){var C=Bf+d.type+"~"+oa(this.result);v(vn+aa+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 Gf(d){if(d.substring(0,na)!==vn)return JSON.parse(d);var v=d.substring(ol),f=d.substring(na,ol),_;if(f===aa&&Ys.test(v)){var y=v.match(Ys);_=y[1],v=v.substring(y[0].length)}var g=ll(v);switch(f){case ia:return g;case aa:return u([g],{type:_});case Xs:return new Int8Array(g);case Qs:return new Uint8Array(g);case Zs:return new Uint8ClampedArray(g);case el:return new Int16Array(g);case rl:return new Uint16Array(g);case tl:return new Int32Array(g);case nl:return new Uint32Array(g);case il:return new Float32Array(g);case al:return new Float64Array(g);default:throw new Error("Unkown type: "+f)}}var sa={serialize:Mf,deserialize:Gf,stringToBuffer:ll,bufferToString:oa};function cl(d,v,f,_){d.executeSql("CREATE TABLE IF NOT EXISTS "+v.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,_)}function Jf(d){var v=this,f={db:null};if(d)for(var _ in d)f[_]=typeof d[_]!="string"?d[_].toString():d[_];var y=new p(function(g,C){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch(k){return C(k)}f.db.transaction(function(k){cl(k,f,function(){v._dbInfo=f,g()},function(T,x){C(x)})},C)});return f.serializer=sa,y}function Ot(d,v,f,_,y,g){d.executeSql(f,_,y,function(C,k){k.code===k.SYNTAX_ERR?C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[v.storeName],function(T,x){x.rows.length?g(T,k):cl(T,v,function(){T.executeSql(f,_,y,g)},g)},g):g(C,k)},g)}function Ff(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[d],function(T,x){var P=x.rows.length?x.rows.item(0).value:null;P&&(P=C.serializer.deserialize(P)),y(P)},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function jf(d,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"SELECT * FROM "+C.storeName,[],function(T,x){for(var P=x.rows,B=P.length,z=0;z<B;z++){var ee=P.item(z),te=ee.value;if(te&&(te=C.serializer.deserialize(te)),te=d(te,ee.key,z+1),te!==void 0){y(te);return}}y()},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function dl(d,v,f,_){var y=this;d=E(d);var g=new p(function(C,k){y.ready().then(function(){v===void 0&&(v=null);var T=v,x=y._dbInfo;x.serializer.serialize(v,function(P,B){B?k(B):x.db.transaction(function(z){Ot(z,x,"INSERT OR REPLACE INTO "+x.storeName+" (key, value) VALUES (?, ?)",[d,P],function(){C(T)},function(ee,te){k(te)})},function(z){if(z.code===z.QUOTA_ERR){if(_>0){C(dl.apply(y,[d,T,f,_-1]));return}k(z)}})})}).catch(k)});return m(g,f),g}function Hf(d,v,f){return dl.apply(this,[d,v,f,1])}function qf(d,v){var f=this;d=E(d);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[d],function(){y()},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function Vf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){Ot(C,g,"DELETE FROM "+g.storeName,[],function(){_()},function(k,T){y(T)})})}).catch(y)});return m(f,d),f}function $f(d){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){Ot(C,g,"SELECT COUNT(key) as c FROM "+g.storeName,[],function(k,T){var x=T.rows.item(0).c;_(x)},function(k,T){y(T)})})}).catch(y)});return m(f,d),f}function Kf(d,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[d+1],function(T,x){var P=x.rows.length?x.rows.item(0).key:null;y(P)},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function Wf(d){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){Ot(C,g,"SELECT key FROM "+g.storeName,[],function(k,T){for(var x=[],P=0;P<T.rows.length;P++)x.push(T.rows.item(P).key);_(x)},function(k,T){y(T)})})}).catch(y)});return m(f,d),f}function zf(d){return new p(function(v,f){d.transaction(function(_){_.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,g){for(var C=[],k=0;k<g.rows.length;k++)C.push(g.rows.item(k).name);v({db:d,storeNames:C})},function(y,g){f(g)})},function(_){f(_)})})}function Yf(d,v){v=A.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 p(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(zf(C))}).then(function(g){return new p(function(C,k){g.db.transaction(function(T){function x(ee){return new p(function(te,me){T.executeSql("DROP TABLE IF EXISTS "+ee,[],function(){te()},function(fe,$e){me($e)})})}for(var P=[],B=0,z=g.storeNames.length;B<z;B++)P.push(x(g.storeNames[B]));p.all(P).then(function(){C()}).catch(function(ee){k(ee)})},function(T){k(T)})})}):y=p.reject("Invalid arguments"),m(y,v),y}var Xf={_driver:"webSQLStorage",_initStorage:Jf,_support:Uf(),iterate:jf,getItem:Ff,setItem:Hf,removeItem:qf,clear:Vf,length:$f,key:Kf,keys:Wf,dropInstance:Yf};function Qf(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(d){return!1}}function ul(d,v){var f=d.name+"/";return d.storeName!==v.storeName&&(f+=d.storeName+"/"),f}function Zf(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch(v){return!0}}function eh(){return!Zf()||localStorage.length>0}function th(d){var v=this,f={};if(d)for(var _ in d)f[_]=d[_];return f.keyPrefix=ul(d,v._defaultConfig),eh()?(v._dbInfo=f,f.serializer=sa,p.resolve()):p.reject()}function rh(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 m(f,d),f}function nh(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 m(_,v),_}function ih(d,v){var f=this,_=f.ready().then(function(){for(var y=f._dbInfo,g=y.keyPrefix,C=g.length,k=localStorage.length,T=1,x=0;x<k;x++){var P=localStorage.key(x);if(P.indexOf(g)===0){var B=localStorage.getItem(P);if(B&&(B=y.serializer.deserialize(B)),B=d(B,P.substring(C),T++),B!==void 0)return B}}});return m(_,v),_}function ah(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 m(_,v),_}function oh(d){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo,y=localStorage.length,g=[],C=0;C<y;C++){var k=localStorage.key(C);k.indexOf(_.keyPrefix)===0&&g.push(k.substring(_.keyPrefix.length))}return g});return m(f,d),f}function sh(d){var v=this,f=v.keys().then(function(_){return _.length});return m(f,d),f}function lh(d,v){var f=this;d=E(d);var _=f.ready().then(function(){var y=f._dbInfo;localStorage.removeItem(y.keyPrefix+d)});return m(_,v),_}function ch(d,v,f){var _=this;d=E(d);var y=_.ready().then(function(){v===void 0&&(v=null);var g=v;return new p(function(C,k){var T=_._dbInfo;T.serializer.serialize(v,function(x,P){if(P)k(P);else try{localStorage.setItem(T.keyPrefix+d,x),C(g)}catch(B){(B.name==="QuotaExceededError"||B.name==="NS_ERROR_DOM_QUOTA_REACHED")&&k(B),k(B)}})})});return m(y,f),y}function dh(d,v){if(v=A.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 p(function(g){d.storeName?g(ul(d,_._defaultConfig)):g(d.name+"/")}).then(function(g){for(var C=localStorage.length-1;C>=0;C--){var k=localStorage.key(C);k.indexOf(g)===0&&localStorage.removeItem(k)}}):y=p.reject("Invalid arguments"),m(y,v),y}var uh={_driver:"localStorageWrapper",_initStorage:th,_support:Qf(),iterate:ih,getItem:nh,setItem:ch,removeItem:lh,clear:rh,length:sh,key:ah,keys:oh,dropInstance:dh},fh=function(v,f){return v===f||typeof v=="number"&&typeof f=="number"&&isNaN(v)&&isNaN(f)},hh=function(v,f){for(var _=v.length,y=0;y<_;){if(fh(v[y],f))return!0;y++}return!1},fl=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Sr={},hl={},Zt={INDEXEDDB:Lf,WEBSQL:Xf,LOCALSTORAGE:uh},mh=[Zt.INDEXEDDB._driver,Zt.WEBSQL._driver,Zt.LOCALSTORAGE._driver],gn=["dropInstance"],la=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(gn),ph={description:"",driver:mh.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function vh(d,v){d[v]=function(){var f=arguments;return d.ready().then(function(){return d[v].apply(d,f)})}}function ca(){for(var d=1;d<arguments.length;d++){var v=arguments[d];if(v)for(var f in v)v.hasOwnProperty(f)&&(fl(v[f])?arguments[0][f]=v[f].slice():arguments[0][f]=v[f])}return arguments[0]}var gh=function(){function d(v){s(this,d);for(var f in Zt)if(Zt.hasOwnProperty(f)){var _=Zt[f],y=_._driver;this[f]=y,Sr[y]||this.defineDriver(_)}this._defaultConfig=ca({},ph),this._config=ca({},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 p(function(C,k){try{var T=f._driver,x=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){k(x);return}for(var P=la.concat("_initStorage"),B=0,z=P.length;B<z;B++){var ee=P[B],te=!hh(gn,ee);if((te||f[ee])&&typeof f[ee]!="function"){k(x);return}}var me=function(){for(var Cr=function(bh){return function(){var wh=new Error("Method "+bh+" is not implemented by the current driver"),ml=p.reject(wh);return m(ml,arguments[arguments.length-1]),ml}},da=0,yh=gn.length;da<yh;da++){var ua=gn[da];f[ua]||(f[ua]=Cr(ua))}};me();var fe=function(Cr){Sr[T]&&console.info("Redefining LocalForage driver: "+T),Sr[T]=f,hl[T]=Cr,C()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(fe,k):fe(!!f._support):fe(!0)}catch($e){k($e)}});return b(g,_,y),g},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(f,_,y){var g=Sr[f]?p.resolve(Sr[f]):p.reject(new Error("Driver not found."));return b(g,_,y),g},d.prototype.getSerializer=function(f){var _=p.resolve(sa);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;fl(f)||(f=[f]);var C=this._getSupportedDrivers(f);function k(){g._config.driver=g.driver()}function T(B){return g._extend(B),k(),g._ready=g._initStorage(g._config),g._ready}function x(B){return function(){var z=0;function ee(){for(;z<B.length;){var te=B[z];return z++,g._dbInfo=null,g._ready=null,g.getDriver(te).then(T).catch(ee)}k();var me=new Error("No available storage method found.");return g._driverSet=p.reject(me),g._driverSet}return ee()}}var P=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=P.then(function(){var B=C[0];return g._dbInfo=null,g._ready=null,g.getDriver(B).then(function(z){g._driver=z._driver,k(),g._wrapLibraryMethodsWithReady(),g._initDriver=x(C)})}).catch(function(){k();var B=new Error("No available storage method found.");return g._driverSet=p.reject(B),g._driverSet}),b(this._driverSet,_,y),this._driverSet},d.prototype.supports=function(f){return!!hl[f]},d.prototype._extend=function(f){ca(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,_=la.length;f<_;f++)vh(this,la[f])},d.prototype.createInstance=function(f){return new d(f)},d}(),_h=new gh;i.exports=_h},{3:3}]},{},[4])(4)})});var Ec=ma(ar=>{"use strict";W();Nr();ht();var Dr=(e,t)=>{window.parent&&window.parent.postMessage({type:e,data:t},"*")},Lr=Ae(),Fm=Xe("levelFinished",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number()),duration:F.number().optional(),rating:F.number().optional(),score:F.number().optional(),variation:F.string().optional()})),implement:e=>I(ar,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:a}=e;Pe.info("onLevelFinished",r,n,i,a),Dr("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:r,rating:n,score:i,variation:a}),yield Promise.all([Ye.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}}),Ye.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:a})])})}),jm=Xe("gamePlayEnded",{paramsSchema:F.tuple(F.object({duration:F.number().optional(),rating:F.number().optional(),score:F.number(),variation:F.string().optional()})),implement:e=>I(ar,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e;Pe.info("onGamePlayEnded",t,r,n,i),Dr("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:r,score:n,variation:i}),yield Promise.all([Ye.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i}),Ye.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})])})}),Hm=Xe("levelUpgrade",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number()),name:F.string().optional()})),implement:r=>I(ar,[r],function*({levelId:e,name:t}){Pe.info("onLevelUpgrade",e,t),Dr("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:e,name:t}),yield Promise.all([Ye.tracker("LevelUpgrade",{name:t,levelId:e}),Ye.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})])})}),qm=Xe("levelStart",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number())})),implement:e=>I(ar,null,function*(){let{levelId:t}=e;Pe.info("onLevelStart",t),Dr("JOLIBOX_GAME_TASK_LEVEL_START",{levelId:t}),yield Ye.tracker("LevelStart",{levelId:t})})}),Vm=Xe("levelFailed",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number()),score:F.number().optional(),rating:F.number().optional(),duration:F.number().optional()})),implement:e=>I(ar,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;Pe.info("onLevelFailed",t,r,n,i),Dr("JOLIBOX_GAME_TASK_LEVEL_FAILED",{levelId:t,score:r,rating:n,duration:i}),yield Ye.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});Lr.registerCommand("TaskTrackerSDK.levelFinished",Fm);Lr.registerCommand("TaskTrackerSDK.gamePlayEnded",jm);Lr.registerCommand("TaskTrackerSDK.levelUpgrade",Hm);Lr.registerCommand("TaskTrackerSDK.levelStart",qm);Lr.registerCommand("TaskTrackerSDK.levelFailed",Vm);we("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"}}});we("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});we("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});we("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});we("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 Ue,or,Ic,io,$m,Ht,Ur=re(()=>{"use strict";Ue=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")},or=new Map,Ic=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let r=or.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)}},io=!1,$m=()=>{io||(window.addEventListener("message",Ic),io=!0)},Ht=(e,t)=>{$m(),or.has(e)||or.set(e,new Set);let r=or.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&or.delete(e),or.size===0&&(window.removeEventListener("message",Ic),io=!1)}}});var Xn,Qn,Zn,ei,ti,ao,ri,ni,ii,ai,sr,Km,ne,pt,vt,Be=re(()=>{"use strict";W();Xn="UNLOCK_OPTIONS_CHANGED",Qn="INVOKE_PAYMENT",Zn="ON_PAYMENT_RESULT",ei="ON_USE_MODAL_EVENT",ti="ON_USE_MODAL_RESULT",ao="ON_USE_MODAL_FREQUENCY",ri="ON_USE_UNLOGIN_MODAL_EVENT",ni="INVOKE_UNLOGIN_MODAL_EVENT",ii="INVOKE_SUBSCRIPTION_EVENT",ai="ON_USE_SUBSCRIPTION_RESULT",sr=new et,Km=()=>({on:sr.on.bind(sr),off:sr.off.bind(sr),emit:sr.emit.bind(sr)}),ne=Km(),pt={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},vt={show:!0,minInterval:8*60*60*1e3}});var rf=ma(Xi=>{"use strict";pe();Be();Ur();W();var tf={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};Ht("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",tf[e.result],e.result),ne.emit(ti,{useModalResult:tf[e.result]})});ne.on(ei,(e,t)=>{var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ue("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:We()})});Ht("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{ne.emit(Zn,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});ne.on(Qn,(e,t)=>I(Xi,null,function*(){var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ue("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:We()})}));Ht("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,r,n,i,a;ne.emit(ri,{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"&&L.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});ne.on(ni,e=>I(Xi,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ue("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:We(),type:e})}));Ht("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),ne.emit(ai,{result:e.result})});ne.on(ii,e=>I(Xi,null,function*(){console.log("----notify custom event-----",e),Ue("JOLIBOX_SUB_EVENT",{sequenceId:We()})}))});ht();pe();Nr();W();var gc=Ae(),Sm="env",Cm="getSystemInfoSync",Rm=()=>{var i,a,o,s;let e={system:L.deviceInfo.system,platform:L.deviceInfo.platform.toLowerCase(),brand:L.deviceInfo.brand,pixelRatio:L.deviceInfo.pixelRatio,language:L.deviceInfo.lang,version:L.sdkInfo.jssdkVersion,appName:(i=L.hostInfo)==null?void 0:i.appName,SDKVersion:L.sdkInfo.nativeSDKVersion},t=(a=L.hostInfo)==null?void 0:a.version;t&&(e=xe(X({},e),{version:t}));let r=(o=L.hostInfo)==null?void 0:o.appName;r&&(e=xe(X({},e),{appName:r}));let n=(s=L.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(e=xe(X({},e),{SDKVersion:n})),e},Om=jt(Cm,{implement:Rm}),km=jt(Sm,{implement:()=>xe(X({},L.hostInfo),{sdkInfo:L.sdkInfo,platform:L.platform,deviceInfo:L.deviceInfo})});gc.registerCommand("API.env",km);gc.registerCommand("API.getSystemInfoSync",Om);we("env",{version:"1.0.0"});we("getSystemInfoSync",{version:"1.0.0"});W();Nr();ut();ht();var Tm="onJoliboxShow",xm="onJoliboxHide",Nm="onReady",eo=Ae(),to=Dl(je),Za=!0,Pr=!0,Kn=0,Wn=$a;function Pm(){let e=Date.now();if(e-Kn<100)return;Kn=e;let t=document.visibilityState==="visible";t!==Za&&(Za=t,Wn.emit("visible",Za))}function _c(e){let t=Date.now();t-Kn<100||(Kn=t,e==="focus"&&!Pr?Pr=!0:e==="blur"&&Pr&&(Pr=!1),Wn.emit("visible",Pr))}document.addEventListener("visibilitychange",Pm);window.addEventListener("focus",()=>_c("focus"));window.addEventListener("blur",()=>_c("blur"));var Dm=jt(Tm,{paramsSchema:F.tuple(F.function()),implement(e){let t=to(e);Wn.on("visible",r=>{r&&t()})}}),Lm=jt(xm,{paramsSchema:F.tuple(F.function()),implement(e){let t=to(e);Wn.on("visible",r=>{!r&&t()})}}),Um=jt(Nm,{paramsSchema:F.tuple(F.function()),implement(e){let t=to(e);kt.on("LifecycleEvent.onReady",r=>{t(r)})}});eo.registerCommand("LifecycleSDK.onReady",Um);eo.registerCommand("LifecycleSDK.onJoliboxShow",Dm);eo.registerCommand("LifecycleSDK.onJoliboxHide",Lm);we("lifeCycle.onReady",{version:"1.0.0"});we("lifeCycle.onJoliboxShow",{version:"1.0.0"});we("lifeCycle.onJoliboxHide",{version:"1.0.0"});Nr();W();nr();pe();var wc=pa(bc());var zn=Ae(),no=class{constructor(){this.httpClient=ze.create({baseUrl:rr(L.testMode)});this.getGameId=()=>L.mpId;this.getItem=t=>I(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)=>I(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=>I(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=()=>I(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=wc.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Yn=new no,Bm=Xe("getLocalStorage",{paramsSchema:F.tuple(F.string()),implement(e){return I(this,null,function*(){return yield Yn.getItem(e)})}});zn.registerCommand("StorageSDK.getItem",Bm);we("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Mm=Xe("setStorage",{paramsSchema:F.tuple(F.string(),F.or(F.string(),F.boolean(),F.number())),implement(e,t){return I(this,null,function*(){return yield Yn.setItem(e,t)})}});zn.registerCommand("StorageSDK.setItem",Mm);we("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Gm=Xe("removeStorage",{paramsSchema:F.tuple(F.string()),implement(e){return I(this,null,function*(){return yield Yn.removeItem(e)})}});zn.registerCommand("StorageSDK.removeItem",Gm);we("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Jm=Xe("clearStorage",{implement(){return I(this,null,function*(){return yield Yn.clear()})}});zn.registerCommand("StorageSDK.clear",Jm);we("storage.clear",{version:"1.0.0"});var D0=pa(Ec());ht();W();nr();Ur();pe();Be();var Ac=L.testMode;function Sc(){let e=new Map,t,r;return{registerRewardHandler(i,a){e.set(i,a)},handleReward(i,...a){return I(this,null,function*(){return yield i.reduce((s,l)=>I(this,null,function*(){let c=yield s;if(c===!0)return!0;Ac&&console.log(`handleReward ${l}`);let h=e.get(l),u=h?yield h(...a):c;return Ac&&console.log(`handleReward ${l} ${u}`),u}),Promise.resolve(!1))})},registerRewardsFetcher(i){return I(this,null,function*(){t=(...a)=>I(this,null,function*(){try{return yield i(...a)}catch(o){return console.error("getRewardOptions error:",o),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return I(this,null,function*(){r=(...a)=>I(this,null,function*(){try{return yield i(...a)}catch(o){return console.error("getRewardOptions error:",o),{joliCoinUseAndCharge:pt,loginGuide:vt}}})})},getRewardsTypes(...i){return I(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return I(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:pt,loginGuide:vt}})}}}W();var oo=class{constructor(t){this.httpClient=t}execute(t,r){return I(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}}}},so=class{constructor(t){this.httpClient=t}execute(t,r){return I(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return X({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},oi=class{constructor(t){this.unlockOptionsService=new Jt(new oo(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 Jt(new so(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return I(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return I(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 I(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return I(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 I(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()}};Be();W();var Wm=()=>(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]},zm=["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(Wm())},lo=null;function co(e){return lo||(lo=new oi(e)),lo}var uo=e=>{e.registerRewardsFetcher(t=>I(void 0,null,function*(){var i,a,o,s,l;let r=["ADS"],n=co(t);try{let c=yield n.getUnlockOptions({});if(c.code!=="SUCCESS")return r;ne.emit(Xn,{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 h=((l=(s=c.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(u=>u.type))||Array.from(r);return Ym(h)}catch(c){return console.error("getRewardOptions error (cached):",c),r}}))},fo=e=>{e.registerRewardFrequencyConfigFetcher(t=>I(void 0,null,function*(){var n,i,a,o;let r=co(t);try{let s=yield r.getGlobalConfig();return ne.emit(ao,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||pt,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||vt}),s.data&&kt.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((a=s.data)==null?void 0:a.joliCoinUseAndCharge)||pt,loginGuide:((o=s.data)==null?void 0:o.loginGuide)||vt}}catch(s){return console.error("getGlobalConfig error (cached):",s),ne.emit(ao,{joliCoinUseAndCharge:pt,loginGuide:vt}),kt.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:pt,loginGuide:vt,supportedHostMethods:zm}}),{joliCoinUseAndCharge:pt,loginGuide:vt}}}))};var ho=e=>I(void 0,null,function*(){yield co(e).warmupCache(),console.log("Reward cache warmed up")});var Cc=e=>t=>I(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});Be();function tt(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=X(X({},i),o),r=Promise.resolve(i),n&&(n(i),n=null),i}}}Be();var Se=tt(ne,Xn),Br=(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()))};pe();W();var mo={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"}};W();var Ke=Ae();Be();Be();W();var vo=class{constructor(t){this.httpClient=t}execute(t,r){return I(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}}}},go=class{constructor(t){this.balanceService=new Jt(new vo(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 I(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 I(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 I(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()}},po=null;function _o(e){return po||(po=new go(e)),po}var yo=(e,t="JOLI_COIN")=>I(void 0,null,function*(){return yield _o(e).getBalance(t)}),qt=(e,t="JOLI_COIN")=>I(void 0,null,function*(){let n=yield _o(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n}),si=(e,t="JOLI_COIN")=>I(void 0,null,function*(){yield _o(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});W();var wo=class{constructor(t){this.httpClient=t}execute(t,r){return I(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}}}},Eo=class{constructor(t){this.gemBalanceService=new Jt(new wo(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 I(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 I(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 I(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()}},bo=null;function Rc(e){return bo||(bo=new Eo(e)),bo}var Io=(e,t="GEM")=>I(void 0,null,function*(){return yield Rc(e).getGemBalance(t)}),lr=(e,t="GEM")=>I(void 0,null,function*(){let n=yield Rc(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n});var rt={JOLI_COIN:{fetchBalance:yo,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:Io,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 li=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;Ke.registerCommand(`Rewards.${e}.useJolicoin`,()=>I(void 0,null,function*(){let i=yield Se.getData(),a=rt[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"}}))},Vt=(e,t)=>r=>I(void 0,null,function*(){let n=tt(ne,ti);return ne.emit(ei,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult});Be();Be();var ci=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;Ke.registerCommand(`Rewards.${e}.usePayment`,()=>I(void 0,null,function*(){var p;let a=yield Se.getData(),o=rt[t],s=yield o.fetchBalance(n),l=o.getQuantity(a),c=o.getCurrentUser(a),h=o.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,c.enableAutoDeduct),u=o.getUpdateKey();if(Se.updateData({[u]:h}),console.log("-----unlockOptions payment-----",a,h,l,t),!o.isEnough(a,h)){let m=yield i({userCurrency:h,currencyQuantity:l,currency:t});return t==="JOLI_GEM"?lr(n):qt(n),{result:m==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},$t=(e,t)=>r=>I(void 0,null,function*(){let n=tt(ne,Zn);return ne.emit(Qn,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult});pe();Be();Be();W();var Kt=(e,t)=>r=>I(void 0,null,function*(){let n=tt(ne,ri);return ne.emit(ni,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()});var Zm=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:a,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:c}})=>{ci(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:o}),li(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let h=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return u=>I(void 0,null,function*(){var p,m,b,E;try{let A=yield a.getData();if(Br(A,c)){let D=rt.JOLI_COIN,M=yield D.fetchBalance(t),S=D.getCurrentUser(A),N=D.createUpdatedUser((p=M==null?void 0:M.balance)!=null?p:0,S.enableAutoDeduct);if(!D.isEnough(A,N))return i==null||i(u),!1}else{let D=!0;for(let M of h){let S=yield Ke.executeCommand(M);if(D=D&&S.result!=="FAILED",S.result!=="CONTINUE")break}if(!D)return i==null||i(u),!1}let R=mo[r],O=yield t.post(R.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${We()}-${L.mpType}-${Date.now()}`,gameInfo:{gameId:L.mpId}}});if(console.log("-----unlockWithCurrency request result-----",O),O.code=="SUCCESS"){try{(b=u.adBreakDone)==null||b.call(u,{breakType:u.type,breakName:"name"in u&&(m=u.name)!=null?m:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in u&&((E=u.adViewed)==null||E.call(u)),qt(t)}catch(D){console.error("-----unlockWithJolicoin adBreakDone error-----",D)}return n==null||n({quantity:O.data.quantity,balance:O.data.balance}),!0}return i==null||i(u),!1}catch(A){if(console.info("JolicoinRewardHandler error:",A),A instanceof Error&&A.message=="CANCEL")throw A;return i==null||i(u),!1}finally{a.clearCache()}})},di=(e,t,r)=>Zm(e,t,"JOLI_COIN",r);var Oc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},a=Vt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),o=$t("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Kt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return di("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Se,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:n}})};var kc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=c=>{var h;r==null||r(),(h=c.adBreakDone)==null||h.call(c,{breakType:c.type,breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},a=Vt("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),o=$t("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Kt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return di("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Se,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:n}})};pe();W();Be();Be();var Tc=e=>{let{showSubscriptionModal:t}=e;Ke.registerCommand("Rewards.subscription",()=>I(void 0,null,function*(){var s,l;let r=yield Se.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=rt[n?"JOLI_GEM":"JOLI_COIN"],a=i.getCurrentUser(r);return i.isEnough(r,a)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},xc=e=>()=>I(void 0,null,function*(){let t=tt(ne,ai);return ne.emit(ii,e),(yield t.getFreshData()).result});pe();var Nc=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:a,hasSubscription:o}})=>{Tc({showSubscriptionModal:a});let s=["Rewards.subscription"];return l=>I(void 0,null,function*(){var c,h,u,p,m,b;try{let E=yield i.getData();if(!Br(E,o))return!1;let w=!0;for(let R of s){let O=yield Ke.executeCommand(R);if(w=w&&O.result!=="FAILED",O.result!=="CONTINUE")break}if(qt(t),lr(t),console.log("-----unlockWithSubscription result-----",w),w){try{(h=l.adBreakDone)==null||h.call(l,{breakType:l.type,breakName:"name"in l&&(c=l.name)!=null?c:"",breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in l&&((u=l.adViewed)==null||u.call(l)),(b=(m=L).onEnvConfigChanged)==null||b.call(m,{hostUserInfo:xe(X({},(p=L.hostUserInfo)!=null?p:{isLogin:!1}),{isSubUser:!0})})}catch(R){console.error("-----unlockWithSubscription adBreakDone error-----",R)}return r==null||r(),!0}return n==null||n(l),!1}catch(E){if(console.info("SubscriptionRewardHandler error:",E),E instanceof Error&&E.message=="CANCEL")throw E;return n==null||n(l),!1}finally{}})};var Pc=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},a=xc("SUBSCRIPTION");return Nc("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Se,showSubscriptionModal:a,hasSubscription:n}})};var nt=Sc();uo(nt);fo(nt);var mi,H,Mc,Co,Wt,Dc,Gc,Jc,Fc,Ro,Ao,So,tp,Mr={},jc=[],rp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Gr=Array.isArray;function gt(e,t){for(var r in t)e[r]=t[r];return e}function Oo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Jr(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?mi.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 fi(e,o,n,i,null)}function fi(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?++Mc:i,__i:-1,__u:0};return i==null&&H.vnode!=null&&H.vnode(a),a}function Fr(){return{current:null}}function Tt(e){return e.children}function He(e,t){this.props=e,this.context=t}function cr(e,t){if(t==null)return e.__?cr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?cr(e):null}function Hc(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 Hc(e)}}function Lc(e){(!e.__d&&(e.__d=!0)&&Wt.push(e)&&!hi.__r++||Dc!==H.debounceRendering)&&((Dc=H.debounceRendering)||Gc)(hi)}function hi(){for(var e,t,r,n,i,a,o,s=1;Wt.length;)Wt.length>s&&Wt.sort(Jc),e=Wt.shift(),s=Wt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,a=[],o=[],t.__P&&((r=gt({},n)).__v=n.__v+1,H.vnode&&H.vnode(r),ko(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,a,i==null?cr(n):i,!!(32&n.__u),o),r.__v=n.__v,r.__.__k[r.__i]=r,$c(a,r,o),r.__e!=i&&Hc(r)));hi.__r=0}function qc(e,t,r,n,i,a,o,s,l,c,h){var u,p,m,b,E,A,w=n&&n.__k||jc,R=t.length;for(l=np(r,t,w,l,R),u=0;u<R;u++)(m=r.__k[u])!=null&&(p=m.__i===-1?Mr:w[m.__i]||Mr,m.__i=u,A=ko(e,m,p,i,a,o,s,l,c,h),b=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&To(p.ref,null,m),h.push(m.ref,m.__c||b,m)),E==null&&b!=null&&(E=b),4&m.__u||p.__k===m.__k?l=Vc(m,l,e):typeof m.type=="function"&&A!==void 0?l=A:b&&(l=b.nextSibling),m.__u&=-7);return r.__e=E,l}function np(e,t,r,n,i){var a,o,s,l,c,h=r.length,u=h,p=0;for(e.__k=new Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=a+p,(o=e.__k[a]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?fi(null,o,null,null,null):Gr(o)?fi(Tt,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?fi(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=ip(o,r,l,u))!==-1&&(u--,(s=r[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&(i>h?p--:i<h&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,o.__u|=4))):e.__k[a]=null;if(u)for(a=0;a<h;a++)(s=r[a])!=null&&!(2&s.__u)&&(s.__e==n&&(n=cr(s)),Wc(s,s));return n}function Vc(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=Vc(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=cr(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function jr(e,t){return t=t||[],e==null||typeof e=="boolean"||(Gr(e)?e.some(function(r){jr(r,t)}):t.push(e)),t}function ip(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 Uc(e,t,r){t[0]=="-"?e.setProperty(t,r==null?"":r):e[t]=r==null?"":typeof r!="number"||rp.test(t)?r:r+"px"}function ui(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||Uc(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Uc(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Fc,"$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=Ro,e.addEventListener(t,a?So:Ao,a)):e.removeEventListener(t,a?So:Ao,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 Bc(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Ro++;else if(t.u<r.t)return;return r(H.event?H.event(t):t)}}}function ko(e,t,r,n,i,a,o,s,l,c){var h,u,p,m,b,E,A,w,R,O,D,M,S,N,J,q,U,G=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),a=[s=t.__e=r.__e]),(h=H.__b)&&h(t);e:if(typeof G=="function")try{if(w=t.props,R="prototype"in G&&G.prototype.render,O=(h=G.contextType)&&n[h.__c],D=h?O?O.props.value:h.__:n,r.__c?A=(u=t.__c=r.__c).__=u.__E:(R?t.__c=u=new G(w,D):(t.__c=u=new He(w,D),u.constructor=G,u.render=op),O&&O.sub(u),u.props=w,u.state||(u.state={}),u.context=D,u.__n=n,p=u.__d=!0,u.__h=[],u._sb=[]),R&&u.__s==null&&(u.__s=u.state),R&&G.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=gt({},u.__s)),gt(u.__s,G.getDerivedStateFromProps(w,u.__s))),m=u.props,b=u.state,u.__v=t,p)R&&G.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),R&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(R&&G.getDerivedStateFromProps==null&&w!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(w,D),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(w,u.__s,D)===!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(j){j&&(j.__=t)}),M=0;M<u._sb.length;M++)u.__h.push(u._sb[M]);u._sb=[],u.__h.length&&o.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(w,u.__s,D),R&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,b,E)})}if(u.context=D,u.props=w,u.__P=e,u.__e=!1,S=H.__r,N=0,R){for(u.state=u.__s,u.__d=!1,S&&S(t),h=u.render(u.props,u.state,u.context),J=0;J<u._sb.length;J++)u.__h.push(u._sb[J]);u._sb=[]}else do u.__d=!1,S&&S(t),h=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++N<25);u.state=u.__s,u.getChildContext!=null&&(n=gt(gt({},n),u.getChildContext())),R&&!p&&u.getSnapshotBeforeUpdate!=null&&(E=u.getSnapshotBeforeUpdate(m,b)),q=h,h!=null&&h.type===Tt&&h.key==null&&(q=Kc(h.props.children)),s=qc(e,Gr(q)?q:[q],t,r,n,i,a,o,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&o.push(u),A&&(u.__E=u.__=null)}catch(j){if(t.__v=null,l||a!=null)if(j.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--;)Oo(a[U]);else t.__e=r.__e,t.__k=r.__k;H.__e(j,t,r)}else a==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):s=t.__e=ap(r.__e,t,r,n,i,a,o,l,c);return(h=H.diffed)&&h(t),128&t.__u?void 0:s}function $c(e,t,r){for(var n=0;n<r.length;n++)To(r[n],r[++n],r[++n]);H.__c&&H.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){H.__e(a,i.__v)}})}function Kc(e){return typeof e!="object"||e==null?e:Gr(e)?e.map(Kc):gt({},e)}function ap(e,t,r,n,i,a,o,s,l){var c,h,u,p,m,b,E,A=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((m=a[c])&&"setAttribute"in m==!!R&&(R?m.localName==R:m.nodeType==3)){e=m,a[c]=null;break}}if(e==null){if(R==null)return document.createTextNode(w);e=document.createElementNS(i,R,w.is&&w),s&&(H.__m&&H.__m(t,a),s=!1),a=null}if(R===null)A===w||s&&e.data===w||(e.data=w);else{if(a=a&&mi.call(e.childNodes),A=r.props||Mr,!s&&a!=null)for(A={},c=0;c<e.attributes.length;c++)A[(m=e.attributes[c]).name]=m.value;for(c in A)if(m=A[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=m;else if(!(c in w)){if(c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w)continue;ui(e,c,null,m,i)}}for(c in w)m=w[c],c=="children"?p=m:c=="dangerouslySetInnerHTML"?h=m:c=="value"?b=m:c=="checked"?E=m:s&&typeof m!="function"||A[c]===m||ui(e,c,m,A[c],i);if(h)s||u&&(h.__html===u.__html||h.__html===e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(u&&(e.innerHTML=""),qc(t.type==="template"?e.content:e,Gr(p)?p:[p],t,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,o,a?a[0]:r.__k&&cr(r,0),s,l),a!=null)for(c=a.length;c--;)Oo(a[c]);s||(c="value",R=="progress"&&b==null?e.removeAttribute("value"):b!==void 0&&(b!==e[c]||R=="progress"&&!b||R=="option"&&b!==A[c])&&ui(e,c,b,A[c],i),c="checked",E!==void 0&&E!==e[c]&&ui(e,c,E,A[c],i))}return e}function To(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){H.__e(i,r)}}function Wc(e,t,r){var n,i;if(H.unmount&&H.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||To(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(a){H.__e(a,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Wc(n[i],t,r||typeof e.type!="function");r||Oo(e.__e),e.__c=e.__=e.__e=void 0}function op(e,t,r){return this.constructor(e,r)}function zc(e,t,r){var n,i,a,o;t==document&&(t=document.documentElement),H.__&&H.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,a=[],o=[],ko(t,e=(!n&&r||t).__k=Jr(Tt,null,[e]),i||Mr,Mr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?mi.call(t.childNodes):null,a,!n&&r?r:i?i.__e:t.firstChild,n,o),$c(a,e,o)}mi=jc.slice,H={__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}},Mc=0,Co=function(e){return e!=null&&e.constructor==null},He.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=gt({},this.state),typeof e=="function"&&(e=e(gt({},r),this.props)),e&&gt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Lc(this))},He.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Lc(this))},He.prototype.render=Tt,Wt=[],Gc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Jc=function(e,t){return e.__v.__b-t.__v.__b},hi.__r=0,Fc=/(PointerCapture)$|Capture$/i,Ro=0,Ao=Bc(!1),So=Bc(!0),tp=0;var dr,de,xo,Yc,Hr=0,id=[],he=H,Xc=he.__b,Qc=he.__r,Zc=he.diffed,ed=he.__c,td=he.unmount,rd=he.__;function vi(e,t){he.__h&&he.__h(de,e,Hr||t),Hr=0;var r=de.__H||(de.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function _t(e){return Hr=1,ad(od,e)}function ad(e,t,r){var n=vi(dr++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):od(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=de,!de.__f)){var i=function(s,l,c){if(!n.__c.__H)return!0;var h=n.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!a||a.call(this,s,l,c);var u=n.__c.props!==s;return h.forEach(function(p){if(p.__N){var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(u=!0)}}),a&&a.call(this,s,l,c)||u};de.__f=!0;var a=de.shouldComponentUpdate,o=de.componentWillUpdate;de.componentWillUpdate=function(s,l,c){if(this.__e){var h=a;a=void 0,i(s,l,c),a=h}o&&o.call(this,s,l,c)},de.shouldComponentUpdate=i}return n.__N||n.__}function xt(e,t){var r=vi(dr++,3);!he.__s&&Do(r.__H,t)&&(r.__=e,r.u=t,de.__H.__h.push(r))}function Po(e,t){var r=vi(dr++,4);!he.__s&&Do(r.__H,t)&&(r.__=e,r.u=t,de.__h.push(r))}function gi(e){return Hr=5,qr(function(){return{current:e}},[])}function qr(e,t){var r=vi(dr++,7);return Do(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Vr(e,t){return Hr=8,qr(function(){return e},t)}function sp(){for(var e;e=id.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(pi),e.__H.__h.forEach(No),e.__H.__h=[]}catch(t){e.__H.__h=[],he.__e(t,e.__v)}}he.__b=function(e){de=null,Xc&&Xc(e)},he.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),rd&&rd(e,t)},he.__r=function(e){Qc&&Qc(e),dr=0;var t=(de=e.__c).__H;t&&(xo===de?(t.__h=[],de.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(pi),t.__h.forEach(No),t.__h=[],dr=0)),xo=de},he.diffed=function(e){Zc&&Zc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(id.push(t)!==1&&Yc===he.requestAnimationFrame||((Yc=he.requestAnimationFrame)||lp)(sp)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),xo=de=null},he.__c=function(e,t){t.some(function(r){try{r.__h.forEach(pi),r.__h=r.__h.filter(function(n){return!n.__||No(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],he.__e(n,r.__v)}}),ed&&ed(e,t)},he.unmount=function(e){td&&td(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{pi(n)}catch(i){t=i}}),r.__H=void 0,t&&he.__e(t,r.__v))};var nd=typeof requestAnimationFrame=="function";function lp(e){var t,r=function(){clearTimeout(n),nd&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);nd&&(t=requestAnimationFrame(r))}function pi(e){var t=de,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),de=t}function No(e){var t=de;e.__c=e.__(),de=t}function Do(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function od(e,t){return typeof t=="function"?t(e):t}function dp(e,t){for(var r in t)e[r]=t[r];return e}function sd(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 ld(e,t){this.props=e,this.context=t}(ld.prototype=new He).isPureReactComponent=!0,ld.prototype.shouldComponentUpdate=function(e,t){return sd(this.props,e)||sd(this.state,t)};var cd=H.__b;H.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),cd&&cd(e)};var oC=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var up=H.__e;H.__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)}up(e,t,r,n)};var dd=H.unmount;function vd(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=dp({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return vd(n,t,r)})),e}function gd(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return gd(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 Lo(){this.__u=0,this.o=null,this.__b=null}function _d(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function _i(){this.i=null,this.l=null}H.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),dd&&dd(e)},(Lo.prototype=new He).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=_d(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]=gd(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)},Lo.prototype.componentWillUnmount=function(){this.o=[]},Lo.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]=vd(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&Jr(Tt,null,e.fallback);return i&&(i.__u&=-33),[Jr(Tt,null,t.__a?null:e.children),i]};var ud=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]}};(_i.prototype=new He).__a=function(e){var t=this,r=_d(t.__v),n=t.l.get(e);return n[0]++,function(i){var a=function(){t.props.revealOrder?(n.push(i),ud(t,e,n)):i()};r?r(a):a()}},_i.prototype.render=function(e){this.i=null,this.l=new Map;var t=jr(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},_i.prototype.componentDidUpdate=_i.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){ud(e,r,t)})};var fp=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,hp=/^(?: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]/,mp=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,pp=/[A-Z0-9]/g,vp=typeof document!="undefined",gp=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function it(e,t,r){return t.__k==null&&(t.textContent=""),zc(e,t),typeof r=="function"&&r(),e?e.__c:null}He.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(He.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var fd=H.event;function _p(){}function yp(){return this.cancelBubble}function bp(){return this.defaultPrevented}H.event=function(e){return fd&&(e=fd(e)),e.persist=_p,e.isPropagationStopped=yp,e.isDefaultPrevented=bp,e.nativeEvent=e};var yd,wp={enumerable:!1,configurable:!0,get:function(){return this.class}},hd=H.vnode;H.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||vp&&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"||gp(r.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":mp.test(o)&&(o=l):l=o="oninput":a&&hp.test(o)?o=o.replace(pp,"-$&").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=jr(r.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=jr(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",wp)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=fp,hd&&hd(e)};var md=H.__r;H.__r=function(e){md&&md(e),yd=e.__c};var pd=H.diffed;H.diffed=function(e){pd&&pd(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),yd=null};var Ep=Object.defineProperty,Ip=Object.defineProperties,Ap=Object.getOwnPropertyDescriptors,wi=Object.getOwnPropertySymbols,Od=Object.prototype.hasOwnProperty,kd=Object.prototype.propertyIsEnumerable,bd=(e,t,r)=>t in e?Ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yt=(e,t)=>{for(var r in t||(t={}))Od.call(t,r)&&bd(e,r,t[r]);if(wi)for(var r of wi(t))kd.call(t,r)&&bd(e,r,t[r]);return e},Sp=(e,t)=>Ip(e,Ap(t)),Cp=(e,t)=>{var r={};for(var n in e)Od.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&wi)for(var n of wi(e))t.indexOf(n)<0&&kd.call(e,n)&&(r[n]=e[n]);return r},Ei=(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 Rp(e){return!!(e!=null&&e.__nativeBuffers__)}var Op=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 jo(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!Rp(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=Op(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var kp=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 Tp(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:kp(a),key:i};n.push(o),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var Td=Object.defineProperty,xp=Object.getOwnPropertyDescriptor,Np=(e,t)=>{for(var r in t)Td(e,r,{get:t[r],enumerable:!0})},xd=(e,t,r,n)=>{for(var i=n>1?void 0:n?xp(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&&Td(t,r,i),i},Pp=(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 Dp(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var Lp=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 Nd(e){return typeof e=="string"}function fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function wd(e){return typeof e=="number"&&!isNaN(e)}function Up(e){return typeof e=="undefined"}function Bp(e){return Up(e)||e===null}function Pd(e){return typeof e=="function"}function Mp(e){return fr(e)&&Pd(e.then)}function Dd(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}var Gp=(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))(Gp||{}),Jp=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}},Ii=class extends Jp{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Fp=class extends Ii{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},jp=class extends Ii{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Hp=class extends Ii{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Uo=class extends Ii{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function $r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var Ai={log:$r("log"),warn:$r("warn"),info:$r("info"),error:$r("error"),debug:$r("debug")};Object.assign(globalThis,{logger:Ai});var Ed=Symbol.for("Jolibox.canIUseMap"),qp={};globalThis[Ed]||(globalThis[Ed]=qp);function Vp(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 Ho=Symbol.for("Jolibox.canIUseMap.native"),$p={};globalThis[Ho]||(globalThis[Ho]=$p);var qo={get config(){return globalThis[Ho]}},Kp=(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))(Kp||{}),Wp=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Wp||{}),zp=(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))(zp||{});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 ur=typeof window=="undefined",Xp=()=>!ur&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),dC={isiOS:!ur&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:!ur&&navigator.userAgent.includes("Android"),isMac:!ur&&navigator.userAgent.includes("Mac"),isFacebook:!ur&&navigator.userAgent.includes("FB_IAB"),isPC:!ur&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Vo=class $o{constructor(t){this.element=t,this.next=$o.Undefined,this.prev=$o.Undefined}};Vo.Undefined=new Vo(void 0);var le=Vo,Qp=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}},Zp=0,Kr=class{constructor(e){this.value=e,this.id=Zp++}},zr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Kr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,a,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Kr(t);return this._listeners?this._listeners instanceof Kr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(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 h,u,p,m;if(!this._disposed){if(this._listeners instanceof Kr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||u.call(h));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((m=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||m.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Kr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Ko=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 zr,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 Qp,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},Wo={};Np(Wo,{None:()=>ev,filter:()=>rv,once:()=>Ld,toPromise:()=>tv});var ev=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function tv(e){return new Promise(t=>Ld(e)(t))}function Ld(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function rv(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new zr(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}var Bo=Symbol.for("Jolibox.hostEmitter"),nv=()=>{let e=new Ko;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]},uC=nv();function iv(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)av(e[n],t[n])}function av(e,t){if(Nd(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Pd(t)){try{if(e instanceof t)return}catch(r){}if(!Bp(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 zo=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new zr,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 iv(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}};zo=xd([Dd],zo);var Id=class{constructor(){this._onWillExecuteCommand=new zr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new zr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new zo,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Dp(3e4)),this._starActivation}executeCommand(e,...t){return Pp(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Wo.toPromise(Wo.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};Id=xd([Dd],Id);var fC=Symbol.for("Jolibox.commands");Ce("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ce("requestProductDetailsAsync",{version:102e4});Ce("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ce("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ce("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ce("userTrackAsync",{version:1e6});Ce("openMiniapp",{version:1050100});Ce("requestCoinDetailsSync",{version:1070100});Ce("requestCoinDetailsAsync",{version:1070100});Ce("sendServerEventAsync",{version:1070100});Ce("requestGameLeaderboardSync",{version:108e4});Ce("requestGameLeaderboardAsync",{version:108e4});Ce("notifyTaskGameInfoAsync",{version:1080100});Ce("loadAdsAsync",{version:1070200});Ce("showAdAsync",{version:1070200});Ce("onJoliboxHideLoading",{version:1070300});function Ce(e,t){if(qo.config[e]){Ai.warn(`[can i use] ${e} already registered`);return}qo.config[e]=yt({},t)}var Ud=(e,t)=>{function r(i){var a;let[o,...s]=i.split(":");if(!o)return!1;let l=qo.config[o];if(!l)return!1;let c=(a=t==null?void 0:t())!=null?a:"",h=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(h=p)}if(typeof h!="number")return!1;let u=e();return typeof u!="number"||u<h?!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=Vp(i,a);if(!s)return!1;if(fr(s)){let l=s.version;return wd(l)?typeof o=="number"&&o>=l:!0}return wd(s)?typeof o=="number"&&o>=s:s===!0}return{canIUseNative:r}};function Ad(e,t){return`[${e}]:${t}`}var ov=()=>Xp(),Wr="custom_event_",sv=[],lv=[],cv=["env","createRequestTask","login"],Bd="__batch_event__",dv="__native_batch_event__",uv=e=>e==="pv"?e:"default",bi=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=uv(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&&fr(o))throw new Uo(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(fr(o))l.push(...Object.keys(o));else if(Nd(o)){if(i.length>0)throw new Uo(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(o)}else throw new Uo(`expected metric value to be a string, but got a(n) ${typeof o}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let h=fr(o)?o[c]:o;t(n[c],[...i],a,h)})}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={}}},Sd=!1,Mo,Go,Jo;function fv(e,t){Sd||(Mo=new bi({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Go=new bi({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Jo=new bi({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Mo.flush(),Go.flush(),Jo.flush()}),Sd=!0);function r(i){var a,o;let{method:s,args:l,startTime:c,isForeground:h,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:b,invokeCallback:E}=m,A=(o=(a=u.match(/\S:(\S+)\s?/))==null?void 0:a[1])!=null?o:"fail";Mo.report({status:A,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:h,duration:Date.now()-c}),c&&b&&E&&(Go.report({status:A,method:s,isForeground:h,duration:Number((b-c).toFixed(3))}),Jo.report({status:A,method:s,isForeground:h,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 Fo=[],hv=!1,Yo=Symbol.for("Jolibox.invokeResolverInstance"),mv=new Map;globalThis[Yo]||(globalThis[Yo]=mv);var pv={get resolveMap(){return globalThis[Yo]}};function vv(e,t){let r=0,n=!0,i=pv.resolveMap,a=fv(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Fo.forEach(l=>Ei(this,[l],function*({method:c,args:h,resolve:u}){let p=yield s(c,h);u(p)})),Fo.length=0});let o=(l,c)=>{let h=i.get(Number(l));if(!h)return;let u=jo(c);h(u),i.delete(Number(l))},s=(l,c)=>{var h,u;let p=Date.now(),m=`${n}`;r+=1;let b=new Lp;if(i.set(r,b.resolve),!n&&lv.includes(l))return new Promise(D=>{Fo.push({method:l,args:c,resolve:D})});let E=Sp(yt({},{method:l,startTime:p,args:c,isForeground:m}),{invokeType:"js-bridge"}),A=!hv&&sv.includes(l),w=Tp(c,A),R=A?w:JSON.stringify(w),O;if(l.endsWith("Sync")||cv.includes(l)?O=(h=e.call)==null?void 0:h.call(e,l,w,r):typeof R=="string"?O=e.invoke(l,R,r):O=(u=e.call)==null?void 0:u.call(e,l,R,r),O){try{typeof O=="string"&&(O=JSON.parse(O)),O=jo(O)}catch(D){Ai.error(D)}return i.delete(r),O.errorCode&&(O.errorCode=Ad(l,O.errorCode)),a(yt(yt({},E),O)),O}return l.endsWith("Sync")&&i.delete(r),b.promise.then(D=>(D.errorCode&&(D.errorCode=Ad(l,D.errorCode)),a(yt(yt({},E),D)),D))};return{invokeNative:s,applyNative:(l,c)=>{let h=s(l,c);return Mp(h)?h.then(u=>Cd(l,u)):Cd(l,h)},invokeHandler:o}}function Cd(e,t){if(!fr(t)){Ai.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:a,errorCode:o}=r,s=Cp(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new jp(n,i,a,o);return s}var yi=Symbol.for("Jolibox.subscribeInstance");function gv(e){if(globalThis[yi])return globalThis[yi];let t=new Ko,r=new Ko,n=new bi({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[yi]={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=jo(a),l;if(s.__extra){l=s.params;let{type:c,startTime:h}=s.__extra;n.report({type:c,event:i,duration:Date.now()-h})}else l=s;if(i===Bd){l.forEach(c=>{let[h,u]=c;try{r.emit(h.slice(Wr.length),u,o)}catch(p){}});return}if(i.startsWith(Wr)){r.emit(i.slice(Wr.length),l,o);return}t.emit(i,l,o)}},globalThis[yi]}function _v(e){let t=new Map,r=new Map,n,i;return{publish:(a,o,s,l)=>{if(l){let h=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Wr}${a}`,o,h);return}n||(n=Promise.resolve().then(()=>{t.forEach((h,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(Bd,h,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Wr}${a}`,o])},emitNative:(a,o,s,l)=>{if(l){let h=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(a,o,h),console.log("emitNative",a,o,h);return}i||(i=Promise.resolve().then(()=>{r.forEach((h,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(dv,h,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([a,o])}}}function yv(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:a}=gv(e),{invokeNative:o,invokeHandler:s,applyNative:l}=vv(e,r),{publish:c,emitNative:h}=_v(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:o,onNative:r,offNative:n,emitNative:h,publish:c,subscribe:i,unsubscribe:a}}function Md(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Xo,Nt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Nt.trigger=e},onDoExit(e){Nt.exit=e},onDoBackPress(e){Nt.backPress=e}},Gd=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Fp("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="")=>{Nt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ei(void 0,null,function*(){let a=yield Nt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:a})});Xo={onDocumentReady:t,doExit:r,invoke(i,a,o){e.invoke.postMessage({event:i,paramsString:a,callbackId:o})},publish(i,a,o){let s=Md(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:Gd,doExit:r};globalThis.joliboxJSCore=yt({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(a="")=>{Nt.trigger(),t.onDocumentReady(JSON.stringify({path:a}))},n=a=>Ei(void 0,null,function*(){let o=yield Nt.exit();t.doExit(JSON.stringify({uuid:a,shouldInterrupt:o}))});Xo={onDocumentReady:r,invoke(a,o,s){t.invoke(JSON.stringify({event:a,paramsString:o,callbackId:s}))},doExit:n,publish(a,o,s){let l=Md(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 Ei(this,null,function*(){let o=yield Nt.backPress();t.doBackPress(JSON.stringify({uuid:a,shouldInterrupt:o}))})}};let i={onDocumentReady:r,env:Gd,doExit:n};globalThis.joliboxJSCore=yt({},i)}var Jd=Xo;if(!Jd&&ov())throw new Hp("No joliboxJScore is found, native bridge not found.");var bv=yt({},Jd),Fd=yv(bv),{invokeHandler:Rd}=Fd,{applyNative:hC,invokeNative:Si,onNative:jd,offNative:Hd,subscribeHandler:wv,publish:mC,emitNative:pC,subscribe:vC,unsubscribe:gC}=Fd;globalThis.joliboxJSBridge={callHandler:Rd,invokeHandler:Rd,subscribeHandler:wv};var Ev=Object.defineProperty,Iv=Object.defineProperties,Av=Object.getOwnPropertyDescriptors,Mi=Object.getOwnPropertySymbols,gu=Object.prototype.hasOwnProperty,_u=Object.prototype.propertyIsEnumerable,qd=(e,t,r)=>t in e?Ev(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yu=(e,t)=>{for(var r in t||(t={}))gu.call(t,r)&&qd(e,r,t[r]);if(Mi)for(var r of Mi(t))_u.call(t,r)&&qd(e,r,t[r]);return e},Sv=(e,t)=>Iv(e,Av(t)),Cv=(e,t)=>{var r={};for(var n in e)gu.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Mi)for(var n of Mi(e))t.indexOf(n)<0&&_u.call(e,n)&&(r[n]=e[n]);return r},bu=Object.defineProperty,Rv=Object.defineProperties,Ov=Object.getOwnPropertyDescriptors,Vd=Object.getOwnPropertySymbols,kv=Object.prototype.hasOwnProperty,Tv=Object.prototype.propertyIsEnumerable,$d=(e,t,r)=>t in e?bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xv=(e,t)=>{for(var r in t||(t={}))kv.call(t,r)&&$d(e,r,t[r]);if(Vd)for(var r of Vd(t))Tv.call(t,r)&&$d(e,r,t[r]);return e},Nv=(e,t)=>Rv(e,Ov(t)),Pv=(e,t)=>{for(var r in t)bu(e,r,{get:t[r],enumerable:!0})},wu=(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},Dv=(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 Lv(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Uv(e){return typeof e=="string"}function Bv(e){return typeof e=="undefined"}function Mv(e){return Bv(e)||e===null}function Gv(e){return typeof e=="function"}function Eu(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 Jv=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(Jv||{});function Yr(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var Fv={log:Yr("log"),warn:Yr("warn"),info:Yr("info"),error:Yr("error"),debug:Yr("debug")};Object.assign(globalThis,{logger:Fv});var Kd=Symbol.for("Jolibox.canIUseMap"),jv={};globalThis[Kd]||(globalThis[Kd]=jv);var Wd=Symbol.for("Jolibox.canIUseMap.native"),Hv={};globalThis[Wd]||(globalThis[Wd]=Hv);var Iu=(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))(Iu||{}),Au=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Au||{}),Su=(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))(Su||{}),zd=["name","params"],qv=["name","type","location","target","extra","timestamp","userId"],Vv=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function Ti(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 $v(e){let t=e.location?Ti(e.location,zd):null,r=e.target?Ti(e.target,zd):null;return Ti(Nv(xv({},e),{location:t,target:r}),qv)}function Kv(e){let t=e.events.map(n=>$v(n)),r=Ti(e.device,Vv);return[e.protocolVersion,t,r,e.project]}function Wv(){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}}Wv();var pr=typeof window=="undefined",Gi=()=>!pr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!pr&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!pr&&navigator.userAgent.includes("Android"),!pr&&navigator.userAgent.includes("Mac"),!pr&&navigator.userAgent.includes("FB_IAB"),!pr&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var os=class ss{constructor(t){this.element=t,this.next=ss.Undefined,this.prev=ss.Undefined}};os.Undefined=new os(void 0);var ce=os,zv=class{constructor(){this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ce.Undefined}clear(){let e=this._first;for(;e!==ce.Undefined;){let t=e.next;e.prev=ce.Undefined,e.next=ce.Undefined,e=t}this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ce(e);if(this._first===ce.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!==ce.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ce.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ce.Undefined&&e.next!==ce.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ce.Undefined&&e.next===ce.Undefined?(this._first=ce.Undefined,this._last=ce.Undefined):e.next===ce.Undefined?(this._last=this._last.prev,this._last.next=ce.Undefined):e.prev===ce.Undefined&&(this._first=this._first.next,this._first.prev=ce.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ce.Undefined;)yield e.element,e=e.next}},Yv=0,Xr=class{constructor(e){this.value=e,this.id=Yv++}},rn=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 Xr&&(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 Xr(e);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,(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,h,u,p;if(!this._disposed){if(this._listeners instanceof Xr)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(h=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||h.call(c));else if(this._listeners){let m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,1),this._size--,this._size===0&&((p=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||p.call(u)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Xr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Xv=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 rn,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 zv,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)}},ls={};Pv(ls,{None:()=>Qv,filter:()=>eg,once:()=>Cu,toPromise:()=>Zv});var Qv=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Zv(e){return new Promise(t=>Cu(e)(t))}function Cu(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 eg(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new rn(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 Qo=Symbol.for("Jolibox.hostEmitter"),tg=()=>{let e=new Xv;return globalThis[Qo]||(globalThis[Qo]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Qo]};tg();function rg(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ng(e[n],t[n])}function ng(e,t){if(Uv(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gv(t)){try{if(e instanceof t)return}catch(r){}if(!Mv(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 cs=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new rn,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 rg(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}};cs=wu([Eu],cs);var Yd=class{constructor(){this._onWillExecuteCommand=new rn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new rn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new cs,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Lv(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 Dv(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),ls.toPromise(ls.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{}}};Yd=wu([Eu],Yd);function Me(e,t,r){return(t=ig(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ig(e){var t=ag(e,"string");return typeof t=="symbol"?t:t+""}function ag(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hr=e=>e?function(){try{for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e==null||e(...r)}catch(i){console.error("Error calling function",i)}}:()=>{console.log("wrapUserFunction: fn is undefined")},ds=class{constructor(t){Me(this,"context",void 0),Me(this,"continueCallback",void 0),Me(this,"adIsShowingCallback",void 0),Me(this,"isBeforeAdCalled",!1),Me(this,"isBeforeRewardCalled",!1),Me(this,"isAdDismissedCalled",!1),Me(this,"isAdViewedCalled",!1),Me(this,"isAfterAdCalled",!1),Me(this,"currentProvider",void 0),Me(this,"currentClientParams",void 0),Me(this,"adsHasResponse",!1),Me(this,"videoChecker",window.document.createElement("video")),Me(this,"contextInfo",void 0),Me(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",yu({userEvent:o},this.paramsToTrack)),Gi()&&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=hr(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=hr(t);o==null||o(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),Gi()&&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=hr(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=hr(t);r==null||r()}}}wrapAfterAd(t){return()=>{if(this.adsHasResponse=!0,this.context.track("CallAfterAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AFTER_AD",this.paramsToTrack),!this.isAfterAdCalled){this.isAfterAdCalled=!0;let r=hr(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,a,o,s,l,c,h,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 p=hr(t);p==null||p(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(h=this.continueCallback)==null||h.call(this,[!1,r]);break}default:{(u=this.continueCallback)==null||u.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return I(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,h,u,p,m;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(h=(c=this.currentProvider)==null?void 0:c.name)!=null?h:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(u=r.name)!=null?u:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(m=this.adIsShowingCallback)==null||m.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),t.adBreak(o,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};function Ci(e,t,r){return(t=og(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function og(e){var t=sg(e,"string");return typeof t=="symbol"?t:t+""}function sg(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){Ci(this,"context",void 0),Ci(this,"adBreakIsShowing",!1),Ci(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Ci(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 Ri(e,t,r){return(t=lg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lg(e){var t=cg(e,"string");return typeof t=="symbol"?t:t+""}function cg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fs=class{constructor(t){Ri(this,"configs",null),Ri(this,"firstRun",!0),Ri(this,"context",void 0),Ri(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return I(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 bt(e,t,r){return(t=dg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dg(e){var t=ug(e,"string");return typeof t=="symbol"?t:t+""}function ug(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{constructor(t,r){bt(this,"name","ADSENSE"),bt(this,"context",void 0),bt(this,"contextInfo",void 0),bt(this,"configured",!1),bt(this,"initParams",void 0),bt(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),bt(this,"adConfig",n=>{let i=n,{onReady:a}=i,o=Cv(i,["onReady"]);this.context.track("CallAdConfig",o),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),bt(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),bt(this,"adUnit",n=>I(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:h,fullWidthResponsive:u,style:p}=n,m;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?m=document.querySelector(l):m=l,!m)throw new Error("targeting element not found");let b=c;if(b||(b=this.initParams.unitId),!b)throw new Error("slot is required");let E=typeof h=="object"&&Array.isArray(h)?h.join(", "):h,A=document.createElement("ins");if(A.className="adsbygoogle",A.id="jolibox-ads",A.style.display="block",A.setAttribute("data-ad-client",this.initParams.clientId),A.setAttribute("data-ad-slot",b),E&&A.setAttribute("data-ad-format",E),u&&A.setAttribute("data-full-width-responsive",u),p&&A.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",A.style.position="relative",m.appendChild(A),A.appendChild(w)}else m.appendChild(A),new MutationObserver(w=>{w.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let O=A.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:O!=null?O:"null"})}})}).observe(A,{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 I(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 fg(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 hg(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 mg=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(hg(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=fg(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}(),Oe="-ms-",Ji="-moz-",Q="-webkit-",Ru="comm",Ms="rule",Gs="decl",pg="@import",Ou="@keyframes",vg="@layer",gg=Math.abs,Ki=String.fromCharCode,_g=Object.assign;function yg(e,t){return Ee(e,0)^45?(((t<<2^Ee(e,0))<<2^Ee(e,1))<<2^Ee(e,2))<<2^Ee(e,3):0}function ku(e){return e.trim()}function bg(e,t){return(e=t.exec(e))?e[0]:e}function Z(e,t,r){return e.replace(t,r)}function ms(e,t){return e.indexOf(t)}function Ee(e,t){return e.charCodeAt(t)|0}function nn(e,t,r){return e.slice(t,r)}function st(e){return e.length}function Js(e){return e.length}function Oi(e,t){return t.push(e),e}function wg(e,t){return e.map(t).join("")}var Wi=1,_r=1,Tu=0,Je=0,ge=0,yr="";function zi(e,t,r,n,i,a,o){return{value:e,root:t,parent:r,type:n,props:i,children:a,line:Wi,column:_r,length:o,return:""}}function Qr(e,t){return _g(zi("",null,null,"",null,null,0),e,{length:-e.length},t)}function Eg(){return ge}function Ig(){return ge=Je>0?Ee(yr,--Je):0,_r--,ge===10&&(_r=1,Wi--),ge}function Ve(){return ge=Je<Tu?Ee(yr,Je++):0,_r++,ge===10&&(_r=1,Wi++),ge}function lt(){return Ee(yr,Je)}function xi(){return Je}function ln(e,t){return nn(yr,e,t)}function an(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 xu(e){return Wi=_r=1,Tu=st(yr=e),Je=0,[]}function Nu(e){return yr="",e}function Ni(e){return ku(ln(Je-1,ps(e===91?e+2:e===40?e+1:e)))}function Ag(e){for(;(ge=lt())&&ge<33;)Ve();return an(e)>2||an(ge)>3?"":" "}function Sg(e,t){for(;--t&&Ve()&&!(ge<48||ge>102||ge>57&&ge<65||ge>70&&ge<97););return ln(e,xi()+(t<6&&lt()==32&&Ve()==32))}function ps(e){for(;Ve();)switch(ge){case e:return Je;case 34:case 39:e!==34&&e!==39&&ps(ge);break;case 40:e===41&&ps(e);break;case 92:Ve();break}return Je}function Cg(e,t){for(;Ve()&&e+ge!==57&&!(e+ge===84&&lt()===47););return"/*"+ln(t,Je-1)+"*"+Ki(e===47?e:Ve())}function Rg(e){for(;!an(lt());)Ve();return ln(e,Je)}function Og(e){return Nu(Pi("",null,null,null,[""],e=xu(e),0,[0],e))}function Pi(e,t,r,n,i,a,o,s,l){for(var c=0,h=0,u=o,p=0,m=0,b=0,E=1,A=1,w=1,R=0,O="",D=i,M=a,S=n,N=O;A;)switch(b=R,R=Ve()){case 40:if(b!=108&&Ee(N,u-1)==58){ms(N+=Z(Ni(R),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:N+=Ni(R);break;case 9:case 10:case 13:case 32:N+=Ag(b);break;case 92:N+=Sg(xi()-1,7);continue;case 47:switch(lt()){case 42:case 47:Oi(kg(Cg(Ve(),xi()),t,r),l);break;default:N+="/"}break;case 123*E:s[c++]=st(N)*w;case 125*E:case 59:case 0:switch(R){case 0:case 125:A=0;case 59+h:w==-1&&(N=Z(N,/\f/g,"")),m>0&&st(N)-u&&Oi(m>32?Qd(N+";",n,r,u-1):Qd(Z(N," ","")+";",n,r,u-2),l);break;case 59:N+=";";default:if(Oi(S=Xd(N,t,r,c,h,i,s,O,D=[],M=[],u),a),R===123)if(h===0)Pi(N,t,S,S,D,a,u,s,M);else switch(p===99&&Ee(N,3)===110?100:p){case 100:case 108:case 109:case 115:Pi(e,S,S,n&&Oi(Xd(e,S,S,0,0,i,s,O,i,D=[],u),M),i,M,u,s,n?D:M);break;default:Pi(N,S,S,S,[""],M,0,s,M)}}c=h=m=0,E=w=1,O=N="",u=o;break;case 58:u=1+st(N),m=b;default:if(E<1){if(R==123)--E;else if(R==125&&E++==0&&Ig()==125)continue}switch(N+=Ki(R),R*E){case 38:w=h>0?1:(N+="\f",-1);break;case 44:s[c++]=(st(N)-1)*w,w=1;break;case 64:lt()===45&&(N+=Ni(Ve())),p=lt(),h=u=st(O=N+=Rg(xi())),R++;break;case 45:b===45&&st(N)==2&&(E=0)}}return a}function Xd(e,t,r,n,i,a,o,s,l,c,h){for(var u=i-1,p=i===0?a:[""],m=Js(p),b=0,E=0,A=0;b<n;++b)for(var w=0,R=nn(e,u+1,u=gg(E=o[b])),O=e;w<m;++w)(O=ku(E>0?p[w]+" "+R:Z(R,/&\f/g,p[w])))&&(l[A++]=O);return zi(e,t,r,i===0?Ms:s,l,c,h)}function kg(e,t,r){return zi(e,t,r,Ru,Ki(Eg()),nn(e,2,-2),0)}function Qd(e,t,r,n){return zi(e,t,r,Gs,nn(e,0,n),nn(e,n+1,-1),n)}function gr(e,t){for(var r="",n=Js(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function Tg(e,t,r,n){switch(e.type){case vg:if(e.children.length)break;case pg:case Gs:return e.return=e.return||e.value;case Ru:return"";case Ou:return e.return=e.value+"{"+gr(e.children,n)+"}";case Ms:e.value=e.props.join(",")}return st(r=gr(e.children,n))?e.return=e.value+"{"+r+"}":""}function xg(e){var t=Js(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 Ng(e){return function(t){t.root||(t=t.return)&&e(t)}}function Pg(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Dg=function(e,t,r){for(var n=0,i=0;n=i,i=lt(),n===38&&i===12&&(t[r]=1),!an(i);)Ve();return ln(e,Je)},Lg=function(e,t){var r=-1,n=44;do switch(an(n)){case 0:n===38&&lt()===12&&(t[r]=1),e[r]+=Dg(Je-1,t,r);break;case 2:e[r]+=Ni(n);break;case 4:if(n===44){e[++r]=lt()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Ki(n)}while(n=Ve());return e},Ug=function(e,t){return Nu(Lg(xu(e),t))},Zd=new WeakMap,Bg=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&&!Zd.get(r))&&!n){Zd.set(e,!0);for(var i=[],a=Ug(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]}}},Mg=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function Pu(e,t){switch(yg(e,t)){case 5103:return Q+"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 Q+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Q+e+Ji+e+Oe+e+e;case 6828:case 4268:return Q+e+Oe+e+e;case 6165:return Q+e+Oe+"flex-"+e+e;case 5187:return Q+e+Z(e,/(\w+).+(:[^]+)/,Q+"box-$1$2"+Oe+"flex-$1$2")+e;case 5443:return Q+e+Oe+"flex-item-"+Z(e,/flex-|-self/,"")+e;case 4675:return Q+e+Oe+"flex-line-pack"+Z(e,/align-content|flex-|-self/,"")+e;case 5548:return Q+e+Oe+Z(e,"shrink","negative")+e;case 5292:return Q+e+Oe+Z(e,"basis","preferred-size")+e;case 6060:return Q+"box-"+Z(e,"-grow","")+Q+e+Oe+Z(e,"grow","positive")+e;case 4554:return Q+Z(e,/([^-])(transform)/g,"$1"+Q+"$2")+e;case 6187:return Z(Z(Z(e,/(zoom-|grab)/,Q+"$1"),/(image-set)/,Q+"$1"),e,"")+e;case 5495:case 3959:return Z(e,/(image-set\([^]*)/,Q+"$1$`$1");case 4968:return Z(Z(e,/(.+:)(flex-)?(.*)/,Q+"box-pack:$3"+Oe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Q+e+e;case 4095:case 3583:case 4068:case 2532:return Z(e,/(.+)-inline(.+)/,Q+"$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(st(e)-1-t>6)switch(Ee(e,t+1)){case 109:if(Ee(e,t+4)!==45)break;case 102:return Z(e,/(.+:)(.+)-([^]+)/,"$1"+Q+"$2-$3$1"+Ji+(Ee(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~ms(e,"stretch")?Pu(Z(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ee(e,t+1)!==115)break;case 6444:switch(Ee(e,st(e)-3-(~ms(e,"!important")&&10))){case 107:return Z(e,":",":"+Q)+e;case 101:return Z(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Q+(Ee(e,14)===45?"inline-":"")+"box$3$1"+Q+"$2$3$1"+Oe+"$2box$3")+e}break;case 5936:switch(Ee(e,t+11)){case 114:return Q+e+Oe+Z(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Q+e+Oe+Z(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Q+e+Oe+Z(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Q+e+Oe+e+e}return e}var Gg=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Gs:e.return=Pu(e.value,e.length);break;case Ou:return gr([Qr(e,{value:Z(e.value,"@","@"+Q)})],n);case Ms:if(e.length)return wg(e.props,function(i){switch(bg(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return gr([Qr(e,{props:[Z(i,/:(read-\w+)/,":"+Ji+"$1")]})],n);case"::placeholder":return gr([Qr(e,{props:[Z(i,/:(plac\w+)/,":"+Q+"input-$1")]}),Qr(e,{props:[Z(i,/:(plac\w+)/,":"+Ji+"$1")]}),Qr(e,{props:[Z(i,/:(plac\w+)/,Oe+"input-$1")]})],n)}return""})}},Jg=[Gg],Fg=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(b){var E=b.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var n=e.stylisPlugins||Jg,i={},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(" "),A=1;A<E.length;A++)i[E[A]]=!0;o.push(b)});var s,l=[Bg,Mg];{var c,h=[Tg,Ng(function(b){c.insert(b)})],u=xg(l.concat(n,h)),p=function(b){return gr(Og(b),u)};s=function(b,E,A,w){c=A,p(b?b+"{"+E.styles+"}":E.styles),w&&(m.inserted[E.name]=!0)}}var m={key:t,sheet:new mg({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 m.sheet.hydrate(o),m};function jg(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 Hg={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},qg=/[A-Z]|^ms/g,Vg=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Du=function(e){return e.charCodeAt(1)===45},eu=function(e){return e!=null&&typeof e!="boolean"},Zo=Pg(function(e){return Du(e)?e:e.replace(qg,"-$&").toLowerCase()}),tu=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(Vg,function(r,n,i){return Lt={name:n,styles:i,next:Lt},n})}return Hg[e]!==1&&!Du(e)&&typeof t=="number"&&t!==0?t+"px":t};function Fi(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 Lt={name:i.name,styles:i.styles,next:Lt},i.name;var a=r;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)Lt={name:o.name,styles:o.styles,next:Lt},o=o.next;var s=a.styles+";";return s}return $g(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function $g(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Fi(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]+"}":eu(s)&&(n+=Zo(a)+":"+tu(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++)eu(o[l])&&(n+=Zo(a)+":"+tu(a,o[l])+";");else{var c=Fi(e,t,o);switch(a){case"animation":case"animationName":{n+=Zo(a)+":"+c+";";break}default:n+=a+"{"+c+"}"}}}return n}var ru=/label:\s*([^\s;{]+)\s*(;|$)/g,Lt;function es(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="";Lt=void 0;var a=e[0];if(a==null||a.raw===void 0)n=!1,i+=Fi(r,t,a);else{var o=a;i+=o[0]}for(var s=1;s<e.length;s++)if(i+=Fi(r,t,e[s]),n){var l=a;i+=l[s]}ru.lastIndex=0;for(var c="",h;(h=ru.exec(i))!==null;)c+="-"+h[1];var u=jg(i)+c;return{name:u,styles:i,next:Lt}}function Lu(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}var Kg=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},Wg=function(e,t,r){Kg(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 nu(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function iu(e,t,r){var n=[],i=Lu(e,n,r);return n.length<2?r:i+t(n)}var zg=function(e){var t=Fg(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=es(s,t.registered,void 0);return Wg(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=es(s,t.registered),h="animation-"+c.name;return nu(t,{name:c.name,styles:"@keyframes "+h+"{"+c.styles+"}"}),h},i=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var c=es(s,t.registered);nu(t,c)},a=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return iu(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:Lu.bind(null,t.registered),merge:iu.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},Xg=zg({key:"css"}),Te=Xg.css,vs,qe,ts,au,ou=0,Uu=[],_e=H,su=_e.__b,lu=_e.__r,cu=_e.diffed,du=_e.__c,uu=_e.unmount,fu=_e.__;function Qg(e,t){_e.__h&&_e.__h(qe,e,ou||t),ou=0;var r=qe.__H||(qe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Bu(e,t){var r=Qg(vs++,7);return t_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Zg(){for(var e;e=Uu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Di),e.__H.__h.forEach(gs),e.__H.__h=[]}catch(t){e.__H.__h=[],_e.__e(t,e.__v)}}_e.__b=function(e){qe=null,su&&su(e)},_e.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),fu&&fu(e,t)},_e.__r=function(e){lu&&lu(e),vs=0;var t=(qe=e.__c).__H;t&&(ts===qe?(t.__h=[],qe.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Di),t.__h.forEach(gs),t.__h=[],vs=0)),ts=qe},_e.diffed=function(e){cu&&cu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Uu.push(t)!==1&&au===_e.requestAnimationFrame||((au=_e.requestAnimationFrame)||e_)(Zg)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),ts=qe=null},_e.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Di),r.__h=r.__h.filter(function(n){return!n.__||gs(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],_e.__e(n,r.__v)}}),du&&du(e,t)},_e.unmount=function(e){uu&&uu(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Di(n)}catch(i){t=i}}),r.__H=void 0,t&&_e.__e(t,r.__v))};var hu=typeof requestAnimationFrame=="function";function e_(e){var t,r=function(){clearTimeout(n),hu&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);hu&&(t=requestAnimationFrame(r))}function Di(e){var t=qe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),qe=t}function gs(e){var t=qe;e.__c=e.__(),qe=t}function t_(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var r_=Symbol.for("preact-signals");function Yi(){if(Ut>1)Ut--;else{for(var e,t=!1;en!==void 0;){var r=en;for(en=void 0,_s++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Gu(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(_s=0,Ut--,t)throw e}}function ue(e){if(Ut>0)return e();Ut++;try{return e()}finally{Yi()}}var ie=void 0,en=void 0,Ut=0,_s=0,ji=0;function Mu(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 Ie(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Ie.prototype.brand=r_;Ie.prototype.h=function(){return!0};Ie.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)};Ie.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)}};Ie.prototype.subscribe=function(e){var t=this;return dn(function(){var r=t.value,n=ie;ie=void 0;try{e(r)}finally{ie=n}})};Ie.prototype.valueOf=function(){return this.value};Ie.prototype.toString=function(){return this.value+""};Ie.prototype.toJSON=function(){return this.value};Ie.prototype.peek=function(){var e=ie;ie=void 0;try{return this.value}finally{ie=e}};Object.defineProperty(Ie.prototype,"value",{get:function(){var e=Mu(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(_s>100)throw new Error("Cycle detected");this.v=e,this.i++,ji++,Ut++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Yi()}}}});function Y(e){return new Ie(e)}function Gu(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 Ju(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 Fu(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 br(e){Ie.call(this,void 0),this.x=e,this.s=void 0,this.g=ji-1,this.f=4}(br.prototype=new Ie).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ji))return!0;if(this.g=ji,this.f|=1,this.i>0&&!Gu(this))return this.f&=-2,!0;var e=ie;try{Ju(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,Fu(this),this.f&=-2,!0};br.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)}Ie.prototype.S.call(this,e)};br.prototype.U=function(e){if(this.t!==void 0&&(Ie.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)}};br.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(br.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Mu(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function tn(e){return new br(e)}function ju(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Ut++;var r=ie;ie=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Fs(e),n}finally{ie=r,Yi()}}}function Fs(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ju(e)}function n_(e){if(ie!==this)throw new Error("Out-of-order effect");Fu(this),ie=e,this.f&=-2,8&this.f&&Fs(this),Yi()}function cn(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}cn.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()}};cn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ju(this),Ju(this),Ut++;var e=ie;return ie=this,n_.bind(this,e)};cn.prototype.N=function(){2&this.f||(this.f|=2,this.o=en,en=this)};cn.prototype.d=function(){this.f|=8,1&this.f||Fs(this)};function dn(e){var t=new cn(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Hu,rs,qu=[];dn(function(){Hu=this.N})();function wr(e,t){H[e]=t.bind(null,H[e]||function(){})}function Hi(e){rs&&rs(),rs=e&&e.S()}function Vu(e){var t=this,r=e.data,n=$u(r);n.value=r;var i=Bu(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=tn(function(){var m=n.value.value;return m===0?0:m===!0?"":m||""}),h=tn(function(){return!Array.isArray(c.value)&&!Co(c.value)}),u=dn(function(){if(this.N=Ku,h.value){var m=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=m)}}),p=t.__$u.d;return t.__$u.d=function(){u(),p.call(this)},[h,c]},[]),a=i[0],o=i[1];return a.value?o.peek():o.value}Vu.displayName="_st";Object.defineProperties(Ie.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Vu},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});wr("__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 Ie&&(r||(t.__np=r={}),r[i]=a,n[i]=a.peek())}}e(t)});wr("__r",function(e,t){Hi();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var a;return dn(function(){a=this}),a.c=function(){n.__$f|=1,n.setState({})},a}())),Hi(r),e(t)});wr("__e",function(e,t,r,n){Hi(),e(t,r,n)});wr("diffed",function(e,t){Hi();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],h=n[l];c===void 0?(c=i_(r,l,h,i),a[l]=c):c.o(h,i)}}}e(t)});function i_(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,a=Y(r);return{o:function(o,s){a.value=o,n=s},d:dn(function(){this.N=Ku;var o=a.value.value;n[t]!==o&&(n[t]=o,i?e[t]=o:o?e.setAttribute(t,o):e.removeAttribute(t))})}}wr("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)});wr("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});He.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 $u(e){return Bu(function(){return Y(e)},[])}var a_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function o_(){ue(function(){for(var e;e=qu.shift();)Hu.call(e)})}function Ku(){qu.push(this)===1&&(H.requestAnimationFrame||a_)(o_)}var ye=Te`
12
12
  inset: 0;
13
13
  clear: none;
14
14
  float: none;
@@ -26,8 +26,8 @@ or `);this.errors.push(a)}return n}},Nn=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 Gg(e,t){let r=si(e);wo(()=>{r.current=e},[e]),Jt(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}var Jg=0;function Q(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:--Jg,__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 H.vnode&&H.vnode(c),c}var Fg=Oe`
30
- ${ge}
29
+ `;function s_(e,t){let r=gi(e);Po(()=>{r.current=e},[e]),xt(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}var l_=0;function $(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:--l_,__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 H.vnode&&H.vnode(c),c}var c_=Te`
30
+ ${ye}
31
31
  position: fixed;
32
32
  top: 0;
33
33
  left: 0;
@@ -40,7 +40,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
40
40
  height: 100vh;
41
41
 
42
42
  .card-wrapper {
43
- ${ge}
43
+ ${ye}
44
44
  position: relative;
45
45
  display: flex;
46
46
  flex-direction: column;
@@ -54,7 +54,7 @@ or `);this.errors.push(a)}return n}},Nn=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
+ ${ye}
58
58
  display: flex;
59
59
  flex-direction: column;
60
60
  width: 100%;
@@ -63,7 +63,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
63
63
  box-sizing: border-box;
64
64
  justify-content: center;
65
65
  .title {
66
- ${ge}
66
+ ${ye}
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}},Nn=class extends me{constructor(...t){super
71
71
  }
72
72
 
73
73
  .content {
74
- ${ge}
74
+ ${ye}
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}},Nn=class extends me{constructor(...t){super
79
79
  }
80
80
 
81
81
  .footer {
82
- ${ge}
82
+ ${ye}
83
83
  display: flex;
84
84
  align-items: center;
85
85
  width: 100%;
86
86
  height: 40px;
87
87
  button {
88
- ${ge}
88
+ ${ye}
89
89
  border: none;
90
90
  outline: none;
91
91
  height: 100%;
@@ -101,8 +101,8 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
101
101
  }
102
102
  }
103
103
  }
104
- `,yt=z(null),os=z(""),ss=z(""),Si=z(!1),jg=()=>{var e;(e=yt.value)==null||e.call(yt,!1)},Hg=()=>{var e;(e=yt.value)==null||e.call(yt,!0)},qg=e=>I(void 0,null,function*(){let{title:t,content:r}=e;return yt.value&&(yt.value(!1),be(()=>{yt.value=null,Si.value=!1})),be(()=>{os.value=t||"",ss.value=r||"",Si.value=!0}),new Promise(n=>{yt.value=i=>{be(()=>{yt.value=null,Si.value=!1,os.value="",ss.value=""}),n(i)}})}),Vg=()=>Si.value?Q("div",{className:Fg,children:Q("div",{className:"card-wrapper",children:[Q("div",{className:"body",children:[Q("div",{className:"title",children:os.value}),Q("div",{className:"content",children:ss.value})]}),Q("div",{className:"footer",children:[Q("button",{onClick:jg,className:"cancel-btn",children:"Cancel"}),Q("button",{onClick:Hg,className:"confirm-btm",children:"Confirm"})]})]})}):null,$g=Oe`
105
- ${ge}
104
+ `,Ct=Y(null),ys=Y(""),bs=Y(""),Li=Y(!1),d_=()=>{var e;(e=Ct.value)==null||e.call(Ct,!1)},u_=()=>{var e;(e=Ct.value)==null||e.call(Ct,!0)},f_=e=>I(void 0,null,function*(){let{title:t,content:r}=e;return Ct.value&&(Ct.value(!1),ue(()=>{Ct.value=null,Li.value=!1})),ue(()=>{ys.value=t||"",bs.value=r||"",Li.value=!0}),new Promise(n=>{Ct.value=i=>{ue(()=>{Ct.value=null,Li.value=!1,ys.value="",bs.value=""}),n(i)}})}),h_=()=>Li.value?$("div",{className:c_,children:$("div",{className:"card-wrapper",children:[$("div",{className:"body",children:[$("div",{className:"title",children:ys.value}),$("div",{className:"content",children:bs.value})]}),$("div",{className:"footer",children:[$("button",{onClick:d_,className:"cancel-btn",children:"Cancel"}),$("button",{onClick:u_,className:"confirm-btm",children:"Confirm"})]})]})}):null,m_=Te`
105
+ ${ye}
106
106
  position: relative;
107
107
  display: flex;
108
108
  align-items: center;
@@ -120,7 +120,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
120
120
  }
121
121
 
122
122
  button {
123
- ${ge}
123
+ ${ye}
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}},Nn=class extends me{constructor(...t){super
134
134
  cursor: not-allowed;
135
135
  }
136
136
  }
137
- `,Kg=()=>{let e=z(!1),t=z(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{be(()=>{t.value=Date.now(),e.value=!1})}}},Wg=e=>{let{countdown:t=0,mode:r,onClose:n,state:i}=e,{startTimestamp:a,timerPaused:o}=i,s=ku(t);Gg(()=>{s.value>0?s.value-=1:be(()=>{o.value=!0,s.value=0})},o.value?null:1e3);let l=$r(()=>{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=$r(()=>{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}),m=$r(()=>r==="interstitial"?!1:!l.value&&!c.value),u=()=>I(void 0,null,function*(){if(o.value=!0,!(yield qg({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})}),p=()=>{n("viewed"),be(()=>{o.value=!0,s.value=0,a.value=null})};return Q("div",{className:$g,children:[s.value>0&&r!=="interstitial"&&Q("div",{className:"timer",children:[s.value,"s"]}),Q("button",{onClick:l.value?u:c.value?p:void 0,disabled:m.value,children:Q("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Q("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"})})})]})},zg=()=>{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}},Xg=Oe`
138
- ${ge}
137
+ `,p_=()=>{let e=Y(!1),t=Y(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{ue(()=>{t.value=Date.now(),e.value=!1})}}},v_=e=>{let{countdown:t=0,mode:r,onClose:n,state:i}=e,{startTimestamp:a,timerPaused:o}=i,s=$u(t);s_(()=>{s.value>0?s.value-=1:ue(()=>{o.value=!0,s.value=0})},o.value?null:1e3);let l=tn(()=>{if(r==="interstitial"||r==="rewarded_insterstitial"||!a.value)return!1;let m=Date.now()-a.value;return s.value>0&&t-s.value>=5&&m>=5e3}),c=tn(()=>{if(r==="interstitial")return!0;if(!a.value)return!1;let m=Date.now()-a.value;return s.value<=0&&m>=(t-1)*1e3&&t>5}),h=tn(()=>r==="interstitial"?!1:!l.value&&!c.value),u=()=>I(void 0,null,function*(){if(o.value=!0,!(yield f_({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){o.value=!1;return}n("dismiss"),ue(()=>{o.value=!0,s.value=0,a.value=null})}),p=()=>{n("viewed"),ue(()=>{o.value=!0,s.value=0,a.value=null})};return $("div",{className:m_,children:[s.value>0&&r!=="interstitial"&&$("div",{className:"timer",children:[s.value,"s"]}),$("button",{onClick:l.value?u:c.value?p:void 0,disabled:h.value,children:$("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$("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"})})})]})},Wu=()=>{let e=Y(),t=Y(),r=Y(),n=Y(),i=Y(),a=Y(!1),o=Y(15),s=Y(""),l=Y("reward");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,visible:a,countdown:o,src:s,mode:l}},g_=Te`
138
+ ${ye}
139
139
  position: fixed;
140
140
  z-index: 2147483647;
141
141
  background: white;
@@ -145,7 +145,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
145
145
  flex-direction: column;
146
146
 
147
147
  iframe {
148
- ${ge}
148
+ ${ye}
149
149
  flex: 1;
150
150
  position: relative;
151
151
  display: block;
@@ -153,22 +153,22 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
153
153
  width: 100%;
154
154
  height: 100%;
155
155
  }
156
- `,Qg=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,visible:s,countdown:l,src:c,mode:m}=t,u=Lr(()=>Kg(),[]),[p,h]=ft(!1),w=A=>{var b,R,k,L;s.value=!1,A==="dismiss"?(b=n.value)==null||b.call(n):A==="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=Ur(()=>{var A;p||(h(!0),(A=o.value)==null||A.call(o))},[p]);return Jt(()=>{p&&(m.value==="reward"||m.value==="rewarded_insterstitial")&&setTimeout(()=>{u.startTimer()},100)},[p,m.value]),s.value?Q("div",{className:Xg,children:[Q(Wg,{mode:m.value,onClose:w,countdown:l.value,state:u}),s.value&&Q("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"}),Q(Vg,{})]}):null};function pt(e,t,r){return(t=Yg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yg(e){var t=Zg(e,"string");return typeof t=="symbol"?t:t+""}function Zg(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){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",zg()),this.context=t,this.initParams=r}init(){return I(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),ci(Q(Qg,{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 I(this,null,function*(){var n,i,a,o,s,l,c,m;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}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)},p=()=>{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=p,this.state.src.value=r.params.url,this.state.mode.value="interstitial",this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(c=t.beforeAd)==null||c.call(t);let u=()=>{var b;this.adsIsShowing=!1,(b=t.afterAd)==null||b.call(t)},p={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},h=()=>{var b;this.adsIsShowing=!1,p.breakStatus="dismissed",(b=t.adDismissed)==null||b.call(t)},w=()=>{var b;this.adsIsShowing=!1,p.breakStatus="viewed",(b=t.adViewed)==null||b.call(t)},E=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,p)};be(()=>{this.state.afterAd.value=u,this.state.adDismissed.value=h,this.state.adViewed.value=w,this.state.adBreakDone.value=E});let A=()=>{var b;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(b=t.adBreakDone)==null||b.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,(m=t.beforeReward)==null||m.call(t,A);break}}})}},e_=()=>{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}},t_=Oe`
157
- ${ge}
156
+ `,zu=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,visible:s,countdown:l,src:c,mode:h}=t,u=qr(()=>p_(),[]),[p,m]=_t(!1),b=A=>{var w,R,O,D;s.value=!1,A==="dismiss"?(w=n.value)==null||w.call(n):A==="viewed"&&((R=i.value)==null||R.call(i)),(O=r.value)==null||O.call(r),(D=a.value)==null||D.call(a),m(!1)},E=Vr(()=>{var A;p||(m(!0),(A=o.value)==null||A.call(o))},[p]);return xt(()=>{p&&(h.value==="reward"||h.value==="rewarded_insterstitial")&&setTimeout(()=>{u.startTimer()},100)},[p,h.value]),s.value?$("div",{className:g_,children:[$(v_,{mode:h.value,onClose:b,countdown:l.value,state:u}),s.value&&$("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"}),$(h_,{})]}):null};function wt(e,t,r){return(t=__(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function __(e){var t=y_(e,"string");return typeof t=="symbol"?t:t+""}function y_(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 ws=class{constructor(t,r){wt(this,"name","OKSPIN"),wt(this,"initialized",!1),wt(this,"initCompleter",null),wt(this,"context",void 0),wt(this,"initParams",void 0),wt(this,"adsOverlay",null),wt(this,"adsIsShowing",!1),wt(this,"lastUnDisplayedAdBreak",null),wt(this,"state",Wu()),this.context=t,this.initParams=r}init(){return I(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),it($(zu,{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 I(this,null,function*(){var n,i,a,o,s,l,c,h;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}switch(t.type){case"preroll":{(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 m;this.adsIsShowing=!1,(m=t.afterAd)==null||m.call(t)},p=()=>{var m;this.adsIsShowing=!1,(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})};ue(()=>{this.adsIsShowing=!0,this.state.afterAd.value=u,this.state.adBreakDone.value=p,this.state.src.value=r.params.url,this.state.mode.value="interstitial",this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(c=t.beforeAd)==null||c.call(t);let u=()=>{var w;this.adsIsShowing=!1,(w=t.afterAd)==null||w.call(t)},p={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},m=()=>{var w;this.adsIsShowing=!1,p.breakStatus="dismissed",(w=t.adDismissed)==null||w.call(t)},b=()=>{var w;this.adsIsShowing=!1,p.breakStatus="viewed",(w=t.adViewed)==null||w.call(t)},E=()=>{var w;this.adsIsShowing=!1,(w=t.adBreakDone)==null||w.call(t,p)};ue(()=>{this.state.afterAd.value=u,this.state.adDismissed.value=m,this.state.adViewed.value=b,this.state.adBreakDone.value=E});let A=()=>{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,ue(()=>{var R;this.state.countdown.value=(R=r.params.countdown)!=null?R:15,this.state.src.value=r.params.url,this.state.mode.value="reward",this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(h=t.beforeReward)==null||h.call(t,A);break}}})}},b_=()=>{let e=Y(null),t=Y(null),r=Y(null),n=Y(null),i=Y(null),a=Y(null),o=Y(!1),s=Y(null);return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adError:a,visible:o,payload:s}},w_=Te`
157
+ ${ye}
158
158
  position: fixed;
159
159
  inset: 0;
160
160
  z-index: 2147483647;
161
161
  display: flex;
162
162
  background: #000000;
163
- `,r_=Oe`
164
- ${ge}
163
+ `,E_=Te`
164
+ ${ye}
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
- `,n_=Oe`
171
+ `,I_=Te`
172
172
  position: absolute;
173
173
  top: 24px;
174
174
  left: 24px;
@@ -179,23 +179,23 @@ or `);this.errors.push(a)}return n}},Nn=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
- `,i_=Oe`
182
+ `,A_=Te`
183
183
  font-size: 11px;
184
184
  letter-spacing: 0.08em;
185
185
  text-transform: uppercase;
186
186
  color: #c7d4ef;
187
- `,a_=Oe`
187
+ `,S_=Te`
188
188
  font-size: 14px;
189
189
  font-weight: 500;
190
- `,o_=Oe`
191
- ${ge}
190
+ `,C_=Te`
191
+ ${ye}
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
- `,Qd=Oe`
198
+ `,mu=Te`
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}},Nn=class extends me{constructor(...t){super
204
204
  justify-content: center;
205
205
  color: #6e7da1;
206
206
  font-size: 14px;
207
- `,s_=Oe`
207
+ `,R_=Te`
208
208
  position: absolute;
209
209
  bottom: 32px;
210
210
  right: 32px;
211
211
  display: flex;
212
212
  gap: 12px;
213
- `,l_=Oe`
213
+ `,O_=Te`
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}},Nn=class extends me{constructor(...t){super
226
226
  opacity: 0.4;
227
227
  cursor: not-allowed;
228
228
  }
229
- `,c_=Oe`
229
+ `,k_=Te`
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}},Nn=class extends me{constructor(...t){super
236
236
  font-size: 14px;
237
237
  font-weight: 500;
238
238
  cursor: pointer;
239
- `,d_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adError:s,visible:l,payload:c}=t,[m,u]=ft(!1),[p,h]=ft(0),[w,E]=ft(!1),[A,b]=ft(!1),[R,k]=ft("Loading next content..."),L=si(null),F=c.value,S=Ur(U=>{var M,J,V,$;u(!1),l.value=!1,U==="dismiss"?(M=n.value)==null||M.call(n):(J=i.value)==null||J.call(i),(V=r.value)==null||V.call(r),($=a.value)==null||$.call(a)},[l,n,i,r,a]),N=Ur(()=>{var U;u(!1),l.value=!1,(U=s.value)==null||U.call(s)},[l,s]);if(Jt(()=>{var U;if(!l.value||!F){h(0),E(!1),b(!1),k("Loading next content...");return}let M=F.mode==="reward"?15:0,J=Math.max(Math.floor((U=F.countdown)!=null?U:M),0);if(h(J),b(F.mode==="reward"?J===0:!0),E(F.mode==="interstitial"?J===0:!1),J===0)return;let V=J,$=window.setInterval(()=>{V-=1,h(Math.max(V,0)),V<=0&&(window.clearInterval($),F.mode==="reward"?b(!0):E(!0))},1e3);return()=>{window.clearInterval($)}},[l.value,F,S]),Jt(()=>{var U;if(!l.value||!F)return;let M=L.current;if(!M)return;if(M.innerHTML="",k("Loading next content..."),u(!1),F.testMode){let $=document.createElement("div");$.className=Qd,$.innerText="Preview slot placeholder",M.appendChild($),u(!0),(U=o.value)==null||U.call(o);return}if(typeof window=="undefined"){N();return}let J=document.createElement("ins");J.className="adsbygoogle",J.style.display="block",J.style.width="100%",J.style.height="100%",J.setAttribute("data-ad-client",F.clientId),J.setAttribute("data-ad-slot",F.unitId),J.setAttribute("data-ad-format","auto"),J.setAttribute("data-full-width-responsive","true"),F.channelId&&J.setAttribute("data-ad-channel",F.channelId),M.appendChild(J);let V=new MutationObserver(()=>{var $;let Ge=J.getAttribute("data-ad-status");Ge==="filled"?(u(!0),k(""),($=o.value)==null||$.call(o),V.disconnect()):Ge==="unfilled"&&(k("Slot currently unavailable."),u(!1),V.disconnect())});V.observe(J,{attributes:!0,attributeFilter:["data-ad-status"]});try{let $=window;$.adsbygoogle=$.adsbygoogle||[],$.adsbygoogle.push({})}catch($){V.disconnect(),N()}return()=>{V.disconnect(),M.innerHTML=""}},[l.value,F,o,N]),!l.value||!F)return null;let j=F.mode==="reward"?"Next content unlocking":"Content paused",q=p>0?`Content resumes in ${p}s`:"Content ready";return Q("div",{className:t_,children:Q("div",{className:r_,children:[Q("div",{className:n_,children:[Q("div",{className:i_,children:j}),Q("div",{className:a_,children:q})]}),Q("div",{className:o_,ref:L,children:!m&&Q("div",{className:Qd,children:R})}),Q("div",{className:s_,children:F.mode==="reward"?Q("button",{className:l_,type:"button",onClick:()=>S("viewed"),disabled:!A,children:A?"Continue":`Continue in ${p}s`}):w&&Q("button",{className:c_,type:"button",onClick:()=>S("viewed"),children:"Continue"})})]})})};function Pe(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){if(Pe(this,"name","ADSENSE_BANNER_AS_AFG"),Pe(this,"initialized",!1),Pe(this,"initCompleter",null),Pe(this,"context",void 0),Pe(this,"contextInfo",void 0),Pe(this,"initParams",void 0),Pe(this,"defaultCountdown",5),Pe(this,"adsOverlay",null),Pe(this,"adsIsShowing",!1),Pe(this,"lastUnDisplayedAdBreak",null),Pe(this,"requestCounter",0),Pe(this,"scriptPromise",null),Pe(this,"scriptReady",!1),Pe(this,"scriptFailed",!1),Pe(this,"state",e_()),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,typeof window!="undefined"){let n=window;n.adsbygoogle=n.adsbygoogle||[]}}init(){return I(this,null,function*(){var t;if(typeof document!="undefined"){this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-banner-as-afg"),ci(Q(d_,{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,m,u;let p=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:p,breakFormat:h,breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:p,breakFormat:h,breakStatus:"frequencyCapped"});return}let w=this.resolveOverlayConfig(r);if(!this.canDisplay(w.rewardUnitId)){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:p,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"},A=()=>{var k;this.adsIsShowing=!1,(k=t.afterAd)==null||k.call(t)},b=()=>{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=A,this.state.adBreakDone.value=b,this.state.adDismissed.value=null,this.state.adViewed.value=null,this.state.adError.value=R,this.showBannerOverlay("interstitial",w)});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),(m=t.beforeAd)==null||m.call(t);let E={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},A=()=>{var S;this.adsIsShowing=!1,(S=t.afterAd)==null||S.call(t)},b=()=>{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,N;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(S=t.afterAd)==null||S.call(t),(N=t.adBreakDone)==null||N.call(t,E)};be(()=>{this.state.afterAd.value=A,this.state.adDismissed.value=b,this.state.adViewed.value=R,this.state.adBreakDone.value=k,this.state.adError.value=L});let F=()=>{var S,N;if(!this.canDisplay(w.rewardUnitId)){this.lastUnDisplayedAdBreak=null,(S=t.afterAd)==null||S.call(t),(N=t.adBreakDone)==null||N.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.lastUnDisplayedAdBreak=null,this.adsIsShowing=!0,be(()=>{this.showBannerOverlay("reward",w)})};this.lastUnDisplayedAdBreak=t,(u=t.beforeReward)==null||u.call(t,F);break}}}},lr={};window.addEventListener("message",e=>{e.origin!=="https://ads.appsrockets.com"&&e.origin!=="https://stg-ads.appsrockets.com"||lr[e.data.type]&&lr[e.data.type].forEach(t=>{t(e.data.data)})});var or=(e,t)=>{Jt(()=>(lr[e]||(lr[e]=new Set),lr[e].add(t),()=>{lr[e].delete(t)}),[e,t])},h_=()=>{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}},m_=Oe`
240
- ${ge}
239
+ `,T_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adError:s,visible:l,payload:c}=t,[h,u]=_t(!1),[p,m]=_t(0),[b,E]=_t(!1),[A,w]=_t(!1),[R,O]=_t("Loading next content..."),D=gi(null),M=c.value,S=Vr(U=>{var G,j,V,K;u(!1),l.value=!1,U==="dismiss"?(G=n.value)==null||G.call(n):(j=i.value)==null||j.call(i),(V=r.value)==null||V.call(r),(K=a.value)==null||K.call(a)},[l,n,i,r,a]),N=Vr(()=>{var U;u(!1),l.value=!1,(U=s.value)==null||U.call(s)},[l,s]);if(xt(()=>{var U;if(!l.value||!M){m(0),E(!1),w(!1),O("Loading next content...");return}let G=M.mode==="reward"?15:0,j=Math.max(Math.floor((U=M.countdown)!=null?U:G),0);if(m(j),w(M.mode==="reward"?j===0:!0),E(M.mode==="interstitial"?j===0:!1),j===0)return;let V=j,K=window.setInterval(()=>{V-=1,m(Math.max(V,0)),V<=0&&(window.clearInterval(K),M.mode==="reward"?w(!0):E(!0))},1e3);return()=>{window.clearInterval(K)}},[l.value,M,S]),xt(()=>{var U;if(!l.value||!M)return;let G=D.current;if(!G)return;if(G.innerHTML="",O("Loading next content..."),u(!1),M.testMode){let K=document.createElement("div");K.className=mu,K.innerText="Preview slot placeholder",G.appendChild(K),u(!0),(U=o.value)==null||U.call(o);return}if(typeof window=="undefined"){N();return}let j=document.createElement("ins");j.className="adsbygoogle",j.style.display="block",j.style.width="100%",j.style.height="100%",j.setAttribute("data-ad-client",M.clientId),j.setAttribute("data-ad-slot",M.unitId),j.setAttribute("data-ad-format","auto"),j.setAttribute("data-full-width-responsive","true"),M.channelId&&j.setAttribute("data-ad-channel",M.channelId),G.appendChild(j);let V=new MutationObserver(()=>{var K;let Fe=j.getAttribute("data-ad-status");Fe==="filled"?(u(!0),O(""),(K=o.value)==null||K.call(o),V.disconnect()):Fe==="unfilled"&&(O("Slot currently unavailable."),u(!1),V.disconnect())});V.observe(j,{attributes:!0,attributeFilter:["data-ad-status"]});try{let K=window;K.adsbygoogle=K.adsbygoogle||[],K.adsbygoogle.push({})}catch(K){V.disconnect(),N()}return()=>{V.disconnect(),G.innerHTML=""}},[l.value,M,o,N]),!l.value||!M)return null;let J=M.mode==="reward"?"Next content unlocking":"Content paused",q=p>0?`Content resumes in ${p}s`:"Content ready";return $("div",{className:w_,children:$("div",{className:E_,children:[$("div",{className:I_,children:[$("div",{className:A_,children:J}),$("div",{className:S_,children:q})]}),$("div",{className:C_,ref:D,children:!h&&$("div",{className:mu,children:R})}),$("div",{className:R_,children:M.mode==="reward"?$("button",{className:O_,type:"button",onClick:()=>S("viewed"),disabled:!A,children:A?"Continue":`Continue in ${p}s`}):b&&$("button",{className:k_,type:"button",onClick:()=>S("viewed"),children:"Continue"})})]})})};function De(e,t,r){return(t=x_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x_(e){var t=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 Es=class{constructor(t,r){if(De(this,"name","ADSENSE_BANNER_AS_AFG"),De(this,"initialized",!1),De(this,"initCompleter",null),De(this,"context",void 0),De(this,"contextInfo",void 0),De(this,"initParams",void 0),De(this,"defaultCountdown",5),De(this,"adsOverlay",null),De(this,"adsIsShowing",!1),De(this,"lastUnDisplayedAdBreak",null),De(this,"requestCounter",0),De(this,"scriptPromise",null),De(this,"scriptReady",!1),De(this,"scriptFailed",!1),De(this,"state",b_()),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,typeof window!="undefined"){let n=window;n.adsbygoogle=n.adsbygoogle||[]}}init(){return I(this,null,function*(){var t;if(typeof document!="undefined"){this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-banner-as-afg"),it($(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,h,u;let p=t.type==="preroll"?"":t.name,m=t.type==="reward"?"reward":"interstitial";if(!this.initialized||!this.adsOverlay){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:p,breakFormat:m,breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:p,breakFormat:m,breakStatus:"frequencyCapped"});return}let b=this.resolveOverlayConfig(r);if(!this.canDisplay(b.rewardUnitId)){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:p,breakFormat:m,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"},A=()=>{var O;this.adsIsShowing=!1,(O=t.afterAd)==null||O.call(t)},w=()=>{var O;this.adsIsShowing=!1,(O=t.adBreakDone)==null||O.call(t,E)},R=()=>{var O,D;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(O=t.afterAd)==null||O.call(t),(D=t.adBreakDone)==null||D.call(t,E)};ue(()=>{this.adsIsShowing=!0,this.state.afterAd.value=A,this.state.adBreakDone.value=w,this.state.adDismissed.value=null,this.state.adViewed.value=null,this.state.adError.value=R,this.showBannerOverlay("interstitial",b)});break}case"reward":{this.lastUnDisplayedAdBreak&&((c=(l=this.lastUnDisplayedAdBreak).adBreakDone)==null||c.call(l,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(h=t.beforeAd)==null||h.call(t);let E={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},A=()=>{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)},O=()=>{var S;this.adsIsShowing=!1,(S=t.adBreakDone)==null||S.call(t,E)},D=()=>{var S,N;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(S=t.afterAd)==null||S.call(t),(N=t.adBreakDone)==null||N.call(t,E)};ue(()=>{this.state.afterAd.value=A,this.state.adDismissed.value=w,this.state.adViewed.value=R,this.state.adBreakDone.value=O,this.state.adError.value=D});let M=()=>{var S,N;if(!this.canDisplay(b.rewardUnitId)){this.lastUnDisplayedAdBreak=null,(S=t.afterAd)==null||S.call(t),(N=t.adBreakDone)==null||N.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.lastUnDisplayedAdBreak=null,this.adsIsShowing=!0,ue(()=>{this.showBannerOverlay("reward",b)})};this.lastUnDisplayedAdBreak=t,(u=t.beforeReward)==null||u.call(t,M);break}}}},vr={};window.addEventListener("message",e=>{e.origin!=="https://ads.appsrockets.com"&&e.origin!=="https://stg-ads.appsrockets.com"||vr[e.data.type]&&vr[e.data.type].forEach(t=>{t(e.data.data)})});var mr=(e,t)=>{xt(()=>(vr[e]||(vr[e]=new Set),vr[e].add(t),()=>{vr[e].delete(t)}),[e,t])},Yu=()=>{let e=Y(),t=Y(),r=Y(),n=Y(),i=Y(),a=Y(),o=Y(),s=Y(!1),l=Y("");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adLinkClicked:a,adError:o,visible:s,src:l}},P_=Te`
240
+ ${ye}
241
241
  position: fixed;
242
242
  z-index: 2147483647;
243
243
  background: white;
@@ -247,7 +247,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
247
247
  flex-direction: column;
248
248
 
249
249
  iframe {
250
- ${ge}
250
+ ${ye}
251
251
  flex: 1;
252
252
  position: relative;
253
253
  display: block;
@@ -255,8 +255,8 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
255
255
  width: 100%;
256
256
  height: 100%;
257
257
  }
258
- `,p_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adLinkClicked:s,visible:l,src:c}=t,[m,u]=ft(!1),p=w=>{var E,A,b,R;u(!1),l.value=!1,w==="dismiss"?(E=n.value)==null||E.call(n):w==="viewed"&&((A=i.value)==null||A.call(i)),(b=r.value)==null||b.call(r),(R=a.value)==null||R.call(a)},h=()=>{var w;(w=o.value)==null||w.call(o)};return or("appsrockets_ad_dismissed",()=>p("dismiss")),or("appsrockets_ad_rewarded",()=>p("viewed")),or("appsrockets_ad_completed",()=>p("viewed")),or("appsrockets_ad_skipped",()=>p("viewed")),or("appsrockets_ad_clicked",w=>{var E;return(E=s.value)==null?void 0:E.call(s,w)}),or("appsrockets_ad_loaded",()=>u(!0)),l.value?Q("div",{className:m_,style:{display:m?"flex":"none"},children:l.value&&Q("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=v_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v_(e){var t=g_(e,"string");return typeof t=="symbol"?t:t+""}function g_(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){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",h_()),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 I(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),ci(Q(p_,{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,m;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let u=h=>{var w,E;(E=(w=this.context).handleLinkClicked)==null||E.call(w,h)},p=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 A;this.adsIsShowing=!1,(A=t.afterAd)==null||A.call(t)},w=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},E=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.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=w,this.state.src.value=this.processUrl(r.params.url,p),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)},w={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var L;this.adsIsShowing=!1,w.breakStatus="dismissed",(L=t.adDismissed)==null||L.call(t)},A=()=>{var L;this.adsIsShowing=!1,w.breakStatus="viewed",(L=t.adViewed)==null||L.call(t)},b=()=>{var L;this.adsIsShowing=!1,(L=t.adBreakDone)==null||L.call(t,w)},R=()=>{this.adsIsShowing=!1,w.breakStatus="noAdPreloaded"};be(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=E,this.state.adViewed.value=A,this.state.adBreakDone.value=b,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,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(m=t.beforeReward)==null||m.call(t,k);break}}}},xu=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Ce(e,t,r){return(t=__(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function __(e){var t=y_(e,"string");return typeof t=="symbol"?t:t+""}function y_(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 w_=class{constructor(e,t,r){Ce(this,"adUnit",void 0),Ce(this,"project",void 0),Ce(this,"keyValue",void 0),Ce(this,"adsContext",null),Ce(this,"rewardedSlot",null),Ce(this,"rewardedPayload",null),Ce(this,"readyEvent",null),Ce(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ce(this,"init",()=>{var n;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(i=>{var a;(a=this.rewardedSlot)==null||a.setTargeting(i,this.keyValue[i])}),Object.keys(this.keyValue).includes("project")||(n=this.rewardedSlot)==null||n.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Ce(this,"destroy",n=>{var i,a;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(a=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||a.call(i,n),n!=="ignored"&&(this.adsContext=null)}),Ce(this,"reinit",n=>{this.destroy(n),this.init()}),Ce(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),Ce(this,"handleSlotClosed",n=>{var i,a;if(this.adsContext&&n.slot===this.rewardedSlot){let o=this.rewardedPayload?"viewed":"dismissed";o==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(a=(i=this.adsContext).afterAd)==null||a.call(i),this.withCommand(()=>{this.reinit(o)})}}),Ce(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),Ce(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Ce(this,"requestAds",n=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=n,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,a,o;(a=(i=this.adsContext)==null?void 0:i.beforeAd)==null||a.call(i),(o=this.readyEvent)==null||o.makeRewardedVisible()});else{let i=a=>{a.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=a,this.adsContext.beforeReward(()=>{var o,s,l;(s=(o=this.adsContext)==null?void 0:o.beforeAd)==null||s.call(o),(l=this.readyEvent)==null||l.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=t,this.keyValue=r,xu(),this.withCommand(()=>{this.init()})}};function Be(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=E_(e,"string");return typeof t=="symbol"?t:t+""}function E_(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,r,n){var i=this;Be(this,"adUnit",void 0),Be(this,"project",void 0),Be(this,"keyValue",void 0),Be(this,"adsContext",null),Be(this,"gamingInterstitialSlot",null),Be(this,"readyEvent",null),Be(this,"isRetrying",!1),Be(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Be(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))}),Be(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)}),Be(this,"reinit",function(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(a,o),i.init()}),Be(this,"handleSlotReady",a=>{this.gamingInterstitialSlot===a.slot&&(this.readyEvent=a)}),Be(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")}))}),Be(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)))})}),xu(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Ft(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 fs=class{constructor(t,r){Ft(this,"name","GOOGLE_GPT"),Ft(this,"context",void 0),Ft(this,"contextInfo",void 0),Ft(this,"initParams",void 0),Ft(this,"rewardAdManager",void 0),Ft(this,"interstitialManager",void 0),Ft(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 I(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 w_(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new us(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 qo(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 hs=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";qo(this,"context",void 0),qo(this,"placement","GAME"),qo(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:lu.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(r=this.contextInfo.hostAppId)!=null?r:"1",model:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",brand:(i=this.contextInfo.deviceBrand)!=null?i:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,r){var n;let i={protocolVersion:"1.0.0",events:[{name:t,type:ou.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:su.WebSDK};return Sv(i)}};function Ne(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 Pi=class{constructor(t){Ne(this,"context",void 0),Ne(this,"adsTrackSerializer",void 0),Ne(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new hs(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}}},ms=class{constructor(t,r){var n=this;Ne(this,"context",void 0),Ne(this,"contextInfo",void 0),Ne(this,"requestContext",void 0),Ne(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Ne(this,"pendingAFVAdsInfo",Promise.resolve(null)),Ne(this,"doFetchAdsInfo",i=>I(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})),Ne(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Ne(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),Ne(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Ne(this,"cacheNextAFGAdsInfo",i=>I(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),Ne(this,"getAFGAdsInfo",i=>I(this,null,function*(){let a=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),a})),Ne(this,"getAFVAdsInfo",function(){return I(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 Pi(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function k_(e,t,r){return(t=T_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T_(e){var t=x_(e,"string");return typeof t=="symbol"?t:t+""}function x_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var P_=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)}},Ni=class{constructor(t){this.context=t,k_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=yd(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return I(this,null,function*(){try{let{errNo:r,errMsg:n}=yield vi("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 $o()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return I(this,null,function*(){try{let r=yield vi("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=()=>{Cd("onAdsStateChange",s),a&&(clearTimeout(a),a=null)},s=l=>{var c;if(l.UUID!==n)return;let m=(c=t.callbacks)==null?void 0:c[l.event];m&&P_(m,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&o()};Sd("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}=vi("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=N_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N_(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 ps=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",()=>I(this,null,function*(){this.helper.canIUse()?(yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1: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=>I(this,null,function*(){this.destroy(n),yield this.init()})),gt(this,"requestAds",(n,i)=>I(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(()=>I(this,null,function*(){var a,o;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a);let s=c=>{var m,u,p;i||(i=!0,c==="dismissed"&&((m=this.adsContext)==null||m.adDismissed()),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.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 Ni(t),this.init()}};function _t(e,t,r){return(t=L_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L_(e){var t=U_(e,"string");return typeof t=="symbol"?t:t+""}function U_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vs=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",()=>I(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 I(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)=>I(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",()=>I(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 m,u;o||(o=!0,(u=(m=this.adsContext)==null?void 0:m.afterAd)==null||u.call(m),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 Ni(t),this.init()}};function qr(e,t,r){return(t=B_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B_(e){var t=M_(e,"string");return typeof t=="symbol"?t:t+""}function M_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var gs=class{constructor(t,r){qr(this,"name","INTERNAL_NATIVE"),qr(this,"context",void 0),qr(this,"rewardAdManager",void 0),qr(this,"interstitialManager",void 0),qr(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 ps(this.context,n)),i.length>0&&(this.interstitialManager=new vs(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 I(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}}}},Vo="jolibox-nb-proxy",G_=0;function Yd(e,t,r,n){return new Promise((i,a)=>{if(!window.parent||window.parent===window){a(new Error("[ParentProxy] No parent window"));return}let o=`${Vo}-${++G_}`,s=c=>{let m=c.data;(m==null?void 0:m.type)===`${Vo}:response`&&m.id===o&&(window.removeEventListener("message",s),clearTimeout(l),m.error?a(new Error(m.error)):i(m.result))},l=window.setTimeout(()=>{window.removeEventListener("message",s),a(new Error(`[ParentProxy] Timeout: ${e.join(".")}.${t}`))},15e3);window.addEventListener("message",s),window.parent.postMessage({type:`${Vo}:request`,id:o,path:e,action:t,args:r,value:n},"*")})}function Pu(e){return console.log("[JoliboxSDK] NewsBreak createProxyForPath basePath:",e),new Proxy(()=>{},{get(t,r){if(console.log("[JoliboxSDK] NewsBreak createProxyForPath get:",r),!(r==="then"||r==="toJSON"||typeof r=="symbol"))return Pu([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),Yd([...e,r],"set",void 0,n).catch(i=>{console.warn(`[ParentProxy] set ${[...e,r].join(".")} failed:`,i)}),!0},apply(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath apply:",n),Yd(e,"call",n)}})}function J_(e){return Pu([e])}var Ci=()=>{try{if(window.parent&&window.parent!==window)return J_("GameSDK")}catch(e){}};function St(e,t,r){return(t=F_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F_(e){var t=j_(e,"string");return typeof t=="symbol"?t:t+""}function j_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var _s=class{constructor(){St(this,"adsContext",null),St(this,"_isReady",!1),St(this,"_isAvailable",!1),St(this,"init",()=>I(this,null,function*(){this._isReady=!1;let t=Ci();if(t)try{if(this._isAvailable=yield t.isAvailable("rewarded"),console.log("[JoliboxSDK] NewsBreak init isAvailable",this._isAvailable),!this._isAvailable)return;let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r),this._isReady=r.success&&r.ready}catch(r){this._isReady=!1}})),St(this,"destroy",t=>{var r,n;this._isReady=!1,(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),St(this,"reinit",t=>I(this,null,function*(){this.destroy(t),yield this.init()})),St(this,"requestAds",t=>{if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Ci();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}let n=r.isRewardReady();if(console.log("[JoliboxSDK] NewsBreak sdk.isRewardReady",n),this._isReady||n)this._isReady=!0,this.showAd();else{let i=window.setTimeout(()=>{this._isReady||this.reinit("timeout")},5e3);r.createRewardAd({platform:"jolibox"}).then(a=>{clearTimeout(i),a.success&&a.ready?(this._isReady=!0,this.showAd()):this.reinit("noAdPreloaded")}).catch(()=>{clearTimeout(i),this.reinit("noAdPreloaded")})}}),St(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>I(this,null,function*(){var t,r,n,i,a,o,s,l,c,m,u,p,h,w;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let E=Ci();if(!E){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let A=yield E.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",A),!A.success){(o=(a=this.adsContext)==null?void 0:a.afterAd)==null||o.call(a),this.reinit("error");return}A.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(c=(l=this.adsContext)==null?void 0:l.afterAd)==null||c.call(l),this.reinit("viewed")):((m=this.adsContext)==null||m.adDismissed(),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.call(u),this.reinit("dismissed"))}catch(A){(w=(h=this.adsContext)==null?void 0:h.afterAd)==null||w.call(h),this.reinit("error")}}))}),this.init()}};function Zd(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=q_(e,"string");return typeof t=="symbol"?t:t+""}function q_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ys=class{constructor(){Zd(this,"name","NEWSBREAK"),Zd(this,"rewardAdManager",void 0)}init(){return I(this,null,function*(){let t=Ci();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new _s})}adConfig(t,r){}adBreak(t,r){var n,i;if(t.type!=="reward"){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:a=>{var o;(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a})}})}};function Xe(e,t,r){return(t=V_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V_(e){var t=$_(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 Xr=class{constructor(t){if(Xe(this,"context",void 0),Xe(this,"contextInfo",void 0),Xe(this,"providers",{}),Xe(this,"channelPolicy",void 0),Xe(this,"adsActionDetection",void 0),Xe(this,"requestContext",void 0),Xe(this,"adsRequest",void 0),Xe(this,"initialized",!1),Xe(this,"adsIsShowing",!1),Xe(this,"lastAdBreak",void 0),Xe(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Zo(this.context),this.adsActionDetection=new Yo(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new ms(t),this.requestContext=new Pi(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return I(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 fs(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new es(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new ls(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new ds(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new cs(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new gs(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",s);let l=new ys;yield l.init(),this.providers.NEWSBREAK=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 I(this,null,function*(){var r,n,i,a,o,s,l,c,m,u,p,h,w,E,A,b;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,F=k==null?void 0:k.code;if(F==="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,N,j,q;(S=t.beforeAd)==null||S.call(t),(N=t.adViewed)==null||N.call(t),(j=t.afterAd)==null||j.call(t),(q=t.adBreakDone)==null||q.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=t.beforeAd)==null||l.call(t),(c=t.afterAd)==null||c.call(t),(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!L||F!=="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){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let S=!0,N=null,j=new Qo(this.context);this.adsActionDetection.adBreakIsShowing=!0;let q=L.filter(V=>V.isNative).sort((V,$)=>V.seq-$.seq),U=L.filter(V=>!V.isNative).sort((V,$)=>V.seq-$.seq),M={seq:(w=(h=q[0])==null?void 0:h.seq)!=null?w:0,provider:"INTERNAL_NATIVE",params:q},J;for(q.length>0?J=[M].concat(U):J=U,J=J.sort((V,$)=>V.seq-$.seq).map((V,$)=>nv(ru({},V),{seq:$}));J.length>0;){let V=J.shift(),$=this.providers[V.provider];if($){let[Ge,Ht]=yield j.callAdBreakAndContinue($,t,V,qt=>{var nt;this.adsIsShowing=qt,(nt=this.context.eventEmitter)==null||nt.emit("isAdShowing",qt)});S=Ge,N=Ht}else S=!0,N={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!S)break}S&&N&&((E=t.adBreakDone)==null||E.call(t,N))}}catch(k){(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(b=this.context.eventEmitter)==null||b.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 eC=Oe`
259
- ${ge}
258
+ `,Xu=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adLinkClicked:s,visible:l,src:c}=t,[h,u]=_t(!1),p=b=>{var E,A,w,R;u(!1),l.value=!1,b==="dismiss"?(E=n.value)==null||E.call(n):b==="viewed"&&((A=i.value)==null||A.call(i)),(w=r.value)==null||w.call(r),(R=a.value)==null||R.call(a)},m=()=>{var b;(b=o.value)==null||b.call(o)};return mr("appsrockets_ad_dismissed",()=>p("dismiss")),mr("appsrockets_ad_rewarded",()=>p("viewed")),mr("appsrockets_ad_completed",()=>p("viewed")),mr("appsrockets_ad_skipped",()=>p("viewed")),mr("appsrockets_ad_clicked",b=>{var E;return(E=s.value)==null?void 0:E.call(s,b)}),mr("appsrockets_ad_loaded",()=>u(!0)),l.value?$("div",{className:P_,style:{display:h?"flex":"none"},children:l.value&&$("iframe",{src:c.value,onLoad:m,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};function Et(e,t,r){return(t=D_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D_(e){var t=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 Is=class{constructor(t,r){Et(this,"name","APPSROCKETS"),Et(this,"initialized",!1),Et(this,"initCompleter",null),Et(this,"context",void 0),Et(this,"adsOverlay",null),Et(this,"adsIsShowing",!1),Et(this,"lastUnDisplayedAdBreak",null),Et(this,"state",Yu()),Et(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 I(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),it($(Xu,{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,h;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let u=m=>{var b,E;(E=(b=this.context).handleLinkClicked)==null||E.call(b,m)},p=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(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 m=()=>{var A;this.adsIsShowing=!1,(A=t.afterAd)==null||A.call(t)},b=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},E=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};ue(()=>{this.adsIsShowing=!0,this.state.afterAd.value=m,this.state.adBreakDone.value=b,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=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 m=()=>{var D;this.adsIsShowing=!1,(D=t.afterAd)==null||D.call(t)},b={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var D;this.adsIsShowing=!1,b.breakStatus="dismissed",(D=t.adDismissed)==null||D.call(t)},A=()=>{var D;this.adsIsShowing=!1,b.breakStatus="viewed",(D=t.adViewed)==null||D.call(t)},w=()=>{var D;this.adsIsShowing=!1,(D=t.adBreakDone)==null||D.call(t,b)},R=()=>{this.adsIsShowing=!1,b.breakStatus="noAdPreloaded"};ue(()=>{this.state.afterAd.value=m,this.state.adDismissed.value=E,this.state.adViewed.value=A,this.state.adBreakDone.value=w,this.state.adLinkClicked.value=u,this.state.adError.value=R});let O=()=>{var D;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(D=t.adBreakDone)==null||D.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,ue(()=>{this.state.src.value=this.processUrl(r.params.url,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(h=t.beforeReward)==null||h.call(t,O);break}}}},Qu=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Re(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=B_(e,"string");return typeof t=="symbol"?t:t+""}function B_(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 Zu=class{constructor(e,t,r){Re(this,"adUnit",void 0),Re(this,"project",void 0),Re(this,"keyValue",void 0),Re(this,"adsContext",null),Re(this,"rewardedSlot",null),Re(this,"rewardedPayload",null),Re(this,"readyEvent",null),Re(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Re(this,"init",()=>{var n;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(i=>{var a;(a=this.rewardedSlot)==null||a.setTargeting(i,this.keyValue[i])}),Object.keys(this.keyValue).includes("project")||(n=this.rewardedSlot)==null||n.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Re(this,"destroy",n=>{var i,a;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(a=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||a.call(i,n),n!=="ignored"&&(this.adsContext=null)}),Re(this,"reinit",n=>{this.destroy(n),this.init()}),Re(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),Re(this,"handleSlotClosed",n=>{var i,a;if(this.adsContext&&n.slot===this.rewardedSlot){let o=this.rewardedPayload?"viewed":"dismissed";o==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(a=(i=this.adsContext).afterAd)==null||a.call(i),this.withCommand(()=>{this.reinit(o)})}}),Re(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),Re(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Re(this,"requestAds",n=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=n,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,a,o;(a=(i=this.adsContext)==null?void 0:i.beforeAd)==null||a.call(i),(o=this.readyEvent)==null||o.makeRewardedVisible()});else{let i=a=>{a.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=a,this.adsContext.beforeReward(()=>{var o,s,l;(s=(o=this.adsContext)==null?void 0:o.beforeAd)==null||s.call(o),(l=this.readyEvent)==null||l.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=t,this.keyValue=r,Qu(),this.withCommand(()=>{this.init()})}};function Ge(e,t,r){return(t=M_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M_(e){var t=G_(e,"string");return typeof t=="symbol"?t:t+""}function G_(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,n){var i=this;Ge(this,"adUnit",void 0),Ge(this,"project",void 0),Ge(this,"keyValue",void 0),Ge(this,"adsContext",null),Ge(this,"gamingInterstitialSlot",null),Ge(this,"readyEvent",null),Ge(this,"isRetrying",!1),Ge(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ge(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))}),Ge(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)}),Ge(this,"reinit",function(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(a,o),i.init()}),Ge(this,"handleSlotReady",a=>{this.gamingInterstitialSlot===a.slot&&(this.readyEvent=a)}),Ge(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")}))}),Ge(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)))})}),Qu(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function zt(e,t,r){return(t=J_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J_(e){var t=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 Ss=class{constructor(t,r){zt(this,"name","GOOGLE_GPT"),zt(this,"context",void 0),zt(this,"contextInfo",void 0),zt(this,"initParams",void 0),zt(this,"rewardAdManager",void 0),zt(this,"interstitialManager",void 0),zt(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 I(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 Zu(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new As(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 ns(e,t,r){return(t=j_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j_(e){var t=H_(e,"string");return typeof t=="symbol"?t:t+""}function H_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Cs=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";ns(this,"context",void 0),ns(this,"placement","GAME"),ns(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:Su.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:Iu.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Au.WebSDK};return Kv(i)}};function Le(e,t,r){return(t=q_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q_(e){var t=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 on=class{constructor(t){Le(this,"context",void 0),Le(this,"adsTrackSerializer",void 0),Le(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new Cs(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}}},qi=class{constructor(t,r){var n=this;Le(this,"context",void 0),Le(this,"contextInfo",void 0),Le(this,"requestContext",void 0),Le(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Le(this,"pendingAFVAdsInfo",Promise.resolve(null)),Le(this,"doFetchAdsInfo",i=>I(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})),Le(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Le(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),Le(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Le(this,"cacheNextAFGAdsInfo",i=>I(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),Le(this,"getAFGAdsInfo",i=>I(this,null,function*(){let a=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),a})),Le(this,"getAFVAdsInfo",function(){return I(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 on(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function $_(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=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 z_=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)}},Vi=class{constructor(t){this.context=t,$_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=Ud(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return I(this,null,function*(){try{let{errNo:r,errMsg:n}=yield Si("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 Gi()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return I(this,null,function*(){try{let r=yield Si("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=()=>{Hd("onAdsStateChange",s),a&&(clearTimeout(a),a=null)},s=l=>{var c;if(l.UUID!==n)return;let h=(c=t.callbacks)==null?void 0:c[l.event];h&&z_(h,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&o()};jd("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}=Si("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 It(e,t,r){return(t=Y_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y_(e){var t=X_(e,"string");return typeof t=="symbol"?t:t+""}function X_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){It(this,"providers",void 0),It(this,"helper",void 0),It(this,"adsContext",null),It(this,"_isAdsReady",!1),It(this,"init",()=>I(this,null,function*(){this.helper.canIUse()?(yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1:this._isAdsReady=!1})),It(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)}),It(this,"reinit",n=>I(this,null,function*(){this.destroy(n),yield this.init()})),It(this,"requestAds",(n,i)=>I(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")}})),It(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>I(this,null,function*(){var a,o;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a);let s=c=>{var h,u,p;i||(i=!0,c==="dismissed"&&((h=this.adsContext)==null||h.adDismissed()),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.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 Vi(t),this.init()}};function At(e,t,r){return(t=Q_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q_(e){var t=Z_(e,"string");return typeof t=="symbol"?t:t+""}function Z_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Os=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;At(this,"providers",void 0),At(this,"helper",void 0),At(this,"adsContext",null),At(this,"_isAdsReady",!1),At(this,"init",()=>I(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),At(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))}),At(this,"reinit",function(a){return I(this,arguments,function*(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,o),yield n.init()})}),At(this,"requestAds",(i,a)=>I(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")}})),At(this,"showAd",()=>I(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 h,u;o||(o=!0,(u=(h=this.adsContext)==null?void 0:h.afterAd)==null||u.call(h),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 Vi(t),this.init()}};function Zr(e,t,r){return(t=ey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ey(e){var t=ty(e,"string");return typeof t=="symbol"?t:t+""}function ty(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ks=class{constructor(t,r){Zr(this,"name","INTERNAL_NATIVE"),Zr(this,"context",void 0),Zr(this,"rewardAdManager",void 0),Zr(this,"interstitialManager",void 0),Zr(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 Rs(this.context,n)),i.length>0&&(this.interstitialManager=new Os(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 I(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}}}},is="jolibox-nb-proxy",ry=0;function pu(e,t,r,n){return new Promise((i,a)=>{if(!window.parent||window.parent===window){a(new Error("[ParentProxy] No parent window"));return}let o=`${is}-${++ry}`,s=c=>{let h=c.data;(h==null?void 0:h.type)===`${is}:response`&&h.id===o&&(window.removeEventListener("message",s),clearTimeout(l),h.error?a(new Error(h.error)):i(h.result))},l=window.setTimeout(()=>{window.removeEventListener("message",s),a(new Error(`[ParentProxy] Timeout: ${e.join(".")}.${t}`))},15e3);window.addEventListener("message",s),window.parent.postMessage({type:`${is}:request`,id:o,path:e,action:t,args:r,value:n},"*")})}function ef(e){return console.log("[JoliboxSDK] NewsBreak createProxyForPath basePath:",e),new Proxy(()=>{},{get(t,r){if(console.log("[JoliboxSDK] NewsBreak createProxyForPath get:",r),!(r==="then"||r==="toJSON"||typeof r=="symbol"))return ef([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),pu([...e,r],"set",void 0,n).catch(i=>{console.warn(`[ParentProxy] set ${[...e,r].join(".")} failed:`,i)}),!0},apply(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath apply:",n),pu(e,"call",n)}})}function ny(e){return ef([e])}var Ui=()=>{try{if(window.parent&&window.parent!==window)return ny("GameSDK")}catch(e){}};function Pt(e,t,r){return(t=iy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iy(e){var t=ay(e,"string");return typeof t=="symbol"?t:t+""}function ay(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ts=class{constructor(){Pt(this,"adsContext",null),Pt(this,"_isReady",!1),Pt(this,"_isAvailable",!1),Pt(this,"init",()=>I(this,null,function*(){this._isReady=!1;let t=Ui();if(t)try{if(this._isAvailable=yield t.isAvailable("rewarded"),console.log("[JoliboxSDK] NewsBreak init isAvailable",this._isAvailable),!this._isAvailable)return;let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r),this._isReady=r.success&&r.ready}catch(r){this._isReady=!1}})),Pt(this,"destroy",t=>{var r,n;this._isReady=!1,(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),Pt(this,"reinit",t=>I(this,null,function*(){this.destroy(t),yield this.init()})),Pt(this,"requestAds",t=>{if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Ui();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}let n=r.isRewardReady();if(console.log("[JoliboxSDK] NewsBreak sdk.isRewardReady",n),this._isReady||n)this._isReady=!0,this.showAd();else{let i=window.setTimeout(()=>{this._isReady||this.reinit("timeout")},5e3);r.createRewardAd({platform:"jolibox"}).then(a=>{clearTimeout(i),a.success&&a.ready?(this._isReady=!0,this.showAd()):this.reinit("noAdPreloaded")}).catch(()=>{clearTimeout(i),this.reinit("noAdPreloaded")})}}),Pt(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>I(this,null,function*(){var t,r,n,i,a,o,s,l,c,h,u,p,m,b;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let E=Ui();if(!E){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let A=yield E.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",A),!A.success){(o=(a=this.adsContext)==null?void 0:a.afterAd)==null||o.call(a),this.reinit("error");return}A.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(c=(l=this.adsContext)==null?void 0:l.afterAd)==null||c.call(l),this.reinit("viewed")):((h=this.adsContext)==null||h.adDismissed(),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.call(u),this.reinit("dismissed"))}catch(A){(b=(m=this.adsContext)==null?void 0:m.afterAd)==null||b.call(m),this.reinit("error")}}))}),this.init()}};function vu(e,t,r){return(t=oy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oy(e){var t=sy(e,"string");return typeof t=="symbol"?t:t+""}function sy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xs=class{constructor(){vu(this,"name","NEWSBREAK"),vu(this,"rewardAdManager",void 0)}init(){return I(this,null,function*(){let t=Ui();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new Ts})}adConfig(t,r){}adBreak(t,r){var n,i;if(t.type!=="reward"){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:a=>{var o;(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a})}})}};function Qe(e,t,r){return(t=ly(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ly(e){var t=cy(e,"string");return typeof t=="symbol"?t:t+""}function cy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sn=class{constructor(t){if(Qe(this,"context",void 0),Qe(this,"contextInfo",void 0),Qe(this,"providers",{}),Qe(this,"channelPolicy",void 0),Qe(this,"adsActionDetection",void 0),Qe(this,"requestContext",void 0),Qe(this,"adsRequest",void 0),Qe(this,"initialized",!1),Qe(this,"adsIsShowing",!1),Qe(this,"lastAdBreak",void 0),Qe(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new fs(this.context),this.adsActionDetection=new us(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new qi(t),this.requestContext=new on(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return I(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 Ss(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new hs(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new ws(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new Is(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Es(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new ks(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",s);let l=new xs;yield l.init(),this.providers.NEWSBREAK=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 I(this,null,function*(){var r,n,i,a,o,s,l,c,h,u,p,m,b,E,A,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 O=yield this.adsRequest.getAFGAdsInfo(t.type),D=O==null?void 0:O.data,M=O==null?void 0:O.code;if(M==="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,N,J,q;(S=t.beforeAd)==null||S.call(t),(N=t.adViewed)==null||N.call(t),(J=t.afterAd)==null||J.call(t),(q=t.adBreakDone)==null||q.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=t.beforeAd)==null||l.call(t),(c=t.afterAd)==null||c.call(t),(h=t.adBreakDone)==null||h.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!D||M!=="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(D.length===0){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let S=!0,N=null,J=new ds(this.context);this.adsActionDetection.adBreakIsShowing=!0;let q=D.filter(V=>V.isNative).sort((V,K)=>V.seq-K.seq),U=D.filter(V=>!V.isNative).sort((V,K)=>V.seq-K.seq),G={seq:(b=(m=q[0])==null?void 0:m.seq)!=null?b:0,provider:"INTERNAL_NATIVE",params:q},j;for(q.length>0?j=[G].concat(U):j=U,j=j.sort((V,K)=>V.seq-K.seq).map((V,K)=>Sv(yu({},V),{seq:K}));j.length>0;){let V=j.shift(),K=this.providers[V.provider];if(K){let[Fe,Xt]=yield J.callAdBreakAndContinue(K,t,V,Qt=>{var ct;this.adsIsShowing=Qt,(ct=this.context.eventEmitter)==null||ct.emit("isAdShowing",Qt)});S=Fe,N=Xt}else S=!0,N={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!S)break}S&&N&&((E=t.adBreakDone)==null||E.call(t,N))}}catch(O){(A=t.adBreakDone)==null||A.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.")}};function ki(e,t,r){return(t=dy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dy(e){var t=uy(e,"string");return typeof t=="symbol"?t:t+""}function uy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ns=class{constructor(t){ki(this,"context",void 0),ki(this,"currentProvider",void 0),ki(this,"continueCallback",void 0),ki(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo()}get paramsToTrack(){var t,r;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null}}wrapAdRequested(t){return()=>{this.context.track("CallAFVRequest",this.paramsToTrack),t==null||t()}}wrapAdLoaded(t){return r=>{this.context.track("CallAFVLoad",this.paramsToTrack),t==null||t(r)}}wrapAdPlaying(t){return r=>{var n,i;this.context.track("CallAFVPlaying",this.paramsToTrack),Gi()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"AFV",module:"drama",game_id:this.contextInfo.objectId}),t==null||t(r)}}wrapAdCompleted(t){return r=>{var n;this.context.track("CallAFVCompleted",this.paramsToTrack),t==null||t(r),(n=this.continueCallback)==null||n.call(this,[!1,null])}}wrapAdError(t){return r=>{var n;this.context.track("CallAFVError",this.paramsToTrack),(n=this.continueCallback)==null||n.call(this,[!0,r])}}callAdRequestAndContinue(t,r,n){return I(this,null,function*(){return this.currentProvider=t,new Promise(i=>{this.continueCallback=i;let a=Object.assign({},r);a.onAdRequested=this.wrapAdRequested(r.onAdRequested),a.onAdLoaded=this.wrapAdLoaded(r.onAdLoaded),a.onAdPlaying=this.wrapAdPlaying(r.onAdPlaying),a.onAdCompleted=this.wrapAdCompleted(r.onAdCompleted),a.onAdError=this.wrapAdError(r.onAdError),t.requestAd(a,n)})})}};function as(e,t,r){return(t=fy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fy(e){var t=hy(e,"string");return typeof t=="symbol"?t:t+""}function hy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ke=class e extends Error{constructor(t,r){super(t.message),as(this,"name",void 0),as(this,"type",void 0),as(this,"raw",void 0),this.name="AFVRequestError",this.type=r,this.raw=t,this.stack=t.stack,this.message=t.message}static from(t,r){switch(r){case"GOOGLE_IMA_ERROR":return new e(t,r);case"JOLIBOX_IMA_ERROR":return new e(t,r)}}};function ae(e,t,r){return(t=my(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function my(e){var t=py(e,"string");return typeof t=="symbol"?t:t+""}function py(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,n){ae(this,"adsLoader",void 0),ae(this,"adDisplayContainer",void 0),ae(this,"isAdPlaying",!1),ae(this,"isContentFinished",!1),ae(this,"videoContent",void 0),ae(this,"adContainer",void 0),ae(this,"adsManager",void 0),ae(this,"intervalTimer",void 0),ae(this,"completed",!1),ae(this,"adTagUrl",void 0),ae(this,"notifyRequestAd",void 0),ae(this,"notifyLoaded",void 0),ae(this,"notifyPlayingAd",void 0),ae(this,"notifyCompleted",void 0),ae(this,"notifyError",void 0),ae(this,"destroy",()=>{var i,a,o,s,l,c,h,u,p,m,b;this.intervalTimer&&clearInterval(this.intervalTimer),(i=this.adsManager)==null||i.stop(),(a=this.adDisplayContainer)==null||a.destroy(),(o=this.adsLoader)==null||o.removeEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded),(s=this.adsLoader)==null||s.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(l=this.adsManager)==null||l.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(c=this.adsManager)==null||c.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),(h=this.adsManager)==null||h.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),(u=this.adsManager)==null||u.removeEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),(p=this.adsManager)==null||p.removeEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),(m=this.adsManager)==null||m.removeEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),(b=this.adsManager)==null||b.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent)}),ae(this,"requestAds",(i,a)=>I(this,null,function*(){var o;this.createAdDisplayContainer(),this.notifyRequestAd=i.onAdRequested,this.notifyLoaded=i.onAdLoaded,this.notifyPlayingAd=i.onAdPlaying,this.notifyCompleted=i.onAdCompleted,this.notifyError=u=>{var p;return(p=i.onAdError)==null?void 0:p.call(i,ke.from(u,"GOOGLE_IMA_ERROR"))},this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded,!1),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError,!1);let s=()=>{var u;this.isAdPlaying||(this.isContentFinished=!0,(u=this.adsLoader)==null||u.contentComplete())};this.videoContent.onended=s;let l=new window.google.ima.AdsRequest;l.vastLoadTimeout=1e4;let c="";Object.keys(a.params).forEach(u=>{let p=window.encodeURIComponent(a.params[u]);c+=`&${u}=${p}`});let h=`${this.adTagUrl}${c}`;l.adTagUrl=h,l.linearAdSlotWidth=640,l.linearAdSlotHeight=400,l.nonLinearAdSlotWidth=640,l.nonLinearAdSlotHeight=150,this.adsLoader.requestAds(l),(o=this.notifyRequestAd)==null||o.call(this)})),ae(this,"createAdDisplayContainer",()=>{this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoContent)}),ae(this,"playAds",()=>{var i,a;this.videoContent.load(),this.adDisplayContainer.initialize(),this.completed=!1;try{(i=this.adsManager)==null||i.init(window.document.body.clientWidth,window.document.body.clientHeight,window.google.ima.ViewMode.NORMAL),(a=this.adsManager)==null||a.start()}catch(o){console.error("[JoliboxAFV] Google IMA Error: ",o),this.videoContent.play()}}),ae(this,"onAdsManagerLoaded",i=>{let a=new window.google.ima.AdsRenderingSettings;a.restoreCustomPlaybackStateOnAdBreakComplete=!0,a.loadVideoTimeout=1e4,this.adsManager=i.getAdsManager(this.videoContent,a),this.adsManager.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent),i.type==="adsManagerLoaded"&&this.playAds()}),ae(this,"onAdEvent",i=>{var a,o,s,l;let c=i.getAd();switch(i.type){case window.google.ima.AdEvent.Type.LOADED:c!=null&&c.isLinear()||this.videoContent.play(),(a=this.notifyLoaded)==null||a.call(this,i);break;case window.google.ima.AdEvent.Type.STARTED:c!=null&&c.isLinear()&&(this.intervalTimer=window.setInterval(function(){},300)),(o=this.notifyPlayingAd)==null||o.call(this,i);break;case window.google.ima.AdEvent.Type.COMPLETE:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(s=this.notifyCompleted)==null||s.call(this,i));break;case window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(l=this.notifyCompleted)==null||l.call(this,i));break}}),ae(this,"onAdError",i=>{var a,o;(a=this.notifyError)==null||a.call(this,i.getError()),(o=this.adsManager)==null||o.destroy()}),ae(this,"onContentPauseRequested",()=>{this.isAdPlaying=!0,this.videoContent.pause()}),ae(this,"onContentResumeRequested",()=>{this.isAdPlaying=!1}),this.adTagUrl=t,this.videoContent=r,this.adContainer=n}},Bi=(e=>(e[e.ADS_REQUEST_NETWORK_ERROR=1012]="ADS_REQUEST_NETWORK_ERROR",e[e.ASSET_FALLBACK_FAILED=1021]="ASSET_FALLBACK_FAILED",e[e.AUTOPLAY_DISALLOWED=1205]="AUTOPLAY_DISALLOWED",e[e.COMPANION_AD_LOADING_FAILED=603]="COMPANION_AD_LOADING_FAILED",e[e.COMPANION_REQUIRED_ERROR=602]="COMPANION_REQUIRED_ERROR",e[e.FAILED_TO_REQUEST_ADS=1005]="FAILED_TO_REQUEST_ADS",e[e.INVALID_AD_TAG=1013]="INVALID_AD_TAG",e[e.INVALID_ADX_EXTENSION=1105]="INVALID_ADX_EXTENSION",e[e.INVALID_ARGUMENTS=1101]="INVALID_ARGUMENTS",e[e.NONLINEAR_DIMENSIONS_ERROR=501]="NONLINEAR_DIMENSIONS_ERROR",e[e.OVERLAY_AD_LOADING_FAILED=502]="OVERLAY_AD_LOADING_FAILED",e[e.OVERLAY_AD_PLAYING_FAILED=500]="OVERLAY_AD_PLAYING_FAILED",e[e.STREAM_INITIALIZATION_FAILED=1020]="STREAM_INITIALIZATION_FAILED",e[e.UNKNOWN_AD_RESPONSE=1010]="UNKNOWN_AD_RESPONSE",e[e.UNKNOWN_ERROR=900]="UNKNOWN_ERROR",e[e.UNSUPPORTED_LOCALE=1011]="UNSUPPORTED_LOCALE",e[e.VAST_ASSET_NOT_FOUND=1007]="VAST_ASSET_NOT_FOUND",e[e.VAST_EMPTY_RESPONSE=1009]="VAST_EMPTY_RESPONSE",e[e.VAST_LINEAR_ASSET_MISMATCH=403]="VAST_LINEAR_ASSET_MISMATCH",e[e.VAST_LOAD_TIMEOUT=301]="VAST_LOAD_TIMEOUT",e[e.VAST_MALFORMED_RESPONSE=100]="VAST_MALFORMED_RESPONSE",e[e.VAST_MEDIA_LOAD_TIMEOUT=402]="VAST_MEDIA_LOAD_TIMEOUT",e[e.VAST_NO_ADS_AFTER_WRAPPER=303]="VAST_NO_ADS_AFTER_WRAPPER",e[e.VAST_NONLINEAR_ASSET_MISMATCH=503]="VAST_NONLINEAR_ASSET_MISMATCH",e[e.VAST_PROBLEM_DISPLAYING_MEDIA_FILE=405]="VAST_PROBLEM_DISPLAYING_MEDIA_FILE",e[e.VAST_SCHEMA_VALIDATION_ERROR=101]="VAST_SCHEMA_VALIDATION_ERROR",e[e.VAST_TOO_MANY_REDIRECTS=302]="VAST_TOO_MANY_REDIRECTS",e[e.VAST_TRAFFICKING_ERROR=200]="VAST_TRAFFICKING_ERROR",e[e.VAST_UNEXPECTED_DURATION_ERROR=202]="VAST_UNEXPECTED_DURATION_ERROR",e[e.VAST_UNEXPECTED_LINEARITY=201]="VAST_UNEXPECTED_LINEARITY",e[e.VAST_UNSUPPORTED_VERSION=102]="VAST_UNSUPPORTED_VERSION",e[e.VAST_WRAPPER_ERROR=300]="VAST_WRAPPER_ERROR",e[e.VIDEO_PLAY_ERROR=400]="VIDEO_PLAY_ERROR",e[e.VPAID_ERROR=901]="VPAID_ERROR",e))(Bi||{}),vy=()=>{let e=Y(!1),t=Y(!1),r=Y(null),n=Fr(),i=Fr();return{visible:e,canRetry:t,retry:r,videoRef:n,adContainerRef:i}},gy=Te`
259
+ ${ye}
260
260
  position: fixed;
261
261
  left: 0;
262
262
  top: 0;
@@ -267,7 +267,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
267
267
  height: 100vh;
268
268
 
269
269
  .ads-wrapper {
270
- ${ge}
270
+ ${ye}
271
271
  position: relative;
272
272
  width: 100%;
273
273
  height: 100%;
@@ -290,7 +290,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
290
290
  }
291
291
 
292
292
  .retry-button {
293
- ${ge}
293
+ ${ye}
294
294
  position: absolute;
295
295
  width: 100%;
296
296
  height: 100%;
@@ -300,7 +300,7 @@ or `);this.errors.push(a)}return n}},Nn=class extends me{constructor(...t){super
300
300
  cursor: pointer;
301
301
  }
302
302
  }
303
- `;he();var GC=ra(Du());var en=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(){}};st();var tn=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,m;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 p=u.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",u)}break;case"huawei_quick_ads_on_message_ad_break":{let p=u.callbackId;if(p){let h=this.callbackMap.get(p),w="noAdPreloaded",E=!1;switch(u.adsRes){case"viewed":w="viewed",(n=h==null?void 0:h.adViewed)==null||n.call(h),E=!1;break;case"dismissed":w="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":w=u.adsRes,E=!0;break;case"breakDone":w=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&&((m=h==null?void 0:h.adBreakDone)==null||m.call(h,{breakType:(l=h.breakType)!=null?l:"",breakName:h.breakName,breakFormat:(c=h.breakFormat)!=null?c:"interstitial",breakStatus:w}))}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=X(X({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 rn=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 jt=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 I(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 et.getRewardsTypes(this.httpClient);if(!(yield et.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 nn=class e extends jt{constructor(t,r){super(t,r),this.startTimes=Date.now()}adBreak(t){return I(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}}tl(e.prototype,this,"adBreak").call(this,t)})}};var As=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new en(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=tn.getInstance();break}case"gamedistribution":{this.cacheHandler=rn.getInstance();break}case"funmax":{let r=new Xr(this.context);this.cacheHandler=new nn(r,Ot);break}default:{let r=new Xr(this.context);this.cacheHandler=new jt(r,Ot);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},Gi=Ie(),Lu=new Qe,Ot=Ke.create(),K_={httpClient:Ot,checkNetwork:()=>Ke.getNetworkStatus(),track:_e,eventEmitter:Lu,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:Te.isAndroid?"ANDROID":Te.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=D.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},Uu=e=>{De("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e}),_e("jolicoin_unlock_success",{quantity:e.quantity})},W_=()=>{_e("subscription_unlock_success",{})},z_=new As(K_),an=z_.getAdsHandler(D.sdkEnvironment);et.registerRewardHandler("ADS",lc(an.getAdsInstance()));et.registerRewardHandler("JOLI_COIN",dc(Ot,{onUnlockSuccess:Uu.bind(void 0),hasSubscription:()=>!0}));et.registerRewardHandler("JOLI_COIN_ONLY",uc(Ot,{onUnlockSuccess:Uu.bind(void 0),hasSubscription:()=>!0}));et.registerRewardHandler("SUBSCRIPTION",pc(Ot,{onSubSuccess:W_.bind(void 0),hasSubscription:()=>!0}));Za(Ot);Qn(Ot);Lu.on("isAdShowing",e=>{De("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Gi.registerCommand("AdsSDK.init",e=>{an.init(e)});Gi.registerCommand("AdsSDK.adConfig",e=>{an.adConfig(e)});Gi.registerCommand("AdsSDK.adBreak",e=>{an.adBreak(e)});Gi.registerCommand("AdsSDK.adUnit",e=>{an.adUnit(e)});K();st();Or();var Ss=Ie();Ss.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();De("CP_LOAD_FINISH",{duration:e}),_e("loadFinished",{duration:e})});Ss.registerCommand("RuntimeSDK.loadProgressEvent",e=>{De("CP_LOAD_PROGRESS",{progress:e}),console.log("RuntimeSDK.loadProgressEvent",e)});Ss.registerCommand("RuntimeSDK.gameTTIEvent",()=>{De("CP_GAME_TTI",{duration:performance.now()}),_e("gameTTI",{duration:performance.now()})});K();st();var ju=-1,Fi=function(e){addEventListener("pageshow",function(t){t.persisted&&(ju=t.timeStamp,e(t))},!0)},Rs=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ji=function(){var e=Rs();return e&&e.activationStart||0},pr=function(e,t){var r=Rs(),n="navigate";return ju>=0?n="back-forward-cache":r&&(document.prerendering||ji()>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}},Hu=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){}},vr=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))}},qu=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},Vu=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},$u=function(e){var t=!1;return function(){t||(e(),t=!0)}},mr=-1,Bu=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Ji=function(e){document.visibilityState==="hidden"&&mr>-1&&(mr=e.type==="visibilitychange"?e.timeStamp:0,X_())},Mu=function(){addEventListener("visibilitychange",Ji,!0),addEventListener("prerenderingchange",Ji,!0)},X_=function(){removeEventListener("visibilitychange",Ji,!0),removeEventListener("prerenderingchange",Ji,!0)},Ku=function(){return mr<0&&(mr=Bu(),Mu(),Fi(function(){setTimeout(function(){mr=Bu(),Mu()},0)})),{get firstHiddenTime(){return mr}}},Os=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Gu=[1800,3e3],Wu=function(e,t){t=t||{},Os(function(){var r,n=Ku(),i=pr("FCP"),a=Hu("paint",function(o){o.forEach(function(s){s.name==="first-contentful-paint"&&(a.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-ji(),0),i.entries.push(s),r(!0)))})});a&&(r=vr(e,i,Gu,t.reportAllChanges),Fi(function(o){i=pr("FCP"),r=vr(e,i,Gu,t.reportAllChanges),qu(function(){i.value=performance.now()-o.timeStamp,r(!0)})}))})};var Q_=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=$u(e),document.visibilityState==="hidden"?e():(r=t(e),Vu(e)),r};var Ju=[2500,4e3],Cs={},zu=function(e,t){t=t||{},Os(function(){var r,n=Ku(),i=pr("LCP"),a=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-ji(),0),i.entries=[c],r())})},o=Hu("largest-contentful-paint",a);if(o){r=vr(e,i,Ju,t.reportAllChanges);var s=$u(function(){Cs[i.id]||(a(o.takeRecords()),o.disconnect(),Cs[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return Q_(s)},{once:!0,capture:!0})}),Vu(s),Fi(function(l){i=pr("LCP"),r=vr(e,i,Ju,t.reportAllChanges),qu(function(){i.value=performance.now()-l.timeStamp,Cs[i.id]=!0,r(!0)})})}})},Fu=[800,1800],Y_=function e(t){document.prerendering?Os(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Xu=function(e,t){t=t||{};var r=pr("TTFB"),n=vr(e,r,Fu,t.reportAllChanges);Y_(function(){var i=Rs();i&&(r.value=Math.max(i.responseStart-ji(),0),r.entries=[i],n(!0),Fi(function(){r=pr("TTFB",0),(n=vr(e,r,Fu,t.reportAllChanges))(!0)}))})};he();zt();at();K();Or();K();var Hi=new Map,Qu=!1,Z_=()=>{Qu||(Dt("ON_JOLIBOX_GET_USER_SUB_STATUS",e=>{let t=Hi.get(e.sequenceId);if(t){clearTimeout(t.timeoutId);let{isSubUser:r,userId:n}=e;t.resolve({isSubUser:r,userId:n}),Hi.delete(e.sequenceId)}}),Qu=!0)};function ks(){return I(this,null,function*(){return Z_(),new Promise((e,t)=>{let r=$e(),n=setTimeout(()=>{Hi.delete(r),t(new Error("Timeout waiting for user sub status response"))},3e3);Hi.set(r,{resolve:e,reject:t,timeoutId:n}),De("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function Yu(){return I(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 Je(new un(t)),!1}})}function ey(){Wu(e=>{_e("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),zu(e=>{_e("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Xu(e=>{_e("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function ty(){Et.on("onDocumentReady",e=>I(this,null,function*(){let t=yield Yu(),{isSubUser:r,userId:n}=yield ks().catch(()=>({isSubUser:!1,userId:void 0}));D.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:r,uid:n}}),Et.emit("LifecycleEvent.onReady",X({},D.hostUserInfo?D.hostUserInfo:{isLogin:!1})),D.mpType==="game"&&We.start(Date.now()-e)}))}function Zu(){ty(),ey()}Zu();
303
+ `,_y=e=>{let{onReady:t,state:r}=e,{visible:n,retry:i,canRetry:a,videoRef:o,adContainerRef:s}=r,l=()=>{i.value&&(i.value(),ue(()=>{i.value=null,a.value=!1}))};return xt(()=>{t()},[t]),$("div",{className:gy,style:{display:n.value?"block":"none"},children:$("div",{className:"ads-wrapper",children:[$("video",{ref:o,width:"100%",height:"100%",playsInline:!0,"webkit-playsinline":"true",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAD0lEQVR4AQEEAPv/AAAAAAAEAAFlScNgAAAAAElFTkSuQmCC",style:{transition:"none !important",transform:"none !important",animation:"none !important",objectFit:"contain"}}),$("div",{id:"ad-container",ref:s}),a.value?$("div",{className:"retry-button",onClick:l,children:$("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[$("circle",{cx:"32",cy:"32",r:"32",fill:"#141416",fillOpacity:"0.3"}),$("path",{d:"M25.3334 23.3668V40.6334C25.3334 41.9501 26.7834 42.7501 27.9 42.0334L41.4667 33.4001C42.5 32.7501 42.5 31.2501 41.4667 30.5834L27.9 21.9668C26.7834 21.2501 25.3334 22.0501 25.3334 23.3668Z",fill:"white"})]})}):null]})})};function St(e,t,r){return(t=yy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yy(e){var t=by(e,"string");return typeof t=="symbol"?t:t+""}function by(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){St(this,"name","GOOGLE_IMA"),St(this,"context",void 0),St(this,"adsOverlay",null),St(this,"initialized",!1),St(this,"ima",null),St(this,"state",vy()),St(this,"init",r=>I(this,null,function*(){if(this.initialized)return;let n="//imasdk.googleapis.com/js/sdkloader/ima3.js";yield new Promise((i,a)=>{if(document.querySelector("#google-ima-sdk")){i();return}else{let o=document.createElement("script");o.id="google-ima-sdk",o.src=n,o.onload=()=>{var s;(s=window.google)!=null&&s.ima?i():setTimeout(i,100)},o.onerror=a,document.head.appendChild(o)}}),this.adsOverlay=document.createElement("div"),this.adsOverlay.id="jolibox-ima-overlay",document.documentElement.appendChild(this.adsOverlay),yield new Promise((i,a)=>{it($(_y,{state:this.state,onReady:()=>{this.ima=new Ps(r.params.url,this.state.videoRef.current,this.state.adContainerRef.current),i()}}),this.adsOverlay)}),this.initialized=!0})),St(this,"destroy",()=>{this.adsOverlay&&(it(null,this.adsOverlay),this.adsOverlay.remove()),this.ima&&this.ima.destroy(),this.initialized=!1}),St(this,"requestAd",(r,n)=>{var i;if(!this.adsOverlay||!this.ima||!this.initialized){let h=ke.from(new Error("IMA not initialized"),"JOLIBOX_IMA_ERROR");(i=r.onAdError)==null||i.call(r,h);return}let a=h=>{var u;this.ima.destroy(),this.state.visible.value=!1,(u=r.onAdCompleted)==null||u.call(r,h)},o=h=>{var u;let p=!1;switch(h.raw.getErrorCode()){case Bi.AUTOPLAY_DISALLOWED:case Bi.VIDEO_PLAY_ERROR:case Bi.ADS_REQUEST_NETWORK_ERROR:{p=!0;break}default:{p=!1;break}}if(!p)this.ima.destroy(),ue(()=>{this.state.canRetry.value=!1,this.state.retry.value=null,this.state.visible.value=!1}),(u=r.onAdError)==null||u.call(r,h);else{let m=()=>{this.ima.destroy(),this.requestAd(r,n)};ue(()=>{this.state.canRetry.value=!0,this.state.retry.value=m})}},s=h=>{var u;this.state.visible.value=!0,(u=r.onAdLoaded)==null||u.call(r,h)},l=h=>{var u;(u=r.onAdPlaying)==null||u.call(r,h)},c=Object.assign({},r);c.onAdCompleted=a,c.onAdError=o,c.onAdLoaded=s,c.onAdPlaying=l,this.ima.requestAds(c,n)}),this.context=t}};function at(e,t,r){return(t=wy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wy(e){var t=Ey(e,"string");return typeof t=="symbol"?t:t+""}function Ey(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ls=class{constructor(t){at(this,"name","OKSPIN"),at(this,"initialized",!1),at(this,"initCompleter",null),at(this,"context",void 0),at(this,"adsOverlay",null),at(this,"adsIsShowing",!1),at(this,"state",Wu()),at(this,"init",r=>I(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv"),it($(zu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),at(this,"destroy",()=>{var r;this.adsOverlay&&(it(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),at(this,"requestAd",(r,n)=>{var i,a,o,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,ke.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(a=r.onAdError)==null||a.call(r,ke.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(o=r.onAdRequested)==null||o.call(r);let l=()=>{var h;this.adsIsShowing=!1,(h=r.onAdCompleted)==null||h.call(r,void 0)},c=()=>{var h;(h=r.onAdLoaded)==null||h.call(r,void 0)};this.adsIsShowing=!0,ue(()=>{var h;this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.countdown.value=(h=n.params.countdown)!=null?h:15,this.state.src.value=n.params.url,this.state.mode.value="rewarded_insterstitial",this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function Ze(e,t,r){return(t=Iy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Iy(e){var t=Ay(e,"string");return typeof t=="symbol"?t:t+""}function Ay(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){Ze(this,"name","APPSROCKETS"),Ze(this,"initialized",!1),Ze(this,"initCompleter",null),Ze(this,"context",void 0),Ze(this,"adsOverlay",null),Ze(this,"adsIsShowing",!1),Ze(this,"state",Yu()),Ze(this,"processUrl",r=>{var n;let i=this.context.getContextInfo(),a=new URL(r),o=new URLSearchParams(a.search);return o.has("joliSource")||o.set("joliSource",i.joliSource),o.get("osType")||o.set("osType",i.osType),o.get("runtimeType")||o.set("runtimeType",i.runtimeType),o.get("mode")||o.set("mode","AFV"),o.get("deviceId")||o.set("deviceId",i.deviceId),o.get("statusBarHeight")||o.set("statusBarHeight",((n=this.context.getWindowInfo().statusBarHeight)!=null?n:0).toString()),o.get("adsType")||o.set("adsType","REWARD_INTERSTITIAL"),a.search=o.toString(),a.toString()}),Ze(this,"init",r=>I(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv-appsrockets"),it($(Xu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),Ze(this,"destroy",()=>{var r;this.adsOverlay&&(it(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),Ze(this,"requestAd",(r,n)=>{var i,a,o,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,ke.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(a=r.onAdError)==null||a.call(r,ke.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(o=r.onAdRequested)==null||o.call(r);let l=()=>{var p;this.adsIsShowing=!1,(p=r.onAdCompleted)==null||p.call(r,void 0)},c=()=>{var p;(p=r.onAdLoaded)==null||p.call(r,void 0)},h=p=>{var m,b;(b=(m=this.context).handleLinkClicked)==null||b.call(m,p)},u=()=>{var p;(p=r.onAdError)==null||p.call(r,ke.from(new Error("Ads load error"),"JOLIBOX_IMA_ERROR"))};this.adsIsShowing=!0,ue(()=>{this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.adLinkClicked.value=h,this.state.adError.value=u,this.state.src.value=this.processUrl(n.params.url),this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function Dt(e,t,r){return(t=Sy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sy(e){var t=Cy(e,"string");return typeof t=="symbol"?t:t+""}function Cy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Bs=class{constructor(t){Dt(this,"name","GOOGLE_GPT"),Dt(this,"context",void 0),Dt(this,"contextInfo",void 0),Dt(this,"rewardAdManager",void 0),Dt(this,"init",r=>I(this,null,function*(){if(!this.rewardAdManager){let n=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":r.params.rewardedSlot,i=`minidrama-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;this.rewardAdManager=new Zu(n,i,r.params.keyValue)}})),Dt(this,"insertScript",()=>{let r="jolibox-google-gpt",n=document.getElementById(r);n||(n=window.document.createElement("script"),n.id=r,n.async=!0,n.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",n.crossOrigin="anonymous",document.head.appendChild(n))}),Dt(this,"destroy",()=>{var r;(r=this.rewardAdManager)==null||r.withCommand(()=>{var n;(n=this.rewardAdManager)==null||n.destroy("ignored")})}),Dt(this,"requestAd",(r,n)=>{var i;if(!this.rewardAdManager){(i=r.onAdError)==null||i.call(r,ke.from(new Error("rewardAdManager not initialized"),"JOLIBOX_IMA_ERROR"));return}this.rewardAdManager.requestAds({beforeAd:r.onAdRequested,beforeReward:a=>{var o,s;(o=r.onAdLoaded)==null||o.call(r,void 0),a(),(s=r.onAdPlaying)==null||s.call(r,void 0)},adDismissed:()=>{},adViewed:()=>{},adBreakDone:a=>{var o,s;switch(a){case"viewed":{(o=r.onAdCompleted)==null||o.call(r,void 0);break}case"ignored":break;default:{(s=r.onAdError)==null||s.call(r,ke.from(new Error(a),"JOLIBOX_IMA_ERROR"));break}}}})}),this.context=t,this.contextInfo=t.getContextInfo(),this.insertScript()}};function ot(e,t,r){return(t=Ry(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ry(e){var t=Oy(e,"string");return typeof t=="symbol"?t:t+""}function Oy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $i=class e{constructor(t){if(ot(this,"context",void 0),ot(this,"contextInfo",void 0),ot(this,"providers",{}),ot(this,"requestContext",void 0),ot(this,"adsRequest",void 0),ot(this,"initialized",!1),ot(this,"preloadedAd",null),ot(this,"shouldCache",!1),t)this.context=t,this.requestContext=new on(t),this.adsRequest=new qi(t,{reward:!1,interstitial:!1,afv:!1}),this.contextInfo=this.context.getContextInfo();else throw new Error("JoliboxAdsForVideo requires a configuration object")}init(){return I(this,arguments,function*(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r,n=sessionStorage.getItem(e.STORAGE_KEY_INIT);if(n){sessionStorage.removeItem(e.STORAGE_KEY_INIT);try{r=JSON.parse(n)}catch(i){}}if(r!=null&&r.length||(r=(yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFVSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}})).data),t&&r!=null&&r.length)try{sessionStorage.setItem(e.STORAGE_KEY_INIT,JSON.stringify(r))}catch(i){}if((r==null?void 0:r.length)>0)for(let i of r)switch(i.provider){case"GOOGLE_GPT":{let a=new Bs(this.context);yield a.init(i),this.providers.GOOGLE_GPT=a;break}case"GOOGLE_IMA":{let a=new Ds(this.context);yield a.init(i),this.providers.GOOGLE_IMA=a;break}case"OKSPIN":{let a=new Ls(this.context);yield a.init(i),this.providers.OKSPIN=a;break}case"APPSROCKETS":{let a=new Us(this.context);yield a.init(i),this.providers.APPSROCKETS=a;break}}this.adsRequest.cacheAFVInfo(),this.initialized=!0,this.shouldCache=t,this.preload()})}preload(){let t=sessionStorage.getItem(e.STORAGE_KEY_INFO);if(t){sessionStorage.removeItem(e.STORAGE_KEY_INFO);try{this.preloadedAd=JSON.parse(t);return}catch(r){}}this.adsRequest.getAFVAdsInfo(!0).then(r=>{if(console.log("[JoliboxSDK] afv preload adsInfo:",r),this.preloadedAd=r,this.shouldCache&&r)try{sessionStorage.setItem(e.STORAGE_KEY_INFO,JSON.stringify(r))}catch(n){}}).catch(()=>{this.preloadedAd=null})}destroy(){let t=Object.values(this.providers);for(let r of t)r.destroy();this.initialized=!1,this.preloadedAd=null}requestAd(t){return I(this,null,function*(){var r,n,i,a,o,s,l,c,h,u,p,m;if((r=this.context.eventEmitter)==null||r.emit("isAdShowing",!0),this.initialized||(yield this.init()),!this.context.checkNetwork()){let b=ke.from(new Error("No network connection"),"JOLIBOX_IMA_ERROR");(n=t.onAdError)==null||n.call(t,b);return}try{console.log("[JoliboxSDK] requestAd this.preloadedAd:",this.preloadedAd);let b=(i=this.preloadedAd)!=null?i:yield this.adsRequest.getAFVAdsInfo(!0);this.preloadedAd=null;let E=b==null?void 0:b.code,A=b==null?void 0:b.data;if(E==="BYPASS_ADS"){(a=t.onAdRequested)==null||a.call(t),(o=t.onAdLoaded)==null||o.call(t,void 0),(s=t.onAdPlaying)==null||s.call(t,void 0),(l=t.onAdCompleted)==null||l.call(t,void 0);return}if(A){let w=A.sort((M,S)=>M.seq-S.seq);if(w.length===0){let M=ke.from(new Error("No ads available"),"JOLIBOX_IMA_ERROR");(h=t.onAdError)==null||h.call(t,M);return}let R=!0,O=null,D=new Ns(this.context);for(;w.length>0;){let M=w.shift(),S=this.providers[M.provider];if(S){let[N,J]=yield D.callAdRequestAndContinue(S,t,M);R=N,O=J}else R=!0,O=ke.from(new Error("No provider available"),"JOLIBOX_IMA_ERROR");if(!R)break}R&&O&&((u=t.onAdError)==null||u.call(t,O))}else{let w=ke.from(new Error("Unknown error"),"JOLIBOX_IMA_ERROR");(c=t.onAdError)==null||c.call(t,w);return}}catch(b){let E=ke.from(new Error("Failed to request ad"),"JOLIBOX_IMA_ERROR");(p=t.onAdError)==null||p.call(t,E)}finally{(m=this.context.eventEmitter)==null||m.emit("isAdShowing",!1),this.preload()}})}};ot($i,"STORAGE_KEY_INIT","jolibox_afv_init_data");ot($i,"STORAGE_KEY_INFO","jolibox_afv_info_data");pe();var b0=pa(rf());var un=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(){}};ht();var fn=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,h;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 p=u.callbackId;if(p){let m=this.callbackMap.get(p);(r=m==null?void 0:m.onReady)==null||r.call(m)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",u)}break;case"huawei_quick_ads_on_message_ad_break":{let p=u.callbackId;if(p){let m=this.callbackMap.get(p),b="noAdPreloaded",E=!1;switch(u.adsRes){case"viewed":b="viewed",(n=m==null?void 0:m.adViewed)==null||n.call(m),E=!1;break;case"dismissed":b="dismissed",(i=m==null?void 0:m.adDismissed)==null||i.call(m),E=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":b=u.adsRes,E=!0;break;case"breakDone":b=u.params,E=!0;break;case"beforeReward":(a=m==null?void 0:m.beforeReward)==null||a.call(m,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),E=!1;break;case"beforeAd":be("HuaweiQuickAdsAdBreakBeforeAd",{type:"beforeAd",format:(m==null?void 0:m.breakType)==="reward"?"reward":"interstitial"}),(o=m==null?void 0:m.beforeAd)==null||o.call(m),E=!1;break;case"afterAd":(s=m==null?void 0:m.afterAd)==null||s.call(m),E=!1;break}E&&((h=m==null?void 0:m.adBreakDone)==null||h.call(m,{breakType:(l=m.breakType)!=null?l:"",breakName:m.breakName,breakFormat:(c=m.breakFormat)!=null?c:"interstitial",breakStatus:b}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",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),be("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=X(X({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 hn=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(){}};pe();var Yt=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 I(this,null,function*(){var n,i;if((n=L.hostUserInfo)==null?void 0:n.isSubUser){this.wrapAdBreadDoneViewed(t);return}if(t.type==="reward")try{let a=yield nt.getRewardsTypes(this.httpClient);if(!(yield nt.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 mn=class e extends Yt{constructor(t,r){super(t,r),this.startTimes=Date.now()}adBreak(t){return I(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}}yl(e.prototype,this,"adBreak").call(this,t)})}};var js=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new un(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=fn.getInstance();break}case"gamedistribution":{this.cacheHandler=hn.getInstance();break}case"funmax":{let r=new sn(this.context);this.cacheHandler=new mn(r,Bt);break}default:{let r=new sn(this.context);this.cacheHandler=new Yt(r,Bt);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},Qi=Ae(),nf=new et,Bt=ze.create(),ky={httpClient:Bt,checkNetwork:()=>ze.getNetworkStatus(),track:be,eventEmitter:nf,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=L.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=L.deviceInfo.did)!=null?r:"",adId:(n=L.deviceInfo.adId)!=null?n:"",sessionId:(i=L.sessionId)!=null?i:"",userId:(o=(a=L.hostUserInfo)==null?void 0:a.uid)!=null?o:"",objectType:"GAME",objectId:L.mpId,testAdsMode:L.testAdsMode,channel:(s=L.joliSource)!=null?s:"",deviceBrand:L.deviceInfo.brand,deviceModel:L.deviceInfo.model,osType:Ne.isAndroid?"ANDROID":Ne.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=L.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},af=e=>{Ue("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e}),be("jolicoin_unlock_success",{quantity:e.quantity})},Ty=()=>{be("subscription_unlock_success",{})},xy=new js(ky),pn=xy.getAdsHandler(L.sdkEnvironment);nt.registerRewardHandler("ADS",Cc(pn.getAdsInstance()));nt.registerRewardHandler("JOLI_COIN",Oc(Bt,{onUnlockSuccess:af.bind(void 0),hasSubscription:()=>!0}));nt.registerRewardHandler("JOLI_COIN_ONLY",kc(Bt,{onUnlockSuccess:af.bind(void 0),hasSubscription:()=>!0}));nt.registerRewardHandler("SUBSCRIPTION",Pc(Bt,{onSubSuccess:Ty.bind(void 0),hasSubscription:()=>!0}));ho(Bt);si(Bt);nf.on("isAdShowing",e=>{Ue("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Qi.registerCommand("AdsSDK.init",e=>{pn.init(e)});Qi.registerCommand("AdsSDK.adConfig",e=>{pn.adConfig(e)});Qi.registerCommand("AdsSDK.adBreak",e=>{pn.adBreak(e)});Qi.registerCommand("AdsSDK.adUnit",e=>{pn.adUnit(e)});W();ht();Ur();var Hs=Ae();Hs.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();Ue("CP_LOAD_FINISH",{duration:e}),be("loadFinished",{duration:e})});Hs.registerCommand("RuntimeSDK.loadProgressEvent",e=>{Ue("CP_LOAD_PROGRESS",{progress:e}),console.log("RuntimeSDK.loadProgressEvent",e)});Hs.registerCommand("RuntimeSDK.gameTTIEvent",()=>{Ue("CP_GAME_TTI",{duration:performance.now()}),be("gameTTI",{duration:performance.now()})});W();ht();var uf=-1,ea=function(e){addEventListener("pageshow",function(t){t.persisted&&(uf=t.timeStamp,e(t))},!0)},Vs=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ta=function(){var e=Vs();return e&&e.activationStart||0},Ir=function(e,t){var r=Vs(),n="navigate";return uf>=0?n="back-forward-cache":r&&(document.prerendering||ta()>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}},ff=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){}},Ar=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))}},hf=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},mf=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},pf=function(e){var t=!1;return function(){t||(e(),t=!0)}},Er=-1,of=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Zi=function(e){document.visibilityState==="hidden"&&Er>-1&&(Er=e.type==="visibilitychange"?e.timeStamp:0,Ny())},sf=function(){addEventListener("visibilitychange",Zi,!0),addEventListener("prerenderingchange",Zi,!0)},Ny=function(){removeEventListener("visibilitychange",Zi,!0),removeEventListener("prerenderingchange",Zi,!0)},vf=function(){return Er<0&&(Er=of(),sf(),ea(function(){setTimeout(function(){Er=of(),sf()},0)})),{get firstHiddenTime(){return Er}}},$s=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},lf=[1800,3e3],gf=function(e,t){t=t||{},$s(function(){var r,n=vf(),i=Ir("FCP"),a=ff("paint",function(o){o.forEach(function(s){s.name==="first-contentful-paint"&&(a.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-ta(),0),i.entries.push(s),r(!0)))})});a&&(r=Ar(e,i,lf,t.reportAllChanges),ea(function(o){i=Ir("FCP"),r=Ar(e,i,lf,t.reportAllChanges),hf(function(){i.value=performance.now()-o.timeStamp,r(!0)})}))})};var Py=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=pf(e),document.visibilityState==="hidden"?e():(r=t(e),mf(e)),r};var cf=[2500,4e3],qs={},_f=function(e,t){t=t||{},$s(function(){var r,n=vf(),i=Ir("LCP"),a=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-ta(),0),i.entries=[c],r())})},o=ff("largest-contentful-paint",a);if(o){r=Ar(e,i,cf,t.reportAllChanges);var s=pf(function(){qs[i.id]||(a(o.takeRecords()),o.disconnect(),qs[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return Py(s)},{once:!0,capture:!0})}),mf(s),ea(function(l){i=Ir("LCP"),r=Ar(e,i,cf,t.reportAllChanges),hf(function(){i.value=performance.now()-l.timeStamp,qs[i.id]=!0,r(!0)})})}})},df=[800,1800],Dy=function e(t){document.prerendering?$s(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},yf=function(e,t){t=t||{};var r=Ir("TTFB"),n=Ar(e,r,df,t.reportAllChanges);Dy(function(){var i=Vs();i&&(r.value=Math.max(i.responseStart-ta(),0),r.entries=[i],n(!0),ea(function(){r=Ir("TTFB",0),(n=Ar(e,r,df,t.reportAllChanges))(!0)}))})};pe();nr();ut();W();Ur();W();var ra=new Map,bf=!1,Ly=()=>{bf||(Ht("ON_JOLIBOX_GET_USER_SUB_STATUS",e=>{let t=ra.get(e.sequenceId);if(t){clearTimeout(t.timeoutId);let{isSubUser:r,userId:n}=e;t.resolve({isSubUser:r,userId:n}),ra.delete(e.sequenceId)}}),bf=!0)};function Ks(){return I(this,null,function*(){return Ly(),new Promise((e,t)=>{let r=We(),n=setTimeout(()=>{ra.delete(r),t(new Error("Timeout waiting for user sub status response"))},3e3);ra.set(r,{resolve:e,reject:t,timeoutId:n}),Ue("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function wf(){return I(this,null,function*(){let e=ze.create();try{let t=yield e.get("/api/users/info");return!(t.code!=="SUCCESS"||!t.data)}catch(t){return je(new wn(t)),!1}})}function Uy(){gf(e=>{be("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),_f(e=>{be("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),yf(e=>{be("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function By(){kt.on("onDocumentReady",e=>I(this,null,function*(){let t=yield wf(),{isSubUser:r,userId:n}=yield Ks().catch(()=>({isSubUser:!1,userId:void 0}));L.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:r,uid:n}}),kt.emit("LifecycleEvent.onReady",X({},L.hostUserInfo?L.hostUserInfo:{isLogin:!1})),L.mpType==="game"&&Ye.start(Date.now()-e)}))}function Ef(){By(),Uy()}Ef();
304
304
  /*! Bundled license information:
305
305
 
306
306
  localforage/dist/localforage.js: