superapp-miniapp-invoke-native 1.1.0 → 1.1.2

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 CHANGED
@@ -128,15 +128,21 @@ declare class LaserScanPlugins implements LaserScanPluginsHandleType {
128
128
  constructor();
129
129
  pickLaserScan(): Promise<void>;
130
130
  unPickLaserScan(): Promise<void>;
131
+ setLaserState(laserStateParams: laserStateParamsType): void;
131
132
  setLaserScan(laserScanApiParams: laserScanApiParamsType): void;
132
133
  }
133
134
 
134
135
  declare interface LaserScanPluginsHandleType {
135
136
  pickLaserScan(): Promise<void>;
136
137
  unPickLaserScan(): Promise<void>;
138
+ setLaserState(laserStateParams: laserStateParamsType): void;
137
139
  setLaserScan(laserScanApiParams: laserScanApiParamsType): void;
138
140
  }
139
141
 
142
+ declare interface laserStateParamsType {
143
+ isOpenLaser: boolean;
144
+ }
145
+
140
146
  declare interface MiniAppKongType {
141
147
  miniAppNames: any[];
142
148
  [key: string]: any;
package/lib/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var we = Object.defineProperty;
2
- var he = (n, e, t) => e in n ? we(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var k = (n, e, t) => (he(n, typeof e != "symbol" ? e + "" : e, t), t);
4
- var a = (n, e, t) => new Promise((r, o) => {
2
+ var he = (r, e, t) => e in r ? we(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var k = (r, e, t) => (he(r, typeof e != "symbol" ? e + "" : e, t), t);
4
+ var a = (r, e, t) => new Promise((n, o) => {
5
5
  var s = (h) => {
6
6
  try {
7
7
  i(t.next(h));
@@ -14,35 +14,35 @@ var a = (n, e, t) => new Promise((r, o) => {
14
14
  } catch (u) {
15
15
  o(u);
16
16
  }
17
- }, i = (h) => h.done ? r(h.value) : Promise.resolve(h.value).then(s, c);
18
- i((t = t.apply(n, e)).next());
17
+ }, i = (h) => h.done ? n(h.value) : Promise.resolve(h.value).then(s, c);
18
+ i((t = t.apply(r, e)).next());
19
19
  });
20
20
  /*! Capacitor: https://capacitorjs.com/ - MIT License */
21
- const me = (n) => n.CapacitorPlatforms = ((e) => {
21
+ const me = (r) => r.CapacitorPlatforms = ((e) => {
22
22
  const t = /* @__PURE__ */ new Map();
23
23
  t.set("web", { name: "web" });
24
- const r = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: t };
25
- return r.addPlatform = (o, s) => {
26
- r.platforms.set(o, s);
27
- }, r.setPlatform = (o) => {
28
- r.platforms.has(o) && (r.currentPlatform = r.platforms.get(o));
29
- }, r;
30
- })(n), ne = me(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
24
+ const n = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: t };
25
+ return n.addPlatform = (o, s) => {
26
+ n.platforms.set(o, s);
27
+ }, n.setPlatform = (o) => {
28
+ n.platforms.has(o) && (n.currentPlatform = n.platforms.get(o));
29
+ }, n;
30
+ })(r), ne = me(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
31
31
  var B;
32
- ne.addPlatform, ne.setPlatform, function(n) {
33
- n.Unimplemented = "UNIMPLEMENTED", n.Unavailable = "UNAVAILABLE";
32
+ ne.addPlatform, ne.setPlatform, function(r) {
33
+ r.Unimplemented = "UNIMPLEMENTED", r.Unavailable = "UNAVAILABLE";
34
34
  }(B || (B = {}));
35
35
  class z extends Error {
36
- constructor(e, t, r) {
37
- super(e), this.message = e, this.code = t, this.data = r;
36
+ constructor(e, t, n) {
37
+ super(e), this.message = e, this.code = t, this.data = n;
38
38
  }
39
39
  }
40
- const pe = (n) => {
41
- var e, t, r, o, s;
42
- const c = n.CapacitorCustomPlatform || null, i = n.Capacitor || {}, h = i.Plugins = i.Plugins || {}, u = n.CapacitorPlatforms, f = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => c !== null ? c.name : ((l) => {
40
+ const pe = (r) => {
41
+ var e, t, n, o, s;
42
+ const c = r.CapacitorCustomPlatform || null, i = r.Capacitor || {}, h = i.Plugins = i.Plugins || {}, u = r.CapacitorPlatforms, f = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => c !== null ? c.name : ((l) => {
43
43
  var d, m;
44
44
  return l != null && l.androidBridge ? "android" : !((m = (d = l == null ? void 0 : l.webkit) === null || d === void 0 ? void 0 : d.messageHandlers) === null || m === void 0) && m.bridge ? "ios" : "web";
45
- })(n)), y = ((t = u == null ? void 0 : u.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || (() => f() !== "web"), g = ((r = u == null ? void 0 : u.currentPlatform) === null || r === void 0 ? void 0 : r.isPluginAvailable) || ((l) => {
45
+ })(r)), y = ((t = u == null ? void 0 : u.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || (() => f() !== "web"), g = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isPluginAvailable) || ((l) => {
46
46
  const d = v.get(l);
47
47
  return !!(d != null && d.platforms.has(f())) || !!x(l);
48
48
  }), x = ((o = u == null ? void 0 : u.currentPlatform) === null || o === void 0 ? void 0 : o.getPluginHeader) || ((l) => {
@@ -52,44 +52,44 @@ const pe = (n) => {
52
52
  const m = v.get(l);
53
53
  if (m)
54
54
  return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), m.proxy;
55
- const P = f(), N = x(l);
55
+ const L = f(), N = x(l);
56
56
  let M;
57
57
  const K = (S) => {
58
58
  let A;
59
59
  const j = (...I) => {
60
60
  const E = (() => a(void 0, null, function* () {
61
- return !M && P in d ? M = M = typeof d[P] == "function" ? yield d[P]() : d[P] : c !== null && !M && "web" in d && (M = M = typeof d.web == "function" ? yield d.web() : d.web), M;
61
+ return !M && L in d ? M = M = typeof d[L] == "function" ? yield d[L]() : d[L] : c !== null && !M && "web" in d && (M = M = typeof d.web == "function" ? yield d.web() : d.web), M;
62
62
  }))().then(($) => {
63
- const ee = ((L, U) => {
63
+ const te = ((P, U) => {
64
64
  var G, J;
65
65
  if (!N) {
66
- if (L)
67
- return (J = L[U]) === null || J === void 0 ? void 0 : J.bind(L);
68
- throw new z(`"${l}" plugin is not implemented on ${P}`, B.Unimplemented);
66
+ if (P)
67
+ return (J = P[U]) === null || J === void 0 ? void 0 : J.bind(P);
68
+ throw new z(`"${l}" plugin is not implemented on ${L}`, B.Unimplemented);
69
69
  }
70
70
  {
71
- const te = N == null ? void 0 : N.methods.find((F) => U === F.name);
72
- if (te)
73
- return te.rtype === "promise" ? (F) => i.nativePromise(l, U.toString(), F) : (F, ue) => i.nativeCallback(l, U.toString(), F, ue);
74
- if (L)
75
- return (G = L[U]) === null || G === void 0 ? void 0 : G.bind(L);
71
+ const re = N == null ? void 0 : N.methods.find((F) => U === F.name);
72
+ if (re)
73
+ return re.rtype === "promise" ? (F) => i.nativePromise(l, U.toString(), F) : (F, ue) => i.nativeCallback(l, U.toString(), F, ue);
74
+ if (P)
75
+ return (G = P[U]) === null || G === void 0 ? void 0 : G.bind(P);
76
76
  }
77
77
  })($, S);
78
- if (ee) {
79
- const L = ee(...I);
80
- return A = L == null ? void 0 : L.remove, L;
78
+ if (te) {
79
+ const P = te(...I);
80
+ return A = P == null ? void 0 : P.remove, P;
81
81
  }
82
- throw new z(`"${l}.${S}()" is not implemented on ${P}`, B.Unimplemented);
82
+ throw new z(`"${l}.${S}()" is not implemented on ${L}`, B.Unimplemented);
83
83
  });
84
84
  return S === "addListener" && (E.remove = () => a(void 0, null, function* () {
85
85
  return A();
86
86
  })), E;
87
87
  };
88
88
  return j.toString = () => `${S.toString()}() { [capacitor code] }`, Object.defineProperty(j, "name", { value: S, writable: !1, configurable: !1 }), j;
89
- }, Y = K("addListener"), Z = K("removeListener"), de = (S, A) => {
90
- const j = Y({ eventName: S }, A), I = () => a(void 0, null, function* () {
89
+ }, Z = K("addListener"), ee = K("removeListener"), de = (S, A) => {
90
+ const j = Z({ eventName: S }, A), I = () => a(void 0, null, function* () {
91
91
  const $ = yield j;
92
- Z({ eventName: S, callbackId: $ }, A);
92
+ ee({ eventName: S, callbackId: $ }, A);
93
93
  }), E = new Promise(($) => j.then(() => $({ remove: I })));
94
94
  return E.remove = () => a(void 0, null, function* () {
95
95
  console.warn("Using addListener() without 'await' is deprecated."), yield I();
@@ -101,17 +101,17 @@ const pe = (n) => {
101
101
  case "toJSON":
102
102
  return () => ({});
103
103
  case "addListener":
104
- return N ? de : Y;
104
+ return N ? de : Z;
105
105
  case "removeListener":
106
- return Z;
106
+ return ee;
107
107
  default:
108
108
  return K(A);
109
109
  }
110
110
  } });
111
- return h[l] = V, v.set(l, { name: l, proxy: V, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...N ? [P] : []]) }), V;
111
+ return h[l] = V, v.set(l, { name: l, proxy: V, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...N ? [L] : []]) }), V;
112
112
  });
113
- return i.convertFileSrc || (i.convertFileSrc = (l) => l), i.getPlatform = f, i.handleError = (l) => n.console.error(l), i.isNativePlatform = y, i.isPluginAvailable = g, i.pluginMethodNoop = (l, d, m) => Promise.reject(`${m} does not have an implementation of "${d}".`), i.registerPlugin = b, i.Exception = z, i.DEBUG = !!i.DEBUG, i.isLoggingEnabled = !!i.isLoggingEnabled, i.platform = i.getPlatform(), i.isNative = i.isNativePlatform(), i;
114
- }, ye = (n) => n.Capacitor = pe(n), w = ye(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), X = w.registerPlugin;
113
+ return i.convertFileSrc || (i.convertFileSrc = (l) => l), i.getPlatform = f, i.handleError = (l) => r.console.error(l), i.isNativePlatform = y, i.isPluginAvailable = g, i.pluginMethodNoop = (l, d, m) => Promise.reject(`${m} does not have an implementation of "${d}".`), i.registerPlugin = b, i.Exception = z, i.DEBUG = !!i.DEBUG, i.isLoggingEnabled = !!i.isLoggingEnabled, i.platform = i.getPlatform(), i.isNative = i.isNativePlatform(), i;
114
+ }, ye = (r) => r.Capacitor = pe(r), w = ye(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), Y = w.registerPlugin;
115
115
  w.Plugins;
116
116
  class C {
117
117
  constructor(e) {
@@ -119,8 +119,8 @@ class C {
119
119
  }
120
120
  addListener(e, t) {
121
121
  this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t);
122
- const r = this.windowListeners[e];
123
- r && !r.registered && this.addWindowListener(r);
122
+ const n = this.windowListeners[e];
123
+ n && !n.registered && this.addWindowListener(n);
124
124
  const o = () => a(this, null, function* () {
125
125
  return this.removeListener(e, t);
126
126
  }), s = Promise.resolve({ remove: o });
@@ -137,15 +137,15 @@ class C {
137
137
  });
138
138
  }
139
139
  notifyListeners(e, t) {
140
- const r = this.listeners[e];
141
- r && r.forEach((o) => o(t));
140
+ const n = this.listeners[e];
141
+ n && n.forEach((o) => o(t));
142
142
  }
143
143
  hasListeners(e) {
144
144
  return !!this.listeners[e].length;
145
145
  }
146
146
  registerWindowListener(e, t) {
147
- this.windowListeners[t] = { registered: !1, windowEventName: e, pluginEventName: t, handler: (r) => {
148
- this.notifyListeners(t, r);
147
+ this.windowListeners[t] = { registered: !1, windowEventName: e, pluginEventName: t, handler: (n) => {
148
+ this.notifyListeners(t, n);
149
149
  } };
150
150
  }
151
151
  unimplemented(e = "not implemented") {
@@ -156,10 +156,10 @@ class C {
156
156
  }
157
157
  removeListener(e, t) {
158
158
  return a(this, null, function* () {
159
- const r = this.listeners[e];
160
- if (!r)
159
+ const n = this.listeners[e];
160
+ if (!n)
161
161
  return;
162
- const o = r.indexOf(t);
162
+ const o = n.indexOf(t);
163
163
  this.listeners[e].splice(o, 1), this.listeners[e].length || this.removeWindowListener(this.windowListeners[e]);
164
164
  });
165
165
  }
@@ -170,24 +170,24 @@ class C {
170
170
  e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
171
171
  }
172
172
  }
173
- const re = (n) => encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), oe = (n) => n.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
173
+ const oe = (r) => encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), ae = (r) => r.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
174
174
  class ge extends C {
175
175
  getCookies() {
176
176
  return a(this, null, function* () {
177
177
  const e = document.cookie, t = {};
178
- return e.split(";").forEach((r) => {
179
- if (r.length <= 0)
178
+ return e.split(";").forEach((n) => {
179
+ if (n.length <= 0)
180
180
  return;
181
- let [o, s] = r.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
182
- o = oe(o).trim(), s = oe(s).trim(), t[o] = s;
181
+ let [o, s] = n.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
182
+ o = ae(o).trim(), s = ae(s).trim(), t[o] = s;
183
183
  }), t;
184
184
  });
185
185
  }
186
186
  setCookie(e) {
187
187
  return a(this, null, function* () {
188
188
  try {
189
- const t = re(e.key), r = re(e.value), o = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), c = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
190
- document.cookie = `${t}=${r || ""}${o}; path=${s}; ${c};`;
189
+ const t = oe(e.key), n = oe(e.value), o = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), c = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
190
+ document.cookie = `${t}=${n || ""}${o}; path=${s}; ${c};`;
191
191
  } catch (t) {
192
192
  return Promise.reject(t);
193
193
  }
@@ -223,45 +223,45 @@ class ge extends C {
223
223
  });
224
224
  }
225
225
  }
226
- X("CapacitorCookies", { web: () => new ge() });
227
- const fe = (n, e = {}) => {
228
- const t = Object.assign({ method: n.method || "GET", headers: n.headers }, e), r = ((o = {}) => {
226
+ Y("CapacitorCookies", { web: () => new ge() });
227
+ const fe = (r, e = {}) => {
228
+ const t = Object.assign({ method: r.method || "GET", headers: r.headers }, e), n = ((o = {}) => {
229
229
  const s = Object.keys(o);
230
230
  return Object.keys(o).map((c) => c.toLocaleLowerCase()).reduce((c, i, h) => (c[i] = o[s[h]], c), {});
231
- })(n.headers)["content-type"] || "";
232
- if (typeof n.data == "string")
233
- t.body = n.data;
234
- else if (r.includes("application/x-www-form-urlencoded")) {
231
+ })(r.headers)["content-type"] || "";
232
+ if (typeof r.data == "string")
233
+ t.body = r.data;
234
+ else if (n.includes("application/x-www-form-urlencoded")) {
235
235
  const o = new URLSearchParams();
236
- for (const [s, c] of Object.entries(n.data || {}))
236
+ for (const [s, c] of Object.entries(r.data || {}))
237
237
  o.set(s, c);
238
238
  t.body = o.toString();
239
- } else if (r.includes("multipart/form-data")) {
239
+ } else if (n.includes("multipart/form-data")) {
240
240
  const o = new FormData();
241
- if (n.data instanceof FormData)
242
- n.data.forEach((c, i) => {
241
+ if (r.data instanceof FormData)
242
+ r.data.forEach((c, i) => {
243
243
  o.append(i, c);
244
244
  });
245
245
  else
246
- for (const c of Object.keys(n.data))
247
- o.append(c, n.data[c]);
246
+ for (const c of Object.keys(r.data))
247
+ o.append(c, r.data[c]);
248
248
  t.body = o;
249
249
  const s = new Headers(t.headers);
250
250
  s.delete("content-type"), t.headers = s;
251
251
  } else
252
- (r.includes("application/json") || typeof n.data == "object") && (t.body = JSON.stringify(n.data));
252
+ (n.includes("application/json") || typeof r.data == "object") && (t.body = JSON.stringify(r.data));
253
253
  return t;
254
254
  };
255
255
  class ve extends C {
256
256
  request(e) {
257
257
  return a(this, null, function* () {
258
- const t = fe(e, e.webFetchExtra), r = ((y, g = !0) => y ? Object.entries(y).reduce((x, v) => {
258
+ const t = fe(e, e.webFetchExtra), n = ((y, g = !0) => y ? Object.entries(y).reduce((x, v) => {
259
259
  const [b, l] = v;
260
260
  let d, m;
261
- return Array.isArray(l) ? (m = "", l.forEach((P) => {
262
- d = g ? encodeURIComponent(P) : P, m += `${b}=${d}&`;
261
+ return Array.isArray(l) ? (m = "", l.forEach((L) => {
262
+ d = g ? encodeURIComponent(L) : L, m += `${b}=${d}&`;
263
263
  }), m.slice(0, -1)) : (d = g ? encodeURIComponent(l) : l, m = `${b}=${d}`), `${x}&${m}`;
264
- }, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), o = r ? `${e.url}?${r}` : e.url, s = yield fetch(o, t), c = s.headers.get("content-type") || "";
264
+ }, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), o = n ? `${e.url}?${n}` : e.url, s = yield fetch(o, t), c = s.headers.get("content-type") || "";
265
265
  let i, h, { responseType: u = "text" } = s.ok ? e : {};
266
266
  switch (c.includes("application/json") && (u = "json"), u) {
267
267
  case "arraybuffer":
@@ -317,33 +317,33 @@ class ve extends C {
317
317
  function Q() {
318
318
  return w.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
319
319
  }
320
- X("CapacitorHttp", { web: () => new ve() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
321
- X("Portals", { web: () => Promise.resolve().then(function() {
320
+ Y("CapacitorHttp", { web: () => new ve() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
321
+ Y("Portals", { web: () => Promise.resolve().then(function() {
322
322
  return be;
323
- }).then((n) => new n.PortalsWeb()) });
323
+ }).then((r) => new r.PortalsWeb()) });
324
324
  const be = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
325
- publishNative(n) {
325
+ publishNative(r) {
326
326
  return a(this, null, function* () {
327
327
  });
328
328
  }
329
- } }), R = (n) => {
330
- var e, t, r;
329
+ } }), R = (r) => {
330
+ var e, t, n;
331
331
  try {
332
332
  if (typeof window == "undefined")
333
333
  return;
334
334
  if (Q && ((e = Q()) != null && e.value)) {
335
- const o = (r = (t = Q()) == null ? void 0 : t.value) != null ? r : null;
335
+ const o = (n = (t = Q()) == null ? void 0 : t.value) != null ? n : null;
336
336
  if (!o)
337
337
  return void console.error("native initialContext is undefine");
338
- if (!n)
338
+ if (!r)
339
339
  return void console.error("initialContext call back is undefine");
340
- n(o);
340
+ r(o);
341
341
  }
342
342
  } catch (o) {
343
343
  throw console.error("getInitialContextHandle error", o), o;
344
344
  }
345
345
  };
346
- class Pe {
346
+ class Le {
347
347
  isNative() {
348
348
  try {
349
349
  return (() => {
@@ -363,12 +363,12 @@ class Pe {
363
363
  redirectPage(e) {
364
364
  try {
365
365
  (({ callBack: t }) => {
366
- R((r) => {
366
+ R((n) => {
367
367
  var o;
368
368
  try {
369
- if (!(r != null && r.params))
369
+ if (!(n != null && n.params))
370
370
  return void console.info("initial context native params is undefine");
371
- const s = (o = r == null ? void 0 : r.params) != null ? o : null;
371
+ const s = (o = n == null ? void 0 : n.params) != null ? o : null;
372
372
  if (!s)
373
373
  return;
374
374
  if (!t)
@@ -388,15 +388,15 @@ class Pe {
388
388
  return this.isNative() ? (() => {
389
389
  try {
390
390
  let t = null;
391
- return R((r) => {
392
- t = r != null ? r : null;
391
+ return R((n) => {
392
+ t = n != null ? n : null;
393
393
  }), t;
394
394
  } catch (t) {
395
395
  throw console.error("getNativeInfoHandle error", t), t;
396
396
  }
397
397
  })() : ((t) => {
398
- var r;
399
- return (r = t == null ? void 0 : t.mockData) != null ? r : null;
398
+ var n;
399
+ return (n = t == null ? void 0 : t.mockData) != null ? n : null;
400
400
  })(e);
401
401
  } catch (t) {
402
402
  throw console.error("getNativeInfo error", t), t;
@@ -405,17 +405,17 @@ class Pe {
405
405
  }
406
406
  const T = () => {
407
407
  try {
408
- let n = {};
409
- return typeof window != "undefined" && (n = window), n;
410
- } catch (n) {
411
- throw console.error("isWinHandle error", n), n;
408
+ let r = {};
409
+ return typeof window != "undefined" && (r = window), r;
410
+ } catch (r) {
411
+ throw console.error("isWinHandle error", r), r;
412
412
  }
413
- }, D = "CommunicatePlugin", p = w.registerPlugin(D, { web: () => Promise.resolve().then(() => Fe).then((n) => new n.PluginsWeb()) }), Le = w.registerPlugin("CountAssistPlugin", { web: new class extends C {
414
- setCountAssistState(n) {
413
+ }, D = "CommunicatePlugin", p = w.registerPlugin(D, { web: () => Promise.resolve().then(() => Fe).then((r) => new r.PluginsWeb()) }), Pe = w.registerPlugin("CountAssistPlugin", { web: new class extends C {
414
+ setCountAssistState(r) {
415
415
  return a(this, null, function* () {
416
416
  try {
417
417
  return new Promise((e) => {
418
- e(n);
418
+ e(r);
419
419
  });
420
420
  } catch (e) {
421
421
  throw console.error("setCountAssistState error", e), e;
@@ -424,19 +424,19 @@ const T = () => {
424
424
  }
425
425
  }() }), W = T();
426
426
  W.removeAddListenerFab = () => null;
427
- const Ce = (n) => {
427
+ const Ce = (r) => {
428
428
  var e, t;
429
429
  try {
430
430
  W.removeAddListenerFab && W.removeAddListenerFab();
431
- const r = [];
432
- if ((e = p.showFABMenu) == null || e.call(p, { fabMenu: r }), !n || !((t = Object.keys(n)) != null && t.length))
431
+ const n = [];
432
+ if ((e = p.showFABMenu) == null || e.call(p, { fabMenu: n }), !r || !((t = Object.keys(r)) != null && t.length))
433
433
  return;
434
- Object.keys(n).forEach((o) => {
434
+ Object.keys(r).forEach((o) => {
435
435
  var s, c, i, h, u, f, y, g;
436
- r.push({ disable: (c = (s = n == null ? void 0 : n[o]) == null ? void 0 : s.disable) != null ? c : !1, icon: (h = (i = n == null ? void 0 : n[o]) == null ? void 0 : i.icon) != null ? h : "", id: (f = (u = n == null ? void 0 : n[o]) == null ? void 0 : u.id) != null ? f : "", name: (g = (y = n == null ? void 0 : n[o]) == null ? void 0 : y.title) != null ? g : "" });
436
+ n.push({ disable: (c = (s = r == null ? void 0 : r[o]) == null ? void 0 : s.disable) != null ? c : !1, icon: (h = (i = r == null ? void 0 : r[o]) == null ? void 0 : i.icon) != null ? h : "", id: (f = (u = r == null ? void 0 : r[o]) == null ? void 0 : u.id) != null ? f : "", name: (g = (y = r == null ? void 0 : r[o]) == null ? void 0 : y.title) != null ? g : "" });
437
437
  }), queueMicrotask(() => {
438
438
  var o;
439
- (o = p.showFABMenu) == null || o.call(p, { fabMenu: r });
439
+ (o = p.showFABMenu) == null || o.call(p, { fabMenu: n });
440
440
  }), setTimeout(() => {
441
441
  ((o) => a(void 0, null, function* () {
442
442
  o && (W.removeAddListenerFab = yield ((s) => a(void 0, null, function* () {
@@ -451,49 +451,49 @@ const Ce = (n) => {
451
451
  }))(o));
452
452
  }))((o) => {
453
453
  let s;
454
- o != null && o.disable || o != null && o.id && (Object.keys(n).forEach((c) => {
454
+ o != null && o.disable || o != null && o.id && (Object.keys(r).forEach((c) => {
455
455
  var i, h, u;
456
- (i = n == null ? void 0 : n[c]) != null && i.id && o.id === n[c].id && (s = (u = (h = n[c]) == null ? void 0 : h.fn) != null ? u : () => null);
456
+ (i = r == null ? void 0 : r[c]) != null && i.id && o.id === r[c].id && (s = (u = (h = r[c]) == null ? void 0 : h.fn) != null ? u : () => null);
457
457
  }), typeof s == "function" && s());
458
458
  });
459
459
  });
460
- } catch (r) {
461
- throw console.error("fabBtnHandle error", r), r;
460
+ } catch (n) {
461
+ throw console.error("fabBtnHandle error", n), n;
462
462
  }
463
463
  }, H = T();
464
464
  H.addListenerBackRemoveHandle = () => null;
465
- const ae = (n = () => null) => a(void 0, null, function* () {
465
+ const se = (r = () => null) => a(void 0, null, function* () {
466
466
  try {
467
467
  H != null && H.addListenerBackRemoveHandle && typeof H.addListenerBackRemoveHandle == "function" && H.addListenerBackRemoveHandle(), H.addListenerBackRemoveHandle = yield ((e) => a(void 0, null, function* () {
468
468
  try {
469
469
  if (w.addListener) {
470
- const t = yield w.addListener(D, "nativeSendBack", (r) => e && e(r));
470
+ const t = yield w.addListener(D, "nativeSendBack", (n) => e && e(n));
471
471
  return t != null && t.remove ? t.remove : () => null;
472
472
  }
473
473
  } catch (t) {
474
474
  throw console.error("addListenerBackHandle error", t), t;
475
475
  }
476
- }))(n);
476
+ }))(r);
477
477
  } catch (e) {
478
478
  throw console.error("initBackBtnFn error", e), e;
479
479
  }
480
480
  }), _ = T();
481
481
  _.addListenerHomeHandle = () => null;
482
- const Se = (n) => {
482
+ const Se = (r) => {
483
483
  try {
484
484
  _.addListenerHomeHandle && _.addListenerHomeHandle(), setTimeout(() => {
485
485
  ((e) => a(void 0, null, function* () {
486
486
  e && (_.addListenerHomeHandle = yield ((t) => a(void 0, null, function* () {
487
487
  try {
488
488
  if (w.addListener) {
489
- const r = yield w.addListener(D, "nativeSendHome", (o) => t && t(o));
490
- return r != null && r.remove ? r.remove : () => null;
489
+ const n = yield w.addListener(D, "nativeSendHome", (o) => t && t(o));
490
+ return n != null && n.remove ? n.remove : () => null;
491
491
  }
492
- } catch (r) {
493
- throw console.error("addListenerHomeHandle error", r), r;
492
+ } catch (n) {
493
+ throw console.error("addListenerHomeHandle error", n), n;
494
494
  }
495
495
  }))(e));
496
- }))(n);
496
+ }))(r);
497
497
  });
498
498
  } catch (e) {
499
499
  throw console.error("homeFn error", e), e;
@@ -508,8 +508,8 @@ class ke {
508
508
  var t;
509
509
  try {
510
510
  return yield (t = p.homeIsClick) == null ? void 0 : t.call(p, e);
511
- } catch (r) {
512
- throw console.error("homeBtnSwitch error", r), r;
511
+ } catch (n) {
512
+ throw console.error("homeBtnSwitch error", n), n;
513
513
  }
514
514
  });
515
515
  }
@@ -517,14 +517,14 @@ class ke {
517
517
  try {
518
518
  ((t) => {
519
519
  try {
520
- const { mounted: r, beforeUnmount: o, callBack: s } = t;
521
- r(() => {
522
- ae(s);
520
+ const { mounted: n, beforeUnmount: o, callBack: s } = t;
521
+ n(() => {
522
+ se(s);
523
523
  }), o(() => {
524
- ae();
524
+ se();
525
525
  });
526
- } catch (r) {
527
- throw console.error("backBtnHandle error", r), r;
526
+ } catch (n) {
527
+ throw console.error("backBtnHandle error", n), n;
528
528
  }
529
529
  })(e);
530
530
  } catch (t) {
@@ -610,10 +610,10 @@ class ke {
610
610
  }
611
611
  }
612
612
  const Ae = w.registerPlugin("CameraScanPlugin", { web: new class extends C {
613
- pickCameraScan(n) {
613
+ pickCameraScan(r) {
614
614
  return a(this, null, function* () {
615
615
  return new Promise((e) => {
616
- e(n);
616
+ e(r);
617
617
  });
618
618
  });
619
619
  }
@@ -681,7 +681,7 @@ class Ne {
681
681
  });
682
682
  }
683
683
  }
684
- const le = "LaserScanPlugin", se = w.registerPlugin(le, { web: new class extends C {
684
+ const le = "LaserScanPlugin", X = w.registerPlugin(le, { web: new class extends C {
685
685
  pickLaserScan() {
686
686
  return a(this, null, function* () {
687
687
  });
@@ -690,16 +690,20 @@ const le = "LaserScanPlugin", se = w.registerPlugin(le, { web: new class extends
690
690
  return a(this, null, function* () {
691
691
  });
692
692
  }
693
+ setLaserState() {
694
+ return a(this, null, function* () {
695
+ });
696
+ }
693
697
  }() }), q = T();
694
698
  q.removeAddListenerLaserScan = () => null;
695
- const ie = (n = () => null) => {
699
+ const ie = (r = () => null) => {
696
700
  try {
697
701
  q.removeAddListenerLaserScan && q.removeAddListenerLaserScan();
698
702
  const e = (t) => a(void 0, null, function* () {
699
- t && (q.removeAddListenerLaserScan = yield ((r) => a(void 0, null, function* () {
703
+ t && (q.removeAddListenerLaserScan = yield ((n) => a(void 0, null, function* () {
700
704
  try {
701
705
  if (w.addListener) {
702
- const o = yield w.addListener(le, "nativeSendLaser", (s) => r && r(s));
706
+ const o = yield w.addListener(le, "nativeSendLaser", (s) => n && n(s));
703
707
  return o != null && o.remove ? o.remove : () => null;
704
708
  }
705
709
  } catch (o) {
@@ -708,7 +712,7 @@ const ie = (n = () => null) => {
708
712
  }))(t));
709
713
  });
710
714
  setTimeout(() => {
711
- e(n);
715
+ e(r);
712
716
  });
713
717
  } catch (e) {
714
718
  throw console.error("laserScanFn error", e), e;
@@ -720,43 +724,58 @@ class Ee {
720
724
  }
721
725
  pickLaserScan() {
722
726
  return a(this, null, function* () {
723
- se.pickLaserScan({ isContinue: !1 });
727
+ try {
728
+ return yield X.pickLaserScan({ isContinue: !1 });
729
+ } catch (e) {
730
+ throw console.error("pickLaserScan error", e), e;
731
+ }
724
732
  });
725
733
  }
726
734
  unPickLaserScan() {
727
735
  return a(this, null, function* () {
728
- se.unPickLaserScan();
736
+ try {
737
+ return yield X.unPickLaserScan();
738
+ } catch (e) {
739
+ throw console.error("unPickLaserScan error", e), e;
740
+ }
729
741
  });
730
742
  }
743
+ setLaserState(e) {
744
+ try {
745
+ X.setLaserState(e);
746
+ } catch (t) {
747
+ throw console.error("setLaserState error", t), t;
748
+ }
749
+ }
731
750
  setLaserScan(e) {
732
751
  ((t) => {
733
752
  try {
734
- const { mounted: r, beforeUnmount: o, callBack: s } = t;
735
- r(() => {
753
+ const { mounted: n, beforeUnmount: o, callBack: s } = t;
754
+ n(() => {
736
755
  ie(s);
737
756
  }), o(() => {
738
757
  ie();
739
758
  });
740
- } catch (r) {
741
- throw console.error("laserScanApiParams error", r), r;
759
+ } catch (n) {
760
+ throw console.error("laserScanApiParams error", n), n;
742
761
  }
743
762
  })(e);
744
763
  }
745
764
  }
746
765
  const O = T();
747
766
  O.addListenerCountAssistRemoveHandle = () => null;
748
- const ce = (n = () => null) => a(void 0, null, function* () {
767
+ const ce = (r = () => null) => a(void 0, null, function* () {
749
768
  try {
750
769
  O != null && O.addListenerCountAssistRemoveHandle && typeof O.addListenerCountAssistRemoveHandle == "function" && O.addListenerCountAssistRemoveHandle(), O.addListenerCountAssistRemoveHandle = yield ((e) => a(void 0, null, function* () {
751
770
  try {
752
771
  if (w.addListener) {
753
- const t = yield w.addListener(D, "nativeSendCountAssist", (r) => e && e(r));
772
+ const t = yield w.addListener(D, "nativeSendCountAssist", (n) => e && e(n));
754
773
  return t != null && t.remove ? t.remove : () => null;
755
774
  }
756
775
  } catch (t) {
757
776
  throw console.error("addListenerCountAssistHandle error", t), t;
758
777
  }
759
- }))(n);
778
+ }))(r);
760
779
  } catch (e) {
761
780
  throw console.error("initCountAssistFn error", e), e;
762
781
  }
@@ -764,39 +783,39 @@ const ce = (n = () => null) => a(void 0, null, function* () {
764
783
  class $e {
765
784
  setCountAssistState(e) {
766
785
  return a(this, null, function* () {
767
- return yield Le.setCountAssistState(e);
786
+ return yield Pe.setCountAssistState(e);
768
787
  });
769
788
  }
770
789
  getCountAssistState(e) {
771
790
  return ((t) => {
772
791
  try {
773
- let r = t != null ? t : !1;
792
+ let n = t != null ? t : !1;
774
793
  return R((o) => {
775
- r = !!(o != null && o.countAssistState);
776
- }), r;
777
- } catch (r) {
778
- throw console.error("getCountAssistStateHandle error", r), r;
794
+ n = !!(o != null && o.countAssistState);
795
+ }), n;
796
+ } catch (n) {
797
+ throw console.error("getCountAssistStateHandle error", n), n;
779
798
  }
780
799
  })(e);
781
800
  }
782
801
  setCountAssistBtn(e) {
783
802
  ((t) => {
784
803
  try {
785
- const { mounted: r, beforeUnmount: o, callBack: s } = t;
786
- r(() => {
804
+ const { mounted: n, beforeUnmount: o, callBack: s } = t;
805
+ n(() => {
787
806
  ce(s);
788
807
  }), o(() => {
789
808
  ce();
790
809
  });
791
- } catch (r) {
792
- throw console.error("setCountAssistBtnHandle error", r), r;
810
+ } catch (n) {
811
+ throw console.error("setCountAssistBtnHandle error", n), n;
793
812
  }
794
813
  })(e);
795
814
  }
796
815
  }
797
816
  class Ue {
798
817
  constructor() {
799
- k(this, "initialContextPlugins", new Pe());
818
+ k(this, "initialContextPlugins", new Le());
800
819
  k(this, "communicatePlugins", new ke());
801
820
  k(this, "cameraScanPlugins", new Me());
802
821
  k(this, "cameraScanMultiplePlugins", new Oe());
@@ -811,55 +830,55 @@ const De = new Ue(), Fe = Object.freeze(Object.defineProperty({ __proto__: null,
811
830
  return a(this, null, function* () {
812
831
  });
813
832
  }
814
- openMiniApp(n) {
833
+ openMiniApp(r) {
815
834
  return a(this, null, function* () {
816
835
  try {
817
836
  return new Promise((e) => {
818
- e(n);
837
+ e(r);
819
838
  });
820
839
  } catch (e) {
821
840
  throw console.error("openMiniApp error", e), e;
822
841
  }
823
842
  });
824
843
  }
825
- showTitle(n) {
844
+ showTitle(r) {
826
845
  return a(this, null, function* () {
827
846
  try {
828
847
  return new Promise((e) => {
829
- e(n);
848
+ e(r);
830
849
  });
831
850
  } catch (e) {
832
851
  throw console.error("showTitle error", e), e;
833
852
  }
834
853
  });
835
854
  }
836
- showFABMenu(n) {
855
+ showFABMenu(r) {
837
856
  return a(this, null, function* () {
838
857
  try {
839
858
  return new Promise((e) => {
840
- e(n);
859
+ e(r);
841
860
  });
842
861
  } catch (e) {
843
862
  throw console.error("showFABMenu error", e), e;
844
863
  }
845
864
  });
846
865
  }
847
- showSubMask(n) {
866
+ showSubMask(r) {
848
867
  return a(this, null, function* () {
849
868
  try {
850
869
  return new Promise((e) => {
851
- e(n);
870
+ e(r);
852
871
  });
853
872
  } catch (e) {
854
873
  throw console.error("showSubMask error", e), e;
855
874
  }
856
875
  });
857
876
  }
858
- setMiniAppVersion(n) {
877
+ setMiniAppVersion(r) {
859
878
  return a(this, null, function* () {
860
879
  try {
861
880
  return new Promise((e) => {
862
- e(n);
881
+ e(r);
863
882
  });
864
883
  } catch (e) {
865
884
  throw console.error("setMiniAppVersion error", e), e;
@@ -874,11 +893,11 @@ const De = new Ue(), Fe = Object.freeze(Object.defineProperty({ __proto__: null,
874
893
  return a(this, null, function* () {
875
894
  });
876
895
  }
877
- getMiniAppKong(n) {
896
+ getMiniAppKong(r) {
878
897
  return a(this, null, function* () {
879
898
  try {
880
899
  return new Promise((e) => {
881
- e(n);
900
+ e(r);
882
901
  });
883
902
  } catch (e) {
884
903
  throw console.error("getMiniAppKong error", e), e;
package/lib/main.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(y,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((y=typeof globalThis!="undefined"?globalThis:y||self).main={})})(this,function(y){"use strict";var Fe=Object.defineProperty;var De=(y,p,g)=>p in y?Fe(y,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):y[p]=g;var H=(y,p,g)=>(De(y,typeof p!="symbol"?p+"":p,g),g);var a=(y,p,g)=>new Promise((x,$)=>{var Q=b=>{try{u(g.next(b))}catch(f){$(f)}},X=b=>{try{u(g.throw(b))}catch(f){$(f)}},u=b=>b.done?x(b.value):Promise.resolve(b.value).then(Q,X);u((g=g.apply(y,p)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const p=n=>n.CapacitorPlatforms=(e=>{const r=new Map;r.set("web",{name:"web"});const t=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:r};return t.addPlatform=(o,s)=>{t.platforms.set(o,s)},t.setPlatform=o=>{t.platforms.has(o)&&(t.currentPlatform=t.platforms.get(o))},t})(n),g=p(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var x;g.addPlatform,g.setPlatform,function(n){n.Unimplemented="UNIMPLEMENTED",n.Unavailable="UNAVAILABLE"}(x||(x={}));class $ extends Error{constructor(e,r,t){super(e),this.message=e,this.code=r,this.data=t}}const Q=n=>{var e,r,t,o,s;const c=n.CapacitorCustomPlatform||null,i=n.Capacitor||{},v=i.Plugins=i.Plugins||{},w=n.CapacitorPlatforms,C=((e=w==null?void 0:w.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(l=>{var d,m;return l!=null&&l.androidBridge?"android":!((m=(d=l==null?void 0:l.webkit)===null||d===void 0?void 0:d.messageHandlers)===null||m===void 0)&&m.bridge?"ios":"web"})(n)),L=((r=w==null?void 0:w.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>C()!=="web"),P=((t=w==null?void 0:w.currentPlatform)===null||t===void 0?void 0:t.isPluginAvailable)||(l=>{const d=S.get(l);return!!(d!=null&&d.platforms.has(C()))||!!T(l)}),T=((o=w==null?void 0:w.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(l=>{var d;return(d=i.PluginHeaders)===null||d===void 0?void 0:d.find(m=>m.name===l)}),S=new Map,k=((s=w==null?void 0:w.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||((l,d={})=>{const m=S.get(l);if(m)return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`),m.proxy;const A=C(),I=T(l);let E;const Z=O=>{let j;const U=(...z)=>{const R=(()=>a(this,null,function*(){return!E&&A in d?E=E=typeof d[A]=="function"?yield d[A]():d[A]:c!==null&&!E&&"web"in d&&(E=E=typeof d.web=="function"?yield d.web():d.web),E}))().then(W=>{const he=((M,_)=>{var re,ne;if(!I){if(M)return(ne=M[_])===null||ne===void 0?void 0:ne.bind(M);throw new $(`"${l}" plugin is not implemented on ${A}`,x.Unimplemented)}{const me=I==null?void 0:I.methods.find(q=>_===q.name);if(me)return me.rtype==="promise"?q=>i.nativePromise(l,_.toString(),q):(q,Ue)=>i.nativeCallback(l,_.toString(),q,Ue);if(M)return(re=M[_])===null||re===void 0?void 0:re.bind(M)}})(W,O);if(he){const M=he(...z);return j=M==null?void 0:M.remove,M}throw new $(`"${l}.${O}()" is not implemented on ${A}`,x.Unimplemented)});return O==="addListener"&&(R.remove=()=>a(this,null,function*(){return j()})),R};return U.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:O,writable:!1,configurable:!1}),U},ue=Z("addListener"),we=Z("removeListener"),Te=(O,j)=>{const U=ue({eventName:O},j),z=()=>a(this,null,function*(){const W=yield U;we({eventName:O,callbackId:W},j)}),R=new Promise(W=>U.then(()=>W({remove:z})));return R.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield z()}),R},ee=new Proxy({},{get(O,j){switch(j){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return I?Te:ue;case"removeListener":return we;default:return Z(j)}}});return v[l]=ee,S.set(l,{name:l,proxy:ee,platforms:new Set([...Object.keys(d),...I?[A]:[]])}),ee});return i.convertFileSrc||(i.convertFileSrc=l=>l),i.getPlatform=C,i.handleError=l=>n.console.error(l),i.isNativePlatform=L,i.isPluginAvailable=P,i.pluginMethodNoop=(l,d,m)=>Promise.reject(`${m} does not have an implementation of "${d}".`),i.registerPlugin=k,i.Exception=$,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},X=n=>n.Capacitor=Q(n),u=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),b=u.registerPlugin;u.Plugins;class f{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 t=this.windowListeners[e];t&&!t.registered&&this.addWindowListener(t);const o=()=>a(this,null,function*(){return this.removeListener(e,r)}),s=Promise.resolve({remove:o});return Object.defineProperty(s,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),s}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,r){const t=this.listeners[e];t&&t.forEach(o=>o(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:t=>{this.notifyListeners(r,t)}}}unimplemented(e="not implemented"){return new u.Exception(e,x.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,x.Unavailable)}removeListener(e,r){return a(this,null,function*(){const t=this.listeners[e];if(!t)return;const o=t.indexOf(r);this.listeners[e].splice(o,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 te=n=>encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),oe=n=>n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class pe extends f{getCookies(){return a(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(t=>{if(t.length<=0)return;let[o,s]=t.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=oe(o).trim(),s=oe(s).trim(),r[o]=s}),r})}setCookie(e){return a(this,null,function*(){try{const r=te(e.key),t=te(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${t||""}${o}; path=${s}; ${c};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return a(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 a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}b("CapacitorCookies",{web:()=>new pe});const ye=(n,e={})=>{const r=Object.assign({method:n.method||"GET",headers:n.headers},e),t=((o={})=>{const s=Object.keys(o);return Object.keys(o).map(c=>c.toLocaleLowerCase()).reduce((c,i,v)=>(c[i]=o[s[v]],c),{})})(n.headers)["content-type"]||"";if(typeof n.data=="string")r.body=n.data;else if(t.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[s,c]of Object.entries(n.data||{}))o.set(s,c);r.body=o.toString()}else if(t.includes("multipart/form-data")){const o=new FormData;if(n.data instanceof FormData)n.data.forEach((c,i)=>{o.append(i,c)});else for(const c of Object.keys(n.data))o.append(c,n.data[c]);r.body=o;const s=new Headers(r.headers);s.delete("content-type"),r.headers=s}else(t.includes("application/json")||typeof n.data=="object")&&(r.body=JSON.stringify(n.data));return r};class fe extends f{request(e){return a(this,null,function*(){const r=ye(e,e.webFetchExtra),t=((L,P=!0)=>L?Object.entries(L).reduce((T,S)=>{const[k,l]=S;let d,m;return Array.isArray(l)?(m="",l.forEach(A=>{d=P?encodeURIComponent(A):A,m+=`${k}=${d}&`}),m.slice(0,-1)):(d=P?encodeURIComponent(l):l,m=`${k}=${d}`),`${T}&${m}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=t?`${e.url}?${t}`:e.url,s=yield fetch(o,r),c=s.headers.get("content-type")||"";let i,v,{responseType:w="text"}=s.ok?e:{};switch(c.includes("application/json")&&(w="json"),w){case"arraybuffer":case"blob":v=yield s.blob(),i=yield(L=>a(this,null,function*(){return new Promise((P,T)=>{const S=new FileReader;S.onload=()=>{const k=S.result;P(k.indexOf(",")>=0?k.split(",")[1]:k)},S.onerror=k=>T(k),S.readAsDataURL(L)})}))(v);break;case"json":i=yield s.json();break;default:i=yield s.text()}const C={};return s.headers.forEach((L,P)=>{C[P]=L}),{data:i,headers:C,status:s.status,url:s.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Y(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}b("CapacitorHttp",{web:()=>new fe}),b("Portals",{web:()=>Promise.resolve().then(function(){return ge}).then(n=>new n.PortalsWeb)});const ge=Object.freeze({__proto__:null,PortalsWeb:class extends f{publishNative(n){return a(this,null,function*(){})}}}),K=n=>{var e,r,t;try{if(typeof window=="undefined")return;if(Y&&((e=Y())!=null&&e.value)){const o=(t=(r=Y())==null?void 0:r.value)!=null?t:null;if(!o)return void console.error("native initialContext is undefine");if(!n)return void console.error("initialContext call back is undefine");n(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class ve{isNative(){try{return(()=>{try{let e=!1;return K(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{(({callBack:r})=>{K(t=>{var o;try{if(!(t!=null&&t.params))return void console.info("initial context native params is undefine");const s=(o=t==null?void 0:t.params)!=null?o:null;if(!s)return;if(!r)return void console.error("initial context call back is undefine");r(s)}catch(s){throw console.error("redirectPageHandle error",s),s}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){try{return this.isNative()?(()=>{try{let r=null;return K(t=>{r=t!=null?t:null}),r}catch(r){throw console.error("getNativeInfoHandle error",r),r}})():(r=>{var t;return(t=r==null?void 0:r.mockData)!=null?t:null})(e)}catch(r){throw console.error("getNativeInfo error",r),r}}}const F=()=>{try{let n={};return typeof window!="undefined"&&(n=window),n}catch(n){throw console.error("isWinHandle error",n),n}},D="CommunicatePlugin",h=u.registerPlugin(D,{web:()=>Promise.resolve().then(()=>$e).then(n=>new n.PluginsWeb)}),be=u.registerPlugin("CountAssistPlugin",{web:new class extends f{setCountAssistState(n){return a(this,null,function*(){try{return new Promise(e=>{e(n)})}catch(e){throw console.error("setCountAssistState error",e),e}})}}}),V=F();V.removeAddListenerFab=()=>null;const Le=n=>{var e,r;try{V.removeAddListenerFab&&V.removeAddListenerFab();const t=[];if((e=h.showFABMenu)==null||e.call(h,{fabMenu:t}),!n||!((r=Object.keys(n))!=null&&r.length))return;Object.keys(n).forEach(o=>{var s,c,i,v,w,C,L,P;t.push({disable:(c=(s=n==null?void 0:n[o])==null?void 0:s.disable)!=null?c:!1,icon:(v=(i=n==null?void 0:n[o])==null?void 0:i.icon)!=null?v:"",id:(C=(w=n==null?void 0:n[o])==null?void 0:w.id)!=null?C:"",name:(P=(L=n==null?void 0:n[o])==null?void 0:L.title)!=null?P:""})}),queueMicrotask(()=>{var o;(o=h.showFABMenu)==null||o.call(h,{fabMenu:t})}),setTimeout(()=>{(o=>a(this,null,function*(){o&&(V.removeAddListenerFab=yield(s=>a(this,null,function*(){try{if(u.addListener){const c=yield u.addListener(D,"nativeSendFab",i=>s&&s(i));return c!=null&&c.remove?c.remove:()=>null}}catch(c){throw console.error("addListenerFabHandle error",c),c}}))(o))}))(o=>{let s;o!=null&&o.disable||o!=null&&o.id&&(Object.keys(n).forEach(c=>{var i,v,w;(i=n==null?void 0:n[c])!=null&&i.id&&o.id===n[c].id&&(s=(w=(v=n[c])==null?void 0:v.fn)!=null?w:()=>null)}),typeof s=="function"&&s())})})}catch(t){throw console.error("fabBtnHandle error",t),t}},B=F();B.addListenerBackRemoveHandle=()=>null;const ae=(n=()=>null)=>a(this,null,function*(){try{B!=null&&B.addListenerBackRemoveHandle&&typeof B.addListenerBackRemoveHandle=="function"&&B.addListenerBackRemoveHandle(),B.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"nativeSendBack",t=>e&&e(t));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerBackHandle error",r),r}}))(n)}catch(e){throw console.error("initBackBtnFn error",e),e}}),G=F();G.addListenerHomeHandle=()=>null;const Pe=n=>{try{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(G.addListenerHomeHandle=yield(r=>a(this,null,function*(){try{if(u.addListener){const t=yield u.addListener(D,"nativeSendHome",o=>r&&r(o));return t!=null&&t.remove?t.remove:()=>null}}catch(t){throw console.error("addListenerHomeHandle error",t),t}}))(e))}))(n)})}catch(e){throw console.error("homeFn error",e),e}};class Ce{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var r;try{return yield(r=h.homeIsClick)==null?void 0:r.call(h,e)}catch(t){throw console.error("homeBtnSwitch error",t),t}})}setBackBtn(e){try{(r=>{try{const{mounted:t,beforeUnmount:o,callBack:s}=r;t(()=>{ae(s)}),o(()=>{ae()})}catch(t){throw console.error("backBtnHandle error",t),t}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{Pe(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e){try{Le(e)}catch(r){throw console.error("setFabBtn error",r),r}}openMiniApp(e){return a(this,null,function*(){try{return yield h.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return a(this,null,function*(){try{return yield h.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return a(this,null,function*(){try{return yield h.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield h.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return a(this,null,function*(){try{return yield h.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield h.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield h.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}}const Se=u.registerPlugin("CameraScanPlugin",{web:new class extends f{pickCameraScan(n){return a(this,null,function*(){return new Promise(e=>{e(n)})})}}});window.removeAddListenerCameraScan=()=>null;class ke{pickCameraScan(e){return a(this,null,function*(){try{return yield Se.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends f{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class Me{pickCameraScanMultiple(e){return a(this,null,function*(){try{return yield Ae.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}}const Oe=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends f{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}}});class He{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return yield Oe.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}}const xe=u.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends f{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}}});class je{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return yield xe.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}}const se="LaserScanPlugin",ie=u.registerPlugin(se,{web:new class extends f{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}}}),J=F();J.removeAddListenerLaserScan=()=>null;const ce=(n=()=>null)=>{try{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=r=>a(this,null,function*(){r&&(J.removeAddListenerLaserScan=yield(t=>a(this,null,function*(){try{if(u.addListener){const o=yield u.addListener(se,"nativeSendLaser",s=>t&&t(s));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(r))});setTimeout(()=>{e(n)})}catch(e){throw console.error("laserScanFn error",e),e}};class Be{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){ie.pickLaserScan({isContinue:!1})})}unPickLaserScan(){return a(this,null,function*(){ie.unPickLaserScan()})}setLaserScan(e){(r=>{try{const{mounted:t,beforeUnmount:o,callBack:s}=r;t(()=>{ce(s)}),o(()=>{ce()})}catch(t){throw console.error("laserScanApiParams error",t),t}})(e)}}const N=F();N.addListenerCountAssistRemoveHandle=()=>null;const le=(n=()=>null)=>a(this,null,function*(){try{N!=null&&N.addListenerCountAssistRemoveHandle&&typeof N.addListenerCountAssistRemoveHandle=="function"&&N.addListenerCountAssistRemoveHandle(),N.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"nativeSendCountAssist",t=>e&&e(t));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerCountAssistHandle error",r),r}}))(n)}catch(e){throw console.error("initCountAssistFn error",e),e}});class Ne{setCountAssistState(e){return a(this,null,function*(){return yield be.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let t=r!=null?r:!1;return K(o=>{t=!!(o!=null&&o.countAssistState)}),t}catch(t){throw console.error("getCountAssistStateHandle error",t),t}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:t,beforeUnmount:o,callBack:s}=r;t(()=>{le(s)}),o(()=>{le()})}catch(t){throw console.error("setCountAssistBtnHandle error",t),t}})(e)}}class de{constructor(){H(this,"initialContextPlugins",new ve);H(this,"communicatePlugins",new Ce);H(this,"cameraScanPlugins",new ke);H(this,"cameraScanMultiplePlugins",new Me);H(this,"cameraScanMultipleNoCountPlugins",new He);H(this,"cameraScanSingleOrDualPlugins",new je);H(this,"laserScanPlugins",new Be);H(this,"countAssistPlugins",new Ne)}}const Ee=new de,$e=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends f{homeIsClick(){return a(this,null,function*(){})}openMiniApp(n){return a(this,null,function*(){try{return new Promise(e=>{e(n)})}catch(e){throw console.error("openMiniApp error",e),e}})}showTitle(n){return a(this,null,function*(){try{return new Promise(e=>{e(n)})}catch(e){throw console.error("showTitle error",e),e}})}showFABMenu(n){return a(this,null,function*(){try{return new Promise(e=>{e(n)})}catch(e){throw console.error("showFABMenu error",e),e}})}showSubMask(n){return a(this,null,function*(){try{return new Promise(e=>{e(n)})}catch(e){throw console.error("showSubMask error",e),e}})}setMiniAppVersion(n){return a(this,null,function*(){try{return new Promise(e=>{e(n)})}catch(e){throw console.error("setMiniAppVersion error",e),e}})}showDialog(){return a(this,null,function*(){})}cancelDialog(){return a(this,null,function*(){})}getMiniAppKong(n){return a(this,null,function*(){try{return new Promise(e=>{e(n)})}catch(e){throw console.error("getMiniAppKong error",e),e}})}}},Symbol.toStringTag,{value:"Module"}));y.NativeApi=de,y.default=Ee,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(y,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((y=typeof globalThis!="undefined"?globalThis:y||self).main={})})(this,function(y){"use strict";var Fe=Object.defineProperty;var De=(y,p,g)=>p in y?Fe(y,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):y[p]=g;var H=(y,p,g)=>(De(y,typeof p!="symbol"?p+"":p,g),g);var a=(y,p,g)=>new Promise((x,$)=>{var Q=b=>{try{u(g.next(b))}catch(f){$(f)}},X=b=>{try{u(g.throw(b))}catch(f){$(f)}},u=b=>b.done?x(b.value):Promise.resolve(b.value).then(Q,X);u((g=g.apply(y,p)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const p=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=(o,s)=>{n.platforms.set(o,s)},n.setPlatform=o=>{n.platforms.has(o)&&(n.currentPlatform=n.platforms.get(o))},n})(t),g=p(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var x;g.addPlatform,g.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(x||(x={}));class $ extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const Q=t=>{var e,r,n,o,s;const c=t.CapacitorCustomPlatform||null,i=t.Capacitor||{},v=i.Plugins=i.Plugins||{},w=t.CapacitorPlatforms,S=((e=w==null?void 0:w.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(l=>{var d,m;return l!=null&&l.androidBridge?"android":!((m=(d=l==null?void 0:l.webkit)===null||d===void 0?void 0:d.messageHandlers)===null||m===void 0)&&m.bridge?"ios":"web"})(t)),P=((r=w==null?void 0:w.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>S()!=="web"),L=((n=w==null?void 0:w.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(l=>{const d=C.get(l);return!!(d!=null&&d.platforms.has(S()))||!!T(l)}),T=((o=w==null?void 0:w.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(l=>{var d;return(d=i.PluginHeaders)===null||d===void 0?void 0:d.find(m=>m.name===l)}),C=new Map,k=((s=w==null?void 0:w.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||((l,d={})=>{const m=C.get(l);if(m)return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`),m.proxy;const A=S(),I=T(l);let E;const ee=O=>{let j;const U=(...z)=>{const R=(()=>a(this,null,function*(){return!E&&A in d?E=E=typeof d[A]=="function"?yield d[A]():d[A]:c!==null&&!E&&"web"in d&&(E=E=typeof d.web=="function"?yield d.web():d.web),E}))().then(W=>{const he=((M,_)=>{var te,ne;if(!I){if(M)return(ne=M[_])===null||ne===void 0?void 0:ne.bind(M);throw new $(`"${l}" plugin is not implemented on ${A}`,x.Unimplemented)}{const me=I==null?void 0:I.methods.find(q=>_===q.name);if(me)return me.rtype==="promise"?q=>i.nativePromise(l,_.toString(),q):(q,Ue)=>i.nativeCallback(l,_.toString(),q,Ue);if(M)return(te=M[_])===null||te===void 0?void 0:te.bind(M)}})(W,O);if(he){const M=he(...z);return j=M==null?void 0:M.remove,M}throw new $(`"${l}.${O}()" is not implemented on ${A}`,x.Unimplemented)});return O==="addListener"&&(R.remove=()=>a(this,null,function*(){return j()})),R};return U.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:O,writable:!1,configurable:!1}),U},ue=ee("addListener"),we=ee("removeListener"),Te=(O,j)=>{const U=ue({eventName:O},j),z=()=>a(this,null,function*(){const W=yield U;we({eventName:O,callbackId:W},j)}),R=new Promise(W=>U.then(()=>W({remove:z})));return R.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield z()}),R},re=new Proxy({},{get(O,j){switch(j){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return I?Te:ue;case"removeListener":return we;default:return ee(j)}}});return v[l]=re,C.set(l,{name:l,proxy:re,platforms:new Set([...Object.keys(d),...I?[A]:[]])}),re});return i.convertFileSrc||(i.convertFileSrc=l=>l),i.getPlatform=S,i.handleError=l=>t.console.error(l),i.isNativePlatform=P,i.isPluginAvailable=L,i.pluginMethodNoop=(l,d,m)=>Promise.reject(`${m} does not have an implementation of "${d}".`),i.registerPlugin=k,i.Exception=$,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},X=t=>t.Capacitor=Q(t),u=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),b=u.registerPlugin;u.Plugins;class f{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 o=()=>a(this,null,function*(){return this.removeListener(e,r)}),s=Promise.resolve({remove:o});return Object.defineProperty(s,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),s}removeAllListeners(){return a(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(o=>o(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 u.Exception(e,x.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,x.Unavailable)}removeListener(e,r){return a(this,null,function*(){const n=this.listeners[e];if(!n)return;const o=n.indexOf(r);this.listeners[e].splice(o,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 oe=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ae=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class pe extends f{getCookies(){return a(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[o,s]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=ae(o).trim(),s=ae(s).trim(),r[o]=s}),r})}setCookie(e){return a(this,null,function*(){try{const r=oe(e.key),n=oe(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${o}; path=${s}; ${c};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return a(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 a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}b("CapacitorCookies",{web:()=>new pe});const ye=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=((o={})=>{const s=Object.keys(o);return Object.keys(o).map(c=>c.toLocaleLowerCase()).reduce((c,i,v)=>(c[i]=o[s[v]],c),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[s,c]of Object.entries(t.data||{}))o.set(s,c);r.body=o.toString()}else if(n.includes("multipart/form-data")){const o=new FormData;if(t.data instanceof FormData)t.data.forEach((c,i)=>{o.append(i,c)});else for(const c of Object.keys(t.data))o.append(c,t.data[c]);r.body=o;const s=new Headers(r.headers);s.delete("content-type"),r.headers=s}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class fe extends f{request(e){return a(this,null,function*(){const r=ye(e,e.webFetchExtra),n=((P,L=!0)=>P?Object.entries(P).reduce((T,C)=>{const[k,l]=C;let d,m;return Array.isArray(l)?(m="",l.forEach(A=>{d=L?encodeURIComponent(A):A,m+=`${k}=${d}&`}),m.slice(0,-1)):(d=L?encodeURIComponent(l):l,m=`${k}=${d}`),`${T}&${m}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=n?`${e.url}?${n}`:e.url,s=yield fetch(o,r),c=s.headers.get("content-type")||"";let i,v,{responseType:w="text"}=s.ok?e:{};switch(c.includes("application/json")&&(w="json"),w){case"arraybuffer":case"blob":v=yield s.blob(),i=yield(P=>a(this,null,function*(){return new Promise((L,T)=>{const C=new FileReader;C.onload=()=>{const k=C.result;L(k.indexOf(",")>=0?k.split(",")[1]:k)},C.onerror=k=>T(k),C.readAsDataURL(P)})}))(v);break;case"json":i=yield s.json();break;default:i=yield s.text()}const S={};return s.headers.forEach((P,L)=>{S[L]=P}),{data:i,headers:S,status:s.status,url:s.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Y(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}b("CapacitorHttp",{web:()=>new fe}),b("Portals",{web:()=>Promise.resolve().then(function(){return ge}).then(t=>new t.PortalsWeb)});const ge=Object.freeze({__proto__:null,PortalsWeb:class extends f{publishNative(t){return a(this,null,function*(){})}}}),K=t=>{var e,r,n;try{if(typeof window=="undefined")return;if(Y&&((e=Y())!=null&&e.value)){const o=(n=(r=Y())==null?void 0:r.value)!=null?n:null;if(!o)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class ve{isNative(){try{return(()=>{try{let e=!1;return K(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{(({callBack:r})=>{K(n=>{var o;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const s=(o=n==null?void 0:n.params)!=null?o:null;if(!s)return;if(!r)return void console.error("initial context call back is undefine");r(s)}catch(s){throw console.error("redirectPageHandle error",s),s}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){try{return this.isNative()?(()=>{try{let r=null;return K(n=>{r=n!=null?n:null}),r}catch(r){throw console.error("getNativeInfoHandle error",r),r}})():(r=>{var n;return(n=r==null?void 0:r.mockData)!=null?n:null})(e)}catch(r){throw console.error("getNativeInfo error",r),r}}}const F=()=>{try{let t={};return typeof window!="undefined"&&(t=window),t}catch(t){throw console.error("isWinHandle error",t),t}},D="CommunicatePlugin",h=u.registerPlugin(D,{web:()=>Promise.resolve().then(()=>$e).then(t=>new t.PluginsWeb)}),be=u.registerPlugin("CountAssistPlugin",{web:new class extends f{setCountAssistState(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setCountAssistState error",e),e}})}}}),V=F();V.removeAddListenerFab=()=>null;const Pe=t=>{var e,r;try{V.removeAddListenerFab&&V.removeAddListenerFab();const n=[];if((e=h.showFABMenu)==null||e.call(h,{fabMenu:n}),!t||!((r=Object.keys(t))!=null&&r.length))return;Object.keys(t).forEach(o=>{var s,c,i,v,w,S,P,L;n.push({disable:(c=(s=t==null?void 0:t[o])==null?void 0:s.disable)!=null?c:!1,icon:(v=(i=t==null?void 0:t[o])==null?void 0:i.icon)!=null?v:"",id:(S=(w=t==null?void 0:t[o])==null?void 0:w.id)!=null?S:"",name:(L=(P=t==null?void 0:t[o])==null?void 0:P.title)!=null?L:""})}),queueMicrotask(()=>{var o;(o=h.showFABMenu)==null||o.call(h,{fabMenu:n})}),setTimeout(()=>{(o=>a(this,null,function*(){o&&(V.removeAddListenerFab=yield(s=>a(this,null,function*(){try{if(u.addListener){const c=yield u.addListener(D,"nativeSendFab",i=>s&&s(i));return c!=null&&c.remove?c.remove:()=>null}}catch(c){throw console.error("addListenerFabHandle error",c),c}}))(o))}))(o=>{let s;o!=null&&o.disable||o!=null&&o.id&&(Object.keys(t).forEach(c=>{var i,v,w;(i=t==null?void 0:t[c])!=null&&i.id&&o.id===t[c].id&&(s=(w=(v=t[c])==null?void 0:v.fn)!=null?w:()=>null)}),typeof s=="function"&&s())})})}catch(n){throw console.error("fabBtnHandle error",n),n}},B=F();B.addListenerBackRemoveHandle=()=>null;const se=(t=()=>null)=>a(this,null,function*(){try{B!=null&&B.addListenerBackRemoveHandle&&typeof B.addListenerBackRemoveHandle=="function"&&B.addListenerBackRemoveHandle(),B.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"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}}),G=F();G.addListenerHomeHandle=()=>null;const Le=t=>{try{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(G.addListenerHomeHandle=yield(r=>a(this,null,function*(){try{if(u.addListener){const n=yield u.addListener(D,"nativeSendHome",o=>r&&r(o));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}};class Se{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var r;try{return yield(r=h.homeIsClick)==null?void 0:r.call(h,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{se(s)}),o(()=>{se()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{Le(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e){try{Pe(e)}catch(r){throw console.error("setFabBtn error",r),r}}openMiniApp(e){return a(this,null,function*(){try{return yield h.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return a(this,null,function*(){try{return yield h.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return a(this,null,function*(){try{return yield h.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield h.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return a(this,null,function*(){try{return yield h.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield h.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield h.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}}const Ce=u.registerPlugin("CameraScanPlugin",{web:new class extends f{pickCameraScan(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}}});window.removeAddListenerCameraScan=()=>null;class ke{pickCameraScan(e){return a(this,null,function*(){try{return yield Ce.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends f{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class Me{pickCameraScanMultiple(e){return a(this,null,function*(){try{return yield Ae.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}}const Oe=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends f{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}}});class He{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return yield Oe.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}}const xe=u.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends f{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}}});class je{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return yield xe.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}}const ie="LaserScanPlugin",Z=u.registerPlugin(ie,{web:new class extends f{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}setLaserState(){return a(this,null,function*(){})}}}),J=F();J.removeAddListenerLaserScan=()=>null;const ce=(t=()=>null)=>{try{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=r=>a(this,null,function*(){r&&(J.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(u.addListener){const o=yield u.addListener(ie,"nativeSendLaser",s=>n&&n(s));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(r))});setTimeout(()=>{e(t)})}catch(e){throw console.error("laserScanFn error",e),e}};class Be{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){try{return yield Z.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return a(this,null,function*(){try{return yield Z.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{Z.setLaserState(e)}catch(r){throw console.error("setLaserState error",r),r}}setLaserScan(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{ce(s)}),o(()=>{ce()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}}const N=F();N.addListenerCountAssistRemoveHandle=()=>null;const le=(t=()=>null)=>a(this,null,function*(){try{N!=null&&N.addListenerCountAssistRemoveHandle&&typeof N.addListenerCountAssistRemoveHandle=="function"&&N.addListenerCountAssistRemoveHandle(),N.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"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 Ne{setCountAssistState(e){return a(this,null,function*(){return yield be.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let n=r!=null?r:!1;return K(o=>{n=!!(o!=null&&o.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{le(s)}),o(()=>{le()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}}class de{constructor(){H(this,"initialContextPlugins",new ve);H(this,"communicatePlugins",new Se);H(this,"cameraScanPlugins",new ke);H(this,"cameraScanMultiplePlugins",new Me);H(this,"cameraScanMultipleNoCountPlugins",new He);H(this,"cameraScanSingleOrDualPlugins",new je);H(this,"laserScanPlugins",new Be);H(this,"countAssistPlugins",new Ne)}}const Ee=new de,$e=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends f{homeIsClick(){return a(this,null,function*(){})}openMiniApp(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("openMiniApp error",e),e}})}showTitle(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showTitle error",e),e}})}showFABMenu(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showFABMenu error",e),e}})}showSubMask(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showSubMask error",e),e}})}setMiniAppVersion(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setMiniAppVersion error",e),e}})}showDialog(){return a(this,null,function*(){})}cancelDialog(){return a(this,null,function*(){})}getMiniAppKong(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("getMiniAppKong error",e),e}})}}},Symbol.toStringTag,{value:"Module"}));y.NativeApi=de,y.default=Ee,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "superapp-miniapp-invoke-native",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "description": "In Superapp, the encapsulation of calling Native interfaces by mini-programs.",
6
6
  "scripts": {
7
7
  "dev": "vite",