superapp-miniapp-invoke-native 1.12.2 → 1.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/main.d.ts +6 -2
- package/lib/main.js +780 -852
- package/lib/main.umd.cjs +1 -1
- package/package.json +1 -1
package/lib/main.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
/* global globalThis, AndroidInitialContext */
|
|
3
|
-
var yt=Object.defineProperty,St=Object.defineProperties;var Nt=Object.getOwnPropertyDescriptors;var Hr=Object.getOwnPropertySymbols;var ft=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable;var qe=(S,g,N)=>g in S?yt(S,g,{enumerable:!0,configurable:!0,writable:!0,value:N}):S[g]=N,H=(S,g)=>{for(var N in g||(g={}))ft.call(g,N)&&qe(S,N,g[N]);if(Hr)for(var N of Hr(g))Mt.call(g,N)&&qe(S,N,g[N]);return S},F=(S,g)=>St(S,Nt(g));var f=(S,g,N)=>(qe(S,typeof g!="symbol"?g+"":g,N),N);var o=(S,g,N)=>new Promise((V,z)=>{var ve=C=>{try{l(N.next(C))}catch(P){z(P)}},Ee=C=>{try{l(N.throw(C))}catch(P){z(P)}},l=C=>C.done?V(C.value):Promise.resolve(C.value).then(ve,Ee);l((N=N.apply(S,g)).next())});(function(S,g){typeof exports=="object"&&typeof module!="undefined"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):g((S=typeof globalThis!="undefined"?globalThis:S||self).main={})})(this,function(S){var mr,gr,Pr,yr,Sr,Nr,fr,Mr,Ir,Or,Cr,vr,Er,Ar,Rr,Lr,kr;"use strict";/*! Capacitor: https://capacitorjs.com/ - MIT License */const g=t=>t.CapacitorPlatforms=(e=>{const r=new Map;r.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:r};return n.addPlatform=(a,i)=>{n.platforms.set(a,i)},n.setPlatform=a=>{n.platforms.has(a)&&(n.currentPlatform=n.platforms.get(a))},n})(t),N=g(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var V;N.addPlatform,N.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(V||(V={}));class z extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const ve=t=>{var e,r,n,a,i;const c=t.CapacitorCustomPlatform||null,s=t.Capacitor||{},w=s.Plugins=s.Plugins||{},u=t.CapacitorPlatforms,_=((e=u==null?void 0:u.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(h=>{var m,I;return h!=null&&h.androidBridge?"android":!((I=(m=h==null?void 0:h.webkit)===null||m===void 0?void 0:m.messageHandlers)===null||I===void 0)&&I.bridge?"ios":"web"})(t)),p=((r=u==null?void 0:u.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>_()!=="web"),v=((n=u==null?void 0:u.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(h=>{const m=E.get(h);return!!(m!=null&&m.platforms.has(_()))||!!b(h)}),b=((a=u==null?void 0:u.currentPlatform)===null||a===void 0?void 0:a.getPluginHeader)||(h=>{var m;return(m=s.PluginHeaders)===null||m===void 0?void 0:m.find(I=>I.name===h)}),E=new Map,A=((i=u==null?void 0:u.currentPlatform)===null||i===void 0?void 0:i.registerPlugin)||((h,m={})=>{const I=E.get(h);if(I)return console.warn(`Capacitor plugin "${h}" already registered. Cannot register plugins twice.`),I.proxy;const R=_(),X=b(h);let K;const xe=T=>{let B;const G=(...Ce)=>{const Z=(()=>o(this,null,function*(){return!K&&R in m?K=K=typeof m[R]=="function"?yield m[R]():m[R]:c!==null&&!K&&"web"in m&&(K=K=typeof m.web=="function"?yield m.web():m.web),K}))().then(Y=>{const Vr=((L,ee)=>{var je,$e;if(!X){if(L)return($e=L[ee])===null||$e===void 0?void 0:$e.bind(L);throw new z(`"${h}" plugin is not implemented on ${R}`,V.Unimplemented)}{const Br=X==null?void 0:X.methods.find(re=>ee===re.name);if(Br)return Br.rtype==="promise"?re=>s.nativePromise(h,ee.toString(),re):(re,Pt)=>s.nativeCallback(h,ee.toString(),re,Pt);if(L)return(je=L[ee])===null||je===void 0?void 0:je.bind(L)}})(Y,T);if(Vr){const L=Vr(...Ce);return B=L==null?void 0:L.remove,L}throw new z(`"${h}.${T}()" is not implemented on ${R}`,V.Unimplemented)});return T==="addListener"&&(Z.remove=()=>o(this,null,function*(){return B()})),Z};return G.toString=()=>`${T.toString()}() { [capacitor code] }`,Object.defineProperty(G,"name",{value:T,writable:!1,configurable:!1}),G},br=xe("addListener"),Tr=xe("removeListener"),gt=(T,B)=>{const G=br({eventName:T},B),Ce=()=>o(this,null,function*(){const Y=yield G;Tr({eventName:T,callbackId:Y},B)}),Z=new Promise(Y=>G.then(()=>Y({remove:Ce})));return Z.remove=()=>o(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Ce()}),Z},De=new Proxy({},{get(T,B){switch(B){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return X?gt:br;case"removeListener":return Tr;default:return xe(B)}}});return w[h]=De,E.set(h,{name:h,proxy:De,platforms:new Set([...Object.keys(m),...X?[R]:[]])}),De});return s.convertFileSrc||(s.convertFileSrc=h=>h),s.getPlatform=_,s.handleError=h=>t.console.error(h),s.isNativePlatform=p,s.isPluginAvailable=v,s.pluginMethodNoop=(h,m,I)=>Promise.reject(`${I} does not have an implementation of "${m}".`),s.registerPlugin=A,s.Exception=z,s.DEBUG=!!s.DEBUG,s.isLoggingEnabled=!!s.isLoggingEnabled,s.platform=s.getPlatform(),s.isNative=s.isNativePlatform(),s},Ee=t=>t.Capacitor=ve(t),l=Ee(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),C=l.registerPlugin;l.Plugins;class P{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const a=()=>o(this,null,function*(){return this.removeListener(e,r)}),i=Promise.resolve({remove:a});return Object.defineProperty(i,"remove",{value:()=>o(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield a()})}),i}removeAllListeners(){return o(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,r){const n=this.listeners[e];n&&n.forEach(a=>a(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new l.Exception(e,V.Unimplemented)}unavailable(e="not available"){return new l.Exception(e,V.Unavailable)}removeListener(e,r){return o(this,null,function*(){const n=this.listeners[e];if(!n)return;const a=n.indexOf(r);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const Ke=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ze=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Fr extends P{getCookies(){return o(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[a,i]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=ze(a).trim(),i=ze(i).trim(),r[a]=i}),r})}setCookie(e){return o(this,null,function*(){try{const r=Ke(e.key),n=Ke(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${a}; path=${i}; ${c};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return o(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return o(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return o(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}C("CapacitorCookies",{web:()=>new Fr});const Ur=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=((a={})=>{const i=Object.keys(a);return Object.keys(a).map(c=>c.toLocaleLowerCase()).reduce((c,s,w)=>(c[s]=a[i[w]],c),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[i,c]of Object.entries(t.data||{}))a.set(i,c);r.body=a.toString()}else if(n.includes("multipart/form-data")){const a=new FormData;if(t.data instanceof FormData)t.data.forEach((c,s)=>{a.append(s,c)});else for(const c of Object.keys(t.data))a.append(c,t.data[c]);r.body=a;const i=new Headers(r.headers);i.delete("content-type"),r.headers=i}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class Wr extends P{request(e){return o(this,null,function*(){const r=Ur(e,e.webFetchExtra),n=((p,v=!0)=>p?Object.entries(p).reduce((b,E)=>{const[A,h]=E;let m,I;return Array.isArray(h)?(I="",h.forEach(R=>{m=v?encodeURIComponent(R):R,I+=`${A}=${m}&`}),I.slice(0,-1)):(m=v?encodeURIComponent(h):h,I=`${A}=${m}`),`${b}&${I}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),a=n?`${e.url}?${n}`:e.url,i=yield fetch(a,r),c=i.headers.get("content-type")||"";let s,w,{responseType:u="text"}=i.ok?e:{};switch(c.includes("application/json")&&(u="json"),u){case"arraybuffer":case"blob":w=yield i.blob(),s=yield(p=>o(this,null,function*(){return new Promise((v,b)=>{const E=new FileReader;E.onload=()=>{const A=E.result;v(A.indexOf(",")>=0?A.split(",")[1]:A)},E.onerror=A=>b(A),E.readAsDataURL(p)})}))(w);break;case"json":s=yield i.json();break;default:s=yield i.text()}const _={};return i.headers.forEach((p,v)=>{_[v]=p}),{data:s,headers:_,status:i.status,url:i.url}})}get(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Ae(){return l.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}C("CapacitorHttp",{web:()=>new Wr}),C("Portals",{web:()=>Promise.resolve().then(function(){return xr}).then(t=>new t.PortalsWeb)});const xr=Object.freeze({__proto__:null,PortalsWeb:class extends P{publishNative(t){return o(this,null,function*(){})}}}),te=t=>{var e,r,n;try{if(typeof window=="undefined")return;if(Ae&&((e=Ae())!=null&&e.value)){const a=(n=(r=Ae())==null?void 0:r.value)!=null?n:null;if(!a)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(a)}}catch(a){throw console.error("getInitialContextHandle error",a),a}};class Dr{isNative(){try{return(()=>{try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.isNative();{let e=!1;return te(r=>{e=!!(r!=null&&r.isNative)}),e}}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{if(window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.redirectPage(window.__MICRO_APP_NAME__);if(console.log("redirectParams",r),r)return e.callBack(r)}else(({callBack:r})=>{te(n=>{var a;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const i=(a=n==null?void 0:n.params)!=null?a:null;if(!i)return;if(!r)return void console.error("initial context call back is undefine");r(i)}catch(i){throw console.error("redirectPageHandle error",i),i}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){var r;try{return this.isNative()?window.__MICRO_APP_ENVIRONMENT__?(r=window.rawWindow.__mini_app_hook__.getNativeInfo(e))!=null?r:{}:(()=>{try{let n=null;return te(a=>{n=a!=null?a:null}),n}catch(n){throw console.error("getNativeInfoHandle error",n),n}})():(n=>{var a;return(a=n==null?void 0:n.mockData)!=null?a:null})(e)}catch(n){throw console.error("getNativeInfo error",n),n}}getStatus(){return new Promise(e=>{e({isNative:!0,redirectPage:!0,getNativeInfo:!0})})}}const O=()=>{try{let t={};return typeof window!="undefined"&&(t=window),t}catch(t){throw console.error("isWinHandle error",t),t}},k="CommunicatePlugin",y=l.registerPlugin(k,{web:()=>Promise.resolve().then(()=>mt).then(t=>new t.PluginsWeb)}),ne=O();ne.removeAddListenerFab=()=>null;const jr=(t,e)=>{var r,n;try{ne.removeAddListenerFab&&ne.removeAddListenerFab();const a=[];if((r=y.showFABMenu)==null||r.call(y,{fabMenu:a,position:null}),!t||!((n=Object.keys(t))!=null&&n.length))return;Object.keys(t).forEach(i=>{var c,s,w,u,_,p,v,b;a.push({disable:(s=(c=t==null?void 0:t[i])==null?void 0:c.disable)!=null?s:!1,icon:(u=(w=t==null?void 0:t[i])==null?void 0:w.icon)!=null?u:"",id:(p=(_=t==null?void 0:t[i])==null?void 0:_.id)!=null?p:"",name:(b=(v=t==null?void 0:t[i])==null?void 0:v.title)!=null?b:""})}),queueMicrotask(()=>{var i;(i=y.showFABMenu)==null||i.call(y,{fabMenu:a,position:e!=null?e:null})}),setTimeout(()=>{(i=>o(this,null,function*(){i&&(ne.removeAddListenerFab=yield(c=>o(this,null,function*(){try{if(l.addListener){const s=yield l.addListener(k,"nativeSendFab",w=>c&&c(w));return s!=null&&s.remove?s.remove:()=>null}}catch(s){throw console.error("addListenerFabHandle error",s),s}}))(i))}))(i=>{let c;i!=null&&i.disable||i!=null&&i.id&&(Object.keys(t).forEach(s=>{var w,u,_;(w=t==null?void 0:t[s])!=null&&w.id&&i.id===t[s].id&&(c=(_=(u=t[s])==null?void 0:u.fn)!=null?_:()=>null)}),typeof c=="function"&&c())})})}catch(a){throw console.error("fabBtnHandle error",a),a}},U=O();U.addListenerBackRemoveHandle=()=>null;const Ge=(t=()=>null)=>o(this,null,function*(){try{U!=null&&U.addListenerBackRemoveHandle&&typeof U.addListenerBackRemoveHandle=="function"&&U.addListenerBackRemoveHandle(),U.addListenerBackRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendBack",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerBackHandle error",r),r}}))(t)}catch(e){throw console.error("initBackBtnFn error",e),e}}),oe=O();oe.addListenerHomeHandle=()=>null;const $r=t=>{try{oe.addListenerHomeHandle&&oe.addListenerHomeHandle(),setTimeout(()=>{(e=>o(this,null,function*(){e&&(oe.addListenerHomeHandle=yield(r=>o(this,null,function*(){try{if(l.addListener){const n=yield l.addListener(k,"nativeSendHome",a=>r&&r(a));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(t)})}catch(e){throw console.error("homeFn error",e),e}},W=O();W.addListenerTouchRemoveHandle=()=>null;const Je=(t=()=>null)=>o(this,null,function*(){try{W!=null&&W.addListenerTouchRemoveHandle&&typeof W.addListenerTouchRemoveHandle=="function"&&W.addListenerTouchRemoveHandle(),W.addListenerTouchRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeTouchListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerTouchHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),x=O();x.addListenerSendDeepLinkRemoveHandle=()=>null;const Qe=(t=()=>null)=>o(this,null,function*(){try{x!=null&&x.addListenerSendDeepLinkRemoveHandle&&typeof x.addListenerSendDeepLinkRemoveHandle=="function"&&x.addListenerSendDeepLinkRemoveHandle(),x.addListenerSendDeepLinkRemoveHandle=yield(e=>o(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return e&&window.rawWindow.__mini_app_hook__.getDeeplinkParams(e),{remove:()=>null};if(l.addListener){const r=yield l.addListener(k,"nativeSendDeeplinkCallbackListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSendDeepLinkHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),D=O();D.addListenerSwitchLanguageRemoveHandle=()=>null;const Xe=(t=()=>null)=>o(this,null,function*(){try{D!=null&&D.addListenerSwitchLanguageRemoveHandle&&typeof D.addListenerSwitchLanguageRemoveHandle=="function"&&D.addListenerSwitchLanguageRemoveHandle(),D.addListenerSwitchLanguageRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendSwitchLanguage",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.switchLanguage=e,{remove:()=>{window.rawWindow.__mini_app_hook__.switchLanguage=null}}}catch(r){throw console.error("addListenerSwitchLanguageHandle error",r),r}}))(t)}catch(e){throw console.error("initSwitchLanguageFn error",e),e}}),j=O();j.addListenerSetupMiniAppRemoveHandle=()=>null;const Ze=(t=()=>null)=>o(this,null,function*(){try{j!=null&&j.addListenerSetupMiniAppRemoveHandle&&typeof j.addListenerSetupMiniAppRemoveHandle=="function"&&j.addListenerSetupMiniAppRemoveHandle(),j.addListenerSetupMiniAppRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSetupMiniApp",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSetupMiniAppHandle error",r),r}}))(t)}catch(e){throw console.error("initSetupMiniAppFn error",e),e}}),$=O();$.addListenerSwitchStoreRemoveHandle=()=>null;const Ye=(t=()=>null)=>o(this,null,function*(){try{$!=null&&$.addListenerSwitchStoreRemoveHandle&&typeof $.addListenerSwitchStoreRemoveHandle=="function"&&$.addListenerSwitchStoreRemoveHandle(),$.addListenerSwitchStoreRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendSwitchStore",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.switchStore=e,{remove:()=>{window.rawWindow.__mini_app_hook__.switchStore=null}}}catch(r){throw console.error("addListenerSwitchStoreHandle error",r),r}}))(t)}catch(e){throw console.error("initSwitchStoreFn error",e),e}});class qr{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return o(this,null,function*(){var r;try{return yield(r=y.homeIsClick)==null?void 0:r.call(y,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Ge(i)}),a(()=>{Ge()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setHomeBtn=e:$r(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e,r){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setFabBtn(e,r):jr(e,r)}catch(n){throw console.error("setFabBtn error",n),n}}touchListener(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Je(i)}),a(()=>{Je()})}catch(n){throw console.error("touchListenerHandle error",n),n}})(e)}catch(r){throw console.error("listenerTouch error",r),r}}disableFAB(e){return o(this,null,function*(){try{return yield y.disableFAB(e)}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(e){return o(this,null,function*(){try{return yield y.disableBack(e)}catch(r){throw console.error("disableBack error",r),r}})}openMiniApp(e){return o(this,null,function*(){try{return yield y.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return o(this,null,function*(){try{return yield y.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return o(this,null,function*(){try{return yield y.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return o(this,null,function*(){try{return yield y.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return o(this,null,function*(){try{return yield y.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return o(this,null,function*(){try{return yield y.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return o(this,null,function*(){try{return yield y.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}getDeeplinkParams(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Qe(i)}),a(()=>{Qe()})}catch(n){throw console.error("sendDeepLinkListenerHandle error",n),n}})(e)}catch(r){throw console.error("getDeeplinkParams error",r),r}}switchLanguage(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Xe(i)}),a(()=>{Xe()})}catch(n){throw console.error("sendSwitchLanguageHandle error",n),n}})(e)}catch(r){throw console.error("switchLanguage error",r),r}}setupMiniApp(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Ze(i)}),a(()=>{Ze()})}catch(n){throw console.error("setupMiniAppHandle error",n),n}})(e)}catch(r){throw console.error("setupMiniApp error",r),r}}switchStore(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Ye(i)}),a(()=>{Ye()})}catch(n){throw console.error("sendSwitchStoreHandle error",n),n}})(e)}catch(r){throw console.error("switchStore error",r),r}}closeMiniApp(){return o(this,null,function*(){try{return yield y.closeMiniApp()}catch(e){throw console.error("closeMiniApp error",e),e}})}getStatus(){return o(this,null,function*(){try{return yield y.getStatus()}catch(e){throw console.error("communicatePlugins getStatus error",e),e}})}dispatchToShell(e){return o(this,null,function*(){try{return yield y.dispatchToShell(e)}catch(r){throw console.error("communicate dispatchToShell error",r),r}})}getMiniAppInfo(e){return o(this,null,function*(){try{return yield y.getMiniAppInfo(e)}catch(r){throw console.error("getMiniAppInfo error",r),r}})}}let ae=null;window.__MICRO_APP_ENVIRONMENT__&&(ae=(mr=window.rawWindow.__mini_app_status_hook__)!=null?mr:{});const Re=l.registerPlugin("CameraScanPlugin",{web:new class extends P{pickCameraScan(t){return o(this,null,function*(){return new Promise(e=>{e(t)})})}setCameraScanState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ae==null?void 0:ae.cameraScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScan getStatus error",t),t}}}});window.removeAddListenerCameraScan=()=>null;class Kr{pickCameraScan(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScan(e):yield Re.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}setCameraScanState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanState(e):yield Re.setCameraScanState(e)}catch(r){throw console.error("setCameraScanState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Re.getStatus()}catch(e){throw console.error("cameraScanPlugin getStatus error",e),e}})}}let ie=null;window.__MICRO_APP_ENVIRONMENT__&&(ie=(gr=window.rawWindow.__mini_app_status_hook__)!=null?gr:{});const Le=l.registerPlugin("CameraScanMultiplePlugin",{web:new class extends P{pickCameraScanMultiple(){return o(this,null,function*(){})}setCameraScanMultipleState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ie==null?void 0:ie.cameraScanMultiple)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultiple getStatus error",t),t}}}});class zr{pickCameraScanMultiple(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultiple(e):yield Le.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}setCameraScanMultipleState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleState(e):yield Le.setCameraScanMultipleState(e)}catch(r){throw console.error("setCameraScanMultipleState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Le.getStatus()}catch(e){throw console.error("cameraScanMultiplePlugin getStatus error",e),e}})}}let se=null;window.__MICRO_APP_ENVIRONMENT__&&(se=(Pr=window.rawWindow.__mini_app_status_hook__)!=null?Pr:{});const ke=l.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends P{pickCameraScanMultipleNoCount(){return o(this,null,function*(){})}setCameraScanMultipleNoCountState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=se==null?void 0:se.cameraScanMultipleNoCount)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultipleNoCount getStatus error",t),t}}}});class Gr{pickCameraScanMultipleNoCount(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultipleNoCount(e):yield ke.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}setCameraScanMultipleNoCountState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleNoCountState(e):yield ke.setCameraScanMultipleNoCountState(e)}catch(r){throw console.error("setCameraScanMultipleNoCountState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield ke.getStatus()}catch(e){throw console.error("cameraScanMultipleNoCountPlugin getStatus error",e),e}})}}let ce=null;window.__MICRO_APP_ENVIRONMENT__&&(ce=(yr=window.rawWindow.__mini_app_status_hook__)!=null?yr:{});const be=l.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends P{pickCameraScanSingleOrDual(){return o(this,null,function*(){})}setCameraScanSingleOrDualState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ce==null?void 0:ce.cameraScanSingleOrDual)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanSingleOrDual getStatus error",t),t}}}});class Jr{pickCameraScanSingleOrDual(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanSingleOrDual(e):yield be.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}setCameraScanSingleOrDualState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCameraScanSingleOrDualState(e):yield be.setCameraScanSingleOrDualState(e)}catch(r){throw console.error("setCameraScanSingleOrDualState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield be.getStatus()}catch(e){throw console.error("cameraScanSingleOrDualPlugin getStatus error",e),e}})}}const er="LaserScanPlugin";let le=null;window.__MICRO_APP_ENVIRONMENT__&&(le=(Sr=window.rawWindow.__mini_app_status_hook__)!=null?Sr:{});const de=l.registerPlugin(er,{web:new class extends P{pickLaserScan(){return o(this,null,function*(){})}unPickLaserScan(){return o(this,null,function*(){})}setLaserState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=le==null?void 0:le.laserScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("laserScan getStatus error",t),t}}}}),we=O();we.removeAddListenerLaserScan=()=>null;const rr=(t=()=>null)=>{try{we.removeAddListenerLaserScan&&we.removeAddListenerLaserScan();const e=r=>o(this,null,function*(){r&&(we.removeAddListenerLaserScan=yield(n=>o(this,null,function*(){try{if(l.addListener){const a=yield l.addListener(er,"nativeSendLaser",i=>n&&n(i));return a!=null&&a.remove?a.remove:()=>null}}catch(a){throw console.error("addListenerLaserHandle error",a),a}}))(r))});setTimeout(()=>{e(t)})}catch(e){throw console.error("laserScanFn error",e),e}};class Qr{constructor(){this.pickLaserScan()}pickLaserScan(){return o(this,null,function*(){try{return yield de.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return o(this,null,function*(){try{return yield de.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{de.setLaserState(e)}catch(r){throw console.error("setLaserState error",r),r}}setLaserScan(e){(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{rr(i)}),a(()=>{rr()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}getStatus(){return o(this,null,function*(){try{return yield de.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}const tr="CountAssistPlugin";let ue=null;window.__MICRO_APP_ENVIRONMENT__&&(ue=(Nr=window.rawWindow.__mini_app_status_hook__)!=null?Nr:{});const _e=l.registerPlugin(tr,{web:new class extends P{setCountAssistState(t){return o(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setCountAssistState error",e),e}})}toggleCountAssist(t){return o(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("hideCountAssist error",e),e}})}getCountAssistToggleState(){return o(this,null,function*(){try{return new Promise(t=>{t(void 0)})}catch(t){throw console.error("getCountAssistToggleState error",t),t}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ue==null?void 0:ue.countAssist)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("countAssist getStatus error",t),t}}}}),q=O();q.addListenerCountAssistRemoveHandle=()=>null;const nr=(t=()=>null)=>o(this,null,function*(){try{q!=null&&q.addListenerCountAssistRemoveHandle&&typeof q.addListenerCountAssistRemoveHandle=="function"&&q.addListenerCountAssistRemoveHandle(),q.addListenerCountAssistRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(tr,"nativeSendCountAssist",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerCountAssistHandle error",r),r}}))(t)}catch(e){throw console.error("initCountAssistFn error",e),e}});class Xr{setCountAssistState(e){return o(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCountAssistState(e):yield _e.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let n=r!=null?r:!1;return te(a=>{n=!!(a!=null&&a.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{nr(i)}),a(()=>{nr()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}toggleCountAssist(e){return o(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.toggleCountAssist(e):yield _e.toggleCountAssist(e)})}getCountAssistToggleState(){return o(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.getCountAssistToggleState():yield _e.getCountAssistToggleState()})}getStatus(){return o(this,null,function*(){try{return yield _e.getStatus()}catch(e){throw console.error("countAssistPlugin getStatus error",e),e}})}}let he=null;window.__MICRO_APP_ENVIRONMENT__&&(he=(fr=window.rawWindow.__mini_app_status_hook__)!=null?fr:{});const Te=l.registerPlugin("ClickStreamPlugin",{web:new class extends P{init(){return o(this,null,function*(){return new Promise(t=>{t(null)})})}trace(t){return o(this,null,function*(){var e,r;try{return window.__MICRO_APP_ENVIRONMENT__&&((r=(e=window.rawWindow.__mini_app_hook__).clickStream)==null||r.call(e,t.data)),new Promise(n=>{n(t)})}catch(n){throw console.error("clickStreamTraceParams error",n),n}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=he==null?void 0:he.clickStream)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("clickStream getStatus error",t),t}}}});class Zr{constructor(){this.init()}init(){return o(this,null,function*(){try{return yield Te.init()}catch(e){throw console.error("clickStreamPlugin, init error",e),e}})}trace(e){return o(this,null,function*(){try{return yield Te.trace(e)}catch(r){throw console.error("clickStreamPlugin, trace error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Te.getStatus()}catch(e){throw console.error("clickStreamPlugin getStatus error",e),e}})}}const or="MiniAppLifecyclePlugin";let pe=null;window.__MICRO_APP_ENVIRONMENT__&&(pe=(Mr=window.rawWindow.__mini_app_status_hook__)!=null?Mr:{});var J=(t=>(t.MINI_APP_BEFORE_UNMOUNT_PERMISSION="mini_app_before_unmount_permission",t.MINI_APP_BEFORE_UNMOUNT_COMPLETION="mini_app_before_unmount_completion",t))(J||{});const Ve=l.registerPlugin(or,{web:new class extends P{setNativeUsagePermission(){return o(this,null,function*(){})}authorizeWebCallback(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=pe==null?void 0:pe.lifecycle)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("lifecycle getStatus error",t),t}}}}),me=O();me.removeAddListenerLifecycleMiniAppBeforeUnmount=()=>null;const ar=(t=()=>null)=>{try{me.removeAddListenerLifecycleMiniAppBeforeUnmount&&me.removeAddListenerLifecycleMiniAppBeforeUnmount();const e=r=>o(this,null,function*(){r&&(me.removeAddListenerLifecycleMiniAppBeforeUnmount=yield(n=>o(this,null,function*(){try{if(l.addListener){const a=yield l.addListener(or,"miniAppBeforeUnmount",i=>n&&n(i));return a!=null&&a.remove?a.remove:()=>null}}catch(a){throw console.error("miniAppBeforeUnmountHandle error",a),a}}))(r))});setTimeout(()=>o(this,null,function*(){yield e(t)}))}catch(e){throw console.error("laserScanFn error",e),e}};class Yr{constructor(){}setNativeUsagePermission(e){return o(this,null,function*(){try{return yield Ve.setNativeUsagePermission(e)}catch(r){throw console.error("lifecyclePlugin.setNativeUsagePermission error",r),r}})}authorizeWebCallback(e){return o(this,null,function*(){try{return yield Ve.authorizeWebCallback(e)}catch(r){throw console.error("lifecyclePlugin.authorizeWebCallback error",r),r}})}miniAppBeforeUnmount(e){this.setNativeUsagePermission({action:J.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!0}),((r,n)=>{try{const{mounted:a,beforeUnmount:i,callBack:c}=r;a(()=>{ar(s=>o(this,null,function*(){var w;if(c&&c instanceof Function)try{(w=c(s))==null||w.then(()=>o(this,null,function*(){yield n.setNativeUsagePermission({action:J.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1}),yield n.authorizeWebCallback({action:J.MINI_APP_BEFORE_UNMOUNT_COMPLETION})}))}catch(u){console.error("miniAppBeforeUnmount error callBack is not a function or promise")}else console.error("miniAppBeforeUnmount error callBack is not a function or promise")}))}),i(()=>o(this,null,function*(){ar(),n.setNativeUsagePermission({action:J.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1})}))}catch(a){throw console.error("miniAppBeforeUnmount error",a),a}})(e,this)}getStatus(){return o(this,null,function*(){try{return yield Ve.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let ge=null;window.__MICRO_APP_ENVIRONMENT__&&(ge=(Ir=window.rawWindow.__mini_app_status_hook__)!=null?Ir:{});const Be=l.registerPlugin("DeviceInteractionPlugin",{web:new class extends P{callVibrate(){return o(this,null,function*(){})}callErrorBeep(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ge==null?void 0:ge.deviceInteraction)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("deviceInteraction getStatus error",t),t}}}});class et{callVibrate(){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callVibrate():yield Be.callVibrate()}catch(e){throw console.error("callVibrate error",e),e}})}callErrorBeep(){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callErrorBeep():yield Be.callErrorBeep()}catch(e){throw console.error("callErrorBeep error",e),e}})}getStatus(){return o(this,null,function*(){try{return yield Be.getStatus()}catch(e){throw console.error("deviceInteractionPlugin getStatus error",e),e}})}}const ir="PollingPlugin";let Pe=null;window.__MICRO_APP_ENVIRONMENT__&&(Pe=(Or=window.rawWindow.__mini_app_status_hook__)!=null?Or:{});const He=l.registerPlugin(ir,{web:new class extends P{create(){return o(this,null,function*(){})}destroy(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Pe==null?void 0:Pe.polling)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("polling getStatus error",t),t}}}}),ye=O();ye.removeAddListenerPolling=()=>null;const rt=(t,e)=>{try{ye.removeAddListenerPolling&&ye.removeAddListenerPolling();const r=e.pollingId;(n=>o(this,null,function*(){return n&&(ye.removeAddListenerPolling=yield(a=>o(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(ir,"nativeSendPolling",c=>a&&a(c));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPollingHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.pollingId)===r&&(n!=null&&n.pollingId)&&t.pollingList.forEach(a=>{a!=null&&a.pollingId&&(n==null?void 0:n.pollingId)===(a==null?void 0:a.pollingId)&&typeof(a==null?void 0:a.callBack)=="function"&&a.callBack(n)})})}catch(r){throw console.error("pollingFn error",r),r}};class tt{constructor(){f(this,"pollingList");this.pollingList=[]}create(e){var r,n,a;if(window.__MICRO_APP_ENVIRONMENT__){const{mounted:i,pollingParams:c,callBack:s}=e;return i(()=>{var w,u;(u=(w=window.rawWindow.__mini_app_hook__)==null?void 0:w.addPolling)==null||u.call(w,c,s)}),()=>{this.destroy({pollingId:c.pollingId})}}try{(r=e==null?void 0:e.pollingParams)!=null&&r.pollingId&&this.pollingList.push({pollingId:(n=e==null?void 0:e.pollingParams)==null?void 0:n.pollingId,callBack:e==null?void 0:e.callBack}),this.pollingList=this.pollingList.filter((c,s,w)=>s===w.findIndex(u=>u.pollingId===c.pollingId));const i=((a=e==null?void 0:e.pollingParams)==null?void 0:a.delay)/1e3;return He.create(F(H({},e==null?void 0:e.pollingParams),{delay:i})),((c,s)=>{try{const{mounted:w,pollingParams:u}=c;w(()=>rt(s,u))}catch(w){throw console.error("createPolling error",w),w}})(e,this),()=>{var c,s;return(c=e==null?void 0:e.pollingParams)!=null&&c.pollingId?this.destroy({pollingId:(s=e==null?void 0:e.pollingParams)==null?void 0:s.pollingId}):null}}catch(i){throw console.error("pollingPlugin create error",i),i}}destroy(e){var r,n,a;if(window.__MICRO_APP_ENVIRONMENT__){const{pollingId:i}=e;(n=(r=window.rawWindow.__mini_app_hook__)==null?void 0:r.deletePolling)==null||n.call(r,i)}else try{const i=this.pollingList.map(c=>c.pollingId).indexOf(e.pollingId);return(a=this.pollingList)!=null&&a.length&&(Number(i)||Number(i)>=0)&&this.pollingList.splice(Number(i),1),He.destroy(e)}catch(i){throw console.error("pollingPlugin destroy error",i),i}}getStatus(){return o(this,null,function*(){try{return yield He.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Se=null;window.__MICRO_APP_ENVIRONMENT__&&(Se=(Cr=window.rawWindow.__mini_app_status_hook__)!=null?Cr:{});const sr=l.registerPlugin("PaymentPlugin",{web:new class extends P{process(t){return o(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("process error",e),e}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Se==null?void 0:Se.payment)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("payment getStatus error",t),t}}}});class nt{process(e){return o(this,null,function*(){try{return yield sr.process(e)}catch(r){throw console.error("paymentPlugins.process error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield sr.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Ne=null;window.__MICRO_APP_ENVIRONMENT__&&(Ne=(vr=window.rawWindow.__mini_app_status_hook__)!=null?vr:{});const Fe=l.registerPlugin("CameraForTakePhotoPlugin",{web:new class extends P{pickCameraForTakePhoto(){return o(this,null,function*(){})}setCameraForTakePhotoState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Ne==null?void 0:Ne.cameraForTakePhoto)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraForTakePhoto getStatus error",t),t}}}});class ot{pickCameraForTakePhoto(){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraForTakePhoto():yield Fe.pickCameraForTakePhoto()}catch(e){throw console.error("pickCameraForTakePhoto error",e),e}})}setCameraForTakePhotoState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraForTakePhotoState(e):yield Fe.setCameraForTakePhotoState(e)}catch(r){throw console.error("setCameraForTakePhotoState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Fe.getStatus()}catch(e){throw console.error("cameraForTakePhotoPlugin getStatus error",e),e}})}}let fe=null;window.__MICRO_APP_ENVIRONMENT__&&(fe=(Er=window.rawWindow.__mini_app_status_hook__)!=null?Er:{});const cr=l.registerPlugin("HttpPlugin",{web:new class extends P{request(t){return o(this,null,function*(){return new Promise(e=>{e(t)})})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=fe==null?void 0:fe.http)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("http getStatus error",t),t}}}});class at{request(e){return o(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.requestHttp(e);{let r={};return e.url&&(r.url=e.url),e.method&&(r.method=e.method),e.headers&&(r.headers=e.headers),e.params&&(r.urlParams=e.params),e.data&&(typeof e.data=="string"?r.bodyData=e.data:r.bodyParams=e.data),e.upload&&(r.upload=e.upload),yield cr.request(r)}}catch(r){throw console.error("HttpPlugin, trace error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield cr.getStatus()}catch(e){throw console.error("HttpPlugin getStatus error",e),e}})}}const M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));const it=new Uint8Array(16);function st(t,e,r){return e||t||!crypto.randomUUID?function(n,a,i){var s,w,u;n=n||{};const c=(u=(w=n.random)!=null?w:(s=n.rng)==null?void 0:s.call(n))!=null?u:crypto.getRandomValues(it);if(c.length<16)throw new Error("Random bytes length must be >= 16");if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,a){if((i=i||0)<0||i+16>a.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let _=0;_<16;++_)a[i+_]=c[_];return a}return function(_,p=0){return(M[_[p+0]]+M[_[p+1]]+M[_[p+2]]+M[_[p+3]]+"-"+M[_[p+4]]+M[_[p+5]]+"-"+M[_[p+6]]+M[_[p+7]]+"-"+M[_[p+8]]+M[_[p+9]]+"-"+M[_[p+10]]+M[_[p+11]]+M[_[p+12]]+M[_[p+13]]+M[_[p+14]]+M[_[p+15]]).toLowerCase()}(c)}(t,e,r):crypto.randomUUID()}const lr="PrintPlugin";let Me=null;window.__MICRO_APP_ENVIRONMENT__&&(Me=(Ar=window.rawWindow.__mini_app_status_hook__)!=null?Ar:{});const dr=l.registerPlugin(lr,{web:new class extends P{print(){}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Me==null?void 0:Me.print)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("print getStatus error",t),t}}}}),Q=O();Q.removeAddListenerPrintList={};const ct=(t,e)=>{try{const r=e.printId;Q.removeAddListenerPrintList=F(H({},Q.removeAddListenerPrintList),{printId:()=>{}}),(n=>o(this,null,function*(){return n&&(Q.removeAddListenerPrintList[r]=yield(a=>o(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(lr,"nativeSendPrint",c=>a&&a(c));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPrintHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.printId)===r&&(n!=null&&n.printId)&&t.printList.forEach(a=>{var i,c,s;a!=null&&a.printId&&(n==null?void 0:n.printId)===(a==null?void 0:a.printId)&&(typeof(a==null?void 0:a.callBack)=="function"&&a.callBack(n),(s=a.state==5||a.state==6)!=null||(c=(i=Q.removeAddListenerPrintList)==null?void 0:i[a==null?void 0:a.printId])==null||c.call(i))})})}catch(r){throw console.error("printFn error",r),r}};class lt{constructor(){f(this,"printList");this.printList=[]}print(e){var n,a,i,c;const r=((a=(n=e==null?void 0:e.printParams)==null?void 0:n.functionId)!=null?a:"")+st().replace(/-/g,"");if(this.printList.push({printId:r,callBack:e==null?void 0:e.callBack}),this.printList=this.printList.filter((s,w,u)=>w===u.findIndex(_=>_.printId===s.printId)),window.__MICRO_APP_ENVIRONMENT__){const{printParams:s,callBack:w}=e;return(c=(i=window.rawWindow.__mini_app_hook__)==null?void 0:i.print)==null||c.call(i,F(H({},s),{printId:r}),w),{id:r}}try{return dr.print(F(H({},e==null?void 0:e.printParams),{printId:r})),((s,w)=>{try{const{printParams:u}=s;ct(w,u)}catch(u){throw console.error("createPrint error",u),u}})(F(H({},e),{printParams:F(H({},e.printParams),{printId:r})}),this),{id:r}}catch(s){throw console.error("printPlugin create error",s),s}}getStatus(){return o(this,null,function*(){try{return yield dr.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}const wr=typeof window!="undefined";let Ie=null;wr&&window.__MICRO_APP_ENVIRONMENT__&&(Ie=(Rr=window.rawWindow.__mini_app_status_hook__)!=null?Rr:{});const dt=t=>{var e,r;if(!t)return"";try{const n=decodeURIComponent(t).match(/\/([^/?#&=]+)(?=$|[?&#])/g),a=(r=(e=n==null?void 0:n.pop())==null?void 0:e.slice(1))!=null?r:"",i=a.lastIndexOf(".");return i<=0?a:a.slice(0,i)}catch(n){return""}},ur=l.registerPlugin("DownloadFilePlugin",{web:new class extends P{downloadFile(t){return o(this,null,function*(){return((e,r,n="")=>({success:e,message:r,fileName:n}))(!1,"DownloadFilePlugin should be handled by shell",(e=>{var n;return((n=e==null?void 0:e.fileName)==null?void 0:n.trim())||`${dt(e==null?void 0:e.url)}_${Date.now()}`})(t))})}getStatus(){try{return wr&&window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Ie==null?void 0:Ie.downloadFile)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("downloadFile getStatus error",t),t}}}}),wt=typeof window!="undefined",ut=t=>{var r;const e=(r=t==null?void 0:t.fileName)==null?void 0:r.trim();return e||`${(n=>{var a,i;if(!n)return"";try{const c=decodeURIComponent(n).match(/\/([^/?#&=]+)(?=$|[?&#])/g),s=(i=(a=c==null?void 0:c.pop())==null?void 0:a.slice(1))!=null?i:"",w=s.lastIndexOf(".");return w<=0?s:s.slice(0,w)}catch(c){return""}})(t==null?void 0:t.url)}_${Date.now()}`},_r=(t,e)=>({success:!1,message:e,fileName:ut(t)});class _t{downloadFile(e){return o(this,null,function*(){try{if(wt&&window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.downloadFile;return r?yield r(e):_r(e,"DownloadFilePlugin is not available")}return yield ur.downloadFile(e)}catch(r){return console.error("downloadFile error",r),_r(e,r instanceof Error?r.message:"download failed")}})}getStatus(){return o(this,null,function*(){try{return yield ur.getStatus()}catch(e){throw console.error("downloadFile getStatus error",e),e}})}}const Ue="1.0";function We(){return{accepted:!1,code:"UNSUPPORTED",protocolVersion:Ue}}const hr=l.registerPlugin("OtelPlugin",{web:new class extends P{recordTrace(t){return o(this,null,function*(){var r,n;if(!window.__MICRO_APP_ENVIRONMENT__)return We();const e=(n=(r=window.rawWindow)==null?void 0:r.__mini_app_hook__)==null?void 0:n.recordOtelTrace;if(typeof e!="function")return We();try{return yield e(F(H({},t),{miniappKey:window.__MICRO_APP_NAME__}))}catch(a){return console.warn("[OtelPlugin] Web Shell recordOtelTrace failed",a),{accepted:!1,code:"INTERNAL_ERROR",protocolVersion:Ue}}})}getStatus(){return o(this,null,function*(){var e,r,n;if(!window.__MICRO_APP_ENVIRONMENT__)return{recordTrace:!1};const t=(n=(r=(e=window.rawWindow)==null?void 0:e.__mini_app_status_hook__)==null?void 0:r.otel)==null?void 0:n.getStatus;if(typeof t!="function")return{recordTrace:!1};try{const a=yield t();return{recordTrace:(a==null?void 0:a.recordTrace)===!0}}catch(a){return console.warn("[OtelPlugin] Web Shell getStatus failed",a),{recordTrace:!1}}})}}});class ht{recordTrace(e){return o(this,null,function*(){try{return yield hr.recordTrace({span:e})}catch(r){return console.warn("[OtelPlugin] recordTrace is unavailable",r),We()}})}getStatus(){return o(this,null,function*(){try{const e=yield hr.getStatus();return{recordTrace:(e==null?void 0:e.recordTrace)===!0}}catch(e){return console.warn("[OtelPlugin] getStatus is unavailable",e),{recordTrace:!1}}})}}class pr{constructor(){f(this,"initialContextPlugins",new Dr);f(this,"communicatePlugins",new qr);f(this,"cameraScanPlugins",new Kr);f(this,"cameraScanMultiplePlugins",new zr);f(this,"cameraScanMultipleNoCountPlugins",new Gr);f(this,"cameraScanSingleOrDualPlugins",new Jr);f(this,"laserScanPlugins",new Qr);f(this,"countAssistPlugins",new Xr);f(this,"clickStreamPlugins",new Zr);f(this,"lifecyclePlugins",new Yr);f(this,"deviceInteractionPlugins",new et);f(this,"pollingPlugins",new tt);f(this,"paymentPlugins",new nt);f(this,"cameraForTakePhotoPlugin",new ot);f(this,"httpPlugin",new at);f(this,"printPlugins",new lt);f(this,"downloadFilePlugin",new _t);f(this,"otelPlugins",new ht)}}const pt=new pr;let d=null,Oe=null;window.__MICRO_APP_ENVIRONMENT__&&(d=(Lr=window.rawWindow.__mini_app_hook__)!=null?Lr:{},Oe=(kr=window.rawWindow.__mini_app_status_hook__)!=null?kr:{});const mt=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends P{homeIsClick(t){return o(this,null,function*(){var e;window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch homeIsClick",t),(e=d.disabledMenu)==null||e.call(d,t))})}openMiniApp(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.openMiniApp)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch showTitle",t),(e=d.showTitle)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showTitle error",r),r}})}showFABMenu(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.showFABMenu)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showFABMenu error",r),r}})}disableFAB(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.disableFAB)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.disableBack)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableBack error",r),r}})}showSubMask(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.showSubMask)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.setMiniAppVersion)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showDialog(){return o(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.showDialog)==null||t.call(d))})}cancelDialog(){return o(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.cancelDialog)==null||t.call(d))})}getMiniAppKong(t){return o(this,null,function*(){var e,r;try{if(window.__MICRO_APP_ENVIRONMENT__){const n=(r=(e=d.getMiniAppKong)==null?void 0:e.call(d,t))!=null?r:{};return new Promise(a=>{a(n)})}return new Promise(n=>{n(t)})}catch(n){throw console.error("getMiniAppKong error",n),n}})}closeMiniApp(){return o(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.closeMiniApp)==null||t.call(d))})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Oe==null?void 0:Oe.communicate)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("communicate getStatus error",t),t}}dispatchToShell(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>o(this,null,function*(){var r;e((yield(r=d==null?void 0:d.dispatchToShell)==null?void 0:r.call(d,t))||{})})):new Promise(e=>{e(t)})}catch(e){throw console.error("communicate dispatchToShell error",e),e}}getMiniAppInfo(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>o(this,null,function*(){var r;e((yield(r=d==null?void 0:d.getMiniAppInfo)==null?void 0:r.call(d,t))||{})})):new Promise(e=>{e({})})}catch(e){throw console.error("communicate getMiniAppInfo error",e),e}}}},Symbol.toStringTag,{value:"Module"}));S.NativeApi=pr,S.OTEL_PLUGIN_PROTOCOL_VERSION=Ue,S.default=pt,Object.defineProperties(S,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
3
|
+
var ht=Object.defineProperty,mt=Object.defineProperties;var gt=Object.getOwnPropertyDescriptors;var br=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable;var je=(S,g,N)=>g in S?ht(S,g,{enumerable:!0,configurable:!0,writable:!0,value:N}):S[g]=N,V=(S,g)=>{for(var N in g||(g={}))Pt.call(g,N)&&je(S,N,g[N]);if(br)for(var N of br(g))yt.call(g,N)&&je(S,N,g[N]);return S},U=(S,g)=>mt(S,gt(g));var f=(S,g,N)=>(je(S,typeof g!="symbol"?g+"":g,N),N);var o=(S,g,N)=>new Promise((T,q)=>{var Oe=O=>{try{l(N.next(O))}catch(P){q(P)}},Ce=O=>{try{l(N.throw(O))}catch(P){q(P)}},l=O=>O.done?T(O.value):Promise.resolve(O.value).then(Oe,Ce);l((N=N.apply(S,g)).next())});(function(S,g){typeof exports=="object"&&typeof module!="undefined"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):g((S=typeof globalThis!="undefined"?globalThis:S||self).main={})})(this,function(S){var ur,_r,pr,hr,mr,gr,Pr,yr,Sr,Nr,fr,Mr,Ir,Or,Cr,Ar,Er;"use strict";/*! Capacitor: https://capacitorjs.com/ - MIT License */const g=t=>t.CapacitorPlatforms=(e=>{const r=new Map;r.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:r};return n.addPlatform=(a,i)=>{n.platforms.set(a,i)},n.setPlatform=a=>{n.platforms.has(a)&&(n.currentPlatform=n.platforms.get(a))},n})(t),N=g(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var T;N.addPlatform,N.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(T||(T={}));class q extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const Oe=t=>{var e,r,n,a,i;const c=t.CapacitorCustomPlatform||null,s=t.Capacitor||{},w=s.Plugins=s.Plugins||{},u=t.CapacitorPlatforms,_=((e=u==null?void 0:u.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(p=>{var m,I;return p!=null&&p.androidBridge?"android":!((I=(m=p==null?void 0:p.webkit)===null||m===void 0?void 0:m.messageHandlers)===null||I===void 0)&&I.bridge?"ios":"web"})(t)),h=((r=u==null?void 0:u.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>_()!=="web"),A=((n=u==null?void 0:u.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(p=>{const m=E.get(p);return!!(m!=null&&m.platforms.has(_()))||!!L(p)}),L=((a=u==null?void 0:u.currentPlatform)===null||a===void 0?void 0:a.getPluginHeader)||(p=>{var m;return(m=s.PluginHeaders)===null||m===void 0?void 0:m.find(I=>I.name===p)}),E=new Map,v=((i=u==null?void 0:u.currentPlatform)===null||i===void 0?void 0:i.registerPlugin)||((p,m={})=>{const I=E.get(p);if(I)return console.warn(`Capacitor plugin "${p}" already registered. Cannot register plugins twice.`),I.proxy;const R=_(),J=L(p);let $;const He=b=>{let B;const K=(...Ie)=>{const Q=(()=>o(this,null,function*(){return!$&&R in m?$=$=typeof m[R]=="function"?yield m[R]():m[R]:c!==null&&!$&&"web"in m&&($=$=typeof m.web=="function"?yield m.web():m.web),$}))().then(X=>{const kr=((k,Y)=>{var De,xe;if(!J){if(k)return(xe=k[Y])===null||xe===void 0?void 0:xe.bind(k);throw new q(`"${p}" plugin is not implemented on ${R}`,T.Unimplemented)}{const Lr=J==null?void 0:J.methods.find(Z=>Y===Z.name);if(Lr)return Lr.rtype==="promise"?Z=>s.nativePromise(p,Y.toString(),Z):(Z,pt)=>s.nativeCallback(p,Y.toString(),Z,pt);if(k)return(De=k[Y])===null||De===void 0?void 0:De.bind(k)}})(X,b);if(kr){const k=kr(...Ie);return B=k==null?void 0:k.remove,k}throw new q(`"${p}.${b}()" is not implemented on ${R}`,T.Unimplemented)});return b==="addListener"&&(Q.remove=()=>o(this,null,function*(){return B()})),Q};return K.toString=()=>`${b.toString()}() { [capacitor code] }`,Object.defineProperty(K,"name",{value:b,writable:!1,configurable:!1}),K},vr=He("addListener"),Rr=He("removeListener"),_t=(b,B)=>{const K=vr({eventName:b},B),Ie=()=>o(this,null,function*(){const X=yield K;Rr({eventName:b,callbackId:X},B)}),Q=new Promise(X=>K.then(()=>X({remove:Ie})));return Q.remove=()=>o(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Ie()}),Q},We=new Proxy({},{get(b,B){switch(B){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return J?_t:vr;case"removeListener":return Rr;default:return He(B)}}});return w[p]=We,E.set(p,{name:p,proxy:We,platforms:new Set([...Object.keys(m),...J?[R]:[]])}),We});return s.convertFileSrc||(s.convertFileSrc=p=>p),s.getPlatform=_,s.handleError=p=>t.console.error(p),s.isNativePlatform=h,s.isPluginAvailable=A,s.pluginMethodNoop=(p,m,I)=>Promise.reject(`${I} does not have an implementation of "${m}".`),s.registerPlugin=v,s.Exception=q,s.DEBUG=!!s.DEBUG,s.isLoggingEnabled=!!s.isLoggingEnabled,s.platform=s.getPlatform(),s.isNative=s.isNativePlatform(),s},Ce=t=>t.Capacitor=Oe(t),l=Ce(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),O=l.registerPlugin;l.Plugins;class P{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const a=()=>o(this,null,function*(){return this.removeListener(e,r)}),i=Promise.resolve({remove:a});return Object.defineProperty(i,"remove",{value:()=>o(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield a()})}),i}removeAllListeners(){return o(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,r){const n=this.listeners[e];n&&n.forEach(a=>a(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new l.Exception(e,T.Unimplemented)}unavailable(e="not available"){return new l.Exception(e,T.Unavailable)}removeListener(e,r){return o(this,null,function*(){const n=this.listeners[e];if(!n)return;const a=n.indexOf(r);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const $e=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),qe=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Tr extends P{getCookies(){return o(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[a,i]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=qe(a).trim(),i=qe(i).trim(),r[a]=i}),r})}setCookie(e){return o(this,null,function*(){try{const r=$e(e.key),n=$e(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${a}; path=${i}; ${c};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return o(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return o(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return o(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}O("CapacitorCookies",{web:()=>new Tr});const Br=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=((a={})=>{const i=Object.keys(a);return Object.keys(a).map(c=>c.toLocaleLowerCase()).reduce((c,s,w)=>(c[s]=a[i[w]],c),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[i,c]of Object.entries(t.data||{}))a.set(i,c);r.body=a.toString()}else if(n.includes("multipart/form-data")){const a=new FormData;if(t.data instanceof FormData)t.data.forEach((c,s)=>{a.append(s,c)});else for(const c of Object.keys(t.data))a.append(c,t.data[c]);r.body=a;const i=new Headers(r.headers);i.delete("content-type"),r.headers=i}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class Vr extends P{request(e){return o(this,null,function*(){const r=Br(e,e.webFetchExtra),n=((h,A=!0)=>h?Object.entries(h).reduce((L,E)=>{const[v,p]=E;let m,I;return Array.isArray(p)?(I="",p.forEach(R=>{m=A?encodeURIComponent(R):R,I+=`${v}=${m}&`}),I.slice(0,-1)):(m=A?encodeURIComponent(p):p,I=`${v}=${m}`),`${L}&${I}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),a=n?`${e.url}?${n}`:e.url,i=yield fetch(a,r),c=i.headers.get("content-type")||"";let s,w,{responseType:u="text"}=i.ok?e:{};switch(c.includes("application/json")&&(u="json"),u){case"arraybuffer":case"blob":w=yield i.blob(),s=yield(h=>o(this,null,function*(){return new Promise((A,L)=>{const E=new FileReader;E.onload=()=>{const v=E.result;A(v.indexOf(",")>=0?v.split(",")[1]:v)},E.onerror=v=>L(v),E.readAsDataURL(h)})}))(w);break;case"json":s=yield i.json();break;default:s=yield i.text()}const _={};return i.headers.forEach((h,A)=>{_[A]=h}),{data:s,headers:_,status:i.status,url:i.url}})}get(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return o(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Ae(){return l.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}O("CapacitorHttp",{web:()=>new Vr}),O("Portals",{web:()=>Promise.resolve().then(function(){return Ur}).then(t=>new t.PortalsWeb)});const Ur=Object.freeze({__proto__:null,PortalsWeb:class extends P{publishNative(t){return o(this,null,function*(){})}}}),ee=t=>{var e,r,n;try{if(typeof window=="undefined")return;if(Ae&&((e=Ae())!=null&&e.value)){const a=(n=(r=Ae())==null?void 0:r.value)!=null?n:null;if(!a)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(a)}}catch(a){throw console.error("getInitialContextHandle error",a),a}};class Fr{isNative(){try{return(()=>{try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.isNative();{let e=!1;return ee(r=>{e=!!(r!=null&&r.isNative)}),e}}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{if(window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.redirectPage(window.__MICRO_APP_NAME__);if(console.log("redirectParams",r),r)return e.callBack(r)}else(({callBack:r})=>{ee(n=>{var a;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const i=(a=n==null?void 0:n.params)!=null?a:null;if(!i)return;if(!r)return void console.error("initial context call back is undefine");r(i)}catch(i){throw console.error("redirectPageHandle error",i),i}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){var r;try{return this.isNative()?window.__MICRO_APP_ENVIRONMENT__?(r=window.rawWindow.__mini_app_hook__.getNativeInfo(e))!=null?r:{}:(()=>{try{let n=null;return ee(a=>{n=a!=null?a:null}),n}catch(n){throw console.error("getNativeInfoHandle error",n),n}})():(n=>{var a;return(a=n==null?void 0:n.mockData)!=null?a:null})(e)}catch(n){throw console.error("getNativeInfo error",n),n}}getStatus(){return new Promise(e=>{e({isNative:!0,redirectPage:!0,getNativeInfo:!0})})}}const C=()=>{try{let t={};return typeof window!="undefined"&&(t=window),t}catch(t){throw console.error("isWinHandle error",t),t}},F="CommunicatePlugin",y=l.registerPlugin(F,{web:()=>Promise.resolve().then(()=>ut).then(t=>new t.PluginsWeb)}),re=C();re.removeAddListenerFab=()=>null;const Hr=(t,e)=>{var r,n;try{re.removeAddListenerFab&&re.removeAddListenerFab();const a=[];if((r=y.showFABMenu)==null||r.call(y,{fabMenu:a,position:null}),!t||!((n=Object.keys(t))!=null&&n.length))return;Object.keys(t).forEach(i=>{var c,s,w,u,_,h,A,L;a.push({disable:(s=(c=t==null?void 0:t[i])==null?void 0:c.disable)!=null?s:!1,icon:(u=(w=t==null?void 0:t[i])==null?void 0:w.icon)!=null?u:"",id:(h=(_=t==null?void 0:t[i])==null?void 0:_.id)!=null?h:"",name:(L=(A=t==null?void 0:t[i])==null?void 0:A.title)!=null?L:""})}),queueMicrotask(()=>{var i;(i=y.showFABMenu)==null||i.call(y,{fabMenu:a,position:e!=null?e:null})}),setTimeout(()=>{(i=>o(this,null,function*(){i&&(re.removeAddListenerFab=yield(c=>o(this,null,function*(){try{if(l.addListener){const s=yield l.addListener(F,"nativeSendFab",w=>c&&c(w));return s!=null&&s.remove?s.remove:()=>null}}catch(s){throw console.error("addListenerFabHandle error",s),s}}))(i))}))(i=>{let c;i!=null&&i.disable||i!=null&&i.id&&(Object.keys(t).forEach(s=>{var w,u,_;(w=t==null?void 0:t[s])!=null&&w.id&&i.id===t[s].id&&(c=(_=(u=t[s])==null?void 0:u.fn)!=null?_:()=>null)}),typeof c=="function"&&c())})})}catch(a){throw console.error("fabBtnHandle error",a),a}},H=C();H.addListenerBackRemoveHandle=()=>null;const Ke=(t=()=>null)=>o(this,null,function*(){try{H!=null&&H.addListenerBackRemoveHandle&&typeof H.addListenerBackRemoveHandle=="function"&&H.addListenerBackRemoveHandle(),H.addListenerBackRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(F,"nativeSendBack",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerBackHandle error",r),r}}))(t)}catch(e){throw console.error("initBackBtnFn error",e),e}}),te=C();te.addListenerHomeHandle=()=>null;const Wr=t=>{try{te.addListenerHomeHandle&&te.addListenerHomeHandle(),setTimeout(()=>{(e=>o(this,null,function*(){e&&(te.addListenerHomeHandle=yield(r=>o(this,null,function*(){try{if(l.addListener){const n=yield l.addListener(F,"nativeSendHome",a=>r&&r(a));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(t)})}catch(e){throw console.error("homeFn error",e),e}},W=C();W.addListenerTouchRemoveHandle=()=>null;const ze=(t=()=>null)=>o(this,null,function*(){try{W!=null&&W.addListenerTouchRemoveHandle&&typeof W.addListenerTouchRemoveHandle=="function"&&W.addListenerTouchRemoveHandle(),W.addListenerTouchRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(F,"nativeTouchListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerTouchHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),D=C();D.addListenerSendDeepLinkRemoveHandle=()=>null;const Ge=(t=()=>null)=>o(this,null,function*(){try{D!=null&&D.addListenerSendDeepLinkRemoveHandle&&typeof D.addListenerSendDeepLinkRemoveHandle=="function"&&D.addListenerSendDeepLinkRemoveHandle(),D.addListenerSendDeepLinkRemoveHandle=yield(e=>o(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return e&&window.rawWindow.__mini_app_hook__.getDeeplinkParams(e),{remove:()=>null};if(l.addListener){const r=yield l.addListener(F,"nativeSendDeeplinkCallbackListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSendDeepLinkHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),x=C();x.addListenerSetupMiniAppRemoveHandle=()=>null;const Je=(t=()=>null)=>o(this,null,function*(){try{x!=null&&x.addListenerSetupMiniAppRemoveHandle&&typeof x.addListenerSetupMiniAppRemoveHandle=="function"&&x.addListenerSetupMiniAppRemoveHandle(),x.addListenerSetupMiniAppRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(F,"nativeSetupMiniApp",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSetupMiniAppHandle error",r),r}}))(t)}catch(e){throw console.error("initSetupMiniAppFn error",e),e}});class Dr{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return o(this,null,function*(){var r;try{return yield(r=y.homeIsClick)==null?void 0:r.call(y,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Ke(i)}),a(()=>{Ke()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setHomeBtn=e:Wr(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e,r){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setFabBtn(e,r):Hr(e,r)}catch(n){throw console.error("setFabBtn error",n),n}}touchListener(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{ze(i)}),a(()=>{ze()})}catch(n){throw console.error("touchListenerHandle error",n),n}})(e)}catch(r){throw console.error("listenerTouch error",r),r}}disableFAB(e){return o(this,null,function*(){try{return yield y.disableFAB(e)}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(e){return o(this,null,function*(){try{return yield y.disableBack(e)}catch(r){throw console.error("disableBack error",r),r}})}openMiniApp(e){return o(this,null,function*(){try{return yield y.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return o(this,null,function*(){try{return yield y.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return o(this,null,function*(){try{return yield y.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return o(this,null,function*(){try{return yield y.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return o(this,null,function*(){try{return yield y.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return o(this,null,function*(){try{return yield y.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return o(this,null,function*(){try{return yield y.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}getDeeplinkParams(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Ge(i)}),a(()=>{Ge()})}catch(n){throw console.error("sendDeepLinkListenerHandle error",n),n}})(e)}catch(r){throw console.error("getDeeplinkParams error",r),r}}switchLanguage(e){return console.info("sendSwitchLanguageParams",e),{errorMsg:"This method is deprecated"}}setupMiniApp(e){try{(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Je(i)}),a(()=>{Je()})}catch(n){throw console.error("setupMiniAppHandle error",n),n}})(e)}catch(r){throw console.error("setupMiniApp error",r),r}}switchStore(e){return console.info("sendSwitchStoreParams",e),{errorMsg:"This method is deprecated"}}closeMiniApp(){return o(this,null,function*(){try{return yield y.closeMiniApp()}catch(e){throw console.error("closeMiniApp error",e),e}})}getStatus(){return o(this,null,function*(){try{return yield y.getStatus()}catch(e){throw console.error("communicatePlugins getStatus error",e),e}})}dispatchToShell(e){return o(this,null,function*(){try{return yield y.dispatchToShell(e)}catch(r){throw console.error("communicate dispatchToShell error",r),r}})}getMiniAppInfo(e){return o(this,null,function*(){try{return yield y.getMiniAppInfo(e)}catch(r){throw console.error("getMiniAppInfo error",r),r}})}}let ne=null;window.__MICRO_APP_ENVIRONMENT__&&(ne=(ur=window.rawWindow.__mini_app_status_hook__)!=null?ur:{});const Ee=l.registerPlugin("CameraScanPlugin",{web:new class extends P{pickCameraScan(t){return o(this,null,function*(){return new Promise(e=>{e(t)})})}setCameraScanState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ne==null?void 0:ne.cameraScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScan getStatus error",t),t}}}});window.removeAddListenerCameraScan=()=>null;class xr{pickCameraScan(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScan(e):yield Ee.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}setCameraScanState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanState(e):yield Ee.setCameraScanState(e)}catch(r){throw console.error("setCameraScanState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Ee.getStatus()}catch(e){throw console.error("cameraScanPlugin getStatus error",e),e}})}}let oe=null;window.__MICRO_APP_ENVIRONMENT__&&(oe=(_r=window.rawWindow.__mini_app_status_hook__)!=null?_r:{});const ve=l.registerPlugin("CameraScanMultiplePlugin",{web:new class extends P{pickCameraScanMultiple(){return o(this,null,function*(){})}setCameraScanMultipleState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=oe==null?void 0:oe.cameraScanMultiple)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultiple getStatus error",t),t}}}});class jr{pickCameraScanMultiple(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultiple(e):yield ve.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}setCameraScanMultipleState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleState(e):yield ve.setCameraScanMultipleState(e)}catch(r){throw console.error("setCameraScanMultipleState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield ve.getStatus()}catch(e){throw console.error("cameraScanMultiplePlugin getStatus error",e),e}})}}let ae=null;window.__MICRO_APP_ENVIRONMENT__&&(ae=(pr=window.rawWindow.__mini_app_status_hook__)!=null?pr:{});const Re=l.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends P{pickCameraScanMultipleNoCount(){return o(this,null,function*(){})}setCameraScanMultipleNoCountState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ae==null?void 0:ae.cameraScanMultipleNoCount)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultipleNoCount getStatus error",t),t}}}});class $r{pickCameraScanMultipleNoCount(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultipleNoCount(e):yield Re.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}setCameraScanMultipleNoCountState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleNoCountState(e):yield Re.setCameraScanMultipleNoCountState(e)}catch(r){throw console.error("setCameraScanMultipleNoCountState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Re.getStatus()}catch(e){throw console.error("cameraScanMultipleNoCountPlugin getStatus error",e),e}})}}let ie=null;window.__MICRO_APP_ENVIRONMENT__&&(ie=(hr=window.rawWindow.__mini_app_status_hook__)!=null?hr:{});const ke=l.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends P{pickCameraScanSingleOrDual(){return o(this,null,function*(){})}setCameraScanSingleOrDualState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ie==null?void 0:ie.cameraScanSingleOrDual)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanSingleOrDual getStatus error",t),t}}}});class qr{pickCameraScanSingleOrDual(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanSingleOrDual(e):yield ke.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}setCameraScanSingleOrDualState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCameraScanSingleOrDualState(e):yield ke.setCameraScanSingleOrDualState(e)}catch(r){throw console.error("setCameraScanSingleOrDualState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield ke.getStatus()}catch(e){throw console.error("cameraScanSingleOrDualPlugin getStatus error",e),e}})}}const Qe="LaserScanPlugin";let se=null;window.__MICRO_APP_ENVIRONMENT__&&(se=(mr=window.rawWindow.__mini_app_status_hook__)!=null?mr:{});const ce=l.registerPlugin(Qe,{web:new class extends P{pickLaserScan(){return o(this,null,function*(){})}unPickLaserScan(){return o(this,null,function*(){})}setLaserState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=se==null?void 0:se.laserScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("laserScan getStatus error",t),t}}}}),le=C();le.removeAddListenerLaserScan=()=>null;const Xe=(t=()=>null)=>{try{le.removeAddListenerLaserScan&&le.removeAddListenerLaserScan();const e=r=>o(this,null,function*(){r&&(le.removeAddListenerLaserScan=yield(n=>o(this,null,function*(){try{if(l.addListener){const a=yield l.addListener(Qe,"nativeSendLaser",i=>n&&n(i));return a!=null&&a.remove?a.remove:()=>null}}catch(a){throw console.error("addListenerLaserHandle error",a),a}}))(r))});setTimeout(()=>{e(t)})}catch(e){throw console.error("laserScanFn error",e),e}};class Kr{constructor(){this.pickLaserScan()}pickLaserScan(){return o(this,null,function*(){try{return yield ce.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return o(this,null,function*(){try{return yield ce.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{ce.setLaserState(e)}catch(r){throw console.error("setLaserState error",r),r}}setLaserScan(e){(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Xe(i)}),a(()=>{Xe()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}getStatus(){return o(this,null,function*(){try{return yield ce.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}const Ye="CountAssistPlugin";let de=null;window.__MICRO_APP_ENVIRONMENT__&&(de=(gr=window.rawWindow.__mini_app_status_hook__)!=null?gr:{});const we=l.registerPlugin(Ye,{web:new class extends P{setCountAssistState(t){return o(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setCountAssistState error",e),e}})}toggleCountAssist(t){return o(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("hideCountAssist error",e),e}})}getCountAssistToggleState(){return o(this,null,function*(){try{return new Promise(t=>{t(void 0)})}catch(t){throw console.error("getCountAssistToggleState error",t),t}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=de==null?void 0:de.countAssist)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("countAssist getStatus error",t),t}}}}),j=C();j.addListenerCountAssistRemoveHandle=()=>null;const Ze=(t=()=>null)=>o(this,null,function*(){try{j!=null&&j.addListenerCountAssistRemoveHandle&&typeof j.addListenerCountAssistRemoveHandle=="function"&&j.addListenerCountAssistRemoveHandle(),j.addListenerCountAssistRemoveHandle=yield(e=>o(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(Ye,"nativeSendCountAssist",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerCountAssistHandle error",r),r}}))(t)}catch(e){throw console.error("initCountAssistFn error",e),e}});class zr{setCountAssistState(e){return o(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCountAssistState(e):yield we.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let n=r!=null?r:!1;return ee(a=>{n=!!(a!=null&&a.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:n,beforeUnmount:a,callBack:i}=r;n(()=>{Ze(i)}),a(()=>{Ze()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}toggleCountAssist(e){return o(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.toggleCountAssist(e):yield we.toggleCountAssist(e)})}getCountAssistToggleState(){return o(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.getCountAssistToggleState():yield we.getCountAssistToggleState()})}getStatus(){return o(this,null,function*(){try{return yield we.getStatus()}catch(e){throw console.error("countAssistPlugin getStatus error",e),e}})}}let ue=null;window.__MICRO_APP_ENVIRONMENT__&&(ue=(Pr=window.rawWindow.__mini_app_status_hook__)!=null?Pr:{});const Le=l.registerPlugin("ClickStreamPlugin",{web:new class extends P{init(){return o(this,null,function*(){return new Promise(t=>{t(null)})})}trace(t){return o(this,null,function*(){var e,r;try{return window.__MICRO_APP_ENVIRONMENT__&&((r=(e=window.rawWindow.__mini_app_hook__).clickStream)==null||r.call(e,t.data)),new Promise(n=>{n(t)})}catch(n){throw console.error("clickStreamTraceParams error",n),n}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ue==null?void 0:ue.clickStream)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("clickStream getStatus error",t),t}}}});class Gr{constructor(){this.init()}init(){return o(this,null,function*(){try{return yield Le.init()}catch(e){throw console.error("clickStreamPlugin, init error",e),e}})}trace(e){return o(this,null,function*(){try{return yield Le.trace(e)}catch(r){throw console.error("clickStreamPlugin, trace error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Le.getStatus()}catch(e){throw console.error("clickStreamPlugin getStatus error",e),e}})}}const er="MiniAppLifecyclePlugin";let _e=null;window.__MICRO_APP_ENVIRONMENT__&&(_e=(yr=window.rawWindow.__mini_app_status_hook__)!=null?yr:{});var z=(t=>(t.MINI_APP_BEFORE_UNMOUNT_PERMISSION="mini_app_before_unmount_permission",t.MINI_APP_BEFORE_UNMOUNT_COMPLETION="mini_app_before_unmount_completion",t))(z||{});const be=l.registerPlugin(er,{web:new class extends P{setNativeUsagePermission(){return o(this,null,function*(){})}authorizeWebCallback(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=_e==null?void 0:_e.lifecycle)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("lifecycle getStatus error",t),t}}}}),pe=C();pe.removeAddListenerLifecycleMiniAppBeforeUnmount=()=>null;const rr=(t=()=>null)=>{try{pe.removeAddListenerLifecycleMiniAppBeforeUnmount&&pe.removeAddListenerLifecycleMiniAppBeforeUnmount();const e=r=>o(this,null,function*(){r&&(pe.removeAddListenerLifecycleMiniAppBeforeUnmount=yield(n=>o(this,null,function*(){try{if(l.addListener){const a=yield l.addListener(er,"miniAppBeforeUnmount",i=>n&&n(i));return a!=null&&a.remove?a.remove:()=>null}}catch(a){throw console.error("miniAppBeforeUnmountHandle error",a),a}}))(r))});setTimeout(()=>o(this,null,function*(){yield e(t)}))}catch(e){throw console.error("laserScanFn error",e),e}};class Jr{constructor(){}setNativeUsagePermission(e){return o(this,null,function*(){try{return yield be.setNativeUsagePermission(e)}catch(r){throw console.error("lifecyclePlugin.setNativeUsagePermission error",r),r}})}authorizeWebCallback(e){return o(this,null,function*(){try{return yield be.authorizeWebCallback(e)}catch(r){throw console.error("lifecyclePlugin.authorizeWebCallback error",r),r}})}miniAppBeforeUnmount(e){this.setNativeUsagePermission({action:z.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!0}),((r,n)=>{try{const{mounted:a,beforeUnmount:i,callBack:c}=r;a(()=>{rr(s=>o(this,null,function*(){var w;if(c&&c instanceof Function)try{(w=c(s))==null||w.then(()=>o(this,null,function*(){yield n.setNativeUsagePermission({action:z.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1}),yield n.authorizeWebCallback({action:z.MINI_APP_BEFORE_UNMOUNT_COMPLETION})}))}catch(u){console.error("miniAppBeforeUnmount error callBack is not a function or promise")}else console.error("miniAppBeforeUnmount error callBack is not a function or promise")}))}),i(()=>o(this,null,function*(){rr(),n.setNativeUsagePermission({action:z.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1})}))}catch(a){throw console.error("miniAppBeforeUnmount error",a),a}})(e,this)}getStatus(){return o(this,null,function*(){try{return yield be.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let he=null;window.__MICRO_APP_ENVIRONMENT__&&(he=(Sr=window.rawWindow.__mini_app_status_hook__)!=null?Sr:{});const Te=l.registerPlugin("DeviceInteractionPlugin",{web:new class extends P{callVibrate(){return o(this,null,function*(){})}callErrorBeep(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=he==null?void 0:he.deviceInteraction)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("deviceInteraction getStatus error",t),t}}}});class Qr{callVibrate(){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callVibrate():yield Te.callVibrate()}catch(e){throw console.error("callVibrate error",e),e}})}callErrorBeep(){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callErrorBeep():yield Te.callErrorBeep()}catch(e){throw console.error("callErrorBeep error",e),e}})}getStatus(){return o(this,null,function*(){try{return yield Te.getStatus()}catch(e){throw console.error("deviceInteractionPlugin getStatus error",e),e}})}}const tr="PollingPlugin";let me=null;window.__MICRO_APP_ENVIRONMENT__&&(me=(Nr=window.rawWindow.__mini_app_status_hook__)!=null?Nr:{});const Be=l.registerPlugin(tr,{web:new class extends P{create(){return o(this,null,function*(){})}destroy(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=me==null?void 0:me.polling)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("polling getStatus error",t),t}}}}),ge=C();ge.removeAddListenerPolling=()=>null;const Xr=(t,e)=>{try{ge.removeAddListenerPolling&&ge.removeAddListenerPolling();const r=e.pollingId;(n=>o(this,null,function*(){return n&&(ge.removeAddListenerPolling=yield(a=>o(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(tr,"nativeSendPolling",c=>a&&a(c));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPollingHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.pollingId)===r&&(n!=null&&n.pollingId)&&t.pollingList.forEach(a=>{a!=null&&a.pollingId&&(n==null?void 0:n.pollingId)===(a==null?void 0:a.pollingId)&&typeof(a==null?void 0:a.callBack)=="function"&&a.callBack(n)})})}catch(r){throw console.error("pollingFn error",r),r}};class Yr{constructor(){f(this,"pollingList");this.pollingList=[]}create(e){var r,n,a;if(window.__MICRO_APP_ENVIRONMENT__){const{mounted:i,pollingParams:c,callBack:s}=e;return i(()=>{var w,u;(u=(w=window.rawWindow.__mini_app_hook__)==null?void 0:w.addPolling)==null||u.call(w,c,s)}),()=>{this.destroy({pollingId:c.pollingId})}}try{(r=e==null?void 0:e.pollingParams)!=null&&r.pollingId&&this.pollingList.push({pollingId:(n=e==null?void 0:e.pollingParams)==null?void 0:n.pollingId,callBack:e==null?void 0:e.callBack}),this.pollingList=this.pollingList.filter((c,s,w)=>s===w.findIndex(u=>u.pollingId===c.pollingId));const i=((a=e==null?void 0:e.pollingParams)==null?void 0:a.delay)/1e3;return Be.create(U(V({},e==null?void 0:e.pollingParams),{delay:i})),((c,s)=>{try{const{mounted:w,pollingParams:u}=c;w(()=>Xr(s,u))}catch(w){throw console.error("createPolling error",w),w}})(e,this),()=>{var c,s;return(c=e==null?void 0:e.pollingParams)!=null&&c.pollingId?this.destroy({pollingId:(s=e==null?void 0:e.pollingParams)==null?void 0:s.pollingId}):null}}catch(i){throw console.error("pollingPlugin create error",i),i}}destroy(e){var r,n,a;if(window.__MICRO_APP_ENVIRONMENT__){const{pollingId:i}=e;(n=(r=window.rawWindow.__mini_app_hook__)==null?void 0:r.deletePolling)==null||n.call(r,i)}else try{const i=this.pollingList.map(c=>c.pollingId).indexOf(e.pollingId);return(a=this.pollingList)!=null&&a.length&&(Number(i)||Number(i)>=0)&&this.pollingList.splice(Number(i),1),Be.destroy(e)}catch(i){throw console.error("pollingPlugin destroy error",i),i}}getStatus(){return o(this,null,function*(){try{return yield Be.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Pe=null;window.__MICRO_APP_ENVIRONMENT__&&(Pe=(fr=window.rawWindow.__mini_app_status_hook__)!=null?fr:{});const nr=l.registerPlugin("PaymentPlugin",{web:new class extends P{process(t){return o(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("process error",e),e}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Pe==null?void 0:Pe.payment)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("payment getStatus error",t),t}}}});class Zr{process(e){return o(this,null,function*(){try{return yield nr.process(e)}catch(r){throw console.error("paymentPlugins.process error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield nr.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let ye=null;window.__MICRO_APP_ENVIRONMENT__&&(ye=(Mr=window.rawWindow.__mini_app_status_hook__)!=null?Mr:{});const Ve=l.registerPlugin("CameraForTakePhotoPlugin",{web:new class extends P{pickCameraForTakePhoto(){return o(this,null,function*(){})}setCameraForTakePhotoState(){return o(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=ye==null?void 0:ye.cameraForTakePhoto)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraForTakePhoto getStatus error",t),t}}}});class et{pickCameraForTakePhoto(){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraForTakePhoto():yield Ve.pickCameraForTakePhoto()}catch(e){throw console.error("pickCameraForTakePhoto error",e),e}})}setCameraForTakePhotoState(e){return o(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraForTakePhotoState(e):yield Ve.setCameraForTakePhotoState(e)}catch(r){throw console.error("setCameraForTakePhotoState error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield Ve.getStatus()}catch(e){throw console.error("cameraForTakePhotoPlugin getStatus error",e),e}})}}let Se=null;window.__MICRO_APP_ENVIRONMENT__&&(Se=(Ir=window.rawWindow.__mini_app_status_hook__)!=null?Ir:{});const or=l.registerPlugin("HttpPlugin",{web:new class extends P{request(t){return o(this,null,function*(){return new Promise(e=>{e(t)})})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Se==null?void 0:Se.http)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("http getStatus error",t),t}}}});class rt{request(e){return o(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.requestHttp(e);{let r={};return e.url&&(r.url=e.url),e.method&&(r.method=e.method),e.headers&&(r.headers=e.headers),e.params&&(r.urlParams=e.params),e.data&&(typeof e.data=="string"?r.bodyData=e.data:r.bodyParams=e.data),e.upload&&(r.upload=e.upload),yield or.request(r)}}catch(r){throw console.error("HttpPlugin, trace error",r),r}})}getStatus(){return o(this,null,function*(){try{return yield or.getStatus()}catch(e){throw console.error("HttpPlugin getStatus error",e),e}})}}const M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));const tt=new Uint8Array(16);function nt(t,e,r){return e||t||!crypto.randomUUID?function(n,a,i){var s,w,u;n=n||{};const c=(u=(w=n.random)!=null?w:(s=n.rng)==null?void 0:s.call(n))!=null?u:crypto.getRandomValues(tt);if(c.length<16)throw new Error("Random bytes length must be >= 16");if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,a){if((i=i||0)<0||i+16>a.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let _=0;_<16;++_)a[i+_]=c[_];return a}return function(_,h=0){return(M[_[h+0]]+M[_[h+1]]+M[_[h+2]]+M[_[h+3]]+"-"+M[_[h+4]]+M[_[h+5]]+"-"+M[_[h+6]]+M[_[h+7]]+"-"+M[_[h+8]]+M[_[h+9]]+"-"+M[_[h+10]]+M[_[h+11]]+M[_[h+12]]+M[_[h+13]]+M[_[h+14]]+M[_[h+15]]).toLowerCase()}(c)}(t,e,r):crypto.randomUUID()}const ar="PrintPlugin";let Ne=null;window.__MICRO_APP_ENVIRONMENT__&&(Ne=(Or=window.rawWindow.__mini_app_status_hook__)!=null?Or:{});const ir=l.registerPlugin(ar,{web:new class extends P{print(){}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Ne==null?void 0:Ne.print)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("print getStatus error",t),t}}}}),G=C();G.removeAddListenerPrintList={};const ot=(t,e)=>{try{const r=e.printId;G.removeAddListenerPrintList=U(V({},G.removeAddListenerPrintList),{printId:()=>{}}),(n=>o(this,null,function*(){return n&&(G.removeAddListenerPrintList[r]=yield(a=>o(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(ar,"nativeSendPrint",c=>a&&a(c));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPrintHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.printId)===r&&(n!=null&&n.printId)&&t.printList.forEach(a=>{var i,c,s;a!=null&&a.printId&&(n==null?void 0:n.printId)===(a==null?void 0:a.printId)&&(typeof(a==null?void 0:a.callBack)=="function"&&a.callBack(n),(s=a.state==5||a.state==6)!=null||(c=(i=G.removeAddListenerPrintList)==null?void 0:i[a==null?void 0:a.printId])==null||c.call(i))})})}catch(r){throw console.error("printFn error",r),r}};class at{constructor(){f(this,"printList");this.printList=[]}print(e){var n,a,i,c;const r=((a=(n=e==null?void 0:e.printParams)==null?void 0:n.functionId)!=null?a:"")+nt().replace(/-/g,"");if(this.printList.push({printId:r,callBack:e==null?void 0:e.callBack}),this.printList=this.printList.filter((s,w,u)=>w===u.findIndex(_=>_.printId===s.printId)),window.__MICRO_APP_ENVIRONMENT__){const{printParams:s,callBack:w}=e;return(c=(i=window.rawWindow.__mini_app_hook__)==null?void 0:i.print)==null||c.call(i,U(V({},s),{printId:r}),w),{id:r}}try{return ir.print(U(V({},e==null?void 0:e.printParams),{printId:r})),((s,w)=>{try{const{printParams:u}=s;ot(w,u)}catch(u){throw console.error("createPrint error",u),u}})(U(V({},e),{printParams:U(V({},e.printParams),{printId:r})}),this),{id:r}}catch(s){throw console.error("printPlugin create error",s),s}}getStatus(){return o(this,null,function*(){try{return yield ir.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}const sr=typeof window!="undefined";let fe=null;sr&&window.__MICRO_APP_ENVIRONMENT__&&(fe=(Cr=window.rawWindow.__mini_app_status_hook__)!=null?Cr:{});const it=t=>{var e,r;if(!t)return"";try{const n=decodeURIComponent(t).match(/\/([^/?#&=]+)(?=$|[?&#])/g),a=(r=(e=n==null?void 0:n.pop())==null?void 0:e.slice(1))!=null?r:"",i=a.lastIndexOf(".");return i<=0?a:a.slice(0,i)}catch(n){return""}},cr=l.registerPlugin("DownloadFilePlugin",{web:new class extends P{downloadFile(t){return o(this,null,function*(){return((e,r,n="")=>({success:e,message:r,fileName:n}))(!1,"DownloadFilePlugin should be handled by shell",(e=>{var n;return((n=e==null?void 0:e.fileName)==null?void 0:n.trim())||`${it(e==null?void 0:e.url)}_${Date.now()}`})(t))})}getStatus(){try{return sr&&window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=fe==null?void 0:fe.downloadFile)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("downloadFile getStatus error",t),t}}}}),st=typeof window!="undefined",ct=t=>{var r;const e=(r=t==null?void 0:t.fileName)==null?void 0:r.trim();return e||`${(n=>{var a,i;if(!n)return"";try{const c=decodeURIComponent(n).match(/\/([^/?#&=]+)(?=$|[?&#])/g),s=(i=(a=c==null?void 0:c.pop())==null?void 0:a.slice(1))!=null?i:"",w=s.lastIndexOf(".");return w<=0?s:s.slice(0,w)}catch(c){return""}})(t==null?void 0:t.url)}_${Date.now()}`},lr=(t,e)=>({success:!1,message:e,fileName:ct(t)});class lt{downloadFile(e){return o(this,null,function*(){try{if(st&&window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.downloadFile;return r?yield r(e):lr(e,"DownloadFilePlugin is not available")}return yield cr.downloadFile(e)}catch(r){return console.error("downloadFile error",r),lr(e,r instanceof Error?r.message:"download failed")}})}getStatus(){return o(this,null,function*(){try{return yield cr.getStatus()}catch(e){throw console.error("downloadFile getStatus error",e),e}})}}const Ue="1.0";function Fe(){return{accepted:!1,code:"UNSUPPORTED",protocolVersion:Ue}}const dr=l.registerPlugin("OtelPlugin",{web:new class extends P{recordTrace(t){return o(this,null,function*(){var r,n;if(!window.__MICRO_APP_ENVIRONMENT__)return Fe();const e=(n=(r=window.rawWindow)==null?void 0:r.__mini_app_hook__)==null?void 0:n.recordOtelTrace;if(typeof e!="function")return Fe();try{return yield e(U(V({},t),{miniappKey:window.__MICRO_APP_NAME__}))}catch(a){return console.warn("[OtelPlugin] Web Shell recordOtelTrace failed",a),{accepted:!1,code:"INTERNAL_ERROR",protocolVersion:Ue}}})}getStatus(){return o(this,null,function*(){var e,r,n;if(!window.__MICRO_APP_ENVIRONMENT__)return{recordTrace:!1};const t=(n=(r=(e=window.rawWindow)==null?void 0:e.__mini_app_status_hook__)==null?void 0:r.otel)==null?void 0:n.getStatus;if(typeof t!="function")return{recordTrace:!1};try{const a=yield t();return{recordTrace:(a==null?void 0:a.recordTrace)===!0}}catch(a){return console.warn("[OtelPlugin] Web Shell getStatus failed",a),{recordTrace:!1}}})}}});class dt{recordTrace(e){return o(this,null,function*(){try{return yield dr.recordTrace({span:e})}catch(r){return console.warn("[OtelPlugin] recordTrace is unavailable",r),Fe()}})}getStatus(){return o(this,null,function*(){try{const e=yield dr.getStatus();return{recordTrace:(e==null?void 0:e.recordTrace)===!0}}catch(e){return console.warn("[OtelPlugin] getStatus is unavailable",e),{recordTrace:!1}}})}}class wr{constructor(){f(this,"initialContextPlugins",new Fr);f(this,"communicatePlugins",new Dr);f(this,"cameraScanPlugins",new xr);f(this,"cameraScanMultiplePlugins",new jr);f(this,"cameraScanMultipleNoCountPlugins",new $r);f(this,"cameraScanSingleOrDualPlugins",new qr);f(this,"laserScanPlugins",new Kr);f(this,"countAssistPlugins",new zr);f(this,"clickStreamPlugins",new Gr);f(this,"lifecyclePlugins",new Jr);f(this,"deviceInteractionPlugins",new Qr);f(this,"pollingPlugins",new Yr);f(this,"paymentPlugins",new Zr);f(this,"cameraForTakePhotoPlugin",new et);f(this,"httpPlugin",new rt);f(this,"printPlugins",new at);f(this,"downloadFilePlugin",new lt);f(this,"otelPlugins",new dt)}}const wt=new wr;let d=null,Me=null;window.__MICRO_APP_ENVIRONMENT__&&(d=(Ar=window.rawWindow.__mini_app_hook__)!=null?Ar:{},Me=(Er=window.rawWindow.__mini_app_status_hook__)!=null?Er:{});const ut=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends P{homeIsClick(t){return o(this,null,function*(){var e;window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch homeIsClick",t),(e=d.disabledMenu)==null||e.call(d,t))})}openMiniApp(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.openMiniApp)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch showTitle",t),(e=d.showTitle)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showTitle error",r),r}})}showFABMenu(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.showFABMenu)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showFABMenu error",r),r}})}disableFAB(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.disableFAB)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.disableBack)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableBack error",r),r}})}showSubMask(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.showSubMask)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(t){return o(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.setMiniAppVersion)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showDialog(){return o(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.showDialog)==null||t.call(d))})}cancelDialog(){return o(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.cancelDialog)==null||t.call(d))})}getMiniAppKong(t){return o(this,null,function*(){var e,r;try{if(window.__MICRO_APP_ENVIRONMENT__){const n=(r=(e=d.getMiniAppKong)==null?void 0:e.call(d,t))!=null?r:{};return new Promise(a=>{a(n)})}return new Promise(n=>{n(t)})}catch(n){throw console.error("getMiniAppKong error",n),n}})}closeMiniApp(){return o(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.closeMiniApp)==null||t.call(d))})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>o(this,null,function*(){var e,r;t((yield(r=(e=Me==null?void 0:Me.communicate)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("communicate getStatus error",t),t}}dispatchToShell(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>o(this,null,function*(){var r;e((yield(r=d==null?void 0:d.dispatchToShell)==null?void 0:r.call(d,t))||{})})):new Promise(e=>{e(t)})}catch(e){throw console.error("communicate dispatchToShell error",e),e}}getMiniAppInfo(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>o(this,null,function*(){var r;e((yield(r=d==null?void 0:d.getMiniAppInfo)==null?void 0:r.call(d,t))||{})})):new Promise(e=>{e({})})}catch(e){throw console.error("communicate getMiniAppInfo error",e),e}}}},Symbol.toStringTag,{value:"Module"}));S.NativeApi=wr,S.OTEL_PLUGIN_PROTOCOL_VERSION=Ue,S.default=wt,Object.defineProperties(S,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED