@kc-one/smart-fill-sdk 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var Yt = Object.defineProperty;
2
2
  var Wt = (e, t, n) => t in e ? Yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var d = (e, t, n) => Wt(e, typeof t != "symbol" ? t + "" : t, n);
4
- const To = {
4
+ const Ao = {
5
5
  name: "native",
6
6
  /** 匹配 input / textarea / select 原生控件 */
7
7
  match: (e) => e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement,
@@ -14,7 +14,7 @@ const To = {
14
14
  const n = e.element;
15
15
  n instanceof HTMLInputElement && n.type === "checkbox" ? n.checked = !!t : (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) && (n.value = String(t ?? "")), n == null || n.dispatchEvent(new Event("input", { bubbles: !0 })), n == null || n.dispatchEvent(new Event("change", { bubbles: !0 }));
16
16
  }
17
- }, lt = [
17
+ }, ct = [
18
18
  // Element Plus / Element UI
19
19
  { framework: "element", selectors: ".el-select,.el-select-v2", type: "select", kind: "input" },
20
20
  { framework: "element", selectors: ".el-cascader", type: "cascader", kind: "input" },
@@ -68,7 +68,7 @@ const To = {
68
68
  "van-switch--disabled",
69
69
  "van-stepper--disabled",
70
70
  "van-dropdown-menu--disabled"
71
- ], ut = lt.map((e) => e.selectors).join(", "), Zt = [
71
+ ], lt = ct.map((e) => e.selectors).join(", "), Zt = [
72
72
  ".form-item",
73
73
  ".ant-form-item",
74
74
  ".el-form-item",
@@ -86,7 +86,7 @@ const To = {
86
86
  ".arco-form-item-label",
87
87
  ".van-field__label",
88
88
  ".label"
89
- ].join(", "), Be = [
89
+ ].join(", "), ze = [
90
90
  "dialog[open]",
91
91
  "[role='dialog']",
92
92
  "[aria-modal='true']",
@@ -115,17 +115,17 @@ const To = {
115
115
  "van-checkbox--checked"
116
116
  ];
117
117
  function F(e) {
118
- return lt.find((t) => e.matches(t.selectors)) || null;
118
+ return ct.find((t) => e.matches(t.selectors)) || null;
119
119
  }
120
- function dt(e) {
120
+ function ut(e) {
121
121
  return !!F(e);
122
122
  }
123
- function Le(e) {
123
+ function Te(e) {
124
124
  for (let t = e; t; t = t.parentElement)
125
- if (dt(t)) return t;
125
+ if (ut(t)) return t;
126
126
  return null;
127
127
  }
128
- function le(e) {
128
+ function ce(e) {
129
129
  var n;
130
130
  const t = F(e);
131
131
  if (!t) return null;
@@ -146,7 +146,7 @@ function le(e) {
146
146
  }
147
147
  return t.type;
148
148
  }
149
- function pt(e) {
149
+ function dt(e) {
150
150
  const t = F(e);
151
151
  if (t != null && t.optionSelector)
152
152
  return Array.from(e.querySelectorAll(t.optionSelector)).map((n) => en(n)).filter((n) => !!(n.label || n.value));
@@ -155,20 +155,20 @@ function en(e) {
155
155
  const t = e instanceof HTMLInputElement ? e : e.querySelector('input[type="radio"],input[type="checkbox"]'), n = p(e.textContent || e.getAttribute("aria-label") || e.getAttribute("title") || ""), r = e.getAttribute("value") || (t == null ? void 0 : t.value) || n;
156
156
  return { label: n, value: r };
157
157
  }
158
- function j(e) {
158
+ function U(e) {
159
159
  return Qt.some((t) => e.classList.contains(t)) || e.getAttribute("aria-checked") === "true" || !!e.querySelector("input:checked");
160
160
  }
161
161
  function O(e) {
162
162
  return e.querySelector('input:not([type="hidden"]), textarea');
163
163
  }
164
- function ft(e) {
164
+ function pt(e) {
165
165
  var t, n, r;
166
166
  return e.getAttribute("name") || ((t = O(e)) == null ? void 0 : t.getAttribute("name")) || e.getAttribute("data-smart-fill-key") || ((n = O(e)) == null ? void 0 : n.getAttribute("data-smart-fill-key")) || ((r = e.querySelector("[data-smart-fill-key]")) == null ? void 0 : r.getAttribute("data-smart-fill-key"));
167
167
  }
168
168
  function p(e) {
169
169
  return e.replace(/[*::]/g, "").replace(/\s+/g, " ").trim();
170
170
  }
171
- const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-style", ht = [
171
+ const Le = "data-smart-fill-hide-dropdown-mode", Be = "smart-fill-hide-dropdown-style", ft = [
172
172
  "[role='combobox']",
173
173
  "[aria-haspopup='listbox']",
174
174
  ".el-cascader",
@@ -207,7 +207,7 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
207
207
  ".select-value",
208
208
  ".selection-item",
209
209
  ".van-field__control"
210
- ].join(", "), Me = [
210
+ ].join(", "), Ie = [
211
211
  "[role='option']",
212
212
  ".ant-select-item-option",
213
213
  ".el-select-dropdown__item",
@@ -219,8 +219,8 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
219
219
  ".t-select-option",
220
220
  ".van-picker-column__item",
221
221
  ".van-action-sheet__item"
222
- ].join(", "), ue = [
223
- Me,
222
+ ].join(", "), le = [
223
+ Ie,
224
224
  ".van-action-sheet__name",
225
225
  ".van-cascader__option",
226
226
  ".van-dropdown-item__option",
@@ -229,7 +229,7 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
229
229
  ".ant-cascader-menu-item",
230
230
  ".n-cascader-node",
231
231
  ".arco-cascader-option"
232
- ].join(", "), Re = [
232
+ ].join(", "), Me = [
233
233
  ".el-select-dropdown",
234
234
  ".el-cascader__dropdown",
235
235
  ".el-cascader-panel",
@@ -253,7 +253,7 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
253
253
  ".van-dropdown-item",
254
254
  ".van-picker",
255
255
  "[role='listbox']"
256
- ].join(", "), gt = [
256
+ ].join(", "), ht = [
257
257
  ".el-select-dropdown",
258
258
  ".el-select__popper",
259
259
  ".el-select-v2__popper",
@@ -270,7 +270,7 @@ const Ie = "data-smart-fill-hide-dropdown-mode", Ue = "smart-fill-hide-dropdown-
270
270
  ".van-dropdown-item",
271
271
  ".van-picker",
272
272
  "[role='listbox']"
273
- ].join(", "), yt = [
273
+ ].join(", "), gt = [
274
274
  ".el-cascader__dropdown",
275
275
  ".el-cascader-panel",
276
276
  ".el-popper.el-cascader__dropdown",
@@ -300,10 +300,10 @@ function E(e) {
300
300
  }
301
301
  return !1;
302
302
  }
303
- function G(e) {
304
- return !_t(e) || mt(e) || e instanceof HTMLSelectElement || e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? !1 : e.matches(ht) || e.getAttribute("role") === "combobox" || e.getAttribute("aria-haspopup") === "listbox" || e.classList.contains("el-select__wrapper") || e.classList.contains("el-select-v2__wrapper") || E(e);
303
+ function j(e) {
304
+ return !_t(e) || mt(e) || e instanceof HTMLSelectElement || e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? !1 : e.matches(ft) || e.getAttribute("role") === "combobox" || e.getAttribute("aria-haspopup") === "listbox" || e.classList.contains("el-select__wrapper") || e.classList.contains("el-select-v2__wrapper") || E(e);
305
305
  }
306
- function Y(e) {
306
+ function G(e) {
307
307
  const t = e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader");
308
308
  if (t instanceof HTMLElement) return t;
309
309
  const n = e.closest([
@@ -333,29 +333,26 @@ function Y(e) {
333
333
  ".el-select__wrapper",
334
334
  ".el-select-v2__wrapper"
335
335
  ].join(", "));
336
- return n instanceof HTMLElement ? n.matches(".van-field") && !E(n) ? null : n : G(e) ? e : null;
336
+ return n instanceof HTMLElement ? n.matches(".van-field") && !E(n) ? null : n : j(e) ? e : null;
337
337
  }
338
- function Oe(e) {
338
+ function Re(e) {
339
339
  if (e instanceof HTMLSelectElement) return e;
340
340
  if (C(e))
341
341
  return e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader") || e;
342
- const t = Y(e);
342
+ const t = G(e);
343
343
  return t || (e.matches(".van-field") && E(e) ? e : null);
344
344
  }
345
- function $e(e) {
345
+ function yt(e) {
346
346
  if (C(e)) return "cascader";
347
- if (G(e) || E(e)) return "select";
348
- const t = le(e);
347
+ if (j(e) || E(e)) return "select";
348
+ const t = ce(e);
349
349
  return t || (e instanceof HTMLSelectElement ? "select" : null);
350
350
  }
351
- function B(e, t) {
352
- const n = t || $e(e);
351
+ function Oe(e, t) {
352
+ const n = t || yt(e);
353
353
  return n != null && on.has(n);
354
354
  }
355
355
  function sn(e) {
356
- return B(e, $e(e) || void 0);
357
- }
358
- function an(e) {
359
356
  const t = e.matches(".van-field") ? e : e.closest(".van-field");
360
357
  if (t instanceof HTMLElement && E(t)) {
361
358
  const i = t.querySelector(".van-field__control");
@@ -373,45 +370,45 @@ function an(e) {
373
370
  return o != null && o.value ? p(o.value) : r;
374
371
  }
375
372
  function bt(e) {
376
- const t = hn(e);
373
+ const t = fn(e);
377
374
  if (!t.length) return;
378
- const n = gn(t);
375
+ const n = hn(t);
379
376
  return n.length ? n : void 0;
380
377
  }
381
- function re(e) {
378
+ function ne(e) {
382
379
  var t;
383
- return !((t = e.options) != null && t.length) || e.type === "cascader" || rn.test(e.label || "") ? !1 : Sn(e.options);
380
+ return !((t = e.options) != null && t.length) || e.type === "cascader" || rn.test(e.label || "") ? !1 : vn(e.options);
384
381
  }
385
- async function cn(e) {
382
+ async function an(e) {
386
383
  if (e instanceof HTMLSelectElement)
387
384
  return Array.from(e.options).map((s) => ({ value: s.value, label: p(s.textContent || s.label) })).filter((s) => s.label || s.value);
388
385
  const t = bt(e);
389
386
  if (t != null && t.length) return t;
390
- const n = Y(e) || e;
391
- if (!G(n) && !C(n) && !E(n))
387
+ const n = G(e) || e;
388
+ if (!j(n) && !C(n) && !E(n))
392
389
  return;
393
- const r = _n(), o = En(), i = new Set(o.getTrackedDropdowns());
390
+ const r = kn(), o = Sn(), i = new Set(o.getTrackedDropdowns());
394
391
  try {
395
- if (!(C(n) ? await un(n, o, i) : await ln(n, o, i))) return;
396
- const a = await pn(o, i, n);
392
+ if (!(C(n) ? await ln(n, o, i) : await cn(n, o, i))) return;
393
+ const a = await dn(o, i, n);
397
394
  if (!a.length) return;
398
- const c = dn(a);
395
+ const c = un(a);
399
396
  return c.length ? c : void 0;
400
397
  } finally {
401
- await kn(n, o), await M(60), o.restore(), r();
398
+ await xn(n, o), await M(60), o.restore(), r();
402
399
  }
403
400
  }
404
401
  function mt(e) {
405
402
  return e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true";
406
403
  }
407
- async function ln(e, t, n) {
408
- const r = W(e);
404
+ async function cn(e, t, n) {
405
+ const r = Y(e);
409
406
  if (!r.length) return !1;
410
407
  for (const o of r)
411
- if (xt(o), Et(o), await M(160), je(e, t, n) || (kt(o), await M(180), je(e, t, n))) return !0;
408
+ if (xt(o), Et(o), await M(160), Ue(e, t, n) || (kt(o), await M(180), Ue(e, t, n))) return !0;
412
409
  return !1;
413
410
  }
414
- async function un(e, t, n) {
411
+ async function ln(e, t, n) {
415
412
  const r = [
416
413
  e,
417
414
  e.querySelector(".el-input__wrapper"),
@@ -420,14 +417,14 @@ async function un(e, t, n) {
420
417
  e.querySelector("input")
421
418
  ].filter((o) => o instanceof HTMLElement);
422
419
  for (const o of r)
423
- if (xt(o), Et(o), await M(180), de(t, n, e).length || (kt(o), await M(180), de(t, n, e).length)) return !0;
420
+ if (xt(o), Et(o), await M(180), ue(t, n, e).length || (kt(o), await M(180), ue(t, n, e).length)) return !0;
424
421
  return !1;
425
422
  }
426
- function dn(e) {
423
+ function un(e) {
427
424
  var r;
428
425
  const t = /* @__PURE__ */ new Set(), n = [];
429
426
  for (const o of e) {
430
- const i = o.matches(ue) ? [o] : Array.from(o.querySelectorAll(ue));
427
+ const i = o.matches(le) ? [o] : Array.from(o.querySelectorAll(le));
431
428
  for (const s of i) {
432
429
  if (s.classList.contains("is-disabled") || s.classList.contains("ant-select-item-option-disabled") || s.getAttribute("aria-disabled") === "true")
433
430
  continue;
@@ -441,19 +438,19 @@ function dn(e) {
441
438
  }
442
439
  return n;
443
440
  }
444
- async function pn(e, t, n) {
441
+ async function dn(e, t, n) {
445
442
  for (let r = 0; r < 8; r += 1) {
446
- const o = de(e, t, n);
443
+ const o = ue(e, t, n);
447
444
  if (o.length) return o;
448
445
  await M(r === 0 ? 120 : 80);
449
446
  }
450
447
  return [];
451
448
  }
452
- function je(e, t, n) {
453
- return de(t, n, e).length > 0 ? !0 : W(e).some((r) => r.getAttribute("aria-expanded") === "true" || r.classList.contains("is-focus") || r.classList.contains("is-focused"));
449
+ function Ue(e, t, n) {
450
+ return ue(t, n, e).length > 0 ? !0 : Y(e).some((r) => r.getAttribute("aria-expanded") === "true" || r.classList.contains("is-focus") || r.classList.contains("is-focused"));
454
451
  }
455
- function fn(e, t, n) {
456
- const r = t.filter((c) => Fe(e, c)), o = r.filter((c) => yn(e, c)), i = o.filter((c) => !n.has(c));
452
+ function pn(e, t, n) {
453
+ const r = t.filter((c) => Fe(e, c)), o = r.filter((c) => gn(e, c)), i = o.filter((c) => !n.has(c));
457
454
  if (i.length)
458
455
  return i.sort((c, l) => R(l, e) - R(c, e));
459
456
  const s = wt(e);
@@ -463,19 +460,19 @@ function fn(e, t, n) {
463
460
  }
464
461
  if (o.length)
465
462
  return o.sort((c, l) => R(l, e) - R(c, e)).slice(0, 1);
466
- const a = r.filter((c) => vn(c) && vt(e)).sort((c, l) => R(l, e) - R(c, e)).slice(0, 1);
463
+ const a = r.filter((c) => wn(c) && vt(e)).sort((c, l) => R(l, e) - R(c, e)).slice(0, 1);
467
464
  return a.length ? a : [];
468
465
  }
469
- function de(e, t, n) {
470
- return fn(n, e.getTrackedDropdowns(), t);
466
+ function ue(e, t, n) {
467
+ return pn(n, e.getTrackedDropdowns(), t);
471
468
  }
472
469
  function R(e, t) {
473
470
  const n = e.getBoundingClientRect(), r = Number.parseInt(window.getComputedStyle(e).zIndex || "0", 10);
474
471
  let o = (Number.isNaN(r) ? 0 : r) * 10 + n.width * n.height;
475
472
  return t && (o += St(t, e)), o;
476
473
  }
477
- function hn(e) {
478
- const t = C(e) ? yt : gt, n = /* @__PURE__ */ new Set();
474
+ function fn(e) {
475
+ const t = C(e) ? gt : ht, n = /* @__PURE__ */ new Set();
479
476
  e.matches(t) && n.add(e);
480
477
  for (const r of e.querySelectorAll(t))
481
478
  Fe(e, r) && n.add(r);
@@ -483,10 +480,10 @@ function hn(e) {
483
480
  e.contains(r) && Fe(e, r) && n.add(r);
484
481
  return [...n];
485
482
  }
486
- function gn(e) {
483
+ function hn(e) {
487
484
  const t = /* @__PURE__ */ new Set(), n = [];
488
485
  for (const r of e) {
489
- const o = r.matches(Me) ? [r] : Array.from(r.querySelectorAll(Me));
486
+ const o = r.matches(Ie) ? [r] : Array.from(r.querySelectorAll(Ie));
490
487
  for (const i of o) {
491
488
  if (i.classList.contains("is-disabled") || i.classList.contains("ant-select-item-option-disabled") || i.getAttribute("aria-disabled") === "true")
492
489
  continue;
@@ -500,31 +497,31 @@ function gn(e) {
500
497
  }
501
498
  function wt(e) {
502
499
  return new Set(
503
- W(e).flatMap((t) => [t.getAttribute("aria-controls"), t.getAttribute("aria-owns")]).filter((t) => !!t)
500
+ Y(e).flatMap((t) => [t.getAttribute("aria-controls"), t.getAttribute("aria-owns")]).filter((t) => !!t)
504
501
  );
505
502
  }
506
- function yn(e, t) {
503
+ function gn(e, t) {
507
504
  const n = wt(e);
508
- return n.size && t.id && n.has(t.id) || e.contains(t) ? !0 : wn(t) ? vt(e) : n.size > 0 || W(e).some((o) => o.getAttribute("aria-controls") || o.getAttribute("aria-owns")) ? !1 : St(e, t) > 0;
505
+ return n.size && t.id && n.has(t.id) || e.contains(t) ? !0 : mn(t) ? vt(e) : n.size > 0 || Y(e).some((o) => o.getAttribute("aria-controls") || o.getAttribute("aria-owns")) ? !1 : St(e, t) > 0;
509
506
  }
510
507
  function Fe(e, t) {
511
- const n = C(e), r = bn(t);
512
- return n ? r : r ? !1 : mn(t);
508
+ const n = C(e), r = yn(t);
509
+ return n ? r : r ? !1 : bn(t);
510
+ }
511
+ function yn(e) {
512
+ return e.matches(gt) || !!e.querySelector(".el-cascader-node, .ant-cascader-menu-item, .van-cascader__option, .n-cascader-node, .arco-cascader-option");
513
513
  }
514
514
  function bn(e) {
515
- return e.matches(yt) || !!e.querySelector(".el-cascader-node, .ant-cascader-menu-item, .van-cascader__option, .n-cascader-node, .arco-cascader-option");
515
+ return e.matches(ht) || !!e.querySelector('.el-select-dropdown__item, .ant-select-item-option, .van-picker-column__item, .van-action-sheet__item, .van-dropdown-item__option, [role="option"]');
516
516
  }
517
517
  function mn(e) {
518
- return e.matches(gt) || !!e.querySelector('.el-select-dropdown__item, .ant-select-item-option, .van-picker-column__item, .van-action-sheet__item, .van-dropdown-item__option, [role="option"]');
519
- }
520
- function wn(e) {
521
518
  return e.matches(".van-popup, .van-action-sheet, .van-picker, .van-dropdown-item__content, .van-dropdown-item");
522
519
  }
523
520
  function vt(e) {
524
- return W(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused") || e.contains(document.activeElement));
521
+ return Y(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused") || e.contains(document.activeElement));
525
522
  }
526
- function vn(e) {
527
- return e.matches(ue) || !!e.querySelector(ue);
523
+ function wn(e) {
524
+ return e.matches(le) || !!e.querySelector(le);
528
525
  }
529
526
  function St(e, t) {
530
527
  const n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
@@ -535,11 +532,11 @@ function St(e, t) {
535
532
  const i = r.top >= n.bottom ? r.top - n.bottom : n.top - r.bottom;
536
533
  return i > 320 ? 0 : Math.max(0, 400 - i) + o;
537
534
  }
538
- function Sn(e) {
535
+ function vn(e) {
539
536
  const t = e.slice(0, 8).map((r) => p(String(r.label || r.value || ""))).filter(Boolean);
540
537
  return t.length < 4 ? !1 : t.filter((r) => nn.test(r)).length / t.length >= 0.75;
541
538
  }
542
- function W(e) {
539
+ function Y(e) {
543
540
  return [
544
541
  e,
545
542
  e.querySelector(".van-field__control"),
@@ -564,11 +561,11 @@ function W(e) {
564
561
  e.querySelector(".select__wrapper")
565
562
  ].filter((n) => n instanceof HTMLElement).filter((n, r, o) => o.indexOf(n) === r);
566
563
  }
567
- function En() {
564
+ function Sn() {
568
565
  const e = /* @__PURE__ */ new Map();
569
- xn(), document.documentElement.setAttribute(Ie, "true");
566
+ En(), document.documentElement.setAttribute(Le, "true");
570
567
  const t = () => {
571
- for (const r of document.querySelectorAll(Re))
568
+ for (const r of document.querySelectorAll(Me))
572
569
  e.has(r) || e.set(r, {
573
570
  display: r.style.display,
574
571
  opacity: r.style.opacity,
@@ -584,19 +581,19 @@ function En() {
584
581
  attributes: !0,
585
582
  attributeFilter: ["class", "style", "aria-hidden"]
586
583
  }), {
587
- getTrackedDropdowns: () => Array.from(document.querySelectorAll(Re)),
584
+ getTrackedDropdowns: () => Array.from(document.querySelectorAll(Me)),
588
585
  restore: () => {
589
- n.disconnect(), document.documentElement.removeAttribute(Ie);
586
+ n.disconnect(), document.documentElement.removeAttribute(Le);
590
587
  for (const [r, o] of e)
591
588
  r.style.display = o.display, r.style.opacity = o.opacity, r.style.visibility = o.visibility, r.style.pointerEvents = o.pointerEvents;
592
589
  }
593
590
  };
594
591
  }
595
- function xn() {
596
- if (document.getElementById(Ue)) return;
592
+ function En() {
593
+ if (document.getElementById(Be)) return;
597
594
  const e = document.createElement("style");
598
- e.id = Ue, e.textContent = `
599
- ${Re.split(",").map((t) => `html[${Ie}="true"] ${t.trim()}`).join(`,
595
+ e.id = Be, e.textContent = `
596
+ ${Me.split(",").map((t) => `html[${Le}="true"] ${t.trim()}`).join(`,
600
597
  `)} {
601
598
  opacity: 0 !important;
602
599
  visibility: hidden !important;
@@ -606,7 +603,7 @@ function xn() {
606
603
  }
607
604
  `, document.head.appendChild(e);
608
605
  }
609
- async function kn(e, t) {
606
+ async function xn(e, t) {
610
607
  e.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.activeElement instanceof HTMLElement && document.activeElement.blur(), document.body.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window })), await M(120);
611
608
  for (const n of t.getTrackedDropdowns())
612
609
  n.isConnected && (n.style.display = "none", n.setAttribute("aria-hidden", "true"));
@@ -626,7 +623,7 @@ function kt(e) {
626
623
  function M(e) {
627
624
  return new Promise((t) => window.setTimeout(t, e));
628
625
  }
629
- function _n() {
626
+ function kn() {
630
627
  const e = /* @__PURE__ */ new Map();
631
628
  e.set(window, { left: window.scrollX, top: window.scrollY });
632
629
  for (const t of document.querySelectorAll("*"))
@@ -643,22 +640,22 @@ function _t(e) {
643
640
  const n = e.getBoundingClientRect();
644
641
  return n.width > 0 && n.height > 0;
645
642
  }
646
- function me(e, t) {
647
- const n = we(t);
643
+ function be(e, t) {
644
+ const n = me(t);
648
645
  if (!n.length) return null;
649
646
  let r = null, o = 0;
650
647
  for (const i of e) {
651
648
  const s = w(i.value), a = w(i.label);
652
649
  for (const c of n) {
653
650
  let l = 0;
654
- c === s || c === a ? l = 120 : s && c.includes(s) || a && c.includes(a) ? l = 100 : s && s.includes(c) || a && a.includes(c) ? l = 90 : (s && oe(s) === oe(c) || a && oe(a) === oe(c)) && (l = 80), l > o && (o = l, r = i);
651
+ c === s || c === a ? l = 120 : s && c.includes(s) || a && c.includes(a) ? l = 100 : s && s.includes(c) || a && a.includes(c) ? l = 90 : (s && re(s) === re(c) || a && re(a) === re(c)) && (l = 80), l > o && (o = l, r = i);
655
652
  }
656
653
  }
657
654
  return o >= 80 ? r : null;
658
655
  }
659
- function we(e) {
656
+ function me(e) {
660
657
  if (Array.isArray(e))
661
- return e.flatMap((n) => we(n));
658
+ return e.flatMap((n) => me(n));
662
659
  if (typeof e == "object" && e) {
663
660
  const n = e;
664
661
  return [n.label, n.value, n.text, n.answer, n.name].filter((r) => r != null).map((r) => w(r)).filter(Boolean);
@@ -669,10 +666,10 @@ function we(e) {
669
666
  function w(e) {
670
667
  return String(e ?? "").replace(/\s+/g, "").replace(/[::,,。.、()()\-_/]/g, "").trim().toLowerCase();
671
668
  }
672
- function oe(e) {
669
+ function re(e) {
673
670
  return w(e).replace(/(请选择|选择|状态|情况|类型|方式|所属|是否)$/g, "");
674
671
  }
675
- const pe = [
672
+ const de = [
676
673
  ".ant-select-item-option",
677
674
  ".el-select-dropdown__item",
678
675
  ".el-select-v2__option",
@@ -689,24 +686,24 @@ const pe = [
689
686
  ".van-dropdown-item__option",
690
687
  ".van-radio",
691
688
  "[role='option']"
692
- ].join(", "), Cn = [
689
+ ].join(", "), _n = [
693
690
  ".el-cascader-panel .el-cascader-menu",
694
691
  ".ant-cascader-menu",
695
692
  ".van-cascader__options",
696
693
  ".n-cascader-menu",
697
694
  ".arco-cascader-list"
698
- ].join(", "), An = [
695
+ ].join(", "), Cn = [
699
696
  ".el-cascader-node",
700
697
  ".ant-cascader-menu-item",
701
698
  ".van-cascader__option",
702
699
  ".n-cascader-node",
703
700
  ".arco-cascader-option"
704
- ].join(", "), Tn = ".van-picker__confirm, .van-picker__toolbar .van-picker__confirm";
705
- async function Ln(e, t, n, r) {
701
+ ].join(", "), An = ".van-picker__confirm, .van-picker__toolbar .van-picker__confirm";
702
+ async function Tn(e, t, n, r) {
706
703
  const o = Ct(t, r);
707
- return e instanceof HTMLSelectElement ? In(e, o) : C(e) || n === "cascader" ? Mn(e, o) : (G(e) || E(e) || n === "select" || n === "date", Ge(e, o));
704
+ return e instanceof HTMLSelectElement ? Ln(e, o) : C(e) || n === "cascader" ? In(e, o) : (j(e) || E(e) || n === "select" || n === "date", je(e, o));
708
705
  }
709
- function Ne(e) {
706
+ function $e(e) {
710
707
  if (e instanceof HTMLSelectElement) {
711
708
  const n = e.options[e.selectedIndex];
712
709
  return p((n == null ? void 0 : n.textContent) || e.value);
@@ -717,67 +714,67 @@ function Ne(e) {
717
714
  const r = e.querySelector(".el-cascader__tags-text, .el-cascader__label");
718
715
  return p((r == null ? void 0 : r.textContent) || "");
719
716
  }
720
- if (G(e) || E(e))
721
- return an(e);
717
+ if (j(e) || E(e))
718
+ return sn(e);
722
719
  const t = e.querySelector("input, textarea");
723
720
  return p((t == null ? void 0 : t.value) || e.textContent || "");
724
721
  }
725
- async function In(e, t) {
722
+ async function Ln(e, t) {
726
723
  const n = Array.from(e.options).map((o) => ({
727
724
  source: o,
728
725
  value: o.value,
729
726
  label: o.textContent
730
- })), r = me(n, t.searchValue);
727
+ })), r = be(n, t.searchValue);
731
728
  if ((r == null ? void 0 : r.source) instanceof HTMLOptionElement) {
732
- ge(e, r.source.value), _(e);
729
+ he(e, r.source.value), _(e);
733
730
  return;
734
731
  }
735
732
  if (!V(e, t))
736
733
  throw new Error("原生下拉框中没有匹配到对应选项");
737
734
  }
738
- async function Ge(e, t) {
739
- const n = Y(e) || e;
740
- if (Ee(n, t.searchValue)) return;
741
- const r = new Set(X());
735
+ async function je(e, t) {
736
+ const n = G(e) || e;
737
+ if (Se(n, t.searchValue)) return;
738
+ const r = new Set(W());
742
739
  try {
743
- if (!await Rn(n)) {
740
+ if (!await Mn(n)) {
744
741
  if (V(n, t)) return;
745
742
  throw new Error("自定义下拉框未能成功展开");
746
743
  }
747
- const i = await Kn(n, r), s = await Fn(t.searchValue, i, !0);
744
+ const i = await Vn(n, r), s = await On(t.searchValue, i, !0);
748
745
  if (!(s != null && s.source)) {
749
- if (await he(n), V(n, t)) return;
746
+ if (await fe(n), V(n, t)) return;
750
747
  throw new Error("自定义下拉框展开后未找到匹配选项");
751
748
  }
752
- if (Z(s.source), await y(120), Bn(), _(n), await y(120), Ee(n, t.searchValue) || V(n, t) && Ee(n, t.searchValue))
749
+ if (X(s.source), await y(120), zn(), _(n), await y(120), Se(n, t.searchValue) || V(n, t) && Se(n, t.searchValue))
753
750
  return;
754
751
  throw new Error("自定义下拉框点击选项后未成功回填");
755
752
  } finally {
756
- await he(n), await y(80);
753
+ await fe(n), await y(80);
757
754
  }
758
755
  }
759
- async function Mn(e, t) {
756
+ async function In(e, t) {
760
757
  const n = e.closest(".el-cascader, .ant-cascader, .van-cascader, .n-cascader, .arco-cascader") || e;
761
- if (!Se(n, t.searchValue)) {
758
+ if (!ve(n, t.searchValue)) {
762
759
  try {
763
- if (await On(n)) {
764
- const o = await Pn(t.searchValue);
765
- if (await y(180), await he(n), await y(120), o && Se(n, t.searchValue)) {
760
+ if (await Rn(n)) {
761
+ const o = await Dn(t.searchValue);
762
+ if (await y(180), await fe(n), await y(120), o && ve(n, t.searchValue)) {
766
763
  _(n);
767
764
  return;
768
765
  }
769
766
  }
770
- if (Hn(n, t.fillValue) && Se(n, t.searchValue))
767
+ if (Pn(n, t.fillValue) && ve(n, t.searchValue))
771
768
  return;
772
769
  } finally {
773
- await he(n), await y(80);
770
+ await fe(n), await y(80);
774
771
  }
775
772
  throw new Error("级联选择框匹配失败");
776
773
  }
777
774
  }
778
775
  function Ct(e, t) {
779
776
  var s;
780
- const n = (s = t == null ? void 0 : t.options) != null && s.length ? me(
777
+ const n = (s = t == null ? void 0 : t.options) != null && s.length ? be(
781
778
  t.options.map((a) => ({
782
779
  value: String(a.value),
783
780
  label: a.label
@@ -790,13 +787,13 @@ function Ct(e, t) {
790
787
  displayValue: o
791
788
  };
792
789
  }
793
- async function Rn(e) {
794
- const t = Ve(e);
790
+ async function Mn(e) {
791
+ const t = Ne(e);
795
792
  for (const n of t)
796
- if (Tt(n), Z(n), await y(160), Ye(e) || (Lt(n), await y(180), Ye(e))) return !0;
793
+ if (Tt(n), X(n), await y(160), Ge(e) || (Lt(n), await y(180), Ge(e))) return !0;
797
794
  return !1;
798
795
  }
799
- async function On(e) {
796
+ async function Rn(e) {
800
797
  const t = [
801
798
  e,
802
799
  e.querySelector(".el-input__wrapper"),
@@ -805,16 +802,16 @@ async function On(e) {
805
802
  e.querySelector("input")
806
803
  ].filter((n) => n instanceof HTMLElement);
807
804
  for (const n of t)
808
- if (Tt(n), Z(n), await y(180), fe().length || (Lt(n), await y(180), fe().length)) return !0;
805
+ if (Tt(n), X(n), await y(180), pe().length || (Lt(n), await y(180), pe().length)) return !0;
809
806
  return !1;
810
807
  }
811
- async function Fn(e, t, n = !1) {
808
+ async function On(e, t, n = !1) {
812
809
  for (let r = 0; r < 12; r += 1) {
813
- const o = me(
810
+ const o = be(
814
811
  At(t, n).map((i) => ({
815
812
  source: i,
816
- value: qn(i),
817
- label: Dn(i)
813
+ value: Fn(i),
814
+ label: qn(i)
818
815
  })),
819
816
  e
820
817
  );
@@ -823,22 +820,22 @@ async function Fn(e, t, n = !1) {
823
820
  }
824
821
  return null;
825
822
  }
826
- function qn(e) {
823
+ function Fn(e) {
827
824
  return e.getAttribute("data-value") || e.getAttribute("data-name") || e.getAttribute("value") || e.getAttribute("name") || e.textContent || "";
828
825
  }
829
- function Dn(e) {
826
+ function qn(e) {
830
827
  var t;
831
828
  return p(
832
829
  ((t = e.querySelector(".van-action-sheet__name, .el-cascader-node__label, .ant-cascader-menu-item-content, .n-cascader-node__label, .arco-cascader-option-label")) == null ? void 0 : t.textContent) || e.textContent || ""
833
830
  );
834
831
  }
835
- async function Pn(e) {
836
- const t = jn(e);
832
+ async function Dn(e) {
833
+ const t = Un(e);
837
834
  if (!t.length) return !1;
838
835
  for (let n = 0; n < t.length; n += 1) {
839
- const r = fe();
836
+ const r = pe();
840
837
  if (!r.length) return n > 0;
841
- const o = r[r.length - 1], i = Array.from(o.querySelectorAll(An)).filter((a) => !a.classList.contains("is-disabled") && a.getAttribute("aria-disabled") !== "true"), s = me(
838
+ const o = r[r.length - 1], i = Array.from(o.querySelectorAll(Cn)).filter((a) => !a.classList.contains("is-disabled") && a.getAttribute("aria-disabled") !== "true"), s = be(
842
839
  i.map((a) => {
843
840
  var c;
844
841
  return {
@@ -850,25 +847,25 @@ async function Pn(e) {
850
847
  t[n]
851
848
  );
852
849
  if (!(s != null && s.source)) return !1;
853
- Z(s.source), await y(220);
850
+ X(s.source), await y(220);
854
851
  }
855
- return !fe().length || !0;
852
+ return !pe().length || !0;
856
853
  }
857
854
  function V(e, t) {
858
- const n = Vn(t) ? t : Ct(t), r = n.displayValue || A(t), o = n.fillValue || r;
855
+ const n = Nn(t) ? t : Ct(t), r = n.displayValue || A(t), o = n.fillValue || r;
859
856
  if (!r && !o) return !1;
860
- const i = Y(e) || e;
857
+ const i = G(e) || e;
861
858
  if (E(i))
862
- return $n(i, r, o);
859
+ return Hn(i, r, o);
863
860
  if (e instanceof HTMLSelectElement) {
864
861
  let l = Array.from(e.options).find((u) => u.dataset.smartFillFallbackOption === "true");
865
- return l || (l = document.createElement("option"), l.dataset.smartFillFallbackOption = "true", e.appendChild(l)), l.value = o, l.textContent = r || o, l.selected = !0, ge(e, o), _(e), !0;
862
+ return l || (l = document.createElement("option"), l.dataset.smartFillFallbackOption = "true", e.appendChild(l)), l.value = o, l.textContent = r || o, l.selected = !0, he(e, o), _(e), !0;
866
863
  }
867
864
  const s = e.querySelector('input:not([type="hidden"])');
868
865
  if (!(s instanceof HTMLInputElement) || s.disabled) return !1;
869
866
  const a = s.readOnly, c = s.hasAttribute("readonly");
870
867
  try {
871
- return a && (s.readOnly = !1, s.removeAttribute("readonly")), s.focus(), ge(s, r), s.dispatchEvent(new InputEvent("input", {
868
+ return a && (s.readOnly = !1, s.removeAttribute("readonly")), s.focus(), he(s, r), s.dispatchEvent(new InputEvent("input", {
872
869
  bubbles: !0,
873
870
  composed: !0,
874
871
  data: r,
@@ -880,7 +877,7 @@ function V(e, t) {
880
877
  a && (s.readOnly = !0, c && s.setAttribute("readonly", ""));
881
878
  }
882
879
  }
883
- function Hn(e, t) {
880
+ function Pn(e, t) {
884
881
  const n = e.querySelector("input"), r = A(t);
885
882
  return !(n instanceof HTMLInputElement) || !r || n.disabled ? !1 : V(e, {
886
883
  searchValue: t,
@@ -888,8 +885,8 @@ function Hn(e, t) {
888
885
  displayValue: r
889
886
  });
890
887
  }
891
- function $n(e, t, n) {
892
- Nn(e);
888
+ function Hn(e, t, n) {
889
+ $n(e);
893
890
  const r = e.querySelector(".van-field__control"), o = Array.from(e.querySelectorAll('input[type="hidden"]')), i = Array.from(e.querySelectorAll('input:not([type="hidden"])'));
894
891
  r instanceof HTMLInputElement ? K(r, t || n) : r instanceof HTMLElement && (r.textContent = t || n);
895
892
  for (const s of o)
@@ -898,7 +895,7 @@ function $n(e, t, n) {
898
895
  r !== s && K(s, t || n);
899
896
  return _(e), !0;
900
897
  }
901
- function Nn(e) {
898
+ function $n(e) {
902
899
  const t = e.querySelector(".van-field__control");
903
900
  t instanceof HTMLInputElement ? K(t, "") : t instanceof HTMLElement && (t.textContent = "");
904
901
  for (const n of e.querySelectorAll("input"))
@@ -908,7 +905,7 @@ function K(e, t) {
908
905
  if (e.disabled) return;
909
906
  const n = e.readOnly, r = e.hasAttribute("readonly");
910
907
  try {
911
- n && (e.readOnly = !1, e.removeAttribute("readonly")), ge(e, t), e.dispatchEvent(new InputEvent("input", {
908
+ n && (e.readOnly = !1, e.removeAttribute("readonly")), he(e, t), e.dispatchEvent(new InputEvent("input", {
912
909
  bubbles: !0,
913
910
  composed: !0,
914
911
  data: t,
@@ -918,10 +915,10 @@ function K(e, t) {
918
915
  n && (e.readOnly = !0, r && e.setAttribute("readonly", ""));
919
916
  }
920
917
  }
921
- function Vn(e) {
918
+ function Nn(e) {
922
919
  return typeof e == "object" && e != null && "searchValue" in e && "fillValue" in e && "displayValue" in e;
923
920
  }
924
- function Ve(e) {
921
+ function Ne(e) {
925
922
  return [
926
923
  e,
927
924
  e.querySelector(".van-field__control"),
@@ -942,43 +939,43 @@ function Ve(e) {
942
939
  ].filter((n) => n instanceof HTMLElement).filter((n, r, o) => o.indexOf(n) === r);
943
940
  }
944
941
  function At(e, t) {
945
- return (e.length ? e : X()).flatMap((o) => o.matches(pe) ? [o] : Array.from(o.querySelectorAll(pe))).filter((o, i, s) => s.indexOf(o) === i).filter((o) => t ? !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true" : D(o) && !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true");
942
+ return (e.length ? e : W()).flatMap((o) => o.matches(de) ? [o] : Array.from(o.querySelectorAll(de))).filter((o, i, s) => s.indexOf(o) === i).filter((o) => t ? !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true" : D(o) && !o.classList.contains("is-disabled") && !o.classList.contains("ant-select-item-option-disabled") && o.getAttribute("aria-disabled") !== "true");
946
943
  }
947
- function fe() {
948
- return Array.from(document.querySelectorAll(Cn)).filter(D);
944
+ function pe() {
945
+ return Array.from(document.querySelectorAll(_n)).filter(D);
949
946
  }
950
- async function Kn(e, t) {
947
+ async function Vn(e, t) {
951
948
  for (let n = 0; n < 10; n += 1) {
952
- const r = zn(e, t);
949
+ const r = Kn(e, t);
953
950
  if (r.length) return r;
954
951
  await y(80);
955
952
  }
956
- return X().filter(D);
953
+ return W().filter(D);
957
954
  }
958
- function zn(e, t) {
959
- const n = X(), r = n.filter((i) => !t.has(i));
955
+ function Kn(e, t) {
956
+ const n = W(), r = n.filter((i) => !t.has(i));
960
957
  if (r.length)
961
- return r.sort((i, s) => ie(s) - ie(i));
958
+ return r.sort((i, s) => oe(s) - oe(i));
962
959
  const o = new Set(
963
- Ve(e).flatMap((i) => [i.getAttribute("aria-controls"), i.getAttribute("aria-owns")]).filter((i) => !!i)
960
+ Ne(e).flatMap((i) => [i.getAttribute("aria-controls"), i.getAttribute("aria-owns")]).filter((i) => !!i)
964
961
  );
965
962
  if (o.size) {
966
963
  const i = n.filter((s) => o.has(s.id));
967
964
  if (i.length) return i;
968
965
  }
969
- return n.filter((i) => D(i) && (i.querySelector(pe) || i.matches(pe))).sort((i, s) => ie(s) - ie(i)).slice(0, 1);
966
+ return n.filter((i) => D(i) && (i.querySelector(de) || i.matches(de))).sort((i, s) => oe(s) - oe(i)).slice(0, 1);
970
967
  }
971
- function Ye(e) {
972
- return At(X().filter(D), !1).length > 0 ? !0 : Ve(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused"));
968
+ function Ge(e) {
969
+ return At(W().filter(D), !1).length > 0 ? !0 : Ne(e).some((t) => t.getAttribute("aria-expanded") === "true" || t.classList.contains("is-focus") || t.classList.contains("is-focused"));
973
970
  }
974
- function Se(e, t) {
975
- const n = w(Ne(e)), r = w(A(t));
971
+ function ve(e, t) {
972
+ const n = w($e(e)), r = w(A(t));
976
973
  return !n || !r ? !1 : n === r || n.includes(r) || r.includes(n);
977
974
  }
978
- function Ee(e, t) {
979
- const n = w(Ne(e));
975
+ function Se(e, t) {
976
+ const n = w($e(e));
980
977
  if (!n) return !1;
981
- const r = we(t);
978
+ const r = me(t);
982
979
  if (!r.length) {
983
980
  const o = w(A(t));
984
981
  return o ? n === o || n.includes(o) || o.includes(n) : !1;
@@ -988,21 +985,21 @@ function Ee(e, t) {
988
985
  return !!i && (n === i || n.includes(i) || i.includes(n));
989
986
  });
990
987
  }
991
- function Bn() {
992
- const e = document.querySelector(Tn);
993
- e && D(e) && Z(e);
988
+ function zn() {
989
+ const e = document.querySelector(An);
990
+ e && D(e) && X(e);
994
991
  }
995
- async function he(e) {
992
+ async function fe(e) {
996
993
  e == null || e.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", code: "Escape", bubbles: !0 })), document.activeElement instanceof HTMLElement && document.activeElement.blur(), document.body.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, cancelable: !0, view: window })), document.body.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window })), await y(120);
997
994
  }
998
- function X() {
999
- return Array.from(document.querySelectorAll(Un()));
995
+ function W() {
996
+ return Array.from(document.querySelectorAll(Bn()));
1000
997
  }
1001
- function ie(e) {
998
+ function oe(e) {
1002
999
  const t = e.getBoundingClientRect(), n = Number.parseInt(window.getComputedStyle(e).zIndex || "0", 10);
1003
1000
  return (Number.isNaN(n) ? 0 : n) * 10 + t.width * t.height;
1004
1001
  }
1005
- function Un() {
1002
+ function Bn() {
1006
1003
  return [
1007
1004
  ".el-select-dropdown",
1008
1005
  ".el-cascader__dropdown",
@@ -1043,15 +1040,15 @@ function A(e) {
1043
1040
  }
1044
1041
  return p(String(e));
1045
1042
  }
1046
- function jn(e) {
1043
+ function Un(e) {
1047
1044
  const t = A(e);
1048
1045
  if (!t) return [];
1049
1046
  if (t.includes("/") || t.includes("、"))
1050
1047
  return t.split(/[//、]/).map((r) => r.trim()).filter(Boolean);
1051
- const n = we(e);
1048
+ const n = me(e);
1052
1049
  return n.length ? [p(n[0])] : [t];
1053
1050
  }
1054
- function ge(e, t) {
1051
+ function he(e, t) {
1055
1052
  var o;
1056
1053
  const n = Object.getPrototypeOf(e), r = Object.getOwnPropertyDescriptor(n, "value");
1057
1054
  (o = r == null ? void 0 : r.set) == null || o.call(e, t);
@@ -1059,7 +1056,7 @@ function ge(e, t) {
1059
1056
  function _(e) {
1060
1057
  e.dispatchEvent(new Event("focus", { bubbles: !0 })), e.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0, data: null, inputType: "insertText" })), e.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), e.dispatchEvent(new Event("blur", { bubbles: !0 }));
1061
1058
  }
1062
- function Z(e) {
1059
+ function X(e) {
1063
1060
  window.PointerEvent && (e.dispatchEvent(new PointerEvent("pointerdown", { bubbles: !0, composed: !0, button: 0 })), e.dispatchEvent(new PointerEvent("pointerup", { bubbles: !0, composed: !0, button: 0 }))), e.dispatchEvent(new MouseEvent("mousedown", { bubbles: !0, composed: !0, button: 0 })), e.dispatchEvent(new MouseEvent("mouseup", { bubbles: !0, composed: !0, button: 0 })), e.click();
1064
1061
  }
1065
1062
  function Tt(e) {
@@ -1080,109 +1077,109 @@ function D(e) {
1080
1077
  function y(e) {
1081
1078
  return new Promise((t) => window.setTimeout(t, e));
1082
1079
  }
1083
- const We = /* @__PURE__ */ new Set(["select", "cascader", "date"]), It = {
1080
+ const Ye = /* @__PURE__ */ new Set(["select", "cascader", "date"]), It = {
1084
1081
  name: "ui-framework",
1085
- match: (e) => e.matches(ut) || dt(e) || !Gn(e) && B(e),
1082
+ match: (e) => e.matches(lt) || ut(e) || !jn(e) && Oe(e),
1086
1083
  getValue: (e) => {
1087
1084
  var o, i;
1088
1085
  const t = e.element;
1089
1086
  if (!t) return;
1090
1087
  const n = F(t);
1091
- if ((n == null ? void 0 : n.kind) === "switch") return j(t);
1092
- if ((n == null ? void 0 : n.kind) === "radioGroup") return Zn(t);
1093
- if ((n == null ? void 0 : n.kind) === "checkboxGroup") return Jn(t);
1094
- const r = e.type || le(t) || (n == null ? void 0 : n.type);
1095
- return r && We.has(r) ? Ne(t) : n ? ((i = O(t)) == null ? void 0 : i.value) || t.textContent || void 0 : (o = O(t)) == null ? void 0 : o.value;
1088
+ if ((n == null ? void 0 : n.kind) === "switch") return U(t);
1089
+ if ((n == null ? void 0 : n.kind) === "radioGroup") return Xn(t);
1090
+ if ((n == null ? void 0 : n.kind) === "checkboxGroup") return Zn(t);
1091
+ const r = e.type || ce(t) || (n == null ? void 0 : n.type);
1092
+ return r && Ye.has(r) ? $e(t) : n ? ((i = O(t)) == null ? void 0 : i.value) || t.textContent || void 0 : (o = O(t)) == null ? void 0 : o.value;
1096
1093
  },
1097
1094
  setValue: async (e, t) => {
1098
1095
  const n = e.element;
1099
1096
  if (!n) return;
1100
1097
  const r = F(n);
1101
1098
  if ((r == null ? void 0 : r.kind) === "switch") {
1102
- Yn(n, t);
1099
+ Gn(n, t);
1103
1100
  return;
1104
1101
  }
1105
1102
  if ((r == null ? void 0 : r.kind) === "radioGroup") {
1106
- Xn(n, t);
1103
+ Wn(n, t);
1107
1104
  return;
1108
1105
  }
1109
1106
  if ((r == null ? void 0 : r.kind) === "checkboxGroup") {
1110
- Wn(n, t);
1107
+ Yn(n, t);
1111
1108
  return;
1112
1109
  }
1113
- const o = e.type || le(n) || (r == null ? void 0 : r.type);
1114
- if (o && We.has(o) || B(n, o || void 0)) {
1115
- await Ln(n, t, o || "select", e);
1110
+ const o = e.type || ce(n) || (r == null ? void 0 : r.type);
1111
+ if (o && Ye.has(o) || Oe(n, o || void 0)) {
1112
+ await Tn(n, t, o || "select", e);
1116
1113
  return;
1117
1114
  }
1118
1115
  const i = O(n);
1119
1116
  if (i) {
1120
- Qn(i, t);
1117
+ Jn(i, t);
1121
1118
  return;
1122
1119
  }
1123
1120
  n.dispatchEvent(new Event("change", { bubbles: !0 }));
1124
1121
  }
1125
- }, Lo = It;
1126
- function Gn(e) {
1122
+ }, To = It;
1123
+ function jn(e) {
1127
1124
  return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
1128
1125
  }
1129
- function Yn(e, t) {
1130
- j(e) !== er(t) && ye(e);
1126
+ function Gn(e, t) {
1127
+ U(e) !== Qn(t) && ge(e);
1131
1128
  }
1132
- function Wn(e, t) {
1129
+ function Yn(e, t) {
1133
1130
  var o;
1134
- const n = new Set(tr(t).map(k)), r = pt(e) || [];
1135
- for (const i of U(e)) {
1136
- const s = J(i.textContent || ""), a = i.getAttribute("value") || ((o = i.querySelector("input")) == null ? void 0 : o.value) || s, c = j(i), l = n.has(k(String(a))) || n.has(k(s));
1137
- c !== l && ye(i);
1131
+ const n = new Set(er(t).map(k)), r = dt(e) || [];
1132
+ for (const i of B(e)) {
1133
+ const s = Z(i.textContent || ""), a = i.getAttribute("value") || ((o = i.querySelector("input")) == null ? void 0 : o.value) || s, c = U(i), l = n.has(k(String(a))) || n.has(k(s));
1134
+ c !== l && ge(i);
1138
1135
  }
1139
- if (!U(e).length && r.length)
1136
+ if (!B(e).length && r.length)
1140
1137
  for (const i of r)
1141
- (n.has(k(String(i.value))) || n.has(k(i.label))) && ye(e);
1138
+ (n.has(k(String(i.value))) || n.has(k(i.label))) && ge(e);
1142
1139
  }
1143
- function Xn(e, t) {
1144
- const n = k(String(t ?? "")), r = U(e).find((o) => {
1140
+ function Wn(e, t) {
1141
+ const n = k(String(t ?? "")), r = B(e).find((o) => {
1145
1142
  var a;
1146
- const i = J(o.textContent || ""), s = o.getAttribute("value") || ((a = o.querySelector("input")) == null ? void 0 : a.value) || i;
1143
+ const i = Z(o.textContent || ""), s = o.getAttribute("value") || ((a = o.querySelector("input")) == null ? void 0 : a.value) || i;
1147
1144
  return k(String(s)) === n || k(i) === n;
1148
1145
  });
1149
- r && ye(r);
1146
+ r && ge(r);
1150
1147
  }
1151
- function Zn(e) {
1148
+ function Xn(e) {
1152
1149
  var n;
1153
- const t = U(e).find((r) => j(r));
1150
+ const t = B(e).find((r) => U(r));
1154
1151
  if (t)
1155
- return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || J(t.textContent || "");
1152
+ return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || Z(t.textContent || "");
1156
1153
  }
1157
- function Jn(e) {
1158
- return U(e).filter((t) => j(t)).map((t) => {
1154
+ function Zn(e) {
1155
+ return B(e).filter((t) => U(t)).map((t) => {
1159
1156
  var n;
1160
- return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || J(t.textContent || "");
1157
+ return t.getAttribute("value") || ((n = t.querySelector("input")) == null ? void 0 : n.value) || Z(t.textContent || "");
1161
1158
  });
1162
1159
  }
1163
- function U(e) {
1160
+ function B(e) {
1164
1161
  const t = F(e);
1165
1162
  return t != null && t.optionSelector ? Array.from(e.querySelectorAll(t.optionSelector)) : [];
1166
1163
  }
1167
- function Qn(e, t) {
1164
+ function Jn(e, t) {
1168
1165
  e.value = String(t ?? ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 })), e.dispatchEvent(new Event("blur", { bubbles: !0 }));
1169
1166
  }
1170
- function ye(e) {
1167
+ function ge(e) {
1171
1168
  e.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0, view: window }));
1172
1169
  }
1173
- function er(e) {
1170
+ function Qn(e) {
1174
1171
  return typeof e == "boolean" ? e : ["true", "1", "是", "开启", "启用", "yes", "y"].includes(String(e ?? "").trim().toLowerCase());
1175
1172
  }
1176
- function tr(e) {
1173
+ function er(e) {
1177
1174
  return Array.isArray(e) ? e.map(String) : String(e ?? "").split(/[,,;;、]/).map((t) => t.trim()).filter(Boolean);
1178
1175
  }
1179
1176
  function k(e) {
1180
- return J(e).toLowerCase();
1177
+ return Z(e).toLowerCase();
1181
1178
  }
1182
- function J(e) {
1179
+ function Z(e) {
1183
1180
  return e.replace(/\s+/g, " ").trim();
1184
1181
  }
1185
- const nr = "https://uat.kingdeefin.com";
1182
+ const tr = "https://uat.kingdeefin.com";
1186
1183
  class Mt extends Error {
1187
1184
  constructor(n) {
1188
1185
  super(n.message);
@@ -1194,7 +1191,7 @@ class Mt extends Error {
1194
1191
  function b(e, t, n, r = {}) {
1195
1192
  return new Mt({ code: e, message: t, stage: n, ...r });
1196
1193
  }
1197
- function Xe(e, t, n = "RECOGNIZE_FAILED") {
1194
+ function We(e, t, n = "RECOGNIZE_FAILED") {
1198
1195
  return e instanceof Mt ? e.smartFillError : {
1199
1196
  code: n,
1200
1197
  message: e instanceof Error ? e.message : String(e || "智能录入异常"),
@@ -1202,15 +1199,15 @@ function Xe(e, t, n = "RECOGNIZE_FAILED") {
1202
1199
  retryable: t === "recognize"
1203
1200
  };
1204
1201
  }
1205
- function be(e = "sf") {
1202
+ function ye(e = "sf") {
1206
1203
  return `${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
1207
1204
  }
1208
- class rr {
1205
+ class nr {
1209
1206
  constructor(t) {
1210
1207
  /** 会话 accessToken,写入请求头 seToken */
1211
1208
  d(this, "seToken", "");
1212
1209
  /** 网关根地址,见 config/defaults.ts */
1213
- d(this, "baseURL", nr);
1210
+ d(this, "baseURL", tr);
1214
1211
  this.config = t;
1215
1212
  }
1216
1213
  /** 设置会话 token,后续 request 自动携带 seToken 请求头 */
@@ -1273,12 +1270,12 @@ class rr {
1273
1270
  userInputMsg: r || ""
1274
1271
  })
1275
1272
  }
1276
- ), i = ir(o, t.fields, t.scanToken);
1273
+ ), i = or(o, t.fields, t.scanToken);
1277
1274
  return console.log("suggestions", i), {
1278
1275
  scanToken: t.scanToken,
1279
1276
  suggestions: i,
1280
1277
  trace: o.trace || {
1281
- traceId: be("trace"),
1278
+ traceId: ye("trace"),
1282
1279
  usedOcr: !!t.usedOcr,
1283
1280
  usedAi: !0,
1284
1281
  durationMs: Math.round(performance.now() - n)
@@ -1297,7 +1294,7 @@ class rr {
1297
1294
  method: "POST",
1298
1295
  body: n
1299
1296
  }
1300
- ), o = ar(r);
1297
+ ), o = sr(r);
1301
1298
  if (!o)
1302
1299
  throw b("RECOGNIZE_FAILED", "图片识别未提取到文本内容。", "recognize");
1303
1300
  return o;
@@ -1305,7 +1302,7 @@ class rr {
1305
1302
  /** 通用 fetch 封装:超时控制、trace 头、HTTP 错误映射为 SmartFillException */
1306
1303
  async request(t, n) {
1307
1304
  const r = new AbortController(), o = window.setTimeout(() => r.abort(), this.config.requestTimeoutMs ?? 3e4), i = new Headers(n.headers);
1308
- n.body && !(n.body instanceof FormData) && !i.has("Content-Type") && i.set("Content-Type", "application/json"), i.set("x-trace-id", be("trace")), this.seToken && i.set("seToken", `${this.seToken}`);
1305
+ n.body && !(n.body instanceof FormData) && !i.has("Content-Type") && i.set("Content-Type", "application/json"), i.set("x-trace-id", ye("trace")), this.seToken && i.set("seToken", `${this.seToken}`);
1309
1306
  try {
1310
1307
  const s = await fetch(`${this.baseURL}${t}`, {
1311
1308
  ...n,
@@ -1313,7 +1310,7 @@ class rr {
1313
1310
  signal: r.signal
1314
1311
  });
1315
1312
  if (!s.ok)
1316
- throw b(cr(s.status), await s.text(), t.includes("session") ? "setup" : "recognize", {
1313
+ throw b(ar(s.status), await s.text(), t.includes("session") ? "setup" : "recognize", {
1317
1314
  retryable: s.status >= 500 || s.status === 429
1318
1315
  });
1319
1316
  return s.json();
@@ -1324,8 +1321,8 @@ class rr {
1324
1321
  }
1325
1322
  }
1326
1323
  }
1327
- const or = 0.95;
1328
- function ir(e, t, n) {
1324
+ const rr = 0.95;
1325
+ function or(e, t, n) {
1329
1326
  var i;
1330
1327
  const r = new Map(t.map((s) => [s.fieldId, s]));
1331
1328
  return (((i = e.data) == null ? void 0 : i.fieldValues) || []).filter((s) => !!(s != null && s.fieldId)).map((s) => {
@@ -1336,21 +1333,21 @@ function ir(e, t, n) {
1336
1333
  label: s.label || (a == null ? void 0 : a.label) || s.fieldId,
1337
1334
  value: s.value,
1338
1335
  displayValue: s.value == null ? "" : String(s.value),
1339
- confidence: sr(s.confidence),
1336
+ confidence: ir(s.confidence),
1340
1337
  source: s.source || "ai",
1341
1338
  warnings: s.warnings
1342
1339
  };
1343
1340
  });
1344
1341
  }
1345
- function sr(e) {
1346
- return typeof e != "number" || Number.isNaN(e) ? or : e < 0 ? 0 : e > 1 ? 1 : e;
1342
+ function ir(e) {
1343
+ return typeof e != "number" || Number.isNaN(e) ? rr : e < 0 ? 0 : e > 1 ? 1 : e;
1347
1344
  }
1348
- function ar(e) {
1345
+ function sr(e) {
1349
1346
  var n;
1350
1347
  const t = typeof e.data == "string" ? e.data : ((n = e.data) == null ? void 0 : n.text) || e.text || "";
1351
1348
  return String(t || "").trim();
1352
1349
  }
1353
- function cr(e) {
1350
+ function ar(e) {
1354
1351
  return e === 401 ? "TOKEN_EXPIRED" : e === 403 ? "API_KEY_FORBIDDEN" : e === 404 ? "FORM_CONFIG_NOT_FOUND" : "RECOGNIZE_FAILED";
1355
1352
  }
1356
1353
  class Rt {
@@ -1374,7 +1371,7 @@ class Rt {
1374
1371
  this.handlers.clear();
1375
1372
  }
1376
1373
  }
1377
- class lr {
1374
+ class cr {
1378
1375
  constructor() {
1379
1376
  /** 当前页面所有存活实例 */
1380
1377
  d(this, "instances", /* @__PURE__ */ new Set());
@@ -1398,14 +1395,14 @@ class lr {
1398
1395
  this.instances.forEach((t) => t.destroy()), this.instances.clear(), this.active = null;
1399
1396
  }
1400
1397
  }
1401
- const ur = [
1398
+ const lr = [
1402
1399
  /^(el|rc|ant|radix|headlessui|mui|chakra)-/i,
1403
1400
  /[0-9a-f]{8,}/i,
1404
1401
  /\d{6,}/
1405
1402
  ];
1406
1403
  function S(e) {
1407
1404
  const t = String(e || "").trim();
1408
- return !t || ur.some((n) => n.test(t)) ? "" : t;
1405
+ return !t || lr.some((n) => n.test(t)) ? "" : t;
1409
1406
  }
1410
1407
  function z(e) {
1411
1408
  const t = (e.options || []).slice(0, 20).map((n) => `${n.label}:${String(n.value)}`).join("|");
@@ -1426,7 +1423,7 @@ function z(e) {
1426
1423
  function q(e) {
1427
1424
  return String(e ?? "").replace(/\s+/g, " ").trim().toLowerCase();
1428
1425
  }
1429
- const xe = /* @__PURE__ */ new WeakMap(), dr = [
1426
+ const Ee = /* @__PURE__ */ new WeakMap(), ur = [
1430
1427
  'input:not([type="hidden"])',
1431
1428
  "textarea",
1432
1429
  "select",
@@ -1447,7 +1444,7 @@ const xe = /* @__PURE__ */ new WeakMap(), dr = [
1447
1444
  ".van-field__body",
1448
1445
  "[role='combobox']"
1449
1446
  ].join(", ");
1450
- class Ze {
1447
+ class Xe {
1451
1448
  constructor(t, n, r = []) {
1452
1449
  this.fields = t, this.schemas = n, this.adapters = r;
1453
1450
  }
@@ -1461,23 +1458,23 @@ class Ze {
1461
1458
  for (const o of t.values) {
1462
1459
  const i = this.fields.find((l) => l.fieldId === o.fieldId);
1463
1460
  if (!i) {
1464
- r.push(ae(o.fieldId, "", o.value, "字段不在当前扫描结果中", "FIELD_NOT_FOUND"));
1461
+ r.push(se(o.fieldId, "", o.value, "字段不在当前扫描结果中", "FIELD_NOT_FOUND"));
1465
1462
  continue;
1466
1463
  }
1467
1464
  if (i.scanToken !== t.scanToken) {
1468
- r.push(ae(i.fieldId, i.label, o.value, "页面扫描已过期,请重新扫描", "SCAN_TOKEN_EXPIRED"));
1465
+ r.push(se(i.fieldId, i.label, o.value, "页面扫描已过期,请重新扫描", "SCAN_TOKEN_EXPIRED"));
1469
1466
  continue;
1470
1467
  }
1471
- const s = br(this.schemas, o.fieldId), a = s != null && s.transform ? s.transform(o.value) : o.value, c = await this.getValue(i, s);
1468
+ const s = yr(this.schemas, o.fieldId), a = s != null && s.transform ? s.transform(o.value) : o.value, c = await this.getValue(i, s);
1472
1469
  try {
1473
1470
  const l = s != null && s.validate ? await s.validate(a) : !0;
1474
1471
  if (l !== !0) {
1475
- r.push(ae(i.fieldId, i.label, a, typeof l == "string" ? l : "字段校验未通过", "VALIDATE_FAILED"));
1472
+ r.push(se(i.fieldId, i.label, a, typeof l == "string" ? l : "字段校验未通过", "VALIDATE_FAILED"));
1476
1473
  continue;
1477
1474
  }
1478
1475
  await this.setValue(i, a, s), n.push({ fieldId: i.fieldId, label: i.label, value: a, previousValue: c });
1479
1476
  } catch (l) {
1480
- r.push(ae(i.fieldId, i.label, a, l instanceof Error ? l.message : "字段回填失败", "SET_VALUE_FAILED"));
1477
+ r.push(se(i.fieldId, i.label, a, l instanceof Error ? l.message : "字段回填失败", "SET_VALUE_FAILED"));
1481
1478
  }
1482
1479
  }
1483
1480
  return {
@@ -1491,7 +1488,7 @@ class Ze {
1491
1488
  if (n != null && n.getValue) return n.getValue();
1492
1489
  const r = this.matchAdapter(t, n);
1493
1490
  if (r != null && r.getValue) return r.getValue(t);
1494
- const o = se(t, n);
1491
+ const o = ie(t, n);
1495
1492
  if (o)
1496
1493
  return o instanceof HTMLInputElement && o.type === "checkbox" ? o.checked : o instanceof HTMLInputElement && o.type === "radio" ? o.checked ? o.value : void 0 : o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement ? o.value : o.textContent;
1497
1494
  }
@@ -1502,38 +1499,38 @@ class Ze {
1502
1499
  async setValue(t, n, r) {
1503
1500
  if (r != null && r.setValue) {
1504
1501
  await r.setValue(n);
1505
- const a = se(t, r);
1506
- a && ke(a, t);
1502
+ const s = ie(t, r);
1503
+ s && xe(s, t);
1507
1504
  return;
1508
1505
  }
1509
- const o = se(t, r);
1506
+ const o = ie(t, r);
1510
1507
  if (!o) throw new Error("页面中未找到对应字段");
1511
1508
  if (t.fingerprint && t.fingerprint !== z({ ...t, tagName: o.tagName.toLowerCase() }))
1512
1509
  throw new Error("字段结构已变化,请重新扫描");
1513
- const i = this.matchAdapter(t, r), s = B(o, t.type);
1510
+ const i = this.matchAdapter(t, r);
1514
1511
  if (t.disabled || o.hasAttribute("disabled") || o.getAttribute("aria-disabled") === "true")
1515
1512
  throw new Error("字段不可编辑");
1516
- if (!s && !i && (t.readonly || o.hasAttribute("readonly")))
1513
+ if (t.readonly || o.hasAttribute("readonly"))
1517
1514
  throw new Error("字段不可编辑");
1518
1515
  if (i) {
1519
- await i.setValue(t, n), ke(o, t);
1516
+ await i.setValue(t, n), xe(o, t);
1520
1517
  return;
1521
1518
  }
1522
- fr(o, n), ke(o, t);
1519
+ pr(o, n), xe(o, t);
1523
1520
  }
1524
1521
  /** 匹配第一个适用的组件库适配器 */
1525
1522
  matchAdapter(t, n) {
1526
- const r = se(t, n);
1523
+ const r = ie(t, n);
1527
1524
  return r ? this.adapters.find((o) => o.match(r, t)) : void 0;
1528
1525
  }
1529
1526
  }
1530
- function se(e, t) {
1527
+ function ie(e, t) {
1531
1528
  var r;
1532
1529
  if ((r = e.element) != null && r.isConnected) return e.element;
1533
- const n = pr(t == null ? void 0 : t.element);
1530
+ const n = dr(t == null ? void 0 : t.element);
1534
1531
  return n || document.querySelector(`[data-smart-fill-id="${qe(e.fieldId)}"]`);
1535
1532
  }
1536
- function pr(e) {
1533
+ function dr(e) {
1537
1534
  if (e instanceof HTMLElement)
1538
1535
  return e.isConnected ? e : null;
1539
1536
  if (typeof e == "string")
@@ -1545,7 +1542,7 @@ function pr(e) {
1545
1542
  }
1546
1543
  return null;
1547
1544
  }
1548
- function fr(e, t) {
1545
+ function pr(e, t) {
1549
1546
  if (e instanceof HTMLInputElement && e.type === "checkbox")
1550
1547
  e.checked = !!t;
1551
1548
  else if (e instanceof HTMLInputElement && e.type === "radio") {
@@ -1554,53 +1551,53 @@ function fr(e, t) {
1554
1551
  } else e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? e.value = String(t ?? "") : e.isContentEditable && (e.textContent = String(t ?? ""));
1555
1552
  e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
1556
1553
  }
1557
- function ke(e, t) {
1558
- for (const n of hr(e, t))
1559
- gr(n);
1554
+ function xe(e, t) {
1555
+ for (const n of fr(e, t))
1556
+ hr(n);
1560
1557
  }
1561
- function hr(e, t) {
1558
+ function fr(e, t) {
1562
1559
  if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)
1563
1560
  return [e];
1564
- const n = B(e, t == null ? void 0 : t.type) && Y(e) || e, r = yr(
1565
- Array.from(n.querySelectorAll(dr)).filter(Je)
1561
+ const n = Oe(e, t == null ? void 0 : t.type) && G(e) || e, r = gr(
1562
+ Array.from(n.querySelectorAll(ur)).filter(Ze)
1566
1563
  );
1567
1564
  if (r.length)
1568
1565
  return r;
1569
1566
  const o = O(n);
1570
- return o && Je(o) ? [o] : [n];
1567
+ return o && Ze(o) ? [o] : [n];
1571
1568
  }
1572
- function gr(e) {
1569
+ function hr(e) {
1573
1570
  var r;
1574
- e.setAttribute("data-smart-fill-highlighted", "true"), (r = xe.get(e)) == null || r.abort();
1571
+ e.setAttribute("data-smart-fill-highlighted", "true"), (r = Ee.get(e)) == null || r.abort();
1575
1572
  const t = new AbortController(), n = (o) => {
1576
- o && "isTrusted" in o && !o.isTrusted || (e.removeAttribute("data-smart-fill-highlighted"), t.abort(), xe.delete(e));
1573
+ o && "isTrusted" in o && !o.isTrusted || (e.removeAttribute("data-smart-fill-highlighted"), t.abort(), Ee.delete(e));
1577
1574
  };
1578
- xe.set(e, t), e.addEventListener("focus", n, { signal: t.signal }), e.addEventListener("pointerdown", n, { signal: t.signal }), e.addEventListener("keydown", n, { signal: t.signal }), e.addEventListener("input", n, { signal: t.signal }), e.addEventListener("change", n, { signal: t.signal });
1575
+ Ee.set(e, t), e.addEventListener("focus", n, { signal: t.signal }), e.addEventListener("pointerdown", n, { signal: t.signal }), e.addEventListener("keydown", n, { signal: t.signal }), e.addEventListener("input", n, { signal: t.signal }), e.addEventListener("change", n, { signal: t.signal });
1579
1576
  }
1580
- function yr(e) {
1577
+ function gr(e) {
1581
1578
  return e.filter((t) => !e.some((n) => n !== t && n.contains(t)));
1582
1579
  }
1583
- function Je(e) {
1580
+ function Ze(e) {
1584
1581
  const t = window.getComputedStyle(e);
1585
1582
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0)
1586
1583
  return !1;
1587
1584
  const n = e.getBoundingClientRect();
1588
1585
  return n.width > 0 && n.height > 0;
1589
1586
  }
1590
- function ae(e, t, n, r, o) {
1587
+ function se(e, t, n, r, o) {
1591
1588
  return { fieldId: e, label: t, attemptedValue: n, reason: r, reasonCode: o };
1592
1589
  }
1593
1590
  function qe(e) {
1594
1591
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
1595
1592
  }
1596
- function br(e, t) {
1593
+ function yr(e, t) {
1597
1594
  const n = e.find((o) => o.fieldId === t);
1598
1595
  if (n) return n;
1599
1596
  const r = t.includes(":") ? t.slice(t.lastIndexOf(":") + 1) : "";
1600
1597
  if (r)
1601
1598
  return e.find((o) => o.rowKey != null && String(o.rowKey) === r && `${o.fieldId}:${o.rowKey}` === t);
1602
1599
  }
1603
- const mr = [
1600
+ const br = [
1604
1601
  { key: "mobile", pattern: new RegExp("(?<!\\d)1[3-9]\\d{9}(?!\\d)", "g"), confidence: 0.98, reason: "手机号正则命中" },
1605
1602
  { key: "idCard", pattern: new RegExp("(?<!\\d)\\d{17}[\\dXx](?!\\d)", "g"), confidence: 0.96, reason: "身份证号正则命中" },
1606
1603
  { key: "email", pattern: /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, confidence: 0.95, reason: "邮箱正则命中" },
@@ -1667,20 +1664,20 @@ const mr = [
1667
1664
  amount: "amount",
1668
1665
  date: "date"
1669
1666
  };
1670
- class wr {
1667
+ class mr {
1671
1668
  /**
1672
1669
  * 从文本中提取事实并匹配到 scan 字段。
1673
1670
  * 按 confidence 降序分配,每个 fieldId 仅匹配一次(usedFieldIds 去重)。
1674
1671
  */
1675
1672
  recognize(t, n, r) {
1676
- const o = Tr([...vr(t), ...Sr(t)]), i = /* @__PURE__ */ new Set(), s = [];
1673
+ const o = Ar([...wr(t), ...vr(t)]), i = /* @__PURE__ */ new Set(), s = [];
1677
1674
  for (const a of o.sort((c, l) => l.confidence - c.confidence)) {
1678
- const c = xr(a, n, i);
1675
+ const c = Er(a, n, i);
1679
1676
  c && (s.push({
1680
1677
  fieldId: c.fieldId,
1681
1678
  scanToken: r,
1682
1679
  label: c.label,
1683
- value: _r(a.value, c),
1680
+ value: kr(a.value, c),
1684
1681
  displayValue: a.value,
1685
1682
  confidence: a.confidence,
1686
1683
  source: "local_rule",
@@ -1690,9 +1687,9 @@ class wr {
1690
1687
  return s;
1691
1688
  }
1692
1689
  }
1693
- function vr(e) {
1690
+ function wr(e) {
1694
1691
  const t = [];
1695
- for (const n of mr)
1692
+ for (const n of br)
1696
1693
  for (const r of e.matchAll(n.pattern)) {
1697
1694
  const o = Ft(r[1] || r[0]);
1698
1695
  t.push({
@@ -1705,21 +1702,21 @@ function vr(e) {
1705
1702
  }
1706
1703
  return t;
1707
1704
  }
1708
- function Sr(e) {
1705
+ function vr(e) {
1709
1706
  const t = [], n = e.split(/\r?\n|[;,;]/).map((r) => r.trim()).filter(Boolean);
1710
1707
  for (const r of n) {
1711
1708
  const o = r.match(/^[“"'`]?([^::=]{2,30})[”"'`]?[::=]\s*(.+)$/);
1712
1709
  if (!o) continue;
1713
- const i = Ar(o[1]), s = Ft(o[2]);
1710
+ const i = Cr(o[1]), s = Ft(o[2]);
1714
1711
  if (!(!i || !s))
1715
- for (const a of Er(i, s))
1712
+ for (const a of Sr(i, s))
1716
1713
  t.push(a);
1717
1714
  }
1718
1715
  return t;
1719
1716
  }
1720
- function Er(e, t) {
1721
- const n = q(e), r = Cr(t), o = [];
1722
- return (x(n, I.mobile) || r === "mobile") && o.push("mobile"), (x(n, I.idCard) || r === "idCard") && o.push("idCard"), (x(n, I.email) || r === "email") && o.push("email"), (x(n, I.bankCard) || r === "bankCard") && o.push("bankCard"), (x(n, I.amount) || r === "amount") && o.push("amount"), (x(n, I.date) || r === "date") && o.push("date"), Lr(o).map((i, s) => ({
1717
+ function Sr(e, t) {
1718
+ const n = q(e), r = _r(t), o = [];
1719
+ return (x(n, I.mobile) || r === "mobile") && o.push("mobile"), (x(n, I.idCard) || r === "idCard") && o.push("idCard"), (x(n, I.email) || r === "email") && o.push("email"), (x(n, I.bankCard) || r === "bankCard") && o.push("bankCard"), (x(n, I.amount) || r === "amount") && o.push("amount"), (x(n, I.date) || r === "date") && o.push("date"), Tr(o).map((i, s) => ({
1723
1720
  key: i,
1724
1721
  value: t,
1725
1722
  confidence: Math.max(0.84, 0.96 - s * 0.04),
@@ -1727,29 +1724,29 @@ function Er(e, t) {
1727
1724
  baseKey: Ot[i]
1728
1725
  }));
1729
1726
  }
1730
- function xr(e, t, n) {
1727
+ function Er(e, t, n) {
1731
1728
  let r = null;
1732
1729
  for (const o of t) {
1733
1730
  if (n.has(o.fieldId)) continue;
1734
- const i = kr(e, o);
1731
+ const i = xr(e, o);
1735
1732
  i > ((r == null ? void 0 : r.score) ?? 0) && (r = { field: o, score: i });
1736
1733
  }
1737
1734
  return r && r.score >= 0.45 ? r.field : null;
1738
1735
  }
1739
- function kr(e, t) {
1736
+ function xr(e, t) {
1740
1737
  const n = q([t.fieldId, t.label, t.placeholder, t.name, t.id, t.section].join(" ")), r = I[e.key] || [e.key];
1741
1738
  let o = 0;
1742
1739
  return x(n, r) ? o += 0.95 : x(n, [e.key]) && (o += 0.82), n.includes(q(e.key)) && (o += 0.22), t.required && (o += 0.05), e.baseKey === "amount" && (t.type === "amount" || t.type === "number") && (o += 0.18), e.baseKey === "date" && t.type === "date" && (o += 0.18), ["email", "mobile", "idCard", "bankCard"].includes(e.baseKey) && t.type === "text" && (o += 0.08), Math.min(o, 1);
1743
1740
  }
1744
- function _r(e, t) {
1741
+ function kr(e, t) {
1745
1742
  var n;
1746
1743
  return t.type === "date" ? e.replace(/[年月/.]/g, "-").replace(/日/g, "").replace(/--/g, "-") : t.type === "number" || t.type === "amount" ? ((n = e.match(/[0-9]+(?:\.[0-9]+)?/)) == null ? void 0 : n[0]) ?? e : t.name && /mobile|phone|idcard|bankcard/i.test(t.name) || t.id && /mobile|phone|idcard|bankcard/i.test(t.id) || /mobile|phone|idcard|bankcard/i.test(t.fieldId) ? e.replace(/\s+/g, "") : e;
1747
1744
  }
1748
- function Cr(e) {
1745
+ function _r(e) {
1749
1746
  const t = e.replace(/\s+/g, "");
1750
1747
  return /^1[3-9]\d{9}$/.test(t) ? "mobile" : /^\d{17}[\dXx]$/.test(t) ? "idCard" : /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(e) ? "email" : /^\d{16,19}$/.test(t) ? "bankCard" : /^\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?$/.test(e) ? "date" : /^[0-9]+(?:\.[0-9]{1,2})?$/.test(t) ? "amount" : "unknown";
1751
1748
  }
1752
- function Ar(e) {
1749
+ function Cr(e) {
1753
1750
  return e.replace(/[“”"'`]/g, "").replace(/\s+/g, " ").trim();
1754
1751
  }
1755
1752
  function Ft(e) {
@@ -1759,7 +1756,7 @@ function x(e, t) {
1759
1756
  const n = q(e);
1760
1757
  return t.some((r) => n.includes(q(r)));
1761
1758
  }
1762
- function Tr(e) {
1759
+ function Ar(e) {
1763
1760
  const t = /* @__PURE__ */ new Map();
1764
1761
  for (const n of e) {
1765
1762
  const r = `${n.key}::${n.value}`, o = t.get(r);
@@ -1767,16 +1764,16 @@ function Tr(e) {
1767
1764
  }
1768
1765
  return [...t.values()];
1769
1766
  }
1770
- function Lr(e) {
1767
+ function Tr(e) {
1771
1768
  return [...new Set(e)];
1772
1769
  }
1773
- const Qe = [
1770
+ const Je = [
1774
1771
  "input",
1775
1772
  "textarea",
1776
1773
  "select",
1777
1774
  "[contenteditable]:not([contenteditable='false'])"
1778
- ].join(", "), Ir = /* @__PURE__ */ new Set(["hidden", "submit", "button", "image", "reset", "file", "password"]);
1779
- class Mr {
1775
+ ].join(", "), Lr = /* @__PURE__ */ new Set(["hidden", "submit", "button", "image", "reset", "file", "password"]);
1776
+ class Ir {
1780
1777
  constructor(t = document) {
1781
1778
  this.root = t;
1782
1779
  }
@@ -1787,7 +1784,7 @@ class Mr {
1787
1784
  */
1788
1785
  scan(t = {}) {
1789
1786
  var l;
1790
- const n = be("scan");
1787
+ const n = ye("scan");
1791
1788
  if ((l = t.registered) != null && l.length)
1792
1789
  return {
1793
1790
  scanToken: n,
@@ -1807,14 +1804,14 @@ class Mr {
1807
1804
  return n;
1808
1805
  const r = [];
1809
1806
  for (const s of n.fields) {
1810
- const a = !!((i = s.options) != null && i.length) && !re(s);
1807
+ const a = !!((i = s.options) != null && i.length) && !ne(s);
1811
1808
  if (!s.element || a || s.type !== "select" && s.type !== "cascader") {
1812
1809
  r.push(s);
1813
1810
  continue;
1814
1811
  }
1815
- const c = await cn(s.element), l = c != null && c.length && !re({ ...s, options: c }) ? c : void 0;
1812
+ const c = await an(s.element), l = c != null && c.length && !ne({ ...s, options: c }) ? c : void 0;
1816
1813
  if (!(l != null && l.length)) {
1817
- r.push({ ...s, options: re(s) ? void 0 : s.options });
1814
+ r.push({ ...s, options: ne(s) ? void 0 : s.options });
1818
1815
  continue;
1819
1816
  }
1820
1817
  const u = { ...s, options: l };
@@ -1827,7 +1824,7 @@ class Mr {
1827
1824
  }
1828
1825
  /** FieldSchema → FieldDescriptor,解析 element 并生成 fingerprint */
1829
1826
  fromSchema(t, n) {
1830
- const r = Vr(t.element, this.root), o = r ? Oe(r) || Le(r) || r : null, i = {
1827
+ const r = Nr(t.element, this.root), o = r ? Re(r) || Te(r) || r : null, i = {
1831
1828
  fieldId: t.rowKey == null ? t.fieldId : `${t.fieldId}:${t.rowKey}`,
1832
1829
  label: t.label,
1833
1830
  type: t.type,
@@ -1848,25 +1845,25 @@ class Mr {
1848
1845
  }
1849
1846
  /** DOM 元素 → FieldDescriptor,自动推断 label/type 并写入 data-smart-fill-id */
1850
1847
  fromElement(t, n, r, o = this.root) {
1851
- const i = Rr(t, n), s = qr(t, o), a = {
1848
+ const i = Mr(t, n), s = Fr(t, o), a = {
1852
1849
  fieldId: i,
1853
1850
  fingerprint: "",
1854
1851
  scanToken: r,
1855
- type: Or(t),
1852
+ type: Rr(t),
1856
1853
  localRuleMode: "inherit",
1857
1854
  label: qt(t),
1858
1855
  placeholder: Pt(t),
1859
- name: S(ft(t)) || void 0,
1856
+ name: S(pt(t)) || void 0,
1860
1857
  id: S(t.id) || void 0,
1861
- section: Fr(t),
1858
+ section: Or(t),
1862
1859
  options: s,
1863
- required: Hr(t),
1864
- readonly: Pr(t) && !sn(t),
1865
- disabled: _e(t),
1860
+ required: Pr(t),
1861
+ readonly: Dr(t),
1862
+ disabled: ke(t),
1866
1863
  source: "form_scan",
1867
1864
  element: t
1868
1865
  };
1869
- return re(a) && (a.options = void 0), a.fingerprint = z({
1866
+ return ne(a) && (a.options = void 0), a.fingerprint = z({
1870
1867
  ...a,
1871
1868
  tagName: t.tagName.toLowerCase()
1872
1869
  }), a;
@@ -1882,38 +1879,38 @@ class Mr {
1882
1879
  }
1883
1880
  /** 收集 root 下可见且可编辑的表单控件 */
1884
1881
  collectVisibleFields(t) {
1885
- const n = /* @__PURE__ */ new Set(), r = [Qe, ht, ut, ".van-field"].join(", ");
1882
+ const n = /* @__PURE__ */ new Set(), r = [Je, ft, lt, ".van-field"].join(", ");
1886
1883
  for (const s of t.querySelectorAll(r)) {
1887
1884
  if (!(s instanceof HTMLElement)) continue;
1888
- const a = Oe(s) || Le(s);
1889
- !a || !De(a) || _e(a) || n.add(a);
1885
+ const a = Re(s) || Te(s);
1886
+ !a || !De(a) || ke(a) || n.add(a);
1890
1887
  }
1891
- const o = [...n], i = Array.from(t.querySelectorAll(Qe)).filter((s) => !(s instanceof HTMLElement) || !De(s) || $r(s) || s instanceof HTMLInputElement && Ir.has((s.type || "").toLowerCase()) ? !1 : !_e(s) && !s.hasAttribute("readonly"));
1892
- return Nr([...i, ...o]);
1888
+ const o = [...n], i = Array.from(t.querySelectorAll(Je)).filter((s) => !(s instanceof HTMLElement) || !De(s) || Hr(s) || s instanceof HTMLInputElement && Lr.has((s.type || "").toLowerCase()) ? !1 : !ke(s) && !s.hasAttribute("readonly"));
1889
+ return $r([...i, ...o]);
1893
1890
  }
1894
1891
  /**
1895
1892
  * 检测最应优先扫描的容器。
1896
1893
  * 优先 activeElement 所在弹窗,否则取包含最多字段的弹窗容器。
1897
1894
  */
1898
1895
  detectTopLayerContainer(t) {
1899
- const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, r = n == null ? void 0 : n.closest(Be);
1896
+ const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, r = n == null ? void 0 : n.closest(ze);
1900
1897
  if (r instanceof HTMLElement && t.some((i) => r.contains(i)))
1901
1898
  return r;
1902
- const o = t.map((i) => i.closest(Be)).filter((i) => i instanceof HTMLElement);
1899
+ const o = t.map((i) => i.closest(ze)).filter((i) => i instanceof HTMLElement);
1903
1900
  return o.length ? o.sort((i, s) => t.filter((a) => s.contains(a)).length - t.filter((a) => i.contains(a)).length)[0] : document.body;
1904
1901
  }
1905
1902
  }
1906
- function Rr(e, t) {
1903
+ function Mr(e, t) {
1907
1904
  const n = e.getAttribute("data-smart-fill-id");
1908
1905
  if (n)
1909
1906
  return n;
1910
- const o = S(e.getAttribute("name")) || S(e.getAttribute("data-smart-fill-key")) || S(ft(e)) || S(e.id) || S(qt(e)) || `smart-fill-${Date.now()}-${t}`;
1907
+ const o = S(e.getAttribute("name")) || S(e.getAttribute("data-smart-fill-key")) || S(pt(e)) || S(e.id) || S(qt(e)) || `smart-fill-${Date.now()}-${t}`;
1911
1908
  return e.setAttribute("data-smart-fill-id", o), o;
1912
1909
  }
1913
- function Or(e) {
1914
- const t = $e(e);
1910
+ function Rr(e) {
1911
+ const t = yt(e);
1915
1912
  if (t) return t;
1916
- const n = le(e);
1913
+ const n = ce(e);
1917
1914
  if (n) return n;
1918
1915
  if (e instanceof HTMLTextAreaElement) return "textarea";
1919
1916
  if (e instanceof HTMLSelectElement) return "select";
@@ -1930,7 +1927,7 @@ function qt(e) {
1930
1927
  const t = e.getAttribute("aria-label");
1931
1928
  if (t) return t.trim();
1932
1929
  if (e.id) {
1933
- const i = document.querySelector(`label[for="${Ke(e.id)}"]`);
1930
+ const i = document.querySelector(`label[for="${Ve(e.id)}"]`);
1934
1931
  if (i != null && i.textContent) return p(i.textContent);
1935
1932
  }
1936
1933
  const n = e.closest(Zt), r = n == null ? void 0 : n.querySelector(Jt);
@@ -1954,14 +1951,14 @@ function Pt(e) {
1954
1951
  var t;
1955
1952
  return e.getAttribute("placeholder") || e.getAttribute("aria-placeholder") || ((t = e.querySelector("[placeholder]")) == null ? void 0 : t.getAttribute("placeholder")) || void 0;
1956
1953
  }
1957
- function Fr(e) {
1954
+ function Or(e) {
1958
1955
  const t = e.closest("fieldset, section, .panel, .card, .form-section"), n = t == null ? void 0 : t.querySelector("legend, h1, h2, h3, .title, .section-title");
1959
1956
  return n != null && n.textContent ? p(n.textContent) : void 0;
1960
1957
  }
1961
- function qr(e, t = document) {
1958
+ function Fr(e, t = document) {
1962
1959
  const n = bt(e);
1963
1960
  if (n != null && n.length) return n;
1964
- const r = pt(e);
1961
+ const r = dt(e);
1965
1962
  if (r != null && r.length) return r;
1966
1963
  if (e instanceof HTMLSelectElement)
1967
1964
  return Array.from(e.options).map((o) => ({
@@ -1969,14 +1966,14 @@ function qr(e, t = document) {
1969
1966
  value: o.value
1970
1967
  }));
1971
1968
  if (e instanceof HTMLInputElement && (e.type === "radio" || e.type === "checkbox") && e.name)
1972
- return Array.from(t.querySelectorAll(`input[name="${Ke(e.name)}"]`)).filter((o) => o.type === e.type && De(o)).map((o) => ({
1973
- label: Dr(o),
1969
+ return Array.from(t.querySelectorAll(`input[name="${Ve(e.name)}"]`)).filter((o) => o.type === e.type && De(o)).map((o) => ({
1970
+ label: qr(o),
1974
1971
  value: o.value || !0
1975
1972
  }));
1976
1973
  }
1977
- function Dr(e) {
1974
+ function qr(e) {
1978
1975
  if (e.id) {
1979
- const n = document.querySelector(`label[for="${Ke(e.id)}"]`);
1976
+ const n = document.querySelector(`label[for="${Ve(e.id)}"]`);
1980
1977
  if (n != null && n.textContent) return p(n.textContent);
1981
1978
  }
1982
1979
  const t = e.closest("label");
@@ -1990,25 +1987,25 @@ function De(e) {
1990
1987
  const t = window.getComputedStyle(e);
1991
1988
  return t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0 ? !1 : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1992
1989
  }
1993
- function _e(e) {
1990
+ function ke(e) {
1994
1991
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement ? e.disabled || e.getAttribute("aria-disabled") === "true" : e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" || Xt.some((t) => e.classList.contains(t));
1995
1992
  }
1996
- function Pr(e) {
1993
+ function Dr(e) {
1997
1994
  return e.hasAttribute("readonly") || !!e.querySelector("[readonly]");
1998
1995
  }
1999
- function Hr(e) {
1996
+ function Pr(e) {
2000
1997
  return e.hasAttribute("required") || e.getAttribute("aria-required") === "true" || !!e.querySelector('[required], [aria-required="true"]');
2001
1998
  }
2002
- function $r(e) {
2003
- return Oe(e) != null || Le(e) != null;
1999
+ function Hr(e) {
2000
+ return Re(e) != null || Te(e) != null;
2004
2001
  }
2005
- function Nr(e) {
2002
+ function $r(e) {
2006
2003
  const t = [];
2007
2004
  for (const n of e)
2008
2005
  t.some((r) => r === n || r.contains(n) || n.contains(r)) || t.push(n);
2009
2006
  return t;
2010
2007
  }
2011
- function Vr(e, t) {
2008
+ function Nr(e, t) {
2012
2009
  return e instanceof HTMLElement ? e : typeof e == "string" ? Ht(t, e) : null;
2013
2010
  }
2014
2011
  function Ht(e, t) {
@@ -2019,11 +2016,11 @@ function Ht(e, t) {
2019
2016
  return null;
2020
2017
  }
2021
2018
  }
2022
- function Ke(e) {
2019
+ function Ve(e) {
2023
2020
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
2024
2021
  }
2025
- const Ce = 5, Kr = 10 * 1024 * 1024, zr = 50 * 1024 * 1024;
2026
- class Br {
2022
+ const _e = 5, Vr = 10 * 1024 * 1024, Kr = 50 * 1024 * 1024;
2023
+ class zr {
2027
2024
  constructor(t) {
2028
2025
  /** 面板宿主元素,挂载到 container 下 */
2029
2026
  d(this, "host", null);
@@ -2049,7 +2046,7 @@ class Br {
2049
2046
  if (!this.dragState || !this.host || t.pointerId !== this.dragState.pointerId) return;
2050
2047
  const n = t.clientX - this.dragState.startX, r = t.clientY - this.dragState.startY;
2051
2048
  (Math.abs(n) > 3 || Math.abs(r) > 3) && (this.dragState.moved = !0);
2052
- const o = this.host.getBoundingClientRect(), i = Math.max(8, window.innerWidth - o.width - 8), s = Math.max(8, window.innerHeight - o.height - 8), a = ce(this.dragState.startLeft + n, 8, i), c = ce(this.dragState.startTop + r, 8, s);
2049
+ const o = this.host.getBoundingClientRect(), i = Math.max(8, window.innerWidth - o.width - 8), s = Math.max(8, window.innerHeight - o.height - 8), a = ae(this.dragState.startLeft + n, 8, i), c = ae(this.dragState.startTop + r, 8, s);
2053
2050
  this.host.style.left = `${a}px`, this.host.style.top = `${c}px`;
2054
2051
  });
2055
2052
  d(this, "handleDragEnd", (t) => {
@@ -2059,7 +2056,7 @@ class Br {
2059
2056
  });
2060
2057
  /** 面板聚焦或鼠标悬浮在图片区时接管全局粘贴图片 */
2061
2058
  d(this, "handleDocumentPaste", (t) => {
2062
- const n = jr(t);
2059
+ const n = Ur(t);
2063
2060
  if (!n.length || !this.isOpen || !this.host)
2064
2061
  return;
2065
2062
  const r = document.activeElement, o = this.root instanceof ShadowRoot ? this.root.activeElement : null;
@@ -2112,7 +2109,7 @@ class Br {
2112
2109
  }
2113
2110
  render(t) {
2114
2111
  this.root && (this.root.innerHTML = `
2115
- <style>${Gr}</style>
2112
+ <style>${jr}</style>
2116
2113
  ${this.options.mode === "floating" ? `<button class="sf-float" type="button" data-role="open">${this.t("entry", "智能录入")}</button>` : ""}
2117
2114
  <section class="sf-panel ${t ? "is-open" : ""} ${this.options.mode === "inline" ? "is-inline" : "is-floating"}" aria-label="智能录入面板">
2118
2115
  <header class="sf-header" data-role="close" >
@@ -2129,7 +2126,7 @@ class Br {
2129
2126
  </label>
2130
2127
  <div class="sf-entry-grid">
2131
2128
  <div class="sf-textarea-wrap">
2132
- <textarea class="sf-textarea" data-role="text" placeholder="${this.t("placeholder", "粘贴文本,如:姓名:张三 手机号:13800000000")}">${Ur(this.inputText)}</textarea>
2129
+ <textarea class="sf-textarea" data-role="text" placeholder="${this.t("placeholder", "粘贴文本,如:姓名:张三 手机号:13800000000")}">${Br(this.inputText)}</textarea>
2133
2130
  <div class="sf-textarea-actions">
2134
2131
  <button class="sf-btn sf-btn-secondary" type="button" data-role="clear">${this.t("clear", "清空")}</button>
2135
2132
  <button class="sf-btn sf-btn-primary" type="button" data-role="recognize">${this.t("recognize", "智能识别")}</button>
@@ -2146,7 +2143,7 @@ class Br {
2146
2143
  <circle cx="10" cy="10.5" r="1" fill="currentColor"/>
2147
2144
  </svg>
2148
2145
  </span>
2149
- <span class="sf-upload-hint">${this.t("uploadHint", `点击、拖拽、Ctrl + V 粘贴图片至此(最多 ${Ce} 张)`)}</span>
2146
+ <span class="sf-upload-hint">${this.t("uploadHint", `点击、拖拽、Ctrl + V 粘贴图片至此(最多 ${_e} 张)`)}</span>
2150
2147
  </span>
2151
2148
  <span class="sf-upload-btn" data-role="file-label">图片识别</span>
2152
2149
  </label>
@@ -2220,15 +2217,15 @@ class Br {
2220
2217
  this.resetSelectedFiles(), this.setError(this.t("invalidImageError", "请选择图片文件。"));
2221
2218
  return;
2222
2219
  }
2223
- if (n.length > Ce) {
2224
- this.resetSelectedFiles(), this.setError(this.t("maxFilesError", `最多上传 ${Ce} 张图片。`));
2220
+ if (n.length > _e) {
2221
+ this.resetSelectedFiles(), this.setError(this.t("maxFilesError", `最多上传 ${_e} 张图片。`));
2225
2222
  return;
2226
2223
  }
2227
- if (n.find((i) => i.size > Kr)) {
2224
+ if (n.find((i) => i.size > Vr)) {
2228
2225
  this.resetSelectedFiles(), this.setError(this.t("maxSingleFileSizeError", "单张图片不能超过 10MB。"));
2229
2226
  return;
2230
2227
  }
2231
- if (n.reduce((i, s) => i + s.size, 0) > zr) {
2228
+ if (n.reduce((i, s) => i + s.size, 0) > Kr) {
2232
2229
  this.resetSelectedFiles(), this.setError(this.t("maxTotalFileSizeError", "上传图片总大小不能超过 50MB。"));
2233
2230
  return;
2234
2231
  }
@@ -2254,7 +2251,7 @@ class Br {
2254
2251
  keepHostInViewport() {
2255
2252
  this.options.mode !== "floating" || !this.host || !this.host.style.left || !this.host.style.top || window.requestAnimationFrame(() => {
2256
2253
  if (!this.host) return;
2257
- const t = this.host.getBoundingClientRect(), n = ce(t.left, 8, Math.max(8, window.innerWidth - t.width - 8)), r = ce(t.top, 8, Math.max(8, window.innerHeight - t.height - 8));
2254
+ const t = this.host.getBoundingClientRect(), n = ae(t.left, 8, Math.max(8, window.innerWidth - t.width - 8)), r = ae(t.top, 8, Math.max(8, window.innerHeight - t.height - 8));
2258
2255
  this.host.style.left = `${n}px`, this.host.style.top = `${r}px`;
2259
2256
  });
2260
2257
  }
@@ -2267,7 +2264,7 @@ class Br {
2267
2264
  return ((r = this.options.messages) == null ? void 0 : r[t]) || n;
2268
2265
  }
2269
2266
  }
2270
- function Ur(e) {
2267
+ function Br(e) {
2271
2268
  return e.replace(/[&<>"']/g, (t) => ({
2272
2269
  "&": "&amp;",
2273
2270
  "<": "&lt;",
@@ -2276,14 +2273,14 @@ function Ur(e) {
2276
2273
  "'": "&#39;"
2277
2274
  })[t] || t);
2278
2275
  }
2279
- function ce(e, t, n) {
2276
+ function ae(e, t, n) {
2280
2277
  return Math.min(Math.max(e, t), n);
2281
2278
  }
2282
- function jr(e) {
2279
+ function Ur(e) {
2283
2280
  var n;
2284
2281
  return Array.from(((n = e.clipboardData) == null ? void 0 : n.items) || []).filter((r) => r.kind === "file" && r.type.startsWith("image/")).map((r) => r.getAsFile()).filter((r) => !!r);
2285
2282
  }
2286
- const Gr = `
2283
+ const jr = `
2287
2284
  :host, .sf-panel { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
2288
2285
  :host(.sf-sdk-host-floating), .sf-sdk-host-floating { position: fixed; top: 30px; right: 30px; z-index: 2147483647; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; width: min(450px, calc(100vw - 32px)); pointer-events: none; }
2289
2286
  .sf-float { font-size: 15px; align-self: flex-end; border: 0; border-radius: 999px; padding: 10px 30px; color: #fff; background: linear-gradient(to right, #FF7E49, #FFA34E); box-shadow: 0 10px 24px rgba(37,99,235,.3); cursor: move; user-select: none; touch-action: none; pointer-events: auto; }
@@ -2353,23 +2350,23 @@ const Gr = `
2353
2350
  width: min(450px, calc(100vw - 32px))
2354
2351
  }
2355
2352
  }
2356
- `, Yr = 0.75, Wr = 1800, H = /* @__PURE__ */ new Map();
2353
+ `, Gr = 0.75, Yr = 1800, H = /* @__PURE__ */ new Map();
2357
2354
  let $ = 0;
2358
2355
  const Pe = "smart-fill:routechange", $t = "smart-fill:session-scan:";
2359
- let et = !1;
2360
- const tt = /* @__PURE__ */ new WeakMap();
2361
- let Xr = 0;
2356
+ let Qe = !1;
2357
+ const et = /* @__PURE__ */ new WeakMap();
2358
+ let Wr = 0;
2362
2359
  function Nt() {
2363
2360
  H.clear(), jt(), $ += 1;
2364
2361
  }
2365
- class Zr {
2362
+ class Xr {
2366
2363
  constructor(t, n) {
2367
2364
  /** 实例级事件总线,对应 instance.on(...) */
2368
2365
  d(this, "events", new Rt());
2369
2366
  /** 页面字段扫描器,root 来自 SmartFill.create({ root }) */
2370
2367
  d(this, "scanner");
2371
2368
  /** 浏览器端本地规则引擎,用于文本正则/键值对提取 */
2372
- d(this, "ruleEngine", new wr());
2369
+ d(this, "ruleEngine", new mr());
2373
2370
  /** Shadow DOM 面板,mount / mountFloatingButton 后可用(指向最后挂载的面板,用于状态展示) */
2374
2371
  d(this, "panel", null);
2375
2372
  /** 已挂载的全部面板(inline / floating 可同时存在),用于本地优先开关广播与销毁 */
@@ -2398,7 +2395,7 @@ class Zr {
2398
2395
  d(this, "floatingLifecycleCleanup", null);
2399
2396
  /** mount 后预扫描定时器 */
2400
2397
  d(this, "preScanTimer", null);
2401
- this.config = t, this.context = n, this.scanner = new Mr(t.root || document), this.localPriorityEnabled = Eo(), this.context.manager.add(this);
2398
+ this.config = t, this.context = n, this.scanner = new Ir(t.root || document), this.localPriorityEnabled = So(), this.context.manager.add(this);
2402
2399
  }
2403
2400
  /** 订阅实例事件,返回取消订阅函数 */
2404
2401
  on(t, n) {
@@ -2434,13 +2431,13 @@ class Zr {
2434
2431
  const n = typeof t == "string" ? document.querySelector(t) : t;
2435
2432
  if (!n)
2436
2433
  throw b("UNSUPPORTED_PAGE", "未找到智能录入挂载点。", "ui");
2437
- const r = it("inline", So(t, n)), o = st(r, !0);
2434
+ const r = ot("inline", vo(t, n)), o = it(r, !0);
2438
2435
  return this.createPanel("inline", r, o).mount(n), this.schedulePreScan(), this;
2439
2436
  }
2440
2437
  /** 挂载右下角悬浮按钮 + 弹框(floating 模式),优先挂到当前子路由页面顶层容器 */
2441
2438
  mountFloatingButton() {
2442
2439
  this.assertAlive();
2443
- const t = uo(this.config), n = it("floating"), r = st(n, !1);
2440
+ const t = lo(this.config), n = ot("floating"), r = it(n, !1);
2444
2441
  return this.createPanel("floating", n, r).mount(t), this.bindFloatingLifecycle(t), this.schedulePreScan(), this;
2445
2442
  }
2446
2443
  /**
@@ -2449,7 +2446,7 @@ class Zr {
2449
2446
  */
2450
2447
  createPanel(t, n, r) {
2451
2448
  let o;
2452
- return o = new Br({
2449
+ return o = new zr({
2453
2450
  mode: t,
2454
2451
  initialOpen: r,
2455
2452
  messages: this.config.messages,
@@ -2462,17 +2459,17 @@ class Zr {
2462
2459
  }
2463
2460
  /** 同步本地优先开关:更新内存态、写入 localStorage,并广播到其他已挂载面板 */
2464
2461
  handleLocalPriorityChange(t, n) {
2465
- this.localPriorityEnabled = t, xo(t);
2462
+ this.localPriorityEnabled = t, Eo(t);
2466
2463
  for (const r of this.panels)
2467
2464
  r !== n && r.setLocalPriorityEnabled(t);
2468
2465
  }
2469
2466
  /** 打开面板并触发 rescan,同时激活当前实例(关闭其他实例面板) */
2470
2467
  async open(t = this.panel) {
2471
- this.assertAlive(), this.syncScanCacheVersion(), t && (this.context.manager.activate(this), this.panel = t, t.setOpen(!0), at(this.panelStorageKeys.get(t), !0), this.scanResult || await this.rescan());
2468
+ this.assertAlive(), this.syncScanCacheVersion(), t && (this.context.manager.activate(this), this.panel = t, t.setOpen(!0), st(this.panelStorageKeys.get(t), !0), this.scanResult || await this.rescan());
2472
2469
  }
2473
2470
  /** 关闭面板(不销毁实例) */
2474
2471
  close(t = this.panel) {
2475
- t && (this.panel = t, t.setOpen(!1), at(this.panelStorageKeys.get(t), !1));
2472
+ t && (this.panel = t, t.setOpen(!1), st(this.panelStorageKeys.get(t), !1));
2476
2473
  }
2477
2474
  /**
2478
2475
  * 扫描页面可回填字段。
@@ -2512,7 +2509,7 @@ class Zr {
2512
2509
  this.destroyed || !this.panels.length || (this.preScanTimer != null && window.clearTimeout(this.preScanTimer), this.preScanTimer = window.setTimeout(() => {
2513
2510
  this.preScanTimer = null, !(this.destroyed || this.scanResult) && this.preScan().catch(() => {
2514
2511
  });
2515
- }, Wr));
2512
+ }, Yr));
2516
2513
  }
2517
2514
  cancelPreScan() {
2518
2515
  this.preScanTimer != null && (window.clearTimeout(this.preScanTimer), this.preScanTimer = null);
@@ -2530,28 +2527,28 @@ class Zr {
2530
2527
  async recognize(t) {
2531
2528
  var i, s, a, c, l, u;
2532
2529
  this.assertAlive(), this.syncScanCacheVersion(), (i = this.panel) == null || i.setBusy(!0, "扫描中..."), (s = this.panel) == null || s.setStatus("扫描中...");
2533
- const n = await this.rescan(), r = be("trace"), o = performance.now();
2530
+ const n = await this.rescan(), r = ye("trace"), o = performance.now();
2534
2531
  this.events.emit("recognizing", { scanToken: n.scanToken, traceId: r }), (a = this.panel) == null || a.setBusy(!0, "识别中...");
2535
2532
  try {
2536
- const h = n.fields.filter((g) => no(g.localRuleMode, this.localPriorityEnabled)), T = n.fields.filter((g) => g.localRuleMode !== "only"), { text: P, usedOcr: Q } = await this.context.client.resolveInputText({
2533
+ const h = n.fields.filter((g) => to(g.localRuleMode, this.localPriorityEnabled)), T = n.fields.filter((g) => g.localRuleMode !== "only"), { text: P, usedOcr: J } = await this.context.client.resolveInputText({
2537
2534
  text: t.text,
2538
2535
  images: t.images,
2539
2536
  onStatusChange: (g) => {
2540
- var te, L, ne;
2537
+ var ee, L, te;
2541
2538
  if (g === "image_uploading") {
2542
- (te = this.panel) == null || te.setStatus("图片上传中...");
2539
+ (ee = this.panel) == null || ee.setStatus("图片上传中...");
2543
2540
  return;
2544
2541
  }
2545
2542
  if (g === "image_recognizing") {
2546
2543
  (L = this.panel) == null || L.setStatus("图片识别中...");
2547
2544
  return;
2548
2545
  }
2549
- (ne = this.panel) == null || ne.setStatus("识别中...");
2546
+ (te = this.panel) == null || te.setStatus("识别中...");
2550
2547
  }
2551
- }), ee = P ? this.ruleEngine.recognize(P, h, n.scanToken) : [];
2548
+ }), Q = P ? this.ruleEngine.recognize(P, h, n.scanToken) : [];
2552
2549
  let v;
2553
2550
  if (!T.length)
2554
- v = nt(n.scanToken, r, ee, o, void 0, Q);
2551
+ v = tt(n.scanToken, r, Q, o, void 0, J);
2555
2552
  else
2556
2553
  try {
2557
2554
  const g = await this.context.client.recognize({
@@ -2559,7 +2556,7 @@ class Zr {
2559
2556
  formCode: this.config.formCode,
2560
2557
  configVersion: this.formConfigVersion,
2561
2558
  text: P,
2562
- usedOcr: Q,
2559
+ usedOcr: J,
2563
2560
  fields: T,
2564
2561
  onStatusChange: () => {
2565
2562
  var L;
@@ -2567,31 +2564,31 @@ class Zr {
2567
2564
  }
2568
2565
  });
2569
2566
  g.trace.durationMs = g.trace.durationMs || Math.round(performance.now() - o);
2570
- const te = to(
2571
- ee,
2572
- g.suggestions.filter((L) => T.some((ne) => ne.fieldId === L.fieldId))
2567
+ const ee = eo(
2568
+ Q,
2569
+ g.suggestions.filter((L) => T.some((te) => te.fieldId === L.fieldId))
2573
2570
  );
2574
- v = { ...g, suggestions: te };
2571
+ v = { ...g, suggestions: ee };
2575
2572
  } catch (g) {
2576
- if (!ee.length)
2573
+ if (!Q.length)
2577
2574
  throw g;
2578
- v = nt(
2575
+ v = tt(
2579
2576
  n.scanToken,
2580
2577
  r,
2581
- ee,
2578
+ Q,
2582
2579
  o,
2583
- [Q ? "后端识别失败,已使用 OCR 文本触发本地识别继续回填。" : "后端识别失败,已启用本地识别继续回填。"],
2584
- Q
2580
+ [J ? "后端识别失败,已使用 OCR 文本触发本地识别继续回填。" : "后端识别失败,已启用本地识别继续回填。"],
2581
+ J
2585
2582
  );
2586
2583
  }
2587
- if (this.autoApplyState = Qr(
2584
+ if (this.autoApplyState = Jr(
2588
2585
  v.scanToken,
2589
2586
  v.trace.traceId,
2590
2587
  v.suggestions,
2591
2588
  n,
2592
2589
  this.registeredFields
2593
2590
  ), this.events.emit("recognized", v), (c = this.panel) == null || c.setAutoApplyState(this.autoApplyState), this.config.apiEnable) {
2594
- const g = Jr(v, this.autoApplyState, n);
2591
+ const g = Zr(v, this.autoApplyState, n);
2595
2592
  this.config.apiCallback && await Promise.resolve(this.config.apiCallback(g)), (l = this.panel) == null || l.setStatus(`识别完成,已返回 ${g.fields.length} 个字段。`);
2596
2593
  } else
2597
2594
  await this.applyAutoItems(this.autoApplyState);
@@ -2612,7 +2609,7 @@ class Zr {
2612
2609
  if (this.assertAlive(), this.syncScanCacheVersion(), !this.scanResult)
2613
2610
  throw b("SCAN_TOKEN_EXPIRED", "请先扫描字段后再回填。", "apply");
2614
2611
  this.events.emit("applying", { scanToken: t.scanToken, count: t.values.length });
2615
- const r = await new Ze(this.scanResult.fields, this.registeredFields, this.adapters).apply(t);
2612
+ const r = await new Xe(this.scanResult.fields, this.registeredFields, this.adapters).apply(t);
2616
2613
  return this.events.emit("applied", r), (o = this.panel) == null || o.setApplyResult(r), r;
2617
2614
  }
2618
2615
  /**
@@ -2623,9 +2620,9 @@ class Zr {
2623
2620
  var a, c;
2624
2621
  if (!this.scanResult)
2625
2622
  throw b("SCAN_TOKEN_EXPIRED", "请先扫描字段后再回填。", "apply");
2626
- const n = eo(t), r = t.items.filter((l) => Vt(l)).map((l) => ({ fieldId: l.fieldId, value: l.value, source: l.source }));
2623
+ const n = Qr(t), r = t.items.filter((l) => Vt(l)).map((l) => ({ fieldId: l.fieldId, value: l.value, source: l.source }));
2627
2624
  this.events.emit("applying", { scanToken: t.scanToken, count: r.length }), (a = this.panel) == null || a.setStatus("识别完成,正在自动回填...");
2628
- const i = await new Ze(this.scanResult.fields, this.registeredFields, this.adapters).apply({ scanToken: t.scanToken, values: r }), s = {
2625
+ const i = await new Xe(this.scanResult.fields, this.registeredFields, this.adapters).apply({ scanToken: t.scanToken, values: r }), s = {
2629
2626
  ...i,
2630
2627
  skipped: [...n, ...i.skipped],
2631
2628
  warnings: [
@@ -2649,7 +2646,7 @@ class Zr {
2649
2646
  }
2650
2647
  emitError(t, n) {
2651
2648
  var o;
2652
- const r = Xe(t, n);
2649
+ const r = We(t, n);
2653
2650
  this.events.emit("error", r), (o = this.panel) == null || o.setError(r.message);
2654
2651
  }
2655
2652
  getCachedPageScanResult(t) {
@@ -2657,7 +2654,7 @@ class Zr {
2657
2654
  if (!n) return null;
2658
2655
  const r = H.get(n);
2659
2656
  if (r && (!t || r.dynamicOptionsReady)) {
2660
- const i = oo(r.scanResult);
2657
+ const i = ro(r.scanResult);
2661
2658
  if (!i)
2662
2659
  H.delete(n);
2663
2660
  else
@@ -2676,13 +2673,13 @@ class Zr {
2676
2673
  }), this.persistPageScanResult(t, (o == null ? void 0 : o.dynamicOptionsReady) || n));
2677
2674
  }
2678
2675
  getPageScanCacheKey() {
2679
- return this.registeredFields.length ? null : ao(this.config);
2676
+ return this.registeredFields.length ? null : so(this.config);
2680
2677
  }
2681
2678
  getSessionPageScanCacheKey() {
2682
- return this.registeredFields.length || !this.config.formCode ? null : co(this.config);
2679
+ return this.registeredFields.length || !this.config.formCode ? null : ao(this.config);
2683
2680
  }
2684
2681
  clearScanStateOnTokenExpired(t) {
2685
- Xe(t, "recognize").code === "TOKEN_EXPIRED" && (Nt(), this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
2682
+ We(t, "recognize").code === "TOKEN_EXPIRED" && (Nt(), this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
2686
2683
  }
2687
2684
  syncScanCacheVersion() {
2688
2685
  this.scanCacheVersion !== $ && (this.scanCacheVersion = $, this.scanResult = null, this.autoApplyState = null);
@@ -2690,9 +2687,9 @@ class Zr {
2690
2687
  getPersistedPageScanResult(t) {
2691
2688
  const n = this.getSessionPageScanCacheKey();
2692
2689
  if (!n) return null;
2693
- const r = wo(n);
2690
+ const r = mo(n);
2694
2691
  if (!r || t && !r.dynamicOptionsReady) return null;
2695
- const o = this.scanner.scan({ maxFields: this.config.maxFields }), i = io(r, o);
2692
+ const o = this.scanner.scan({ maxFields: this.config.maxFields }), i = oo(r, o);
2696
2693
  return i ? {
2697
2694
  scanResult: i,
2698
2695
  dynamicOptionsReady: r.dynamicOptionsReady
@@ -2700,16 +2697,16 @@ class Zr {
2700
2697
  }
2701
2698
  persistPageScanResult(t, n) {
2702
2699
  const r = this.getSessionPageScanCacheKey();
2703
- !r || !t.fields.length || vo(r, {
2700
+ !r || !t.fields.length || wo(r, {
2704
2701
  version: 1,
2705
2702
  dynamicOptionsReady: n,
2706
2703
  fields: t.fields.map(({ element: o, scanToken: i, ...s }) => s)
2707
2704
  });
2708
2705
  }
2709
2706
  bindFloatingLifecycle(t) {
2710
- this.clearFloatingLifecycle(), this.floatingRouteSnapshot = ot(), lo();
2707
+ this.clearFloatingLifecycle(), this.floatingRouteSnapshot = rt(), co();
2711
2708
  const n = () => {
2712
- this.destroyed || ot() !== this.floatingRouteSnapshot && this.destroy();
2709
+ this.destroyed || rt() !== this.floatingRouteSnapshot && this.destroy();
2713
2710
  };
2714
2711
  window.addEventListener(Pe, n);
2715
2712
  const r = new MutationObserver(() => {
@@ -2724,7 +2721,7 @@ class Zr {
2724
2721
  (t = this.floatingLifecycleCleanup) == null || t.call(this);
2725
2722
  }
2726
2723
  }
2727
- function Jr(e, t, n) {
2724
+ function Zr(e, t, n) {
2728
2725
  return {
2729
2726
  scanToken: e.scanToken,
2730
2727
  trace: e.trace,
@@ -2745,12 +2742,12 @@ function Jr(e, t, n) {
2745
2742
  })
2746
2743
  };
2747
2744
  }
2748
- function Qr(e, t, n, r, o) {
2745
+ function Jr(e, t, n, r, o) {
2749
2746
  return {
2750
2747
  scanToken: e,
2751
2748
  traceId: t,
2752
2749
  items: n.map((i) => {
2753
- const s = r.fields.find((l) => l.fieldId === i.fieldId), a = o.find((l) => l.fieldId === i.fieldId), c = a != null && a.getValue ? a.getValue() : ro(s == null ? void 0 : s.element);
2750
+ const s = r.fields.find((l) => l.fieldId === i.fieldId), a = o.find((l) => l.fieldId === i.fieldId), c = a != null && a.getValue ? a.getValue() : no(s == null ? void 0 : s.element);
2754
2751
  return {
2755
2752
  applyItemId: `${i.fieldId}_${Math.random().toString(36).slice(2, 8)}`,
2756
2753
  fieldId: i.fieldId,
@@ -2770,9 +2767,9 @@ function Qr(e, t, n, r, o) {
2770
2767
  }
2771
2768
  function Vt(e) {
2772
2769
  var t;
2773
- return e.confidence >= Yr && !((t = e.warnings) != null && t.length);
2770
+ return e.confidence >= Gr && !((t = e.warnings) != null && t.length);
2774
2771
  }
2775
- function eo(e) {
2772
+ function Qr(e) {
2776
2773
  return e.items.filter((t) => !Vt(t)).map((t) => {
2777
2774
  var n, r;
2778
2775
  return {
@@ -2784,7 +2781,7 @@ function eo(e) {
2784
2781
  };
2785
2782
  });
2786
2783
  }
2787
- function to(e, t) {
2784
+ function eo(e, t) {
2788
2785
  const n = /* @__PURE__ */ new Map();
2789
2786
  for (const r of t)
2790
2787
  n.set(r.fieldId, r);
@@ -2792,10 +2789,10 @@ function to(e, t) {
2792
2789
  n.has(r.fieldId) || n.set(r.fieldId, r);
2793
2790
  return [...n.values()];
2794
2791
  }
2795
- function no(e, t) {
2792
+ function to(e, t) {
2796
2793
  return e === "only" ? !0 : e === "off" ? !1 : t;
2797
2794
  }
2798
- function nt(e, t, n, r, o, i = !1) {
2795
+ function tt(e, t, n, r, o, i = !1) {
2799
2796
  return {
2800
2797
  scanToken: e,
2801
2798
  suggestions: n,
@@ -2808,15 +2805,15 @@ function nt(e, t, n, r, o, i = !1) {
2808
2805
  }
2809
2806
  };
2810
2807
  }
2811
- function ro(e) {
2808
+ function no(e) {
2812
2809
  if (e)
2813
2810
  return e instanceof HTMLInputElement && e.type === "checkbox" ? e.checked : e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? e.value : e.textContent;
2814
2811
  }
2815
- function oo(e) {
2812
+ function ro(e) {
2816
2813
  const t = e.fields.map((n) => {
2817
2814
  if (n.source === "registered")
2818
2815
  return n;
2819
- const r = so(n);
2816
+ const r = io(n);
2820
2817
  return r ? { ...n, element: r } : null;
2821
2818
  });
2822
2819
  return t.some((n) => !n) ? null : {
@@ -2824,7 +2821,7 @@ function oo(e) {
2824
2821
  fields: t
2825
2822
  };
2826
2823
  }
2827
- function io(e, t) {
2824
+ function oo(e, t) {
2828
2825
  var s, a;
2829
2826
  const n = new Map(t.fields.map((c) => [c.fieldId, c])), r = [], o = /* @__PURE__ */ new Set();
2830
2827
  for (const c of e.fields) {
@@ -2856,74 +2853,74 @@ function io(e, t) {
2856
2853
  fields: [...r, ...i]
2857
2854
  };
2858
2855
  }
2859
- function so(e) {
2856
+ function io(e) {
2860
2857
  var t;
2861
2858
  if ((t = e.element) != null && t.isConnected) return e.element;
2862
2859
  try {
2863
- return document.querySelector(`[data-smart-fill-id="${ko(e.fieldId)}"]`);
2860
+ return document.querySelector(`[data-smart-fill-id="${xo(e.fieldId)}"]`);
2864
2861
  } catch {
2865
2862
  return null;
2866
2863
  }
2867
2864
  }
2868
- function ao(e) {
2865
+ function so(e) {
2869
2866
  const t = typeof location < "u" ? `${location.origin}${location.pathname}${location.search}` : "unknown-page", n = Kt(e.root || document);
2870
2867
  return `smart-fill:${t}:${e.formCode || "default-form"}:${n}:${e.maxFields ?? 200}:scan`;
2871
2868
  }
2872
- function co(e) {
2869
+ function ao(e) {
2873
2870
  const t = Kt(e.root || document);
2874
2871
  return `${$t}${e.formCode || "default-form"}:${t}:${e.maxFields ?? 200}`;
2875
2872
  }
2876
2873
  function Kt(e) {
2877
2874
  if (e === document) return "document";
2878
- const t = tt.get(e);
2875
+ const t = et.get(e);
2879
2876
  if (t) return t;
2880
- const n = e instanceof HTMLElement && e.id ? `el:${e.id}` : `root:${++Xr}`;
2881
- return tt.set(e, n), n;
2877
+ const n = e instanceof HTMLElement && e.id ? `el:${e.id}` : `root:${++Wr}`;
2878
+ return et.set(e, n), n;
2882
2879
  }
2883
- function lo() {
2884
- if (et || typeof window > "u") return;
2885
- et = !0;
2880
+ function co() {
2881
+ if (Qe || typeof window > "u") return;
2882
+ Qe = !0;
2886
2883
  const e = () => {
2887
2884
  window.dispatchEvent(new Event(Pe));
2888
2885
  };
2889
- window.addEventListener("popstate", e), window.addEventListener("hashchange", e), rt("pushState", e), rt("replaceState", e);
2886
+ window.addEventListener("popstate", e), window.addEventListener("hashchange", e), nt("pushState", e), nt("replaceState", e);
2890
2887
  }
2891
- function rt(e, t) {
2888
+ function nt(e, t) {
2892
2889
  const n = window.history[e];
2893
2890
  window.history[e] = function(...o) {
2894
2891
  const i = n.apply(this, o);
2895
2892
  return t(), i;
2896
2893
  };
2897
2894
  }
2898
- function ot() {
2895
+ function rt() {
2899
2896
  return typeof location > "u" ? "unknown-route" : `${location.pathname}${location.search}${location.hash}`;
2900
2897
  }
2901
- function uo(e) {
2902
- const t = po(e.floatingContainer);
2898
+ function lo(e) {
2899
+ const t = uo(e.floatingContainer);
2903
2900
  if (t)
2904
2901
  return t;
2905
- const n = fo(e.routeContainerSelector);
2906
- return n || ho() || document.body;
2902
+ const n = po(e.routeContainerSelector);
2903
+ return n || fo() || document.body;
2907
2904
  }
2908
- function po(e) {
2905
+ function uo(e) {
2909
2906
  return e ? e instanceof HTMLElement ? e : He(e) : null;
2910
2907
  }
2911
- function fo(e) {
2908
+ function po(e) {
2912
2909
  if (!e) return null;
2913
2910
  const t = zt(), n = t ? He(e, t) : null;
2914
2911
  return n || He(e);
2915
2912
  }
2916
- function ho() {
2913
+ function fo() {
2917
2914
  const e = zt();
2918
2915
  if (!e)
2919
2916
  return null;
2920
- const t = go(e);
2917
+ const t = ho(e);
2921
2918
  if (t)
2922
2919
  return t;
2923
- const n = yo(e);
2920
+ const n = go(e);
2924
2921
  if (n)
2925
2922
  return n;
2926
- const r = bo(e);
2923
+ const r = yo(e);
2927
2924
  return r !== e ? r : null;
2928
2925
  }
2929
2926
  function zt() {
@@ -2940,16 +2937,16 @@ function zt() {
2940
2937
  ];
2941
2938
  for (const t of e) {
2942
2939
  const n = document.querySelector(t);
2943
- if (n && ve(n))
2940
+ if (n && we(n))
2944
2941
  return n;
2945
2942
  }
2946
2943
  return null;
2947
2944
  }
2948
- function go(e) {
2949
- const t = m(e), n = Bt(e).filter((o) => !ze(o)).filter((o) => m(o) >= Math.max(t * 0.2, 48e3)), r = n.filter((o) => mo(o));
2945
+ function ho(e) {
2946
+ const t = m(e), n = Bt(e).filter((o) => !Ke(o)).filter((o) => m(o) >= Math.max(t * 0.2, 48e3)), r = n.filter((o) => bo(o));
2950
2947
  return r.length ? r.sort((o, i) => m(i) - m(o))[0] : n.length === 1 ? n[0] : null;
2951
2948
  }
2952
- function yo(e) {
2949
+ function go(e) {
2953
2950
  const t = [
2954
2951
  "[data-route-root]",
2955
2952
  "[data-router-view]",
@@ -2966,12 +2963,12 @@ function yo(e) {
2966
2963
  "main",
2967
2964
  '[role="main"]'
2968
2965
  ], n = Ut(e), r = m(e);
2969
- return t.flatMap((i) => Array.from(e.querySelectorAll(i))).filter((i) => ve(i) && !ze(i)).filter((i) => Ae(i, n) <= 3).filter((i) => m(i) >= Math.max(r * 0.2, 48e3)).sort((i, s) => Ae(i, n) - Ae(s, n) || m(s) - m(i))[0] || null;
2966
+ return t.flatMap((i) => Array.from(e.querySelectorAll(i))).filter((i) => we(i) && !Ke(i)).filter((i) => Ce(i, n) <= 3).filter((i) => m(i) >= Math.max(r * 0.2, 48e3)).sort((i, s) => Ce(i, n) - Ce(s, n) || m(s) - m(i))[0] || null;
2970
2967
  }
2971
- function bo(e) {
2968
+ function yo(e) {
2972
2969
  let t = e;
2973
2970
  for (; ; ) {
2974
- const n = Bt(t).filter((o) => !ze(o));
2971
+ const n = Bt(t).filter((o) => !Ke(o));
2975
2972
  if (n.length !== 1)
2976
2973
  return t;
2977
2974
  const [r] = n;
@@ -2981,28 +2978,28 @@ function bo(e) {
2981
2978
  }
2982
2979
  }
2983
2980
  function Bt(e) {
2984
- return Array.from(e.children).filter((t) => t instanceof HTMLElement).filter((t) => ve(t));
2981
+ return Array.from(e.children).filter((t) => t instanceof HTMLElement).filter((t) => we(t));
2985
2982
  }
2986
2983
  function He(e, t = document) {
2987
2984
  try {
2988
2985
  const n = t.querySelector(e);
2989
- return n && ve(n) ? n : null;
2986
+ return n && we(n) ? n : null;
2990
2987
  } catch {
2991
2988
  return null;
2992
2989
  }
2993
2990
  }
2994
- function ve(e) {
2991
+ function we(e) {
2995
2992
  const t = window.getComputedStyle(e);
2996
2993
  if (t.display === "none" || t.visibility === "hidden" || Number(t.opacity) === 0)
2997
2994
  return !1;
2998
2995
  const n = e.getBoundingClientRect();
2999
2996
  return n.width > 0 && n.height > 0;
3000
2997
  }
3001
- function ze(e) {
2998
+ function Ke(e) {
3002
2999
  const t = window.getComputedStyle(e);
3003
3000
  return t.position === "fixed" || t.position === "sticky" ? !0 : m(e) < 24e3;
3004
3001
  }
3005
- function mo(e) {
3002
+ function bo(e) {
3006
3003
  if (e.tagName.toLowerCase() === "main" || e.getAttribute("role") === "main")
3007
3004
  return !0;
3008
3005
  const t = e.id || "", n = typeof e.className == "string" ? e.className : "", r = `${t} ${n}`.toLowerCase();
@@ -3018,10 +3015,10 @@ function Ut(e) {
3018
3015
  t += 1, n = n.parentElement;
3019
3016
  return t;
3020
3017
  }
3021
- function Ae(e, t) {
3018
+ function Ce(e, t) {
3022
3019
  return Math.max(0, Ut(e) - t);
3023
3020
  }
3024
- function wo(e) {
3021
+ function mo(e) {
3025
3022
  try {
3026
3023
  const t = window.sessionStorage.getItem(e);
3027
3024
  if (!t) return null;
@@ -3031,7 +3028,7 @@ function wo(e) {
3031
3028
  return null;
3032
3029
  }
3033
3030
  }
3034
- function vo(e, t) {
3031
+ function wo(e, t) {
3035
3032
  try {
3036
3033
  window.sessionStorage.setItem(e, JSON.stringify(t));
3037
3034
  } catch {
@@ -3053,17 +3050,17 @@ function jt(e) {
3053
3050
  } catch {
3054
3051
  }
3055
3052
  }
3056
- function it(e, t = "default") {
3053
+ function ot(e, t = "default") {
3057
3054
  const n = typeof location < "u" ? location.pathname : "unknown-page", r = t.replace(/[^\w-]/g, "_") || "default";
3058
3055
  return `smart-fill:${e}:${n}:${r}:open`;
3059
3056
  }
3060
- function So(e, t) {
3057
+ function vo(e, t) {
3061
3058
  if (typeof e == "string") return e;
3062
3059
  if (t.id) return `#${t.id}`;
3063
3060
  const n = typeof t.className == "string" ? t.className.trim().split(/\s+/).filter(Boolean)[0] : "";
3064
3061
  return n ? `.${n}` : t.tagName.toLowerCase();
3065
3062
  }
3066
- function st(e, t) {
3063
+ function it(e, t) {
3067
3064
  try {
3068
3065
  const n = window.localStorage.getItem(e);
3069
3066
  return n == null ? t : n === "1";
@@ -3071,7 +3068,7 @@ function st(e, t) {
3071
3068
  return t;
3072
3069
  }
3073
3070
  }
3074
- function at(e, t) {
3071
+ function st(e, t) {
3075
3072
  if (e)
3076
3073
  try {
3077
3074
  window.localStorage.setItem(e, t ? "1" : "0");
@@ -3081,35 +3078,35 @@ function at(e, t) {
3081
3078
  function Gt() {
3082
3079
  return `smart-fill:${typeof location < "u" ? location.pathname : "unknown-page"}:local-priority`;
3083
3080
  }
3084
- function Eo() {
3081
+ function So() {
3085
3082
  try {
3086
3083
  return window.localStorage.getItem(Gt()) === "1";
3087
3084
  } catch {
3088
3085
  return !1;
3089
3086
  }
3090
3087
  }
3091
- function xo(e) {
3088
+ function Eo(e) {
3092
3089
  try {
3093
3090
  window.localStorage.setItem(Gt(), e ? "1" : "0");
3094
3091
  } catch {
3095
3092
  }
3096
3093
  }
3097
- function ko(e) {
3094
+ function xo(e) {
3098
3095
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
3099
3096
  }
3100
- const f = { status: "idle" }, Te = new Rt(), ct = new lr();
3101
- class _o {
3097
+ const f = { status: "idle" }, Ae = new Rt(), at = new cr();
3098
+ class ko {
3102
3099
  /** 初始化 SDK:校验 apiKey、创建会话、获取 accessToken */
3103
3100
  static async setup(t) {
3104
3101
  if (typeof window > "u")
3105
- return f.status = "ready", Co();
3102
+ return f.status = "ready", _o();
3106
3103
  if (f.status === "ready" && f.apiKey === t.apiKey && f.session)
3107
3104
  return f.session;
3108
3105
  if (f.status === "loading" && f.apiKey === t.apiKey && f.promise)
3109
3106
  return f.promise;
3110
- f.apiKey && f.apiKey !== t.apiKey && (Nt(), ct.destroyAll());
3111
- const n = new rr(t);
3112
- return f.status = "loading", f.apiKey = t.apiKey, f.client = n, f.promise = n.createSession().then((r) => (console.log("SmartFill session created:", r), n.setAccessToken(r.apiKey), f.status = "ready", f.session = r, Te.emit("ready", { apiKey: t.apiKey }), r)).catch((r) => {
3107
+ f.apiKey && f.apiKey !== t.apiKey && (Nt(), at.destroyAll());
3108
+ const n = new nr(t);
3109
+ return f.status = "loading", f.apiKey = t.apiKey, f.client = n, f.promise = n.createSession().then((r) => (console.log("SmartFill session created:", r), n.setAccessToken(r.apiKey), f.status = "ready", f.session = r, Ae.emit("ready", { apiKey: t.apiKey }), r)).catch((r) => {
3113
3110
  throw f.status = "error", r;
3114
3111
  }), f.promise;
3115
3112
  }
@@ -3119,15 +3116,15 @@ class _o {
3119
3116
  return N();
3120
3117
  if (f.status !== "ready" || !f.client)
3121
3118
  throw b("SDK_NOT_READY", "请先 await SmartFill.setup({ apiKey })。", "setup");
3122
- return new Zr(t, {
3119
+ return new Xr(t, {
3123
3120
  client: f.client,
3124
- manager: ct
3121
+ manager: at
3125
3122
  });
3126
3123
  }
3127
3124
  }
3128
3125
  /** 订阅全局事件(目前仅 ready) */
3129
- d(_o, "on", Te.on.bind(Te));
3130
- function Co() {
3126
+ d(ko, "on", Ae.on.bind(Ae));
3127
+ function _o() {
3131
3128
  return {
3132
3129
  apiKey: "server-mock",
3133
3130
  accessToken: "server-mock",
@@ -3164,14 +3161,14 @@ function N(e) {
3164
3161
  };
3165
3162
  }
3166
3163
  export {
3167
- nr as DEFAULT_BASE_URL,
3168
- Ze as DomFiller,
3169
- Mr as DomScanner,
3170
- Lo as ElementAdapter,
3164
+ tr as DEFAULT_BASE_URL,
3165
+ Xe as DomFiller,
3166
+ Ir as DomScanner,
3167
+ To as ElementAdapter,
3171
3168
  Rt as EventBus,
3172
- wr as LocalRuleEngine,
3173
- To as NativeAdapter,
3174
- _o as SmartFill,
3175
- Zr as SmartFillInstance,
3169
+ mr as LocalRuleEngine,
3170
+ Ao as NativeAdapter,
3171
+ ko as SmartFill,
3172
+ Xr as SmartFillInstance,
3176
3173
  It as UiFrameworkAdapter
3177
3174
  };