@jolibox/bootstrap 1.1.49 → 1.1.51
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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"packages/bootstrap/.rush/temp/shrinkwrap-deps.json": "85f115f9fbe6f1e962199c288bb411864903ba42",
|
|
4
4
|
"packages/bootstrap/.eslintrc.js": "edf42cea6fba51042e3fc82241d56a202f11a83a",
|
|
5
5
|
"packages/bootstrap/README.md": "9b60fc4ee630488fd6ce5cc43a6bbd5c06e175fb",
|
|
6
|
-
"packages/bootstrap/package.json": "
|
|
6
|
+
"packages/bootstrap/package.json": "c47327784972af4eddc692c4830bab9249285a67",
|
|
7
7
|
"packages/bootstrap/src/index.ts": "1db013adc75ad61e7425a64874d5141e45e222a8",
|
|
8
8
|
"packages/bootstrap/src/runtime.ts": "5fc40aad67a54eb6964d771af06af47d5074dfe4",
|
|
9
9
|
"packages/bootstrap/tsconfig.json": "ef597317f67bfb548a17f81a3b7a3ca64f08bb93"
|
package/bootstrap.build.log
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var L=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var M=(e,t)=>{for(var r in t)L(e,r,{get:t[r],enumerable:!0})},T=(e,t,r,n)=>{for(var s=n>1?void 0:n?C(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(n?a(t,r,s):a(s))||s);return n&&s&&L(t,r,s),s},j=(e,t,r)=>new Promise((n,s)=>{var o=l=>{try{c(r.next(l))}catch(u){s(u)}},a=l=>{try{c(r.throw(l))}catch(u){s(u)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);c((r=r.apply(e,t)).next())});if(typeof window<"u"&&!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 s=this._eventListeners[r].indexOf(n);s!==-1&&this._eventListeners[r].splice(s,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 F(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function k(e){return typeof e=="string"}function K(e){return typeof e>"u"}function J(e){return K(e)||e===null}function G(e){return typeof e=="function"}function D(e){let t=e,r=null,n=function(...s){return r||(r=new t(...s)),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 d(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var W={log:d("log"),warn:d("warn"),info:d("info"),error:d("error"),debug:d("debug")};Object.assign(globalThis,{logger:W});var b=Symbol.for("Jolibox.canIUseMap"),z={};globalThis[b]||(globalThis[b]=z);var I=Symbol.for("Jolibox.canIUseMap.native"),H={};globalThis[I]||(globalThis[I]=H);var $=(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))($||{}),B=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(B||{}),Q=(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))(Q||{});function X(){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}}X();var le={isiOS: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:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")};var E=class v{constructor(t){this.element=t,this.next=v.Undefined,this.prev=v.Undefined}};E.Undefined=new E(void 0);var i=E,Y=class{constructor(){this._first=i.Undefined,this._last=i.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===i.Undefined}clear(){let e=this._first;for(;e!==i.Undefined;){let t=e.next;e.prev=i.Undefined,e.next=i.Undefined,e=t}this._first=i.Undefined,this._last=i.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new i(e);if(this._first===i.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==i.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==i.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==i.Undefined&&e.next!==i.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===i.Undefined&&e.next===i.Undefined?(this._first=i.Undefined,this._last=i.Undefined):e.next===i.Undefined?(this._last=this._last.prev,this._last.next=i.Undefined):e.prev===i.Undefined&&(this._first=this._first.next,this._first.prev=i.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==i.Undefined;)yield e.element,e=e.next}},q=0,h=class{constructor(e){this.value=e,this.id=q++}},m=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 h&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>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,s,o,a,c,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let u=new h(t);return this._listeners?this._listeners instanceof h?this._listeners=[this._listeners,u]:this._listeners.push(u):((s=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||s.call(n,this),this._listeners=u,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(c=this.options)==null?void 0:c.onDidAddListener)==null||l.call(c,this),this._size++,()=>{var _,A,p,w;if(!this._disposed){if(this._listeners instanceof h)this._listeners.id===u.id&&(this._listeners=void 0,this._size=0,(A=(_=this.options)==null?void 0:_.onDidRemoveLastListener)==null||A.call(_));else if(this._listeners){let S=this._listeners.indexOf(u);S>=0&&(this._listeners.splice(S,1),this._size--,this._size===0&&((w=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||w.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(s){n(s)}}fire(e){this._listeners&&(this._listeners instanceof h?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Z=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let s=(n=this.listeners.get(e))!=null?n:new m,o=l=>t(...l.args),a=s.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,s);let c=this.cachedEventQueue.get(e);if(c&&r)for(let l of c)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 Y,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)}},R={};M(R,{None:()=>ee,filter:()=>re,once:()=>P,toPromise:()=>te});var ee=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function te(e){return new Promise(t=>P(e)(t))}function P(e){return(t,r=null)=>{let n=!1;return e(s=>{if(!n)return n=!0,t.call(r,s)},null)}}function re(e,t){return(r=>{let n,s={onWillAddFirstListener(){n=r(o.fire,o)}},o=new m(s);return o.event})((r,n=null)=>e(s=>t(s)&&r.call(n,s),null))}var g=Symbol.for("Jolibox.hostEmitter"),ne=()=>{let e=new Z;return globalThis[g]||(globalThis[g]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[g]},ce=ne();function se(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ie(e[n],t[n])}function ie(e,t){if(k(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(G(t)){try{if(e instanceof t)return}catch{}if(!J(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 f=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new m,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 s of e.metadata.args)r.push(s.constraint);let n=e.handler;e.handler=function(...s){return se(s,r),n(...s)}}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}};f=T([D],f);var x=class{constructor(){this._onWillExecuteCommand=new m,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new m,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new f,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=F(3e4)),this._starActivation}executeCommand(e,...t){return j(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),R.toPromise(R.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}}};x=T([D],x);var N=Symbol.for("Jolibox.commands");function oe(){return typeof globalThis<"u"?globalThis[N]:void 0}function ae(e){typeof globalThis<"u"&&(globalThis[N]=e)}function U(e=!1){let t=oe();if(!e&&t)return t;let r=new f,n=new x,s={registerCommand(o,a,c){r.registerCommand({id:o,handler:a,metadata:c})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return ae(s),s}var y=U();window.dispatchEvent(new Event("JOLIBOX_RUNTIME_LOAD_START"));var O=class{constructor(){this.loadFinished=()=>{if(document?.head.querySelector('meta[name="dlightek"][content="jolibox"]'))window.postMessage("gameLoadingCompleted","*");else{let r=new Event("JOLIBOX_RUNTIME_LOAD_FINISHED");window.dispatchEvent(r)}y.executeCommand("RuntimeSDK.loadFinishedEvent"),y.executeCommand("ReportSDK.traceSystem",{event:"CallRuntimeLoadFinished",info:{t:Date.now()}})};this.notifyLoadProgress=t=>{let r=Math.ceil(t),n=new CustomEvent("JOLIBOX_RUNTIME_LOAD_PROGRESS",{detail:r});window.dispatchEvent(n),y.executeCommand("RuntimeSDK.loadProgressEvent",r)}}};window.JoliboxRuntime=O;})();
|
|
1
|
+
"use strict";(()=>{var T=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var j=(e,t)=>{for(var r in t)T(e,r,{get:t[r],enumerable:!0})},D=(e,t,r,n)=>{for(var s=n>1?void 0:n?M(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(n?a(t,r,s):a(s))||s);return n&&s&&T(t,r,s),s},F=(e,t,r)=>new Promise((n,s)=>{var o=l=>{try{c(r.next(l))}catch(u){s(u)}},a=l=>{try{c(r.throw(l))}catch(u){s(u)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);c((r=r.apply(e,t)).next())});if(typeof window<"u"&&!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 s=this._eventListeners[r].indexOf(n);s!==-1&&this._eventListeners[r].splice(s,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 k(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function K(e){return typeof e=="string"}function J(e){return typeof e>"u"}function G(e){return J(e)||e===null}function V(e){return typeof e=="function"}function P(e){let t=e,r=null,n=function(...s){return r||(r=new t(...s)),r};return n.prototype=t.prototype,n}var W=(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))(W||{});function d(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var z={log:d("log"),warn:d("warn"),info:d("info"),error:d("error"),debug:d("debug")};Object.assign(globalThis,{logger:z});var I=Symbol.for("Jolibox.canIUseMap"),H={};globalThis[I]||(globalThis[I]=H);var L=Symbol.for("Jolibox.canIUseMap.native"),$={};globalThis[L]||(globalThis[L]=$);var B=(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))(B||{}),Q=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Q||{}),X=(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))(X||{});function Y(){if(typeof window>"u")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}}Y();var h=typeof window>"u";var ce={isiOS:!h&&(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:!h&&navigator.userAgent.includes("Android"),isMac:!h&&navigator.userAgent.includes("Mac"),isFacebook:!h&&navigator.userAgent.includes("FB_IAB"),isPC:!h&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")};var v=class R{constructor(t){this.element=t,this.next=R.Undefined,this.prev=R.Undefined}};v.Undefined=new v(void 0);var i=v,q=class{constructor(){this._first=i.Undefined,this._last=i.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===i.Undefined}clear(){let e=this._first;for(;e!==i.Undefined;){let t=e.next;e.prev=i.Undefined,e.next=i.Undefined,e=t}this._first=i.Undefined,this._last=i.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new i(e);if(this._first===i.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==i.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==i.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==i.Undefined&&e.next!==i.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===i.Undefined&&e.next===i.Undefined?(this._first=i.Undefined,this._last=i.Undefined):e.next===i.Undefined?(this._last=this._last.prev,this._last.next=i.Undefined):e.prev===i.Undefined&&(this._first=this._first.next,this._first.prev=i.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==i.Undefined;)yield e.element,e=e.next}},Z=0,m=class{constructor(e){this.value=e,this.id=Z++}},f=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 m&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>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,s,o,a,c,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let u=new m(t);return this._listeners?this._listeners instanceof m?this._listeners=[this._listeners,u]:this._listeners.push(u):((s=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||s.call(n,this),this._listeners=u,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(c=this.options)==null?void 0:c.onDidAddListener)==null||l.call(c,this),this._size++,()=>{var p,A,g,S;if(!this._disposed){if(this._listeners instanceof m)this._listeners.id===u.id&&(this._listeners=void 0,this._size=0,(A=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||A.call(p));else if(this._listeners){let b=this._listeners.indexOf(u);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((S=(g=this.options)==null?void 0:g.onDidRemoveLastListener)==null||S.call(g)))}}}}),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(s){n(s)}}fire(e){this._listeners&&(this._listeners instanceof m?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ee=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let s=(n=this.listeners.get(e))!=null?n:new f,o=l=>t(...l.args),a=s.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,s);let c=this.cachedEventQueue.get(e);if(c&&r)for(let l of c)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 q,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)}},y={};j(y,{None:()=>te,filter:()=>ne,once:()=>N,toPromise:()=>re});var te=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function re(e){return new Promise(t=>N(e)(t))}function N(e){return(t,r=null)=>{let n=!1;return e(s=>{if(!n)return n=!0,t.call(r,s)},null)}}function ne(e,t){return(r=>{let n,s={onWillAddFirstListener(){n=r(o.fire,o)}},o=new f(s);return o.event})((r,n=null)=>e(s=>t(s)&&r.call(n,s),null))}var E=Symbol.for("Jolibox.hostEmitter"),se=()=>{let e=new ee;return globalThis[E]||(globalThis[E]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[E]},ue=se();function ie(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)oe(e[n],t[n])}function oe(e,t){if(K(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(V(t)){try{if(e instanceof t)return}catch{}if(!G(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 _=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new f,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 s of e.metadata.args)r.push(s.constraint);let n=e.handler;e.handler=function(...s){return ie(s,r),n(...s)}}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}};_=D([P],_);var x=class{constructor(){this._onWillExecuteCommand=new f,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new f,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new _,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=k(3e4)),this._starActivation}executeCommand(e,...t){return F(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),y.toPromise(y.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}}};x=D([P],x);var U=Symbol.for("Jolibox.commands");function ae(){return typeof globalThis<"u"?globalThis[U]:void 0}function le(e){typeof globalThis<"u"&&(globalThis[U]=e)}function C(e=!1){let t=ae();if(!e&&t)return t;let r=new _,n=new x,s={registerCommand(o,a,c){r.registerCommand({id:o,handler:a,metadata:c})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return le(s),s}var O=C();window.dispatchEvent(new Event("JOLIBOX_RUNTIME_LOAD_START"));var w=class{constructor(){this.loadFinished=()=>{if(document?.head.querySelector('meta[name="dlightek"][content="jolibox"]'))window.postMessage("gameLoadingCompleted","*");else{let r=new Event("JOLIBOX_RUNTIME_LOAD_FINISHED");window.dispatchEvent(r)}O.executeCommand("RuntimeSDK.loadFinishedEvent"),O.executeCommand("ReportSDK.traceSystem",{event:"CallRuntimeLoadFinished",info:{t:Date.now()}})};this.notifyLoadProgress=t=>{let r=Math.ceil(t),n=new CustomEvent("JOLIBOX_RUNTIME_LOAD_PROGRESS",{detail:r});window.dispatchEvent(n),O.executeCommand("RuntimeSDK.loadProgressEvent",r)}}};window.JoliboxRuntime=w;})();
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/bootstrap",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk bootstrap",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.51",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.1.
|
|
9
|
+
"@jolibox/common": "1.1.51"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"typescript": "5.7.3",
|