@viceme-ai/sdk 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +29 -7
  2. package/dist/capability-mount.d.ts +2 -0
  3. package/dist/capability-mount.d.ts.map +1 -1
  4. package/dist/chunks/{client-w9vih8Ng.js → client-C1Sw400H.js} +429 -294
  5. package/dist/chunks/client-C1Sw400H.js.map +1 -0
  6. package/dist/chunks/integration-CTsnJ8mN.js +38 -0
  7. package/dist/chunks/integration-CTsnJ8mN.js.map +1 -0
  8. package/dist/chunks/version-CAPPYmfK.js +6 -0
  9. package/dist/chunks/{version-uPTHb89K.js.map → version-CAPPYmfK.js.map} +1 -1
  10. package/dist/core/capabilities.d.ts +1 -0
  11. package/dist/core/capabilities.d.ts.map +1 -1
  12. package/dist/core/client.d.ts.map +1 -1
  13. package/dist/core/presentation.d.ts +7 -0
  14. package/dist/core/presentation.d.ts.map +1 -1
  15. package/dist/danmaku/mount.d.ts.map +1 -1
  16. package/dist/danmaku.js +117 -91
  17. package/dist/danmaku.js.map +1 -1
  18. package/dist/engagement/integration.d.ts +15 -0
  19. package/dist/engagement/integration.d.ts.map +1 -0
  20. package/dist/generated/public-contract.d.ts +15 -1
  21. package/dist/generated/public-contract.d.ts.map +1 -1
  22. package/dist/index.js +7 -6
  23. package/dist/index.js.map +1 -1
  24. package/dist/loader/auto-loader.d.ts.map +1 -1
  25. package/dist/manifest.json +37 -28
  26. package/dist/session/session.d.ts +12 -0
  27. package/dist/session/session.d.ts.map +1 -1
  28. package/dist/testing.js +1 -1
  29. package/dist/tip/index.d.ts +2 -0
  30. package/dist/tip/index.d.ts.map +1 -1
  31. package/dist/tip/mount.d.ts.map +1 -1
  32. package/dist/tip.js +211 -194
  33. package/dist/tip.js.map +1 -1
  34. package/dist/transport/transport.d.ts.map +1 -1
  35. package/dist/version.d.ts +1 -1
  36. package/dist/viceme.min.js +46 -4
  37. package/dist/viceme.min.js.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunks/client-w9vih8Ng.js.map +0 -1
  40. package/dist/chunks/version-uPTHb89K.js +0 -6
