qsh-webview-sdk 2.0.9 → 2.1.0

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.
@@ -1,93 +1,93 @@
1
- var St = Object.defineProperty, Pt = Object.defineProperties;
2
- var Tt = Object.getOwnPropertyDescriptors;
3
- var be = Object.getOwnPropertySymbols;
4
- var Lt = Object.prototype.hasOwnProperty, Mt = Object.prototype.propertyIsEnumerable;
5
- var ye = (t, e, r) => e in t ? St(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, p = (t, e) => {
1
+ var bt = Object.defineProperty, xt = Object.defineProperties;
2
+ var vt = Object.getOwnPropertyDescriptors;
3
+ var De = Object.getOwnPropertySymbols;
4
+ var Dt = Object.prototype.hasOwnProperty, Ut = Object.prototype.propertyIsEnumerable;
5
+ var Ce = (t, e, r) => e in t ? bt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, h = (t, e) => {
6
6
  for (var r in e || (e = {}))
7
- Lt.call(e, r) && ye(t, r, e[r]);
8
- if (be)
9
- for (var r of be(e))
10
- Mt.call(e, r) && ye(t, r, e[r]);
7
+ Dt.call(e, r) && Ce(t, r, e[r]);
8
+ if (De)
9
+ for (var r of De(e))
10
+ Ut.call(e, r) && Ce(t, r, e[r]);
11
11
  return t;
12
- }, A = (t, e) => Pt(t, Tt(e));
13
- var v = (t, e, r) => ye(t, typeof e != "symbol" ? e + "" : e, r);
14
- var m = (t, e, r) => new Promise((n, i) => {
15
- var a = (l) => {
12
+ }, A = (t, e) => xt(t, vt(e));
13
+ var U = (t, e, r) => Ce(t, typeof e != "symbol" ? e + "" : e, r);
14
+ var p = (t, e, r) => new Promise((n, i) => {
15
+ var a = (f) => {
16
16
  try {
17
- d(r.next(l));
18
- } catch (h) {
19
- i(h);
17
+ d(r.next(f));
18
+ } catch (w) {
19
+ i(w);
20
20
  }
21
- }, g = (l) => {
21
+ }, c = (f) => {
22
22
  try {
23
- d(r.throw(l));
24
- } catch (h) {
25
- i(h);
23
+ d(r.throw(f));
24
+ } catch (w) {
25
+ i(w);
26
26
  }
27
- }, d = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(a, g);
27
+ }, d = (f) => f.done ? n(f.value) : Promise.resolve(f.value).then(a, c);
28
28
  d((r = r.apply(t, e)).next());
29
29
  });
30
- function de() {
30
+ function pe() {
31
31
  return typeof window != "undefined" ? window : void 0;
32
32
  }
33
- function _e() {
33
+ function Pe() {
34
34
  return typeof navigator == "undefined" ? "" : navigator.userAgent || "";
35
35
  }
36
- function E() {
37
- const t = de();
36
+ function y() {
37
+ const t = pe();
38
38
  if (!t) return !1;
39
39
  if (t.__wxjs_environment === "miniprogram" || t.wx && t.wx.miniProgram)
40
40
  return !0;
41
- const e = _e();
41
+ const e = Pe();
42
42
  return !!(e && /micromessenger/i.test(e) && /miniProgram/i.test(e));
43
43
  }
44
- function ge() {
45
- const t = de();
44
+ function me() {
45
+ const t = pe();
46
46
  return !!(t && t.plus);
47
47
  }
48
- function pe() {
49
- const t = de();
48
+ function we() {
49
+ const t = pe();
50
50
  return !!(t && (t.__dcloud_weex_postMessage || t.__dcloud_weex_));
51
51
  }
52
- function he() {
53
- const t = de();
52
+ function Ee() {
53
+ const t = pe();
54
54
  return !!(t && (t.__uniapp_x_postMessage || t.__uniapp_x_));
55
55
  }
56
- function me() {
57
- const t = _e();
56
+ function ye() {
57
+ const t = Pe();
58
58
  return /uni-app/i.test(t);
59
59
  }
60
- function Ce() {
61
- const t = _e();
60
+ function Ne() {
61
+ const t = Pe();
62
62
  return /Html5Plus/i.test(t);
63
63
  }
64
- function Be() {
65
- return me() || Ce();
66
- }
67
- function bt() {
68
- return he() ? "uvue" : pe() ? "nvue" : E() ? "weixin" : ge() ? "plus" : Be() ? "webview" : me() ? "UniApp" : "h5";
69
- }
70
- let ae = null;
71
- function Ne(t = !1) {
72
- return ae && !t || (ae = {
73
- isWeixinMiniProgram: E(),
74
- isAppPlus: ge(),
75
- isNvue: pe(),
76
- isUvue: he(),
77
- isUniApp: me(),
78
- isHtml5Plus: Ce(),
79
- isUniAppWebView: Be(),
80
- type: bt()
81
- }), ae;
82
- }
83
- const c = Ne(), U = {
64
+ function Ke() {
65
+ return ye() || Ne();
66
+ }
67
+ function Wt() {
68
+ return Ee() ? "uvue" : we() ? "nvue" : y() ? "weixin" : me() ? "plus" : Ke() ? "webview" : ye() ? "UniApp" : "h5";
69
+ }
70
+ let ue = null;
71
+ function Ie(t = !1) {
72
+ return ue && !t || (ue = {
73
+ isWeixinMiniProgram: y(),
74
+ isAppPlus: me(),
75
+ isNvue: we(),
76
+ isUvue: Ee(),
77
+ isUniApp: ye(),
78
+ isHtml5Plus: Ne(),
79
+ isUniAppWebView: Ke(),
80
+ type: Wt()
81
+ }), ue;
82
+ }
83
+ const u = Ie(), M = {
84
84
  PLATFORM_NOT_SUPPORTED: "PLATFORM_NOT_SUPPORTED",
85
85
  API_CALL_FAILED: "API_CALL_FAILED",
86
86
  BRIDGE_NOT_READY: "BRIDGE_NOT_READY",
87
87
  INVALID_PARAMETERS: "INVALID_PARAMETERS",
88
88
  NETWORK_ERROR: "NETWORK_ERROR"
89
89
  };
90
- class L extends Error {
90
+ class P extends Error {
91
91
  /**
92
92
  * 构造函数
93
93
  * @param {string} type - 错误类型
@@ -96,7 +96,7 @@ class L extends Error {
96
96
  * @param {Error} [originalError] - 原始错误对象
97
97
  */
98
98
  constructor(e, r, n = {}, i = null) {
99
- 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, L);
99
+ 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, P);
100
100
  }
101
101
  /**
102
102
  * 转换为 JSON 格式
@@ -113,28 +113,28 @@ class L extends Error {
113
113
  };
114
114
  }
115
115
  }
116
- const O = class O {
116
+ const C = class C {
117
117
  /**
118
118
  * 设置调试模式
119
119
  * @param {boolean} enabled - 是否启用调试模式
120
120
  */
121
121
  static setDebugMode(e) {
122
- O.isDebugMode = e;
122
+ C.isDebugMode = e;
123
123
  }
124
124
  /**
125
125
  * 添加错误回调
126
126
  * @param {Function} callback - 错误处理回调函数
127
127
  */
128
128
  static addErrorCallback(e) {
129
- typeof e == "function" && O.errorCallbacks.push(e);
129
+ typeof e == "function" && C.errorCallbacks.push(e);
130
130
  }
131
131
  /**
132
132
  * 移除错误回调
133
133
  * @param {Function} callback - 要移除的回调函数
134
134
  */
135
135
  static removeErrorCallback(e) {
136
- const r = O.errorCallbacks.indexOf(e);
137
- r > -1 && O.errorCallbacks.splice(r, 1);
136
+ const r = C.errorCallbacks.indexOf(e);
137
+ r > -1 && C.errorCallbacks.splice(r, 1);
138
138
  }
139
139
  /**
140
140
  * 处理 API 调用错误
@@ -144,16 +144,16 @@ const O = class O {
144
144
  */
145
145
  static handleApiError(e, r = {}) {
146
146
  let n;
147
- return e instanceof L ? n = e : e instanceof Error ? n = new L(
148
- U.API_CALL_FAILED,
147
+ return e instanceof P ? n = e : e instanceof Error ? n = new P(
148
+ M.API_CALL_FAILED,
149
149
  e.message,
150
150
  r,
151
151
  e
152
- ) : n = new L(
153
- U.API_CALL_FAILED,
152
+ ) : n = new P(
153
+ M.API_CALL_FAILED,
154
154
  String(e),
155
155
  r
156
- ), O.logError(n), O.notifyCallbacks(n), n;
156
+ ), C.logError(n), C.notifyCallbacks(n), n;
157
157
  }
158
158
  /**
159
159
  * 处理平台不支持错误
@@ -162,12 +162,12 @@ const O = class O {
162
162
  * @returns {QshError} 错误对象
163
163
  */
164
164
  static handlePlatformNotSupported(e, r) {
165
- const n = new L(
166
- U.PLATFORM_NOT_SUPPORTED,
165
+ const n = new P(
166
+ M.PLATFORM_NOT_SUPPORTED,
167
167
  `API "${r}" is not supported on platform "${e}"`,
168
168
  { platformType: e, apiName: r }
169
169
  );
170
- return O.logError(n), O.notifyCallbacks(n), n;
170
+ return C.logError(n), C.notifyCallbacks(n), n;
171
171
  }
172
172
  /**
173
173
  * 处理桥接未就绪错误
@@ -175,12 +175,12 @@ const O = class O {
175
175
  * @returns {QshError} 错误对象
176
176
  */
177
177
  static handleBridgeNotReady(e) {
178
- const r = new L(
179
- U.BRIDGE_NOT_READY,
178
+ const r = new P(
179
+ M.BRIDGE_NOT_READY,
180
180
  `Bridge is not ready when calling "${e}"`,
181
181
  { apiName: e }
182
182
  );
183
- return O.logError(r), O.notifyCallbacks(r), r;
183
+ return C.logError(r), C.notifyCallbacks(r), r;
184
184
  }
185
185
  /**
186
186
  * 处理参数验证错误
@@ -191,12 +191,12 @@ const O = class O {
191
191
  * @returns {QshError} 错误对象
192
192
  */
193
193
  static handleInvalidParameters(e, r, n, i) {
194
- const a = new L(
195
- U.INVALID_PARAMETERS,
194
+ const a = new P(
195
+ M.INVALID_PARAMETERS,
196
196
  `Invalid parameter "${r}" in "${e}": expected ${n}, got ${typeof i}`,
197
197
  { apiName: e, paramName: r, expectedType: n, actualValue: i }
198
198
  );
199
- return O.logError(a), O.notifyCallbacks(a), a;
199
+ return C.logError(a), C.notifyCallbacks(a), a;
200
200
  }
201
201
  /**
202
202
  * 安全地包装函数执行,捕获并处理错误
@@ -208,7 +208,7 @@ const O = class O {
208
208
  try {
209
209
  return e();
210
210
  } catch (n) {
211
- return O.handleApiError(n, r);
211
+ return C.handleApiError(n, r);
212
212
  }
213
213
  }
214
214
  /**
@@ -218,11 +218,11 @@ const O = class O {
218
218
  * @returns {Promise} Promise 对象
219
219
  */
220
220
  static safeExecuteAsync(n) {
221
- return m(this, arguments, function* (e, r = {}) {
221
+ return p(this, arguments, function* (e, r = {}) {
222
222
  try {
223
223
  return yield e();
224
224
  } catch (i) {
225
- return O.handleApiError(i, r);
225
+ return C.handleApiError(i, r);
226
226
  }
227
227
  });
228
228
  }
@@ -234,7 +234,7 @@ const O = class O {
234
234
  static logError(e) {
235
235
  if (typeof console != "undefined") {
236
236
  const r = `[QSH-SDK Error] ${e.type}: ${e.message}`;
237
- O.isDebugMode ? console.error(r, {
237
+ C.isDebugMode ? console.error(r, {
238
238
  context: e.context,
239
239
  originalError: e.originalError,
240
240
  stack: e.stack,
@@ -248,7 +248,7 @@ const O = class O {
248
248
  * @private
249
249
  */
250
250
  static notifyCallbacks(e) {
251
- O.errorCallbacks.forEach((r) => {
251
+ C.errorCallbacks.forEach((r) => {
252
252
  try {
253
253
  r(e);
254
254
  } catch (n) {
@@ -264,23 +264,23 @@ const O = class O {
264
264
  static createErrorDecorator(e = {}) {
265
265
  return function(r, n, i) {
266
266
  const a = i.value;
267
- return i.value = function(...g) {
268
- return O.safeExecute(() => a.apply(this, g), A(p({}, e), { method: n, target: r.constructor.name }));
267
+ return i.value = function(...c) {
268
+ return C.safeExecute(() => a.apply(this, c), A(h({}, e), { method: n, target: r.constructor.name }));
269
269
  }, i;
270
270
  };
271
271
  }
272
272
  };
273
- v(O, "isDebugMode", !1), v(O, "errorCallbacks", []);
274
- let u = O;
275
- const P = {
273
+ U(C, "isDebugMode", !1), U(C, "errorCallbacks", []);
274
+ let l = C;
275
+ const L = {
276
276
  UNINITIALIZED: "uninitialized",
277
277
  INITIALIZING: "initializing",
278
278
  READY: "ready",
279
279
  ERROR: "error"
280
280
  };
281
- class vt {
281
+ class Ft {
282
282
  constructor() {
283
- this.state = P.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null, this.handleBridgeReady = this.handleBridgeReady.bind(this), this.handleInitializationError = this.handleInitializationError.bind(this);
283
+ 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);
284
284
  }
285
285
  /**
286
286
  * 获取当前状态
@@ -294,21 +294,21 @@ class vt {
294
294
  * @returns {boolean} 是否就绪
295
295
  */
296
296
  isReady() {
297
- return this.state === P.READY;
297
+ return this.state === L.READY;
298
298
  }
299
299
  /**
300
300
  * 检查是否正在初始化
301
301
  * @returns {boolean} 是否正在初始化
302
302
  */
303
303
  isInitializing() {
304
- return this.state === P.INITIALIZING;
304
+ return this.state === L.INITIALIZING;
305
305
  }
306
306
  /**
307
307
  * 检查是否出错
308
308
  * @returns {boolean} 是否出错
309
309
  */
310
310
  hasError() {
311
- return this.state === P.ERROR;
311
+ return this.state === L.ERROR;
312
312
  }
313
313
  /**
314
314
  * 获取初始化错误
@@ -332,10 +332,10 @@ class vt {
332
332
  * @returns {Promise<void>} 初始化 Promise
333
333
  */
334
334
  startInitialization(e) {
335
- return m(this, null, function* () {
336
- if (this.state !== P.UNINITIALIZED)
335
+ return p(this, null, function* () {
336
+ if (this.state !== L.UNINITIALIZED)
337
337
  return this.waitForReady();
338
- this.state = P.INITIALIZING;
338
+ this.state = L.INITIALIZING;
339
339
  try {
340
340
  yield e(), this.handleBridgeReady();
341
341
  } catch (r) {
@@ -349,11 +349,11 @@ class vt {
349
349
  * @private
350
350
  */
351
351
  handleBridgeReady() {
352
- this.state === P.INITIALIZING && (this.state = P.READY, this.readyCallbacks.forEach((e) => {
352
+ this.state === L.INITIALIZING && (this.state = L.READY, this.readyCallbacks.forEach((e) => {
353
353
  try {
354
354
  e();
355
355
  } catch (r) {
356
- u.handleApiError(r, { context: "StateManager.handleBridgeReady" });
356
+ l.handleApiError(r, { context: "StateManager.handleBridgeReady" });
357
357
  }
358
358
  }), this.readyCallbacks = [], this.errorCallbacks = []);
359
359
  }
@@ -363,11 +363,11 @@ class vt {
363
363
  * @private
364
364
  */
365
365
  handleInitializationError(e) {
366
- this.state = P.ERROR, this.initializationError = e, this.errorCallbacks.forEach((r) => {
366
+ this.state = L.ERROR, this.initializationError = e, this.errorCallbacks.forEach((r) => {
367
367
  try {
368
368
  r(e);
369
369
  } catch (n) {
370
- u.handleApiError(n, { context: "StateManager.handleInitializationError" });
370
+ l.handleApiError(n, { context: "StateManager.handleInitializationError" });
371
371
  }
372
372
  }), this.readyCallbacks = [], this.errorCallbacks = [];
373
373
  }
@@ -375,7 +375,7 @@ class vt {
375
375
  * 重置状态管理器(用于测试或重新初始化)
376
376
  */
377
377
  reset() {
378
- this.state = P.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null;
378
+ this.state = L.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null;
379
379
  }
380
380
  /**
381
381
  * 添加状态变化监听器
@@ -390,7 +390,7 @@ class vt {
390
390
  const n = () => {
391
391
  this.state === e && r(this.state);
392
392
  };
393
- return e === P.READY ? this.readyCallbacks.push(n) : e === P.ERROR && this.errorCallbacks.push(n), () => {
393
+ return e === L.READY ? this.readyCallbacks.push(n) : e === L.ERROR && this.errorCallbacks.push(n), () => {
394
394
  const i = this.readyCallbacks.indexOf(n);
395
395
  i > -1 && this.readyCallbacks.splice(i, 1);
396
396
  const a = this.errorCallbacks.indexOf(n);
@@ -411,52 +411,52 @@ class vt {
411
411
  };
412
412
  }
413
413
  }
414
- const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = () => G.getState(), w = {
414
+ const j = new Ft(), ze = () => j.waitForReady(), $t = () => j.isReady(), Bt = () => j.getState(), E = {
415
415
  ERROR: 0,
416
416
  WARN: 1,
417
417
  INFO: 2,
418
418
  DEBUG: 3,
419
419
  TRACE: 4
420
- }, ee = {
421
- [w.ERROR]: "ERROR",
422
- [w.WARN]: "WARN",
423
- [w.INFO]: "INFO",
424
- [w.DEBUG]: "DEBUG",
425
- [w.TRACE]: "TRACE"
426
- }, f = class f {
420
+ }, re = {
421
+ [E.ERROR]: "ERROR",
422
+ [E.WARN]: "WARN",
423
+ [E.INFO]: "INFO",
424
+ [E.DEBUG]: "DEBUG",
425
+ [E.TRACE]: "TRACE"
426
+ }, g = class g {
427
427
  // 可注入的外部 reporter
428
428
  /**
429
429
  * 设置日志级别
430
430
  * @param {number} level - 日志级别
431
431
  */
432
432
  static setLevel(e) {
433
- e >= w.ERROR && e <= w.TRACE && (f.currentLevel = e, f.log(w.INFO, "Logger", `日志级别设置为: ${ee[e]}`));
433
+ e >= E.ERROR && e <= E.TRACE && (g.currentLevel = e, g.log(E.INFO, "Logger", `日志级别设置为: ${re[e]}`));
434
434
  }
435
435
  /**
436
436
  * 启用开发模式(显示所有日志)
437
437
  */
438
438
  static enableDevMode() {
439
- f.setLevel(w.DEBUG), f.log(w.INFO, "Logger", "开发模式已启用");
439
+ g.setLevel(E.DEBUG), g.log(E.INFO, "Logger", "开发模式已启用");
440
440
  }
441
441
  /**
442
442
  * 启用生产模式(只显示错误和警告)
443
443
  */
444
444
  static enableProdMode() {
445
- f.setLevel(w.WARN), f.log(w.INFO, "Logger", "生产模式已启用");
445
+ g.setLevel(E.WARN), g.log(E.INFO, "Logger", "生产模式已启用");
446
446
  }
447
447
  /**
448
448
  * 启用特定模块的日志
449
449
  * @param {string} module - 模块名称
450
450
  */
451
451
  static enableModule(e) {
452
- f.enabledModules.add(e), f.log(w.INFO, "Logger", `模块日志已启用: ${e}`);
452
+ g.enabledModules.add(e), g.log(E.INFO, "Logger", `模块日志已启用: ${e}`);
453
453
  }
454
454
  /**
455
455
  * 禁用特定模块的日志
456
456
  * @param {string} module - 模块名称
457
457
  */
458
458
  static disableModule(e) {
459
- f.enabledModules.delete(e), f.log(w.INFO, "Logger", `模块日志已禁用: ${e}`);
459
+ g.enabledModules.delete(e), g.log(E.INFO, "Logger", `模块日志已禁用: ${e}`);
460
460
  }
461
461
  /**
462
462
  * 检查是否应该记录日志
@@ -466,7 +466,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
466
466
  * @private
467
467
  */
468
468
  static shouldLog(e, r) {
469
- return e > f.currentLevel ? !1 : r && f.enabledModules.size > 0 ? f.enabledModules.has(r) : !0;
469
+ return e > g.currentLevel ? !1 : r && g.enabledModules.size > 0 ? g.enabledModules.has(r) : !0;
470
470
  }
471
471
  /**
472
472
  * 核心日志记录方法
@@ -477,22 +477,22 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
477
477
  * @private
478
478
  */
479
479
  static log(e, r, n, ...i) {
480
- if (!f.shouldLog(e, r))
480
+ if (!g.shouldLog(e, r))
481
481
  return;
482
- const a = (/* @__PURE__ */ new Date()).toISOString(), g = ee[e], d = r ? `[${r}]` : "", l = `${f.prefix} ${d} ${n}`, h = {
482
+ const a = (/* @__PURE__ */ new Date()).toISOString(), c = re[e], d = r ? `[${r}]` : "", f = `${g.prefix} ${d} ${n}`, w = {
483
483
  timestamp: a,
484
484
  level: e,
485
- levelName: g,
485
+ levelName: c,
486
486
  module: r,
487
487
  message: n,
488
488
  args: i
489
489
  };
490
- if (f.addToHistory(h), typeof f.reporter == "function")
490
+ if (g.addToHistory(w), typeof g.reporter == "function")
491
491
  try {
492
- f.reporter(h);
493
- } catch (T) {
492
+ g.reporter(w);
493
+ } catch (b) {
494
494
  }
495
- f.outputToConsole(e, l, ...i);
495
+ g.outputToConsole(e, f, ...i);
496
496
  }
497
497
  /**
498
498
  * 添加日志到历史记录
@@ -500,7 +500,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
500
500
  * @private
501
501
  */
502
502
  static addToHistory(e) {
503
- f.logHistory.push(e), f.logHistory.length > f.maxHistorySize && f.logHistory.shift();
503
+ g.logHistory.push(e), g.logHistory.length > g.maxHistorySize && g.logHistory.shift();
504
504
  }
505
505
  /**
506
506
  * 输出到控制台
@@ -514,17 +514,17 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
514
514
  return;
515
515
  const i = n && n.length > 0;
516
516
  switch (e) {
517
- case w.ERROR:
517
+ case E.ERROR:
518
518
  i ? console.error(r, ...n) : console.error(r);
519
519
  break;
520
- case w.WARN:
520
+ case E.WARN:
521
521
  i ? console.warn(r, ...n) : console.warn(r);
522
522
  break;
523
- case w.INFO:
523
+ case E.INFO:
524
524
  i ? console.info(r, ...n) : console.info(r);
525
525
  break;
526
- case w.DEBUG:
527
- case w.TRACE:
526
+ case E.DEBUG:
527
+ case E.TRACE:
528
528
  i ? console.log(r, ...n) : console.log(r);
529
529
  break;
530
530
  }
@@ -536,7 +536,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
536
536
  * @param {any[]} args - 额外参数
537
537
  */
538
538
  static error(e, r, ...n) {
539
- f.log(w.ERROR, e, r, ...n);
539
+ g.log(E.ERROR, e, r, ...n);
540
540
  }
541
541
  /**
542
542
  * 警告级别日志
@@ -545,7 +545,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
545
545
  * @param {any[]} args - 额外参数
546
546
  */
547
547
  static warn(e, r, ...n) {
548
- f.log(w.WARN, e, r, ...n);
548
+ g.log(E.WARN, e, r, ...n);
549
549
  }
550
550
  /**
551
551
  * 信息级别日志
@@ -554,7 +554,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
554
554
  * @param {any[]} args - 额外参数
555
555
  */
556
556
  static info(e, r, ...n) {
557
- f.log(w.INFO, e, r, ...n);
557
+ g.log(E.INFO, e, r, ...n);
558
558
  }
559
559
  /**
560
560
  * 调试级别日志
@@ -563,7 +563,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
563
563
  * @param {any[]} args - 额外参数
564
564
  */
565
565
  static debug(e, r, ...n) {
566
- f.log(w.DEBUG, e, r, ...n);
566
+ g.log(E.DEBUG, e, r, ...n);
567
567
  }
568
568
  /**
569
569
  * 跟踪级别日志
@@ -572,7 +572,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
572
572
  * @param {any[]} args - 额外参数
573
573
  */
574
574
  static trace(e, r, ...n) {
575
- f.log(w.TRACE, e, r, ...n);
575
+ g.log(E.TRACE, e, r, ...n);
576
576
  }
577
577
  /**
578
578
  * 获取日志历史
@@ -580,13 +580,13 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
580
580
  * @returns {Array} 日志条目数组
581
581
  */
582
582
  static getHistory(e) {
583
- return e && e > 0 ? f.logHistory.slice(-e) : [...f.logHistory];
583
+ return e && e > 0 ? g.logHistory.slice(-e) : [...g.logHistory];
584
584
  }
585
585
  /**
586
586
  * 清空日志历史
587
587
  */
588
588
  static clearHistory() {
589
- f.logHistory = [], f.log(w.INFO, "Logger", "日志历史已清空");
589
+ g.logHistory = [], g.log(E.INFO, "Logger", "日志历史已清空");
590
590
  }
591
591
  /**
592
592
  * 获取日志统计信息
@@ -594,15 +594,15 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
594
594
  */
595
595
  static getStats() {
596
596
  const e = {
597
- currentLevel: f.currentLevel,
598
- currentLevelName: ee[f.currentLevel],
599
- enabledModules: Array.from(f.enabledModules),
600
- historySize: f.logHistory.length,
601
- maxHistorySize: f.maxHistorySize
597
+ currentLevel: g.currentLevel,
598
+ currentLevelName: re[g.currentLevel],
599
+ enabledModules: Array.from(g.enabledModules),
600
+ historySize: g.logHistory.length,
601
+ maxHistorySize: g.maxHistorySize
602
602
  }, r = {};
603
- for (const n of Object.keys(ee))
604
- r[ee[n]] = 0;
605
- return f.logHistory.forEach((n) => {
603
+ for (const n of Object.keys(re))
604
+ r[re[n]] = 0;
605
+ return g.logHistory.forEach((n) => {
606
606
  r[n.levelName]++;
607
607
  }), e.levelCounts = r, e;
608
608
  }
@@ -612,7 +612,7 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
612
612
  * @returns {string} JSON 字符串
613
613
  */
614
614
  static exportToJSON(e) {
615
- const r = f.getHistory(e), n = f.getStats();
615
+ const r = g.getHistory(e), n = g.getStats();
616
616
  return JSON.stringify({
617
617
  exportTime: (/* @__PURE__ */ new Date()).toISOString(),
618
618
  stats: n,
@@ -626,11 +626,11 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
626
626
  */
627
627
  static createModuleLogger(e) {
628
628
  return {
629
- error: (r, ...n) => f.error(e, r, ...n),
630
- warn: (r, ...n) => f.warn(e, r, ...n),
631
- info: (r, ...n) => f.info(e, r, ...n),
632
- debug: (r, ...n) => f.debug(e, r, ...n),
633
- trace: (r, ...n) => f.trace(e, r, ...n)
629
+ error: (r, ...n) => g.error(e, r, ...n),
630
+ warn: (r, ...n) => g.warn(e, r, ...n),
631
+ info: (r, ...n) => g.info(e, r, ...n),
632
+ debug: (r, ...n) => g.debug(e, r, ...n),
633
+ trace: (r, ...n) => g.trace(e, r, ...n)
634
634
  };
635
635
  }
636
636
  /**
@@ -638,14 +638,14 @@ const G = new vt(), Fe = () => G.waitForReady(), xt = () => G.isReady(), Dt = ()
638
638
  * @param {(entry: any) => void|null} reporter
639
639
  */
640
640
  static setReporter(e) {
641
- f.reporter = typeof e == "function" ? e : null;
641
+ g.reporter = typeof e == "function" ? e : null;
642
642
  }
643
643
  };
644
- v(f, "currentLevel", w.ERROR), // 生产环境默认只显示错误
645
- v(f, "enabledModules", /* @__PURE__ */ new Set()), // 启用日志的模块
646
- v(f, "logHistory", []), // 日志历史(最多保留1000条)
647
- v(f, "maxHistorySize", 1e3), v(f, "prefix", "[QSH-SDK]"), v(f, "reporter", null);
648
- let S = f;
644
+ U(g, "currentLevel", E.ERROR), // 生产环境默认只显示错误
645
+ U(g, "enabledModules", /* @__PURE__ */ new Set()), // 启用日志的模块
646
+ U(g, "logHistory", []), // 日志历史(最多保留1000条)
647
+ U(g, "maxHistorySize", 1e3), U(g, "prefix", "[QSH-SDK]"), U(g, "reporter", null);
648
+ let T = g;
649
649
  if (typeof window != "undefined") {
650
650
  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"));
651
651
  let r = !1;
@@ -653,34 +653,34 @@ if (typeof window != "undefined") {
653
653
  r = localStorage && localStorage.getItem("qsh_debug") === "true";
654
654
  } catch (n) {
655
655
  }
656
- (t || e || r) && S.enableDevMode();
656
+ (t || e || r) && T.enableDevMode();
657
657
  }
658
- const y = S.createModuleLogger("Bridge"), _ = S.createModuleLogger("Platform"), s = S.createModuleLogger("API"), M = S.createModuleLogger("State"), ke = /complete|loaded|interactive/;
659
- function Ut(t) {
660
- return me() || Ce() ? (y.debug("检测到 APP 环境,开始初始化"), window.__uniapp_x_postMessage || window.__uniapp_x_ || window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? (y.debug("NVUE/UVUE 环境,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)) : window.plus && ke.test(document.readyState) ? (y.debug("Plus 环境已就绪,立即初始化"), setTimeout(t, 0)) : (y.debug("Plus 环境,等待 plusready 事件"), document.addEventListener("plusready", t)), !0) : !1;
658
+ const I = T.createModuleLogger("Bridge"), m = T.createModuleLogger("Platform"), s = T.createModuleLogger("API"), x = T.createModuleLogger("State"), Ge = /complete|loaded|interactive/;
659
+ function kt(t) {
660
+ return ye() || Ne() ? (I.debug("检测到 APP 环境,开始初始化"), window.__uniapp_x_postMessage || window.__uniapp_x_ || window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? (I.debug("NVUE/UVUE 环境,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)) : window.plus && Ge.test(document.readyState) ? (I.debug("Plus 环境已就绪,立即初始化"), setTimeout(t, 0)) : (I.debug("Plus 环境,等待 plusready 事件"), document.addEventListener("plusready", t)), !0) : !1;
661
661
  }
662
- function Wt(t) {
663
- return window.wx && window.wx.miniProgram ? (y.debug("检测到微信小程序环境,开始初始化"), window.WeixinJSBridge && window.WeixinJSBridge.invoke ? (y.debug("微信 JSBridge 已就绪,立即初始化"), setTimeout(t, 0)) : (y.debug("微信 JSBridge 未就绪,等待 WeixinJSBridgeReady 事件"), document.addEventListener("WeixinJSBridgeReady", t)), !0) : !1;
662
+ function Kt(t) {
663
+ return window.wx && window.wx.miniProgram ? (I.debug("检测到微信小程序环境,开始初始化"), window.WeixinJSBridge && window.WeixinJSBridge.invoke ? (I.debug("微信 JSBridge 已就绪,立即初始化"), setTimeout(t, 0)) : (I.debug("微信 JSBridge 未就绪,等待 WeixinJSBridgeReady 事件"), document.addEventListener("WeixinJSBridgeReady", t)), !0) : !1;
664
664
  }
665
- function $t(t) {
666
- return y.info("开始初始化 JSBridge"), Ut(t) ? (y.info("使用 APP 环境初始化"), !0) : Wt(t) ? (y.info("使用微信小程序环境初始化"), !0) : (y.debug("使用默认 H5 环境初始化"), ke.test(document.readyState) ? (y.debug("DOM 已就绪,立即初始化"), setTimeout(t, 0)) : (y.debug("DOM 未就绪,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)), !0);
665
+ function zt(t) {
666
+ return I.info("开始初始化 JSBridge"), kt(t) ? (I.info("使用 APP 环境初始化"), !0) : Kt(t) ? (I.info("使用微信小程序环境初始化"), !0) : (I.debug("使用默认 H5 环境初始化"), Ge.test(document.readyState) ? (I.debug("DOM 已就绪,立即初始化"), setTimeout(t, 0)) : (I.debug("DOM 未就绪,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)), !0);
667
667
  }
668
- function Bt() {
669
- return G.waitForReady();
668
+ function Gt() {
669
+ return j.waitForReady();
670
670
  }
671
- function ze() {
672
- return G.startInitialization(() => m(null, null, function* () {
671
+ function Ve() {
672
+ return j.startInitialization(() => p(null, null, function* () {
673
673
  return new Promise((t, e) => {
674
674
  const r = () => {
675
675
  t();
676
676
  }, n = (i) => {
677
- const a = u.handleApiError(i, {
677
+ const a = l.handleApiError(i, {
678
678
  context: "bridge initialization"
679
679
  });
680
680
  e(a);
681
681
  };
682
682
  try {
683
- $t(() => {
683
+ zt(() => {
684
684
  r();
685
685
  });
686
686
  } catch (i) {
@@ -689,23 +689,76 @@ function ze() {
689
689
  });
690
690
  }));
691
691
  }
692
- const R = {
692
+ const _ = {
693
693
  UNINITIALIZED: "uninitialized",
694
694
  CONFIGURING: "configuring",
695
695
  CONFIGURED: "configured",
696
696
  ERROR: "error"
697
697
  };
698
- class Ft {
698
+ function F() {
699
+ return typeof window == "undefined" || !window.wx ? !1 : typeof window.wx.config == "function" && typeof window.wx.ready == "function" && typeof window.wx.error == "function";
700
+ }
701
+ class Vt {
699
702
  constructor() {
700
- this.state = R.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.CONFIG_API_URL = this.getConfigApiUrl(), this.CLIENT_ID = "bmfw-client", 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);
703
+ this.state = _.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.runtimeConfig = {
704
+ clientId: null,
705
+ isProd: !1
706
+ }, 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);
707
+ }
708
+ configure(e = {}) {
709
+ if (!e || typeof e != "object" || Array.isArray(e))
710
+ throw new P(
711
+ M.INVALID_PARAMETERS,
712
+ "config参数异常",
713
+ { config: e }
714
+ );
715
+ if (!Object.prototype.hasOwnProperty.call(e, "clientId"))
716
+ throw this.createMissingClientIdError();
717
+ if (typeof e.clientId != "string" || !e.clientId.trim())
718
+ throw new P(
719
+ M.INVALID_PARAMETERS,
720
+ "clientId参数异常",
721
+ { clientId: e.clientId }
722
+ );
723
+ if (Object.prototype.hasOwnProperty.call(e, "isProd") && typeof e.isProd != "boolean")
724
+ throw new P(
725
+ M.INVALID_PARAMETERS,
726
+ "isProd参数异常",
727
+ { isProd: e.isProd }
728
+ );
729
+ const r = e.clientId.trim(), n = e.isProd === !0, i = r !== this.runtimeConfig.clientId || n !== this.runtimeConfig.isProd;
730
+ return this.runtimeConfig = A(h({}, this.runtimeConfig), {
731
+ clientId: r,
732
+ isProd: n
733
+ }), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state === _.ERROR || i && (this.state === _.CONFIGURING || this.state === _.CONFIGURED)) && this.reset(), m.info("Updated Weixin runtime config", {
734
+ clientId: this.runtimeConfig.clientId,
735
+ isProd: this.runtimeConfig.isProd,
736
+ configApiUrl: this.CONFIG_API_URL
737
+ }), this.getRuntimeConfig();
738
+ }
739
+ getRuntimeConfig() {
740
+ return h({}, this.runtimeConfig);
741
+ }
742
+ hasClientId() {
743
+ return typeof this.runtimeConfig.clientId == "string" && this.runtimeConfig.clientId.length > 0;
744
+ }
745
+ hasRequiredConfig() {
746
+ return this.isTestMode() || this.hasClientId();
747
+ }
748
+ createMissingClientIdError() {
749
+ return new P(
750
+ M.INVALID_PARAMETERS,
751
+ "clientId错误",
752
+ { field: "clientId" }
753
+ );
701
754
  }
702
755
  /**
703
756
  * 获取配置API的URL(支持开发环境代理)
704
757
  * @returns {string} API URL
705
758
  * @private
706
759
  */
707
- getConfigApiUrl() {
708
- return typeof window != "undefined" && (window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") || window.location.hostname.includes("natappfree.cc") || window.location.port === "5174"), "https://unified-platform-service.xjy2.cn/api/wechat/mp/jssdk-sign";
760
+ getConfigApiUrl(e = !1) {
761
+ return e ? "https://tyck-service.xj-agri.gov.cn/api/wechat/mp/jssdk-sign" : "https://unified-platform-service.xjy2.cn/api/wechat/mp/jssdk-sign";
709
762
  }
710
763
  /**
711
764
  * 获取当前页面URL(不包含hash部分)
@@ -724,30 +777,34 @@ class Ft {
724
777
  * @private
725
778
  */
726
779
  fetchWeixinConfig() {
727
- return m(this, null, function* () {
780
+ return p(this, null, function* () {
728
781
  const e = this.getCurrentPageUrl();
729
782
  if (this.isTestMode())
730
- return _.info("使用测试模式,返回模拟配置"), this.getMockConfig();
731
- const r = `${this.CONFIG_API_URL}?clientId=${this.CLIENT_ID}&url=${encodeURIComponent(e)}`;
732
- _.debug("请求微信配置", { url: r });
783
+ return m.info("使用测试模式,返回模拟配置"), this.getMockConfig();
784
+ if (!this.hasClientId())
785
+ throw this.createMissingClientIdError();
786
+ const r = this.getConfigApiUrl(this.runtimeConfig.isProd);
787
+ this.CONFIG_API_URL = r;
788
+ const n = `${r}?clientId=${this.runtimeConfig.clientId}&url=${encodeURIComponent(e)}`;
789
+ m.debug("请求微信配置", { url: n });
733
790
  try {
734
- const n = yield fetch(r);
735
- if (!n.ok)
736
- throw new Error(`HTTP ${n.status}: ${n.statusText}`);
737
- const i = yield n.json();
738
- if (_.debug("微信配置响应", i), !i.success || i.code !== 200)
739
- throw new Error(`配置获取失败: ${i.message || "未知错误"}`);
740
- const { data: a } = i;
741
- if (!a || !a.appId || !a.timestamp || !a.nonceStr || !a.signature)
791
+ const i = yield fetch(n);
792
+ if (!i.ok)
793
+ throw new Error(`HTTP ${i.status}: ${i.statusText}`);
794
+ const a = yield i.json();
795
+ if (m.debug("微信配置响应", a), !a.success || a.code !== 200)
796
+ throw new Error(`配置获取失败: ${a.message || "未知错误"}`);
797
+ const { data: c } = a;
798
+ if (!c || !c.appId || !c.timestamp || !c.nonceStr || !c.signature)
742
799
  throw new Error("配置数据格式不正确,缺少必需字段");
743
- return a;
744
- } catch (n) {
745
- if (_.error("获取微信配置失败", n), this.shouldUseTestMode(n))
746
- return _.warn("网络请求失败,降级到测试模式"), this.getMockConfig();
747
- throw new L(
748
- U.NETWORK_ERROR,
749
- `获取微信配置失败: ${n.message}`,
750
- { url: r, originalError: n }
800
+ return c;
801
+ } catch (i) {
802
+ if (m.error("获取微信配置失败", i), this.shouldUseTestMode(i))
803
+ return m.warn("网络请求失败,降级到测试模式"), this.getMockConfig();
804
+ throw new P(
805
+ M.NETWORK_ERROR,
806
+ `获取微信配置失败: ${i.message}`,
807
+ { url: n, originalError: i }
751
808
  );
752
809
  }
753
810
  });
@@ -773,6 +830,7 @@ class Ft {
773
830
  * @private
774
831
  */
775
832
  shouldUseTestMode(e) {
833
+ if (typeof window == "undefined") return !1;
776
834
  const r = window.location.hostname === "localhost" || window.location.hostname.includes("natappfree.cc"), n = !window.wx || !window.wx.miniProgram, i = e.message.includes("CORS") || e.message.includes("Failed to fetch");
777
835
  return r && n && i;
778
836
  }
@@ -796,12 +854,12 @@ class Ft {
796
854
  */
797
855
  executeWeixinConfig(e) {
798
856
  if (this.isTestMode() || e.appId === "wx_test_app_id") {
799
- _.info("测试模式:模拟微信配置成功"), setTimeout(() => {
857
+ m.info("测试模式:模拟微信配置成功"), setTimeout(() => {
800
858
  this.handleConfigSuccess();
801
859
  }, 100);
802
860
  return;
803
861
  }
804
- if (!window.wx)
862
+ if (!F())
805
863
  throw new Error("微信JS-SDK未加载");
806
864
  const r = {
807
865
  debug: !1,
@@ -812,20 +870,22 @@ class Ft {
812
870
  signature: e.signature,
813
871
  jsApiList: this.DEFAULT_JS_API_LIST
814
872
  };
815
- _.info("执行微信配置", r), window.wx.ready(this.handleConfigSuccess), window.wx.error(this.handleConfigError), window.wx.config(r);
873
+ m.info("执行微信配置", r), window.wx.ready(this.handleConfigSuccess), window.wx.error(this.handleConfigError), window.wx.config(r);
816
874
  }
817
875
  /**
818
876
  * 处理配置成功
819
877
  * @private
820
878
  */
821
879
  handleConfigSuccess() {
822
- _.info("微信配置成功"), this.state = R.CONFIGURED, this.readyCallbacks.forEach((e) => {
880
+ m.info("微信配置成功"), this.state = _.CONFIGURED, this.lastError = null, this.configPromise = null;
881
+ const e = [...this.readyCallbacks];
882
+ this.readyCallbacks = [], this.errorCallbacks = [], e.forEach((r) => {
823
883
  try {
824
- e();
825
- } catch (r) {
826
- u.handleApiError(r, { context: "WeixinConfigManager.handleConfigSuccess" });
884
+ r();
885
+ } catch (n) {
886
+ l.handleApiError(n, { context: "WeixinConfigManager.handleConfigSuccess" });
827
887
  }
828
- }), this.readyCallbacks = [], this.errorCallbacks = [];
888
+ });
829
889
  }
830
890
  /**
831
891
  * 处理配置错误
@@ -834,25 +894,29 @@ class Ft {
834
894
  */
835
895
  handleConfigError(e) {
836
896
  const r = `微信配置验证失败: ${JSON.stringify(e)}`;
837
- _.error(r, e), this.state = R.ERROR, this.lastError = new L(
838
- U.API_CALL_FAILED,
897
+ m.error(r, e);
898
+ const n = new P(
899
+ M.API_CALL_FAILED,
839
900
  r,
840
901
  { weixinErrorResponse: e }
841
- ), this.errorCallbacks.forEach((n) => {
902
+ );
903
+ this.state = _.ERROR, this.lastError = n, this.configPromise = null;
904
+ const i = [...this.errorCallbacks];
905
+ this.readyCallbacks = [], this.errorCallbacks = [], i.forEach((a) => {
842
906
  try {
843
- n(this.lastError);
844
- } catch (i) {
845
- u.handleApiError(i, { context: "WeixinConfigManager.handleConfigError" });
907
+ a(n);
908
+ } catch (c) {
909
+ l.handleApiError(c, { context: "WeixinConfigManager.handleConfigError" });
846
910
  }
847
- }), this.readyCallbacks = [], this.errorCallbacks = [];
911
+ });
848
912
  }
849
913
  /**
850
914
  * 自动配置微信JS-SDK
851
915
  * @returns {Promise<void>} 配置完成的Promise
852
916
  */
853
917
  autoConfig() {
854
- return m(this, null, function* () {
855
- return this.state === R.CONFIGURED ? Promise.resolve() : this.state === R.ERROR ? Promise.reject(this.lastError) : this.configPromise ? this.configPromise : (this.state = R.CONFIGURING, this.configPromise = this.performAutoConfig(), this.configPromise);
918
+ return p(this, null, function* () {
919
+ return this.hasRequiredConfig() ? this.state === _.CONFIGURED ? Promise.resolve() : this.state === _.ERROR ? Promise.reject(this.lastError) : this.configPromise ? this.configPromise : (this.state = _.CONFIGURING, this.configPromise = this.performAutoConfig(), this.configPromise) : (m.warn("clientId为空,等待qsh.config({ clientId })"), Promise.resolve());
856
920
  });
857
921
  }
858
922
  /**
@@ -861,25 +925,36 @@ class Ft {
861
925
  * @private
862
926
  */
863
927
  performAutoConfig() {
864
- return m(this, null, function* () {
865
- return u.safeExecuteAsync(() => m(this, null, function* () {
928
+ return p(this, null, function* () {
929
+ try {
866
930
  if (typeof window == "undefined")
867
931
  throw new Error("非浏览器环境无法执行微信配置");
868
- if (!window.wx)
932
+ if (!F())
869
933
  throw new Error("微信JS-SDK未加载,无法执行配置");
870
934
  const e = yield this.fetchWeixinConfig();
871
- return this.executeWeixinConfig(e), new Promise((r, n) => {
872
- if (this.state === R.CONFIGURED) {
935
+ return this.executeWeixinConfig(e), yield new Promise((r, n) => {
936
+ if (this.state === _.CONFIGURED) {
873
937
  r();
874
938
  return;
875
939
  }
876
- if (this.state === R.ERROR) {
940
+ if (this.state === _.ERROR) {
877
941
  n(this.lastError);
878
942
  return;
879
943
  }
880
944
  this.readyCallbacks.push(r), this.errorCallbacks.push(n);
881
945
  });
882
- }), { context: "WeixinConfigManager.performAutoConfig" });
946
+ } catch (e) {
947
+ const r = e instanceof P ? e : l.handleApiError(e, { context: "WeixinConfigManager.performAutoConfig" });
948
+ this.state = _.ERROR, this.lastError = r, this.configPromise = null;
949
+ const n = [...this.errorCallbacks];
950
+ throw this.readyCallbacks = [], this.errorCallbacks = [], n.forEach((i) => {
951
+ try {
952
+ i(r);
953
+ } catch (a) {
954
+ l.handleApiError(a, { context: "WeixinConfigManager.performAutoConfig.errorCallback" });
955
+ }
956
+ }), r;
957
+ }
883
958
  });
884
959
  }
885
960
  /**
@@ -887,16 +962,16 @@ class Ft {
887
962
  * @returns {Promise<void>} 配置完成的Promise
888
963
  */
889
964
  waitForReady() {
890
- return this.state === R.CONFIGURED ? Promise.resolve() : this.state === R.ERROR ? Promise.reject(this.lastError) : this.state === R.UNINITIALIZED ? this.autoConfig() : new Promise((e, r) => {
965
+ return this.state === _.CONFIGURED ? Promise.resolve() : this.state === _.ERROR ? Promise.reject(this.lastError) : this.hasRequiredConfig() ? this.state === _.UNINITIALIZED ? this.autoConfig() : new Promise((e, r) => {
891
966
  this.readyCallbacks.push(e), this.errorCallbacks.push(r);
892
- });
967
+ }) : Promise.reject(this.createMissingClientIdError());
893
968
  }
894
969
  /**
895
970
  * 检查配置状态
896
971
  * @returns {boolean} 是否已配置
897
972
  */
898
973
  isReady() {
899
- return this.state === R.CONFIGURED;
974
+ return this.state === _.CONFIGURED;
900
975
  }
901
976
  /**
902
977
  * 获取当前状态
@@ -916,7 +991,7 @@ class Ft {
916
991
  * 重置配置管理器(用于重试或测试)
917
992
  */
918
993
  reset() {
919
- this.state = R.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, _.debug("微信配置管理器已重置");
994
+ this.state = _.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, m.debug("微信配置管理器已重置");
920
995
  }
921
996
  /**
922
997
  * 获取配置统计信息
@@ -930,71 +1005,135 @@ class Ft {
930
1005
  hasConfigPromise: !!this.configPromise,
931
1006
  hasLastError: !!this.lastError,
932
1007
  configApiUrl: this.CONFIG_API_URL,
933
- clientId: this.CLIENT_ID,
1008
+ clientId: this.runtimeConfig.clientId,
1009
+ isProd: this.runtimeConfig.isProd,
934
1010
  jsApiList: this.DEFAULT_JS_API_LIST
935
1011
  };
936
1012
  }
937
1013
  }
938
- const F = new Ft();
939
- let H = !1, Ie = !1, ue = !1;
940
- function kt() {
941
- if (typeof window == "undefined" || Ie || H || window.wx && window.wx.miniProgram) return !1;
942
- const t = navigator.userAgent || "", e = /micromessenger/i.test(t), r = /miniProgram/i.test(t), n = typeof window.__wxjs_environment != "undefined" && window.__wxjs_environment === "miniprogram";
943
- return e && (r || n);
1014
+ const N = new Vt();
1015
+ let X = !1, se = !1, v = null, de = !1;
1016
+ function jt(t) {
1017
+ return new Promise((e) => {
1018
+ let r = !1, n = null;
1019
+ const i = (d) => p(null, null, function* () {
1020
+ if (!r) {
1021
+ if (r = !0, n && clearTimeout(n), X = !1, se = d, d)
1022
+ try {
1023
+ yield je();
1024
+ } catch (f) {
1025
+ m.error("微信配置失败,将使用消息桥作为后备", f);
1026
+ }
1027
+ e();
1028
+ }
1029
+ }), a = () => i(F()), c = () => {
1030
+ m.warn("已存在的微信 JS-SDK 脚本加载失败,SDK 将使用消息桥作为后备"), i(!1);
1031
+ };
1032
+ t.addEventListener("load", a, { once: !0 }), t.addEventListener("error", c, { once: !0 }), setTimeout(() => {
1033
+ F() && a();
1034
+ }, 0), n = setTimeout(() => {
1035
+ i(F());
1036
+ }, 3e3);
1037
+ });
944
1038
  }
945
- function Ae() {
946
- return m(this, null, function* () {
947
- if (ue)
948
- return F.waitForReady();
949
- ue = !0, _.info("开始自动配置微信JS-SDK");
1039
+ function Se() {
1040
+ return p(this, arguments, function* (t = {}) {
1041
+ const { force: e = !1, recoverFromError: r = !1 } = t;
1042
+ if (yield qe({ force: e }), !F())
1043
+ throw new Error("微信 JS-SDK 未正确加载,无法执行配置");
1044
+ r && Jt();
1045
+ });
1046
+ }
1047
+ function qt(t = !1) {
1048
+ if (typeof window == "undefined") return !1;
1049
+ if (F())
1050
+ return se = !0, !1;
1051
+ if (se) return !1;
1052
+ if (t) return !0;
1053
+ const e = navigator.userAgent || "", r = /micromessenger/i.test(e), n = /miniProgram/i.test(e), i = typeof window.__wxjs_environment != "undefined" && window.__wxjs_environment === "miniprogram", a = !!(window.wx && window.wx.miniProgram);
1054
+ return r && (n || i || a);
1055
+ }
1056
+ function Jt() {
1057
+ N.getState() === "error" && (N.reset(), de = !1);
1058
+ }
1059
+ function je() {
1060
+ return p(this, null, function* () {
1061
+ if (de)
1062
+ return N.waitForReady();
1063
+ de = !0, m.info("开始自动配置微信JS-SDK");
950
1064
  try {
951
- yield F.autoConfig(), _.info("微信JS-SDK自动配置完成");
1065
+ yield N.autoConfig(), m.info("微信JS-SDK自动配置完成");
952
1066
  } catch (t) {
953
- _.error("微信JS-SDK自动配置失败", t);
1067
+ m.error("微信JS-SDK自动配置失败", t);
954
1068
  }
955
1069
  });
956
1070
  }
957
- function zt() {
958
- return kt() ? document.getElementById("weixin-jssdk") ? (H = !1, Ie = !0, ue ? F.waitForReady() : Ae()) : new Promise((t) => {
959
- H = !0;
1071
+ function qe(t = {}) {
1072
+ const { force: e = !1 } = t;
1073
+ if (typeof window == "undefined")
1074
+ return Promise.resolve();
1075
+ if (F())
1076
+ return se = !0, Promise.resolve();
1077
+ const r = document.getElementById("weixin-jssdk");
1078
+ return r ? v || (X = !0, v = jt(r).finally(() => {
1079
+ v = null;
1080
+ }), v) : qt(e) ? v || (v = new Promise((n) => {
1081
+ X = !0;
960
1082
  try {
961
- const e = document.createElement("script");
962
- e.id = "weixin-jssdk", e.type = "text/javascript", e.async = !0, e.src = "https://res.wx.qq.com/open/js/jweixin-1.6.2.js", e.onload = function() {
963
- return m(this, null, function* () {
964
- Ie = !0, H = !1, _.info("微信 JS-SDK 已自动加载");
1083
+ const i = document.createElement("script");
1084
+ 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() {
1085
+ return p(this, null, function* () {
1086
+ se = !0, X = !1, m.info("微信 JS-SDK 已自动加载");
965
1087
  try {
966
- yield Ae();
967
- } catch (n) {
968
- _.error("微信配置失败,将使用消息桥作为后备", n);
1088
+ yield je();
1089
+ } catch (c) {
1090
+ m.error("微信配置失败,将使用消息桥作为后备", c);
969
1091
  }
970
- t();
1092
+ n();
971
1093
  });
972
- }, e.onerror = function() {
973
- H = !1, _.warn("微信 JS-SDK 加载失败,SDK 将使用消息桥作为后备"), t();
974
- }, (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(e);
975
- } catch (e) {
976
- H = !1, _.error("注入微信 JS-SDK 失败", e), t();
1094
+ }, i.onerror = function() {
1095
+ X = !1, m.warn("微信 JS-SDK 加载失败,SDK 将使用消息桥作为后备"), n();
1096
+ }, (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(i);
1097
+ } catch (i) {
1098
+ X = !1, m.error("注入微信 JS-SDK 失败", i), n();
977
1099
  }
978
- }) : Promise.resolve();
979
- }
980
- function k() {
981
- return F.waitForReady();
1100
+ }).finally(() => {
1101
+ v = null;
1102
+ }), v) : Promise.resolve();
1103
+ }
1104
+ function B() {
1105
+ return Se({ force: !0, recoverFromError: !0 }).then(() => N.waitForReady());
1106
+ }
1107
+ function Ue(t = {}) {
1108
+ const e = N.configure(t);
1109
+ return typeof window == "undefined" || Se({
1110
+ force: !0,
1111
+ recoverFromError: N.getState() === "error"
1112
+ }).then(() => {
1113
+ if (!N.isReady())
1114
+ return N.waitForReady().catch((r) => {
1115
+ m.error("Failed to auto-configure Weixin after qsh.config()", r);
1116
+ });
1117
+ window.wx && !F() && m.warn("window.wx 已存在,但微信 JS-SDK 尚未就绪,跳过自动配置");
1118
+ }).catch((r) => {
1119
+ m.error("Failed to preload Weixin JS-SDK", r);
1120
+ }), e;
982
1121
  }
983
- function z() {
984
- return F.isReady();
1122
+ function G() {
1123
+ return N.isReady();
985
1124
  }
986
- function Kt() {
987
- return F.getState();
1125
+ function Ht() {
1126
+ return N.getState();
988
1127
  }
989
- function ve() {
990
- return F;
1128
+ function _e() {
1129
+ return N;
991
1130
  }
992
- function Gt() {
993
- return m(this, null, function* () {
994
- return _.info("手动重试微信配置"), F.reset(), ue = !1, Ae();
1131
+ function Yt() {
1132
+ return p(this, null, function* () {
1133
+ return m.info("手动重试微信配置"), N.reset(), de = !1, yield Se({ force: !0 }), N.waitForReady();
995
1134
  });
996
1135
  }
997
- class Vt {
1136
+ class Xt {
998
1137
  constructor() {
999
1138
  this.plugins = /* @__PURE__ */ new Map(), this.installed = /* @__PURE__ */ new Set(), this.installOrder = [], s.debug("插件管理器已初始化");
1000
1139
  }
@@ -1006,7 +1145,7 @@ class Vt {
1006
1145
  * pluginManager.register(imagePlugin)
1007
1146
  */
1008
1147
  register(e) {
1009
- return u.safeExecute(() => {
1148
+ return l.safeExecute(() => {
1010
1149
  this.validatePlugin(e);
1011
1150
  const { name: r, version: n } = e;
1012
1151
  if (this.plugins.has(r)) {
@@ -1046,8 +1185,8 @@ class Vt {
1046
1185
  * await pluginManager.install('image', qsh)
1047
1186
  */
1048
1187
  install(e, r) {
1049
- return m(this, null, function* () {
1050
- return u.safeExecute(() => m(this, null, function* () {
1188
+ return p(this, null, function* () {
1189
+ return l.safeExecute(() => p(this, null, function* () {
1051
1190
  if (!this.plugins.has(e))
1052
1191
  throw new Error(`插件 ${e} 未注册`);
1053
1192
  if (this.installed.has(e)) {
@@ -1076,8 +1215,8 @@ class Vt {
1076
1215
  * await pluginManager.uninstall('image', qsh)
1077
1216
  */
1078
1217
  uninstall(e, r) {
1079
- return m(this, null, function* () {
1080
- return u.safeExecute(() => m(this, null, function* () {
1218
+ return p(this, null, function* () {
1219
+ return l.safeExecute(() => p(this, null, function* () {
1081
1220
  if (!this.installed.has(e)) {
1082
1221
  s.debug(`插件 ${e} 未安装,跳过卸载`);
1083
1222
  return;
@@ -1098,7 +1237,7 @@ class Vt {
1098
1237
  * @returns {Promise<void>}
1099
1238
  */
1100
1239
  uninstallAll(e) {
1101
- return m(this, null, function* () {
1240
+ return p(this, null, function* () {
1102
1241
  const r = [...this.installOrder].reverse();
1103
1242
  for (const n of r)
1104
1243
  yield this.uninstall(n, e);
@@ -1125,7 +1264,7 @@ class Vt {
1125
1264
  * await pluginManager.installAll(['image', 'location'], qsh)
1126
1265
  */
1127
1266
  installAll(e, r) {
1128
- return m(this, null, function* () {
1267
+ return p(this, null, function* () {
1129
1268
  if (!Array.isArray(e))
1130
1269
  throw new Error("names 必须是数组");
1131
1270
  for (const n of e)
@@ -1187,8 +1326,8 @@ class Vt {
1187
1326
  this.plugins.clear(), this.installed.clear(), this.installOrder = [];
1188
1327
  }
1189
1328
  }
1190
- const te = new Vt();
1191
- class jt {
1329
+ const ne = new Xt();
1330
+ class Zt {
1192
1331
  constructor() {
1193
1332
  this.requestInterceptors = [], this.responseInterceptors = [], s.debug("拦截器链已初始化");
1194
1333
  }
@@ -1247,8 +1386,8 @@ class jt {
1247
1386
  * @private
1248
1387
  */
1249
1388
  runRequest(e) {
1250
- return m(this, null, function* () {
1251
- let r = p({}, e);
1389
+ return p(this, null, function* () {
1390
+ let r = h({}, e);
1252
1391
  for (const { fn: n } of this.requestInterceptors) {
1253
1392
  if (r.abort) {
1254
1393
  s.debug("请求被中止", { apiName: r.apiName });
@@ -1273,7 +1412,7 @@ class jt {
1273
1412
  * @private
1274
1413
  */
1275
1414
  runResponse(e, r) {
1276
- return m(this, null, function* () {
1415
+ return p(this, null, function* () {
1277
1416
  let n = e;
1278
1417
  for (const { fn: i } of this.responseInterceptors)
1279
1418
  try {
@@ -1302,7 +1441,7 @@ class jt {
1302
1441
  };
1303
1442
  }
1304
1443
  }
1305
- const K = new jt(), qt = {
1444
+ const V = new Zt(), Qt = {
1306
1445
  /**
1307
1446
  * 请求日志
1308
1447
  */
@@ -1319,7 +1458,7 @@ const K = new jt(), qt = {
1319
1458
  success: t == null ? void 0 : t.success
1320
1459
  }), t;
1321
1460
  }
1322
- }, W = {
1461
+ }, k = {
1323
1462
  // 性能数据存储
1324
1463
  metrics: /* @__PURE__ */ new Map(),
1325
1464
  /**
@@ -1331,14 +1470,14 @@ const K = new jt(), qt = {
1331
1470
  */
1332
1471
  response: (t, e) => {
1333
1472
  const r = performance.now() - e.perfStartTime;
1334
- W.metrics.has(e.apiName) || W.metrics.set(e.apiName, {
1473
+ k.metrics.has(e.apiName) || k.metrics.set(e.apiName, {
1335
1474
  count: 0,
1336
1475
  totalTime: 0,
1337
1476
  minTime: 1 / 0,
1338
1477
  maxTime: 0,
1339
1478
  avgTime: 0
1340
1479
  });
1341
- const n = W.metrics.get(e.apiName);
1480
+ const n = k.metrics.get(e.apiName);
1342
1481
  return n.count++, n.totalTime += r, n.minTime = Math.min(n.minTime, r), n.maxTime = Math.max(n.maxTime, r), n.avgTime = n.totalTime / n.count, t;
1343
1482
  },
1344
1483
  /**
@@ -1346,30 +1485,30 @@ const K = new jt(), qt = {
1346
1485
  */
1347
1486
  getReport: () => {
1348
1487
  const t = {};
1349
- return W.metrics.forEach((e, r) => {
1350
- t[r] = p({}, e);
1488
+ return k.metrics.forEach((e, r) => {
1489
+ t[r] = h({}, e);
1351
1490
  }), t;
1352
1491
  },
1353
1492
  /**
1354
1493
  * 清空性能数据
1355
1494
  */
1356
1495
  clearMetrics: () => {
1357
- W.metrics.clear();
1496
+ k.metrics.clear();
1358
1497
  }
1359
1498
  };
1360
- function Jt(t = {}) {
1499
+ function er(t = {}) {
1361
1500
  const {
1362
1501
  maxRetries: e = 3,
1363
1502
  retryDelay: r = 1e3,
1364
1503
  shouldRetry: n = (i) => !i.success
1365
1504
  } = t;
1366
1505
  return {
1367
- response: (i, a) => m(null, null, function* () {
1368
- return a.retryCount || (a.retryCount = 0), n(i) && a.retryCount < e && (a.retryCount++, s.warn(`API 调用失败,第 ${a.retryCount} 次重试: ${a.apiName}`), yield new Promise((g) => setTimeout(g, r)), i.shouldRetry = !0, i.retryContext = a), i;
1506
+ response: (i, a) => p(null, null, function* () {
1507
+ return a.retryCount || (a.retryCount = 0), n(i) && a.retryCount < e && (a.retryCount++, s.warn(`API 调用失败,第 ${a.retryCount} 次重试: ${a.apiName}`), yield new Promise((c) => setTimeout(c, r)), i.shouldRetry = !0, i.retryContext = a), i;
1369
1508
  })
1370
1509
  };
1371
1510
  }
1372
- function Ht(t = {}) {
1511
+ function tr(t = {}) {
1373
1512
  return {
1374
1513
  request: (e) => {
1375
1514
  const r = t[e.apiName];
@@ -1381,7 +1520,7 @@ function Ht(t = {}) {
1381
1520
  }
1382
1521
  };
1383
1522
  }
1384
- class Yt {
1523
+ class rr {
1385
1524
  constructor() {
1386
1525
  this.state = {
1387
1526
  // SDK 状态
@@ -1393,11 +1532,11 @@ class Yt {
1393
1532
  },
1394
1533
  // 平台信息
1395
1534
  platform: {
1396
- type: c.type,
1397
- isWeixinMiniProgram: c.isWeixinMiniProgram,
1398
- isAppPlus: c.isAppPlus,
1399
- isNvue: c.isNvue,
1400
- isUvue: c.isUvue,
1535
+ type: u.type,
1536
+ isWeixinMiniProgram: u.isWeixinMiniProgram,
1537
+ isAppPlus: u.isAppPlus,
1538
+ isNvue: u.isNvue,
1539
+ isUvue: u.isUvue,
1401
1540
  features: {}
1402
1541
  // 平台支持的特性
1403
1542
  },
@@ -1425,7 +1564,7 @@ class Yt {
1425
1564
  api: {
1426
1565
  // 格式: { apiName: { loading: boolean, lastCall: timestamp, lastResult: any } }
1427
1566
  }
1428
- }, this.listeners = /* @__PURE__ */ new Map(), this.wildcardListeners = /* @__PURE__ */ new Set(), this.initNetworkListener(), M.debug("状态仓库已初始化");
1567
+ }, this.listeners = /* @__PURE__ */ new Map(), this.wildcardListeners = /* @__PURE__ */ new Set(), this.initNetworkListener(), x.debug("状态仓库已初始化");
1429
1568
  }
1430
1569
  /**
1431
1570
  * 获取状态值
@@ -1447,8 +1586,8 @@ class Yt {
1447
1586
  * store.set('network.online', false)
1448
1587
  */
1449
1588
  set(e, r) {
1450
- const n = e.split("."), i = n.pop(), a = n.reduce((d, l) => ((!d[l] || typeof d[l] != "object") && (d[l] = {}), d[l]), this.state), g = a[i];
1451
- g !== r && (a[i] = r, M.debug(`状态已更新: ${e}`, { oldValue: g, newValue: r }), this.notify(e, r, g));
1589
+ const n = e.split("."), i = n.pop(), a = n.reduce((d, f) => ((!d[f] || typeof d[f] != "object") && (d[f] = {}), d[f]), this.state), c = a[i];
1590
+ c !== r && (a[i] = r, x.debug(`状态已更新: ${e}`, { oldValue: c, newValue: r }), this.notify(e, r, c));
1452
1591
  }
1453
1592
  /**
1454
1593
  * 批量更新状态
@@ -1479,11 +1618,11 @@ class Yt {
1479
1618
  subscribe(e, r) {
1480
1619
  if (typeof r != "function")
1481
1620
  throw new Error("listener 必须是函数");
1482
- return e === "*" ? (this.wildcardListeners.add(r), M.debug("添加通配符订阅者"), () => {
1483
- this.wildcardListeners.delete(r), M.debug("移除通配符订阅者");
1484
- }) : (this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(r), M.debug(`添加订阅者: ${e}`), () => {
1621
+ return e === "*" ? (this.wildcardListeners.add(r), x.debug("添加通配符订阅者"), () => {
1622
+ this.wildcardListeners.delete(r), x.debug("移除通配符订阅者");
1623
+ }) : (this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(r), x.debug(`添加订阅者: ${e}`), () => {
1485
1624
  const n = this.listeners.get(e);
1486
- n && (n.delete(r), n.size === 0 && this.listeners.delete(e), M.debug(`移除订阅者: ${e}`));
1625
+ n && (n.delete(r), n.size === 0 && this.listeners.delete(e), x.debug(`移除订阅者: ${e}`));
1487
1626
  });
1488
1627
  }
1489
1628
  /**
@@ -1493,8 +1632,8 @@ class Yt {
1493
1632
  * @returns {Function} 取消订阅的函数
1494
1633
  */
1495
1634
  subscribeOnce(e, r) {
1496
- const n = this.subscribe(e, (i, a, g) => {
1497
- r(i, a, g), n();
1635
+ const n = this.subscribe(e, (i, a, c) => {
1636
+ r(i, a, c), n();
1498
1637
  });
1499
1638
  return n;
1500
1639
  }
@@ -1507,32 +1646,32 @@ class Yt {
1507
1646
  */
1508
1647
  notify(e, r, n) {
1509
1648
  const i = this.listeners.get(e);
1510
- i && i.forEach((g) => {
1649
+ i && i.forEach((c) => {
1511
1650
  try {
1512
- g(r, n, e);
1651
+ c(r, n, e);
1513
1652
  } catch (d) {
1514
- M.error("订阅者执行失败", d);
1653
+ x.error("订阅者执行失败", d);
1515
1654
  }
1516
1655
  });
1517
1656
  const a = e.split(".");
1518
- for (let g = 1; g < a.length; g++) {
1519
- const d = a.slice(0, g).join("."), l = this.listeners.get(d);
1520
- if (l) {
1521
- const h = this.get(d);
1522
- l.forEach((T) => {
1657
+ for (let c = 1; c < a.length; c++) {
1658
+ const d = a.slice(0, c).join("."), f = this.listeners.get(d);
1659
+ if (f) {
1660
+ const w = this.get(d);
1661
+ f.forEach((b) => {
1523
1662
  try {
1524
- T(h, void 0, d);
1525
- } catch (N) {
1526
- M.error("父路径订阅者执行失败", N);
1663
+ b(w, void 0, d);
1664
+ } catch (S) {
1665
+ x.error("父路径订阅者执行失败", S);
1527
1666
  }
1528
1667
  });
1529
1668
  }
1530
1669
  }
1531
- this.wildcardListeners.forEach((g) => {
1670
+ this.wildcardListeners.forEach((c) => {
1532
1671
  try {
1533
- g(r, n, e);
1672
+ c(r, n, e);
1534
1673
  } catch (d) {
1535
- M.error("通配符订阅者执行失败", d);
1674
+ x.error("通配符订阅者执行失败", d);
1536
1675
  }
1537
1676
  });
1538
1677
  }
@@ -1558,7 +1697,7 @@ class Yt {
1558
1697
  */
1559
1698
  setApiLoading(e, r = !0) {
1560
1699
  const n = `api.${e}`, i = this.get(n) || {};
1561
- this.set(n, A(p({}, i), {
1700
+ this.set(n, A(h({}, i), {
1562
1701
  loading: r,
1563
1702
  lastCall: r ? Date.now() : i.lastCall
1564
1703
  }));
@@ -1570,7 +1709,7 @@ class Yt {
1570
1709
  */
1571
1710
  setApiResult(e, r) {
1572
1711
  const n = `api.${e}`, i = this.get(n) || {};
1573
- this.set(n, A(p({}, i), {
1712
+ this.set(n, A(h({}, i), {
1574
1713
  loading: !1,
1575
1714
  lastResult: r,
1576
1715
  lastCallEnd: Date.now()
@@ -1611,7 +1750,7 @@ class Yt {
1611
1750
  album: "prompt"
1612
1751
  },
1613
1752
  api: {}
1614
- }, M.debug("状态已重置");
1753
+ }, x.debug("状态已重置");
1615
1754
  }
1616
1755
  /**
1617
1756
  * 获取统计信息
@@ -1625,7 +1764,7 @@ class Yt {
1625
1764
  };
1626
1765
  }
1627
1766
  }
1628
- const x = new Yt(), o = {
1767
+ const W = new rr(), o = {
1629
1768
  // SDK 核心错误 (E_SDK_xxx)
1630
1769
  SDK_NOT_READY: "E_SDK_001",
1631
1770
  SDK_INIT_FAILED: "E_SDK_002",
@@ -1676,7 +1815,7 @@ const x = new Yt(), o = {
1676
1815
  API_TIMEOUT: "E_TIMEOUT_001",
1677
1816
  // 通用错误
1678
1817
  UNKNOWN_ERROR: "E_UNKNOWN_999"
1679
- }, Oe = {
1818
+ }, Re = {
1680
1819
  // SDK 核心
1681
1820
  [o.SDK_NOT_READY]: "SDK 未就绪",
1682
1821
  [o.SDK_INIT_FAILED]: "SDK 初始化失败",
@@ -1717,7 +1856,7 @@ const x = new Yt(), o = {
1717
1856
  [o.API_TIMEOUT]: "API 调用超时",
1718
1857
  // 通用
1719
1858
  [o.UNKNOWN_ERROR]: "未知错误"
1720
- }, b = {
1859
+ }, D = {
1721
1860
  USER_CANCEL: "user_cancel",
1722
1861
  // 用户主动取消
1723
1862
  PERMISSION: "permission",
@@ -1732,7 +1871,7 @@ const x = new Yt(), o = {
1732
1871
  // 配置问题
1733
1872
  UNKNOWN: "unknown"
1734
1873
  // 未知问题
1735
- }, Xt = {
1874
+ }, nr = {
1736
1875
  // 图片相关
1737
1876
  "IMAGE/USER_CANCEL": o.IMAGE_CANCELLED,
1738
1877
  "IMAGE/PERMISSION_DENIED": o.IMAGE_NO_PERMISSION,
@@ -1740,7 +1879,7 @@ const x = new Yt(), o = {
1740
1879
  "COMMON/UNKNOWN": o.UNKNOWN_ERROR,
1741
1880
  "COMMON/CONFIG_NOT_READY": o.IMAGE_CONFIG_NOT_READY,
1742
1881
  "COMMON/PLATFORM_NOT_SUPPORTED": o.PLATFORM_NOT_SUPPORTED
1743
- }, xe = {
1882
+ }, We = {
1744
1883
  // 微信平台错误模式
1745
1884
  weixin: {
1746
1885
  patterns: [
@@ -1763,7 +1902,7 @@ const x = new Yt(), o = {
1763
1902
  ],
1764
1903
  default: o.UNKNOWN_ERROR
1765
1904
  }
1766
- }, De = {
1905
+ }, Fe = {
1767
1906
  chooseImage: {
1768
1907
  "fail cancel": o.IMAGE_CANCELLED,
1769
1908
  "fail auth deny": o.IMAGE_NO_PERMISSION,
@@ -1777,19 +1916,19 @@ const x = new Yt(), o = {
1777
1916
  NOT_IN_CONTAINER: o.PLATFORM_NOT_SUPPORTED
1778
1917
  }
1779
1918
  };
1780
- function Ke(t) {
1781
- return t ? t.includes("CANCEL") ? b.USER_CANCEL : t.includes("PERM") || t.includes("PERMISSION") ? b.PERMISSION : t.includes("NET") || t.includes("NETWORK") ? b.NETWORK : t.includes("PARAM") ? b.PARAM : t.includes("CONFIG") ? b.CONFIG : t.includes("SDK") || t.includes("PLATFORM") ? b.SYSTEM : b.UNKNOWN : b.UNKNOWN;
1919
+ function Je(t) {
1920
+ return t ? t.includes("CANCEL") ? D.USER_CANCEL : t.includes("PERM") || t.includes("PERMISSION") ? D.PERMISSION : t.includes("NET") || t.includes("NETWORK") ? D.NETWORK : t.includes("PARAM") ? D.PARAM : t.includes("CONFIG") ? D.CONFIG : t.includes("SDK") || t.includes("PLATFORM") ? D.SYSTEM : D.UNKNOWN : D.UNKNOWN;
1782
1921
  }
1783
- function Zt(t) {
1922
+ function ir(t) {
1784
1923
  return t.includes("NET_") || t.includes("TIMEOUT") || t === o.NETWORK_ERROR || t === o.NETWORK_TIMEOUT || t === o.API_TIMEOUT;
1785
1924
  }
1786
- function Qt(t) {
1787
- return t.includes("CANCEL") || Ke(t) === b.USER_CANCEL;
1925
+ function sr(t) {
1926
+ return t.includes("CANCEL") || Je(t) === D.USER_CANCEL;
1788
1927
  }
1789
- function Y(t) {
1790
- return Oe[t] || Oe[o.UNKNOWN_ERROR];
1928
+ function Z(t) {
1929
+ return Re[t] || Re[o.UNKNOWN_ERROR];
1791
1930
  }
1792
- class D extends Error {
1931
+ class $ extends Error {
1793
1932
  /**
1794
1933
  * 构造函数
1795
1934
  * @param {string} code - 错误码
@@ -1797,7 +1936,7 @@ class D extends Error {
1797
1936
  * @param {Object} options - 选项
1798
1937
  */
1799
1938
  constructor(e, r, n = {}) {
1800
- super(r), this.name = "StandardError", this.code = e, this.message = r || Y(e), this.platform = n.platform || c.type, this.apiName = n.apiName, this.category = n.category || Ke(e), this.retriable = n.retriable !== void 0 ? n.retriable : Zt(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
1939
+ super(r), this.name = "StandardError", this.code = e, this.message = r || Z(e), this.platform = n.platform || u.type, this.apiName = n.apiName, this.category = n.category || Je(e), this.retriable = n.retriable !== void 0 ? n.retriable : ir(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
1801
1940
  }
1802
1941
  /**
1803
1942
  * 是否可重试
@@ -1811,14 +1950,14 @@ class D extends Error {
1811
1950
  * @returns {boolean}
1812
1951
  */
1813
1952
  isUserAction() {
1814
- return Qt(this.code);
1953
+ return sr(this.code);
1815
1954
  }
1816
1955
  /**
1817
1956
  * 转为普通对象
1818
1957
  * @returns {Object}
1819
1958
  */
1820
1959
  toJSON() {
1821
- return p({
1960
+ return h({
1822
1961
  code: this.code,
1823
1962
  message: this.message,
1824
1963
  platform: this.platform,
@@ -1832,15 +1971,15 @@ class D extends Error {
1832
1971
  } : {});
1833
1972
  }
1834
1973
  }
1835
- function Ge(t, e = {}) {
1836
- if (t instanceof D)
1974
+ function He(t, e = {}) {
1975
+ if (t instanceof $)
1837
1976
  return t;
1838
- const { apiName: r, platform: n = c.type } = e;
1839
- return t && typeof t.code == "string" && t.code.includes("/") ? er(t, { apiName: r, platform: n }) : t && (t.errMsg || t.message) ? tr(t, { apiName: r, platform: n }) : typeof t == "string" ? new D(
1977
+ const { apiName: r, platform: n = u.type } = e;
1978
+ return t && typeof t.code == "string" && t.code.includes("/") ? ar(t, { apiName: r, platform: n }) : t && (t.errMsg || t.message) ? or(t, { apiName: r, platform: n }) : typeof t == "string" ? new $(
1840
1979
  o.UNKNOWN_ERROR,
1841
1980
  t,
1842
1981
  { apiName: r, platform: n, originalError: t }
1843
- ) : new D(
1982
+ ) : new $(
1844
1983
  o.UNKNOWN_ERROR,
1845
1984
  "未知错误",
1846
1985
  {
@@ -1851,49 +1990,49 @@ function Ge(t, e = {}) {
1851
1990
  }
1852
1991
  );
1853
1992
  }
1854
- function er(t, e) {
1855
- const { apiName: r, platform: n } = e, i = t.code, a = Xt[i] || o.UNKNOWN_ERROR;
1993
+ function ar(t, e) {
1994
+ const { apiName: r, platform: n } = e, i = t.code, a = nr[i] || o.UNKNOWN_ERROR;
1856
1995
  return s.debug("转换旧版错误码", {
1857
1996
  legacy: i,
1858
1997
  new: a
1859
- }), new D(
1998
+ }), new $(
1860
1999
  a,
1861
- t.message || Y(a),
2000
+ t.message || Z(a),
1862
2001
  {
1863
2002
  apiName: r,
1864
2003
  platform: t.platform || n,
1865
2004
  originalError: t,
1866
- details: p({
2005
+ details: h({
1867
2006
  legacyCode: i,
1868
2007
  legacyVersion: t.version
1869
2008
  }, t.details)
1870
2009
  }
1871
2010
  );
1872
2011
  }
1873
- function tr(t, e) {
2012
+ function or(t, e) {
1874
2013
  const { apiName: r, platform: n } = e, i = (t.errMsg || t.message || "").toLowerCase();
1875
- if (r && De[r]) {
1876
- const d = De[r];
1877
- for (const [l, h] of Object.entries(d))
1878
- if (i.includes(l.toLowerCase()))
1879
- return new D(h, Y(h), {
2014
+ if (r && Fe[r]) {
2015
+ const d = Fe[r];
2016
+ for (const [f, w] of Object.entries(d))
2017
+ if (i.includes(f.toLowerCase()))
2018
+ return new $(w, Z(w), {
1880
2019
  apiName: r,
1881
2020
  platform: n,
1882
2021
  originalError: t
1883
2022
  });
1884
2023
  }
1885
- const a = xe[n] || xe.uniapp;
1886
- for (const { pattern: d, code: l } of a.patterns)
2024
+ const a = We[n] || We.uniapp;
2025
+ for (const { pattern: d, code: f } of a.patterns)
1887
2026
  if (d.test(i))
1888
- return new D(l, Y(l), {
2027
+ return new $(f, Z(f), {
1889
2028
  apiName: r,
1890
2029
  platform: n,
1891
2030
  originalError: t
1892
2031
  });
1893
- const g = a.default || o.UNKNOWN_ERROR;
1894
- return new D(
1895
- g,
1896
- t.errMsg || t.message || Y(g),
2032
+ const c = a.default || o.UNKNOWN_ERROR;
2033
+ return new $(
2034
+ c,
2035
+ t.errMsg || t.message || Z(c),
1897
2036
  {
1898
2037
  apiName: r,
1899
2038
  platform: n,
@@ -1901,7 +2040,7 @@ function tr(t, e) {
1901
2040
  }
1902
2041
  );
1903
2042
  }
1904
- const Ve = {
2043
+ const Ye = {
1905
2044
  /**
1906
2045
  * 响应拦截器
1907
2046
  * @param {Object} result - API 响应结果
@@ -1910,9 +2049,9 @@ const Ve = {
1910
2049
  */
1911
2050
  response: (t, e) => {
1912
2051
  if (!t.success && t.error) {
1913
- const r = Ge(t.error, {
2052
+ const r = He(t.error, {
1914
2053
  apiName: e.apiName,
1915
- platform: c.type
2054
+ platform: u.type
1916
2055
  });
1917
2056
  t.error = r.toJSON(), t.errorCode = r.code, t.errorCategory = r.category, t.retriable = r.isRetriable(), s.debug("错误已标准化", {
1918
2057
  api: e.apiName,
@@ -1923,25 +2062,25 @@ const Ve = {
1923
2062
  return t;
1924
2063
  }
1925
2064
  };
1926
- function rr(t, e = {}) {
1927
- return new D(t, Y(t), e);
2065
+ function cr(t, e = {}) {
2066
+ return new $(t, Z(t), e);
1928
2067
  }
1929
- function nr(t) {
1930
- return t instanceof D;
2068
+ function ur(t) {
2069
+ return t instanceof $;
1931
2070
  }
1932
- function ir(t, e, r) {
2071
+ function lr(t, e, r) {
1933
2072
  return e ? Promise.race([
1934
2073
  t(),
1935
2074
  new Promise((n, i) => setTimeout(() => i(new Error(`Init task timeout: ${r}`)), e))
1936
2075
  ]) : t();
1937
2076
  }
1938
- function sr() {
1939
- return m(this, arguments, function* (t = [], e = {}) {
2077
+ function fr() {
2078
+ return p(this, arguments, function* (t = [], e = {}) {
1940
2079
  for (const r of t) {
1941
2080
  const n = (r == null ? void 0 : r.name) || "anonymous-task", i = (r == null ? void 0 : r.run) || r;
1942
2081
  if (typeof i == "function")
1943
2082
  try {
1944
- yield ir(() => Promise.resolve().then(() => i()), r.timeoutMs, n), typeof r.onSuccess == "function" && r.onSuccess();
2083
+ yield lr(() => Promise.resolve().then(() => i()), r.timeoutMs, n), typeof r.onSuccess == "function" && r.onSuccess();
1945
2084
  } catch (a) {
1946
2085
  if (typeof r.onError == "function" && r.onError(a), typeof e.onError == "function")
1947
2086
  e.onError(a, r);
@@ -1951,7 +2090,7 @@ function sr() {
1951
2090
  }
1952
2091
  });
1953
2092
  }
1954
- class je {
2093
+ class Xe {
1955
2094
  /**
1956
2095
  * 构造函数
1957
2096
  * @param {string} name - 平台名称
@@ -1966,7 +2105,7 @@ class je {
1966
2105
  */
1967
2106
  processNavigationOptions(e = {}) {
1968
2107
  const { url: r, delta: n = 1 } = e, i = r && encodeURI(r), a = parseInt(n) || 1;
1969
- return A(p({}, e), {
2108
+ return A(h({}, e), {
1970
2109
  url: i,
1971
2110
  delta: a
1972
2111
  });
@@ -2077,18 +2216,18 @@ class je {
2077
2216
  throw new Error(`${this.name} platform must implement performGetEnv method`);
2078
2217
  }
2079
2218
  }
2080
- let re = [];
2081
- function ar() {
2082
- if (re.length === 0 && window.plus) {
2219
+ let ie = [];
2220
+ function dr() {
2221
+ if (ie.length === 0 && window.plus) {
2083
2222
  const t = plus.webview.currentWebview();
2084
2223
  if (!t)
2085
2224
  throw new Error("plus.webview.currentWebview() is undefined");
2086
2225
  const e = t.parent(), r = e ? e.id : t.id;
2087
- re.push(r);
2226
+ ie.push(r);
2088
2227
  }
2089
- return re;
2228
+ return ie;
2090
2229
  }
2091
- function or(t, e) {
2230
+ function gr(t, e) {
2092
2231
  const r = {
2093
2232
  options: {
2094
2233
  timestamp: +/* @__PURE__ */ new Date()
@@ -2104,12 +2243,12 @@ function or(t, e) {
2104
2243
  type: "WEB_INVOKE_APPSERVICE",
2105
2244
  args: {
2106
2245
  data: r,
2107
- webviewIds: re
2246
+ webviewIds: ie
2108
2247
  }
2109
2248
  };
2110
2249
  window.__uniapp_x_postMessage ? window.__uniapp_x_postMessageToService(n) : window.__uniapp_x_.postMessageToService(JSON.stringify(n));
2111
2250
  }
2112
- function cr(t, e) {
2251
+ function hr(t, e) {
2113
2252
  const r = {
2114
2253
  options: {
2115
2254
  timestamp: +/* @__PURE__ */ new Date()
@@ -2125,19 +2264,19 @@ function cr(t, e) {
2125
2264
  type: "WEB_INVOKE_APPSERVICE",
2126
2265
  args: {
2127
2266
  data: r,
2128
- webviewIds: re
2267
+ webviewIds: ie
2129
2268
  }
2130
2269
  };
2131
2270
  window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(n) : window.__dcloud_weex_.postMessageToService(JSON.stringify(n));
2132
2271
  }
2133
- function ur(t, e) {
2272
+ function pr(t, e) {
2134
2273
  const r = {
2135
2274
  options: {
2136
2275
  timestamp: +/* @__PURE__ */ new Date()
2137
2276
  },
2138
2277
  name: t,
2139
2278
  arg: e
2140
- }, n = ar();
2279
+ }, n = dr();
2141
2280
  if (plus.webview.getWebviewById("__uniapp__service"))
2142
2281
  plus.webview.postMessageToUniNView({
2143
2282
  type: "WEB_INVOKE_APPSERVICE",
@@ -2153,7 +2292,7 @@ function ur(t, e) {
2153
2292
  );
2154
2293
  }
2155
2294
  }
2156
- function lr(t, e) {
2295
+ function mr(t, e) {
2157
2296
  const r = {
2158
2297
  options: {
2159
2298
  timestamp: +/* @__PURE__ */ new Date()
@@ -2167,10 +2306,10 @@ function lr(t, e) {
2167
2306
  pageId: ""
2168
2307
  }, "*");
2169
2308
  }
2170
- function ne(t, e) {
2171
- he() ? or(t, e) : pe() ? cr(t, e) : ge() ? ur(t, e) : lr(t, e);
2309
+ function ae(t, e) {
2310
+ Ee() ? gr(t, e) : we() ? hr(t, e) : me() ? pr(t, e) : mr(t, e);
2172
2311
  }
2173
- class qe extends je {
2312
+ class Ze extends Xe {
2174
2313
  constructor() {
2175
2314
  super("weixin");
2176
2315
  }
@@ -2189,17 +2328,17 @@ class qe extends je {
2189
2328
  * @returns {void}
2190
2329
  */
2191
2330
  performNavigation(e, r) {
2192
- return u.safeExecute(() => {
2331
+ return l.safeExecute(() => {
2193
2332
  const { url: n, delta: i } = r;
2194
- if (_.debug(`微信平台执行导航操作: ${e}`, r), this.isWeixinApiAvailable()) {
2195
- const g = window.wx.miniProgram[e];
2196
- if (typeof g == "function") {
2197
- _.debug(`使用微信原生 API: wx.miniProgram.${e}`);
2333
+ if (m.debug(`微信平台执行导航操作: ${e}`, r), this.isWeixinApiAvailable()) {
2334
+ const c = window.wx.miniProgram[e];
2335
+ if (typeof c == "function") {
2336
+ m.debug(`使用微信原生 API: wx.miniProgram.${e}`);
2198
2337
  const d = e === "navigateBack" ? { delta: i } : { url: n };
2199
- return g.call(window.wx.miniProgram, d);
2338
+ return c.call(window.wx.miniProgram, d);
2200
2339
  }
2201
2340
  }
2202
- _.debug(`使用消息桥接执行: ${e}`), ne(e, e === "navigateBack" ? { delta: i } : { url: n });
2341
+ m.debug(`使用消息桥接执行: ${e}`), ae(e, e === "navigateBack" ? { delta: i } : { url: n });
2203
2342
  }, {
2204
2343
  platform: this.name,
2205
2344
  method: "performNavigation",
@@ -2213,11 +2352,11 @@ class qe extends je {
2213
2352
  * @returns {void}
2214
2353
  */
2215
2354
  performPostMessage(e) {
2216
- return u.safeExecute(() => {
2355
+ return l.safeExecute(() => {
2217
2356
  const { data: r } = e;
2218
2357
  if (this.isWeixinApiAvailable())
2219
2358
  return window.wx.miniProgram.postMessage({ data: r });
2220
- ne("postMessage", r);
2359
+ ae("postMessage", r);
2221
2360
  }, {
2222
2361
  platform: this.name,
2223
2362
  method: "performPostMessage",
@@ -2230,7 +2369,7 @@ class qe extends je {
2230
2369
  * @returns {void}
2231
2370
  */
2232
2371
  performGetEnv(e) {
2233
- return u.safeExecute(() => {
2372
+ return l.safeExecute(() => {
2234
2373
  if (!e || typeof e != "function")
2235
2374
  throw new Error("Callback function is required for getEnv");
2236
2375
  if (this.isWeixinApiAvailable() && window.wx.miniProgram.getEnv)
@@ -2245,19 +2384,19 @@ class qe extends je {
2245
2384
  });
2246
2385
  }
2247
2386
  }
2248
- const j = new qe(), fr = (t) => j.navigateTo(t), dr = (t) => j.navigateBack(t), gr = (t) => j.switchTab(t), pr = (t) => j.reLaunch(t), hr = (t) => j.redirectTo(t), mr = (t) => j.postMessage(t), wr = (t) => j.getEnv(t);
2249
- var Je = /* @__PURE__ */ Object.freeze({
2387
+ const J = new Ze(), wr = (t) => J.navigateTo(t), Er = (t) => J.navigateBack(t), yr = (t) => J.switchTab(t), Ir = (t) => J.reLaunch(t), Ar = (t) => J.redirectTo(t), Or = (t) => J.postMessage(t), Cr = (t) => J.getEnv(t);
2388
+ var Qe = /* @__PURE__ */ Object.freeze({
2250
2389
  __proto__: null,
2251
- WeixinPlatform: qe,
2252
- getEnv: wr,
2253
- navigateBack: dr,
2254
- navigateTo: fr,
2255
- postMessage: mr,
2256
- reLaunch: pr,
2257
- redirectTo: hr,
2258
- switchTab: gr
2390
+ WeixinPlatform: Ze,
2391
+ getEnv: Cr,
2392
+ navigateBack: Er,
2393
+ navigateTo: wr,
2394
+ postMessage: Or,
2395
+ reLaunch: Ir,
2396
+ redirectTo: Ar,
2397
+ switchTab: yr
2259
2398
  });
2260
- class He extends je {
2399
+ class et extends Xe {
2261
2400
  constructor() {
2262
2401
  super("app");
2263
2402
  }
@@ -2268,9 +2407,9 @@ class He extends je {
2268
2407
  * @returns {void}
2269
2408
  */
2270
2409
  performNavigation(e, r) {
2271
- return u.safeExecute(() => {
2410
+ return l.safeExecute(() => {
2272
2411
  const { url: n, delta: i } = r;
2273
- ne(e, e === "navigateBack" ? { delta: i } : { url: n });
2412
+ ae(e, e === "navigateBack" ? { delta: i } : { url: n });
2274
2413
  }, {
2275
2414
  platform: this.name,
2276
2415
  method: "performNavigation",
@@ -2284,9 +2423,9 @@ class He extends je {
2284
2423
  * @returns {void}
2285
2424
  */
2286
2425
  performPostMessage(e) {
2287
- return u.safeExecute(() => {
2426
+ return l.safeExecute(() => {
2288
2427
  const { data: r } = e;
2289
- ne("postMessage", r);
2428
+ ae("postMessage", r);
2290
2429
  }, {
2291
2430
  platform: this.name,
2292
2431
  method: "performPostMessage",
@@ -2299,66 +2438,66 @@ class He extends je {
2299
2438
  * @returns {void}
2300
2439
  */
2301
2440
  performGetEnv(e) {
2302
- return u.safeExecute(() => {
2441
+ return l.safeExecute(() => {
2303
2442
  if (!e || typeof e != "function")
2304
2443
  throw new Error("Callback function is required for getEnv");
2305
2444
  const r = {};
2306
2445
  let n = !1;
2307
- he() ? (r.uvue = !0, n = !0) : pe() ? (r.nvue = !0, n = !0) : ge() && (r.plus = !0, n = !0), n ? r.app = !0 : r.h5 = !0, e(r);
2446
+ Ee() ? (r.uvue = !0, n = !0) : we() ? (r.nvue = !0, n = !0) : me() && (r.plus = !0, n = !0), n ? r.app = !0 : r.h5 = !0, e(r);
2308
2447
  }, {
2309
2448
  platform: this.name,
2310
2449
  method: "performGetEnv"
2311
2450
  });
2312
2451
  }
2313
2452
  }
2314
- const q = new He(), Er = (t) => q.navigateTo(t), yr = (t) => q.navigateBack(t), Ir = (t) => q.switchTab(t), Ar = (t) => q.reLaunch(t), Or = (t) => q.redirectTo(t), _r = (t) => q.postMessage(t), Cr = (t) => q.getEnv(t);
2315
- var Ye = /* @__PURE__ */ Object.freeze({
2453
+ const H = new et(), _r = (t) => H.navigateTo(t), Rr = (t) => H.navigateBack(t), Pr = (t) => H.switchTab(t), Nr = (t) => H.reLaunch(t), Sr = (t) => H.redirectTo(t), Tr = (t) => H.postMessage(t), Lr = (t) => H.getEnv(t);
2454
+ var tt = /* @__PURE__ */ Object.freeze({
2316
2455
  __proto__: null,
2317
- AppPlatform: He,
2318
- getEnv: Cr,
2319
- navigateBack: yr,
2320
- navigateTo: Er,
2321
- postMessage: _r,
2322
- reLaunch: Ar,
2323
- redirectTo: Or,
2324
- switchTab: Ir
2456
+ AppPlatform: et,
2457
+ getEnv: Lr,
2458
+ navigateBack: Rr,
2459
+ navigateTo: _r,
2460
+ postMessage: Tr,
2461
+ reLaunch: Nr,
2462
+ redirectTo: Sr,
2463
+ switchTab: Pr
2325
2464
  });
2326
- function ie() {
2327
- return E() ? Je : Ye;
2465
+ function oe() {
2466
+ return y() ? Qe : tt;
2328
2467
  }
2329
- function Nr(t) {
2330
- return ie().navigateTo(t);
2468
+ function Mr(t) {
2469
+ return oe().navigateTo(t);
2331
2470
  }
2332
- function Rr(t) {
2333
- return ie().navigateBack(t);
2471
+ function br(t) {
2472
+ return oe().navigateBack(t);
2334
2473
  }
2335
- function Sr(t) {
2336
- return ie().switchTab(t);
2474
+ function xr(t) {
2475
+ return oe().switchTab(t);
2337
2476
  }
2338
- function Pr(t) {
2339
- return ie().reLaunch(t);
2477
+ function vr(t) {
2478
+ return oe().reLaunch(t);
2340
2479
  }
2341
- function Tr(t) {
2342
- return ie().redirectTo(t);
2480
+ function Dr(t) {
2481
+ return oe().redirectTo(t);
2343
2482
  }
2344
- function Xe() {
2345
- return E() ? Je : Ye;
2483
+ function rt() {
2484
+ return y() ? Qe : tt;
2346
2485
  }
2347
- function Lr(t = {}) {
2348
- return Xe().postMessage(t);
2486
+ function Ur(t = {}) {
2487
+ return rt().postMessage(t);
2349
2488
  }
2350
- function Mr(t) {
2351
- return Xe().getEnv(t);
2489
+ function Wr(t) {
2490
+ return rt().getEnv(t);
2352
2491
  }
2353
- function br(t) {
2492
+ function Fr(t) {
2354
2493
  return t && typeof t == "object" && t.__v_raw ? t.__v_raw : t;
2355
2494
  }
2356
- function vr() {
2495
+ function $r() {
2357
2496
  return "qsh_callback_" + Date.now() + "_" + Math.random().toString(36).substring(2, 9);
2358
2497
  }
2359
- class xr {
2498
+ class Br {
2360
2499
  constructor() {
2361
- this.callbacks = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.persistentCallbacksByApi = /* @__PURE__ */ new Map(), this.defaultTimeout = 3e4, typeof window != "undefined" && (window.qshWebviewCallbacks || (window.qshWebviewCallbacks = {})), y.debug("WebView 桥接器已初始化");
2500
+ this.callbacks = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.persistentCallbacksByApi = /* @__PURE__ */ new Map(), this.defaultTimeout = 3e4, typeof window != "undefined" && (window.qshWebviewCallbacks || (window.qshWebviewCallbacks = {})), I.debug("WebView 桥接器已初始化");
2362
2501
  }
2363
2502
  /**
2364
2503
  * 向主应用发送 API 调用消息
@@ -2368,18 +2507,18 @@ class xr {
2368
2507
  * @returns {void}
2369
2508
  */
2370
2509
  callApi(i) {
2371
- return m(this, arguments, function* (e, r = {}, n = {}) {
2372
- return u.safeExecute(() => m(this, null, function* () {
2373
- var h;
2510
+ return p(this, arguments, function* (e, r = {}, n = {}) {
2511
+ return l.safeExecute(() => p(this, null, function* () {
2512
+ var w;
2374
2513
  if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_) {
2375
- const T = new L(
2376
- U.PLATFORM_NOT_SUPPORTED,
2514
+ const b = new P(
2515
+ M.PLATFORM_NOT_SUPPORTED,
2377
2516
  "当前不在宿主 WebView 容器中,无法发送消息"
2378
2517
  );
2379
- n && typeof n.fail == "function" && n.fail({ errMsg: T.message, code: "NOT_IN_CONTAINER" }), n && typeof n.complete == "function" && n.complete({ success: !1, error: { errMsg: T.message } });
2518
+ n && typeof n.fail == "function" && n.fail({ errMsg: b.message, code: "NOT_IN_CONTAINER" }), n && typeof n.complete == "function" && n.complete({ success: !1, error: { errMsg: b.message } });
2380
2519
  return;
2381
2520
  }
2382
- const g = {
2521
+ const c = {
2383
2522
  apiName: e,
2384
2523
  params: r,
2385
2524
  callbacks: n,
@@ -2387,50 +2526,50 @@ class xr {
2387
2526
  abort: !1,
2388
2527
  metadata: {}
2389
2528
  };
2390
- x.setApiLoading(e, !0);
2391
- const d = yield K.runRequest(g);
2529
+ W.setApiLoading(e, !0);
2530
+ const d = yield V.runRequest(c);
2392
2531
  if (d.abort) {
2393
- y.warn("API 调用被拦截器中止", { api: e }), x.setApiLoading(e, !1), n.fail && n.fail({
2394
- errMsg: ((h = d.error) == null ? void 0 : h.message) || "API 调用被中止",
2532
+ I.warn("API 调用被拦截器中止", { api: e }), W.setApiLoading(e, !1), n.fail && n.fail({
2533
+ errMsg: ((w = d.error) == null ? void 0 : w.message) || "API 调用被中止",
2395
2534
  code: "INTERCEPTED"
2396
2535
  }), n.complete && n.complete({ success: !1 });
2397
2536
  return;
2398
2537
  }
2399
- const l = vr();
2538
+ const f = $r();
2400
2539
  if (n.success || n.fail || n.complete) {
2401
- if (this.callbacks.set(l, A(p({}, n), {
2540
+ if (this.callbacks.set(f, A(h({}, n), {
2402
2541
  context: d
2403
2542
  // 保存上下文用于响应拦截
2404
- })), window.qshWebviewCallbacks[l] = (Ee) => {
2405
- this.handleCallback(l, Ee);
2406
- }, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(l)), r.isPersistent || r.disableTimeout)
2407
- y.info(`API ${e} 禁用超时清理,将等待回调返回后清理`, {
2408
- callbackId: l,
2543
+ })), window.qshWebviewCallbacks[f] = (Oe) => {
2544
+ this.handleCallback(f, Oe);
2545
+ }, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(f)), r.isPersistent || r.disableTimeout)
2546
+ I.info(`API ${e} 禁用超时清理,将等待回调返回后清理`, {
2547
+ callbackId: f,
2409
2548
  isPersistent: r.isPersistent,
2410
2549
  disableTimeout: r.disableTimeout
2411
2550
  });
2412
2551
  else {
2413
- const Ee = setTimeout(() => {
2414
- y.warn("API 调用超时,自动清理回调", { api: e, callbackId: l }), n.fail && n.fail({
2552
+ const Oe = setTimeout(() => {
2553
+ I.warn("API 调用超时,自动清理回调", { api: e, callbackId: f }), n.fail && n.fail({
2415
2554
  errMsg: `API ${e} 调用超时`,
2416
2555
  code: "TIMEOUT"
2417
- }), this.cleanupCallback(l);
2556
+ }), this.cleanupCallback(f);
2418
2557
  }, r.timeout || this.defaultTimeout);
2419
- this.timeouts.set(l, Ee);
2558
+ this.timeouts.set(f, Oe);
2420
2559
  }
2421
- const N = {
2560
+ const S = {
2422
2561
  type: "qsh_api_call",
2423
2562
  api: e,
2424
2563
  params: d.params,
2425
- callbackId: l,
2564
+ callbackId: f,
2426
2565
  timestamp: Date.now()
2427
2566
  };
2428
- y.info("发送 API 调用消息", {
2567
+ I.info("发送 API 调用消息", {
2429
2568
  api: e,
2430
- callbackId: l,
2569
+ callbackId: f,
2431
2570
  hasSuccess: !!n.success,
2432
2571
  hasFail: !!n.fail
2433
- }), console.log("message:", JSON.stringify(br(N), null, 2)), ne("postMessage", N);
2572
+ }), console.log("message:", JSON.stringify(Fr(S), null, 2)), ae("postMessage", S);
2434
2573
  }
2435
2574
  }), {
2436
2575
  context: "WebViewBridge.callApi",
@@ -2445,18 +2584,18 @@ class xr {
2445
2584
  * @private
2446
2585
  */
2447
2586
  handleCallback(e, r) {
2448
- return m(this, null, function* () {
2449
- return u.safeExecute(() => m(this, null, function* () {
2450
- var T, N;
2587
+ return p(this, null, function* () {
2588
+ return l.safeExecute(() => p(this, null, function* () {
2589
+ var b, S;
2451
2590
  const n = this.callbacks.get(e);
2452
2591
  if (!n) {
2453
- y.warn("未找到回调函数", { callbackId: e });
2592
+ I.warn("未找到回调函数", { callbackId: e });
2454
2593
  return;
2455
2594
  }
2456
- const { success: i, fail: a, complete: g, context: d } = n;
2457
- y.debug("处理回调", { callbackId: e, result: r });
2458
- const l = yield K.runResponse(r, d);
2459
- d && x.setApiResult(d.apiName, l), l.success && i ? i(l.data) : !l.success && a && a(l.error || { errMsg: "操作失败" }), g && g(l), ((N = (T = n.context) == null ? void 0 : T.params) == null ? void 0 : N.isPersistent) ? y.debug("持久监听API:保留回调", { callbackId: e }) : (this.cleanupCallback(e), y.debug("回调执行完成,已清理", { callbackId: e }));
2595
+ const { success: i, fail: a, complete: c, context: d } = n;
2596
+ I.debug("处理回调", { callbackId: e, result: r });
2597
+ const f = yield V.runResponse(r, d);
2598
+ d && W.setApiResult(d.apiName, f), f.success && i ? i(f.data) : !f.success && a && a(f.error || { errMsg: "操作失败" }), c && c(f), ((S = (b = n.context) == null ? void 0 : b.params) == null ? void 0 : S.isPersistent) ? I.debug("持久监听API:保留回调", { callbackId: e }) : (this.cleanupCallback(e), I.debug("回调执行完成,已清理", { callbackId: e }));
2460
2599
  }), {
2461
2600
  context: "WebViewBridge.handleCallback",
2462
2601
  callbackId: e
@@ -2481,7 +2620,7 @@ class xr {
2481
2620
  * 清理所有待处理的回调
2482
2621
  */
2483
2622
  clearCallbacks() {
2484
- y.debug("清理所有回调", { count: this.callbacks.size }), this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts.clear(), this.callbacks.clear(), this.persistentCallbacksByApi && this.persistentCallbacksByApi.clear(), typeof window != "undefined" && window.qshWebviewCallbacks && Object.keys(window.qshWebviewCallbacks).forEach((e) => {
2623
+ I.debug("清理所有回调", { count: this.callbacks.size }), this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts.clear(), this.callbacks.clear(), this.persistentCallbacksByApi && this.persistentCallbacksByApi.clear(), typeof window != "undefined" && window.qshWebviewCallbacks && Object.keys(window.qshWebviewCallbacks).forEach((e) => {
2485
2624
  e.startsWith("qsh_callback_") && delete window.qshWebviewCallbacks[e];
2486
2625
  });
2487
2626
  }
@@ -2495,7 +2634,7 @@ class xr {
2495
2634
  if (!r || r.size === 0)
2496
2635
  return 0;
2497
2636
  const n = Array.from(r);
2498
- return n.forEach((i) => this.cleanupCallback(i)), this.persistentCallbacksByApi.delete(e), y.info("已清理持久回调", { api: e, count: n.length }), n.length;
2637
+ return n.forEach((i) => this.cleanupCallback(i)), this.persistentCallbacksByApi.delete(e), I.info("已清理持久回调", { api: e, count: n.length }), n.length;
2499
2638
  }
2500
2639
  /**
2501
2640
  * 获取桥接器状态信息
@@ -2509,30 +2648,30 @@ class xr {
2509
2648
  };
2510
2649
  }
2511
2650
  }
2512
- const Ze = new xr(), C = (t, e, r) => Ze.callApi(t, e, r), X = (t) => Ze.cleanupPersistentCallbacksByApi(t), le = {
2651
+ const nt = new Br(), R = (t, e, r) => nt.callApi(t, e, r), Q = (t) => nt.cleanupPersistentCallbacksByApi(t), ge = {
2513
2652
  ALBUM: "album",
2514
2653
  // 相册
2515
2654
  CAMERA: "camera"
2516
2655
  // 相机
2517
- }, fe = {
2656
+ }, he = {
2518
2657
  ORIGINAL: "original",
2519
2658
  // 原图
2520
2659
  COMPRESSED: "compressed"
2521
2660
  // 压缩图
2522
- }, Dr = {
2661
+ }, kr = {
2523
2662
  count: 9,
2524
- sizeType: [fe.ORIGINAL, fe.COMPRESSED],
2525
- sourceType: [le.ALBUM, le.CAMERA]
2663
+ sizeType: [he.ORIGINAL, he.COMPRESSED],
2664
+ sourceType: [ge.ALBUM, ge.CAMERA]
2526
2665
  };
2527
- function Ur(t = {}) {
2528
- const e = p(p({}, Dr), t);
2529
- 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 = [fe.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [le.ALBUM]), e;
2666
+ function Kr(t = {}) {
2667
+ const e = h(h({}, kr), t);
2668
+ 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 = [he.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [ge.ALBUM]), e;
2530
2669
  }
2531
- function Qe() {
2532
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(c.type);
2670
+ function it() {
2671
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
2533
2672
  }
2534
- function et(t) {
2535
- return u.safeExecute(() => {
2673
+ function st(t) {
2674
+ return l.safeExecute(() => {
2536
2675
  var e;
2537
2676
  if (!window.wx) {
2538
2677
  const r = {
@@ -2542,8 +2681,8 @@ function et(t) {
2542
2681
  (e = t.fail) == null || e.call(t, r);
2543
2682
  return;
2544
2683
  }
2545
- if (!z()) {
2546
- s.info("等待微信配置完成"), k().then(() => et(t)).catch((r) => {
2684
+ if (!G()) {
2685
+ s.info("等待微信配置完成"), B().then(() => st(t)).catch((r) => {
2547
2686
  var n;
2548
2687
  s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
2549
2688
  });
@@ -2568,9 +2707,9 @@ function et(t) {
2568
2707
  platform: "weixin"
2569
2708
  });
2570
2709
  }
2571
- function Wr(t) {
2572
- return u.safeExecute(() => {
2573
- s.debug("通过 WebView 桥接调用图片选择", t), C("chooseImage", A(p({}, t), { disableTimeout: !0 }), {
2710
+ function zr(t) {
2711
+ return l.safeExecute(() => {
2712
+ s.debug("通过 WebView 桥接调用图片选择", t), R("chooseImage", A(h({}, t), { disableTimeout: !0 }), {
2574
2713
  success: (e) => {
2575
2714
  var r, n;
2576
2715
  s.info("UniApp 图片选择成功", {
@@ -2588,34 +2727,34 @@ function Wr(t) {
2588
2727
  platform: "uniapp"
2589
2728
  });
2590
2729
  }
2591
- function $r(t = {}) {
2592
- return u.safeExecute(() => {
2730
+ function Gr(t = {}) {
2731
+ return l.safeExecute(() => {
2593
2732
  var r;
2594
- if (!Qe()) {
2733
+ if (!it()) {
2595
2734
  const n = {
2596
- errMsg: `当前环境 (${c.type}) 不支持图片选择功能`,
2735
+ errMsg: `当前环境 (${u.type}) 不支持图片选择功能`,
2597
2736
  code: "PLATFORM_NOT_SUPPORTED"
2598
2737
  };
2599
- s.error("平台不支持图片选择", { platform: c.type }), (r = t.fail) == null || r.call(t, n);
2738
+ s.error("平台不支持图片选择", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
2600
2739
  return;
2601
2740
  }
2602
- const e = Ur(t);
2741
+ const e = Kr(t);
2603
2742
  s.info("开始选择图片", {
2604
- platform: c.type,
2743
+ platform: u.type,
2605
2744
  count: e.count,
2606
2745
  sizeType: e.sizeType,
2607
2746
  sourceType: e.sourceType
2608
- }), E() ? et(e) : Wr(e);
2747
+ }), y() ? st(e) : zr(e);
2609
2748
  }, {
2610
2749
  context: "chooseImage",
2611
2750
  options: t
2612
2751
  });
2613
2752
  }
2614
- function Br() {
2753
+ function Vr() {
2615
2754
  return {
2616
- supported: Qe(),
2617
- environment: c.type,
2618
- implementation: E() ? "weixin" : "webview",
2755
+ supported: it(),
2756
+ environment: u.type,
2757
+ implementation: y() ? "weixin" : "webview",
2619
2758
  features: {
2620
2759
  multipleSelection: !0,
2621
2760
  // 支持多选
@@ -2628,7 +2767,7 @@ function Br() {
2628
2767
  }
2629
2768
  };
2630
2769
  }
2631
- const V = {
2770
+ const q = {
2632
2771
  QR_CODE: "qrCode",
2633
2772
  // 二维码
2634
2773
  BAR_CODE: "barCode",
@@ -2637,21 +2776,21 @@ const V = {
2637
2776
  // Data Matrix 码
2638
2777
  PDF417: "pdf417"
2639
2778
  // PDF417 条码
2640
- }, Fr = {
2779
+ }, jr = {
2641
2780
  onlyFromCamera: !0,
2642
2781
  // 只从相机扫码
2643
- scanType: [V.QR_CODE, V.BAR_CODE]
2782
+ scanType: [q.QR_CODE, q.BAR_CODE]
2644
2783
  // 支持二维码和一维码
2645
2784
  };
2646
- function kr(t = {}) {
2647
- const e = p(p({}, Fr), t);
2648
- return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [V.QR_CODE, V.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
2785
+ function qr(t = {}) {
2786
+ const e = h(h({}, jr), t);
2787
+ return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [q.QR_CODE, q.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
2649
2788
  }
2650
- function tt() {
2651
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(c.type);
2789
+ function at() {
2790
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
2652
2791
  }
2653
- function rt(t) {
2654
- return u.safeExecute(() => {
2792
+ function ot(t) {
2793
+ return l.safeExecute(() => {
2655
2794
  var e;
2656
2795
  if (!window.wx) {
2657
2796
  const r = {
@@ -2661,8 +2800,8 @@ function rt(t) {
2661
2800
  (e = t.fail) == null || e.call(t, r);
2662
2801
  return;
2663
2802
  }
2664
- if (!z()) {
2665
- s.info("等待微信配置完成"), k().then(() => rt(t)).catch((r) => {
2803
+ if (!G()) {
2804
+ s.info("等待微信配置完成"), B().then(() => ot(t)).catch((r) => {
2666
2805
  var n;
2667
2806
  s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
2668
2807
  });
@@ -2678,7 +2817,7 @@ function rt(t) {
2678
2817
  const n = {
2679
2818
  result: r.resultStr,
2680
2819
  // 扫码内容
2681
- scanType: zr(r.resultStr),
2820
+ scanType: Jr(r.resultStr),
2682
2821
  // 推测扫码类型
2683
2822
  charSet: "utf-8",
2684
2823
  // 微信默认 UTF-8
@@ -2697,12 +2836,12 @@ function rt(t) {
2697
2836
  platform: "weixin"
2698
2837
  });
2699
2838
  }
2700
- function zr(t) {
2701
- return t ? t.length > 50 || /[^\d]/.test(t) ? V.QR_CODE : V.BAR_CODE : "unknown";
2839
+ function Jr(t) {
2840
+ return t ? t.length > 50 || /[^\d]/.test(t) ? q.QR_CODE : q.BAR_CODE : "unknown";
2702
2841
  }
2703
- function Kr(t) {
2704
- return u.safeExecute(() => {
2705
- s.debug("通过 WebView 桥接调用扫码", t), C("scanCode", A(p({}, t), { disableTimeout: !0 }), {
2842
+ function Hr(t) {
2843
+ return l.safeExecute(() => {
2844
+ s.debug("通过 WebView 桥接调用扫码", t), R("scanCode", A(h({}, t), { disableTimeout: !0 }), {
2706
2845
  success: (e) => {
2707
2846
  var r;
2708
2847
  s.info("UniApp 扫码成功", {
@@ -2721,33 +2860,33 @@ function Kr(t) {
2721
2860
  platform: "uniapp"
2722
2861
  });
2723
2862
  }
2724
- function Gr(t = {}) {
2725
- return u.safeExecute(() => {
2863
+ function Yr(t = {}) {
2864
+ return l.safeExecute(() => {
2726
2865
  var r;
2727
- if (!tt()) {
2866
+ if (!at()) {
2728
2867
  const n = {
2729
- errMsg: `当前环境 (${c.type}) 不支持扫码功能`,
2868
+ errMsg: `当前环境 (${u.type}) 不支持扫码功能`,
2730
2869
  code: "PLATFORM_NOT_SUPPORTED"
2731
2870
  };
2732
- s.error("平台不支持扫码", { platform: c.type }), (r = t.fail) == null || r.call(t, n);
2871
+ s.error("平台不支持扫码", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
2733
2872
  return;
2734
2873
  }
2735
- const e = kr(t);
2874
+ const e = qr(t);
2736
2875
  s.info("开始扫码", {
2737
- platform: c.type,
2876
+ platform: u.type,
2738
2877
  onlyFromCamera: e.onlyFromCamera,
2739
2878
  scanType: e.scanType
2740
- }), E() ? rt(e) : Kr(e);
2879
+ }), y() ? ot(e) : Hr(e);
2741
2880
  }, {
2742
2881
  context: "scanCode",
2743
2882
  options: t
2744
2883
  });
2745
2884
  }
2746
- function Vr() {
2885
+ function Xr() {
2747
2886
  return {
2748
- supported: tt(),
2749
- environment: c.type,
2750
- implementation: E() ? "weixin" : "webview",
2887
+ supported: at(),
2888
+ environment: u.type,
2889
+ implementation: y() ? "weixin" : "webview",
2751
2890
  features: {
2752
2891
  onlyFromCamera: !0,
2753
2892
  // 支持只从相机扫码
@@ -2760,30 +2899,30 @@ function Vr() {
2760
2899
  }
2761
2900
  };
2762
2901
  }
2763
- const Z = {
2902
+ const ee = {
2764
2903
  WGS84: "wgs84",
2765
2904
  // GPS 坐标
2766
2905
  GCJ02: "gcj02",
2767
2906
  // 国测局坐标(火星坐标)
2768
2907
  BD09: "bd09"
2769
2908
  // 百度坐标
2770
- }, jr = {
2771
- type: Z.WGS84,
2909
+ }, Zr = {
2910
+ type: ee.WGS84,
2772
2911
  altitude: !1
2773
- }, qr = {
2912
+ }, Qr = {
2774
2913
  scale: 18
2775
2914
  // 地图缩放级别 1-28
2776
2915
  };
2777
- function Jr(t = {}) {
2778
- const e = p(p({}, jr), t);
2779
- return Object.values(Z).includes(e.type) || (e.type = Z.WGS84), e.altitude = !!e.altitude, e;
2916
+ function en(t = {}) {
2917
+ const e = h(h({}, Zr), t);
2918
+ return Object.values(ee).includes(e.type) || (e.type = ee.WGS84), e.altitude = !!e.altitude, e;
2780
2919
  }
2781
- function Hr(t = {}) {
2782
- const e = p({}, t);
2783
- return Object.values(Z).includes(e.type) || (e.type = Z.WGS84), e.needFullAccuracy = !!e.needFullAccuracy, e;
2920
+ function tn(t = {}) {
2921
+ const e = h({}, t);
2922
+ return Object.values(ee).includes(e.type) || (e.type = ee.WGS84), e.needFullAccuracy = !!e.needFullAccuracy, e;
2784
2923
  }
2785
- function Yr(t = {}) {
2786
- const e = p(p({}, qr), t);
2924
+ function rn(t = {}) {
2925
+ const e = h(h({}, Qr), t);
2787
2926
  if (e.latitude === void 0 || e.latitude === null)
2788
2927
  throw {
2789
2928
  errMsg: "缺少必需参数:latitude(纬度)",
@@ -2842,11 +2981,11 @@ function Yr(t = {}) {
2842
2981
  }
2843
2982
  return e;
2844
2983
  }
2845
- function Re() {
2846
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(c.type);
2984
+ function Te() {
2985
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
2847
2986
  }
2848
- function nt(t) {
2849
- return u.safeExecute(() => {
2987
+ function ct(t) {
2988
+ return l.safeExecute(() => {
2850
2989
  var e;
2851
2990
  if (!window.wx) {
2852
2991
  const r = {
@@ -2856,8 +2995,8 @@ function nt(t) {
2856
2995
  (e = t.fail) == null || e.call(t, r);
2857
2996
  return;
2858
2997
  }
2859
- if (!z()) {
2860
- s.info("等待微信配置完成"), k().then(() => nt(t)).catch((r) => {
2998
+ if (!G()) {
2999
+ s.info("等待微信配置完成"), B().then(() => ct(t)).catch((r) => {
2861
3000
  var n;
2862
3001
  s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
2863
3002
  });
@@ -2883,8 +3022,8 @@ function nt(t) {
2883
3022
  platform: "weixin"
2884
3023
  });
2885
3024
  }
2886
- function it(t) {
2887
- return u.safeExecute(() => {
3025
+ function ut(t) {
3026
+ return l.safeExecute(() => {
2888
3027
  var e;
2889
3028
  if (!window.wx) {
2890
3029
  const r = {
@@ -2894,8 +3033,8 @@ function it(t) {
2894
3033
  (e = t.fail) == null || e.call(t, r);
2895
3034
  return;
2896
3035
  }
2897
- if (!z()) {
2898
- s.info("等待微信配置完成"), k().then(() => it(t)).catch((r) => {
3036
+ if (!G()) {
3037
+ s.info("等待微信配置完成"), B().then(() => ut(t)).catch((r) => {
2899
3038
  var n;
2900
3039
  s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
2901
3040
  });
@@ -2923,9 +3062,9 @@ function it(t) {
2923
3062
  platform: "weixin"
2924
3063
  });
2925
3064
  }
2926
- function Xr(t) {
2927
- return u.safeExecute(() => {
2928
- s.debug("通过 WebView 桥接调用获取位置", t), C("getLocation", t, {
3065
+ function nn(t) {
3066
+ return l.safeExecute(() => {
3067
+ s.debug("通过 WebView 桥接调用获取位置", t), R("getLocation", t, {
2929
3068
  success: (e) => {
2930
3069
  var r;
2931
3070
  s.info("UniApp 获取位置成功", {
@@ -2944,9 +3083,9 @@ function Xr(t) {
2944
3083
  platform: "uniapp"
2945
3084
  });
2946
3085
  }
2947
- function Zr(t) {
2948
- return u.safeExecute(() => {
2949
- s.debug("通过 WebView 桥接调用查看位置", t), C("openLocation", t, {
3086
+ function sn(t) {
3087
+ return l.safeExecute(() => {
3088
+ s.debug("通过 WebView 桥接调用查看位置", t), R("openLocation", t, {
2950
3089
  success: (e) => {
2951
3090
  var r;
2952
3091
  s.info("UniApp 查看位置成功"), (r = t.success) == null || r.call(t, e);
@@ -2962,62 +3101,62 @@ function Zr(t) {
2962
3101
  platform: "uniapp"
2963
3102
  });
2964
3103
  }
2965
- function Qr(t = {}) {
2966
- return u.safeExecute(() => {
3104
+ function an(t = {}) {
3105
+ return l.safeExecute(() => {
2967
3106
  var r;
2968
- if (!Re()) {
3107
+ if (!Te()) {
2969
3108
  const n = {
2970
- errMsg: `当前环境 (${c.type}) 不支持定位功能`,
3109
+ errMsg: `当前环境 (${u.type}) 不支持定位功能`,
2971
3110
  code: "PLATFORM_NOT_SUPPORTED"
2972
3111
  };
2973
- s.error("平台不支持定位", { platform: c.type }), (r = t.fail) == null || r.call(t, n);
3112
+ s.error("平台不支持定位", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
2974
3113
  return;
2975
3114
  }
2976
- const e = Jr(t);
3115
+ const e = en(t);
2977
3116
  s.info("开始获取位置", {
2978
- platform: c.type,
3117
+ platform: u.type,
2979
3118
  type: e.type,
2980
3119
  altitude: e.altitude
2981
- }), E() ? nt(e) : Xr(e);
3120
+ }), y() ? ct(e) : nn(e);
2982
3121
  }, {
2983
3122
  context: "getLocation",
2984
3123
  options: t
2985
3124
  });
2986
3125
  }
2987
- function en(t = {}) {
2988
- return u.safeExecute(() => {
3126
+ function on(t = {}) {
3127
+ return l.safeExecute(() => {
2989
3128
  var r, n, i;
2990
- if (!Re()) {
3129
+ if (!Te()) {
2991
3130
  const a = {
2992
- errMsg: `当前环境 (${c.type}) 不支持查看位置功能`,
3131
+ errMsg: `当前环境 (${u.type}) 不支持查看位置功能`,
2993
3132
  code: "PLATFORM_NOT_SUPPORTED"
2994
3133
  };
2995
- s.error("平台不支持查看位置", { platform: c.type }), (r = t.fail) == null || r.call(t, a);
3134
+ s.error("平台不支持查看位置", { platform: u.type }), (r = t.fail) == null || r.call(t, a);
2996
3135
  return;
2997
3136
  }
2998
3137
  let e;
2999
3138
  try {
3000
- e = Yr(t);
3139
+ e = rn(t);
3001
3140
  } catch (a) {
3002
3141
  s.error("参数验证失败", a), (n = t.fail) == null || n.call(t, a), (i = t.complete) == null || i.call(t);
3003
3142
  return;
3004
3143
  }
3005
3144
  s.info("开始查看位置", {
3006
- platform: c.type,
3145
+ platform: u.type,
3007
3146
  latitude: e.latitude,
3008
3147
  longitude: e.longitude,
3009
3148
  name: e.name
3010
- }), E() ? it(e) : Zr(e);
3149
+ }), y() ? ut(e) : sn(e);
3011
3150
  }, {
3012
3151
  context: "openLocation",
3013
3152
  options: t
3014
3153
  });
3015
3154
  }
3016
- function tn() {
3017
- const t = E();
3155
+ function cn() {
3156
+ const t = y();
3018
3157
  return {
3019
- supported: Re(),
3020
- environment: c.type,
3158
+ supported: Te(),
3159
+ environment: u.type,
3021
3160
  implementation: t ? "weixin" : "webview",
3022
3161
  features: {
3023
3162
  getLocation: !0,
@@ -3035,29 +3174,29 @@ function tn() {
3035
3174
  }
3036
3175
  };
3037
3176
  }
3038
- const $ = /* @__PURE__ */ new Set(), B = /* @__PURE__ */ new Set();
3039
- function st(t, e, r) {
3177
+ const K = /* @__PURE__ */ new Set(), z = /* @__PURE__ */ new Set();
3178
+ function lt(t, e, r) {
3040
3179
  t.forEach((n) => {
3041
3180
  if (typeof n == "function") {
3042
- u.safeExecute(() => n(e), { context: r });
3181
+ l.safeExecute(() => n(e), { context: r });
3043
3182
  return;
3044
3183
  }
3045
3184
  s.warn("监听回调不是函数,已跳过", { type: typeof n });
3046
3185
  });
3047
3186
  }
3048
- function rn(t = {}) {
3049
- return u.safeExecute(() => {
3187
+ function un(t = {}) {
3188
+ return l.safeExecute(() => {
3050
3189
  var r, n;
3051
- if (E()) {
3190
+ if (y()) {
3052
3191
  const i = {
3053
- errMsg: `当前环境 (${c.type}) 不支持该接口`,
3192
+ errMsg: `当前环境 (${u.type}) 不支持该接口`,
3054
3193
  code: "PLATFORM_NOT_SUPPORTED"
3055
3194
  };
3056
- s.error("当前环境不支持此接口", { platform: c.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
3195
+ s.error("当前环境不支持此接口", { platform: u.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
3057
3196
  return;
3058
3197
  }
3059
- const e = Hr(t);
3060
- s.info("正在开启定位监听"), C("startLocationUpdate", {
3198
+ const e = tn(t);
3199
+ s.info("正在开启定位监听"), R("startLocationUpdate", {
3061
3200
  type: e.type,
3062
3201
  needFullAccuracy: e.needFullAccuracy
3063
3202
  }, {
@@ -3073,18 +3212,18 @@ function rn(t = {}) {
3073
3212
  });
3074
3213
  }, { context: "startLocationUpdate" });
3075
3214
  }
3076
- function nn(t = {}) {
3077
- return u.safeExecute(() => {
3215
+ function ln(t = {}) {
3216
+ return l.safeExecute(() => {
3078
3217
  var e, r;
3079
- if (E()) {
3218
+ if (y()) {
3080
3219
  const n = {
3081
- errMsg: `当前环境 (${c.type}) 不支持该接口`,
3220
+ errMsg: `当前环境 (${u.type}) 不支持该接口`,
3082
3221
  code: "PLATFORM_NOT_SUPPORTED"
3083
3222
  };
3084
- s.error("当前环境不支持此接口", { platform: c.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
3223
+ s.error("当前环境不支持此接口", { platform: u.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
3085
3224
  return;
3086
3225
  }
3087
- s.info("正在停止定位监听"), C("stopLocationUpdate", t, {
3226
+ s.info("正在停止定位监听"), R("stopLocationUpdate", t, {
3088
3227
  success: (n) => {
3089
3228
  var i;
3090
3229
  s.info("定位监听已停止"), (i = t.success) == null || i.call(t, n);
@@ -3097,10 +3236,10 @@ function nn(t = {}) {
3097
3236
  });
3098
3237
  }, { context: "stopLocationUpdate" });
3099
3238
  }
3100
- function sn(t) {
3101
- return u.safeExecute(() => {
3102
- if (E()) {
3103
- s.warn("当前环境不支持此接口", { platform: c.type });
3239
+ function fn(t) {
3240
+ return l.safeExecute(() => {
3241
+ if (y()) {
3242
+ s.warn("当前环境不支持此接口", { platform: u.type });
3104
3243
  return;
3105
3244
  }
3106
3245
  if (typeof t != "function")
@@ -3108,21 +3247,21 @@ function sn(t) {
3108
3247
  errMsg: "onLocationChange 回调必须是函数",
3109
3248
  code: "INVALID_CALLBACK"
3110
3249
  };
3111
- const e = $.size > 0;
3112
- $.add(t), e || (s.debug("注册实时位置变化监听器"), C("onLocationChange", { isPersistent: !0 }, {
3250
+ const e = K.size > 0;
3251
+ K.add(t), e || (s.debug("注册实时位置变化监听器"), R("onLocationChange", { isPersistent: !0 }, {
3113
3252
  success: (r) => {
3114
- s.debug("收到实时位置推送", r), st($, r, "onLocationChange");
3253
+ s.debug("收到实时位置推送", r), lt(K, r, "onLocationChange");
3115
3254
  },
3116
3255
  fail: (r) => {
3117
- s.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r), $.delete(t), $.size === 0 && X("onLocationChange");
3256
+ s.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r), K.delete(t), K.size === 0 && Q("onLocationChange");
3118
3257
  }
3119
3258
  }));
3120
3259
  }, { context: "onLocationChange" });
3121
3260
  }
3122
- function an(t) {
3123
- return u.safeExecute(() => {
3124
- if (E()) {
3125
- s.warn("当前环境不支持此接口", { platform: c.type });
3261
+ function dn(t) {
3262
+ return l.safeExecute(() => {
3263
+ if (y()) {
3264
+ s.warn("当前环境不支持此接口", { platform: u.type });
3126
3265
  return;
3127
3266
  }
3128
3267
  if (t && typeof t != "function")
@@ -3130,20 +3269,20 @@ function an(t) {
3130
3269
  errMsg: "offLocationChange 回调必须是函数",
3131
3270
  code: "INVALID_CALLBACK"
3132
3271
  };
3133
- t ? $.delete(t) : $.clear(), !($.size > 0) && (s.info("移除位置变化监听器"), C("offLocationChange", {}, {
3272
+ t ? K.delete(t) : K.clear(), !(K.size > 0) && (s.info("移除位置变化监听器"), R("offLocationChange", {}, {
3134
3273
  success: () => {
3135
- s.info("位置变化监听已移除"), X("onLocationChange");
3274
+ s.info("位置变化监听已移除"), Q("onLocationChange");
3136
3275
  },
3137
3276
  fail: (e) => {
3138
- s.error("移除位置变化监听失败", e), X("onLocationChange");
3277
+ s.error("移除位置变化监听失败", e), Q("onLocationChange");
3139
3278
  }
3140
3279
  }));
3141
3280
  }, { context: "offLocationChange" });
3142
3281
  }
3143
- function on(t) {
3144
- return u.safeExecute(() => {
3145
- if (E()) {
3146
- s.warn("当前环境不支持此接口", { platform: c.type });
3282
+ function gn(t) {
3283
+ return l.safeExecute(() => {
3284
+ if (y()) {
3285
+ s.warn("当前环境不支持此接口", { platform: u.type });
3147
3286
  return;
3148
3287
  }
3149
3288
  if (typeof t != "function")
@@ -3151,21 +3290,21 @@ function on(t) {
3151
3290
  errMsg: "onLocationChangeError 回调必须是函数",
3152
3291
  code: "INVALID_CALLBACK"
3153
3292
  };
3154
- const e = B.size > 0;
3155
- B.add(t), e || (s.debug("注册位置更新错误监听器"), C("onLocationChangeError", { isPersistent: !0 }, {
3293
+ const e = z.size > 0;
3294
+ z.add(t), e || (s.debug("注册位置更新错误监听器"), R("onLocationChangeError", { isPersistent: !0 }, {
3156
3295
  success: (r) => {
3157
- s.warn("持续定位发生异常", r), st(B, r, "onLocationChangeError");
3296
+ s.warn("持续定位发生异常", r), lt(z, r, "onLocationChangeError");
3158
3297
  },
3159
3298
  fail: (r) => {
3160
- s.warn("位置更新错误监听注册失败", r), B.delete(t), B.size === 0 && X("onLocationChangeError");
3299
+ s.warn("位置更新错误监听注册失败", r), z.delete(t), z.size === 0 && Q("onLocationChangeError");
3161
3300
  }
3162
3301
  }));
3163
3302
  }, { context: "onLocationChangeError" });
3164
3303
  }
3165
- function cn(t) {
3166
- return u.safeExecute(() => {
3167
- if (E()) {
3168
- s.warn("当前环境不支持此接口", { platform: c.type });
3304
+ function hn(t) {
3305
+ return l.safeExecute(() => {
3306
+ if (y()) {
3307
+ s.warn("当前环境不支持此接口", { platform: u.type });
3169
3308
  return;
3170
3309
  }
3171
3310
  if (t && typeof t != "function")
@@ -3173,24 +3312,24 @@ function cn(t) {
3173
3312
  errMsg: "offLocationChangeError 回调必须是函数",
3174
3313
  code: "INVALID_CALLBACK"
3175
3314
  };
3176
- t ? B.delete(t) : B.clear(), !(B.size > 0) && (s.info("移除定位错误监听器"), C("offLocationChangeError", {}, {
3315
+ t ? z.delete(t) : z.clear(), !(z.size > 0) && (s.info("移除定位错误监听器"), R("offLocationChangeError", {}, {
3177
3316
  success: () => {
3178
- s.info("定位错误监听已移除"), X("onLocationChangeError");
3317
+ s.info("定位错误监听已移除"), Q("onLocationChangeError");
3179
3318
  },
3180
3319
  fail: (e) => {
3181
- s.error("移除定位错误监听失败", e), X("onLocationChangeError");
3320
+ s.error("移除定位错误监听失败", e), Q("onLocationChangeError");
3182
3321
  }
3183
3322
  }));
3184
3323
  }, { context: "offLocationChangeError" });
3185
3324
  }
3186
- const un = {
3325
+ const pn = {
3187
3326
  latitude: null,
3188
3327
  // 目标地纬度
3189
3328
  longitude: null
3190
3329
  // 目标地经度
3191
3330
  };
3192
- function ln(t = {}) {
3193
- const e = p(p({}, un), t);
3331
+ function mn(t = {}) {
3332
+ const e = h(h({}, pn), t);
3194
3333
  return e.latitude !== null && e.latitude !== void 0 && (typeof e.latitude != "number" ? (s.warn("latitude 参数类型错误,已忽略", {
3195
3334
  latitude: e.latitude
3196
3335
  }), e.latitude = null) : (e.latitude < -90 || e.latitude > 90) && (s.warn("latitude 超出范围,已忽略", {
@@ -3201,11 +3340,11 @@ function ln(t = {}) {
3201
3340
  longitude: e.longitude
3202
3341
  }), e.longitude = null)), e;
3203
3342
  }
3204
- function at() {
3205
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(c.type);
3343
+ function ft() {
3344
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
3206
3345
  }
3207
- function ot(t) {
3208
- return u.safeExecute(() => {
3346
+ function dt(t) {
3347
+ return l.safeExecute(() => {
3209
3348
  var n;
3210
3349
  if (!window.wx) {
3211
3350
  const i = {
@@ -3215,8 +3354,8 @@ function ot(t) {
3215
3354
  (n = t.fail) == null || n.call(t, i);
3216
3355
  return;
3217
3356
  }
3218
- if (!z()) {
3219
- s.info("等待微信配置完成"), k().then(() => ot(t)).catch((i) => {
3357
+ if (!G()) {
3358
+ s.info("等待微信配置完成"), B().then(() => dt(t)).catch((i) => {
3220
3359
  var a;
3221
3360
  s.error("微信配置失败", i), (a = t.fail) == null || a.call(t, { errMsg: `微信配置失败: ${i.message}` });
3222
3361
  });
@@ -3225,7 +3364,7 @@ function ot(t) {
3225
3364
  s.debug("调用微信位置选择", t);
3226
3365
  const e = {
3227
3366
  success: (i) => {
3228
- var g;
3367
+ var c;
3229
3368
  s.info("微信位置选择成功", {
3230
3369
  name: i.name,
3231
3370
  address: i.address,
@@ -3243,7 +3382,7 @@ function ot(t) {
3243
3382
  // 经度
3244
3383
  errMsg: "chooseLocation:ok"
3245
3384
  };
3246
- (g = t.success) == null || g.call(t, a);
3385
+ (c = t.success) == null || c.call(t, a);
3247
3386
  },
3248
3387
  fail: (i) => {
3249
3388
  var a;
@@ -3251,7 +3390,7 @@ function ot(t) {
3251
3390
  },
3252
3391
  complete: t.complete
3253
3392
  }, r = {};
3254
- t.latitude !== null && t.latitude !== void 0 && (r.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (r.longitude = t.longitude), window.wx.chooseLocation(A(p({}, r), {
3393
+ t.latitude !== null && t.latitude !== void 0 && (r.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (r.longitude = t.longitude), window.wx.chooseLocation(A(h({}, r), {
3255
3394
  success: e.success,
3256
3395
  fail: e.fail,
3257
3396
  complete: e.complete
@@ -3261,8 +3400,8 @@ function ot(t) {
3261
3400
  platform: "weixin"
3262
3401
  });
3263
3402
  }
3264
- function fn(t) {
3265
- return u.safeExecute(() => {
3403
+ function wn(t) {
3404
+ return l.safeExecute(() => {
3266
3405
  s.debug("通过 WebView 桥接调用位置选择", t);
3267
3406
  const e = {
3268
3407
  // 禁用超时清理,等待用户操作完成后才清理
@@ -3282,7 +3421,7 @@ function fn(t) {
3282
3421
  },
3283
3422
  complete: t.complete
3284
3423
  };
3285
- t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude), C("chooseLocation", e, {
3424
+ t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude), R("chooseLocation", e, {
3286
3425
  success: (r) => {
3287
3426
  e.success(r);
3288
3427
  },
@@ -3296,33 +3435,33 @@ function fn(t) {
3296
3435
  platform: "uniapp"
3297
3436
  });
3298
3437
  }
3299
- function dn(t = {}) {
3300
- return u.safeExecute(() => {
3438
+ function En(t = {}) {
3439
+ return l.safeExecute(() => {
3301
3440
  var r;
3302
- if (!at()) {
3441
+ if (!ft()) {
3303
3442
  const n = {
3304
- errMsg: `当前环境 (${c.type}) 不支持位置选择功能`,
3443
+ errMsg: `当前环境 (${u.type}) 不支持位置选择功能`,
3305
3444
  code: "PLATFORM_NOT_SUPPORTED"
3306
3445
  };
3307
- s.error("平台不支持位置选择", { platform: c.type }), (r = t.fail) == null || r.call(t, n);
3446
+ s.error("平台不支持位置选择", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
3308
3447
  return;
3309
3448
  }
3310
- const e = ln(t);
3449
+ const e = mn(t);
3311
3450
  s.info("开始选择位置", {
3312
- platform: c.type,
3451
+ platform: u.type,
3313
3452
  latitude: e.latitude,
3314
3453
  longitude: e.longitude
3315
- }), E() ? ot(e) : fn(e);
3454
+ }), y() ? dt(e) : wn(e);
3316
3455
  }, {
3317
3456
  context: "chooseLocation",
3318
3457
  options: t
3319
3458
  });
3320
3459
  }
3321
- function gn() {
3460
+ function yn() {
3322
3461
  return {
3323
- supported: at(),
3324
- environment: c.type,
3325
- implementation: E() ? "weixin" : "webview",
3462
+ supported: ft(),
3463
+ environment: u.type,
3464
+ implementation: y() ? "weixin" : "webview",
3326
3465
  features: {
3327
3466
  chooseLocation: !0,
3328
3467
  // 支持位置选择
@@ -3333,21 +3472,21 @@ function gn() {
3333
3472
  }
3334
3473
  };
3335
3474
  }
3336
- const ct = /* @__PURE__ */ new Map();
3337
- function pn(t, e = {}) {
3338
- ct.set(t, e);
3475
+ const gt = /* @__PURE__ */ new Map();
3476
+ function In(t, e = {}) {
3477
+ gt.set(t, e);
3339
3478
  }
3340
- function hn(t, e) {
3341
- const r = ct.get(t);
3479
+ function An(t, e) {
3480
+ const r = gt.get(t);
3342
3481
  if (r)
3343
3482
  return r[e] || r.default;
3344
3483
  }
3345
- const mn = {
3484
+ const On = {
3346
3485
  0: "WXSceneSession",
3347
3486
  // 聊天界面
3348
3487
  1: "WXSceneTimeline"
3349
3488
  // 朋友圈
3350
- }, wn = {
3489
+ }, Cn = {
3351
3490
  0: "图文/网页",
3352
3491
  1: "纯文字",
3353
3492
  2: "纯图片",
@@ -3355,33 +3494,33 @@ const mn = {
3355
3494
  4: "视频",
3356
3495
  5: "小程序"
3357
3496
  };
3358
- function ut(t = {}) {
3359
- return u.safeExecute(
3497
+ function ht(t = {}) {
3498
+ return l.safeExecute(
3360
3499
  () => {
3361
3500
  var n, i;
3362
3501
  if (typeof window == "undefined" || !window.wx) {
3363
3502
  const a = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
3364
3503
  return (n = t.fail) == null || n.call(t, a), Promise.reject(a);
3365
3504
  }
3366
- if (!z())
3367
- return s.info("等待微信配置完成"), k().then(() => ut(t));
3368
- const e = lt(t);
3505
+ if (!G())
3506
+ return s.info("等待微信配置完成"), B().then(() => ht(t));
3507
+ const e = pt(t);
3369
3508
  if (!e.success) {
3370
3509
  const a = { errMsg: e.message || "参数校验失败", code: "INVALID_PARAMS" };
3371
3510
  return (i = t.fail) == null || i.call(t, a), Promise.reject(a);
3372
3511
  }
3373
3512
  const r = e.params;
3374
- return s.debug("调用微信分享", r), new Promise((a, g) => {
3375
- window.wx[r.scene](A(p({}, r), {
3513
+ return s.debug("调用微信分享", r), new Promise((a, c) => {
3514
+ window.wx[r.scene](A(h({}, r), {
3376
3515
  success: () => {
3377
- var l;
3516
+ var f;
3378
3517
  const d = { errMsg: "weixinShare:ok" };
3379
- (l = t.success) == null || l.call(t, d), a(d);
3518
+ (f = t.success) == null || f.call(t, d), a(d);
3380
3519
  },
3381
3520
  fail: (d) => {
3382
- var h;
3383
- const l = { errMsg: (d == null ? void 0 : d.errMsg) || "weixinShare:fail", details: d };
3384
- s.error("微信分享失败", l), (h = t.fail) == null || h.call(t, l), g(l);
3521
+ var w;
3522
+ const f = { errMsg: (d == null ? void 0 : d.errMsg) || "weixinShare:fail", details: d };
3523
+ s.error("微信分享失败", f), (w = t.fail) == null || w.call(t, f), c(f);
3385
3524
  },
3386
3525
  complete: t.complete
3387
3526
  }));
@@ -3393,16 +3532,16 @@ function ut(t = {}) {
3393
3532
  }
3394
3533
  );
3395
3534
  }
3396
- function lt(t = {}) {
3397
- const e = p({}, t), r = {
3535
+ function pt(t = {}) {
3536
+ const e = h({}, t), r = {
3398
3537
  scene: e.scene === 1 ? "updateTimelineShareData" : "updateAppMessageShareData"
3399
3538
  };
3400
3539
  return s.info("格式化微信参数", e), Object.prototype.hasOwnProperty.call(e, "title") ? Object.prototype.hasOwnProperty.call(e, "imageUrl") ? Object.prototype.hasOwnProperty.call(e, "path") ? Object.prototype.hasOwnProperty.call(e, "summary") ? (r.title = e.title, r.imgUrl = e.imageUrl, r.link = e.path, r.desc = e.summary, { params: r, success: !0 }) : { message: "参数字段summary值缺少!", success: !1 } : { message: "参数字段path值缺少!", success: !1 } : { message: "参数字段imageUrl值缺少!", success: !1 } : { message: "参数字段title值缺少!", success: !1 };
3401
3540
  }
3402
- function J(t = {}) {
3403
- return u.safeExecute(
3541
+ function Y(t = {}) {
3542
+ return l.safeExecute(
3404
3543
  () => (s.debug("通过 WebView 桥接调用微信分享", t), new Promise((e, r) => {
3405
- C("toShareData", t, {
3544
+ R("toShareData", t, {
3406
3545
  success: (n) => {
3407
3546
  var i;
3408
3547
  (i = t.success) == null || i.call(t, n), e(n);
@@ -3420,14 +3559,14 @@ function J(t = {}) {
3420
3559
  }
3421
3560
  );
3422
3561
  }
3423
- function En(t = {}) {
3424
- const e = p({}, t), r = {
3562
+ function _n(t = {}) {
3563
+ const e = h({}, t), r = {
3425
3564
  provider: "weixin",
3426
3565
  scene: "WXSceneSession"
3427
3566
  };
3428
- if (s.info("格式化 UniApp 参数", e), [0, 1].some((n) => parseInt(n) === parseInt(e.scene)) ? r.scene = mn[e.scene] : r.scene = "WXSceneSession", Object.prototype.hasOwnProperty.call(e, "type")) {
3567
+ if (s.info("格式化 UniApp 参数", e), [0, 1].some((n) => parseInt(n) === parseInt(e.scene)) ? r.scene = On[e.scene] : r.scene = "WXSceneSession", Object.prototype.hasOwnProperty.call(e, "type")) {
3429
3568
  const n = Number(e.type);
3430
- if (Object.keys(wn).some((a) => parseInt(a) === n)) {
3569
+ if (Object.keys(Cn).some((a) => parseInt(a) === n)) {
3431
3570
  if (r.type = n, [0].includes(n))
3432
3571
  if (Object.prototype.hasOwnProperty.call(e, "path"))
3433
3572
  r.href = e.path;
@@ -3443,29 +3582,29 @@ function En(t = {}) {
3443
3582
  r.imageUrl = e.imageUrl;
3444
3583
  else
3445
3584
  return { message: "参数字段imageUrl值缺少!", success: !1 };
3446
- [5].includes(n) && Object.prototype.hasOwnProperty.call(e, "miniProgram") && p({}, e.miniProgram), Object.prototype.hasOwnProperty.call(e, "title") && (r.title = e.title), Object.prototype.hasOwnProperty.call(e, "success") && (r.success = e.success), Object.prototype.hasOwnProperty.call(e, "fail") && (r.fail = e.fail), Object.prototype.hasOwnProperty.call(e, "complete") && (r.complete = e.complete);
3585
+ [5].includes(n) && Object.prototype.hasOwnProperty.call(e, "miniProgram") && h({}, e.miniProgram), Object.prototype.hasOwnProperty.call(e, "title") && (r.title = e.title), Object.prototype.hasOwnProperty.call(e, "success") && (r.success = e.success), Object.prototype.hasOwnProperty.call(e, "fail") && (r.fail = e.fail), Object.prototype.hasOwnProperty.call(e, "complete") && (r.complete = e.complete);
3447
3586
  } else
3448
3587
  return { message: "参数字段type值有误!", success: !1 };
3449
3588
  } else
3450
3589
  return { message: "参数字段type缺少!", success: !1 };
3451
3590
  return { params: r, success: !0 };
3452
3591
  }
3453
- const ft = "share.toShare";
3454
- pn(ft, {
3455
- weixin: ut,
3456
- webview: J,
3457
- plus: J,
3458
- nvue: J,
3459
- uvue: J,
3460
- UniApp: J,
3461
- h5: J,
3592
+ const mt = "share.toShare";
3593
+ In(mt, {
3594
+ weixin: ht,
3595
+ webview: Y,
3596
+ plus: Y,
3597
+ nvue: Y,
3598
+ uvue: Y,
3599
+ UniApp: Y,
3600
+ h5: Y,
3462
3601
  default: void 0
3463
3602
  });
3464
- function yn(t = {}) {
3465
- return u.safeExecute(
3603
+ function Rn(t = {}) {
3604
+ return l.safeExecute(
3466
3605
  () => {
3467
- var a, g;
3468
- const e = Ne(), r = hn(ft, e.type);
3606
+ var a, c;
3607
+ const e = Ie(), r = An(mt, e.type);
3469
3608
  if (typeof r != "function") {
3470
3609
  const d = {
3471
3610
  errMsg: `当前环境 (${e.type}) 不支持微信分享功能`,
@@ -3473,10 +3612,10 @@ function yn(t = {}) {
3473
3612
  };
3474
3613
  return s.error("平台不支持微信分享", { platform: e.type }), (a = t.fail) == null || a.call(t, d), Promise.reject(d);
3475
3614
  }
3476
- const n = E() ? lt(t) : En(t);
3615
+ const n = y() ? pt(t) : _n(t);
3477
3616
  if (!n.success) {
3478
3617
  const d = { errMsg: n.message || "参数校验失败", code: "INVALID_PARAMS" };
3479
- return (g = t.fail) == null || g.call(t, d), Promise.reject(d);
3618
+ return (c = t.fail) == null || c.call(t, d), Promise.reject(d);
3480
3619
  }
3481
3620
  const i = n.params;
3482
3621
  return s.info("开始微信分享", { platform: e.type, type: i == null ? void 0 : i.type }), r(i);
@@ -3487,7 +3626,7 @@ function yn(t = {}) {
3487
3626
  }
3488
3627
  );
3489
3628
  }
3490
- const In = {
3629
+ const Pn = {
3491
3630
  OFF: "off",
3492
3631
  // 蓝牙关闭
3493
3632
  ON: "on",
@@ -3496,29 +3635,29 @@ const In = {
3496
3635
  // 不支持蓝牙
3497
3636
  UNAUTHORIZED: "unauthorized"
3498
3637
  // 未授权
3499
- }, An = {
3638
+ }, Nn = {
3500
3639
  allowDuplicatesKey: !1,
3501
3640
  // 是否允许重复上报同一设备
3502
3641
  services: []
3503
3642
  // 指定服务 UUID 列表
3504
3643
  };
3505
- function we(t = {}) {
3506
- return p(p({}, An), t);
3644
+ function Ae(t = {}) {
3645
+ return h(h({}, Nn), t);
3507
3646
  }
3508
- function se() {
3509
- return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(c.type);
3647
+ function ce() {
3648
+ return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
3510
3649
  }
3511
- function On(t) {
3512
- return u.safeExecute(() => m(null, null, function* () {
3650
+ function Sn(t) {
3651
+ return l.safeExecute(() => p(null, null, function* () {
3513
3652
  var e;
3514
3653
  if (!window.wx) {
3515
3654
  const r = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
3516
3655
  (e = t.fail) == null || e.call(t, r);
3517
3656
  return;
3518
3657
  }
3519
- z() || (s.info("等待微信配置完成"), yield k()), wx.openBluetoothAdapter({
3658
+ G() || (s.info("等待微信配置完成"), yield B()), wx.openBluetoothAdapter({
3520
3659
  success: () => {
3521
- s.info("微信蓝牙适配器已打开"), dt(t);
3660
+ s.info("微信蓝牙适配器已打开"), wt(t);
3522
3661
  },
3523
3662
  fail: (r) => {
3524
3663
  var n;
@@ -3527,9 +3666,9 @@ function On(t) {
3527
3666
  });
3528
3667
  }), { context: "openBluetoothAdapterInWeixin" });
3529
3668
  }
3530
- function _n(t) {
3531
- return u.safeExecute(() => {
3532
- s.debug("通过 WebView 桥接调用蓝牙功能", t), C("bluetooth", t, {
3669
+ function Tn(t) {
3670
+ return l.safeExecute(() => {
3671
+ s.debug("通过 WebView 桥接调用蓝牙功能", t), R("bluetooth", t, {
3533
3672
  success: (e) => {
3534
3673
  var r;
3535
3674
  s.info("UniApp 蓝牙调用成功", e), (r = t.success) == null || r.call(t, e);
@@ -3542,10 +3681,10 @@ function _n(t) {
3542
3681
  });
3543
3682
  }, { context: "bluetoothInUniApp" });
3544
3683
  }
3545
- function Cn(t) {
3546
- return u.safeExecute(() => {
3684
+ function Ln(t) {
3685
+ return l.safeExecute(() => {
3547
3686
  var e;
3548
- s.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), C("bluetoothDevicesDiscovery", {
3687
+ s.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), R("bluetoothDevicesDiscovery", {
3549
3688
  action: "startBluetoothDevicesDiscovery",
3550
3689
  params: {
3551
3690
  services: t.services || [],
@@ -3564,11 +3703,11 @@ function Cn(t) {
3564
3703
  });
3565
3704
  }, { context: "startBluetoothDevicesDiscoveryInUniApp" });
3566
3705
  }
3567
- const oe = /* @__PURE__ */ new Set();
3568
- function Nn(t, e = {}) {
3569
- return u.safeExecute(() => {
3706
+ const le = /* @__PURE__ */ new Set();
3707
+ function Mn(t, e = {}) {
3708
+ return l.safeExecute(() => {
3570
3709
  var r;
3571
- return oe.add(t), oe.size === 1 && C("onBluetoothDeviceFound", {
3710
+ return le.add(t), le.size === 1 && R("onBluetoothDeviceFound", {
3572
3711
  action: "onBluetoothDeviceFound",
3573
3712
  isPersistent: !0,
3574
3713
  params: {
@@ -3577,8 +3716,8 @@ function Nn(t, e = {}) {
3577
3716
  }
3578
3717
  }, {
3579
3718
  success: (n) => {
3580
- oe.forEach((i) => {
3581
- typeof i == "function" ? u.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
3719
+ le.forEach((i) => {
3720
+ typeof i == "function" ? l.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
3582
3721
  });
3583
3722
  },
3584
3723
  fail: (n) => {
@@ -3586,13 +3725,13 @@ function Nn(t, e = {}) {
3586
3725
  console.error("[Bluetooth] 搜索失败:", n), (i = e.fail) == null || i.call(e, n);
3587
3726
  },
3588
3727
  complete: e.complete
3589
- }), () => oe.delete(t);
3728
+ }), () => le.delete(t);
3590
3729
  }, { context: "qsh_onBluetoothDeviceFound" });
3591
3730
  }
3592
- function Rn(t) {
3593
- return u.safeExecute(() => {
3731
+ function bn(t) {
3732
+ return l.safeExecute(() => {
3594
3733
  var e;
3595
- s.debug("通过 WebView 桥接调用蓝牙连接功能", t), C("bluetoothConnection", {
3734
+ s.debug("通过 WebView 桥接调用蓝牙连接功能", t), R("bluetoothConnection", {
3596
3735
  action: "createBLEConnection",
3597
3736
  params: {
3598
3737
  deviceId: t.deviceId,
@@ -3612,90 +3751,90 @@ function Rn(t) {
3612
3751
  });
3613
3752
  }, { context: "createBLEConnectionInUniApp" });
3614
3753
  }
3615
- function Sn(t = {}) {
3616
- return u.safeExecute(() => {
3754
+ function xn(t = {}) {
3755
+ return l.safeExecute(() => {
3617
3756
  var r;
3618
- if (!se()) {
3757
+ if (!ce()) {
3619
3758
  const n = {
3620
- errMsg: `当前环境 (${c.type}) 不支持蓝牙功能`,
3759
+ errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
3621
3760
  code: "PLATFORM_NOT_SUPPORTED"
3622
3761
  };
3623
- s.error("平台不支持蓝牙", { platform: c.type }), (r = t.fail) == null || r.call(t, n);
3762
+ s.error("平台不支持蓝牙", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
3624
3763
  return;
3625
3764
  }
3626
- const e = we(t);
3765
+ const e = Ae(t);
3627
3766
  s.info("开始蓝牙操作", {
3628
- platform: c.type,
3767
+ platform: u.type,
3629
3768
  services: e.services,
3630
3769
  allowDuplicatesKey: e.allowDuplicatesKey
3631
- }), E() ? On(e) : _n(e);
3770
+ }), y() ? Sn(e) : Tn(e);
3632
3771
  }, { context: "openBluetoothAdapter", options: t });
3633
3772
  }
3634
- function Pn(t = {}) {
3635
- return u.safeExecute(() => {
3773
+ function vn(t = {}) {
3774
+ return l.safeExecute(() => {
3636
3775
  var r, n;
3637
- if (!se()) {
3776
+ if (!ce()) {
3638
3777
  const i = {
3639
- errMsg: `当前环境 (${c.type}) 不支持蓝牙功能`,
3778
+ errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
3640
3779
  code: "PLATFORM_NOT_SUPPORTED"
3641
3780
  };
3642
- s.error("平台不支持蓝牙", { platform: c.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
3781
+ s.error("平台不支持蓝牙", { platform: u.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
3643
3782
  return;
3644
3783
  }
3645
- const e = we(t);
3784
+ const e = Ae(t);
3646
3785
  s.info("开始搜索蓝牙设备", {
3647
- platform: c.type,
3786
+ platform: u.type,
3648
3787
  services: e.services,
3649
3788
  allowDuplicatesKey: e.allowDuplicatesKey
3650
- }), E() ? startBluetoothDevicesDiscoveryInWeixin(e) : Cn(e);
3789
+ }), y() ? startBluetoothDevicesDiscoveryInWeixin(e) : Ln(e);
3651
3790
  }, { context: "startBluetoothDevicesDiscovery", options: t });
3652
3791
  }
3653
- function dt(t, e = {}) {
3654
- return u.safeExecute(() => {
3792
+ function wt(t, e = {}) {
3793
+ return l.safeExecute(() => {
3655
3794
  var n, i;
3656
- if (!se()) {
3795
+ if (!ce()) {
3657
3796
  const a = {
3658
- errMsg: `当前环境 (${c.type}) 不支持蓝牙功能`,
3797
+ errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
3659
3798
  code: "PLATFORM_NOT_SUPPORTED"
3660
3799
  };
3661
- s.error("平台不支持蓝牙", { platform: c.type }), (n = e.fail) == null || n.call(e, a), (i = e.complete) == null || i.call(e, a);
3800
+ s.error("平台不支持蓝牙", { platform: u.type }), (n = e.fail) == null || n.call(e, a), (i = e.complete) == null || i.call(e, a);
3662
3801
  return;
3663
3802
  }
3664
- const r = we(e);
3665
- s.info("注册蓝牙设备发现监听", { platform: c.type }), E() ? onBluetoothDeviceFoundInWeixin(r) : Nn(t, r);
3803
+ const r = Ae(e);
3804
+ s.info("注册蓝牙设备发现监听", { platform: u.type }), y() ? onBluetoothDeviceFoundInWeixin(r) : Mn(t, r);
3666
3805
  }, { context: "onBluetoothDeviceFound", options: e });
3667
3806
  }
3668
- function Tn(t = {}) {
3669
- return u.safeExecute(() => {
3670
- var a, g, d, l;
3671
- if (!se()) {
3672
- const h = {
3673
- errMsg: `当前环境 (${c.type}) 不支持蓝牙功能`,
3807
+ function Dn(t = {}) {
3808
+ return l.safeExecute(() => {
3809
+ var a, c, d, f;
3810
+ if (!ce()) {
3811
+ const w = {
3812
+ errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
3674
3813
  code: "PLATFORM_NOT_SUPPORTED"
3675
3814
  };
3676
- s.error("平台不支持蓝牙连接", { platform: c.type }), (a = t.fail) == null || a.call(t, h), (g = t.complete) == null || g.call(t, h);
3815
+ s.error("平台不支持蓝牙连接", { platform: u.type }), (a = t.fail) == null || a.call(t, w), (c = t.complete) == null || c.call(t, w);
3677
3816
  return;
3678
3817
  }
3679
- const e = we(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
3818
+ const e = Ae(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
3680
3819
  if (!n) {
3681
- const h = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
3682
- (d = t.fail) == null || d.call(t, h), (l = t.complete) == null || l.call(t, h);
3820
+ const w = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
3821
+ (d = t.fail) == null || d.call(t, w), (f = t.complete) == null || f.call(t, w);
3683
3822
  return;
3684
3823
  }
3685
- s.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: c.type }), E() ? uni.createBLEConnection({
3824
+ s.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: u.type }), y() ? uni.createBLEConnection({
3686
3825
  deviceId: n,
3687
3826
  autoConnect: i,
3688
3827
  success: t.success,
3689
3828
  fail: t.fail,
3690
3829
  complete: t.complete
3691
- }) : Rn(e);
3830
+ }) : bn(e);
3692
3831
  }, { context: "createBLEConnection", options: t });
3693
3832
  }
3694
- function Ln() {
3833
+ function Un() {
3695
3834
  return {
3696
- supported: se(),
3697
- environment: c.type,
3698
- implementation: E() ? "weixin" : "webview",
3835
+ supported: ce(),
3836
+ environment: u.type,
3837
+ implementation: y() ? "weixin" : "webview",
3699
3838
  features: {
3700
3839
  discovery: !0,
3701
3840
  connect: !0,
@@ -3705,18 +3844,18 @@ function Ln() {
3705
3844
  }
3706
3845
  };
3707
3846
  }
3708
- const Mn = {
3847
+ const Wn = {
3709
3848
  // TODO: 添加更多默认配置
3710
3849
  };
3711
- function bn(t = {}) {
3712
- return p(p({}, Mn), t);
3850
+ function Fn(t = {}) {
3851
+ return h(h({}, Wn), t);
3713
3852
  }
3714
- function gt() {
3715
- return ["webview", "UniApp", "plus", "nvue", "uvue"].includes(c.type);
3853
+ function Et() {
3854
+ return ["webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
3716
3855
  }
3717
- function vn(t) {
3718
- return u.safeExecute(() => {
3719
- s.debug("通过 WebView 桥接调用打印PDF", t), C("printPdf", A(p({}, t), {
3856
+ function $n(t) {
3857
+ return l.safeExecute(() => {
3858
+ s.debug("通过 WebView 桥接调用打印PDF", t), R("printPdf", A(h({}, t), {
3720
3859
  isPersistent: !0
3721
3860
  // 强制禁用超时自动清理
3722
3861
  }), {
@@ -3735,207 +3874,219 @@ function vn(t) {
3735
3874
  platform: "uniapp"
3736
3875
  });
3737
3876
  }
3738
- function xn(t = {}) {
3739
- return u.safeExecute(() => {
3877
+ function Bn(t = {}) {
3878
+ return l.safeExecute(() => {
3740
3879
  var r;
3741
- if (!gt()) {
3880
+ if (!Et()) {
3742
3881
  const n = {
3743
- errMsg: `当前环境 (${c.type}) 不支持打印PDF功能`,
3882
+ errMsg: `当前环境 (${u.type}) 不支持打印PDF功能`,
3744
3883
  code: "PLATFORM_NOT_SUPPORTED"
3745
3884
  };
3746
- s.error("平台不支持打印PDF", { platform: c.type }), (r = t.fail) == null || r.call(t, n);
3885
+ s.error("平台不支持打印PDF", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
3747
3886
  return;
3748
3887
  }
3749
- const e = bn(t);
3750
- s.info("开始打印PDF", { platform: c.type }), vn(e);
3888
+ const e = Fn(t);
3889
+ s.info("开始打印PDF", { platform: u.type }), $n(e);
3751
3890
  }, {
3752
3891
  context: "printPdf",
3753
3892
  options: t
3754
3893
  });
3755
3894
  }
3756
- function Dn() {
3895
+ function kn() {
3757
3896
  return {
3758
- supported: gt(),
3759
- environment: c.type,
3897
+ supported: Et(),
3898
+ environment: u.type,
3760
3899
  implementation: "uniapp",
3761
3900
  features: {
3762
3901
  asyncSupport: !0
3763
3902
  }
3764
3903
  };
3765
3904
  }
3766
- const pt = Ne();
3767
- K.useResponse(Ve.response, { priority: 1e3 });
3768
- let Ue = !1;
3769
- function We() {
3770
- if (Ue) return;
3771
- Ue = !0, sr([
3772
- { name: "load-weixin-sdk", run: zt, timeoutMs: 8e3 },
3773
- { name: "init-bridge", run: ze, timeoutMs: 8e3 }
3905
+ const yt = Ie();
3906
+ function Kn() {
3907
+ if (typeof window == "undefined" || !Ie(!0).isWeixinMiniProgram)
3908
+ return !1;
3909
+ const e = _e().getRuntimeConfig();
3910
+ return typeof e.clientId == "string" && e.clientId.length > 0;
3911
+ }
3912
+ function zn() {
3913
+ return p(this, null, function* () {
3914
+ yield Gt(), Kn() && (yield B());
3915
+ });
3916
+ }
3917
+ V.useResponse(Ye.response, { priority: 1e3 });
3918
+ let $e = !1;
3919
+ function Be() {
3920
+ if ($e) return;
3921
+ $e = !0, fr([
3922
+ { name: "load-weixin-sdk", run: qe, timeoutMs: 8e3 },
3923
+ { name: "init-bridge", run: Ve, timeoutMs: 8e3 }
3774
3924
  ], {
3775
3925
  onError: (e, r) => {
3776
3926
  console.error(`[QSH-SDK] 初始化失败(${(r == null ? void 0 : r.name) || "unknown"}):`, e);
3777
3927
  }
3778
3928
  });
3779
3929
  }
3780
- typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(We, 0) : document.addEventListener("DOMContentLoaded", We));
3781
- function I(t, { apiName: e } = {}) {
3930
+ typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(Be, 0) : document.addEventListener("DOMContentLoaded", Be));
3931
+ function O(t, { apiName: e } = {}) {
3782
3932
  return function(r = {}, ...n) {
3783
- const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), a = r && typeof r == "object" ? r : {}, g = () => i ? t(a, ...n) : new Promise((l, h) => {
3784
- const T = A(p({}, a), {
3785
- success: (N) => {
3786
- typeof a.success == "function" && a.success(N), l(N);
3933
+ const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), a = r && typeof r == "object" ? r : {}, c = () => i ? t(a, ...n) : new Promise((f, w) => {
3934
+ const b = A(h({}, a), {
3935
+ success: (S) => {
3936
+ typeof a.success == "function" && a.success(S), f(S);
3787
3937
  },
3788
- fail: (N) => {
3789
- typeof a.fail == "function" && a.fail(N), h(N);
3938
+ fail: (S) => {
3939
+ typeof a.fail == "function" && a.fail(S), w(S);
3790
3940
  },
3791
3941
  complete: a.complete
3792
3942
  });
3793
- t(T, ...n);
3943
+ t(b, ...n);
3794
3944
  });
3795
- return (typeof window == "undefined" ? Promise.resolve() : Fe()).then(() => g()).catch((l) => {
3796
- throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, l), l;
3945
+ return (typeof window == "undefined" ? Promise.resolve() : ze()).then(() => c()).catch((f) => {
3946
+ throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, f), f;
3797
3947
  });
3798
3948
  };
3799
3949
  }
3800
- function ce(t) {
3950
+ function fe(t) {
3801
3951
  return typeof t == "function" ? { success: t } : t && typeof t == "object" ? t : {};
3802
3952
  }
3803
- const ht = I(Nr), mt = I(Rr), wt = I(Sr), Et = I(Pr), yt = I(Tr), It = I(Lr);
3804
- function At(t) {
3805
- const e = () => Mr(t);
3806
- return (typeof window == "undefined" ? Promise.resolve() : Fe()).then(() => e());
3953
+ const It = O(Mr), At = O(br), Ot = O(xr), Ct = O(vr), _t = O(Dr), Rt = O(Ur);
3954
+ function Pt(t) {
3955
+ const e = () => Wr(t);
3956
+ return (typeof window == "undefined" ? Promise.resolve() : ze()).then(() => e());
3807
3957
  }
3808
- const Se = I($r);
3809
- function Un(t = {}) {
3958
+ const Le = O(Gr);
3959
+ function Gn(t = {}) {
3810
3960
  return new Promise((e, r) => {
3811
- Se(A(p({}, t), {
3961
+ Le(A(h({}, t), {
3812
3962
  success: e,
3813
3963
  fail: r
3814
3964
  }));
3815
3965
  });
3816
3966
  }
3817
- const Ot = I(xn);
3818
- function Wn(t = {}) {
3967
+ const Nt = O(Bn);
3968
+ function Vn(t = {}) {
3819
3969
  return new Promise((e, r) => {
3820
- Ot(A(p({}, t), {
3970
+ Nt(A(h({}, t), {
3821
3971
  success: e,
3822
3972
  fail: r
3823
3973
  }));
3824
3974
  });
3825
3975
  }
3826
- const Pe = I(Gr);
3827
- function $n(t = {}) {
3976
+ const Me = O(Yr);
3977
+ function jn(t = {}) {
3828
3978
  return new Promise((e, r) => {
3829
- Pe(A(p({}, t), {
3979
+ Me(A(h({}, t), {
3830
3980
  success: e,
3831
3981
  fail: r
3832
3982
  }));
3833
3983
  });
3834
3984
  }
3835
- const Bn = I(yn), Te = I(Qr);
3836
- function Fn(t = {}) {
3985
+ const qn = O(Rn), be = O(an);
3986
+ function Jn(t = {}) {
3837
3987
  return new Promise((e, r) => {
3838
- Te(A(p({}, t), {
3988
+ be(A(h({}, t), {
3839
3989
  success: e,
3840
3990
  fail: r
3841
3991
  }));
3842
3992
  });
3843
3993
  }
3844
- const Le = I(en);
3845
- function kn(t = {}) {
3994
+ const xe = O(on);
3995
+ function Hn(t = {}) {
3846
3996
  return new Promise((e, r) => {
3847
- Le(A(p({}, t), {
3997
+ xe(A(h({}, t), {
3848
3998
  success: e,
3849
3999
  fail: r
3850
4000
  }));
3851
4001
  });
3852
4002
  }
3853
- const Me = I(dn);
3854
- function zn(t = {}) {
4003
+ const ve = O(En);
4004
+ function Yn(t = {}) {
3855
4005
  return new Promise((e, r) => {
3856
- Me(A(p({}, t), {
4006
+ ve(A(h({}, t), {
3857
4007
  success: e,
3858
4008
  fail: r
3859
4009
  }));
3860
4010
  });
3861
4011
  }
3862
- const _t = I(Sn);
3863
- function Kn(t = {}) {
4012
+ const St = O(xn);
4013
+ function Xn(t = {}) {
3864
4014
  return new Promise((e, r) => {
3865
- _t(A(p({}, t), {
4015
+ St(A(h({}, t), {
3866
4016
  success: e,
3867
4017
  fail: r
3868
4018
  }));
3869
4019
  });
3870
4020
  }
3871
- const Ct = I(Pn);
3872
- function Gn(t = {}) {
4021
+ const Tt = O(vn);
4022
+ function Zn(t = {}) {
3873
4023
  return new Promise((e, r) => {
3874
- Ct(A(p({}, t), {
4024
+ Tt(A(h({}, t), {
3875
4025
  success: e,
3876
4026
  fail: r
3877
4027
  }));
3878
4028
  });
3879
4029
  }
3880
- const Nt = I(dt);
3881
- function Vn(t = {}) {
4030
+ const Lt = O(wt);
4031
+ function Qn(t = {}) {
3882
4032
  return new Promise((e, r) => {
3883
- Nt(A(p({}, t), {
4033
+ Lt(A(h({}, t), {
3884
4034
  success: e,
3885
4035
  fail: r
3886
4036
  }));
3887
4037
  });
3888
4038
  }
3889
- const Rt = I(Tn);
3890
- function jn(t = {}) {
4039
+ const Mt = O(Dn);
4040
+ function ei(t = {}) {
3891
4041
  return new Promise((e, r) => {
3892
- Rt(A(p({}, t), {
4042
+ Mt(A(h({}, t), {
3893
4043
  success: e,
3894
4044
  fail: r
3895
4045
  }));
3896
4046
  });
3897
4047
  }
3898
- const Q = {
4048
+ const te = {
3899
4049
  // 导航 API
3900
- navigateTo: ht,
3901
- navigateBack: mt,
3902
- switchTab: wt,
3903
- reLaunch: Et,
3904
- redirectTo: yt,
4050
+ navigateTo: It,
4051
+ navigateBack: At,
4052
+ switchTab: Ot,
4053
+ reLaunch: Ct,
4054
+ redirectTo: _t,
3905
4055
  // 消息 API
3906
- postMessage: It,
3907
- getEnv: At,
4056
+ postMessage: Rt,
4057
+ getEnv: Pt,
3908
4058
  // 图片 API
3909
- chooseImage: Se,
3910
- chooseImageAsync: Un,
4059
+ chooseImage: Le,
4060
+ chooseImageAsync: Gn,
3911
4061
  // 扫码 API
3912
- scanCode: Pe,
3913
- scanCodeAsync: $n,
4062
+ scanCode: Me,
4063
+ scanCodeAsync: jn,
3914
4064
  // 位置 API
3915
- getLocation: Te,
3916
- getLocationAsync: Fn,
3917
- openLocation: Le,
3918
- openLocationAsync: kn,
3919
- chooseLocation: Me,
3920
- chooseLocationAsync: zn,
4065
+ getLocation: be,
4066
+ getLocationAsync: Jn,
4067
+ openLocation: xe,
4068
+ openLocationAsync: Hn,
4069
+ chooseLocation: ve,
4070
+ chooseLocationAsync: Yn,
3921
4071
  // 位置监听 API(保留回调签名)
3922
- onLocationChange: (t) => I((e = {}) => sn(e.success), { apiName: "onLocationChange" })(ce(t)),
3923
- offLocationChange: (t) => I((e = {}) => an(e.success), { apiName: "offLocationChange" })(ce(t)),
3924
- onLocationChangeError: (t) => I((e = {}) => on(e.success), { apiName: "onLocationChangeError" })(ce(t)),
3925
- offLocationChangeError: (t) => I((e = {}) => cn(e.success), { apiName: "offLocationChangeError" })(ce(t)),
3926
- startLocationUpdate: I(rn, { apiName: "startLocationUpdate" }),
3927
- stopLocationUpdate: I(nn, { apiName: "stopLocationUpdate" }),
4072
+ onLocationChange: (t) => O((e = {}) => fn(e.success), { apiName: "onLocationChange" })(fe(t)),
4073
+ offLocationChange: (t) => O((e = {}) => dn(e.success), { apiName: "offLocationChange" })(fe(t)),
4074
+ onLocationChangeError: (t) => O((e = {}) => gn(e.success), { apiName: "onLocationChangeError" })(fe(t)),
4075
+ offLocationChangeError: (t) => O((e = {}) => hn(e.success), { apiName: "offLocationChangeError" })(fe(t)),
4076
+ startLocationUpdate: O(un, { apiName: "startLocationUpdate" }),
4077
+ stopLocationUpdate: O(ln, { apiName: "stopLocationUpdate" }),
3928
4078
  // 环境信息
3929
- environment: pt,
4079
+ environment: yt,
3930
4080
  /**
3931
- * 等待 JSBridge 就绪
3932
- * 返回一个 Promise,当桥接完成初始化后 resolve。
4081
+ * Wait for SDK readiness.
4082
+ * In Weixin mini-program web-view, if qsh.config({ clientId }) was called,
4083
+ * this also waits for wx.config to complete.
3933
4084
  * @returns {Promise<void>}
3934
4085
  * @example
3935
4086
  * await qsh.ready()
3936
4087
  * @since 2.0.0
3937
4088
  */
3938
- ready: Bt,
4089
+ ready: zn,
3939
4090
  /**
3940
4091
  * 手动初始化 JSBridge
3941
4092
  * 默认会在 DOM 就绪时自动初始化;如需更早或手动控制,可调用本方法。
@@ -3944,7 +4095,7 @@ const Q = {
3944
4095
  * await qsh.init()
3945
4096
  * @since 2.0.0
3946
4097
  */
3947
- init: ze,
4098
+ init: Ve,
3948
4099
  /**
3949
4100
  * 检查 JSBridge 是否就绪
3950
4101
  * @returns {boolean}
@@ -3952,7 +4103,7 @@ const Q = {
3952
4103
  * if (qsh.isReady()) { console.log('ready') }
3953
4104
  * @since 2.0.0
3954
4105
  */
3955
- isReady: xt,
4106
+ isReady: $t,
3956
4107
  /**
3957
4108
  * 获取当前 SDK 状态
3958
4109
  * @returns {string}
@@ -3960,7 +4111,8 @@ const Q = {
3960
4111
  * console.log(qsh.getState()) // 'ready'
3961
4112
  * @since 2.0.0
3962
4113
  */
3963
- getState: Dt,
4114
+ getState: Bt,
4115
+ config: Ue,
3964
4116
  // 微信配置 API
3965
4117
  weixin: {
3966
4118
  /**
@@ -3970,7 +4122,8 @@ const Q = {
3970
4122
  * await qsh.weixin.waitForConfig()
3971
4123
  * @since 2.0.0
3972
4124
  */
3973
- waitForConfig: k,
4125
+ config: Ue,
4126
+ waitForConfig: B,
3974
4127
  /**
3975
4128
  * 检查微信配置是否完成
3976
4129
  * @returns {boolean}
@@ -3978,7 +4131,7 @@ const Q = {
3978
4131
  * if (qsh.weixin.isConfigReady()) { wx.chooseImage({}) }
3979
4132
  * @since 2.0.0
3980
4133
  */
3981
- isConfigReady: z,
4134
+ isConfigReady: G,
3982
4135
  /**
3983
4136
  * 获取微信配置状态
3984
4137
  * @returns {string}
@@ -3986,7 +4139,7 @@ const Q = {
3986
4139
  * console.log(qsh.weixin.getConfigState()) // 'configured'
3987
4140
  * @since 2.0.0
3988
4141
  */
3989
- getConfigState: Kt,
4142
+ getConfigState: Ht,
3990
4143
  /**
3991
4144
  * 手动重试微信配置
3992
4145
  * @returns {Promise<void>}
@@ -3994,13 +4147,13 @@ const Q = {
3994
4147
  * await qsh.weixin.retryConfig()
3995
4148
  * @since 2.0.0
3996
4149
  */
3997
- retryConfig: Gt
4150
+ retryConfig: Yt
3998
4151
  },
3999
4152
  // WebView 对象(兼容旧版本)
4000
4153
  webView: null,
4001
4154
  // 图片相关常量
4002
- ImageSourceTypes: le,
4003
- ImageSizeTypes: fe,
4155
+ ImageSourceTypes: ge,
4156
+ ImageSizeTypes: he,
4004
4157
  /**
4005
4158
  * 获取图片功能能力信息
4006
4159
  * @returns {Object} 能力信息对象
@@ -4009,9 +4162,9 @@ const Q = {
4009
4162
  * console.log('是否支持:', capabilities.supported)
4010
4163
  * @since 2.0.0
4011
4164
  */
4012
- getImageCapabilities: Br,
4165
+ getImageCapabilities: Vr,
4013
4166
  // 扫码相关常量
4014
- ScanTypes: V,
4167
+ ScanTypes: q,
4015
4168
  /**
4016
4169
  * 获取扫码功能能力信息
4017
4170
  * @returns {Object} 能力信息对象
@@ -4020,9 +4173,9 @@ const Q = {
4020
4173
  * console.log('是否支持:', capabilities.supported)
4021
4174
  * @since 2.1.0
4022
4175
  */
4023
- getScanCapabilities: Vr,
4176
+ getScanCapabilities: Xr,
4024
4177
  // 位置相关常量
4025
- CoordinateTypes: Z,
4178
+ CoordinateTypes: ee,
4026
4179
  /**
4027
4180
  * 获取位置功能能力信息
4028
4181
  * @returns {Object} 能力信息对象
@@ -4031,7 +4184,7 @@ const Q = {
4031
4184
  * console.log('是否支持:', capabilities.supported)
4032
4185
  * @since 2.1.0
4033
4186
  */
4034
- getLocationCapabilities: tn,
4187
+ getLocationCapabilities: cn,
4035
4188
  /**
4036
4189
  * 获取位置选择功能能力信息
4037
4190
  * @returns {Object} 能力信息对象
@@ -4040,20 +4193,20 @@ const Q = {
4040
4193
  * console.log('是否支持:', capabilities.supported)
4041
4194
  * @since 2.1.0
4042
4195
  */
4043
- getChooseLocationCapabilities: gn,
4196
+ getChooseLocationCapabilities: yn,
4044
4197
  // 蓝牙 API
4045
- openBluetoothAdapter: _t,
4046
- openBluetoothAdapterAsync: Kn,
4047
- startBluetoothDevicesDiscovery: Ct,
4048
- startBluetoothDevicesDiscoveryAsync: Gn,
4049
- onBluetoothDeviceFound: Nt,
4050
- onBluetoothDeviceFoundAsync: Vn,
4051
- createBLEConnection: Rt,
4052
- createBLEConnectionAsync: jn,
4198
+ openBluetoothAdapter: St,
4199
+ openBluetoothAdapterAsync: Xn,
4200
+ startBluetoothDevicesDiscovery: Tt,
4201
+ startBluetoothDevicesDiscoveryAsync: Zn,
4202
+ onBluetoothDeviceFound: Lt,
4203
+ onBluetoothDeviceFoundAsync: Qn,
4204
+ createBLEConnection: Mt,
4205
+ createBLEConnectionAsync: ei,
4053
4206
  // 蓝牙相关常量
4054
- BluetoothStates: In,
4207
+ BluetoothStates: Pn,
4055
4208
  //微信分享
4056
- toShare: Bn,
4209
+ toShare: qn,
4057
4210
  /**
4058
4211
  * 获取蓝牙功能能力信息
4059
4212
  * @returns {Object} 能力信息对象
@@ -4061,10 +4214,10 @@ const Q = {
4061
4214
  * const capabilities = qsh.getBluetoothCapabilities()
4062
4215
  * console.log('是否支持:', capabilities.supported)
4063
4216
  */
4064
- getBluetoothCapabilities: Ln,
4217
+ getBluetoothCapabilities: Un,
4065
4218
  // 打印PDF API
4066
- printPdf: Ot,
4067
- printPdfAsync: Wn,
4219
+ printPdf: Nt,
4220
+ printPdfAsync: Vn,
4068
4221
  /**
4069
4222
  * 获取打印PDF功能能力信息
4070
4223
  * @returns {Object} 能力信息对象
@@ -4072,13 +4225,13 @@ const Q = {
4072
4225
  * const capabilities = qsh.getPrintCapabilities()
4073
4226
  * console.log('是否支持:', capabilities.supported)
4074
4227
  */
4075
- getPrintCapabilities: Dn,
4228
+ getPrintCapabilities: kn,
4076
4229
  // 插件系统
4077
4230
  plugins: {
4078
4231
  /**
4079
4232
  * 插件管理器
4080
4233
  */
4081
- manager: te,
4234
+ manager: ne,
4082
4235
  /**
4083
4236
  * 注册插件
4084
4237
  * @param {Object} plugin - 插件对象
@@ -4086,7 +4239,7 @@ const Q = {
4086
4239
  * @example
4087
4240
  * qsh.plugins.register(myPlugin)
4088
4241
  */
4089
- register: (t) => te.register(t),
4242
+ register: (t) => ne.register(t),
4090
4243
  /**
4091
4244
  * 安装插件
4092
4245
  * @param {string} name - 插件名称
@@ -4094,21 +4247,21 @@ const Q = {
4094
4247
  * @example
4095
4248
  * await qsh.plugins.install('image')
4096
4249
  */
4097
- install: (t) => te.install(t, Q),
4250
+ install: (t) => ne.install(t, te),
4098
4251
  /**
4099
4252
  * 获取插件列表
4100
4253
  * @returns {Array} 插件列表
4101
4254
  * @example
4102
4255
  * console.log(qsh.plugins.list())
4103
4256
  */
4104
- list: () => te.getPluginList()
4257
+ list: () => ne.getPluginList()
4105
4258
  },
4106
4259
  // 拦截器系统
4107
4260
  interceptors: {
4108
4261
  /**
4109
4262
  * 拦截器链
4110
4263
  */
4111
- chain: K,
4264
+ chain: V,
4112
4265
  /**
4113
4266
  * 注册请求拦截器
4114
4267
  * @param {Function} interceptor - 拦截器函数
@@ -4120,7 +4273,7 @@ const Q = {
4120
4273
  * return ctx
4121
4274
  * })
4122
4275
  */
4123
- useRequest: (t, e) => K.useRequest(t, e),
4276
+ useRequest: (t, e) => V.useRequest(t, e),
4124
4277
  /**
4125
4278
  * 注册响应拦截器
4126
4279
  * @param {Function} interceptor - 拦截器函数
@@ -4132,16 +4285,16 @@ const Q = {
4132
4285
  * return result
4133
4286
  * })
4134
4287
  */
4135
- useResponse: (t, e) => K.useResponse(t, e),
4288
+ useResponse: (t, e) => V.useResponse(t, e),
4136
4289
  /**
4137
4290
  * 内置拦截器
4138
4291
  */
4139
4292
  builtin: {
4140
- logging: qt,
4141
- performance: W,
4142
- createRetry: Jt,
4143
- createValidation: Ht,
4144
- errorNormalizer: Ve
4293
+ logging: Qt,
4294
+ performance: k,
4295
+ createRetry: er,
4296
+ createValidation: tr,
4297
+ errorNormalizer: Ye
4145
4298
  }
4146
4299
  },
4147
4300
  // 观测指标
@@ -4149,11 +4302,11 @@ const Q = {
4149
4302
  /**
4150
4303
  * 获取性能指标报告
4151
4304
  */
4152
- getPerformanceReport: () => W.getReport(),
4305
+ getPerformanceReport: () => k.getReport(),
4153
4306
  /**
4154
4307
  * 清空性能指标
4155
4308
  */
4156
- clearPerformanceMetrics: () => W.clearMetrics()
4309
+ clearPerformanceMetrics: () => k.clearMetrics()
4157
4310
  },
4158
4311
  // 错误处理工具
4159
4312
  errors: {
@@ -4164,11 +4317,11 @@ const Q = {
4164
4317
  /**
4165
4318
  * 错误消息
4166
4319
  */
4167
- messages: Oe,
4320
+ messages: Re,
4168
4321
  /**
4169
4322
  * 错误分类
4170
4323
  */
4171
- categories: b,
4324
+ categories: D,
4172
4325
  /**
4173
4326
  * 标准化错误
4174
4327
  * @param {any} error - 原始错误
@@ -4177,7 +4330,7 @@ const Q = {
4177
4330
  * @example
4178
4331
  * const standardError = qsh.errors.normalize(error, { apiName: 'chooseImage' })
4179
4332
  */
4180
- normalize: Ge,
4333
+ normalize: He,
4181
4334
  /**
4182
4335
  * 创建标准错误
4183
4336
  * @param {string} code - 错误码
@@ -4186,7 +4339,7 @@ const Q = {
4186
4339
  * @example
4187
4340
  * const error = qsh.errors.create('E_IMG_001', { apiName: 'chooseImage' })
4188
4341
  */
4189
- create: rr,
4342
+ create: cr,
4190
4343
  /**
4191
4344
  * 判断是否为标准错误
4192
4345
  * @param {any} error - 错误对象
@@ -4194,14 +4347,14 @@ const Q = {
4194
4347
  * @example
4195
4348
  * if (qsh.errors.isStandard(error)) { ... }
4196
4349
  */
4197
- isStandard: nr
4350
+ isStandard: ur
4198
4351
  },
4199
4352
  // 状态管理
4200
4353
  store: {
4201
4354
  /**
4202
4355
  * 状态仓库实例
4203
4356
  */
4204
- instance: x,
4357
+ instance: W,
4205
4358
  /**
4206
4359
  * 获取状态
4207
4360
  * @param {string} path - 状态路径
@@ -4209,7 +4362,7 @@ const Q = {
4209
4362
  * @example
4210
4363
  * const status = qsh.store.get('sdk.status')
4211
4364
  */
4212
- get: (t) => x.get(t),
4365
+ get: (t) => W.get(t),
4213
4366
  /**
4214
4367
  * 设置状态
4215
4368
  * @param {string} path - 状态路径
@@ -4217,7 +4370,7 @@ const Q = {
4217
4370
  * @example
4218
4371
  * qsh.store.set('sdk.status', 'ready')
4219
4372
  */
4220
- set: (t, e) => x.set(t, e),
4373
+ set: (t, e) => W.set(t, e),
4221
4374
  /**
4222
4375
  * 订阅状态变化
4223
4376
  * @param {string} path - 状态路径
@@ -4228,39 +4381,39 @@ const Q = {
4228
4381
  * console.log('网络状态:', online)
4229
4382
  * })
4230
4383
  */
4231
- subscribe: (t, e) => x.subscribe(t, e),
4384
+ subscribe: (t, e) => W.subscribe(t, e),
4232
4385
  /**
4233
4386
  * 获取状态快照
4234
4387
  * @returns {Object} 状态快照
4235
4388
  * @example
4236
4389
  * console.log(qsh.store.getSnapshot())
4237
4390
  */
4238
- getSnapshot: () => x.getSnapshot()
4391
+ getSnapshot: () => W.getSnapshot()
4239
4392
  },
4240
4393
  // 调试工具(生产环境可能被优化掉)
4241
4394
  debug: {
4242
4395
  /**
4243
4396
  * 日志记录器
4244
4397
  */
4245
- logger: S,
4398
+ logger: T,
4246
4399
  /**
4247
4400
  * 设置外部日志 reporter,便于对接埋点/观测
4248
4401
  */
4249
- setLogReporter: (t) => S.setReporter(t),
4402
+ setLogReporter: (t) => T.setReporter(t),
4250
4403
  /**
4251
4404
  * 错误处理器
4252
4405
  */
4253
- errorHandler: u,
4406
+ errorHandler: l,
4254
4407
  /**
4255
4408
  * 状态管理器
4256
4409
  */
4257
- stateManager: G,
4410
+ stateManager: j,
4258
4411
  /**
4259
4412
  * 启用调试模式
4260
4413
  * @example
4261
4414
  * qsh.debug.enableDevMode()
4262
4415
  */
4263
- enableDevMode: () => S.enableDevMode(),
4416
+ enableDevMode: () => T.enableDevMode(),
4264
4417
  /**
4265
4418
  * 获取日志历史
4266
4419
  * @param {number} [count] - 获取条数
@@ -4268,7 +4421,7 @@ const Q = {
4268
4421
  * @example
4269
4422
  * console.log(qsh.debug.getLogs(10))
4270
4423
  */
4271
- getLogs: (t) => S.getHistory(t),
4424
+ getLogs: (t) => T.getHistory(t),
4272
4425
  /**
4273
4426
  * 获取 SDK 统计信息
4274
4427
  * @returns {Object} 统计信息
@@ -4276,12 +4429,12 @@ const Q = {
4276
4429
  * console.log(qsh.debug.getStats())
4277
4430
  */
4278
4431
  getStats: () => ({
4279
- logger: S.getStats(),
4280
- state: G.getStats(),
4281
- weixinConfig: ve().getStats(),
4282
- plugins: te.getStats(),
4283
- interceptors: K.getStats(),
4284
- store: x.getStats()
4432
+ logger: T.getStats(),
4433
+ state: j.getStats(),
4434
+ weixinConfig: _e().getStats(),
4435
+ plugins: ne.getStats(),
4436
+ interceptors: V.getStats(),
4437
+ store: W.getStats()
4285
4438
  }),
4286
4439
  /**
4287
4440
  * 获取微信配置管理器
@@ -4289,36 +4442,36 @@ const Q = {
4289
4442
  * @example
4290
4443
  * console.log(qsh.debug.getWeixinConfigManager().getStats())
4291
4444
  */
4292
- getWeixinConfigManager: ve,
4445
+ getWeixinConfigManager: _e,
4293
4446
  /**
4294
4447
  * 导出调试信息
4295
4448
  * @returns {string} JSON 格式的调试信息
4296
4449
  * @example
4297
4450
  * console.log(qsh.debug.exportDebugInfo())
4298
4451
  */
4299
- exportDebugInfo: () => S.exportToJSON()
4452
+ exportDebugInfo: () => T.exportToJSON()
4300
4453
  }
4301
4454
  };
4302
- pt.isWeixinMiniProgram ? Q.webView = window.wx && window.wx.miniProgram : Q.webView = {
4303
- navigateTo: ht,
4304
- navigateBack: mt,
4305
- switchTab: wt,
4306
- reLaunch: Et,
4307
- redirectTo: yt,
4308
- postMessage: It,
4309
- getEnv: At,
4310
- chooseImage: Se,
4311
- scanCode: Pe,
4312
- getLocation: Te,
4313
- openLocation: Le,
4314
- chooseLocation: Me
4455
+ yt.isWeixinMiniProgram ? te.webView = window.wx && window.wx.miniProgram : te.webView = {
4456
+ navigateTo: It,
4457
+ navigateBack: At,
4458
+ switchTab: Ot,
4459
+ reLaunch: Ct,
4460
+ redirectTo: _t,
4461
+ postMessage: Rt,
4462
+ getEnv: Pt,
4463
+ chooseImage: Le,
4464
+ scanCode: Me,
4465
+ getLocation: be,
4466
+ openLocation: xe,
4467
+ chooseLocation: ve
4315
4468
  };
4316
- const $e = typeof window.uni != "undefined" ? window.uni : {};
4317
- Object.keys($e).forEach((t) => {
4318
- Q.hasOwnProperty(t) || (Q[t] = $e[t]);
4469
+ const ke = typeof window.uni != "undefined" ? window.uni : {};
4470
+ Object.keys(ke).forEach((t) => {
4471
+ te.hasOwnProperty(t) || (te[t] = ke[t]);
4319
4472
  });
4320
- typeof window != "undefined" && (window.qsh = Q);
4473
+ typeof window != "undefined" && (window.qsh = te);
4321
4474
  export {
4322
- Q as default
4475
+ te as default
4323
4476
  };
4324
4477
  //# sourceMappingURL=qsh-webview-sdk.es.js.map