@skillbuilder/miniapp-simulator 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -3,15 +3,14 @@ var tr = (r) => {
3
3
  };
4
4
  var dt = (r, e, t) => e.has(r) || tr("Cannot " + t);
5
5
  var A = (r, e, t) => (dt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), S = (r, e, t) => e.has(r) ? tr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), V = (r, e, t, n) => (dt(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t), T = (r, e, t) => (dt(r, e, "access private method"), t);
6
- import { a as rr, M as v, b as E, i as Gn, d as Hn, e as Qn, f as zn, g as jn, v as Jn } from "./index-B5oixYXr.mjs";
7
- import { M as he } from "./business-line-CMb3ehRn.mjs";
8
- import { B as ld } from "./business-line-CMb3ehRn.mjs";
9
- const _n = "minitool-worker-runtime", $n = "0.1.0", es = 1, ts = "default-src 'none'; script-src 'none'; connect-src 'none'; worker-src 'none'; child-src 'none'", Mt = {
10
- name: _n,
11
- version: $n,
12
- protocolVersion: es,
13
- workerCsp: ts
14
- }, rs = Mt, ns = Mt.protocolVersion, $c = Mt.workerCsp, b = {
6
+ import { a as rr, M as v, b as E, i as Gn, d as Hn, e as Qn, f as zn, g as Jn, v as jn } from "./index-D5AYVv8s.mjs";
7
+ import { B as _n, M as he } from "./options-B34ipLmF.mjs";
8
+ const $n = "minitool-worker-runtime", es = "0.1.0", ts = 1, rs = "default-src 'none'; script-src 'none'; connect-src 'none'; worker-src 'none'; child-src 'none'", Mt = {
9
+ name: $n,
10
+ version: es,
11
+ protocolVersion: ts,
12
+ workerCsp: rs
13
+ }, ns = Mt, ss = Mt.protocolVersion, od = Mt.workerCsp, b = {
15
14
  /** 相机:getUserMedia({ video: true });seal 不直接拦截,由宿主层控制。 */
16
15
  Camera: "camera",
17
16
  /** 麦克风:getUserMedia({ audio: true });seal 不直接拦截,由宿主层控制。 */
@@ -62,7 +61,7 @@ const _n = "minitool-worker-runtime", $n = "0.1.0", es = 1, ts = "default-src 'n
62
61
  WindowOpen: "window-open",
63
62
  /** 系统输入对话框:window.prompt。 */
64
63
  WindowPrompt: "window-prompt"
65
- }, ss = "__MINI_APP_SEAL_CONFIG__", jr = [
64
+ }, is = "__MINI_APP_SEAL_CONFIG__", Jr = [
66
65
  b.Camera,
67
66
  b.Microphone,
68
67
  b.PhotoLibrary
@@ -219,15 +218,15 @@ const ct = [
219
218
  description: "系统输入对话框:window.prompt",
220
219
  permissionNames: []
221
220
  }
222
- ], Jr = ct.map((r) => r.value), ed = ct.filter((r) => r.controlledBy === "seal").map((r) => r.value), td = ct.filter((r) => r.controlledBy === "host").map((r) => r.value), is = new Set(Jr);
223
- function os(r) {
224
- return typeof r == "string" && is.has(r);
221
+ ], jr = ct.map((r) => r.value), ad = ct.filter((r) => r.controlledBy === "seal").map((r) => r.value), ld = ct.filter((r) => r.controlledBy === "host").map((r) => r.value), os = new Set(jr);
222
+ function as(r) {
223
+ return typeof r == "string" && os.has(r);
225
224
  }
226
- function rd(r) {
225
+ function cd(r) {
227
226
  if (!Array.isArray(r)) return [];
228
227
  const e = [], t = /* @__PURE__ */ new Set();
229
228
  for (const n of r)
230
- os(n) && !t.has(n) && (t.add(n), e.push(n));
229
+ as(n) && !t.has(n) && (t.add(n), e.push(n));
231
230
  return e;
232
231
  }
233
232
  function _e(r) {
@@ -237,25 +236,25 @@ function _e(r) {
237
236
  function _r(r) {
238
237
  return Object.entries(r).filter(([, e]) => e).map(([e]) => e);
239
238
  }
240
- function as(r) {
239
+ function ls(r) {
241
240
  return _r(r).join(" ");
242
241
  }
243
- function ls(r) {
242
+ function cs(r) {
244
243
  return r === "*" ? "*" : r === "self" ? "'self'" : r;
245
244
  }
246
- function cs(r) {
245
+ function ds(r) {
247
246
  const e = [];
248
247
  for (const [t, n] of Object.entries(r)) {
249
248
  if (n === !1) continue;
250
- const i = (n === !0 ? ["*"] : Array.isArray(n) ? n : [n]).map(ls).filter(Boolean).join(" ");
249
+ const i = (n === !0 ? ["*"] : Array.isArray(n) ? n : [n]).map(cs).filter(Boolean).join(" ");
251
250
  e.push(i ? `${t} ${i}` : t);
252
251
  }
253
252
  return e.join("; ");
254
253
  }
255
- function ds(r) {
254
+ function us(r) {
256
255
  return r === "self" ? "self" : `"${r}"`;
257
256
  }
258
- function us(r) {
257
+ function As(r) {
259
258
  const e = [];
260
259
  for (const [t, n] of Object.entries(r)) {
261
260
  if (n === !0) {
@@ -271,18 +270,18 @@ function us(r) {
271
270
  e.push(`${t}=*`);
272
271
  continue;
273
272
  }
274
- const i = s.map(ds).join(" ");
273
+ const i = s.map(us).join(" ");
275
274
  e.push(`${t}=(${i})`);
276
275
  }
277
276
  return e.join(", ");
278
277
  }
279
- class I extends Error {
278
+ class W extends Error {
280
279
  constructor(e, t, n) {
281
280
  super(t), this.name = "MiniAppSimulatorError", this.code = e, this.url = n?.url, this.cause = n?.cause;
282
281
  }
283
282
  }
284
283
  function nr(r, e) {
285
- return r instanceof I ? r : r instanceof Error ? new I(e, r.message, { cause: r }) : new I(e, String(r), { cause: r });
284
+ return r instanceof W ? r : r instanceof Error ? new W(e, r.message, { cause: r }) : new W(e, String(r), { cause: r });
286
285
  }
287
286
  class $r {
288
287
  constructor() {
@@ -337,7 +336,7 @@ function Zt(r) {
337
336
  function Ut(r) {
338
337
  r.style.userSelect = "none", r.style.webkitUserSelect = "none";
339
338
  }
340
- const As = "miniapp-simulator-host", en = "dms-bounds", hs = "dms-stage", ps = `
339
+ const hs = "miniapp-simulator-host", en = "dms-bounds", ps = "dms-stage", fs = `
341
340
  :host {
342
341
  display: block;
343
342
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
@@ -363,25 +362,25 @@ img, a, svg {
363
362
  overflow: hidden;
364
363
  }
365
364
  `;
366
- function fs(r) {
365
+ function gs(r) {
367
366
  if (typeof r != "string") return r;
368
367
  const e = document.querySelector(r);
369
368
  if (!e)
370
369
  throw new Error(`Mini app simulator mount target not found: ${r}`);
371
370
  return e;
372
371
  }
373
- function gs(r, e = {}) {
372
+ function ms(r, e = {}) {
374
373
  const t = e.shadow ?? !0, n = getComputedStyle(r).position === "static", s = r.style.position;
375
374
  n && (r.style.position = "relative");
376
375
  const i = document.createElement("div");
377
- i.className = As, i.style.position = "absolute", i.style.inset = "0", Ut(i);
376
+ i.className = hs, i.style.position = "absolute", i.style.inset = "0", Ut(i);
378
377
  const o = Zt(i);
379
378
  r.appendChild(i);
380
379
  let a = null, l = i;
381
380
  if (t) {
382
381
  a = i.attachShadow({ mode: "open" });
383
382
  const h = document.createElement("style");
384
- h.textContent = ps, a.appendChild(h), l = a;
383
+ h.textContent = fs, a.appendChild(h), l = a;
385
384
  }
386
385
  const c = document.createElement("div");
387
386
  c.className = en, t || Object.assign(c.style, {
@@ -390,7 +389,7 @@ function gs(r, e = {}) {
390
389
  overflow: "hidden"
391
390
  }), l.appendChild(c);
392
391
  const d = document.createElement("div");
393
- return d.className = hs, c.appendChild(d), {
392
+ return d.className = ps, c.appendChild(d), {
394
393
  root: r,
395
394
  host: i,
396
395
  shadowRoot: a,
@@ -402,7 +401,7 @@ function gs(r, e = {}) {
402
401
  }
403
402
  };
404
403
  }
405
- class ms {
404
+ class bs {
406
405
  constructor() {
407
406
  this.modules = /* @__PURE__ */ new Map(), this.order = [];
408
407
  }
@@ -436,7 +435,7 @@ const xt = "[mini-app-sdk]";
436
435
  function tn(r) {
437
436
  return r.startsWith(xt) ? { message: r.slice(xt.length).replace(/^\s+/, ""), source: "sdk" } : { message: r, source: "user" };
438
437
  }
439
- async function bs(r, e) {
438
+ async function vs(r, e) {
440
439
  const t = [], n = [];
441
440
  for (const o of r.list()) {
442
441
  if (o.buildHeadSnippet) {
@@ -445,14 +444,14 @@ async function bs(r, e) {
445
444
  }
446
445
  if (o.buildHeadScriptSource) {
447
446
  const a = await o.buildHeadScriptSource(e);
448
- a && n.push(ws(o.id, a));
447
+ a && n.push(Cs(o.id, a));
449
448
  }
450
449
  }
451
- const s = e.scriptNonce ? ` nonce="${e.scriptNonce}"` : "", i = n.length ? `<script${s}>${ys(n.join(`
450
+ const s = e.scriptNonce ? ` nonce="${e.scriptNonce}"` : "", i = n.length ? `<script${s}>${ws(n.join(`
452
451
  `))}<\/script>` : "";
453
452
  return t.join("") + i;
454
453
  }
455
- const vs = `var __miniAppSdkConsole = (function(){
454
+ const ys = `var __miniAppSdkConsole = (function(){
456
455
  var mark = ${JSON.stringify(`${xt} `)};
457
456
  var levels = ["log","info","warn","error","debug"];
458
457
  var overrides = {};
@@ -473,20 +472,20 @@ const vs = `var __miniAppSdkConsole = (function(){
473
472
  }
474
473
  });
475
474
  })();`;
476
- function ys(r) {
475
+ function ws(r) {
477
476
  return `(function(){
478
- ${vs}
477
+ ${ys}
479
478
  (function(console){
480
479
  ${r}
481
480
  })(__miniAppSdkConsole);
482
481
  })();`;
483
482
  }
484
- function ws(r, e) {
483
+ function Cs(r, e) {
485
484
  return `try {
486
485
  ${e}
487
486
  } catch (e) { console.error("${r} injection failed", e); }`;
488
487
  }
489
- const Be = 24, rn = 22, ut = 1.55, Cs = "0px 4.8px 7.2px 0px rgba(0, 0, 0, 0.15)", Ss = {
488
+ const Be = 24, rn = 22, ut = 1.55, Ss = "0px 4.8px 7.2px 0px rgba(0, 0, 0, 0.15)", Es = {
490
489
  // 默认态:白色玻璃质感(浅色描边 + 半透明白填充)
491
490
  idle: {
492
491
  width: Be,
@@ -506,7 +505,7 @@ const Be = 24, rn = 22, ut = 1.55, Cs = "0px 4.8px 7.2px 0px rgba(0, 0, 0, 0.15)
506
505
  background: "rgba(255, 255, 255, 0.85)"
507
506
  }
508
507
  };
509
- class Es {
508
+ class xs {
510
509
  constructor(e) {
511
510
  this.destroyed = !1, this.suppressed = !1, this.visible = !1, this.pressed = !1, this.hot = !1, this.hostX = 0, this.hostY = 0, this.rafId = 0, this.tickHot = () => {
512
511
  if (this.rafId = 0, this.destroyed || !this.readCursor) return;
@@ -540,7 +539,7 @@ class Es {
540
539
  width: `${Be}px`,
541
540
  height: `${Be}px`,
542
541
  borderRadius: "50%",
543
- boxShadow: Cs,
542
+ boxShadow: Ss,
544
543
  pointerEvents: "none",
545
544
  userSelect: "none",
546
545
  zIndex: "99999",
@@ -565,7 +564,7 @@ class Es {
565
564
  return t.includes(this.region) || t.includes(this.overlay) || t.includes(this.element);
566
565
  }
567
566
  applyMode(e) {
568
- const t = Ss[e];
567
+ const t = Es[e];
569
568
  this.dot.style.width = `${t.width}px`, this.dot.style.height = `${t.width}px`, this.dot.style.border = t.border, this.dot.style.background = t.background;
570
569
  }
571
570
  place() {
@@ -644,7 +643,7 @@ class nn {
644
643
  this.channel.focusGuest();
645
644
  } catch {
646
645
  }
647
- }, this.element = e.element, this.channel = e.channel, this.mountTarget = e.mountTarget, this.hoverTrackTarget = e.hoverTrackTarget ?? e.mountTarget, this.hoverEnterTarget = e.hoverEnterTarget ?? null, this.debug = e.debug ?? !1, this.overlay = document.createElement("div"), this.overlay.style.position = "absolute", this.overlay.style.inset = "0", this.overlay.style.cursor = "default", this.overlay.style.zIndex = "2", this.overlay.style.userSelect = "none", this.mountTarget.appendChild(this.overlay), this.overlay.addEventListener("mousedown", this.onMouseDown), this.overlay.addEventListener("wheel", this.onWheel, { passive: !1 }), window.addEventListener("mouseup", this.onMouseUp, !0), window.addEventListener("blur", this.onWindowBlur), this.unsubscribeChannel = this.channel.subscribe(this.onGuestInbound), this.touchCursor = new Es({
646
+ }, this.element = e.element, this.channel = e.channel, this.mountTarget = e.mountTarget, this.hoverTrackTarget = e.hoverTrackTarget ?? e.mountTarget, this.hoverEnterTarget = e.hoverEnterTarget ?? null, this.debug = e.debug ?? !1, this.overlay = document.createElement("div"), this.overlay.style.position = "absolute", this.overlay.style.inset = "0", this.overlay.style.cursor = "default", this.overlay.style.zIndex = "2", this.overlay.style.userSelect = "none", this.mountTarget.appendChild(this.overlay), this.overlay.addEventListener("mousedown", this.onMouseDown), this.overlay.addEventListener("wheel", this.onWheel, { passive: !1 }), window.addEventListener("mouseup", this.onMouseUp, !0), window.addEventListener("blur", this.onWindowBlur), this.unsubscribeChannel = this.channel.subscribe(this.onGuestInbound), this.touchCursor = new xs({
648
647
  region: this.hoverRegion,
649
648
  element: this.element,
650
649
  overlay: this.overlay,
@@ -880,7 +879,7 @@ class nn {
880
879
  }
881
880
  }
882
881
  const De = 30;
883
- function xs(r, e, t = "#fff") {
882
+ function Vs(r, e, t = "#fff") {
884
883
  return {
885
884
  position: "fixed",
886
885
  left: "0",
@@ -901,14 +900,14 @@ function xs(r, e, t = "#fff") {
901
900
  zIndex: "99999"
902
901
  };
903
902
  }
904
- class Vs {
903
+ class Is {
905
904
  constructor(e = document.body) {
906
905
  this.dots = /* @__PURE__ */ new Map(), this.parent = e;
907
906
  }
908
907
  place(e, t, n, s) {
909
908
  let i = this.dots.get(e);
910
909
  i || (i = document.createElement("div"), this.parent.appendChild(i), this.dots.set(e, i));
911
- const o = xs(t, n, s);
910
+ const o = Vs(t, n, s);
912
911
  for (const [a, l] of Object.entries(o))
913
912
  i.style[a] = l;
914
913
  }
@@ -1449,7 +1448,7 @@ function Ws(r) {
1449
1448
  }
1450
1449
  return "";
1451
1450
  }
1452
- function Is(r) {
1451
+ function ks(r) {
1453
1452
  const e = r.contentDocument;
1454
1453
  if (!e?.documentElement) return !1;
1455
1454
  const t = r.contentWindow;
@@ -1459,7 +1458,7 @@ function Is(r) {
1459
1458
  return s && (n.nonce = s), n.textContent = Dt, (e.head ?? e.documentElement).appendChild(n), n.remove(), !0;
1460
1459
  }
1461
1460
  const sr = 75;
1462
- function ks(r, e, t) {
1461
+ function qs(r, e, t) {
1463
1462
  const n = r.x - e.iframeX, s = r.y - e.iframeY;
1464
1463
  switch (t) {
1465
1464
  case "mirror":
@@ -1473,7 +1472,7 @@ function ks(r, e, t) {
1473
1472
  return { x: e.iframeX - n, y: e.iframeY - s };
1474
1473
  }
1475
1474
  }
1476
- function qs() {
1475
+ function Bs() {
1477
1476
  let r = !1, e = !1;
1478
1477
  return {
1479
1478
  name: "touch-emitter",
@@ -1489,7 +1488,7 @@ function qs() {
1489
1488
  screenY: i.screenY
1490
1489
  }];
1491
1490
  if (t.state.isMultiTouch && t.state.multiTouchBase && t.state.multiTouchMode) {
1492
- const c = ks(
1491
+ const c = qs(
1493
1492
  { x: i.iframeX, y: i.iframeY },
1494
1493
  t.state.multiTouchBase,
1495
1494
  t.state.multiTouchMode
@@ -1555,17 +1554,17 @@ function Yt(r) {
1555
1554
  }
1556
1555
  };
1557
1556
  }
1558
- function Bs() {
1557
+ function Ts() {
1559
1558
  return Yt({ name: "multi-touch-switch", modifier: "shiftKey", mode: "mirror" });
1560
1559
  }
1561
- function Ts() {
1560
+ function Rs() {
1562
1561
  return Yt({ name: "pinch", modifier: "altKey", mode: "pinch" });
1563
1562
  }
1564
- function Rs() {
1563
+ function Fs() {
1565
1564
  return Yt({ name: "rotate", modifier: "ctrlKey", mode: "rotate" });
1566
1565
  }
1567
- const Fs = 500, Xs = 10;
1568
- function Ks() {
1566
+ const Xs = 500, Ks = 10;
1567
+ function Ns() {
1569
1568
  return {
1570
1569
  name: "tap",
1571
1570
  install(r) {
@@ -1573,7 +1572,7 @@ function Ks() {
1573
1572
  const t = r.state.pressStartPoint;
1574
1573
  if (!t) return;
1575
1574
  const n = e.timestamp - r.state.pressStartedAt, s = e.iframeX - t.iframeX, i = e.iframeY - t.iframeY, o = Math.sqrt(s * s + i * i);
1576
- if (n > Fs || o > Xs || r.state.isMultiTouch) return;
1575
+ if (n > Xs || o > Ks || r.state.isMultiTouch) return;
1577
1576
  const a = {
1578
1577
  identifier: 1,
1579
1578
  clientX: e.iframeX,
@@ -1588,8 +1587,8 @@ function Ks() {
1588
1587
  }
1589
1588
  };
1590
1589
  }
1591
- const Ps = 500, Ns = 10;
1592
- function Os() {
1590
+ const Ps = 500, Os = 10;
1591
+ function Ms() {
1593
1592
  return {
1594
1593
  name: "long-press",
1595
1594
  install(r) {
@@ -1614,13 +1613,13 @@ function Os() {
1614
1613
  }), r.on("move", (n) => {
1615
1614
  if (!r.state.isPressed || !r.state.pressStartPoint) return;
1616
1615
  const s = n.iframeX - r.state.pressStartPoint.iframeX, i = n.iframeY - r.state.pressStartPoint.iframeY;
1617
- Math.sqrt(s * s + i * i) > Ns && t();
1616
+ Math.sqrt(s * s + i * i) > Os && t();
1618
1617
  }), r.on("up", () => t()), r.on("leave", () => t()), r.on("blur", () => t());
1619
1618
  }
1620
1619
  };
1621
1620
  }
1622
- const Ms = 300, Zs = 25;
1623
- function Us() {
1621
+ const Zs = 300, Us = 25;
1622
+ function Ds() {
1624
1623
  return {
1625
1624
  name: "double-tap",
1626
1625
  install(r) {
@@ -1630,7 +1629,7 @@ function Us() {
1630
1629
  if (n) {
1631
1630
  if (e) {
1632
1631
  const s = n.timestamp - e.timestamp, i = n.point.clientX - e.point.clientX, o = n.point.clientY - e.point.clientY, a = Math.sqrt(i * i + o * o);
1633
- if (s <= Ms && a <= Zs) {
1632
+ if (s <= Zs && a <= Us) {
1634
1633
  r.send({ type: "mini-app:dblclick", point: n.point, modifiers: n.modifiers }), r.emit("dblclick", { point: n.point, modifiers: n.modifiers }), e = null;
1635
1634
  return;
1636
1635
  }
@@ -1641,7 +1640,7 @@ function Us() {
1641
1640
  }
1642
1641
  };
1643
1642
  }
1644
- function Ds() {
1643
+ function Ys() {
1645
1644
  return {
1646
1645
  name: "wheel-scroll",
1647
1646
  install(r) {
@@ -1660,7 +1659,7 @@ function Ds() {
1660
1659
  }
1661
1660
  };
1662
1661
  }
1663
- function Ys() {
1662
+ function Gs() {
1664
1663
  return {
1665
1664
  name: "selection-disabler",
1666
1665
  install(r) {
@@ -1671,16 +1670,16 @@ function Ys() {
1671
1670
  }
1672
1671
  };
1673
1672
  }
1674
- const Gs = {
1673
+ const Hs = {
1675
1674
  mirror: "🤏 双指模式 · Shift 镜像",
1676
1675
  pinch: "🔍 缩放模式 · Alt 捏合",
1677
1676
  rotate: "🔄 旋转模式 · Ctrl 旋转"
1678
1677
  };
1679
- function Hs() {
1678
+ function Qs() {
1680
1679
  return {
1681
1680
  name: "multi-touch-hint",
1682
1681
  install(r) {
1683
- const e = new Vs(document.body);
1682
+ const e = new Is(document.body);
1684
1683
  let t = null;
1685
1684
  const n = (i) => {
1686
1685
  t || (t = document.createElement("div"), Object.assign(t.style, {
@@ -1696,7 +1695,7 @@ function Hs() {
1696
1695
  zIndex: "100000",
1697
1696
  pointerEvents: "none",
1698
1697
  userSelect: "none"
1699
- }), document.body.appendChild(t)), t.textContent = Gs[i];
1698
+ }), document.body.appendChild(t)), t.textContent = Hs[i];
1700
1699
  }, s = () => {
1701
1700
  t?.remove(), t = null;
1702
1701
  };
@@ -1717,19 +1716,19 @@ function Hs() {
1717
1716
  }
1718
1717
  function sn() {
1719
1718
  return [
1720
- Bs(),
1721
1719
  Ts(),
1722
1720
  Rs(),
1723
- qs(),
1724
- Ks(),
1725
- Os(),
1726
- Us(),
1721
+ Fs(),
1722
+ Bs(),
1723
+ Ns(),
1724
+ Ms(),
1727
1725
  Ds(),
1728
1726
  Ys(),
1729
- Hs()
1727
+ Gs(),
1728
+ Qs()
1730
1729
  ];
1731
1730
  }
1732
- const Qs = `/**
1731
+ const zs = `/**
1733
1732
  * Electron \`<webview>\` preload 入口(纯 JS)。
1734
1733
  *
1735
1734
  * 由 vite 单独打包成 \`lib/preload/webview-preload.js\`(供 npm 发布参考),
@@ -1808,9 +1807,9 @@ const Qs = `/**
1808
1807
  });
1809
1808
  })();
1810
1809
  `;
1811
- async function zs(r) {
1810
+ async function Js(r) {
1812
1811
  const e = await js(r);
1813
- return Js(e);
1812
+ return _s(e);
1814
1813
  }
1815
1814
  async function js(r) {
1816
1815
  const { options: e, injection: t, appUrl: n = "" } = r, s = {
@@ -1834,17 +1833,17 @@ ${Dt}` : null, a = i.length > 0 ? [
1834
1833
  `) : null;
1835
1834
  return [
1836
1835
  "// === channel bridge ===",
1837
- Qs,
1836
+ zs,
1838
1837
  ...o ? ["// === gesture receiver ===", o] : [],
1839
1838
  ...a ? [a] : []
1840
1839
  ].join(`
1841
1840
  ;
1842
1841
  `);
1843
1842
  }
1844
- async function Js(r) {
1845
- return _s(r, "miniapp-simulator-preload", "preload", "js");
1843
+ async function _s(r) {
1844
+ return $s(r, "miniapp-simulator-preload", "preload", "js");
1846
1845
  }
1847
- async function _s(r, e, t, n) {
1846
+ async function $s(r, e, t, n) {
1848
1847
  const s = globalThis.__miniAppSimulatorHostFs;
1849
1848
  if (s && typeof s.writeTempFile == "function")
1850
1849
  try {
@@ -1883,7 +1882,7 @@ const ir = `(function(){
1883
1882
  } else {
1884
1883
  s();
1885
1884
  }
1886
- })();`, $s = {
1885
+ })();`, ei = {
1887
1886
  id: "render-done",
1888
1887
  buildHeadScriptSource(r) {
1889
1888
  return ir;
@@ -1891,28 +1890,28 @@ const ir = `(function(){
1891
1890
  buildPreloadSource(r) {
1892
1891
  return ir;
1893
1892
  }
1894
- }, ht = "$xhs", ei = "", ti = 94e5, ri = "develop", ni = "simulator";
1895
- function on(r, e = ei, t, n) {
1893
+ }, ht = "$xhs", ti = "", ri = 94e5, ni = "develop", si = "simulator";
1894
+ function on(r, e = ti, t, n) {
1896
1895
  return {
1897
1896
  miniToolBizQuery: {},
1898
1897
  miniToolEnv: {
1899
1898
  ...r ? { appId: r } : {},
1900
1899
  ...t ? { gateways: t } : {},
1901
1900
  ...n ? { businessLine: n } : {},
1902
- buildVersion: ti,
1903
- env: ri,
1904
- platform: ni,
1901
+ buildVersion: ri,
1902
+ env: ni,
1903
+ platform: si,
1905
1904
  userDataPath: e
1906
1905
  }
1907
1906
  };
1908
1907
  }
1909
- function si(r, e, t, n) {
1908
+ function ii(r, e, t, n) {
1910
1909
  const s = JSON.stringify(
1911
1910
  on(r, e, t, n)
1912
1911
  ).replace(/<\/(script)/gi, "<\\/$1");
1913
1912
  return `window.${ht}=window.${ht}||{};window.${ht}.launchOptions=${s};`;
1914
1913
  }
1915
- const We = {
1914
+ const Le = {
1916
1915
  /** guest → host: the simulator bridge is ready */
1917
1916
  ready: "designable-small-tool:xhs:ready",
1918
1917
  /** guest → host: an SDK call forwarded through xhsInvoke */
@@ -1921,16 +1920,16 @@ const We = {
1921
1920
  invokeCallback: "designable-small-tool:xhs:invoke:callback",
1922
1921
  /** host → guest: a pushed SDK event */
1923
1922
  event: "designable-small-tool:xhs:event"
1924
- }, ii = "__designableSimulatorJsapiChannelInstalled__", ze = "__designableSimulatorJsapiChannelReady__", an = `
1923
+ }, oi = "__designableSimulatorJsapiChannelInstalled__", ze = "__designableSimulatorJsapiChannelReady__", an = `
1925
1924
  (function installSimulatorJsapiChannel() {
1926
1925
  if (typeof window === "undefined") return;
1927
1926
 
1928
1927
  var target = window;
1929
- var installedFlag = ${JSON.stringify(ii)};
1928
+ var installedFlag = ${JSON.stringify(oi)};
1930
1929
  if (target[installedFlag]) return;
1931
1930
  target[installedFlag] = true;
1932
1931
 
1933
- var messageTypes = ${JSON.stringify(We)};
1932
+ var messageTypes = ${JSON.stringify(Le)};
1934
1933
  var host = target.parent && target.parent !== target ? target.parent : target;
1935
1934
 
1936
1935
  function postToHost(message) {
@@ -1971,7 +1970,7 @@ const We = {
1971
1970
  });
1972
1971
  };
1973
1972
  })();
1974
- `, oi = `
1973
+ `, ai = `
1975
1974
  (function notifySimulatorJsapiChannelReady() {
1976
1975
  var notify = window[${JSON.stringify(ze)}];
1977
1976
  if (typeof notify !== "function") return;
@@ -1985,12 +1984,12 @@ const We = {
1985
1984
  }
1986
1985
  }
1987
1986
  })();
1988
- `, ai = '/*! xhs-script-version=0.4.3 */\n!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,i=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,a=(e,t)=>{for(var r in t||(t={}))o.call(t,r)&&i(e,r,t[r]);if(n)for(var r of n(t))s.call(t,r)&&i(e,r,t[r]);return e},c=(e,n)=>t(e,r(n)),l=(e,t)=>{var r={};for(var i in e)o.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&n)for(var i of n(e))t.indexOf(i)<0&&s.call(e,i)&&(r[i]=e[i]);return r};function u(){return"undefined"==typeof window?void 0:window}let d,f,p=!1;const m=new WeakMap;function g(e){p||(!function(e){var t;if(d)return d;const r=[null==(t=e.webkit)?void 0:t.messageHandlers,e].find(e=>{var t;return"function"==typeof(null==(t=null==e?void 0:e.xhsInvoke)?void 0:t.postMessage)}),n=null==r?void 0:r.xhsInvoke;if(!n)throw new Error("xhsInvoke unavailable");if(!Reflect.defineProperty(r,"xhsInvoke",{value:void 0,writable:!1,configurable:!1,enumerable:!1})||void 0!==r.xhsInvoke)throw new Error("Failed to hide xhsInvoke");f=r,d=n}(e),null!=e.XHS_SDK_CALLBACKS||(e.XHS_SDK_CALLBACKS={}),null!=e.XHS_SDK_CALLBACKS_ID||(e.XHS_SDK_CALLBACKS_ID=0),m.set(e,new Map),e.XHS_SDK_INVOKE_CALLBACKS=(t,r)=>{var n,o;const s=null==(n=e.XHS_SDK_CALLBACKS)?void 0:n[r];if(!s)return;null==(o=e.XHS_SDK_CALLBACKS)||delete o[r];const i=function(e){if("string"!=typeof e)return null!=e?e:{code:-1,msg:"empty bridge result"};try{const t=JSON.parse(e);return t&&"object"==typeof t?t:{code:-1,msg:"invalid bridge result"}}catch(t){return{code:-1,msg:e||"invalid bridge result"}}}(t);0===i.code?function(e,t){var r,n,o;const s=t&&"object"==typeof t&&!Array.isArray(t)?c(a({},t),{errMsg:`${e.api}:ok`}):void 0===t?{errMsg:`${e.api}:ok`}:{data:t,errMsg:`${e.api}:ok`};null==(r=e.resolve)||r.call(e,s);try{null==(n=e.success)||n.call(e,s)}finally{null==(o=e.complete)||o.call(e,s)}}(s,i.data):function(e,t){var r,n,o;null==(r=e.reject)||r.call(e,t);try{null==(n=e.fail)||n.call(e,t)}finally{null==(o=e.complete)||o.call(e,t)}}(s,{errMsg:`${s.api}:fail${i.msg?` ${i.msg}`:""}`,errCode:i.code})},e.XHS_SDK_EVENTS_CALLBACKS=t=>{var r;const n=function(e){let t;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){return}else t=e;return"events"===(null==t?void 0:t.type)&&"string"==typeof t.method?t:void 0}(t);if(!n)return;const o=null==(r=m.get(e))?void 0:r.get(n.method);if(o)for(const e of[...o])e(n)},p=!0)}function h(e,t,r=u()){var n;if(!r)throw new Error("window is unavailable");if(!e||"function"!=typeof t)throw new TypeError("invalid event subscription");const o=m.get(r);if(!o)throw new Error("bridge is not initialized");const s=t,i=null!=(n=o.get(e))?n:new Set;return i.add(s),o.set(e,i),{remove(){const t=o.get(e);null==t||t.delete(s),0===(null==t?void 0:t.size)&&o.delete(e)}}}function v(e,t={},r={}){const{target:n,validate:o,prepareRequest:s}=r,i=t,{success:a,fail:c,complete:p}=i,m=l(i,["success","fail","complete"]);w("success",a),w("fail",c),w("complete",p);const g=!(a||c||p);let h=m;try{null==o||o(h),s&&(h=s(h))}catch(t){return y(e,t,g,c,p)}const v=null!=n?n:u();if(!v)return y(e,new Error("window is unavailable"),g,c,p);let _,S;const k=new Promise((e,t)=>{_=e,S=t}),C="xhs_"+ ++v.XHS_SDK_CALLBACKS_ID;v.XHS_SDK_CALLBACKS[C]=g?{api:e,resolve:_,reject:S}:{api:e,success:a,fail:c,complete:p};try{!function(e){if(!d||!f||void 0!==f.xhsInvoke)throw new Error("xhsInvoke bridge is unavailable");d.postMessage(e)}(JSON.stringify({event:e,message:h,callbackId:C}))}catch(t){delete v.XHS_SDK_CALLBACKS[C];const r=b(e,t);return g?(null==S||S(r),k):(null==c||c(r),void(null==p||p(r)))}return g?k:void 0}function y(e,t,r,n,o){const s=b(e,t);if(r)return Promise.reject(s);null==n||n(s),null==o||o(s)}function b(e,t){const r=t instanceof Error?t.message:String(t),n=t&&"object"==typeof t&&"code"in t&&"number"==typeof t.code?t.code:void 0;return a({errMsg:`${e}:fail ${r}`},void 0===n?{}:{errCode:n})}function w(e,t){if(void 0!==t&&"function"!=typeof t)throw new TypeError(`${e} must be a function`)}const _="__xhsErrorMonitorInstalled__";function S(e,t){try{const r=v("reportTracker",{eventName:"minitool_error",data:t},{target:e});r&&r.catch(()=>{})}catch(e){}}function k(e){return e instanceof Error?e.message:String(e&&"object"==typeof e&&"message"in e?e.message:e)}function C(e){return e instanceof Error?e.name||"Error":e&&"object"==typeof e&&"name"in e&&String(e.name)||"Error"}function E(e){const t=e instanceof Error?e.stack:null==e?void 0:e.stack;return t?String(t).slice(0,512):""}class A{constructor(){this.aborted=!1,this.listeners=new Set}addEventListener(e,t,r){"abort"===e&&t&&this.listeners.add(t)}removeEventListener(e,t){"abort"===e&&t&&this.listeners.delete(t)}abort(e){if(this.aborted)return;this.aborted=!0,this.reason=e;const t={type:"abort",target:this,currentTarget:this},r=[...this.listeners];this.listeners.clear();for(const e of r)"function"==typeof e?e.call(this,t):e.handleEvent(t)}}const q=Object.freeze({default:"/api/sns/v1/creator/red_app/chat/completions",creator:"/api/sns/v1/creator/red_app/creator/chat/completions",mars:"/api/sns/v1/creator/red_app/mars/chat/completions"});function j(e,t){return`${e.replace(/\\/+$/,"")}/${t.replace(/^\\/+/,"")}`}const O=-104001;class I extends Error{constructor(e){super(e.message),this.name="AIError",this.code=e.code,this.requestId=e.requestId,this.details=e.details}}function T(e){if(e instanceof I)return e;const t=function(e){return x(e)&&"number"==typeof e.errCode?e.errCode:void 0}(e);return new I({code:O,message:L(e),details:void 0===t?void 0:{bridgeCode:t}})}function L(e){if(e instanceof Error)return e.message;if(x(e)){if("string"==typeof e.errMsg)return e.errMsg;if("string"==typeof e.message)return e.message}return"string"==typeof e?e:"AI request failed"}function x(e){return null!==e&&"object"==typeof e}const $=[239,187,191];const N=Symbol.for("Symbol.asyncIterator"),R="symbol"==typeof Symbol.asyncIterator?Symbol.asyncIterator:N;function P(e){const t=e;if("function"==typeof e[R])return t;const r=()=>{const t=e.getReader();let r=!1;const n=()=>{r||(r=!0,t.releaseLock())},o={async next(){try{const e=await t.read();return e.done&&n(),e}catch(e){throw n(),e}},async return(){try{await t.cancel()}finally{n()}return{done:!0,value:void 0}}};return Object.defineProperty(o,R,{value:()=>o}),o};return Object.defineProperty(e,R,{configurable:!0,value:r}),R!==N&&Object.defineProperty(e,N,{configurable:!0,value:r}),t}function M(e){const t=function(e){if("getReader"in e){const t=e.getReader();let r=!1;const n=()=>{r||(r=!0,t.releaseLock())};return new ReadableStream({async pull(e){try{const r=await t.read();r.done?(n(),e.close()):e.enqueue(r.value)}catch(t){n(),e.error(t)}},async cancel(e){var r;try{await(null==(r=t.cancel)?void 0:r.call(t,e))}finally{n()}}})}const t=e[R].call(e);return new ReadableStream({async pull(e){const r=await t.next();r.done?e.close():e.enqueue(r.value)},async cancel(e){var r;await(null==(r=t.return)?void 0:r.call(t,e))}})}(e).getReader();let r,n=!1,o=!1;const s=()=>{o||(o=!0,t.releaseLock())};return P(new ReadableStream({start(e){r=function(e){let t,r,n,o,s,i,a;return c(),{feed:function(e){r=r?r+e:e,t&&function(e){return $.every((t,r)=>e.charCodeAt(r)===t)}(r)&&(r=r.slice($.length)),t=!1;const{length:s}=r;let i=0,a=!1;for(;i<s;){a&&("\\n"===r[i]&&(i+=1),a=!1);let e,t=-1,c=o;for(let o=n;t<0&&o<s;o++)e=r[o],":"===e&&c<0?c=o-i:"\\r"===e?(a=!0,t=o-i):"\\n"===e&&(t=o-i);if(t<0){n=s-i,o=c;break}n=0,o=-1,l(r,i,c,t),i+=t+1}i===s?r="":i>0&&(r=r.slice(i))},reset:c};function c(){t=!0,r="",n=0,o=-1,s=void 0,i=void 0,a=""}function l(t,r,n,o){if(0===o)return a.length>0&&(e({type:"event",id:s,event:i||void 0,data:a.slice(0,-1)}),a="",s=void 0),void(i=void 0);const c=n<0,l=t.slice(r,r+(c?o:n));let u=0;u=c?o:" "===t[r+n+1]?n+2:n+1;const d=r+u,f=o-u,p=t.slice(d,d+f).toString();if("data"===l)a+=p?`${p}\\n`:"\\n";else if("event"===l)i=p;else if("id"!==l||p.includes("\\0")){if("retry"===l){const t=Number.parseInt(p,10);Number.isNaN(t)||e({type:"reconnect-interval",value:t})}}else s=p}}(t=>{if("event"===t.type&&"[DONE]"!==t.data)try{const r=JSON.parse(t.data);if(!r||"object"!=typeof r||Array.isArray(r))throw new TypeError("SSE data must be a JSON object");e.enqueue(r)}catch(e){throw new I({code:O,message:"AI chat gateway returned invalid SSE data",details:{cause:e instanceof Error?e.message:String(e)}})}}),(async()=>{try{for(;!n;){const o=await t.read();if(o.done)return n=!0,s(),void e.close();const i=o.value;i&&r.feed(i)}}catch(r){if(n)return;n=!0;try{await t.cancel(r)}catch(e){}finally{s()}e.error(r)}})()},async cancel(e){if(!n){n=!0;try{await t.cancel(e)}finally{s()}}}}))}class D{constructor(e,t,r){this.req=e,this.getBaseUrl=t,this.getSubUrl=r}}const K="x-minitool-appid",B=Object.freeze({max_output_tokens:1024,temperature:1});function F(e,t,r,n){var o,s;return function(e){z(e)||H("request");Array.isArray(e.messages)||H("messages");e.messages.forEach((e,t)=>{var r;z(e)||H(`messages[${t}]`),"string"==typeof(r=e.content)||"object"==typeof r&&null!==r||H(`messages[${t}].content`)}),U(e.max_output_tokens)||H("max_output_tokens");U(e.temperature)||H("temperature");U(e.top_p)||H("top_p");t=e.stop,void 0===t||"string"==typeof t||Array.isArray(t)&&t.every(e=>"string"==typeof e)||H("stop");var t;J(e.response_format)||H("response_format");J(e.thinking)||H("thinking");(function(e){return void 0===e||"string"==typeof e})(e.reasoning_effort)||H("reasoning_effort")}(t),c(a(a({},t),n?{app_id:n}:{}),{model:e,max_output_tokens:null!=(o=t.max_output_tokens)?o:B.max_output_tokens,temperature:null!=(s=t.temperature)?s:B.temperature,stream:r})}function H(e){throw new I({code:104001,message:`请求参数不合法:${e}`})}function U(e){return void 0===e||"number"==typeof e&&Number.isFinite(e)&&e>=0}function J(e){return void 0===e||z(e)}function z(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function G(e){var t,r,n;return c(a({},e),{prompt_tokens:null!=(t=null==e?void 0:e.prompt_tokens)?t:0,completion_tokens:null!=(r=null==e?void 0:e.completion_tokens)?r:0,total_tokens:null!=(n=null==e?void 0:e.total_tokens)?n:0})}function X(e){if(!Y(e))return;const t=W(e);return t||(Y(e.data)?W(e.data):void 0)}function W(e){var t,r;const n=void 0!==e.code&&0!==e.code;if(!1===e.success||n){const r=n&&void 0!==e.code?e.code:O;return new I({code:r,message:null!=(t=e.msg)?t:"AI chat request failed",requestId:e.request_id})}if(e.error)return new I({code:O,message:null!=(r=e.error.message)?r:"AI chat request failed",requestId:e.request_id,details:a(a({},void 0===e.error.code?{}:{providerCode:e.error.code}),void 0===e.error.retriable?{}:{retriable:e.error.retriable})})}function V(e,t){const r=X(e.data);if(r)throw r;if(void 0!==e.statusCode&&e.statusCode>=400)throw new I({code:O,message:`AI request failed with status ${e.statusCode}`,details:{statusCode:e.statusCode}});if(!e.data)throw new I({code:O,message:t});return e.data}function Y(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Q(e){var t,r;const n=function(){if("function"==typeof AbortController)return new AbortController;const e=new A;return{signal:e,abort:t=>e.abort(t)}}();let o=!1;const s=()=>{var t;return n.abort(null==(t=null==e?void 0:e.signal)?void 0:t.reason)};(null==(t=null==e?void 0:e.signal)?void 0:t.aborted)?s():null==(r=null==e?void 0:e.signal)||r.addEventListener("abort",s,{once:!0});const i=void 0!==(null==e?void 0:e.timeoutMs)&&e.timeoutMs>0?setTimeout(()=>{o=!0,n.abort("timeout")},e.timeoutMs):void 0;return{controller:n,get timedOut(){return o},cleanup(){var t;void 0!==i&&clearTimeout(i),null==(t=null==e?void 0:e.signal)||t.removeEventListener("abort",s)}}}function Z(e,t){return t.timedOut?new I({code:O,message:"AI request timed out"}):t.controller.signal.aborted?new I({code:O,message:"AI request was aborted"}):T(e)}function ee(e,t=0){var r,n,o,s,i;const l=null!=(r=null==e?void 0:e.message)?r:{};return c(a({},e),{index:null!=(n=null==e?void 0:e.index)?n:t,message:c(a({},l),{role:null!=(o=l.role)?o:"assistant",content:null!=(s=l.content)?s:""}),finish_reason:null!=(i=null==e?void 0:e.finish_reason)?i:void 0})}class te extends D{constructor(e,t,r,n,o=()=>"/chat/completions",s){super(e,t,o),this.modelName=r,this.getAppId=n,this.onError=s}reportError(e,t){if(this.onError)try{Promise.resolve(this.onError(e,{model:this.modelName,operation:t})).catch(()=>{})}catch(e){}}requestOptions(e,t,r,n){var o;const s=null==(o=this.getAppId)?void 0:o.call(this),i=F(this.modelName,e,t,s);return{url:j(this.getBaseUrl(),this.getSubUrl()),method:"post",headers:a(a({"Content-Type":"application/json"},null==n?void 0:n.headers),s?{[K]:s}:{}),data:i,responseType:t?"stream":"json",stream:t,signal:r}}async doGenerate(e,t){var r;const n=Q(t);try{const o=await this.req.post(this.requestOptions(e,!1,n.controller.signal,t)),s=function(e){var t;if(!("code"in e||"success"in e||"msg"in e)||null===e.data||"object"!=typeof e.data||Array.isArray(e.data))return e;const r=e.data;return c(a({},r),{request_id:null!=(t=r.request_id)?t:e.request_id})}(V(o,"AI response is empty"));return function(e,t,r){var n,o,s;const i=(null==(n=e.choices)?void 0:n.length)?e.choices.map(ee):[ee(void 0)];return c(a({},e),{request_id:null!=(s=null!=(o=e.request_id)?o:e.id)?s:t,model:r,choices:i,usage:G(e.usage)})}(s,null!=(r=null==t?void 0:t.idempotencyKey)?r:this.modelName,this.modelName)}catch(e){const t=Z(e,n);throw this.reportError(t,"generateText"),t}finally{n.cleanup()}}async doStream(e,t){var r;const n=Q(t),o=null!=(r=null==t?void 0:t.idempotencyKey)?r:`chat_${Date.now().toString(36)}`,s=function(){let e,t;return{promise:new Promise((r,n)=>{e=r,t=n}),resolve:e,reject:t}}();s.promise.catch(()=>{});let i=n.controller.signal.aborted;const u=P(new ReadableStream({start:r=>{if(i){const e=new I({code:O,message:"AI request was aborted"});return r.error(e),s.reject(e),void n.cleanup()}(async()=>{var u,d,f;let p,m=0;const g={},h=new Map;try{const v=await this.req.post(this.requestOptions(e,!0,n.controller.signal,t));if(i)return;const y=M(V(v,"AI stream is empty")).getReader();let b=!1;try{for(;;){const e=await y.read();if(e.done){b=!0;break}const t=e.value;if(i)return;const n=X(t);if(n)throw n;t.usage&&(p=t.usage);const s=t,{choices:v,usage:w}=s,_=l(s,["choices","usage"]);Object.assign(g,_);const S=(null!=(u=t.choices)?u:[]).map((e,t)=>{var r,n,o,s;const i=null!=(r=e.index)?r:t,u=null!=(n=e.delta)?n:{},d=null!=(o=h.get(i))?o:{fields:{},content:"",reasoning_content:""},f=e,{delta:p,message:g}=f,v=l(f,["delta","message"]);return Object.assign(d.fields,v),u.content&&(d.content+=u.content),u.reasoning_content&&(d.reasoning_content+=u.reasoning_content),e.finish_reason&&(d.finish_reason=e.finish_reason),h.set(i,d),c(a({},e),{index:i,delta:a(a({},u),0===m&&void 0===u.role?{role:"assistant"}:{}),finish_reason:null!=(s=e.finish_reason)?s:void 0})});m+=1,r.enqueue(c(a({},t),{request_id:null!=(f=null!=(d=t.request_id)?d:t.id)?f:o,model:this.modelName,seq:m,choices:S}))}}finally{b||await y.cancel().catch(()=>{}),y.releaseLock()}if(i)return;r.close();const w=[...h.entries()].map(([e,t])=>c(a({},t.fields),{index:e,message:a({role:"assistant",content:t.content},t.reasoning_content?{reasoning_content:t.reasoning_content}:{}),finish_reason:t.finish_reason}));s.resolve(c(a({},g),{request_id:"string"==typeof g.request_id?g.request_id:"string"==typeof g.id?g.id:o,model:this.modelName,choices:w,usage:G(p)}))}catch(e){if(i)return;const t=Z(e,n);this.reportError(t,"streamText"),r.error(t),s.reject(t)}finally{n.cleanup()}})()},cancel:e=>{i||(i=!0,n.controller.abort(e),n.cleanup(),s.reject(new I({code:O,message:"AI stream was canceled by consumer"})))}}));return Object.defineProperties(u,{request_id:{enumerable:!0,value:o},result:{enumerable:!0,value:s.promise}}),u}}const re=new WeakMap;function ne(e){const t=re.get(e);if(!t)throw new Error("AI model is not initialized");return t}class oe{constructor(e){this.generateText=async(e,t)=>ne(this).doGenerate(e,t),this.streamText=async(e,t)=>ne(this).doStream(e,t),re.set(this,e)}}const se=new WeakMap;class ie{constructor(e,t,r,n,o){this.createModel=e=>{const{request:t,getBaseUrl:r,getAppId:n,getSubUrl:o,onError:s}=function(e){const t=se.get(e);if(!t)throw new Error("AI is not initialized");return t}(this);return new oe(new te(t,r,e,n,o,s))},se.set(this,{request:e,getBaseUrl:t,getAppId:r,getSubUrl:n,onError:o})}}const ae="https://edith.xiaohongshu.com";function ce({getAppId:e,getGateway:t,getBusinessLine:r,onError:n,request:o}){if(!o)throw new Error("`request` is required!");return new ie(o,()=>{var e;return function(e){if("string"!=typeof e||!e.trim())throw new Error("`gateway` must be a non-empty HTTPS URL");const t=e.trim();let r;try{r=new URL(t)}catch(e){throw new Error("`gateway` must be an absolute HTTPS URL")}if(n=r,"https:"!==n.protocol&&("http:"!==n.protocol||"localhost"!==n.hostname&&"127.0.0.1"!==n.hostname&&"[::1]"!==n.hostname))throw new Error("`gateway` must use HTTPS (HTTP is allowed only for loopback development)");var n;return t.replace(/\\/+$/,"")}(null!=(e=null==t?void 0:t())?e:ae)},()=>{return(null==(t=null==e?void 0:e())?void 0:t.trim())||void 0;var t},()=>function(e){switch(null==e?void 0:e.trim()){case"creator":return q.creator;case"mars":return q.mars;default:return q.default}}(null==r?void 0:r()),n)}function le(e){var t;const r=null==(t=null==e?void 0:e.$xhs)?void 0:t.launchOptions;return!r||"object"!=typeof r||Array.isArray(r)?{}:r}function ue(e){return(t={})=>v("getLaunchOptions",t,{target:e})}const de=10001;let fe=0;class pe{constructor(e){this.target=e,this.id=(fe+=1,`xhs_request_${Date.now().toString(36)}_${fe.toString(36)}`),this.chunkCallbacks=new Set,this.headersCallbacks=new Set,this.terminal=!1}get isSettled(){return this.terminal}abort(){this.terminal||(this.terminal=!0,this.dispose(),Promise.resolve(v("abortRequest",{taskId:this.id},{target:this.target})).catch(()=>{}))}onChunkReceived(e){this.terminal||"function"!=typeof e||(this.chunkCallbacks.add(e),this.chunkSubscription||(this.chunkSubscription=h("onEventStream",({payload:e})=>{if(!this.terminal&&(null==e?void 0:e.taskId)===this.id&&"string"==typeof e.chunk)for(const t of[...this.chunkCallbacks])t({data:e.chunk})},this.target)))}offChunkReceived(e){var t;e?this.chunkCallbacks.delete(e):this.chunkCallbacks.clear(),0===this.chunkCallbacks.size&&(null==(t=this.chunkSubscription)||t.remove(),this.chunkSubscription=void 0)}onHeadersReceived(e){this.terminal||"function"!=typeof e||(this.headersCallbacks.add(e),this.headersSubscription||(this.headersSubscription=h("onHeadersReceivedRequest",({payload:e})=>{if(this.terminal||(null==e?void 0:e.taskId)!==this.id)return;const t=e,{taskId:r}=t,n=l(t,["taskId"]);for(const e of[...this.headersCallbacks])e(n)},this.target)))}offHeadersReceived(e){var t;e?this.headersCallbacks.delete(e):this.headersCallbacks.clear(),0===this.headersCallbacks.size&&(null==(t=this.headersSubscription)||t.remove(),this.headersSubscription=void 0)}settle(){this.terminal||(this.terminal=!0,this.dispose())}dispose(){var e,t;null==(e=this.chunkSubscription)||e.remove(),null==(t=this.headersSubscription)||t.remove(),this.chunkSubscription=void 0,this.headersSubscription=void 0,this.chunkCallbacks.clear(),this.headersCallbacks.clear()}}function me(e,t){return function(r){var n,o,s,i,a;const c=new pe(e);if((l=r.data)instanceof ArrayBuffer||ArrayBuffer.isView(l))return function(e,t,r){ge(e,t,r,"request data does not support ArrayBuffer")}(t,c,r),c;var l;if(void 0!==r.responseType&&"text"!==r.responseType)return function(e,t,r){ge(e,t,r,"request responseType only supports text")}(t,c,r),c;const u={taskId:c.id,url:r.url,method:null!=(n=r.method)?n:"GET",header:r.header,data:r.data,dataType:null!=(o=r.dataType)?o:"json",responseType:null!=(s=r.responseType)?s:"text",timeout:null!=(i=r.timeout)?i:6e4,enableChunked:null!=(a=r.enableChunked)&&a,success(e){var t;null==(t=r.success)||t.call(r,e)},fail(e){var t;null==(t=r.fail)||t.call(r,e)},complete(e){var t;c.settle(),null==(t=r.complete)||t.call(r,e)}};return setTimeout(()=>{c.isSettled||v(t,u,{target:e})},0),c}}function ge(e,t,r,n){const o={errMsg:`${e}:fail ${n}`,errCode:de};setTimeout(()=>{var e,n;if(!t.isSettled){t.settle();try{null==(e=r.fail)||e.call(r,o)}finally{null==(n=r.complete)||n.call(r,o)}}},0)}function he(e){return me(e,"request")}function ve(e){return me(e,"xhsRequest")}function ye(e,t,r){const n="stream"===t.responseType||!0===t.stream;return new Promise((o,s)=>{let i,a,c=!1,l=!1;const u=n?new ReadableStream({start(e){a=e},cancel(){g(_e())}}):void 0,d=t.signal,f=()=>g(_e()),p=()=>!c&&(c=!0,null==d||d.removeEventListener("abort",f),!0),m=e=>{if(!p())return;const t=function(e){if(e instanceof Error)return e;if(function(e){return Boolean(e&&"object"==typeof e&&"errMsg"in e)}(e)){const t=new Error(e.errMsg);return t.name="XhsBridgeError",void 0!==e.errCode&&(t.errCode=e.errCode),t}return new Error(String(e))}(e);l?null==a||a.error(t):s(t)},g=e=>{null==i||i.abort(),m(e)},h=e=>{l||(l=!0,o(e))};i=e({url:t.url,method:we(r),header:t.headers,data:t.data,dataType:n?"text":"json",responseType:"text",enableChunked:n,success(e){if(!c)return u?(h(be(e,u)),void(p()&&(null==a||a.close()))):void(p()&&h(function(e){return{statusCode:e.statusCode,headers:e.header,data:e.data}}(e)))},fail:m}),u&&(i.onHeadersReceived(e=>{h(be(e,u))}),i.onChunkReceived(({data:e})=>{c||null==a||a.enqueue(e)})),(null==d?void 0:d.aborted)?f():null==d||d.addEventListener("abort",f,{once:!0})})}function be(e,t){return{statusCode:e.statusCode,headers:e.header,data:t}}function we(e){return"get"===e?"GET":"POST"}function _e(){const e=new Error("request was aborted");return e.name="AbortError",e}function Se(e){return ce({getAppId:()=>{var t;return ke(null==(t=le(e).miniToolEnv)?void 0:t.appId)},getGateway:()=>{var t,r;return ke(null==(r=null==(t=le(e).miniToolEnv)?void 0:t.gateways)?void 0:r.edith)},getBusinessLine:()=>{var t;return ke(null==(t=le(e).miniToolEnv)?void 0:t.businessLine)},onError:(t,r)=>{var n;S(e,{type:"ai",name:r.model,message:t.message.slice(0,512),stack:null==(n=t.stack)?void 0:n.slice(0,512),code:t.code,request_id:t.requestId,details:t.details,model:r.model,operation:r.operation})},request:(t=ve(e),{get:e=>ye(t,e,"get"),post:e=>ye(t,e,"post")})});var t}function ke(e){if("string"!=typeof e)return;return e.trim()||void 0}const Ce="INVALID_ARGUMENT",Ee="NETWORK_ERROR",Ae="BAD_RESPONSE",qe="SERVER_ERROR";class je extends Error{constructor(e,t,r={}){super(t),this.name="CloudServiceError",this.code=e,void 0!==r.errCode&&(this.errCode=r.errCode),void 0!==r.details&&(this.details=r.details)}}function Oe(e,t,r,n,o={}){var s;const i=null!=(s=o.errCode)?s:t===Ce?de:void 0;throw S(n,{type:"jsapi",name:"CloudServiceError",message:`${e}: ${r}`.slice(0,512),details:a({api:e,code:t,errCode:i},o.details)}),new je(t,`${e}:fail ${r}`,c(a({},o),{errCode:i}))}const Ie={all:"ALL",month:"MONTH",week:"WEEK",day:"DAY"};function Te(e,t,r,n){t||Oe(e,Ce,r,n)}function Le(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function xe(e,t,r){return Te(e,"string"==typeof t&&t.trim().length>0,"collection must be a non-empty string",r),t.trim()}function $e(e,t,r){return void 0===t?1:(Te(e,"number"==typeof t&&Number.isInteger(t)&&t>=1&&t<=5,"board must be an integer between 1 and 5",r),t)}function Ne(e,t,r){return void 0===t?Ie.all:(Te(e,"string"==typeof t&&t in Ie,"period must be \'all\', \'month\', \'week\' or \'day\'",r),Ie[t])}function Re(e,t,r){return Te(e,"number"==typeof t&&Number.isFinite(t),"score must be a finite number",r),t}function Pe(e,t,r){Te(e,Array.isArray(t)&&t.length>0,"ids must be a non-empty array",r);const n=t,o=new Set;return n.map(t=>{Te(e,"string"==typeof t&&t.trim().length>0,"ids must contain non-empty strings",r);const n=t.trim();return Te(e,!o.has(n),`ids must not contain duplicates: ${n}`,r),o.add(n),n})}const Me=["success","fail","complete"];function De(e,t,r){!function(e){for(const t of Me){const r=null==e?void 0:e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError(`${t} must be a function`)}}(r);const{success:n,fail:o,complete:s}=null!=r?r:{};if(!(n||o||s))return t().then(t=>Ke(e,t),t=>{throw Be(e,t)});t().then(t=>{const r=Ke(e,t);try{null==n||n(r)}finally{null==s||s(r)}},t=>{const r=Be(e,t);try{null==o||o(r)}finally{null==s||s(r)}})}function Ke(e,t){return Le(t)?c(a({},t),{errMsg:`${e}:ok`}):{data:t,errMsg:`${e}:ok`}}function Be(e,t){if(t instanceof je){const e={errMsg:t.message};return void 0!==t.errCode&&(e.errCode=t.errCode),e}const r=t instanceof Error&&t.message?t.message:"";return{errMsg:r?`${e}:fail ${r}`:`${e}:fail`}}function Fe(e){var t,r,n;return null!=(n=Ue(null==(r=null==(t=le(e).miniToolEnv)?void 0:t.gateways)?void 0:r.edith))?n:ae}function He(e){var t;return Ue(null==(t=le(e).miniToolEnv)?void 0:t.businessLine)}function Ue(e){if("string"==typeof e)return e.trim()||void 0}const Je=Object.freeze({default:Object.freeze({batchCreate:"/api/sns/v1/creator/red_app/batch_create",batchUpdate:"/api/sns/v1/creator/red_app/batch_update",query:"/api/sns/v1/creator/red_app/query",batchDelete:"/api/sns/v1/creator/red_app/batch_delete",submitScore:"/api/sns/v1/creator/red_app/submit_score",queryTop100:"/api/sns/v1/creator/red_app/query_top_100",querySelfRank:"/api/sns/v1/creator/red_app/query_self_rank"}),creator:Object.freeze({batchCreate:"/api/sns/v1/creator/red_app/creator/batch_create",batchUpdate:"/api/sns/v1/creator/red_app/creator/batch_update",query:"/api/sns/v1/creator/red_app/creator/query",batchDelete:"/api/sns/v1/creator/red_app/creator/batch_delete",submitScore:"/api/sns/v1/creator/red_app/creator/submit_score",queryTop100:"/api/sns/v1/creator/red_app/creator/query_top_100",querySelfRank:"/api/sns/v1/creator/red_app/creator/query_self_rank"}),mars:Object.freeze({batchCreate:"/api/sns/v1/creator/red_app/mars/batch_create",batchUpdate:"/api/sns/v1/creator/red_app/mars/batch_update",query:"/api/sns/v1/creator/red_app/mars/query",batchDelete:"/api/sns/v1/creator/red_app/mars/batch_delete",submitScore:"/api/sns/v1/creator/red_app/mars/submit_score",queryTop100:"/api/sns/v1/creator/red_app/mars/query_top_100",querySelfRank:"/api/sns/v1/creator/red_app/mars/query_self_rank"})});function ze(e,t){switch(null==e?void 0:e.trim()){case"creator":return Je.creator[t];case"mars":return Je.mars[t];default:return Je.default[t]}}function Ge(e){const t=ve(e);return{post(r,n,o){const s=function(e){var t;return Ue(null==(t=le(e).miniToolEnv)?void 0:t.appId)}(e);s||Oe(r,Ce,"appId is unavailable: launchOptions.miniToolEnv.appId is missing",e);const i=a({request_context:{env:"prod",app_id:s}},o);return new Promise((o,s)=>{t({url:j(Fe(e),ze(He(e),n)),method:"POST",header:{"Content-Type":"application/json"},data:i,dataType:"json",success(t){try{o(function(e,t,r,n){var o;const s=Xe(t),i=s?Xe(s.data):void 0,a=i?Xe(i.result):void 0;if(!s||!i||!a){Oe(e,!1===(null==s?void 0:s.success)||void 0!==r&&(r<200||r>=300)?Ee:Ae,null!=(o=We(null==s?void 0:s.msg))?o:`unexpected response (statusCode=${r})`,n,{details:{statusCode:r,gatewayCode:null==s?void 0:s.code,body:Ve(t)}})}const c="number"==typeof a.code?a.code:!0===a.success?0:void 0,l=We(a.message);void 0===c&&Oe(e,qe,null!=l?l:"response is missing a numeric result code",n,{details:{statusCode:r}});if(0!==c&&2003!==c)throw new je(String(c),`${e}:fail ${null!=l?l:String(c)}`,{errCode:c});return i}(r,t.data,t.statusCode,e))}catch(e){s(e)}},fail(t){try{Oe(r,Ee,t.errMsg||"request failed",e,{errCode:t.errCode,details:{errCode:t.errCode}})}catch(e){s(e)}}})})}}}function Xe(e){if("string"==typeof e)try{return Xe(JSON.parse(e))}catch(e){return}if("object"==typeof e&&null!==e&&!Array.isArray(e))return e}function We(e){return"string"==typeof e&&e?e:void 0}function Ve(e){try{return("string"==typeof e?e:JSON.stringify(e)||"").slice(0,256)}catch(e){return""}}const Ye="DESC",Qe="addCloudStorage",Ze="updateCloudStorage",et="queryCloudStorage",tt="removeCloudStorage";function rt(e){const t=Ge(e);return{addCloudStorage:r=>De(Qe,()=>async function(e,t,r){const n=nt(Qe,t,r),o=xe(Qe,n.collection,r),s=ot(Qe,n.items,r),i=s.map((e,t)=>(Te(Qe,Le(e.content),`items[${t}].content must be an object`,r),{content_json:JSON.stringify(e.content)})),a=await e.post(Qe,"batchCreate",{collection:o,items:i});return st(Qe,a,i.map(()=>{}),r)}(t,r,e),r),updateCloudStorage:r=>De(Ze,()=>async function(e,t,r){const n=nt(Ze,t,r),o=xe(Ze,n.collection,r),s=ot(Ze,n.items,r),i=new Set,a=s.map((e,t)=>{Te(Ze,"string"==typeof e.id&&e.id.trim().length>0,`items[${t}].id must be a non-empty string`,r);const n=e.id.trim();return Te(Ze,!i.has(n),`items must not repeat id: ${n}`,r),i.add(n),Te(Ze,Le(e.content),`items[${t}].content must be an object`,r),{id:n,content_json:JSON.stringify(e.content)}}),c=await e.post(Ze,"batchUpdate",{collection:o,items:a});return st(Ze,c,a.map(e=>e.id),r)}(t,r,e),r),queryCloudStorage:(r={})=>De(et,()=>async function(e,t,r){var n,o;const s=nt(et,t,r),i=function(e,t){var r;const n=void 0!==e.ids,o=void 0!==e.collection;if(n)return{mode:"BY_IDS",collection:xe(et,e.collection,t),ids:Pe(et,e.ids,t)};const s=null!=(r=function(e,t,r){if(void 0!==t)return Te(e,"number"==typeof t&&Number.isInteger(t)&&t>0,"limit must be a positive integer",r),t}(et,e.limit,t))?r:20,i=function(e,t,r){if(null!=t)return Te(e,"string"==typeof t&&t.length>0,"cursor must be a non-empty string",r),t}(et,e.cursor,t);if(o)return a({mode:"COLLECTION",collection:xe(et,e.collection,t),sort_by:Ye,limit:s},void 0===i?{}:{cursor:i});return a({mode:"APP_ALL",limit:s},void 0===i?{}:{cursor:i})}(s,r),c=await e.post(et,"query",i),l=Le(c)&&Le(c.data)?c.data:void 0;l&&Array.isArray(l.items)||Oe(et,Ae,"response is missing data.data.items",r);const u={items:l.items.map(e=>function(e,t,r){const n=Le(t)?t:void 0;n&&"string"==typeof n.id&&"string"==typeof n.content_json||Oe(e,Ae,"record is missing id or content_json",r);let o;try{o=JSON.parse(n.content_json)}catch(e){o=void 0}Le(o)||Oe(e,Ae,"record.content_json is not a JSON object",r);return{id:n.id,collection:"string"==typeof n.collection?n.collection:"",content:o}}(et,e,r))};("next_cursor"in l||"nextCursor"in l)&&(u.nextCursor="string"==typeof(d=null!=(n=l.next_cursor)?n:l.nextCursor)&&d?d:null);var d;("has_more"in l||"hasMore"in l)&&(u.hasMore=!0===(null!=(o=l.has_more)?o:l.hasMore));return u}(t,r,e),r),removeCloudStorage:r=>De(tt,()=>async function(e,t,r){const n=nt(tt,t,r),o=Pe(tt,n.ids,r),s=await e.post(tt,"batchDelete",{collection:xe(tt,n.collection,r),ids:o});return st(tt,s,o,r)}(t,r,e),r)}}function nt(e,t,r){return Te(e,Le(t),"options must be an object",r),t}function ot(e,t,r){return Te(e,Array.isArray(t)&&t.length>0,"items must be a non-empty array",r),t.map((t,n)=>(Te(e,Le(t),`items[${n}] must be an object`,r),t))}function st(e,t,r,n){const o=function(e,t,r){const n=Le(t)?t:void 0;return n&&Array.isArray(n.results)||Oe(e,Ae,"response is missing data.results",r),n.results.map((t,n)=>(Te(e,Le(t),`data.results[${n}] must be an object`,r),t))}(e,t,n);o.length!==r.length&&Oe(e,Ae,`data.results length ${o.length} does not match request items ${r.length}`,n);const s=new Map;for(const e of o)for(const t of[e.item_id,e.id])"string"==typeof t&&t&&s.set(t,e);return r.map((t,r)=>{var i;const a=null!=(i=void 0!==t?s.get(t):void 0)?i:o[r];return function(e,t,r,n){const{id:o,status:s}=t;"string"!=typeof s&&Oe(e,Ae,"per-item result is missing status",n);return{id:"string"==typeof o?o:"string"==typeof r?r:"",status:s}}(e,a,t,n)})}function it(e){return(t={})=>v("followAuthor",t,{target:e})}function at(e){return(t={})=>v("getFollowStatus",t,{target:e})}class ct extends Error{constructor(e){super(e),this.code=de,this.name="JsApiParamError"}}function lt(e,t,r,n){t||function(e,t,r){throw S(r,{type:"jsapi",name:"JsApiParamError",message:t,code:de,details:{api:e}}),new ct(t)}(e,r,n)}function ut(e){return(t={})=>v("getLocation",t,{target:e,validate:t=>function(e,t){const{type:r}=e;lt("getLocation",void 0===r||"wgs84"===r||"gcj02"===r,\'type must be "wgs84" or "gcj02"\',t)}(t,e)})}function dt(e){return(t={})=>v("getWindowInfo",t,{target:e})}const ft=["game","ui","normal"],pt="startGyroscope";function mt(e){return(t={})=>v(pt,t,{target:e,validate:t=>function(e,t){const{interval:r}=e;lt(pt,void 0===r||ft.includes(r),\'interval must be "game", "ui" or "normal"\',t)}(t,e)})}function gt(e){return(t={})=>v("stopGyroscope",t,{target:e})}const ht=new WeakMap;function vt(e){let t=ht.get(e);return t||(t={callbacks:new Set},ht.set(e,t)),t}function yt(e){return t=>{if("function"!=typeof t)throw new TypeError("onGyroscopeChange callback must be a function");const r=null!=e?e:u();if(!r)throw new Error("window is unavailable");const n=vt(r);if(n.callbacks.has(t))return;if(n.callbacks.add(t),n.subscription)return;n.subscription=h("onGyroscopeChange",({payload:e})=>{for(const t of[...n.callbacks])try{t(e)}catch(e){}},r)}}function bt(e){return t=>{var r;if(void 0!==t&&"function"!=typeof t)throw new TypeError("offGyroscopeChange callback must be a function");const n=null!=e?e:u();if(!n)throw new Error("window is unavailable");const o=vt(n);t?o.callbacks.delete(t):o.callbacks.clear(),o.callbacks.size>0||(null==(r=o.subscription)||r.remove(),o.subscription=void 0)}}function wt(e){return t=>v("interactionOpenApi",t,{target:e})}const _t="submitScore",St="getRankList",kt="getMyRank";function Ct(e){const t=Ge(e);return{submitScore:r=>De(_t,()=>async function(e,t,r){var n;const o=Et(_t,t,r),s=await e.post(_t,"submitScore",{rank_code:$e(_t,o.board,r),score:Re(_t,o.score,r)}),i=At(_t,s,r),a=qt(null!=(n=i.bestScore)?n:i.best_score);void 0===a&&Oe(_t,Ae,"response is missing data.data.bestScore",r);return{score:a}}(t,r,e),r),getRankList:(r={})=>De(St,()=>async function(e,t,r){const n=Et(St,t,r),o=await e.post(St,"queryTop100",{rank_code:$e(St,n.board,r),rank_type:Ne(St,n.period,r),limit:100}),s=At(St,o,r);Array.isArray(s.items)||Oe(St,Ae,"response is missing data.data.items",r);return s.items.map((e,t)=>{var n;Te(St,Le(e),`data.items[${t}] is malformed`,r);const o=e,s=qt(o.score);return"number"==typeof o.rank&&void 0!==s||Oe(St,Ae,`data.items[${t}] is missing rank or score`,r),{rank:o.rank,score:s,nickname:jt(o.nickname),avatar:jt(null!=(n=o.avatar_url)?n:o.avatarUrl)}})}(t,r,e),r),getMyRank:(r={})=>De(kt,()=>async function(e,t,r){var n;const o=Et(kt,t,r),s=await e.post(kt,"querySelfRank",{rank_code:$e(kt,o.board,r),rank_type:Ne(kt,o.period,r)}),i=At(kt,s,r),a=void 0!==i.self_rank?i.self_rank:i.self,c=Le(a)?a:void 0;c&&"string"==typeof c.status||Oe(kt,Ae,"response is missing data.data.self_rank.status",r);return{status:c.status,rank:Ot(c.rank),score:null!=(n=qt(c.score))?n:null}}(t,r,e),r)}}function Et(e,t,r){return Te(e,Le(t),"options must be an object",r),t}function At(e,t,r){const n=Le(t)?t.data:void 0;return Le(n)||Oe(e,Ae,"response is missing data.data",r),n}function qt(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function jt(e){return"string"==typeof e&&e?e:null}function Ot(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function It(e){return t=>v("openRedPage",t,{target:e})}function Tt(e){return c(a({},e),{mediaInfo:JSON.stringify(e.mediaInfo||{})})}function Lt(e){return t=>v("postNote",t,{target:e,prepareRequest:Tt})}function xt(e){return t=>v("saveImageToPhotosAlbum",t,{target:e})}function $t(e){return(t={})=>v("clearStorage",t,{target:e})}function Nt(e){return t=>v("getStorage",t,{target:e})}function Rt(e){return(t={})=>v("getStorageInfo",t,{target:e})}function Pt(e){return t=>v("removeStorage",t,{target:e})}function Mt(e){return t=>v("setStorage",t,{target:e})}const Dt=["heavy","medium","light"],Kt="vibrateShort";function Bt(e){return t=>v(Kt,t,{target:e,validate:t=>function(e,t){const{type:r}=e;lt(Kt,Dt.includes(r),\'type must be "heavy", "medium" or "light"\',t)}(t,e)})}function Ft(e){return(t={})=>v("vibrateLong",t,{target:e})}function Ht(e){return t=>v("writeTempFile",t,{target:e})}const Ut="xhsOpenSiteLocation",Jt=["poi-detail","poi-list","path","navigation"];function zt(e){if(!e||"object"!=typeof e)return!1;const t=e;return"string"==typeof t.id&&t.id.length>0&&"number"==typeof t.latitude&&"number"==typeof t.longitude}function Gt(e){return t=>v("xhsOpenSiteLocation",t,{target:e,validate:t=>function(e,t){const{scene:r}=e;switch(lt(Ut,void 0!==r&&Jt.includes(r),\'scene must be "poi-detail" | "poi-list" | "path" | "navigation"\',t),r){case"poi-detail":lt(Ut,"string"==typeof e.id&&e.id.length>0,\'"poi-detail" requires a non-empty id\',t);break;case"poi-list":lt(Ut,Array.isArray(e.pois)&&e.pois.length>0,\'"poi-list" requires a non-empty pois array\',t);break;case"path":lt(Ut,zt(e.origin),\'"path" requires a valid origin { latitude, longitude, id }\',t),lt(Ut,zt(e.destination),\'"path" requires a valid destination { latitude, longitude, id }\',t);break;case"navigation":lt(Ut,zt(e.destination),\'"navigation" requires a valid destination { latitude, longitude, id }\',t)}}(t,e)})}function Xt(e){return c(a(a(a(a({},rt(e)),function(e){return{saveFile:t=>v("saveFile",t,{target:e}),writeFile:t=>v("writeFile",t,{target:e}),appendFile:t=>v("appendFile",t,{target:e}),readFile:t=>v("readFile",t,{target:e}),readDir:t=>v("readDir",t,{target:e}),statFile:t=>v("statFile",t,{target:e}),unlink:t=>v("unlink",t,{target:e}),mkdir:t=>v("mkdir",t,{target:e}),getFileStorageInfo:(t={})=>v("getFileStorageInfo",t,{target:e})}}(e)),Ct(e)),function(e){return{clearStorage:$t(e),getStorage:Nt(e),getStorageInfo:Rt(e),removeStorage:Pt(e),setStorage:Mt(e)}}(e)),{followAuthor:it(e),getFollowStatus:at(e),getLaunchOptions:ue(e),getLocation:ut(e),getWindowInfo:dt(e),interactionOpenApi:wt(e),offGyroscopeChange:bt(e),onGyroscopeChange:yt(e),postNote:Lt(e),request:he(e),saveImageToPhotosAlbum:xt(e),startGyroscope:mt(e),stopGyroscope:gt(e),openRedPage:It(e),vibrateLong:Ft(e),vibrateShort:Bt(e),xhsOpenSiteLocation:Gt(e),writeTempFile:Ht(e)})}function Wt(e){throw Object.assign(new Error(`invalid parameter; param=${e}`),{code:10001})}function Vt(e){throw Object.assign(new Error(`payload too large; param=${e}`),{code:10002})}function Yt(e,t,r=0,n=new Set){if(null===e||"string"==typeof e||"boolean"==typeof e)return;if("number"==typeof e)return void(Number.isFinite(e)||Wt(t));"object"!=typeof e&&Wt(t),n.has(e)&&Wt(t),r>5&&Vt(t);const o=Array.isArray(e),s=Object.getPrototypeOf(e);o||null===s||null===Object.getPrototypeOf(s)||Wt(t);for(let r=e;null!==r;r=Object.getPrototypeOf(r)){const e=Object.getOwnPropertyDescriptor(r,"toJSON");if(e){"value"in e&&"function"!=typeof e.value||Wt(t);break}}n.add(e);const i=Object.keys(e);o&&i.length!==e.length&&Wt(t);for(const s of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,s);i.enumerable&&("string"==typeof s&&"value"in i||Wt(t),o&&(!/^(0|[1-9]\\d*)$/.test(s)||Number(s)>=e.length)&&Wt(t),Yt(i.value,`${t}.${s}`,r+1,n))}n.delete(e)}function Qt(e,t,r){const n=JSON.stringify(e);(new TextEncoder).encode(n).byteLength>t&&Vt(r)}function Zt(e){const t=e,{success:r,complete:n,fail:o}=t,s=l(t,["success","complete","fail"]);if(Yt(s,"message"),"params"in s&&Qt(s.params,4096,"params"),s.index&&"object"==typeof s.index)for(const[e,t]of Object.entries(s.index))"string"==typeof t&&[...t].length>256&&Vt(`index.${e}`);return Qt(s,8192,"message"),s}function er(e){return t=>v("reportUba",t,{target:e,prepareRequest:Zt})}const tr=Symbol.for("xhs.internal");"undefined"!=typeof window&&(function(e={}){var t;const r=null!=(t=e.target)?t:u();if(!r)throw new Error("window is unavailable");if(g(r),!r.xhs||e.force){const e=Object.freeze({AI:Se(r),config:()=>{},get launchOptions(){return le(r)},miniTool:Object.freeze(c(a(a({},Xt(r)),{}),{version:"0.4.3"}))});r.xhs=e}!function(e){Object.prototype.hasOwnProperty.call(e,tr)||Object.defineProperty(e,tr,{get:()=>Object.freeze({reportUba:er(e)}),set(e){},configurable:!1,enumerable:!1})}(r)}({target:window}),function(e={}){var t,r;const n=null!=(t=e.target)?t:"undefined"==typeof window?void 0:window;if(!n)return;const o=n,s=n;if(s[_])return;s[_]=!0;const i=new Set;function a(e){try{const t=JSON.stringify(e);if(i.has(t))return;i.add(t),S(o,e)}catch(e){}}n.addEventListener("error",e=>{var t;try{const r=e,o=r.target;if(o&&o!==n&&o.tagName)return void a({type:"error",name:"ResourceError",message:`${o.tagName} 资源加载失败`,source:String(o.tagName).toLowerCase(),url:String(o.src||o.href||"")});const s=null!=(t=r.error)?t:{};a({type:"error",name:s.name||"Error",message:(r.message||String(s.message||"")).slice(0,512),source:`${r.filename||""}:${r.lineno||0}:${r.colno||0}`,url:r.filename||"",stack:s.stack?String(s.stack).slice(0,512):""})}catch(e){}},!0),n.addEventListener("unhandledrejection",e=>{try{const t=e.reason;let r="UnhandledRejection",n="",o="";if(t&&"object"==typeof t){const e=t;r=e.name||r,n=e.message||String(t),o=e.stack?String(e.stack).slice(0,512):""}else n=String(t);a({type:"unhandledrejection",name:r,message:n.slice(0,512),stack:o})}catch(e){}}),null==(r=n.document)||r.addEventListener("securitypolicyviolation",e=>{try{a({type:"securitypolicyviolation",name:"CSPViolation",disposition:e.disposition||"",effective_directive:e.effectiveDirective||"",violated_directive:e.violatedDirective||"",blocked_uri:e.blockedURI||"",source_file:e.sourceFile||"",line_number:e.lineNumber||0,column_number:e.columnNumber||0,original_policy:e.originalPolicy||""})}catch(e){}});try{const e=n,t=e.fetch;"function"==typeof t&&(e.fetch=function(e,r){const n=function(e){try{return"string"==typeof e?e:String(e&&"object"==typeof e&&"url"in e?e.url:e)}catch(e){return""}}(e);return t.call(this,e,r).then(e=>e,e=>{throw a({type:"fetch",name:C(e),message:(k(e)||"fetch failed").slice(0,512),url:n,stack:E(e)}),e})})}catch(e){}}({target:window}))});', li = ai, ci = /<meta[^>]+name=["']x-miniapp-jsapi-mode["'][^>]+content=["']external["'][^>]*>/i, di = /<script[^>]+src=["'][^"']*miniapp-js-api[^"']*\.umd[^"']*["']/i;
1989
- function ui(r) {
1990
- return !!(ci.test(r) || di.test(r));
1987
+ `, li = '/*! xhs-script-version=0.4.3 */\n!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,i=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,a=(e,t)=>{for(var r in t||(t={}))o.call(t,r)&&i(e,r,t[r]);if(n)for(var r of n(t))s.call(t,r)&&i(e,r,t[r]);return e},c=(e,n)=>t(e,r(n)),l=(e,t)=>{var r={};for(var i in e)o.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&n)for(var i of n(e))t.indexOf(i)<0&&s.call(e,i)&&(r[i]=e[i]);return r};function u(){return"undefined"==typeof window?void 0:window}let d,f,p=!1;const m=new WeakMap;function g(e){p||(!function(e){var t;if(d)return d;const r=[null==(t=e.webkit)?void 0:t.messageHandlers,e].find(e=>{var t;return"function"==typeof(null==(t=null==e?void 0:e.xhsInvoke)?void 0:t.postMessage)}),n=null==r?void 0:r.xhsInvoke;if(!n)throw new Error("xhsInvoke unavailable");if(!Reflect.defineProperty(r,"xhsInvoke",{value:void 0,writable:!1,configurable:!1,enumerable:!1})||void 0!==r.xhsInvoke)throw new Error("Failed to hide xhsInvoke");f=r,d=n}(e),null!=e.XHS_SDK_CALLBACKS||(e.XHS_SDK_CALLBACKS={}),null!=e.XHS_SDK_CALLBACKS_ID||(e.XHS_SDK_CALLBACKS_ID=0),m.set(e,new Map),e.XHS_SDK_INVOKE_CALLBACKS=(t,r)=>{var n,o;const s=null==(n=e.XHS_SDK_CALLBACKS)?void 0:n[r];if(!s)return;null==(o=e.XHS_SDK_CALLBACKS)||delete o[r];const i=function(e){if("string"!=typeof e)return null!=e?e:{code:-1,msg:"empty bridge result"};try{const t=JSON.parse(e);return t&&"object"==typeof t?t:{code:-1,msg:"invalid bridge result"}}catch(t){return{code:-1,msg:e||"invalid bridge result"}}}(t);0===i.code?function(e,t){var r,n,o;const s=t&&"object"==typeof t&&!Array.isArray(t)?c(a({},t),{errMsg:`${e.api}:ok`}):void 0===t?{errMsg:`${e.api}:ok`}:{data:t,errMsg:`${e.api}:ok`};null==(r=e.resolve)||r.call(e,s);try{null==(n=e.success)||n.call(e,s)}finally{null==(o=e.complete)||o.call(e,s)}}(s,i.data):function(e,t){var r,n,o;null==(r=e.reject)||r.call(e,t);try{null==(n=e.fail)||n.call(e,t)}finally{null==(o=e.complete)||o.call(e,t)}}(s,{errMsg:`${s.api}:fail${i.msg?` ${i.msg}`:""}`,errCode:i.code})},e.XHS_SDK_EVENTS_CALLBACKS=t=>{var r;const n=function(e){let t;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){return}else t=e;return"events"===(null==t?void 0:t.type)&&"string"==typeof t.method?t:void 0}(t);if(!n)return;const o=null==(r=m.get(e))?void 0:r.get(n.method);if(o)for(const e of[...o])e(n)},p=!0)}function h(e,t,r=u()){var n;if(!r)throw new Error("window is unavailable");if(!e||"function"!=typeof t)throw new TypeError("invalid event subscription");const o=m.get(r);if(!o)throw new Error("bridge is not initialized");const s=t,i=null!=(n=o.get(e))?n:new Set;return i.add(s),o.set(e,i),{remove(){const t=o.get(e);null==t||t.delete(s),0===(null==t?void 0:t.size)&&o.delete(e)}}}function v(e,t={},r={}){const{target:n,validate:o,prepareRequest:s}=r,i=t,{success:a,fail:c,complete:p}=i,m=l(i,["success","fail","complete"]);w("success",a),w("fail",c),w("complete",p);const g=!(a||c||p);let h=m;try{null==o||o(h),s&&(h=s(h))}catch(t){return y(e,t,g,c,p)}const v=null!=n?n:u();if(!v)return y(e,new Error("window is unavailable"),g,c,p);let _,S;const k=new Promise((e,t)=>{_=e,S=t}),C="xhs_"+ ++v.XHS_SDK_CALLBACKS_ID;v.XHS_SDK_CALLBACKS[C]=g?{api:e,resolve:_,reject:S}:{api:e,success:a,fail:c,complete:p};try{!function(e){if(!d||!f||void 0!==f.xhsInvoke)throw new Error("xhsInvoke bridge is unavailable");d.postMessage(e)}(JSON.stringify({event:e,message:h,callbackId:C}))}catch(t){delete v.XHS_SDK_CALLBACKS[C];const r=b(e,t);return g?(null==S||S(r),k):(null==c||c(r),void(null==p||p(r)))}return g?k:void 0}function y(e,t,r,n,o){const s=b(e,t);if(r)return Promise.reject(s);null==n||n(s),null==o||o(s)}function b(e,t){const r=t instanceof Error?t.message:String(t),n=t&&"object"==typeof t&&"code"in t&&"number"==typeof t.code?t.code:void 0;return a({errMsg:`${e}:fail ${r}`},void 0===n?{}:{errCode:n})}function w(e,t){if(void 0!==t&&"function"!=typeof t)throw new TypeError(`${e} must be a function`)}const _="__xhsErrorMonitorInstalled__";function S(e,t){try{const r=v("reportTracker",{eventName:"minitool_error",data:t},{target:e});r&&r.catch(()=>{})}catch(e){}}function k(e){return e instanceof Error?e.message:String(e&&"object"==typeof e&&"message"in e?e.message:e)}function C(e){return e instanceof Error?e.name||"Error":e&&"object"==typeof e&&"name"in e&&String(e.name)||"Error"}function E(e){const t=e instanceof Error?e.stack:null==e?void 0:e.stack;return t?String(t).slice(0,512):""}class A{constructor(){this.aborted=!1,this.listeners=new Set}addEventListener(e,t,r){"abort"===e&&t&&this.listeners.add(t)}removeEventListener(e,t){"abort"===e&&t&&this.listeners.delete(t)}abort(e){if(this.aborted)return;this.aborted=!0,this.reason=e;const t={type:"abort",target:this,currentTarget:this},r=[...this.listeners];this.listeners.clear();for(const e of r)"function"==typeof e?e.call(this,t):e.handleEvent(t)}}const q=Object.freeze({default:"/api/sns/v1/creator/red_app/chat/completions",creator:"/api/sns/v1/creator/red_app/creator/chat/completions",mars:"/api/sns/v1/creator/red_app/mars/chat/completions"});function j(e,t){return`${e.replace(/\\/+$/,"")}/${t.replace(/^\\/+/,"")}`}const O=-104001;class I extends Error{constructor(e){super(e.message),this.name="AIError",this.code=e.code,this.requestId=e.requestId,this.details=e.details}}function T(e){if(e instanceof I)return e;const t=function(e){return x(e)&&"number"==typeof e.errCode?e.errCode:void 0}(e);return new I({code:O,message:L(e),details:void 0===t?void 0:{bridgeCode:t}})}function L(e){if(e instanceof Error)return e.message;if(x(e)){if("string"==typeof e.errMsg)return e.errMsg;if("string"==typeof e.message)return e.message}return"string"==typeof e?e:"AI request failed"}function x(e){return null!==e&&"object"==typeof e}const $=[239,187,191];const N=Symbol.for("Symbol.asyncIterator"),R="symbol"==typeof Symbol.asyncIterator?Symbol.asyncIterator:N;function P(e){const t=e;if("function"==typeof e[R])return t;const r=()=>{const t=e.getReader();let r=!1;const n=()=>{r||(r=!0,t.releaseLock())},o={async next(){try{const e=await t.read();return e.done&&n(),e}catch(e){throw n(),e}},async return(){try{await t.cancel()}finally{n()}return{done:!0,value:void 0}}};return Object.defineProperty(o,R,{value:()=>o}),o};return Object.defineProperty(e,R,{configurable:!0,value:r}),R!==N&&Object.defineProperty(e,N,{configurable:!0,value:r}),t}function M(e){const t=function(e){if("getReader"in e){const t=e.getReader();let r=!1;const n=()=>{r||(r=!0,t.releaseLock())};return new ReadableStream({async pull(e){try{const r=await t.read();r.done?(n(),e.close()):e.enqueue(r.value)}catch(t){n(),e.error(t)}},async cancel(e){var r;try{await(null==(r=t.cancel)?void 0:r.call(t,e))}finally{n()}}})}const t=e[R].call(e);return new ReadableStream({async pull(e){const r=await t.next();r.done?e.close():e.enqueue(r.value)},async cancel(e){var r;await(null==(r=t.return)?void 0:r.call(t,e))}})}(e).getReader();let r,n=!1,o=!1;const s=()=>{o||(o=!0,t.releaseLock())};return P(new ReadableStream({start(e){r=function(e){let t,r,n,o,s,i,a;return c(),{feed:function(e){r=r?r+e:e,t&&function(e){return $.every((t,r)=>e.charCodeAt(r)===t)}(r)&&(r=r.slice($.length)),t=!1;const{length:s}=r;let i=0,a=!1;for(;i<s;){a&&("\\n"===r[i]&&(i+=1),a=!1);let e,t=-1,c=o;for(let o=n;t<0&&o<s;o++)e=r[o],":"===e&&c<0?c=o-i:"\\r"===e?(a=!0,t=o-i):"\\n"===e&&(t=o-i);if(t<0){n=s-i,o=c;break}n=0,o=-1,l(r,i,c,t),i+=t+1}i===s?r="":i>0&&(r=r.slice(i))},reset:c};function c(){t=!0,r="",n=0,o=-1,s=void 0,i=void 0,a=""}function l(t,r,n,o){if(0===o)return a.length>0&&(e({type:"event",id:s,event:i||void 0,data:a.slice(0,-1)}),a="",s=void 0),void(i=void 0);const c=n<0,l=t.slice(r,r+(c?o:n));let u=0;u=c?o:" "===t[r+n+1]?n+2:n+1;const d=r+u,f=o-u,p=t.slice(d,d+f).toString();if("data"===l)a+=p?`${p}\\n`:"\\n";else if("event"===l)i=p;else if("id"!==l||p.includes("\\0")){if("retry"===l){const t=Number.parseInt(p,10);Number.isNaN(t)||e({type:"reconnect-interval",value:t})}}else s=p}}(t=>{if("event"===t.type&&"[DONE]"!==t.data)try{const r=JSON.parse(t.data);if(!r||"object"!=typeof r||Array.isArray(r))throw new TypeError("SSE data must be a JSON object");e.enqueue(r)}catch(e){throw new I({code:O,message:"AI chat gateway returned invalid SSE data",details:{cause:e instanceof Error?e.message:String(e)}})}}),(async()=>{try{for(;!n;){const o=await t.read();if(o.done)return n=!0,s(),void e.close();const i=o.value;i&&r.feed(i)}}catch(r){if(n)return;n=!0;try{await t.cancel(r)}catch(e){}finally{s()}e.error(r)}})()},async cancel(e){if(!n){n=!0;try{await t.cancel(e)}finally{s()}}}}))}class D{constructor(e,t,r){this.req=e,this.getBaseUrl=t,this.getSubUrl=r}}const K="x-minitool-appid",B=Object.freeze({max_output_tokens:1024,temperature:1});function F(e,t,r,n){var o,s;return function(e){z(e)||H("request");Array.isArray(e.messages)||H("messages");e.messages.forEach((e,t)=>{var r;z(e)||H(`messages[${t}]`),"string"==typeof(r=e.content)||"object"==typeof r&&null!==r||H(`messages[${t}].content`)}),U(e.max_output_tokens)||H("max_output_tokens");U(e.temperature)||H("temperature");U(e.top_p)||H("top_p");t=e.stop,void 0===t||"string"==typeof t||Array.isArray(t)&&t.every(e=>"string"==typeof e)||H("stop");var t;J(e.response_format)||H("response_format");J(e.thinking)||H("thinking");(function(e){return void 0===e||"string"==typeof e})(e.reasoning_effort)||H("reasoning_effort")}(t),c(a(a({},t),n?{app_id:n}:{}),{model:e,max_output_tokens:null!=(o=t.max_output_tokens)?o:B.max_output_tokens,temperature:null!=(s=t.temperature)?s:B.temperature,stream:r})}function H(e){throw new I({code:104001,message:`请求参数不合法:${e}`})}function U(e){return void 0===e||"number"==typeof e&&Number.isFinite(e)&&e>=0}function J(e){return void 0===e||z(e)}function z(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function G(e){var t,r,n;return c(a({},e),{prompt_tokens:null!=(t=null==e?void 0:e.prompt_tokens)?t:0,completion_tokens:null!=(r=null==e?void 0:e.completion_tokens)?r:0,total_tokens:null!=(n=null==e?void 0:e.total_tokens)?n:0})}function X(e){if(!Y(e))return;const t=W(e);return t||(Y(e.data)?W(e.data):void 0)}function W(e){var t,r;const n=void 0!==e.code&&0!==e.code;if(!1===e.success||n){const r=n&&void 0!==e.code?e.code:O;return new I({code:r,message:null!=(t=e.msg)?t:"AI chat request failed",requestId:e.request_id})}if(e.error)return new I({code:O,message:null!=(r=e.error.message)?r:"AI chat request failed",requestId:e.request_id,details:a(a({},void 0===e.error.code?{}:{providerCode:e.error.code}),void 0===e.error.retriable?{}:{retriable:e.error.retriable})})}function V(e,t){const r=X(e.data);if(r)throw r;if(void 0!==e.statusCode&&e.statusCode>=400)throw new I({code:O,message:`AI request failed with status ${e.statusCode}`,details:{statusCode:e.statusCode}});if(!e.data)throw new I({code:O,message:t});return e.data}function Y(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Q(e){var t,r;const n=function(){if("function"==typeof AbortController)return new AbortController;const e=new A;return{signal:e,abort:t=>e.abort(t)}}();let o=!1;const s=()=>{var t;return n.abort(null==(t=null==e?void 0:e.signal)?void 0:t.reason)};(null==(t=null==e?void 0:e.signal)?void 0:t.aborted)?s():null==(r=null==e?void 0:e.signal)||r.addEventListener("abort",s,{once:!0});const i=void 0!==(null==e?void 0:e.timeoutMs)&&e.timeoutMs>0?setTimeout(()=>{o=!0,n.abort("timeout")},e.timeoutMs):void 0;return{controller:n,get timedOut(){return o},cleanup(){var t;void 0!==i&&clearTimeout(i),null==(t=null==e?void 0:e.signal)||t.removeEventListener("abort",s)}}}function Z(e,t){return t.timedOut?new I({code:O,message:"AI request timed out"}):t.controller.signal.aborted?new I({code:O,message:"AI request was aborted"}):T(e)}function ee(e,t=0){var r,n,o,s,i;const l=null!=(r=null==e?void 0:e.message)?r:{};return c(a({},e),{index:null!=(n=null==e?void 0:e.index)?n:t,message:c(a({},l),{role:null!=(o=l.role)?o:"assistant",content:null!=(s=l.content)?s:""}),finish_reason:null!=(i=null==e?void 0:e.finish_reason)?i:void 0})}class te extends D{constructor(e,t,r,n,o=()=>"/chat/completions",s){super(e,t,o),this.modelName=r,this.getAppId=n,this.onError=s}reportError(e,t){if(this.onError)try{Promise.resolve(this.onError(e,{model:this.modelName,operation:t})).catch(()=>{})}catch(e){}}requestOptions(e,t,r,n){var o;const s=null==(o=this.getAppId)?void 0:o.call(this),i=F(this.modelName,e,t,s);return{url:j(this.getBaseUrl(),this.getSubUrl()),method:"post",headers:a(a({"Content-Type":"application/json"},null==n?void 0:n.headers),s?{[K]:s}:{}),data:i,responseType:t?"stream":"json",stream:t,signal:r}}async doGenerate(e,t){var r;const n=Q(t);try{const o=await this.req.post(this.requestOptions(e,!1,n.controller.signal,t)),s=function(e){var t;if(!("code"in e||"success"in e||"msg"in e)||null===e.data||"object"!=typeof e.data||Array.isArray(e.data))return e;const r=e.data;return c(a({},r),{request_id:null!=(t=r.request_id)?t:e.request_id})}(V(o,"AI response is empty"));return function(e,t,r){var n,o,s;const i=(null==(n=e.choices)?void 0:n.length)?e.choices.map(ee):[ee(void 0)];return c(a({},e),{request_id:null!=(s=null!=(o=e.request_id)?o:e.id)?s:t,model:r,choices:i,usage:G(e.usage)})}(s,null!=(r=null==t?void 0:t.idempotencyKey)?r:this.modelName,this.modelName)}catch(e){const t=Z(e,n);throw this.reportError(t,"generateText"),t}finally{n.cleanup()}}async doStream(e,t){var r;const n=Q(t),o=null!=(r=null==t?void 0:t.idempotencyKey)?r:`chat_${Date.now().toString(36)}`,s=function(){let e,t;return{promise:new Promise((r,n)=>{e=r,t=n}),resolve:e,reject:t}}();s.promise.catch(()=>{});let i=n.controller.signal.aborted;const u=P(new ReadableStream({start:r=>{if(i){const e=new I({code:O,message:"AI request was aborted"});return r.error(e),s.reject(e),void n.cleanup()}(async()=>{var u,d,f;let p,m=0;const g={},h=new Map;try{const v=await this.req.post(this.requestOptions(e,!0,n.controller.signal,t));if(i)return;const y=M(V(v,"AI stream is empty")).getReader();let b=!1;try{for(;;){const e=await y.read();if(e.done){b=!0;break}const t=e.value;if(i)return;const n=X(t);if(n)throw n;t.usage&&(p=t.usage);const s=t,{choices:v,usage:w}=s,_=l(s,["choices","usage"]);Object.assign(g,_);const S=(null!=(u=t.choices)?u:[]).map((e,t)=>{var r,n,o,s;const i=null!=(r=e.index)?r:t,u=null!=(n=e.delta)?n:{},d=null!=(o=h.get(i))?o:{fields:{},content:"",reasoning_content:""},f=e,{delta:p,message:g}=f,v=l(f,["delta","message"]);return Object.assign(d.fields,v),u.content&&(d.content+=u.content),u.reasoning_content&&(d.reasoning_content+=u.reasoning_content),e.finish_reason&&(d.finish_reason=e.finish_reason),h.set(i,d),c(a({},e),{index:i,delta:a(a({},u),0===m&&void 0===u.role?{role:"assistant"}:{}),finish_reason:null!=(s=e.finish_reason)?s:void 0})});m+=1,r.enqueue(c(a({},t),{request_id:null!=(f=null!=(d=t.request_id)?d:t.id)?f:o,model:this.modelName,seq:m,choices:S}))}}finally{b||await y.cancel().catch(()=>{}),y.releaseLock()}if(i)return;r.close();const w=[...h.entries()].map(([e,t])=>c(a({},t.fields),{index:e,message:a({role:"assistant",content:t.content},t.reasoning_content?{reasoning_content:t.reasoning_content}:{}),finish_reason:t.finish_reason}));s.resolve(c(a({},g),{request_id:"string"==typeof g.request_id?g.request_id:"string"==typeof g.id?g.id:o,model:this.modelName,choices:w,usage:G(p)}))}catch(e){if(i)return;const t=Z(e,n);this.reportError(t,"streamText"),r.error(t),s.reject(t)}finally{n.cleanup()}})()},cancel:e=>{i||(i=!0,n.controller.abort(e),n.cleanup(),s.reject(new I({code:O,message:"AI stream was canceled by consumer"})))}}));return Object.defineProperties(u,{request_id:{enumerable:!0,value:o},result:{enumerable:!0,value:s.promise}}),u}}const re=new WeakMap;function ne(e){const t=re.get(e);if(!t)throw new Error("AI model is not initialized");return t}class oe{constructor(e){this.generateText=async(e,t)=>ne(this).doGenerate(e,t),this.streamText=async(e,t)=>ne(this).doStream(e,t),re.set(this,e)}}const se=new WeakMap;class ie{constructor(e,t,r,n,o){this.createModel=e=>{const{request:t,getBaseUrl:r,getAppId:n,getSubUrl:o,onError:s}=function(e){const t=se.get(e);if(!t)throw new Error("AI is not initialized");return t}(this);return new oe(new te(t,r,e,n,o,s))},se.set(this,{request:e,getBaseUrl:t,getAppId:r,getSubUrl:n,onError:o})}}const ae="https://edith.xiaohongshu.com";function ce({getAppId:e,getGateway:t,getBusinessLine:r,onError:n,request:o}){if(!o)throw new Error("`request` is required!");return new ie(o,()=>{var e;return function(e){if("string"!=typeof e||!e.trim())throw new Error("`gateway` must be a non-empty HTTPS URL");const t=e.trim();let r;try{r=new URL(t)}catch(e){throw new Error("`gateway` must be an absolute HTTPS URL")}if(n=r,"https:"!==n.protocol&&("http:"!==n.protocol||"localhost"!==n.hostname&&"127.0.0.1"!==n.hostname&&"[::1]"!==n.hostname))throw new Error("`gateway` must use HTTPS (HTTP is allowed only for loopback development)");var n;return t.replace(/\\/+$/,"")}(null!=(e=null==t?void 0:t())?e:ae)},()=>{return(null==(t=null==e?void 0:e())?void 0:t.trim())||void 0;var t},()=>function(e){switch(null==e?void 0:e.trim()){case"creator":return q.creator;case"mars":return q.mars;default:return q.default}}(null==r?void 0:r()),n)}function le(e){var t;const r=null==(t=null==e?void 0:e.$xhs)?void 0:t.launchOptions;return!r||"object"!=typeof r||Array.isArray(r)?{}:r}function ue(e){return(t={})=>v("getLaunchOptions",t,{target:e})}const de=10001;let fe=0;class pe{constructor(e){this.target=e,this.id=(fe+=1,`xhs_request_${Date.now().toString(36)}_${fe.toString(36)}`),this.chunkCallbacks=new Set,this.headersCallbacks=new Set,this.terminal=!1}get isSettled(){return this.terminal}abort(){this.terminal||(this.terminal=!0,this.dispose(),Promise.resolve(v("abortRequest",{taskId:this.id},{target:this.target})).catch(()=>{}))}onChunkReceived(e){this.terminal||"function"!=typeof e||(this.chunkCallbacks.add(e),this.chunkSubscription||(this.chunkSubscription=h("onEventStream",({payload:e})=>{if(!this.terminal&&(null==e?void 0:e.taskId)===this.id&&"string"==typeof e.chunk)for(const t of[...this.chunkCallbacks])t({data:e.chunk})},this.target)))}offChunkReceived(e){var t;e?this.chunkCallbacks.delete(e):this.chunkCallbacks.clear(),0===this.chunkCallbacks.size&&(null==(t=this.chunkSubscription)||t.remove(),this.chunkSubscription=void 0)}onHeadersReceived(e){this.terminal||"function"!=typeof e||(this.headersCallbacks.add(e),this.headersSubscription||(this.headersSubscription=h("onHeadersReceivedRequest",({payload:e})=>{if(this.terminal||(null==e?void 0:e.taskId)!==this.id)return;const t=e,{taskId:r}=t,n=l(t,["taskId"]);for(const e of[...this.headersCallbacks])e(n)},this.target)))}offHeadersReceived(e){var t;e?this.headersCallbacks.delete(e):this.headersCallbacks.clear(),0===this.headersCallbacks.size&&(null==(t=this.headersSubscription)||t.remove(),this.headersSubscription=void 0)}settle(){this.terminal||(this.terminal=!0,this.dispose())}dispose(){var e,t;null==(e=this.chunkSubscription)||e.remove(),null==(t=this.headersSubscription)||t.remove(),this.chunkSubscription=void 0,this.headersSubscription=void 0,this.chunkCallbacks.clear(),this.headersCallbacks.clear()}}function me(e,t){return function(r){var n,o,s,i,a;const c=new pe(e);if((l=r.data)instanceof ArrayBuffer||ArrayBuffer.isView(l))return function(e,t,r){ge(e,t,r,"request data does not support ArrayBuffer")}(t,c,r),c;var l;if(void 0!==r.responseType&&"text"!==r.responseType)return function(e,t,r){ge(e,t,r,"request responseType only supports text")}(t,c,r),c;const u={taskId:c.id,url:r.url,method:null!=(n=r.method)?n:"GET",header:r.header,data:r.data,dataType:null!=(o=r.dataType)?o:"json",responseType:null!=(s=r.responseType)?s:"text",timeout:null!=(i=r.timeout)?i:6e4,enableChunked:null!=(a=r.enableChunked)&&a,success(e){var t;null==(t=r.success)||t.call(r,e)},fail(e){var t;null==(t=r.fail)||t.call(r,e)},complete(e){var t;c.settle(),null==(t=r.complete)||t.call(r,e)}};return setTimeout(()=>{c.isSettled||v(t,u,{target:e})},0),c}}function ge(e,t,r,n){const o={errMsg:`${e}:fail ${n}`,errCode:de};setTimeout(()=>{var e,n;if(!t.isSettled){t.settle();try{null==(e=r.fail)||e.call(r,o)}finally{null==(n=r.complete)||n.call(r,o)}}},0)}function he(e){return me(e,"request")}function ve(e){return me(e,"xhsRequest")}function ye(e,t,r){const n="stream"===t.responseType||!0===t.stream;return new Promise((o,s)=>{let i,a,c=!1,l=!1;const u=n?new ReadableStream({start(e){a=e},cancel(){g(_e())}}):void 0,d=t.signal,f=()=>g(_e()),p=()=>!c&&(c=!0,null==d||d.removeEventListener("abort",f),!0),m=e=>{if(!p())return;const t=function(e){if(e instanceof Error)return e;if(function(e){return Boolean(e&&"object"==typeof e&&"errMsg"in e)}(e)){const t=new Error(e.errMsg);return t.name="XhsBridgeError",void 0!==e.errCode&&(t.errCode=e.errCode),t}return new Error(String(e))}(e);l?null==a||a.error(t):s(t)},g=e=>{null==i||i.abort(),m(e)},h=e=>{l||(l=!0,o(e))};i=e({url:t.url,method:we(r),header:t.headers,data:t.data,dataType:n?"text":"json",responseType:"text",enableChunked:n,success(e){if(!c)return u?(h(be(e,u)),void(p()&&(null==a||a.close()))):void(p()&&h(function(e){return{statusCode:e.statusCode,headers:e.header,data:e.data}}(e)))},fail:m}),u&&(i.onHeadersReceived(e=>{h(be(e,u))}),i.onChunkReceived(({data:e})=>{c||null==a||a.enqueue(e)})),(null==d?void 0:d.aborted)?f():null==d||d.addEventListener("abort",f,{once:!0})})}function be(e,t){return{statusCode:e.statusCode,headers:e.header,data:t}}function we(e){return"get"===e?"GET":"POST"}function _e(){const e=new Error("request was aborted");return e.name="AbortError",e}function Se(e){return ce({getAppId:()=>{var t;return ke(null==(t=le(e).miniToolEnv)?void 0:t.appId)},getGateway:()=>{var t,r;return ke(null==(r=null==(t=le(e).miniToolEnv)?void 0:t.gateways)?void 0:r.edith)},getBusinessLine:()=>{var t;return ke(null==(t=le(e).miniToolEnv)?void 0:t.businessLine)},onError:(t,r)=>{var n;S(e,{type:"ai",name:r.model,message:t.message.slice(0,512),stack:null==(n=t.stack)?void 0:n.slice(0,512),code:t.code,request_id:t.requestId,details:t.details,model:r.model,operation:r.operation})},request:(t=ve(e),{get:e=>ye(t,e,"get"),post:e=>ye(t,e,"post")})});var t}function ke(e){if("string"!=typeof e)return;return e.trim()||void 0}const Ce="INVALID_ARGUMENT",Ee="NETWORK_ERROR",Ae="BAD_RESPONSE",qe="SERVER_ERROR";class je extends Error{constructor(e,t,r={}){super(t),this.name="CloudServiceError",this.code=e,void 0!==r.errCode&&(this.errCode=r.errCode),void 0!==r.details&&(this.details=r.details)}}function Oe(e,t,r,n,o={}){var s;const i=null!=(s=o.errCode)?s:t===Ce?de:void 0;throw S(n,{type:"jsapi",name:"CloudServiceError",message:`${e}: ${r}`.slice(0,512),details:a({api:e,code:t,errCode:i},o.details)}),new je(t,`${e}:fail ${r}`,c(a({},o),{errCode:i}))}const Ie={all:"ALL",month:"MONTH",week:"WEEK",day:"DAY"};function Te(e,t,r,n){t||Oe(e,Ce,r,n)}function Le(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function xe(e,t,r){return Te(e,"string"==typeof t&&t.trim().length>0,"collection must be a non-empty string",r),t.trim()}function $e(e,t,r){return void 0===t?1:(Te(e,"number"==typeof t&&Number.isInteger(t)&&t>=1&&t<=5,"board must be an integer between 1 and 5",r),t)}function Ne(e,t,r){return void 0===t?Ie.all:(Te(e,"string"==typeof t&&t in Ie,"period must be \'all\', \'month\', \'week\' or \'day\'",r),Ie[t])}function Re(e,t,r){return Te(e,"number"==typeof t&&Number.isFinite(t),"score must be a finite number",r),t}function Pe(e,t,r){Te(e,Array.isArray(t)&&t.length>0,"ids must be a non-empty array",r);const n=t,o=new Set;return n.map(t=>{Te(e,"string"==typeof t&&t.trim().length>0,"ids must contain non-empty strings",r);const n=t.trim();return Te(e,!o.has(n),`ids must not contain duplicates: ${n}`,r),o.add(n),n})}const Me=["success","fail","complete"];function De(e,t,r){!function(e){for(const t of Me){const r=null==e?void 0:e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError(`${t} must be a function`)}}(r);const{success:n,fail:o,complete:s}=null!=r?r:{};if(!(n||o||s))return t().then(t=>Ke(e,t),t=>{throw Be(e,t)});t().then(t=>{const r=Ke(e,t);try{null==n||n(r)}finally{null==s||s(r)}},t=>{const r=Be(e,t);try{null==o||o(r)}finally{null==s||s(r)}})}function Ke(e,t){return Le(t)?c(a({},t),{errMsg:`${e}:ok`}):{data:t,errMsg:`${e}:ok`}}function Be(e,t){if(t instanceof je){const e={errMsg:t.message};return void 0!==t.errCode&&(e.errCode=t.errCode),e}const r=t instanceof Error&&t.message?t.message:"";return{errMsg:r?`${e}:fail ${r}`:`${e}:fail`}}function Fe(e){var t,r,n;return null!=(n=Ue(null==(r=null==(t=le(e).miniToolEnv)?void 0:t.gateways)?void 0:r.edith))?n:ae}function He(e){var t;return Ue(null==(t=le(e).miniToolEnv)?void 0:t.businessLine)}function Ue(e){if("string"==typeof e)return e.trim()||void 0}const Je=Object.freeze({default:Object.freeze({batchCreate:"/api/sns/v1/creator/red_app/batch_create",batchUpdate:"/api/sns/v1/creator/red_app/batch_update",query:"/api/sns/v1/creator/red_app/query",batchDelete:"/api/sns/v1/creator/red_app/batch_delete",submitScore:"/api/sns/v1/creator/red_app/submit_score",queryTop100:"/api/sns/v1/creator/red_app/query_top_100",querySelfRank:"/api/sns/v1/creator/red_app/query_self_rank"}),creator:Object.freeze({batchCreate:"/api/sns/v1/creator/red_app/creator/batch_create",batchUpdate:"/api/sns/v1/creator/red_app/creator/batch_update",query:"/api/sns/v1/creator/red_app/creator/query",batchDelete:"/api/sns/v1/creator/red_app/creator/batch_delete",submitScore:"/api/sns/v1/creator/red_app/creator/submit_score",queryTop100:"/api/sns/v1/creator/red_app/creator/query_top_100",querySelfRank:"/api/sns/v1/creator/red_app/creator/query_self_rank"}),mars:Object.freeze({batchCreate:"/api/sns/v1/creator/red_app/mars/batch_create",batchUpdate:"/api/sns/v1/creator/red_app/mars/batch_update",query:"/api/sns/v1/creator/red_app/mars/query",batchDelete:"/api/sns/v1/creator/red_app/mars/batch_delete",submitScore:"/api/sns/v1/creator/red_app/mars/submit_score",queryTop100:"/api/sns/v1/creator/red_app/mars/query_top_100",querySelfRank:"/api/sns/v1/creator/red_app/mars/query_self_rank"})});function ze(e,t){switch(null==e?void 0:e.trim()){case"creator":return Je.creator[t];case"mars":return Je.mars[t];default:return Je.default[t]}}function Ge(e){const t=ve(e);return{post(r,n,o){const s=function(e){var t;return Ue(null==(t=le(e).miniToolEnv)?void 0:t.appId)}(e);s||Oe(r,Ce,"appId is unavailable: launchOptions.miniToolEnv.appId is missing",e);const i=a({request_context:{env:"prod",app_id:s}},o);return new Promise((o,s)=>{t({url:j(Fe(e),ze(He(e),n)),method:"POST",header:{"Content-Type":"application/json"},data:i,dataType:"json",success(t){try{o(function(e,t,r,n){var o;const s=Xe(t),i=s?Xe(s.data):void 0,a=i?Xe(i.result):void 0;if(!s||!i||!a){Oe(e,!1===(null==s?void 0:s.success)||void 0!==r&&(r<200||r>=300)?Ee:Ae,null!=(o=We(null==s?void 0:s.msg))?o:`unexpected response (statusCode=${r})`,n,{details:{statusCode:r,gatewayCode:null==s?void 0:s.code,body:Ve(t)}})}const c="number"==typeof a.code?a.code:!0===a.success?0:void 0,l=We(a.message);void 0===c&&Oe(e,qe,null!=l?l:"response is missing a numeric result code",n,{details:{statusCode:r}});if(0!==c&&2003!==c)throw new je(String(c),`${e}:fail ${null!=l?l:String(c)}`,{errCode:c});return i}(r,t.data,t.statusCode,e))}catch(e){s(e)}},fail(t){try{Oe(r,Ee,t.errMsg||"request failed",e,{errCode:t.errCode,details:{errCode:t.errCode}})}catch(e){s(e)}}})})}}}function Xe(e){if("string"==typeof e)try{return Xe(JSON.parse(e))}catch(e){return}if("object"==typeof e&&null!==e&&!Array.isArray(e))return e}function We(e){return"string"==typeof e&&e?e:void 0}function Ve(e){try{return("string"==typeof e?e:JSON.stringify(e)||"").slice(0,256)}catch(e){return""}}const Ye="DESC",Qe="addCloudStorage",Ze="updateCloudStorage",et="queryCloudStorage",tt="removeCloudStorage";function rt(e){const t=Ge(e);return{addCloudStorage:r=>De(Qe,()=>async function(e,t,r){const n=nt(Qe,t,r),o=xe(Qe,n.collection,r),s=ot(Qe,n.items,r),i=s.map((e,t)=>(Te(Qe,Le(e.content),`items[${t}].content must be an object`,r),{content_json:JSON.stringify(e.content)})),a=await e.post(Qe,"batchCreate",{collection:o,items:i});return st(Qe,a,i.map(()=>{}),r)}(t,r,e),r),updateCloudStorage:r=>De(Ze,()=>async function(e,t,r){const n=nt(Ze,t,r),o=xe(Ze,n.collection,r),s=ot(Ze,n.items,r),i=new Set,a=s.map((e,t)=>{Te(Ze,"string"==typeof e.id&&e.id.trim().length>0,`items[${t}].id must be a non-empty string`,r);const n=e.id.trim();return Te(Ze,!i.has(n),`items must not repeat id: ${n}`,r),i.add(n),Te(Ze,Le(e.content),`items[${t}].content must be an object`,r),{id:n,content_json:JSON.stringify(e.content)}}),c=await e.post(Ze,"batchUpdate",{collection:o,items:a});return st(Ze,c,a.map(e=>e.id),r)}(t,r,e),r),queryCloudStorage:(r={})=>De(et,()=>async function(e,t,r){var n,o;const s=nt(et,t,r),i=function(e,t){var r;const n=void 0!==e.ids,o=void 0!==e.collection;if(n)return{mode:"BY_IDS",collection:xe(et,e.collection,t),ids:Pe(et,e.ids,t)};const s=null!=(r=function(e,t,r){if(void 0!==t)return Te(e,"number"==typeof t&&Number.isInteger(t)&&t>0,"limit must be a positive integer",r),t}(et,e.limit,t))?r:20,i=function(e,t,r){if(null!=t)return Te(e,"string"==typeof t&&t.length>0,"cursor must be a non-empty string",r),t}(et,e.cursor,t);if(o)return a({mode:"COLLECTION",collection:xe(et,e.collection,t),sort_by:Ye,limit:s},void 0===i?{}:{cursor:i});return a({mode:"APP_ALL",limit:s},void 0===i?{}:{cursor:i})}(s,r),c=await e.post(et,"query",i),l=Le(c)&&Le(c.data)?c.data:void 0;l&&Array.isArray(l.items)||Oe(et,Ae,"response is missing data.data.items",r);const u={items:l.items.map(e=>function(e,t,r){const n=Le(t)?t:void 0;n&&"string"==typeof n.id&&"string"==typeof n.content_json||Oe(e,Ae,"record is missing id or content_json",r);let o;try{o=JSON.parse(n.content_json)}catch(e){o=void 0}Le(o)||Oe(e,Ae,"record.content_json is not a JSON object",r);return{id:n.id,collection:"string"==typeof n.collection?n.collection:"",content:o}}(et,e,r))};("next_cursor"in l||"nextCursor"in l)&&(u.nextCursor="string"==typeof(d=null!=(n=l.next_cursor)?n:l.nextCursor)&&d?d:null);var d;("has_more"in l||"hasMore"in l)&&(u.hasMore=!0===(null!=(o=l.has_more)?o:l.hasMore));return u}(t,r,e),r),removeCloudStorage:r=>De(tt,()=>async function(e,t,r){const n=nt(tt,t,r),o=Pe(tt,n.ids,r),s=await e.post(tt,"batchDelete",{collection:xe(tt,n.collection,r),ids:o});return st(tt,s,o,r)}(t,r,e),r)}}function nt(e,t,r){return Te(e,Le(t),"options must be an object",r),t}function ot(e,t,r){return Te(e,Array.isArray(t)&&t.length>0,"items must be a non-empty array",r),t.map((t,n)=>(Te(e,Le(t),`items[${n}] must be an object`,r),t))}function st(e,t,r,n){const o=function(e,t,r){const n=Le(t)?t:void 0;return n&&Array.isArray(n.results)||Oe(e,Ae,"response is missing data.results",r),n.results.map((t,n)=>(Te(e,Le(t),`data.results[${n}] must be an object`,r),t))}(e,t,n);o.length!==r.length&&Oe(e,Ae,`data.results length ${o.length} does not match request items ${r.length}`,n);const s=new Map;for(const e of o)for(const t of[e.item_id,e.id])"string"==typeof t&&t&&s.set(t,e);return r.map((t,r)=>{var i;const a=null!=(i=void 0!==t?s.get(t):void 0)?i:o[r];return function(e,t,r,n){const{id:o,status:s}=t;"string"!=typeof s&&Oe(e,Ae,"per-item result is missing status",n);return{id:"string"==typeof o?o:"string"==typeof r?r:"",status:s}}(e,a,t,n)})}function it(e){return(t={})=>v("followAuthor",t,{target:e})}function at(e){return(t={})=>v("getFollowStatus",t,{target:e})}class ct extends Error{constructor(e){super(e),this.code=de,this.name="JsApiParamError"}}function lt(e,t,r,n){t||function(e,t,r){throw S(r,{type:"jsapi",name:"JsApiParamError",message:t,code:de,details:{api:e}}),new ct(t)}(e,r,n)}function ut(e){return(t={})=>v("getLocation",t,{target:e,validate:t=>function(e,t){const{type:r}=e;lt("getLocation",void 0===r||"wgs84"===r||"gcj02"===r,\'type must be "wgs84" or "gcj02"\',t)}(t,e)})}function dt(e){return(t={})=>v("getWindowInfo",t,{target:e})}const ft=["game","ui","normal"],pt="startGyroscope";function mt(e){return(t={})=>v(pt,t,{target:e,validate:t=>function(e,t){const{interval:r}=e;lt(pt,void 0===r||ft.includes(r),\'interval must be "game", "ui" or "normal"\',t)}(t,e)})}function gt(e){return(t={})=>v("stopGyroscope",t,{target:e})}const ht=new WeakMap;function vt(e){let t=ht.get(e);return t||(t={callbacks:new Set},ht.set(e,t)),t}function yt(e){return t=>{if("function"!=typeof t)throw new TypeError("onGyroscopeChange callback must be a function");const r=null!=e?e:u();if(!r)throw new Error("window is unavailable");const n=vt(r);if(n.callbacks.has(t))return;if(n.callbacks.add(t),n.subscription)return;n.subscription=h("onGyroscopeChange",({payload:e})=>{for(const t of[...n.callbacks])try{t(e)}catch(e){}},r)}}function bt(e){return t=>{var r;if(void 0!==t&&"function"!=typeof t)throw new TypeError("offGyroscopeChange callback must be a function");const n=null!=e?e:u();if(!n)throw new Error("window is unavailable");const o=vt(n);t?o.callbacks.delete(t):o.callbacks.clear(),o.callbacks.size>0||(null==(r=o.subscription)||r.remove(),o.subscription=void 0)}}function wt(e){return t=>v("interactionOpenApi",t,{target:e})}const _t="submitScore",St="getRankList",kt="getMyRank";function Ct(e){const t=Ge(e);return{submitScore:r=>De(_t,()=>async function(e,t,r){var n;const o=Et(_t,t,r),s=await e.post(_t,"submitScore",{rank_code:$e(_t,o.board,r),score:Re(_t,o.score,r)}),i=At(_t,s,r),a=qt(null!=(n=i.bestScore)?n:i.best_score);void 0===a&&Oe(_t,Ae,"response is missing data.data.bestScore",r);return{score:a}}(t,r,e),r),getRankList:(r={})=>De(St,()=>async function(e,t,r){const n=Et(St,t,r),o=await e.post(St,"queryTop100",{rank_code:$e(St,n.board,r),rank_type:Ne(St,n.period,r),limit:100}),s=At(St,o,r);Array.isArray(s.items)||Oe(St,Ae,"response is missing data.data.items",r);return s.items.map((e,t)=>{var n;Te(St,Le(e),`data.items[${t}] is malformed`,r);const o=e,s=qt(o.score);return"number"==typeof o.rank&&void 0!==s||Oe(St,Ae,`data.items[${t}] is missing rank or score`,r),{rank:o.rank,score:s,nickname:jt(o.nickname),avatar:jt(null!=(n=o.avatar_url)?n:o.avatarUrl)}})}(t,r,e),r),getMyRank:(r={})=>De(kt,()=>async function(e,t,r){var n;const o=Et(kt,t,r),s=await e.post(kt,"querySelfRank",{rank_code:$e(kt,o.board,r),rank_type:Ne(kt,o.period,r)}),i=At(kt,s,r),a=void 0!==i.self_rank?i.self_rank:i.self,c=Le(a)?a:void 0;c&&"string"==typeof c.status||Oe(kt,Ae,"response is missing data.data.self_rank.status",r);return{status:c.status,rank:Ot(c.rank),score:null!=(n=qt(c.score))?n:null}}(t,r,e),r)}}function Et(e,t,r){return Te(e,Le(t),"options must be an object",r),t}function At(e,t,r){const n=Le(t)?t.data:void 0;return Le(n)||Oe(e,Ae,"response is missing data.data",r),n}function qt(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function jt(e){return"string"==typeof e&&e?e:null}function Ot(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function It(e){return t=>v("openRedPage",t,{target:e})}function Tt(e){return c(a({},e),{mediaInfo:JSON.stringify(e.mediaInfo||{})})}function Lt(e){return t=>v("postNote",t,{target:e,prepareRequest:Tt})}function xt(e){return t=>v("saveImageToPhotosAlbum",t,{target:e})}function $t(e){return(t={})=>v("clearStorage",t,{target:e})}function Nt(e){return t=>v("getStorage",t,{target:e})}function Rt(e){return(t={})=>v("getStorageInfo",t,{target:e})}function Pt(e){return t=>v("removeStorage",t,{target:e})}function Mt(e){return t=>v("setStorage",t,{target:e})}const Dt=["heavy","medium","light"],Kt="vibrateShort";function Bt(e){return t=>v(Kt,t,{target:e,validate:t=>function(e,t){const{type:r}=e;lt(Kt,Dt.includes(r),\'type must be "heavy", "medium" or "light"\',t)}(t,e)})}function Ft(e){return(t={})=>v("vibrateLong",t,{target:e})}function Ht(e){return t=>v("writeTempFile",t,{target:e})}const Ut="xhsOpenSiteLocation",Jt=["poi-detail","poi-list","path","navigation"];function zt(e){if(!e||"object"!=typeof e)return!1;const t=e;return"string"==typeof t.id&&t.id.length>0&&"number"==typeof t.latitude&&"number"==typeof t.longitude}function Gt(e){return t=>v("xhsOpenSiteLocation",t,{target:e,validate:t=>function(e,t){const{scene:r}=e;switch(lt(Ut,void 0!==r&&Jt.includes(r),\'scene must be "poi-detail" | "poi-list" | "path" | "navigation"\',t),r){case"poi-detail":lt(Ut,"string"==typeof e.id&&e.id.length>0,\'"poi-detail" requires a non-empty id\',t);break;case"poi-list":lt(Ut,Array.isArray(e.pois)&&e.pois.length>0,\'"poi-list" requires a non-empty pois array\',t);break;case"path":lt(Ut,zt(e.origin),\'"path" requires a valid origin { latitude, longitude, id }\',t),lt(Ut,zt(e.destination),\'"path" requires a valid destination { latitude, longitude, id }\',t);break;case"navigation":lt(Ut,zt(e.destination),\'"navigation" requires a valid destination { latitude, longitude, id }\',t)}}(t,e)})}function Xt(e){return c(a(a(a(a({},rt(e)),function(e){return{saveFile:t=>v("saveFile",t,{target:e}),writeFile:t=>v("writeFile",t,{target:e}),appendFile:t=>v("appendFile",t,{target:e}),readFile:t=>v("readFile",t,{target:e}),readDir:t=>v("readDir",t,{target:e}),statFile:t=>v("statFile",t,{target:e}),unlink:t=>v("unlink",t,{target:e}),mkdir:t=>v("mkdir",t,{target:e}),getFileStorageInfo:(t={})=>v("getFileStorageInfo",t,{target:e})}}(e)),Ct(e)),function(e){return{clearStorage:$t(e),getStorage:Nt(e),getStorageInfo:Rt(e),removeStorage:Pt(e),setStorage:Mt(e)}}(e)),{followAuthor:it(e),getFollowStatus:at(e),getLaunchOptions:ue(e),getLocation:ut(e),getWindowInfo:dt(e),interactionOpenApi:wt(e),offGyroscopeChange:bt(e),onGyroscopeChange:yt(e),postNote:Lt(e),request:he(e),saveImageToPhotosAlbum:xt(e),startGyroscope:mt(e),stopGyroscope:gt(e),openRedPage:It(e),vibrateLong:Ft(e),vibrateShort:Bt(e),xhsOpenSiteLocation:Gt(e),writeTempFile:Ht(e)})}function Wt(e){throw Object.assign(new Error(`invalid parameter; param=${e}`),{code:10001})}function Vt(e){throw Object.assign(new Error(`payload too large; param=${e}`),{code:10002})}function Yt(e,t,r=0,n=new Set){if(null===e||"string"==typeof e||"boolean"==typeof e)return;if("number"==typeof e)return void(Number.isFinite(e)||Wt(t));"object"!=typeof e&&Wt(t),n.has(e)&&Wt(t),r>5&&Vt(t);const o=Array.isArray(e),s=Object.getPrototypeOf(e);o||null===s||null===Object.getPrototypeOf(s)||Wt(t);for(let r=e;null!==r;r=Object.getPrototypeOf(r)){const e=Object.getOwnPropertyDescriptor(r,"toJSON");if(e){"value"in e&&"function"!=typeof e.value||Wt(t);break}}n.add(e);const i=Object.keys(e);o&&i.length!==e.length&&Wt(t);for(const s of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,s);i.enumerable&&("string"==typeof s&&"value"in i||Wt(t),o&&(!/^(0|[1-9]\\d*)$/.test(s)||Number(s)>=e.length)&&Wt(t),Yt(i.value,`${t}.${s}`,r+1,n))}n.delete(e)}function Qt(e,t,r){const n=JSON.stringify(e);(new TextEncoder).encode(n).byteLength>t&&Vt(r)}function Zt(e){const t=e,{success:r,complete:n,fail:o}=t,s=l(t,["success","complete","fail"]);if(Yt(s,"message"),"params"in s&&Qt(s.params,4096,"params"),s.index&&"object"==typeof s.index)for(const[e,t]of Object.entries(s.index))"string"==typeof t&&[...t].length>256&&Vt(`index.${e}`);return Qt(s,8192,"message"),s}function er(e){return t=>v("reportUba",t,{target:e,prepareRequest:Zt})}const tr=Symbol.for("xhs.internal");"undefined"!=typeof window&&(function(e={}){var t;const r=null!=(t=e.target)?t:u();if(!r)throw new Error("window is unavailable");if(g(r),!r.xhs||e.force){const e=Object.freeze({AI:Se(r),config:()=>{},get launchOptions(){return le(r)},miniTool:Object.freeze(c(a(a({},Xt(r)),{}),{version:"0.4.3"}))});r.xhs=e}!function(e){Object.prototype.hasOwnProperty.call(e,tr)||Object.defineProperty(e,tr,{get:()=>Object.freeze({reportUba:er(e)}),set(e){},configurable:!1,enumerable:!1})}(r)}({target:window}),function(e={}){var t,r;const n=null!=(t=e.target)?t:"undefined"==typeof window?void 0:window;if(!n)return;const o=n,s=n;if(s[_])return;s[_]=!0;const i=new Set;function a(e){try{const t=JSON.stringify(e);if(i.has(t))return;i.add(t),S(o,e)}catch(e){}}n.addEventListener("error",e=>{var t;try{const r=e,o=r.target;if(o&&o!==n&&o.tagName)return void a({type:"error",name:"ResourceError",message:`${o.tagName} 资源加载失败`,source:String(o.tagName).toLowerCase(),url:String(o.src||o.href||"")});const s=null!=(t=r.error)?t:{};a({type:"error",name:s.name||"Error",message:(r.message||String(s.message||"")).slice(0,512),source:`${r.filename||""}:${r.lineno||0}:${r.colno||0}`,url:r.filename||"",stack:s.stack?String(s.stack).slice(0,512):""})}catch(e){}},!0),n.addEventListener("unhandledrejection",e=>{try{const t=e.reason;let r="UnhandledRejection",n="",o="";if(t&&"object"==typeof t){const e=t;r=e.name||r,n=e.message||String(t),o=e.stack?String(e.stack).slice(0,512):""}else n=String(t);a({type:"unhandledrejection",name:r,message:n.slice(0,512),stack:o})}catch(e){}}),null==(r=n.document)||r.addEventListener("securitypolicyviolation",e=>{try{a({type:"securitypolicyviolation",name:"CSPViolation",disposition:e.disposition||"",effective_directive:e.effectiveDirective||"",violated_directive:e.violatedDirective||"",blocked_uri:e.blockedURI||"",source_file:e.sourceFile||"",line_number:e.lineNumber||0,column_number:e.columnNumber||0,original_policy:e.originalPolicy||""})}catch(e){}});try{const e=n,t=e.fetch;"function"==typeof t&&(e.fetch=function(e,r){const n=function(e){try{return"string"==typeof e?e:String(e&&"object"==typeof e&&"url"in e?e.url:e)}catch(e){return""}}(e);return t.call(this,e,r).then(e=>e,e=>{throw a({type:"fetch",name:C(e),message:(k(e)||"fetch failed").slice(0,512),url:n,stack:E(e)}),e})})}catch(e){}}({target:window}))});', ci = li, di = /<meta[^>]+name=["']x-miniapp-jsapi-mode["'][^>]+content=["']external["'][^>]*>/i, ui = /<script[^>]+src=["'][^"']*miniapp-js-api[^"']*\.umd[^"']*["']/i;
1988
+ function Ai(r) {
1989
+ return !!(di.test(r) || ui.test(r));
1991
1990
  }
1992
1991
  function $e(r) {
1993
- return si(
1992
+ return ii(
1994
1993
  r.options.appId,
1995
1994
  r.userDataPath,
1996
1995
  r.gateways,
@@ -2006,33 +2005,33 @@ function or(r) {
2006
2005
  return [
2007
2006
  $e(r),
2008
2007
  an,
2009
- li,
2010
- oi
2008
+ ci,
2009
+ ai
2011
2010
  ].join(`
2012
2011
  ;
2013
2012
  `);
2014
2013
  }
2015
- const Ai = {
2014
+ const hi = {
2016
2015
  id: "jsapi",
2017
2016
  /**
2018
2017
  * head 脚本源。auto 模式在 ctx.rawHtml 存在时检测原 HTML 是否已自带 jsapi。
2019
2018
  */
2020
2019
  buildHeadScriptSource(r) {
2021
2020
  const e = r.options.jsapi;
2022
- return !e.enabled || e.mode === "off" ? $e(r) : e.mode === "external" || e.mode === "auto" && r.rawHtml && ui(r.rawHtml) ? pt(r) : or(r);
2021
+ return !e.enabled || e.mode === "off" ? $e(r) : e.mode === "external" || e.mode === "auto" && r.rawHtml && Ai(r.rawHtml) ? pt(r) : or(r);
2023
2022
  },
2024
2023
  buildPreloadSource(r) {
2025
2024
  const e = r.options.jsapi;
2026
2025
  return !e.enabled || e.mode === "off" ? $e(r) : e.mode === "external" ? pt(r) : or(r);
2027
2026
  }
2028
- }, hi = `/*! xhs-script-version=1.0.1 */
2027
+ }, pi = `/*! xhs-script-version=1.0.1 */
2029
2028
  (function(e){let t;return(()=>{var o="camera",n="microphone",r="geolocation",i="clipboard",a="bluetooth",c="generic-sensor",s="device-motion",d="device-orientation",p="persistent-storage",l="storage-access",u="credentials",f=[o,n,"photo-library"],y={geolocation:r,"clipboard-read":i,"clipboard-write":i,"persistent-storage":p,accelerometer:c,gyroscope:c,magnetometer:c,"ambient-light-sensor":c,camera:o,microphone:n,bluetooth:a,"storage-access":l,"publickey-credentials-get":u,"publickey-credentials-create":u},v=["midi","background-sync","background-fetch","notifications","push","screen-wake-lock"],g=3e4;var b=Object,h="undefined"!=typeof Reflect?Reflect:null,m=Promise,w=b.defineProperty.bind(b),O=b.freeze.bind(b),E=b.getOwnPropertyDescriptor.bind(b),k=b.setPrototypeOf.bind(b),S=h?h.setPrototypeOf.bind(h):null,D=m.resolve.bind(m),N=m.reject.bind(m);function _(e,t){try{w(navigator,e,{value:t,configurable:!1,writable:!1})}catch(o){try{navigator[e]=t}catch(e){}}}function M(e,t,o){try{w(e,t,{value:o,configurable:!1,writable:!1})}catch(n){try{e[t]=o}catch(e){}}}function T(e,t,o){try{w(e,t,{get:o,configurable:!1})}catch(e){}}function P(e,t,o){try{w(e,t,{value:o,configurable:!1,writable:!1})}catch(n){try{e[t]=o}catch(e){}}}function W(e){try{O(e)}catch(e){}return e}var I="mini-app-simulator: blocked";function C(){return N(new DOMException(I,"SecurityError"))}function A(){throw new DOMException(I,"SecurityError")}function L(e){return"undefined"!=typeof window?window:e}function R(){const e="undefined"!=typeof document?document:null;if(!e)return;const t=()=>C(),o=()=>D(!1);"undefined"!=typeof Document&&Document.prototype&&("function"==typeof Document.prototype.requestStorageAccess&&P(Document.prototype,"requestStorageAccess",t),"function"==typeof Document.prototype.hasStorageAccess&&P(Document.prototype,"hasStorageAccess",o)),"function"==typeof e.requestStorageAccess&&M(e,"requestStorageAccess",t),"function"==typeof e.hasStorageAccess&&M(e,"hasStorageAccess",o)}function q(){const e=()=>C(),t="undefined"!=typeof Element?Element.prototype:null;if(t)for(const o of["requestFullscreen","webkitRequestFullscreen","webkitRequestFullScreen","mozRequestFullScreen","msRequestFullscreen"])o in t&&P(t,o,e)}function x(e){var t;const o=e.querySelectorAll("input[capture]");for(let e=0;e<o.length;e++)null==(t=o[e])||t.removeAttribute("capture")}function j(){const e="undefined"!=typeof document?document:null;if(!e)return;if(x(e),"undefined"==typeof MutationObserver)return;const t=new MutationObserver(e=>{for(const t of e)if("attributes"===t.type&&t.target instanceof HTMLInputElement)"capture"===t.attributeName&&t.target.hasAttribute("capture")&&t.target.removeAttribute("capture");else for(const e of t.addedNodes)e instanceof HTMLInputElement&&e.hasAttribute("capture")?e.removeAttribute("capture"):e instanceof Element&&x(e)}),o=()=>{var o;const n=null!=(o=e.documentElement)?o:e.body;n&&t.observe(n,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["capture"]})};"loading"===e.readyState?e.addEventListener("DOMContentLoaded",o,{once:!0}):o()}function G(){const e=()=>D([]);"undefined"!=typeof MediaDevices&&MediaDevices.prototype&&P(MediaDevices.prototype,"enumerateDevices",e);const t=navigator.mediaDevices;t&&M(t,"enumerateDevices",e)}function z(){const e=()=>C();"undefined"!=typeof MediaDevices&&MediaDevices.prototype&&P(MediaDevices.prototype,"getDisplayMedia",e);const t=navigator.mediaDevices;t&&"function"==typeof t.getDisplayMedia&&M(t,"getDisplayMedia",e)}function F(){const e=W({requestDevice:()=>C(),getAvailability:()=>D(!1),getDevices:()=>D([])});_("bluetooth",e),"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"bluetooth",()=>e)}var V=new Set(["copy","cut","paste"]);function K(){const e=W({read:()=>C(),readText:()=>C(),write:()=>C(),writeText:()=>C()});if(_("clipboard",e),"undefined"!=typeof Clipboard&&Clipboard.prototype){for(const t of["read","readText","write","writeText"])P(Clipboard.prototype,t,e[t]);W(Clipboard.prototype)}"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"clipboard",()=>e);const t="undefined"!=typeof document?document:null;if(!t||"function"!=typeof t.execCommand)return;const o=t.execCommand.bind(t);function n(e,...t){return"string"==typeof e&&V.has(e.toLowerCase())&&A(),o(e,...t)}M(t,"execCommand",n),"undefined"!=typeof Document&&Document.prototype&&P(Document.prototype,"execCommand",n)}function B(){const e=()=>{};try{w(navigator,"connection",{get:e,configurable:!1})}catch(e){}"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"connection",e)}function X(){if(!("credentials"in navigator))return;const e=W({get:()=>C(),create:()=>C(),store:()=>C(),preventSilentAccess:()=>C()});_("credentials",e),"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"credentials",()=>e)}function H(){if(!("getBattery"in navigator))return;const e=()=>C();_("getBattery",e),"undefined"!=typeof Navigator&&Navigator.prototype&&P(Navigator.prototype,"getBattery",e)}function U(){const e=W({getDevices:()=>D([]),requestDevice:()=>C()});_("hid",e),"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"hid",()=>e)}function Q(){const e=W({request:()=>C(),query:()=>D(new Map)});_("locks",e),"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"locks",()=>e)}function J(){const e=W({requestPort:()=>C(),getPorts:()=>D([])});_("serial",e),"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"serial",()=>e)}function Y(){const e=()=>D(!1);"undefined"!=typeof StorageManager&&StorageManager.prototype&&("function"==typeof StorageManager.prototype.persist&&P(StorageManager.prototype,"persist",e),"function"==typeof StorageManager.prototype.persisted&&P(StorageManager.prototype,"persisted",e));const t=navigator.storage;t&&("function"==typeof t.persist&&M(t,"persist",e),"function"==typeof t.persisted&&M(t,"persisted",e))}function Z(){const e=W({getDevices:()=>D([]),requestDevice:()=>C()});_("usb",e),"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"usb",()=>e)}var $=["Accelerometer","LinearAccelerationSensor","GravitySensor","Gyroscope","Magnetometer","AbsoluteOrientationSensor","RelativeOrientationSensor","AmbientLightSensor"];!function(){var o;const n="undefined"!=typeof window?window:e;if(n.__miniAppDeviceCapabilitiesSealed)return;let b;n.Object.defineProperty(n,"__miniAppDeviceCapabilitiesSealed",{value:!0,configurable:!1,writable:!1});try{b=function(e,t){const{Object:o,TypeError:n,DOMException:r}=e,i=e.window===e&&!!e.document;try{if(!t||1!==t.protocolVersion)throw new n("Unsupported Worker runtime protocol");if(i){const r=function(e,t){const{Object:o,TypeError:n}=t;if("string"!=typeof e.sessionId||"boolean"!=typeof e.enabled||void 0!==e.initialState&&"visible"!==e.initialState&&"hidden"!==e.initialState||e.enabled&&!e.sessionId)throw new n("Invalid Worker page policy");return o.freeze({protocolVersion:e.protocolVersion,sessionId:e.sessionId,enabled:e.enabled,initialState:e.initialState})}(t,e),i=o.getOwnPropertyDescriptor(e,"__MINITOOL_WORKER_CONTEXT__");if(i&&!i.configurable){if(i.get||i.writable||i.value!==t)throw new n("Worker context must be readonly host data");o.freeze(t)}else o.defineProperty(e,"__MINITOOL_WORKER_CONTEXT__",{value:r,writable:!1,configurable:!1});return function(e,t){var o,n,r,i,a;const{Object:c,Reflect:s,Function:d,Set:p,WeakMap:l,WeakSet:u,String:f,TypeError:y,Proxy:v}=e,b=e.Worker,h=e.DOMException,m=c.defineProperty,w=c.freeze,O=s.apply,E=s.construct,k=(e,t,o)=>{m(e,t,{value:o,writable:!1,configurable:!1})},S=function(){throw new h("Worker capability is disabled","SecurityError")};(t=>{const o=e[t];"function"==typeof o&&k(o.prototype,"constructor",S),k(e,t,S)})("SharedWorker"),function(e,t){const o=[];for(let n=e;n&&n!==t.prototype;n=t.getPrototypeOf(n))t.getOwnPropertyDescriptor(n,"serviceWorker")&&o.push(n);if(0===o.length)return;const n={get:()=>{},configurable:!1};t.defineProperty(e,"serviceWorker",n);for(const r of o)r!==e&&t.defineProperty(r,"serviceWorker",n)}(e.navigator,c);const D="function"==typeof b;m(e,"Worker",{value:S,writable:!0,configurable:!0});const N=null==b?void 0:b.prototype.terminate,_=d.prototype.call.bind(N),M=new p,T=M.has.bind(M),P=M.add.bind(M),W=M.delete.bind(M),I=M.forEach.bind(M),C=new u,A=C.has.bind(C),L=C.add.bind(C);let R=0,q=!1,x=!1,j=!1,G=0;const z=D&&t.enabled,F=new l,V=F.get.bind(F),K=F.set.bind(F),B=p.prototype.add,X=p.prototype.delete,H=p.prototype.has,U=p.prototype.clear,Q=p.prototype.forEach,J=u.prototype.has,Y=u.prototype.add,Z=e.Promise.resolve(),$=e.Promise.prototype.then,ee=null==(n=null==(o=e.console)?void 0:o.error)?void 0:n.bind(e.console),te=null==(i=null==(r=e.console)?void 0:r.debug)?void 0:i.bind(e.console),oe=(e,o)=>{var n;null==te||te("[minitool-worker]",{sessionId:t.sessionId,workerId:null==(n=V(e))?void 0:n.id,reason:o,activeCount:R})},ne=e=>{const t=V(e);O($,Z,[()=>{const e=[];O(Q,t.listeners,[t=>{e[e.length]=t}]);for(let o=0;o<e.length;o+=1){const n=e[o];if(t.reason&&O(H,t.listeners,[n])&&!O(J,t.delivered,[n])){O(Y,t.delivered,[n]),O(X,t.listeners,[n]);try{n(t.reason)}catch(e){null==ee||ee("Worker onTerminate callback failed")}}}}])},re=()=>w({protocolVersion:1,sessionId:t.sessionId,enabled:z,maxWorkers:z?1:0,state:x?"destroyed":se.visible?"visible":"hidden",recycled:j}),ie=null==(a=e.dispatchEvent)?void 0:a.bind(e),ae=e.CustomEvent,ce=()=>{ie&&ae&&ie(new ae("miniapp:worker-visibility",{detail:re()}))},se=function(e,t,o){var n;const r=e.Date.now.bind(e.Date),i=e.setTimeout.bind(e),a=e.clearTimeout.bind(e),{Object:c,Reflect:s}=e;let d=()=>e.document.hidden;for(let t=e.document;t;t=c.getPrototypeOf(t)){const o=null==(n=c.getOwnPropertyDescriptor(t,"hidden"))?void 0:n.get;if(o){const t=s.apply;d=()=>t(o,e.document,[]);break}}let p,l,u=!0,f=0,y=!1,v=!1;const b=()=>{f+=1,void 0!==l&&a(l),l=void 0},h=()=>void 0!==p&&r()-p>=g,m=()=>{if(!y&&!v){v=!0;try{const e=u&&!d();if(void 0!==p&&h()&&t(),e&&void 0!==p)b(),p=void 0,o();else if(!e&&void 0===p){p=r();const e=++f,t=()=>{y||e!==f||(m(),void 0===p||h()||(l=i(t,g-(r()-p))))};l=i(t,g),o()}}finally{v=!1}}};return{refresh:m,update(e){u=e,m()},get visible(){return void 0===p},get expired(){return h()},destroy(){y=!0,b()}}}(e,()=>{R&&(j=!0,I(e=>pe(e,"system")),ce())},ce),de=1===t.protocolVersion&&z&&!!t.sessionId,pe=(e,t)=>{if(!T(e))return void(A(e)||_(e));_(e),W(e),L(e),R-=1;const o=V(e);o.closed=!0,o.reason=t,oe(e,null!=t?t:"destroyed"),t?ne(e):O(U,o.listeners,[])},le={supported:D,get context(){return se.refresh(),re()},updateVisibility(e){x||se.update(!0===e)},reclaim(){!x&&R&&(j=!0,I(e=>pe(e,"system")),ce())},destroy(){x||(x=!0,se.destroy(),I(e=>pe(e)))}},ue=()=>{se.refresh(),(!de||x||se.expired)&&S()},fe=e=>{if("symbol"==typeof e)throw new y("Cannot convert a Symbol to a string");return f(e)};if(m(e,"__MINITOOL_WORKER_STATE__",{get:()=>le.context,configurable:!1}),!D)return k(e,"Worker",void 0),se.update("hidden"!==t.initialState),le;const ye=new v(b,{construct(e,t,o){if(ue(),q||R>=1)throw new h("At most one Worker is allowed per session","QuotaExceededError");let n;q=!0;try{if(0===t.length)throw new y("Worker requires a script URL");const r=fe(t[0]),i=t[1];if(null!=i&&"object"!=typeof i&&"function"!=typeof i)throw new y("Worker options must be a dictionary");const a=null==i?void 0:i.credentials,c=void 0===a?"same-origin":fe(a),s=null==i?void 0:i.name,d=void 0===s?"":fe(s),l=null==i?void 0:i.type;if(void 0!==l&&"classic"!==fe(l))throw new h("Only classic Workers are supported","NotSupportedError");return ue(),n=E(e,[r,{credentials:c,name:d,type:"classic"}],o),ue(),K(n,{listeners:new p,delivered:new u,closed:!1,id:++G}),P(n),R+=1,oe(n,"created"),n}catch(e){throw n&&(T(n)?pe(n):_(n)),e}finally{q=!1}}});return k(b.prototype,"constructor",ye),k(b.prototype,"terminate",function(){pe(this,"主动")}),k(b.prototype,"onTerminate",function(e){if("function"!=typeof e)throw new y("onTerminate callback must be a function");const t=V(this);if(!t)throw new y("Illegal Worker receiver");t.closed&&!t.reason||O(J,t.delivered,[e])||(O(B,t.listeners,[e]),t.reason&&ne(this))}),k(b.prototype,"offTerminate",function(e){if(void 0!==e&&"function"!=typeof e)throw new y("offTerminate callback must be a function");const t=V(this);if(!t)throw new y("Illegal Worker receiver");e?O(X,t.listeners,[e]):O(U,t.listeners,[])}),k(e,"Worker",ye),se.update("hidden"!==t.initialState),le}(e,r)}throw new n("Worker guard must be installed in the page Realm")}catch(t){if(i)try{const t=function(){throw new r("Worker runtime installation failed","SecurityError")};o.defineProperty(e,"Worker",{value:t,writable:!1,configurable:!1})}finally{e.stop()}throw t}}(n,null!=(o=n.__MINITOOL_WORKER_CONTEXT__)?o:{protocolVersion:1,sessionId:"",enabled:!1});const{allow:e}=function(){const e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:null,t=e?e.__MINI_APP_SEAL_CONFIG__:void 0,o=t&&Array.isArray(t.allow)?t.allow:f,n=new Set;for(const e of o)"string"==typeof e&&n.add(e);return{allow:n}}(),h=t=>!e.has(t),m=[[r,()=>function(e){function t(t){"function"==typeof t&&e.setTimeout(()=>{t({code:1,message:"mini-app-simulator: geolocation denied",PERMISSION_DENIED:1})},0)}function o(e,o){t(null!=o?o:void 0)}function n(e,o){return t(null!=o?o:void 0),0}function r(){}const i={clearWatch:r,getCurrentPosition:o,watchPosition:n};_("geolocation",i),"undefined"!=typeof Geolocation&&Geolocation.prototype&&(P(Geolocation.prototype,"getCurrentPosition",o),P(Geolocation.prototype,"watchPosition",n),P(Geolocation.prototype,"clearWatch",r),W(Geolocation.prototype)),"undefined"!=typeof Navigator&&Navigator.prototype&&T(Navigator.prototype,"geolocation",()=>i),W(i)}(n)],["connection",B],["battery",H],[p,Y],[l,R],["screen-share",z],["media-device-enumeration",G],[a,F],["usb",Z],["hid",U],["serial",J],[c,()=>function(e){const t=L(e),o=t,n=()=>A();for(const e of $)"function"==typeof o[e]&&M(t,e,n)}(n)],[s,()=>function(e){const t=L(e),o=t.DeviceMotionEvent;if("function"==typeof o){try{M(o,"requestPermission",()=>D("denied"))}catch(e){}M(t,"DeviceMotionEvent",()=>A())}}(n)],[d,()=>function(e){const t=L(e),o=t.DeviceOrientationEvent;if("function"==typeof o){try{M(o,"requestPermission",()=>D("denied"))}catch(e){}M(t,"DeviceOrientationEvent",()=>A())}}(n)],[i,K],[u,X],["webrtc",()=>function(e){const t=L(e),o=t,n=()=>A();for(const e of["RTCPeerConnection","webkitRTCPeerConnection","RTCDataChannel"])"function"==typeof o[e]&&M(t,e,n)}(n)],["locks",Q],["fullscreen",q],["input-capture",j],["window-open",()=>function(e){M(L(e),"open",()=>null)}(n)],["window-prompt",()=>function(e){M(L(e),"prompt",()=>null)}(n)]];for(const[e,t]of m)h(e)&&t();!function(e){const t=new Set;if(e.blockMotion&&t.add("devicemotion"),e.blockOrientation&&(t.add("deviceorientation"),t.add("deviceorientationabsolute")),0===t.size)return;if("undefined"==typeof EventTarget||void 0===EventTarget.prototype)return;const o=EventTarget.prototype,n=o.addEventListener,r=o.removeEventListener;"function"==typeof n&&(P(o,"addEventListener",function(e,...o){"string"==typeof e&&t.has(e.toLowerCase())||n.apply(this,[e,...o])}),"function"==typeof r&&P(o,"removeEventListener",function(e,...o){"string"==typeof e&&t.has(e.toLowerCase())||r.apply(this,[e,...o])}))}({blockMotion:h(s),blockOrientation:h(d)}),function(e){const t=navigator.permissions;if(!t||"function"!=typeof t.query)return;const o=new Set,n=Object.keys(y);for(let t=0;t<n.length;t++){const r=n[t],i=y[r];e.has(i)||o.add(r)}for(const e of v)o.add(e);if(0===o.size)return;const r=t.query.bind(t),i=O({state:"denied",onchange:null,addEventListener(){},removeEventListener(){},dispatchEvent:()=>!1});function a(e){return e&&"string"==typeof e.name&&o.has(e.name)?D(i):r(e)}M(t,"query",a);const c=Object.getPrototypeOf(t);c&&P(c,"query",a)}(e),function(){if(W(navigator),"undefined"!=typeof Object&&"function"==typeof k){const e=k;M(Object,"setPrototypeOf",(t,o)=>t===navigator?t:e(t,o))}if("undefined"!=typeof Reflect&&S){const e=S;M(Reflect,"setPrototypeOf",(t,o)=>t!==navigator&&e(t,o))}const e=void 0!==Object.prototype?E(Object.prototype,"__proto__"):void 0;if(e&&"function"==typeof e.set){const t=e.set;try{w(Object.prototype,"__proto__",{get:e.get,set(e){this!==navigator&&t.call(this,e)},configurable:!1})}catch(e){}}}();const N=b,I=()=>N.context;n.document.addEventListener("visibilitychange",I),n.addEventListener("pageshow",I),n.addEventListener("pagehide",e=>{e.persisted||N.destroy()}),t=n.Object.freeze({worker:N})}catch(e){throw null==b||b.destroy(),n.stop(),e}}()})(),t}).call(this,this)
2030
- `, pi = `"use strict";(()=>{(()=>{let r=window,t=workerController,o=t.context.sessionId,n=-1;r.addEventListener("message",s=>{let e=s.data;!s.isTrusted||s.source!==r.parent||r.parent===r||e?.type!=="mini-app:worker-state"||e.sessionId!==o||!Number.isSafeInteger(e.sequence)||e.sequence<=n||!["visible","hidden","destroyed"].includes(e.state)||(n=e.sequence,e.state==="destroyed"?t.destroy():t.updateVisibility(e.state==="visible"))}),r.parent!==r&&r.parent.postMessage({type:"mini-app:worker-ready",sessionId:o},"*")})();})();
2029
+ `, fi = `"use strict";(()=>{(()=>{let r=window,t=workerController,o=t.context.sessionId,n=-1;r.addEventListener("message",s=>{let e=s.data;!s.isTrusted||s.source!==r.parent||r.parent===r||e?.type!=="mini-app:worker-state"||e.sessionId!==o||!Number.isSafeInteger(e.sequence)||e.sequence<=n||!["visible","hidden","destroyed"].includes(e.state)||(n=e.sequence,e.state==="destroyed"?t.destroy():t.updateVisibility(e.state==="visible"))}),r.parent!==r&&r.parent.postMessage({type:"mini-app:worker-ready",sessionId:o},"*")})();})();
2031
2030
  `;
2032
- function fi(r) {
2031
+ function gi(r) {
2033
2032
  return `(function(window){if(window.__miniAppDeviceCapabilitiesSealed)return;var workerController=(${r}).worker;
2034
2033
  try{
2035
- ${pi}
2034
+ ${fi}
2036
2035
  }catch(error){workerController.destroy();window.stop();throw error;}
2037
2036
  }).call(window,window);`;
2038
2037
  }
@@ -2068,17 +2067,17 @@ const Xe = {
2068
2067
  // 模拟器是用iframe实现的当然允许被嵌入
2069
2068
  "frame-ancestors": { freeze: !0, default: { "'self'": !0 } },
2070
2069
  "child-src": { freeze: !0, default: { "'none'": !0 } }
2071
- }, gi = {
2070
+ }, mi = {
2072
2071
  "allow-scripts": !0,
2073
2072
  "allow-forms": !0,
2074
2073
  "allow-modals": !0,
2075
2074
  "allow-downloads": !0,
2076
2075
  "allow-same-origin": !0
2077
- }, mi = {
2076
+ }, bi = {
2078
2077
  camera: "*",
2079
2078
  microphone: "*",
2080
2079
  autoplay: "*"
2081
- }, bi = {
2080
+ }, vi = {
2082
2081
  geolocation: !1,
2083
2082
  accelerometer: !1,
2084
2083
  gyroscope: !1,
@@ -2101,7 +2100,7 @@ const Xe = {
2101
2100
  camera: "self",
2102
2101
  microphone: "self"
2103
2102
  };
2104
- function vi(r) {
2103
+ function yi(r) {
2105
2104
  if (!r) return "";
2106
2105
  try {
2107
2106
  const e = new URL(r).origin;
@@ -2110,11 +2109,11 @@ function vi(r) {
2110
2109
  }
2111
2110
  return "";
2112
2111
  }
2113
- function yi(r) {
2112
+ function wi(r) {
2114
2113
  return r.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
2115
2114
  }
2116
2115
  function ln(r = {}) {
2117
- const e = r.directives, t = [vi(r.appUrl), ...r.extraOrigins ?? []].filter(Boolean), n = [];
2116
+ const e = r.directives, t = [yi(r.appUrl), ...r.extraOrigins ?? []].filter(Boolean), n = [];
2118
2117
  for (const s of Object.keys(Xe)) {
2119
2118
  if (s === "worker-src") {
2120
2119
  n.push(`worker-src ${r.workerEnabled ? "'self'" : "'none'"}`);
@@ -2131,20 +2130,20 @@ function ln(r = {}) {
2131
2130
  }
2132
2131
  return n.join("; ");
2133
2132
  }
2134
- function wi(r = {}) {
2133
+ function Ci(r = {}) {
2135
2134
  const e = ln(r);
2136
- return `<meta http-equiv="Content-Security-Policy" content="${yi(e)}">`;
2135
+ return `<meta http-equiv="Content-Security-Policy" content="${wi(e)}">`;
2137
2136
  }
2138
- function Ci() {
2137
+ function Si() {
2139
2138
  const r = new Uint8Array(16);
2140
2139
  crypto.getRandomValues(r);
2141
2140
  let e = "";
2142
2141
  for (let t = 0; t < r.length; t++) e += String.fromCharCode(r[t]);
2143
2142
  return btoa(e);
2144
2143
  }
2145
- function Si(r = {}) {
2144
+ function Ei(r = {}) {
2146
2145
  let e = "";
2147
- return r.permissionsPolicy && (e += `<meta http-equiv="Permissions-Policy" content="${Ei(r.permissionsPolicy)}">`), r.csp !== !1 && (e += wi({
2146
+ return r.permissionsPolicy && (e += `<meta http-equiv="Permissions-Policy" content="${xi(r.permissionsPolicy)}">`), r.csp !== !1 && (e += Ci({
2148
2147
  directives: r.cspDirectives,
2149
2148
  appUrl: r.appUrl,
2150
2149
  extraOrigins: r.extraOrigins,
@@ -2153,16 +2152,16 @@ function Si(r = {}) {
2153
2152
  }
2154
2153
  function cn(r, e) {
2155
2154
  let t = "";
2156
- r !== void 0 && (t += `window.${ss}=${xi(r)};`), e !== void 0 && (t += `window.Object.defineProperty(window,"__MINITOOL_WORKER_CONTEXT__",{value:${dn(e)},writable:false,configurable:false});`);
2155
+ r !== void 0 && (t += `window.${is}=${Vi(r)};`), e !== void 0 && (t += `window.Object.defineProperty(window,"__MINITOOL_WORKER_CONTEXT__",{value:${dn(e)},writable:false,configurable:false});`);
2157
2156
  const n = `(function(){${t}return (
2158
- ${hi}
2157
+ ${pi}
2159
2158
  );}).call(this)`;
2160
- return fi(n);
2159
+ return gi(n);
2161
2160
  }
2162
- function Ei(r) {
2161
+ function xi(r) {
2163
2162
  return r.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
2164
2163
  }
2165
- function xi(r) {
2164
+ function Vi(r) {
2166
2165
  return dn({ allow: r });
2167
2166
  }
2168
2167
  function dn(r) {
@@ -2171,21 +2170,21 @@ function dn(r) {
2171
2170
  (e) => `\\u${e.charCodeAt(0).toString(16).padStart(4, "0")}`
2172
2171
  );
2173
2172
  }
2174
- const Vi = [
2173
+ const Ii = [
2175
2174
  "* { -webkit-touch-callout: none; }",
2176
2175
  "::-webkit-scrollbar { width: 0; height: 0; display: none; }",
2177
2176
  "* { scrollbar-width: none; -ms-overflow-style: none; }",
2178
2177
  ":root { --safe-area-inset-top: 47px; --safe-area-inset-bottom: 28px; --safe-area-inset-left: 0px; --safe-area-inset-right: 0px; }"
2179
2178
  ].join("");
2180
2179
  function Li() {
2181
- return `<style>${Vi}</style>`;
2180
+ return `<style>${Ii}</style>`;
2182
2181
  }
2183
2182
  const Wi = {
2184
2183
  id: "security",
2185
2184
  buildHeadSnippet(r) {
2186
2185
  const e = r.options.security;
2187
- return Si({
2188
- permissionsPolicy: us(e.permissionsPolicy),
2186
+ return Ei({
2187
+ permissionsPolicy: As(e.permissionsPolicy),
2189
2188
  cspDirectives: e.cspDirectives,
2190
2189
  csp: !r.cspAsHeader,
2191
2190
  appUrl: r.appUrl,
@@ -2196,13 +2195,13 @@ const Wi = {
2196
2195
  return cn(r.options.security.sealAllow, r.workerGuard);
2197
2196
  },
2198
2197
  buildPreloadSource(r) {
2199
- return Ii(r.options.security);
2198
+ return ki(r.options.security);
2200
2199
  }
2201
2200
  };
2202
- function Ii(r) {
2201
+ function ki(r) {
2203
2202
  return cn(r.sealAllow);
2204
2203
  }
2205
- const ki = `(function(){
2204
+ const qi = `(function(){
2206
2205
  var parentWin = window.parent || window;
2207
2206
  var target = window.console || (window.console = {});
2208
2207
  function serialize(args){
@@ -2230,10 +2229,10 @@ const ki = `(function(){
2230
2229
  };
2231
2230
  })(levels[i]);
2232
2231
  }
2233
- })();`, qi = {
2232
+ })();`, Bi = {
2234
2233
  id: "console-forward",
2235
2234
  buildHeadScriptSource(r) {
2236
- return ki;
2235
+ return qi;
2237
2236
  }
2238
2237
  }, ar = `(() => {
2239
2238
  const guestWindow = window;
@@ -2471,7 +2470,7 @@ const ki = `(function(){
2471
2470
  });
2472
2471
  });
2473
2472
  })();
2474
- `, Bi = `(() => {
2473
+ `, Ti = `(() => {
2475
2474
  const guestWindow = window;
2476
2475
  if (guestWindow.__miniAppInspectorPauseInstalled) return;
2477
2476
  guestWindow.__miniAppInspectorPauseInstalled = true;
@@ -2656,13 +2655,13 @@ const ki = `(function(){
2656
2655
  setPaused(data.payload.paused);
2657
2656
  });
2658
2657
  })();
2659
- `, Ti = {
2658
+ `, Ri = {
2660
2659
  id: "visual-inspector",
2661
2660
  buildHeadScriptSource(r) {
2662
- return r.options.visualInspector.pauseRuntime ? `${Bi}
2661
+ return r.options.visualInspector.pauseRuntime ? `${Ti}
2663
2662
  ${ar}` : ar;
2664
2663
  }
2665
- }, Ri = {
2664
+ }, Fi = {
2666
2665
  id: "resource-guard",
2667
2666
  buildHeadScriptSource(r) {
2668
2667
  const e = r.options.runtimeLimits.maxHeapUsedBytes, t = r.options.runtimeLimits.heapSampleIntervalMs;
@@ -2743,7 +2742,7 @@ ${ar}` : ar;
2743
2742
  }
2744
2743
  })();`;
2745
2744
  }
2746
- }, Fi = {
2745
+ }, Xi = {
2747
2746
  id: "gesture-receiver",
2748
2747
  buildHeadScriptSource(r) {
2749
2748
  return r.rendererType !== "iframe" || !r.options.touchEmulation ? "" : Dt;
@@ -2899,7 +2898,7 @@ ${ar}` : ar;
2899
2898
  })(proto);
2900
2899
  }
2901
2900
  }
2902
- })();`, Xi = {
2901
+ })();`, Ki = {
2903
2902
  id: "scroll-containment",
2904
2903
  buildHeadScriptSource(r) {
2905
2904
  return lr;
@@ -2907,12 +2906,12 @@ ${ar}` : ar;
2907
2906
  buildPreloadSource(r) {
2908
2907
  return lr;
2909
2908
  }
2910
- }, Ki = '"use strict";(()=>{function v(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;let r=document.implementation.createHTMLDocument(),n=r.createElement("base"),i=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(i),e&&(n.href=e),i.href=t,i.href}var D=(()=>{let t=0,e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function m(t){let e=[];for(let r=0,n=t.length;r<n;r++)e.push(t[r]);return e}var p=null;function R(t={}){return p||(t.includeStyleProperties?(p=t.includeStyleProperties,p):(p=m(window.getComputedStyle(document.documentElement)),p))}function E(t,e){let n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function et(t){let e=E(t,"border-left-width"),r=E(t,"border-right-width");return t.clientWidth+e+r}function rt(t){let e=E(t,"border-top-width"),r=E(t,"border-bottom-width");return t.clientHeight+e+r}function T(t,e={}){let r=e.width||et(t),n=e.height||rt(t);return{width:r,height:n}}function M(){let t,e;try{e=process}catch{}let r=e&&e.env?e.env.devicePixelRatio:null;return r&&(t=parseInt(r,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}var u=16384;function U(t){(t.width>u||t.height>u)&&(t.width>u&&t.height>u?t.width>t.height?(t.height*=u/t.width,t.width=u):(t.width*=u/t.height,t.height=u):t.width>u?(t.height*=u/t.width,t.width=u):(t.width*=u/t.height,t.height=u))}function k(t,e={}){return t.toBlob?new Promise(r=>{t.toBlob(r,e.type?e.type:"image/png",e.quality?e.quality:1)}):new Promise(r=>{let n=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=n.length,o=new Uint8Array(i);for(let a=0;a<i;a+=1)o[a]=n.charCodeAt(a);r(new Blob([o],{type:e.type?e.type:"image/png"}))})}function d(t){return new Promise((e,r)=>{let n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>e(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=t})}async function nt(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function H(t,e,r){let n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`),i.setAttribute("viewBox",`0 0 ${e} ${r}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(t),nt(i)}var l=(t,e)=>{if(t instanceof e)return!0;let r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||l(r,e)};function ot(t){let e=t.getPropertyValue("content");return`${t.cssText} content: \'${e.replace(/\'|"/g,"")}\';`}function it(t,e){return R(e).map(r=>{let n=t.getPropertyValue(r),i=t.getPropertyPriority(r);return`${r}: ${n}${i?" !important":""};`}).join(" ")}function at(t,e,r,n){let i=`.${t}:${e}`,o=r.cssText?ot(r):it(r,n);return document.createTextNode(`${i}{${o}}`)}function _(t,e,r,n){let i=window.getComputedStyle(t,r),o=i.getPropertyValue("content");if(o===""||o==="none")return;let a=D();try{e.className=`${e.className} ${a}`}catch{return}let s=document.createElement("style");s.appendChild(at(a,r,i,n)),e.appendChild(s)}function q(t,e,r){_(t,e,":before",r),_(t,e,":after",r)}var O="application/font-woff",W="image/jpeg",st={woff:O,woff2:O,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:W,jpeg:W,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function ct(t){let e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}function y(t){let e=ct(t).toLowerCase();return st[e]||""}function lt(t){return t.split(/,/)[1]}function x(t){return t.search(/^(data:)/)!==-1}function L(t,e){return`data:${e};base64,${t}`}async function F(t,e,r){let n=await fetch(t,e);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);let i=await n.blob();return new Promise((o,a)=>{let s=new FileReader;s.onerror=a,s.onloadend=()=>{try{o(r({res:n,result:s.result}))}catch(c){a(c)}},s.readAsDataURL(i)})}var $={};function ut(t,e,r){let n=t.replace(/\\?.*/,"");return r&&(n=t),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\\//,"")),e?`[${e}]${n}`:n}async function w(t,e,r){let n=ut(t,e,r.includeQueryParams);if($[n]!=null)return $[n];r.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+new Date().getTime());let i;try{let o=await F(t,r.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),lt(s)));i=L(o,e)}catch(o){i=r.imagePlaceholder||"";let a=`Failed to fetch resource: ${t}`;o&&(a=typeof o=="string"?o:o.message),a&&console.warn(a)}return $[n]=i,i}async function ft(t){let e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):d(e)}async function mt(t,e){if(t.currentSrc){let o=document.createElement("canvas"),a=o.getContext("2d");o.width=t.clientWidth,o.height=t.clientHeight,a?.drawImage(t,0,0,o.width,o.height);let s=o.toDataURL();return d(s)}let r=t.poster,n=y(r),i=await w(r,n,e);return d(i)}async function ht(t,e){var r;try{if(!((r=t?.contentDocument)===null||r===void 0)&&r.body)return await S(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function gt(t,e){return l(t,HTMLCanvasElement)?ft(t):l(t,HTMLVideoElement)?mt(t,e):l(t,HTMLIFrameElement)?ht(t,e):t.cloneNode(V(t))}var pt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",V=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function dt(t,e,r){var n,i;if(V(e))return e;let o=[];return pt(t)&&t.assignedNodes?o=m(t.assignedNodes()):l(t,HTMLIFrameElement)&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?o=m(t.contentDocument.body.childNodes):o=m(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),o.length===0||l(t,HTMLVideoElement)||await o.reduce((a,s)=>a.then(()=>S(s,r)).then(c=>{c&&e.appendChild(c)}),Promise.resolve()),e}function yt(t,e,r){let n=e.style;if(!n)return;let i=window.getComputedStyle(t);i.cssText?(n.cssText=i.cssText,n.transformOrigin=i.transformOrigin):R(r).forEach(o=>{let a=i.getPropertyValue(o);o==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),l(t,HTMLIFrameElement)&&o==="display"&&a==="inline"&&(a="block"),o==="d"&&e.getAttribute("d")&&(a=`path(${e.getAttribute("d")})`),n.setProperty(o,a,i.getPropertyPriority(o))})}function wt(t,e){l(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),l(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function bt(t,e){if(l(t,HTMLSelectElement)){let r=e,n=Array.from(r.children).find(i=>t.value===i.getAttribute("value"));n&&n.setAttribute("selected","")}}function xt(t,e,r){return l(e,Element)&&(yt(t,e,r),q(t,e,r),wt(t,e),bt(t,e)),e}async function St(t,e){let r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;let n={};for(let o=0;o<r.length;o++){let s=r[o].getAttribute("xlink:href");if(s){let c=t.querySelector(s),h=document.querySelector(s);!c&&h&&!n[s]&&(n[s]=await S(h,e,!0))}}let i=Object.values(n);if(i.length){let o="http://www.w3.org/1999/xhtml",a=document.createElementNS(o,"svg");a.setAttribute("xmlns",o),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";let s=document.createElementNS(o,"defs");a.appendChild(s);for(let c=0;c<i.length;c++)s.appendChild(i[c]);t.appendChild(a)}return t}async function S(t,e,r){return!r&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(n=>gt(n,e)).then(n=>dt(t,n,e)).then(n=>xt(t,n,e)).then(n=>St(n,e))}var B=/url\\(([\'"]?)([^\'"]+?)\\1\\)/g,Et=/url\\([^)]+\\)\\s*format\\((["\']?)([^"\']+)\\1\\)/g,Rt=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function Pt(t){let e=t.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g,"\\\\$1");return new RegExp(`(url\\\\([\'"]?)(${e})([\'"]?\\\\))`,"g")}function Ct(t){let e=[];return t.replace(B,(r,n,i)=>(e.push(i),r)),e.filter(r=>!x(r))}async function Tt(t,e,r,n,i){try{let o=r?v(e,r):e,a=y(e),s;if(i){let c=await i(o);s=L(c,a)}else s=await w(o,a,n);return t.replace(Pt(e),`$1${s}$3`)}catch{}return t}function $t(t,{preferredFontFormat:e}){return e?t.replace(Rt,r=>{for(;;){let[n,,i]=Et.exec(r)||[];if(!i)return"";if(i===e)return`src: ${n};`}}):t}function I(t){return t.search(B)!==-1}async function P(t,e,r){if(!I(t))return t;let n=$t(t,r);return Ct(n).reduce((o,a)=>o.then(s=>Tt(s,a,e,r)),Promise.resolve(n))}async function b(t,e,r){var n;let i=(n=e.style)===null||n===void 0?void 0:n.getPropertyValue(t);if(i){let o=await P(i,null,r);return e.style.setProperty(t,o,e.style.getPropertyPriority(t)),!0}return!1}async function Lt(t,e){await b("background",t,e)||await b("background-image",t,e),await b("mask",t,e)||await b("-webkit-mask",t,e)||await b("mask-image",t,e)||await b("-webkit-mask-image",t,e)}async function Ft(t,e){let r=l(t,HTMLImageElement);if(!(r&&!x(t.src))&&!(l(t,SVGImageElement)&&!x(t.href.baseVal)))return;let n=r?t.src:t.href.baseVal,i=await w(n,y(n),e);await new Promise((o,a)=>{t.onload=o,t.onerror=e.onImageErrorHandler?(...c)=>{try{o(e.onImageErrorHandler(...c))}catch(h){a(h)}}:a;let s=t;s.decode&&(s.decode=o),s.loading==="lazy"&&(s.loading="eager"),r?(t.srcset="",t.src=i):t.href.baseVal=i})}async function It(t,e){let n=m(t.childNodes).map(i=>A(i,e));await Promise.all(n).then(()=>t)}async function A(t,e){l(t,Element)&&(await Lt(t,e),await Ft(t,e),await It(t,e))}function j(t,e){let{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);let n=e.style;return n!=null&&Object.keys(n).forEach(i=>{r[i]=n[i]}),t}var z={};async function G(t){let e=z[t];if(e!=null)return e;let n=await(await fetch(t)).text();return e={url:t,cssText:n},z[t]=e,e}async function X(t,e){let r=t.cssText,n=/url\\(["\']?([^"\')]+)["\']?\\)/g,o=(r.match(/url\\([^)]+\\)/g)||[]).map(async a=>{let s=a.replace(n,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),F(s,e.fetchRequestInit,({result:c})=>(r=r.replace(a,`url(${c})`),[a,c]))});return Promise.all(o).then(()=>r)}function Y(t){if(t==null)return[];let e=[],r=/(\\/\\*[\\s\\S]*?\\*\\/)/gi,n=t.replace(r,""),i=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");for(;;){let c=i.exec(n);if(c===null)break;e.push(c[0])}n=n.replace(i,"");let o=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,a="((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})",s=new RegExp(a,"gi");for(;;){let c=o.exec(n);if(c===null){if(c=s.exec(n),c===null)break;o.lastIndex=s.lastIndex}else s.lastIndex=o.lastIndex;e.push(c[0])}return e}async function At(t,e){let r=[],n=[];return t.forEach(i=>{if("cssRules"in i)try{m(i.cssRules||[]).forEach((o,a)=>{if(o.type===CSSRule.IMPORT_RULE){let s=a+1,c=o.href,h=G(c).then(g=>X(g,e)).then(g=>Y(g).forEach(C=>{try{i.insertRule(C,C.startsWith("@import")?s+=1:i.cssRules.length)}catch(tt){console.error("Error inserting rule from remote css",{rule:C,error:tt})}})).catch(g=>{console.error("Error loading remote css",g.toString())});n.push(h)}})}catch(o){let a=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&n.push(G(i.href).then(s=>X(s,e)).then(s=>Y(s).forEach(c=>{a.insertRule(c,a.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",o)}}),Promise.all(n).then(()=>(t.forEach(i=>{if("cssRules"in i)try{m(i.cssRules||[]).forEach(o=>{r.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),r))}function vt(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>I(e.style.getPropertyValue("src")))}async function Dt(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");let r=m(t.ownerDocument.styleSheets),n=await At(r,e);return vt(n)}function J(t){return t.trim().replace(/["\']/g,"")}function Mt(t){let e=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(o=>{e.add(J(o))}),Array.from(n.children).forEach(o=>{o instanceof HTMLElement&&r(o)})}return r(t),e}async function K(t,e){let r=await Dt(t,e),n=Mt(t);return(await Promise.all(r.filter(o=>n.has(J(o.style.fontFamily))).map(o=>{let a=o.parentStyleSheet?o.parentStyleSheet.href:null;return P(o.cssText,a,e)}))).join(`\n`)}async function Q(t,e){let r=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await K(t,e);if(r){let n=document.createElement("style"),i=document.createTextNode(r);n.appendChild(i),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}async function Ut(t,e={}){let{width:r,height:n}=T(t,e),i=await S(t,e,!0);return await Q(i,e),await A(i,e),j(i,e),await H(i,r,n)}async function kt(t,e={}){let{width:r,height:n}=T(t,e),i=await Ut(t,e),o=await d(i),a=document.createElement("canvas"),s=a.getContext("2d"),c=e.pixelRatio||M(),h=e.canvasWidth||r,g=e.canvasHeight||n;return a.width=h*c,a.height=g*c,e.skipAutoScale||U(a),a.style.width=`${h}`,a.style.height=`${g}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(o,0,0,a.width,a.height),a}async function Z(t,e={}){let r=await kt(t,e);return await k(r)}var Ht="mini-app:widget-snapshot-request",N="mini-app:widget-snapshot-response",_t="mini-app:widget-first-paint-report",f=window;f.__miniAppWidgetSnapshotInstalled||(f.__miniAppWidgetSnapshotInstalled=!0,Ot(),qt());function qt(){let t=Date.now(),e=!1,r=n=>{if(!e){e=!0,console.log(`[miniapp-simulator guest] paint report sent (name=${n}) after ${Date.now()-t}ms`);try{f.parent.postMessage({type:_t,name:n},"*")}catch(i){console.log("[miniapp-simulator guest] paint report postMessage failed",i)}}};try{if(performance.getEntriesByType("paint").some(s=>s.name==="first-contentful-paint"||s.name==="first-paint")){r("paint");return}let o=!1,a=new PerformanceObserver(()=>r("paint"));try{a.observe({type:"paint",buffered:!0}),o=!0}catch(s){console.log("[miniapp-simulator guest] paint entry type unsupported",s)}if(o)try{a.observe({type:"largest-contentful-paint",buffered:!0}),console.log("[miniapp-simulator guest] observing paint + largest-contentful-paint")}catch(s){console.log("[miniapp-simulator guest] largest-contentful-paint unsupported",s)}else{r("unsupported");return}}catch(n){console.log("[miniapp-simulator guest] PerformanceObserver unavailable",n),r("unsupported");return}requestAnimationFrame(()=>{requestAnimationFrame(()=>{f.setTimeout(()=>r("raf"),250)})})}function Ot(){f.addEventListener("message",async t=>{if(t.source!==f.parent||t.data?.type!==Ht)return;let e=t.data.requestId;if(e)try{await Wt();let r=document.body;if(!r)throw new Error("preview document is not ready");let n=Math.max(1,Math.round(f.innerWidth)),i=t.data.options?.fullPage?Math.max(1,Math.round(f.innerHeight),Math.round(r.scrollHeight),Math.round(document.documentElement.scrollHeight)):Math.max(1,Math.round(f.innerHeight)),o=document.documentElement,a=t.data.options?.fullPage?0:Math.max(0,f.scrollX||o.scrollLeft),s=t.data.options?.fullPage?0:Math.max(0,f.scrollY||o.scrollTop),c=await Z(r,{width:n,height:i,pixelRatio:2,style:{width:`${n}px`,height:`${i}px`,margin:`${-s}px 0 0 ${-a}px`,transform:"none"}});if(!c)throw new Error("failed to capture preview");f.parent.postMessage({type:N,requestId:e,ok:!0,blob:c},"*")}catch(r){f.parent.postMessage({type:N,requestId:e,ok:!1,error:r instanceof Error?r.message:String(r)},"*")}})}function Wt(){return new Promise(t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))})}})();\n', Pi = {
2909
+ }, Ni = '"use strict";(()=>{function v(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;let r=document.implementation.createHTMLDocument(),n=r.createElement("base"),i=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(i),e&&(n.href=e),i.href=t,i.href}var D=(()=>{let t=0,e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function m(t){let e=[];for(let r=0,n=t.length;r<n;r++)e.push(t[r]);return e}var p=null;function R(t={}){return p||(t.includeStyleProperties?(p=t.includeStyleProperties,p):(p=m(window.getComputedStyle(document.documentElement)),p))}function E(t,e){let n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function et(t){let e=E(t,"border-left-width"),r=E(t,"border-right-width");return t.clientWidth+e+r}function rt(t){let e=E(t,"border-top-width"),r=E(t,"border-bottom-width");return t.clientHeight+e+r}function T(t,e={}){let r=e.width||et(t),n=e.height||rt(t);return{width:r,height:n}}function M(){let t,e;try{e=process}catch{}let r=e&&e.env?e.env.devicePixelRatio:null;return r&&(t=parseInt(r,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}var u=16384;function U(t){(t.width>u||t.height>u)&&(t.width>u&&t.height>u?t.width>t.height?(t.height*=u/t.width,t.width=u):(t.width*=u/t.height,t.height=u):t.width>u?(t.height*=u/t.width,t.width=u):(t.width*=u/t.height,t.height=u))}function k(t,e={}){return t.toBlob?new Promise(r=>{t.toBlob(r,e.type?e.type:"image/png",e.quality?e.quality:1)}):new Promise(r=>{let n=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=n.length,o=new Uint8Array(i);for(let a=0;a<i;a+=1)o[a]=n.charCodeAt(a);r(new Blob([o],{type:e.type?e.type:"image/png"}))})}function d(t){return new Promise((e,r)=>{let n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>e(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=t})}async function nt(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function H(t,e,r){let n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`),i.setAttribute("viewBox",`0 0 ${e} ${r}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(t),nt(i)}var l=(t,e)=>{if(t instanceof e)return!0;let r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||l(r,e)};function ot(t){let e=t.getPropertyValue("content");return`${t.cssText} content: \'${e.replace(/\'|"/g,"")}\';`}function it(t,e){return R(e).map(r=>{let n=t.getPropertyValue(r),i=t.getPropertyPriority(r);return`${r}: ${n}${i?" !important":""};`}).join(" ")}function at(t,e,r,n){let i=`.${t}:${e}`,o=r.cssText?ot(r):it(r,n);return document.createTextNode(`${i}{${o}}`)}function _(t,e,r,n){let i=window.getComputedStyle(t,r),o=i.getPropertyValue("content");if(o===""||o==="none")return;let a=D();try{e.className=`${e.className} ${a}`}catch{return}let s=document.createElement("style");s.appendChild(at(a,r,i,n)),e.appendChild(s)}function q(t,e,r){_(t,e,":before",r),_(t,e,":after",r)}var O="application/font-woff",W="image/jpeg",st={woff:O,woff2:O,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:W,jpeg:W,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function ct(t){let e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}function y(t){let e=ct(t).toLowerCase();return st[e]||""}function lt(t){return t.split(/,/)[1]}function x(t){return t.search(/^(data:)/)!==-1}function L(t,e){return`data:${e};base64,${t}`}async function F(t,e,r){let n=await fetch(t,e);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);let i=await n.blob();return new Promise((o,a)=>{let s=new FileReader;s.onerror=a,s.onloadend=()=>{try{o(r({res:n,result:s.result}))}catch(c){a(c)}},s.readAsDataURL(i)})}var $={};function ut(t,e,r){let n=t.replace(/\\?.*/,"");return r&&(n=t),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\\//,"")),e?`[${e}]${n}`:n}async function w(t,e,r){let n=ut(t,e,r.includeQueryParams);if($[n]!=null)return $[n];r.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+new Date().getTime());let i;try{let o=await F(t,r.fetchRequestInit,({res:a,result:s})=>(e||(e=a.headers.get("Content-Type")||""),lt(s)));i=L(o,e)}catch(o){i=r.imagePlaceholder||"";let a=`Failed to fetch resource: ${t}`;o&&(a=typeof o=="string"?o:o.message),a&&console.warn(a)}return $[n]=i,i}async function ft(t){let e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):d(e)}async function mt(t,e){if(t.currentSrc){let o=document.createElement("canvas"),a=o.getContext("2d");o.width=t.clientWidth,o.height=t.clientHeight,a?.drawImage(t,0,0,o.width,o.height);let s=o.toDataURL();return d(s)}let r=t.poster,n=y(r),i=await w(r,n,e);return d(i)}async function ht(t,e){var r;try{if(!((r=t?.contentDocument)===null||r===void 0)&&r.body)return await S(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function gt(t,e){return l(t,HTMLCanvasElement)?ft(t):l(t,HTMLVideoElement)?mt(t,e):l(t,HTMLIFrameElement)?ht(t,e):t.cloneNode(V(t))}var pt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",V=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function dt(t,e,r){var n,i;if(V(e))return e;let o=[];return pt(t)&&t.assignedNodes?o=m(t.assignedNodes()):l(t,HTMLIFrameElement)&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?o=m(t.contentDocument.body.childNodes):o=m(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),o.length===0||l(t,HTMLVideoElement)||await o.reduce((a,s)=>a.then(()=>S(s,r)).then(c=>{c&&e.appendChild(c)}),Promise.resolve()),e}function yt(t,e,r){let n=e.style;if(!n)return;let i=window.getComputedStyle(t);i.cssText?(n.cssText=i.cssText,n.transformOrigin=i.transformOrigin):R(r).forEach(o=>{let a=i.getPropertyValue(o);o==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),l(t,HTMLIFrameElement)&&o==="display"&&a==="inline"&&(a="block"),o==="d"&&e.getAttribute("d")&&(a=`path(${e.getAttribute("d")})`),n.setProperty(o,a,i.getPropertyPriority(o))})}function wt(t,e){l(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),l(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function bt(t,e){if(l(t,HTMLSelectElement)){let r=e,n=Array.from(r.children).find(i=>t.value===i.getAttribute("value"));n&&n.setAttribute("selected","")}}function xt(t,e,r){return l(e,Element)&&(yt(t,e,r),q(t,e,r),wt(t,e),bt(t,e)),e}async function St(t,e){let r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;let n={};for(let o=0;o<r.length;o++){let s=r[o].getAttribute("xlink:href");if(s){let c=t.querySelector(s),h=document.querySelector(s);!c&&h&&!n[s]&&(n[s]=await S(h,e,!0))}}let i=Object.values(n);if(i.length){let o="http://www.w3.org/1999/xhtml",a=document.createElementNS(o,"svg");a.setAttribute("xmlns",o),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";let s=document.createElementNS(o,"defs");a.appendChild(s);for(let c=0;c<i.length;c++)s.appendChild(i[c]);t.appendChild(a)}return t}async function S(t,e,r){return!r&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(n=>gt(n,e)).then(n=>dt(t,n,e)).then(n=>xt(t,n,e)).then(n=>St(n,e))}var B=/url\\(([\'"]?)([^\'"]+?)\\1\\)/g,Et=/url\\([^)]+\\)\\s*format\\((["\']?)([^"\']+)\\1\\)/g,Rt=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function Pt(t){let e=t.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g,"\\\\$1");return new RegExp(`(url\\\\([\'"]?)(${e})([\'"]?\\\\))`,"g")}function Ct(t){let e=[];return t.replace(B,(r,n,i)=>(e.push(i),r)),e.filter(r=>!x(r))}async function Tt(t,e,r,n,i){try{let o=r?v(e,r):e,a=y(e),s;if(i){let c=await i(o);s=L(c,a)}else s=await w(o,a,n);return t.replace(Pt(e),`$1${s}$3`)}catch{}return t}function $t(t,{preferredFontFormat:e}){return e?t.replace(Rt,r=>{for(;;){let[n,,i]=Et.exec(r)||[];if(!i)return"";if(i===e)return`src: ${n};`}}):t}function I(t){return t.search(B)!==-1}async function P(t,e,r){if(!I(t))return t;let n=$t(t,r);return Ct(n).reduce((o,a)=>o.then(s=>Tt(s,a,e,r)),Promise.resolve(n))}async function b(t,e,r){var n;let i=(n=e.style)===null||n===void 0?void 0:n.getPropertyValue(t);if(i){let o=await P(i,null,r);return e.style.setProperty(t,o,e.style.getPropertyPriority(t)),!0}return!1}async function Lt(t,e){await b("background",t,e)||await b("background-image",t,e),await b("mask",t,e)||await b("-webkit-mask",t,e)||await b("mask-image",t,e)||await b("-webkit-mask-image",t,e)}async function Ft(t,e){let r=l(t,HTMLImageElement);if(!(r&&!x(t.src))&&!(l(t,SVGImageElement)&&!x(t.href.baseVal)))return;let n=r?t.src:t.href.baseVal,i=await w(n,y(n),e);await new Promise((o,a)=>{t.onload=o,t.onerror=e.onImageErrorHandler?(...c)=>{try{o(e.onImageErrorHandler(...c))}catch(h){a(h)}}:a;let s=t;s.decode&&(s.decode=o),s.loading==="lazy"&&(s.loading="eager"),r?(t.srcset="",t.src=i):t.href.baseVal=i})}async function It(t,e){let n=m(t.childNodes).map(i=>A(i,e));await Promise.all(n).then(()=>t)}async function A(t,e){l(t,Element)&&(await Lt(t,e),await Ft(t,e),await It(t,e))}function j(t,e){let{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);let n=e.style;return n!=null&&Object.keys(n).forEach(i=>{r[i]=n[i]}),t}var z={};async function G(t){let e=z[t];if(e!=null)return e;let n=await(await fetch(t)).text();return e={url:t,cssText:n},z[t]=e,e}async function X(t,e){let r=t.cssText,n=/url\\(["\']?([^"\')]+)["\']?\\)/g,o=(r.match(/url\\([^)]+\\)/g)||[]).map(async a=>{let s=a.replace(n,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),F(s,e.fetchRequestInit,({result:c})=>(r=r.replace(a,`url(${c})`),[a,c]))});return Promise.all(o).then(()=>r)}function Y(t){if(t==null)return[];let e=[],r=/(\\/\\*[\\s\\S]*?\\*\\/)/gi,n=t.replace(r,""),i=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");for(;;){let c=i.exec(n);if(c===null)break;e.push(c[0])}n=n.replace(i,"");let o=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,a="((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})",s=new RegExp(a,"gi");for(;;){let c=o.exec(n);if(c===null){if(c=s.exec(n),c===null)break;o.lastIndex=s.lastIndex}else s.lastIndex=o.lastIndex;e.push(c[0])}return e}async function At(t,e){let r=[],n=[];return t.forEach(i=>{if("cssRules"in i)try{m(i.cssRules||[]).forEach((o,a)=>{if(o.type===CSSRule.IMPORT_RULE){let s=a+1,c=o.href,h=G(c).then(g=>X(g,e)).then(g=>Y(g).forEach(C=>{try{i.insertRule(C,C.startsWith("@import")?s+=1:i.cssRules.length)}catch(tt){console.error("Error inserting rule from remote css",{rule:C,error:tt})}})).catch(g=>{console.error("Error loading remote css",g.toString())});n.push(h)}})}catch(o){let a=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&n.push(G(i.href).then(s=>X(s,e)).then(s=>Y(s).forEach(c=>{a.insertRule(c,a.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",o)}}),Promise.all(n).then(()=>(t.forEach(i=>{if("cssRules"in i)try{m(i.cssRules||[]).forEach(o=>{r.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),r))}function vt(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>I(e.style.getPropertyValue("src")))}async function Dt(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");let r=m(t.ownerDocument.styleSheets),n=await At(r,e);return vt(n)}function J(t){return t.trim().replace(/["\']/g,"")}function Mt(t){let e=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(o=>{e.add(J(o))}),Array.from(n.children).forEach(o=>{o instanceof HTMLElement&&r(o)})}return r(t),e}async function K(t,e){let r=await Dt(t,e),n=Mt(t);return(await Promise.all(r.filter(o=>n.has(J(o.style.fontFamily))).map(o=>{let a=o.parentStyleSheet?o.parentStyleSheet.href:null;return P(o.cssText,a,e)}))).join(`\n`)}async function Q(t,e){let r=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await K(t,e);if(r){let n=document.createElement("style"),i=document.createTextNode(r);n.appendChild(i),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}async function Ut(t,e={}){let{width:r,height:n}=T(t,e),i=await S(t,e,!0);return await Q(i,e),await A(i,e),j(i,e),await H(i,r,n)}async function kt(t,e={}){let{width:r,height:n}=T(t,e),i=await Ut(t,e),o=await d(i),a=document.createElement("canvas"),s=a.getContext("2d"),c=e.pixelRatio||M(),h=e.canvasWidth||r,g=e.canvasHeight||n;return a.width=h*c,a.height=g*c,e.skipAutoScale||U(a),a.style.width=`${h}`,a.style.height=`${g}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(o,0,0,a.width,a.height),a}async function Z(t,e={}){let r=await kt(t,e);return await k(r)}var Ht="mini-app:widget-snapshot-request",N="mini-app:widget-snapshot-response",_t="mini-app:widget-first-paint-report",f=window;f.__miniAppWidgetSnapshotInstalled||(f.__miniAppWidgetSnapshotInstalled=!0,Ot(),qt());function qt(){let t=Date.now(),e=!1,r=n=>{if(!e){e=!0,console.log(`[miniapp-simulator guest] paint report sent (name=${n}) after ${Date.now()-t}ms`);try{f.parent.postMessage({type:_t,name:n},"*")}catch(i){console.log("[miniapp-simulator guest] paint report postMessage failed",i)}}};try{if(performance.getEntriesByType("paint").some(s=>s.name==="first-contentful-paint"||s.name==="first-paint")){r("paint");return}let o=!1,a=new PerformanceObserver(()=>r("paint"));try{a.observe({type:"paint",buffered:!0}),o=!0}catch(s){console.log("[miniapp-simulator guest] paint entry type unsupported",s)}if(o)try{a.observe({type:"largest-contentful-paint",buffered:!0}),console.log("[miniapp-simulator guest] observing paint + largest-contentful-paint")}catch(s){console.log("[miniapp-simulator guest] largest-contentful-paint unsupported",s)}else{r("unsupported");return}}catch(n){console.log("[miniapp-simulator guest] PerformanceObserver unavailable",n),r("unsupported");return}requestAnimationFrame(()=>{requestAnimationFrame(()=>{f.setTimeout(()=>r("raf"),250)})})}function Ot(){f.addEventListener("message",async t=>{if(t.source!==f.parent||t.data?.type!==Ht)return;let e=t.data.requestId;if(e)try{await Wt();let r=document.body;if(!r)throw new Error("preview document is not ready");let n=Math.max(1,Math.round(f.innerWidth)),i=t.data.options?.fullPage?Math.max(1,Math.round(f.innerHeight),Math.round(r.scrollHeight),Math.round(document.documentElement.scrollHeight)):Math.max(1,Math.round(f.innerHeight)),o=document.documentElement,a=t.data.options?.fullPage?0:Math.max(0,f.scrollX||o.scrollLeft),s=t.data.options?.fullPage?0:Math.max(0,f.scrollY||o.scrollTop),c=await Z(r,{width:n,height:i,pixelRatio:2,style:{width:`${n}px`,height:`${i}px`,margin:`${-s}px 0 0 ${-a}px`,transform:"none"}});if(!c)throw new Error("failed to capture preview");f.parent.postMessage({type:N,requestId:e,ok:!0,blob:c},"*")}catch(r){f.parent.postMessage({type:N,requestId:e,ok:!1,error:r instanceof Error?r.message:String(r)},"*")}})}function Wt(){return new Promise(t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))})}})();\n', Pi = {
2911
2910
  id: "widget-snapshot",
2912
2911
  buildHeadScriptSource(r) {
2913
2912
  return `
2914
2913
  try {
2915
- ${Ki}
2914
+ ${Ni}
2916
2915
  } catch (e) { console.error("widget-snapshot injection failed", e); }`;
2917
2916
  }
2918
2917
  };
@@ -2921,14 +2920,14 @@ class Gt {
2921
2920
  this.value = e;
2922
2921
  }
2923
2922
  }
2924
- function Ni(r) {
2923
+ function Oi(r) {
2925
2924
  return new Gt(r);
2926
2925
  }
2927
- function Oi(r) {
2926
+ function Mi(r) {
2928
2927
  return String(r ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2929
2928
  }
2930
2929
  function un(r) {
2931
- return r instanceof Gt ? r.value : Array.isArray(r) ? r.map(un).join("") : Oi(r);
2930
+ return r instanceof Gt ? r.value : Array.isArray(r) ? r.map(un).join("") : Mi(r);
2932
2931
  }
2933
2932
  function O(r, ...e) {
2934
2933
  let t = r[0];
@@ -2940,7 +2939,7 @@ function fe(r) {
2940
2939
  return r.value;
2941
2940
  }
2942
2941
  let Ce = null;
2943
- function Mi() {
2942
+ function Zi() {
2944
2943
  if (Ce !== null) return Ce;
2945
2944
  try {
2946
2945
  Ce = typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype && "adoptedStyleSheets" in Document.prototype;
@@ -2951,7 +2950,7 @@ function Mi() {
2951
2950
  }
2952
2951
  const cr = /* @__PURE__ */ new Map();
2953
2952
  function Ht(r, e) {
2954
- if (Mi()) {
2953
+ if (Zi()) {
2955
2954
  r.adoptedStyleSheets = e.map((n) => {
2956
2955
  let s = cr.get(n);
2957
2956
  return s || (s = new CSSStyleSheet(), s.replaceSync(n), cr.set(n, s)), s;
@@ -2966,7 +2965,7 @@ function Qt(r, e) {
2966
2965
  typeof customElements > "u" || customElements.get(r) || customElements.define(r, e);
2967
2966
  }
2968
2967
  var ne, Me;
2969
- class Zi {
2968
+ class Ui {
2970
2969
  constructor(e) {
2971
2970
  S(this, ne, !1);
2972
2971
  S(this, Me, 0);
@@ -2982,9 +2981,9 @@ class Zi {
2982
2981
  }
2983
2982
  }
2984
2983
  ne = new WeakMap(), Me = new WeakMap();
2985
- const Ui = 420, zt = `
2984
+ const Di = 420, zt = `
2986
2985
  :host {
2987
- --dt-width: ${Ui}px;
2986
+ --dt-width: ${Di}px;
2988
2987
 
2989
2988
  --dt-fg: #e8eaf0;
2990
2989
  --dt-fg-2: rgba(232, 234, 240, 0.72);
@@ -3010,7 +3009,7 @@ const Ui = 420, zt = `
3010
3009
  --dt-font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
3011
3010
  --dt-mono: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
3012
3011
  }
3013
- `, jt = `
3012
+ `, Jt = `
3014
3013
  *, *::before, *::after { box-sizing: border-box; }
3015
3014
  .dt-content {
3016
3015
  display: flex;
@@ -3074,10 +3073,10 @@ const Ui = 420, zt = `
3074
3073
  font-size: 12px;
3075
3074
  color: var(--dt-fg-4);
3076
3075
  }
3077
- `, An = "miniapp-devtools-capabilities", hn = "capabilitychange", Di = {
3076
+ `, An = "miniapp-devtools-capabilities", hn = "capabilitychange", Yi = {
3078
3077
  seal: "Seal 封印能力",
3079
3078
  host: "宿主层能力"
3080
- }, Yi = `
3079
+ }, Gi = `
3081
3080
  :host {
3082
3081
  display: flex;
3083
3082
  flex-direction: column;
@@ -3176,14 +3175,14 @@ const Ui = 420, zt = `
3176
3175
  color: #ffb3bd;
3177
3176
  }
3178
3177
  `;
3179
- var oe, z, Ze, ae, me, U, Ie, nt, Vt, pn;
3180
- class Gi extends HTMLElement {
3178
+ var oe, z, Ze, ae, me, U, We, nt, Vt, pn;
3179
+ class Hi extends HTMLElement {
3181
3180
  constructor() {
3182
3181
  super();
3183
3182
  S(this, U);
3184
3183
  S(this, oe);
3185
3184
  S(this, z);
3186
- S(this, Ze, new Zi(() => T(this, U, pn).call(this)));
3185
+ S(this, Ze, new Ui(() => T(this, U, pn).call(this)));
3187
3186
  S(this, ae, null);
3188
3187
  S(this, me, !1);
3189
3188
  S(this, nt, (t) => {
@@ -3193,23 +3192,23 @@ class Gi extends HTMLElement {
3193
3192
  if (!(!n || A(this, me) || !A(this, ae))) {
3194
3193
  if (n.dataset.cap) {
3195
3194
  const s = new Set(A(this, ae).allow), i = n.dataset.cap;
3196
- s.has(i) ? s.delete(i) : s.add(i), T(this, U, Ie).call(this, [...s]);
3195
+ s.has(i) ? s.delete(i) : s.add(i), T(this, U, We).call(this, [...s]);
3197
3196
  return;
3198
3197
  }
3199
3198
  switch (n.dataset.act) {
3200
3199
  case "reset":
3201
- T(this, U, Ie).call(this, [...jr]);
3200
+ T(this, U, We).call(this, [...Jr]);
3202
3201
  break;
3203
3202
  case "allow-all":
3204
- T(this, U, Ie).call(this, [...Jr]);
3203
+ T(this, U, We).call(this, [...jr]);
3205
3204
  break;
3206
3205
  case "seal-all":
3207
- T(this, U, Ie).call(this, []);
3206
+ T(this, U, We).call(this, []);
3208
3207
  break;
3209
3208
  }
3210
3209
  }
3211
3210
  });
3212
- V(this, oe, this.attachShadow({ mode: "open" })), Ht(A(this, oe), [zt, jt, Yi]), V(this, z, document.createElement("div")), A(this, z).className = "dt-content", A(this, oe).append(A(this, z)), A(this, oe).addEventListener("click", A(this, nt));
3211
+ V(this, oe, this.attachShadow({ mode: "open" })), Ht(A(this, oe), [zt, Jt, Gi]), V(this, z, document.createElement("div")), A(this, z).className = "dt-content", A(this, oe).append(A(this, z)), A(this, oe).addEventListener("click", A(this, nt));
3213
3212
  }
3214
3213
  set snapshot(t) {
3215
3214
  V(this, ae, t), A(this, Ze).schedule();
@@ -3218,7 +3217,7 @@ class Gi extends HTMLElement {
3218
3217
  V(this, me, t), A(this, Ze).schedule();
3219
3218
  }
3220
3219
  }
3221
- oe = new WeakMap(), z = new WeakMap(), Ze = new WeakMap(), ae = new WeakMap(), me = new WeakMap(), U = new WeakSet(), Ie = function(t) {
3220
+ oe = new WeakMap(), z = new WeakMap(), Ze = new WeakMap(), ae = new WeakMap(), me = new WeakMap(), U = new WeakSet(), We = function(t) {
3222
3221
  this.dispatchEvent(
3223
3222
  new CustomEvent(hn, {
3224
3223
  detail: { allow: t },
@@ -3248,7 +3247,7 @@ oe = new WeakMap(), z = new WeakMap(), Ze = new WeakMap(), ae = new WeakMap(), m
3248
3247
  }
3249
3248
  const n = new Set(t.allow), i = ["seal", "host"].map((o) => {
3250
3249
  const a = ct.filter((c) => c.controlledBy === o);
3251
- if (a.length === 0) return Ni("");
3250
+ if (a.length === 0) return Oi("");
3252
3251
  const l = a.map((c) => {
3253
3252
  const d = n.has(c.value), h = c.controlledBy === "host" ? O`<span class="badge badge-host">宿主控制</span>` : d ? O`<span class="badge badge-allow">放行</span>` : O`<span class="badge badge-sealed">已封印</span>`;
3254
3253
  return O`
@@ -3261,7 +3260,7 @@ oe = new WeakMap(), z = new WeakMap(), Ze = new WeakMap(), ae = new WeakMap(), m
3261
3260
  data-cap="${c.value}" aria-label="toggle ${c.value}"></button>
3262
3261
  </div>`;
3263
3262
  });
3264
- return O`<div class="cap-group">${Di[o]}</div>${l}`;
3263
+ return O`<div class="cap-group">${Yi[o]}</div>${l}`;
3265
3264
  });
3266
3265
  A(this, z).innerHTML = fe(O`
3267
3266
  ${T(this, U, Vt).call(this, t)}
@@ -3279,10 +3278,10 @@ oe = new WeakMap(), z = new WeakMap(), Ze = new WeakMap(), ae = new WeakMap(), m
3279
3278
  </div>
3280
3279
  `);
3281
3280
  };
3282
- function Hi() {
3283
- Qt(An, Gi);
3281
+ function Qi() {
3282
+ Qt(An, Hi);
3284
3283
  }
3285
- function Qi(r, e) {
3284
+ function zi(r, e) {
3286
3285
  const t = e ?? {}, n = Date.now();
3287
3286
  switch (r) {
3288
3287
  case "error":
@@ -3336,10 +3335,10 @@ function Qi(r, e) {
3336
3335
  case "destroy":
3337
3336
  return { timestamp: n, event: r, level: "warn", message: String(t.reason ?? "destroyed") };
3338
3337
  default:
3339
- return { timestamp: n, event: r, level: "info", message: zi(t) };
3338
+ return { timestamp: n, event: r, level: "info", message: Ji(t) };
3340
3339
  }
3341
3340
  }
3342
- function zi(r) {
3341
+ function Ji(r) {
3343
3342
  const e = Object.keys(r);
3344
3343
  if (e.length === 0) return "";
3345
3344
  try {
@@ -3352,7 +3351,7 @@ function ji(r) {
3352
3351
  const e = new Date(r), t = (n, s = 2) => String(n).padStart(s, "0");
3353
3352
  return `${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(), 3)}`;
3354
3353
  }
3355
- const fn = "miniapp-devtools-logs", ft = 600, Ji = `
3354
+ const fn = "miniapp-devtools-logs", ft = 600, _i = `
3356
3355
  :host {
3357
3356
  display: flex;
3358
3357
  flex-direction: column;
@@ -3385,27 +3384,27 @@ function dr(r) {
3385
3384
  <span class="log-msg">${r.message}</span>
3386
3385
  </div>`;
3387
3386
  }
3388
- const _i = '<div class="dt-empty">暂无日志,操作小应用后将在此实时显示</div>';
3389
- var se, j, be, Y, G, le, $, Lt, je, st, it;
3390
- class $i extends HTMLElement {
3387
+ const $i = '<div class="dt-empty">暂无日志,操作小应用后将在此实时显示</div>';
3388
+ var se, J, be, Y, G, le, $, It, Je, st, it;
3389
+ class eo extends HTMLElement {
3391
3390
  constructor() {
3392
3391
  super();
3393
3392
  S(this, $);
3394
3393
  S(this, se);
3395
- S(this, j, []);
3394
+ S(this, J, []);
3396
3395
  S(this, be, "");
3397
3396
  S(this, Y, !1);
3398
3397
  S(this, G, null);
3399
3398
  S(this, le, null);
3400
3399
  S(this, st, (t) => {
3401
3400
  const n = t.target;
3402
- n?.dataset?.role === "filter" && (V(this, be, n.value.trim().toLowerCase()), T(this, $, je).call(this));
3401
+ n?.dataset?.role === "filter" && (V(this, be, n.value.trim().toLowerCase()), T(this, $, Je).call(this));
3403
3402
  });
3404
3403
  S(this, it, (t) => {
3405
3404
  const n = t.target?.closest("[data-act]");
3406
3405
  n && (n.dataset.act === "clear" ? this.clear() : n.dataset.act === "pause" && (V(this, Y, !A(this, Y)), A(this, le)?.setAttribute("aria-pressed", String(A(this, Y))), A(this, le) && (A(this, le).textContent = A(this, Y) ? "恢复滚动" : "暂停滚动"), !A(this, Y) && A(this, G) && (A(this, G).scrollTop = A(this, G).scrollHeight)));
3407
3406
  });
3408
- V(this, se, this.attachShadow({ mode: "open" })), Ht(A(this, se), [zt, jt, Ji]);
3407
+ V(this, se, this.attachShadow({ mode: "open" })), Ht(A(this, se), [zt, Jt, _i]);
3409
3408
  }
3410
3409
  connectedCallback() {
3411
3410
  if (A(this, G)) return;
@@ -3417,34 +3416,34 @@ class $i extends HTMLElement {
3417
3416
  <button class="dt-btn" type="button" data-act="clear">清空</button>
3418
3417
  </div>
3419
3418
  <div class="dt-scroll" data-role="list"></div>
3420
- `), A(this, se).append(t), V(this, G, t.querySelector('[data-role="list"]')), V(this, le, t.querySelector('[data-act="pause"]')), A(this, se).addEventListener("click", A(this, it)), A(this, se).addEventListener("input", A(this, st)), T(this, $, je).call(this);
3419
+ `), A(this, se).append(t), V(this, G, t.querySelector('[data-role="list"]')), V(this, le, t.querySelector('[data-act="pause"]')), A(this, se).addEventListener("click", A(this, it)), A(this, se).addEventListener("input", A(this, st)), T(this, $, Je).call(this);
3421
3420
  }
3422
3421
  /** 灌入一条模拟器事件 */
3423
3422
  push(t, n) {
3424
- const s = Qi(t, n);
3425
- A(this, j).push(s), A(this, j).length > ft && A(this, j).splice(0, A(this, j).length - ft);
3423
+ const s = zi(t, n);
3424
+ A(this, J).push(s), A(this, J).length > ft && A(this, J).splice(0, A(this, J).length - ft);
3426
3425
  const i = A(this, G);
3427
- if (!(!i || !T(this, $, Lt).call(this, s))) {
3426
+ if (!(!i || !T(this, $, It).call(this, s))) {
3428
3427
  for (i.querySelector(".dt-empty") && (i.innerHTML = ""), i.insertAdjacentHTML("beforeend", fe(dr(s))); i.childElementCount > ft; ) i.firstElementChild?.remove();
3429
3428
  A(this, Y) || (i.scrollTop = i.scrollHeight);
3430
3429
  }
3431
3430
  }
3432
3431
  clear() {
3433
- A(this, j).length = 0, T(this, $, je).call(this);
3432
+ A(this, J).length = 0, T(this, $, Je).call(this);
3434
3433
  }
3435
3434
  }
3436
- se = new WeakMap(), j = new WeakMap(), be = new WeakMap(), Y = new WeakMap(), G = new WeakMap(), le = new WeakMap(), $ = new WeakSet(), Lt = function(t) {
3435
+ se = new WeakMap(), J = new WeakMap(), be = new WeakMap(), Y = new WeakMap(), G = new WeakMap(), le = new WeakMap(), $ = new WeakSet(), It = function(t) {
3437
3436
  return A(this, be) ? `${t.event} ${t.message}`.toLowerCase().includes(A(this, be)) : !0;
3438
- }, je = function() {
3437
+ }, Je = function() {
3439
3438
  const t = A(this, G);
3440
3439
  if (!t) return;
3441
- const n = A(this, j).filter((s) => T(this, $, Lt).call(this, s));
3442
- t.innerHTML = n.length ? fe(O`${n.map(dr)}`) : _i, A(this, Y) || (t.scrollTop = t.scrollHeight);
3440
+ const n = A(this, J).filter((s) => T(this, $, It).call(this, s));
3441
+ t.innerHTML = n.length ? fe(O`${n.map(dr)}`) : $i, A(this, Y) || (t.scrollTop = t.scrollHeight);
3443
3442
  }, st = new WeakMap(), it = new WeakMap();
3444
- function eo() {
3445
- Qt(fn, $i);
3443
+ function to() {
3444
+ Qt(fn, eo);
3446
3445
  }
3447
- const gn = "miniapp-devtools", to = `
3446
+ const gn = "miniapp-devtools", ro = `
3448
3447
  :host {
3449
3448
  position: fixed;
3450
3449
  top: 0;
@@ -3516,12 +3515,12 @@ const gn = "miniapp-devtools", to = `
3516
3515
  .body > * { flex: 1 1 auto; min-width: 0; }
3517
3516
  .body > [hidden] { display: none !important; }
3518
3517
  `;
3519
- var J, H, ve, Q, ie, Ue, ot, mn, at, lt;
3520
- class ro extends HTMLElement {
3518
+ var j, H, ve, Q, ie, Ue, ot, mn, at, lt;
3519
+ class no extends HTMLElement {
3521
3520
  constructor() {
3522
3521
  super();
3523
3522
  S(this, ot);
3524
- S(this, J);
3523
+ S(this, j);
3525
3524
  S(this, H, null);
3526
3525
  S(this, ve, null);
3527
3526
  S(this, Q);
@@ -3541,7 +3540,7 @@ class ro extends HTMLElement {
3541
3540
  A(this, Q).applying = !1, this.refresh();
3542
3541
  });
3543
3542
  });
3544
- V(this, J, this.attachShadow({ mode: "open" })), Ht(A(this, J), [zt, jt, to]), A(this, J).innerHTML = fe(O`
3543
+ V(this, j, this.attachShadow({ mode: "open" })), Ht(A(this, j), [zt, Jt, ro]), A(this, j).innerHTML = fe(O`
3545
3544
  <div class="header">
3546
3545
  <div class="title"><span class="dot"></span>MiniApp DevTools</div>
3547
3546
  <span class="kbd">⇧⌘U</span>
@@ -3552,7 +3551,7 @@ class ro extends HTMLElement {
3552
3551
  <button class="tab" type="button" role="tab" data-tab="logs" aria-selected="false">运行日志</button>
3553
3552
  </div>
3554
3553
  <div class="body"></div>
3555
- `), V(this, Q, document.createElement(An)), V(this, ie, document.createElement(fn)), A(this, ie).hidden = !0, A(this, J).querySelector(".body").append(A(this, Q), A(this, ie)), A(this, J).addEventListener("click", A(this, at)), A(this, Q).addEventListener(hn, A(this, lt));
3554
+ `), V(this, Q, document.createElement(An)), V(this, ie, document.createElement(fn)), A(this, ie).hidden = !0, A(this, j).querySelector(".body").append(A(this, Q), A(this, ie)), A(this, j).addEventListener("click", A(this, at)), A(this, Q).addEventListener(hn, A(this, lt));
3556
3555
  }
3557
3556
  /** 注入模拟器侧回调(创建后立即调用) */
3558
3557
  bind(t) {
@@ -3580,29 +3579,29 @@ class ro extends HTMLElement {
3580
3579
  (t = A(this, ve)) == null || t.call(this), V(this, ve, null), V(this, H, null), this.remove();
3581
3580
  }
3582
3581
  }
3583
- J = new WeakMap(), H = new WeakMap(), ve = new WeakMap(), Q = new WeakMap(), ie = new WeakMap(), Ue = new WeakMap(), ot = new WeakSet(), mn = function(t) {
3584
- t !== A(this, Ue) && (V(this, Ue, t), A(this, Q).hidden = t !== "capabilities", A(this, ie).hidden = t !== "logs", A(this, J).querySelectorAll(".tab").forEach((n) => {
3582
+ j = new WeakMap(), H = new WeakMap(), ve = new WeakMap(), Q = new WeakMap(), ie = new WeakMap(), Ue = new WeakMap(), ot = new WeakSet(), mn = function(t) {
3583
+ t !== A(this, Ue) && (V(this, Ue, t), A(this, Q).hidden = t !== "capabilities", A(this, ie).hidden = t !== "logs", A(this, j).querySelectorAll(".tab").forEach((n) => {
3585
3584
  n.setAttribute("aria-selected", String(n.dataset.tab === t));
3586
3585
  }));
3587
3586
  }, at = new WeakMap(), lt = new WeakMap();
3588
- function no() {
3589
- Hi(), eo(), Qt(gn, ro);
3590
- }
3591
3587
  function so() {
3588
+ Qi(), to(), Qt(gn, no);
3589
+ }
3590
+ function io() {
3592
3591
  if (typeof navigator > "u") return !1;
3593
3592
  const r = navigator.userAgentData?.platform || navigator.platform || navigator.userAgent || "";
3594
3593
  return /mac|iphone|ipad|ipod/i.test(r);
3595
3594
  }
3596
- function io(r, e = typeof document < "u" ? document : void 0) {
3595
+ function oo(r, e = typeof document < "u" ? document : void 0) {
3597
3596
  if (!e) return () => {
3598
3597
  };
3599
- const t = so(), n = (s) => {
3598
+ const t = io(), n = (s) => {
3600
3599
  s.code !== "KeyU" && s.key?.toLowerCase() !== "u" || !s.shiftKey || !(t ? s.metaKey : s.ctrlKey) || (s.preventDefault(), s.stopPropagation(), r());
3601
3600
  };
3602
3601
  return e.addEventListener("keydown", n, !0), () => e.removeEventListener("keydown", n, !0);
3603
3602
  }
3604
- function oo(r) {
3605
- no();
3603
+ function ao(r) {
3604
+ so();
3606
3605
  const e = document.createElement(gn);
3607
3606
  return e.bind(r), (r.mountRoot ?? document.body).appendChild(e), {
3608
3607
  open: () => e.open(),
@@ -3615,7 +3614,31 @@ function oo(r) {
3615
3614
  destroy: () => e.dispose()
3616
3615
  };
3617
3616
  }
3618
- const Te = "designable-miniapp-frame-toast", ur = "designable-miniapp-frame-toast-style", ao = `
3617
+ const lo = { light: 1, medium: 2, heavy: 4 }, co = 100;
3618
+ class uo {
3619
+ constructor(e) {
3620
+ this.stage = e, this.animation = null, this.lastStartedAt = Number.NEGATIVE_INFINITY;
3621
+ }
3622
+ vibrate(e) {
3623
+ if (!this.stage.isConnected || typeof this.stage.animate != "function") return;
3624
+ const t = performance.now();
3625
+ if (t - this.lastStartedAt < co) return;
3626
+ this.lastStartedAt = t, this.animation?.cancel();
3627
+ const n = e === "long" ? 3 : lo[e];
3628
+ this.animation = this.stage.animate(
3629
+ [0, -1, 1, -1, 1, 0].map((s) => ({ translate: `${s * n}px 0` })),
3630
+ {
3631
+ duration: e === "long" ? 100 : 120,
3632
+ iterations: e === "long" ? 4 : 1,
3633
+ easing: "linear"
3634
+ }
3635
+ );
3636
+ }
3637
+ stop() {
3638
+ this.animation?.cancel(), this.animation = null, this.lastStartedAt = Number.NEGATIVE_INFINITY;
3639
+ }
3640
+ }
3641
+ const Te = "designable-miniapp-frame-toast", ur = "designable-miniapp-frame-toast-style", Ao = `
3619
3642
  .${Te} {
3620
3643
  position: absolute;
3621
3644
  inset: 0;
@@ -3654,7 +3677,7 @@ class bn {
3654
3677
  if (this.container) return this.container;
3655
3678
  if (!this.mountEl.querySelector(`#${ur}`)) {
3656
3679
  const t = document.createElement("style");
3657
- t.id = ur, t.textContent = ao, this.mountEl.appendChild(t);
3680
+ t.id = ur, t.textContent = Ao, this.mountEl.appendChild(t);
3658
3681
  }
3659
3682
  const e = document.createElement("div");
3660
3683
  return e.id = Te, e.className = Te, this.mountEl.appendChild(e), this.container = e, e;
@@ -3672,7 +3695,7 @@ class bn {
3672
3695
  this.container?.remove(), this.container = null;
3673
3696
  }
3674
3697
  }
3675
- class lo {
3698
+ class ho {
3676
3699
  constructor() {
3677
3700
  this.iframe = null, this.handlers = /* @__PURE__ */ new Set(), this.destroyed = !1, this.handleMessage = (e) => {
3678
3701
  if (this.destroyed || !this.iframe || e.source !== this.iframe.contentWindow) return;
@@ -3727,7 +3750,7 @@ function Ar(r) {
3727
3750
  }
3728
3751
  }
3729
3752
  const hr = "mas:msg";
3730
- class co {
3753
+ class po {
3731
3754
  constructor() {
3732
3755
  this.webview = null, this.handlers = /* @__PURE__ */ new Set(), this.destroyed = !1, this.isReady = !1, this.pending = [], this.handleDomReady = () => {
3733
3756
  this.markChannelReady();
@@ -3803,19 +3826,19 @@ class co {
3803
3826
  this.destroyed || (this.destroyed = !0, this.webview && (this.webview.removeEventListener("ipc-message", this.handleIpcMessage), this.webview.removeEventListener("dom-ready", this.handleDomReady)), this.handlers.clear(), this.pending.length = 0, this.webview = null);
3804
3827
  }
3805
3828
  }
3806
- const uo = 60;
3807
- function Ao(r) {
3829
+ const fo = 60;
3830
+ function go(r) {
3808
3831
  throw new Error(`unsupported jsapi: ${r.event}`);
3809
3832
  }
3810
3833
  class vn {
3811
3834
  constructor(e, t = {}) {
3812
- this.handlers = /* @__PURE__ */ new Map(), this.fallbackHandler = Ao, this.destroyed = !1, this.handleMessage = (n) => {
3835
+ this.handlers = /* @__PURE__ */ new Map(), this.fallbackHandler = go, this.destroyed = !1, this.handleMessage = (n) => {
3813
3836
  if (this.destroyed) return;
3814
- if (n.type === We.ready) {
3837
+ if (n.type === Le.ready) {
3815
3838
  this.debug && console.info("[bridge-protocol] ← jsapi channel ready", n);
3816
3839
  return;
3817
3840
  }
3818
- if (n.type !== We.invoke) return;
3841
+ if (n.type !== Le.invoke) return;
3819
3842
  const s = n;
3820
3843
  if (typeof s.raw != "string") {
3821
3844
  this.debug && console.warn("[bridge-protocol] invoke missing raw", n);
@@ -3841,7 +3864,7 @@ class vn {
3841
3864
  `[bridge-protocol] ← invoke event="${o.event}" callbackId="${o.callbackId}"`,
3842
3865
  o.message
3843
3866
  ), this.dispatch(o);
3844
- }, this.transport = e, this.defaultDelay = t.defaultDelay ?? uo, this.debug = t.debug ?? !1, this.onInvoke = t.onInvoke, this.unsubscribe = e.onMessage(this.handleMessage), this.debug && console.info("[bridge-protocol] attached");
3867
+ }, this.transport = e, this.defaultDelay = t.defaultDelay ?? fo, this.debug = t.debug ?? !1, this.onInvoke = t.onInvoke, this.unsubscribe = e.onMessage(this.handleMessage), this.debug && console.info("[bridge-protocol] attached");
3845
3868
  }
3846
3869
  /** Simulator 内部设置未注册事件的最终路由。 */
3847
3870
  setFallbackHandler(e) {
@@ -3879,7 +3902,7 @@ class vn {
3879
3902
  */
3880
3903
  emit(e, t) {
3881
3904
  this.destroyed || this.transport.post({
3882
- type: We.event,
3905
+ type: Le.event,
3883
3906
  payload: { type: "events", method: e, payload: t }
3884
3907
  });
3885
3908
  }
@@ -3892,7 +3915,7 @@ class vn {
3892
3915
  try {
3893
3916
  s = { code: 0, data: await Promise.resolve(t(e)) ?? {} };
3894
3917
  } catch (a) {
3895
- i = !1, o = a instanceof Error ? a.message : String(a), s = { code: ho(a), msg: o };
3918
+ i = !1, o = a instanceof Error ? a.message : String(a), s = { code: mo(a), msg: o };
3896
3919
  }
3897
3920
  if (this.onInvoke) {
3898
3921
  const a = Math.round(performance.now() - n);
@@ -3909,19 +3932,19 @@ class vn {
3909
3932
  return;
3910
3933
  }
3911
3934
  this.debug && console.info(`[bridge-protocol] → callback callbackId="${e.callbackId}"`, s), this.transport.post({
3912
- type: We.invokeCallback,
3935
+ type: Le.invokeCallback,
3913
3936
  callbackId: e.callbackId,
3914
3937
  result: s
3915
3938
  });
3916
3939
  }, this.defaultDelay);
3917
3940
  }
3918
3941
  }
3919
- function ho(r) {
3942
+ function mo(r) {
3920
3943
  if (!r || typeof r != "object" || !("code" in r)) return -1;
3921
3944
  const e = r.code;
3922
3945
  return typeof e == "number" && Number.isSafeInteger(e) && e !== 0 ? e : -1;
3923
3946
  }
3924
- const po = "rgba(0, 0, 0, 0.65)", fo = "#fff", ge = [
3947
+ const bo = "rgba(0, 0, 0, 0.65)", vo = "#fff", ge = [
3925
3948
  {
3926
3949
  id: "s",
3927
3950
  minWindow: 0,
@@ -3970,16 +3993,16 @@ function ce(r) {
3970
3993
  function gt(r, e, t) {
3971
3994
  return r + (e - r) * t;
3972
3995
  }
3973
- function go(r) {
3996
+ function yo(r) {
3974
3997
  if (typeof window < "u") return window.innerWidth;
3975
3998
  }
3976
- function mo(r) {
3999
+ function wo(r) {
3977
4000
  let e = ge[0];
3978
4001
  for (const t of ge)
3979
4002
  r >= t.minWindow && (e = t);
3980
4003
  return e;
3981
4004
  }
3982
- function bo(r) {
4005
+ function Co(r) {
3983
4006
  const e = ge;
3984
4007
  if (r <= e[0].panelWidth)
3985
4008
  return { ...e[0], tierId: e[0].id };
@@ -4000,14 +4023,14 @@ function bo(r) {
4000
4023
  }
4001
4024
  return { ...t, tierId: t.id };
4002
4025
  }
4003
- function vo(r, e) {
4004
- const t = go();
4026
+ function So(r, e) {
4027
+ const t = yo();
4005
4028
  let n, s, i, o;
4006
4029
  if (t !== void 0) {
4007
- const d = mo(t);
4030
+ const d = wo(t);
4008
4031
  n = d.id, s = d.borderRadius, i = d.borderWidth, o = d.shellHeight;
4009
4032
  } else {
4010
- const d = bo(r.width);
4033
+ const d = Co(r.width);
4011
4034
  n = d.tierId, s = d.borderRadius, i = d.borderWidth, o = d.shellHeight;
4012
4035
  }
4013
4036
  const a = r.height / o, l = ce(s * a), c = ce(i * a);
@@ -4015,30 +4038,30 @@ function vo(r, e) {
4015
4038
  tierId: n,
4016
4039
  borderWidth: Math.max(2, c),
4017
4040
  borderRadius: Math.max(8, l),
4018
- borderColor: po,
4019
- background: fo,
4041
+ borderColor: bo,
4042
+ background: vo,
4020
4043
  heightScale: ce(a)
4021
4044
  };
4022
4045
  }
4023
- function Jt(r, e, t) {
4024
- const n = vo(e);
4046
+ function jt(r, e, t) {
4047
+ const n = So(e);
4025
4048
  return getComputedStyle(r).position === "static" && (r.style.position = "relative"), r.style.boxSizing = "content-box", r.style.width = `${e.width}px`, r.style.height = `${e.height}px`, r.style.border = `${n.borderWidth}px solid ${n.borderColor}`, r.style.borderRadius = `${n.borderRadius}px`, r.style.overflow = "hidden", r.style.background = n.borderColor, r.style.display = "flex", r.style.flexDirection = "column", r.style.backgroundImage = "", r.style.backgroundRepeat = "", r.style.backgroundSize = "", n;
4026
4049
  }
4027
4050
  function _t(r, e) {
4028
4051
  const t = Math.max(0, e.borderRadius - e.borderWidth);
4029
4052
  r.style.borderRadius = `${ce(t)}px`, r.style.webkitMaskImage = "-webkit-radial-gradient(white, black)", r.style.maskImage = "radial-gradient(white, black)", r.style.flex = "1", r.style.minHeight = "0", r.style.minWidth = "0";
4030
4053
  }
4031
- function Wt(r) {
4054
+ function Lt(r) {
4032
4055
  r.style.border = "", r.style.borderRadius = "", r.style.boxSizing = "", r.style.display = "", r.style.flexDirection = "", r.style.background = "";
4033
4056
  }
4034
- function It(r) {
4057
+ function Wt(r) {
4035
4058
  r.style.borderRadius = "", r.style.webkitMaskImage = "", r.style.maskImage = "", r.style.flex = "", r.style.minHeight = "", r.style.minWidth = "";
4036
4059
  }
4037
4060
  function yn(r, e, t) {
4038
4061
  if (typeof window > "u") return () => {
4039
4062
  };
4040
4063
  const n = () => {
4041
- const s = t(), i = Jt(r, s);
4064
+ const s = t(), i = jt(r, s);
4042
4065
  e && _t(e, i);
4043
4066
  };
4044
4067
  return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
@@ -4057,12 +4080,12 @@ class wn {
4057
4080
  this.events.clear();
4058
4081
  }
4059
4082
  }
4060
- const yo = 200, pr = 600;
4061
- function wo(r) {
4083
+ const Eo = 200, pr = 600;
4084
+ function xo(r) {
4062
4085
  const e = r.tagName.toLowerCase(), t = r.id ? `#${r.id}` : r.classList.length > 0 ? `.${r.classList.item(0)}` : "", n = (r.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 18);
4063
4086
  return n ? `${e}${t} · ${n}` : `${e}${t}`;
4064
4087
  }
4065
- function Co(r) {
4088
+ function Vo(r) {
4066
4089
  const e = [];
4067
4090
  let t = r;
4068
4091
  for (; t && t !== r.ownerDocument.documentElement; ) {
@@ -4089,7 +4112,7 @@ function Sn(r, e) {
4089
4112
  return !1;
4090
4113
  }
4091
4114
  }
4092
- function So(r) {
4115
+ function Io(r) {
4093
4116
  const e = r.ownerDocument, t = [];
4094
4117
  let n = r;
4095
4118
  for (; n && n.nodeType === 1 && n !== e.documentElement; ) {
@@ -4107,13 +4130,13 @@ function So(r) {
4107
4130
  }
4108
4131
  return t.join(" > ");
4109
4132
  }
4110
- function Eo(r) {
4133
+ function Lo(r) {
4111
4134
  const e = {};
4112
4135
  for (const t of Array.from(r.attributes))
4113
4136
  e[t.name] = t.value;
4114
4137
  return e;
4115
4138
  }
4116
- function xo(r, e) {
4139
+ function Wo(r, e) {
4117
4140
  const t = e.getBoundingClientRect(), n = e.offsetWidth > 0 ? t.width / e.offsetWidth : 1, s = e.offsetHeight > 0 ? t.height / e.offsetHeight : 1;
4118
4141
  return {
4119
4142
  x: t.left + r.left * n,
@@ -4123,25 +4146,25 @@ function xo(r, e) {
4123
4146
  };
4124
4147
  }
4125
4148
  function fr(r, e) {
4126
- const t = (r.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, yo), n = r.outerHTML ?? "", s = r.getBoundingClientRect(), i = So(r);
4149
+ const t = (r.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, Eo), n = r.outerHTML ?? "", s = r.getBoundingClientRect(), i = Io(r);
4127
4150
  return {
4128
4151
  kind: "dom",
4129
4152
  ref: `dom:${i}`,
4130
- label: wo(r),
4153
+ label: xo(r),
4131
4154
  selector: i,
4132
- domPath: Co(r),
4155
+ domPath: Vo(r),
4133
4156
  tagName: r.tagName.toLowerCase(),
4134
4157
  id: r.id || null,
4135
4158
  classList: Array.from(r.classList),
4136
4159
  text: t,
4137
4160
  outerHTMLPreview: n.length > pr ? `${n.slice(0, pr)}…` : n,
4138
- attributes: Eo(r),
4161
+ attributes: Lo(r),
4139
4162
  rect: { x: s.left, y: s.top, width: s.width, height: s.height },
4140
- viewportRect: xo(s, e)
4163
+ viewportRect: Wo(s, e)
4141
4164
  };
4142
4165
  }
4143
- const Vo = "2147483600", gr = "opacity 200ms ease, left 300ms cubic-bezier(0.22, 1, 0.36, 1), top 300ms cubic-bezier(0.22, 1, 0.36, 1), width 300ms cubic-bezier(0.22, 1, 0.36, 1), height 300ms cubic-bezier(0.22, 1, 0.36, 1)", En = "#7c5cfc", Lo = "rgba(124, 92, 252, 0.78)", Wo = "rgba(124, 92, 252, 0.045)", Io = "0 0 0 1px rgba(255, 255, 255, 0.88), 0 2px 10px rgba(124, 92, 252, 0.16)", ko = En, qo = "rgba(124, 92, 252, 0.055)", Bo = "0 0 0 1px rgba(255, 255, 255, 0.92), 0 0 0 3px rgba(124, 92, 252, 0.24), 0 6px 18px rgba(124, 92, 252, 0.18)", mr = "mini-app:inspector-request", To = "mini-app:inspector-response", Ro = "mini-app:inspector-control", Fo = 2e3, Xo = 200;
4144
- class Ko {
4166
+ const ko = "2147483600", gr = "opacity 200ms ease, left 300ms cubic-bezier(0.22, 1, 0.36, 1), top 300ms cubic-bezier(0.22, 1, 0.36, 1), width 300ms cubic-bezier(0.22, 1, 0.36, 1), height 300ms cubic-bezier(0.22, 1, 0.36, 1)", En = "#7c5cfc", qo = "rgba(124, 92, 252, 0.78)", Bo = "rgba(124, 92, 252, 0.045)", To = "0 0 0 1px rgba(255, 255, 255, 0.88), 0 2px 10px rgba(124, 92, 252, 0.16)", Ro = En, Fo = "rgba(124, 92, 252, 0.055)", Xo = "0 0 0 1px rgba(255, 255, 255, 0.92), 0 0 0 3px rgba(124, 92, 252, 0.24), 0 6px 18px rgba(124, 92, 252, 0.18)", mr = "mini-app:inspector-request", Ko = "mini-app:inspector-response", No = "mini-app:inspector-control", Po = 2e3, Oo = 200;
4167
+ class Mo {
4145
4168
  constructor(e) {
4146
4169
  this.enabled = !1, this.destroyed = !1, this.overlay = null, this.hoverBox = null, this.selectedBoxes = /* @__PURE__ */ new Map(), this.selections = /* @__PURE__ */ new Map(), this.selectionMode = "single", this.hoveredEl = null, this.hoverShown = !1, this.requestSeq = 0, this.latestHoverRequest = 0, this.guestHoverFrame = null, this.pendingGuestHover = null, this.pendingRequests = /* @__PURE__ */ new Map(), this.sceneRefreshTimer = null, this.sceneRefreshPending = !1, this.warnedNoAccess = !1, this.onFrameLoad = () => {
4147
4170
  this.enabled && this.notifyGuestPause(!0);
@@ -4188,7 +4211,7 @@ class Ko {
4188
4211
  }, this.onGuestMessage = (t) => {
4189
4212
  if (t.source !== this.opts.element.contentWindow) return;
4190
4213
  const n = t.data;
4191
- if (n?.type !== To || !n.payload) return;
4214
+ if (n?.type !== Ko || !n.payload) return;
4192
4215
  const { requestId: s = 0, action: i, selection: o, error: a } = n.payload, l = this.pendingRequests.get(s);
4193
4216
  if (l) {
4194
4217
  this.pendingRequests.delete(s), window.clearTimeout(l.timeoutId), a ? l.reject(new Error(a)) : l.resolve(n.payload);
@@ -4234,13 +4257,13 @@ class Ko {
4234
4257
  }
4235
4258
  notifyGuestPause(e) {
4236
4259
  this.opts.element.contentWindow?.postMessage(
4237
- { type: Ro, payload: { paused: e } },
4260
+ { type: No, payload: { paused: e } },
4238
4261
  "*"
4239
4262
  );
4240
4263
  }
4241
4264
  buildOverlay(e) {
4242
4265
  const t = document.createElement("div");
4243
- t.style.position = "absolute", t.style.inset = "0", t.style.zIndex = Vo, t.style.cursor = "crosshair", t.style.userSelect = "none", t.style.background = "transparent", t.addEventListener("mousemove", this.onMove), t.addEventListener("mouseleave", this.onLeave), t.addEventListener("mousedown", this.onMouseDown, !0), this.hoverBox = this.createBox(Lo, Wo, Io), this.hoverBox.style.borderStyle = "dashed", this.hoverBox.style.borderRadius = "7px", t.appendChild(this.hoverBox), e.appendChild(t), this.overlay = t;
4266
+ t.style.position = "absolute", t.style.inset = "0", t.style.zIndex = ko, t.style.cursor = "crosshair", t.style.userSelect = "none", t.style.background = "transparent", t.addEventListener("mousemove", this.onMove), t.addEventListener("mouseleave", this.onLeave), t.addEventListener("mousedown", this.onMouseDown, !0), this.hoverBox = this.createBox(qo, Bo, To), this.hoverBox.style.borderStyle = "dashed", this.hoverBox.style.borderRadius = "7px", t.appendChild(this.hoverBox), e.appendChild(t), this.overlay = t;
4244
4267
  }
4245
4268
  teardownOverlay() {
4246
4269
  this.stopSceneSelectionRefresh(), this.cancelGuestHover();
@@ -4326,7 +4349,7 @@ class Ko {
4326
4349
  startSceneSelectionRefresh() {
4327
4350
  this.sceneRefreshTimer !== null || !this.enabled || (this.sceneRefreshTimer = window.setInterval(() => {
4328
4351
  this.refreshSceneSelections();
4329
- }, Xo));
4352
+ }, Oo));
4330
4353
  }
4331
4354
  stopSceneSelectionRefresh() {
4332
4355
  this.sceneRefreshTimer !== null && (window.clearInterval(this.sceneRefreshTimer), this.sceneRefreshTimer = null);
@@ -4371,7 +4394,7 @@ class Ko {
4371
4394
  return new Promise((i, o) => {
4372
4395
  const a = window.setTimeout(() => {
4373
4396
  this.pendingRequests.delete(s), o(new Error(`Visual Inspector request timed out: ${e}`));
4374
- }, Fo);
4397
+ }, Po);
4375
4398
  this.pendingRequests.set(s, { resolve: i, reject: o, timeoutId: a }), n.postMessage(
4376
4399
  { type: mr, payload: { requestId: s, action: e, ...t } },
4377
4400
  "*"
@@ -4452,7 +4475,7 @@ class Ko {
4452
4475
  e && (e.style.opacity = "0");
4453
4476
  }
4454
4477
  createSelectedBox(e, t) {
4455
- const n = this.createBox(ko, qo, Bo);
4478
+ const n = this.createBox(Ro, Fo, Xo);
4456
4479
  n.style.zIndex = "2", n.style.borderRadius = "9px";
4457
4480
  const s = document.createElement("span");
4458
4481
  return s.textContent = `${t} · ${e}`, Object.assign(s.style, {
@@ -4501,8 +4524,8 @@ function xn(r) {
4501
4524
  }
4502
4525
  };
4503
4526
  }
4504
- const Po = 3e3;
4505
- class No {
4527
+ const Zo = 3e3;
4528
+ class Uo {
4506
4529
  constructor(e) {
4507
4530
  this.currentUrl = "", this.loadStartedAt = 0, this.renderDoneEmitted = !1, this.gestureBus = null, this.gestureSetup = null, this.resourceLimitRecovering = !1, this.heapCooling = null, this.pendingGesturePlugins = [], this.inspector = null, this.handleMessage = (t) => {
4508
4531
  if (t.source !== this.element.contentWindow) return;
@@ -4525,7 +4548,7 @@ class No {
4525
4548
  }
4526
4549
  createIframe() {
4527
4550
  const e = document.createElement("iframe");
4528
- return e.setAttribute("sandbox", this.ctx.rendererContext.sandboxFlags), e.referrerPolicy = "no-referrer", e.allow = cs(this.ctx.rendererContext.security.iframeAllow), e.style.border = "0", e.style.display = "block", e.style.width = "100%", e.style.height = "100%", e;
4551
+ return e.setAttribute("sandbox", this.ctx.rendererContext.sandboxFlags), e.referrerPolicy = "no-referrer", e.allow = ds(this.ctx.rendererContext.security.iframeAllow), e.style.border = "0", e.style.display = "block", e.style.width = "100%", e.style.height = "100%", e;
4529
4552
  }
4530
4553
  async prepare() {
4531
4554
  }
@@ -4629,7 +4652,7 @@ class No {
4629
4652
  o.onload = () => {
4630
4653
  if (l(), this.ctx.rendererContext.transport?.markReady(), this.ctx.rendererContext.touchEmulation)
4631
4654
  try {
4632
- Is(o);
4655
+ ks(o);
4633
4656
  } catch (h) {
4634
4657
  this.ctx.rendererContext.debug && console.debug("[mini-app-simulator] gesture receiver 使用文档预注入", h);
4635
4658
  } finally {
@@ -4637,7 +4660,7 @@ class No {
4637
4660
  }
4638
4661
  const c = Math.round(performance.now() - n);
4639
4662
  this.ctx.emit("load", { url: e, duration: c });
4640
- const d = Oo(o, c);
4663
+ const d = Do(o, c);
4641
4664
  d && this.ctx.emit("performance", d), window.setTimeout(() => this.emitRenderDone(e), 120), s();
4642
4665
  }, o.onerror = (c) => {
4643
4666
  l();
@@ -4659,7 +4682,7 @@ class No {
4659
4682
  if (e === !1) return null;
4660
4683
  if (this.heapCooling) {
4661
4684
  const n = this.heapCooling;
4662
- if (performance.now() - n.startedAt < Po)
4685
+ if (performance.now() - n.startedAt < Zo)
4663
4686
  return { used: Math.max(n.used, t ?? 0), limit: n.limit };
4664
4687
  if (t === void 0 || t > e)
4665
4688
  return { used: Math.max(n.used, t ?? 0), limit: e };
@@ -4791,7 +4814,7 @@ class No {
4791
4814
  // ---- 可视化元素选取 ----
4792
4815
  /** 惰性创建选取器:overlay 挂到 iframe 父容器(与 iframe 盒对齐,适配各内容模式) */
4793
4816
  ensureInspector() {
4794
- return this.inspector || (this.inspector = new Ko({
4817
+ return this.inspector || (this.inspector = new Mo({
4795
4818
  element: this.element,
4796
4819
  getMountTarget: () => this.element.parentElement,
4797
4820
  onSelect: (e) => {
@@ -4839,7 +4862,7 @@ class No {
4839
4862
  this.detachWorkerLifecycle?.(), window.removeEventListener("message", this.handleMessage), this.inspector?.destroy(), this.inspector = null, this.gestureBus?.destroy(), this.gestureBus = null, this.terminateGuest("destroy"), this.element.onload = null, this.element.onerror = null, this.element.removeAttribute("srcdoc"), this.element.remove();
4840
4863
  }
4841
4864
  }
4842
- function Oo(r, e) {
4865
+ function Do(r, e) {
4843
4866
  try {
4844
4867
  const t = r.contentWindow?.performance;
4845
4868
  if (!t) return null;
@@ -4849,7 +4872,7 @@ function Oo(r, e) {
4849
4872
  domReady: n?.domContentLoadedEventEnd ? Math.round(n.domContentLoadedEventEnd) : void 0,
4850
4873
  firstPaint: i ? Math.round(i.startTime) : void 0,
4851
4874
  domExecutionDuration: n?.domContentLoadedEventEnd ? Math.max(0, Math.round(n.domContentLoadedEventEnd - n.responseEnd)) : void 0,
4852
- resourceDuration: Mo(s),
4875
+ resourceDuration: Yo(s),
4853
4876
  resourceCount: s.length,
4854
4877
  transferSize: s.reduce((o, a) => o + a.transferSize, 0)
4855
4878
  };
@@ -4857,7 +4880,7 @@ function Oo(r, e) {
4857
4880
  return null;
4858
4881
  }
4859
4882
  }
4860
- function Mo(r) {
4883
+ function Yo(r) {
4861
4884
  if (r.length === 0) return;
4862
4885
  const e = Math.min(...r.map((n) => n.startTime)), t = Math.max(...r.map((n) => n.responseEnd));
4863
4886
  return Math.max(0, Math.round(t - e));
@@ -4870,14 +4893,14 @@ function Ye(r) {
4870
4893
  return null;
4871
4894
  }
4872
4895
  }
4873
- class Zo {
4896
+ class Go {
4874
4897
  constructor(e) {
4875
4898
  this.currentUrl = "", this.preloadUrl = null, this.domReady = !1, this.devtoolsDesired = !1, this.zoomFactorDesired = 1, this.gestureBus = null, this.pendingGesturePlugins = [], this.handleDomReady = () => {
4876
4899
  this.domReady = !0, this.gestureBus?.notifyIframeReady(), this.zoomFactorDesired !== 1 && this.setZoomFactor(this.zoomFactorDesired), this.devtoolsDesired && this.applyDevtools(!0);
4877
4900
  }, this.handleConsole = (n) => {
4878
4901
  const s = n, { message: i, source: o } = tn(s.message ?? "");
4879
4902
  this.ctx.emit("console", {
4880
- level: Uo(s.level),
4903
+ level: Ho(s.level),
4881
4904
  message: i,
4882
4905
  source: o
4883
4906
  });
@@ -4895,7 +4918,7 @@ class Zo {
4895
4918
  async prepare() {
4896
4919
  const e = this.ctx.rendererContext;
4897
4920
  try {
4898
- this.preloadUrl = await zs({
4921
+ this.preloadUrl = await Js({
4899
4922
  options: e.normalizedOptions,
4900
4923
  injection: e.injection
4901
4924
  }), console.info("[sim-dbg] prepare preload", {
@@ -5067,48 +5090,48 @@ class Zo {
5067
5090
  }
5068
5091
  }
5069
5092
  }
5070
- function Uo(r) {
5093
+ function Ho(r) {
5071
5094
  return r === 0 ? "debug" : r === 1 ? "info" : r === 2 ? "warn" : r === 3 ? "error" : "log";
5072
5095
  }
5073
- const et = "部署成功后可预览", br = { width: 108, height: 73 }, Do = "0 0 108 73", Yo = `<svg width="${br.width}" height="${br.height}" viewBox="${Do}" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M17.5523 3.45177C18.5978 3.30869 19.8053 3.72588 20.8677 3.7213C21.8149 3.71724 22.8293 3.45062 23.7798 3.46838C24.9063 3.48928 26.1311 3.68172 27.2495 3.70861C28.7022 3.7437 30.1759 3.66674 31.6372 3.69005C32.8024 3.70856 33.9865 3.83116 35.1362 3.83068C36.2481 3.83018 37.37 3.76656 38.4898 3.77111C39.4154 3.77493 40.4597 3.84521 41.3687 3.81213C42.3573 3.77621 43.4742 3.5029 44.5005 3.52697C45.5079 3.55061 46.5849 3.79763 47.5767 3.82189C49.8156 3.87664 52.0926 3.95474 54.3316 3.98302C56.1946 4.00667 58.3675 4.19346 60.1821 4.16369C62.8754 4.11947 65.5892 4.16343 68.2603 3.91466C69.3377 3.81439 70.4866 3.40545 71.5425 3.43322C73.8561 3.49427 76.2024 3.63789 78.5152 3.74084C79.2352 3.77293 80.2913 3.51477 80.9624 3.53576C82.1221 3.52923 83.3832 3.79373 84.5337 3.75939C86.7485 3.69334 88.7812 3.32488 90.9976 3.73009C92.0457 3.92176 92.8627 3.89957 93.7036 4.76427C94.3225 5.4021 94.379 6.21544 94.4976 7.06505C94.7506 10.6378 94.6359 14.1942 94.6226 17.7643L94.6519 32.152L94.7495 59.9371C94.7678 62.0734 94.9897 64.2293 95.0445 66.3727C95.1133 69.062 94.1317 68.9939 91.8081 68.9283C90.8791 68.8513 89.7376 69.046 88.8609 69.0045C86.7448 68.905 84.7278 69.0412 82.6167 69.0006C82.0742 68.9899 81.2033 69.1142 80.5962 69.1324L61.4761 69.5797C58.4893 69.6344 55.2801 69.1116 52.2359 69.1813C50.1517 69.2286 47.9723 69.2703 45.8902 69.2711L22.107 69.1295C21.0981 69.132 15.3988 69.343 15.0015 69.1315C14.7505 68.9969 14.6279 68.5785 14.5581 68.319C13.8726 65.7643 14.0488 63.5686 14.0679 61.0113C14.0848 58.7396 14.0646 56.47 14.1079 54.1969C14.1289 53.0948 14.2333 51.9949 14.2398 50.8922C14.2483 49.4294 14.2518 47.9331 14.187 46.4733C14.1411 45.4376 14.0144 44.4002 14.0239 43.3629C14.0336 42.3208 14.2202 41.2864 14.2349 40.2447L14.5972 18.4889C14.6574 14.8432 14.4808 11.1457 14.4009 7.50158C14.3524 5.28478 15.3986 4.00203 17.5523 3.45177ZM84.0073 17.1998C82.749 17.2314 81.09 16.9222 79.8765 17.0826C76.5874 17.3246 73.4225 17.1627 70.1284 17.1178C68.165 17.091 66.2269 17.4293 64.2671 17.3844C62.7918 17.3389 61.3342 17.1485 59.856 17.1344C59.2263 17.1283 58.5859 17.1366 57.9566 17.1227C56.1444 17.0825 54.4092 17.5789 52.5904 17.4049C52.1524 17.363 51.6623 17.3924 51.2202 17.3776C49.906 17.4059 48.5865 17.5062 47.271 17.5113C45.9078 17.51 44.6386 17.4127 43.2544 17.4869C41.7822 17.5659 40.3445 17.9553 38.8882 17.9498C36.4908 17.9408 34.2416 17.6096 31.8169 17.6022C29.8747 17.5963 28.0332 17.478 26.0689 17.5611C24.8704 17.6118 23.1046 17.8972 22.0171 17.8727C20.0195 17.8273 18.3649 17.6053 16.3052 17.6403L15.9595 51.4498L15.8794 60.9996C15.8724 61.6237 15.6441 63.1346 15.6743 63.5045C15.7686 64.6585 15.8966 66.4726 16.0835 67.5817C20.4948 67.1686 24.8526 67.5326 29.2202 67.4762C32.8823 67.5508 36.5115 67.4397 40.1724 67.399C42.2531 67.375 44.3275 67.5204 46.4068 67.5387C48.1617 67.537 49.9517 67.39 51.7046 67.4108C56.327 67.4605 60.9098 68.0708 65.5337 67.6354C67.0758 67.4894 68.7005 67.6431 70.2368 67.5377C75.6428 67.1636 81.0467 67.4588 86.4585 67.2281C87.1114 67.2008 88.1957 67.3791 88.7896 67.2945C90.2271 67.0898 91.9084 67.334 93.272 67.2203C93.4014 65.0489 93.2341 62.81 93.0864 60.6393C92.8774 57.5856 93.11 54.7471 93.232 51.7272C93.3647 48.4517 92.9765 45.0516 92.9624 41.7731C92.9118 39.9941 93.0414 38.2658 93.0405 36.5104L93.0269 22.1627C93.0318 20.5252 92.8554 18.7787 92.8628 17.1569C89.9139 17.147 86.9546 17.1257 84.0073 17.1998Z" fill="black" fill-opacity="0.27"/><path d="M55.7374 34.6264C56.0667 33.3883 56.4399 32.1743 57.1424 31.0846C59.0982 28.0509 63.693 27.0695 66.6626 29.0925C69.6157 31.1041 69.8106 37.0884 67.8505 39.8061C66.6999 41.4007 65.0737 42.1102 63.1871 42.4203C59.0197 42.9598 56.3897 40.9103 55.8006 36.7491C54.8942 40.2303 53.3291 42.0919 49.5536 42.4714C45.8729 42.8038 42.9989 40.6755 42.6806 36.9371C42.3144 32.6345 44.4633 28.3858 49.1883 28.0315C49.5812 28.037 49.974 28.0476 50.3667 28.0631C54.0562 28.2301 55.9159 31.1557 55.7374 34.6264Z" fill="black" fill-opacity="0.27"/><path d="M49.1181 29.8535C49.7972 29.7381 50.8544 29.935 51.5613 30.0387C50.3064 30.4438 49.3408 30.5925 48.6341 31.8607C47.2869 34.2788 49.5375 36.9511 52.131 36.1644C53.2004 35.84 53.7314 34.8441 54.173 33.8922C54.0454 35.5683 54.1036 37.292 53.1069 38.7373C52.2783 39.869 50.6033 40.539 49.225 40.6162C42.532 40.9917 43.1611 30.4267 49.1181 29.8535Z" fill="white"/><path d="M62.2667 29.8477C63.0255 29.7846 64.1183 29.962 64.8955 30.0617C63.6767 30.3828 62.4958 30.6606 61.8547 31.8518C60.4455 34.4701 62.7362 36.9987 65.5032 36.2126C66.3576 35.97 66.8446 35.3888 67.2353 34.6371C67.2743 36.3893 67.1042 37.7957 65.9562 39.1968C64.3878 40.6345 60.98 41.23 59.3232 39.7737C55.9556 36.8137 57.6824 30.4498 62.2667 29.8477Z" fill="white"/><path d="M26.3445 19.6176L27.4116 19.6147C27.4004 21.4551 27.5046 23.3326 27.5406 25.1748C27.5951 28.3785 27.6092 31.583 27.5828 34.7871C27.5573 37.5929 27.3885 40.4084 27.3733 43.221C27.4175 44.2992 27.0986 45.6969 27.1691 46.7384C27.37 49.7061 27.4811 52.535 27.2498 55.5165C27.1589 56.6883 27.4267 58.2028 27.3909 59.3505C27.3605 60.323 27.3692 64.1261 26.8121 64.7153C26.5166 64.6715 26.2179 64.5882 26.0247 64.3542C25.8581 63.7958 26.215 60.9323 26.2237 60.0705C26.2382 58.617 26.0204 57.1732 26.0166 55.7661C25.9878 54.3433 26.2722 52.8298 26.2513 51.4204C26.2195 49.2771 25.8748 47.5358 26.015 45.3595C26.2705 40.5662 26.4689 35.7243 26.452 30.9236C26.4441 28.6779 26.2885 26.351 26.3653 24.0866C26.4135 22.6659 26.1621 21.0264 26.3445 19.6176Z" fill="black" fill-opacity="0.27"/><path d="M20.1269 51.5022C20.875 51.4543 22.7525 51.1751 23.1363 51.8769C23.1823 52.1445 23.1747 52.1767 23.0779 52.4312C22.8071 52.6057 22.7893 52.5516 22.4257 52.5717C21.6024 52.6245 19.5517 52.8771 19.1016 52.1431C19.102 51.9275 19.1448 51.8966 19.2698 51.707C19.5299 51.5136 19.7931 51.5311 20.1269 51.5022Z" fill="black" fill-opacity="0.27"/><path d="M19.8632 21.4886C20.7111 21.4493 22.5399 21.2168 23.1352 21.716C23.2803 21.9633 23.2692 22.0075 23.2295 22.2951C23.0507 22.5511 23.099 22.4762 22.7473 22.591C21.9574 22.5893 19.9137 22.8484 19.4079 22.3056C19.3135 22.0476 19.3315 22.0057 19.4084 21.7384C19.6097 21.5134 19.5174 21.587 19.8632 21.4886Z" fill="black" fill-opacity="0.27"/><path d="M21.5103 45.2112C21.9089 45.1874 22.5931 45.0957 22.9294 45.2482C23.1338 45.4886 23.2289 46.0708 23.0368 46.1847C22.639 46.4204 21.4558 46.3333 20.968 46.3281C20.2785 46.3484 19.3703 46.5827 19.1797 45.7866C19.3998 45.0041 20.8056 45.2148 21.5103 45.2112Z" fill="black" fill-opacity="0.27"/><path d="M19.6605 57.8873C20.2986 57.8662 22.5425 57.7338 23.0242 57.9146C23.1377 58.1465 23.1557 58.571 23.0397 58.8135C22.9924 58.9124 22.8259 58.9105 22.7101 58.9336C21.8965 58.9291 19.7416 59.1798 19.209 58.6524C19.0985 58.352 19.1131 58.4814 19.1613 58.1587C19.3797 57.9228 19.2924 58.0003 19.6605 57.8873Z" fill="black" fill-opacity="0.27"/><path d="M19.8318 27.0236C20.6418 27.0088 22.849 26.7599 23.2824 27.3852C23.2991 27.7917 23.1603 27.8987 22.8367 28.0499C22.0813 28.1747 19.9938 28.4117 19.442 27.8633C19.3212 27.6107 19.3267 27.5749 19.379 27.298C19.576 27.0689 19.5141 27.1399 19.8318 27.0236Z" fill="black" fill-opacity="0.27"/><path d="M19.5103 38.6328C20.3818 38.5977 22.2948 38.4602 23.0374 38.7355C23.3443 39.0578 23.2308 39.3339 22.9823 39.6834C21.9447 39.6989 20.7656 39.7845 19.7369 39.6178C19.3747 39.5592 19.2748 39.4001 19.2227 39.0752C19.3043 38.8331 19.3243 38.8089 19.5103 38.6328Z" fill="black" fill-opacity="0.27"/><path d="M19.4441 32.7511C20.2259 32.7059 22.7452 32.4643 23.22 33.0422C23.2626 33.324 23.2059 33.4152 23.0992 33.6765C22.5657 33.8516 20.4179 33.91 19.8238 33.7636C19.5144 33.6873 19.4752 33.5963 19.3428 33.3683C19.3126 33.0655 19.3211 33.0302 19.4441 32.7511Z" fill="black" fill-opacity="0.27"/><path d="M17.9375 5.19426C19.0035 5.18057 19.8439 5.51612 20.8324 5.51437C21.8845 5.51247 22.9572 5.18895 24.0571 5.23159C25.3236 5.28061 26.5655 5.39666 27.829 5.47398C29.7132 5.44876 31.4461 5.35601 33.3318 5.49529C35.9003 5.68509 38.5198 5.39384 41.1053 5.57418C42.1021 5.6437 43.3577 5.26958 44.3736 5.30135C48.4763 5.66651 52.5325 5.71628 56.6557 5.83864C60.7142 5.95917 65.0095 6.19003 69.0404 5.61433C69.8948 5.49222 70.8554 5.21607 71.7057 5.21748C73.9529 5.22113 76.1951 5.33337 78.434 5.5079C79.1748 5.55386 80.2076 5.29289 80.9226 5.33843C83.5398 5.505 86.011 5.50176 88.6249 5.24469C89.2213 5.18613 91.8377 5.45838 92.2242 5.86311C92.8953 6.56548 92.8464 8.85259 92.8746 9.83235C92.9426 11.7353 92.9559 13.6399 92.9161 15.5437L91.4859 15.5528C90.4275 15.5788 89.0712 15.419 87.972 15.3943C86.6547 15.3646 85.403 15.505 84.1122 15.4998C82.9616 15.4953 81.7265 15.3339 80.5452 15.3247C79.5166 15.3167 78.2233 15.5727 77.2511 15.5575C74.8073 15.5193 72.3311 15.3913 69.8865 15.378C68.1536 15.3684 66.3593 15.6691 64.6221 15.6522C62.4737 15.6313 60.3791 15.402 58.2226 15.3801C56.6504 15.3641 55.345 15.6268 53.8054 15.6947C52.949 15.7324 52.0307 15.6119 51.1814 15.6647C48.4764 15.8326 45.7948 15.7373 43.091 15.7663C41.7022 15.7811 40.1085 16.2506 38.7735 16.2141C35.625 16.0503 32.512 15.9138 29.3574 15.8182C26.8796 15.7432 24.6994 16.0095 22.2825 16.0759C20.3479 16.1292 18.2916 15.9415 16.302 15.9671C16.3022 14.0656 16.2797 12.1641 16.2345 10.2631C16.2125 9.30485 16.1176 8.32011 16.1659 7.36739C16.2359 5.98588 16.6968 5.56439 17.9375 5.19426Z" fill="white"/><path d="M21.4551 8.37897C22.7406 8.12829 23.9876 8.96189 24.2474 10.2456C24.5071 11.5294 23.6824 12.7822 22.4005 13.0511C21.1057 13.3226 19.8376 12.4877 19.5752 11.1911C19.3128 9.89445 20.1566 8.63223 21.4551 8.37897Z" fill="black" fill-opacity="0.27"/><path d="M21.3133 9.5824C22.0079 9.53404 22.5757 9.4934 22.9771 10.1973C23.1132 10.4306 23.1465 10.7098 23.0693 10.9686C22.935 11.4263 22.7202 11.6472 22.3159 11.8612L22.2383 11.8719C20.6043 12.0898 20.2753 10.6113 21.3133 9.5824Z" fill="white"/><path d="M34.3344 8.43169C36.5428 8.40033 37.7 9.74675 36.7659 12.0393C36.5415 12.5902 35.8517 12.9222 35.2821 13.0585C34.577 13.0934 34.2485 13.1509 33.6265 12.7913C31.8975 11.7915 32.3767 8.78855 34.3344 8.43169Z" fill="black" fill-opacity="0.27"/><path d="M34.2632 9.67081C35.6934 9.56314 35.8442 9.80976 35.9445 11.1688C35.7088 11.5184 35.6685 11.5974 35.3228 11.8352C33.6563 12.151 33.2269 10.7561 34.2632 9.67081Z" fill="white"/><path d="M27.6458 8.60775C28.4397 8.37921 29.2951 8.59464 29.8861 9.17192C30.4771 9.74911 30.7125 10.5993 30.5027 11.3983C30.2928 12.1973 29.67 12.8221 28.8717 13.0345C28.2459 13.201 27.5788 13.0955 27.0349 12.7441C26.2785 12.2556 25.8775 11.3701 26.0091 10.4793C26.1406 9.58859 26.7806 8.85686 27.6458 8.60775Z" fill="black" fill-opacity="0.27"/><path d="M27.9803 9.72255C28.5705 9.56602 29.1782 9.90712 29.352 10.4925C29.5259 11.0778 29.2027 11.6954 28.6227 11.8863C28.2321 12.0149 27.8024 11.9209 27.5011 11.6408C27.1999 11.3609 27.0746 10.9392 27.1743 10.5402C27.274 10.1412 27.5828 9.82798 27.9803 9.72255Z" fill="white"/><path d="M81.4858 8.49414C81.8483 8.60721 82.0374 9.00936 82.2348 9.32683C81.5588 9.86992 80.677 10.399 79.9387 10.866C80.6446 11.3705 82.8495 12.0949 81.3746 13.0558C80.7599 12.8096 79.2303 11.9336 78.8761 11.4271C78.0474 10.2411 80.6413 9.00729 81.4858 8.49414Z" fill="black" fill-opacity="0.27"/><path d="M87.389 8.3125C87.866 8.35547 88.0012 8.48604 88.4011 8.70918C91.8635 10.6419 89.8843 11.408 87.7565 12.861C87.5242 12.9687 87.6213 12.9452 87.3467 12.9073C87.0846 12.7284 86.9751 12.4694 86.8125 12.1868C87.5715 11.6023 88.3007 11.0312 89.097 10.4957C88.7354 10.297 88.3762 10.0958 88.0178 9.8921C87.6238 9.66688 87.2414 9.42773 87.1145 8.96626C87.1352 8.65344 87.2181 8.56584 87.389 8.3125Z" fill="black" fill-opacity="0.27"/><path d="M85.2039 7.95898C85.6344 8.02999 85.8302 8.05339 86.0566 8.4514C86.001 9.22029 84.1752 12.6609 83.6966 13.3503C83.3598 13.243 83.0462 13.165 82.8828 12.8499C82.9218 12.3602 84.8546 8.6363 85.2039 7.95898Z" fill="black" fill-opacity="0.27"/><path d="M4.60573 28.124C5.68355 28.5288 7.58426 30.1288 8.58875 30.8184C9.27328 31.2883 8.41977 32.0435 7.99497 32.3571C7.51915 32.2865 4.09681 29.9137 3.82812 29.5119C3.91265 29.0899 4.3548 28.4789 4.60573 28.124Z" fill="black" fill-opacity="0.27"/><path d="M7.98434 36.271C8.49666 36.492 8.91085 37.0139 8.81645 37.5879C8.44822 38.0576 5.24886 39.4855 4.47715 39.8675C4.45956 39.8643 4.44197 39.8611 4.42439 39.8579C2.66619 38.7221 4.41559 37.9817 5.48835 37.4792C6.29399 37.1019 7.21445 36.707 7.98434 36.271Z" fill="black" fill-opacity="0.27"/><path d="M101.734 23.0845C104.741 23.3919 100.07 26.9117 99.3915 27.5579C98.7138 27.5239 98.0493 26.5915 98.7321 25.8791C99.681 24.889 100.714 24.0016 101.734 23.0845Z" fill="black" fill-opacity="0.27"/><path d="M100.128 30.9795C101.14 31.0998 104.729 31.2038 105.224 31.8678C105.326 32.3315 105.185 32.659 104.955 33.0484C104.842 33.0557 104.729 33.0601 104.616 33.0619C104.103 33.0695 100.259 32.7585 100.022 32.5299C99.7793 32.0177 99.9859 31.5306 100.128 30.9795Z" fill="black" fill-opacity="0.27"/></svg>`, Go = '<svg width="10" height="20" viewBox="0 0 10 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M2.38154 9.58986C2.30774 9.67252 2.30769 9.79882 2.38144 9.88154L9.50124 17.8683C9.85679 18.2672 9.82773 18.8842 9.43633 19.2465C9.04493 19.6088 8.43941 19.5792 8.08386 19.1804L0.248749 10.3912C-0.0831022 10.0189 -0.0828921 9.45059 0.249234 9.07859L8.06971 0.319091C8.42555 -0.0794786 9.03109 -0.108629 9.42222 0.253981C9.81335 0.616592 9.84196 1.23365 9.48612 1.63222L2.38154 9.58986Z" fill="black" fill-opacity="0.8"/></svg>', Ho = '<svg width="22" height="20" viewBox="0 0 22 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M11.2986 5.67284C11.2986 5.97893 11.085 6.24354 10.7859 6.30818L10.0168 6.47435C7.99248 6.91173 5.77167 7.9941 4.13622 9.86952C2.72423 11.4887 1.6758 13.7798 1.62674 16.9708C3.27106 14.4059 5.66007 12.278 9.31215 11.4448L10.504 11.1729C10.9109 11.0801 11.2986 11.3893 11.2986 11.8066V16.1091C11.2986 16.3883 11.6275 16.5376 11.8376 16.3537L19.9263 9.27602C20.0743 9.14654 20.0743 8.91633 19.9263 8.78684L11.8376 1.70921C11.6275 1.52534 11.2986 1.67456 11.2986 1.9538V5.67284ZM20.9964 7.56391C21.8843 8.34081 21.8843 9.72205 20.9964 10.499L12.9077 17.5766C11.6468 18.6799 9.67359 17.7845 9.67359 16.1091V13.0291C9.09667 13.1607 8.55598 13.3292 8.04859 13.5306C5.44688 14.5636 3.72051 16.465 2.47251 18.7261C1.84869 19.8563 0.131189 19.728 0.0429597 18.44C-0.547868 9.8153 5.07299 5.88002 9.67359 4.88601V1.9538C9.67359 0.278437 11.6468 -0.616962 12.9077 0.486268L20.9964 7.56391Z" fill="black" fill-opacity="0.8"/></svg>', Qo = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="var(--mas-chrome-circle, rgba(0,0,0,0.27))"/><path d="M14.082 15.8768C14.0252 15.9404 14.0251 16.0376 14.0819 16.1012L19.5586 22.2449C19.8321 22.5517 19.8098 23.0263 19.5087 23.305C19.2076 23.5837 18.7419 23.5609 18.4684 23.2541L12.4413 16.4932C12.1861 16.2069 12.1862 15.7697 12.4417 15.4835L18.4575 8.74545C18.7312 8.43886 19.197 8.41644 19.4979 8.69537C19.7987 8.9743 19.8207 9.44896 19.547 9.75555L14.082 15.8768Z" fill="var(--mas-chrome-fg, #fff)"/></svg>', zo = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="var(--mas-chrome-circle, rgba(0,0,0,0.27))"/><path d="M15.9534 13.3094C16.1845 13.2605 16.3499 13.0565 16.3499 12.8202V9.92041C16.3499 9.63317 16.689 9.48043 16.9041 9.67074L23.1371 15.1846C23.2871 15.3172 23.2871 15.5512 23.1371 15.6839L16.9041 21.1977C16.689 21.388 16.3499 21.2353 16.3499 20.948V17.4338C16.3499 17.1206 16.0652 16.8845 15.7574 16.9424L14.5725 17.1654C12.0387 17.6423 10.1764 19.018 8.75756 20.8225C8.83972 18.7314 9.57906 17.18 10.5879 16.0467C11.8143 14.6688 13.5183 13.8244 15.1603 13.4771L15.9534 13.3094ZM14.8499 20.948C14.8499 22.5279 16.7147 23.368 17.898 22.3212L24.131 16.8074C24.9558 16.0777 24.9558 14.7907 24.131 14.0611L17.898 8.54725C16.7147 7.5005 14.8499 8.34059 14.8499 9.92041V12.0096C11.0594 12.8112 6.80807 15.9291 7.28708 22.1643C7.3705 23.2502 8.78908 23.3974 9.39657 22.4935C10.4307 20.9549 11.6992 19.7501 13.3499 19.0781C13.8181 18.8876 14.3169 18.7399 14.8499 18.6395V20.948Z" fill="var(--mas-chrome-fg, #fff)"/></svg>', jo = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="var(--mas-chrome-circle, rgba(0,0,0,0.27))"/><path d="M11 16C11 16.6903 10.4403 17.25 9.75 17.25C9.05972 17.25 8.5 16.6903 8.5 16C8.5 15.3097 9.05972 14.75 9.75 14.75C10.4403 14.75 11 15.3097 11 16Z" fill="var(--mas-chrome-fg, #fff)"/><path d="M17.25 16C17.25 16.6903 16.6903 17.25 16 17.25C15.3097 17.25 14.75 16.6903 14.75 16C14.75 15.3097 15.3097 14.75 16 14.75C16.6903 14.75 17.25 15.3097 17.25 16Z" fill="var(--mas-chrome-fg, #fff)"/><path d="M22.2502 17.25C22.9406 17.25 23.5 16.6906 23.5 16.0002C23.5 15.3098 22.9406 14.75 22.2502 14.75C21.5598 14.75 21 15.3098 21 16.0002C21 16.6906 21.5598 17.25 22.2502 17.25Z" fill="var(--mas-chrome-fg, #fff)"/></svg>', Vn = '<svg width="18" height="13" viewBox="0 0 18 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.5713 2.46628C11.0584 2.46639 13.4504 3.38847 15.2529 5.04195C15.3887 5.1696 15.6056 5.16799 15.7393 5.03834L17.0368 3.77487C17.1045 3.70911 17.1422 3.62004 17.1417 3.52735C17.1411 3.43467 17.1023 3.34603 17.0338 3.28104C12.3028 -1.09368 4.83907 -1.09368 0.108056 3.28104C0.039524 3.34598 0.000639766 3.4346 7.82398e-06 3.52728C-0.000624118 3.61996 0.0370483 3.70906 0.104689 3.77487L1.40255 5.03834C1.53615 5.16819 1.75327 5.1698 1.88893 5.04195C3.69167 3.38836 6.08395 2.46628 8.5713 2.46628ZM8.56795 6.68656C9.92527 6.68647 11.2341 7.19821 12.2403 8.12234C12.3763 8.2535 12.5907 8.25065 12.7234 8.11593L14.0106 6.79663C14.0784 6.72742 14.1161 6.63355 14.1151 6.536C14.1141 6.43844 14.0746 6.34536 14.0054 6.27757C10.9416 3.38672 6.19688 3.38672 3.13305 6.27757C3.06384 6.34536 3.02435 6.43849 3.02345 6.53607C3.02254 6.63366 3.06028 6.72752 3.12822 6.79663L4.41513 8.11593C4.54778 8.25065 4.76215 8.2535 4.89823 8.12234C5.90368 7.19882 7.21152 6.68713 8.56795 6.68656ZM11.0924 9.48011C11.0943 9.58546 11.0572 9.68703 10.9899 9.76084L8.81327 12.2156C8.74946 12.2877 8.66247 12.3283 8.5717 12.3283C8.48093 12.3283 8.39394 12.2877 8.33013 12.2156L6.1531 9.76084C6.08585 9.68697 6.04886 9.58537 6.05085 9.48002C6.05284 9.37467 6.09365 9.27491 6.16364 9.20429C7.55374 7.8904 9.58966 7.8904 10.9798 9.20429C11.0497 9.27497 11.0904 9.37476 11.0924 9.48011Z" fill="currentColor"/></svg>', Ln = '<svg width="20" height="13" viewBox="0 0 20 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path fill-rule="evenodd" clip-rule="evenodd" d="M19.2 1.14623C19.2 0.513183 18.7224 0 18.1333 0H17.0667C16.4776 0 16 0.513183 16 1.14623V11.0802C16 11.7132 16.4776 12.2264 17.0667 12.2264H18.1333C18.7224 12.2264 19.2 11.7132 19.2 11.0802V1.14623ZM11.7659 2.44528H12.8326C13.4217 2.44528 13.8992 2.97078 13.8992 3.61902V11.0527C13.8992 11.7009 13.4217 12.2264 12.8326 12.2264H11.7659C11.1768 12.2264 10.6992 11.7009 10.6992 11.0527V3.61902C10.6992 2.97078 11.1768 2.44528 11.7659 2.44528ZM7.43411 5.09433H6.36745C5.77834 5.09433 5.30078 5.62652 5.30078 6.28301V11.0377C5.30078 11.6942 5.77834 12.2264 6.36745 12.2264H7.43411C8.02322 12.2264 8.50078 11.6942 8.50078 11.0377V6.28301C8.50078 5.62652 8.02322 5.09433 7.43411 5.09433ZM2.13333 7.53962H1.06667C0.477563 7.53962 0 8.06421 0 8.71132V11.0547C0 11.7018 0.477563 12.2264 1.06667 12.2264H2.13333C2.72244 12.2264 3.2 11.7018 3.2 11.0547V8.71132C3.2 8.06421 2.72244 7.53962 2.13333 7.53962Z" fill="currentColor"/></svg>', Wn = '<svg width="25" height="12" viewBox="0 0 25 12" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path opacity="0.35" d="M2.66699 0.5H19.333C20.5296 0.5 21.5 1.47038 21.5 2.66699V8.66699C21.4998 9.86346 20.5295 10.833 19.333 10.833H2.66699C1.47048 10.833 0.500176 9.86346 0.5 8.66699V2.66699L0.510742 2.44531C0.621596 1.35265 1.54509 0.5 2.66699 0.5Z" stroke="currentColor"/><path opacity="0.4" d="M23 3.6665V7.6665C23.8047 7.32773 24.328 6.53964 24.328 5.6665C24.328 4.79337 23.8047 4.00528 23 3.6665Z" fill="currentColor"/><path d="M2 3.33333C2 2.59695 2.59695 2 3.33333 2H18.6667C19.403 2 20 2.59695 20 3.33333V8C20 8.73638 19.403 9.33333 18.6667 9.33333H3.33333C2.59695 9.33333 2 8.73638 2 8V3.33333Z" fill="currentColor"/></svg>', Jo = '<svg width="7" height="12" viewBox="0 0 7 12" fill="none" aria-hidden="true"><path d="M6.28 0.72a1 1 0 0 1 0 1.41L2.41 6l3.87 3.87a1 1 0 1 1-1.41 1.41L0.29 6.71a1 1 0 0 1 0-1.42L4.87 0.72a1 1 0 0 1 1.41 0Z" fill="#fff"/></svg>', _o = '<svg width="7" height="12" viewBox="0 0 7 12" fill="none" aria-hidden="true"><path d="M0.72 0.72a1 1 0 0 1 1.41 0l4.58 4.57a1 1 0 0 1 0 1.42l-4.58 4.57a1 1 0 1 1-1.41-1.41L4.59 6 0.72 2.13a1 1 0 0 1 0-1.41Z" fill="#fff"/></svg>', $o = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18.84 12.25 1.72-1.71a4.5 4.5 0 0 0-6.36-6.37l-1.72 1.72"/><path d="m5.17 11.75-1.71 1.71a4.5 4.5 0 0 0 6.36 6.37l1.72-1.72"/><path d="M8 2v3"/><path d="M2 8h3"/><path d="M16 22v-3"/><path d="M22 16h-3"/></svg>', ea = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
5096
+ const et = "部署成功后可预览", br = { width: 108, height: 73 }, Qo = "0 0 108 73", zo = `<svg width="${br.width}" height="${br.height}" viewBox="${Qo}" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M17.5523 3.45177C18.5978 3.30869 19.8053 3.72588 20.8677 3.7213C21.8149 3.71724 22.8293 3.45062 23.7798 3.46838C24.9063 3.48928 26.1311 3.68172 27.2495 3.70861C28.7022 3.7437 30.1759 3.66674 31.6372 3.69005C32.8024 3.70856 33.9865 3.83116 35.1362 3.83068C36.2481 3.83018 37.37 3.76656 38.4898 3.77111C39.4154 3.77493 40.4597 3.84521 41.3687 3.81213C42.3573 3.77621 43.4742 3.5029 44.5005 3.52697C45.5079 3.55061 46.5849 3.79763 47.5767 3.82189C49.8156 3.87664 52.0926 3.95474 54.3316 3.98302C56.1946 4.00667 58.3675 4.19346 60.1821 4.16369C62.8754 4.11947 65.5892 4.16343 68.2603 3.91466C69.3377 3.81439 70.4866 3.40545 71.5425 3.43322C73.8561 3.49427 76.2024 3.63789 78.5152 3.74084C79.2352 3.77293 80.2913 3.51477 80.9624 3.53576C82.1221 3.52923 83.3832 3.79373 84.5337 3.75939C86.7485 3.69334 88.7812 3.32488 90.9976 3.73009C92.0457 3.92176 92.8627 3.89957 93.7036 4.76427C94.3225 5.4021 94.379 6.21544 94.4976 7.06505C94.7506 10.6378 94.6359 14.1942 94.6226 17.7643L94.6519 32.152L94.7495 59.9371C94.7678 62.0734 94.9897 64.2293 95.0445 66.3727C95.1133 69.062 94.1317 68.9939 91.8081 68.9283C90.8791 68.8513 89.7376 69.046 88.8609 69.0045C86.7448 68.905 84.7278 69.0412 82.6167 69.0006C82.0742 68.9899 81.2033 69.1142 80.5962 69.1324L61.4761 69.5797C58.4893 69.6344 55.2801 69.1116 52.2359 69.1813C50.1517 69.2286 47.9723 69.2703 45.8902 69.2711L22.107 69.1295C21.0981 69.132 15.3988 69.343 15.0015 69.1315C14.7505 68.9969 14.6279 68.5785 14.5581 68.319C13.8726 65.7643 14.0488 63.5686 14.0679 61.0113C14.0848 58.7396 14.0646 56.47 14.1079 54.1969C14.1289 53.0948 14.2333 51.9949 14.2398 50.8922C14.2483 49.4294 14.2518 47.9331 14.187 46.4733C14.1411 45.4376 14.0144 44.4002 14.0239 43.3629C14.0336 42.3208 14.2202 41.2864 14.2349 40.2447L14.5972 18.4889C14.6574 14.8432 14.4808 11.1457 14.4009 7.50158C14.3524 5.28478 15.3986 4.00203 17.5523 3.45177ZM84.0073 17.1998C82.749 17.2314 81.09 16.9222 79.8765 17.0826C76.5874 17.3246 73.4225 17.1627 70.1284 17.1178C68.165 17.091 66.2269 17.4293 64.2671 17.3844C62.7918 17.3389 61.3342 17.1485 59.856 17.1344C59.2263 17.1283 58.5859 17.1366 57.9566 17.1227C56.1444 17.0825 54.4092 17.5789 52.5904 17.4049C52.1524 17.363 51.6623 17.3924 51.2202 17.3776C49.906 17.4059 48.5865 17.5062 47.271 17.5113C45.9078 17.51 44.6386 17.4127 43.2544 17.4869C41.7822 17.5659 40.3445 17.9553 38.8882 17.9498C36.4908 17.9408 34.2416 17.6096 31.8169 17.6022C29.8747 17.5963 28.0332 17.478 26.0689 17.5611C24.8704 17.6118 23.1046 17.8972 22.0171 17.8727C20.0195 17.8273 18.3649 17.6053 16.3052 17.6403L15.9595 51.4498L15.8794 60.9996C15.8724 61.6237 15.6441 63.1346 15.6743 63.5045C15.7686 64.6585 15.8966 66.4726 16.0835 67.5817C20.4948 67.1686 24.8526 67.5326 29.2202 67.4762C32.8823 67.5508 36.5115 67.4397 40.1724 67.399C42.2531 67.375 44.3275 67.5204 46.4068 67.5387C48.1617 67.537 49.9517 67.39 51.7046 67.4108C56.327 67.4605 60.9098 68.0708 65.5337 67.6354C67.0758 67.4894 68.7005 67.6431 70.2368 67.5377C75.6428 67.1636 81.0467 67.4588 86.4585 67.2281C87.1114 67.2008 88.1957 67.3791 88.7896 67.2945C90.2271 67.0898 91.9084 67.334 93.272 67.2203C93.4014 65.0489 93.2341 62.81 93.0864 60.6393C92.8774 57.5856 93.11 54.7471 93.232 51.7272C93.3647 48.4517 92.9765 45.0516 92.9624 41.7731C92.9118 39.9941 93.0414 38.2658 93.0405 36.5104L93.0269 22.1627C93.0318 20.5252 92.8554 18.7787 92.8628 17.1569C89.9139 17.147 86.9546 17.1257 84.0073 17.1998Z" fill="black" fill-opacity="0.27"/><path d="M55.7374 34.6264C56.0667 33.3883 56.4399 32.1743 57.1424 31.0846C59.0982 28.0509 63.693 27.0695 66.6626 29.0925C69.6157 31.1041 69.8106 37.0884 67.8505 39.8061C66.6999 41.4007 65.0737 42.1102 63.1871 42.4203C59.0197 42.9598 56.3897 40.9103 55.8006 36.7491C54.8942 40.2303 53.3291 42.0919 49.5536 42.4714C45.8729 42.8038 42.9989 40.6755 42.6806 36.9371C42.3144 32.6345 44.4633 28.3858 49.1883 28.0315C49.5812 28.037 49.974 28.0476 50.3667 28.0631C54.0562 28.2301 55.9159 31.1557 55.7374 34.6264Z" fill="black" fill-opacity="0.27"/><path d="M49.1181 29.8535C49.7972 29.7381 50.8544 29.935 51.5613 30.0387C50.3064 30.4438 49.3408 30.5925 48.6341 31.8607C47.2869 34.2788 49.5375 36.9511 52.131 36.1644C53.2004 35.84 53.7314 34.8441 54.173 33.8922C54.0454 35.5683 54.1036 37.292 53.1069 38.7373C52.2783 39.869 50.6033 40.539 49.225 40.6162C42.532 40.9917 43.1611 30.4267 49.1181 29.8535Z" fill="white"/><path d="M62.2667 29.8477C63.0255 29.7846 64.1183 29.962 64.8955 30.0617C63.6767 30.3828 62.4958 30.6606 61.8547 31.8518C60.4455 34.4701 62.7362 36.9987 65.5032 36.2126C66.3576 35.97 66.8446 35.3888 67.2353 34.6371C67.2743 36.3893 67.1042 37.7957 65.9562 39.1968C64.3878 40.6345 60.98 41.23 59.3232 39.7737C55.9556 36.8137 57.6824 30.4498 62.2667 29.8477Z" fill="white"/><path d="M26.3445 19.6176L27.4116 19.6147C27.4004 21.4551 27.5046 23.3326 27.5406 25.1748C27.5951 28.3785 27.6092 31.583 27.5828 34.7871C27.5573 37.5929 27.3885 40.4084 27.3733 43.221C27.4175 44.2992 27.0986 45.6969 27.1691 46.7384C27.37 49.7061 27.4811 52.535 27.2498 55.5165C27.1589 56.6883 27.4267 58.2028 27.3909 59.3505C27.3605 60.323 27.3692 64.1261 26.8121 64.7153C26.5166 64.6715 26.2179 64.5882 26.0247 64.3542C25.8581 63.7958 26.215 60.9323 26.2237 60.0705C26.2382 58.617 26.0204 57.1732 26.0166 55.7661C25.9878 54.3433 26.2722 52.8298 26.2513 51.4204C26.2195 49.2771 25.8748 47.5358 26.015 45.3595C26.2705 40.5662 26.4689 35.7243 26.452 30.9236C26.4441 28.6779 26.2885 26.351 26.3653 24.0866C26.4135 22.6659 26.1621 21.0264 26.3445 19.6176Z" fill="black" fill-opacity="0.27"/><path d="M20.1269 51.5022C20.875 51.4543 22.7525 51.1751 23.1363 51.8769C23.1823 52.1445 23.1747 52.1767 23.0779 52.4312C22.8071 52.6057 22.7893 52.5516 22.4257 52.5717C21.6024 52.6245 19.5517 52.8771 19.1016 52.1431C19.102 51.9275 19.1448 51.8966 19.2698 51.707C19.5299 51.5136 19.7931 51.5311 20.1269 51.5022Z" fill="black" fill-opacity="0.27"/><path d="M19.8632 21.4886C20.7111 21.4493 22.5399 21.2168 23.1352 21.716C23.2803 21.9633 23.2692 22.0075 23.2295 22.2951C23.0507 22.5511 23.099 22.4762 22.7473 22.591C21.9574 22.5893 19.9137 22.8484 19.4079 22.3056C19.3135 22.0476 19.3315 22.0057 19.4084 21.7384C19.6097 21.5134 19.5174 21.587 19.8632 21.4886Z" fill="black" fill-opacity="0.27"/><path d="M21.5103 45.2112C21.9089 45.1874 22.5931 45.0957 22.9294 45.2482C23.1338 45.4886 23.2289 46.0708 23.0368 46.1847C22.639 46.4204 21.4558 46.3333 20.968 46.3281C20.2785 46.3484 19.3703 46.5827 19.1797 45.7866C19.3998 45.0041 20.8056 45.2148 21.5103 45.2112Z" fill="black" fill-opacity="0.27"/><path d="M19.6605 57.8873C20.2986 57.8662 22.5425 57.7338 23.0242 57.9146C23.1377 58.1465 23.1557 58.571 23.0397 58.8135C22.9924 58.9124 22.8259 58.9105 22.7101 58.9336C21.8965 58.9291 19.7416 59.1798 19.209 58.6524C19.0985 58.352 19.1131 58.4814 19.1613 58.1587C19.3797 57.9228 19.2924 58.0003 19.6605 57.8873Z" fill="black" fill-opacity="0.27"/><path d="M19.8318 27.0236C20.6418 27.0088 22.849 26.7599 23.2824 27.3852C23.2991 27.7917 23.1603 27.8987 22.8367 28.0499C22.0813 28.1747 19.9938 28.4117 19.442 27.8633C19.3212 27.6107 19.3267 27.5749 19.379 27.298C19.576 27.0689 19.5141 27.1399 19.8318 27.0236Z" fill="black" fill-opacity="0.27"/><path d="M19.5103 38.6328C20.3818 38.5977 22.2948 38.4602 23.0374 38.7355C23.3443 39.0578 23.2308 39.3339 22.9823 39.6834C21.9447 39.6989 20.7656 39.7845 19.7369 39.6178C19.3747 39.5592 19.2748 39.4001 19.2227 39.0752C19.3043 38.8331 19.3243 38.8089 19.5103 38.6328Z" fill="black" fill-opacity="0.27"/><path d="M19.4441 32.7511C20.2259 32.7059 22.7452 32.4643 23.22 33.0422C23.2626 33.324 23.2059 33.4152 23.0992 33.6765C22.5657 33.8516 20.4179 33.91 19.8238 33.7636C19.5144 33.6873 19.4752 33.5963 19.3428 33.3683C19.3126 33.0655 19.3211 33.0302 19.4441 32.7511Z" fill="black" fill-opacity="0.27"/><path d="M17.9375 5.19426C19.0035 5.18057 19.8439 5.51612 20.8324 5.51437C21.8845 5.51247 22.9572 5.18895 24.0571 5.23159C25.3236 5.28061 26.5655 5.39666 27.829 5.47398C29.7132 5.44876 31.4461 5.35601 33.3318 5.49529C35.9003 5.68509 38.5198 5.39384 41.1053 5.57418C42.1021 5.6437 43.3577 5.26958 44.3736 5.30135C48.4763 5.66651 52.5325 5.71628 56.6557 5.83864C60.7142 5.95917 65.0095 6.19003 69.0404 5.61433C69.8948 5.49222 70.8554 5.21607 71.7057 5.21748C73.9529 5.22113 76.1951 5.33337 78.434 5.5079C79.1748 5.55386 80.2076 5.29289 80.9226 5.33843C83.5398 5.505 86.011 5.50176 88.6249 5.24469C89.2213 5.18613 91.8377 5.45838 92.2242 5.86311C92.8953 6.56548 92.8464 8.85259 92.8746 9.83235C92.9426 11.7353 92.9559 13.6399 92.9161 15.5437L91.4859 15.5528C90.4275 15.5788 89.0712 15.419 87.972 15.3943C86.6547 15.3646 85.403 15.505 84.1122 15.4998C82.9616 15.4953 81.7265 15.3339 80.5452 15.3247C79.5166 15.3167 78.2233 15.5727 77.2511 15.5575C74.8073 15.5193 72.3311 15.3913 69.8865 15.378C68.1536 15.3684 66.3593 15.6691 64.6221 15.6522C62.4737 15.6313 60.3791 15.402 58.2226 15.3801C56.6504 15.3641 55.345 15.6268 53.8054 15.6947C52.949 15.7324 52.0307 15.6119 51.1814 15.6647C48.4764 15.8326 45.7948 15.7373 43.091 15.7663C41.7022 15.7811 40.1085 16.2506 38.7735 16.2141C35.625 16.0503 32.512 15.9138 29.3574 15.8182C26.8796 15.7432 24.6994 16.0095 22.2825 16.0759C20.3479 16.1292 18.2916 15.9415 16.302 15.9671C16.3022 14.0656 16.2797 12.1641 16.2345 10.2631C16.2125 9.30485 16.1176 8.32011 16.1659 7.36739C16.2359 5.98588 16.6968 5.56439 17.9375 5.19426Z" fill="white"/><path d="M21.4551 8.37897C22.7406 8.12829 23.9876 8.96189 24.2474 10.2456C24.5071 11.5294 23.6824 12.7822 22.4005 13.0511C21.1057 13.3226 19.8376 12.4877 19.5752 11.1911C19.3128 9.89445 20.1566 8.63223 21.4551 8.37897Z" fill="black" fill-opacity="0.27"/><path d="M21.3133 9.5824C22.0079 9.53404 22.5757 9.4934 22.9771 10.1973C23.1132 10.4306 23.1465 10.7098 23.0693 10.9686C22.935 11.4263 22.7202 11.6472 22.3159 11.8612L22.2383 11.8719C20.6043 12.0898 20.2753 10.6113 21.3133 9.5824Z" fill="white"/><path d="M34.3344 8.43169C36.5428 8.40033 37.7 9.74675 36.7659 12.0393C36.5415 12.5902 35.8517 12.9222 35.2821 13.0585C34.577 13.0934 34.2485 13.1509 33.6265 12.7913C31.8975 11.7915 32.3767 8.78855 34.3344 8.43169Z" fill="black" fill-opacity="0.27"/><path d="M34.2632 9.67081C35.6934 9.56314 35.8442 9.80976 35.9445 11.1688C35.7088 11.5184 35.6685 11.5974 35.3228 11.8352C33.6563 12.151 33.2269 10.7561 34.2632 9.67081Z" fill="white"/><path d="M27.6458 8.60775C28.4397 8.37921 29.2951 8.59464 29.8861 9.17192C30.4771 9.74911 30.7125 10.5993 30.5027 11.3983C30.2928 12.1973 29.67 12.8221 28.8717 13.0345C28.2459 13.201 27.5788 13.0955 27.0349 12.7441C26.2785 12.2556 25.8775 11.3701 26.0091 10.4793C26.1406 9.58859 26.7806 8.85686 27.6458 8.60775Z" fill="black" fill-opacity="0.27"/><path d="M27.9803 9.72255C28.5705 9.56602 29.1782 9.90712 29.352 10.4925C29.5259 11.0778 29.2027 11.6954 28.6227 11.8863C28.2321 12.0149 27.8024 11.9209 27.5011 11.6408C27.1999 11.3609 27.0746 10.9392 27.1743 10.5402C27.274 10.1412 27.5828 9.82798 27.9803 9.72255Z" fill="white"/><path d="M81.4858 8.49414C81.8483 8.60721 82.0374 9.00936 82.2348 9.32683C81.5588 9.86992 80.677 10.399 79.9387 10.866C80.6446 11.3705 82.8495 12.0949 81.3746 13.0558C80.7599 12.8096 79.2303 11.9336 78.8761 11.4271C78.0474 10.2411 80.6413 9.00729 81.4858 8.49414Z" fill="black" fill-opacity="0.27"/><path d="M87.389 8.3125C87.866 8.35547 88.0012 8.48604 88.4011 8.70918C91.8635 10.6419 89.8843 11.408 87.7565 12.861C87.5242 12.9687 87.6213 12.9452 87.3467 12.9073C87.0846 12.7284 86.9751 12.4694 86.8125 12.1868C87.5715 11.6023 88.3007 11.0312 89.097 10.4957C88.7354 10.297 88.3762 10.0958 88.0178 9.8921C87.6238 9.66688 87.2414 9.42773 87.1145 8.96626C87.1352 8.65344 87.2181 8.56584 87.389 8.3125Z" fill="black" fill-opacity="0.27"/><path d="M85.2039 7.95898C85.6344 8.02999 85.8302 8.05339 86.0566 8.4514C86.001 9.22029 84.1752 12.6609 83.6966 13.3503C83.3598 13.243 83.0462 13.165 82.8828 12.8499C82.9218 12.3602 84.8546 8.6363 85.2039 7.95898Z" fill="black" fill-opacity="0.27"/><path d="M4.60573 28.124C5.68355 28.5288 7.58426 30.1288 8.58875 30.8184C9.27328 31.2883 8.41977 32.0435 7.99497 32.3571C7.51915 32.2865 4.09681 29.9137 3.82812 29.5119C3.91265 29.0899 4.3548 28.4789 4.60573 28.124Z" fill="black" fill-opacity="0.27"/><path d="M7.98434 36.271C8.49666 36.492 8.91085 37.0139 8.81645 37.5879C8.44822 38.0576 5.24886 39.4855 4.47715 39.8675C4.45956 39.8643 4.44197 39.8611 4.42439 39.8579C2.66619 38.7221 4.41559 37.9817 5.48835 37.4792C6.29399 37.1019 7.21445 36.707 7.98434 36.271Z" fill="black" fill-opacity="0.27"/><path d="M101.734 23.0845C104.741 23.3919 100.07 26.9117 99.3915 27.5579C98.7138 27.5239 98.0493 26.5915 98.7321 25.8791C99.681 24.889 100.714 24.0016 101.734 23.0845Z" fill="black" fill-opacity="0.27"/><path d="M100.128 30.9795C101.14 31.0998 104.729 31.2038 105.224 31.8678C105.326 32.3315 105.185 32.659 104.955 33.0484C104.842 33.0557 104.729 33.0601 104.616 33.0619C104.103 33.0695 100.259 32.7585 100.022 32.5299C99.7793 32.0177 99.9859 31.5306 100.128 30.9795Z" fill="black" fill-opacity="0.27"/></svg>`, Jo = '<svg width="10" height="20" viewBox="0 0 10 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M2.38154 9.58986C2.30774 9.67252 2.30769 9.79882 2.38144 9.88154L9.50124 17.8683C9.85679 18.2672 9.82773 18.8842 9.43633 19.2465C9.04493 19.6088 8.43941 19.5792 8.08386 19.1804L0.248749 10.3912C-0.0831022 10.0189 -0.0828921 9.45059 0.249234 9.07859L8.06971 0.319091C8.42555 -0.0794786 9.03109 -0.108629 9.42222 0.253981C9.81335 0.616592 9.84196 1.23365 9.48612 1.63222L2.38154 9.58986Z" fill="black" fill-opacity="0.8"/></svg>', jo = '<svg width="22" height="20" viewBox="0 0 22 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M11.2986 5.67284C11.2986 5.97893 11.085 6.24354 10.7859 6.30818L10.0168 6.47435C7.99248 6.91173 5.77167 7.9941 4.13622 9.86952C2.72423 11.4887 1.6758 13.7798 1.62674 16.9708C3.27106 14.4059 5.66007 12.278 9.31215 11.4448L10.504 11.1729C10.9109 11.0801 11.2986 11.3893 11.2986 11.8066V16.1091C11.2986 16.3883 11.6275 16.5376 11.8376 16.3537L19.9263 9.27602C20.0743 9.14654 20.0743 8.91633 19.9263 8.78684L11.8376 1.70921C11.6275 1.52534 11.2986 1.67456 11.2986 1.9538V5.67284ZM20.9964 7.56391C21.8843 8.34081 21.8843 9.72205 20.9964 10.499L12.9077 17.5766C11.6468 18.6799 9.67359 17.7845 9.67359 16.1091V13.0291C9.09667 13.1607 8.55598 13.3292 8.04859 13.5306C5.44688 14.5636 3.72051 16.465 2.47251 18.7261C1.84869 19.8563 0.131189 19.728 0.0429597 18.44C-0.547868 9.8153 5.07299 5.88002 9.67359 4.88601V1.9538C9.67359 0.278437 11.6468 -0.616962 12.9077 0.486268L20.9964 7.56391Z" fill="black" fill-opacity="0.8"/></svg>', _o = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="var(--mas-chrome-circle, rgba(0,0,0,0.27))"/><path d="M14.082 15.8768C14.0252 15.9404 14.0251 16.0376 14.0819 16.1012L19.5586 22.2449C19.8321 22.5517 19.8098 23.0263 19.5087 23.305C19.2076 23.5837 18.7419 23.5609 18.4684 23.2541L12.4413 16.4932C12.1861 16.2069 12.1862 15.7697 12.4417 15.4835L18.4575 8.74545C18.7312 8.43886 19.197 8.41644 19.4979 8.69537C19.7987 8.9743 19.8207 9.44896 19.547 9.75555L14.082 15.8768Z" fill="var(--mas-chrome-fg, #fff)"/></svg>', $o = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="var(--mas-chrome-circle, rgba(0,0,0,0.27))"/><path d="M15.9534 13.3094C16.1845 13.2605 16.3499 13.0565 16.3499 12.8202V9.92041C16.3499 9.63317 16.689 9.48043 16.9041 9.67074L23.1371 15.1846C23.2871 15.3172 23.2871 15.5512 23.1371 15.6839L16.9041 21.1977C16.689 21.388 16.3499 21.2353 16.3499 20.948V17.4338C16.3499 17.1206 16.0652 16.8845 15.7574 16.9424L14.5725 17.1654C12.0387 17.6423 10.1764 19.018 8.75756 20.8225C8.83972 18.7314 9.57906 17.18 10.5879 16.0467C11.8143 14.6688 13.5183 13.8244 15.1603 13.4771L15.9534 13.3094ZM14.8499 20.948C14.8499 22.5279 16.7147 23.368 17.898 22.3212L24.131 16.8074C24.9558 16.0777 24.9558 14.7907 24.131 14.0611L17.898 8.54725C16.7147 7.5005 14.8499 8.34059 14.8499 9.92041V12.0096C11.0594 12.8112 6.80807 15.9291 7.28708 22.1643C7.3705 23.2502 8.78908 23.3974 9.39657 22.4935C10.4307 20.9549 11.6992 19.7501 13.3499 19.0781C13.8181 18.8876 14.3169 18.7399 14.8499 18.6395V20.948Z" fill="var(--mas-chrome-fg, #fff)"/></svg>', ea = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="var(--mas-chrome-circle, rgba(0,0,0,0.27))"/><path d="M11 16C11 16.6903 10.4403 17.25 9.75 17.25C9.05972 17.25 8.5 16.6903 8.5 16C8.5 15.3097 9.05972 14.75 9.75 14.75C10.4403 14.75 11 15.3097 11 16Z" fill="var(--mas-chrome-fg, #fff)"/><path d="M17.25 16C17.25 16.6903 16.6903 17.25 16 17.25C15.3097 17.25 14.75 16.6903 14.75 16C14.75 15.3097 15.3097 14.75 16 14.75C16.6903 14.75 17.25 15.3097 17.25 16Z" fill="var(--mas-chrome-fg, #fff)"/><path d="M22.2502 17.25C22.9406 17.25 23.5 16.6906 23.5 16.0002C23.5 15.3098 22.9406 14.75 22.2502 14.75C21.5598 14.75 21 15.3098 21 16.0002C21 16.6906 21.5598 17.25 22.2502 17.25Z" fill="var(--mas-chrome-fg, #fff)"/></svg>', Vn = '<svg width="18" height="13" viewBox="0 0 18 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.5713 2.46628C11.0584 2.46639 13.4504 3.38847 15.2529 5.04195C15.3887 5.1696 15.6056 5.16799 15.7393 5.03834L17.0368 3.77487C17.1045 3.70911 17.1422 3.62004 17.1417 3.52735C17.1411 3.43467 17.1023 3.34603 17.0338 3.28104C12.3028 -1.09368 4.83907 -1.09368 0.108056 3.28104C0.039524 3.34598 0.000639766 3.4346 7.82398e-06 3.52728C-0.000624118 3.61996 0.0370483 3.70906 0.104689 3.77487L1.40255 5.03834C1.53615 5.16819 1.75327 5.1698 1.88893 5.04195C3.69167 3.38836 6.08395 2.46628 8.5713 2.46628ZM8.56795 6.68656C9.92527 6.68647 11.2341 7.19821 12.2403 8.12234C12.3763 8.2535 12.5907 8.25065 12.7234 8.11593L14.0106 6.79663C14.0784 6.72742 14.1161 6.63355 14.1151 6.536C14.1141 6.43844 14.0746 6.34536 14.0054 6.27757C10.9416 3.38672 6.19688 3.38672 3.13305 6.27757C3.06384 6.34536 3.02435 6.43849 3.02345 6.53607C3.02254 6.63366 3.06028 6.72752 3.12822 6.79663L4.41513 8.11593C4.54778 8.25065 4.76215 8.2535 4.89823 8.12234C5.90368 7.19882 7.21152 6.68713 8.56795 6.68656ZM11.0924 9.48011C11.0943 9.58546 11.0572 9.68703 10.9899 9.76084L8.81327 12.2156C8.74946 12.2877 8.66247 12.3283 8.5717 12.3283C8.48093 12.3283 8.39394 12.2877 8.33013 12.2156L6.1531 9.76084C6.08585 9.68697 6.04886 9.58537 6.05085 9.48002C6.05284 9.37467 6.09365 9.27491 6.16364 9.20429C7.55374 7.8904 9.58966 7.8904 10.9798 9.20429C11.0497 9.27497 11.0904 9.37476 11.0924 9.48011Z" fill="currentColor"/></svg>', In = '<svg width="20" height="13" viewBox="0 0 20 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path fill-rule="evenodd" clip-rule="evenodd" d="M19.2 1.14623C19.2 0.513183 18.7224 0 18.1333 0H17.0667C16.4776 0 16 0.513183 16 1.14623V11.0802C16 11.7132 16.4776 12.2264 17.0667 12.2264H18.1333C18.7224 12.2264 19.2 11.7132 19.2 11.0802V1.14623ZM11.7659 2.44528H12.8326C13.4217 2.44528 13.8992 2.97078 13.8992 3.61902V11.0527C13.8992 11.7009 13.4217 12.2264 12.8326 12.2264H11.7659C11.1768 12.2264 10.6992 11.7009 10.6992 11.0527V3.61902C10.6992 2.97078 11.1768 2.44528 11.7659 2.44528ZM7.43411 5.09433H6.36745C5.77834 5.09433 5.30078 5.62652 5.30078 6.28301V11.0377C5.30078 11.6942 5.77834 12.2264 6.36745 12.2264H7.43411C8.02322 12.2264 8.50078 11.6942 8.50078 11.0377V6.28301C8.50078 5.62652 8.02322 5.09433 7.43411 5.09433ZM2.13333 7.53962H1.06667C0.477563 7.53962 0 8.06421 0 8.71132V11.0547C0 11.7018 0.477563 12.2264 1.06667 12.2264H2.13333C2.72244 12.2264 3.2 11.7018 3.2 11.0547V8.71132C3.2 8.06421 2.72244 7.53962 2.13333 7.53962Z" fill="currentColor"/></svg>', Ln = '<svg width="25" height="12" viewBox="0 0 25 12" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path opacity="0.35" d="M2.66699 0.5H19.333C20.5296 0.5 21.5 1.47038 21.5 2.66699V8.66699C21.4998 9.86346 20.5295 10.833 19.333 10.833H2.66699C1.47048 10.833 0.500176 9.86346 0.5 8.66699V2.66699L0.510742 2.44531C0.621596 1.35265 1.54509 0.5 2.66699 0.5Z" stroke="currentColor"/><path opacity="0.4" d="M23 3.6665V7.6665C23.8047 7.32773 24.328 6.53964 24.328 5.6665C24.328 4.79337 23.8047 4.00528 23 3.6665Z" fill="currentColor"/><path d="M2 3.33333C2 2.59695 2.59695 2 3.33333 2H18.6667C19.403 2 20 2.59695 20 3.33333V8C20 8.73638 19.403 9.33333 18.6667 9.33333H3.33333C2.59695 9.33333 2 8.73638 2 8V3.33333Z" fill="currentColor"/></svg>', ta = '<svg width="7" height="12" viewBox="0 0 7 12" fill="none" aria-hidden="true"><path d="M6.28 0.72a1 1 0 0 1 0 1.41L2.41 6l3.87 3.87a1 1 0 1 1-1.41 1.41L0.29 6.71a1 1 0 0 1 0-1.42L4.87 0.72a1 1 0 0 1 1.41 0Z" fill="#fff"/></svg>', ra = '<svg width="7" height="12" viewBox="0 0 7 12" fill="none" aria-hidden="true"><path d="M0.72 0.72a1 1 0 0 1 1.41 0l4.58 4.57a1 1 0 0 1 0 1.42l-4.58 4.57a1 1 0 1 1-1.41-1.41L4.59 6 0.72 2.13a1 1 0 0 1 0-1.41Z" fill="#fff"/></svg>', na = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18.84 12.25 1.72-1.71a4.5 4.5 0 0 0-6.36-6.37l-1.72 1.72"/><path d="m5.17 11.75-1.71 1.71a4.5 4.5 0 0 0 6.36 6.37l1.72-1.72"/><path d="M8 2v3"/><path d="M2 8h3"/><path d="M16 22v-3"/><path d="M22 16h-3"/></svg>', sa = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
5074
5097
  <path d="M5.12701 6.16137L5.12684 6.16153C3.19177 8.07231 3.18948 11.1684 5.12171 13.0829C5.12195 13.0831 5.12219 13.0833 5.12243 13.0836L12.5956 20.4651L20.0639 13.0896C20.0642 13.0893 20.0645 13.089 20.0648 13.0887C22.003 11.1683 22.0001 8.07222 20.0655 6.16137C19.1221 5.22951 17.8626 4.72335 16.5498 4.72335C15.4589 4.72335 14.4068 5.07235 13.5423 5.72249L12.5963 6.43401L11.65 5.72281C10.7846 5.07238 9.73221 4.72335 8.64208 4.72335C7.32916 4.72335 6.07077 5.22917 5.12701 6.16137ZM21.1718 14.2083L13.6959 21.5913C13.0874 22.1923 12.1054 22.1923 11.4953 21.5913L4.01453 14.2022C1.45912 11.6714 1.46146 7.56825 4.02061 5.04124C5.26382 3.81327 6.92169 3.14893 8.64208 3.14893C10.0698 3.14893 11.4549 3.60663 12.596 4.46423C13.7364 3.60647 15.1215 3.14893 16.5498 3.14893C18.2699 3.14893 19.9289 3.81349 21.1719 5.04124C23.7315 7.56948 23.7322 11.6725 21.1718 14.2083Z" fill="black" fill-opacity="0.8"/>
5075
- </svg>`, ta = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
5098
+ </svg>`, ia = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
5076
5099
  <path d="M17.1378 22.407C17.7597 22.6785 18.4794 22.6002 19.0279 22.2013C19.5764 21.8025 19.8711 21.1433 19.8017 20.4701L19.3275 15.8682C19.3123 15.7204 19.3604 15.5731 19.4599 15.4629L22.6026 11.9787C23.0578 11.4742 23.2088 10.7662 22.9991 10.1206C22.7893 9.47513 22.2505 8.98986 21.585 8.84711L16.9624 7.85554C16.8187 7.82473 16.6946 7.73508 16.6201 7.60842L14.2422 3.5644C13.8997 2.98191 13.2731 2.62402 12.5958 2.62402C11.9185 2.62402 11.2919 2.98191 10.9494 3.5644L8.57151 7.60841C8.49703 7.73508 8.37286 7.82473 8.22918 7.85554L3.60656 8.84711C2.94108 8.98986 2.40227 9.47513 2.19251 10.1206C1.98275 10.7662 2.13381 11.4742 2.58894 11.9787L5.73172 15.4629C5.8312 15.5731 5.87929 15.7204 5.86407 15.8682L5.38986 20.4701C5.32049 21.1433 5.61514 21.8025 6.16364 22.2013C6.71214 22.6002 7.43189 22.6785 8.05379 22.407L12.3858 20.516C12.5197 20.4576 12.6719 20.4576 12.8057 20.516L17.1378 22.407ZM3.75802 10.9242C3.67946 10.8371 3.65435 10.7165 3.68987 10.6072C3.72553 10.4975 3.81835 10.4119 3.93677 10.3865L8.55939 9.39495C9.13409 9.27168 9.63078 8.91311 9.92871 8.40644L12.3066 4.36243C12.3654 4.26238 12.4748 4.19845 12.5958 4.19845C12.7168 4.19845 12.8262 4.26238 12.885 4.36242L15.2629 8.40644C15.5608 8.91312 16.0575 9.27168 16.6322 9.39495L21.2548 10.3865C21.3732 10.4119 21.4661 10.4975 21.5017 10.6072C21.5372 10.7165 21.5121 10.8371 21.4336 10.9242L18.2908 14.4083C17.8929 14.8495 17.7005 15.4386 17.7614 16.0296L18.2356 20.6315C18.2473 20.7451 18.1979 20.8583 18.1021 20.9279C18.0057 20.998 17.878 21.0122 17.7677 20.9641L13.4356 19.0731C12.9001 18.8393 12.2915 18.8393 11.756 19.0731L7.42393 20.9641C7.31359 21.0122 7.1859 20.998 7.08952 20.9279C6.99372 20.8583 6.94429 20.7451 6.956 20.6315L7.4302 16.0295C7.4911 15.4386 7.29874 14.8495 6.9008 14.4083L3.75802 10.9242Z" fill="black" fill-opacity="0.8"/>
5077
5100
  </svg>
5078
- `, ra = `<svg width="62" height="30" viewBox="0 0 62 30" fill="none" xmlns="http://www.w3.org/2000/svg">
5101
+ `, oa = `<svg width="62" height="30" viewBox="0 0 62 30" fill="none" xmlns="http://www.w3.org/2000/svg">
5079
5102
  <path d="M5.96703 20.5975C6.29588 21.1269 6.38174 21.784 6.1787 22.3932L5.17491 25.4045C5.52307 25.3376 5.9134 25.2638 6.31068 25.191C6.88797 25.0851 7.49114 24.9791 8.00558 24.899C8.45957 24.8282 9.00755 24.75 9.375 24.75C9.90779 24.75 10.511 24.9129 10.9 25.018L11.0003 25.045C11.9316 25.2933 13.1806 25.625 15 25.625C20.8423 25.625 25.625 20.8652 25.625 15C25.625 9.13197 20.868 4.375 15 4.375C9.13197 4.375 4.375 9.13197 4.375 15C4.375 17.0576 4.95803 18.9733 5.96703 20.5975ZM4.20912 27.4998C3.36929 27.4835 2.78128 26.6562 3.04843 25.8547L4.39992 21.8002C4.42369 21.7289 4.414 21.6508 4.37434 21.587C3.18616 19.6743 2.5 17.4173 2.5 15C2.5 8.09644 8.09644 2.5 15 2.5C21.9036 2.5 27.5 8.09644 27.5 15C27.5 21.9036 21.875 27.5 15 27.5C12.9295 27.5 11.4892 27.1159 10.5171 26.8567C10.0221 26.7246 9.64851 26.625 9.375 26.625C8.59818 26.625 4.58859 27.4287 4.25621 27.4956C4.23991 27.4989 4.22575 27.5001 4.20912 27.4998ZM20.8124 15.3125C20.8124 14.4496 20.1128 13.75 19.2499 13.75C18.3869 13.75 17.6874 14.4496 17.6874 15.3125C17.6874 16.1754 18.3869 16.875 19.2499 16.875C20.1128 16.875 20.8124 16.1754 20.8124 15.3125ZM10.7501 16.875C9.88718 16.875 9.18762 16.1754 9.18762 15.3125C9.18762 14.4496 9.88718 13.75 10.7501 13.75C11.6131 13.75 12.3126 14.4496 12.3126 15.3125C12.3126 16.1754 11.6131 16.875 10.7501 16.875Z" fill="black" fill-opacity="0.8"/>
5080
5103
  <path d="M39.404 9.08H47.076V10.326H43.87V15.31H47.496V16.57H43.87V21.442H42.582V16.57H39.012V15.31H42.582V10.326H39.404V9.08ZM45.62 10.872L46.782 11.18C46.502 12.524 46.138 13.7 45.69 14.708L44.57 14.316C44.962 13.406 45.312 12.258 45.62 10.872ZM40.692 10.928C41.084 11.95 41.42 13.126 41.728 14.456L40.594 14.736C40.328 13.532 39.978 12.384 39.558 11.292L40.692 10.928ZM36.422 8.632C37.332 9.318 38.102 10.004 38.732 10.704L37.822 11.628C37.262 10.97 36.492 10.27 35.498 9.542L36.422 8.632ZM34.532 12.692H37.766V18.586C38.144 18.236 38.55 17.844 38.984 17.424L39.348 18.824C38.508 19.65 37.598 20.392 36.646 21.036L36.142 19.832C36.366 19.636 36.492 19.398 36.492 19.118V13.966H34.532V12.692ZM56.4 8.506H57.59C58.374 10.2 59.718 11.684 61.636 12.972L60.908 14.092C59.144 12.916 57.842 11.46 57.002 9.752C55.98 11.67 54.706 13.154 53.166 14.19L52.438 13.07C54.146 11.894 55.476 10.382 56.4 8.506ZM59.032 21.204H55.966C54.902 21.204 54.384 20.63 54.384 19.496V13.518H55.7V15.814C56.988 15.324 58.234 14.652 59.424 13.784L60.18 14.848C58.612 15.842 57.114 16.598 55.7 17.13V19.23C55.7 19.706 55.924 19.958 56.372 19.958H58.794C59.158 19.958 59.41 19.846 59.578 19.65C59.802 19.426 59.942 18.768 59.998 17.648L61.244 18.054C61.118 19.58 60.88 20.49 60.516 20.784C60.194 21.064 59.704 21.204 59.032 21.204ZM50.352 8.632C51.262 9.318 52.032 10.004 52.662 10.704L51.752 11.628C51.192 10.97 50.422 10.27 49.428 9.542L50.352 8.632ZM48.546 12.692H51.71V18.656C52.144 18.278 52.606 17.844 53.11 17.368L53.446 18.698C52.55 19.566 51.584 20.336 50.562 21.036L50.058 19.846C50.296 19.65 50.422 19.398 50.422 19.118V13.966H48.546V12.692Z" fill="black" fill-opacity="0.8"/>
5081
5104
  </svg>
5082
- `, na = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
5105
+ `, aa = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
5083
5106
  <path d="M5.33317 11.1461L13.2797 3.19953C14.1747 2.30458 15.6257 2.30458 16.5206 3.19953C17.4156 4.09449 17.4156 5.54549 16.5206 6.44044L8.58651 14.3746C8.33981 14.6213 8.01284 14.7714 7.66494 14.7976L5.82888 14.936C5.25521 14.9792 4.7551 14.5493 4.71185 13.9756C4.70695 13.9105 4.70817 13.8451 4.7155 13.7802L4.91527 12.0134C4.95237 11.6854 5.0997 11.3796 5.33317 11.1461ZM7.57097 13.5511C7.62067 13.5474 7.66738 13.5259 7.70263 13.4907L15.6368 5.55656C16.0436 5.14976 16.0436 4.49021 15.6368 4.08342C15.23 3.67662 14.5704 3.67662 14.1636 4.08342L6.21706 12.03C6.1837 12.0633 6.16266 12.107 6.15736 12.1539L5.98586 13.6706L7.57097 13.5511Z" fill="black" fill-opacity="0.45"/>
5084
5107
  <path d="M3.95898 16.2499C3.61381 16.2499 3.33398 16.5297 3.33398 16.8749C3.33398 17.2201 3.61381 17.4999 3.95898 17.4999H16.0423C16.3875 17.4999 16.6673 17.2201 16.6673 16.8749C16.6673 16.5297 16.3875 16.2499 16.0423 16.2499H3.95898Z" fill="black" fill-opacity="0.45"/>
5085
5108
  </svg>
5086
- `, In = "light", sa = 128;
5087
- function ia({ r, g: e, b: t }) {
5109
+ `, Wn = "light", la = 128;
5110
+ function ca({ r, g: e, b: t }) {
5088
5111
  return 0.299 * r + 0.587 * e + 0.114 * t;
5089
5112
  }
5090
- function oa(r) {
5091
- return r > sa ? "dark" : "light";
5113
+ function da(r) {
5114
+ return r > la ? "dark" : "light";
5092
5115
  }
5093
- function aa(r) {
5116
+ function ua(r) {
5094
5117
  if (!r) return null;
5095
5118
  const e = r.trim().match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+))?\s*\)$/i);
5096
5119
  if (!e) return null;
5097
5120
  const t = Number(e[1]), n = Number(e[2]), s = Number(e[3]), i = e[4] != null ? Number(e[4]) : 1;
5098
5121
  return [t, n, s, i].every(Number.isFinite) ? { r: t, g: n, b: s, a: i } : null;
5099
5122
  }
5100
- function la(r, e) {
5123
+ function Aa(r, e) {
5101
5124
  let t = r;
5102
5125
  for (; t; ) {
5103
- const n = aa(e.getComputedStyle(t).backgroundColor);
5126
+ const n = ua(e.getComputedStyle(t).backgroundColor);
5104
5127
  if (n && n.a >= 0.5)
5105
5128
  return { r: n.r, g: n.g, b: n.b };
5106
5129
  t = t.parentElement;
5107
5130
  }
5108
5131
  return { r: 255, g: 255, b: 255 };
5109
5132
  }
5110
- const ca = [8, 24, 48], da = [0.16, 0.5, 0.84];
5111
- function ua(r) {
5133
+ const ha = [8, 24, 48], pa = [0.16, 0.5, 0.84];
5134
+ function fa(r) {
5112
5135
  let e = null, t = null;
5113
5136
  try {
5114
5137
  e = r.contentDocument, t = r.contentWindow ?? null;
@@ -5119,22 +5142,22 @@ function ua(r) {
5119
5142
  const n = e.documentElement.clientWidth || r.clientWidth;
5120
5143
  if (!n) return null;
5121
5144
  let s = 0, i = 0;
5122
- for (const o of da) {
5145
+ for (const o of pa) {
5123
5146
  const a = Math.round(n * o);
5124
- for (const l of ca) {
5147
+ for (const l of ha) {
5125
5148
  let c = null;
5126
5149
  try {
5127
5150
  c = e.elementFromPoint(a, l);
5128
5151
  } catch {
5129
5152
  c = null;
5130
5153
  }
5131
- const d = la(c ?? e.body ?? e.documentElement, t);
5132
- s += ia(d), i += 1;
5154
+ const d = Aa(c ?? e.body ?? e.documentElement, t);
5155
+ s += ca(d), i += 1;
5133
5156
  }
5134
5157
  }
5135
- return i ? oa(s / i) : null;
5158
+ return i ? da(s / i) : null;
5136
5159
  }
5137
- const ke = "https://picasso-static.xiaohongshu.com/fe-platform/6544a4b19792523b3a9c97aa0fec738f821381cf.png", $t = 0.75, tt = "小工具模拟器", kt = "点击「用一用」打开小工具预览", Je = 2, Se = Je + 1, Aa = "https://fe-platform.xhscdn.com/platform/104101l0324qamsiqgo06277180ac7t8006ptl0ev7ed16.png", ha = "此处为发布页上传的图片", kn = "https://fe-platform.xhscdn.com/platform/104101l0325aul06cl006277180ac7t8006ptl09n4ess6.png", vr = ["#ECECEC", "#F5F5F5"], Ee = {
5160
+ const ke = "https://picasso-static.xiaohongshu.com/fe-platform/6544a4b19792523b3a9c97aa0fec738f821381cf.png", $t = 0.75, tt = "小工具模拟器", kt = "点击「用一用」打开小工具预览", je = 2, Se = je + 1, ga = "https://fe-platform.xhscdn.com/platform/104101l0324qamsiqgo06277180ac7t8006ptl0ev7ed16.png", ma = "此处为发布页上传的图片", kn = "https://fe-platform.xhscdn.com/platform/104101l0325aul06cl006277180ac7t8006ptl09n4ess6.png", vr = ["#ECECEC", "#F5F5F5"], Ee = {
5138
5161
  /** 未传入 notePreview.user 时的兜底头像与昵称 */
5139
5162
  user: {
5140
5163
  avatar: ke,
@@ -5164,7 +5187,7 @@ function qn(r) {
5164
5187
  cover: r.cover ?? r.images?.[0] ?? Ee.cover
5165
5188
  } : { ...Ee };
5166
5189
  }
5167
- function pa(r) {
5190
+ function ba(r) {
5168
5191
  return r >= 2 ? 2 : r <= 3 / 4 ? 3 / 4 : r;
5169
5192
  }
5170
5193
  const Ke = 44, er = `
@@ -5195,7 +5218,7 @@ const Ke = 44, er = `
5195
5218
  -webkit-user-drag: none;
5196
5219
  user-drag: none;
5197
5220
  }
5198
- `, fa = 0.08, ga = 0.2, ma = 3 / 5, ba = 280, Bn = 1;
5221
+ `, va = 0.08, ya = 0.2, wa = 3 / 5, Ca = 280, Bn = 1;
5199
5222
  function qe(r, e, t) {
5200
5223
  return Math.min(t, Math.max(e, r));
5201
5224
  }
@@ -5204,12 +5227,12 @@ function yr(r) {
5204
5227
  return {
5205
5228
  expand: r.expandThresholdRatio ?? e + t * 0.55,
5206
5229
  collapse: r.collapseThresholdRatio ?? e + t * 0.35,
5207
- close: r.closeThresholdRatio ?? ga,
5208
- topZone: r.topDragZoneRatio ?? fa,
5209
- transitionMs: r.snapTransitionMs ?? ba
5230
+ close: r.closeThresholdRatio ?? ya,
5231
+ topZone: r.topDragZoneRatio ?? va,
5232
+ transitionMs: r.snapTransitionMs ?? Ca
5210
5233
  };
5211
5234
  }
5212
- function va(r) {
5235
+ function Sa(r) {
5213
5236
  const { sheet: e, handle: t, getBoundsHeight: n, fullScreenDragZone: s, onStateChange: i } = r;
5214
5237
  let o = qe(r.halfHeightRatio, 0.5, 0.95), a = yr({ ...r, halfHeightRatio: o }), l = r.initialState ?? "half", c = !1, d = null, h = 0, u = 0, p = 0;
5215
5238
  const g = () => {
@@ -5229,31 +5252,31 @@ function va(r) {
5229
5252
  if (l === "full")
5230
5253
  return C <= a.collapse ? "half" : "full";
5231
5254
  if (C >= a.expand) return "full";
5232
- const W = g();
5233
- if (W > 0) {
5234
- if ((W - f) / W >= ma) return "closed";
5255
+ const L = g();
5256
+ if (L > 0) {
5257
+ if ((L - f) / L >= wa) return "closed";
5235
5258
  } else if (C <= a.close)
5236
5259
  return "closed";
5237
5260
  return "half";
5238
- }, L = (f, C = !0) => {
5261
+ }, I = (f, C = !0) => {
5239
5262
  l = f;
5240
- const W = l === "closed" ? 0 : l === "full" ? n() : g();
5241
- y(W, C), i?.(l);
5242
- }, q = (f, C, W) => C >= f.left && C <= f.right && W >= f.top && W <= f.bottom, K = (f, C, W) => {
5263
+ const L = l === "closed" ? 0 : l === "full" ? n() : g();
5264
+ y(L, C), i?.(l);
5265
+ }, q = (f, C, L) => C >= f.left && C <= f.right && L >= f.top && L <= f.bottom, K = (f, C, L) => {
5243
5266
  if (f === t || f instanceof Node && t.contains(f)) return !0;
5244
5267
  const te = t.getBoundingClientRect();
5245
- return q(te, C, W);
5246
- }, D = (f, C) => s ? q(s.getBoundingClientRect(), f, C) : !1, Z = (f, C, W) => {
5268
+ return q(te, C, L);
5269
+ }, D = (f, C) => s ? q(s.getBoundingClientRect(), f, C) : !1, Z = (f, C, L) => {
5247
5270
  if (r.locked || l === "closed") return !1;
5248
5271
  if (l === "half")
5249
- return K(f, C, W);
5250
- if (s) return D(C, W);
5272
+ return K(f, C, L);
5273
+ if (s) return D(C, L);
5251
5274
  const te = e.getBoundingClientRect();
5252
- return te.height <= 0 ? K(f, C, W) : (W - te.top) / te.height <= a.topZone || K(f, C, W);
5275
+ return te.height <= 0 ? K(f, C, L) : (L - te.top) / te.height <= a.topZone || K(f, C, L);
5253
5276
  };
5254
- let P = null, x = null;
5277
+ let N = null, x = null;
5255
5278
  const ye = () => {
5256
- P && (window.removeEventListener("pointermove", P), P = null), x && (window.removeEventListener("pointerup", x), window.removeEventListener("pointercancel", x), x = null);
5279
+ N && (window.removeEventListener("pointermove", N), N = null), x && (window.removeEventListener("pointerup", x), window.removeEventListener("pointercancel", x), x = null);
5257
5280
  }, we = (f) => {
5258
5281
  if (!(f.button !== 0 || c) && Z(f.target, f.clientX, f.clientY)) {
5259
5282
  c = !0, d = f.pointerId, h = f.clientY, u = p, m(!1);
@@ -5261,11 +5284,11 @@ function va(r) {
5261
5284
  e.setPointerCapture(f.pointerId);
5262
5285
  } catch {
5263
5286
  }
5264
- e.classList.add("sheet--dragging"), P = (C) => ee(C), x = (C) => ue(C), window.addEventListener("pointermove", P), window.addEventListener("pointerup", x), window.addEventListener("pointercancel", x), f.preventDefault(), f.stopPropagation();
5287
+ e.classList.add("sheet--dragging"), N = (C) => ee(C), x = (C) => ue(C), window.addEventListener("pointermove", N), window.addEventListener("pointerup", x), window.addEventListener("pointercancel", x), f.preventDefault(), f.stopPropagation();
5265
5288
  }
5266
5289
  }, ee = (f) => {
5267
5290
  if (!c || d !== null && f.pointerId !== d) return;
5268
- const C = n(), W = f.clientY - h, te = qe(u - W, 0, C);
5291
+ const C = n(), L = f.clientY - h, te = qe(u - L, 0, C);
5269
5292
  y(te, !1);
5270
5293
  }, ue = (f) => {
5271
5294
  if (!(!c || d !== null && f.pointerId !== d)) {
@@ -5274,17 +5297,17 @@ function va(r) {
5274
5297
  e.hasPointerCapture(f.pointerId) && e.releasePointerCapture(f.pointerId);
5275
5298
  } catch {
5276
5299
  }
5277
- L(M(p), !0);
5300
+ I(M(p), !0);
5278
5301
  }
5279
5302
  };
5280
- return e.addEventListener("pointerdown", we), L(l, !1), {
5303
+ return e.addEventListener("pointerdown", we), I(l, !1), {
5281
5304
  getState: () => l,
5282
5305
  setHalfHeightRatio(f) {
5283
- o = qe(f, 0.5, 0.95), a = yr({ ...r, halfHeightRatio: o }), L(l, !1);
5306
+ o = qe(f, 0.5, 0.95), a = yr({ ...r, halfHeightRatio: o }), I(l, !1);
5284
5307
  },
5285
- snapTo: L,
5308
+ snapTo: I,
5286
5309
  refresh() {
5287
- L(l, !1);
5310
+ I(l, !1);
5288
5311
  },
5289
5312
  destroy() {
5290
5313
  ye(), e.removeEventListener("pointerdown", we);
@@ -5292,9 +5315,9 @@ function va(r) {
5292
5315
  };
5293
5316
  }
5294
5317
  const qt = "xhs-note-half-sheet";
5295
- class ya extends HTMLElement {
5318
+ class Ea extends HTMLElement {
5296
5319
  constructor() {
5297
- super(...arguments), this._bodyEl = null, this._placeholderEl = null, this._sheetEl = null, this._handleEl = null, this._fullChromeEl = null, this._fullScreenDragZoneEl = null, this._backBtn = null, this._drag = null, this._resizeObserver = null, this._iframeObserver = null, this._watchedIframe = null, this._detachIframeListeners = null, this._toneRafId = null, this._chromeTone = In, this._hasApp = !1;
5320
+ super(...arguments), this._bodyEl = null, this._placeholderEl = null, this._sheetEl = null, this._handleEl = null, this._fullChromeEl = null, this._fullScreenDragZoneEl = null, this._backBtn = null, this._drag = null, this._resizeObserver = null, this._iframeObserver = null, this._watchedIframe = null, this._detachIframeListeners = null, this._toneRafId = null, this._chromeTone = Wn, this._hasApp = !1;
5298
5321
  }
5299
5322
  static get observedAttributes() {
5300
5323
  return ["height-ratio", "placeholder", "launch-mode"];
@@ -5347,7 +5370,7 @@ class ya extends HTMLElement {
5347
5370
  }
5348
5371
  detectAndApplyTone() {
5349
5372
  if (!this._watchedIframe) return;
5350
- const e = ua(this._watchedIframe);
5373
+ const e = fa(this._watchedIframe);
5351
5374
  e && this.applyChromeTone(e);
5352
5375
  }
5353
5376
  /** 应用 chrome tone:驱动顶栏 icon 圆底/前景色与拖杆明暗,并向详情壳透传 */
@@ -5470,7 +5493,7 @@ class ya extends HTMLElement {
5470
5493
  mountDragController() {
5471
5494
  if (!this._sheetEl || !this._handleEl || this._drag) return;
5472
5495
  const e = this.readHeightRatio(), t = this.isFullscreenMode();
5473
- this._drag = va({
5496
+ this._drag = Sa({
5474
5497
  sheet: this._sheetEl,
5475
5498
  handle: this._handleEl,
5476
5499
  fullScreenDragZone: this._fullScreenDragZoneEl ?? void 0,
@@ -5746,21 +5769,21 @@ class ya extends HTMLElement {
5746
5769
  </div>
5747
5770
  <div class="full-chrome" part="full-chrome">
5748
5771
  <button type="button" class="nav-btn nav-btn--back" part="back" aria-label="返回">
5749
- ${Qo}
5772
+ ${_o}
5750
5773
  </button>
5751
5774
  <div class="full-chrome__actions">
5752
5775
  <button type="button" class="nav-btn nav-btn--share" part="share" aria-label="分享">
5753
- ${zo}
5776
+ ${$o}
5754
5777
  </button>
5755
5778
  <button type="button" class="nav-btn nav-btn--more" part="more" aria-label="更多">
5756
- ${jo}
5779
+ ${ea}
5757
5780
  </button>
5758
5781
  </div>
5759
5782
  </div>
5760
5783
  </div>
5761
5784
  <div class="body-wrap">
5762
5785
  <div class="placeholder" part="placeholder">
5763
- <div class="placeholder-icon">${Yo}</div>
5786
+ <div class="placeholder-icon">${zo}</div>
5764
5787
  <p class="placeholder-text"></p>
5765
5788
  </div>
5766
5789
  <div class="body" part="body"></div>
@@ -5770,14 +5793,14 @@ class ya extends HTMLElement {
5770
5793
  }
5771
5794
  }
5772
5795
  function Tn() {
5773
- customElements.get(qt) || customElements.define(qt, ya);
5796
+ customElements.get(qt) || customElements.define(qt, Ea);
5774
5797
  }
5775
- function wa(r = /* @__PURE__ */ new Date()) {
5798
+ function xa(r = /* @__PURE__ */ new Date()) {
5776
5799
  const e = r.getHours(), t = r.getMinutes();
5777
5800
  return `${e}:${String(t).padStart(2, "0")}`;
5778
5801
  }
5779
5802
  const Bt = "xhs-note-detail-shell";
5780
- class Ca extends HTMLElement {
5803
+ class Va extends HTMLElement {
5781
5804
  constructor() {
5782
5805
  super(...arguments), this._data = null, this._sheetOptions = {
5783
5806
  heightRatio: $t,
@@ -5842,7 +5865,7 @@ class Ca extends HTMLElement {
5842
5865
  }
5843
5866
  render() {
5844
5867
  if (!this.shadowRoot) return;
5845
- const e = this._data, t = pa(e?.images?.[0]?.ratio ?? e?.cover?.ratio ?? 3 / 4), n = e?.appCard?.name || tt, s = e?.appCard?.desc || kt, i = e?.appCard?.icon || "", o = this.buildGalleryPages(), a = "<span></span>".repeat(Se);
5868
+ const e = this._data, t = ba(e?.images?.[0]?.ratio ?? e?.cover?.ratio ?? 3 / 4), n = e?.appCard?.name || tt, s = e?.appCard?.desc || kt, i = e?.appCard?.icon || "", o = this.buildGalleryPages(), a = "<span></span>".repeat(Se);
5846
5869
  this.shadowRoot.innerHTML = `
5847
5870
  <style>
5848
5871
  ${er}
@@ -6319,41 +6342,41 @@ class Ca extends HTMLElement {
6319
6342
  /* 不强制子元素 pointer-events:auto:half-sheet 自身 :host 为 none、
6320
6343
  仅 .sheet 为 auto;关闭态 .sheet 也置 none,从而让背景的「使用」可点击 */
6321
6344
  </style>
6322
- <div class="shell sheet-open" data-chrome-tone="${In}">
6345
+ <div class="shell sheet-open" data-chrome-tone="${Wn}">
6323
6346
  <div class="status">
6324
6347
  <span class="status-time"></span>
6325
6348
  <div class="status-icons">
6326
- ${Ln}
6349
+ ${In}
6327
6350
  ${Vn}
6328
- ${Wn}
6351
+ ${Ln}
6329
6352
  </div>
6330
6353
  </div>
6331
6354
  <header class="nav">
6332
- <button type="button" class="back" aria-label="返回">${Go}</button>
6333
- <img class="avatar" src="${Pe(e?.user.avatar || ke)}" alt="" referrerpolicy="no-referrer" />
6355
+ <button type="button" class="back" aria-label="返回">${Jo}</button>
6356
+ <img class="avatar" src="${Ne(e?.user.avatar || ke)}" alt="" referrerpolicy="no-referrer" />
6334
6357
  <span class="nickname">${Re(e?.user.nickname ?? "用户名")}</span>
6335
6358
  <span class="follow">关注</span>
6336
- <button type="button" class="share" aria-label="分享">${Ho}</button>
6359
+ <button type="button" class="share" aria-label="分享">${jo}</button>
6337
6360
  </header>
6338
6361
  <div class="body-region">
6339
6362
  <div class="note-bg">
6340
6363
  <div class="gallery">
6341
6364
  <div class="gallery__track">${o}
6342
6365
  </div>
6343
- <button type="button" class="gallery__arrow gallery__arrow--prev" aria-label="上一张">${Jo}</button>
6344
- <button type="button" class="gallery__arrow gallery__arrow--next" aria-label="下一张">${_o}</button>
6366
+ <button type="button" class="gallery__arrow gallery__arrow--prev" aria-label="上一张">${ta}</button>
6367
+ <button type="button" class="gallery__arrow gallery__arrow--next" aria-label="下一张">${ra}</button>
6345
6368
  <div class="gallery__badge">
6346
6369
  <span class="gallery__badge-num"></span>
6347
6370
  <span class="gallery__badge-tag">小工具</span>
6348
6371
  </div>
6349
- <button type="button" class="gallery__use">${$o}<span>点击使用小工具</span></button>
6372
+ <button type="button" class="gallery__use">${na}<span>点击使用小工具</span></button>
6350
6373
  </div>
6351
6374
  <div class="gallery-dots">${a}</div>
6352
6375
  <div class="note-text">
6353
6376
  <div class="skeleton skeleton--title"></div>
6354
6377
  <div class="skeleton skeleton--desc"></div>
6355
6378
  <div class="app-card">
6356
- <div class="app-card__icon"${i ? ` style="background-image:url('${Pe(i)}');background-size:cover;background-position:center"` : ""}></div>
6379
+ <div class="app-card__icon"${i ? ` style="background-image:url('${Ne(i)}');background-size:cover;background-position:center"` : ""}></div>
6357
6380
  <div class="app-card__meta">
6358
6381
  <div class="app-card__name-row">
6359
6382
  <span class="app-card__name">${Re(n)}</span>
@@ -6367,11 +6390,11 @@ class Ca extends HTMLElement {
6367
6390
  </div>
6368
6391
  </div>
6369
6392
  <footer class="action-bar">
6370
- <div class="comment-input">${na}<span>说点什么...</span></div>
6393
+ <div class="comment-input">${aa}<span>说点什么...</span></div>
6371
6394
  <div class="actions">
6372
- <span class="action action--like">${ea}<span>点赞</span></span>
6373
- <span class="action action--collect">${ta}<span>收藏</span></span>
6374
- <span class="action action--comment">${ra}</span>
6395
+ <span class="action action--like">${sa}<span>点赞</span></span>
6396
+ <span class="action action--collect">${ia}<span>收藏</span></span>
6397
+ <span class="action action--comment">${oa}</span>
6375
6398
  </div>
6376
6399
  </footer>
6377
6400
  <div class="home-indicator" aria-hidden="true"></div>
@@ -6404,14 +6427,14 @@ class Ca extends HTMLElement {
6404
6427
  * 末页是小工具尾卡。尾卡与图片同在 track 内,因此切换共用同一段位移过渡。
6405
6428
  */
6406
6429
  buildGalleryPages() {
6407
- const e = this._data, t = Array.from({ length: Je }, (s, i) => {
6430
+ const e = this._data, t = Array.from({ length: je }, (s, i) => {
6408
6431
  const o = vr[Math.min(i, vr.length - 1)];
6409
6432
  return `
6410
- <div class="gallery__page">${Ea(o)}</div>`;
6433
+ <div class="gallery__page">${La(o)}</div>`;
6411
6434
  }).join(""), n = e?.widgetCover?.url || e?.cover?.url || e?.images?.[0]?.url || "";
6412
6435
  return `${t}
6413
6436
  <div class="gallery__page gallery__page--widget">
6414
- ${n ? Sa(n) : xa()}
6437
+ ${n ? Ia(n) : Wa()}
6415
6438
  </div>`;
6416
6439
  }
6417
6440
  /** 绑定左右翻页箭头,以及点击「小工具」tag 直接跳到尾卡 */
@@ -6432,7 +6455,7 @@ class Ca extends HTMLElement {
6432
6455
  const i = e.querySelector(".gallery__track");
6433
6456
  i && (i.style.transform = `translateX(-${t * 100}%)`);
6434
6457
  const o = e.querySelector(".gallery__badge-num");
6435
- o && (o.textContent = `${Math.min(t + 1, Je)}/${Je}`), e.querySelectorAll(".gallery-dots span").forEach((d, h) => d.classList.toggle("is-active", h === t));
6458
+ o && (o.textContent = `${Math.min(t + 1, je)}/${je}`), e.querySelectorAll(".gallery-dots span").forEach((d, h) => d.classList.toggle("is-active", h === t));
6436
6459
  const l = e.querySelector(".gallery__arrow--prev"), c = e.querySelector(".gallery__arrow--next");
6437
6460
  l && (l.disabled = t === 0), c && (c.disabled = n);
6438
6461
  }
@@ -6446,7 +6469,7 @@ class Ca extends HTMLElement {
6446
6469
  /** 刷新状态栏时间为当前本地时间 */
6447
6470
  updateStatusTime() {
6448
6471
  const e = this.shadowRoot?.querySelector(".status-time");
6449
- e && (e.textContent = wa());
6472
+ e && (e.textContent = xa());
6450
6473
  }
6451
6474
  /** 启动状态栏时钟:立即显示并在每分钟整点刷新 */
6452
6475
  startStatusTimeClock() {
@@ -6476,16 +6499,16 @@ class Ca extends HTMLElement {
6476
6499
  }
6477
6500
  }
6478
6501
  }
6479
- function Sa(r) {
6480
- return `<img class="gallery__img" src="${Pe(r)}" alt="" referrerpolicy="no-referrer" />`;
6502
+ function Ia(r) {
6503
+ return `<img class="gallery__img" src="${Ne(r)}" alt="" referrerpolicy="no-referrer" />`;
6481
6504
  }
6482
- function Ea(r) {
6483
- return `<div class="gallery__placeholder" style="background:${Pe(r)}">
6484
- <img class="gallery__ph-icon" src="${Pe(Aa)}" alt="" referrerpolicy="no-referrer" />
6485
- <div class="gallery__ph-text">${Re(ha)}</div>
6505
+ function La(r) {
6506
+ return `<div class="gallery__placeholder" style="background:${Ne(r)}">
6507
+ <img class="gallery__ph-icon" src="${Ne(ga)}" alt="" referrerpolicy="no-referrer" />
6508
+ <div class="gallery__ph-text">${Re(ma)}</div>
6486
6509
  </div>`;
6487
6510
  }
6488
- function xa() {
6511
+ function Wa() {
6489
6512
  return `<div class="gallery__placeholder gallery__placeholder--widget">
6490
6513
  <div class="gallery__ph-text">暂未上传封面</div>
6491
6514
  </div>`;
@@ -6493,18 +6516,18 @@ function xa() {
6493
6516
  function Re(r) {
6494
6517
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
6495
6518
  }
6496
- function Pe(r) {
6519
+ function Ne(r) {
6497
6520
  return Re(r).replace(/'/g, "&#39;");
6498
6521
  }
6499
- function Va() {
6500
- customElements.get(Bt) || customElements.define(Bt, Ca);
6522
+ function ka() {
6523
+ customElements.get(Bt) || customElements.define(Bt, Va);
6501
6524
  }
6502
- function La(r = /* @__PURE__ */ new Date()) {
6525
+ function qa(r = /* @__PURE__ */ new Date()) {
6503
6526
  const e = r.getHours(), t = r.getMinutes();
6504
6527
  return `${e}:${String(t).padStart(2, "0")}`;
6505
6528
  }
6506
6529
  const Tt = "xhs-profile-shell";
6507
- class Wa extends HTMLElement {
6530
+ class Ba extends HTMLElement {
6508
6531
  constructor() {
6509
6532
  super(...arguments), this._data = null, this._cover = null, this._statusTimeTimer = null;
6510
6533
  }
@@ -6896,9 +6919,9 @@ class Wa extends HTMLElement {
6896
6919
  <div class="status">
6897
6920
  <span class="status-time"></span>
6898
6921
  <div class="status-icons">
6899
- ${Ln}
6922
+ ${In}
6900
6923
  ${Vn}
6901
- ${Wn}
6924
+ ${Ln}
6902
6925
  </div>
6903
6926
  </div>
6904
6927
  <nav class="nav">
@@ -6990,7 +7013,7 @@ class Wa extends HTMLElement {
6990
7013
  /** 刷新状态栏时间为当前本地时间 */
6991
7014
  updateStatusTime() {
6992
7015
  const e = this.shadowRoot?.querySelector(".status-time");
6993
- e && (e.textContent = La());
7016
+ e && (e.textContent = qa());
6994
7017
  }
6995
7018
  startStatusTimeClock() {
6996
7019
  this.stopStatusTimeClock(), this.updateStatusTime();
@@ -7006,11 +7029,11 @@ class Wa extends HTMLElement {
7006
7029
  function mt() {
7007
7030
  return `
7008
7031
  <div class="card card--placeholder">
7009
- ${Ia()}
7032
+ ${Ta()}
7010
7033
  </div>
7011
7034
  `;
7012
7035
  }
7013
- function Ia() {
7036
+ function Ta() {
7014
7037
  return `
7015
7038
  <div class="card__cover">
7016
7039
  <span class="card__type"><img src="${kn}" alt="" referrerpolicy="no-referrer" /></span>
@@ -7033,12 +7056,12 @@ function Rt(r) {
7033
7056
  function wr(r) {
7034
7057
  return Rt(r).replace(/'/g, "&#39;");
7035
7058
  }
7036
- function ka() {
7037
- customElements.get(Tt) || customElements.define(Tt, Wa);
7059
+ function Ra() {
7060
+ customElements.get(Tt) || customElements.define(Tt, Ba);
7038
7061
  }
7039
7062
  let Cr = !1;
7040
- function qa() {
7041
- Cr || (Tn(), Va(), ka(), Cr = !0);
7063
+ function Fa() {
7064
+ Cr || (Tn(), ka(), Ra(), Cr = !0);
7042
7065
  }
7043
7066
  class Rn {
7044
7067
  constructor(e) {
@@ -7049,7 +7072,7 @@ class Rn {
7049
7072
  * 半屏 sheet body(并初始化为占位态)。
7050
7073
  */
7051
7074
  mount(e) {
7052
- qa(), this.detailShell = document.createElement(Bt), this.detailShell.launchMode = this.context.contentMode, this.detailShell.notePreview = this.context.notePreview, this.detailShell.sheetOptions = this.context.rednoteDetail, this.detailShell.onContentClose = this.context.onContentClose, this.detailShell.onContentOpen = this.context.onContentOpen, this.detailShell.onContentOpenRequest = this.context.onContentOpenRequest, this.detailShell.onAvatarClick = () => this.context.onRouteChange?.("profile"), e.appendChild(this.detailShell);
7075
+ Fa(), this.detailShell = document.createElement(Bt), this.detailShell.launchMode = this.context.contentMode, this.detailShell.notePreview = this.context.notePreview, this.detailShell.sheetOptions = this.context.rednoteDetail, this.detailShell.onContentClose = this.context.onContentClose, this.detailShell.onContentOpen = this.context.onContentOpen, this.detailShell.onContentOpenRequest = this.context.onContentOpenRequest, this.detailShell.onAvatarClick = () => this.context.onRouteChange?.("profile"), e.appendChild(this.detailShell);
7053
7076
  const t = this.detailShell.getContentMountTarget();
7054
7077
  return this.detailShell.setHasAppUrl(!1), this.profileShell = document.createElement(Tt), this.profileShell.profilePreview = this.resolveProfilePreview(), this.profileShell.widgetCover = this.context.widgetCover ?? null, this.profileShell.onBackClick = () => this.context.onRouteChange?.("note"), this.profileShell.onWidgetCardClick = () => {
7055
7078
  this.detailShell?.openContent("full");
@@ -7110,7 +7133,7 @@ class Rn {
7110
7133
  this.detailShell?.remove(), this.detailShell = null, this.profileShell?.remove(), this.profileShell = null;
7111
7134
  }
7112
7135
  }
7113
- class Ba extends wn {
7136
+ class Xa extends wn {
7114
7137
  constructor(e) {
7115
7138
  super(), this.frame = null, this.overlay = null, this.container = null, this.contentRoot = null, this.rednoteShell = null, this.contentHost = null, this.currentUrl = "", this.desiredZoom = 1, this.bridge = null, this.frameToastHost = null, this.detachFramelessShellWindowSync = null, this.detachContentPcGuard = null, this.forwardEmit = (t, n) => {
7116
7139
  this.emit(t, n);
@@ -7140,7 +7163,7 @@ class Ba extends wn {
7140
7163
  emit: this.forwardEmit,
7141
7164
  placement: "sheet"
7142
7165
  };
7143
- this.contentHost = new Zo(s), await this.contentHost.prepare(), n.appendChild(this.contentHost.element), this.contentHost.afterAttached(), this.contentHost.resize(this.context.viewport), this.contentHost.setZoomFactor(this.desiredZoom);
7166
+ this.contentHost = new Go(s), await this.contentHost.prepare(), n.appendChild(this.contentHost.element), this.contentHost.afterAttached(), this.contentHost.resize(this.context.viewport), this.contentHost.setZoomFactor(this.desiredZoom);
7144
7167
  }
7145
7168
  this.resize(this.context.viewport), this.attachFramelessShellIfNeeded(), this.setupBridge(), this.setupGesture(), this.frameToastHost = new bn(this.contentRoot);
7146
7169
  }
@@ -7213,11 +7236,11 @@ class Ba extends wn {
7213
7236
  this.viewport = e;
7214
7237
  const t = this.context.phoneFrame;
7215
7238
  if (t) {
7216
- Wt(this.container), It(this.contentRoot), this.container.style.position = "relative", this.container.style.width = `${t.width}px`, this.container.style.height = `${t.height}px`, this.frame && (this.frame.style.left = `${t.screen.x}px`, this.frame.style.top = `${t.screen.y}px`, this.frame.style.width = `${t.screen.width}px`, this.frame.style.height = `${t.screen.height}px`);
7239
+ Lt(this.container), Wt(this.contentRoot), this.container.style.position = "relative", this.container.style.width = `${t.width}px`, this.container.style.height = `${t.height}px`, this.frame && (this.frame.style.left = `${t.screen.x}px`, this.frame.style.top = `${t.screen.y}px`, this.frame.style.width = `${t.screen.width}px`, this.frame.style.height = `${t.screen.height}px`);
7217
7240
  const n = t.screen.width / e.width, s = t.screen.height / e.height;
7218
7241
  this.contentRoot.style.width = `${e.width}px`, this.contentRoot.style.height = `${e.height}px`, this.contentRoot.style.transformOrigin = "top left", this.contentRoot.style.transform = `scale(${n}, ${s})`;
7219
7242
  } else {
7220
- const n = Jt(this.container, e);
7243
+ const n = jt(this.container, e);
7221
7244
  _t(this.contentRoot, n), this.contentRoot.style.width = `${e.width}px`, this.contentRoot.style.height = `${e.height}px`, this.contentRoot.style.transform = "", this.contentRoot.style.transformOrigin = "";
7222
7245
  }
7223
7246
  this.rednoteShell?.onResize(e), this.contentHost?.resize(e);
@@ -7263,9 +7286,9 @@ class Ba extends wn {
7263
7286
  return t ? (this.frame = document.createElement("div"), this.frame.style.position = "absolute", this.frame.style.overflow = "hidden", this.frame.style.borderRadius = `${t.screen.cornerRadius ?? 42}px`, this.frame.style.background = "#fff", e.appendChild(this.frame), this.overlay = document.createElement("div"), this.overlay.style.position = "absolute", this.overlay.style.inset = "0", this.overlay.style.backgroundImage = `url("${t.imageUrl}")`, this.overlay.style.backgroundRepeat = "no-repeat", this.overlay.style.backgroundSize = "100% 100%", this.overlay.style.pointerEvents = "none", this.overlay.style.zIndex = "1", e.appendChild(this.overlay), this.frame) : e;
7264
7287
  }
7265
7288
  }
7266
- const Ta = "__MINIAPP_SIMULATOR_CONTEXT__";
7289
+ const Ka = "__MINIAPP_SIMULATOR_CONTEXT__";
7267
7290
  let Fn = null;
7268
- function Ra() {
7291
+ function Na() {
7269
7292
  try {
7270
7293
  if (globalThis.process?.versions?.electron) return "electron";
7271
7294
  const e = typeof navigator < "u" ? navigator.userAgent : "";
@@ -7274,17 +7297,45 @@ function Ra() {
7274
7297
  }
7275
7298
  return "web";
7276
7299
  }
7277
- function Fa(r) {
7300
+ function Pa(r) {
7278
7301
  Fn = r;
7279
7302
  try {
7280
- globalThis[Ta] = { ...r };
7303
+ globalThis[Ka] = { ...r };
7281
7304
  } catch {
7282
7305
  }
7283
7306
  }
7284
- function nd() {
7307
+ function dd() {
7285
7308
  return Fn;
7286
7309
  }
7287
- const Xa = {
7310
+ const Oa = 6e4;
7311
+ function Ma(r) {
7312
+ if (r !== _n.mars)
7313
+ return (t, n) => window.alert(n);
7314
+ const e = /* @__PURE__ */ new Map();
7315
+ return (t, n) => {
7316
+ const s = Za(t), i = Date.now(), o = e.get(s);
7317
+ if (!(o !== void 0 && i < o)) {
7318
+ for (const [a, l] of e)
7319
+ l <= i && e.delete(a);
7320
+ e.set(s, Number.POSITIVE_INFINITY);
7321
+ try {
7322
+ window.alert(n);
7323
+ } finally {
7324
+ e.set(s, Date.now() + Oa);
7325
+ }
7326
+ }
7327
+ };
7328
+ }
7329
+ function Za(r) {
7330
+ return JSON.stringify([r.event, r.message], (e, t) => {
7331
+ if (!t || typeof t != "object" || Array.isArray(t)) return t;
7332
+ const n = t;
7333
+ return Object.fromEntries(
7334
+ Object.keys(n).sort().map((s) => [s, n[s]])
7335
+ );
7336
+ });
7337
+ }
7338
+ const Ua = {
7288
7339
  saveFile: "fsSaveFile",
7289
7340
  writeFile: "fsWriteFile",
7290
7341
  appendFile: "fsAppendFile",
@@ -7295,8 +7346,8 @@ const Xa = {
7295
7346
  mkdir: "fsMkdir",
7296
7347
  getFileStorageInfo: "fsGetStorageInfo"
7297
7348
  };
7298
- function Ka(r) {
7299
- const e = (n, s) => Xn(r, n, s), t = Pa(e);
7349
+ function Da(r) {
7350
+ const e = (n, s) => Xn(r, n, s), t = Ya(e);
7300
7351
  return {
7301
7352
  name: "filesystem",
7302
7353
  handlers: {
@@ -7315,15 +7366,15 @@ function Ka(r) {
7315
7366
  }
7316
7367
  };
7317
7368
  }
7318
- function Pa(r) {
7369
+ function Ya(r) {
7319
7370
  return Object.fromEntries(
7320
- Object.entries(Xa).map(([e, t]) => [
7371
+ Object.entries(Ua).map(([e, t]) => [
7321
7372
  e,
7322
7373
  async (n) => {
7323
7374
  try {
7324
7375
  return await r(t, n.message);
7325
7376
  } catch (s) {
7326
- throw Na(s);
7377
+ throw Ga(s);
7327
7378
  }
7328
7379
  }
7329
7380
  ])
@@ -7336,7 +7387,7 @@ function Xn(r, e, t) {
7336
7387
  fsScope: r.appId
7337
7388
  });
7338
7389
  }
7339
- function Na(r) {
7390
+ function Ga(r) {
7340
7391
  if (r instanceof Error) {
7341
7392
  const t = r.code;
7342
7393
  if (typeof t == "number" && Number.isSafeInteger(t))
@@ -7359,21 +7410,21 @@ const F = {
7359
7410
  livePhoto: "实况",
7360
7411
  saveDraft: "存草稿",
7361
7412
  publish: "发布笔记"
7362
- }, N = "https://fe-platform.xhscdn.com/platform", X = {
7363
- navBar: `${N}/104101l0323g0lkiknu0m277180ac7t8006ptl0akiev06.png`,
7364
- statusLevels: `${N}/104101l0323g0lkih7a06277180ac7t8006ptl0b0qgdka.png`,
7365
- homeIndicator: `${N}/104101l0323g0lkipga06277180ac7t8006ptl0dehcmn4.png`,
7366
- voice: `${N}/104101l0323g0lki10206277180ac7t8006ptl0br01bmu.png`,
7367
- location: `${N}/104101l0323g0lkiknk0m277180ac7t8006ptl0e7n5ldm.png`,
7368
- visibility: `${N}/104101l0323g0lkiknk06277180ac7t8006ptl0e1f6908.png`,
7369
- addComponent: `${N}/104101l0323g0lki07k06277180ac7t8006ptl0ck0o7v8.png`,
7370
- setting: `${N}/104101l0323g0lki07u06277180ac7t8006ptl09f764ic.png`,
7371
- chevron: `${N}/104101l0323g0lkij7a06277180ac7t8006ptl0aholfs6.png`,
7372
- topic: `${N}/104101l0323g0lkiqna06277180ac7t8006ptl0ckpb7vo.png`,
7373
- mention: `${N}/104101l0323g0lki1nu76277180ac7t8006ptl0e2eecng.png`,
7374
- vote: `${N}/104101l0323g0lki07k0m277180ac7t8006ptl0bpvoc3i.png`,
7375
- videoBadge: `${N}/104101l0323g0ofcn0206277180ac7t8006ptl0ctk6mds.png`
7376
- }, Oa = {
7413
+ }, P = "https://fe-platform.xhscdn.com/platform", X = {
7414
+ navBar: `${P}/104101l0323g0lkiknu0m277180ac7t8006ptl0akiev06.png`,
7415
+ statusLevels: `${P}/104101l0323g0lkih7a06277180ac7t8006ptl0b0qgdka.png`,
7416
+ homeIndicator: `${P}/104101l0323g0lkipga06277180ac7t8006ptl0dehcmn4.png`,
7417
+ voice: `${P}/104101l0323g0lki10206277180ac7t8006ptl0br01bmu.png`,
7418
+ location: `${P}/104101l0323g0lkiknk0m277180ac7t8006ptl0e7n5ldm.png`,
7419
+ visibility: `${P}/104101l0323g0lkiknk06277180ac7t8006ptl0e1f6908.png`,
7420
+ addComponent: `${P}/104101l0323g0lki07k06277180ac7t8006ptl0ck0o7v8.png`,
7421
+ setting: `${P}/104101l0323g0lki07u06277180ac7t8006ptl09f764ic.png`,
7422
+ chevron: `${P}/104101l0323g0lkij7a06277180ac7t8006ptl0aholfs6.png`,
7423
+ topic: `${P}/104101l0323g0lkiqna06277180ac7t8006ptl0ckpb7vo.png`,
7424
+ mention: `${P}/104101l0323g0lki1nu76277180ac7t8006ptl0e2eecng.png`,
7425
+ vote: `${P}/104101l0323g0lki07k0m277180ac7t8006ptl0bpvoc3i.png`,
7426
+ videoBadge: `${P}/104101l0323g0ofcn0206277180ac7t8006ptl0ctk6mds.png`
7427
+ }, Ha = {
7377
7428
  red: "#FF2442",
7378
7429
  title: "rgba(0, 0, 0, 0.8)",
7379
7430
  placeholder: "rgba(0, 0, 0, 0.27)",
@@ -7383,7 +7434,7 @@ const F = {
7383
7434
  chooseCoverBg: "rgba(0, 0, 0, 0.65)",
7384
7435
  chooseCoverBorder: "rgba(255, 255, 255, 0.3)"
7385
7436
  }, Ft = "miniapp-note-publish";
7386
- class Ma extends HTMLElement {
7437
+ class Qa extends HTMLElement {
7387
7438
  constructor() {
7388
7439
  super(...arguments), this._panelEl = null, this._resolve = null;
7389
7440
  }
@@ -7414,11 +7465,11 @@ class Ma extends HTMLElement {
7414
7465
  const t = this.shadowRoot?.querySelector(".scroll");
7415
7466
  if (!t) return;
7416
7467
  const n = e.title ? `<div class="title title--filled">${bt(e.title)}</div>` : `<div class="title">${F.titlePlaceholder}</div>`, s = e.content ? `<div class="content content--filled">${bt(e.content)}</div>` : `<div class="content"><span>${F.contentPlaceholder}</span><img class="voice" src="${X.voice}" alt=""></div>`, i = e.tags.length ? `<div class="tags">${e.tags.map((o) => `<span class="tag">#${bt(o)}</span>`).join("")}</div>` : "";
7417
- t.innerHTML = Za(e.media) + n + s + i;
7468
+ t.innerHTML = za(e.media) + n + s + i;
7418
7469
  }
7419
7470
  render() {
7420
7471
  if (!this.shadowRoot) return;
7421
- const e = Oa;
7472
+ const e = Ha;
7422
7473
  this.shadowRoot.innerHTML = `
7423
7474
  <style>
7424
7475
  :host {
@@ -7595,10 +7646,10 @@ class Ma extends HTMLElement {
7595
7646
  function Ge(r, e) {
7596
7647
  return `<div class="row"><img class="ricon" src="${r}" alt=""><span class="label">${e}</span><img class="chevron" src="${X.chevron}" alt=""></div>`;
7597
7648
  }
7598
- function Za(r) {
7599
- return r.length ? r.length === 1 && r[0].type !== "image" ? `<div class="media">${Ua(r[0])}</div>` : `<div class="media">${r.map((t) => t.type === "image" ? `<div class="cell"><img src="${t.url}" alt=""></div>` : t.type === "live_photo" ? `<div class="cell"><img src="${t.cover}" alt=""><span class="badge">${F.livePhoto}</span></div>` : `<div class="cell">${t.cover ? `<img src="${t.cover}" alt="">` : `<video src="${t.url}" muted playsinline></video>`}<span class="badge"><img src="${X.videoBadge}" alt=""></span></div>`).join("")}</div>` : "";
7649
+ function za(r) {
7650
+ return r.length ? r.length === 1 && r[0].type !== "image" ? `<div class="media">${Ja(r[0])}</div>` : `<div class="media">${r.map((t) => t.type === "image" ? `<div class="cell"><img src="${t.url}" alt=""></div>` : t.type === "live_photo" ? `<div class="cell"><img src="${t.cover}" alt=""><span class="badge">${F.livePhoto}</span></div>` : `<div class="cell">${t.cover ? `<img src="${t.cover}" alt="">` : `<video src="${t.url}" muted playsinline></video>`}<span class="badge"><img src="${X.videoBadge}" alt=""></span></div>`).join("")}</div>` : "";
7600
7651
  }
7601
- function Ua(r) {
7652
+ function Ja(r) {
7602
7653
  if (r.type === "image") return "";
7603
7654
  const e = r.type === "live_photo" ? `<span class="badge">${F.livePhoto}</span>` : `<span class="badge"><img src="${X.videoBadge}" alt=""></span>`;
7604
7655
  return `<div class="cover">${r.type === "live_photo" ? `<img src="${r.cover}" alt="">` : r.cover ? `<img src="${r.cover}" alt="">` : `<video src="${r.url}" muted playsinline></video>`}${e}<span class="choose-cover">${F.chooseCover}</span></div>`;
@@ -7608,14 +7659,14 @@ function bt(r) {
7608
7659
  }
7609
7660
  let Sr = !1;
7610
7661
  function Kn() {
7611
- Sr || typeof customElements > "u" || (customElements.get(Ft) || customElements.define(Ft, Ma), Sr = !0);
7662
+ Sr || typeof customElements > "u" || (customElements.get(Ft) || customElements.define(Ft, Qa), Sr = !0);
7612
7663
  }
7613
- function Da() {
7664
+ function ja() {
7614
7665
  return Kn(), document.createElement(Ft);
7615
7666
  }
7616
- class Ya {
7667
+ class _a {
7617
7668
  constructor(e, t = {}) {
7618
- this.mountEl = e, this.options = t, this.page = Da(), this.mounted = !1, Kn();
7669
+ this.mountEl = e, this.options = t, this.page = ja(), this.mounted = !1, Kn();
7619
7670
  }
7620
7671
  mount() {
7621
7672
  this.mounted || (this.mountEl.appendChild(this.page), this.mounted = !0);
@@ -7632,16 +7683,16 @@ class Ya {
7632
7683
  this.hide(), this.page.remove(), this.mounted = !1;
7633
7684
  }
7634
7685
  }
7635
- function Ga(r) {
7686
+ function $a(r) {
7636
7687
  return {
7637
7688
  title: _(r.title),
7638
7689
  content: _(r.content),
7639
7690
  pageType: typeof r.pageType == "string" ? r.pageType : void 0,
7640
- tags: Qa(r.tags),
7641
- media: Ha(r.mediaInfo)
7691
+ tags: tl(r.tags),
7692
+ media: el(r.mediaInfo)
7642
7693
  };
7643
7694
  }
7644
- function Ha(r) {
7695
+ function el(r) {
7645
7696
  const e = He(r);
7646
7697
  if (!e) return [];
7647
7698
  const t = [];
@@ -7660,7 +7711,7 @@ function Ha(r) {
7660
7711
  }
7661
7712
  return t;
7662
7713
  }
7663
- function Qa(r) {
7714
+ function tl(r) {
7664
7715
  if (Array.isArray(r)) return r.map(_).filter(Boolean);
7665
7716
  const e = _(r);
7666
7717
  return e ? e.split(/[\s,,、#]+/).map((t) => t.trim()).filter(Boolean) : [];
@@ -7681,7 +7732,7 @@ function He(r) {
7681
7732
  }
7682
7733
  return r && typeof r == "object" ? r : null;
7683
7734
  }
7684
- const de = "designable-miniapp-host-toast", xr = "designable-miniapp-host-toast-style", za = `
7735
+ const de = "designable-miniapp-host-toast", xr = "designable-miniapp-host-toast-style", rl = `
7685
7736
  .${de} {
7686
7737
  position: fixed;
7687
7738
  top: 50%;
@@ -7712,22 +7763,22 @@ const de = "designable-miniapp-host-toast", xr = "designable-miniapp-host-toast-
7712
7763
  transform: translateY(0);
7713
7764
  }
7714
7765
  `;
7715
- function ja(r) {
7766
+ function nl(r) {
7716
7767
  if (r.querySelector(`#${xr}`)) return;
7717
7768
  const e = document.createElement("style");
7718
- e.id = xr, e.textContent = za.replace(
7769
+ e.id = xr, e.textContent = rl.replace(
7719
7770
  /\.designable-miniapp-host-toast/g,
7720
7771
  `.${de}`
7721
7772
  ), r.appendChild(e);
7722
7773
  }
7723
- function Ja(r) {
7724
- ja(r);
7774
+ function sl(r) {
7775
+ nl(r);
7725
7776
  let e = r.querySelector(`#${de}`);
7726
7777
  return e || (e = document.createElement("div"), e.id = de, e.className = de, r.appendChild(e), e);
7727
7778
  }
7728
- function _a(r, e) {
7779
+ function il(r, e) {
7729
7780
  if (typeof document > "u") return;
7730
- const t = Ja(e?.root ?? document.body), n = document.createElement("div");
7781
+ const t = sl(e?.root ?? document.body), n = document.createElement("div");
7731
7782
  n.textContent = r, t.appendChild(n), requestAnimationFrame(() => {
7732
7783
  n.classList.add("visible");
7733
7784
  });
@@ -7736,14 +7787,14 @@ function _a(r, e) {
7736
7787
  n.classList.remove("visible"), window.setTimeout(() => n.remove(), 220);
7737
7788
  }, s);
7738
7789
  }
7739
- function $a(r) {
7790
+ function ol(r) {
7740
7791
  return {
7741
7792
  name: "interaction",
7742
7793
  handlers: {
7743
7794
  showToast: {
7744
7795
  handler: (e) => {
7745
7796
  const t = e.message, n = typeof t.title == "string" ? t.title : String(t.title ?? "");
7746
- _a(n, {
7797
+ il(n, {
7747
7798
  duration: typeof t.duration == "number" ? t.duration : void 0,
7748
7799
  root: r.overlayRoot
7749
7800
  });
@@ -7751,41 +7802,59 @@ function $a(r) {
7751
7802
  },
7752
7803
  postNote: {
7753
7804
  handler: async (e) => {
7754
- if (await r.showNotePublish(Ga(e.message)) !== "publish") throw new Error("用户取消发布");
7805
+ if (await r.showNotePublish($a(e.message)) !== "publish") throw new Error("用户取消发布");
7755
7806
  return {};
7756
7807
  }
7808
+ },
7809
+ getFollowStatus: {
7810
+ // 契约:0 表示未关注;允许 Apollo 或宿主覆盖 mock 结果。
7811
+ handler: () => ({ follow_status: 0 })
7812
+ },
7813
+ vibrateLong: {
7814
+ handler: () => (r.vibrate("long"), {})
7815
+ },
7816
+ vibrateShort: {
7817
+ handler: (e) => {
7818
+ const { type: t } = e.message;
7819
+ if (t !== "light" && t !== "medium" && t !== "heavy")
7820
+ throw E(
7821
+ v.INVALID_PARAM,
7822
+ 'type must be "heavy", "medium" or "light"'
7823
+ );
7824
+ return r.vibrate(t), {};
7825
+ }
7757
7826
  }
7758
7827
  }
7759
7828
  };
7760
7829
  }
7761
- const Vr = 6378245, Lr = 0.006693421622965943, B = Math.PI, el = {
7830
+ const Vr = 6378245, Ir = 0.006693421622965943, B = Math.PI, al = {
7762
7831
  enableHighAccuracy: !0,
7763
7832
  timeout: 1e4,
7764
7833
  maximumAge: 0
7765
7834
  };
7766
- function tl({ latitude: r, longitude: e }) {
7835
+ function ll({ latitude: r, longitude: e }) {
7767
7836
  return e < 72.004 || e > 137.8347 || r < 0.8293 || r > 55.8271;
7768
7837
  }
7769
- function rl(r, e) {
7838
+ function cl(r, e) {
7770
7839
  let t = -100 + 2 * r + 3 * e + 0.2 * e * e;
7771
7840
  return t += 0.1 * r * e + 0.2 * Math.sqrt(Math.abs(r)), t += (20 * Math.sin(6 * r * B) + 20 * Math.sin(2 * r * B)) * 2 / 3, t += (20 * Math.sin(e * B) + 40 * Math.sin(e / 3 * B)) * 2 / 3, t += (160 * Math.sin(e / 12 * B) + 320 * Math.sin(e * B / 30)) * 2 / 3, t;
7772
7841
  }
7773
- function nl(r, e) {
7842
+ function dl(r, e) {
7774
7843
  let t = 300 + r + 2 * e + 0.1 * r * r;
7775
7844
  return t += 0.1 * r * e + 0.1 * Math.sqrt(Math.abs(r)), t += (20 * Math.sin(6 * r * B) + 20 * Math.sin(2 * r * B)) * 2 / 3, t += (20 * Math.sin(r * B) + 40 * Math.sin(r / 3 * B)) * 2 / 3, t += (150 * Math.sin(r / 12 * B) + 300 * Math.sin(r / 30 * B)) * 2 / 3, t;
7776
7845
  }
7777
- function sl(r) {
7778
- if (tl(r)) return r;
7779
- const e = rl(r.longitude - 105, r.latitude - 35), t = nl(
7846
+ function ul(r) {
7847
+ if (ll(r)) return r;
7848
+ const e = cl(r.longitude - 105, r.latitude - 35), t = dl(
7780
7849
  r.longitude - 105,
7781
7850
  r.latitude - 35
7782
- ), n = r.latitude / 180 * B, s = Math.sin(n), i = 1 - Lr * s * s, o = Math.sqrt(i);
7851
+ ), n = r.latitude / 180 * B, s = Math.sin(n), i = 1 - Ir * s * s, o = Math.sqrt(i);
7783
7852
  return {
7784
- latitude: r.latitude + e * 180 / (Vr * (1 - Lr) / (i * o) * B),
7853
+ latitude: r.latitude + e * 180 / (Vr * (1 - Ir) / (i * o) * B),
7785
7854
  longitude: r.longitude + t * 180 / (Vr / o * Math.cos(n) * B)
7786
7855
  };
7787
7856
  }
7788
- function il(r) {
7857
+ function Al(r) {
7789
7858
  switch (r.code) {
7790
7859
  case r.PERMISSION_DENIED:
7791
7860
  return "browser location permission was denied";
@@ -7797,34 +7866,34 @@ function il(r) {
7797
7866
  return r.message || "browser location failed";
7798
7867
  }
7799
7868
  }
7800
- function ol() {
7869
+ function hl() {
7801
7870
  return navigator.geolocation ? new Promise((r, e) => {
7802
7871
  navigator.geolocation.getCurrentPosition(
7803
7872
  r,
7804
- (t) => e(new Error(il(t))),
7805
- el
7873
+ (t) => e(new Error(Al(t))),
7874
+ al
7806
7875
  );
7807
7876
  }) : Promise.reject(new Error("browser geolocation is unavailable"));
7808
7877
  }
7809
- function al() {
7878
+ function pl() {
7810
7879
  return {
7811
7880
  name: "location",
7812
7881
  handlers: {
7813
7882
  getLocation: {
7814
- handler: ll(),
7883
+ handler: fl(),
7815
7884
  hostOverride: "function-only"
7816
7885
  }
7817
7886
  }
7818
7887
  };
7819
7888
  }
7820
- function ll() {
7889
+ function fl() {
7821
7890
  return async (r) => {
7822
7891
  const { type: e } = r.message;
7823
7892
  if (e !== void 0 && e !== "wgs84" && e !== "gcj02")
7824
7893
  throw new Error('type must be "wgs84" or "gcj02"');
7825
- const t = await ol(), { coords: n } = t;
7894
+ const t = await hl(), { coords: n } = t;
7826
7895
  return {
7827
- ...e === "gcj02" ? sl({ latitude: n.latitude, longitude: n.longitude }) : { latitude: n.latitude, longitude: n.longitude },
7896
+ ...e === "gcj02" ? ul({ latitude: n.latitude, longitude: n.longitude }) : { latitude: n.latitude, longitude: n.longitude },
7828
7897
  accuracy: n.accuracy,
7829
7898
  ...n.speed === null ? {} : { speed: n.speed },
7830
7899
  ...n.altitude === null ? {} : { altitude: n.altitude },
@@ -7833,7 +7902,7 @@ function ll() {
7833
7902
  };
7834
7903
  };
7835
7904
  }
7836
- const cl = {
7905
+ const gl = {
7837
7906
  "image/png": "png",
7838
7907
  "image/jpeg": "jpg",
7839
7908
  "image/webp": "webp",
@@ -7842,7 +7911,7 @@ const cl = {
7842
7911
  "video/quicktime": "mov",
7843
7912
  "video/webm": "webm"
7844
7913
  };
7845
- function Wr(r) {
7914
+ function Lr(r) {
7846
7915
  const e = new Uint8Array(r);
7847
7916
  if (vt(e, [137, 80, 78, 71, 13, 10, 26, 10]))
7848
7917
  return "image/png";
@@ -7850,16 +7919,16 @@ function Wr(r) {
7850
7919
  if (xe(e, 0, "GIF87a") || xe(e, 0, "GIF89a")) return "image/gif";
7851
7920
  if (xe(e, 0, "RIFF") && xe(e, 8, "WEBP")) return "image/webp";
7852
7921
  if (xe(e, 4, "ftyp"))
7853
- return Pn(e, 8, 12) === "qt " ? "video/quicktime" : "video/mp4";
7922
+ return Nn(e, 8, 12) === "qt " ? "video/quicktime" : "video/mp4";
7854
7923
  if (vt(e, [26, 69, 223, 163])) return "video/webm";
7855
7924
  }
7856
- function dl(r) {
7925
+ function ml(r) {
7857
7926
  if (typeof r != "string" || r.length === 0)
7858
7927
  return { error: "data is required", code: "ERR_INVALID_ARGS" };
7859
7928
  const e = /^data:([^;,]+);base64,(.*)$/s.exec(r);
7860
7929
  if (!e)
7861
7930
  return { error: "only base64 data: URI is accepted", code: "ERR_INVALID_ARGS" };
7862
- const t = e[1].toLowerCase(), n = cl[t];
7931
+ const t = e[1].toLowerCase(), n = gl[t];
7863
7932
  if (!n)
7864
7933
  return { error: `unsupported mime "${t}"`, code: "ERR_UNSUPPORTED_MIME" };
7865
7934
  let s;
@@ -7876,41 +7945,41 @@ function vt(r, e) {
7876
7945
  return e.every((t, n) => r[n] === t);
7877
7946
  }
7878
7947
  function xe(r, e, t) {
7879
- return Pn(r, e, e + t.length) === t;
7948
+ return Nn(r, e, e + t.length) === t;
7880
7949
  }
7881
- function Pn(r, e, t) {
7950
+ function Nn(r, e, t) {
7882
7951
  if (r.length < t) return "";
7883
7952
  let n = "";
7884
7953
  for (let s = e; s < t; s++) n += String.fromCharCode(r[s]);
7885
7954
  return n;
7886
7955
  }
7887
- const ul = /^data:image\/[a-z0-9.+-]+;base64,/i, Al = /^https?:\/\//i, Nn = "/_xhsfile_/";
7888
- function hl(r) {
7956
+ const bl = /^data:image\/[a-z0-9.+-]+;base64,/i, vl = /^https?:\/\//i, Pn = "/_xhsfile_/";
7957
+ function yl(r) {
7889
7958
  return {
7890
7959
  name: "media",
7891
7960
  handlers: {
7892
7961
  saveImageToPhotosAlbum: {
7893
- handler: pl(r),
7962
+ handler: wl(r),
7894
7963
  hostOverride: "function-only"
7895
7964
  }
7896
7965
  }
7897
7966
  };
7898
7967
  }
7899
- function pl(r) {
7900
- const e = r.fetch ?? globalThis.fetch.bind(globalThis), t = r.download ?? wl;
7968
+ function wl(r) {
7969
+ const e = r.fetch ?? globalThis.fetch.bind(globalThis), t = r.download ?? Ll;
7901
7970
  return async (n) => {
7902
- const s = fl(n.message.filePath), i = gl(s, r.loadedUrl), o = await ml(i, r, e);
7903
- return t(o, vl(i, o.type)), {};
7971
+ const s = Cl(n.message.filePath), i = Sl(s, r.loadedUrl), o = await El(i, r, e);
7972
+ return t(o, Vl(i, o.type)), {};
7904
7973
  };
7905
7974
  }
7906
- function fl(r) {
7975
+ function Cl(r) {
7907
7976
  if (typeof r != "string" || !r.trim())
7908
7977
  throw E(v.INVALID_PARAM, "filePath is required");
7909
7978
  return r.trim();
7910
7979
  }
7911
- function gl(r, e) {
7980
+ function Sl(r, e) {
7912
7981
  if (r.startsWith("data:")) {
7913
- if (!ul.test(r))
7982
+ if (!bl.test(r))
7914
7983
  throw E(
7915
7984
  v.INVALID_PARAM,
7916
7985
  "filePath must be a base64 image data URI"
@@ -7925,22 +7994,22 @@ function gl(r, e) {
7925
7994
  }
7926
7995
  if (t.protocol !== "http:" && t.protocol !== "https:")
7927
7996
  throw E(v.PATH_INVALID, "filePath is invalid");
7928
- if (t.origin !== n.origin || Al.test(r) && !t.pathname.includes(Nn))
7997
+ if (t.origin !== n.origin || vl.test(r) && !t.pathname.includes(Pn))
7929
7998
  throw E(
7930
7999
  v.URL_SCHEME_NOT_ALLOWED,
7931
8000
  "network image URLs are not supported"
7932
8001
  );
7933
8002
  return t.href;
7934
8003
  }
7935
- async function ml(r, e, t) {
8004
+ async function El(r, e, t) {
7936
8005
  if (r.startsWith("data:")) {
7937
- const i = dl(r);
8006
+ const i = ml(r);
7938
8007
  if ("error" in i || !i.mime.startsWith("image/")) throw Qe();
7939
- const o = Wr(i.bytes);
8008
+ const o = Lr(i.bytes);
7940
8009
  if (!o?.startsWith("image/")) throw Qe();
7941
8010
  return new Blob([i.bytes], { type: o });
7942
8011
  }
7943
- if (new URL(r).pathname.includes(Nn)) {
8012
+ if (new URL(r).pathname.includes(Pn)) {
7944
8013
  let i;
7945
8014
  try {
7946
8015
  i = await Xn(e, "fsReadFile", {
@@ -7953,11 +8022,11 @@ async function ml(r, e, t) {
7953
8022
  if (typeof i.data != "string") throw Ve();
7954
8023
  let o;
7955
8024
  try {
7956
- o = bl(i.data);
8025
+ o = xl(i.data);
7957
8026
  } catch {
7958
8027
  throw Ve();
7959
8028
  }
7960
- const a = Wr(o);
8029
+ const a = Lr(o);
7961
8030
  if (!a?.startsWith("image/")) throw Qe();
7962
8031
  return new Blob([o], { type: a });
7963
8032
  }
@@ -7975,7 +8044,7 @@ async function ml(r, e, t) {
7975
8044
  if (!s.type.toLowerCase().startsWith("image/")) throw Qe();
7976
8045
  return s;
7977
8046
  }
7978
- function bl(r) {
8047
+ function xl(r) {
7979
8048
  const e = atob(r), t = new Uint8Array(e.length);
7980
8049
  for (let n = 0; n < e.length; n += 1) t[n] = e.charCodeAt(n);
7981
8050
  return t.buffer;
@@ -7992,24 +8061,24 @@ function Qe() {
7992
8061
  "filePath must reference an image"
7993
8062
  );
7994
8063
  }
7995
- function vl(r, e) {
8064
+ function Vl(r, e) {
7996
8065
  if (!r.startsWith("data:"))
7997
8066
  try {
7998
8067
  const n = decodeURIComponent(new URL(r).pathname.split("/").pop() ?? "");
7999
- if (n && /\.(?:png|jpe?g|gif|webp)$/i.test(n)) return yl(n);
8068
+ if (n && /\.(?:png|jpe?g|gif|webp)$/i.test(n)) return Il(n);
8000
8069
  } catch {
8001
8070
  }
8002
8071
  const t = e.toLowerCase() === "image/jpeg" ? "jpg" : e.toLowerCase() === "image/gif" ? "gif" : e.toLowerCase() === "image/webp" ? "webp" : "png";
8003
8072
  return `miniapp-image-${Date.now()}.${t}`;
8004
8073
  }
8005
- function yl(r) {
8074
+ function Il(r) {
8006
8075
  return r.replace(/[\\/:*?"<>|]/g, "-");
8007
8076
  }
8008
- function wl(r, e) {
8077
+ function Ll(r, e) {
8009
8078
  const t = URL.createObjectURL(r), n = document.createElement("a");
8010
8079
  n.href = t, n.download = e, n.hidden = !0, document.body.appendChild(n), n.click(), n.remove(), window.setTimeout(() => URL.revokeObjectURL(t), 1e3);
8011
8080
  }
8012
- function Cl(r) {
8081
+ function Wl(r) {
8013
8082
  return {
8014
8083
  name: "network",
8015
8084
  handlers: {
@@ -8028,8 +8097,8 @@ function Cl(r) {
8028
8097
  }
8029
8098
  };
8030
8099
  }
8031
- const Ir = 21, Sl = 44, pe = 32, kr = 8, El = 8;
8032
- function xl() {
8100
+ const Wr = 21, kl = 44, pe = 32, kr = 8, ql = 8;
8101
+ function Bl() {
8033
8102
  return typeof window < "u" && typeof window.devicePixelRatio == "number" && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1;
8034
8103
  }
8035
8104
  function qr(r, e) {
@@ -8042,10 +8111,10 @@ function qr(r, e) {
8042
8111
  height: pe
8043
8112
  };
8044
8113
  }
8045
- function Vl(r) {
8046
- const { width: e, height: t } = r, n = Ke, s = n + (Sl - pe) / 2;
8114
+ function Tl(r) {
8115
+ const { width: e, height: t } = r, n = Ke, s = n + (kl - pe) / 2;
8047
8116
  return {
8048
- pixelRatio: xl(),
8117
+ pixelRatio: Bl(),
8049
8118
  screenWidth: e,
8050
8119
  screenHeight: t,
8051
8120
  windowWidth: e,
@@ -8056,20 +8125,20 @@ function Vl(r) {
8056
8125
  left: 0,
8057
8126
  top: n,
8058
8127
  right: e,
8059
- bottom: t - Ir,
8128
+ bottom: t - Wr,
8060
8129
  width: e,
8061
- height: t - n - Ir
8130
+ height: t - n - Wr
8062
8131
  },
8063
8132
  gestureInsets: { left: 0, right: 0, top: n, bottom: 0 },
8064
8133
  menuButtons: {
8065
8134
  back: qr(kr, s),
8066
8135
  me: null,
8067
8136
  // share 左侧依次是 more(32) + gap(8),右侧 padding 8。
8068
- share: qr(e - kr - pe * 2 - El, s)
8137
+ share: qr(e - kr - pe * 2 - ql, s)
8069
8138
  }
8070
8139
  };
8071
8140
  }
8072
- function Ll(r) {
8141
+ function Rl(r) {
8073
8142
  return {
8074
8143
  name: "system",
8075
8144
  handlers: {
@@ -8083,15 +8152,22 @@ function Ll(r) {
8083
8152
  hostOverride: "forbid"
8084
8153
  },
8085
8154
  getWindowInfo: {
8086
- handler: () => Vl(r.viewport),
8155
+ handler: () => Tl(r.viewport),
8087
8156
  hostOverride: "forbid"
8157
+ },
8158
+ // PC 预览仅确认调用成功,不采集或推送陀螺仪数据。
8159
+ startGyroscope: {
8160
+ handler: () => ({})
8161
+ },
8162
+ stopGyroscope: {
8163
+ handler: () => ({})
8088
8164
  }
8089
8165
  }
8090
8166
  };
8091
8167
  }
8092
- const Wl = "miniapp-simulator-storage", Il = 1, R = "entries", yt = "by_scope", rt = 1024 * 1024, wt = 10 * rt, Br = rt;
8093
- function kl(r) {
8094
- const e = ql({ scope: r.storageScope });
8168
+ const Fl = "miniapp-simulator-storage", Xl = 1, R = "entries", yt = "by_scope", rt = 1024 * 1024, wt = 10 * rt, Br = rt;
8169
+ function Kl(r) {
8170
+ const e = Nl({ scope: r.storageScope });
8095
8171
  return {
8096
8172
  name: "storage",
8097
8173
  handlers: Object.fromEntries(
@@ -8099,8 +8175,8 @@ function kl(r) {
8099
8175
  )
8100
8176
  };
8101
8177
  }
8102
- function ql(r) {
8103
- const e = r.scope, t = r.repository ?? Rl();
8178
+ function Nl(r) {
8179
+ const e = r.scope, t = r.repository ?? Ml();
8104
8180
  let n = Promise.resolve();
8105
8181
  const s = (i) => {
8106
8182
  const o = n.then(i, i);
@@ -8113,7 +8189,7 @@ function ql(r) {
8113
8189
  };
8114
8190
  return {
8115
8191
  setStorage: (i) => s(async () => {
8116
- const o = Ct(i), a = Bl(i), l = Tr(i), c = Tl(a), d = new TextEncoder().encode(c).byteLength;
8192
+ const o = Ct(i), a = Pl(i), l = Tr(i), c = Ol(a), d = new TextEncoder().encode(c).byteLength;
8117
8193
  if (d > Br)
8118
8194
  throw Rr(
8119
8195
  v.STORAGE_QUOTA_EXCEEDED,
@@ -8154,31 +8230,31 @@ function ql(r) {
8154
8230
  }
8155
8231
  function Ct(r) {
8156
8232
  const e = r.message.key;
8157
- if (typeof e != "string" || e.length === 0) throw Ne("key is required");
8233
+ if (typeof e != "string" || e.length === 0) throw Pe("key is required");
8158
8234
  return e;
8159
8235
  }
8160
- function Bl(r) {
8236
+ function Pl(r) {
8161
8237
  if (!("data" in r.message) || r.message.data === void 0)
8162
- throw Ne("data is required");
8238
+ throw Pe("data is required");
8163
8239
  return r.message.data;
8164
8240
  }
8165
8241
  function Tr(r) {
8166
8242
  const e = r.message.encrypt;
8167
8243
  if (e === void 0) return !1;
8168
- if (typeof e != "boolean") throw Ne("encrypt must be a boolean");
8244
+ if (typeof e != "boolean") throw Pe("encrypt must be a boolean");
8169
8245
  return e;
8170
8246
  }
8171
- function Tl(r) {
8247
+ function Ol(r) {
8172
8248
  let e;
8173
8249
  try {
8174
8250
  e = JSON.stringify(r);
8175
8251
  } catch {
8176
- throw Ne("data must be JSON serializable");
8252
+ throw Pe("data must be JSON serializable");
8177
8253
  }
8178
- if (e === void 0) throw Ne("data must be JSON serializable");
8254
+ if (e === void 0) throw Pe("data must be JSON serializable");
8179
8255
  return e;
8180
8256
  }
8181
- function Ne(r) {
8257
+ function Pe(r) {
8182
8258
  const e = new TypeError(r);
8183
8259
  return e.code = v.INVALID_PARAM, e;
8184
8260
  }
@@ -8186,10 +8262,10 @@ function Rr(r, e) {
8186
8262
  const t = new Error(e);
8187
8263
  return t.code = r, t;
8188
8264
  }
8189
- function Rl() {
8265
+ function Ml() {
8190
8266
  let r;
8191
8267
  const e = () => r || (r = new Promise((t, n) => {
8192
- const s = indexedDB.open(Wl, Il);
8268
+ const s = indexedDB.open(Fl, Xl);
8193
8269
  s.onupgradeneeded = () => {
8194
8270
  const i = s.result;
8195
8271
  if (i.objectStoreNames.contains(R)) return;
@@ -8237,7 +8313,7 @@ function Ae(r) {
8237
8313
  r.onsuccess = () => e(r.result), r.onerror = () => t(r.error ?? new Error("storage database request failed"));
8238
8314
  });
8239
8315
  }
8240
- function Fl(r, e, t) {
8316
+ function Zl(r, e, t) {
8241
8317
  const n = /* @__PURE__ */ new Set();
8242
8318
  for (const s of e)
8243
8319
  for (const [i, o] of Object.entries(s.handlers)) {
@@ -8252,7 +8328,7 @@ function Fl(r, e, t) {
8252
8328
  }
8253
8329
  }
8254
8330
  const St = "mini-app:request-manager";
8255
- class Xl {
8331
+ class Ul {
8256
8332
  constructor(e) {
8257
8333
  this.pending = /* @__PURE__ */ new Map(), this.destroyed = !1, this.handleMessage = (n) => {
8258
8334
  if (this.destroyed || n.source !== this.iframe.contentWindow) return;
@@ -8292,7 +8368,7 @@ class Xl {
8292
8368
  this.readyResolve = n;
8293
8369
  });
8294
8370
  const t = document.createElement("iframe");
8295
- t.setAttribute("sandbox", "allow-scripts"), t.setAttribute("aria-hidden", "true"), t.referrerPolicy = "no-referrer", t.style.display = "none", t.src = e.frameUrl ?? Kl(), this.iframe = t, window.addEventListener("message", this.handleMessage), e.mount.appendChild(t);
8371
+ t.setAttribute("sandbox", "allow-scripts"), t.setAttribute("aria-hidden", "true"), t.referrerPolicy = "no-referrer", t.style.display = "none", t.src = e.frameUrl ?? Dl(), this.iframe = t, window.addEventListener("message", this.handleMessage), e.mount.appendChild(t);
8296
8372
  }
8297
8373
  async execute(e) {
8298
8374
  if (this.destroyed)
@@ -8334,16 +8410,16 @@ class Xl {
8334
8410
  }
8335
8411
  }
8336
8412
  }
8337
- function Kl() {
8413
+ function Dl() {
8338
8414
  const r = {
8339
8415
  urlSchemeNotAllowed: v.URL_SCHEME_NOT_ALLOWED,
8340
8416
  timeout: v.REQUEST_TIMEOUT,
8341
8417
  aborted: v.REQUEST_ABORTED,
8342
8418
  failed: v.REQUEST_FAILED
8343
- }, t = `<!doctype html><html><head><meta charset="UTF-8"><meta name="referrer" content="no-referrer"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; connect-src https: http: ws: wss:; base-uri 'none'; form-action 'none'"></head><body><script>${`(${Pl.toString()})(${JSON.stringify(r)},${Gn.toString()},${Hn.toString()});`.replace(/<\/script/gi, "<\\/script")}<\/script></body></html>`;
8419
+ }, t = `<!doctype html><html><head><meta charset="UTF-8"><meta name="referrer" content="no-referrer"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; connect-src https: http: ws: wss:; base-uri 'none'; form-action 'none'"></head><body><script>${`(${Yl.toString()})(${JSON.stringify(r)},${Gn.toString()},${Hn.toString()});`.replace(/<\/script/gi, "<\\/script")}<\/script></body></html>`;
8344
8420
  return `data:text/html;charset=utf-8,${encodeURIComponent(t)}`;
8345
8421
  }
8346
- function Pl(r, e, t) {
8422
+ function Yl(r, e, t) {
8347
8423
  const n = "mini-app:request-manager", s = /* @__PURE__ */ new Map(), i = (u) => {
8348
8424
  parent.postMessage({ channel: n, ...u }, "*");
8349
8425
  }, o = (u) => {
@@ -8388,7 +8464,7 @@ function Pl(r, e, t) {
8388
8464
  Number.isFinite(M) && M > 0 && (g.timer = window.setTimeout(() => {
8389
8465
  g.abortReason = "timeout", p.abort();
8390
8466
  }, M));
8391
- const L = await fetch(m.href, {
8467
+ const I = await fetch(m.href, {
8392
8468
  method: w,
8393
8469
  headers: y,
8394
8470
  body: w === "GET" || w === "HEAD" ? void 0 : d(k, y),
@@ -8399,24 +8475,24 @@ function Pl(r, e, t) {
8399
8475
  throw Z instanceof TypeError && !p.signal.aborted ? new Error(
8400
8476
  `${Z.message || "request failed"}; possible CORS or network/security policy failure. Simulator requests use Origin: null. Check the server's Access-Control-Allow-Origin response header and browser DevTools Console/Network for details.`
8401
8477
  ) : Z;
8402
- }), q = o(L.headers);
8478
+ }), q = o(I.headers);
8403
8479
  if (i({
8404
8480
  type: "headers",
8405
8481
  taskId: u.taskId,
8406
- statusCode: L.status,
8482
+ statusCode: I.status,
8407
8483
  header: q
8408
- }), u.enableChunked && e(L.headers.get("content-type")) && L.body) {
8409
- const Z = L.body.getReader(), P = new TextDecoder(), x = t(), ye = (ee) => {
8484
+ }), u.enableChunked && e(I.headers.get("content-type")) && I.body) {
8485
+ const Z = I.body.getReader(), N = new TextDecoder(), x = t(), ye = (ee) => {
8410
8486
  for (const ue of x.push(ee))
8411
8487
  i({ type: "chunk", taskId: u.taskId, data: ue });
8412
8488
  };
8413
8489
  for (; ; ) {
8414
8490
  const ee = await Z.read();
8415
8491
  if (ee.done) break;
8416
- const ue = P.decode(ee.value, { stream: !0 });
8492
+ const ue = N.decode(ee.value, { stream: !0 });
8417
8493
  ue && ye(ue);
8418
8494
  }
8419
- const we = P.decode();
8495
+ const we = N.decode();
8420
8496
  we && ye(we);
8421
8497
  for (const ee of x.finish())
8422
8498
  i({ type: "chunk", taskId: u.taskId, data: ee });
@@ -8425,7 +8501,7 @@ function Pl(r, e, t) {
8425
8501
  taskId: u.taskId,
8426
8502
  data: {
8427
8503
  taskId: u.taskId,
8428
- statusCode: L.status,
8504
+ statusCode: I.status,
8429
8505
  data: "",
8430
8506
  header: q
8431
8507
  }
@@ -8433,7 +8509,7 @@ function Pl(r, e, t) {
8433
8509
  return;
8434
8510
  }
8435
8511
  let K;
8436
- const D = await L.text();
8512
+ const D = await I.text();
8437
8513
  if (u.dataType === "json")
8438
8514
  try {
8439
8515
  K = JSON.parse(D);
@@ -8447,7 +8523,7 @@ function Pl(r, e, t) {
8447
8523
  taskId: u.taskId,
8448
8524
  data: {
8449
8525
  taskId: u.taskId,
8450
- statusCode: L.status,
8526
+ statusCode: I.status,
8451
8527
  data: K,
8452
8528
  header: q
8453
8529
  }
@@ -8480,7 +8556,7 @@ function Pl(r, e, t) {
8480
8556
  }
8481
8557
  }), i({ type: "ready" });
8482
8558
  }
8483
- class Nl {
8559
+ class Gl {
8484
8560
  constructor(e) {
8485
8561
  this.options = e, this.isolatedRequest = null, this.hostRequests = /* @__PURE__ */ new Map();
8486
8562
  }
@@ -8552,7 +8628,7 @@ class Nl {
8552
8628
  this.abortAll(), this.isolatedRequest?.destroy(), this.isolatedRequest = null;
8553
8629
  }
8554
8630
  getIsolatedRequest() {
8555
- return this.isolatedRequest ? this.isolatedRequest : (this.isolatedRequest = new Xl({
8631
+ return this.isolatedRequest ? this.isolatedRequest : (this.isolatedRequest = new Ul({
8556
8632
  mount: this.options.mount,
8557
8633
  frameUrl: this.options.requestManagerFrameUrl,
8558
8634
  onHeaders: (e) => this.options.emit("onHeadersReceivedRequest", e),
@@ -8608,14 +8684,14 @@ function Fr(r) {
8608
8684
  enableChunked: e.enableChunked === !0
8609
8685
  };
8610
8686
  }
8611
- const Xr = 5, Ol = "miniapp:restore-worker-mount", Mn = "/miniapp-simulator/", Ml = 5e3, Zl = 3e4;
8687
+ const Xr = 5, Hl = "miniapp:restore-worker-mount", Mn = "/miniapp-simulator/", Ql = 5e3, zl = 3e4;
8612
8688
  function Kr() {
8613
8689
  return typeof navigator < "u" && "serviceWorker" in navigator && typeof window < "u" && window.isSecureContext === !0;
8614
8690
  }
8615
8691
  const Fe = /* @__PURE__ */ new Map();
8616
- let Pr = !1;
8617
- function Ul() {
8618
- Pr || typeof window > "u" || (Pr = !0, window.addEventListener("pagehide", () => {
8692
+ let Nr = !1;
8693
+ function Jl() {
8694
+ Nr || typeof window > "u" || (Nr = !0, window.addEventListener("pagehide", () => {
8619
8695
  for (const [r, e] of Fe)
8620
8696
  try {
8621
8697
  e.postMessage({ type: "UNMOUNT", id: r });
@@ -8628,7 +8704,7 @@ const re = class re {
8628
8704
  constructor(e, t, n, s, i) {
8629
8705
  this.sw = e, this.scope = t, this.mountTimeout = n, this.registration = s, this.scriptUrl = i, this.mountSnapshots = /* @__PURE__ */ new Map(), this.supportedFsOps = /* @__PURE__ */ new Set(), navigator.serviceWorker.addEventListener?.("message", (o) => {
8630
8706
  const a = o.data, l = o.ports[0];
8631
- if (!o.isTrusted || o.source !== this.sw || a?.type !== Ol || typeof a.id != "string" || !l)
8707
+ if (!o.isTrusted || o.source !== this.sw || a?.type !== Hl || typeof a.id != "string" || !l)
8632
8708
  return;
8633
8709
  const c = (d) => {
8634
8710
  l.postMessage({ ok: d }), l.close();
@@ -8649,8 +8725,8 @@ const re = class re {
8649
8725
  return new URL(n, new URL(this.scope, window.location.origin)).href;
8650
8726
  }
8651
8727
  /** 单例获取(固定 scope 幂等注册并等待 SW 激活)。 */
8652
- static acquire(e, t = Ml, n = Mn) {
8653
- const s = Dl(n), i = `${s}::${new URL(e, window.location.href).href}`;
8728
+ static acquire(e, t = Ql, n = Mn) {
8729
+ const s = jl(n), i = `${s}::${new URL(e, window.location.href).href}`;
8654
8730
  let o = re.instances.get(i);
8655
8731
  return o || (o = re.create(e, t, s).catch((a) => {
8656
8732
  throw re.instances.delete(i), a;
@@ -8666,15 +8742,15 @@ const re = class re {
8666
8742
  } catch (o) {
8667
8743
  console.warn("Service Worker update check failed:", o);
8668
8744
  }
8669
- const i = await Nr(s);
8670
- return Ul(), new re(i, n, t, s, e);
8745
+ const i = await Pr(s);
8746
+ return Jl(), new re(i, n, t, s, e);
8671
8747
  }
8672
8748
  /**
8673
8749
  * 挂载一个预览实例,返回可直连的同源虚拟 URL(`<scope><id>/<entryPath>`)。
8674
8750
  * SW 在返回 HTML 时按 `injectHead` 改写 `<head>`、按 `csp` 下发响应头。
8675
8751
  */
8676
8752
  async mount(e) {
8677
- const t = Hl(e);
8753
+ const t = ec(e);
8678
8754
  try {
8679
8755
  await this.sendMount(e, e.rawFiles);
8680
8756
  } catch (n) {
@@ -8700,16 +8776,16 @@ const re = class re {
8700
8776
  try {
8701
8777
  return await this.sendFsRequest(e, t, n);
8702
8778
  } catch (s) {
8703
- if (!Yl(s, "ERR_NOT_MOUNTED") || !this.mountSnapshots.has(e))
8779
+ if (!_l(s, "ERR_NOT_MOUNTED") || !this.mountSnapshots.has(e))
8704
8780
  throw s;
8705
8781
  return await this.restoreMount(e), this.sendFsRequest(e, t, n);
8706
8782
  }
8707
8783
  }
8708
8784
  async sendFsRequest(e, t, n) {
8709
- const s = Gl(), i = await this.postWithAck(
8785
+ const s = $l(), i = await this.postWithAck(
8710
8786
  { type: "FS", op: t, id: e, reqId: s, ...n },
8711
8787
  [],
8712
- Zl
8788
+ zl
8713
8789
  );
8714
8790
  if (i.type !== "FS_ACK" || i.id !== e || i.op !== t || i.reqId !== s)
8715
8791
  throw new Error("invalid service worker file system response");
@@ -8784,7 +8860,7 @@ const re = class re {
8784
8860
  } catch (n) {
8785
8861
  console.warn("Service Worker update check failed:", n);
8786
8862
  }
8787
- this.registration = t, this.sw = await Nr(t);
8863
+ this.registration = t, this.sw = await Pr(t);
8788
8864
  }
8789
8865
  /** 校验注册确属我们的实例(scope 精确匹配),排除宿主根 scope SW 的最长前缀回退命中。 */
8790
8866
  isOurRegistration(e) {
@@ -8798,23 +8874,23 @@ const re = class re {
8798
8874
  };
8799
8875
  re.instances = /* @__PURE__ */ new Map();
8800
8876
  let Xt = re;
8801
- function Dl(r) {
8877
+ function jl(r) {
8802
8878
  const e = new URL(r || Mn, window.location.origin);
8803
8879
  if (e.origin !== window.location.origin)
8804
8880
  throw new Error("service worker scope must be same-origin");
8805
8881
  return e.pathname.endsWith("/") ? e.pathname : `${e.pathname}/`;
8806
8882
  }
8807
- function Yl(r, e) {
8883
+ function _l(r, e) {
8808
8884
  return r instanceof Error && r.code === e;
8809
8885
  }
8810
- function Gl() {
8886
+ function $l() {
8811
8887
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
8812
8888
  return crypto.randomUUID().replace(/-/g, "");
8813
8889
  let r = "";
8814
8890
  for (let e = 0; e < 32; e++) r += Math.floor(Math.random() * 16).toString(16);
8815
8891
  return r;
8816
8892
  }
8817
- function Hl(r) {
8893
+ function ec(r) {
8818
8894
  return {
8819
8895
  ...r,
8820
8896
  rawFiles: Kt(r.rawFiles),
@@ -8830,7 +8906,7 @@ function Kt(r) {
8830
8906
  e[t] = n.slice(0);
8831
8907
  return e;
8832
8908
  }
8833
- function Nr(r) {
8909
+ function Pr(r) {
8834
8910
  return new Promise((e, t) => {
8835
8911
  const n = r.installing ?? r.waiting, s = n ?? r.active;
8836
8912
  if (!s) {
@@ -8852,41 +8928,41 @@ function Zn(r, e) {
8852
8928
  const t = e ?? Oe;
8853
8929
  return t.includes("/") ? null : r.includes(t) ? t : null;
8854
8930
  }
8855
- const Ql = /\.(png|jpe?g|gif|svg|webp|ico|bmp|woff2?|ttf|otf|eot|mp4|m4v|webm|ogv|mov|mp3|m4a|aac|wav|flac|oga|ogg|opus)$/i, zl = /\.(?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$/i, jl = {
8931
+ const tc = /\.(png|jpe?g|gif|svg|webp|ico|bmp|woff2?|ttf|otf|eot|mp4|m4v|webm|ogv|mov|mp3|m4a|aac|wav|flac|oga|ogg|opus)$/i, rc = /\.(?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$/i, nc = {
8856
8932
  maxZipBytes: 50 * 1024 * 1024,
8857
8933
  maxSingleFileBytes: 15 * 1024 * 1024,
8858
8934
  maxScriptBytes: 15 * 1024 * 1024
8859
8935
  };
8860
8936
  function Un(r) {
8861
- return r === !1 ? null : { ...jl, ...r };
8937
+ return r === !1 ? null : { ...nc, ...r };
8862
8938
  }
8863
- function Pt(r) {
8864
- throw new I("PACKAGE_LIMIT_EXCEEDED", `小应用包超过安全上限:${r}`);
8939
+ function Nt(r) {
8940
+ throw new W("PACKAGE_LIMIT_EXCEEDED", `小应用包超过安全上限:${r}`);
8865
8941
  }
8866
- function Nt(r, e, t) {
8867
- t && (zl.test(r) && e > t.maxScriptBytes && Pt(`${r} 为 ${e} bytes,脚本上限为 ${t.maxScriptBytes} bytes`), e > t.maxSingleFileBytes && Pt(`${r} 为 ${e} bytes,单文件上限为 ${t.maxSingleFileBytes} bytes`));
8942
+ function Pt(r, e, t) {
8943
+ t && (rc.test(r) && e > t.maxScriptBytes && Nt(`${r} 为 ${e} bytes,脚本上限为 ${t.maxScriptBytes} bytes`), e > t.maxSingleFileBytes && Nt(`${r} 为 ${e} bytes,单文件上限为 ${t.maxSingleFileBytes} bytes`));
8868
8944
  }
8869
- function Jl(r) {
8945
+ function sc(r) {
8870
8946
  return r instanceof ArrayBuffer || r instanceof Uint8Array ? r.byteLength : r.size;
8871
8947
  }
8872
- function _l(r) {
8948
+ function ic(r) {
8873
8949
  if (r && typeof r.loadAsync == "function") return r;
8874
8950
  const e = typeof globalThis < "u" ? globalThis : void 0;
8875
8951
  if (e?.JSZip && typeof e.JSZip.loadAsync == "function") return e.JSZip;
8876
- throw new I(
8952
+ throw new W(
8877
8953
  "ZIP_LOAD_FAILED",
8878
8954
  "JSZip 不可用:请通过 loadZip(source, { jszip }) 传入 JSZip,或在全局挂载 window.JSZip(CDN/UMD)"
8879
8955
  );
8880
8956
  }
8881
- async function $l(r, e = {}) {
8882
- const t = Un(e.limits), n = Jl(r);
8883
- t && n > t.maxZipBytes && Pt(`压缩包为 ${n} bytes,压缩包上限为 ${t.maxZipBytes} bytes`);
8884
- const s = _l(e.jszip);
8957
+ async function oc(r, e = {}) {
8958
+ const t = Un(e.limits), n = sc(r);
8959
+ t && n > t.maxZipBytes && Nt(`压缩包为 ${n} bytes,压缩包上限为 ${t.maxZipBytes} bytes`);
8960
+ const s = ic(e.jszip);
8885
8961
  let i;
8886
8962
  try {
8887
8963
  i = await s.loadAsync(r);
8888
8964
  } catch (m) {
8889
- throw new I("ZIP_LOAD_FAILED", "ZIP 解压失败", { cause: m });
8965
+ throw new W("ZIP_LOAD_FAILED", "ZIP 解压失败", { cause: m });
8890
8966
  }
8891
8967
  const o = [];
8892
8968
  i.forEach((m, w) => {
@@ -8896,27 +8972,27 @@ async function $l(r, e = {}) {
8896
8972
  });
8897
8973
  for (const { path: m, entry: w } of o) {
8898
8974
  const y = w._data?.uncompressedSize;
8899
- typeof y == "number" && Nt(m, y, t);
8975
+ typeof y == "number" && Pt(m, y, t);
8900
8976
  }
8901
8977
  const a = e.entry ? _e(e.entry) ?? e.entry : void 0, l = Zn(
8902
8978
  o.map((m) => m.path),
8903
8979
  a
8904
8980
  );
8905
8981
  if (!l)
8906
- throw new I(
8982
+ throw new W(
8907
8983
  "ZIP_NO_ENTRY",
8908
8984
  `入口文件「${e.entry ?? Oe}」必须位于 zip 根目录(不支持放在子目录)`
8909
8985
  );
8910
8986
  if (!new Map(o.map((m) => [m.path, m.entry])).get(l))
8911
- throw new I("ZIP_NO_ENTRY", `ZIP 包内未找到入口文件「${l}」`);
8987
+ throw new W("ZIP_NO_ENTRY", `ZIP 包内未找到入口文件「${l}」`);
8912
8988
  const h = {}, u = [];
8913
8989
  for (const { path: m, entry: w } of o) {
8914
8990
  const y = await w.async("arraybuffer");
8915
- Nt(m, y.byteLength, t), u.push({ path: m, size: y.byteLength }), h[m] = y;
8991
+ Pt(m, y.byteLength, t), u.push({ path: m, size: y.byteLength }), h[m] = y;
8916
8992
  }
8917
8993
  const p = h[l];
8918
8994
  if (!p)
8919
- throw new I("ZIP_NO_ENTRY", `ZIP 包内未找到入口文件「${l}」`);
8995
+ throw new W("ZIP_NO_ENTRY", `ZIP 包内未找到入口文件「${l}」`);
8920
8996
  const g = new TextDecoder("utf-8").decode(new Uint8Array(p));
8921
8997
  return {
8922
8998
  entryPath: l,
@@ -8925,29 +9001,29 @@ async function $l(r, e = {}) {
8925
9001
  files: u
8926
9002
  };
8927
9003
  }
8928
- function ec(r, e = {}) {
8929
- const t = tc(r), n = Un(e.limits), s = e.entry ? _e(e.entry) ?? e.entry : void 0, i = Zn([...t.keys()], s);
9004
+ function ac(r, e = {}) {
9005
+ const t = lc(r), n = Un(e.limits), s = e.entry ? _e(e.entry) ?? e.entry : void 0, i = Zn([...t.keys()], s);
8930
9006
  if (!i)
8931
- throw new I(
9007
+ throw new W(
8932
9008
  "FILES_NO_ENTRY",
8933
9009
  `入口文件「${e.entry ?? Oe}」必须位于文件表根目录(不支持放在子目录)`
8934
9010
  );
8935
9011
  const o = t.get(i);
8936
9012
  if (o === void 0)
8937
- throw new I("FILES_NO_ENTRY", `文件表中未找到入口文件「${i}」`);
9013
+ throw new W("FILES_NO_ENTRY", `文件表中未找到入口文件「${i}」`);
8938
9014
  const a = {}, l = [];
8939
9015
  for (const [c, d] of t) {
8940
- const h = sc(c, d);
8941
- Nt(c, h.byteLength, n), l.push({ path: c, size: h.byteLength }), a[c] = h;
9016
+ const h = uc(c, d);
9017
+ Pt(c, h.byteLength, n), l.push({ path: c, size: h.byteLength }), a[c] = h;
8942
9018
  }
8943
9019
  return {
8944
9020
  entryPath: i,
8945
- entryHtml: rc(o),
9021
+ entryHtml: cc(o),
8946
9022
  rawFiles: a,
8947
9023
  files: l
8948
9024
  };
8949
9025
  }
8950
- function tc(r) {
9026
+ function lc(r) {
8951
9027
  const e = /* @__PURE__ */ new Map();
8952
9028
  for (const [t, n] of Object.entries(r)) {
8953
9029
  const s = _e(t);
@@ -8958,15 +9034,15 @@ function tc(r) {
8958
9034
  function Dn(r) {
8959
9035
  return r instanceof Uint8Array ? r : new Uint8Array(r);
8960
9036
  }
8961
- function rc(r) {
9037
+ function cc(r) {
8962
9038
  return typeof r == "string" ? r : new TextDecoder("utf-8").decode(Dn(r));
8963
9039
  }
8964
- function nc(r) {
9040
+ function dc(r) {
8965
9041
  return r.byteOffset === 0 && r.byteLength === r.buffer.byteLength ? r.buffer : r.slice().buffer;
8966
9042
  }
8967
- function sc(r, e) {
8968
- if (typeof e != "string") return nc(Dn(e));
8969
- if (Ql.test(r)) {
9043
+ function uc(r, e) {
9044
+ if (typeof e != "string") return dc(Dn(e));
9045
+ if (tc.test(r)) {
8970
9046
  if (e.startsWith("data:")) {
8971
9047
  const n = e.indexOf(","), s = e.slice(0, n), i = e.slice(n + 1);
8972
9048
  return /;base64/i.test(s) ? Or(i) : new TextEncoder().encode(decodeURIComponent(i)).buffer;
@@ -8982,7 +9058,7 @@ function Or(r) {
8982
9058
  return t.buffer;
8983
9059
  }
8984
9060
  async function Mr(r, e, t, n, s, i, o, a, l, c) {
8985
- const d = Ci(), u = await bs(e, {
9061
+ const d = Si(), u = await vs(e, {
8986
9062
  workerGuard: c,
8987
9063
  rendererType: "iframe",
8988
9064
  options: r,
@@ -9003,7 +9079,7 @@ async function Mr(r, e, t, n, s, i, o, a, l, c) {
9003
9079
  });
9004
9080
  return { head: u, csp: p };
9005
9081
  }
9006
- class ic extends No {
9082
+ class Ac extends Uo {
9007
9083
  async load(e) {
9008
9084
  try {
9009
9085
  await this.ctx.rendererContext.restoreServiceWorkerMount?.(e);
@@ -9017,7 +9093,7 @@ class ic extends No {
9017
9093
  return super.load(e);
9018
9094
  }
9019
9095
  }
9020
- const oc = {
9096
+ const hc = {
9021
9097
  album: {
9022
9098
  kind: "album",
9023
9099
  title: "你的相册照片与视频",
@@ -9033,16 +9109,16 @@ const oc = {
9033
9109
  title: "设备麦克风",
9034
9110
  description: "用于录制音频,供小工具实时识别或处理"
9035
9111
  }
9036
- }, ac = [
9112
+ }, pc = [
9037
9113
  "album",
9038
9114
  "camera",
9039
9115
  "microphone"
9040
- ], lc = "小工具申请使用以下权限", cc = "取消", dc = "同意授权";
9041
- function uc(r) {
9042
- return r.map((e) => oc[e]);
9116
+ ], fc = "小工具申请使用以下权限", gc = "取消", mc = "同意授权";
9117
+ function bc(r) {
9118
+ return r.map((e) => hc[e]);
9043
9119
  }
9044
9120
  const Ot = "miniapp-permission-sheet";
9045
- class Ac extends HTMLElement {
9121
+ class vc extends HTMLElement {
9046
9122
  constructor() {
9047
9123
  super(...arguments), this._backdropEl = null, this._panelEl = null, this._listEl = null, this._resolve = null;
9048
9124
  }
@@ -9082,7 +9158,7 @@ class Ac extends HTMLElement {
9082
9158
  this._listEl.innerHTML = "";
9083
9159
  for (const t of e) {
9084
9160
  const n = document.createElement("li");
9085
- n.className = "perm-item", n.innerHTML = `<span class="perm-dot" aria-hidden="true"></span><div class="perm-text"><div class="perm-title">${Le(t.title)}</div><div class="perm-desc">${Le(t.description)}</div></div>`, this._listEl.appendChild(n);
9161
+ n.className = "perm-item", n.innerHTML = `<span class="perm-dot" aria-hidden="true"></span><div class="perm-text"><div class="perm-title">${Ie(t.title)}</div><div class="perm-desc">${Ie(t.description)}</div></div>`, this._listEl.appendChild(n);
9086
9162
  }
9087
9163
  }
9088
9164
  }
@@ -9215,11 +9291,11 @@ class Ac extends HTMLElement {
9215
9291
  </style>
9216
9292
  <div class="backdrop" part="backdrop"></div>
9217
9293
  <div class="panel" part="panel">
9218
- <h2 class="title">${Le(lc)}</h2>
9294
+ <h2 class="title">${Ie(fc)}</h2>
9219
9295
  <ul class="list"></ul>
9220
9296
  <div class="actions">
9221
- <button type="button" class="btn btn-cancel">${Le(cc)}</button>
9222
- <button type="button" class="btn btn-grant">${Le(dc)}</button>
9297
+ <button type="button" class="btn btn-cancel">${Ie(gc)}</button>
9298
+ <button type="button" class="btn btn-grant">${Ie(mc)}</button>
9223
9299
  </div>
9224
9300
  </div>
9225
9301
  `, this._backdropEl = this.shadowRoot.querySelector(".backdrop"), this._panelEl = this.shadowRoot.querySelector(".panel"), this._listEl = this.shadowRoot.querySelector(".list"), this.shadowRoot.querySelector(".btn-cancel")?.addEventListener("click", () => {
@@ -9231,27 +9307,27 @@ class Ac extends HTMLElement {
9231
9307
  }), this.syncOpenAttr());
9232
9308
  }
9233
9309
  }
9234
- function Le(r) {
9310
+ function Ie(r) {
9235
9311
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
9236
9312
  }
9237
9313
  let Zr = !1;
9238
9314
  function Yn() {
9239
- Zr || typeof customElements > "u" || (customElements.get(Ot) || customElements.define(Ot, Ac), Zr = !0);
9315
+ Zr || typeof customElements > "u" || (customElements.get(Ot) || customElements.define(Ot, vc), Zr = !0);
9240
9316
  }
9241
- function hc() {
9317
+ function yc() {
9242
9318
  return Yn(), document.createElement(Ot);
9243
9319
  }
9244
- class pc {
9320
+ class wc {
9245
9321
  constructor(e, t = {}) {
9246
- this.mountEl = e, this.options = t, this.sheet = hc(), this.mounted = !1, Yn();
9322
+ this.mountEl = e, this.options = t, this.sheet = yc(), this.mounted = !1, Yn();
9247
9323
  }
9248
9324
  mount() {
9249
9325
  this.mounted || (this.mountEl.appendChild(this.sheet), this.mounted = !0);
9250
9326
  }
9251
9327
  show(e = {}) {
9252
9328
  this.mount();
9253
- const t = e.kinds ?? [...ac];
9254
- return this.options.onOpenChange?.(!0), this.sheet.present(uc(t)).finally(() => {
9329
+ const t = e.kinds ?? [...pc];
9330
+ return this.options.onOpenChange?.(!0), this.sheet.present(bc(t)).finally(() => {
9255
9331
  this.options.onOpenChange?.(!1);
9256
9332
  });
9257
9333
  }
@@ -9262,7 +9338,7 @@ class pc {
9262
9338
  this.hide(), this.sheet.remove(), this.mounted = !1;
9263
9339
  }
9264
9340
  }
9265
- class fc extends wn {
9341
+ class Cc extends wn {
9266
9342
  constructor(e) {
9267
9343
  super(), this.frame = null, this.overlay = null, this.container = null, this.contentRoot = null, this.rednoteShell = null, this.contentHost = null, this.currentUrl = "", this.bridge = null, this.permissionSheetHost = null, this.notePublishHost = null, this.frameToastHost = null, this.detachFramelessShellWindowSync = null, this.detachContentPcGuard = null, this.forwardEmit = (t, n) => {
9268
9344
  this.emit(t, n);
@@ -9305,11 +9381,11 @@ class fc extends wn {
9305
9381
  };
9306
9382
  this.contentHost = this.createContentHost(s), n.appendChild(this.contentHost.element), this.contentHost.afterAttached();
9307
9383
  }
9308
- this.permissionSheetHost = new pc(this.contentRoot, {
9384
+ this.permissionSheetHost = new wc(this.contentRoot, {
9309
9385
  onOpenChange: (s) => {
9310
9386
  this.contentHost?.setGestureOverlayInteractionEnabled?.(!s);
9311
9387
  }
9312
- }), this.permissionSheetHost.mount(), this.notePublishHost = new Ya(this.contentRoot, {
9388
+ }), this.permissionSheetHost.mount(), this.notePublishHost = new _a(this.contentRoot, {
9313
9389
  onOpenChange: (s) => {
9314
9390
  this.contentHost?.setGestureOverlayInteractionEnabled?.(!s);
9315
9391
  }
@@ -9428,13 +9504,13 @@ class fc extends wn {
9428
9504
  this.viewport = e;
9429
9505
  const t = this.context.phoneFrame;
9430
9506
  if (this.chromeless && !t)
9431
- Wt(this.container), It(this.contentRoot), this.container.style.position = "relative", this.container.style.width = `${e.width}px`, this.container.style.height = `${e.height}px`, this.contentRoot.style.width = `${e.width}px`, this.contentRoot.style.height = `${e.height}px`, this.contentRoot.style.borderRadius = "", this.contentRoot.style.transform = "", this.contentRoot.style.transformOrigin = "";
9507
+ Lt(this.container), Wt(this.contentRoot), this.container.style.position = "relative", this.container.style.width = `${e.width}px`, this.container.style.height = `${e.height}px`, this.contentRoot.style.width = `${e.width}px`, this.contentRoot.style.height = `${e.height}px`, this.contentRoot.style.borderRadius = "", this.contentRoot.style.transform = "", this.contentRoot.style.transformOrigin = "";
9432
9508
  else if (t) {
9433
- Wt(this.container), It(this.contentRoot), this.container.style.position = "relative", this.container.style.width = `${t.width}px`, this.container.style.height = `${t.height}px`, this.frame && (this.frame.style.left = `${t.screen.x}px`, this.frame.style.top = `${t.screen.y}px`, this.frame.style.width = `${t.screen.width}px`, this.frame.style.height = `${t.screen.height}px`);
9509
+ Lt(this.container), Wt(this.contentRoot), this.container.style.position = "relative", this.container.style.width = `${t.width}px`, this.container.style.height = `${t.height}px`, this.frame && (this.frame.style.left = `${t.screen.x}px`, this.frame.style.top = `${t.screen.y}px`, this.frame.style.width = `${t.screen.width}px`, this.frame.style.height = `${t.screen.height}px`);
9434
9510
  const n = t.screen.width / e.width, s = t.screen.height / e.height;
9435
9511
  this.contentRoot.style.width = `${e.width}px`, this.contentRoot.style.height = `${e.height}px`, this.contentRoot.style.transformOrigin = "top left", this.contentRoot.style.transform = `scale(${n}, ${s})`;
9436
9512
  } else {
9437
- const n = Jt(this.container, e);
9513
+ const n = jt(this.container, e);
9438
9514
  _t(this.contentRoot, n), this.contentRoot.style.width = `${e.width}px`, this.contentRoot.style.height = `${e.height}px`, this.contentRoot.style.transform = "", this.contentRoot.style.transformOrigin = "";
9439
9515
  }
9440
9516
  this.rednoteShell?.onResize(e), this.contentHost?.resize(e);
@@ -9480,27 +9556,27 @@ class fc extends wn {
9480
9556
  return t ? (this.frame = document.createElement("div"), this.frame.style.position = "absolute", this.frame.style.overflow = "hidden", this.frame.style.borderRadius = `${t.screen.cornerRadius ?? 42}px`, this.frame.style.background = "#fff", e.appendChild(this.frame), this.overlay = document.createElement("div"), this.overlay.style.position = "absolute", this.overlay.style.inset = "0", this.overlay.style.backgroundImage = `url("${t.imageUrl}")`, this.overlay.style.backgroundRepeat = "no-repeat", this.overlay.style.backgroundSize = "100% 100%", this.overlay.style.pointerEvents = "none", this.overlay.style.zIndex = "1", e.appendChild(this.overlay), this.frame) : e;
9481
9557
  }
9482
9558
  }
9483
- class gc extends fc {
9559
+ class Sc extends Cc {
9484
9560
  createContentHost(e) {
9485
- return new ic(e);
9561
+ return new Ac(e);
9486
9562
  }
9487
9563
  }
9488
- function mc(r) {
9564
+ function Ec(r) {
9489
9565
  return new Promise((e, t) => {
9490
9566
  const n = new FileReader();
9491
9567
  n.onload = () => e(String(n.result)), n.onerror = () => t(n.error ?? new Error("failed to read captured blob")), n.readAsDataURL(r);
9492
9568
  });
9493
9569
  }
9494
- function bc(r) {
9570
+ function xc(r) {
9495
9571
  return new Promise((e) => {
9496
9572
  const t = new Image();
9497
9573
  t.onload = () => e({ width: t.width, height: t.height }), t.onerror = () => e(null), t.src = r;
9498
9574
  });
9499
9575
  }
9500
- async function vc(r, e) {
9576
+ async function Vc(r, e) {
9501
9577
  try {
9502
- const t = await mc(r);
9503
- return await yc(t, e);
9578
+ const t = await Ec(r);
9579
+ return await Ic(t, e);
9504
9580
  } catch (t) {
9505
9581
  return {
9506
9582
  success: !1,
@@ -9509,8 +9585,8 @@ async function vc(r, e) {
9509
9585
  };
9510
9586
  }
9511
9587
  }
9512
- async function yc(r, e) {
9513
- const t = await bc(r);
9588
+ async function Ic(r, e) {
9589
+ const t = await xc(r);
9514
9590
  return t ? {
9515
9591
  success: !0,
9516
9592
  base64: r,
@@ -9523,8 +9599,8 @@ async function yc(r, e) {
9523
9599
  reason: "截图内容解码失败,无法生成图片"
9524
9600
  };
9525
9601
  }
9526
- const wc = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 6h10M1 6l2.5-2.5M1 6l2.5 2.5M11 6l-2.5-2.5M11 6l-2.5 2.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>', Cc = `<span style="display:inline-flex;align-items:center;justify-content:center;transform:rotate(-45deg);transform-origin:center">${wc}</span>`;
9527
- function Sc(r) {
9602
+ const Lc = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 6h10M1 6l2.5-2.5M1 6l2.5 2.5M11 6l-2.5-2.5M11 6l-2.5 2.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>', Wc = `<span style="display:inline-flex;align-items:center;justify-content:center;transform:rotate(-45deg);transform-origin:center">${Lc}</span>`;
9603
+ function kc(r) {
9528
9604
  r.className = "miniapp-simulator-resize-handle", Object.assign(r.style, {
9529
9605
  position: "absolute",
9530
9606
  width: "22px",
@@ -9545,7 +9621,7 @@ function Sc(r) {
9545
9621
  transition: "background 0.15s"
9546
9622
  });
9547
9623
  }
9548
- function Ec(r, e) {
9624
+ function qc(r, e) {
9549
9625
  const t = e.bounds;
9550
9626
  let n = e.scaleMultiplier;
9551
9627
  const s = {
@@ -9557,20 +9633,20 @@ function Ec(r, e) {
9557
9633
  };
9558
9634
  getComputedStyle(r).position === "static" && (r.style.position = "absolute"), r.style.left = "50%", e.centerInBounds ? (r.style.top = "50%", r.style.transformOrigin = "center center") : (r.style.top = `${e.contentTop}px`, r.style.transformOrigin = "top center");
9559
9635
  const o = e.resizeHandle ? document.createElement("div") : null;
9560
- o && (Sc(o), o.innerHTML = Cc, o.title = "左右拖拽调整大小", t.appendChild(o));
9636
+ o && (kc(o), o.innerHTML = Wc, o.title = "左右拖拽调整大小", t.appendChild(o));
9561
9637
  let a = !1, l = 0, c = n;
9562
- const d = (y, k, M, L, q) => {
9638
+ const d = (y, k, M, I, q) => {
9563
9639
  if (!o) return;
9564
- const K = 22, D = 4, Z = y / 2 + M * q / 2, P = e.centerInBounds ? k / 2 - L * q / 2 + e.handleTop : e.handleTop, x = Math.min(Z - D - K, y - K - 4);
9565
- o.style.left = `${Math.max(0, x)}px`, o.style.top = `${Math.max(0, P)}px`;
9640
+ const K = 22, D = 4, Z = y / 2 + M * q / 2, N = e.centerInBounds ? k / 2 - I * q / 2 + e.handleTop : e.handleTop, x = Math.min(Z - D - K, y - K - 4);
9641
+ o.style.left = `${Math.max(0, x)}px`, o.style.top = `${Math.max(0, N)}px`;
9566
9642
  }, h = () => {
9567
9643
  const y = r.offsetWidth, k = r.offsetHeight;
9568
9644
  if (!y || !k) return;
9569
- const { top: M, right: L, bottom: q, left: K } = e.padding, D = Math.max(0, t.clientWidth - K - L), Z = Math.max(0, t.clientHeight - M - q);
9645
+ const { top: M, right: I, bottom: q, left: K } = e.padding, D = Math.max(0, t.clientWidth - K - I), Z = Math.max(0, t.clientHeight - M - q);
9570
9646
  if (D === 0 || Z === 0) return;
9571
- const P = Math.min(D / y, Z / k);
9572
- let x = P * n;
9573
- e.capToBounds && (x = Math.min(x, P)), x = Math.min(x, e.maxScale), x = Math.max(x, e.minScale), r.style.position = "absolute", r.style.left = "50%", e.centerInBounds && (r.style.top = "50%", r.style.transformOrigin = "center center"), r.style.transform = e.centerInBounds ? `translate(-50%, -50%) scale(${x})` : `translateX(-50%) scale(${x})`, d(t.clientWidth, t.clientHeight, y, k, x);
9647
+ const N = Math.min(D / y, Z / k);
9648
+ let x = N * n;
9649
+ e.capToBounds && (x = Math.min(x, N)), x = Math.min(x, e.maxScale), x = Math.max(x, e.minScale), r.style.position = "absolute", r.style.left = "50%", e.centerInBounds && (r.style.top = "50%", r.style.transformOrigin = "center center"), r.style.transform = e.centerInBounds ? `translate(-50%, -50%) scale(${x})` : `translateX(-50%) scale(${x})`, d(t.clientWidth, t.clientHeight, y, k, x);
9574
9650
  }, u = () => {
9575
9651
  h();
9576
9652
  }, p = new ResizeObserver(u);
@@ -9591,15 +9667,15 @@ function Ec(r, e) {
9591
9667
  p.disconnect(), window.removeEventListener("resize", u), window.removeEventListener("mousemove", g, !0), window.removeEventListener("mouseup", m, !0), o && (o.removeEventListener("mousedown", w), o.remove()), r.style.position = s.position, r.style.left = s.left, r.style.top = s.top, r.style.transform = s.transform, r.style.transformOrigin = s.transformOrigin;
9592
9668
  };
9593
9669
  }
9594
- function xc(r, e) {
9670
+ function Bc(r, e) {
9595
9671
  if (r?.enabled === !0)
9596
9672
  return {
9597
- protocolVersion: ns,
9673
+ protocolVersion: ss,
9598
9674
  sessionId: e,
9599
9675
  enabled: !0
9600
9676
  };
9601
9677
  }
9602
- function Vc(r) {
9678
+ function Tc(r) {
9603
9679
  const { hostApiMap: e, getRenderer: t } = r;
9604
9680
  return {
9605
9681
  set: (n, s) => {
@@ -9620,7 +9696,7 @@ function Vc(r) {
9620
9696
  }
9621
9697
  };
9622
9698
  }
9623
- function Lc(r) {
9699
+ function Rc(r) {
9624
9700
  const { gesturePlugins: e, getRenderer: t } = r;
9625
9701
  return {
9626
9702
  dispatch: (n) => {
@@ -9641,7 +9717,7 @@ function Lc(r) {
9641
9717
  }
9642
9718
  };
9643
9719
  }
9644
- function Wc(r) {
9720
+ function Fc(r) {
9645
9721
  const e = (t, n) => {
9646
9722
  const s = r.getRenderer();
9647
9723
  return s?.invokeGamePlaytest ? s.invokeGamePlaytest(t, n) : Promise.reject(new Error("Current renderer does not support game playtest"));
@@ -9655,7 +9731,7 @@ function Wc(r) {
9655
9731
  isAvailable: async () => await e("isAvailable") === !0
9656
9732
  };
9657
9733
  }
9658
- function Ic(r) {
9734
+ function Xc(r) {
9659
9735
  const { getRenderer: e, isEnabled: t, setEnabled: n, getSelectionMode: s, setSelectionMode: i, emitChange: o } = r, a = {
9660
9736
  enable() {
9661
9737
  t() || (n(!0), e()?.enableInspector?.(), o(!0));
@@ -9681,7 +9757,7 @@ function Ic(r) {
9681
9757
  };
9682
9758
  return a;
9683
9759
  }
9684
- function kc(r) {
9760
+ function Kc(r) {
9685
9761
  const { getRenderer: e } = r;
9686
9762
  return {
9687
9763
  show: async (t) => {
@@ -9696,7 +9772,7 @@ function kc(r) {
9696
9772
  }
9697
9773
  };
9698
9774
  }
9699
- function qc(r) {
9775
+ function Nc(r) {
9700
9776
  const { getOptions: e, setOptions: t, syncRednote: n } = r, s = (i) => {
9701
9777
  const o = e();
9702
9778
  t({
@@ -9719,7 +9795,7 @@ function qc(r) {
9719
9795
  }
9720
9796
  };
9721
9797
  }
9722
- function Bc(r) {
9798
+ function Pc(r) {
9723
9799
  const { getOptions: e, setOptions: t, syncWidgetCover: n } = r;
9724
9800
  return {
9725
9801
  update: (i) => {
@@ -9731,14 +9807,14 @@ function Bc(r) {
9731
9807
  }
9732
9808
  };
9733
9809
  }
9734
- const Tc = {
9810
+ const Oc = {
9735
9811
  idle: ["loading", "destroyed"],
9736
9812
  loading: ["ready", "error", "destroyed"],
9737
9813
  ready: ["loading", "destroyed"],
9738
9814
  error: ["loading", "destroyed"],
9739
9815
  destroyed: []
9740
9816
  };
9741
- class Rc {
9817
+ class Mc {
9742
9818
  constructor() {
9743
9819
  this.current = "idle";
9744
9820
  }
@@ -9747,8 +9823,8 @@ class Rc {
9747
9823
  }
9748
9824
  transitionTo(e) {
9749
9825
  if (this.current !== e) {
9750
- if (!Tc[this.current].includes(e))
9751
- throw new I(
9826
+ if (!Oc[this.current].includes(e))
9827
+ throw new W(
9752
9828
  this.current === "destroyed" ? "DESTROYED" : "RENDERER_ERROR",
9753
9829
  `Invalid simulator state transition: ${this.current} -> ${e}`
9754
9830
  );
@@ -9757,22 +9833,22 @@ class Rc {
9757
9833
  }
9758
9834
  assertActive() {
9759
9835
  if (this.current === "destroyed")
9760
- throw new I("DESTROYED", "Mini app simulator has been destroyed");
9836
+ throw new W("DESTROYED", "Mini app simulator has been destroyed");
9761
9837
  }
9762
9838
  }
9763
9839
  const Ur = {
9764
9840
  maxHeapUsedBytes: 1 * 1024 * 1024 * 1024,
9765
9841
  heapSampleIntervalMs: 1e3
9766
- }, Fc = { width: 390, height: 844 }, Dr = {
9842
+ }, Zc = { width: 390, height: 844 }, Dr = {
9767
9843
  "iphone-15-pro": { width: 390, height: 844 },
9768
9844
  "iphone-15-pro-max": { width: 430, height: 932 },
9769
9845
  "ipad-pro": { width: 768, height: 1024 },
9770
9846
  pc: { width: 1280, height: 720 }
9771
9847
  };
9772
- function Xc(r, e) {
9773
- return e || (r && Dr[r] ? Dr[r] : Fc);
9848
+ function Uc(r, e) {
9849
+ return e || (r && Dr[r] ? Dr[r] : Zc);
9774
9850
  }
9775
- const Kc = {
9851
+ const Dc = {
9776
9852
  "iphone-14-pro-max": {
9777
9853
  id: "iphone-14-pro-max",
9778
9854
  name: "iPhone 14 Pro Max",
@@ -9802,22 +9878,22 @@ const Kc = {
9802
9878
  }
9803
9879
  }
9804
9880
  };
9805
- function Pc(r) {
9881
+ function Yc(r) {
9806
9882
  if (r)
9807
- return typeof r != "string" ? r : Kc[r];
9883
+ return typeof r != "string" ? r : Dc[r];
9808
9884
  }
9809
- const Nc = ["default-src", "script-src", "connect-src", "worker-src", "child-src"];
9810
- function Oc(r) {
9885
+ const Gc = ["default-src", "script-src", "connect-src", "worker-src", "child-src"];
9886
+ function Hc(r) {
9811
9887
  if (!r || typeof r != "object" || Array.isArray(r)) return;
9812
9888
  const e = {};
9813
9889
  for (const [t, n] of Object.entries(r)) {
9814
- if (!Nc.includes(t) || typeof n != "string" || !n.trim() || /[;,]|[^\x20-\x7e]/u.test(n))
9890
+ if (!Gc.includes(t) || typeof n != "string" || !n.trim() || /[;,]|[^\x20-\x7e]/u.test(n))
9815
9891
  return;
9816
9892
  e[t] = n.trim();
9817
9893
  }
9818
9894
  return Object.keys(e).length ? e : void 0;
9819
9895
  }
9820
- function Mc(r, e) {
9896
+ function Qc(r, e) {
9821
9897
  if (e === !1) return !1;
9822
9898
  const t = e === !0 || e === void 0 ? {} : e, n = t.bounds ?? r;
9823
9899
  if (!n) return !1;
@@ -9844,9 +9920,9 @@ function Mc(r, e) {
9844
9920
  capToBounds: t.capToBounds ?? !s
9845
9921
  };
9846
9922
  }
9847
- function Zc(r) {
9848
- const e = { ...gi, ...r?.sandbox ?? {} }, t = { ...mi, ...r?.iframeAllow ?? {} }, n = {
9849
- ...bi,
9923
+ function zc(r) {
9924
+ const e = { ...mi, ...r?.sandbox ?? {} }, t = { ...bi, ...r?.iframeAllow ?? {} }, n = {
9925
+ ...vi,
9850
9926
  ...r?.permissionsPolicy ?? {}
9851
9927
  }, s = {};
9852
9928
  for (const i of Object.keys(Xe)) {
@@ -9859,11 +9935,11 @@ function Zc(r) {
9859
9935
  permissionsPolicy: n,
9860
9936
  cspDirectives: s,
9861
9937
  sealAllow: r?.sealAllow,
9862
- workerCsp: Oc(r?.workerCsp),
9938
+ workerCsp: Hc(r?.workerCsp),
9863
9939
  worker: r?.worker ? { enabled: r.worker.enabled } : void 0
9864
9940
  };
9865
9941
  }
9866
- function Uc(r, e) {
9942
+ function Jc(r, e) {
9867
9943
  if (!e) return r;
9868
9944
  const t = e.cspDirectives ? Object.fromEntries(
9869
9945
  Object.keys(Xe).map((n) => [
@@ -9880,7 +9956,7 @@ function Uc(r, e) {
9880
9956
  cspDirectives: t
9881
9957
  };
9882
9958
  }
9883
- function Dc(r) {
9959
+ function jc(r) {
9884
9960
  return {
9885
9961
  heightRatio: r?.heightRatio ?? $t,
9886
9962
  placeholderText: r?.placeholderText ?? et
@@ -9898,11 +9974,11 @@ function Yr(r, e) {
9898
9974
  // 个人页用户信息为内部数据:hostApi getUserInfo 拉取后写入(无对外构造入口)
9899
9975
  profilePreview: {},
9900
9976
  widgetCover: { ...r.widgetCover },
9901
- rednoteDetail: Dc(r.rednoteDetail),
9977
+ rednoteDetail: jc(r.rednoteDetail),
9902
9978
  renderer: r.renderer ?? "iframe-service-worker",
9903
- viewport: Xc(r.device, r.viewport),
9979
+ viewport: Uc(r.device, r.viewport),
9904
9980
  // 默认无贴图外壳(frameless);需要 iPhone / Nexus 贴图壳时显式传 phoneFrame
9905
- phoneFrame: Pc(r.phoneFrame === void 0 ? !1 : r.phoneFrame),
9981
+ phoneFrame: Yc(r.phoneFrame === void 0 ? !1 : r.phoneFrame),
9906
9982
  query: r.query ?? {},
9907
9983
  review: {
9908
9984
  collectConsole: r.review?.collectConsole ?? !1,
@@ -9924,12 +10000,12 @@ function Yr(r, e) {
9924
10000
  // webview 与 iframe 共用同一套 bounds + transform 缩放(对齐 mp-simulator layout 的 auto scale)。
9925
10001
  // 内部 guest 须保持逻辑视口像素尺寸(见 webview.resize 对 webview 的明确 width/height),
9926
10002
  // 避免 shadow iframe 在百分比高度下塌成 150px;外层 stage 的 scale 只负责装入容器。
9927
- stageFit: Mc(e.stageFitBounds, r.stageFit ?? !0),
9928
- jsapi: Yc(r.jsapi),
9929
- security: Zc(r.security)
10003
+ stageFit: Qc(e.stageFitBounds, r.stageFit ?? !0),
10004
+ jsapi: _c(r.jsapi),
10005
+ security: zc(r.security)
9930
10006
  };
9931
10007
  }
9932
- function Yc(r) {
10008
+ function _c(r) {
9933
10009
  if (r === !1)
9934
10010
  return {
9935
10011
  enabled: !1,
@@ -9963,11 +10039,11 @@ const Hr = {
9963
10039
  onNetwork: "network",
9964
10040
  onDestroy: "destroy"
9965
10041
  };
9966
- class Gc {
10042
+ class $c {
9967
10043
  constructor(e, t = {}) {
9968
- if (this.runtimeOptions = t, this.lifecycle = new Rc(), this.events = new $r(), this.injection = new ms(), this.renderer = null, this.loadGeneration = 0, this.loadedUrl = "", this.loadSource = "load", this.swHost = null, this.swMountedId = null, this.userDataPath = null, this.serviceWorkerUnavailable = !1, this.detachStageFit = null, this.hostApiMap = {}, this.gesturePlugins = /* @__PURE__ */ new Map(), this.inspectorEnabled = !1, this.inspectorSelectionMode = "single", this.tracker = null, this.devtoolsPanel = null, this.detachDevtoolsShortcut = null, this.currentRoute = "note", this.activePage = "note", this.shadowHost = gs(fs(e.mount), {
10044
+ if (this.runtimeOptions = t, this.lifecycle = new Mc(), this.events = new $r(), this.injection = new bs(), this.renderer = null, this.loadGeneration = 0, this.loadedUrl = "", this.loadSource = "load", this.swHost = null, this.swMountedId = null, this.userDataPath = null, this.serviceWorkerUnavailable = !1, this.detachStageFit = null, this.hostApiMap = {}, this.showJsApiAlert = Ma(this.runtimeOptions.businessLine), this.gesturePlugins = /* @__PURE__ */ new Map(), this.inspectorEnabled = !1, this.inspectorSelectionMode = "single", this.tracker = null, this.devtoolsPanel = null, this.detachDevtoolsShortcut = null, this.currentRoute = "note", this.activePage = "note", this.shadowHost = ms(gs(e.mount), {
9969
10045
  shadow: e.shadow
9970
- }), this.requestRuntime = new Nl({
10046
+ }), this.phoneVibration = new uo(this.shadowHost.stage), this.requestRuntime = new Gl({
9971
10047
  mount: this.shadowHost.stage,
9972
10048
  requestManagerFrameUrl: t.requestManagerFrameUrl,
9973
10049
  getHostRequest: () => {
@@ -9981,16 +10057,16 @@ class Gc {
9981
10057
  ), this.storageScope = JSON.stringify([
9982
10058
  t.businessLine ?? "app",
9983
10059
  this.options.appId?.trim() || Et()
9984
- ]), Fa({
10060
+ ]), Pa({
9985
10061
  renderer: this.options.renderer,
9986
- environment: Ra()
9987
- }), this.injection.register(qi), this.injection.register(Ri), this.injection.register(Xi), this.injection.register(Fi), this.injection.register(Wi), this.injection.register(Ai), this.injection.register(Ti), this.injection.register($s), this.injection.register(Pi), Object.assign(this.hostApiMap, e.hostApi ?? {}), this.hostApi = Vc({
10062
+ environment: Na()
10063
+ }), this.injection.register(Bi), this.injection.register(Fi), this.injection.register(Ki), this.injection.register(Xi), this.injection.register(Wi), this.injection.register(hi), this.injection.register(Ri), this.injection.register(ei), this.injection.register(Pi), Object.assign(this.hostApiMap, e.hostApi ?? {}), this.hostApi = Tc({
9988
10064
  hostApiMap: this.hostApiMap,
9989
10065
  getRenderer: () => this.renderer
9990
- }), this.gesture = Lc({
10066
+ }), this.gesture = Rc({
9991
10067
  gesturePlugins: this.gesturePlugins,
9992
10068
  getRenderer: () => this.renderer
9993
- }), this.gamePlaytest = Wc({ getRenderer: () => this.renderer }), this.inspector = Ic({
10069
+ }), this.gamePlaytest = Fc({ getRenderer: () => this.renderer }), this.inspector = Xc({
9994
10070
  getRenderer: () => this.renderer,
9995
10071
  isEnabled: () => this.inspectorEnabled,
9996
10072
  setEnabled: (n) => {
@@ -10001,19 +10077,19 @@ class Gc {
10001
10077
  this.inspectorSelectionMode = n;
10002
10078
  },
10003
10079
  emitChange: (n) => this.events.emit("inspectorChange", { enabled: n })
10004
- }), this.notePreview = qc({
10080
+ }), this.notePreview = Nc({
10005
10081
  getOptions: () => this.options,
10006
10082
  setOptions: (n) => {
10007
10083
  this.options = n;
10008
10084
  },
10009
10085
  syncRednote: () => this.syncRendererRednoteContext()
10010
- }), this.widgetCover = Bc({
10086
+ }), this.widgetCover = Pc({
10011
10087
  getOptions: () => this.options,
10012
10088
  setOptions: (n) => {
10013
10089
  this.options = n;
10014
10090
  },
10015
10091
  syncWidgetCover: () => this.syncRendererWidgetCover()
10016
- }), this.permissionSheet = kc({
10092
+ }), this.permissionSheet = Kc({
10017
10093
  getRenderer: () => this.renderer,
10018
10094
  onResult: (n, s) => {
10019
10095
  this.tracker?.trackPermissionResult({ type: n, result: s });
@@ -10030,7 +10106,7 @@ class Gc {
10030
10106
  return "";
10031
10107
  }
10032
10108
  };
10033
- this.tracker = new jn(
10109
+ this.tracker = new Jn(
10034
10110
  e.tracker,
10035
10111
  this.events,
10036
10112
  n,
@@ -10039,7 +10115,7 @@ class Gc {
10039
10115
  renderer: this.options.renderer,
10040
10116
  contentMode: this.options.contentMode,
10041
10117
  appUrl: this.options.appUrl,
10042
- sdkVersion: Jn
10118
+ sdkVersion: jn
10043
10119
  });
10044
10120
  }
10045
10121
  this.options.debug && this.initDevtools();
@@ -10083,6 +10159,9 @@ class Gc {
10083
10159
  },
10084
10160
  showNotePublish(t) {
10085
10161
  return e.renderer?.showNotePublish?.(t);
10162
+ },
10163
+ vibrate(t) {
10164
+ e.phoneVibration.vibrate(t);
10086
10165
  }
10087
10166
  };
10088
10167
  }
@@ -10091,20 +10170,20 @@ class Gc {
10091
10170
  * 注册 Shift+Cmd/Ctrl+U 唤起快捷键。能力开关仅供内部调试并触发整页 reload。
10092
10171
  */
10093
10172
  initDevtools() {
10094
- const e = oo({
10173
+ const e = ao({
10095
10174
  getSnapshot: () => this.buildDevtoolsSnapshot(),
10096
10175
  onApplyCapabilities: async (t) => {
10097
10176
  this.options = this.mergeOptions({ security: { sealAllow: t } }), this.loadSource = "debug-capabilities", await this.load();
10098
10177
  },
10099
10178
  subscribe: (t) => this.events.on("*", t)
10100
10179
  });
10101
- this.devtoolsPanel = e, this.detachDevtoolsShortcut = io(() => e.toggle());
10180
+ this.devtoolsPanel = e, this.detachDevtoolsShortcut = oo(() => e.toggle());
10102
10181
  }
10103
10182
  /** 从当前归一化选项构造调试面板快照 */
10104
10183
  buildDevtoolsSnapshot() {
10105
10184
  const e = this.options.security;
10106
10185
  return {
10107
- allow: e.sealAllow ?? jr,
10186
+ allow: e.sealAllow ?? Jr,
10108
10187
  custom: e.sealAllow !== void 0,
10109
10188
  renderer: this.options.renderer,
10110
10189
  contentMode: this.options.contentMode,
@@ -10162,7 +10241,7 @@ class Gc {
10162
10241
  ...this.options,
10163
10242
  ...e,
10164
10243
  notePreview: e.notePreview ? { ...this.options.notePreview, ...e.notePreview } : this.options.notePreview,
10165
- security: Uc(this.options.security, e.security),
10244
+ security: Jc(this.options.security, e.security),
10166
10245
  review: { ...this.options.review, ...e.review }
10167
10246
  };
10168
10247
  return Yr(t, this.normalizeContext());
@@ -10236,7 +10315,7 @@ class Gc {
10236
10315
  }
10237
10316
  async redirectTo(e, t) {
10238
10317
  if (this.lifecycle.assertActive(), e !== "note" && e !== "minitool" && e !== "profile")
10239
- throw new I("INVALID_ROUTE", `Unsupported route: ${String(e)}`);
10318
+ throw new W("INVALID_ROUTE", `Unsupported route: ${String(e)}`);
10240
10319
  if (e === "minitool") {
10241
10320
  this.currentRoute !== "minitool" && (this.renderer?.openContent?.(t?.sheetMode ?? "full"), this.setRoute("minitool"));
10242
10321
  return;
@@ -10252,11 +10331,11 @@ class Gc {
10252
10331
  }
10253
10332
  /** 终止当前 guest,并回收其 renderer 与 SW 挂载。 */
10254
10333
  interruptCurrentGuest() {
10255
- this.requestRuntime.abortAll(), this.detachStageFit?.(), this.detachStageFit = null, this.renderer?.destroy(), this.renderer = null, this.unmountServiceWorkerContent();
10334
+ this.phoneVibration.stop(), this.requestRuntime.abortAll(), this.detachStageFit?.(), this.detachStageFit = null, this.renderer?.destroy(), this.renderer = null, this.unmountServiceWorkerContent();
10256
10335
  }
10257
10336
  async loadCurrent(e) {
10258
10337
  if (!this.isCurrentLoad(e)) return;
10259
- this.lifecycle.assertActive(), this.lifecycle.transitionTo("loading");
10338
+ this.lifecycle.assertActive(), this.lifecycle.transitionTo("loading"), this.phoneVibration.stop();
10260
10339
  let t = null;
10261
10340
  const n = Date.now();
10262
10341
  let s = !1;
@@ -10265,7 +10344,7 @@ class Gc {
10265
10344
  if (this.registerBuiltinBridgeHandlers(), this.renderer?.useGesturePlugin)
10266
10345
  for (const i of this.gesturePlugins.values())
10267
10346
  this.renderer.useGesturePlugin(i);
10268
- if (this.renderer?.setInspectorSelectionMode?.(this.inspectorSelectionMode), this.inspectorEnabled && this.renderer?.enableInspector?.(), this.activePage !== "note" && this.renderer?.setActivePage?.(this.activePage), this.options.stageFit && (this.detachStageFit = Ec(this.options.container, this.options.stageFit)), await this.tryResolveHostUserInfo(), !this.isCurrentLoad(e) || this.renderer !== t || (await this.maybeMountRemoteViaServiceWorker(), !this.isCurrentLoad(e) || this.renderer !== t) || (this.tracker?.trackLoadStage("renderer_setup", {
10347
+ if (this.renderer?.setInspectorSelectionMode?.(this.inspectorSelectionMode), this.inspectorEnabled && this.renderer?.enableInspector?.(), this.activePage !== "note" && this.renderer?.setActivePage?.(this.activePage), this.options.stageFit && (this.detachStageFit = qc(this.options.container, this.options.stageFit)), await this.tryResolveHostUserInfo(), !this.isCurrentLoad(e) || this.renderer !== t || (await this.maybeMountRemoteViaServiceWorker(), !this.isCurrentLoad(e) || this.renderer !== t) || (this.tracker?.trackLoadStage("renderer_setup", {
10269
10348
  result: "success",
10270
10349
  duration: Date.now() - n
10271
10350
  }), s = !0, this.loadedUrl = this.resolveLoadUrl(), this.events.emit("ready", {
@@ -10294,7 +10373,7 @@ class Gc {
10294
10373
  }
10295
10374
  }
10296
10375
  unload() {
10297
- this.lifecycle.assertActive(), this.loadGeneration += 1, this.requestRuntime.abortAll(), this.renderer?.unload ? this.renderer.unload() : (this.renderer?.destroy(), this.renderer = null), this.unmountServiceWorkerContent(), this.loadedUrl = "", this.loadSource = "load";
10376
+ this.lifecycle.assertActive(), this.phoneVibration.stop(), this.loadGeneration += 1, this.requestRuntime.abortAll(), this.renderer?.unload ? this.renderer.unload() : (this.renderer?.destroy(), this.renderer = null), this.unmountServiceWorkerContent(), this.loadedUrl = "", this.loadSource = "load";
10298
10377
  }
10299
10378
  /**
10300
10379
  * 执行宿主定制项:函数则直接调用;`{ toast }` 则弹该文案并回成功。
@@ -10305,23 +10384,23 @@ class Gc {
10305
10384
  runUnsupportedJsApi(e, t = {}) {
10306
10385
  console.log("[mini-app-simulator] unsupported jsapi:", e);
10307
10386
  const n = this.options.jsapi.unsupportedBehavior;
10308
- return n?.type === "alert" ? window.alert(n.message) : this.renderer?.showToast?.(n?.message ?? "请前往真机调试", { duration: 2e3 }), t;
10387
+ return n?.type === "alert" ? this.showJsApiAlert(e, n.message) : this.renderer?.showToast?.(n?.message ?? "请前往真机调试", { duration: 2e3 }), t;
10309
10388
  }
10310
10389
  /** 注册模拟器 JSAPI 领域模块;未声明事件仍由 fallback 分发。 */
10311
10390
  registerBuiltinBridgeHandlers() {
10312
10391
  const e = this.renderer?.bridge;
10313
10392
  if (!e) return;
10314
10393
  const t = this.jsapiContext;
10315
- Fl(
10394
+ Zl(
10316
10395
  e,
10317
10396
  [
10318
- $a(t),
10319
- hl(t),
10320
- al(),
10321
- Ll(t),
10322
- kl(t),
10323
- Ka(t),
10324
- Cl(t)
10397
+ ol(t),
10398
+ yl(t),
10399
+ pl(),
10400
+ Rl(t),
10401
+ Kl(t),
10402
+ Da(t),
10403
+ Wl(t)
10325
10404
  ],
10326
10405
  {
10327
10406
  hostApiMap: this.hostApiMap,
@@ -10336,7 +10415,7 @@ class Gc {
10336
10415
  });
10337
10416
  }
10338
10417
  async reload() {
10339
- if (this.lifecycle.assertActive(), !this.renderer)
10418
+ if (this.lifecycle.assertActive(), this.phoneVibration.stop(), !this.renderer)
10340
10419
  return this.load();
10341
10420
  this.lifecycle.transitionTo("loading"), this.tracker?.trackReload(this.loadedUrl), this.events.emit("beforeLoad", {
10342
10421
  url: this.loadedUrl,
@@ -10390,7 +10469,7 @@ class Gc {
10390
10469
  }
10391
10470
  async loadZip(e, t) {
10392
10471
  this.lifecycle.assertActive(), this.assertServiceWorkerLoader(), this.assertServiceWorkerUsable();
10393
- const n = ++this.loadGeneration, s = Date.now(), i = await $l(e, {
10472
+ const n = ++this.loadGeneration, s = Date.now(), i = await oc(e, {
10394
10473
  jszip: t?.jszip,
10395
10474
  entry: t?.entry,
10396
10475
  limits: t?.limits
@@ -10404,7 +10483,7 @@ class Gc {
10404
10483
  }
10405
10484
  async loadFiles(e, t) {
10406
10485
  this.lifecycle.assertActive(), this.assertServiceWorkerLoader(), this.assertServiceWorkerUsable();
10407
- const n = ++this.loadGeneration, s = Date.now(), i = ec(e, { entry: t?.entry, limits: t?.limits });
10486
+ const n = ++this.loadGeneration, s = Date.now(), i = ac(e, { entry: t?.entry, limits: t?.limits });
10408
10487
  return this.tracker?.trackParseDone({
10409
10488
  type: "files",
10410
10489
  duration: Date.now() - s,
@@ -10418,7 +10497,7 @@ class Gc {
10418
10497
  */
10419
10498
  assertServiceWorkerLoader() {
10420
10499
  if (this.options.renderer !== "iframe-service-worker")
10421
- throw new I(
10500
+ throw new W(
10422
10501
  "LOADER_UNSUPPORTED",
10423
10502
  `loadZip/loadFiles 需要 renderer: "iframe-service-worker";当前 renderer="${this.options.renderer}"`
10424
10503
  );
@@ -10465,7 +10544,7 @@ class Gc {
10465
10544
  const i = await this.acquireServiceWorkerHost(s.scriptUrl, s.mountTimeout);
10466
10545
  if (!this.isCurrentLoad(n)) return;
10467
10546
  this.unmountServiceWorkerContent(), this.swHost = i;
10468
- const o = Et(), a = this.options.appId || o, l = i.fileUrl(a, "usr"), c = `${i.scope}${o}/${e.entryPath}`, d = xc(this.options.security.worker, o), h = Date.now(), { head: u, csp: p } = await Mr(
10547
+ const o = Et(), a = this.options.appId || o, l = i.fileUrl(a, "usr"), c = `${i.scope}${o}/${e.entryPath}`, d = Bc(this.options.security.worker, o), h = Date.now(), { head: u, csp: p } = await Mr(
10469
10548
  this.options,
10470
10549
  this.injection,
10471
10550
  c,
@@ -10515,7 +10594,7 @@ class Gc {
10515
10594
  }
10516
10595
  /** 是否对当前远程 appUrl 启用 SW 代理:SW 渲染器 + 配了 scriptUrl + 环境支持 + 未注册失败 + appUrl 为跨域 http(s)。 */
10517
10596
  shouldProxyRemoteViaServiceWorker() {
10518
- return !this.serviceWorkerUnavailable && this.options.renderer === "iframe-service-worker" && !!this.options.serviceWorker?.scriptUrl && Kr() && !this.isCurrentServiceWorkerMountUrl(this.options.appUrl) && Hc(this.options.appUrl);
10597
+ return !this.serviceWorkerUnavailable && this.options.renderer === "iframe-service-worker" && !!this.options.serviceWorker?.scriptUrl && Kr() && !this.isCurrentServiceWorkerMountUrl(this.options.appUrl) && ed(this.options.appUrl);
10519
10598
  }
10520
10599
  /** load() 内调用:远程 appUrl 满足条件时挂进 SW 走同源代理;失败经 error 事件暴露并抛出。 */
10521
10600
  async maybeMountRemoteViaServiceWorker() {
@@ -10529,7 +10608,7 @@ class Gc {
10529
10608
  async mountRemoteViaServiceWorker(e) {
10530
10609
  const t = this.options.serviceWorker;
10531
10610
  if (!t?.scriptUrl) throw new Error("serviceWorker.scriptUrl is required");
10532
- const n = Gr(e, this.options.query), s = new URL(".", n).href, i = Qc(n), o = Date.now(), a = await fetch(n, { method: "GET", credentials: "omit", cache: "no-store" });
10611
+ const n = Gr(e, this.options.query), s = new URL(".", n).href, i = td(n), o = Date.now(), a = await fetch(n, { method: "GET", credentials: "omit", cache: "no-store" });
10533
10612
  if (!a.ok) throw new Error(`远程入口请求失败:HTTP ${a.status}`);
10534
10613
  const l = await a.text();
10535
10614
  this.tracker?.trackParseDone({
@@ -10557,9 +10636,9 @@ class Gc {
10557
10636
  count: 1
10558
10637
  });
10559
10638
  const k = new TextEncoder().encode(l).buffer, M = Date.now();
10560
- let L;
10639
+ let I;
10561
10640
  try {
10562
- L = await c.mount({
10641
+ I = await c.mount({
10563
10642
  id: d,
10564
10643
  entryPath: i,
10565
10644
  rawFiles: { [i]: k },
@@ -10581,7 +10660,7 @@ class Gc {
10581
10660
  duration: Date.now() - M,
10582
10661
  count: 1,
10583
10662
  entry: i
10584
- }), this.swMountedId = d, this.userDataPath = u, this.options = this.mergeOptions({ appUrl: L });
10663
+ }), this.swMountedId = d, this.userDataPath = u, this.options = this.mergeOptions({ appUrl: I });
10585
10664
  }
10586
10665
  async setTouchEmulation(e) {
10587
10666
  this.lifecycle.assertActive(), e !== this.options.touchEmulation && (this.options = this.mergeOptions({ touchEmulation: e }), this.loadSource = "set-touch-emulation", await this.load());
@@ -10619,7 +10698,7 @@ class Gc {
10619
10698
  }
10620
10699
  async capture() {
10621
10700
  if (this.lifecycle.assertActive(), !this.renderer?.capture)
10622
- throw new I(
10701
+ throw new W(
10623
10702
  "CAPTURE_UNSUPPORTED",
10624
10703
  "Current renderer does not support capture"
10625
10704
  );
@@ -10639,7 +10718,7 @@ class Gc {
10639
10718
  if (!this.renderer?.capture)
10640
10719
  return e(he.unsupported, "当前渲染器不支持截图");
10641
10720
  try {
10642
- const t = await this.renderer.capture(), n = await vc(t, "manual");
10721
+ const t = await this.renderer.capture(), n = await Vc(t, "manual");
10643
10722
  return this.events.emit("screenShot", n), n;
10644
10723
  } catch (t) {
10645
10724
  const n = t instanceof Error ? t.message : String(t), s = /timeout/i.test(n) ? he.timeout : he.renderFailed;
@@ -10647,7 +10726,7 @@ class Gc {
10647
10726
  }
10648
10727
  }
10649
10728
  destroy(e) {
10650
- this.status !== "destroyed" && (this.loadGeneration += 1, this.detachDevtoolsShortcut?.(), this.detachDevtoolsShortcut = null, this.devtoolsPanel?.destroy(), this.devtoolsPanel = null, this.detachStageFit?.(), this.detachStageFit = null, this.requestRuntime.destroy(), this.renderer?.destroy(), this.renderer = null, this.unmountServiceWorkerContent(), this.swHost = null, this.lifecycle.transitionTo("destroyed"), this.events.emit("destroy", { reason: e }), this.tracker?.destroy(), this.events.clear(), this.shadowHost.destroy());
10729
+ this.status !== "destroyed" && (this.phoneVibration.stop(), this.loadGeneration += 1, this.detachDevtoolsShortcut?.(), this.detachDevtoolsShortcut = null, this.devtoolsPanel?.destroy(), this.devtoolsPanel = null, this.detachStageFit?.(), this.detachStageFit = null, this.requestRuntime.destroy(), this.renderer?.destroy(), this.renderer = null, this.unmountServiceWorkerContent(), this.swHost = null, this.lifecycle.transitionTo("destroyed"), this.events.emit("destroy", { reason: e }), this.tracker?.destroy(), this.events.clear(), this.shadowHost.destroy());
10651
10730
  }
10652
10731
  on(e, t) {
10653
10732
  return this.events.on(e, t);
@@ -10661,15 +10740,15 @@ class Gc {
10661
10740
  /** 根据渲染器类型创建对应的 Transport;webview 手势 IPC 与 jsapi bridge 共用通道 */
10662
10741
  createTransport(e) {
10663
10742
  if (this.options.jsapi.enabled || e === "webview" && this.options.touchEmulation) {
10664
- if (e === "iframe-service-worker") return new lo();
10665
- if (e === "webview") return new co();
10743
+ if (e === "iframe-service-worker") return new ho();
10744
+ if (e === "webview") return new po();
10666
10745
  }
10667
10746
  }
10668
10747
  createRenderer(e) {
10669
10748
  const t = this.createTransport(e), n = {
10670
10749
  viewport: this.options.viewport,
10671
10750
  phoneFrame: this.options.phoneFrame,
10672
- sandboxFlags: as(this.options.security.sandbox),
10751
+ sandboxFlags: ls(this.options.security.sandbox),
10673
10752
  timeout: this.options.timeout,
10674
10753
  debug: this.options.debug,
10675
10754
  touchEmulation: this.options.touchEmulation,
@@ -10690,10 +10769,10 @@ class Gc {
10690
10769
  restoreServiceWorkerMount: (s) => this.restoreServiceWorkerMount(s)
10691
10770
  };
10692
10771
  if (e === "iframe-service-worker")
10693
- return new gc(n);
10772
+ return new Sc(n);
10694
10773
  if (e === "webview")
10695
- return new Ba(n);
10696
- throw new I("UNSUPPORTED_RENDERER", `Unsupported renderer: ${e}`);
10774
+ return new Xa(n);
10775
+ throw new W("UNSUPPORTED_RENDERER", `Unsupported renderer: ${e}`);
10697
10776
  }
10698
10777
  bindRendererEvents(e) {
10699
10778
  e.on("load", (t) => this.events.emit("load", t)), e.on("renderDone", (t) => this.events.emit("renderDone", t)), e.on("error", (t) => this.events.emit("error", t)), e.on("navigation", (t) => this.events.emit("navigation", t)), e.on("console", (t) => this.events.emit("console", t)), e.on("guestError", (t) => this.events.emit("guestError", t)), e.on("network", (t) => this.events.emit("network", t)), e.on("performance", (t) => this.events.emit("performance", t)), e.on("capture", (t) => this.events.emit("capture", t)), e.on("elementHovered", (t) => this.events.emit("elementHovered", t)), e.on("elementSelected", (t) => this.events.emit("elementSelected", t)), e.on(
@@ -10717,13 +10796,13 @@ function Qr(r, e, t) {
10717
10796
  function zr(r) {
10718
10797
  return r.frameAncestors?.length ? [...new Set(r.frameAncestors)] : void 0;
10719
10798
  }
10720
- function sd(r) {
10721
- return new Gc(r);
10799
+ function ud(r) {
10800
+ return new $c(r);
10722
10801
  }
10723
10802
  function Et() {
10724
10803
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
10725
10804
  }
10726
- function Hc(r) {
10805
+ function ed(r) {
10727
10806
  if (!r || typeof window > "u") return !1;
10728
10807
  try {
10729
10808
  const e = new URL(r, window.location.href);
@@ -10732,32 +10811,32 @@ function Hc(r) {
10732
10811
  return !1;
10733
10812
  }
10734
10813
  }
10735
- function Qc(r) {
10814
+ function td(r) {
10736
10815
  try {
10737
10816
  return (new URL(r).pathname.split("/").pop() ?? "") || Oe;
10738
10817
  } catch {
10739
10818
  return Oe;
10740
10819
  }
10741
10820
  }
10742
- const id = Object.freeze(rs);
10821
+ const Ad = Object.freeze(ns);
10743
10822
  export {
10744
- Jr as ALL_MINI_APP_CAPABILITIES,
10745
- ld as BusinessLine,
10746
- td as HOST_CONTROLLED_CAPABILITIES,
10823
+ jr as ALL_MINI_APP_CAPABILITIES,
10824
+ _n as BusinessLine,
10825
+ ld as HOST_CONTROLLED_CAPABILITIES,
10747
10826
  he as MINIAPP_SCREENSHOT_ERROR_CODE,
10748
10827
  ct as MINI_APP_CAPABILITIES,
10749
10828
  b as MiniAppCapability,
10750
10829
  v as MiniAppJsApiErrorCode,
10751
- I as MiniAppSimulatorError,
10752
- ed as SEAL_CONTROLLED_CAPABILITIES,
10753
- $c as WORKER_CONTENT_SECURITY_POLICY,
10754
- id as WORKER_RUNTIME_METADATA,
10755
- ns as WORKER_RUNTIME_PROTOCOL_VERSION,
10830
+ W as MiniAppSimulatorError,
10831
+ ad as SEAL_CONTROLLED_CAPABILITIES,
10832
+ od as WORKER_CONTENT_SECURITY_POLICY,
10833
+ Ad as WORKER_RUNTIME_METADATA,
10834
+ ss as WORKER_RUNTIME_PROTOCOL_VERSION,
10756
10835
  fr as buildElementSelection,
10757
- So as computeSelector,
10758
- sd as createMiniAppSimulator,
10759
- Ra as detectEnvironment,
10760
- nd as getSimulatorContext,
10761
- os as isMiniAppCapability,
10762
- rd as sanitizeCapabilityList
10836
+ Io as computeSelector,
10837
+ ud as createMiniAppSimulator,
10838
+ Na as detectEnvironment,
10839
+ dd as getSimulatorContext,
10840
+ as as isMiniAppCapability,
10841
+ cd as sanitizeCapabilityList
10763
10842
  };