@@ -1,47 +1,47 @@
1
- import { a as C, V as b, c as x, i as G } from "./errors-C7DfLKcF.js";
2
- import { a as q, B as z } from "./build-endpoints-NrDmg6jf.js";
3
- import { S as H, A as V } from "./version-uPTHb89K.js";
4
- const W = /* @__PURE__ */ new Set(["cn", "global"]), j = {
5
- cn: q.cn,
6
- global: q.global
1
+ import { a as R, V as v, c as k, i as Y } from "./errors-C7DfLKcF.js";
2
+ import { a as W, B as $ } from "./build-endpoints-NrDmg6jf.js";
3
+ import { S as Q, A as X } from "./version-CAPPYmfK.js";
4
+ const J = /* @__PURE__ */ new Set(["cn", "global"]), Z = {
5
+ cn: W.cn,
6
+ global: W.global
7
7
  };
8
- function me(t) {
9
- return j[t];
8
+ function Ee(t) {
9
+ return Z[t];
10
10
  }
11
- function B(t) {
11
+ function ee(t) {
12
12
  return typeof t == "string" && /^wrk_(?:test|live)_[A-Za-z0-9_-]{4,119}$/.test(t);
13
13
  }
14
- function Y(t) {
15
- return typeof t == "string" && W.has(t);
14
+ function te(t) {
15
+ return typeof t == "string" && J.has(t);
16
16
  }
17
- function he(t) {
17
+ function Se(t) {
18
18
  if (typeof t != "object" || t === null)
19
- throw C("createViceMe expects a configuration object.");
19
+ throw R("createViceMe expects a configuration object.");
20
20
  const e = t, i = /* @__PURE__ */ new Set(["workKey", "region", "signal"]);
21
21
  for (const r of Object.keys(e))
22
22
  if (!i.has(r))
23
- throw C(`Unknown configuration field "${r}".`);
24
- if (!B(e.workKey))
25
- throw C(
23
+ throw R(`Unknown configuration field "${r}".`);
24
+ if (!ee(e.workKey))
25
+ throw R(
26
26
  'Configuration field "workKey" must start with "wrk_test_" or "wrk_live_".'
27
27
  );
28
- if (!Y(e.region))
29
- throw C('Configuration field "region" must be "cn" or "global".');
28
+ if (!te(e.region))
29
+ throw R('Configuration field "region" must be "cn" or "global".');
30
30
  if (e.signal !== void 0 && !(e.signal instanceof AbortSignal))
31
- throw C('Configuration field "signal" must be an AbortSignal.');
31
+ throw R('Configuration field "signal" must be an AbortSignal.');
32
32
  return {
33
33
  workKey: e.workKey,
34
34
  region: e.region,
35
35
  signal: e.signal
36
36
  };
37
37
  }
38
- const $ = {
38
+ const ie = {
39
39
  CREATED: ["READY", "DESTROYED"],
40
40
  READY: ["DEGRADED", "DESTROYED"],
41
41
  DEGRADED: ["DESTROYED"],
42
42
  DESTROYED: []
43
43
  };
44
- class Q {
44
+ class re {
45
45
  #e = "CREATED";
46
46
  #t = /* @__PURE__ */ new Set();
47
47
  get state() {
@@ -52,8 +52,8 @@ class Q {
52
52
  }
53
53
  transition(e) {
54
54
  if (e !== this.#e) {
55
- if (!$[this.#e].includes(e))
56
- throw new b({
55
+ if (!ie[this.#e].includes(e))
56
+ throw new v({
57
57
  code: "INTERNAL_ERROR",
58
58
  message: `Illegal lifecycle transition ${this.#e} -> ${e}.`,
59
59
  retryable: !1
@@ -64,7 +64,7 @@ class Q {
64
64
  }
65
65
  /** Any operation on a destroyed client must fail closed with this guard. */
66
66
  assertAlive() {
67
- if (this.destroyed) throw x();
67
+ if (this.destroyed) throw k();
68
68
  }
69
69
  subscribe(e) {
70
70
  return this.#t.add(e), () => {
@@ -75,14 +75,14 @@ class Q {
75
75
  this.#t.clear();
76
76
  }
77
77
  }
78
- function X(t, e) {
78
+ function ae(t, e) {
79
79
  if (typeof t != "object" || t === null)
80
- throw R();
80
+ throw C();
81
81
  const i = t;
82
- if (typeof i.workKey != "string" || !Array.isArray(i.capabilities) || !i.capabilities.every((c) => typeof c == "string"))
83
- throw R();
82
+ if (typeof i.workKey != "string" || !Array.isArray(i.capabilities) || !i.capabilities.every((s) => typeof s == "string"))
83
+ throw C();
84
84
  if (i.workKey !== e)
85
- throw new b({
85
+ throw new v({
86
86
  code: "WORK_NOT_FOUND",
87
87
  message: "Work-session response did not match the requested work key.",
88
88
  retryable: !1
@@ -93,24 +93,60 @@ function X(t, e) {
93
93
  capabilities: i.capabilities
94
94
  }
95
95
  };
96
+ if (i.creator !== void 0 || i.work !== void 0) {
97
+ const s = j(i.creator), w = j(i.work);
98
+ if (typeof s.displayName != "string" || s.displayName.length === 0 || !z(s.avatarUrl) || !Number.isInteger(s.publishedWorkCount) || s.publishedWorkCount < 0 || typeof w.title != "string" || w.title.length === 0 || typeof w.summary != "string" || !z(w.coverUrl))
99
+ throw C();
100
+ r.work.creator = {
101
+ displayName: s.displayName,
102
+ avatarUrl: s.avatarUrl,
103
+ publishedWorkCount: s.publishedWorkCount
104
+ }, r.work.details = {
105
+ title: w.title,
106
+ summary: w.summary,
107
+ coverUrl: w.coverUrl
108
+ };
109
+ }
96
110
  if (typeof i.token == "string" && (r.token = i.token), typeof i.expiresAt == "string") {
97
- const c = new Date(i.expiresAt).getTime();
98
- Number.isNaN(c) || (r.expiresAt = c);
111
+ const s = new Date(i.expiresAt).getTime();
112
+ Number.isNaN(s) || (r.expiresAt = s);
99
113
  }
100
114
  return r;
101
115
  }
102
- function R() {
103
- return new b({
116
+ function j(t) {
117
+ if (typeof t != "object" || t === null) throw C();
118
+ return t;
119
+ }
120
+ function z(t) {
121
+ if (t === null) return !0;
122
+ if (typeof t != "string") return !1;
123
+ try {
124
+ return new URL(t), !0;
125
+ } catch {
126
+ return !1;
127
+ }
128
+ }
129
+ function C() {
130
+ return new v({
104
131
  code: "INTERNAL_ERROR",
105
132
  message: "Malformed work-session response.",
106
133
  retryable: !0
107
134
  });
108
135
  }
109
- class J {
136
+ function oe() {
137
+ return new v({
138
+ code: "SESSION_EXPIRED",
139
+ message: "The work session was invalidated before it completed.",
140
+ retryable: !0
141
+ });
142
+ }
143
+ class ne {
110
144
  #e;
111
145
  #t;
112
146
  #i;
113
147
  #r;
148
+ #o = 0;
149
+ #a = !1;
114
150
  constructor(e) {
115
151
  this.#e = e, this.#t = e.now ?? (() => Date.now());
116
152
  }
@@ -118,7 +154,7 @@ class J {
118
154
  return this.#i;
119
155
  }
120
156
  /** True when the cached snapshot's server-provided expiry has passed. */
121
- #a() {
157
+ #s() {
122
158
  const e = this.#i?.expiresAt;
123
159
  return e !== void 0 && e <= this.#t();
124
160
  }
@@ -130,48 +166,43 @@ class J {
130
166
  * in-flight request (single flight).
131
167
  */
132
168
  establish() {
169
+ if (this.#a) return Promise.reject(k());
133
170
  if (this.#i) {
134
- if (!this.#a()) return Promise.resolve(this.#i);
171
+ if (!this.#s()) return Promise.resolve(this.#i);
135
172
  this.#i = void 0;
136
173
  }
137
- return this.#r ??= this.#e.transport.request({
174
+ if (this.#r) return this.#r;
175
+ const e = this.#o, i = this.#e.transport.request({
138
176
  method: "POST",
139
177
  path: "/v1/public/work-sdk/sessions",
140
178
  body: { workKey: this.#e.workKey },
141
179
  signal: this.#e.signal,
142
180
  timeoutMs: this.#e.timeoutMs
143
- }).then((e) => {
144
- const i = X(e.body, this.#e.workKey);
145
- return this.#i = i, i;
181
+ }).then((r) => {
182
+ this.#c(e);
183
+ const s = ae(r.body, this.#e.workKey);
184
+ return this.#c(e), this.#i = s, s;
146
185
  }).finally(() => {
147
- this.#r = void 0;
148
- }), this.#r;
186
+ this.#r === i && (this.#r = void 0);
187
+ });
188
+ return this.#r = i, i;
149
189
  }
150
190
  async request(e) {
151
191
  const i = await this.establish();
152
- if (!i.token) throw R();
192
+ if (!i.token) throw C();
153
193
  try {
154
- return await this.#e.transport.request({
155
- ...e,
156
- authorization: i.token,
157
- userAuthorization: i.userToken,
158
- signal: this.#e.signal
159
- });
194
+ return await this.#l(e, i);
160
195
  } catch (r) {
161
- if (!(r instanceof b) || r.code !== "SESSION_EXPIRED") throw r;
196
+ if (this.#a) throw k();
197
+ if (!(r instanceof v) || r.code !== "SESSION_EXPIRED") throw r;
162
198
  this.#i === i && this.invalidate();
163
- const c = await this.establish();
164
- if (!c.token) throw R();
165
- return this.#e.transport.request({
166
- ...e,
167
- authorization: c.token,
168
- userAuthorization: c.userToken,
169
- signal: this.#e.signal
170
- });
199
+ const s = await this.establish();
200
+ if (!s.token) throw C();
201
+ return this.#l(e, s);
171
202
  }
172
203
  }
173
204
  authenticate(e) {
174
- if (!this.#i) throw R();
205
+ if (this.#n(), !this.#i) throw C();
175
206
  this.#i = {
176
207
  ...this.#i,
177
208
  userToken: e.userToken,
@@ -179,19 +210,39 @@ class J {
179
210
  };
180
211
  }
181
212
  async signOut() {
182
- this.invalidate(), await this.establish();
213
+ this.#n(), this.invalidate(), await this.establish();
183
214
  }
184
215
  /** Drop the token; next `establish()` re-authenticates. */
185
216
  invalidate() {
186
- this.#i = void 0;
217
+ this.#o += 1, this.#i = void 0, this.#r = void 0;
187
218
  }
188
219
  /** Hard cleanup: forget the token and pending work. */
189
220
  destroy() {
190
- this.invalidate(), this.#r = void 0;
221
+ this.#a || (this.#a = !0, this.#o += 1, this.#i = void 0, this.#r = void 0);
222
+ }
223
+ #n() {
224
+ if (this.#a) throw k();
225
+ }
226
+ #c(e) {
227
+ if (this.#n(), e !== this.#o) throw oe();
228
+ }
229
+ async #l(e, i) {
230
+ this.#n();
231
+ try {
232
+ const r = await this.#e.transport.request({
233
+ ...e,
234
+ authorization: i.token,
235
+ userAuthorization: i.userToken,
236
+ signal: this.#e.signal
237
+ });
238
+ return this.#n(), r;
239
+ } catch (r) {
240
+ throw this.#a ? k() : r;
241
+ }
191
242
  }
192
243
  }
193
- const M = "viceme-access-layer", U = 50;
194
- function Z(t) {
244
+ const q = "viceme-access-layer", M = 50;
245
+ function se(t) {
195
246
  switch (t) {
196
247
  case "SIGN_IN":
197
248
  return {
@@ -210,8 +261,8 @@ function Z(t) {
210
261
  };
211
262
  }
212
263
  }
213
- function ee(t) {
214
- if (!G(t)) return "操作未完成,请重试。";
264
+ function ce(t) {
265
+ if (!Y(t)) return "操作未完成,请重试。";
215
266
  switch (t.code) {
216
267
  case "CONFIG_INVALID":
217
268
  return "微信授权配置无效,请稍后重试。";
@@ -225,12 +276,12 @@ function ee(t) {
225
276
  return t.requestId ? `操作未完成,请重试。请求 ID:${t.requestId}` : "操作未完成,请重试。";
226
277
  }
227
278
  }
228
- function te() {
229
- if (customElements.get(M)) return;
279
+ function le() {
280
+ if (customElements.get(q)) return;
230
281
  class t extends HTMLElement {
231
282
  interaction;
232
283
  connectedCallback() {
233
- const i = Z(this.interaction.action), r = this.attachShadow({ mode: "open" });
284
+ const i = se(this.interaction.action), r = this.attachShadow({ mode: "open" });
234
285
  r.innerHTML = `
235
286
  <style>
236
287
  :host {
@@ -350,8 +401,43 @@ function te() {
350
401
  font-size: 1.125rem;
351
402
  }
352
403
  [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='profile-description'] {
353
- margin-top: 0.75rem;
354
- line-height: 1.625;
404
+ display: none;
405
+ }
406
+ [data-viceme='work'] {
407
+ display: none;
408
+ overflow: hidden;
409
+ margin-top: 1.25rem;
410
+ border: 1px solid #e4e4e7;
411
+ border-radius: 1rem;
412
+ background: #fafafa;
413
+ text-align: left;
414
+ }
415
+ [data-viceme='work'][data-visible='true'] { display: block; }
416
+ [data-viceme='work-cover'] {
417
+ display: block;
418
+ width: 100%;
419
+ aspect-ratio: 16 / 9;
420
+ object-fit: cover;
421
+ background: #f4f4f5;
422
+ }
423
+ [data-viceme='work-cover'][hidden] { display: none; }
424
+ [data-viceme='work-copy'] { padding: 1rem; }
425
+ [data-viceme='work-title'] {
426
+ margin: 0;
427
+ color: #18181b;
428
+ font-size: 1rem;
429
+ font-weight: 700;
430
+ line-height: 1.5;
431
+ }
432
+ [data-viceme='work-summary'] {
433
+ display: -webkit-box;
434
+ overflow: hidden;
435
+ margin: 0.375rem 0 0;
436
+ color: #71717a;
437
+ font-size: 0.875rem;
438
+ line-height: 1.5;
439
+ -webkit-box-orient: vertical;
440
+ -webkit-line-clamp: 2;
355
441
  }
356
442
  [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='action'] {
357
443
  width: 100%;
@@ -438,6 +524,13 @@ function te() {
438
524
  </div>
439
525
  <p data-viceme="profile-description"></p>
440
526
  </section>
527
+ <article data-viceme="work">
528
+ <img data-viceme="work-cover" hidden />
529
+ <div data-viceme="work-copy">
530
+ <p data-viceme="work-title"></p>
531
+ <p data-viceme="work-summary"></p>
532
+ </div>
533
+ </article>
441
534
  <p data-viceme="error" role="alert" aria-live="polite"></p>
442
535
  <div data-viceme="actions">
443
536
  <button data-viceme="action" type="button"></button>
@@ -446,70 +539,76 @@ function te() {
446
539
  <iframe data-viceme="frame" title="" referrerpolicy="no-referrer" allow="payment"></iframe>
447
540
  </section>
448
541
  `;
449
- const c = r.querySelector("[data-viceme='panel']");
450
- c.dataset.action = this.interaction.action, c.dataset.frame = "false";
451
- const N = r.querySelector("[data-viceme='description']");
452
- N.textContent = i.description;
453
- const f = r.querySelector("[data-viceme='action']"), O = f.parentElement, A = r.querySelector("[data-viceme='close']"), L = r.querySelector("[data-viceme='backdrop']"), T = r.querySelector("[data-viceme='error']"), I = r.querySelector("[data-viceme='frame']"), P = r.querySelector("[data-viceme='profile']"), n = r.querySelector("[data-viceme='avatar']"), o = r.querySelector("[data-viceme='avatar-fallback']"), u = r.querySelector("[data-viceme='profile-name']"), a = r.querySelector(
542
+ const s = r.querySelector("[data-viceme='panel']");
543
+ s.dataset.action = this.interaction.action, s.dataset.frame = "false";
544
+ const w = r.querySelector("[data-viceme='description']");
545
+ w.textContent = i.description;
546
+ const f = r.querySelector("[data-viceme='action']"), L = f.parentElement, D = r.querySelector("[data-viceme='close']"), T = r.querySelector("[data-viceme='backdrop']"), O = r.querySelector("[data-viceme='error']"), N = r.querySelector("[data-viceme='frame']"), U = r.querySelector("[data-viceme='profile']"), _ = r.querySelector("[data-viceme='avatar']"), K = r.querySelector("[data-viceme='avatar-fallback']"), a = r.querySelector("[data-viceme='profile-name']"), n = r.querySelector(
454
547
  "[data-viceme='profile-description']"
455
- ), l = r.querySelector("[data-viceme='profile-stats']");
456
- f.textContent = i.label, f.hidden = !1, O.dataset.single = "true";
457
- const v = i.label;
458
- I.title = this.interaction.action === "SIGN_IN" ? "登录授权" : "支付";
459
- const d = this.interaction.followTarget;
460
- if (d) {
461
- c.setAttribute(
548
+ ), d = r.querySelector("[data-viceme='profile-stats']"), o = r.querySelector("[data-viceme='work']"), l = r.querySelector("[data-viceme='work-cover']"), g = r.querySelector("[data-viceme='work-title']"), S = r.querySelector("[data-viceme='work-summary']");
549
+ f.textContent = i.label, f.hidden = !1, L.dataset.single = "true";
550
+ const A = i.label;
551
+ N.title = this.interaction.action === "SIGN_IN" ? "登录授权" : "支付";
552
+ const m = this.interaction.followTarget;
553
+ if (m) {
554
+ s.setAttribute(
462
555
  "aria-label",
463
- this.interaction.action === "SIGN_IN" ? `授权 ${d.displayName}` : `关注 ${d.displayName}`
464
- ), P.dataset.visible = "true", u.textContent = d.displayName;
465
- const s = [...d.description ?? ""];
466
- a.textContent = s.length > U ? `${s.slice(0, U).join("")}…` : s.join(""), s.length > U && (a.title = d.description), l.textContent = `${d.workCount} 个作品`, o.textContent = d.displayName.trim().slice(0, 1) || "V", d.avatarUrl && (n.src = d.avatarUrl, n.alt = `${d.displayName}的头像`, n.hidden = !1, o.hidden = !0);
556
+ this.interaction.action === "SIGN_IN" ? `授权 ${m.displayName}` : `关注 ${m.displayName}`
557
+ ), U.dataset.visible = "true", a.textContent = m.displayName;
558
+ const c = [...m.description ?? ""];
559
+ n.textContent = c.length > M ? `${c.slice(0, M).join("")}…` : c.join(""), c.length > M && (n.title = m.description), d.textContent = `${m.workCount} 个作品`, K.textContent = m.displayName.trim().slice(0, 1) || "V", m.avatarUrl && (_.src = m.avatarUrl, _.alt = `${m.displayName}的头像`, _.hidden = !1, K.hidden = !0);
467
560
  }
468
- let p = null;
469
- const E = (s) => {
470
- this.dispatchEvent(new CustomEvent("viceme:access-layer-close", { detail: s }));
471
- }, y = () => {
472
- p?.cancel(), E("dismissed");
561
+ const p = this.interaction.work;
562
+ p && (o.dataset.visible = "true", g.textContent = p.title, S.textContent = p.summary, p.coverUrl && (l.src = p.coverUrl, l.alt = p.title, l.hidden = !1));
563
+ let b = null, E = !1;
564
+ const y = (c) => {
565
+ E || (E = !0, this.interaction.signal?.removeEventListener("abort", u), this.dispatchEvent(new CustomEvent("viceme:access-layer-close", { detail: c })));
566
+ }, u = () => {
567
+ b?.cancel(), y("dismissed");
473
568
  };
474
- L.addEventListener("click", y), A.addEventListener("click", y), this.addEventListener("keydown", (s) => {
475
- if (s.key === "Escape" && y(), s.key === "Tab") {
476
- if (s.preventDefault(), p?.type === "frame") {
477
- I.focus();
569
+ this.interaction.signal?.addEventListener("abort", u, { once: !0 }), this.interaction.signal?.aborted && queueMicrotask(u), T.addEventListener("click", u), D.addEventListener("click", u), this.addEventListener("keydown", (c) => {
570
+ if (c.key === "Escape" && u(), c.key === "Tab") {
571
+ if (c.preventDefault(), b?.type === "frame") {
572
+ N.focus();
478
573
  return;
479
574
  }
480
- const m = [A, ...f.hidden ? [] : [f]].filter((_) => !_.disabled && !_.hidden);
481
- if (m.length === 0) return;
482
- const D = m.indexOf(r.activeElement), g = s.shiftKey ? -1 : 1;
483
- m[(D + g + m.length) % m.length]?.focus();
575
+ const x = [D, ...f.hidden ? [] : [f]].filter((G) => !G.disabled && !G.hidden);
576
+ if (x.length === 0) return;
577
+ const V = x.indexOf(r.activeElement), B = c.shiftKey ? -1 : 1;
578
+ x[(V + B + x.length) % x.length]?.focus();
484
579
  }
485
580
  });
486
- const S = async () => {
487
- f.disabled = !0, f.setAttribute("aria-busy", "true"), f.textContent = "正在打开…", T.textContent = "";
581
+ const P = async () => {
582
+ f.disabled = !0, f.setAttribute("aria-busy", "true"), f.textContent = "正在打开…", O.textContent = "";
488
583
  try {
489
- const s = await this.interaction.perform();
490
- s.type === "frame" ? (p = s, c.dataset.frame = "true", I.src = s.url, I.focus(), await s.completion) : s.type === "external" && (p = s, await s.completion), E("acted");
491
- } catch (s) {
492
- p?.cancel(), p = null, c.dataset.frame = "false", I.removeAttribute("src"), T.textContent = ee(s), f.hidden = !1, f.disabled = !1, f.removeAttribute("aria-busy"), f.textContent = v, f.focus();
584
+ const c = await this.interaction.perform();
585
+ if (E || this.interaction.signal?.aborted) {
586
+ c.type !== "completed" && c.cancel();
587
+ return;
588
+ }
589
+ c.type === "frame" ? (b = c, s.dataset.frame = "true", N.src = c.url, N.focus(), await c.completion) : c.type === "external" && (b = c, await c.completion), y("acted");
590
+ } catch (c) {
591
+ if (E) return;
592
+ b?.cancel(), b = null, s.dataset.frame = "false", N.removeAttribute("src"), O.textContent = ce(c), f.hidden = !1, f.disabled = !1, f.removeAttribute("aria-busy"), f.textContent = A, f.focus();
493
593
  }
494
594
  };
495
- f.addEventListener("click", S), queueMicrotask(() => f.focus());
595
+ f.addEventListener("click", P), queueMicrotask(() => f.focus());
496
596
  }
497
597
  }
498
- customElements.define(M, t);
598
+ customElements.define(q, t);
499
599
  }
500
- const K = async (t) => {
501
- if (typeof document > "u" || typeof customElements > "u")
502
- return "dismissed";
503
- te();
504
- const e = document.createElement(M);
600
+ const de = async (t) => {
601
+ if (typeof document > "u" || typeof customElements > "u" || t.signal?.aborted) return "dismissed";
602
+ le();
603
+ const e = document.createElement(q);
505
604
  e.interaction = t;
506
605
  const i = document.documentElement.style.overflow, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
507
606
  document.documentElement.style.overflow = "hidden", document.body.append(e);
508
607
  try {
509
- return await new Promise((c) => {
608
+ return await new Promise((s) => {
510
609
  e.addEventListener(
511
610
  "viceme:access-layer-close",
512
- (N) => c(N.detail),
611
+ (w) => s(w.detail),
513
612
  { once: !0 }
514
613
  );
515
614
  });
@@ -517,19 +616,19 @@ const K = async (t) => {
517
616
  e.remove(), document.documentElement.style.overflow = i, r?.focus();
518
617
  }
519
618
  };
520
- function k(t) {
619
+ function I(t) {
521
620
  if (typeof t != "object" || t === null) throw h();
522
621
  return t;
523
622
  }
524
623
  function h() {
525
- return new b({
624
+ return new v({
526
625
  code: "INTERNAL_ERROR",
527
626
  message: "Malformed public API response.",
528
627
  retryable: !0
529
628
  });
530
629
  }
531
- function ie(t) {
532
- const e = k(t);
630
+ function ue(t) {
631
+ const e = I(t);
533
632
  if (typeof e.id != "string" || !(typeof e.displayName == "string" || e.displayName === null) || !(typeof e.avatarUrl == "string" || e.avatarUrl === null))
534
633
  throw h();
535
634
  return {
@@ -538,11 +637,11 @@ function ie(t) {
538
637
  avatarUrl: e.avatarUrl
539
638
  };
540
639
  }
541
- function F(t) {
542
- const e = k(t);
640
+ function H(t) {
641
+ const e = I(t);
543
642
  if (typeof e.following != "boolean" || !(typeof e.followedAt == "string" || e.followedAt === null))
544
643
  throw h();
545
- const i = k(e.creator);
644
+ const i = I(e.creator);
546
645
  if (typeof i.displayName != "string" || !(typeof i.avatarUrl == "string" || i.avatarUrl === null) || !(typeof i.description == "string" || i.description === null) || !Number.isInteger(i.publishedWorkCount) || i.publishedWorkCount < 0)
547
646
  throw h();
548
647
  return {
@@ -557,8 +656,8 @@ function F(t) {
557
656
  }
558
657
  };
559
658
  }
560
- function re(t) {
561
- const e = k(t), i = /* @__PURE__ */ new Set([
659
+ function fe(t) {
660
+ const e = I(t), i = /* @__PURE__ */ new Set([
562
661
  "PUBLIC",
563
662
  "OWNER",
564
663
  "FOLLOWING",
@@ -577,11 +676,11 @@ function re(t) {
577
676
  nextAction: e.nextAction
578
677
  };
579
678
  }
580
- function ae(t) {
581
- const e = k(t);
679
+ function me(t) {
680
+ const e = I(t);
582
681
  if (typeof e.featureKey != "string" || !/^[a-z][a-z0-9_-]{1,63}$/.test(e.featureKey) || typeof e.title != "string" || e.title.trim().length === 0 || e.title.length > 120 || !(e.policyType === "PUBLIC" || e.policyType === "FOLLOW_OWNER" || e.policyType === "WORK_ENTITLEMENT"))
583
682
  throw h();
584
- const i = e.price === null ? null : k(e.price);
683
+ const i = e.price === null ? null : I(e.price);
585
684
  if (i !== null && (!Number.isInteger(i.amountCents) || i.amountCents <= 0 || i.currency !== "CNY") || e.policyType === "WORK_ENTITLEMENT" != (i !== null))
586
685
  throw h();
587
686
  return {
@@ -591,333 +690,369 @@ function ae(t) {
591
690
  price: i === null ? null : { amountCents: i.amountCents, currency: "CNY" }
592
691
  };
593
692
  }
594
- function ne() {
693
+ function he() {
595
694
  const t = crypto.getRandomValues(new Uint8Array(32));
596
- return oe(t);
695
+ return pe(t);
597
696
  }
598
- function oe(t) {
697
+ function pe(t) {
599
698
  let e = "";
600
699
  for (const i of t) e += String.fromCharCode(i);
601
700
  return btoa(e).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
602
701
  }
603
- function se() {
702
+ function ye() {
604
703
  return typeof document < "u" && document.documentElement.lang.toLowerCase() === "en-us" ? "en-US" : "zh-CN";
605
704
  }
606
- function ce(t) {
607
- const e = () => new b({
705
+ function we(t) {
706
+ const e = () => new v({
608
707
  code: "AUTH_CANCELLED",
609
708
  message: "The interactive action was cancelled.",
610
709
  retryable: !1
611
- }), i = (n, o, u, a, l, v) => {
710
+ }), i = (a) => {
711
+ if (t.signal.aborted) return Promise.reject(k());
712
+ let n;
713
+ const d = new Promise((l, g) => {
714
+ n = () => g(k()), t.signal.addEventListener("abort", n, { once: !0 }), t.signal.aborted && n();
715
+ });
716
+ let o;
717
+ try {
718
+ o = (t.presenter ?? de)({
719
+ ...a,
720
+ signal: t.signal
721
+ });
722
+ } catch (l) {
723
+ o = Promise.reject(l);
724
+ }
725
+ return Promise.race([o, d]).then((l) => {
726
+ if (t.signal.aborted) throw k();
727
+ return l;
728
+ }).finally(() => {
729
+ n && t.signal.removeEventListener("abort", n);
730
+ });
731
+ }, r = (a, n, d, o, l, g) => {
612
732
  if (typeof window > "u")
613
- throw new b({
733
+ throw new v({
614
734
  code: "CONFIG_INVALID",
615
735
  message: "Interactive access requires a browser window.",
616
736
  retryable: !1
617
737
  });
618
- let d = !0, p, E;
619
- const y = () => {
620
- d && (d = !1, window.removeEventListener("message", s));
621
- }, S = new Promise((w, m) => {
622
- p = w, E = m;
623
- }), s = (w) => {
624
- if (!d || w.origin !== o || typeof w.data != "object" || w.data === null) return;
625
- const m = w.data;
626
- if (!(m.workKey !== t.workKey || m.channel !== u)) {
627
- if (m.type === `viceme:${a}:ready`) {
628
- w.source && "postMessage" in w.source && w.source.postMessage(
738
+ let S = !0, A, m;
739
+ const p = () => {
740
+ S && (S = !1, window.removeEventListener("message", E));
741
+ }, b = new Promise((y, u) => {
742
+ A = y, m = u;
743
+ }), E = (y) => {
744
+ if (!S || y.origin !== n || typeof y.data != "object" || y.data === null) return;
745
+ const u = y.data;
746
+ if (!(u.workKey !== t.workKey || u.channel !== d)) {
747
+ if (u.type === `viceme:${o}:ready`) {
748
+ y.source && "postMessage" in y.source && y.source.postMessage(
629
749
  {
630
- type: `viceme:${a}:init`,
750
+ type: `viceme:${o}:init`,
631
751
  workKey: t.workKey,
632
- channel: u,
752
+ channel: d,
633
753
  ...l
634
754
  },
635
- o
755
+ n
636
756
  );
637
757
  return;
638
758
  }
639
- if (m.type === `viceme:${a}:cancelled`) {
640
- y(), E(e());
759
+ if (u.type === `viceme:${o}:cancelled`) {
760
+ p(), m(e());
641
761
  return;
642
762
  }
643
- m.type === `viceme:${a}:complete` && (y(), v(m).then(p, E));
763
+ u.type === `viceme:${o}:complete` && (p(), g(u).then(A, m));
644
764
  }
645
765
  };
646
- return window.addEventListener("message", s), {
766
+ return window.addEventListener("message", E), {
647
767
  type: "frame",
648
- url: n,
649
- completion: S,
768
+ url: a,
769
+ completion: b,
650
770
  cancel() {
651
- y(), p();
771
+ p(), A();
652
772
  }
653
773
  };
654
- }, r = async () => {
774
+ }, s = async () => {
655
775
  if (await t.ready(), typeof window > "u")
656
- throw new b({
776
+ throw new v({
657
777
  code: "CONFIG_INVALID",
658
778
  message: "Interactive access requires a browser window.",
659
779
  retryable: !1
660
780
  });
661
- const n = ne(), o = new URL("/sdk/login", t.widgetOrigin);
662
- o.search = new URLSearchParams({
781
+ const a = he(), n = new URL("/sdk/login", t.widgetOrigin);
782
+ n.search = new URLSearchParams({
663
783
  workKey: t.workKey,
664
- channel: n,
784
+ channel: a,
665
785
  parentOrigin: window.location.origin,
666
- locale: se()
786
+ locale: ye()
667
787
  }).toString();
668
- const u = t.session.snapshot?.token;
669
- if (!u) throw h();
670
- return i(
671
- o.toString(),
788
+ const d = t.session.snapshot?.token;
789
+ if (!d) throw h();
790
+ return r(
791
+ n.toString(),
672
792
  t.widgetOrigin,
673
- n,
793
+ a,
674
794
  "auth",
675
- { workSessionToken: u },
676
- async (a) => {
677
- if (typeof a.userToken != "string")
795
+ { workSessionToken: d },
796
+ async (o) => {
797
+ if (typeof o.userToken != "string")
678
798
  throw h();
679
- t.session.authenticate({ userToken: a.userToken, user: ie(a.user) });
799
+ t.session.authenticate({ userToken: o.userToken, user: ue(o.user) });
680
800
  }
681
801
  );
682
- }, c = async () => (await t.ready(), F(
802
+ }, w = async () => (await t.ready(), H(
683
803
  (await t.session.request({ method: "GET", path: "/v1/public/work-sdk/follow" })).body
684
- )), N = async () => (await t.ready(), F(
804
+ )), f = async () => (await t.ready(), H(
685
805
  (await t.session.request({ method: "PUT", path: "/v1/public/work-sdk/follow" })).body
686
- )), f = {
806
+ )), L = () => {
807
+ const a = t.session.snapshot?.work;
808
+ return {
809
+ ...a?.creator ? {
810
+ followTarget: {
811
+ kind: "CREATOR",
812
+ displayName: a.creator.displayName,
813
+ avatarUrl: a.creator.avatarUrl,
814
+ description: null,
815
+ workCount: a.creator.publishedWorkCount
816
+ }
817
+ } : {},
818
+ ...a?.details ? { work: a.details } : {}
819
+ };
820
+ }, D = {
687
821
  async getState() {
688
822
  await t.ready();
689
- const n = t.session.snapshot?.user ?? null;
690
- return { authenticated: n !== null, user: n };
823
+ const a = t.session.snapshot?.user ?? null;
824
+ return { authenticated: a !== null, user: a };
691
825
  },
692
826
  async signIn() {
693
- if (await (t.presenter ?? K)({
827
+ if (await t.ready(), await i({
694
828
  featureKey: "auth",
695
829
  reason: "AUTH_REQUIRED",
696
830
  action: "SIGN_IN",
697
- perform: r
831
+ ...L(),
832
+ perform: s
698
833
  }) === "dismissed") throw e();
699
834
  return this.getState();
700
835
  },
701
836
  async signOut() {
702
837
  await t.ready(), await t.session.signOut();
703
838
  }
704
- }, O = {
705
- getState: c,
706
- follow: N,
839
+ }, T = {
840
+ getState: w,
841
+ follow: f,
707
842
  unfollow: async () => {
708
- throw new b({
843
+ throw new v({
709
844
  code: "CAPABILITY_DISABLED",
710
845
  message: "Unfollow is not exposed by website access.",
711
846
  retryable: !1
712
847
  });
713
848
  }
714
- }, A = async (n) => {
849
+ }, O = async (a) => {
715
850
  await t.ready();
716
- const o = k(
851
+ const n = I(
717
852
  (await t.session.request({
718
853
  method: "POST",
719
854
  path: "/v1/public/work-sdk/access/check",
720
- body: { featureKeys: n }
855
+ body: { featureKeys: a }
721
856
  })).body
722
- ), u = k(o.decisions);
857
+ ), d = I(n.decisions);
723
858
  return Object.fromEntries(
724
- Object.entries(u).map(([a, l]) => [a, re(l)])
859
+ Object.entries(d).map(([o, l]) => [o, fe(l)])
725
860
  );
726
- }, L = async (n, o = {}) => {
861
+ }, N = async (a, n = {}) => {
727
862
  await t.ready();
728
- const u = {
729
- featureKey: n,
730
- locale: o.locale ?? "zh-CN"
731
- }, a = k(
863
+ const d = {
864
+ featureKey: a,
865
+ locale: n.locale ?? "zh-CN"
866
+ }, o = I(
732
867
  (await t.session.request({
733
868
  method: "POST",
734
869
  path: "/v1/public/work-sdk/checkout",
735
- body: u
870
+ body: d
736
871
  })).body
737
872
  );
738
- if (typeof a.checkoutUrl != "string" || typeof a.alreadyOwned != "boolean" || !(a.expiresAt === null || typeof a.expiresAt == "string" && !Number.isNaN(Date.parse(a.expiresAt))) || a.alreadyOwned !== (a.expiresAt === null))
873
+ if (typeof o.checkoutUrl != "string" || typeof o.alreadyOwned != "boolean" || !(o.expiresAt === null || typeof o.expiresAt == "string" && !Number.isNaN(Date.parse(o.expiresAt))) || o.alreadyOwned !== (o.expiresAt === null))
739
874
  throw h();
740
875
  let l;
741
876
  try {
742
- l = new URL(a.checkoutUrl);
877
+ l = new URL(o.checkoutUrl);
743
878
  } catch {
744
879
  throw h();
745
880
  }
746
- if (!a.alreadyOwned && (l.protocol !== "https:" || l.origin !== t.widgetOrigin))
881
+ if (!o.alreadyOwned && (l.protocol !== "https:" || l.origin !== t.widgetOrigin))
747
882
  throw h();
748
883
  return {
749
- checkoutUrl: a.checkoutUrl,
750
- alreadyOwned: a.alreadyOwned,
751
- expiresAt: a.expiresAt
884
+ checkoutUrl: o.checkoutUrl,
885
+ alreadyOwned: o.alreadyOwned,
886
+ expiresAt: o.expiresAt
752
887
  };
753
- }, T = (n, o) => {
754
- if (n.alreadyOwned) return { type: "completed" };
755
- const u = Date.parse(n.expiresAt);
888
+ }, U = (a, n) => {
889
+ if (a.alreadyOwned) return { type: "completed" };
890
+ const d = Date.parse(a.expiresAt);
756
891
  if (typeof window > "u")
757
- throw new b({
892
+ throw new v({
758
893
  code: "CONFIG_INVALID",
759
894
  message: "Hosted checkout requires a browser window.",
760
895
  retryable: !1
761
896
  });
762
- let a = !0, l, v, d, p;
763
- const E = new Promise((g, _) => {
764
- d = g, p = _;
765
- }), y = () => {
766
- l && clearTimeout(l), v && clearTimeout(v), document.removeEventListener("visibilitychange", m);
767
- }, S = () => {
768
- a && (a = !1, y(), p(
769
- new b({
897
+ let o = !0, l, g, S, A;
898
+ const m = new Promise((c, F) => {
899
+ S = c, A = F;
900
+ }), p = () => {
901
+ l && clearTimeout(l), g && clearTimeout(g), document.removeEventListener("visibilitychange", u);
902
+ }, b = () => {
903
+ o && (o = !1, p(), A(
904
+ new v({
770
905
  code: "SESSION_EXPIRED",
771
906
  message: "Hosted checkout session expired.",
772
907
  retryable: !0
773
908
  })
774
909
  ));
775
- }, s = () => {
776
- if (!a || document.visibilityState === "hidden") return;
777
- const g = u - t.now();
778
- if (g <= 0) {
779
- S();
910
+ }, E = () => {
911
+ if (!o || document.visibilityState === "hidden") return;
912
+ const c = d - t.now();
913
+ if (c <= 0) {
914
+ b();
780
915
  return;
781
916
  }
782
917
  l = setTimeout(() => {
783
- w();
784
- }, Math.min(1500, g));
785
- }, w = async () => {
786
- if (a)
918
+ y();
919
+ }, Math.min(1500, c));
920
+ }, y = async () => {
921
+ if (o)
787
922
  try {
788
- const g = (await A([o]))[o];
789
- if (!g) throw h();
790
- if (g.allowed) {
791
- a = !1, y(), d();
923
+ const c = (await O([n]))[n];
924
+ if (!c) throw h();
925
+ if (c.allowed) {
926
+ o = !1, p(), S();
792
927
  return;
793
928
  }
794
- s();
795
- } catch (g) {
796
- a = !1, y(), p(g);
929
+ E();
930
+ } catch (c) {
931
+ o = !1, p(), A(c);
797
932
  }
798
933
  };
799
- function m() {
800
- if (a) {
934
+ function u() {
935
+ if (o) {
801
936
  if (document.visibilityState === "hidden") {
802
937
  l && clearTimeout(l), l = void 0;
803
938
  return;
804
939
  }
805
- s();
940
+ E();
806
941
  }
807
942
  }
808
- document.addEventListener("visibilitychange", m);
809
- const D = u - t.now();
810
- return D <= 0 ? S() : (v = setTimeout(S, D), s()), {
943
+ document.addEventListener("visibilitychange", u);
944
+ const P = d - t.now();
945
+ return P <= 0 ? b() : (g = setTimeout(b, P), E()), {
811
946
  type: "frame",
812
- url: n.checkoutUrl,
813
- completion: E,
947
+ url: a.checkoutUrl,
948
+ completion: m,
814
949
  cancel() {
815
- a && (a = !1, y(), d());
950
+ o && (o = !1, p(), S());
816
951
  }
817
952
  };
818
953
  };
819
- return { auth: f, follow: O, access: {
954
+ return { auth: D, follow: T, access: {
820
955
  async getFeatures() {
821
956
  await t.ready();
822
- const n = k(
957
+ const a = I(
823
958
  (await t.session.request({
824
959
  method: "GET",
825
960
  path: "/v1/public/work-sdk/access/features"
826
961
  })).body
827
962
  );
828
- if (!Array.isArray(n.features) || n.features.length > 100)
963
+ if (!Array.isArray(a.features) || a.features.length > 100)
829
964
  throw h();
830
- return n.features.map(ae);
965
+ return a.features.map(me);
831
966
  },
832
- async check(n) {
833
- const u = (await A([n]))[n];
834
- if (!u) throw h();
835
- return u;
967
+ async check(a) {
968
+ const d = (await O([a]))[a];
969
+ if (!d) throw h();
970
+ return d;
836
971
  },
837
- checkMany: A,
838
- async require(n) {
839
- let o = await this.check(n);
840
- const u = t.presenter ?? K;
841
- for (let a = 0; !o.allowed && o.nextAction && a < 3; a += 1) {
842
- const l = o.nextAction, v = l === "FOLLOW" ? (await O.getState()).target : void 0, d = l === "CHECKOUT" ? await L(n) : void 0;
843
- if (d?.alreadyOwned) {
844
- o = await this.check(n);
972
+ checkMany: O,
973
+ async require(a) {
974
+ let n = await this.check(a);
975
+ for (let d = 0; !n.allowed && n.nextAction && d < 3; d += 1) {
976
+ const o = n.nextAction, l = o === "FOLLOW" ? (await T.getState()).target : void 0, g = o === "CHECKOUT" ? await N(a) : void 0;
977
+ if (g?.alreadyOwned) {
978
+ n = await this.check(a);
845
979
  continue;
846
980
  }
847
- if (await u({
848
- featureKey: n,
849
- reason: o.reason,
850
- action: l,
851
- ...v ? { followTarget: v } : {},
852
- perform: async () => l === "SIGN_IN" ? r() : l === "FOLLOW" ? (await O.follow(), { type: "completed" }) : T(d, n)
853
- }) === "dismissed") return o;
854
- o = await this.check(n);
981
+ if (await i({
982
+ featureKey: a,
983
+ reason: n.reason,
984
+ action: o,
985
+ ...o === "SIGN_IN" ? L() : l ? { followTarget: l } : {},
986
+ perform: async () => o === "SIGN_IN" ? s() : o === "FOLLOW" ? (await T.follow(), { type: "completed" }) : U(g, a)
987
+ }) === "dismissed") return n;
988
+ n = await this.check(a);
855
989
  }
856
- return o;
990
+ return n;
857
991
  },
858
992
  async refresh() {
859
993
  await t.ready();
860
994
  }
861
995
  }, checkout: {
862
- async open(n) {
863
- const o = await L(n.featureKey, n);
864
- if (o.alreadyOwned) return o;
865
- if (await (t.presenter ?? K)({
866
- featureKey: n.featureKey,
996
+ async open(a) {
997
+ const n = await N(a.featureKey, a);
998
+ if (n.alreadyOwned) return n;
999
+ if (await i({
1000
+ featureKey: a.featureKey,
867
1001
  reason: "PURCHASE_REQUIRED",
868
1002
  action: "CHECKOUT",
869
- perform: async () => T(o, n.featureKey)
1003
+ perform: async () => U(n, a.featureKey)
870
1004
  }) === "dismissed") throw e();
871
- return o;
1005
+ return n;
872
1006
  }
873
1007
  } };
874
1008
  }
875
- class le extends DOMException {
1009
+ class ge extends DOMException {
876
1010
  constructor() {
877
1011
  super("ViceMe client destroyed.", "AbortError");
878
1012
  }
879
1013
  }
880
- class pe {
881
- #e = new Q();
1014
+ class Ie {
1015
+ #e = new re();
882
1016
  #t;
883
1017
  #i;
884
1018
  #r = new AbortController();
885
- #a;
1019
+ #o;
886
1020
  auth;
887
1021
  access;
888
1022
  checkout;
889
1023
  /** Detaches the caller-signal listener; undefined when none was attached. */
890
- #n;
1024
+ #a;
891
1025
  constructor(e) {
892
- this.#i = e.config, this.#t = new J({
1026
+ this.#i = e.config, this.#t = new ne({
893
1027
  workKey: e.config.workKey,
894
1028
  transport: e.transport,
895
1029
  signal: this.#r.signal,
896
1030
  ...e.now !== void 0 ? { now: e.now } : {}
897
1031
  });
898
- const i = ce({
1032
+ const i = we({
899
1033
  session: this.#t,
900
1034
  workKey: e.config.workKey,
901
- widgetOrigin: z[e.config.region],
1035
+ widgetOrigin: $[e.config.region],
902
1036
  now: e.now ?? (() => Date.now()),
903
1037
  presenter: e.presenter,
904
- ready: () => this.#o()
1038
+ signal: this.#r.signal,
1039
+ ready: () => this.#s()
905
1040
  });
906
1041
  this.auth = i.auth, this.access = i.access, this.checkout = i.checkout;
907
1042
  const r = e.config.signal;
908
1043
  if (r) {
909
- const c = () => {
1044
+ const s = () => {
910
1045
  this.#r.abort(
911
1046
  r.reason instanceof Error ? r.reason : new DOMException("Caller signal aborted.", "AbortError")
912
1047
  );
913
1048
  };
914
- r.aborted ? c() : (r.addEventListener("abort", c, { once: !0 }), this.#n = () => {
915
- r.removeEventListener("abort", c);
1049
+ r.aborted ? s() : (r.addEventListener("abort", s, { once: !0 }), this.#a = () => {
1050
+ r.removeEventListener("abort", s);
916
1051
  });
917
1052
  }
918
1053
  }
919
1054
  get version() {
920
- return H;
1055
+ return Q;
921
1056
  }
922
1057
  get workKey() {
923
1058
  return this.#i.workKey;
@@ -930,18 +1065,18 @@ class pe {
930
1065
  }
931
1066
  /** Internal: public API major, used by the loader registry namespace. */
932
1067
  get apiMajor() {
933
- return V;
1068
+ return X;
934
1069
  }
935
1070
  ready() {
936
- return this.#e.destroyed ? Promise.reject(x()) : (this.#a || (this.#e.transition("READY"), this.#a = Promise.resolve()), this.#a);
1071
+ return this.#e.destroyed ? Promise.reject(k()) : (this.#o || (this.#e.transition("READY"), this.#o = Promise.resolve()), this.#o);
937
1072
  }
938
- async #o() {
939
- if (this.#e.destroyed) throw x();
1073
+ async #s() {
1074
+ if (this.#e.destroyed) throw k();
940
1075
  await this.ready();
941
1076
  try {
942
- if (await this.#t.establish(), this.#e.destroyed) throw x();
1077
+ if (await this.#t.establish(), this.#e.destroyed) throw k();
943
1078
  } catch (e) {
944
- throw this.#e.destroyed ? x() : (this.#t.invalidate(), e);
1079
+ throw this.#e.destroyed ? k() : (this.#t.invalidate(), e);
945
1080
  }
946
1081
  }
947
1082
  hasCapability(e) {
@@ -965,14 +1100,14 @@ class pe {
965
1100
  return this.#t.snapshot;
966
1101
  }
967
1102
  destroy() {
968
- this.#e.destroyed || (this.#e.transition("DESTROYED"), this.#r.abort(new le()), this.#t.destroy(), this.#e.clearListeners(), this.#a = void 0, this.#n?.(), this.#n = void 0);
1103
+ this.#e.destroyed || (this.#e.transition("DESTROYED"), this.#r.abort(new ge()), this.#t.destroy(), this.#e.clearListeners(), this.#o = void 0, this.#a?.(), this.#a = void 0);
969
1104
  }
970
1105
  }
971
1106
  export {
972
- pe as V,
973
- Y as a,
974
- B as i,
975
- me as r,
976
- he as v
1107
+ Ie as V,
1108
+ te as a,
1109
+ ee as i,
1110
+ Ee as r,
1111
+ Se as v
977
1112
  };
978
- //# sourceMappingURL=client-w9vih8Ng.js.map
1113
+ //# sourceMappingURL=client-C1Sw400H.js.map