qsh-webview-sdk 2.4.3 → 2.4.4

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.
@@ -2,30 +2,30 @@ var zt = Object.defineProperty, Yt = Object.defineProperties;
2
2
  var Xt = Object.getOwnPropertyDescriptors;
3
3
  var Je = Object.getOwnPropertySymbols;
4
4
  var Zt = Object.prototype.hasOwnProperty, Qt = Object.prototype.propertyIsEnumerable;
5
- var be = (t, e, r) => e in t ? zt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, g = (t, e) => {
5
+ var Te = (t, e, r) => e in t ? zt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, g = (t, e) => {
6
6
  for (var r in e || (e = {}))
7
- Zt.call(e, r) && be(t, r, e[r]);
7
+ Zt.call(e, r) && Te(t, r, e[r]);
8
8
  if (Je)
9
9
  for (var r of Je(e))
10
- Qt.call(e, r) && be(t, r, e[r]);
10
+ Qt.call(e, r) && Te(t, r, e[r]);
11
11
  return t;
12
12
  }, m = (t, e) => Yt(t, Xt(e));
13
- var k = (t, e, r) => be(t, typeof e != "symbol" ? e + "" : e, r);
14
- var y = (t, e, r) => new Promise((n, i) => {
13
+ var B = (t, e, r) => Te(t, typeof e != "symbol" ? e + "" : e, r);
14
+ var I = (t, e, r) => new Promise((n, i) => {
15
15
  var s = (u) => {
16
16
  try {
17
- d(r.next(u));
17
+ l(r.next(u));
18
18
  } catch (p) {
19
19
  i(p);
20
20
  }
21
21
  }, o = (u) => {
22
22
  try {
23
- d(r.throw(u));
23
+ l(r.throw(u));
24
24
  } catch (p) {
25
25
  i(p);
26
26
  }
27
- }, d = (u) => u.done ? n(u.value) : Promise.resolve(u.value).then(s, o);
28
- d((r = r.apply(t, e)).next());
27
+ }, l = (u) => u.done ? n(u.value) : Promise.resolve(u.value).then(s, o);
28
+ l((r = r.apply(t, e)).next());
29
29
  });
30
30
  function pe() {
31
31
  return typeof window != "undefined" ? window : void 0;
@@ -33,7 +33,7 @@ function pe() {
33
33
  function De() {
34
34
  return typeof navigator == "undefined" ? "" : navigator.userAgent || "";
35
35
  }
36
- function _() {
36
+ function C() {
37
37
  const t = pe();
38
38
  if (!t) return !1;
39
39
  if (t.__wxjs_environment === "miniprogram" || t.wx && t.wx.miniProgram)
@@ -41,7 +41,7 @@ function _() {
41
41
  const e = De();
42
42
  return !!(e && /micromessenger/i.test(e) && /miniProgram/i.test(e));
43
43
  }
44
- function Ce() {
44
+ function Me() {
45
45
  const t = pe();
46
46
  return !!(t && t.plus);
47
47
  }
@@ -76,13 +76,13 @@ function Z() {
76
76
  return !1;
77
77
  }
78
78
  function er() {
79
- return Se() ? "uvue" : Re() ? "nvue" : _() ? "weixin" : Z() ? "offline" : Ce() ? "plus" : tt() ? "webview" : Oe() ? "UniApp" : "h5";
79
+ return Se() ? "uvue" : Re() ? "nvue" : C() ? "weixin" : Z() ? "offline" : Me() ? "plus" : tt() ? "webview" : Oe() ? "UniApp" : "h5";
80
80
  }
81
81
  let Ee = null;
82
82
  function H(t = !1) {
83
83
  return Ee && !t || (Ee = {
84
- isWeixinMiniProgram: _(),
85
- isAppPlus: Ce(),
84
+ isWeixinMiniProgram: C(),
85
+ isAppPlus: Me(),
86
86
  isNvue: Re(),
87
87
  isUvue: Se(),
88
88
  isUniApp: Oe(),
@@ -92,14 +92,14 @@ function H(t = !1) {
92
92
  type: er()
93
93
  }), Ee;
94
94
  }
95
- const l = H(), x = {
95
+ const f = H(), T = {
96
96
  PLATFORM_NOT_SUPPORTED: "PLATFORM_NOT_SUPPORTED",
97
97
  API_CALL_FAILED: "API_CALL_FAILED",
98
98
  BRIDGE_NOT_READY: "BRIDGE_NOT_READY",
99
99
  INVALID_PARAMETERS: "INVALID_PARAMETERS",
100
100
  NETWORK_ERROR: "NETWORK_ERROR"
101
101
  };
102
- class T extends Error {
102
+ class N extends Error {
103
103
  /**
104
104
  * 构造函数
105
105
  * @param {string} type - 错误类型
@@ -108,7 +108,7 @@ class T extends Error {
108
108
  * @param {Error} [originalError] - 原始错误对象
109
109
  */
110
110
  constructor(e, r, n = {}, i = null) {
111
- super(r), this.name = "QshError", this.type = e, this.context = n, this.originalError = i, this.timestamp = (/* @__PURE__ */ new Date()).toISOString(), Error.captureStackTrace && Error.captureStackTrace(this, T);
111
+ super(r), this.name = "QshError", this.type = e, this.context = n, this.originalError = i, this.timestamp = (/* @__PURE__ */ new Date()).toISOString(), Error.captureStackTrace && Error.captureStackTrace(this, N);
112
112
  }
113
113
  /**
114
114
  * 转换为 JSON 格式
@@ -156,13 +156,13 @@ const S = class S {
156
156
  */
157
157
  static handleApiError(e, r = {}) {
158
158
  let n;
159
- return e instanceof T ? n = e : e instanceof Error ? n = new T(
160
- x.API_CALL_FAILED,
159
+ return e instanceof N ? n = e : e instanceof Error ? n = new N(
160
+ T.API_CALL_FAILED,
161
161
  e.message,
162
162
  r,
163
163
  e
164
- ) : n = new T(
165
- x.API_CALL_FAILED,
164
+ ) : n = new N(
165
+ T.API_CALL_FAILED,
166
166
  String(e),
167
167
  r
168
168
  ), S.logError(n), S.notifyCallbacks(n), n;
@@ -174,8 +174,8 @@ const S = class S {
174
174
  * @returns {QshError} 错误对象
175
175
  */
176
176
  static handlePlatformNotSupported(e, r) {
177
- const n = new T(
178
- x.PLATFORM_NOT_SUPPORTED,
177
+ const n = new N(
178
+ T.PLATFORM_NOT_SUPPORTED,
179
179
  `API "${r}" is not supported on platform "${e}"`,
180
180
  { platformType: e, apiName: r }
181
181
  );
@@ -187,8 +187,8 @@ const S = class S {
187
187
  * @returns {QshError} 错误对象
188
188
  */
189
189
  static handleBridgeNotReady(e) {
190
- const r = new T(
191
- x.BRIDGE_NOT_READY,
190
+ const r = new N(
191
+ T.BRIDGE_NOT_READY,
192
192
  `Bridge is not ready when calling "${e}"`,
193
193
  { apiName: e }
194
194
  );
@@ -203,8 +203,8 @@ const S = class S {
203
203
  * @returns {QshError} 错误对象
204
204
  */
205
205
  static handleInvalidParameters(e, r, n, i) {
206
- const s = new T(
207
- x.INVALID_PARAMETERS,
206
+ const s = new N(
207
+ T.INVALID_PARAMETERS,
208
208
  `Invalid parameter "${r}" in "${e}": expected ${n}, got ${typeof i}`,
209
209
  { apiName: e, paramName: r, expectedType: n, actualValue: i }
210
210
  );
@@ -230,7 +230,7 @@ const S = class S {
230
230
  * @returns {Promise} Promise 对象
231
231
  */
232
232
  static safeExecuteAsync(n) {
233
- return y(this, arguments, function* (e, r = {}) {
233
+ return I(this, arguments, function* (e, r = {}) {
234
234
  try {
235
235
  return yield e();
236
236
  } catch (i) {
@@ -282,9 +282,9 @@ const S = class S {
282
282
  };
283
283
  }
284
284
  };
285
- k(S, "isDebugMode", !1), k(S, "errorCallbacks", []);
286
- let f = S;
287
- const L = {
285
+ B(S, "isDebugMode", !1), B(S, "errorCallbacks", []);
286
+ let d = S;
287
+ const x = {
288
288
  UNINITIALIZED: "uninitialized",
289
289
  INITIALIZING: "initializing",
290
290
  READY: "ready",
@@ -292,7 +292,7 @@ const L = {
292
292
  };
293
293
  class tr {
294
294
  constructor() {
295
- this.state = L.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null, this.handleBridgeReady = this.handleBridgeReady.bind(this), this.handleInitializationError = this.handleInitializationError.bind(this);
295
+ this.state = x.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null, this.handleBridgeReady = this.handleBridgeReady.bind(this), this.handleInitializationError = this.handleInitializationError.bind(this);
296
296
  }
297
297
  /**
298
298
  * 获取当前状态
@@ -306,21 +306,21 @@ class tr {
306
306
  * @returns {boolean} 是否就绪
307
307
  */
308
308
  isReady() {
309
- return this.state === L.READY;
309
+ return this.state === x.READY;
310
310
  }
311
311
  /**
312
312
  * 检查是否正在初始化
313
313
  * @returns {boolean} 是否正在初始化
314
314
  */
315
315
  isInitializing() {
316
- return this.state === L.INITIALIZING;
316
+ return this.state === x.INITIALIZING;
317
317
  }
318
318
  /**
319
319
  * 检查是否出错
320
320
  * @returns {boolean} 是否出错
321
321
  */
322
322
  hasError() {
323
- return this.state === L.ERROR;
323
+ return this.state === x.ERROR;
324
324
  }
325
325
  /**
326
326
  * 获取初始化错误
@@ -344,10 +344,10 @@ class tr {
344
344
  * @returns {Promise<void>} 初始化 Promise
345
345
  */
346
346
  startInitialization(e) {
347
- return y(this, null, function* () {
348
- if (this.state !== L.UNINITIALIZED)
347
+ return I(this, null, function* () {
348
+ if (this.state !== x.UNINITIALIZED)
349
349
  return this.waitForReady();
350
- this.state = L.INITIALIZING;
350
+ this.state = x.INITIALIZING;
351
351
  try {
352
352
  yield e(), this.handleBridgeReady();
353
353
  } catch (r) {
@@ -361,11 +361,11 @@ class tr {
361
361
  * @private
362
362
  */
363
363
  handleBridgeReady() {
364
- this.state === L.INITIALIZING && (this.state = L.READY, this.readyCallbacks.forEach((e) => {
364
+ this.state === x.INITIALIZING && (this.state = x.READY, this.readyCallbacks.forEach((e) => {
365
365
  try {
366
366
  e();
367
367
  } catch (r) {
368
- f.handleApiError(r, { context: "StateManager.handleBridgeReady" });
368
+ d.handleApiError(r, { context: "StateManager.handleBridgeReady" });
369
369
  }
370
370
  }), this.readyCallbacks = [], this.errorCallbacks = []);
371
371
  }
@@ -375,11 +375,11 @@ class tr {
375
375
  * @private
376
376
  */
377
377
  handleInitializationError(e) {
378
- this.state = L.ERROR, this.initializationError = e, this.errorCallbacks.forEach((r) => {
378
+ this.state = x.ERROR, this.initializationError = e, this.errorCallbacks.forEach((r) => {
379
379
  try {
380
380
  r(e);
381
381
  } catch (n) {
382
- f.handleApiError(n, { context: "StateManager.handleInitializationError" });
382
+ d.handleApiError(n, { context: "StateManager.handleInitializationError" });
383
383
  }
384
384
  }), this.readyCallbacks = [], this.errorCallbacks = [];
385
385
  }
@@ -387,7 +387,7 @@ class tr {
387
387
  * 重置状态管理器(用于测试或重新初始化)
388
388
  */
389
389
  reset() {
390
- this.state = L.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null;
390
+ this.state = x.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null;
391
391
  }
392
392
  /**
393
393
  * 添加状态变化监听器
@@ -402,7 +402,7 @@ class tr {
402
402
  const n = () => {
403
403
  this.state === e && r(this.state);
404
404
  };
405
- return e === L.READY ? this.readyCallbacks.push(n) : e === L.ERROR && this.errorCallbacks.push(n), () => {
405
+ return e === x.READY ? this.readyCallbacks.push(n) : e === x.ERROR && this.errorCallbacks.push(n), () => {
406
406
  const i = this.readyCallbacks.indexOf(n);
407
407
  i > -1 && this.readyCallbacks.splice(i, 1);
408
408
  const s = this.errorCallbacks.indexOf(n);
@@ -491,7 +491,7 @@ const Y = new tr(), rt = () => Y.waitForReady(), rr = () => Y.isReady(), nr = ()
491
491
  static log(e, r, n, ...i) {
492
492
  if (!h.shouldLog(e, r))
493
493
  return;
494
- const s = (/* @__PURE__ */ new Date()).toISOString(), o = le[e], d = r ? `[${r}]` : "", u = `${h.prefix} ${d} ${n}`, p = {
494
+ const s = (/* @__PURE__ */ new Date()).toISOString(), o = le[e], l = r ? `[${r}]` : "", u = `${h.prefix} ${l} ${n}`, p = {
495
495
  timestamp: s,
496
496
  level: e,
497
497
  levelName: o,
@@ -502,7 +502,7 @@ const Y = new tr(), rt = () => Y.waitForReady(), rr = () => Y.isReady(), nr = ()
502
502
  if (h.addToHistory(p), typeof h.reporter == "function")
503
503
  try {
504
504
  h.reporter(p);
505
- } catch (C) {
505
+ } catch (M) {
506
506
  }
507
507
  h.outputToConsole(e, u, ...i);
508
508
  }
@@ -653,11 +653,11 @@ const Y = new tr(), rt = () => Y.waitForReady(), rr = () => Y.isReady(), nr = ()
653
653
  h.reporter = typeof e == "function" ? e : null;
654
654
  }
655
655
  };
656
- k(h, "currentLevel", P.ERROR), // 生产环境默认只显示错误
657
- k(h, "enabledModules", /* @__PURE__ */ new Set()), // 启用日志的模块
658
- k(h, "logHistory", []), // 日志历史(最多保留1000条)
659
- k(h, "maxHistorySize", 1e3), k(h, "prefix", "[QSH-SDK]"), k(h, "reporter", null);
660
- let v = h;
656
+ B(h, "currentLevel", P.ERROR), // 生产环境默认只显示错误
657
+ B(h, "enabledModules", /* @__PURE__ */ new Set()), // 启用日志的模块
658
+ B(h, "logHistory", []), // 日志历史(最多保留1000条)
659
+ B(h, "maxHistorySize", 1e3), B(h, "prefix", "[QSH-SDK]"), B(h, "reporter", null);
660
+ let L = h;
661
661
  if (typeof window != "undefined") {
662
662
  const t = window.location && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes("192.168.")), e = window.location && (window.location.search.includes("debug=true") || window.location.search.includes("qsh_debug=1"));
663
663
  let r = !1;
@@ -665,9 +665,9 @@ if (typeof window != "undefined") {
665
665
  r = localStorage && localStorage.getItem("qsh_debug") === "true";
666
666
  } catch (n) {
667
667
  }
668
- (t || e || r) && v.enableDevMode();
668
+ (t || e || r) && L.enableDevMode();
669
669
  }
670
- const A = v.createModuleLogger("Bridge"), I = v.createModuleLogger("Platform"), a = v.createModuleLogger("API"), D = v.createModuleLogger("State"), Ae = /complete|loaded|interactive/;
670
+ const A = L.createModuleLogger("Bridge"), E = L.createModuleLogger("Platform"), a = L.createModuleLogger("API"), D = L.createModuleLogger("State"), Ae = /complete|loaded|interactive/;
671
671
  function ir(t) {
672
672
  if (!Z()) return !1;
673
673
  A.debug("检测到离线包环境,开始初始化");
@@ -699,12 +699,12 @@ function cr() {
699
699
  return Y.waitForReady();
700
700
  }
701
701
  function nt() {
702
- return Y.startInitialization(() => y(null, null, function* () {
702
+ return Y.startInitialization(() => I(null, null, function* () {
703
703
  return new Promise((t, e) => {
704
704
  const r = () => {
705
705
  t();
706
706
  }, n = (i) => {
707
- const s = f.handleApiError(i, {
707
+ const s = d.handleApiError(i, {
708
708
  context: "bridge initialization"
709
709
  });
710
710
  e(s);
@@ -719,7 +719,7 @@ function nt() {
719
719
  });
720
720
  }));
721
721
  }
722
- const N = {
722
+ const b = {
723
723
  UNINITIALIZED: "uninitialized",
724
724
  CONFIGURING: "configuring",
725
725
  CONFIGURED: "configured",
@@ -730,45 +730,78 @@ function K() {
730
730
  }
731
731
  class ur {
732
732
  constructor() {
733
- this.state = N.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.runtimeConfig = {
733
+ this.state = b.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.configVersion = 0, this.configuredConfigKey = null, this.runtimeConfig = {
734
734
  clientId: null,
735
- isProd: !1
735
+ isProd: !1,
736
+ debug: !1,
737
+ url: ""
736
738
  }, this.CONFIG_API_URL = this.getConfigApiUrl(this.runtimeConfig.isProd), this.DEFAULT_JS_API_LIST = ["chooseImage", "uploadImage", "previewImage", "downloadImage", "getLocalImgData", "scanQRCode", "getLocation", "openLocation", "updateAppMessageShareData", "updateTimelineShareData"], this.handleConfigSuccess = this.handleConfigSuccess.bind(this), this.handleConfigError = this.handleConfigError.bind(this);
737
739
  }
738
740
  configure(e = {}) {
739
741
  if (!e || typeof e != "object" || Array.isArray(e))
740
- throw new T(
741
- x.INVALID_PARAMETERS,
742
+ throw new N(
743
+ T.INVALID_PARAMETERS,
742
744
  "config参数异常",
743
745
  { config: e }
744
746
  );
745
747
  if (!Object.prototype.hasOwnProperty.call(e, "clientId"))
746
748
  throw this.createMissingClientIdError();
747
749
  if (typeof e.clientId != "string" || !e.clientId.trim())
748
- throw new T(
749
- x.INVALID_PARAMETERS,
750
+ throw new N(
751
+ T.INVALID_PARAMETERS,
750
752
  "clientId参数异常",
751
753
  { clientId: e.clientId }
752
754
  );
753
755
  if (Object.prototype.hasOwnProperty.call(e, "isProd") && typeof e.isProd != "boolean")
754
- throw new T(
755
- x.INVALID_PARAMETERS,
756
+ throw new N(
757
+ T.INVALID_PARAMETERS,
756
758
  "isProd参数异常",
757
759
  { isProd: e.isProd }
758
760
  );
759
- const r = e.clientId.trim(), n = e.isProd === !0, i = r !== this.runtimeConfig.clientId || n !== this.runtimeConfig.isProd;
761
+ if (Object.prototype.hasOwnProperty.call(e, "debug") && typeof e.debug != "boolean")
762
+ throw new N(
763
+ T.INVALID_PARAMETERS,
764
+ "debug参数异常",
765
+ { debug: e.debug }
766
+ );
767
+ if (Object.prototype.hasOwnProperty.call(e, "url") && typeof e.url != "string")
768
+ throw new N(
769
+ T.INVALID_PARAMETERS,
770
+ "url参数异常",
771
+ { url: e.url }
772
+ );
773
+ const r = e.clientId.trim(), n = e.isProd === !0, i = n ? !1 : e.debug === !0, s = typeof e.url == "string" ? e.url.trim() : "", o = r !== this.runtimeConfig.clientId || n !== this.runtimeConfig.isProd || i !== this.runtimeConfig.debug || s !== this.runtimeConfig.url;
760
774
  return this.runtimeConfig = m(g({}, this.runtimeConfig), {
761
775
  clientId: r,
762
- isProd: n
763
- }), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state === N.ERROR || i && (this.state === N.CONFIGURING || this.state === N.CONFIGURED)) && this.reset(), I.info("Updated Weixin runtime config", {
776
+ isProd: n,
777
+ debug: i,
778
+ url: s
779
+ }), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state === b.ERROR || o && (this.state === b.CONFIGURING || this.state === b.CONFIGURED)) && this.reset({ preserveCallbacks: !0 }), E.info("Updated Weixin runtime config", {
764
780
  clientId: this.runtimeConfig.clientId,
765
781
  isProd: this.runtimeConfig.isProd,
782
+ debug: this.runtimeConfig.debug,
783
+ url: this.runtimeConfig.url,
766
784
  configApiUrl: this.CONFIG_API_URL
767
785
  }), this.getRuntimeConfig();
768
786
  }
769
787
  getRuntimeConfig() {
770
788
  return g({}, this.runtimeConfig);
771
789
  }
790
+ getEffectiveConfigUrl(e = {}) {
791
+ const { requireWindow: r = !1 } = e;
792
+ return this.runtimeConfig.url ? this.runtimeConfig.url : r ? this.getCurrentPageUrl() : typeof window == "undefined" || !window.location ? "" : this.getCurrentPageUrl();
793
+ }
794
+ getRuntimeConfigKey() {
795
+ return JSON.stringify({
796
+ clientId: this.runtimeConfig.clientId,
797
+ isProd: this.runtimeConfig.isProd,
798
+ debug: this.runtimeConfig.debug,
799
+ url: this.getEffectiveConfigUrl()
800
+ });
801
+ }
802
+ isCurrentConfigRun(e, r) {
803
+ return e === this.configVersion && r === this.getRuntimeConfigKey();
804
+ }
772
805
  hasClientId() {
773
806
  return typeof this.runtimeConfig.clientId == "string" && this.runtimeConfig.clientId.length > 0;
774
807
  }
@@ -776,8 +809,8 @@ class ur {
776
809
  return this.isTestMode() || this.hasClientId();
777
810
  }
778
811
  createMissingClientIdError() {
779
- return new T(
780
- x.INVALID_PARAMETERS,
812
+ return new N(
813
+ T.INVALID_PARAMETERS,
781
814
  "clientId错误",
782
815
  { field: "clientId" }
783
816
  );
@@ -807,32 +840,32 @@ class ur {
807
840
  * @private
808
841
  */
809
842
  fetchWeixinConfig() {
810
- return y(this, null, function* () {
811
- const e = this.getCurrentPageUrl();
843
+ return I(this, null, function* () {
844
+ const e = this.getEffectiveConfigUrl({ requireWindow: !0 });
812
845
  if (this.isTestMode())
813
- return I.info("使用测试模式,返回模拟配置"), this.getMockConfig();
846
+ return E.info("使用测试模式,返回模拟配置"), this.getMockConfig();
814
847
  if (!this.hasClientId())
815
848
  throw this.createMissingClientIdError();
816
849
  const r = this.getConfigApiUrl(this.runtimeConfig.isProd);
817
850
  this.CONFIG_API_URL = r;
818
851
  const n = `${r}?clientId=${this.runtimeConfig.clientId}&url=${encodeURIComponent(e)}`;
819
- I.debug("请求微信配置", { url: n });
852
+ E.debug("请求微信配置", { url: n });
820
853
  try {
821
854
  const i = yield fetch(n);
822
855
  if (!i.ok)
823
856
  throw new Error(`HTTP ${i.status}: ${i.statusText}`);
824
857
  const s = yield i.json();
825
- if (I.debug("微信配置响应", s), !s.success || s.code !== 200)
858
+ if (E.debug("微信配置响应", s), !s.success || s.code !== 200)
826
859
  throw new Error(`配置获取失败: ${s.message || "未知错误"}`);
827
860
  const { data: o } = s;
828
861
  if (!o || !o.appId || !o.timestamp || !o.nonceStr || !o.signature)
829
862
  throw new Error("配置数据格式不正确,缺少必需字段");
830
863
  return o;
831
864
  } catch (i) {
832
- if (I.error("获取微信配置失败", i), this.shouldUseTestMode(i))
833
- return I.warn("网络请求失败,降级到测试模式"), this.getMockConfig();
834
- throw new T(
835
- x.NETWORK_ERROR,
865
+ if (E.error("获取微信配置失败", i), this.shouldUseTestMode(i))
866
+ return E.warn("网络请求失败,降级到测试模式"), this.getMockConfig();
867
+ throw new N(
868
+ T.NETWORK_ERROR,
836
869
  `获取微信配置失败: ${i.message}`,
837
870
  { url: n, originalError: i }
838
871
  );
@@ -882,38 +915,41 @@ class ur {
882
915
  * @param {Object} configData - 配置数据
883
916
  * @private
884
917
  */
885
- executeWeixinConfig(e) {
918
+ executeWeixinConfig(e, r, n) {
886
919
  if (this.isTestMode() || e.appId === "wx_test_app_id") {
887
- I.info("测试模式:模拟微信配置成功"), setTimeout(() => {
888
- this.handleConfigSuccess();
920
+ E.info("测试模式:模拟微信配置成功"), setTimeout(() => {
921
+ this.handleConfigSuccess(r, n);
889
922
  }, 100);
890
923
  return;
891
924
  }
892
925
  if (!K())
893
926
  throw new Error("微信JS-SDK未加载");
894
- const r = {
895
- debug: !1,
896
- // 生产环境关闭调试
927
+ const i = {
928
+ debug: this.runtimeConfig.debug,
897
929
  appId: e.appId,
898
930
  timestamp: parseInt(e.timestamp),
899
931
  nonceStr: e.nonceStr,
900
932
  signature: e.signature,
901
933
  jsApiList: this.DEFAULT_JS_API_LIST
902
934
  };
903
- I.info("执行微信配置", r), window.wx.ready(this.handleConfigSuccess), window.wx.error(this.handleConfigError), window.wx.config(r);
935
+ E.info("执行微信配置", i), window.wx.ready(() => this.handleConfigSuccess(r, n)), window.wx.error((s) => this.handleConfigError(s, r, n)), window.wx.config(i);
904
936
  }
905
937
  /**
906
938
  * 处理配置成功
907
939
  * @private
908
940
  */
909
- handleConfigSuccess() {
910
- I.info("微信配置成功"), this.state = N.CONFIGURED, this.lastError = null, this.configPromise = null;
911
- const e = [...this.readyCallbacks];
912
- this.readyCallbacks = [], this.errorCallbacks = [], e.forEach((r) => {
941
+ handleConfigSuccess(e = this.configVersion, r = this.getRuntimeConfigKey()) {
942
+ if (!this.isCurrentConfigRun(e, r)) {
943
+ E.debug("忽略过期的微信配置成功回调");
944
+ return;
945
+ }
946
+ E.info("微信配置成功"), this.state = b.CONFIGURED, this.configuredConfigKey = r, this.lastError = null, this.configPromise = null;
947
+ const n = [...this.readyCallbacks];
948
+ this.readyCallbacks = [], this.errorCallbacks = [], n.forEach((i) => {
913
949
  try {
914
- r();
915
- } catch (n) {
916
- f.handleApiError(n, { context: "WeixinConfigManager.handleConfigSuccess" });
950
+ i();
951
+ } catch (s) {
952
+ d.handleApiError(s, { context: "WeixinConfigManager.handleConfigSuccess" });
917
953
  }
918
954
  });
919
955
  }
@@ -922,21 +958,25 @@ class ur {
922
958
  * @param {Object} res - 微信返回的错误信息
923
959
  * @private
924
960
  */
925
- handleConfigError(e) {
926
- const r = `微信配置验证失败: ${JSON.stringify(e)}`;
927
- I.error(r, e);
928
- const n = new T(
929
- x.API_CALL_FAILED,
930
- r,
961
+ handleConfigError(e, r = this.configVersion, n = this.getRuntimeConfigKey()) {
962
+ if (!this.isCurrentConfigRun(r, n)) {
963
+ E.debug("忽略过期的微信配置错误回调", e);
964
+ return;
965
+ }
966
+ const i = `微信配置验证失败: ${JSON.stringify(e)}`;
967
+ E.error(i, e);
968
+ const s = new N(
969
+ T.API_CALL_FAILED,
970
+ i,
931
971
  { weixinErrorResponse: e }
932
972
  );
933
- this.state = N.ERROR, this.lastError = n, this.configPromise = null;
934
- const i = [...this.errorCallbacks];
935
- this.readyCallbacks = [], this.errorCallbacks = [], i.forEach((s) => {
973
+ this.state = b.ERROR, this.lastError = s, this.configPromise = null;
974
+ const o = [...this.errorCallbacks];
975
+ this.readyCallbacks = [], this.errorCallbacks = [], o.forEach((l) => {
936
976
  try {
937
- s(n);
938
- } catch (o) {
939
- f.handleApiError(o, { context: "WeixinConfigManager.handleConfigError" });
977
+ l(s);
978
+ } catch (u) {
979
+ d.handleApiError(u, { context: "WeixinConfigManager.handleConfigError" });
940
980
  }
941
981
  });
942
982
  }
@@ -945,8 +985,18 @@ class ur {
945
985
  * @returns {Promise<void>} 配置完成的Promise
946
986
  */
947
987
  autoConfig() {
948
- return y(this, null, function* () {
949
- return this.hasRequiredConfig() ? this.state === N.CONFIGURED ? Promise.resolve() : this.state === N.ERROR ? Promise.reject(this.lastError) : this.configPromise ? this.configPromise : (this.state = N.CONFIGURING, this.configPromise = this.performAutoConfig(), this.configPromise) : (I.warn("clientId为空,等待qsh.config({ clientId })"), Promise.resolve());
988
+ return I(this, null, function* () {
989
+ if (!this.hasRequiredConfig())
990
+ return E.warn("clientId为空,等待qsh.config({ clientId })"), Promise.resolve();
991
+ if (this.isReady())
992
+ return Promise.resolve();
993
+ if (this.state === b.CONFIGURED && this.reset({ preserveCallbacks: !0 }), this.state === b.ERROR)
994
+ return Promise.reject(this.lastError);
995
+ if (this.configPromise)
996
+ return this.configPromise;
997
+ this.state = b.CONFIGURING;
998
+ const e = this.configVersion, r = this.getRuntimeConfigKey();
999
+ return this.configPromise = this.performAutoConfig(e, r), this.configPromise;
950
1000
  });
951
1001
  }
952
1002
  /**
@@ -954,36 +1004,44 @@ class ur {
954
1004
  * @returns {Promise<void>}
955
1005
  * @private
956
1006
  */
957
- performAutoConfig() {
958
- return y(this, null, function* () {
1007
+ performAutoConfig(e, r) {
1008
+ return I(this, null, function* () {
959
1009
  try {
960
1010
  if (typeof window == "undefined")
961
1011
  throw new Error("非浏览器环境无法执行微信配置");
962
1012
  if (!K())
963
1013
  throw new Error("微信JS-SDK未加载,无法执行配置");
964
- const e = yield this.fetchWeixinConfig();
965
- return this.executeWeixinConfig(e), yield new Promise((r, n) => {
966
- if (this.state === N.CONFIGURED) {
967
- r();
1014
+ const n = yield this.fetchWeixinConfig();
1015
+ if (!this.isCurrentConfigRun(e, r)) {
1016
+ E.debug("忽略过期的微信配置响应");
1017
+ return;
1018
+ }
1019
+ return this.executeWeixinConfig(n, e, r), yield new Promise((i, s) => {
1020
+ if (this.isReady()) {
1021
+ i();
968
1022
  return;
969
1023
  }
970
- if (this.state === N.ERROR) {
971
- n(this.lastError);
1024
+ if (this.state === b.ERROR) {
1025
+ s(this.lastError);
972
1026
  return;
973
1027
  }
974
- this.readyCallbacks.push(r), this.errorCallbacks.push(n);
1028
+ this.readyCallbacks.push(i), this.errorCallbacks.push(s);
975
1029
  });
976
- } catch (e) {
977
- const r = e instanceof T ? e : f.handleApiError(e, { context: "WeixinConfigManager.performAutoConfig" });
978
- this.state = N.ERROR, this.lastError = r, this.configPromise = null;
979
- const n = [...this.errorCallbacks];
980
- throw this.readyCallbacks = [], this.errorCallbacks = [], n.forEach((i) => {
1030
+ } catch (n) {
1031
+ if (!this.isCurrentConfigRun(e, r)) {
1032
+ E.debug("忽略过期的微信配置异常", n);
1033
+ return;
1034
+ }
1035
+ const i = n instanceof N ? n : d.handleApiError(n, { context: "WeixinConfigManager.performAutoConfig" });
1036
+ this.state = b.ERROR, this.lastError = i, this.configPromise = null;
1037
+ const s = [...this.errorCallbacks];
1038
+ throw this.readyCallbacks = [], this.errorCallbacks = [], s.forEach((o) => {
981
1039
  try {
982
- i(r);
983
- } catch (s) {
984
- f.handleApiError(s, { context: "WeixinConfigManager.performAutoConfig.errorCallback" });
1040
+ o(i);
1041
+ } catch (l) {
1042
+ d.handleApiError(l, { context: "WeixinConfigManager.performAutoConfig.errorCallback" });
985
1043
  }
986
- }), r;
1044
+ }), i;
987
1045
  }
988
1046
  });
989
1047
  }
@@ -992,16 +1050,16 @@ class ur {
992
1050
  * @returns {Promise<void>} 配置完成的Promise
993
1051
  */
994
1052
  waitForReady() {
995
- return this.state === N.CONFIGURED ? Promise.resolve() : this.state === N.ERROR ? Promise.reject(this.lastError) : this.hasRequiredConfig() ? this.state === N.UNINITIALIZED ? this.autoConfig() : new Promise((e, r) => {
1053
+ return this.isReady() ? Promise.resolve() : (this.state === b.CONFIGURED && this.reset({ preserveCallbacks: !0 }), this.state === b.ERROR ? Promise.reject(this.lastError) : this.hasRequiredConfig() ? this.state === b.UNINITIALIZED ? this.autoConfig() : new Promise((e, r) => {
996
1054
  this.readyCallbacks.push(e), this.errorCallbacks.push(r);
997
- }) : Promise.reject(this.createMissingClientIdError());
1055
+ }) : Promise.reject(this.createMissingClientIdError()));
998
1056
  }
999
1057
  /**
1000
1058
  * 检查配置状态
1001
1059
  * @returns {boolean} 是否已配置
1002
1060
  */
1003
1061
  isReady() {
1004
- return this.state === N.CONFIGURED;
1062
+ return this.state === b.CONFIGURED && this.configuredConfigKey === this.getRuntimeConfigKey();
1005
1063
  }
1006
1064
  /**
1007
1065
  * 获取当前状态
@@ -1020,8 +1078,9 @@ class ur {
1020
1078
  /**
1021
1079
  * 重置配置管理器(用于重试或测试)
1022
1080
  */
1023
- reset() {
1024
- this.state = N.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, I.debug("微信配置管理器已重置");
1081
+ reset(e = {}) {
1082
+ const { preserveCallbacks: r = !1 } = e;
1083
+ this.configVersion += 1, this.state = b.UNINITIALIZED, this.configPromise = null, r || (this.readyCallbacks = [], this.errorCallbacks = []), this.lastError = null, this.configuredConfigKey = null, E.debug("微信配置管理器已重置");
1025
1084
  }
1026
1085
  /**
1027
1086
  * 获取配置统计信息
@@ -1034,30 +1093,35 @@ class ur {
1034
1093
  errorCallbacksCount: this.errorCallbacks.length,
1035
1094
  hasConfigPromise: !!this.configPromise,
1036
1095
  hasLastError: !!this.lastError,
1096
+ configVersion: this.configVersion,
1097
+ configuredConfigKey: this.configuredConfigKey,
1037
1098
  configApiUrl: this.CONFIG_API_URL,
1038
1099
  clientId: this.runtimeConfig.clientId,
1039
1100
  isProd: this.runtimeConfig.isProd,
1101
+ debug: this.runtimeConfig.debug,
1102
+ url: this.runtimeConfig.url,
1103
+ effectiveUrl: this.getEffectiveConfigUrl(),
1040
1104
  jsApiList: this.DEFAULT_JS_API_LIST
1041
1105
  };
1042
1106
  }
1043
1107
  }
1044
- const b = new ur();
1108
+ const v = new ur();
1045
1109
  let re = !1, ge = !1, U = null, Pe = !1;
1046
1110
  function lr(t) {
1047
1111
  return new Promise((e) => {
1048
1112
  let r = !1, n = null;
1049
- const i = (d) => y(null, null, function* () {
1113
+ const i = (l) => I(null, null, function* () {
1050
1114
  if (!r) {
1051
- if (r = !0, n && clearTimeout(n), re = !1, ge = d, d)
1115
+ if (r = !0, n && clearTimeout(n), re = !1, ge = l, l)
1052
1116
  try {
1053
1117
  yield it();
1054
1118
  } catch (u) {
1055
- I.error("微信配置失败,将使用消息桥作为后备", u);
1119
+ E.error("微信配置失败,将使用消息桥作为后备", u);
1056
1120
  }
1057
1121
  e();
1058
1122
  }
1059
1123
  }), s = () => i(K()), o = () => {
1060
- I.warn("已存在的微信 JS-SDK 脚本加载失败,SDK 将使用消息桥作为后备"), i(!1);
1124
+ E.warn("已存在的微信 JS-SDK 脚本加载失败,SDK 将使用消息桥作为后备"), i(!1);
1061
1125
  };
1062
1126
  t.addEventListener("load", s, { once: !0 }), t.addEventListener("error", o, { once: !0 }), setTimeout(() => {
1063
1127
  K() && s();
@@ -1067,7 +1131,7 @@ function lr(t) {
1067
1131
  });
1068
1132
  }
1069
1133
  function We() {
1070
- return y(this, arguments, function* (t = {}) {
1134
+ return I(this, arguments, function* (t = {}) {
1071
1135
  const { force: e = !1, recoverFromError: r = !1 } = t;
1072
1136
  if (yield at({ force: e }), !K())
1073
1137
  throw new Error("微信 JS-SDK 未正确加载,无法执行配置");
@@ -1084,17 +1148,17 @@ function fr(t = !1) {
1084
1148
  return r && (n || i || s);
1085
1149
  }
1086
1150
  function dr() {
1087
- b.getState() === "error" && (b.reset(), Pe = !1);
1151
+ v.getState() === "error" && (v.reset(), Pe = !1);
1088
1152
  }
1089
1153
  function it() {
1090
- return y(this, null, function* () {
1154
+ return I(this, null, function* () {
1091
1155
  if (Pe)
1092
- return b.waitForReady();
1093
- Pe = !0, I.info("开始自动配置微信JS-SDK");
1156
+ return v.waitForReady();
1157
+ Pe = !0, E.info("开始自动配置微信JS-SDK");
1094
1158
  try {
1095
- yield b.autoConfig(), I.info("微信JS-SDK自动配置完成");
1159
+ yield v.autoConfig(), E.info("微信JS-SDK自动配置完成");
1096
1160
  } catch (t) {
1097
- I.error("微信JS-SDK自动配置失败", t);
1161
+ E.error("微信JS-SDK自动配置失败", t);
1098
1162
  }
1099
1163
  });
1100
1164
  }
@@ -1112,55 +1176,55 @@ function at(t = {}) {
1112
1176
  try {
1113
1177
  const i = document.createElement("script");
1114
1178
  i.id = "weixin-jssdk", i.type = "text/javascript", i.async = !0, i.src = "https://res.wx.qq.com/open/js/jweixin-1.6.2.js", i.onload = function() {
1115
- return y(this, null, function* () {
1116
- ge = !0, re = !1, I.info("微信 JS-SDK 已自动加载");
1179
+ return I(this, null, function* () {
1180
+ ge = !0, re = !1, E.info("微信 JS-SDK 已自动加载");
1117
1181
  try {
1118
1182
  yield it();
1119
1183
  } catch (o) {
1120
- I.error("微信配置失败,将使用消息桥作为后备", o);
1184
+ E.error("微信配置失败,将使用消息桥作为后备", o);
1121
1185
  }
1122
1186
  n();
1123
1187
  });
1124
1188
  }, i.onerror = function() {
1125
- re = !1, I.warn("微信 JS-SDK 加载失败,SDK 将使用消息桥作为后备"), n();
1189
+ re = !1, E.warn("微信 JS-SDK 加载失败,SDK 将使用消息桥作为后备"), n();
1126
1190
  }, (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(i);
1127
1191
  } catch (i) {
1128
- re = !1, I.error("注入微信 JS-SDK 失败", i), n();
1192
+ re = !1, E.error("注入微信 JS-SDK 失败", i), n();
1129
1193
  }
1130
1194
  }).finally(() => {
1131
1195
  U = null;
1132
1196
  }), U) : Promise.resolve();
1133
1197
  }
1134
1198
  function Q() {
1135
- return We({ force: !0, recoverFromError: !0 }).then(() => b.waitForReady());
1199
+ return We({ force: !0, recoverFromError: !0 }).then(() => v.waitForReady());
1136
1200
  }
1137
1201
  function He(t = {}) {
1138
- const e = b.configure(t);
1202
+ const e = v.configure(t);
1139
1203
  return typeof window == "undefined" || We({
1140
1204
  force: !0,
1141
- recoverFromError: b.getState() === "error"
1205
+ recoverFromError: v.getState() === "error"
1142
1206
  }).then(() => {
1143
- if (!b.isReady())
1144
- return b.waitForReady().catch((r) => {
1145
- I.error("Failed to auto-configure Weixin after qsh.config()", r);
1207
+ if (!v.isReady())
1208
+ return v.waitForReady().catch((r) => {
1209
+ E.error("Failed to auto-configure Weixin after qsh.config()", r);
1146
1210
  });
1147
- window.wx && !K() && I.warn("window.wx 已存在,但微信 JS-SDK 尚未就绪,跳过自动配置");
1211
+ window.wx && !K() && E.warn("window.wx 已存在,但微信 JS-SDK 尚未就绪,跳过自动配置");
1148
1212
  }).catch((r) => {
1149
- I.error("Failed to preload Weixin JS-SDK", r);
1213
+ E.error("Failed to preload Weixin JS-SDK", r);
1150
1214
  }), e;
1151
1215
  }
1152
1216
  function oe() {
1153
- return b.isReady();
1217
+ return v.isReady();
1154
1218
  }
1155
1219
  function gr() {
1156
- return b.getState();
1220
+ return v.getState();
1157
1221
  }
1158
1222
  function ve() {
1159
- return b;
1223
+ return v;
1160
1224
  }
1161
1225
  function hr() {
1162
- return y(this, null, function* () {
1163
- return I.info("手动重试微信配置"), b.reset(), Pe = !1, yield We({ force: !0 }), b.waitForReady();
1226
+ return I(this, null, function* () {
1227
+ return E.info("手动重试微信配置"), v.reset(), Pe = !1, yield We({ force: !0 }), v.waitForReady();
1164
1228
  });
1165
1229
  }
1166
1230
  class pr {
@@ -1175,7 +1239,7 @@ class pr {
1175
1239
  * pluginManager.register(imagePlugin)
1176
1240
  */
1177
1241
  register(e) {
1178
- return f.safeExecute(() => {
1242
+ return d.safeExecute(() => {
1179
1243
  this.validatePlugin(e);
1180
1244
  const { name: r, version: n } = e;
1181
1245
  if (this.plugins.has(r)) {
@@ -1215,8 +1279,8 @@ class pr {
1215
1279
  * await pluginManager.install('image', qsh)
1216
1280
  */
1217
1281
  install(e, r) {
1218
- return y(this, null, function* () {
1219
- return f.safeExecute(() => y(this, null, function* () {
1282
+ return I(this, null, function* () {
1283
+ return d.safeExecute(() => I(this, null, function* () {
1220
1284
  if (!this.plugins.has(e))
1221
1285
  throw new Error(`插件 ${e} 未注册`);
1222
1286
  if (this.installed.has(e)) {
@@ -1245,8 +1309,8 @@ class pr {
1245
1309
  * await pluginManager.uninstall('image', qsh)
1246
1310
  */
1247
1311
  uninstall(e, r) {
1248
- return y(this, null, function* () {
1249
- return f.safeExecute(() => y(this, null, function* () {
1312
+ return I(this, null, function* () {
1313
+ return d.safeExecute(() => I(this, null, function* () {
1250
1314
  if (!this.installed.has(e)) {
1251
1315
  a.debug(`插件 ${e} 未安装,跳过卸载`);
1252
1316
  return;
@@ -1267,7 +1331,7 @@ class pr {
1267
1331
  * @returns {Promise<void>}
1268
1332
  */
1269
1333
  uninstallAll(e) {
1270
- return y(this, null, function* () {
1334
+ return I(this, null, function* () {
1271
1335
  const r = [...this.installOrder].reverse();
1272
1336
  for (const n of r)
1273
1337
  yield this.uninstall(n, e);
@@ -1294,7 +1358,7 @@ class pr {
1294
1358
  * await pluginManager.installAll(['image', 'location'], qsh)
1295
1359
  */
1296
1360
  installAll(e, r) {
1297
- return y(this, null, function* () {
1361
+ return I(this, null, function* () {
1298
1362
  if (!Array.isArray(e))
1299
1363
  throw new Error("names 必须是数组");
1300
1364
  for (const n of e)
@@ -1416,7 +1480,7 @@ class mr {
1416
1480
  * @private
1417
1481
  */
1418
1482
  runRequest(e) {
1419
- return y(this, null, function* () {
1483
+ return I(this, null, function* () {
1420
1484
  let r = g({}, e);
1421
1485
  for (const { fn: n } of this.requestInterceptors) {
1422
1486
  if (r.abort) {
@@ -1442,7 +1506,7 @@ class mr {
1442
1506
  * @private
1443
1507
  */
1444
1508
  runResponse(e, r) {
1445
- return y(this, null, function* () {
1509
+ return I(this, null, function* () {
1446
1510
  let n = e;
1447
1511
  for (const { fn: i } of this.responseInterceptors)
1448
1512
  try {
@@ -1533,7 +1597,7 @@ function Er(t = {}) {
1533
1597
  shouldRetry: n = (i) => !i.success
1534
1598
  } = t;
1535
1599
  return {
1536
- response: (i, s) => y(null, null, function* () {
1600
+ response: (i, s) => I(null, null, function* () {
1537
1601
  return s.retryCount || (s.retryCount = 0), n(i) && s.retryCount < e && (s.retryCount++, a.warn(`API 调用失败,第 ${s.retryCount} 次重试: ${s.apiName}`), yield new Promise((o) => setTimeout(o, r)), i.shouldRetry = !0, i.retryContext = s), i;
1538
1602
  })
1539
1603
  };
@@ -1562,12 +1626,12 @@ class Ir {
1562
1626
  },
1563
1627
  // 平台信息
1564
1628
  platform: {
1565
- type: l.type,
1566
- isWeixinMiniProgram: l.isWeixinMiniProgram,
1567
- isAppPlus: l.isAppPlus,
1568
- isNvue: l.isNvue,
1569
- isUvue: l.isUvue,
1570
- isOfflineWebview: l.isOfflineWebview,
1629
+ type: f.type,
1630
+ isWeixinMiniProgram: f.isWeixinMiniProgram,
1631
+ isAppPlus: f.isAppPlus,
1632
+ isNvue: f.isNvue,
1633
+ isUvue: f.isUvue,
1634
+ isOfflineWebview: f.isOfflineWebview,
1571
1635
  features: {}
1572
1636
  // 平台支持的特性
1573
1637
  },
@@ -1617,7 +1681,7 @@ class Ir {
1617
1681
  * store.set('network.online', false)
1618
1682
  */
1619
1683
  set(e, r) {
1620
- const n = e.split("."), i = n.pop(), s = n.reduce((d, u) => ((!d[u] || typeof d[u] != "object") && (d[u] = {}), d[u]), this.state), o = s[i];
1684
+ const n = e.split("."), i = n.pop(), s = n.reduce((l, u) => ((!l[u] || typeof l[u] != "object") && (l[u] = {}), l[u]), this.state), o = s[i];
1621
1685
  o !== r && (s[i] = r, D.debug(`状态已更新: ${e}`, { oldValue: o, newValue: r }), this.notify(e, r, o));
1622
1686
  }
1623
1687
  /**
@@ -1680,20 +1744,20 @@ class Ir {
1680
1744
  i && i.forEach((o) => {
1681
1745
  try {
1682
1746
  o(r, n, e);
1683
- } catch (d) {
1684
- D.error("订阅者执行失败", d);
1747
+ } catch (l) {
1748
+ D.error("订阅者执行失败", l);
1685
1749
  }
1686
1750
  });
1687
1751
  const s = e.split(".");
1688
1752
  for (let o = 1; o < s.length; o++) {
1689
- const d = s.slice(0, o).join("."), u = this.listeners.get(d);
1753
+ const l = s.slice(0, o).join("."), u = this.listeners.get(l);
1690
1754
  if (u) {
1691
- const p = this.get(d);
1692
- u.forEach((C) => {
1755
+ const p = this.get(l);
1756
+ u.forEach((M) => {
1693
1757
  try {
1694
- C(p, void 0, d);
1695
- } catch (M) {
1696
- D.error("父路径订阅者执行失败", M);
1758
+ M(p, void 0, l);
1759
+ } catch (_) {
1760
+ D.error("父路径订阅者执行失败", _);
1697
1761
  }
1698
1762
  });
1699
1763
  }
@@ -1701,8 +1765,8 @@ class Ir {
1701
1765
  this.wildcardListeners.forEach((o) => {
1702
1766
  try {
1703
1767
  o(r, n, e);
1704
- } catch (d) {
1705
- D.error("通配符订阅者执行失败", d);
1768
+ } catch (l) {
1769
+ D.error("通配符订阅者执行失败", l);
1706
1770
  }
1707
1771
  });
1708
1772
  }
@@ -1964,7 +2028,7 @@ function st(t) {
1964
2028
  function Pr(t) {
1965
2029
  return t.includes("NET_") || t.includes("TIMEOUT") || t === c.NETWORK_ERROR || t === c.NETWORK_TIMEOUT || t === c.API_TIMEOUT;
1966
2030
  }
1967
- function _r(t) {
2031
+ function Cr(t) {
1968
2032
  return t.includes("CANCEL") || st(t) === W.USER_CANCEL;
1969
2033
  }
1970
2034
  function ne(t) {
@@ -1978,7 +2042,7 @@ class V extends Error {
1978
2042
  * @param {Object} options - 选项
1979
2043
  */
1980
2044
  constructor(e, r, n = {}) {
1981
- super(r), this.name = "StandardError", this.code = e, this.message = r || ne(e), this.platform = n.platform || l.type, this.apiName = n.apiName, this.category = n.category || st(e), this.retriable = n.retriable !== void 0 ? n.retriable : Pr(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
2045
+ super(r), this.name = "StandardError", this.code = e, this.message = r || ne(e), this.platform = n.platform || f.type, this.apiName = n.apiName, this.category = n.category || st(e), this.retriable = n.retriable !== void 0 ? n.retriable : Pr(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
1982
2046
  }
1983
2047
  /**
1984
2048
  * 是否可重试
@@ -1992,7 +2056,7 @@ class V extends Error {
1992
2056
  * @returns {boolean}
1993
2057
  */
1994
2058
  isUserAction() {
1995
- return _r(this.code);
2059
+ return Cr(this.code);
1996
2060
  }
1997
2061
  /**
1998
2062
  * 转为普通对象
@@ -2016,8 +2080,8 @@ class V extends Error {
2016
2080
  function ot(t, e = {}) {
2017
2081
  if (t instanceof V)
2018
2082
  return t;
2019
- const { apiName: r, platform: n = l.type } = e;
2020
- return t && typeof t.code == "string" && t.code.includes("/") ? Mr(t, { apiName: r, platform: n }) : t && (t.errMsg || t.message) ? Cr(t, { apiName: r, platform: n }) : typeof t == "string" ? new V(
2083
+ const { apiName: r, platform: n = f.type } = e;
2084
+ return t && typeof t.code == "string" && t.code.includes("/") ? _r(t, { apiName: r, platform: n }) : t && (t.errMsg || t.message) ? Mr(t, { apiName: r, platform: n }) : typeof t == "string" ? new V(
2021
2085
  c.UNKNOWN_ERROR,
2022
2086
  t,
2023
2087
  { apiName: r, platform: n, originalError: t }
@@ -2032,7 +2096,7 @@ function ot(t, e = {}) {
2032
2096
  }
2033
2097
  );
2034
2098
  }
2035
- function Mr(t, e) {
2099
+ function _r(t, e) {
2036
2100
  const { apiName: r, platform: n } = e, i = t.code, s = Ar[i] || c.UNKNOWN_ERROR;
2037
2101
  return a.debug("转换旧版错误码", {
2038
2102
  legacy: i,
@@ -2051,11 +2115,11 @@ function Mr(t, e) {
2051
2115
  }
2052
2116
  );
2053
2117
  }
2054
- function Cr(t, e) {
2118
+ function Mr(t, e) {
2055
2119
  const { apiName: r, platform: n } = e, i = (t.errMsg || t.message || "").toLowerCase();
2056
2120
  if (r && Ye[r]) {
2057
- const d = Ye[r];
2058
- for (const [u, p] of Object.entries(d))
2121
+ const l = Ye[r];
2122
+ for (const [u, p] of Object.entries(l))
2059
2123
  if (i.includes(u.toLowerCase()))
2060
2124
  return new V(p, ne(p), {
2061
2125
  apiName: r,
@@ -2064,8 +2128,8 @@ function Cr(t, e) {
2064
2128
  });
2065
2129
  }
2066
2130
  const s = ze[n] || ze.uniapp;
2067
- for (const { pattern: d, code: u } of s.patterns)
2068
- if (d.test(i))
2131
+ for (const { pattern: l, code: u } of s.patterns)
2132
+ if (l.test(i))
2069
2133
  return new V(u, ne(u), {
2070
2134
  apiName: r,
2071
2135
  platform: n,
@@ -2093,7 +2157,7 @@ const ct = {
2093
2157
  if (!t.success && t.error) {
2094
2158
  const r = ot(t.error, {
2095
2159
  apiName: e.apiName,
2096
- platform: l.type
2160
+ platform: f.type
2097
2161
  });
2098
2162
  t.error = r.toJSON(), t.errorCode = r.code, t.errorCategory = r.category, t.retriable = r.isRetriable(), a.debug("错误已标准化", {
2099
2163
  api: e.apiName,
@@ -2117,7 +2181,7 @@ function Or(t, e, r) {
2117
2181
  ]) : t();
2118
2182
  }
2119
2183
  function Nr() {
2120
- return y(this, arguments, function* (t = [], e = {}) {
2184
+ return I(this, arguments, function* (t = [], e = {}) {
2121
2185
  for (const r of t) {
2122
2186
  const n = (r == null ? void 0 : r.name) || "anonymous-task", i = (r == null ? void 0 : r.run) || r;
2123
2187
  if (typeof i == "function")
@@ -2259,7 +2323,7 @@ class ut {
2259
2323
  }
2260
2324
  }
2261
2325
  let de = [];
2262
- function Tr() {
2326
+ function br() {
2263
2327
  if (de.length === 0 && window.plus) {
2264
2328
  const t = plus.webview.currentWebview();
2265
2329
  if (!t)
@@ -2269,7 +2333,7 @@ function Tr() {
2269
2333
  }
2270
2334
  return de;
2271
2335
  }
2272
- function br(t, e) {
2336
+ function Tr(t, e) {
2273
2337
  const r = {
2274
2338
  options: {
2275
2339
  timestamp: +/* @__PURE__ */ new Date()
@@ -2318,7 +2382,7 @@ function Lr(t, e) {
2318
2382
  },
2319
2383
  name: t,
2320
2384
  arg: e
2321
- }, n = Tr();
2385
+ }, n = br();
2322
2386
  if (plus.webview.getWebviewById("__uniapp__service"))
2323
2387
  plus.webview.postMessageToUniNView({
2324
2388
  type: "WEB_INVOKE_APPSERVICE",
@@ -2368,7 +2432,7 @@ function Ur(t, e) {
2368
2432
  });
2369
2433
  }
2370
2434
  function he(t, e) {
2371
- Se() ? br(t, e) : Re() ? vr(t, e) : Z() ? Ur(t, e) : Ce() ? Lr(t, e) : xr(t, e);
2435
+ Se() ? Tr(t, e) : Re() ? vr(t, e) : Z() ? Ur(t, e) : Me() ? Lr(t, e) : xr(t, e);
2372
2436
  }
2373
2437
  class lt extends ut {
2374
2438
  constructor() {
@@ -2389,17 +2453,17 @@ class lt extends ut {
2389
2453
  * @returns {void}
2390
2454
  */
2391
2455
  performNavigation(e, r) {
2392
- return f.safeExecute(() => {
2456
+ return d.safeExecute(() => {
2393
2457
  const { url: n, delta: i } = r;
2394
- if (I.debug(`微信平台执行导航操作: ${e}`, r), this.isWeixinApiAvailable()) {
2458
+ if (E.debug(`微信平台执行导航操作: ${e}`, r), this.isWeixinApiAvailable()) {
2395
2459
  const o = window.wx.miniProgram[e];
2396
2460
  if (typeof o == "function") {
2397
- I.debug(`使用微信原生 API: wx.miniProgram.${e}`);
2398
- const d = e === "navigateBack" ? { delta: i } : { url: n };
2399
- return o.call(window.wx.miniProgram, d);
2461
+ E.debug(`使用微信原生 API: wx.miniProgram.${e}`);
2462
+ const l = e === "navigateBack" ? { delta: i } : { url: n };
2463
+ return o.call(window.wx.miniProgram, l);
2400
2464
  }
2401
2465
  }
2402
- I.debug(`使用消息桥接执行: ${e}`), he(e, e === "navigateBack" ? { delta: i } : { url: n });
2466
+ E.debug(`使用消息桥接执行: ${e}`), he(e, e === "navigateBack" ? { delta: i } : { url: n });
2403
2467
  }, {
2404
2468
  platform: this.name,
2405
2469
  method: "performNavigation",
@@ -2413,7 +2477,7 @@ class lt extends ut {
2413
2477
  * @returns {void}
2414
2478
  */
2415
2479
  performPostMessage(e) {
2416
- return f.safeExecute(() => {
2480
+ return d.safeExecute(() => {
2417
2481
  const { data: r } = e;
2418
2482
  if (this.isWeixinApiAvailable())
2419
2483
  return window.wx.miniProgram.postMessage({ data: r });
@@ -2430,7 +2494,7 @@ class lt extends ut {
2430
2494
  * @returns {void}
2431
2495
  */
2432
2496
  performGetEnv(e) {
2433
- return f.safeExecute(() => {
2497
+ return d.safeExecute(() => {
2434
2498
  if (!e || typeof e != "function")
2435
2499
  throw new Error("Callback function is required for getEnv");
2436
2500
  if (this.isWeixinApiAvailable() && window.wx.miniProgram.getEnv)
@@ -2445,7 +2509,7 @@ class lt extends ut {
2445
2509
  });
2446
2510
  }
2447
2511
  }
2448
- const ee = new lt(), Wr = (t) => ee.navigateTo(t), $r = (t) => ee.navigateBack(t), Fr = (t) => ee.switchTab(t), Br = (t) => ee.reLaunch(t), kr = (t) => ee.redirectTo(t), Gr = (t) => ee.postMessage(t), Kr = (t) => ee.getEnv(t);
2512
+ const ee = new lt(), Wr = (t) => ee.navigateTo(t), $r = (t) => ee.navigateBack(t), Fr = (t) => ee.switchTab(t), kr = (t) => ee.reLaunch(t), Br = (t) => ee.redirectTo(t), Gr = (t) => ee.postMessage(t), Kr = (t) => ee.getEnv(t);
2449
2513
  var ft = /* @__PURE__ */ Object.freeze({
2450
2514
  __proto__: null,
2451
2515
  WeixinPlatform: lt,
@@ -2453,8 +2517,8 @@ var ft = /* @__PURE__ */ Object.freeze({
2453
2517
  navigateBack: $r,
2454
2518
  navigateTo: Wr,
2455
2519
  postMessage: Gr,
2456
- reLaunch: Br,
2457
- redirectTo: kr,
2520
+ reLaunch: kr,
2521
+ redirectTo: Br,
2458
2522
  switchTab: Fr
2459
2523
  });
2460
2524
  class dt extends ut {
@@ -2468,7 +2532,7 @@ class dt extends ut {
2468
2532
  * @returns {void}
2469
2533
  */
2470
2534
  performNavigation(e, r) {
2471
- return f.safeExecute(() => {
2535
+ return d.safeExecute(() => {
2472
2536
  const { url: n, delta: i } = r;
2473
2537
  he(e, e === "navigateBack" ? { delta: i } : { url: n });
2474
2538
  }, {
@@ -2484,7 +2548,7 @@ class dt extends ut {
2484
2548
  * @returns {void}
2485
2549
  */
2486
2550
  performPostMessage(e) {
2487
- return f.safeExecute(() => {
2551
+ return d.safeExecute(() => {
2488
2552
  const { data: r } = e;
2489
2553
  he("postMessage", r);
2490
2554
  }, {
@@ -2499,12 +2563,12 @@ class dt extends ut {
2499
2563
  * @returns {void}
2500
2564
  */
2501
2565
  performGetEnv(e) {
2502
- return f.safeExecute(() => {
2566
+ return d.safeExecute(() => {
2503
2567
  if (!e || typeof e != "function")
2504
2568
  throw new Error("Callback function is required for getEnv");
2505
2569
  const r = {};
2506
2570
  let n = !1;
2507
- Se() ? (r.uvue = !0, n = !0) : Re() ? (r.nvue = !0, n = !0) : Ce() ? (r.plus = !0, n = !0) : Z() && (r.offline = !0, n = !0), n ? r.app = !0 : r.h5 = !0, e(r);
2571
+ Se() ? (r.uvue = !0, n = !0) : Re() ? (r.nvue = !0, n = !0) : Me() ? (r.plus = !0, n = !0) : Z() && (r.offline = !0, n = !0), n ? r.app = !0 : r.h5 = !0, e(r);
2508
2572
  }, {
2509
2573
  platform: this.name,
2510
2574
  method: "performGetEnv"
@@ -2524,7 +2588,7 @@ var gt = /* @__PURE__ */ Object.freeze({
2524
2588
  switchTab: jr
2525
2589
  });
2526
2590
  function me() {
2527
- return _() ? ft : gt;
2591
+ return C() ? ft : gt;
2528
2592
  }
2529
2593
  function Xr(t) {
2530
2594
  return me().navigateTo(t);
@@ -2542,7 +2606,7 @@ function tn(t) {
2542
2606
  return me().redirectTo(t);
2543
2607
  }
2544
2608
  function ht() {
2545
- return _() ? ft : gt;
2609
+ return C() ? ft : gt;
2546
2610
  }
2547
2611
  function rn(t = {}) {
2548
2612
  return ht().postMessage(t);
@@ -2568,15 +2632,15 @@ class on {
2568
2632
  * @returns {void}
2569
2633
  */
2570
2634
  callApi(i) {
2571
- return y(this, arguments, function* (e, r = {}, n = {}) {
2572
- return f.safeExecute(() => y(this, null, function* () {
2635
+ return I(this, arguments, function* (e, r = {}, n = {}) {
2636
+ return d.safeExecute(() => I(this, null, function* () {
2573
2637
  var p;
2574
2638
  if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_ && !Z()) {
2575
- const C = new T(
2576
- x.PLATFORM_NOT_SUPPORTED,
2639
+ const M = new N(
2640
+ T.PLATFORM_NOT_SUPPORTED,
2577
2641
  "当前不在宿主 WebView 容器中,无法发送消息"
2578
2642
  );
2579
- n && typeof n.fail == "function" && n.fail({ errMsg: C.message, code: "NOT_IN_CONTAINER" }), n && typeof n.complete == "function" && n.complete({ success: !1, error: { errMsg: C.message } });
2643
+ n && typeof n.fail == "function" && n.fail({ errMsg: M.message, code: "NOT_IN_CONTAINER" }), n && typeof n.complete == "function" && n.complete({ success: !1, error: { errMsg: M.message } });
2580
2644
  return;
2581
2645
  }
2582
2646
  const o = {
@@ -2588,10 +2652,10 @@ class on {
2588
2652
  metadata: {}
2589
2653
  };
2590
2654
  G.setApiLoading(e, !0);
2591
- const d = yield z.runRequest(o);
2592
- if (d.abort) {
2655
+ const l = yield z.runRequest(o);
2656
+ if (l.abort) {
2593
2657
  A.warn("API 调用被拦截器中止", { api: e }), G.setApiLoading(e, !1), n.fail && n.fail({
2594
- errMsg: ((p = d.error) == null ? void 0 : p.message) || "API 调用被中止",
2658
+ errMsg: ((p = l.error) == null ? void 0 : p.message) || "API 调用被中止",
2595
2659
  code: "INTERCEPTED"
2596
2660
  }), n.complete && n.complete({ success: !1 });
2597
2661
  return;
@@ -2599,7 +2663,7 @@ class on {
2599
2663
  const u = sn();
2600
2664
  if (n.success || n.fail || n.complete) {
2601
2665
  if (this.callbacks.set(u, m(g({}, n), {
2602
- context: d
2666
+ context: l
2603
2667
  // 保存上下文用于响应拦截
2604
2668
  })), window.qshWebviewCallbacks[u] = ($) => {
2605
2669
  this.handleCallback(u, $);
@@ -2618,10 +2682,10 @@ class on {
2618
2682
  }, r.timeout || this.defaultTimeout);
2619
2683
  this.timeouts.set(u, $);
2620
2684
  }
2621
- const M = {
2685
+ const _ = {
2622
2686
  type: "qsh_api_call",
2623
2687
  api: e,
2624
- params: d.params,
2688
+ params: l.params,
2625
2689
  callbackId: u,
2626
2690
  timestamp: Date.now()
2627
2691
  };
@@ -2630,7 +2694,7 @@ class on {
2630
2694
  callbackId: u,
2631
2695
  hasSuccess: !!n.success,
2632
2696
  hasFail: !!n.fail
2633
- }), console.log("message:", JSON.stringify(an(M), null, 2)), he("postMessage", M);
2697
+ }), console.log("message:", JSON.stringify(an(_), null, 2)), he("postMessage", _);
2634
2698
  }
2635
2699
  }), {
2636
2700
  context: "WebViewBridge.callApi",
@@ -2645,18 +2709,18 @@ class on {
2645
2709
  * @private
2646
2710
  */
2647
2711
  handleCallback(e, r) {
2648
- return y(this, null, function* () {
2649
- return f.safeExecute(() => y(this, null, function* () {
2650
- var C, M;
2712
+ return I(this, null, function* () {
2713
+ return d.safeExecute(() => I(this, null, function* () {
2714
+ var M, _;
2651
2715
  const n = this.callbacks.get(e);
2652
2716
  if (!n) {
2653
2717
  A.warn("未找到回调函数", { callbackId: e });
2654
2718
  return;
2655
2719
  }
2656
- const { success: i, fail: s, complete: o, context: d } = n;
2720
+ const { success: i, fail: s, complete: o, context: l } = n;
2657
2721
  A.debug("处理回调", { callbackId: e, result: r });
2658
- const u = yield z.runResponse(r, d);
2659
- d && G.setApiResult(d.apiName, u), u.success && i ? i(u.data) : !u.success && s && s(u.error || { errMsg: "操作失败" }), o && o(u), ((M = (C = n.context) == null ? void 0 : C.params) == null ? void 0 : M.isPersistent) ? A.debug("持久监听API:保留回调", { callbackId: e }) : (this.cleanupCallback(e), A.debug("回调执行完成,已清理", { callbackId: e }));
2722
+ const u = yield z.runResponse(r, l);
2723
+ l && G.setApiResult(l.apiName, u), u.success && i ? i(u.data) : !u.success && s && s(u.error || { errMsg: "操作失败" }), o && o(u), ((_ = (M = n.context) == null ? void 0 : M.params) == null ? void 0 : _.isPersistent) ? A.debug("持久监听API:保留回调", { callbackId: e }) : (this.cleanupCallback(e), A.debug("回调执行完成,已清理", { callbackId: e }));
2660
2724
  }), {
2661
2725
  context: "WebViewBridge.handleCallback",
2662
2726
  callbackId: e
@@ -2717,7 +2781,7 @@ function cn(t) {
2717
2781
  return t === "offline";
2718
2782
  }
2719
2783
  function un(t = {}) {
2720
- return f.safeExecute(() => {
2784
+ return d.safeExecute(() => {
2721
2785
  a.debug("Call getCode through offline webview bridge", {
2722
2786
  clientId: t.clientId
2723
2787
  }), O(
@@ -2743,7 +2807,7 @@ function un(t = {}) {
2743
2807
  });
2744
2808
  }
2745
2809
  function ln(t = {}) {
2746
- return f.safeExecute(() => {
2810
+ return d.safeExecute(() => {
2747
2811
  var n, i;
2748
2812
  const e = mt(), r = String((t == null ? void 0 : t.clientId) || "").trim();
2749
2813
  if (!r) {
@@ -2803,7 +2867,7 @@ function dn() {
2803
2867
  return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.postMessage == "function" && typeof window.wx.miniProgram.navigateBack == "function";
2804
2868
  }
2805
2869
  function gn(t = {}) {
2806
- return f.safeExecute(() => {
2870
+ return d.safeExecute(() => {
2807
2871
  var r;
2808
2872
  if (!dn()) {
2809
2873
  const n = {
@@ -2839,18 +2903,18 @@ function gn(t = {}) {
2839
2903
  delta: 1,
2840
2904
  success: (o) => {
2841
2905
  var u;
2842
- const d = m(g({}, o), {
2906
+ const l = m(g({}, o), {
2843
2907
  errMsg: (o == null ? void 0 : o.errMsg) || "navigateToMiniProgram:queued"
2844
2908
  });
2845
2909
  a.info("Navigate to mini program request queued in weixin web-view", {
2846
2910
  appid: t.appid,
2847
2911
  path: t.path,
2848
2912
  env: t.env
2849
- }), (u = t.success) == null || u.call(t, d), n(d);
2913
+ }), (u = t.success) == null || u.call(t, l), n(l);
2850
2914
  },
2851
2915
  fail: (o) => {
2852
- var d;
2853
- a.error("Navigate back after posting mini program message failed", o), (d = t.fail) == null || d.call(t, o), i(o);
2916
+ var l;
2917
+ a.error("Navigate back after posting mini program message failed", o), (l = t.fail) == null || l.call(t, o), i(o);
2854
2918
  },
2855
2919
  complete: t.complete
2856
2920
  });
@@ -2861,7 +2925,7 @@ function gn(t = {}) {
2861
2925
  });
2862
2926
  }
2863
2927
  function hn(t = {}) {
2864
- return f.safeExecute(() => (a.debug("Call navigateToMiniProgram through webview bridge", {
2928
+ return d.safeExecute(() => (a.debug("Call navigateToMiniProgram through webview bridge", {
2865
2929
  appid: t.appid,
2866
2930
  path: t.path,
2867
2931
  env: t.env
@@ -2891,7 +2955,7 @@ function hn(t = {}) {
2891
2955
  });
2892
2956
  }
2893
2957
  function pn(t = {}) {
2894
- return f.safeExecute(() => {
2958
+ return d.safeExecute(() => {
2895
2959
  var n;
2896
2960
  const e = wt();
2897
2961
  let r;
@@ -3014,9 +3078,9 @@ function An(t) {
3014
3078
  });
3015
3079
  }
3016
3080
  function Et(t = {}) {
3017
- return f.safeExecute(
3081
+ return d.safeExecute(
3018
3082
  () => {
3019
- var n, i, s, o, d, u;
3083
+ var n, i, s, o, l, u;
3020
3084
  const e = H(!0);
3021
3085
  let r;
3022
3086
  try {
@@ -3036,14 +3100,14 @@ function Et(t = {}) {
3036
3100
  errMsg: "wx.miniProgram.postMessage or wx.miniProgram.navigateBack is not available",
3037
3101
  code: "PLATFORM_NOT_SUPPORTED"
3038
3102
  };
3039
- return (d = r.fail) == null || d.call(r, p), (u = r.complete) == null || u.call(r, p), Promise.reject(p);
3103
+ return (l = r.fail) == null || l.call(r, p), (u = r.complete) == null || u.call(r, p), Promise.reject(p);
3040
3104
  }
3041
3105
  return An(r).then((p) => {
3042
- var C, M;
3043
- return (C = r.success) == null || C.call(r, p), (M = r.complete) == null || M.call(r, p), p;
3106
+ var M, _;
3107
+ return (M = r.success) == null || M.call(r, p), (_ = r.complete) == null || _.call(r, p), p;
3044
3108
  }).catch((p) => {
3045
- var C, M;
3046
- return (C = r.fail) == null || C.call(r, p), (M = r.complete) == null || M.call(r, p), Promise.reject(p);
3109
+ var M, _;
3110
+ return (M = r.fail) == null || M.call(r, p), (_ = r.complete) == null || _.call(r, p), Promise.reject(p);
3047
3111
  });
3048
3112
  },
3049
3113
  {
@@ -3060,30 +3124,30 @@ function Pn(t = {}) {
3060
3124
  }));
3061
3125
  });
3062
3126
  }
3063
- const _e = {
3127
+ const Ce = {
3064
3128
  ALBUM: "album",
3065
3129
  // 相册
3066
3130
  CAMERA: "camera"
3067
3131
  // 相机
3068
- }, Me = {
3132
+ }, _e = {
3069
3133
  ORIGINAL: "original",
3070
3134
  // 原图
3071
3135
  COMPRESSED: "compressed"
3072
3136
  // 压缩图
3073
- }, _n = {
3137
+ }, Cn = {
3074
3138
  count: 9,
3075
- sizeType: [Me.ORIGINAL, Me.COMPRESSED],
3076
- sourceType: [_e.ALBUM, _e.CAMERA]
3139
+ sizeType: [_e.ORIGINAL, _e.COMPRESSED],
3140
+ sourceType: [Ce.ALBUM, Ce.CAMERA]
3077
3141
  };
3078
- function Mn(t = {}) {
3079
- const e = g(g({}, _n), t);
3080
- return Array.isArray(e.sizeType) || (e.sizeType = [e.sizeType].filter(Boolean)), Array.isArray(e.sourceType) || (e.sourceType = [e.sourceType].filter(Boolean)), e.count = Math.max(1, Math.min(9, parseInt(e.count) || 1)), e.sizeType.length === 0 && (e.sizeType = [Me.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [_e.ALBUM]), e;
3142
+ function _n(t = {}) {
3143
+ const e = g(g({}, Cn), t);
3144
+ return Array.isArray(e.sizeType) || (e.sizeType = [e.sizeType].filter(Boolean)), Array.isArray(e.sourceType) || (e.sourceType = [e.sourceType].filter(Boolean)), e.count = Math.max(1, Math.min(9, parseInt(e.count) || 1)), e.sizeType.length === 0 && (e.sizeType = [_e.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [Ce.ALBUM]), e;
3081
3145
  }
3082
3146
  function yt() {
3083
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
3147
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
3084
3148
  }
3085
3149
  function It(t) {
3086
- return f.safeExecute(() => {
3150
+ return d.safeExecute(() => {
3087
3151
  var e;
3088
3152
  if (!window.wx) {
3089
3153
  const r = {
@@ -3119,8 +3183,8 @@ function It(t) {
3119
3183
  platform: "weixin"
3120
3184
  });
3121
3185
  }
3122
- function Cn(t) {
3123
- return f.safeExecute(() => {
3186
+ function Mn(t) {
3187
+ return d.safeExecute(() => {
3124
3188
  a.debug("通过 WebView 桥接调用图片选择", t), O("chooseImage", m(g({}, t), { disableTimeout: !0 }), {
3125
3189
  success: (e) => {
3126
3190
  var r, n;
@@ -3140,23 +3204,23 @@ function Cn(t) {
3140
3204
  });
3141
3205
  }
3142
3206
  function Rn(t = {}) {
3143
- return f.safeExecute(() => {
3207
+ return d.safeExecute(() => {
3144
3208
  var r;
3145
3209
  if (!yt()) {
3146
3210
  const n = {
3147
- errMsg: `当前环境 (${l.type}) 不支持图片选择功能`,
3211
+ errMsg: `当前环境 (${f.type}) 不支持图片选择功能`,
3148
3212
  code: "PLATFORM_NOT_SUPPORTED"
3149
3213
  };
3150
- a.error("平台不支持图片选择", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
3214
+ a.error("平台不支持图片选择", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
3151
3215
  return;
3152
3216
  }
3153
- const e = Mn(t);
3217
+ const e = _n(t);
3154
3218
  a.info("开始选择图片", {
3155
- platform: l.type,
3219
+ platform: f.type,
3156
3220
  count: e.count,
3157
3221
  sizeType: e.sizeType,
3158
3222
  sourceType: e.sourceType
3159
- }), _() ? It(e) : Cn(e);
3223
+ }), C() ? It(e) : Mn(e);
3160
3224
  }, {
3161
3225
  context: "chooseImage",
3162
3226
  options: t
@@ -3165,8 +3229,8 @@ function Rn(t = {}) {
3165
3229
  function Sn() {
3166
3230
  return {
3167
3231
  supported: yt(),
3168
- environment: l.type,
3169
- implementation: _() ? "weixin" : "webview",
3232
+ environment: f.type,
3233
+ implementation: C() ? "weixin" : "webview",
3170
3234
  features: {
3171
3235
  multipleSelection: !0,
3172
3236
  // 支持多选
@@ -3199,10 +3263,10 @@ function Nn(t = {}) {
3199
3263
  return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [X.QR_CODE, X.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
3200
3264
  }
3201
3265
  function At() {
3202
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
3266
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
3203
3267
  }
3204
3268
  function Pt(t) {
3205
- return f.safeExecute(() => {
3269
+ return d.safeExecute(() => {
3206
3270
  var e;
3207
3271
  if (!window.wx) {
3208
3272
  const r = {
@@ -3229,7 +3293,7 @@ function Pt(t) {
3229
3293
  const n = {
3230
3294
  result: r.resultStr,
3231
3295
  // 扫码内容
3232
- scanType: Tn(r.resultStr),
3296
+ scanType: bn(r.resultStr),
3233
3297
  // 推测扫码类型
3234
3298
  charSet: "utf-8",
3235
3299
  // 微信默认 UTF-8
@@ -3248,11 +3312,11 @@ function Pt(t) {
3248
3312
  platform: "weixin"
3249
3313
  });
3250
3314
  }
3251
- function Tn(t) {
3315
+ function bn(t) {
3252
3316
  return t ? t.length > 50 || /[^\d]/.test(t) ? X.QR_CODE : X.BAR_CODE : "unknown";
3253
3317
  }
3254
- function bn(t) {
3255
- return f.safeExecute(() => {
3318
+ function Tn(t) {
3319
+ return d.safeExecute(() => {
3256
3320
  a.debug("通过 WebView 桥接调用扫码", t), O("scanCode", m(g({}, t), { disableTimeout: !0 }), {
3257
3321
  success: (e) => {
3258
3322
  var r;
@@ -3273,22 +3337,22 @@ function bn(t) {
3273
3337
  });
3274
3338
  }
3275
3339
  function vn(t = {}) {
3276
- return f.safeExecute(() => {
3340
+ return d.safeExecute(() => {
3277
3341
  var r;
3278
3342
  if (!At()) {
3279
3343
  const n = {
3280
- errMsg: `当前环境 (${l.type}) 不支持扫码功能`,
3344
+ errMsg: `当前环境 (${f.type}) 不支持扫码功能`,
3281
3345
  code: "PLATFORM_NOT_SUPPORTED"
3282
3346
  };
3283
- a.error("平台不支持扫码", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
3347
+ a.error("平台不支持扫码", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
3284
3348
  return;
3285
3349
  }
3286
3350
  const e = Nn(t);
3287
3351
  a.info("开始扫码", {
3288
- platform: l.type,
3352
+ platform: f.type,
3289
3353
  onlyFromCamera: e.onlyFromCamera,
3290
3354
  scanType: e.scanType
3291
- }), _() ? Pt(e) : bn(e);
3355
+ }), C() ? Pt(e) : Tn(e);
3292
3356
  }, {
3293
3357
  context: "scanCode",
3294
3358
  options: t
@@ -3297,8 +3361,8 @@ function vn(t = {}) {
3297
3361
  function Ln() {
3298
3362
  return {
3299
3363
  supported: At(),
3300
- environment: l.type,
3301
- implementation: _() ? "weixin" : "webview",
3364
+ environment: f.type,
3365
+ implementation: C() ? "weixin" : "webview",
3302
3366
  features: {
3303
3367
  onlyFromCamera: !0,
3304
3368
  // 支持只从相机扫码
@@ -3394,10 +3458,10 @@ function $n(t = {}) {
3394
3458
  return e;
3395
3459
  }
3396
3460
  function $e() {
3397
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
3461
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
3398
3462
  }
3399
- function _t(t) {
3400
- return f.safeExecute(() => {
3463
+ function Ct(t) {
3464
+ return d.safeExecute(() => {
3401
3465
  var e;
3402
3466
  if (!window.wx) {
3403
3467
  const r = {
@@ -3408,7 +3472,7 @@ function _t(t) {
3408
3472
  return;
3409
3473
  }
3410
3474
  if (!oe()) {
3411
- a.info("等待微信配置完成"), Q().then(() => _t(t)).catch((r) => {
3475
+ a.info("等待微信配置完成"), Q().then(() => Ct(t)).catch((r) => {
3412
3476
  var n;
3413
3477
  a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
3414
3478
  });
@@ -3434,8 +3498,8 @@ function _t(t) {
3434
3498
  platform: "weixin"
3435
3499
  });
3436
3500
  }
3437
- function Mt(t) {
3438
- return f.safeExecute(() => {
3501
+ function _t(t) {
3502
+ return d.safeExecute(() => {
3439
3503
  var e;
3440
3504
  if (!window.wx) {
3441
3505
  const r = {
@@ -3446,7 +3510,7 @@ function Mt(t) {
3446
3510
  return;
3447
3511
  }
3448
3512
  if (!oe()) {
3449
- a.info("等待微信配置完成"), Q().then(() => Mt(t)).catch((r) => {
3513
+ a.info("等待微信配置完成"), Q().then(() => _t(t)).catch((r) => {
3450
3514
  var n;
3451
3515
  a.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
3452
3516
  });
@@ -3475,7 +3539,7 @@ function Mt(t) {
3475
3539
  });
3476
3540
  }
3477
3541
  function Fn(t) {
3478
- return f.safeExecute(() => {
3542
+ return d.safeExecute(() => {
3479
3543
  a.debug("通过 WebView 桥接调用获取位置", t), O("getLocation", t, {
3480
3544
  success: (e) => {
3481
3545
  var r;
@@ -3495,8 +3559,8 @@ function Fn(t) {
3495
3559
  platform: "uniapp"
3496
3560
  });
3497
3561
  }
3498
- function Bn(t) {
3499
- return f.safeExecute(() => {
3562
+ function kn(t) {
3563
+ return d.safeExecute(() => {
3500
3564
  a.debug("通过 WebView 桥接调用查看位置", t), O("openLocation", t, {
3501
3565
  success: (e) => {
3502
3566
  var r;
@@ -3513,37 +3577,37 @@ function Bn(t) {
3513
3577
  platform: "uniapp"
3514
3578
  });
3515
3579
  }
3516
- function kn(t = {}) {
3517
- return f.safeExecute(() => {
3580
+ function Bn(t = {}) {
3581
+ return d.safeExecute(() => {
3518
3582
  var r;
3519
3583
  if (!$e()) {
3520
3584
  const n = {
3521
- errMsg: `当前环境 (${l.type}) 不支持定位功能`,
3585
+ errMsg: `当前环境 (${f.type}) 不支持定位功能`,
3522
3586
  code: "PLATFORM_NOT_SUPPORTED"
3523
3587
  };
3524
- a.error("平台不支持定位", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
3588
+ a.error("平台不支持定位", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
3525
3589
  return;
3526
3590
  }
3527
3591
  const e = Un(t);
3528
3592
  a.info("开始获取位置", {
3529
- platform: l.type,
3593
+ platform: f.type,
3530
3594
  type: e.type,
3531
3595
  altitude: e.altitude
3532
- }), _() ? _t(e) : Fn(e);
3596
+ }), C() ? Ct(e) : Fn(e);
3533
3597
  }, {
3534
3598
  context: "getLocation",
3535
3599
  options: t
3536
3600
  });
3537
3601
  }
3538
3602
  function Gn(t = {}) {
3539
- return f.safeExecute(() => {
3603
+ return d.safeExecute(() => {
3540
3604
  var r, n, i;
3541
3605
  if (!$e()) {
3542
3606
  const s = {
3543
- errMsg: `当前环境 (${l.type}) 不支持查看位置功能`,
3607
+ errMsg: `当前环境 (${f.type}) 不支持查看位置功能`,
3544
3608
  code: "PLATFORM_NOT_SUPPORTED"
3545
3609
  };
3546
- a.error("平台不支持查看位置", { platform: l.type }), (r = t.fail) == null || r.call(t, s);
3610
+ a.error("平台不支持查看位置", { platform: f.type }), (r = t.fail) == null || r.call(t, s);
3547
3611
  return;
3548
3612
  }
3549
3613
  let e;
@@ -3554,21 +3618,21 @@ function Gn(t = {}) {
3554
3618
  return;
3555
3619
  }
3556
3620
  a.info("开始查看位置", {
3557
- platform: l.type,
3621
+ platform: f.type,
3558
3622
  latitude: e.latitude,
3559
3623
  longitude: e.longitude,
3560
3624
  name: e.name
3561
- }), _() ? Mt(e) : Bn(e);
3625
+ }), C() ? _t(e) : kn(e);
3562
3626
  }, {
3563
3627
  context: "openLocation",
3564
3628
  options: t
3565
3629
  });
3566
3630
  }
3567
3631
  function Kn() {
3568
- const t = _();
3632
+ const t = C();
3569
3633
  return {
3570
3634
  supported: $e(),
3571
- environment: l.type,
3635
+ environment: f.type,
3572
3636
  implementation: t ? "weixin" : "webview",
3573
3637
  features: {
3574
3638
  getLocation: !0,
@@ -3587,24 +3651,24 @@ function Kn() {
3587
3651
  };
3588
3652
  }
3589
3653
  const j = /* @__PURE__ */ new Set(), J = /* @__PURE__ */ new Set();
3590
- function Ct(t, e, r) {
3654
+ function Mt(t, e, r) {
3591
3655
  t.forEach((n) => {
3592
3656
  if (typeof n == "function") {
3593
- f.safeExecute(() => n(e), { context: r });
3657
+ d.safeExecute(() => n(e), { context: r });
3594
3658
  return;
3595
3659
  }
3596
3660
  a.warn("监听回调不是函数,已跳过", { type: typeof n });
3597
3661
  });
3598
3662
  }
3599
3663
  function Vn(t = {}) {
3600
- return f.safeExecute(() => {
3664
+ return d.safeExecute(() => {
3601
3665
  var r, n;
3602
- if (_()) {
3666
+ if (C()) {
3603
3667
  const i = {
3604
- errMsg: `当前环境 (${l.type}) 不支持该接口`,
3668
+ errMsg: `当前环境 (${f.type}) 不支持该接口`,
3605
3669
  code: "PLATFORM_NOT_SUPPORTED"
3606
3670
  };
3607
- a.error("当前环境不支持此接口", { platform: l.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
3671
+ a.error("当前环境不支持此接口", { platform: f.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
3608
3672
  return;
3609
3673
  }
3610
3674
  const e = Wn(t);
@@ -3625,14 +3689,14 @@ function Vn(t = {}) {
3625
3689
  }, { context: "startLocationUpdate" });
3626
3690
  }
3627
3691
  function qn(t = {}) {
3628
- return f.safeExecute(() => {
3692
+ return d.safeExecute(() => {
3629
3693
  var e, r;
3630
- if (_()) {
3694
+ if (C()) {
3631
3695
  const n = {
3632
- errMsg: `当前环境 (${l.type}) 不支持该接口`,
3696
+ errMsg: `当前环境 (${f.type}) 不支持该接口`,
3633
3697
  code: "PLATFORM_NOT_SUPPORTED"
3634
3698
  };
3635
- a.error("当前环境不支持此接口", { platform: l.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
3699
+ a.error("当前环境不支持此接口", { platform: f.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
3636
3700
  return;
3637
3701
  }
3638
3702
  a.info("正在停止定位监听"), O("stopLocationUpdate", t, {
@@ -3649,9 +3713,9 @@ function qn(t = {}) {
3649
3713
  }, { context: "stopLocationUpdate" });
3650
3714
  }
3651
3715
  function jn(t) {
3652
- return f.safeExecute(() => {
3653
- if (_()) {
3654
- a.warn("当前环境不支持此接口", { platform: l.type });
3716
+ return d.safeExecute(() => {
3717
+ if (C()) {
3718
+ a.warn("当前环境不支持此接口", { platform: f.type });
3655
3719
  return;
3656
3720
  }
3657
3721
  if (typeof t != "function")
@@ -3662,7 +3726,7 @@ function jn(t) {
3662
3726
  const e = j.size > 0;
3663
3727
  j.add(t), e || (a.debug("注册实时位置变化监听器"), O("onLocationChange", { isPersistent: !0 }, {
3664
3728
  success: (r) => {
3665
- a.debug("收到实时位置推送", r), Ct(j, r, "onLocationChange");
3729
+ a.debug("收到实时位置推送", r), Mt(j, r, "onLocationChange");
3666
3730
  },
3667
3731
  fail: (r) => {
3668
3732
  a.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r), j.delete(t), j.size === 0 && ie("onLocationChange");
@@ -3671,9 +3735,9 @@ function jn(t) {
3671
3735
  }, { context: "onLocationChange" });
3672
3736
  }
3673
3737
  function Jn(t) {
3674
- return f.safeExecute(() => {
3675
- if (_()) {
3676
- a.warn("当前环境不支持此接口", { platform: l.type });
3738
+ return d.safeExecute(() => {
3739
+ if (C()) {
3740
+ a.warn("当前环境不支持此接口", { platform: f.type });
3677
3741
  return;
3678
3742
  }
3679
3743
  if (t && typeof t != "function")
@@ -3692,9 +3756,9 @@ function Jn(t) {
3692
3756
  }, { context: "offLocationChange" });
3693
3757
  }
3694
3758
  function Hn(t) {
3695
- return f.safeExecute(() => {
3696
- if (_()) {
3697
- a.warn("当前环境不支持此接口", { platform: l.type });
3759
+ return d.safeExecute(() => {
3760
+ if (C()) {
3761
+ a.warn("当前环境不支持此接口", { platform: f.type });
3698
3762
  return;
3699
3763
  }
3700
3764
  if (typeof t != "function")
@@ -3705,7 +3769,7 @@ function Hn(t) {
3705
3769
  const e = J.size > 0;
3706
3770
  J.add(t), e || (a.debug("注册位置更新错误监听器"), O("onLocationChangeError", { isPersistent: !0 }, {
3707
3771
  success: (r) => {
3708
- a.warn("持续定位发生异常", r), Ct(J, r, "onLocationChangeError");
3772
+ a.warn("持续定位发生异常", r), Mt(J, r, "onLocationChangeError");
3709
3773
  },
3710
3774
  fail: (r) => {
3711
3775
  a.warn("位置更新错误监听注册失败", r), J.delete(t), J.size === 0 && ie("onLocationChangeError");
@@ -3714,9 +3778,9 @@ function Hn(t) {
3714
3778
  }, { context: "onLocationChangeError" });
3715
3779
  }
3716
3780
  function zn(t) {
3717
- return f.safeExecute(() => {
3718
- if (_()) {
3719
- a.warn("当前环境不支持此接口", { platform: l.type });
3781
+ return d.safeExecute(() => {
3782
+ if (C()) {
3783
+ a.warn("当前环境不支持此接口", { platform: f.type });
3720
3784
  return;
3721
3785
  }
3722
3786
  if (t && typeof t != "function")
@@ -3753,10 +3817,10 @@ function Xn(t = {}) {
3753
3817
  }), e.longitude = null)), e;
3754
3818
  }
3755
3819
  function Rt() {
3756
- return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
3820
+ return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
3757
3821
  }
3758
3822
  function Zn(t) {
3759
- return f.safeExecute(() => {
3823
+ return d.safeExecute(() => {
3760
3824
  a.debug("通过 WebView 桥接调用位置选择", t);
3761
3825
  const e = {
3762
3826
  // 禁用超时清理,等待用户操作完成后才清理
@@ -3791,22 +3855,22 @@ function Zn(t) {
3791
3855
  });
3792
3856
  }
3793
3857
  function Qn(t = {}) {
3794
- return f.safeExecute(() => {
3858
+ return d.safeExecute(() => {
3795
3859
  var r;
3796
3860
  if (!Rt()) {
3797
3861
  const n = {
3798
- errMsg: `当前环境 (${l.type}) 不支持位置选择功能`,
3862
+ errMsg: `当前环境 (${f.type}) 不支持位置选择功能`,
3799
3863
  code: "PLATFORM_NOT_SUPPORTED"
3800
3864
  };
3801
- a.error("平台不支持位置选择", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
3865
+ a.error("平台不支持位置选择", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
3802
3866
  return;
3803
3867
  }
3804
3868
  const e = Xn(t);
3805
3869
  a.info("开始选择位置", {
3806
- platform: l.type,
3870
+ platform: f.type,
3807
3871
  latitude: e.latitude,
3808
3872
  longitude: e.longitude
3809
- }), _() || Zn(e);
3873
+ }), C() || Zn(e);
3810
3874
  }, {
3811
3875
  context: "chooseLocation",
3812
3876
  options: t
@@ -3815,8 +3879,8 @@ function Qn(t = {}) {
3815
3879
  function ei() {
3816
3880
  return {
3817
3881
  supported: Rt(),
3818
- environment: l.type,
3819
- implementation: _() ? "weixin" : "webview",
3882
+ environment: f.type,
3883
+ implementation: C() ? "weixin" : "webview",
3820
3884
  features: {
3821
3885
  chooseLocation: !0,
3822
3886
  // 支持位置选择
@@ -3852,8 +3916,8 @@ function ri() {
3852
3916
  if (!r) return e({ errMsg: "当前环境不支持 plus", code: "PLUS_UNAVAILABLE" });
3853
3917
  if (r.plus) return t(r.plus);
3854
3918
  const n = setTimeout(() => {
3855
- var d, u;
3856
- (u = (d = r.document) == null ? void 0 : d.removeEventListener) == null || u.call(d, "plusready", i), e({ errMsg: "等待 plusready 超时", code: "PLUS_READY_TIMEOUT" });
3919
+ var l, u;
3920
+ (u = (l = r.document) == null ? void 0 : l.removeEventListener) == null || u.call(l, "plusready", i), e({ errMsg: "等待 plusready 超时", code: "PLUS_READY_TIMEOUT" });
3857
3921
  }, 8e3);
3858
3922
  function i() {
3859
3923
  clearTimeout(n), t(r.plus);
@@ -3914,9 +3978,9 @@ function si(t, e) {
3914
3978
  throw { errMsg: (n == null ? void 0 : n.errMsg) || "shareDirected: 小程序环境下 payload.target 不合法", code: (n == null ? void 0 : n.code) || "PARAM_INVALID" };
3915
3979
  }
3916
3980
  if (e.isAppPlus) {
3917
- const n = (o, d) => {
3981
+ const n = (o, l) => {
3918
3982
  try {
3919
- return Ot(o, d);
3983
+ return Ot(o, l);
3920
3984
  } catch (u) {
3921
3985
  return "";
3922
3986
  }
@@ -3951,7 +4015,7 @@ function ci(t) {
3951
4015
  };
3952
4016
  }
3953
4017
  function ui(t) {
3954
- return y(this, null, function* () {
4018
+ return I(this, null, function* () {
3955
4019
  yield ri();
3956
4020
  const e = yield ni(), { message: r, degradedFromText: n } = ci(t);
3957
4021
  return new Promise((i, s) => {
@@ -3981,7 +4045,7 @@ function fi(t = {}) {
3981
4045
  if (!e.targetPath) throw { errMsg: "shareMiniProgramCard: payload.targetPath 必填", code: "PARAM_MISSING" };
3982
4046
  return Ne(e.targetPath, "targetPath"), { payload: e, success: t.success, fail: t.fail, complete: t.complete };
3983
4047
  }
3984
- function Tt(t) {
4048
+ function bt(t) {
3985
4049
  switch (String(t || "release").trim().toLowerCase()) {
3986
4050
  case "develop":
3987
4051
  case "development":
@@ -4008,7 +4072,7 @@ function di(t) {
4008
4072
  } catch (r) {
4009
4073
  throw { errMsg: "shareMiniProgramCard: App 环境下 payload.webUrl 必填,且必须是公网链接", code: (r == null ? void 0 : r.code) || "PARAM_INVALID" };
4010
4074
  }
4011
- return Tt(e.envVersion), t;
4075
+ return bt(e.envVersion), t;
4012
4076
  }
4013
4077
  function gi(t) {
4014
4078
  const { payload: e } = t, r = Ne(e.targetPath, "targetPath");
@@ -4030,7 +4094,7 @@ function hi(t) {
4030
4094
  miniProgram: {
4031
4095
  id: e.appid,
4032
4096
  path: e.targetPath,
4033
- type: Tt(e.envVersion),
4097
+ type: bt(e.envVersion),
4034
4098
  webUrl: e.webUrl
4035
4099
  }
4036
4100
  };
@@ -4039,16 +4103,16 @@ function pi(t, e) {
4039
4103
  return { type: "qsh_api_call", api: "shareMiniProgramCard", params: { miniProgramShare: gi(t), rowCustom: e }, timestamp: Date.now() };
4040
4104
  }
4041
4105
  function mi(t) {
4042
- return y(this, null, function* () {
4106
+ return I(this, null, function* () {
4043
4107
  return new Promise((e, r) => {
4044
4108
  O("shareMiniProgramCard", { appShare: hi(t) }, { success: (n) => e(n || {}), fail: (n) => r(n) });
4045
4109
  });
4046
4110
  });
4047
4111
  }
4048
- function bt(t = {}) {
4049
- return f.safeExecute(
4112
+ function Tt(t = {}) {
4113
+ return d.safeExecute(
4050
4114
  () => {
4051
- var s, o, d, u, p, C, M, $, ce, R, F;
4115
+ var s, o, l, u, p, M, _, $, ce, R, F;
4052
4116
  let e;
4053
4117
  try {
4054
4118
  e = ai(t);
@@ -4059,17 +4123,17 @@ function bt(t = {}) {
4059
4123
  try {
4060
4124
  e = si(e, r);
4061
4125
  } catch (w) {
4062
- return (o = e.fail) == null || o.call(e, w), (d = e.complete) == null || d.call(e, w), Promise.reject(w);
4126
+ return (o = e.fail) == null || o.call(e, w), (l = e.complete) == null || l.call(e, w), Promise.reject(w);
4063
4127
  }
4064
4128
  const n = ii(r);
4065
4129
  if (r.isAppPlus)
4066
4130
  return ui(e).then((w) => {
4067
4131
  var ue, je;
4068
- const B = m(g({}, (w == null ? void 0 : w.data) || {}), { hint: n });
4069
- return (ue = e.success) == null || ue.call(e, B), (je = e.complete) == null || je.call(e, B), B;
4132
+ const k = m(g({}, (w == null ? void 0 : w.data) || {}), { hint: n });
4133
+ return (ue = e.success) == null || ue.call(e, k), (je = e.complete) == null || je.call(e, k), k;
4070
4134
  }).catch((w) => {
4071
- var B, ue;
4072
- return (B = e.fail) == null || B.call(e, w), (ue = e.complete) == null || ue.call(e, w), Promise.reject(w);
4135
+ var k, ue;
4136
+ return (k = e.fail) == null || k.call(e, w), (ue = e.complete) == null || ue.call(e, w), Promise.reject(w);
4073
4137
  });
4074
4138
  if (r.isWeixinMiniProgram)
4075
4139
  try {
@@ -4077,7 +4141,7 @@ function bt(t = {}) {
4077
4141
  const w = { success: !0, hint: n };
4078
4142
  return (u = e.success) == null || u.call(e, w), (p = e.complete) == null || p.call(e, w), Promise.resolve(w);
4079
4143
  } catch (w) {
4080
- return (C = e.fail) == null || C.call(e, w), (M = e.complete) == null || M.call(e, w), Promise.reject(w);
4144
+ return (M = e.fail) == null || M.call(e, w), (_ = e.complete) == null || _.call(e, w), Promise.reject(w);
4081
4145
  }
4082
4146
  if (r.type === "h5" && !r.isUniAppWebView && !r.isOfflineWebview) {
4083
4147
  const w = { errMsg: "当前页面不在宿主 WebView 中,无法分享。请在 unified-platform-app 内打开该 H5 再重试。", code: "NOT_IN_CONTAINER" };
@@ -4091,13 +4155,13 @@ function bt(t = {}) {
4091
4155
  }
4092
4156
  function wi(t = {}) {
4093
4157
  return new Promise((e, r) => {
4094
- bt(m(g({}, t), { success: e, fail: r }));
4158
+ Tt(m(g({}, t), { success: e, fail: r }));
4095
4159
  });
4096
4160
  }
4097
4161
  function vt(t = {}) {
4098
- return f.safeExecute(
4162
+ return d.safeExecute(
4099
4163
  () => {
4100
- var s, o, d, u, p, C, M, $, ce;
4164
+ var s, o, l, u, p, M, _, $, ce;
4101
4165
  let e;
4102
4166
  try {
4103
4167
  e = fi(t);
@@ -4109,14 +4173,14 @@ function vt(t = {}) {
4109
4173
  try {
4110
4174
  e = di(e);
4111
4175
  } catch (R) {
4112
- return (o = e.fail) == null || o.call(e, R), (d = e.complete) == null || d.call(e, R), Promise.reject(R);
4176
+ return (o = e.fail) == null || o.call(e, R), (l = e.complete) == null || l.call(e, R), Promise.reject(R);
4113
4177
  }
4114
4178
  const n = r.isWeixinMiniProgram ? "已同步小程序卡片内容,请点击右上角“···”后发送给朋友。" : "正在拉起微信发送给朋友面板,请继续完成小程序卡片分享。";
4115
4179
  if (r.isAppPlus)
4116
4180
  return mi(e).then((R) => {
4117
- var w, B;
4181
+ var w, k;
4118
4182
  const F = m(g({}, R || {}), { hint: n });
4119
- return (w = e.success) == null || w.call(e, F), (B = e.complete) == null || B.call(e, F), F;
4183
+ return (w = e.success) == null || w.call(e, F), (k = e.complete) == null || k.call(e, F), F;
4120
4184
  }).catch((R) => {
4121
4185
  var F, w;
4122
4186
  return (F = e.fail) == null || F.call(e, R), (w = e.complete) == null || w.call(e, R), Promise.reject(R);
@@ -4127,7 +4191,7 @@ function vt(t = {}) {
4127
4191
  const R = { success: !0, hint: n };
4128
4192
  return (u = e.success) == null || u.call(e, R), (p = e.complete) == null || p.call(e, R), Promise.resolve(R);
4129
4193
  } catch (R) {
4130
- return (C = e.fail) == null || C.call(e, R), (M = e.complete) == null || M.call(e, R), Promise.reject(R);
4194
+ return (M = e.fail) == null || M.call(e, R), (_ = e.complete) == null || _.call(e, R), Promise.reject(R);
4131
4195
  }
4132
4196
  const i = { errMsg: "当前环境暂不支持 shareMiniProgramCard,请在 App 或微信小程序容器内使用。", code: "ENV_NOT_SUPPORTED" };
4133
4197
  return ($ = e.fail) == null || $.call(e, i), (ce = e.complete) == null || ce.call(e, i), Promise.reject(i);
@@ -4155,14 +4219,14 @@ const yi = {
4155
4219
  services: []
4156
4220
  // 指定服务 UUID 列表
4157
4221
  };
4158
- function Te(t = {}) {
4222
+ function be(t = {}) {
4159
4223
  return g(g({}, Ii), t);
4160
4224
  }
4161
4225
  function we() {
4162
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
4226
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
4163
4227
  }
4164
4228
  function Ai(t) {
4165
- return f.safeExecute(() => y(null, null, function* () {
4229
+ return d.safeExecute(() => I(null, null, function* () {
4166
4230
  var e;
4167
4231
  if (!window.wx) {
4168
4232
  const r = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
@@ -4181,7 +4245,7 @@ function Ai(t) {
4181
4245
  }), { context: "openBluetoothAdapterInWeixin" });
4182
4246
  }
4183
4247
  function Pi(t) {
4184
- return f.safeExecute(() => {
4248
+ return d.safeExecute(() => {
4185
4249
  a.debug("通过 WebView 桥接调用蓝牙功能", t), O("bluetooth", t, {
4186
4250
  success: (e) => {
4187
4251
  var r;
@@ -4195,8 +4259,8 @@ function Pi(t) {
4195
4259
  });
4196
4260
  }, { context: "bluetoothInUniApp" });
4197
4261
  }
4198
- function _i(t) {
4199
- return f.safeExecute(() => {
4262
+ function Ci(t) {
4263
+ return d.safeExecute(() => {
4200
4264
  var e;
4201
4265
  a.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), O("bluetoothDevicesDiscovery", {
4202
4266
  action: "startBluetoothDevicesDiscovery",
@@ -4218,8 +4282,8 @@ function _i(t) {
4218
4282
  }, { context: "startBluetoothDevicesDiscoveryInUniApp" });
4219
4283
  }
4220
4284
  const ye = /* @__PURE__ */ new Set();
4221
- function Mi(t, e = {}) {
4222
- return f.safeExecute(() => {
4285
+ function _i(t, e = {}) {
4286
+ return d.safeExecute(() => {
4223
4287
  var r;
4224
4288
  return ye.add(t), ye.size === 1 && O("onBluetoothDeviceFound", {
4225
4289
  action: "onBluetoothDeviceFound",
@@ -4231,7 +4295,7 @@ function Mi(t, e = {}) {
4231
4295
  }, {
4232
4296
  success: (n) => {
4233
4297
  ye.forEach((i) => {
4234
- typeof i == "function" ? f.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
4298
+ typeof i == "function" ? d.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
4235
4299
  });
4236
4300
  },
4237
4301
  fail: (n) => {
@@ -4242,8 +4306,8 @@ function Mi(t, e = {}) {
4242
4306
  }), () => ye.delete(t);
4243
4307
  }, { context: "qsh_onBluetoothDeviceFound" });
4244
4308
  }
4245
- function Ci(t) {
4246
- return f.safeExecute(() => {
4309
+ function Mi(t) {
4310
+ return d.safeExecute(() => {
4247
4311
  var e;
4248
4312
  a.debug("通过 WebView 桥接调用蓝牙连接功能", t), O("bluetoothConnection", {
4249
4313
  action: "createBLEConnection",
@@ -4266,89 +4330,89 @@ function Ci(t) {
4266
4330
  }, { context: "createBLEConnectionInUniApp" });
4267
4331
  }
4268
4332
  function Ri(t = {}) {
4269
- return f.safeExecute(() => {
4333
+ return d.safeExecute(() => {
4270
4334
  var r;
4271
4335
  if (!we()) {
4272
4336
  const n = {
4273
- errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
4337
+ errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
4274
4338
  code: "PLATFORM_NOT_SUPPORTED"
4275
4339
  };
4276
- a.error("平台不支持蓝牙", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
4340
+ a.error("平台不支持蓝牙", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
4277
4341
  return;
4278
4342
  }
4279
- const e = Te(t);
4343
+ const e = be(t);
4280
4344
  a.info("开始蓝牙操作", {
4281
- platform: l.type,
4345
+ platform: f.type,
4282
4346
  services: e.services,
4283
4347
  allowDuplicatesKey: e.allowDuplicatesKey
4284
- }), _() ? Ai(e) : Pi(e);
4348
+ }), C() ? Ai(e) : Pi(e);
4285
4349
  }, { context: "openBluetoothAdapter", options: t });
4286
4350
  }
4287
4351
  function Si(t = {}) {
4288
- return f.safeExecute(() => {
4352
+ return d.safeExecute(() => {
4289
4353
  var r, n;
4290
4354
  if (!we()) {
4291
4355
  const i = {
4292
- errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
4356
+ errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
4293
4357
  code: "PLATFORM_NOT_SUPPORTED"
4294
4358
  };
4295
- a.error("平台不支持蓝牙", { platform: l.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
4359
+ a.error("平台不支持蓝牙", { platform: f.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
4296
4360
  return;
4297
4361
  }
4298
- const e = Te(t);
4362
+ const e = be(t);
4299
4363
  a.info("开始搜索蓝牙设备", {
4300
- platform: l.type,
4364
+ platform: f.type,
4301
4365
  services: e.services,
4302
4366
  allowDuplicatesKey: e.allowDuplicatesKey
4303
- }), _() ? startBluetoothDevicesDiscoveryInWeixin(e) : _i(e);
4367
+ }), C() ? startBluetoothDevicesDiscoveryInWeixin(e) : Ci(e);
4304
4368
  }, { context: "startBluetoothDevicesDiscovery", options: t });
4305
4369
  }
4306
4370
  function Lt(t, e = {}) {
4307
- return f.safeExecute(() => {
4371
+ return d.safeExecute(() => {
4308
4372
  var n, i;
4309
4373
  if (!we()) {
4310
4374
  const s = {
4311
- errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
4375
+ errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
4312
4376
  code: "PLATFORM_NOT_SUPPORTED"
4313
4377
  };
4314
- a.error("平台不支持蓝牙", { platform: l.type }), (n = e.fail) == null || n.call(e, s), (i = e.complete) == null || i.call(e, s);
4378
+ a.error("平台不支持蓝牙", { platform: f.type }), (n = e.fail) == null || n.call(e, s), (i = e.complete) == null || i.call(e, s);
4315
4379
  return;
4316
4380
  }
4317
- const r = Te(e);
4318
- a.info("注册蓝牙设备发现监听", { platform: l.type }), _() ? onBluetoothDeviceFoundInWeixin(r) : Mi(t, r);
4381
+ const r = be(e);
4382
+ a.info("注册蓝牙设备发现监听", { platform: f.type }), C() ? onBluetoothDeviceFoundInWeixin(r) : _i(t, r);
4319
4383
  }, { context: "onBluetoothDeviceFound", options: e });
4320
4384
  }
4321
4385
  function Oi(t = {}) {
4322
- return f.safeExecute(() => {
4323
- var s, o, d, u;
4386
+ return d.safeExecute(() => {
4387
+ var s, o, l, u;
4324
4388
  if (!we()) {
4325
4389
  const p = {
4326
- errMsg: `当前环境 (${l.type}) 不支持蓝牙功能`,
4390
+ errMsg: `当前环境 (${f.type}) 不支持蓝牙功能`,
4327
4391
  code: "PLATFORM_NOT_SUPPORTED"
4328
4392
  };
4329
- a.error("平台不支持蓝牙连接", { platform: l.type }), (s = t.fail) == null || s.call(t, p), (o = t.complete) == null || o.call(t, p);
4393
+ a.error("平台不支持蓝牙连接", { platform: f.type }), (s = t.fail) == null || s.call(t, p), (o = t.complete) == null || o.call(t, p);
4330
4394
  return;
4331
4395
  }
4332
- const e = Te(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
4396
+ const e = be(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
4333
4397
  if (!n) {
4334
4398
  const p = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
4335
- (d = t.fail) == null || d.call(t, p), (u = t.complete) == null || u.call(t, p);
4399
+ (l = t.fail) == null || l.call(t, p), (u = t.complete) == null || u.call(t, p);
4336
4400
  return;
4337
4401
  }
4338
- a.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: l.type }), _() ? uni.createBLEConnection({
4402
+ a.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: f.type }), C() ? uni.createBLEConnection({
4339
4403
  deviceId: n,
4340
4404
  autoConnect: i,
4341
4405
  success: t.success,
4342
4406
  fail: t.fail,
4343
4407
  complete: t.complete
4344
- }) : Ci(e);
4408
+ }) : Mi(e);
4345
4409
  }, { context: "createBLEConnection", options: t });
4346
4410
  }
4347
4411
  function Ni() {
4348
4412
  return {
4349
4413
  supported: we(),
4350
- environment: l.type,
4351
- implementation: _() ? "weixin" : "webview",
4414
+ environment: f.type,
4415
+ implementation: C() ? "weixin" : "webview",
4352
4416
  features: {
4353
4417
  discovery: !0,
4354
4418
  connect: !0,
@@ -4358,17 +4422,17 @@ function Ni() {
4358
4422
  }
4359
4423
  };
4360
4424
  }
4361
- const Ti = {
4425
+ const bi = {
4362
4426
  // TODO: 添加更多默认配置
4363
4427
  };
4364
- function bi(t = {}) {
4365
- return g(g({}, Ti), t);
4428
+ function Ti(t = {}) {
4429
+ return g(g({}, bi), t);
4366
4430
  }
4367
4431
  function xt() {
4368
- return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(l.type);
4432
+ return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(f.type);
4369
4433
  }
4370
4434
  function vi(t) {
4371
- return f.safeExecute(() => {
4435
+ return d.safeExecute(() => {
4372
4436
  a.debug("通过 WebView 桥接调用打印PDF", t), O("printPdf", m(g({}, t), {
4373
4437
  isPersistent: !0
4374
4438
  // 强制禁用超时自动清理
@@ -4389,18 +4453,18 @@ function vi(t) {
4389
4453
  });
4390
4454
  }
4391
4455
  function Li(t = {}) {
4392
- return f.safeExecute(() => {
4456
+ return d.safeExecute(() => {
4393
4457
  var r;
4394
4458
  if (!xt()) {
4395
4459
  const n = {
4396
- errMsg: `当前环境 (${l.type}) 不支持打印PDF功能`,
4460
+ errMsg: `当前环境 (${f.type}) 不支持打印PDF功能`,
4397
4461
  code: "PLATFORM_NOT_SUPPORTED"
4398
4462
  };
4399
- a.error("平台不支持打印PDF", { platform: l.type }), (r = t.fail) == null || r.call(t, n);
4463
+ a.error("平台不支持打印PDF", { platform: f.type }), (r = t.fail) == null || r.call(t, n);
4400
4464
  return;
4401
4465
  }
4402
- const e = bi(t);
4403
- a.info("开始打印PDF", { platform: l.type }), vi(e);
4466
+ const e = Ti(t);
4467
+ a.info("开始打印PDF", { platform: f.type }), vi(e);
4404
4468
  }, {
4405
4469
  context: "printPdf",
4406
4470
  options: t
@@ -4409,7 +4473,7 @@ function Li(t = {}) {
4409
4473
  function xi() {
4410
4474
  return {
4411
4475
  supported: xt(),
4412
- environment: l.type,
4476
+ environment: f.type,
4413
4477
  implementation: "uniapp",
4414
4478
  features: {
4415
4479
  asyncSupport: !0
@@ -4432,7 +4496,7 @@ function Di(t = {}) {
4432
4496
  return e.idCardNumber = e.idCardNumber.trim(), e;
4433
4497
  }
4434
4498
  function Dt() {
4435
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(l.type);
4499
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(f.type);
4436
4500
  }
4437
4501
  function Ui() {
4438
4502
  return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.navigateTo == "function";
@@ -4445,7 +4509,7 @@ function Wi(t) {
4445
4509
  return r ? `${xe}?${r}` : xe;
4446
4510
  }
4447
4511
  function $i(t) {
4448
- return f.safeExecute(() => {
4512
+ return d.safeExecute(() => {
4449
4513
  if (!Ui()) {
4450
4514
  a.error("微信小程序导航API不可用");
4451
4515
  return;
@@ -4469,9 +4533,9 @@ function $i(t) {
4469
4533
  });
4470
4534
  }
4471
4535
  function Fi(t) {
4472
- return f.safeExecute(() => {
4536
+ return d.safeExecute(() => {
4473
4537
  a.debug("通过 WebView 桥接调用人脸识别", {
4474
- platform: l.type,
4538
+ platform: f.type,
4475
4539
  name: t.name
4476
4540
  }), O("faceVerify", g({}, t), {
4477
4541
  success: (e) => {
@@ -4486,10 +4550,10 @@ function Fi(t) {
4486
4550
  platform: "uniapp"
4487
4551
  });
4488
4552
  }
4489
- function Bi(t = {}) {
4490
- return f.safeExecute(() => {
4553
+ function ki(t = {}) {
4554
+ return d.safeExecute(() => {
4491
4555
  if (!Dt()) {
4492
- a.error("平台不支持人脸识别", { platform: l.type });
4556
+ a.error("平台不支持人脸识别", { platform: f.type });
4493
4557
  return;
4494
4558
  }
4495
4559
  let e;
@@ -4500,10 +4564,10 @@ function Bi(t = {}) {
4500
4564
  return;
4501
4565
  }
4502
4566
  if (a.info("开始人脸识别", {
4503
- platform: l.type,
4567
+ platform: f.type,
4504
4568
  name: e.name,
4505
4569
  pagePath: xe
4506
- }), _()) {
4570
+ }), C()) {
4507
4571
  $i(e);
4508
4572
  return;
4509
4573
  }
@@ -4513,16 +4577,16 @@ function Bi(t = {}) {
4513
4577
  options: t
4514
4578
  });
4515
4579
  }
4516
- function ki() {
4580
+ function Bi() {
4517
4581
  let t = "weixin";
4518
- return l.type === "UniApp" && (t = "uniapp"), {
4582
+ return f.type === "UniApp" && (t = "uniapp"), {
4519
4583
  supported: Dt(),
4520
- environment: l.type,
4584
+ environment: f.type,
4521
4585
  implementation: t,
4522
4586
  features: {
4523
4587
  asyncSupport: !0,
4524
- hostPageNavigation: _(),
4525
- hostBridge: l.type === "UniApp"
4588
+ hostPageNavigation: C(),
4589
+ hostBridge: f.type === "UniApp"
4526
4590
  }
4527
4591
  };
4528
4592
  }
@@ -4534,7 +4598,7 @@ function Gi() {
4534
4598
  return typeof e.clientId == "string" && e.clientId.length > 0;
4535
4599
  }
4536
4600
  function Ki() {
4537
- return y(this, null, function* () {
4601
+ return I(this, null, function* () {
4538
4602
  yield cr(), Gi() && (yield Q());
4539
4603
  });
4540
4604
  }
@@ -4552,19 +4616,19 @@ function Qe() {
4552
4616
  });
4553
4617
  }
4554
4618
  typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(Qe, 0) : document.addEventListener("DOMContentLoaded", Qe));
4555
- function E(t, { apiName: e } = {}) {
4619
+ function y(t, { apiName: e } = {}) {
4556
4620
  return function(r = {}, ...n) {
4557
4621
  const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), s = r && typeof r == "object" ? r : {}, o = () => i ? t(s, ...n) : new Promise((u, p) => {
4558
- const C = m(g({}, s), {
4559
- success: (M) => {
4560
- typeof s.success == "function" && s.success(M), u(M);
4622
+ const M = m(g({}, s), {
4623
+ success: (_) => {
4624
+ typeof s.success == "function" && s.success(_), u(_);
4561
4625
  },
4562
- fail: (M) => {
4563
- typeof s.fail == "function" && s.fail(M), p(M);
4626
+ fail: (_) => {
4627
+ typeof s.fail == "function" && s.fail(_), p(_);
4564
4628
  },
4565
4629
  complete: s.complete
4566
4630
  });
4567
- t(C, ...n);
4631
+ t(M, ...n);
4568
4632
  });
4569
4633
  return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => o()).catch((u) => {
4570
4634
  throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, u), u;
@@ -4574,12 +4638,12 @@ function E(t, { apiName: e } = {}) {
4574
4638
  function Ie(t) {
4575
4639
  return typeof t == "function" ? { success: t } : t && typeof t == "object" ? t : {};
4576
4640
  }
4577
- const Wt = E(Xr), $t = E(Zr), Ft = E(Qr), Bt = E(en), kt = E(tn), Gt = E(rn);
4641
+ const Wt = y(Xr), $t = y(Zr), Ft = y(Qr), kt = y(en), Bt = y(tn), Gt = y(rn);
4578
4642
  function Kt(t) {
4579
4643
  const e = () => nn(t);
4580
4644
  return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => e());
4581
4645
  }
4582
- const Fe = E(ln, { apiName: "getCode" });
4646
+ const Fe = y(ln, { apiName: "getCode" });
4583
4647
  function Vi(t = {}) {
4584
4648
  return new Promise((e, r) => {
4585
4649
  Fe(m(g({}, t), {
@@ -4588,27 +4652,27 @@ function Vi(t = {}) {
4588
4652
  }));
4589
4653
  });
4590
4654
  }
4591
- const Be = E(pn, {
4655
+ const ke = y(pn, {
4592
4656
  apiName: "navigateToMiniProgram"
4593
4657
  });
4594
4658
  function qi(t = {}) {
4595
4659
  return new Promise((e, r) => {
4596
- Be(m(g({}, t), {
4660
+ ke(m(g({}, t), {
4597
4661
  success: e,
4598
4662
  fail: r
4599
4663
  }));
4600
4664
  });
4601
4665
  }
4602
- const ke = E(Rn);
4666
+ const Be = y(Rn);
4603
4667
  function ji(t = {}) {
4604
4668
  return new Promise((e, r) => {
4605
- ke(m(g({}, t), {
4669
+ Be(m(g({}, t), {
4606
4670
  success: e,
4607
4671
  fail: r
4608
4672
  }));
4609
4673
  });
4610
4674
  }
4611
- const Vt = E(Li);
4675
+ const Vt = y(Li);
4612
4676
  function Ji(t = {}) {
4613
4677
  return new Promise((e, r) => {
4614
4678
  Vt(m(g({}, t), {
@@ -4617,7 +4681,7 @@ function Ji(t = {}) {
4617
4681
  }));
4618
4682
  });
4619
4683
  }
4620
- const Ge = E(vn), Hi = E(Bi);
4684
+ const Ge = y(vn), Hi = y(ki);
4621
4685
  function zi(t = {}) {
4622
4686
  return new Promise((e, r) => {
4623
4687
  Ge(m(g({}, t), {
@@ -4626,7 +4690,7 @@ function zi(t = {}) {
4626
4690
  }));
4627
4691
  });
4628
4692
  }
4629
- const Yi = E(bt, { apiName: "shareDirected" }), Xi = E(wi, { apiName: "shareDirectedAsync" }), Zi = E(Et, { apiName: "manualShare" }), Qi = E(Pn, { apiName: "manualShareAsync" }), Ke = E(kn);
4693
+ const Yi = y(Tt, { apiName: "shareDirected" }), Xi = y(wi, { apiName: "shareDirectedAsync" }), Zi = y(Et, { apiName: "manualShare" }), Qi = y(Pn, { apiName: "manualShareAsync" }), Ke = y(Bn);
4630
4694
  function ea(t = {}) {
4631
4695
  return new Promise((e, r) => {
4632
4696
  Ke(m(g({}, t), {
@@ -4635,7 +4699,7 @@ function ea(t = {}) {
4635
4699
  }));
4636
4700
  });
4637
4701
  }
4638
- const Ve = E(Gn);
4702
+ const Ve = y(Gn);
4639
4703
  function ta(t = {}) {
4640
4704
  return new Promise((e, r) => {
4641
4705
  Ve(m(g({}, t), {
@@ -4644,7 +4708,7 @@ function ta(t = {}) {
4644
4708
  }));
4645
4709
  });
4646
4710
  }
4647
- const qe = E(Qn);
4711
+ const qe = y(Qn);
4648
4712
  function ra(t = {}) {
4649
4713
  return new Promise((e, r) => {
4650
4714
  qe(m(g({}, t), {
@@ -4653,7 +4717,7 @@ function ra(t = {}) {
4653
4717
  }));
4654
4718
  });
4655
4719
  }
4656
- const qt = E(Ri);
4720
+ const qt = y(Ri);
4657
4721
  function na(t = {}) {
4658
4722
  return new Promise((e, r) => {
4659
4723
  qt(m(g({}, t), {
@@ -4662,7 +4726,7 @@ function na(t = {}) {
4662
4726
  }));
4663
4727
  });
4664
4728
  }
4665
- const jt = E(Si);
4729
+ const jt = y(Si);
4666
4730
  function ia(t = {}) {
4667
4731
  return new Promise((e, r) => {
4668
4732
  jt(m(g({}, t), {
@@ -4671,7 +4735,7 @@ function ia(t = {}) {
4671
4735
  }));
4672
4736
  });
4673
4737
  }
4674
- const Jt = E(Lt);
4738
+ const Jt = y(Lt);
4675
4739
  function aa(t = {}) {
4676
4740
  return new Promise((e, r) => {
4677
4741
  Jt(m(g({}, t), {
@@ -4680,7 +4744,7 @@ function aa(t = {}) {
4680
4744
  }));
4681
4745
  });
4682
4746
  }
4683
- const Ht = E(Oi);
4747
+ const Ht = y(Oi);
4684
4748
  function sa(t = {}) {
4685
4749
  return new Promise((e, r) => {
4686
4750
  Ht(m(g({}, t), {
@@ -4689,22 +4753,22 @@ function sa(t = {}) {
4689
4753
  }));
4690
4754
  });
4691
4755
  }
4692
- const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "shareMiniProgramCardAsync" }), se = {
4756
+ const oa = y(vt, { apiName: "shareMiniProgramCard" }), ca = y(Ei, { apiName: "shareMiniProgramCardAsync" }), se = {
4693
4757
  // 导航 API
4694
4758
  navigateTo: Wt,
4695
4759
  navigateBack: $t,
4696
4760
  switchTab: Ft,
4697
- reLaunch: Bt,
4698
- redirectTo: kt,
4761
+ reLaunch: kt,
4762
+ redirectTo: Bt,
4699
4763
  // 消息 API
4700
4764
  postMessage: Gt,
4701
4765
  getEnv: Kt,
4702
4766
  getCode: Fe,
4703
4767
  getCodeAsync: Vi,
4704
- navigateToMiniProgram: Be,
4768
+ navigateToMiniProgram: ke,
4705
4769
  navigateToMiniProgramAsync: qi,
4706
4770
  // 图片 API
4707
- chooseImage: ke,
4771
+ chooseImage: Be,
4708
4772
  chooseImageAsync: ji,
4709
4773
  // 扫码 API
4710
4774
  scanCode: Ge,
@@ -4717,12 +4781,12 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
4717
4781
  chooseLocation: qe,
4718
4782
  chooseLocationAsync: ra,
4719
4783
  // 位置监听 API(保留回调签名)
4720
- onLocationChange: (t) => E((e = {}) => jn(e.success), { apiName: "onLocationChange" })(Ie(t)),
4721
- offLocationChange: (t) => E((e = {}) => Jn(e.success), { apiName: "offLocationChange" })(Ie(t)),
4722
- onLocationChangeError: (t) => E((e = {}) => Hn(e.success), { apiName: "onLocationChangeError" })(Ie(t)),
4723
- offLocationChangeError: (t) => E((e = {}) => zn(e.success), { apiName: "offLocationChangeError" })(Ie(t)),
4724
- startLocationUpdate: E(Vn, { apiName: "startLocationUpdate" }),
4725
- stopLocationUpdate: E(qn, { apiName: "stopLocationUpdate" }),
4784
+ onLocationChange: (t) => y((e = {}) => jn(e.success), { apiName: "onLocationChange" })(Ie(t)),
4785
+ offLocationChange: (t) => y((e = {}) => Jn(e.success), { apiName: "offLocationChange" })(Ie(t)),
4786
+ onLocationChangeError: (t) => y((e = {}) => Hn(e.success), { apiName: "onLocationChangeError" })(Ie(t)),
4787
+ offLocationChangeError: (t) => y((e = {}) => zn(e.success), { apiName: "offLocationChangeError" })(Ie(t)),
4788
+ startLocationUpdate: y(Vn, { apiName: "startLocationUpdate" }),
4789
+ stopLocationUpdate: y(qn, { apiName: "stopLocationUpdate" }),
4726
4790
  // 环境信息
4727
4791
  environment: Ut,
4728
4792
  /**
@@ -4800,8 +4864,8 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
4800
4864
  // WebView 对象(兼容旧版本)
4801
4865
  webView: null,
4802
4866
  // 图片相关常量
4803
- ImageSourceTypes: _e,
4804
- ImageSizeTypes: Me,
4867
+ ImageSourceTypes: Ce,
4868
+ ImageSizeTypes: _e,
4805
4869
  /**
4806
4870
  * 获取图片功能能力信息
4807
4871
  * @returns {Object} 能力信息对象
@@ -4884,7 +4948,7 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
4884
4948
  getPrintCapabilities: xi,
4885
4949
  // 人脸识别 API(仅支持微信小程序环境)
4886
4950
  faceVerify: Hi,
4887
- getFaceCapabilities: ki,
4951
+ getFaceCapabilities: Bi,
4888
4952
  // 插件系统
4889
4953
  plugins: {
4890
4954
  /**
@@ -5054,15 +5118,15 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
5054
5118
  /**
5055
5119
  * 日志记录器
5056
5120
  */
5057
- logger: v,
5121
+ logger: L,
5058
5122
  /**
5059
5123
  * 设置外部日志 reporter,便于对接埋点/观测
5060
5124
  */
5061
- setLogReporter: (t) => v.setReporter(t),
5125
+ setLogReporter: (t) => L.setReporter(t),
5062
5126
  /**
5063
5127
  * 错误处理器
5064
5128
  */
5065
- errorHandler: f,
5129
+ errorHandler: d,
5066
5130
  /**
5067
5131
  * 状态管理器
5068
5132
  */
@@ -5072,7 +5136,7 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
5072
5136
  * @example
5073
5137
  * qsh.debug.enableDevMode()
5074
5138
  */
5075
- enableDevMode: () => v.enableDevMode(),
5139
+ enableDevMode: () => L.enableDevMode(),
5076
5140
  /**
5077
5141
  * 获取日志历史
5078
5142
  * @param {number} [count] - 获取条数
@@ -5080,7 +5144,7 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
5080
5144
  * @example
5081
5145
  * console.log(qsh.debug.getLogs(10))
5082
5146
  */
5083
- getLogs: (t) => v.getHistory(t),
5147
+ getLogs: (t) => L.getHistory(t),
5084
5148
  /**
5085
5149
  * 获取 SDK 统计信息
5086
5150
  * @returns {Object} 统计信息
@@ -5088,7 +5152,7 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
5088
5152
  * console.log(qsh.debug.getStats())
5089
5153
  */
5090
5154
  getStats: () => ({
5091
- logger: v.getStats(),
5155
+ logger: L.getStats(),
5092
5156
  state: Y.getStats(),
5093
5157
  weixinConfig: ve().getStats(),
5094
5158
  plugins: fe.getStats(),
@@ -5108,20 +5172,20 @@ const oa = E(vt, { apiName: "shareMiniProgramCard" }), ca = E(Ei, { apiName: "sh
5108
5172
  * @example
5109
5173
  * console.log(qsh.debug.exportDebugInfo())
5110
5174
  */
5111
- exportDebugInfo: () => v.exportToJSON()
5175
+ exportDebugInfo: () => L.exportToJSON()
5112
5176
  }
5113
5177
  };
5114
5178
  Ut.isWeixinMiniProgram ? se.webView = window.wx && window.wx.miniProgram : se.webView = {
5115
5179
  navigateTo: Wt,
5116
5180
  navigateBack: $t,
5117
5181
  switchTab: Ft,
5118
- reLaunch: Bt,
5119
- redirectTo: kt,
5182
+ reLaunch: kt,
5183
+ redirectTo: Bt,
5120
5184
  postMessage: Gt,
5121
5185
  getEnv: Kt,
5122
5186
  getCode: Fe,
5123
- navigateToMiniProgram: Be,
5124
- chooseImage: ke,
5187
+ navigateToMiniProgram: ke,
5188
+ chooseImage: Be,
5125
5189
  scanCode: Ge,
5126
5190
  getLocation: Ke,
5127
5191
  openLocation: Ve,