@jolibox/common 1.1.13-beta.3 → 1.1.13-beta.5

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.
@@ -0,0 +1,14 @@
1
+ type StorageIsolationOptions = {
2
+ namespace?: string;
3
+ debug?: boolean;
4
+ };
5
+ declare global {
6
+ interface Window {
7
+ __joliboxLocalStorage__: typeof window.localStorage;
8
+ }
9
+ }
10
+ export declare function createStorageIsolation(options?: StorageIsolationOptions): {
11
+ isolateFrame: (frame: HTMLIFrameElement) => void;
12
+ isolateWindowStorage: () => void;
13
+ };
14
+ export {};
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var v=Object.defineProperty,Pe=Object.defineProperties,me=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertyNames,de=Object.getOwnPropertySymbols;var ce=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var le=(n,e,t)=>e in n?v(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,f=(n,e)=>{for(var t in e||(e={}))ce.call(e,t)&&le(n,t,e[t]);if(de)for(var t of de(e))Me.call(e,t)&&le(n,t,e[t]);return n},N=(n,e)=>Pe(n,ke(e));var ue=(n,e)=>{for(var t in e)v(n,t,{get:e[t],enumerable:!0})},Se=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Le(e))!ce.call(n,o)&&o!==t&&v(n,o,{get:()=>e[o],enumerable:!(r=me(e,o))||r.enumerable});return n};var Ue=n=>Se(v({},"__esModule",{value:!0}),n),O=(n,e,t,r)=>{for(var o=r>1?void 0:r?me(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(o=(r?a(e,t,o):a(o))||o);return r&&o&&v(e,t,o),o};var w=(n,e,t)=>new Promise((r,o)=>{var i=s=>{try{m(t.next(s))}catch(c){o(c)}},a=s=>{try{m(t.throw(s))}catch(c){o(c)}},m=s=>s.done?r(s.value):Promise.resolve(s.value).then(i,a);m((t=t.apply(n,e)).next())});var xn={};ue(xn,{ADVERTISING_ID:()=>be,APIError:()=>q,BaseError:()=>T,DEVICE_ID:()=>ve,Deferred:()=>U,EPlatform:()=>he,EProject:()=>Re,EventEmitter:()=>h,EventType:()=>xe,EventUtils:()=>E,InternalApplyNativeError:()=>z,InternalBufferError:()=>Q,InternalContextError:()=>X,InternalError:()=>u,InternalGlobalJSError:()=>Y,InternalInvokeMethodError:()=>B,InternalInvokeNativeError:()=>$,InternalJSCoreNotFoundError:()=>W,InternalJSModuleEvalError:()=>J,InternalJSModuleFetchError:()=>G,InternalMetricReportError:()=>Z,InternalReporterError:()=>ee,InternalSchemaParseError:()=>K,LoadScriptCode:()=>ge,Singleton:()=>b,UserCustomError:()=>I,UserError:()=>y,UserFetchError:()=>H,UserFunctionEvalError:()=>j,UserGlobalError:()=>F,UserValidateError:()=>V,canIUseConfig:()=>nn,compareVersion:()=>rn,createCommands:()=>Tn,createRunTaskQueue:()=>He,debounce:()=>Ye,get:()=>tn,getAdvertisingId:()=>Ae,getDeviceId:()=>Ie,getPlatform:()=>_e,getStorage:()=>re,getUtmSource:()=>Ce,hostEmitter:()=>En,isArray:()=>Ge,isBoolean:()=>ze,isDefined:()=>Be,isFunction:()=>L,isIterable:()=>$e,isNumber:()=>Je,isObject:()=>pe,isPromiseLike:()=>We,isString:()=>P,isStringArray:()=>je,isTypedArray:()=>Ke,isUndefined:()=>fe,isUndefinedOrNull:()=>k,isValidUUIDV4:()=>ln,logger:()=>ne,mergeArray:()=>Xe,mergeWith:()=>Qe,microTask:()=>Fe,platform:()=>C,promisifyAPI:()=>Ve,serializeEventPackage:()=>dn,sleep:()=>De,timeout:()=>D,uuidv4:()=>te,validateConstraint:()=>Oe,validateConstraints:()=>ie,wrapUserFunction:()=>Ze,xUserAgent:()=>cn});module.exports=Ue(xn);if(typeof window!="undefined"&&!window.AbortController){let n=function(){this.signal=new e};n.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let t=new Event("abort");this.signal.dispatchEvent(t)};let e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(t,r){this._eventListeners[t]||(this._eventListeners[t]=[]),this._eventListeners[t].push(r)},e.prototype.removeEventListener=function(t,r){if(!this._eventListeners[t])return;let o=this._eventListeners[t].indexOf(r);o!==-1&&this._eventListeners[t].splice(o,1)},e.prototype.dispatchEvent=function(t){if(this._eventListeners[t.type])for(let r of this._eventListeners[t.type])r.call(this,t)},window.AbortController=n,window.AbortSignal=e}function D(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}function De(n){return new Promise(e=>setTimeout(e,n))}function Ve(n){return e=>new Promise((t,r)=>{n(N(f({},e),{success:t,fail(o){let i=new Error(o.errMsg);r(i)}}))})}function Fe(n){if(n)Promise.resolve().then(n);else return Promise.resolve()}var U=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 He(){let n=[],e=!1,t=()=>w(this,null,function*(){let r=n.shift();if(r){e=!0;try{yield r()}finally{e=!1,t()}}});return r=>{n.push(r),e||t()}}function P(n){return typeof n=="string"}function je(n){return Array.isArray(n)&&n.every(e=>P(e))}function pe(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof RegExp)&&!(n instanceof Date)}function Ke(n){let e=Object.getPrototypeOf(Uint8Array);return typeof n=="object"&&n instanceof e}function Ge(n){return typeof n=="object"&&Array.isArray(n)}function Je(n){return typeof n=="number"&&!isNaN(n)}function $e(n){return!!n&&typeof n[Symbol.iterator]=="function"}function ze(n){return n===!0||n===!1}function fe(n){return typeof n=="undefined"}function Be(n){return!k(n)}function k(n){return fe(n)||n===null}function L(n){return typeof n=="function"}function We(n){return pe(n)&&L(n.then)}function b(n){let e=n,t=null,r=function(...o){return t||(t=new e(...o)),t};return r.prototype=e.prototype,r}function Qe(n,e,t){if(typeof t!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function r(o,i){for(let a in i)if(Object.prototype.hasOwnProperty.call(i,a)){let m=o[a],s=i[a],c=t(m,s,a,o,i);c!==void 0?o[a]=c:ye(s)&&ye(m)?o[a]=r(f({},m),s):Array.isArray(s)&&Array.isArray(m)?o[a]=[...m,...s]:o[a]=s}return o}return r(n,e)}function ye(n){return n&&typeof n=="object"&&n.constructor===Object}function Xe(n,e){if(Array.isArray(n))return n.concat(e)}function Ye(n,e,t={}){let r=null,o,i,a,{leading:m=!1,trailing:s=!0}=t,c=()=>(a=n.apply(i,o),o=void 0,i=void 0,a),d=function(...we){o=we,i=this;let ae=m&&!r;if(r&&clearTimeout(r),r=setTimeout(()=>{r=null,s&&!ae&&c()},e),ae)return c()};return d.cancel=()=>{r&&clearTimeout(r),r=null,o=i=void 0},d.flush=()=>{if(r)return clearTimeout(r),r=null,c()},d}var ge=(s=>(s[s.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",s[s.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",s[s.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",s[s.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",s[s.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",s[s.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",s[s.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",s[s.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",s))(ge||{}),T=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}},u=class extends T{constructor(){super(...arguments);this.kind="INTERNAL_ERROR"}},y=class extends T{constructor(){super(...arguments);this.kind="USER_ERROR"}},V=class extends y{constructor(){super(...arguments);this.name="USER_VALIDATE_ERROR"}},F=class extends y{constructor(){super(...arguments);this.name="USER_GLOBAL_ERROR";this.priority="P1"}},I=class extends y{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_CUSTOM_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},H=class extends y{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_FETCH_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},j=class extends y{constructor(){super(...arguments);this.name="USER_CALLBACK_ERROR"}},K=class extends u{constructor(){super(...arguments);this.name="INTERNAL_SCHEMA_PARSE_ERROR";this.priority="P0"}},G=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_FETCH_ERROR";this.priority="P0"}},J=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_EVAL_ERROR";this.priority="P0"}},$=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},z=class extends u{constructor(t,r,o,i){super(t);this.errNo=r;this.name="INTERNAL_APPLY_NATIVE_ERROR";this.errorType=o,this.errorCode=i}},B=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_METHOD_ERROR"}},W=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JSCORE_ERROR";this.priority="P0"}},Q=class extends u{constructor(){super(...arguments);this.name="INTERNAL_BUFFER_ERROR"}},X=class extends u{constructor(t,r){super(t);this.message=t;this.name="INTERNAL_CONTEXT_ERROR";this.property=r}},Y=class extends u{constructor(){super(...arguments);this.name="INTERNAL_GLOBAL_JS_ERROR";this.priority="P1"}},q=class extends T{constructor(t,r,o,i,a){super(t);this.message=t;this.code=r;this.kind="API_ERROR";this.name="API_ERROR";o&&(this.errorType=o),i!==void 0&&(this.stack=i),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Z=class extends u{constructor(){super(...arguments);this.name="INTERNAL_METRIC_REPORT_ERROR"}},ee=class extends u{constructor(){super(...arguments);this.name="INTERNAL_REPORTER_ERROR"}};function qe(n,e){return(...t)=>e(n,...t)}function Ze(n){return e=>qe(e,function(t,...r){if(typeof t=="function")try{return t.apply(this,r)}catch(o){n(new I(`${o}`))}})}function A(n){return(...e)=>{var r,o;((o=(r=globalThis.VConsole)==null?void 0:r[n])!=null?o:globalThis.console[n])(...e)}}var ne={log:A("log"),warn:A("warn"),info:A("info"),error:A("error"),debug:A("debug")};Object.assign(globalThis,{logger:ne});var Ee=Symbol.for("Jolibox.canIUseMap"),en={};globalThis[Ee]=en;var nn={get config(){return globalThis[Ee]}};function tn(n,e,t){let r=n;for(let o of e)if(r&&typeof r=="object")r=r[o];else return t;return r===void 0?t:r}function rn(n,e,t){let r=0;if(n!==e){let o=n.split("."),i=e.split("."),a=Math.max(o.length,i.length);for(let m=0;m<a;m++){let s=parseInt(o[m],10)||0,c=parseInt(i[m],10)||0;if(s>c){r=1;break}else if(s<c){r=-1;break}}}if(!t)return r;switch(t){case">":return r>0;case"<":return r<0;case"=":return r===0;case">=":return r>=0;case"<=":return r<=0;default:return!1}}var xe=(r=>(r[r.System=1e3]="System",r[r.ErrorTrace=1001]="ErrorTrace",r[r.UserDefined=1002]="UserDefined",r))(xe||{}),Re=(i=>(i.MiniGame="mini-game",i.MiniDrama="mini-drama",i.App="app",i.WebSDK="web-sdk",i.AppSDK="app-sdk",i))(Re||{}),he=(d=>(d[d.App=0]="App",d[d.H5=1]="H5",d[d.Weapp=2]="Weapp",d[d.Alipay=3]="Alipay",d[d.Gcash=4]="Gcash",d[d.Dana=5]="Dana",d[d.Umma=6]="Umma",d[d.WebSDK=1e3]="WebSDK",d[d.AppSDK=1001]="AppSDK",d[d.Other=9999]="Other",d))(he||{}),Te=["name","params"],on=["name","type","location","target","extra","timestamp","userId"],sn=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function M(n,e){return e.map(t=>{if(t==="params"&&n[t]){let r=n[t];return Object.keys(r).reduce((o,i)=>(o[i]=String(r[i]),o),{})}return n[t]})}function an(n){let e=n.location?M(n.location,Te):null,t=n.target?M(n.target,Te):null;return M(N(f({},n),{location:e,target:t}),on)}function dn(n){let e=n.events.map(r=>an(r)),t=M(n.device,sn);return[n.protocolVersion,e,t,n.project]}var te=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),ln=n=>/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i.test(n);var C={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let n=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[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")},_e=()=>C.isiOS?"iOS":C.isAndroid?"Android":C.isMac?"Mac":C.isFacebook?"Facebook":"PC",ve="device_id",be="advertising_id",re=n=>(localStorage.getItem(n)||localStorage.setItem(n,te()),localStorage.getItem(n)),Ie=()=>re(ve),Ae=()=>re(be),mn=n=>n.charAt(0).toUpperCase()+n.slice(1),Ce=()=>{var e;let n=new URLSearchParams(window.location.search);return mn((e=n.get("utm_source"))!=null?e:"")||"JoliboxSDK"},cn=n=>{let e="JoliboxWebSDK",t=_e(),r=navigator.language,o=Ie(),i=Ae();return`${e} (${Ce()}${t}; UnknownModel; UnknownSystemVersion; ${r}) uuid/${o} adid/${i} version/${n||""}`};var x=class x{constructor(e){this.element=e,this.next=x.Undefined,this.prev=x.Undefined}};x.Undefined=new x(void 0);var l=x,S=class{constructor(){this._first=l.Undefined;this._last=l.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===l.Undefined}clear(){let e=this._first;for(;e!==l.Undefined;){let t=e.next;e.prev=l.Undefined,e.next=l.Undefined,e=t}this._first=l.Undefined,this._last=l.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new l(e);if(this._first===l.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 o=!1;return()=>{o||(o=!0,this._remove(r))}}shift(){if(this._first!==l.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==l.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==l.Undefined&&e.next!==l.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===l.Undefined&&e.next===l.Undefined?(this._first=l.Undefined,this._last=l.Undefined):e.next===l.Undefined?(this._last=this._last.prev,this._last.next=l.Undefined):e.prev===l.Undefined&&(this._first=this._first.next,this._first.prev=l.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==l.Undefined;)yield e.element,e=e.next}};var un=0,R=class{constructor(e){this.value=e;this.id=un++}},p=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 R&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(o=>(o==null?void 0:o.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 i,a,m,s,c,d;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let o=new R(t);this._listeners?this._listeners instanceof R?this._listeners=[this._listeners,o]:this._listeners.push(o):((a=(i=this.options)==null?void 0:i.onWillAddFirstListener)==null||a.call(i,this),this._listeners=o,(s=(m=this.options)==null?void 0:m.onDidFirstListener)==null||s.call(m,this)),(d=(c=this.options)==null?void 0:c.onDidAddListener)==null||d.call(c,this),this._size++}),this._event}_deliver(e,t){var o;if(!e)return;let r=((o=this.options)==null?void 0:o.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}fire(e){this._listeners&&(this._listeners instanceof R?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},h=class{constructor(){this.listeners=new Map;this.listerHandlerMap=new WeakMap;this.cachedEventQueue=new Map}on(e,t){var a;let r=(a=this.listeners.get(e))!=null?a:new p,o=m=>t(...m.args);this.listerHandlerMap.set(t,o),r.event(o),this.listeners.set(e,r);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)r.fire(f({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let o=this.listerHandlerMap.get(t);r.dispose(o)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let o=this.cachedEventQueue.get(e);o||(o=new S,this.cachedEventQueue.set(e,o)),o.push({args:t})}}};var E={};ue(E,{None:()=>pn,filter:()=>yn,once:()=>Ne,toPromise:()=>fn});var pn=()=>{console.log("[Jolibox SDK] None Event")};function fn(n){return new Promise(e=>Ne(n)(e))}function Ne(n){return(e,t=null)=>{let r=!1;return n(i=>{if(!r)return r=!0,e.call(t,i)},null)}}function yn(n,e){return(r=>{let o,i={onWillAddFirstListener(){o=r(a.fire,a)}},a=new p(i);return a.event})((r,o=null)=>n(i=>e(i)&&r.call(o,i),null))}var oe=Symbol.for("Jolibox.hostEmitter"),gn=()=>{let n=new h;return globalThis[oe]||(globalThis[oe]={on:n.on.bind(n),off:n.off.bind(n),emit:n.emit.bind(n)}),globalThis[oe]},En=gn();function ie(n,e){let t=Math.min(n.length,e.length);for(let r=0;r<t;r++)Oe(n[r],e[r])}function Oe(n,e){if(P(e)){if(typeof n!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(L(e)){try{if(n instanceof e)return}catch(t){}if(!k(n)&&n.constructor===e||e.length===1&&e.call(void 0,n)===!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 g=class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new p;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 o=[];for(let a of e.metadata.args)o.push(a.constraint);let i=e.handler;e.handler=function(...a){return ie(a,o),i(...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}};g=O([b],g);var _=class{constructor(){this._onWillExecuteCommand=new p;this.onWillExecuteCommand=this._onWillExecuteCommand.event;this._onDidExecuteCommand=new p;this.onDidExecuteCommand=this._onDidExecuteCommand.event;this.registry=new g;this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=D(3e4)),this._starActivation}executeCommand(e,...t){return w(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),E.toPromise(E.filter(this.registry.onDidRegisterCommand,o=>o===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!!!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let o=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let i=this.invokeFunction(o.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),i}_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 o=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(o)}catch(o){return Promise.reject(o)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};_=O([b],_);var se=Symbol.for("Jolibox.commands");function Tn(){if(globalThis[se])return globalThis[se];let n=new g,e=new _,t={registerCommand(r,o,i){n.registerCommand({id:r,handler:o,metadata:i})},executeCommand(r,...o){return e.executeCommand(r,...o)},excuteCommandSync(r,...o){return e.executeCommandThowErr(r,...o)}};return globalThis[se]=t,t}
1
+ "use strict";var v=Object.defineProperty,Le=Object.defineProperties,ce=Object.getOwnPropertyDescriptor,Pe=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertyNames,de=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;var le=(n,e,t)=>e in n?v(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,f=(n,e)=>{for(var t in e||(e={}))me.call(e,t)&&le(n,t,e[t]);if(de)for(var t of de(e))ke.call(e,t)&&le(n,t,e[t]);return n},w=(n,e)=>Le(n,Pe(e));var ue=(n,e)=>{for(var t in e)v(n,t,{get:e[t],enumerable:!0})},Me=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Se(e))!me.call(n,o)&&o!==t&&v(n,o,{get:()=>e[o],enumerable:!(r=ce(e,o))||r.enumerable});return n};var Ue=n=>Me(v({},"__esModule",{value:!0}),n),O=(n,e,t,r)=>{for(var o=r>1?void 0:r?ce(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(o=(r?a(e,t,o):a(o))||o);return r&&o&&v(e,t,o),o};var N=(n,e,t)=>new Promise((r,o)=>{var i=s=>{try{c(t.next(s))}catch(m){o(m)}},a=s=>{try{c(t.throw(s))}catch(m){o(m)}},c=s=>s.done?r(s.value):Promise.resolve(s.value).then(i,a);c((t=t.apply(n,e)).next())});var _n={};ue(_n,{ADVERTISING_ID:()=>be,APIError:()=>q,BaseError:()=>T,DEVICE_ID:()=>ve,Deferred:()=>U,EPlatform:()=>Re,EProject:()=>_e,EventEmitter:()=>R,EventType:()=>xe,EventUtils:()=>E,InternalApplyNativeError:()=>z,InternalBufferError:()=>Q,InternalContextError:()=>X,InternalError:()=>u,InternalGlobalJSError:()=>Y,InternalInvokeMethodError:()=>B,InternalInvokeNativeError:()=>$,InternalJSCoreNotFoundError:()=>W,InternalJSModuleEvalError:()=>J,InternalJSModuleFetchError:()=>G,InternalMetricReportError:()=>Z,InternalReporterError:()=>ee,InternalSchemaParseError:()=>K,LoadScriptCode:()=>ye,Singleton:()=>b,UserCustomError:()=>I,UserError:()=>g,UserFetchError:()=>j,UserFunctionEvalError:()=>H,UserGlobalError:()=>F,UserValidateError:()=>V,canIUseConfig:()=>nn,compareVersion:()=>rn,createCommands:()=>xn,createRunTaskQueue:()=>je,debounce:()=>Ye,get:()=>tn,getAdvertisingId:()=>Ae,getDeviceId:()=>Ie,getOriginalLocalStorage:()=>un,getPlatform:()=>he,getStorage:()=>re,getUtmSource:()=>Ce,hostEmitter:()=>Tn,isArray:()=>Ge,isBoolean:()=>ze,isDefined:()=>Be,isFunction:()=>S,isIterable:()=>$e,isNumber:()=>Je,isObject:()=>pe,isPromiseLike:()=>We,isString:()=>L,isStringArray:()=>He,isTypedArray:()=>Ke,isUndefined:()=>fe,isUndefinedOrNull:()=>P,isValidUUIDV4:()=>ln,logger:()=>ne,mergeArray:()=>Xe,mergeWith:()=>Qe,microTask:()=>Fe,platform:()=>C,promisifyAPI:()=>Ve,serializeEventPackage:()=>dn,sleep:()=>De,timeout:()=>D,uuidv4:()=>te,validateConstraint:()=>Oe,validateConstraints:()=>ie,wrapUserFunction:()=>Ze,xUserAgent:()=>mn});module.exports=Ue(_n);if(typeof window!="undefined"&&!window.AbortController){let n=function(){this.signal=new e};n.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let t=new Event("abort");this.signal.dispatchEvent(t)};let e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(t,r){this._eventListeners[t]||(this._eventListeners[t]=[]),this._eventListeners[t].push(r)},e.prototype.removeEventListener=function(t,r){if(!this._eventListeners[t])return;let o=this._eventListeners[t].indexOf(r);o!==-1&&this._eventListeners[t].splice(o,1)},e.prototype.dispatchEvent=function(t){if(this._eventListeners[t.type])for(let r of this._eventListeners[t.type])r.call(this,t)},window.AbortController=n,window.AbortSignal=e}function D(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}function De(n){return new Promise(e=>setTimeout(e,n))}function Ve(n){return e=>new Promise((t,r)=>{n(w(f({},e),{success:t,fail(o){let i=new Error(o.errMsg);r(i)}}))})}function Fe(n){if(n)Promise.resolve().then(n);else return Promise.resolve()}var U=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 je(){let n=[],e=!1,t=()=>N(this,null,function*(){let r=n.shift();if(r){e=!0;try{yield r()}finally{e=!1,t()}}});return r=>{n.push(r),e||t()}}function L(n){return typeof n=="string"}function He(n){return Array.isArray(n)&&n.every(e=>L(e))}function pe(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof RegExp)&&!(n instanceof Date)}function Ke(n){let e=Object.getPrototypeOf(Uint8Array);return typeof n=="object"&&n instanceof e}function Ge(n){return typeof n=="object"&&Array.isArray(n)}function Je(n){return typeof n=="number"&&!isNaN(n)}function $e(n){return!!n&&typeof n[Symbol.iterator]=="function"}function ze(n){return n===!0||n===!1}function fe(n){return typeof n=="undefined"}function Be(n){return!P(n)}function P(n){return fe(n)||n===null}function S(n){return typeof n=="function"}function We(n){return pe(n)&&S(n.then)}function b(n){let e=n,t=null,r=function(...o){return t||(t=new e(...o)),t};return r.prototype=e.prototype,r}function Qe(n,e,t){if(typeof t!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function r(o,i){for(let a in i)if(Object.prototype.hasOwnProperty.call(i,a)){let c=o[a],s=i[a],m=t(c,s,a,o,i);m!==void 0?o[a]=m:ge(s)&&ge(c)?o[a]=r(f({},c),s):Array.isArray(s)&&Array.isArray(c)?o[a]=[...c,...s]:o[a]=s}return o}return r(n,e)}function ge(n){return n&&typeof n=="object"&&n.constructor===Object}function Xe(n,e){if(Array.isArray(n))return n.concat(e)}function Ye(n,e,t={}){let r=null,o,i,a,{leading:c=!1,trailing:s=!0}=t,m=()=>(a=n.apply(i,o),o=void 0,i=void 0,a),d=function(...Ne){o=Ne,i=this;let ae=c&&!r;if(r&&clearTimeout(r),r=setTimeout(()=>{r=null,s&&!ae&&m()},e),ae)return m()};return d.cancel=()=>{r&&clearTimeout(r),r=null,o=i=void 0},d.flush=()=>{if(r)return clearTimeout(r),r=null,m()},d}var ye=(s=>(s[s.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",s[s.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",s[s.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",s[s.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",s[s.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",s[s.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",s[s.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",s[s.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",s))(ye||{}),T=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}},u=class extends T{constructor(){super(...arguments);this.kind="INTERNAL_ERROR"}},g=class extends T{constructor(){super(...arguments);this.kind="USER_ERROR"}},V=class extends g{constructor(){super(...arguments);this.name="USER_VALIDATE_ERROR"}},F=class extends g{constructor(){super(...arguments);this.name="USER_GLOBAL_ERROR";this.priority="P1"}},I=class extends g{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_CUSTOM_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},j=class extends g{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_FETCH_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},H=class extends g{constructor(){super(...arguments);this.name="USER_CALLBACK_ERROR"}},K=class extends u{constructor(){super(...arguments);this.name="INTERNAL_SCHEMA_PARSE_ERROR";this.priority="P0"}},G=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_FETCH_ERROR";this.priority="P0"}},J=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_EVAL_ERROR";this.priority="P0"}},$=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},z=class extends u{constructor(t,r,o,i){super(t);this.errNo=r;this.name="INTERNAL_APPLY_NATIVE_ERROR";this.errorType=o,this.errorCode=i}},B=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_METHOD_ERROR"}},W=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JSCORE_ERROR";this.priority="P0"}},Q=class extends u{constructor(){super(...arguments);this.name="INTERNAL_BUFFER_ERROR"}},X=class extends u{constructor(t,r){super(t);this.message=t;this.name="INTERNAL_CONTEXT_ERROR";this.property=r}},Y=class extends u{constructor(){super(...arguments);this.name="INTERNAL_GLOBAL_JS_ERROR";this.priority="P1"}},q=class extends T{constructor(t,r,o,i,a){super(t);this.message=t;this.code=r;this.kind="API_ERROR";this.name="API_ERROR";o&&(this.errorType=o),i!==void 0&&(this.stack=i),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Z=class extends u{constructor(){super(...arguments);this.name="INTERNAL_METRIC_REPORT_ERROR"}},ee=class extends u{constructor(){super(...arguments);this.name="INTERNAL_REPORTER_ERROR"}};function qe(n,e){return(...t)=>e(n,...t)}function Ze(n){return e=>qe(e,function(t,...r){if(typeof t=="function")try{return t.apply(this,r)}catch(o){n(new I(`${o}`))}})}function A(n){return(...e)=>{var r,o;((o=(r=globalThis.VConsole)==null?void 0:r[n])!=null?o:globalThis.console[n])(...e)}}var ne={log:A("log"),warn:A("warn"),info:A("info"),error:A("error"),debug:A("debug")};Object.assign(globalThis,{logger:ne});var Ee=Symbol.for("Jolibox.canIUseMap"),en={};globalThis[Ee]=en;var nn={get config(){return globalThis[Ee]}};function tn(n,e,t){let r=n;for(let o of e)if(r&&typeof r=="object")r=r[o];else return t;return r===void 0?t:r}function rn(n,e,t){let r=0;if(n!==e){let o=n.split("."),i=e.split("."),a=Math.max(o.length,i.length);for(let c=0;c<a;c++){let s=parseInt(o[c],10)||0,m=parseInt(i[c],10)||0;if(s>m){r=1;break}else if(s<m){r=-1;break}}}if(!t)return r;switch(t){case">":return r>0;case"<":return r<0;case"=":return r===0;case">=":return r>=0;case"<=":return r<=0;default:return!1}}var xe=(r=>(r[r.System=1e3]="System",r[r.ErrorTrace=1001]="ErrorTrace",r[r.UserDefined=1002]="UserDefined",r))(xe||{}),_e=(i=>(i.MiniGame="mini-game",i.MiniDrama="mini-drama",i.App="app",i.WebSDK="web-sdk",i.AppSDK="app-sdk",i))(_e||{}),Re=(d=>(d[d.App=0]="App",d[d.H5=1]="H5",d[d.Weapp=2]="Weapp",d[d.Alipay=3]="Alipay",d[d.Gcash=4]="Gcash",d[d.Dana=5]="Dana",d[d.Umma=6]="Umma",d[d.WebSDK=1e3]="WebSDK",d[d.AppSDK=1001]="AppSDK",d[d.Other=9999]="Other",d))(Re||{}),Te=["name","params"],on=["name","type","location","target","extra","timestamp","userId"],sn=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function k(n,e){return e.map(t=>{if(t==="params"&&n[t]){let r=n[t];return Object.keys(r).reduce((o,i)=>(o[i]=String(r[i]),o),{})}return n[t]})}function an(n){let e=n.location?k(n.location,Te):null,t=n.target?k(n.target,Te):null;return k(w(f({},n),{location:e,target:t}),on)}function dn(n){let e=n.events.map(r=>an(r)),t=k(n.device,sn);return[n.protocolVersion,e,t,n.project]}var te=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),ln=n=>/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i.test(n);var C={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let n=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[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")},he=()=>C.isiOS?"iOS":C.isAndroid?"Android":C.isMac?"Mac":C.isFacebook?"Facebook":"PC",ve="device_id",be="advertising_id",re=n=>(window.__joliboxLocalStorage__.getItem(n)||window.__joliboxLocalStorage__.setItem(n,te()),window.__joliboxLocalStorage__.getItem(n)),Ie=()=>re(ve),Ae=()=>re(be),cn=n=>n.charAt(0).toUpperCase()+n.slice(1),Ce=()=>{var e;let n=new URLSearchParams(window.location.search);return cn((e=n.get("utm_source"))!=null?e:"")||"JoliboxSDK"},mn=n=>{let e="JoliboxWebSDK",t=he(),r=navigator.language,o=Ie(),i=Ae();return`${e} (${Ce()}${t}; UnknownModel; UnknownSystemVersion; ${r}) uuid/${o} adid/${i} version/${n||""}`};function un(){try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let n=Object.getOwnPropertyDescriptor(window,"localStorage");if(n&&n.get){let r=n.get.call(window);return window.__joliboxLocalStorage__=r,r}if(n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),n&&n.get)return n.get.call(window);let e=Window.prototype,t=Object.getOwnPropertyDescriptor(e,"localStorage");if(t&&t.get){let r=t.get.call(window);return window.__joliboxLocalStorage__=r,r}return localStorage}catch(n){return console.warn("Failed to get original localStorage, fallback to default implementation",n),localStorage}}var x=class x{constructor(e){this.element=e,this.next=x.Undefined,this.prev=x.Undefined}};x.Undefined=new x(void 0);var l=x,M=class{constructor(){this._first=l.Undefined;this._last=l.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===l.Undefined}clear(){let e=this._first;for(;e!==l.Undefined;){let t=e.next;e.prev=l.Undefined,e.next=l.Undefined,e=t}this._first=l.Undefined,this._last=l.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new l(e);if(this._first===l.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 o=!1;return()=>{o||(o=!0,this._remove(r))}}shift(){if(this._first!==l.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==l.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==l.Undefined&&e.next!==l.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===l.Undefined&&e.next===l.Undefined?(this._first=l.Undefined,this._last=l.Undefined):e.next===l.Undefined?(this._last=this._last.prev,this._last.next=l.Undefined):e.prev===l.Undefined&&(this._first=this._first.next,this._first.prev=l.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==l.Undefined;)yield e.element,e=e.next}};var pn=0,_=class{constructor(e){this.value=e;this.id=pn++}},p=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 _&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(o=>(o==null?void 0:o.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 i,a,c,s,m,d;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let o=new _(t);this._listeners?this._listeners instanceof _?this._listeners=[this._listeners,o]:this._listeners.push(o):((a=(i=this.options)==null?void 0:i.onWillAddFirstListener)==null||a.call(i,this),this._listeners=o,(s=(c=this.options)==null?void 0:c.onDidFirstListener)==null||s.call(c,this)),(d=(m=this.options)==null?void 0:m.onDidAddListener)==null||d.call(m,this),this._size++}),this._event}_deliver(e,t){var o;if(!e)return;let r=((o=this.options)==null?void 0:o.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}fire(e){this._listeners&&(this._listeners instanceof _?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},R=class{constructor(){this.listeners=new Map;this.listerHandlerMap=new WeakMap;this.cachedEventQueue=new Map}on(e,t){var a;let r=(a=this.listeners.get(e))!=null?a:new p,o=c=>t(...c.args);this.listerHandlerMap.set(t,o),r.event(o),this.listeners.set(e,r);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)r.fire(f({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let o=this.listerHandlerMap.get(t);r.dispose(o)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let o=this.cachedEventQueue.get(e);o||(o=new M,this.cachedEventQueue.set(e,o)),o.push({args:t})}}};var E={};ue(E,{None:()=>fn,filter:()=>yn,once:()=>we,toPromise:()=>gn});var fn=()=>{console.log("[Jolibox SDK] None Event")};function gn(n){return new Promise(e=>we(n)(e))}function we(n){return(e,t=null)=>{let r=!1;return n(i=>{if(!r)return r=!0,e.call(t,i)},null)}}function yn(n,e){return(r=>{let o,i={onWillAddFirstListener(){o=r(a.fire,a)}},a=new p(i);return a.event})((r,o=null)=>n(i=>e(i)&&r.call(o,i),null))}var oe=Symbol.for("Jolibox.hostEmitter"),En=()=>{let n=new R;return globalThis[oe]||(globalThis[oe]={on:n.on.bind(n),off:n.off.bind(n),emit:n.emit.bind(n)}),globalThis[oe]},Tn=En();function ie(n,e){let t=Math.min(n.length,e.length);for(let r=0;r<t;r++)Oe(n[r],e[r])}function Oe(n,e){if(L(e)){if(typeof n!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(S(e)){try{if(n instanceof e)return}catch(t){}if(!P(n)&&n.constructor===e||e.length===1&&e.call(void 0,n)===!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 y=class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new p;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 o=[];for(let a of e.metadata.args)o.push(a.constraint);let i=e.handler;e.handler=function(...a){return ie(a,o),i(...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}};y=O([b],y);var h=class{constructor(){this._onWillExecuteCommand=new p;this.onWillExecuteCommand=this._onWillExecuteCommand.event;this._onDidExecuteCommand=new p;this.onDidExecuteCommand=this._onDidExecuteCommand.event;this.registry=new y;this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=D(3e4)),this._starActivation}executeCommand(e,...t){return N(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),E.toPromise(E.filter(this.registry.onDidRegisterCommand,o=>o===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!!!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let o=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let i=this.invokeFunction(o.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),i}_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 o=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(o)}catch(o){return Promise.reject(o)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};h=O([b],h);var se=Symbol.for("Jolibox.commands");function xn(){if(globalThis[se])return globalThis[se];let n=new y,e=new h,t={registerCommand(r,o,i){n.registerCommand({id:r,handler:o,metadata:i})},executeCommand(r,...o){return e.executeCommand(r,...o)},excuteCommandSync(r,...o){return e.executeCommandThowErr(r,...o)}};return globalThis[se]=t,t}
package/dist/index.es.js CHANGED
@@ -1 +1 @@
1
- var k=Object.defineProperty,ye=Object.defineProperties,ge=Object.getOwnPropertyDescriptor,Ee=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var H=(n,e,t)=>e in n?k(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,f=(n,e)=>{for(var t in e||(e={}))Te.call(e,t)&&H(n,t,e[t]);if(F)for(var t of F(e))xe.call(e,t)&&H(n,t,e[t]);return n},b=(n,e)=>ye(n,Ee(e));var Re=(n,e)=>{for(var t in e)k(n,t,{get:e[t],enumerable:!0})};var I=(n,e,t,r)=>{for(var o=r>1?void 0:r?ge(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(o=(r?a(e,t,o):a(o))||o);return r&&o&&k(e,t,o),o};var A=(n,e,t)=>new Promise((r,o)=>{var i=s=>{try{m(t.next(s))}catch(c){o(c)}},a=s=>{try{m(t.throw(s))}catch(c){o(c)}},m=s=>s.done?r(s.value):Promise.resolve(s.value).then(i,a);m((t=t.apply(n,e)).next())});if(typeof window!="undefined"&&!window.AbortController){let n=function(){this.signal=new e};n.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let t=new Event("abort");this.signal.dispatchEvent(t)};let e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(t,r){this._eventListeners[t]||(this._eventListeners[t]=[]),this._eventListeners[t].push(r)},e.prototype.removeEventListener=function(t,r){if(!this._eventListeners[t])return;let o=this._eventListeners[t].indexOf(r);o!==-1&&this._eventListeners[t].splice(o,1)},e.prototype.dispatchEvent=function(t){if(this._eventListeners[t.type])for(let r of this._eventListeners[t.type])r.call(this,t)},window.AbortController=n,window.AbortSignal=e}function K(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}function ze(n){return new Promise(e=>setTimeout(e,n))}function Be(n){return e=>new Promise((t,r)=>{n(b(f({},e),{success:t,fail(o){let i=new Error(o.errMsg);r(i)}}))})}function We(n){if(n)Promise.resolve().then(n);else return Promise.resolve()}var j=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 Qe(){let n=[],e=!1,t=()=>A(this,null,function*(){let r=n.shift();if(r){e=!0;try{yield r()}finally{e=!1,t()}}});return r=>{n.push(r),e||t()}}function L(n){return typeof n=="string"}function Ze(n){return Array.isArray(n)&&n.every(e=>L(e))}function he(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof RegExp)&&!(n instanceof Date)}function en(n){let e=Object.getPrototypeOf(Uint8Array);return typeof n=="object"&&n instanceof e}function nn(n){return typeof n=="object"&&Array.isArray(n)}function tn(n){return typeof n=="number"&&!isNaN(n)}function rn(n){return!!n&&typeof n[Symbol.iterator]=="function"}function on(n){return n===!0||n===!1}function _e(n){return typeof n=="undefined"}function sn(n){return!M(n)}function M(n){return _e(n)||n===null}function S(n){return typeof n=="function"}function an(n){return he(n)&&S(n.then)}function C(n){let e=n,t=null,r=function(...o){return t||(t=new e(...o)),t};return r.prototype=e.prototype,r}function un(n,e,t){if(typeof t!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function r(o,i){for(let a in i)if(Object.prototype.hasOwnProperty.call(i,a)){let m=o[a],s=i[a],c=t(m,s,a,o,i);c!==void 0?o[a]=c:G(s)&&G(m)?o[a]=r(f({},m),s):Array.isArray(s)&&Array.isArray(m)?o[a]=[...m,...s]:o[a]=s}return o}return r(n,e)}function G(n){return n&&typeof n=="object"&&n.constructor===Object}function pn(n,e){if(Array.isArray(n))return n.concat(e)}function En(n,e,t={}){let r=null,o,i,a,{leading:m=!1,trailing:s=!0}=t,c=()=>(a=n.apply(i,o),o=void 0,i=void 0,a),d=function(...fe){o=fe,i=this;let V=m&&!r;if(r&&clearTimeout(r),r=setTimeout(()=>{r=null,s&&!V&&c()},e),V)return c()};return d.cancel=()=>{r&&clearTimeout(r),r=null,o=i=void 0},d.flush=()=>{if(r)return clearTimeout(r),r=null,c()},d}var ve=(s=>(s[s.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",s[s.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",s[s.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",s[s.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",s[s.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",s[s.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",s[s.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",s[s.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",s))(ve||{}),h=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}},u=class extends h{constructor(){super(...arguments);this.kind="INTERNAL_ERROR"}},g=class extends h{constructor(){super(...arguments);this.kind="USER_ERROR"}},J=class extends g{constructor(){super(...arguments);this.name="USER_VALIDATE_ERROR"}},$=class extends g{constructor(){super(...arguments);this.name="USER_GLOBAL_ERROR";this.priority="P1"}},N=class extends g{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_CUSTOM_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},z=class extends g{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_FETCH_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},B=class extends g{constructor(){super(...arguments);this.name="USER_CALLBACK_ERROR"}},W=class extends u{constructor(){super(...arguments);this.name="INTERNAL_SCHEMA_PARSE_ERROR";this.priority="P0"}},Q=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_FETCH_ERROR";this.priority="P0"}},X=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_EVAL_ERROR";this.priority="P0"}},Y=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},q=class extends u{constructor(t,r,o,i){super(t);this.errNo=r;this.name="INTERNAL_APPLY_NATIVE_ERROR";this.errorType=o,this.errorCode=i}},Z=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_METHOD_ERROR"}},ee=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JSCORE_ERROR";this.priority="P0"}},ne=class extends u{constructor(){super(...arguments);this.name="INTERNAL_BUFFER_ERROR"}},te=class extends u{constructor(t,r){super(t);this.message=t;this.name="INTERNAL_CONTEXT_ERROR";this.property=r}},re=class extends u{constructor(){super(...arguments);this.name="INTERNAL_GLOBAL_JS_ERROR";this.priority="P1"}},oe=class extends h{constructor(t,r,o,i,a){super(t);this.message=t;this.code=r;this.kind="API_ERROR";this.name="API_ERROR";o&&(this.errorType=o),i!==void 0&&(this.stack=i),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},ie=class extends u{constructor(){super(...arguments);this.name="INTERNAL_METRIC_REPORT_ERROR"}},se=class extends u{constructor(){super(...arguments);this.name="INTERNAL_REPORTER_ERROR"}};function be(n,e){return(...t)=>e(n,...t)}function bn(n){return e=>be(e,function(t,...r){if(typeof t=="function")try{return t.apply(this,r)}catch(o){n(new N(`${o}`))}})}function _(n){return(...e)=>{var r,o;((o=(r=globalThis.VConsole)==null?void 0:r[n])!=null?o:globalThis.console[n])(...e)}}var ae={log:_("log"),warn:_("warn"),info:_("info"),error:_("error"),debug:_("debug")};Object.assign(globalThis,{logger:ae});var de=Symbol.for("Jolibox.canIUseMap"),Ie={};globalThis[de]=Ie;var Ln={get config(){return globalThis[de]}};function Mn(n,e,t){let r=n;for(let o of e)if(r&&typeof r=="object")r=r[o];else return t;return r===void 0?t:r}function Dn(n,e,t){let r=0;if(n!==e){let o=n.split("."),i=e.split("."),a=Math.max(o.length,i.length);for(let m=0;m<a;m++){let s=parseInt(o[m],10)||0,c=parseInt(i[m],10)||0;if(s>c){r=1;break}else if(s<c){r=-1;break}}}if(!t)return r;switch(t){case">":return r>0;case"<":return r<0;case"=":return r===0;case">=":return r>=0;case"<=":return r<=0;default:return!1}}var Ae=(r=>(r[r.System=1e3]="System",r[r.ErrorTrace=1001]="ErrorTrace",r[r.UserDefined=1002]="UserDefined",r))(Ae||{}),Ce=(i=>(i.MiniGame="mini-game",i.MiniDrama="mini-drama",i.App="app",i.WebSDK="web-sdk",i.AppSDK="app-sdk",i))(Ce||{}),Ne=(d=>(d[d.App=0]="App",d[d.H5=1]="H5",d[d.Weapp=2]="Weapp",d[d.Alipay=3]="Alipay",d[d.Gcash=4]="Gcash",d[d.Dana=5]="Dana",d[d.Umma=6]="Umma",d[d.WebSDK=1e3]="WebSDK",d[d.AppSDK=1001]="AppSDK",d[d.Other=9999]="Other",d))(Ne||{}),le=["name","params"],Oe=["name","type","location","target","extra","timestamp","userId"],we=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function O(n,e){return e.map(t=>{if(t==="params"&&n[t]){let r=n[t];return Object.keys(r).reduce((o,i)=>(o[i]=String(r[i]),o),{})}return n[t]})}function Pe(n){let e=n.location?O(n.location,le):null,t=n.target?O(n.target,le):null;return O(b(f({},n),{location:e,target:t}),Oe)}function Hn(n){let e=n.events.map(r=>Pe(r)),t=O(n.device,we);return[n.protocolVersion,e,t,n.project]}var me=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),Jn=n=>/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i.test(n);var w={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let n=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[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")},ke=()=>w.isiOS?"iOS":w.isAndroid?"Android":w.isMac?"Mac":w.isFacebook?"Facebook":"PC",Le="device_id",Me="advertising_id",ce=n=>(localStorage.getItem(n)||localStorage.setItem(n,me()),localStorage.getItem(n)),Se=()=>ce(Le),Ue=()=>ce(Me),De=n=>n.charAt(0).toUpperCase()+n.slice(1),Ve=()=>{var e;let n=new URLSearchParams(window.location.search);return De((e=n.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Wn=n=>{let e="JoliboxWebSDK",t=ke(),r=navigator.language,o=Se(),i=Ue();return`${e} (${Ve()}${t}; UnknownModel; UnknownSystemVersion; ${r}) uuid/${o} adid/${i} version/${n||""}`};var E=class E{constructor(e){this.element=e,this.next=E.Undefined,this.prev=E.Undefined}};E.Undefined=new E(void 0);var l=E,P=class{constructor(){this._first=l.Undefined;this._last=l.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===l.Undefined}clear(){let e=this._first;for(;e!==l.Undefined;){let t=e.next;e.prev=l.Undefined,e.next=l.Undefined,e=t}this._first=l.Undefined,this._last=l.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new l(e);if(this._first===l.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 o=!1;return()=>{o||(o=!0,this._remove(r))}}shift(){if(this._first!==l.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==l.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==l.Undefined&&e.next!==l.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===l.Undefined&&e.next===l.Undefined?(this._first=l.Undefined,this._last=l.Undefined):e.next===l.Undefined?(this._last=this._last.prev,this._last.next=l.Undefined):e.prev===l.Undefined&&(this._first=this._first.next,this._first.prev=l.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==l.Undefined;)yield e.element,e=e.next}};var Fe=0,T=class{constructor(e){this.value=e;this.id=Fe++}},p=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 T&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(o=>(o==null?void 0:o.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 i,a,m,s,c,d;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let o=new T(t);this._listeners?this._listeners instanceof T?this._listeners=[this._listeners,o]:this._listeners.push(o):((a=(i=this.options)==null?void 0:i.onWillAddFirstListener)==null||a.call(i,this),this._listeners=o,(s=(m=this.options)==null?void 0:m.onDidFirstListener)==null||s.call(m,this)),(d=(c=this.options)==null?void 0:c.onDidAddListener)==null||d.call(c,this),this._size++}),this._event}_deliver(e,t){var o;if(!e)return;let r=((o=this.options)==null?void 0:o.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}fire(e){this._listeners&&(this._listeners instanceof T?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},v=class{constructor(){this.listeners=new Map;this.listerHandlerMap=new WeakMap;this.cachedEventQueue=new Map}on(e,t){var a;let r=(a=this.listeners.get(e))!=null?a:new p,o=m=>t(...m.args);this.listerHandlerMap.set(t,o),r.event(o),this.listeners.set(e,r);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)r.fire(f({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let o=this.listerHandlerMap.get(t);r.dispose(o)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let o=this.cachedEventQueue.get(e);o||(o=new P,this.cachedEventQueue.set(e,o)),o.push({args:t})}}};var x={};Re(x,{None:()=>He,filter:()=>Ke,once:()=>ue,toPromise:()=>je});var He=()=>{console.log("[Jolibox SDK] None Event")};function je(n){return new Promise(e=>ue(n)(e))}function ue(n){return(e,t=null)=>{let r=!1;return n(i=>{if(!r)return r=!0,e.call(t,i)},null)}}function Ke(n,e){return(r=>{let o,i={onWillAddFirstListener(){o=r(a.fire,a)}},a=new p(i);return a.event})((r,o=null)=>n(i=>e(i)&&r.call(o,i),null))}var U=Symbol.for("Jolibox.hostEmitter"),Ge=()=>{let n=new v;return globalThis[U]||(globalThis[U]={on:n.on.bind(n),off:n.off.bind(n),emit:n.emit.bind(n)}),globalThis[U]},vt=Ge();function pe(n,e){let t=Math.min(n.length,e.length);for(let r=0;r<t;r++)Je(n[r],e[r])}function Je(n,e){if(L(e)){if(typeof n!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(S(e)){try{if(n instanceof e)return}catch(t){}if(!M(n)&&n.constructor===e||e.length===1&&e.call(void 0,n)===!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 y=class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new p;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 o=[];for(let a of e.metadata.args)o.push(a.constraint);let i=e.handler;e.handler=function(...a){return pe(a,o),i(...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}};y=I([C],y);var R=class{constructor(){this._onWillExecuteCommand=new p;this.onWillExecuteCommand=this._onWillExecuteCommand.event;this._onDidExecuteCommand=new p;this.onDidExecuteCommand=this._onDidExecuteCommand.event;this.registry=new y;this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=K(3e4)),this._starActivation}executeCommand(e,...t){return A(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),x.toPromise(x.filter(this.registry.onDidRegisterCommand,o=>o===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!!!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let o=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let i=this.invokeFunction(o.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),i}_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 o=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(o)}catch(o){return Promise.reject(o)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};R=I([C],R);var D=Symbol.for("Jolibox.commands");function qt(){if(globalThis[D])return globalThis[D];let n=new y,e=new R,t={registerCommand(r,o,i){n.registerCommand({id:r,handler:o,metadata:i})},executeCommand(r,...o){return e.executeCommand(r,...o)},excuteCommandSync(r,...o){return e.executeCommandThowErr(r,...o)}};return globalThis[D]=t,t}export{Me as ADVERTISING_ID,oe as APIError,h as BaseError,Le as DEVICE_ID,j as Deferred,Ne as EPlatform,Ce as EProject,v as EventEmitter,Ae as EventType,x as EventUtils,q as InternalApplyNativeError,ne as InternalBufferError,te as InternalContextError,u as InternalError,re as InternalGlobalJSError,Z as InternalInvokeMethodError,Y as InternalInvokeNativeError,ee as InternalJSCoreNotFoundError,X as InternalJSModuleEvalError,Q as InternalJSModuleFetchError,ie as InternalMetricReportError,se as InternalReporterError,W as InternalSchemaParseError,ve as LoadScriptCode,C as Singleton,N as UserCustomError,g as UserError,z as UserFetchError,B as UserFunctionEvalError,$ as UserGlobalError,J as UserValidateError,Ln as canIUseConfig,Dn as compareVersion,qt as createCommands,Qe as createRunTaskQueue,En as debounce,Mn as get,Ue as getAdvertisingId,Se as getDeviceId,ke as getPlatform,ce as getStorage,Ve as getUtmSource,vt as hostEmitter,nn as isArray,on as isBoolean,sn as isDefined,S as isFunction,rn as isIterable,tn as isNumber,he as isObject,an as isPromiseLike,L as isString,Ze as isStringArray,en as isTypedArray,_e as isUndefined,M as isUndefinedOrNull,Jn as isValidUUIDV4,ae as logger,pn as mergeArray,un as mergeWith,We as microTask,w as platform,Be as promisifyAPI,Hn as serializeEventPackage,ze as sleep,K as timeout,me as uuidv4,Je as validateConstraint,pe as validateConstraints,bn as wrapUserFunction,Wn as xUserAgent};
1
+ var P=Object.defineProperty,ge=Object.defineProperties,ye=Object.getOwnPropertyDescriptor,Ee=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var j=(n,e,t)=>e in n?P(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,f=(n,e)=>{for(var t in e||(e={}))Te.call(e,t)&&j(n,t,e[t]);if(F)for(var t of F(e))xe.call(e,t)&&j(n,t,e[t]);return n},b=(n,e)=>ge(n,Ee(e));var _e=(n,e)=>{for(var t in e)P(n,t,{get:e[t],enumerable:!0})};var I=(n,e,t,r)=>{for(var o=r>1?void 0:r?ye(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(o=(r?a(e,t,o):a(o))||o);return r&&o&&P(e,t,o),o};var A=(n,e,t)=>new Promise((r,o)=>{var i=s=>{try{c(t.next(s))}catch(m){o(m)}},a=s=>{try{c(t.throw(s))}catch(m){o(m)}},c=s=>s.done?r(s.value):Promise.resolve(s.value).then(i,a);c((t=t.apply(n,e)).next())});if(typeof window!="undefined"&&!window.AbortController){let n=function(){this.signal=new e};n.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let t=new Event("abort");this.signal.dispatchEvent(t)};let e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(t,r){this._eventListeners[t]||(this._eventListeners[t]=[]),this._eventListeners[t].push(r)},e.prototype.removeEventListener=function(t,r){if(!this._eventListeners[t])return;let o=this._eventListeners[t].indexOf(r);o!==-1&&this._eventListeners[t].splice(o,1)},e.prototype.dispatchEvent=function(t){if(this._eventListeners[t.type])for(let r of this._eventListeners[t.type])r.call(this,t)},window.AbortController=n,window.AbortSignal=e}function K(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}function ze(n){return new Promise(e=>setTimeout(e,n))}function Be(n){return e=>new Promise((t,r)=>{n(b(f({},e),{success:t,fail(o){let i=new Error(o.errMsg);r(i)}}))})}function We(n){if(n)Promise.resolve().then(n);else return Promise.resolve()}var H=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 Qe(){let n=[],e=!1,t=()=>A(this,null,function*(){let r=n.shift();if(r){e=!0;try{yield r()}finally{e=!1,t()}}});return r=>{n.push(r),e||t()}}function S(n){return typeof n=="string"}function Ze(n){return Array.isArray(n)&&n.every(e=>S(e))}function Re(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof RegExp)&&!(n instanceof Date)}function en(n){let e=Object.getPrototypeOf(Uint8Array);return typeof n=="object"&&n instanceof e}function nn(n){return typeof n=="object"&&Array.isArray(n)}function tn(n){return typeof n=="number"&&!isNaN(n)}function rn(n){return!!n&&typeof n[Symbol.iterator]=="function"}function on(n){return n===!0||n===!1}function he(n){return typeof n=="undefined"}function sn(n){return!k(n)}function k(n){return he(n)||n===null}function M(n){return typeof n=="function"}function an(n){return Re(n)&&M(n.then)}function C(n){let e=n,t=null,r=function(...o){return t||(t=new e(...o)),t};return r.prototype=e.prototype,r}function un(n,e,t){if(typeof t!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function r(o,i){for(let a in i)if(Object.prototype.hasOwnProperty.call(i,a)){let c=o[a],s=i[a],m=t(c,s,a,o,i);m!==void 0?o[a]=m:G(s)&&G(c)?o[a]=r(f({},c),s):Array.isArray(s)&&Array.isArray(c)?o[a]=[...c,...s]:o[a]=s}return o}return r(n,e)}function G(n){return n&&typeof n=="object"&&n.constructor===Object}function pn(n,e){if(Array.isArray(n))return n.concat(e)}function En(n,e,t={}){let r=null,o,i,a,{leading:c=!1,trailing:s=!0}=t,m=()=>(a=n.apply(i,o),o=void 0,i=void 0,a),d=function(...fe){o=fe,i=this;let V=c&&!r;if(r&&clearTimeout(r),r=setTimeout(()=>{r=null,s&&!V&&m()},e),V)return m()};return d.cancel=()=>{r&&clearTimeout(r),r=null,o=i=void 0},d.flush=()=>{if(r)return clearTimeout(r),r=null,m()},d}var ve=(s=>(s[s.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",s[s.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",s[s.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",s[s.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",s[s.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",s[s.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",s[s.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",s[s.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",s))(ve||{}),R=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}},u=class extends R{constructor(){super(...arguments);this.kind="INTERNAL_ERROR"}},y=class extends R{constructor(){super(...arguments);this.kind="USER_ERROR"}},J=class extends y{constructor(){super(...arguments);this.name="USER_VALIDATE_ERROR"}},$=class extends y{constructor(){super(...arguments);this.name="USER_GLOBAL_ERROR";this.priority="P1"}},w=class extends y{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_CUSTOM_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},z=class extends y{constructor(t,r,o){super(t);this.message=t;this.errNo=r;this.name="USER_FETCH_ERROR";this.errMsg=t,o&&(this.extra=Object.assign({},this.extra,o))}},B=class extends y{constructor(){super(...arguments);this.name="USER_CALLBACK_ERROR"}},W=class extends u{constructor(){super(...arguments);this.name="INTERNAL_SCHEMA_PARSE_ERROR";this.priority="P0"}},Q=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_FETCH_ERROR";this.priority="P0"}},X=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JS_MODULE_EVAL_ERROR";this.priority="P0"}},Y=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},q=class extends u{constructor(t,r,o,i){super(t);this.errNo=r;this.name="INTERNAL_APPLY_NATIVE_ERROR";this.errorType=o,this.errorCode=i}},Z=class extends u{constructor(){super(...arguments);this.name="INTERNAL_INVOKE_METHOD_ERROR"}},ee=class extends u{constructor(){super(...arguments);this.name="INTERNAL_JSCORE_ERROR";this.priority="P0"}},ne=class extends u{constructor(){super(...arguments);this.name="INTERNAL_BUFFER_ERROR"}},te=class extends u{constructor(t,r){super(t);this.message=t;this.name="INTERNAL_CONTEXT_ERROR";this.property=r}},re=class extends u{constructor(){super(...arguments);this.name="INTERNAL_GLOBAL_JS_ERROR";this.priority="P1"}},oe=class extends R{constructor(t,r,o,i,a){super(t);this.message=t;this.code=r;this.kind="API_ERROR";this.name="API_ERROR";o&&(this.errorType=o),i!==void 0&&(this.stack=i),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},ie=class extends u{constructor(){super(...arguments);this.name="INTERNAL_METRIC_REPORT_ERROR"}},se=class extends u{constructor(){super(...arguments);this.name="INTERNAL_REPORTER_ERROR"}};function be(n,e){return(...t)=>e(n,...t)}function bn(n){return e=>be(e,function(t,...r){if(typeof t=="function")try{return t.apply(this,r)}catch(o){n(new w(`${o}`))}})}function h(n){return(...e)=>{var r,o;((o=(r=globalThis.VConsole)==null?void 0:r[n])!=null?o:globalThis.console[n])(...e)}}var ae={log:h("log"),warn:h("warn"),info:h("info"),error:h("error"),debug:h("debug")};Object.assign(globalThis,{logger:ae});var de=Symbol.for("Jolibox.canIUseMap"),Ie={};globalThis[de]=Ie;var Sn={get config(){return globalThis[de]}};function kn(n,e,t){let r=n;for(let o of e)if(r&&typeof r=="object")r=r[o];else return t;return r===void 0?t:r}function Dn(n,e,t){let r=0;if(n!==e){let o=n.split("."),i=e.split("."),a=Math.max(o.length,i.length);for(let c=0;c<a;c++){let s=parseInt(o[c],10)||0,m=parseInt(i[c],10)||0;if(s>m){r=1;break}else if(s<m){r=-1;break}}}if(!t)return r;switch(t){case">":return r>0;case"<":return r<0;case"=":return r===0;case">=":return r>=0;case"<=":return r<=0;default:return!1}}var Ae=(r=>(r[r.System=1e3]="System",r[r.ErrorTrace=1001]="ErrorTrace",r[r.UserDefined=1002]="UserDefined",r))(Ae||{}),Ce=(i=>(i.MiniGame="mini-game",i.MiniDrama="mini-drama",i.App="app",i.WebSDK="web-sdk",i.AppSDK="app-sdk",i))(Ce||{}),we=(d=>(d[d.App=0]="App",d[d.H5=1]="H5",d[d.Weapp=2]="Weapp",d[d.Alipay=3]="Alipay",d[d.Gcash=4]="Gcash",d[d.Dana=5]="Dana",d[d.Umma=6]="Umma",d[d.WebSDK=1e3]="WebSDK",d[d.AppSDK=1001]="AppSDK",d[d.Other=9999]="Other",d))(we||{}),le=["name","params"],Oe=["name","type","location","target","extra","timestamp","userId"],Ne=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function O(n,e){return e.map(t=>{if(t==="params"&&n[t]){let r=n[t];return Object.keys(r).reduce((o,i)=>(o[i]=String(r[i]),o),{})}return n[t]})}function Le(n){let e=n.location?O(n.location,le):null,t=n.target?O(n.target,le):null;return O(b(f({},n),{location:e,target:t}),Oe)}function jn(n){let e=n.events.map(r=>Le(r)),t=O(n.device,Ne);return[n.protocolVersion,e,t,n.project]}var ce=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),Jn=n=>/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i.test(n);var N={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let n=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[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")},Pe=()=>N.isiOS?"iOS":N.isAndroid?"Android":N.isMac?"Mac":N.isFacebook?"Facebook":"PC",Se="device_id",ke="advertising_id",me=n=>(window.__joliboxLocalStorage__.getItem(n)||window.__joliboxLocalStorage__.setItem(n,ce()),window.__joliboxLocalStorage__.getItem(n)),Me=()=>me(Se),Ue=()=>me(ke),De=n=>n.charAt(0).toUpperCase()+n.slice(1),Ve=()=>{var e;let n=new URLSearchParams(window.location.search);return De((e=n.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Wn=n=>{let e="JoliboxWebSDK",t=Pe(),r=navigator.language,o=Me(),i=Ue();return`${e} (${Ve()}${t}; UnknownModel; UnknownSystemVersion; ${r}) uuid/${o} adid/${i} version/${n||""}`};function Yn(){try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let n=Object.getOwnPropertyDescriptor(window,"localStorage");if(n&&n.get){let r=n.get.call(window);return window.__joliboxLocalStorage__=r,r}if(n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),n&&n.get)return n.get.call(window);let e=Window.prototype,t=Object.getOwnPropertyDescriptor(e,"localStorage");if(t&&t.get){let r=t.get.call(window);return window.__joliboxLocalStorage__=r,r}return localStorage}catch(n){return console.warn("Failed to get original localStorage, fallback to default implementation",n),localStorage}}var E=class E{constructor(e){this.element=e,this.next=E.Undefined,this.prev=E.Undefined}};E.Undefined=new E(void 0);var l=E,L=class{constructor(){this._first=l.Undefined;this._last=l.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===l.Undefined}clear(){let e=this._first;for(;e!==l.Undefined;){let t=e.next;e.prev=l.Undefined,e.next=l.Undefined,e=t}this._first=l.Undefined,this._last=l.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new l(e);if(this._first===l.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 o=!1;return()=>{o||(o=!0,this._remove(r))}}shift(){if(this._first!==l.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==l.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==l.Undefined&&e.next!==l.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===l.Undefined&&e.next===l.Undefined?(this._first=l.Undefined,this._last=l.Undefined):e.next===l.Undefined?(this._last=this._last.prev,this._last.next=l.Undefined):e.prev===l.Undefined&&(this._first=this._first.next,this._first.prev=l.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==l.Undefined;)yield e.element,e=e.next}};var Fe=0,T=class{constructor(e){this.value=e;this.id=Fe++}},p=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 T&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(o=>(o==null?void 0:o.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 i,a,c,s,m,d;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let o=new T(t);this._listeners?this._listeners instanceof T?this._listeners=[this._listeners,o]:this._listeners.push(o):((a=(i=this.options)==null?void 0:i.onWillAddFirstListener)==null||a.call(i,this),this._listeners=o,(s=(c=this.options)==null?void 0:c.onDidFirstListener)==null||s.call(c,this)),(d=(m=this.options)==null?void 0:m.onDidAddListener)==null||d.call(m,this),this._size++}),this._event}_deliver(e,t){var o;if(!e)return;let r=((o=this.options)==null?void 0:o.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}fire(e){this._listeners&&(this._listeners instanceof T?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},v=class{constructor(){this.listeners=new Map;this.listerHandlerMap=new WeakMap;this.cachedEventQueue=new Map}on(e,t){var a;let r=(a=this.listeners.get(e))!=null?a:new p,o=c=>t(...c.args);this.listerHandlerMap.set(t,o),r.event(o),this.listeners.set(e,r);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)r.fire(f({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let o=this.listerHandlerMap.get(t);r.dispose(o)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let o=this.cachedEventQueue.get(e);o||(o=new L,this.cachedEventQueue.set(e,o)),o.push({args:t})}}};var x={};_e(x,{None:()=>je,filter:()=>Ke,once:()=>ue,toPromise:()=>He});var je=()=>{console.log("[Jolibox SDK] None Event")};function He(n){return new Promise(e=>ue(n)(e))}function ue(n){return(e,t=null)=>{let r=!1;return n(i=>{if(!r)return r=!0,e.call(t,i)},null)}}function Ke(n,e){return(r=>{let o,i={onWillAddFirstListener(){o=r(a.fire,a)}},a=new p(i);return a.event})((r,o=null)=>n(i=>e(i)&&r.call(o,i),null))}var U=Symbol.for("Jolibox.hostEmitter"),Ge=()=>{let n=new v;return globalThis[U]||(globalThis[U]={on:n.on.bind(n),off:n.off.bind(n),emit:n.emit.bind(n)}),globalThis[U]},Ct=Ge();function pe(n,e){let t=Math.min(n.length,e.length);for(let r=0;r<t;r++)Je(n[r],e[r])}function Je(n,e){if(S(e)){if(typeof n!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(M(e)){try{if(n instanceof e)return}catch(t){}if(!k(n)&&n.constructor===e||e.length===1&&e.call(void 0,n)===!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 g=class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new p;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 o=[];for(let a of e.metadata.args)o.push(a.constraint);let i=e.handler;e.handler=function(...a){return pe(a,o),i(...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}};g=I([C],g);var _=class{constructor(){this._onWillExecuteCommand=new p;this.onWillExecuteCommand=this._onWillExecuteCommand.event;this._onDidExecuteCommand=new p;this.onDidExecuteCommand=this._onDidExecuteCommand.event;this.registry=new g;this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=K(3e4)),this._starActivation}executeCommand(e,...t){return A(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),x.toPromise(x.filter(this.registry.onDidRegisterCommand,o=>o===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!!!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let o=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let i=this.invokeFunction(o.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),i}_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 o=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(o)}catch(o){return Promise.reject(o)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};_=I([C],_);var D=Symbol.for("Jolibox.commands");function tr(){if(globalThis[D])return globalThis[D];let n=new g,e=new _,t={registerCommand(r,o,i){n.registerCommand({id:r,handler:o,metadata:i})},executeCommand(r,...o){return e.executeCommand(r,...o)},excuteCommandSync(r,...o){return e.executeCommandThowErr(r,...o)}};return globalThis[D]=t,t}export{ke as ADVERTISING_ID,oe as APIError,R as BaseError,Se as DEVICE_ID,H as Deferred,we as EPlatform,Ce as EProject,v as EventEmitter,Ae as EventType,x as EventUtils,q as InternalApplyNativeError,ne as InternalBufferError,te as InternalContextError,u as InternalError,re as InternalGlobalJSError,Z as InternalInvokeMethodError,Y as InternalInvokeNativeError,ee as InternalJSCoreNotFoundError,X as InternalJSModuleEvalError,Q as InternalJSModuleFetchError,ie as InternalMetricReportError,se as InternalReporterError,W as InternalSchemaParseError,ve as LoadScriptCode,C as Singleton,w as UserCustomError,y as UserError,z as UserFetchError,B as UserFunctionEvalError,$ as UserGlobalError,J as UserValidateError,Sn as canIUseConfig,Dn as compareVersion,tr as createCommands,Qe as createRunTaskQueue,En as debounce,kn as get,Ue as getAdvertisingId,Me as getDeviceId,Yn as getOriginalLocalStorage,Pe as getPlatform,me as getStorage,Ve as getUtmSource,Ct as hostEmitter,nn as isArray,on as isBoolean,sn as isDefined,M as isFunction,rn as isIterable,tn as isNumber,Re as isObject,an as isPromiseLike,S as isString,Ze as isStringArray,en as isTypedArray,he as isUndefined,k as isUndefinedOrNull,Jn as isValidUUIDV4,ae as logger,pn as mergeArray,un as mergeWith,We as microTask,N as platform,Be as promisifyAPI,jn as serializeEventPackage,ze as sleep,K as timeout,ce as uuidv4,Je as validateConstraint,pe as validateConstraints,bn as wrapUserFunction,Wn as xUserAgent};
@@ -11,3 +11,4 @@ export * from './compare-version';
11
11
  export * from './event-tracker';
12
12
  export * from './uuid';
13
13
  export * from './xua';
14
+ export * from './local-storage';
@@ -0,0 +1 @@
1
+ export declare function getOriginalLocalStorage(): Storage;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jolibox/common",
3
3
  "description": "This project is common utils for both sdk & implementation",
4
- "version": "1.1.13-beta.3",
4
+ "version": "1.1.13-beta.5",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
7
7
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "README.md"
12
12
  ],
13
13
  "dependencies": {
14
- "@jolibox/types": "1.1.13-beta.3"
14
+ "@jolibox/types": "1.1.13-beta.5"
15
15
  },
16
16
  "devDependencies": {
17
17
  "typescript": "5.7.3",