remote-webview-debugger 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! remote-webview-debugger sdk v0.2.0 | includes chobitsu (MIT), Playwright (Apache-2.0), licia (MIT), modern-screenshot (MIT) */
1
+ /*! remote-webview-debugger sdk v0.2.1 | includes chobitsu (MIT), Playwright (Apache-2.0), licia (MIT), modern-screenshot (MIT) */
2
2
  // \0rolldown/runtime.js
3
3
  var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), s = (e, i, o, s) => {
4
4
  if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
@@ -6554,33 +6554,37 @@ function od(e) {
6554
6554
  }, 60))) : Promise.resolve();
6555
6555
  }
6556
6556
  function sd(e) {
6557
+ let t = X("localStorage", Wu);
6558
+ t && t !== e.deviceId ? e.deviceId = t : (e.deviceId = td(), Z("localStorage", Wu, e.deviceId), Z("localStorage", Ju, null));
6559
+ }
6560
+ function cd(e) {
6557
6561
  try {
6558
6562
  let t = JSON.parse(X("sessionStorage", Yu) || "null");
6559
6563
  if (t && t.p === e && typeof t.r == "string") return t.r;
6560
6564
  } catch (e) {}
6561
6565
  return null;
6562
6566
  }
6563
- function cd(e, t) {
6567
+ function ld(e, t) {
6564
6568
  Z("sessionStorage", Yu, t ? JSON.stringify({
6565
6569
  p: e,
6566
6570
  r: t
6567
6571
  }) : null);
6568
6572
  }
6569
- function ld(e) {
6570
- e.pageId = ed(12), Z("sessionStorage", Gu, e.pageId), cd(e.pageId, null);
6573
+ function ud(e) {
6574
+ e.pageId = ed(12), Z("sessionStorage", Gu, e.pageId), ld(e.pageId, null);
6571
6575
  }
6572
- function ud() {
6576
+ function dd() {
6573
6577
  try {
6574
6578
  let e = new URL(location.href), t = e.searchParams.get(Zu);
6575
6579
  t !== null && (e.searchParams.delete(Zu), history.replaceState(history.state, "", e.href), t && Z("sessionStorage", Xu, t));
6576
6580
  } catch (e) {}
6577
6581
  return X("sessionStorage", Xu);
6578
6582
  }
6579
- function dd() {
6583
+ function fd() {
6580
6584
  Z("sessionStorage", Xu, null);
6581
6585
  }
6582
6586
  // src/approval.ts
6583
- var fd = 3e4, pd = class {
6587
+ var pd = 3e4, md = class {
6584
6588
  constructor(e) {
6585
6589
  this.opts = e, this.attach = null, this.confirmation = null, this.channel = null;
6586
6590
  let t = window.BroadcastChannel;
@@ -6667,11 +6671,11 @@ var fd = 3e4, pd = class {
6667
6671
  kind: "confirm",
6668
6672
  requestId: ed(12),
6669
6673
  action: e,
6670
- expiresAt: Date.now() + fd
6674
+ expiresAt: Date.now() + pd
6671
6675
  }, i = {
6672
6676
  info: r,
6673
6677
  dialog: null,
6674
- timer: setTimeout(() => i.finish(null), fd),
6678
+ timer: setTimeout(() => i.finish(null), pd),
6675
6679
  finish: (e) => {
6676
6680
  this.confirmation === i && (clearTimeout(i.timer), i.dialog && i.dialog.close(), this.confirmation = null, e === "allow" ? t() : n(new cr("forbidden", M().userDenied)));
6677
6681
  }
@@ -6702,7 +6706,7 @@ var fd = 3e4, pd = class {
6702
6706
  let e = this.attach;
6703
6707
  e && (this.attach = null, clearTimeout(e.timer), e.dialog && e.dialog.close());
6704
6708
  }
6705
- }, md = 6e4, hd = 6e4, gd = 3, _d = 100, vd = 6e5, yd = 3e5, bd = class {
6709
+ }, hd = 6e4, gd = 6e4, _d = 3, vd = 100, yd = 6e5, bd = 3e5, xd = class {
6706
6710
  constructor(e) {
6707
6711
  this.opts = e, this.ws = null, this.failures = 0, this.attempt = 0, this.polls = 0, this.online = !1, this.stopped = !0, this.queue = [], this.state = "stopped";
6708
6712
  }
@@ -6728,7 +6732,7 @@ var fd = 3e4, pd = class {
6728
6732
  if (this.online && this.ws && this.ws.readyState === 1) try {
6729
6733
  return this.ws.send(JSON.stringify(e)), !0;
6730
6734
  } catch (e) {}
6731
- return t && (this.queue.push(e), this.queue.length > _d && this.queue.shift()), !1;
6735
+ return t && (this.queue.push(e), this.queue.length > vd && this.queue.shift()), !1;
6732
6736
  }
6733
6737
  setState(e) {
6734
6738
  this.state !== e && (this.state = e, this.opts.onState(e));
@@ -6759,7 +6763,7 @@ var fd = 3e4, pd = class {
6759
6763
  let t = !1, n = () => {
6760
6764
  clearTimeout(this.idleTimer), this.idleTimer = setTimeout(() => {
6761
6765
  this.ws === e && (this.drop(), this.scheduleReconnect());
6762
- }, md);
6766
+ }, hd);
6763
6767
  };
6764
6768
  e.onopen = () => {
6765
6769
  n();
@@ -6778,7 +6782,10 @@ var fd = 3e4, pd = class {
6778
6782
  }, e.onclose = (n) => {
6779
6783
  if (this.ws !== e || (this.ws = null, this.online = !1, clearTimeout(this.idleTimer), this.stopped)) return;
6780
6784
  let r = n && n.code;
6781
- r === 4401 ? this.opts.onRejected() ? this.timer = setTimeout(() => this.connect(), 0) : this.backOff("rejected", vd) : r === 4429 ? this.backOff("quota", yd) : (r === 4409 ? this.opts.onConflict() : t || this.failures++, this.scheduleReconnect());
6785
+ if (r === 4401) {
6786
+ let e = this.opts.onRejected();
6787
+ e === !1 ? this.backOff("rejected", yd) : this.timer = setTimeout(() => this.connect(), e);
6788
+ } else r === 4429 ? this.backOff("quota", bd) : (r === 4409 ? this.opts.onConflict() : t || this.failures++, this.scheduleReconnect());
6782
6789
  }, e.onerror = () => {};
6783
6790
  }
6784
6791
  failed() {
@@ -6786,7 +6793,7 @@ var fd = 3e4, pd = class {
6786
6793
  }
6787
6794
  scheduleReconnect() {
6788
6795
  if (this.stopped) return;
6789
- if (this.failures >= gd) {
6796
+ if (this.failures >= _d) {
6790
6797
  this.startPolling();
6791
6798
  return;
6792
6799
  }
@@ -6803,7 +6810,7 @@ var fd = 3e4, pd = class {
6803
6810
  for (let t of e) this.send(t, !0);
6804
6811
  }
6805
6812
  startPolling() {
6806
- this.setState("polling"), this.pollTimer || (this.polls = 0, this.poll(), this.pollTimer = setInterval(() => this.poll(), hd));
6813
+ this.setState("polling"), this.pollTimer || (this.polls = 0, this.poll(), this.pollTimer = setInterval(() => this.poll(), gd));
6807
6814
  }
6808
6815
  stopPolling() {
6809
6816
  this.pollTimer && clearInterval(this.pollTimer), this.pollTimer = void 0;
@@ -6824,25 +6831,25 @@ var fd = 3e4, pd = class {
6824
6831
  }
6825
6832
  };
6826
6833
  // src/pageWatch.ts
6827
- function xd() {
6834
+ function Sd() {
6828
6835
  return {
6829
6836
  url: location.href,
6830
6837
  title: document.title,
6831
6838
  visibility: document.visibilityState === "hidden" ? "hidden" : "visible"
6832
6839
  };
6833
6840
  }
6834
- var Sd = "a, button, input, select, textarea, label, summary, [role=button], [role=link], [role=tab], [role=menuitem], [role=checkbox], [role=radio], [role=switch], [role=option], [onclick]";
6835
- function Cd(e) {
6836
- let t = tr(e, Sd) || e, { role: n, name: r } = Nc(t), i = r;
6841
+ var Cd = "a, button, input, select, textarea, label, summary, [role=button], [role=link], [role=tab], [role=menuitem], [role=checkbox], [role=radio], [role=switch], [role=option], [onclick]";
6842
+ function wd(e) {
6843
+ let t = tr(e, Cd) || e, { role: n, name: r } = Nc(t), i = r;
6837
6844
  !i && !(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (i = rr(t) ? k : A((t.textContent || "").replace(/\s+/g, " ").trim())), i.length > 30 && (i = i.slice(0, 30) + "…");
6838
6845
  let a = M(), o = a.roles[n] || a.element;
6839
6846
  return i ? a.tapped(o, i) : a.tappedTag(o, q(t));
6840
6847
  }
6841
- function wd(e) {
6848
+ function Td(e) {
6842
6849
  let { role: t, name: n } = Nc(e);
6843
6850
  return n ? `${t} "${n.length > 30 ? n.slice(0, 30) + "…" : n}"` : q(e);
6844
6851
  }
6845
- function Td(e) {
6852
+ function Ed(e) {
6846
6853
  if (rr(e)) return k;
6847
6854
  if (e instanceof HTMLInputElement) {
6848
6855
  if (e.type === "password") return k;
@@ -6851,10 +6858,10 @@ function Td(e) {
6851
6858
  let t = A(e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? e.value : "");
6852
6859
  return t.length > 200 ? t.slice(0, 200) + "…" : t;
6853
6860
  }
6854
- function Ed(e) {
6855
- let t = xd(), n, r = () => {
6861
+ function Dd(e) {
6862
+ let t = Sd(), n, r = () => {
6856
6863
  n = void 0;
6857
- let r = xd();
6864
+ let r = Sd();
6858
6865
  if (r.url === t.url && r.title === t.title && r.visibility === t.visibility) return;
6859
6866
  let i = t;
6860
6867
  t = r, r.url !== i.url && L("page", {
@@ -6888,7 +6895,7 @@ function Ed(e) {
6888
6895
  if (!t.isTrusted) return;
6889
6896
  let n = t.composedPath ? t.composedPath()[0] : t.target;
6890
6897
  if (n && n.nodeType === 1 && !nr(n)) try {
6891
- let t = Cd(n);
6898
+ let t = wd(n);
6892
6899
  e.onTap(t, n), L("action", {
6893
6900
  event: "tap",
6894
6901
  target: t,
@@ -6900,8 +6907,8 @@ function Ed(e) {
6900
6907
  if (e.isTrusted && t && t.nodeType === 1 && !nr(t)) try {
6901
6908
  L("action", {
6902
6909
  event: "input",
6903
- target: wd(t),
6904
- value: Td(t)
6910
+ target: Td(t),
6911
+ value: Ed(t)
6905
6912
  }, !0);
6906
6913
  } catch (e) {}
6907
6914
  }, !0), document.addEventListener("submit", (e) => {
@@ -6909,7 +6916,7 @@ function Ed(e) {
6909
6916
  if (e.isTrusted && t && t.nodeType === 1) try {
6910
6917
  L("action", {
6911
6918
  event: "submit",
6912
- target: wd(t)
6919
+ target: Td(t)
6913
6920
  }, !0);
6914
6921
  } catch (e) {}
6915
6922
  }, !0);
@@ -6930,7 +6937,7 @@ function Ed(e) {
6930
6937
  }, !0), { check: r };
6931
6938
  }
6932
6939
  // src/localeLoader.esm.ts
6933
- var Dd = {
6940
+ var Od = {
6934
6941
  "zh-TW": () => import("./locales/zh-TW.mjs"),
6935
6942
  fr: () => import("./locales/fr.mjs"),
6936
6943
  es: () => import("./locales/es.mjs"),
@@ -6941,12 +6948,12 @@ var Dd = {
6941
6948
  de: () => import("./locales/de.mjs"),
6942
6949
  pt: () => import("./locales/pt.mjs")
6943
6950
  };
6944
- function Od(e) {
6945
- let t = Dd[e];
6951
+ function kd(e) {
6952
+ let t = Od[e];
6946
6953
  return t ? t().then((e) => e.default) : Promise.resolve(null);
6947
6954
  }
6948
6955
  // src/locales/en.ts
6949
- var kd = {
6956
+ var Ad = {
6950
6957
  id: "en",
6951
6958
  name: "English",
6952
6959
  dir: "ltr",
@@ -7016,7 +7023,7 @@ var kd = {
7016
7023
  },
7017
7024
  action: dr,
7018
7025
  agent: ur
7019
- }, Ad = {
7026
+ }, jd = {
7020
7027
  id: "zh",
7021
7028
  name: "简体中文",
7022
7029
  dir: "ltr",
@@ -7160,7 +7167,7 @@ var kd = {
7160
7167
  },
7161
7168
  element: "元素"
7162
7169
  }
7163
- }, jd = [
7170
+ }, Md = [
7164
7171
  "en",
7165
7172
  "zh",
7166
7173
  "zh-TW",
@@ -7172,7 +7179,7 @@ var kd = {
7172
7179
  "ko",
7173
7180
  "de",
7174
7181
  "pt"
7175
- ], Md = [
7182
+ ], Nd = [
7176
7183
  "ar",
7177
7184
  "fa",
7178
7185
  "he",
@@ -7183,30 +7190,30 @@ var kd = {
7183
7190
  "yi",
7184
7191
  "dv",
7185
7192
  "ckb"
7186
- ], Nd = {
7187
- en: kd,
7188
- zh: Ad
7189
- }, Pd = {}, Fd = {}, Id = {}, Ld = [];
7190
- function Rd(e) {
7193
+ ], Pd = {
7194
+ en: Ad,
7195
+ zh: jd
7196
+ }, Fd = {}, Id = {}, Ld = {}, Rd = [];
7197
+ function zd(e) {
7191
7198
  if (typeof e != "string") return "";
7192
7199
  let t = e.trim().replace(/_/g, "-").split("-");
7193
7200
  return /^[a-z]{2,8}$/i.test(t[0]) ? t.map((e, t) => t === 0 ? e.toLowerCase() : /^[a-z]{4}$/i.test(e) ? e.charAt(0).toUpperCase() + e.slice(1).toLowerCase() : /^([a-z]{2}|\d{3})$/i.test(e) ? e.toUpperCase() : e.toLowerCase()).join("-") : "";
7194
7201
  }
7195
- function zd(e) {
7196
- let t = Rd(e);
7202
+ function Bd(e) {
7203
+ let t = zd(e);
7197
7204
  if (!t) return [];
7198
7205
  let n = t.split("-"), r = [];
7199
7206
  for (let e = n.length; e > 0; e--) r.push(n.slice(0, e).join("-"));
7200
7207
  return n[0] === "zh" && (n.indexOf("Hant") > 0 || n.indexOf("Hans") < 0 && /-(TW|HK|MO)\b/.test(t)) && r.indexOf("zh-TW") < 0 && r.splice(r.length - 1, 0, "zh-TW"), r;
7201
7208
  }
7202
- function Bd(e) {
7203
- return !!Nd[e] || jd.indexOf(e) >= 0;
7204
- }
7205
7209
  function Vd(e) {
7206
- for (let t of e) for (let e of zd(t)) if (Bd(e)) return e;
7210
+ return !!Pd[e] || Md.indexOf(e) >= 0;
7211
+ }
7212
+ function Hd(e) {
7213
+ for (let t of e) for (let e of Bd(t)) if (Vd(e)) return e;
7207
7214
  return "en";
7208
7215
  }
7209
- function Hd() {
7216
+ function Ud() {
7210
7217
  try {
7211
7218
  let e = navigator.languages && navigator.languages.length ? navigator.languages.slice() : [];
7212
7219
  return navigator.language && e.indexOf(navigator.language) < 0 && e.unshift(navigator.language), e;
@@ -7214,114 +7221,114 @@ function Hd() {
7214
7221
  return [];
7215
7222
  }
7216
7223
  }
7217
- function Ud(e) {
7224
+ function Wd(e) {
7218
7225
  return !!e && typeof e == "object" && !Array.isArray(e);
7219
7226
  }
7220
- function Wd(e, t) {
7221
- if (!Ud(t) || !Ud(e)) return e;
7227
+ function Gd(e, t) {
7228
+ if (!Wd(t) || !Wd(e)) return e;
7222
7229
  let n = {};
7223
7230
  for (let t in e) n[t] = e[t];
7224
7231
  for (let e in t) {
7225
7232
  let r = t[e];
7226
- r !== void 0 && (n[e] = Ud(r) && Ud(n[e]) ? Wd(n[e], r) : r);
7233
+ r !== void 0 && (n[e] = Wd(r) && Wd(n[e]) ? Gd(n[e], r) : r);
7227
7234
  }
7228
7235
  return n;
7229
7236
  }
7230
- function Gd() {
7231
- for (let e in Id) delete Id[e];
7232
- for (let e of Ld.slice()) e();
7237
+ function Kd() {
7238
+ for (let e in Ld) delete Ld[e];
7239
+ for (let e of Rd.slice()) e();
7233
7240
  }
7234
- function Kd(e) {
7235
- let t = Id[e];
7241
+ function qd(e) {
7242
+ let t = Ld[e];
7236
7243
  if (t) return t;
7237
7244
  let n = {
7238
- ui: kd.ui,
7239
- action: kd.action,
7240
- agent: kd.agent
7241
- }, r = zd(e).reverse();
7245
+ ui: Ad.ui,
7246
+ action: Ad.action,
7247
+ agent: Ad.agent
7248
+ }, r = Bd(e).reverse();
7242
7249
  r[0] !== "en" && r.unshift("en");
7243
7250
  for (let e of r) {
7244
- let t = Nd[e];
7245
- t && (n = Wd(n, {
7251
+ let t = Pd[e];
7252
+ t && (n = Gd(n, {
7246
7253
  ui: t.ui,
7247
7254
  action: t.action,
7248
7255
  agent: t.agent
7249
7256
  }));
7250
- for (let t of Pd[e] || []) n = Wd(n, t);
7257
+ for (let t of Fd[e] || []) n = Gd(n, t);
7251
7258
  }
7252
- return Id[e] = n, n;
7259
+ return Ld[e] = n, n;
7253
7260
  }
7254
- function qd(e) {
7255
- for (let t of zd(e)) {
7256
- let e = Nd[t];
7261
+ function Jd(e) {
7262
+ for (let t of Bd(e)) {
7263
+ let e = Pd[t];
7257
7264
  if (e && e.dir) return e.dir;
7258
7265
  }
7259
- return Md.indexOf(e.split("-")[0]) >= 0 ? "rtl" : "ltr";
7266
+ return Nd.indexOf(e.split("-")[0]) >= 0 ? "rtl" : "ltr";
7260
7267
  }
7261
- function Jd(e) {
7268
+ function Yd(e) {
7262
7269
  let t = Array.isArray(e) ? e : [e], n = !1;
7263
7270
  for (let e of t) {
7264
- let t = e && Rd(e.id);
7265
- t && (Nd[t] = t === e.id ? e : N(N({}, e), {}, { id: t }), n = !0);
7271
+ let t = e && zd(e.id);
7272
+ t && (Pd[t] = t === e.id ? e : N(N({}, e), {}, { id: t }), n = !0);
7266
7273
  }
7267
- n && Gd();
7274
+ n && Kd();
7268
7275
  }
7269
- function Yd(e) {
7270
- if (Ud(e)) {
7276
+ function Xd(e) {
7277
+ if (Wd(e)) {
7271
7278
  for (let t in e) {
7272
- let n = Rd(t);
7273
- n && Ud(e[t]) && (Pd[n] = Pd[n] || []).push(e[t]);
7279
+ let n = zd(t);
7280
+ n && Wd(e[t]) && (Fd[n] = Fd[n] || []).push(e[t]);
7274
7281
  }
7275
- Gd();
7282
+ Kd();
7276
7283
  }
7277
7284
  }
7278
- function Xd(e) {
7279
- return Ld.push(e), () => {
7280
- let t = Ld.indexOf(e);
7281
- t >= 0 && Ld.splice(t, 1);
7285
+ function Zd(e) {
7286
+ return Rd.push(e), () => {
7287
+ let t = Rd.indexOf(e);
7288
+ t >= 0 && Rd.splice(t, 1);
7282
7289
  };
7283
7290
  }
7284
- function Zd(e, t) {
7291
+ function Qd(e, t) {
7285
7292
  let n = [];
7286
- for (let r of zd(e)) Nd[r] || jd.indexOf(r) < 0 || (Fd[r] || (Fd[r] = Od(r, t).then((e) => {
7287
- e && !Nd[r] && Jd(e);
7293
+ for (let r of Bd(e)) Pd[r] || Md.indexOf(r) < 0 || (Id[r] || (Id[r] = kd(r, t).then((e) => {
7294
+ e && !Pd[r] && Yd(e);
7288
7295
  }).catch(() => void 0).then(() => {
7289
- Nd[r] || delete Fd[r];
7290
- })), n.push(Fd[r]));
7296
+ Pd[r] || delete Id[r];
7297
+ })), n.push(Id[r]));
7291
7298
  return Promise.all(n).then(() => void 0);
7292
7299
  }
7293
- function Qd(e) {
7300
+ function $d(e) {
7294
7301
  return e === "zh" ? "zh-CN" : e;
7295
7302
  }
7296
- var $d = "en";
7297
- function ef(e, t) {
7298
- $d = Vd([e]), mr(Kd($d).agent), Zd($d, t);
7303
+ var ef = "en";
7304
+ function tf(e, t) {
7305
+ ef = Hd([e]), mr(qd(ef).agent), Qd(ef, t);
7299
7306
  }
7300
- function tf(e) {
7301
- hr(Kd(e).action);
7307
+ function nf(e) {
7308
+ hr(qd(e).action);
7302
7309
  }
7303
- Xd(() => mr(Kd($d).agent));
7310
+ Zd(() => mr(qd(ef).agent));
7304
7311
  try {
7305
7312
  let e = window.__RWD_LOCALES__;
7306
- Array.isArray(e) && Jd(e);
7313
+ Array.isArray(e) && Yd(e);
7307
7314
  } catch (e) {}
7308
7315
  // src/ui.ts
7309
- var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-min", sf = "rwd:auto", cf = "rwd:lock", Q = 8, lf = 400, uf = " --accent-rgb: var(--rwd-accent-rgb, 59, 130, 246);--accent: rgb(var(--accent-rgb));--danger-rgb: var(--rwd-danger-rgb, 239, 68, 68);--warning-rgb: var(--rwd-warning-rgb, 245, 158, 11);--success-rgb: var(--rwd-success-rgb, 34, 197, 94);--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"PingFang SC\", \"Helvetica Neue\", \"Microsoft YaHei\", sans-serif);--mono: var(--rwd-font-mono, ui-monospace, \"SF Mono\", SFMono-Regular, Menlo, monospace);--radius: var(--rwd-radius, 18px);--button-radius: var(--rwd-button-radius, 999px);", df = " :host(:lang(zh-TW)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"PingFang TC\", \"Helvetica Neue\", \"Microsoft JhengHei\", sans-serif)}:host(:lang(ja)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"Hiragino Sans\", \"Hiragino Kaku Gothic ProN\", \"Helvetica Neue\", \"Yu Gothic UI\", Meiryo, sans-serif)}:host(:lang(ko)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"Apple SD Gothic Neo\", \"Helvetica Neue\", \"Malgun Gothic\", sans-serif)}", ff = "<svg class=\"arrow\" viewBox=\"0 0 26 26\" aria-hidden=\"true\">\n<path d=\"M3.2 1.6 L23.4 9.4 Q24.8 10 23.4 10.7 L14.6 14.6 L10.7 23.4 Q10 24.8 9.4 23.4 L1.6 3.2 Q1.1 1.1 3.2 1.6 Z\"\n fill=\"#0b0d12\" stroke=\"#fff\" stroke-width=\"2\" stroke-linejoin=\"round\"/>\n</svg>", pf = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"5\" y=\"5\" width=\"8.5\" height=\"8.5\" rx=\"2\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\"/><path d=\"M3.5 10.5V4a1.5 1.5 0 0 1 1.5-1.5h6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\"/></svg>", mf = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M4 8.4 6.8 11 12 5.6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>", hf = ` :host{all: initial;${uf}--ink: 255, 255, 255;--paper: 12, 14, 20;--fg: #fff;--solid-bg: #fff;--solid-fg: #0b0d12;--track: rgba(var(--ink), .2)}${df}:host([data-theme=light]){--ink: 11, 13, 18;--paper: 255, 255, 255;--fg: #0b0d12;--solid-bg: #0b0d12;--solid-fg: #fff;--track: rgba(11, 13, 18, .16)}*{box-sizing: border-box}.glass{background: rgba(var(--paper), .9);color: var(--fg);border: 1px solid rgba(var(--ink), .1);box-shadow: 0 12px 32px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(var(--ink), .06);-webkit-backdrop-filter: blur(18px) saturate(1.5);backdrop-filter: blur(18px) saturate(1.5)}.win.glass, .dlg.glass, .task.glass{background: rgba(var(--paper), .96)}.pill, .bar, .btn{font: 500 12px/16px var(--font)}.pill{position: fixed;z-index: 3;top: 0;left: 0;display: flex;align-items: center;gap: 8px;max-width: calc(100vw - 16px);padding: 7px 12px 7px 8px;border-radius: 999px;white-space: nowrap;background: rgba(var(--paper), .55);color: var(--fg);border: 1px solid rgba(var(--ink), .14);box-shadow: 0 8px 24px rgba(0, 0, 0, .18);-webkit-backdrop-filter: blur(16px) saturate(1.6);backdrop-filter: blur(16px) saturate(1.6);pointer-events: auto;touch-action: none;cursor: pointer;user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;transition: opacity .22s ease, transform .22s cubic-bezier(.2, .9, .2, 1), background .2s ease}.pill:active{transform: scale(.97)}.pill.open{background: rgba(var(--paper), .85)}.pill.hidden{opacity: 0;transform: scale(.9);pointer-events: none;visibility: hidden;transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s}.pill.snap{transition: left .22s cubic-bezier(.2, .9, .2, 1), top .22s cubic-bezier(.2, .9, .2, 1), opacity .22s ease, transform .22s ease}.logo{position: relative;flex: none;width: 18px;height: 18px;border-radius: 6px;background: #0b0d12;box-shadow: inset 0 0 0 1px rgba(var(--ink), .18)}.logo .dot{position: absolute;left: 5px;top: 5px}.brand{font-weight: 650;letter-spacing: .2px}.win{position: fixed;z-index: 3;width: min(calc(100vw - 16px), 300px);padding: 14px;border-radius: var(--radius);font: 13px/18px var(--font);pointer-events: auto;opacity: 0;visibility: hidden;transform: scale(.92) translateY(6px);transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .24s}.win.open{opacity: 1;visibility: visible;transform: none;transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1)}.win .head{display: flex;align-items: center;gap: 8px}.win .name{font-weight: 700;font-size: 14px}.win .link{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;color: rgba(var(--ink), .6)}.win .k{margin-top: 14px;font: 600 10px/14px var(--mono);letter-spacing: 1px;text-transform: uppercase;color: rgba(var(--ink), .45)}.win .codebox{display: flex;align-items: center;gap: 10px;margin-top: 4px}.win .big{font: 700 24px/30px var(--mono);letter-spacing: 1.5px}.win .note{margin-top: 10px;font-size: 12px;line-height: 17px;color: rgba(var(--ink), .55)}.win .row{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 14px}.win .row .btn{flex: 1 0 0;min-width: max-content;text-align: center;white-space: nowrap}.code{font: 500 12px/16px var(--mono);letter-spacing: .5px;color: rgba(var(--ink), .7)}.pill{border-radius: calc(var(--radius) - 2px);padding: 7px 12px 7px 9px;gap: 9px}.pill .lines{display: flex;flex-direction: column;gap: 1px;min-width: 0}.pill .brand{font-size: 12px;line-height: 16px;cursor: pointer}.pill .copy, .pill .logo{cursor: pointer}.pill .copy{display: inline-flex;align-items: center;gap: 5px;margin: 0 -4px;padding: 1px 4px;border-radius: 6px;font: 600 12px/16px var(--mono);letter-spacing: .6px;color: rgba(var(--ink), .78);transition: background .15s ease, color .15s ease}.pill .copy:active{background: rgba(var(--ink), .14)}.pill .copy svg{width: 12px;height: 12px;opacity: .7}.pill .copy.done{color: rgb(var(--success-rgb))}.win .opts{margin-top: 12px;border-radius: calc(var(--radius) - 8px);background: rgba(var(--ink), .05);box-shadow: inset 0 0 0 1px rgba(var(--ink), .08)}.win .opt{display: flex;align-items: center;gap: 10px;padding: 8px 10px;cursor: pointer;-webkit-tap-highlight-color: transparent}.win .opt + .opt{border-top: 1px solid rgba(var(--ink), .08)}.win .opt .t{flex: 1;min-width: 0;font-size: 12px;line-height: 16px;font-weight: 600}.win .opt small{display: block;margin-top: 1px;font-size: 10.5px;line-height: 14px;font-weight: 400;color: rgba(var(--ink), .5)}.sw{position: relative;flex: none;width: 30px;height: 18px;border-radius: 999px;background: var(--track);transition: background .2s ease}.sw::after{content: "";position: absolute;top: 2px;left: 2px;width: 14px;height: 14px;border-radius: 50%;background: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, .3);transition: transform .22s cubic-bezier(.2, .9, .2, 1)}.sw.on{background: var(--accent)}.sw.on::after{transform: translateX(12px)}.toast{position: fixed;z-index: 4;left: 50%;bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-toast-bottom, 84px));max-width: calc(100vw - 32px);padding: 10px 16px;border-radius: var(--button-radius);font: 600 13px/18px var(--font);pointer-events: none;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;animation: rwd-toast 3.2s cubic-bezier(.2, .9, .2, 1) both}@keyframes rwd-toast{0%{opacity: 0;transform: translate(-50%, 12px) scale(.96)}8%, 88%{opacity: 1;transform: translate(-50%, 0)}100%{opacity: 0;transform: translate(-50%, 6px)}}.dot{position: relative;flex: none;width: 8px;height: 8px;border-radius: 50%;background: #6b7280}.online .dot{background: rgb(var(--success-rgb))}.observe .dot{background: var(--accent)}.agent .dot{background: var(--accent)}.observe .dot::after, .agent .dot::after, .task .now .mark::after{content: "";position: absolute;inset: -4px;border-radius: 50%;border: 2px solid var(--accent);animation: rwd-ping 1.4s cubic-bezier(.2, .6, .3, 1) infinite}.user .dot{background: rgb(var(--warning-rgb))}.btn{flex: none;margin: 0;padding: 7px 14px;border: 0;border-radius: var(--button-radius);font-weight: 600;letter-spacing: .2px;cursor: pointer;pointer-events: auto;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease}.btn:active{transform: scale(.96)}.btn.light{background: var(--solid-bg);color: var(--solid-fg)}.btn.accent{background: var(--accent);color: #fff}.btn.ghost{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.btn.stop{background: rgb(var(--danger-rgb));color: #fff;box-shadow: 0 6px 16px rgba(var(--danger-rgb), .35)}.btn.help{background: rgb(var(--warning-rgb));color: #0b0d12;padding: 4px 10px}.btn.help.on{background: rgba(var(--warning-rgb), .18);color: #fcd34d}.bar{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-bar-bottom, 14px));display: flex;align-items: center;gap: 12px;padding: 7px 7px 7px 18px;border-radius: var(--button-radius);white-space: nowrap;pointer-events: none;max-width: calc(100vw - 24px);user-select: none;-webkit-user-select: none;opacity: 0;visibility: hidden;transform: translate(-50%, 18px) scale(.96);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.observe .bar, .agent .bar, .user .bar{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.bar .status{display: flex;align-items: center;gap: 10px;min-width: 0;font-size: 14px;font-weight: 650;letter-spacing: .3px}.bar .text{display: flex;flex-direction: column;min-width: 0;overflow: hidden}.bar .head{display: flex;align-items: baseline;gap: 10px;min-width: 0}.bar .since{overflow: hidden;text-overflow: ellipsis;font-size: 12px;line-height: 16px;font-weight: 500;font-variant-numeric: tabular-nums;color: rgba(var(--ink), .55)}.bar .label{flex: none;max-width: 100%;overflow: hidden;text-overflow: ellipsis}.bar.stack{flex-wrap: wrap;justify-content: center;row-gap: 8px;width: calc(100vw - 24px);padding: 10px 7px 7px;border-radius: min(var(--button-radius), 26px)}.bar.stack .status{flex: 1 0 100%;justify-content: center}.bar.stack .acts{flex: 1 0 100%}.bar.stack .acts .btn{flex: 1}.bar .who{color: rgba(var(--ink), .5);font-weight: 500;overflow: hidden;text-overflow: ellipsis;max-width: 96px}.bar .acts{display: flex;gap: 8px}.bar .btn{min-width: 78px;min-height: 46px;padding: 12px 22px;font-size: 15px;line-height: 20px;font-weight: 700;text-align: center}.task{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);top: calc(env(safe-area-inset-top, 0px) + var(--rwd-task-top, 10px));width: min(calc(100vw - 24px), 380px);padding: 12px 14px 12px;border-radius: calc(var(--radius) - 2px);pointer-events: none;cursor: pointer;font: 13px/18px var(--font);user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;opacity: 0;visibility: hidden;transform: translate(-50%, -14px) scale(.97);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.task.on{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.task li{transition: color .25s ease}.task .mark{transition: background .25s ease, box-shadow .25s ease}.task .top{display: flex;align-items: center;gap: 8px}.task .tag{flex: none;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.task .agent{flex: 1;min-width: 0;color: rgba(var(--ink), .5);font-size: 12px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}.task .count{flex: none;font: 600 12px/16px var(--mono);color: rgba(var(--ink), .6)}.task .title{margin-top: 8px;font-size: 16px;line-height: 22px;font-weight: 700;letter-spacing: .2px}.task .track{margin-top: 8px;height: 3px;border-radius: 3px;background: rgba(var(--ink), .1);overflow: hidden}.task .fill{height: 100%;width: 0;background: var(--accent);box-shadow: 0 0 8px var(--accent);transition: width .35s cubic-bezier(.2, .9, .2, 1)}.task ol{list-style: none;margin: 10px -6px 0 0;padding: 0 6px 0 0;max-height: min(26vh, 134px);overflow-y: auto;overscroll-behavior: contain;-webkit-overflow-scrolling: touch;touch-action: pan-y;scrollbar-width: thin}.task ol.more{-webkit-mask-image: linear-gradient(#000 82%, transparent);mask-image: linear-gradient(#000 82%, transparent)}.task ol.more.end{-webkit-mask-image: none;mask-image: none}.task li{display: flex;align-items: flex-start;gap: 10px;padding: 4px 0;color: rgba(var(--ink), .42)}.task .mark{position: relative;flex: none;width: 16px;height: 16px;margin-top: 1px;border-radius: 50%;box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .25)}.task .done{color: rgba(var(--ink), .62)}.task .done .mark{background: var(--accent);box-shadow: none;color: #fff}.task .done .mark svg{width: 16px;height: 16px;display: block}.task .now{color: var(--fg);font-weight: 600}.task .now .mark{box-shadow: inset 0 0 0 2px var(--accent)}.task .now .mark::before{content: "";position: absolute;inset: 4px;border-radius: 50%;background: var(--accent)}.task.min ol{display: none}.task.min .title{font-size: 14px;line-height: 20px}.overlay{position: fixed;z-index: 1;top: 0;right: 0;bottom: 0;left: 0;display: none;background: transparent;pointer-events: auto;touch-action: none}.glow{position: fixed;z-index: 2;pointer-events: none;display: none;top: 0;right: 0;bottom: 0;left: 0}.observe.locked .overlay, .agent.locked .overlay{display: block}.observe .glow, .agent .glow{display: block;box-shadow: inset 0 0 0 5px rgba(var(--accent-rgb), .95), inset 0 0 36px 14px rgba(var(--accent-rgb), .8), inset 0 0 140px 56px rgba(var(--accent-rgb), .42);animation: rwd-glow 1.9s ease-in-out infinite}.user .glow{display: block;box-shadow: inset 0 0 0 3px rgba(var(--warning-rgb), .9), inset 0 0 18px 4px rgba(var(--warning-rgb), .3)}.cursor{position: fixed;z-index: 3;top: 0;left: 0;width: 0;height: 0;pointer-events: none;opacity: 0;will-change: transform;transition: opacity .2s ease}.cursor.on{opacity: 1}.cursor .arrow{position: absolute;left: -2px;top: -2px;width: 26px;height: 26px;overflow: visible;filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)) drop-shadow(0 0 12px rgba(var(--accent-rgb), .45));transform-origin: 2px 2px;transition: transform .09s ease-out}.cursor.press .arrow{transform: scale(.82)}.ripple{position: fixed;z-index: 3;width: 40px;height: 40px;margin: -20px 0 0 -20px;border-radius: 50%;border: 2px solid var(--accent);background: rgba(var(--accent-rgb), .16);pointer-events: none;animation: rwd-ripple .45s cubic-bezier(.2, .7, .3, 1) forwards}.hl{position: fixed;z-index: 2;pointer-events: none;border-radius: 6px;outline: 2px solid rgba(var(--accent-rgb), .9);outline-offset: 2px;background: rgba(var(--accent-rgb), .08);transition: opacity .25s ease}.scrim{position: fixed;z-index: 4;top: 0;right: 0;bottom: 0;left: 0;display: flex;align-items: center;justify-content: center;padding: 20px;background: rgba(4, 6, 10, .46);pointer-events: auto;touch-action: none;-webkit-backdrop-filter: blur(3px);backdrop-filter: blur(3px);animation: rwd-fade .2s ease both}.scrim.out{animation: rwd-fade-out .18s ease both;pointer-events: none}.dlg{width: 100%;max-width: 330px;padding: 18px 16px 14px;border-radius: calc(var(--radius) + 2px);font: 14px/20px var(--font);user-select: none;-webkit-user-select: none;animation: rwd-pop .26s cubic-bezier(.2, .9, .2, 1) both}.scrim.out .dlg{animation: rwd-pop-out .18s ease both}.dlg .tag{display: inline-block;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.dlg h3{margin: 10px 0 6px;font-size: 17px;line-height: 24px;font-weight: 700}.dlg p{margin: 0;word-break: break-word;color: rgba(var(--ink), .78)}.dlg .hint, .dlg .count{margin-top: 6px;color: rgba(var(--ink), .45);font-size: 12px;line-height: 16px}.choices{display: flex;flex-direction: column;gap: 6px;margin-top: 14px}.dlg button{margin: 0;font: inherit;color: inherit;cursor: pointer;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease, box-shadow .15s ease, opacity .15s ease}.dlg button:active{transform: scale(.97)}.choice{padding: 10px 12px;border: 0;border-radius: calc(var(--radius) - 6px);text-align: left;color: rgba(var(--ink), .85);background: rgba(var(--ink), .06);box-shadow: inset 0 0 0 1px rgba(var(--ink), .12)}.choice.on{color: var(--fg);background: rgba(var(--accent-rgb), .16);box-shadow: inset 0 0 0 1.5px var(--accent)}.dlg .acts{display: flex;gap: 8px;margin-top: 16px}.dlg .acts button{flex: 1;padding: 11px;border: 0;border-radius: calc(var(--radius) - 6px);font-weight: 650}.dlg .acts .deny{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.dlg .acts .allow{background: var(--accent);color: #fff;box-shadow: 0 6px 18px rgba(var(--accent-rgb), .4)}.dlg button[disabled]{opacity: .45}@keyframes rwd-ping{0%{transform: scale(.6);opacity: .9}100%{transform: scale(1.9);opacity: 0}}@keyframes rwd-glow{0%, 100%{opacity: .22}50%{opacity: 1}}@keyframes rwd-ripple{from{transform: scale(.25);opacity: 1}to{transform: scale(1.6);opacity: 0}}@keyframes rwd-fade{from{opacity: 0}to{opacity: 1}}@keyframes rwd-fade-out{from{opacity: 1}to{opacity: 0}}@keyframes rwd-pop{from{opacity: 0;transform: translateY(10px) scale(.94)}to{opacity: 1;transform: none}}@keyframes rwd-pop-out{from{opacity: 1;transform: none}to{opacity: 0;transform: translateY(6px) scale(.97)}}:host([dir=rtl]) .pill{padding: 7px 9px 7px 12px}:host([dir=rtl]) .win .link{margin-left: 0;margin-right: auto}:host([dir=rtl]) .bar{padding: 7px 18px 7px 7px}:host([dir=rtl]) .task ol{margin: 10px 0 0 -6px;padding: 0 0 0 6px}:host([dir=rtl]) .choice{text-align: right}:host([dir=rtl]) .sw::after{left: auto;right: 2px}:host([dir=rtl]) .sw.on::after{transform: translateX(-12px)}:host([dir=rtl]) .win .k{font-family: var(--font);letter-spacing: 0}:host([dir=rtl]) .btn, :host([dir=rtl]) .bar .status{letter-spacing: 0}.ltr{direction: ltr;unicode-bidi: isolate}@media (prefers-reduced-motion: reduce){.observe .glow, .agent .glow, .observe .dot::after, .agent .dot::after, .task .now .mark::after{animation: none}.observe .glow, .agent .glow{opacity: .9}.pill, .pill.snap, .hl, .win, .bar, .task, .scrim, .dlg{transition: none !important;animation: none !important}}`, gf = ` :host{all: initial;display: block;color: inherit;${uf}}*{box-sizing: border-box}.panel{padding: 14px;font: 13px/18px var(--font);color: inherit}.head{display: flex;align-items: center;gap: 8px}.logo{position: relative;width: 22px;height: 22px;border-radius: 6px;flex: none;background: #0b0d12}.logo::after{content: "";position: absolute;inset: 7px;border-radius: 50%;background: var(--accent)}.name{font-weight: 600;font-size: 14px}.status{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;opacity: .8}.dot{width: 8px;height: 8px;border-radius: 50%;background: #8e8e93}.online .dot{background: rgb(var(--success-rgb))}.observe .dot, .agent .dot{background: var(--accent)}.user .dot{background: rgb(var(--warning-rgb))}.card{margin-top: 12px;padding: 12px;border-radius: 10px;border: 1px solid rgba(127, 127, 127, .25);background: rgba(127, 127, 127, .08)}.k{font-size: 12px;opacity: .65}.code{display: flex;align-items: center;gap: 10px;margin-top: 4px}.code b{font: 600 22px/28px var(--mono);letter-spacing: 1px}.state{margin-top: 10px;font-size: 13px}.hint{margin-top: 8px;font-size: 12px;opacity: .65}.acts{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 12px}button{margin: 0;padding: 7px 14px;border: 0;border-radius: 8px;font: 600 13px/18px var(--font);cursor: pointer;-webkit-tap-highlight-color: transparent}.primary{background: var(--accent);color: #fff}.ghost{background: rgba(127, 127, 127, .16);color: inherit}.warn{background: rgb(var(--warning-rgb));color: #0b0d12}.small{padding: 4px 10px;font-size: 12px}${df}:host([dir=rtl]) .status{margin-left: 0;margin-right: auto}.ltr{direction: ltr;unicode-bidi: isolate}`, _f = class {
7316
+ var rf = "Remote Debugger", af = "rwd:pill", of = "rwd:cursor", sf = "rwd:task-min", cf = "rwd:auto", lf = "rwd:lock", Q = 8, uf = 400, df = " --accent-rgb: var(--rwd-accent-rgb, 59, 130, 246);--accent: rgb(var(--accent-rgb));--danger-rgb: var(--rwd-danger-rgb, 239, 68, 68);--warning-rgb: var(--rwd-warning-rgb, 245, 158, 11);--success-rgb: var(--rwd-success-rgb, 34, 197, 94);--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"PingFang SC\", \"Helvetica Neue\", \"Microsoft YaHei\", sans-serif);--mono: var(--rwd-font-mono, ui-monospace, \"SF Mono\", SFMono-Regular, Menlo, monospace);--radius: var(--rwd-radius, 18px);--button-radius: var(--rwd-button-radius, 999px);", ff = " :host(:lang(zh-TW)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"PingFang TC\", \"Helvetica Neue\", \"Microsoft JhengHei\", sans-serif)}:host(:lang(ja)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"Hiragino Sans\", \"Hiragino Kaku Gothic ProN\", \"Helvetica Neue\", \"Yu Gothic UI\", Meiryo, sans-serif)}:host(:lang(ko)){--font: var(--rwd-font, -apple-system, BlinkMacSystemFont, \"Apple SD Gothic Neo\", \"Helvetica Neue\", \"Malgun Gothic\", sans-serif)}", pf = "<svg class=\"arrow\" viewBox=\"0 0 26 26\" aria-hidden=\"true\">\n<path d=\"M3.2 1.6 L23.4 9.4 Q24.8 10 23.4 10.7 L14.6 14.6 L10.7 23.4 Q10 24.8 9.4 23.4 L1.6 3.2 Q1.1 1.1 3.2 1.6 Z\"\n fill=\"#0b0d12\" stroke=\"#fff\" stroke-width=\"2\" stroke-linejoin=\"round\"/>\n</svg>", mf = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"5\" y=\"5\" width=\"8.5\" height=\"8.5\" rx=\"2\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\"/><path d=\"M3.5 10.5V4a1.5 1.5 0 0 1 1.5-1.5h6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\"/></svg>", hf = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M4 8.4 6.8 11 12 5.6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>", gf = ` :host{all: initial;${df}--ink: 255, 255, 255;--paper: 12, 14, 20;--fg: #fff;--solid-bg: #fff;--solid-fg: #0b0d12;--track: rgba(var(--ink), .2)}${ff}:host([data-theme=light]){--ink: 11, 13, 18;--paper: 255, 255, 255;--fg: #0b0d12;--solid-bg: #0b0d12;--solid-fg: #fff;--track: rgba(11, 13, 18, .16)}*{box-sizing: border-box}.glass{background: rgba(var(--paper), .9);color: var(--fg);border: 1px solid rgba(var(--ink), .1);box-shadow: 0 12px 32px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(var(--ink), .06);-webkit-backdrop-filter: blur(18px) saturate(1.5);backdrop-filter: blur(18px) saturate(1.5)}.win.glass, .dlg.glass, .task.glass{background: rgba(var(--paper), .96)}.pill, .bar, .btn{font: 500 12px/16px var(--font)}.pill{position: fixed;z-index: 3;top: 0;left: 0;display: flex;align-items: center;gap: 8px;max-width: calc(100vw - 16px);padding: 7px 12px 7px 8px;border-radius: 999px;white-space: nowrap;background: rgba(var(--paper), .55);color: var(--fg);border: 1px solid rgba(var(--ink), .14);box-shadow: 0 8px 24px rgba(0, 0, 0, .18);-webkit-backdrop-filter: blur(16px) saturate(1.6);backdrop-filter: blur(16px) saturate(1.6);pointer-events: auto;touch-action: none;cursor: pointer;user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;transition: opacity .22s ease, transform .22s cubic-bezier(.2, .9, .2, 1), background .2s ease}.pill:active{transform: scale(.97)}.pill.open{background: rgba(var(--paper), .85)}.pill.hidden{opacity: 0;transform: scale(.9);pointer-events: none;visibility: hidden;transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s}.pill.snap{transition: left .22s cubic-bezier(.2, .9, .2, 1), top .22s cubic-bezier(.2, .9, .2, 1), opacity .22s ease, transform .22s ease}.logo{position: relative;flex: none;width: 18px;height: 18px;border-radius: 6px;background: #0b0d12;box-shadow: inset 0 0 0 1px rgba(var(--ink), .18)}.logo .dot{position: absolute;left: 5px;top: 5px}.brand{font-weight: 650;letter-spacing: .2px}.win{position: fixed;z-index: 3;width: min(calc(100vw - 16px), 300px);padding: 14px;border-radius: var(--radius);font: 13px/18px var(--font);pointer-events: auto;opacity: 0;visibility: hidden;transform: scale(.92) translateY(6px);transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .24s}.win.open{opacity: 1;visibility: visible;transform: none;transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .2, 1)}.win .head{display: flex;align-items: center;gap: 8px}.win .name{font-weight: 700;font-size: 14px}.win .link{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;color: rgba(var(--ink), .6)}.win .k{margin-top: 14px;font: 600 10px/14px var(--mono);letter-spacing: 1px;text-transform: uppercase;color: rgba(var(--ink), .45)}.win .codebox{display: flex;align-items: center;gap: 10px;margin-top: 4px}.win .big{font: 700 24px/30px var(--mono);letter-spacing: 1.5px}.win .note{margin-top: 10px;font-size: 12px;line-height: 17px;color: rgba(var(--ink), .55)}.win .row{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 14px}.win .row .btn{flex: 1 0 0;min-width: max-content;text-align: center;white-space: nowrap}.code{font: 500 12px/16px var(--mono);letter-spacing: .5px;color: rgba(var(--ink), .7)}.pill{border-radius: calc(var(--radius) - 2px);padding: 7px 12px 7px 9px;gap: 9px}.pill .lines{display: flex;flex-direction: column;gap: 1px;min-width: 0}.pill .brand{font-size: 12px;line-height: 16px;cursor: pointer}.pill .copy, .pill .logo{cursor: pointer}.pill .copy{display: inline-flex;align-items: center;gap: 5px;margin: 0 -4px;padding: 1px 4px;border-radius: 6px;font: 600 12px/16px var(--mono);letter-spacing: .6px;color: rgba(var(--ink), .78);transition: background .15s ease, color .15s ease}.pill .copy:active{background: rgba(var(--ink), .14)}.pill .copy svg{width: 12px;height: 12px;opacity: .7}.pill .copy.done{color: rgb(var(--success-rgb))}.win .opts{margin-top: 12px;border-radius: calc(var(--radius) - 8px);background: rgba(var(--ink), .05);box-shadow: inset 0 0 0 1px rgba(var(--ink), .08)}.win .opt{display: flex;align-items: center;gap: 10px;padding: 8px 10px;cursor: pointer;-webkit-tap-highlight-color: transparent}.win .opt + .opt{border-top: 1px solid rgba(var(--ink), .08)}.win .opt .t{flex: 1;min-width: 0;font-size: 12px;line-height: 16px;font-weight: 600}.win .opt small{display: block;margin-top: 1px;font-size: 10.5px;line-height: 14px;font-weight: 400;color: rgba(var(--ink), .5)}.sw{position: relative;flex: none;width: 30px;height: 18px;border-radius: 999px;background: var(--track);transition: background .2s ease}.sw::after{content: "";position: absolute;top: 2px;left: 2px;width: 14px;height: 14px;border-radius: 50%;background: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, .3);transition: transform .22s cubic-bezier(.2, .9, .2, 1)}.sw.on{background: var(--accent)}.sw.on::after{transform: translateX(12px)}.toast{position: fixed;z-index: 4;left: 50%;bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-toast-bottom, 84px));max-width: calc(100vw - 32px);padding: 10px 16px;border-radius: var(--button-radius);font: 600 13px/18px var(--font);pointer-events: none;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;animation: rwd-toast 3.2s cubic-bezier(.2, .9, .2, 1) both}@keyframes rwd-toast{0%{opacity: 0;transform: translate(-50%, 12px) scale(.96)}8%, 88%{opacity: 1;transform: translate(-50%, 0)}100%{opacity: 0;transform: translate(-50%, 6px)}}.dot{position: relative;flex: none;width: 8px;height: 8px;border-radius: 50%;background: #6b7280}.online .dot{background: rgb(var(--success-rgb))}.observe .dot{background: var(--accent)}.agent .dot{background: var(--accent)}.observe .dot::after, .agent .dot::after, .task .now .mark::after{content: "";position: absolute;inset: -4px;border-radius: 50%;border: 2px solid var(--accent);animation: rwd-ping 1.4s cubic-bezier(.2, .6, .3, 1) infinite}.user .dot{background: rgb(var(--warning-rgb))}.btn{flex: none;margin: 0;padding: 7px 14px;border: 0;border-radius: var(--button-radius);font-weight: 600;letter-spacing: .2px;cursor: pointer;pointer-events: auto;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease}.btn:active{transform: scale(.96)}.btn.light{background: var(--solid-bg);color: var(--solid-fg)}.btn.accent{background: var(--accent);color: #fff}.btn.ghost{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.btn.stop{background: rgb(var(--danger-rgb));color: #fff;box-shadow: 0 6px 16px rgba(var(--danger-rgb), .35)}.btn.help{background: rgb(var(--warning-rgb));color: #0b0d12;padding: 4px 10px}.btn.help.on{background: rgba(var(--warning-rgb), .18);color: #fcd34d}.bar{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);bottom: calc(env(safe-area-inset-bottom, 0px) + var(--rwd-bar-bottom, 14px));display: flex;align-items: center;gap: 12px;padding: 7px 7px 7px 18px;border-radius: var(--button-radius);white-space: nowrap;pointer-events: none;max-width: calc(100vw - 24px);user-select: none;-webkit-user-select: none;opacity: 0;visibility: hidden;transform: translate(-50%, 18px) scale(.96);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.observe .bar, .agent .bar, .user .bar{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.bar .status{display: flex;align-items: center;gap: 10px;min-width: 0;font-size: 14px;font-weight: 650;letter-spacing: .3px}.bar .text{display: flex;flex-direction: column;min-width: 0;overflow: hidden}.bar .head{display: flex;align-items: baseline;gap: 10px;min-width: 0}.bar .since{overflow: hidden;text-overflow: ellipsis;font-size: 12px;line-height: 16px;font-weight: 500;font-variant-numeric: tabular-nums;color: rgba(var(--ink), .55)}.bar .label{flex: none;max-width: 100%;overflow: hidden;text-overflow: ellipsis}.bar.stack{flex-wrap: wrap;justify-content: center;row-gap: 8px;width: calc(100vw - 24px);padding: 10px 7px 7px;border-radius: min(var(--button-radius), 26px)}.bar.stack .status{flex: 1 0 100%;justify-content: center}.bar.stack .acts{flex: 1 0 100%}.bar.stack .acts .btn{flex: 1}.bar .who{color: rgba(var(--ink), .5);font-weight: 500;overflow: hidden;text-overflow: ellipsis;max-width: 96px}.bar .acts{display: flex;gap: 8px}.bar .btn{min-width: 78px;min-height: 46px;padding: 12px 22px;font-size: 15px;line-height: 20px;font-weight: 700;text-align: center}.task{position: fixed;z-index: 3;left: 50%;transform: translateX(-50%);top: calc(env(safe-area-inset-top, 0px) + var(--rwd-task-top, 10px));width: min(calc(100vw - 24px), 380px);padding: 12px 14px 12px;border-radius: calc(var(--radius) - 2px);pointer-events: none;cursor: pointer;font: 13px/18px var(--font);user-select: none;-webkit-user-select: none;-webkit-tap-highlight-color: transparent;opacity: 0;visibility: hidden;transform: translate(-50%, -14px) scale(.97);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1), visibility 0s linear .3s}.task.on{pointer-events: auto;opacity: 1;visibility: visible;transform: translateX(-50%);transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .2, 1)}.task li{transition: color .25s ease}.task .mark{transition: background .25s ease, box-shadow .25s ease}.task .top{display: flex;align-items: center;gap: 8px}.task .tag{flex: none;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.task .agent{flex: 1;min-width: 0;color: rgba(var(--ink), .5);font-size: 12px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}.task .count{flex: none;font: 600 12px/16px var(--mono);color: rgba(var(--ink), .6)}.task .title{margin-top: 8px;font-size: 16px;line-height: 22px;font-weight: 700;letter-spacing: .2px}.task .track{margin-top: 8px;height: 3px;border-radius: 3px;background: rgba(var(--ink), .1);overflow: hidden}.task .fill{height: 100%;width: 0;background: var(--accent);box-shadow: 0 0 8px var(--accent);transition: width .35s cubic-bezier(.2, .9, .2, 1)}.task ol{list-style: none;margin: 4px -6px -6px -8px;padding: 6px 6px 6px 8px;max-height: min(26vh, 146px);overflow-y: auto;overscroll-behavior: contain;-webkit-overflow-scrolling: touch;touch-action: pan-y;scrollbar-width: thin}.task ol.more{-webkit-mask-image: linear-gradient(#000 82%, transparent);mask-image: linear-gradient(#000 82%, transparent)}.task ol.more.end{-webkit-mask-image: none;mask-image: none}.task li{display: flex;align-items: flex-start;gap: 10px;padding: 4px 0;color: rgba(var(--ink), .42)}.task .mark{position: relative;flex: none;width: 16px;height: 16px;margin-top: 1px;border-radius: 50%;box-shadow: inset 0 0 0 1.5px rgba(var(--ink), .25)}.task .done{color: rgba(var(--ink), .62)}.task .done .mark{background: var(--accent);box-shadow: none;color: #fff}.task .done .mark svg{width: 16px;height: 16px;display: block}.task .now{color: var(--fg);font-weight: 600}.task .now .mark{box-shadow: inset 0 0 0 2px var(--accent)}.task .now .mark::before{content: "";position: absolute;inset: 4px;border-radius: 50%;background: var(--accent)}.task.min ol{display: none}.task.min .title{font-size: 14px;line-height: 20px}.overlay{position: fixed;z-index: 1;top: 0;right: 0;bottom: 0;left: 0;display: none;background: transparent;pointer-events: auto;touch-action: none}.glow{position: fixed;z-index: 2;pointer-events: none;display: none;top: 0;right: 0;bottom: 0;left: 0}.observe.locked .overlay, .agent.locked .overlay{display: block}.observe .glow, .agent .glow{display: block;box-shadow: inset 0 0 0 5px rgba(var(--accent-rgb), .95), inset 0 0 36px 14px rgba(var(--accent-rgb), .8), inset 0 0 140px 56px rgba(var(--accent-rgb), .42);animation: rwd-glow 1.9s ease-in-out infinite}.user .glow{display: block;box-shadow: inset 0 0 0 3px rgba(var(--warning-rgb), .9), inset 0 0 18px 4px rgba(var(--warning-rgb), .3)}.cursor{position: fixed;z-index: 3;top: 0;left: 0;width: 0;height: 0;pointer-events: none;opacity: 0;will-change: transform;transition: opacity .2s ease}.cursor.on{opacity: 1}.cursor .arrow{position: absolute;left: -2px;top: -2px;width: 26px;height: 26px;overflow: visible;filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)) drop-shadow(0 0 12px rgba(var(--accent-rgb), .45));transform-origin: 2px 2px;transition: transform .09s ease-out}.cursor.press .arrow{transform: scale(.82)}.ripple{position: fixed;z-index: 3;width: 40px;height: 40px;margin: -20px 0 0 -20px;border-radius: 50%;border: 2px solid var(--accent);background: rgba(var(--accent-rgb), .16);pointer-events: none;animation: rwd-ripple .45s cubic-bezier(.2, .7, .3, 1) forwards}.hl{position: fixed;z-index: 2;pointer-events: none;border-radius: 6px;outline: 2px solid rgba(var(--accent-rgb), .9);outline-offset: 2px;background: rgba(var(--accent-rgb), .08);transition: opacity .25s ease}.scrim{position: fixed;z-index: 4;top: 0;right: 0;bottom: 0;left: 0;display: flex;align-items: center;justify-content: center;padding: 20px;background: rgba(4, 6, 10, .46);pointer-events: auto;touch-action: none;-webkit-backdrop-filter: blur(3px);backdrop-filter: blur(3px);animation: rwd-fade .2s ease both}.scrim.out{animation: rwd-fade-out .18s ease both;pointer-events: none}.dlg{width: 100%;max-width: 330px;padding: 18px 16px 14px;border-radius: calc(var(--radius) + 2px);font: 14px/20px var(--font);user-select: none;-webkit-user-select: none;animation: rwd-pop .26s cubic-bezier(.2, .9, .2, 1) both}.scrim.out .dlg{animation: rwd-pop-out .18s ease both}.dlg .tag{display: inline-block;padding: 2px 6px;border-radius: 5px;font: 600 10px/14px var(--mono);letter-spacing: 1px;color: var(--accent);background: rgba(var(--accent-rgb), .14);box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35)}.dlg h3{margin: 10px 0 6px;font-size: 17px;line-height: 24px;font-weight: 700}.dlg p{margin: 0;word-break: break-word;color: rgba(var(--ink), .78)}.dlg .hint, .dlg .count{margin-top: 6px;color: rgba(var(--ink), .45);font-size: 12px;line-height: 16px}.choices{display: flex;flex-direction: column;gap: 6px;margin-top: 14px}.dlg button{margin: 0;font: inherit;color: inherit;cursor: pointer;-webkit-tap-highlight-color: transparent;transition: transform .12s ease, background .15s ease, box-shadow .15s ease, opacity .15s ease}.dlg button:active{transform: scale(.97)}.choice{padding: 10px 12px;border: 0;border-radius: calc(var(--radius) - 6px);text-align: left;color: rgba(var(--ink), .85);background: rgba(var(--ink), .06);box-shadow: inset 0 0 0 1px rgba(var(--ink), .12)}.choice.on{color: var(--fg);background: rgba(var(--accent-rgb), .16);box-shadow: inset 0 0 0 1.5px var(--accent)}.dlg .acts{display: flex;gap: 8px;margin-top: 16px}.dlg .acts button{flex: 1;padding: 11px;border: 0;border-radius: calc(var(--radius) - 6px);font-weight: 650}.dlg .acts .deny{background: rgba(var(--ink), .08);color: rgba(var(--ink), .9);box-shadow: inset 0 0 0 1px rgba(var(--ink), .14)}.dlg .acts .allow{background: var(--accent);color: #fff;box-shadow: 0 6px 18px rgba(var(--accent-rgb), .4)}.dlg button[disabled]{opacity: .45}@keyframes rwd-ping{0%{transform: scale(.6);opacity: .9}100%{transform: scale(1.9);opacity: 0}}@keyframes rwd-glow{0%, 100%{opacity: .22}50%{opacity: 1}}@keyframes rwd-ripple{from{transform: scale(.25);opacity: 1}to{transform: scale(1.6);opacity: 0}}@keyframes rwd-fade{from{opacity: 0}to{opacity: 1}}@keyframes rwd-fade-out{from{opacity: 1}to{opacity: 0}}@keyframes rwd-pop{from{opacity: 0;transform: translateY(10px) scale(.94)}to{opacity: 1;transform: none}}@keyframes rwd-pop-out{from{opacity: 1;transform: none}to{opacity: 0;transform: translateY(6px) scale(.97)}}:host([dir=rtl]) .pill{padding: 7px 9px 7px 12px}:host([dir=rtl]) .win .link{margin-left: 0;margin-right: auto}:host([dir=rtl]) .bar{padding: 7px 18px 7px 7px}:host([dir=rtl]) .task ol{margin: 4px -8px -6px -6px;padding: 6px 8px 6px 6px}:host([dir=rtl]) .choice{text-align: right}:host([dir=rtl]) .sw::after{left: auto;right: 2px}:host([dir=rtl]) .sw.on::after{transform: translateX(-12px)}:host([dir=rtl]) .win .k{font-family: var(--font);letter-spacing: 0}:host([dir=rtl]) .btn, :host([dir=rtl]) .bar .status{letter-spacing: 0}.ltr{direction: ltr;unicode-bidi: isolate}@media (prefers-reduced-motion: reduce){.observe .glow, .agent .glow, .observe .dot::after, .agent .dot::after, .task .now .mark::after{animation: none}.observe .glow, .agent .glow{opacity: .9}.pill, .pill.snap, .hl, .win, .bar, .task, .scrim, .dlg{transition: none !important;animation: none !important}}`, _f = ` :host{all: initial;display: block;color: inherit;${df}}*{box-sizing: border-box}.panel{padding: 14px;font: 13px/18px var(--font);color: inherit}.head{display: flex;align-items: center;gap: 8px}.logo{position: relative;width: 22px;height: 22px;border-radius: 6px;flex: none;background: #0b0d12}.logo::after{content: "";position: absolute;inset: 7px;border-radius: 50%;background: var(--accent)}.name{font-weight: 600;font-size: 14px}.status{margin-left: auto;display: inline-flex;align-items: center;gap: 6px;font-size: 12px;opacity: .8}.dot{width: 8px;height: 8px;border-radius: 50%;background: #8e8e93}.online .dot{background: rgb(var(--success-rgb))}.observe .dot, .agent .dot{background: var(--accent)}.user .dot{background: rgb(var(--warning-rgb))}.card{margin-top: 12px;padding: 12px;border-radius: 10px;border: 1px solid rgba(127, 127, 127, .25);background: rgba(127, 127, 127, .08)}.k{font-size: 12px;opacity: .65}.code{display: flex;align-items: center;gap: 10px;margin-top: 4px}.code b{font: 600 22px/28px var(--mono);letter-spacing: 1px}.state{margin-top: 10px;font-size: 13px}.hint{margin-top: 8px;font-size: 12px;opacity: .65}.acts{display: flex;flex-wrap: wrap;gap: 8px;margin-top: 12px}button{margin: 0;padding: 7px 14px;border: 0;border-radius: 8px;font: 600 13px/18px var(--font);cursor: pointer;-webkit-tap-highlight-color: transparent}.primary{background: var(--accent);color: #fff}.ghost{background: rgba(127, 127, 127, .16);color: inherit}.warn{background: rgb(var(--warning-rgb));color: #0b0d12}.small{padding: 4px 10px;font-size: 12px}${ff}:host([dir=rtl]) .status{margin-left: 0;margin-right: auto}.ltr{direction: ltr;unicode-bidi: isolate}`, vf = class {
7310
7317
  constructor(e) {
7311
7318
  this.opts = e, this.winOpen = !1, this.cursorAt = null, this.panel = null, this.control = "none", this.since = null, this.sinceEl = null, this.ticker = null, this.link = "connecting", this.code = "", this.help = !1, this.agent = "AI", this.task = null, this.taskKey = "", this.taskPct = 0, this.dragged = !1, this.onClickBound = (e) => this.onClick(e), this.dialogs = [], this.t = e.text;
7312
7319
  let t = document.createElement("div");
7313
- t.id = "__rwd", t.className = "__chobitsu-hide__", t.setAttribute("aria-hidden", "true"), t.setAttribute("lang", Qd(e.lang)), t.setAttribute("dir", e.dir), t.style.cssText = "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:var(--rwd-z-index,2147483647);pointer-events:none;", wf(t, e.style), this.host = t, this.root = t.attachShadow ? t.attachShadow({ mode: "open" }) : t;
7320
+ t.id = "__rwd", t.className = "__chobitsu-hide__", t.setAttribute("aria-hidden", "true"), t.setAttribute("lang", $d(e.lang)), t.setAttribute("dir", e.dir), t.style.cssText = "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:var(--rwd-z-index,2147483647);pointer-events:none;", Tf(t, e.style), this.host = t, this.root = t.attachShadow ? t.attachShadow({ mode: "open" }) : t;
7314
7321
  let n = document.createElement("style");
7315
- n.textContent = hf, this.frame = document.createElement("div"), this.frame.innerHTML = `<div class="overlay" part="overlay"></div><div class="glow" part="glow"></div><div class="pill" part="pill" data-action="toggle" role="status"></div><div class="win glass" part="window" role="dialog"></div><div class="bar glass" part="bar" role="status"></div><div class="task glass" part="task" data-action="task" role="status"></div><div class="cursor" part="cursor">${ff}</div>`, this.pill = this.frame.querySelector(".pill"), this.win = this.frame.querySelector(".win"), this.bar = this.frame.querySelector(".bar"), this.taskEl = this.frame.querySelector(".task"), this.cursor = this.frame.querySelector(".cursor"), this.root.appendChild(n), this.root.appendChild(this.frame), this.root.addEventListener("click", (e) => this.onClick(e)), window.addEventListener("load", () => this.render());
7322
+ n.textContent = gf, this.frame = document.createElement("div"), this.frame.innerHTML = `<div class="overlay" part="overlay"></div><div class="glow" part="glow"></div><div class="pill" part="pill" data-action="toggle" role="status"></div><div class="win glass" part="window" role="dialog"></div><div class="bar glass" part="bar" role="status"></div><div class="task glass" part="task" data-action="task" role="status"></div><div class="cursor" part="cursor">${pf}</div>`, this.pill = this.frame.querySelector(".pill"), this.win = this.frame.querySelector(".win"), this.bar = this.frame.querySelector(".bar"), this.taskEl = this.frame.querySelector(".task"), this.cursor = this.frame.querySelector(".cursor"), this.root.appendChild(n), this.root.appendChild(this.frame), this.root.addEventListener("click", (e) => this.onClick(e)), window.addEventListener("load", () => this.render());
7316
7323
  try {
7317
7324
  window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => this.render());
7318
7325
  } catch (e) {}
7319
7326
  this.taskEl.addEventListener("click", (e) => this.onClick(e)), this.pill.addEventListener("click", (e) => this.onClick(e)), this.bindDrag(), window.addEventListener("resize", () => this.place()), this.render();
7320
7327
  }
7321
7328
  setText(e, t, n) {
7322
- if (this.t = e, this.opts.lang = t, this.opts.dir = n, this.host.setAttribute("lang", Qd(t)), this.host.setAttribute("dir", n), this.panel) {
7329
+ if (this.t = e, this.opts.lang = t, this.opts.dir = n, this.host.setAttribute("lang", $d(t)), this.host.setAttribute("dir", n), this.panel) {
7323
7330
  let e = this.panel.getRootNode().host;
7324
- e && (e.setAttribute("lang", Qd(t)), e.setAttribute("dir", n));
7331
+ e && (e.setAttribute("lang", $d(t)), e.setAttribute("dir", n));
7325
7332
  }
7326
7333
  this.render();
7327
7334
  }
@@ -7344,18 +7351,18 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7344
7351
  return !1;
7345
7352
  }
7346
7353
  autoLevel() {
7347
- let e = X("localStorage", sf);
7354
+ let e = X("localStorage", cf);
7348
7355
  return e === "observe" || e === "interact" || e === "advanced" ? e : null;
7349
7356
  }
7350
7357
  lockScreen() {
7351
- let e = X("localStorage", cf);
7358
+ let e = X("localStorage", lf);
7352
7359
  return e === null ? this.opts.lockScreen : e === "1";
7353
7360
  }
7354
7361
  theme() {
7355
7362
  let e = this.opts.theme || "auto";
7356
7363
  if (e === "light" || e === "dark") return e;
7357
7364
  let t = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
7358
- return e === "system" ? t : vf() || "light";
7365
+ return e === "system" ? t : yf() || "light";
7359
7366
  }
7360
7367
  toast(e) {
7361
7368
  let t = document.createElement("div");
@@ -7366,9 +7373,9 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7366
7373
  }
7367
7374
  dock(e) {
7368
7375
  let t = document.createElement("div");
7369
- t.className = "__chobitsu-hide__", t.setAttribute("lang", Qd(this.opts.lang)), t.setAttribute("dir", this.opts.dir), wf(t, this.opts.style);
7376
+ t.className = "__chobitsu-hide__", t.setAttribute("lang", $d(this.opts.lang)), t.setAttribute("dir", this.opts.dir), Tf(t, this.opts.style);
7370
7377
  let n = t.attachShadow ? t.attachShadow({ mode: "open" }) : t, r = document.createElement("style");
7371
- r.textContent = gf;
7378
+ r.textContent = _f;
7372
7379
  let i = document.createElement("div");
7373
7380
  i.className = "panel", n.appendChild(r), n.appendChild(i), n.addEventListener("click", (e) => this.onClick(e)), e.appendChild(t), this.panel = i, this.render();
7374
7381
  }
@@ -7388,7 +7395,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7388
7395
  let a = document.createElement(e);
7389
7396
  return t && (a.className = t), a.textContent = r, i.appendChild(a), a;
7390
7397
  };
7391
- r("span", "tag", nf.toUpperCase()), r("h3", "", e.title), r("p", "", e.text), e.hint && r("p", "hint", e.hint);
7398
+ r("span", "tag", rf.toUpperCase()), r("h3", "", e.title), r("p", "", e.text), e.hint && r("p", "hint", e.hint);
7392
7399
  let i = e.choice, a = [];
7393
7400
  if (e.choices && e.choices.length) {
7394
7401
  let t = r("div", "choices", "");
@@ -7410,7 +7417,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7410
7417
  e.expiresAt === void 0 && o.remove();
7411
7418
  let p = setTimeout(() => {
7412
7419
  for (let e of u) e.disabled = !1;
7413
- }, lf), m = !0, h = () => {
7420
+ }, uf), m = !0, h = () => {
7414
7421
  if (!m) return;
7415
7422
  m = !1, clearInterval(f), clearTimeout(p);
7416
7423
  let e = this.dialogs.indexOf(t);
@@ -7463,7 +7470,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7463
7470
  if (this.cursor.classList.contains("on")) return;
7464
7471
  let e = this.cursorAt;
7465
7472
  if (!e) try {
7466
- let t = JSON.parse(X("sessionStorage", af) || "null");
7473
+ let t = JSON.parse(X("sessionStorage", of) || "null");
7467
7474
  t && typeof t.x == "number" && typeof t.y == "number" && (e = t);
7468
7475
  } catch (e) {}
7469
7476
  let t = window.innerWidth, n = window.innerHeight;
@@ -7483,7 +7490,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7483
7490
  this.cursorAt = {
7484
7491
  x: e,
7485
7492
  y: t
7486
- }, Z("sessionStorage", af, JSON.stringify({
7493
+ }, Z("sessionStorage", of, JSON.stringify({
7487
7494
  x: Math.round(e),
7488
7495
  y: Math.round(t)
7489
7496
  }));
@@ -7500,15 +7507,15 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7500
7507
  let r = this.t, i = this.pill;
7501
7508
  i.className = `pill ${this.control} ${this.link}${n ? "" : " hidden"}${this.winOpen ? " open" : ""}${i.classList.contains("snap") ? " snap" : ""}`, t(i), e("span", "dot", "", e("span", "logo", "", i, "toggle"));
7502
7509
  let a = e("span", "lines", "", i);
7503
- if (e("span", "brand", nf, a, "toggle"), this.code) {
7510
+ if (e("span", "brand", rf, a, "toggle"), this.code) {
7504
7511
  let t = e("span", "copy", "", a, "copy");
7505
- e("span", "ltr", this.code, t), this.help && t.appendChild(document.createTextNode(` · ${r.helpPending}`)), t.insertAdjacentHTML("beforeend", pf);
7512
+ e("span", "ltr", this.code, t), this.help && t.appendChild(document.createTextNode(` · ${r.helpPending}`)), t.insertAdjacentHTML("beforeend", mf);
7506
7513
  } else e("span", "code", this.link === "online" ? "" : r.connecting, a);
7507
7514
  i.setAttribute("aria-label", i.textContent || "");
7508
7515
  let o = this.win;
7509
7516
  o.className = `win glass ${this.control} ${this.link}${this.winOpen ? " open" : ""}`, t(o);
7510
7517
  let s = e("div", "head", "", o);
7511
- e("span", "dot", "", e("span", "logo", "", s)), e("span", "name", nf, s);
7518
+ e("span", "dot", "", e("span", "logo", "", s)), e("span", "name", rf, s);
7512
7519
  let c = e("span", "link", "", s);
7513
7520
  e("span", "dot", "", c), e("span", "", r.link[this.link], c), e("div", "k", r.deviceCode, o);
7514
7521
  let l = e("div", "codebox", "", o);
@@ -7536,7 +7543,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7536
7543
  }
7537
7544
  tick() {
7538
7545
  let e = this.sinceEl;
7539
- e && (e.textContent = this.link === "online" ? this.since == null ? "" : this.t.connectedFor(yf(Date.now() - this.since)) : this.t.connecting);
7546
+ e && (e.textContent = this.link === "online" ? this.since == null ? "" : this.t.connectedFor(bf(Date.now() - this.since)) : this.t.connecting);
7540
7547
  }
7541
7548
  renderOptions(e, t) {
7542
7549
  let n = this.t, r = this.autoLevel(), i = this.lockScreen(), a = e("div", "opts", "", t), o = (t, n, r, i) => {
@@ -7546,7 +7553,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7546
7553
  o("auto", n.autoTitle, r ? n.autoOn(n.levels[r]) : n.autoOff, !!r), o("lock", n.lockTitle, i ? n.lockOn : n.lockOff, i);
7547
7554
  }
7548
7555
  renderTask(e, t) {
7549
- let n = this.taskEl, r = this.task, i = !!r && this.control !== "none", a = X("sessionStorage", of) === "1";
7556
+ let n = this.taskEl, r = this.task, i = !!r && this.control !== "none", a = X("sessionStorage", sf) === "1";
7550
7557
  if (n.className = `task glass${i ? " on" : ""}${a ? " min" : ""}`, !r || !i) {
7551
7558
  this.taskKey = "";
7552
7559
  return;
@@ -7567,7 +7574,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7567
7574
  let o = e("ol", "", "", n);
7568
7575
  r.steps.forEach((t, n) => {
7569
7576
  let r = e("li", n < c ? "done" : n === c ? "now" : "", "", o), i = e("span", "mark", "", r);
7570
- n < c && (i.innerHTML = mf), e("span", "", t, r);
7577
+ n < c && (i.innerHTML = hf), e("span", "", t, r);
7571
7578
  });
7572
7579
  let l = () => o.classList.toggle("end", o.scrollTop + o.clientHeight >= o.scrollHeight - 2);
7573
7580
  if (o.scrollHeight > o.clientHeight + 2) {
@@ -7584,7 +7591,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7584
7591
  let r = this.t;
7585
7592
  n.className = `panel ${this.control} ${this.link}`, t(n);
7586
7593
  let i = e("div", "head", "", n);
7587
- e("span", "logo", "", i), e("span", "name", nf, i);
7594
+ e("span", "logo", "", i), e("span", "name", rf, i);
7588
7595
  let a = e("span", "status", "", i);
7589
7596
  e("span", "dot", "", a), e("span", "", r.link[this.link], a);
7590
7597
  let o = e("div", "card", "", n);
@@ -7604,12 +7611,12 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7604
7611
  else if (r === "auto") this.toggleAuto();
7605
7612
  else if (r === "lock") {
7606
7613
  let e = !this.lockScreen();
7607
- Z("localStorage", cf, e ? "1" : "0"), this.toast(e ? this.t.lockedToast : this.t.unlockedToast), this.opts.onSettings(), this.render();
7608
- } else r === "toggle" ? (this.winOpen = !this.winOpen, this.render()) : r === "task" ? (Z("sessionStorage", of, X("sessionStorage", of) === "1" ? null : "1"), this.render()) : r === "copy" ? (bf(this.code), n.classList.contains("copy") ? (n.classList.add("done"), n.textContent = this.t.copied, setTimeout(() => this.render(), 1200)) : (n.textContent = this.t.copied, setTimeout(() => n.textContent = this.t.copy, 1500))) : (r === "takeover" || r === "handback" || r === "end") && this.opts.onControl(r);
7614
+ Z("localStorage", lf, e ? "1" : "0"), this.toast(e ? this.t.lockedToast : this.t.unlockedToast), this.opts.onSettings(), this.render();
7615
+ } else r === "toggle" ? (this.winOpen = !this.winOpen, this.render()) : r === "task" ? (Z("sessionStorage", sf, X("sessionStorage", sf) === "1" ? null : "1"), this.render()) : r === "copy" ? (xf(this.code), n.classList.contains("copy") ? (n.classList.add("done"), n.textContent = this.t.copied, setTimeout(() => this.render(), 1200)) : (n.textContent = this.t.copied, setTimeout(() => n.textContent = this.t.copy, 1500))) : (r === "takeover" || r === "handback" || r === "end") && this.opts.onControl(r);
7609
7616
  }
7610
7617
  toggleAuto() {
7611
7618
  let e = this.t;
7612
- this.autoLevel() ? (Z("localStorage", sf, null), this.toast(e.autoOffToast), this.opts.onSettings(), this.render()) : this.dialog({
7619
+ this.autoLevel() ? (Z("localStorage", cf, null), this.toast(e.autoOffToast), this.opts.onSettings(), this.render()) : this.dialog({
7613
7620
  title: e.autoDialogTitle,
7614
7621
  text: e.autoDialogText,
7615
7622
  choices: ["observe", "interact"].map((t) => ({
@@ -7622,7 +7629,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7622
7629
  onDecide: (t, n) => {
7623
7630
  if (!t) return;
7624
7631
  let r = n === "observe" ? "observe" : "interact";
7625
- Z("localStorage", sf, r), this.toast(e.autoOnToast(e.levels[r])), this.opts.onSettings(), this.render();
7632
+ Z("localStorage", cf, r), this.toast(e.autoOnToast(e.levels[r])), this.opts.onSettings(), this.render();
7626
7633
  }
7627
7634
  });
7628
7635
  }
@@ -7634,7 +7641,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7634
7641
  }
7635
7642
  savedPosition() {
7636
7643
  try {
7637
- let e = JSON.parse(X("localStorage", rf) || "null");
7644
+ let e = JSON.parse(X("localStorage", af) || "null");
7638
7645
  if (e && (e.side === "left" || e.side === "right") && typeof e.top == "number") return e;
7639
7646
  } catch (e) {}
7640
7647
  let e = this.opts.style && this.opts.style.pill;
@@ -7676,7 +7683,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7676
7683
  if (!t || r.pointerId !== t.id || (t = null, !n)) return;
7677
7684
  n = !1, this.dragged = !0, setTimeout(() => this.dragged = !1, 0);
7678
7685
  let i = e.getBoundingClientRect(), a = i.left + i.width / 2 < window.innerWidth / 2 ? "left" : "right";
7679
- Z("localStorage", rf, JSON.stringify({
7686
+ Z("localStorage", af, JSON.stringify({
7680
7687
  side: a,
7681
7688
  top: i.top / window.innerHeight
7682
7689
  })), e.classList.add("snap"), this.place();
@@ -7684,7 +7691,7 @@ var nf = "Remote Debugger", rf = "rwd:pill", af = "rwd:cursor", of = "rwd:task-m
7684
7691
  e.addEventListener("pointerup", r), e.addEventListener("pointercancel", r);
7685
7692
  }
7686
7693
  };
7687
- function vf() {
7694
+ function yf() {
7688
7695
  for (let e of [document.body, document.documentElement]) {
7689
7696
  if (!e) continue;
7690
7697
  let t = getComputedStyle(e).backgroundColor.match(/rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?/);
@@ -7692,20 +7699,20 @@ function vf() {
7692
7699
  }
7693
7700
  return null;
7694
7701
  }
7695
- function yf(e) {
7702
+ function bf(e) {
7696
7703
  let t = Math.max(0, Math.floor(e / 1e3)), n = (e) => (e < 10 ? "0" : "") + e, r = Math.floor(t / 3600);
7697
7704
  return (r ? r + ":" : "") + n(Math.floor(t / 60) % 60) + ":" + n(t % 60);
7698
7705
  }
7699
- function bf(e) {
7706
+ function xf(e) {
7700
7707
  try {
7701
7708
  if (navigator.clipboard && navigator.clipboard.writeText) {
7702
- navigator.clipboard.writeText(e).catch(() => xf(e));
7709
+ navigator.clipboard.writeText(e).catch(() => Sf(e));
7703
7710
  return;
7704
7711
  }
7705
7712
  } catch (e) {}
7706
- xf(e);
7713
+ Sf(e);
7707
7714
  }
7708
- function xf(e) {
7715
+ function Sf(e) {
7709
7716
  let t = document.createElement("textarea");
7710
7717
  t.value = e, t.setAttribute("readonly", ""), t.style.cssText = "position:fixed;top:-1000px;opacity:0;", document.body.appendChild(t), t.select();
7711
7718
  try {
@@ -7713,7 +7720,7 @@ function xf(e) {
7713
7720
  } catch (e) {}
7714
7721
  t.remove();
7715
7722
  }
7716
- function Sf(e) {
7723
+ function Cf(e) {
7717
7724
  let t = e.trim();
7718
7725
  if (/^\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}$/.test(t)) return t;
7719
7726
  try {
@@ -7734,15 +7741,15 @@ function Sf(e) {
7734
7741
  return null;
7735
7742
  }
7736
7743
  }
7737
- function Cf(e) {
7744
+ function wf(e) {
7738
7745
  return typeof e == "number" ? `${e}px` : e;
7739
7746
  }
7740
- function wf(e, t) {
7747
+ function Tf(e, t) {
7741
7748
  if (!t) return;
7742
7749
  let n = (t, n) => {
7743
7750
  n && e.style.setProperty(t, n);
7744
7751
  }, r = (e, t) => {
7745
- typeof t == "string" && n(e, Sf(t));
7752
+ typeof t == "string" && n(e, Cf(t));
7746
7753
  };
7747
7754
  r("--rwd-accent-rgb", t.accent), r("--rwd-danger-rgb", t.danger), r("--rwd-warning-rgb", t.warning), r("--rwd-success-rgb", t.success), typeof t.font == "string" && n("--rwd-font", t.font), typeof t.monoFont == "string" && n("--rwd-font-mono", t.monoFont);
7748
7755
  for (let [e, r] of [
@@ -7753,22 +7760,22 @@ function wf(e, t) {
7753
7760
  ["toastBottom", "--rwd-toast-bottom"]
7754
7761
  ]) {
7755
7762
  let i = t[e];
7756
- (typeof i == "number" || typeof i == "string") && n(r, Cf(i));
7763
+ (typeof i == "number" || typeof i == "string") && n(r, wf(i));
7757
7764
  }
7758
7765
  typeof t.zIndex == "number" && n("--rwd-z-index", String(Math.round(t.zIndex)));
7759
7766
  }
7760
7767
  // src/eruda.ts
7761
- var Tf = "https://cdn.jsdelivr.net/npm/eruda";
7762
- function Ef(e, t) {
7768
+ var Ef = "https://cdn.jsdelivr.net/npm/eruda";
7769
+ function Df(e, t) {
7763
7770
  let n = e === !0 ? {} : e && typeof e == "object" ? e : {}, r = e === !0 || !!e && typeof e == "object", i = (e, i) => typeof n[e] == "boolean" ? n[e] : r && e === "dock" ? i : !!(t && t[e]);
7764
7771
  return {
7765
7772
  dock: e !== !1 && i("dock", !0),
7766
7773
  load: e !== !1 && i("load", !1),
7767
- src: typeof n.src == "string" && n.src ? n.src : Tf,
7768
- name: typeof n.name == "string" && n.name ? n.name : nf
7774
+ src: typeof n.src == "string" && n.src ? n.src : Ef,
7775
+ name: typeof n.name == "string" && n.name ? n.name : rf
7769
7776
  };
7770
7777
  }
7771
- var Df = class {
7778
+ var Of = class {
7772
7779
  constructor(e) {
7773
7780
  this.ui = e, this.loading = !1, this.docked = null;
7774
7781
  }
@@ -7834,12 +7841,12 @@ var Df = class {
7834
7841
  stopWaiting() {
7835
7842
  this.timer && clearInterval(this.timer), this.timer = void 0;
7836
7843
  }
7837
- }, Of = /* @__PURE__ */ "pointerdown.pointerup.pointermove.pointerover.pointerout.pointerenter.pointerleave.pointercancel.touchstart.touchmove.touchend.touchcancel.mousedown.mouseup.mousemove.mouseover.mouseout.mouseenter.mouseleave.click.dblclick.auxclick.contextmenu.wheel.keydown.keypress.keyup.beforeinput.dragstart.drop.selectstart.gesturestart.gesturechange.gestureend".split(".");
7838
- function kf(e) {
7844
+ }, kf = /* @__PURE__ */ "pointerdown.pointerup.pointermove.pointerover.pointerout.pointerenter.pointerleave.pointercancel.touchstart.touchmove.touchend.touchcancel.mousedown.mouseup.mousemove.mouseover.mouseout.mouseenter.mouseleave.click.dblclick.auxclick.contextmenu.wheel.keydown.keypress.keyup.beforeinput.dragstart.drop.selectstart.gesturestart.gesturechange.gestureend".split(".");
7845
+ function Af(e) {
7839
7846
  let t = !1, n = (n) => {
7840
7847
  t && n.isTrusted && !e(n) && (n.cancelable && n.preventDefault(), n.stopImmediatePropagation());
7841
7848
  };
7842
- for (let e of Of) window.addEventListener(e, n, {
7849
+ for (let e of kf) window.addEventListener(e, n, {
7843
7850
  capture: !0,
7844
7851
  passive: !1
7845
7852
  });
@@ -7857,33 +7864,33 @@ function kf(e) {
7857
7864
  };
7858
7865
  }
7859
7866
  // src/launch.ts
7860
- var Af = "rwd_launch", jf = 300;
7861
- async function Mf(e) {
7862
- let t = Ff(e) || Ff(await Pf());
7867
+ var jf = "rwd_launch", Mf = 300;
7868
+ async function Nf(e) {
7869
+ let t = If(e) || If(await Ff());
7863
7870
  return t ? {
7864
7871
  id: t,
7865
7872
  source: "app"
7866
7873
  } : {
7867
- id: If() || Lf(oi()),
7874
+ id: Lf() || Rf(oi()),
7868
7875
  source: "cookie"
7869
7876
  };
7870
7877
  }
7871
- function Nf(e, t) {
7872
- e.source === "cookie" && t !== e.id && Lf(t);
7878
+ function Pf(e, t) {
7879
+ e.source === "cookie" && t !== e.id && Rf(t);
7873
7880
  }
7874
- async function Pf() {
7881
+ async function Ff() {
7875
7882
  let e = window.RWDLaunchId;
7876
7883
  if (typeof e != "function") return e;
7877
7884
  try {
7878
- return await Promise.race([Promise.resolve(e()), new Promise((e) => setTimeout(() => e(null), jf))]);
7885
+ return await Promise.race([Promise.resolve(e()), new Promise((e) => setTimeout(() => e(null), Mf))]);
7879
7886
  } catch (e) {
7880
7887
  return null;
7881
7888
  }
7882
7889
  }
7883
- function Ff(e) {
7890
+ function If(e) {
7884
7891
  return typeof e == "number" && isFinite(e) && (e = String(e)), typeof e == "string" && /^[\w.:-]{4,128}$/.test(e) ? e : "";
7885
7892
  }
7886
- function If() {
7893
+ function Lf() {
7887
7894
  try {
7888
7895
  let e = document.cookie.match(/(?:^|;\s*)rwd_launch=([\w-]{4,64})/);
7889
7896
  return e ? e[1] : "";
@@ -7891,25 +7898,25 @@ function If() {
7891
7898
  return "";
7892
7899
  }
7893
7900
  }
7894
- function Lf(e) {
7901
+ function Rf(e) {
7895
7902
  try {
7896
- document.cookie = `${Af}=${e}; path=/; SameSite=Lax`;
7903
+ document.cookie = `${jf}=${e}; path=/; SameSite=Lax`;
7897
7904
  } catch (e) {}
7898
7905
  return e;
7899
7906
  }
7900
7907
  // src/index.ts
7901
- var Rf = "0.2.0", zf = "rwd:code", Bf = "rwd:help", Vf = "rwd:ctl", Hf = "rwd:cfg", Uf = "rwd:alang", Wf = 12e4, Gf = 8e3, $ = null, Kf = null, qf = {}, Jf = {
7908
+ var zf = "0.2.1", Bf = "rwd:code", Vf = 1500, Hf = "rwd:help", Uf = "rwd:ctl", Wf = "rwd:cfg", Gf = "rwd:alang", Kf = 12e4, qf = 8e3, $ = null, Jf = null, Yf = {}, Xf = {
7902
7909
  start: 0,
7903
7910
  count: 0
7904
7911
  };
7905
- function Yf(e, t) {
7912
+ function Zf(e, t) {
7906
7913
  if (!t) return;
7907
7914
  let n = Date.now(), r = e + "|" + t;
7908
- if (!(qf[r] && n - qf[r] < 2e3) && (qf[r] = n, n - Jf.start > 1e4 && (Jf = {
7915
+ if (!(Yf[r] && n - Yf[r] < 2e3) && (Yf[r] = n, n - Xf.start > 1e4 && (Xf = {
7909
7916
  start: n,
7910
7917
  count: 0
7911
- }), !(++Jf.count > 30))) {
7912
- for (let e in qf) n - qf[e] > 1e4 && delete qf[e];
7918
+ }), !(++Xf.count > 30))) {
7919
+ for (let e in Yf) n - Yf[e] > 1e4 && delete Yf[e];
7913
7920
  $ && $.transport.send({
7914
7921
  t: "event",
7915
7922
  kind: e,
@@ -7918,40 +7925,40 @@ function Yf(e, t) {
7918
7925
  }, !0);
7919
7926
  }
7920
7927
  }
7921
- ef(X("localStorage", Uf)), _i(Yf);
7922
- function Xf(e) {
7923
- return Vd([e.opts.lang].concat(Hd()));
7928
+ tf(X("localStorage", Gf)), _i(Zf);
7929
+ function Qf(e) {
7930
+ return Hd([e.opts.lang].concat(Ud()));
7924
7931
  }
7925
- function Zf(e) {
7926
- e.lang = Xf(e), tf(e.lang), e.ui.setText(Kd(e.lang).ui, e.lang, qd(e.lang)), Zd(e.lang, e.gatewayUrl);
7932
+ function $f(e) {
7933
+ e.lang = Qf(e), nf(e.lang), e.ui.setText(qd(e.lang).ui, e.lang, Jd(e.lang)), Qd(e.lang, e.gatewayUrl);
7927
7934
  }
7928
- Xd(() => {
7929
- $ && Zf($);
7935
+ Zd(() => {
7936
+ $ && $f($);
7930
7937
  });
7931
- var Qf = null, $f = null;
7932
- function ep() {
7933
- return Qf || (Qf = kf((e) => !!$f && $f.isOwnControl(e))), Qf;
7934
- }
7935
- ep();
7936
- var tp = null;
7938
+ var ep = null, tp = null;
7937
7939
  function np() {
7938
- tp || (tp = Ed({
7940
+ return ep || (ep = Af((e) => !!tp && tp.isOwnControl(e))), ep;
7941
+ }
7942
+ np();
7943
+ var rp = null;
7944
+ function ip() {
7945
+ rp || (rp = Dd({
7939
7946
  onChange: (e) => {
7940
7947
  $ && $.transport.send(N({ t: "page" }, e));
7941
7948
  },
7942
7949
  onTap: (e) => {
7943
- $ && ad($.identity.pageId), Yf("user_tap", e);
7950
+ $ && ad($.identity.pageId), Zf("user_tap", e);
7944
7951
  }
7945
7952
  }));
7946
7953
  }
7947
- function rp() {
7954
+ function ap() {
7948
7955
  let e = navigator.userAgent;
7949
7956
  return /iPhone|iPad|iPod/.test(e) || /Macintosh/.test(e) && navigator.maxTouchPoints > 1 ? "ios" : /Android/.test(e) ? "android" : "web";
7950
7957
  }
7951
- function ip(e) {
7958
+ function op(e) {
7952
7959
  return {
7953
7960
  ua: navigator.userAgent,
7954
- platform: rp(),
7961
+ platform: ap(),
7955
7962
  screen: {
7956
7963
  w: window.screen ? screen.width : window.innerWidth,
7957
7964
  h: window.screen ? screen.height : window.innerHeight,
@@ -7963,7 +7970,7 @@ function ip(e) {
7963
7970
  } : null
7964
7971
  };
7965
7972
  }
7966
- function ap(e, t) {
7973
+ function sp(e, t) {
7967
7974
  let n = new URL(e.replace(/\/+$/, "") + "/", location.href);
7968
7975
  if (n.protocol !== "https:" && n.protocol !== "http:") throw Error("gatewayUrl must be http(s)");
7969
7976
  let r = new URL("page", n);
@@ -7972,69 +7979,69 @@ function ap(e, t) {
7972
7979
  presenceUrl: new URL("presence", n).href
7973
7980
  };
7974
7981
  }
7975
- function op() {
7982
+ function cp() {
7976
7983
  return $ ? $.transport.state : "idle";
7977
7984
  }
7978
- function sp() {
7985
+ function lp() {
7979
7986
  return {
7980
7987
  deviceCode: $ ? $.deviceCode : null,
7981
- status: op()
7988
+ status: cp()
7982
7989
  };
7983
7990
  }
7984
- function cp() {
7991
+ function up() {
7985
7992
  if (!$) return;
7986
7993
  let e = $.waiters;
7987
7994
  $.waiters = [];
7988
- for (let t of e) t(sp());
7995
+ for (let t of e) t(lp());
7989
7996
  }
7990
- function lp() {
7997
+ function dp() {
7991
7998
  try {
7992
- let e = JSON.parse(X("localStorage", Vf) || "null");
7993
- if (e && up(e.s) && Date.now() - e.at < Wf) return {
7999
+ let e = JSON.parse(X("localStorage", Uf) || "null");
8000
+ if (e && fp(e.s) && Date.now() - e.at < Kf) return {
7994
8001
  state: e.s,
7995
8002
  since: typeof e.since == "number" ? e.since : null
7996
8003
  };
7997
8004
  } catch (e) {}
7998
8005
  return null;
7999
8006
  }
8000
- function up(e) {
8007
+ function fp(e) {
8001
8008
  return e === "observe" || e === "agent";
8002
8009
  }
8003
- function dp(e) {
8004
- ep().set(up(e.control) && e.ui.lockScreen());
8010
+ function pp(e) {
8011
+ np().set(fp(e.control) && e.ui.lockScreen());
8005
8012
  }
8006
- function fp(e, t) {
8013
+ function mp(e, t) {
8007
8014
  e.level = t == null ? null : ml(t);
8008
8015
  }
8009
- function pp(e) {
8016
+ function hp(e) {
8010
8017
  return e && e.agent && typeof e.agent.name == "string" ? e.agent.name : void 0;
8011
8018
  }
8012
- function mp(e, t, n, r) {
8019
+ function gp(e, t, n, r) {
8013
8020
  (t === "user" || t === "none") && e.approvals.cancelConfirm(), t === "none" && (e.level = null), t !== e.control && L("control", {
8014
8021
  state: t,
8015
8022
  agent: n || null
8016
- }, !0), t === "none" ? e.attachedAt = null : typeof r == "number" && r >= 0 ? e.attachedAt = Date.now() - r : e.attachedAt == null && (e.attachedAt = Date.now()), e.control = t, e.ui.setControl(t, n, e.attachedAt), dp(e), Z("localStorage", Vf, JSON.stringify({
8023
+ }, !0), t === "none" ? e.attachedAt = null : typeof r == "number" && r >= 0 ? e.attachedAt = Date.now() - r : e.attachedAt == null && (e.attachedAt = Date.now()), e.control = t, e.ui.setControl(t, n, e.attachedAt), pp(e), Z("localStorage", Uf, JSON.stringify({
8017
8024
  s: t,
8018
8025
  at: Date.now(),
8019
8026
  since: e.attachedAt
8020
8027
  }));
8021
8028
  }
8022
- function hp(e) {
8029
+ function _p(e) {
8023
8030
  return e.level ? e.level : e.control === "none" ? null : "interact";
8024
8031
  }
8025
- function gp(e) {
8032
+ function vp(e) {
8026
8033
  return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
8027
8034
  }
8028
- function _p(e) {
8035
+ function yp(e) {
8029
8036
  return {
8030
8037
  helpButton: !!e.helpButton,
8031
- maskSelectors: gp(e.maskSelectors),
8038
+ maskSelectors: vp(e.maskSelectors),
8032
8039
  maskPatterns: Array.isArray(e.maskPatterns) ? e.maskPatterns.filter((e) => e && typeof e.regex == "string").map((e) => ({
8033
8040
  name: String(e.name || ""),
8034
8041
  regex: e.regex
8035
8042
  })) : [],
8036
- confirmSelectors: gp(e.confirmSelectors),
8037
- networkExclude: gp(e.networkExclude),
8043
+ confirmSelectors: vp(e.confirmSelectors),
8044
+ networkExclude: vp(e.networkExclude),
8038
8045
  sessionLog: e.sessionLog !== !1,
8039
8046
  eruda: e.eruda && typeof e.eruda == "object" ? {
8040
8047
  dock: !!e.eruda.dock,
@@ -8042,19 +8049,19 @@ function _p(e) {
8042
8049
  } : null
8043
8050
  };
8044
8051
  }
8045
- function vp(e, t) {
8046
- e.config = t, $n(t ? t.maskSelectors : [], t ? t.maskPatterns : []), vl(t ? t.confirmSelectors : []), Oi(gp(e.opts.networkExclude).concat(t ? t.networkExclude : [])), t && !t.sessionLog && Fr(!0), e.ui.setHelpButton(!!e.opts.helpButton || !!t && t.helpButton), e.ui.host.isConnected && e.eruda.apply(Ef(e.opts.eruda, t && t.eruda));
8052
+ function bp(e, t) {
8053
+ e.config = t, $n(t ? t.maskSelectors : [], t ? t.maskPatterns : []), vl(t ? t.confirmSelectors : []), Oi(vp(e.opts.networkExclude).concat(t ? t.networkExclude : [])), t && !t.sessionLog && Fr(!0), e.ui.setHelpButton(!!e.opts.helpButton || !!t && t.helpButton), e.ui.host.isConnected && e.eruda.apply(Df(e.opts.eruda, t && t.eruda));
8047
8054
  }
8048
- function yp(e) {
8055
+ function xp(e) {
8049
8056
  return e.opts.deviceToken || X("localStorage", "rwd:dtoken") || null;
8050
8057
  }
8051
- function bp(e) {
8058
+ function Sp(e) {
8052
8059
  return e === "online" ? "online" : e === "polling" || e === "rejected" || e === "quota" ? "offline" : "connecting";
8053
8060
  }
8054
- async function xp(e, t) {
8061
+ async function Cp(e, t) {
8055
8062
  let n;
8056
8063
  try {
8057
- let r = pl(t.method), i = hp(e);
8064
+ let r = pl(t.method), i = _p(e);
8058
8065
  if (r && i && !hl(i, r)) throw new cr("forbidden", M().needLevel(r));
8059
8066
  if (e.control === "user" && Eu.indexOf(t.method) >= 0) throw new cr("takeover", M().takenOver);
8060
8067
  t.method === "rwd.click" && ad(e.identity.pageId);
@@ -8073,9 +8080,9 @@ async function xp(e, t) {
8073
8080
  error: lr(e)
8074
8081
  };
8075
8082
  }
8076
- Sp(t.method, t.params, n), $ === e && e.transport.send(n);
8083
+ wp(t.method, t.params, n), $ === e && e.transport.send(n);
8077
8084
  }
8078
- function Sp(e, t, n) {
8085
+ function wp(e, t, n) {
8079
8086
  var r;
8080
8087
  if (Eu.indexOf(e) < 0 && e !== "rwd.evaluate") return;
8081
8088
  let i = t && typeof t == "object" ? t : {}, a = { method: e };
@@ -8089,21 +8096,21 @@ function Sp(e, t, n) {
8089
8096
  ]) i[e] !== void 0 && (a[e] = i[e]);
8090
8097
  (typeof i.value == "string" || typeof i.text == "string") && (a.text = A(String((r = i.value) == null ? i.text : r)).slice(0, 200)), n.error && (a.error = `${n.error.code}: ${n.error.message}`), L("agent", a, !0);
8091
8098
  }
8092
- function Cp(e, t) {
8093
- if (typeof t.id == "number" && typeof t.method == "string") xp(e, t);
8099
+ function Tp(e, t) {
8100
+ if (typeof t.id == "number" && typeof t.method == "string") Cp(e, t);
8094
8101
  else switch (t.t) {
8095
8102
  case "welcome":
8096
- if (typeof t.deviceToken == "string" && t.deviceToken && (e.deviceToken = t.deviceToken, Z("localStorage", Ju, t.deviceToken)), cd(e.identity.pageId, typeof t.resume == "string" ? t.resume : null), typeof t.agentLang == "string" && (ef(t.agentLang, e.gatewayUrl), Z("localStorage", Uf, t.agentLang)), e.invite && (e.invite = null, dd()), t.config && typeof t.config == "object") {
8097
- let n = _p(t.config);
8098
- vp(e, n), Z("localStorage", Hf, JSON.stringify(n));
8103
+ if (typeof t.deviceToken == "string" && t.deviceToken && (e.deviceToken = t.deviceToken, Z("localStorage", Ju, t.deviceToken)), ld(e.identity.pageId, typeof t.resume == "string" ? t.resume : null), typeof t.agentLang == "string" && (tf(t.agentLang, e.gatewayUrl), Z("localStorage", Gf, t.agentLang)), e.invite && (e.invite = null, fd()), t.config && typeof t.config == "object") {
8104
+ let n = yp(t.config);
8105
+ bp(e, n), Z("localStorage", Wf, JSON.stringify(n));
8099
8106
  }
8100
- t.deviceCode && (e.deviceCode = String(t.deviceCode), Z("localStorage", zf, e.deviceCode)), e.label = t.label || null, e.ui.setLink("online", e.deviceCode || void 0), fp(e, t.level == null ? t.control && t.control.level : t.level), mp(e, t.control && t.control.state || "none", pp(t.control), t.control && t.control.attachedMs), e.ui.setTask(t.task || null), Np(e, !!t.help), cp();
8107
+ t.deviceCode && (e.deviceCode = String(t.deviceCode), Z("localStorage", Bf, e.deviceCode)), e.label = t.label || null, e.ui.setLink("online", e.deviceCode || void 0), mp(e, t.level == null ? t.control && t.control.level : t.level), gp(e, t.control && t.control.state || "none", hp(t.control), t.control && t.control.attachedMs), e.ui.setTask(t.task || null), Fp(e, !!t.help), up();
8101
8108
  break;
8102
8109
  case "task":
8103
8110
  e.ui.setTask(t.task || null);
8104
8111
  break;
8105
8112
  case "control":
8106
- fp(e, t.level), mp(e, t.state || "none", pp(t), t.attachedMs);
8113
+ mp(e, t.level), gp(e, t.state || "none", hp(t), t.attachedMs);
8107
8114
  break;
8108
8115
  case "attach_request":
8109
8116
  e.approvals.onAttachRequest(t);
@@ -8111,37 +8118,37 @@ function Cp(e, t) {
8111
8118
  case "attach_cancel":
8112
8119
  e.approvals.onAttachCancel(String(t.requestId));
8113
8120
  break;
8114
- case "help": Np(e, !!t.on);
8121
+ case "help": Fp(e, !!t.on);
8115
8122
  }
8116
8123
  }
8117
- function wp(e, t, n = {}) {
8118
- if (Kf) return Kf;
8124
+ function Ep(e, t, n = {}) {
8125
+ if (Jf) return Jf;
8119
8126
  if (typeof e != "string" || !e) return Promise.reject(/* @__PURE__ */ Error("RemoteWebviewDebugger.run: gatewayUrl is required"));
8120
8127
  if (typeof t != "string" || !t) return Promise.reject(/* @__PURE__ */ Error("RemoteWebviewDebugger.run: appKey is required"));
8121
8128
  let r;
8122
8129
  try {
8123
- r = ap(e, t);
8130
+ r = sp(e, t);
8124
8131
  } catch (e) {
8125
8132
  return Promise.reject(e);
8126
8133
  }
8127
- let i = ud();
8128
- np();
8134
+ let i = dd();
8135
+ ip();
8129
8136
  let a = id(n.deviceId);
8130
- n.locales && Jd(n.locales), n.messages && Yd(n.messages);
8131
- let o = Vd([n.lang].concat(Hd()));
8132
- tf(o);
8133
- let s = new _f({
8137
+ n.locales && Yd(n.locales), n.messages && Xd(n.messages);
8138
+ let o = Hd([n.lang].concat(Ud()));
8139
+ nf(o);
8140
+ let s = new vf({
8134
8141
  lang: o,
8135
- dir: qd(o),
8136
- text: Kd(o).ui,
8142
+ dir: Jd(o),
8143
+ text: qd(o).ui,
8137
8144
  style: n.style,
8138
8145
  helpButton: !!n.helpButton,
8139
8146
  lockScreen: n.lockScreen !== !1,
8140
8147
  theme: n.theme,
8141
8148
  onSettings: () => {
8142
- $ && dp($);
8149
+ $ && pp($);
8143
8150
  },
8144
- onHelp: (e) => Pp(e),
8151
+ onHelp: (e) => Ip(e),
8145
8152
  onControl: (e) => {
8146
8153
  $ && $.transport.send({
8147
8154
  t: "control",
@@ -8149,7 +8156,7 @@ function wp(e, t, n = {}) {
8149
8156
  }, !0);
8150
8157
  }
8151
8158
  });
8152
- $f = s;
8159
+ tp = s;
8153
8160
  let c = {
8154
8161
  gatewayUrl: e,
8155
8162
  appKey: t,
@@ -8157,116 +8164,118 @@ function wp(e, t, n = {}) {
8157
8164
  identity: a,
8158
8165
  lang: o,
8159
8166
  ui: s,
8160
- deviceCode: X("localStorage", zf),
8167
+ deviceCode: X("localStorage", Bf),
8161
8168
  label: null,
8162
8169
  control: "none",
8163
8170
  attachedAt: null,
8164
8171
  level: null,
8165
- help: X("localStorage", Bf) === "1",
8172
+ help: X("localStorage", Hf) === "1",
8166
8173
  deviceToken: null,
8167
8174
  sentToken: null,
8175
+ recoverDevice: !1,
8176
+ recoveries: 0,
8168
8177
  invite: i,
8169
8178
  config: null,
8170
8179
  waiters: [],
8171
8180
  transport: null,
8172
8181
  approvals: null,
8173
- eruda: new Df(s)
8182
+ eruda: new Of(s)
8174
8183
  };
8175
- c.deviceToken = yp(c), c.approvals = new pd({
8184
+ c.deviceToken = xp(c), c.approvals = new md({
8176
8185
  ui: s,
8177
8186
  native: !!n.nativeApproval,
8178
8187
  send: (e) => c.transport.send(e, !0)
8179
- }), Oi(gp(n.networkExclude));
8188
+ }), Oi(vp(n.networkExclude));
8180
8189
  try {
8181
- let e = JSON.parse(X("localStorage", Hf) || "null");
8182
- e && typeof e == "object" && vp(c, _p(e));
8190
+ let e = JSON.parse(X("localStorage", Wf) || "null");
8191
+ e && typeof e == "object" && bp(c, yp(e));
8183
8192
  } catch (e) {}
8184
8193
  n.record === !1 ? Fr(!1) : (!c.config || c.config.sessionLog) && (L("page", {
8185
8194
  event: "open",
8186
8195
  url: A(location.href),
8187
8196
  title: A(document.title),
8188
8197
  referrer: A(document.referrer)
8189
- }), Mf(n.launchId).then((e) => Pr(e, a.pageId).then((t) => Nf(e, t))).catch(() => void 0)), c.transport = new bd({
8198
+ }), Nf(n.launchId).then((e) => Pr(e, a.pageId).then((t) => Pf(e, t))).catch(() => void 0)), c.transport = new xd({
8190
8199
  wsUrl: r.wsUrl,
8191
8200
  presenceUrl: r.presenceUrl,
8192
- hello: () => (c.sentToken = c.deviceToken = yp(c), {
8201
+ hello: () => (c.recoverDevice && (c.recoverDevice = !1, xp(c) || (sd(c.identity), c.deviceCode = null, Z("localStorage", Bf, null))), c.sentToken = c.deviceToken = xp(c), {
8193
8202
  t: "hello",
8194
8203
  v: 1,
8195
- sdk: Rf,
8204
+ sdk: zf,
8196
8205
  deviceId: c.identity.deviceId,
8197
8206
  pageId: c.identity.pageId,
8198
8207
  openerId: c.identity.openerId,
8199
8208
  userId: c.opts.userId == null ? null : String(c.opts.userId),
8200
- page: xd(),
8201
- device: ip(c.opts),
8209
+ page: Sd(),
8210
+ device: op(c.opts),
8202
8211
  help: c.help,
8203
8212
  deviceToken: c.sentToken,
8204
- resume: sd(c.identity.pageId),
8213
+ resume: cd(c.identity.pageId),
8205
8214
  invite: c.invite
8206
8215
  }),
8207
8216
  presence: () => ({
8208
8217
  key: c.appKey,
8209
8218
  deviceId: c.identity.deviceId,
8210
8219
  pageId: c.identity.pageId,
8211
- page: xd(),
8212
- device: ip(c.opts),
8220
+ page: Sd(),
8221
+ device: op(c.opts),
8213
8222
  userId: c.opts.userId == null ? null : String(c.opts.userId),
8214
8223
  help: c.help,
8215
- deviceToken: yp(c)
8224
+ deviceToken: xp(c)
8216
8225
  }),
8217
- onMessage: (e) => Cp(c, e),
8226
+ onMessage: (e) => Tp(c, e),
8218
8227
  onState: (e) => {
8219
- c.ui.setLink(bp(e), c.deviceCode || void 0), e !== "online" && c.approvals.cancelConfirm(), (e === "polling" || e === "stopped" || e === "rejected" || e === "quota") && c.control !== "none" && mp(c, "none"), (e === "stopped" || e === "rejected" || e === "quota") && cp();
8228
+ c.ui.setLink(Sp(e), c.deviceCode || void 0), e !== "online" && c.approvals.cancelConfirm(), (e === "polling" || e === "stopped" || e === "rejected" || e === "quota") && c.control !== "none" && gp(c, "none"), (e === "stopped" || e === "rejected" || e === "quota") && up();
8220
8229
  },
8221
8230
  onRejected: () => {
8222
- let e = yp(c);
8223
- return !!e && e !== c.sentToken;
8231
+ let e = xp(c);
8232
+ return e && e !== c.sentToken ? 0 : !e && !c.opts.deviceId && c.recoveries < 2 && (c.recoveries++, c.recoverDevice = !0, Vf);
8224
8233
  },
8225
- onConflict: () => ld(c.identity),
8234
+ onConflict: () => ud(c.identity),
8226
8235
  onPresence: (e) => {
8227
- e.deviceCode && (c.deviceCode = String(e.deviceCode), Z("localStorage", zf, c.deviceCode), c.ui.setLink("offline", c.deviceCode)), cp();
8228
- }
8229
- }), $ = c, s.setLink("connecting", c.deviceCode || void 0), s.setHelp(c.help), s.mount(), Zd(o, e), c.eruda.apply(Ef(c.opts.eruda, c.config && c.config.eruda));
8230
- let l = lp();
8231
- return l && (c.attachedAt = l.since, mp(c, l.state), setTimeout(() => {
8232
- $ === c && up(c.control) && !c.transport.isOnline() && mp(c, "none");
8233
- }, Gf)), Kf = new Promise((e) => {
8234
- c.waiters.push(e), setTimeout(() => cp(), Gf);
8236
+ e.deviceCode && (c.deviceCode = String(e.deviceCode), Z("localStorage", Bf, c.deviceCode), c.ui.setLink("offline", c.deviceCode)), up();
8237
+ }
8238
+ }), $ = c, s.setLink("connecting", c.deviceCode || void 0), s.setHelp(c.help), s.mount(), Qd(o, e), c.eruda.apply(Df(c.opts.eruda, c.config && c.config.eruda));
8239
+ let l = dp();
8240
+ return l && (c.attachedAt = l.since, gp(c, l.state), setTimeout(() => {
8241
+ $ === c && fp(c.control) && !c.transport.isOnline() && gp(c, "none");
8242
+ }, qf)), Jf = new Promise((e) => {
8243
+ c.waiters.push(e), setTimeout(() => up(), qf);
8235
8244
  }), od(a).then(() => {
8236
8245
  $ === c && c.transport.start();
8237
- }), Kf;
8246
+ }), Jf;
8238
8247
  }
8239
- function Tp(e) {
8248
+ function Dp(e) {
8240
8249
  $ && (L("page", { event: "hide" }), Ir(), $.transport.suspend());
8241
8250
  }
8242
- function Ep(e) {
8251
+ function Op(e) {
8243
8252
  $ && e.persisted && $.transport.resume();
8244
8253
  }
8245
- window.addEventListener("pagehide", Tp), window.addEventListener("pageshow", Ep);
8246
- function Dp() {
8254
+ window.addEventListener("pagehide", Dp), window.addEventListener("pageshow", Op);
8255
+ function kp() {
8247
8256
  let e = $;
8248
8257
  return {
8249
- deviceCode: e ? e.deviceCode : X("localStorage", zf),
8250
- status: op(),
8258
+ deviceCode: e ? e.deviceCode : X("localStorage", Bf),
8259
+ status: cp(),
8251
8260
  control: e ? e.control : "none",
8252
8261
  help: e ? e.help : !1,
8253
8262
  label: e ? e.label : null,
8254
8263
  deviceId: e ? e.identity.deviceId : null,
8255
8264
  pageId: e ? e.identity.pageId : null,
8256
- version: Rf,
8265
+ version: zf,
8257
8266
  lang: e ? e.lang : null,
8258
8267
  deviceToken: e ? e.deviceToken : X("localStorage", Ju),
8259
- level: e ? hp(e) : null,
8268
+ level: e ? _p(e) : null,
8260
8269
  config: e ? e.config : null,
8261
8270
  pending: e ? e.approvals.pending() : null,
8262
8271
  logSession: Lr() || null
8263
8272
  };
8264
8273
  }
8265
- function Op() {
8274
+ function Ap() {
8266
8275
  let e = $;
8267
- e && ($ = null, Kf = null, $f = null, e.transport.stop(), e.approvals.destroy(), e.ui.unmount(), ep().set(!1), kp(e));
8276
+ e && ($ = null, Jf = null, tp = null, e.transport.stop(), e.approvals.destroy(), e.ui.unmount(), np().set(!1), jp(e));
8268
8277
  }
8269
- function kp(e) {
8278
+ function jp(e) {
8270
8279
  let t = e.waiters;
8271
8280
  e.waiters = [];
8272
8281
  for (let n of t) n({
@@ -8274,46 +8283,46 @@ function kp(e) {
8274
8283
  status: "stopped"
8275
8284
  });
8276
8285
  }
8277
- function Ap(e) {
8286
+ function Mp(e) {
8278
8287
  let t = $;
8279
- t && (t.opts.lang = e || void 0, Zf(t));
8288
+ t && (t.opts.lang = e || void 0, $f(t));
8280
8289
  }
8281
- var jp = jd.slice();
8282
- function Mp(e) {
8290
+ var Np = Md.slice();
8291
+ function Pp(e) {
8283
8292
  let t = $, n = e == null || e === "" ? null : String(e);
8284
8293
  t && (t.opts.userId == null ? null : String(t.opts.userId)) !== n && (t.opts.userId = n, t.transport.state !== "stopped" && t.transport.restart());
8285
8294
  }
8286
- function Np(e, t) {
8287
- e.help = t, e.ui.setHelp(t), Z("localStorage", Bf, t ? "1" : null);
8295
+ function Fp(e, t) {
8296
+ e.help = t, e.ui.setHelp(t), Z("localStorage", Hf, t ? "1" : null);
8288
8297
  }
8289
- function Pp(e) {
8298
+ function Ip(e) {
8290
8299
  let t = $;
8291
- t && (Np(t, !!e), t.transport.send({
8300
+ t && (Fp(t, !!e), t.transport.send({
8292
8301
  t: "help",
8293
8302
  on: t.help
8294
8303
  }, !1));
8295
8304
  }
8296
- function Fp(e = !0) {
8297
- Pp(e);
8305
+ function Lp(e = !0) {
8306
+ Ip(e);
8298
8307
  }
8299
- function Ip(e, t) {
8308
+ function Rp(e, t) {
8300
8309
  let n = $;
8301
- return !n || !Rp(n, e) || t !== "takeover" && t !== "handback" && t !== "end" ? !1 : (n.transport.send({
8310
+ return !n || !Bp(n, e) || t !== "takeover" && t !== "handback" && t !== "end" ? !1 : (n.transport.send({
8302
8311
  t: "control",
8303
8312
  action: t
8304
8313
  }, !0), !0);
8305
8314
  }
8306
- function Lp(e, t, n) {
8315
+ function zp(e, t, n) {
8307
8316
  let r = $;
8308
- return !r || !Rp(r, e) || typeof t != "string" ? !1 : r.approvals.decide(t, n == null ? null : String(n));
8317
+ return !r || !Bp(r, e) || typeof t != "string" ? !1 : r.approvals.decide(t, n == null ? null : String(n));
8309
8318
  }
8310
- function Rp(e, t) {
8319
+ function Bp(e, t) {
8311
8320
  let n = e.opts.nativeKey;
8312
8321
  if (!n || typeof t != "string" || t.length !== n.length) return !1;
8313
8322
  let r = 0;
8314
8323
  for (let e = 0; e < t.length; e++) r |= t.charCodeAt(e) ^ n.charCodeAt(e);
8315
8324
  return r === 0;
8316
8325
  }
8317
- export { jp as builtinLocales, Dp as getStatus, Dp as status, Fp as help, Ip as nativeControl, Lp as nativeDecide, Jd as registerLocale, wp as run, Ap as setLang, Mp as setUser, Op as stop, Rf as version };
8326
+ export { Np as builtinLocales, kp as getStatus, kp as status, Lp as help, Rp as nativeControl, zp as nativeDecide, Yd as registerLocale, Ep as run, Mp as setLang, Pp as setUser, Ap as stop, zf as version };
8318
8327
 
8319
8328
  //# sourceMappingURL=index.mjs.map