@16x/webphone-sdk 3.1.17 → 3.1.19

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 (51) hide show
  1. package/CHANGELOG.md +267 -31
  2. package/LICENSE +1 -1
  3. package/README.md +214 -161
  4. package/dist/{Diagnostics-CK0ai_sy.cjs → Diagnostics-CgDSPlQx.cjs} +1 -1
  5. package/dist/{Diagnostics-B6xGNl8M.js → Diagnostics-DJdBDGad.js} +1 -1
  6. package/dist/{JsSipAdapter-l97xq1ao.cjs → JsSipAdapter-CgBtmR16.cjs} +1 -1
  7. package/dist/{JsSipAdapter-B8ueIoBA.js → JsSipAdapter-CiqM4KOq.js} +1 -1
  8. package/dist/SharedWorkerProtocol-4VARy5ma.cjs +1 -0
  9. package/dist/SharedWorkerProtocol-DvLUl0JZ.js +93 -0
  10. package/dist/core/CCBarCall.d.ts +1 -1
  11. package/dist/createJsSipFactory-9CPsweDR.js +9665 -0
  12. package/dist/createJsSipFactory-Dr8HbLl-.cjs +75 -0
  13. package/dist/crypto/legacySipTicket.d.ts +40 -0
  14. package/dist/diagnostics/index.cjs +1 -1
  15. package/dist/diagnostics/index.js +1 -1
  16. package/dist/errors/CCBarError.d.ts +2 -0
  17. package/dist/i18n/index.d.ts +22 -0
  18. package/dist/i18n/messages/en-US.d.ts +2 -0
  19. package/dist/i18n/messages/es-ES.d.ts +2 -0
  20. package/dist/i18n/messages/id-ID.d.ts +2 -0
  21. package/dist/i18n/messages/index.d.ts +7 -0
  22. package/dist/i18n/messages/zh-CN.d.ts +2 -0
  23. package/dist/i18n/types.d.ts +5 -0
  24. package/dist/i18n-BbEy6K9z.cjs +1 -0
  25. package/dist/i18n-D-DdHtGz.js +150 -0
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +9 -8
  29. package/dist/index.umd.js +69 -16
  30. package/dist/legacy/index.cjs +1 -1
  31. package/dist/legacy/index.js +10 -276
  32. package/dist/legacy/legacySessionProvider.d.ts +20 -9
  33. package/dist/legacySessionProvider-CKJyrade.cjs +1 -0
  34. package/dist/{CCBarClient-C2sC86Xi.js → legacySessionProvider-DBrRBB3S.js} +795 -493
  35. package/dist/shared/SharedWorkerFactory.d.ts +2 -0
  36. package/dist/shared/SharedWorkerProtocol.d.ts +2 -0
  37. package/dist/shared-worker.cjs +1 -1
  38. package/dist/shared-worker.js +65 -64
  39. package/dist/styles.css +7 -7
  40. package/dist/ui/i18n/es-ES.d.ts +2 -0
  41. package/dist/ui/i18n/id-ID.d.ts +2 -0
  42. package/dist/ui/i18n/index.d.ts +2 -0
  43. package/dist/ui/index.cjs +1 -1
  44. package/dist/ui/index.js +278 -170
  45. package/dist/version.d.ts +1 -1
  46. package/package.json +114 -109
  47. package/dist/CCBarClient-GQ3yxDur.cjs +0 -1
  48. package/dist/SharedWorkerProtocol-C-4KpECM.cjs +0 -1
  49. package/dist/SharedWorkerProtocol-CffZrUXg.js +0 -119
  50. package/dist/createJsSipFactory-B1ORbJiP.cjs +0 -22
  51. package/dist/createJsSipFactory-CoWZN-BC.js +0 -7410
package/dist/ui/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ import { a as e } from "../i18n-D-DdHtGz.js";
1
2
  //#region src/ui/i18n/en-US.ts
2
- var e = {
3
+ var t = {
3
4
  call: "Call",
4
5
  numberLabel: "Number",
5
6
  statusReady: "Ready",
@@ -51,7 +52,111 @@ var e = {
51
52
  rowAgent: "Agent",
52
53
  extensionLabel: "Extension",
53
54
  extensionPlaceholder: "Optional, assigned by the server"
54
- }, t = {
55
+ }, n = {
56
+ call: "Llamar",
57
+ numberLabel: "Número",
58
+ statusReady: "Listo",
59
+ statusSetup: "Sin inicializar",
60
+ statusConnecting: "Conectando",
61
+ statusIncoming: "Llamada entrante",
62
+ statusActive: "En llamada",
63
+ statusHeld: "En espera",
64
+ statusDialing: "Marcando",
65
+ statusEnded: "Llamada finalizada",
66
+ statusFailed: "Llamada fallida",
67
+ statusUnsupported: "Navegador no compatible",
68
+ statusPermission: "Micrófono no disponible",
69
+ statusError: "No se puede continuar",
70
+ incoming: "Llamada entrante",
71
+ answer: "Responder",
72
+ reject: "Rechazar",
73
+ hangup: "Colgar",
74
+ mute: "Silenciar",
75
+ unmute: "Activar sonido",
76
+ hold: "Retener",
77
+ resume: "Reanudar",
78
+ transfer: "Transferir",
79
+ blindTransfer: "Transferencia directa",
80
+ more: "Más",
81
+ devices: "Dispositivos",
82
+ enablePhone: "Activar teléfono",
83
+ retryPermission: "Comprobar de nuevo",
84
+ permissionTitle: "Micrófono no disponible",
85
+ permissionBody: "Permita el acceso al micrófono en la configuración del navegador y compruebe de nuevo.",
86
+ errorTitle: "No se puede continuar",
87
+ errorBody: "Compruebe la red, la autorización del dominio o el permiso del agente y vuelva a intentarlo.",
88
+ errorTokenUnavailable: "No se pudo obtener la credencial de acceso. Compruebe que el servicio de token esté activo y configurado.",
89
+ currentCall: "Llamada actual",
90
+ inbound: "Entrante",
91
+ outbound: "Saliente",
92
+ foregroundChecking: "De vuelta en primer plano, comprobando la conexión",
93
+ foregroundFailed: "Error al recuperar. Vuelva a intentarlo.",
94
+ signIn: "Iniciar sesión",
95
+ signOut: "Cerrar sesión",
96
+ outboundCall: "Saliente",
97
+ internalCall: "Interna",
98
+ agentIdle: "Disponible",
99
+ agentBusy: "Ocupado",
100
+ agentBreak: "Descanso",
101
+ agentBusyHint: "El estado ocupado lo controla la llamada o el servidor",
102
+ rowSignIn: "Presencia",
103
+ rowCall: "Llamada",
104
+ rowAgent: "Agente",
105
+ extensionLabel: "Extensión",
106
+ extensionPlaceholder: "Opcional, asignada por el servidor"
107
+ }, r = {
108
+ call: "Panggil",
109
+ numberLabel: "Nomor",
110
+ statusReady: "Siap menelepon",
111
+ statusSetup: "Belum diinisialisasi",
112
+ statusConnecting: "Menghubungkan",
113
+ statusIncoming: "Panggilan masuk",
114
+ statusActive: "Sedang menelepon",
115
+ statusHeld: "Ditahan",
116
+ statusDialing: "Sedang memanggil",
117
+ statusEnded: "Panggilan berakhir",
118
+ statusFailed: "Panggilan gagal",
119
+ statusUnsupported: "Browser tidak didukung",
120
+ statusPermission: "Mikrofon tidak tersedia",
121
+ statusError: "Tidak dapat melanjutkan panggilan",
122
+ incoming: "Panggilan masuk",
123
+ answer: "Jawab",
124
+ reject: "Tolak",
125
+ hangup: "Tutup",
126
+ mute: "Bisukan",
127
+ unmute: "Aktifkan suara",
128
+ hold: "Tahan",
129
+ resume: "Lanjutkan",
130
+ transfer: "Alihkan",
131
+ blindTransfer: "Alihkan langsung",
132
+ more: "Lainnya",
133
+ devices: "Perangkat",
134
+ enablePhone: "Aktifkan telepon",
135
+ retryPermission: "Periksa ulang",
136
+ permissionTitle: "Mikrofon tidak tersedia",
137
+ permissionBody: "Izinkan akses mikrofon untuk situs ini di pengaturan browser, lalu periksa ulang.",
138
+ errorTitle: "Tidak dapat melanjutkan panggilan",
139
+ errorBody: "Periksa jaringan, izin domain, atau izin agen, lalu coba lagi.",
140
+ errorTokenUnavailable: "Tidak dapat mendapatkan kredensial masuk. Periksa apakah layanan token berjalan dan konfigurasinya benar.",
141
+ currentCall: "Panggilan saat ini",
142
+ inbound: "Masuk",
143
+ outbound: "Keluar",
144
+ foregroundChecking: "Kembali ke depan, memeriksa koneksi",
145
+ foregroundFailed: "Pemulihan gagal, coba lagi",
146
+ signIn: "Masuk",
147
+ signOut: "Keluar",
148
+ outboundCall: "Panggilan keluar",
149
+ internalCall: "Panggilan internal",
150
+ agentIdle: "Tersedia",
151
+ agentBusy: "Sibuk",
152
+ agentBreak: "Istirahat",
153
+ agentBusyHint: "Status sibuk dikendalikan oleh panggilan atau server",
154
+ rowSignIn: "Kehadiran",
155
+ rowCall: "Panggilan",
156
+ rowAgent: "Agen",
157
+ extensionLabel: "Ekstensi",
158
+ extensionPlaceholder: "Opsional, ditentukan server"
159
+ }, i = {
55
160
  call: "呼叫",
56
161
  numberLabel: "号码",
57
162
  statusReady: "可拨号",
@@ -103,25 +208,28 @@ var e = {
103
208
  rowAgent: "坐席",
104
209
  extensionLabel: "分机",
105
210
  extensionPlaceholder: "可空,由服务端分配"
211
+ }, a = {
212
+ "zh-CN": i,
213
+ "en-US": t,
214
+ "id-ID": r,
215
+ "es-ES": n
106
216
  };
107
- //#endregion
108
- //#region src/ui/i18n/index.ts
109
- function n(n) {
110
- return n.toLowerCase().startsWith("en") ? e : t;
217
+ function o(t) {
218
+ return a[e(t)];
111
219
  }
112
- function r(e, t, r) {
220
+ function s(e, t, n) {
113
221
  return {
114
- ...n(e),
115
- ...r === void 0 ? {} : r(e),
222
+ ...o(e),
223
+ ...n === void 0 ? {} : n(e),
116
224
  ...t ?? {}
117
225
  };
118
226
  }
119
227
  //#endregion
120
228
  //#region src/ui/controllers/mobileLifecycle.ts
121
- async function i(e) {
229
+ async function c(e) {
122
230
  await e.media.requestPermission(), await e.initialize(), await e.connect();
123
231
  }
124
- function a(e, t = {}) {
232
+ function l(e, t = {}) {
125
233
  let n = t.document ?? (typeof document > "u" ? void 0 : document);
126
234
  if (n === void 0) return () => void 0;
127
235
  let r = () => {
@@ -135,30 +243,30 @@ function a(e, t = {}) {
135
243
  }
136
244
  //#endregion
137
245
  //#region src/ui/controllers/phoneActions.ts
138
- function o(e) {
246
+ function u(e) {
139
247
  return e.replace(/\s+/g, "");
140
248
  }
141
- function s(e, t, n) {
142
- return o(e).length > 0 && n === "connected" && t !== "denied";
249
+ function d(e, t, n) {
250
+ return u(e).length > 0 && n === "connected" && t !== "denied";
143
251
  }
144
- async function c(e, t, n) {
145
- let r = o(t);
252
+ async function f(e, t, n) {
253
+ let r = u(t);
146
254
  r !== "" && await e.dial({
147
255
  destination: r,
148
256
  ...n === void 0 ? {} : { type: n }
149
257
  });
150
258
  }
151
- async function l(e, t) {
259
+ async function p(e, t) {
152
260
  return t ? await e.unmute() : await e.mute(), !t;
153
261
  }
154
- async function u(e) {
262
+ async function m(e) {
155
263
  e.state === "held" ? await e.resume() : await e.hold();
156
264
  }
157
- async function d(e, t) {
265
+ async function h(e, t) {
158
266
  await e.sendDtmf(t);
159
267
  }
160
- async function f(e, t) {
161
- let n = o(t);
268
+ async function g(e, t) {
269
+ let n = u(t);
162
270
  n !== "" && await e.transfer({
163
271
  target: n,
164
272
  type: "blind"
@@ -166,12 +274,12 @@ async function f(e, t) {
166
274
  }
167
275
  //#endregion
168
276
  //#region src/ui/views/dom.ts
169
- function p(e, t = {}) {
277
+ function _(e, t = {}) {
170
278
  let n = document.createElement(e);
171
279
  return t.className !== void 0 && (n.className = t.className), t.text !== void 0 && (n.textContent = t.text), Object.entries(t.attrs ?? {}).forEach(([e, t]) => n.setAttribute(e, t)), t.children?.forEach((e) => n.append(e)), n;
172
280
  }
173
- function m(e) {
174
- return p("div", {
281
+ function v(e) {
282
+ return _("div", {
175
283
  attrs: {
176
284
  part: "status-rail",
177
285
  role: "status",
@@ -180,8 +288,8 @@ function m(e) {
180
288
  text: e
181
289
  });
182
290
  }
183
- function h(e, t, n = "destination") {
184
- let r = p("input", { attrs: {
291
+ function y(e, t, n = "destination") {
292
+ let r = _("input", { attrs: {
185
293
  id: e,
186
294
  type: "tel",
187
295
  inputmode: "tel",
@@ -189,7 +297,7 @@ function h(e, t, n = "destination") {
189
297
  autocomplete: "tel"
190
298
  } });
191
299
  return {
192
- field: p("div", { children: [p("label", {
300
+ field: _("div", { children: [_("label", {
193
301
  attrs: { for: e },
194
302
  text: t
195
303
  }), r] }),
@@ -198,7 +306,7 @@ function h(e, t, n = "destination") {
198
306
  }
199
307
  //#endregion
200
308
  //#region src/ui/views/renderDesktop.ts
201
- var g = [
309
+ var b = [
202
310
  "1",
203
311
  "2",
204
312
  "3",
@@ -212,13 +320,13 @@ var g = [
212
320
  "0",
213
321
  "#"
214
322
  ];
215
- function _(e) {
216
- return e.mode === "compact" ? v(e) : y(e);
323
+ function x(e) {
324
+ return e.mode === "compact" ? S(e) : C(e);
217
325
  }
218
- function v(e) {
219
- let { field: t, input: n } = h("ccbar-destination", e.messages.numberLabel ?? "号码");
326
+ function S(e) {
327
+ let { field: t, input: n } = y("ccbar-destination", e.messages.numberLabel ?? "号码");
220
328
  n.value = e.destination;
221
- let r = e.view.kind === "ready" || e.view.kind === "setup" || e.view.kind === "ended" ? p("button", {
329
+ let r = e.view.kind === "ready" || e.view.kind === "setup" || e.view.kind === "ended" ? _("button", {
222
330
  attrs: {
223
331
  type: "button",
224
332
  "data-action": "dial",
@@ -226,20 +334,20 @@ function v(e) {
226
334
  ...e.canDial ? {} : { disabled: "" }
227
335
  },
228
336
  text: e.messages.call ?? "呼叫"
229
- }) : p("button", {
337
+ }) : _("button", {
230
338
  attrs: {
231
339
  type: "button",
232
340
  "data-action": "hangup",
233
341
  part: "hangup-button"
234
342
  },
235
343
  text: e.messages.hangup ?? "挂断"
236
- }), i = [S(e.messages.status ?? "", e.floating), p("div", {
344
+ }), i = [E(e.messages.status ?? "", e.floating), _("div", {
237
345
  className: "ccbar-toolbar",
238
346
  children: [
239
347
  t,
240
- e.view.kind === "active" || e.view.kind === "held" ? E(e) : p("span"),
348
+ e.view.kind === "active" || e.view.kind === "held" ? A(e) : _("span"),
241
349
  r,
242
- p("button", {
350
+ _("button", {
243
351
  attrs: {
244
352
  type: "button",
245
353
  "data-action": "more"
@@ -248,16 +356,16 @@ function v(e) {
248
356
  })
249
357
  ]
250
358
  })];
251
- return e.moreOpen && i.push(p("div", {
359
+ return e.moreOpen && i.push(_("div", {
252
360
  className: "ccbar-more",
253
- children: [D(e.view, e.messages), p("button", {
361
+ children: [j(e.view, e.messages), _("button", {
254
362
  attrs: {
255
363
  type: "button",
256
364
  "data-action": "devices"
257
365
  },
258
366
  text: e.messages.devices ?? "设备"
259
367
  })]
260
- })), p("div", {
368
+ })), _("div", {
261
369
  attrs: {
262
370
  part: "panel",
263
371
  "data-layout": "compact"
@@ -265,56 +373,56 @@ function v(e) {
265
373
  children: i
266
374
  });
267
375
  }
268
- function y(e) {
269
- let { input: t } = h("ccbar-destination", e.messages.numberLabel ?? "号码"), { field: n } = h("ccbar-transfer-target", e.messages.transfer ?? "转接号码", "transfer-target");
376
+ function C(e) {
377
+ let { input: t } = y("ccbar-destination", e.messages.numberLabel ?? "号码"), { field: n } = y("ccbar-transfer-target", e.messages.transfer ?? "转接号码", "transfer-target");
270
378
  t.value = e.destination, t.placeholder = e.messages.numberLabel ?? "号码", t.setAttribute("aria-label", e.messages.numberLabel ?? "号码");
271
379
  let r = e.view.kind === "active" || e.view.kind === "held" || e.view.kind === "dialing", i = e.view.kind === "held", a = e.view.kind === "connecting", o = [
272
- S(e.messages.status ?? "", e.floating, e.extension, e.messages.extensionLabel ?? "分机"),
273
- b(e.messages.rowSignIn ?? "签入", [
274
- C(e),
275
- x("signin", e.messages.signIn ?? "签入", {
380
+ E(e.messages.status ?? "", e.floating, e.extension, e.messages.extensionLabel ?? "分机"),
381
+ w(e.messages.rowSignIn ?? "签入", [
382
+ D(e),
383
+ T("signin", e.messages.signIn ?? "签入", {
276
384
  variant: "primary",
277
385
  disabled: e.connected || a
278
386
  }),
279
- x("signout", e.messages.signOut ?? "退签", { disabled: !e.connected })
387
+ T("signout", e.messages.signOut ?? "退签", { disabled: !e.connected })
280
388
  ]),
281
- b(e.messages.numberLabel ?? "号码", [t], { labelFor: t.id }),
282
- b(e.messages.rowCall ?? "通话", [
283
- x("dial", e.messages.outboundCall ?? "外呼", {
389
+ w(e.messages.numberLabel ?? "号码", [t], { labelFor: t.id }),
390
+ w(e.messages.rowCall ?? "通话", [
391
+ T("dial", e.messages.outboundCall ?? "外呼", {
284
392
  variant: "primary",
285
393
  disabled: !e.canDial
286
394
  }),
287
- x("dial-internal", e.messages.internalCall ?? "内呼", { disabled: !e.canDial }),
288
- x("hangup", e.messages.hangup ?? "挂断", {
395
+ T("dial-internal", e.messages.internalCall ?? "内呼", { disabled: !e.canDial }),
396
+ T("hangup", e.messages.hangup ?? "挂断", {
289
397
  variant: "danger",
290
398
  disabled: !r
291
399
  }),
292
- x("transfer", e.messages.transfer ?? "转接", { disabled: !r }),
293
- x("hold", e.messages.hold ?? "保持", {
400
+ T("transfer", e.messages.transfer ?? "转接", { disabled: !r }),
401
+ T("hold", e.messages.hold ?? "保持", {
294
402
  pressed: i,
295
403
  disabled: !r || i
296
404
  }),
297
- x("resume", e.messages.resume ?? "恢复", { disabled: !i }),
298
- E(e)
405
+ T("resume", e.messages.resume ?? "恢复", { disabled: !i }),
406
+ A(e)
299
407
  ]),
300
- ...r ? [b(e.messages.transfer ?? "转接号码", [n], { labelFor: "ccbar-transfer-target" })] : [],
301
- b(e.messages.rowAgent ?? "坐席", [
302
- x("agent-available", e.messages.agentIdle ?? "空闲", {
408
+ ...r ? [w(e.messages.transfer ?? "转接号码", [n], { labelFor: "ccbar-transfer-target" })] : [],
409
+ w(e.messages.rowAgent ?? "坐席", [
410
+ T("agent-available", e.messages.agentIdle ?? "空闲", {
303
411
  pressed: e.agentStatus === "available",
304
412
  disabled: !e.connected
305
413
  }),
306
- x("agent-busy", e.messages.agentBusy ?? "置忙", {
414
+ T("agent-busy", e.messages.agentBusy ?? "置忙", {
307
415
  disabled: !0,
308
416
  title: e.messages.agentBusyHint ?? "置忙由通话或服务端状态控制"
309
417
  }),
310
- x("agent-break", e.messages.agentBreak ?? "休息", {
418
+ T("agent-break", e.messages.agentBreak ?? "休息", {
311
419
  pressed: e.agentStatus === "break",
312
420
  disabled: !e.connected
313
421
  })
314
422
  ]),
315
- T()
423
+ k()
316
424
  ];
317
- return e.calls.length > 1 && o.push(O(e.calls, e.messages)), p("div", {
425
+ return e.calls.length > 1 && o.push(M(e.calls, e.messages)), _("div", {
318
426
  attrs: {
319
427
  part: "panel",
320
428
  "data-layout": "panel"
@@ -322,22 +430,22 @@ function y(e) {
322
430
  children: o
323
431
  });
324
432
  }
325
- function b(e, t, n = {}) {
326
- return p("div", {
433
+ function w(e, t, n = {}) {
434
+ return _("div", {
327
435
  className: "ccbar-bar-row",
328
- children: [p(n.labelFor === void 0 ? "div" : "label", {
436
+ children: [_(n.labelFor === void 0 ? "div" : "label", {
329
437
  className: "ccbar-bar-label",
330
438
  attrs: n.labelFor === void 0 ? {} : { for: n.labelFor },
331
439
  text: e
332
- }), p("div", {
440
+ }), _("div", {
333
441
  className: "ccbar-bar-keys",
334
442
  children: t
335
443
  })]
336
444
  });
337
445
  }
338
- function x(e, t, n = {}) {
446
+ function T(e, t, n = {}) {
339
447
  let r = e === "dial" ? "call-button" : e === "hangup" ? "hangup-button" : void 0;
340
- return p("button", {
448
+ return _("button", {
341
449
  attrs: {
342
450
  type: "button",
343
451
  "data-action": e,
@@ -350,15 +458,15 @@ function x(e, t, n = {}) {
350
458
  text: t
351
459
  });
352
460
  }
353
- function S(e, t, n = "", r = "分机") {
354
- let i = w(e);
355
- return t && i.setAttribute("data-drag-handle", ""), n !== "" && i.append(p("span", {
461
+ function E(e, t, n = "", r = "分机") {
462
+ let i = O(e);
463
+ return t && i.setAttribute("data-drag-handle", ""), n !== "" && i.append(_("span", {
356
464
  className: "ccbar-ext-chip",
357
465
  text: `${r} ${n}`
358
466
  })), i;
359
467
  }
360
- function C(e) {
361
- let t = p("input", { attrs: {
468
+ function D(e) {
469
+ let t = _("input", { attrs: {
362
470
  id: "ccbar-extension",
363
471
  type: "tel",
364
472
  inputmode: "numeric",
@@ -369,13 +477,13 @@ function C(e) {
369
477
  } });
370
478
  return t.value = e.extension, e.connected && (t.readOnly = !0), t;
371
479
  }
372
- function w(e) {
373
- return m(e);
480
+ function O(e) {
481
+ return v(e);
374
482
  }
375
- function T() {
376
- return p("div", {
483
+ function k() {
484
+ return _("div", {
377
485
  className: "ccbar-dialpad",
378
- children: g.map((e) => p("button", {
486
+ children: b.map((e) => _("button", {
379
487
  attrs: {
380
488
  type: "button",
381
489
  "data-digit": e
@@ -384,8 +492,8 @@ function T() {
384
492
  }))
385
493
  });
386
494
  }
387
- function E(e) {
388
- return p("button", {
495
+ function A(e) {
496
+ return _("button", {
389
497
  attrs: {
390
498
  type: "button",
391
499
  "data-action": "mute",
@@ -394,9 +502,9 @@ function E(e) {
394
502
  text: e.muted ? e.messages.unmute ?? "取消静音" : e.messages.mute ?? "静音"
395
503
  });
396
504
  }
397
- function D(e, t) {
505
+ function j(e, t) {
398
506
  let n = e.kind === "held";
399
- return p("button", {
507
+ return _("button", {
400
508
  attrs: {
401
509
  type: "button",
402
510
  "data-action": "hold",
@@ -405,35 +513,35 @@ function D(e, t) {
405
513
  text: n ? t.resume ?? "恢复" : t.hold ?? "保持"
406
514
  });
407
515
  }
408
- function O(e, t) {
409
- return p("ul", {
516
+ function M(e, t) {
517
+ return _("ul", {
410
518
  className: "ccbar-call-list",
411
- children: e.map((e) => p("li", { children: [p("button", {
519
+ children: e.map((e) => _("li", { children: [_("button", {
412
520
  attrs: {
413
521
  type: "button",
414
522
  "data-call-id": e.id
415
523
  },
416
- children: [p("span", { text: `${e.destination} ${e.direction === "inbound" ? t.inbound ?? "呼入" : t.outbound ?? "呼出"} ${k(e.state, t)}` }), ...e.current ? [p("span", {
524
+ children: [_("span", { text: `${e.destination} ${e.direction === "inbound" ? t.inbound ?? "呼入" : t.outbound ?? "呼出"} ${N(e.state, t)}` }), ...e.current ? [_("span", {
417
525
  className: "ccbar-call-current",
418
526
  text: t.currentCall ?? "当前通话"
419
527
  })] : []]
420
528
  })] }))
421
529
  });
422
530
  }
423
- function k(e, t) {
531
+ function N(e, t) {
424
532
  return e === "held" ? t.statusHeld ?? "保持中" : e === "active" ? t.statusActive ?? "通话中" : e === "dialing" || e === "ringing" || e === "connecting" ? t.statusDialing ?? "拨号中" : e;
425
533
  }
426
534
  //#endregion
427
535
  //#region src/ui/views/renderError.ts
428
- function A(e) {
536
+ function P(e) {
429
537
  switch (e.view.kind) {
430
- case "permission-error": return p("div", {
538
+ case "permission-error": return _("div", {
431
539
  attrs: { part: "panel" },
432
540
  children: [
433
- m(e.messages.permissionTitle ?? "无法使用麦克风"),
434
- p("h2", { text: e.messages.permissionTitle ?? "无法使用麦克风" }),
435
- p("p", { text: e.messages.permissionBody ?? "请在浏览器设置中允许本网站访问麦克风,然后重新检测。" }),
436
- p("button", {
541
+ v(e.messages.permissionTitle ?? "无法使用麦克风"),
542
+ _("h2", { text: e.messages.permissionTitle ?? "无法使用麦克风" }),
543
+ _("p", { text: e.messages.permissionBody ?? "请在浏览器设置中允许本网站访问麦克风,然后重新检测。" }),
544
+ _("button", {
437
545
  attrs: {
438
546
  type: "button",
439
547
  "data-action": "retry-permission"
@@ -443,18 +551,18 @@ function A(e) {
443
551
  ]
444
552
  });
445
553
  case "unrecoverable-error":
446
- case "unsupported": return p("div", {
554
+ case "unsupported": return _("div", {
447
555
  attrs: { part: "panel" },
448
556
  children: [
449
- p("div", {
557
+ _("div", {
450
558
  attrs: {
451
559
  role: "alert",
452
560
  part: "status-rail"
453
561
  },
454
562
  text: e.messages.errorTitle ?? "无法继续通话"
455
563
  }),
456
- p("p", { text: e.view.kind === "unrecoverable-error" && e.view.code === "AUTH_TOKEN_UNAVAILABLE" ? e.messages.errorTokenUnavailable ?? "无法获取登录凭证,请检查 token 服务是否启动及配置是否正确。" : e.messages.errorBody ?? "请检查网络、域名授权或坐席权限后重试。" }),
457
- ...e.view.kind === "unrecoverable-error" ? [p("code", {
564
+ _("p", { text: e.view.kind === "unrecoverable-error" && e.view.code === "AUTH_TOKEN_UNAVAILABLE" ? e.messages.errorTokenUnavailable ?? "无法获取登录凭证,请检查 token 服务是否启动及配置是否正确。" : e.messages.errorBody ?? "请检查网络、域名授权或坐席权限后重试。" }),
565
+ ...e.view.kind === "unrecoverable-error" ? [_("code", {
458
566
  attrs: { "data-error-code": e.view.code },
459
567
  text: e.view.code
460
568
  })] : []
@@ -467,29 +575,29 @@ function A(e) {
467
575
  case "held":
468
576
  case "dialing":
469
577
  case "ended":
470
- case "ready": return p("div", {
578
+ case "ready": return _("div", {
471
579
  attrs: { part: "panel" },
472
- children: [m(e.messages.status ?? "")]
580
+ children: [v(e.messages.status ?? "")]
473
581
  });
474
582
  default: return e.view;
475
583
  }
476
584
  }
477
585
  //#endregion
478
586
  //#region src/ui/views/renderIncoming.ts
479
- function j(e) {
480
- return p("div", {
587
+ function F(e) {
588
+ return _("div", {
481
589
  attrs: { part: "panel" },
482
590
  children: [
483
- m(e.messages.status ?? "来电"),
484
- p("p", { text: e.view.from }),
485
- p("button", {
591
+ v(e.messages.status ?? "来电"),
592
+ _("p", { text: e.view.from }),
593
+ _("button", {
486
594
  attrs: {
487
595
  type: "button",
488
596
  "data-action": "answer"
489
597
  },
490
598
  text: e.messages.answer ?? "接听"
491
599
  }),
492
- p("button", {
600
+ _("button", {
493
601
  attrs: {
494
602
  type: "button",
495
603
  "data-action": "reject"
@@ -501,7 +609,7 @@ function j(e) {
501
609
  }
502
610
  //#endregion
503
611
  //#region src/ui/views/renderMobile.ts
504
- var M = [
612
+ var I = [
505
613
  "1",
506
614
  "2",
507
615
  "3",
@@ -515,13 +623,13 @@ var M = [
515
623
  "0",
516
624
  "#"
517
625
  ];
518
- function N(e) {
519
- return F(p("div", {
626
+ function L(e) {
627
+ return z(_("div", {
520
628
  attrs: {
521
629
  part: "panel",
522
630
  "data-layout": "mobile"
523
631
  },
524
- children: [m(e.status), p("button", {
632
+ children: [v(e.status), _("button", {
525
633
  attrs: {
526
634
  type: "button",
527
635
  "data-action": "enable-phone",
@@ -531,18 +639,18 @@ function N(e) {
531
639
  })]
532
640
  }));
533
641
  }
534
- function P(e) {
535
- let t = e.view.kind === "active" || e.view.kind === "dialing", n = [m(e.messages.status ?? "")];
642
+ function R(e) {
643
+ let t = e.view.kind === "active" || e.view.kind === "dialing", n = [v(e.messages.status ?? "")];
536
644
  if (t) {
537
645
  let t = e.view.kind === "active" || e.view.kind === "dialing" ? e.view.destination ?? "" : "";
538
- n.push(p("p", { text: t }), I(p("button", {
646
+ n.push(_("p", { text: t }), B(_("button", {
539
647
  attrs: {
540
648
  type: "button",
541
649
  "data-action": "mute",
542
650
  "aria-pressed": e.muted ? "true" : "false"
543
651
  },
544
652
  text: e.muted ? e.messages.unmute ?? "取消静音" : e.messages.mute ?? "静音"
545
- }), 44), L(), I(p("button", {
653
+ }), 44), V(), B(_("button", {
546
654
  attrs: {
547
655
  type: "button",
548
656
  "data-action": "hangup",
@@ -551,8 +659,8 @@ function P(e) {
551
659
  text: e.messages.hangup ?? "挂断"
552
660
  }), 52));
553
661
  } else {
554
- let { field: t, input: r } = h("ccbar-destination", e.messages.numberLabel ?? "号码");
555
- r.value = e.destination, n.push(t, L(), p("button", {
662
+ let { field: t, input: r } = y("ccbar-destination", e.messages.numberLabel ?? "号码");
663
+ r.value = e.destination, n.push(t, V(), _("button", {
556
664
  attrs: {
557
665
  type: "button",
558
666
  "data-action": "dial",
@@ -562,13 +670,13 @@ function P(e) {
562
670
  text: e.messages.call ?? "呼叫"
563
671
  }));
564
672
  }
565
- return e.showOutputDevice && n.push(p("button", {
673
+ return e.showOutputDevice && n.push(_("button", {
566
674
  attrs: {
567
675
  type: "button",
568
676
  "data-action": "devices"
569
677
  },
570
678
  text: e.messages.devices ?? "设备"
571
- })), F(p("div", {
679
+ })), z(_("div", {
572
680
  attrs: {
573
681
  part: "panel",
574
682
  "data-layout": "mobile"
@@ -576,16 +684,16 @@ function P(e) {
576
684
  children: n
577
685
  }));
578
686
  }
579
- function F(e) {
687
+ function z(e) {
580
688
  return e.style.minHeight = "100dvh", e.style.paddingBottom = "max(16px, env(safe-area-inset-bottom))", e;
581
689
  }
582
- function I(e, t) {
690
+ function B(e, t) {
583
691
  return e.style.minHeight = `${t}px`, e;
584
692
  }
585
- function L() {
586
- return p("div", {
693
+ function V() {
694
+ return _("div", {
587
695
  className: "ccbar-dialpad",
588
- children: M.map((e) => p("button", {
696
+ children: I.map((e) => _("button", {
589
697
  attrs: {
590
698
  type: "button",
591
699
  "data-digit": e
@@ -596,14 +704,14 @@ function L() {
596
704
  }
597
705
  //#endregion
598
706
  //#region src/ui/state/toPhoneViewModel.ts
599
- var R = {
707
+ var H = {
600
708
  kind: "permission-error",
601
709
  code: "MEDIA_PERMISSION_DENIED",
602
710
  action: "retry-permission"
603
711
  };
604
- function z(e) {
712
+ function U(e) {
605
713
  if (e.supported === !1) return { kind: "unsupported" };
606
- if (e.permission === "denied" || e.error?.code === "MEDIA_PERMISSION_DENIED") return R;
714
+ if (e.permission === "denied" || e.error?.code === "MEDIA_PERMISSION_DENIED") return H;
607
715
  if (e.error !== void 0 && e.error.code !== "MEDIA_PLAYBACK_BLOCKED") return {
608
716
  kind: "unrecoverable-error",
609
717
  code: e.error.code
@@ -640,7 +748,7 @@ function z(e) {
640
748
  }
641
749
  //#endregion
642
750
  //#region src/ui/styles/index.css?inline
643
- var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f5f9;--ccbar-color-border:#d8e0ea;--ccbar-color-title:#0f172a;--ccbar-color-text:#334155;--ccbar-color-muted:#475569;--ccbar-color-primary:#2563eb;--ccbar-color-primary-hover:#1d4ed8;--ccbar-color-success:#15803d;--ccbar-color-warning:#a15c00;--ccbar-color-danger:#b91c1c;--ccbar-radius-sm:6px;--ccbar-radius:8px;--ccbar-radius-lg:12px;--ccbar-control-height:40px;--ccbar-control-height-touch:44px;--ccbar-space-1:4px;--ccbar-space-2:8px;--ccbar-space-3:12px;--ccbar-space-4:16px;--ccbar-space-6:24px;--ccbar-font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;--ccbar-panel-width:560px}:host{color:var(--ccbar-color-text);font-family:var(--ccbar-font-family);display:block}:host([floating]){z-index:2147483646;right:var(--ccbar-space-6);bottom:var(--ccbar-space-6);position:fixed}[part=panel]{background:var(--ccbar-color-surface);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-lg)}[part=status-rail]{align-items:center;gap:var(--ccbar-space-2);min-height:var(--ccbar-control-height);padding:var(--ccbar-space-2) var(--ccbar-space-3);border-bottom:1px solid var(--ccbar-color-border);color:var(--ccbar-color-muted);font-variant-numeric:tabular-nums;display:flex}[part=status-rail]:before{content:\"\";background:var(--ccbar-color-muted);border-radius:50%;flex:none;width:8px;height:8px}button{min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);background:var(--ccbar-color-surface);color:var(--ccbar-color-title);font:inherit}button[data-action=dial],button[data-action=signin],button[data-action=answer],button[data-variant=primary]{background:var(--ccbar-color-primary);border-color:var(--ccbar-color-primary);color:#fff}button[aria-pressed=true]{border-color:var(--ccbar-color-primary);color:var(--ccbar-color-primary);background:var(--ccbar-color-surface-muted)}button[data-action=hangup],button[data-action=reject]{background:var(--ccbar-color-danger);border-color:var(--ccbar-color-danger);color:#fff;margin-top:var(--ccbar-space-4)}button:disabled{opacity:.5}button:focus-visible,input:focus-visible{outline:2px solid var(--ccbar-color-primary);outline-offset:2px}input[type=tel]{width:100%;min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);font-variant-numeric:tabular-nums}.ccbar-call-list{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;padding:0;list-style:none;display:grid}.ccbar-call-list button{text-align:left;width:100%}.ccbar-call-current{color:var(--ccbar-color-title);display:block}[data-layout=compact]{min-height:80px;max-height:96px}[data-layout=compact] .ccbar-toolbar{gap:var(--ccbar-space-2);padding:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;display:grid}[data-layout=compact] .ccbar-more{right:var(--ccbar-space-3);gap:var(--ccbar-space-2);display:grid;position:absolute}[data-layout=panel]{width:min(var(--ccbar-panel-width), 100%);min-width:420px;max-width:560px;padding:var(--ccbar-space-3)}[data-layout=panel] .ccbar-bar-row{gap:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:48px minmax(0,1fr);align-items:center;min-height:36px;display:grid}[data-layout=panel] .ccbar-bar-row+.ccbar-bar-row{margin-top:var(--ccbar-space-2)}[data-layout=panel] .ccbar-bar-label{color:var(--ccbar-color-muted);font-size:12px}[data-layout=panel] .ccbar-bar-keys{align-items:center;gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=panel] .ccbar-bar-keys button{min-width:48px;min-height:32px;padding:0 10px;font-size:13px}[data-layout=panel] .ccbar-bar-keys input[type=tel]{max-width:320px}[data-layout=panel] .ccbar-bar-keys input[name=extension]{width:148px;max-width:148px}[data-layout=panel] .ccbar-ext-chip{background:var(--ccbar-color-surface-muted);height:28px;color:var(--ccbar-color-title);font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;margin-left:auto;padding:0 10px;font-size:12px;display:inline-flex}[data-layout=panel] [data-action=hangup]{margin-top:0}[data-layout=panel] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;grid-template-columns:repeat(3,1fr);display:grid}[data-layout=panel] .ccbar-safe-actions{gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=mobile]{min-height:100vh;padding:var(--ccbar-space-4);padding-bottom:max(16px, env(safe-area-inset-bottom))}[data-layout=mobile] button{min-width:44px;min-height:44px}[data-layout=mobile] [data-action=enable-phone],[data-layout=mobile] [data-action=dial],[data-layout=mobile] [data-action=hangup]{min-height:52px}[data-layout=mobile] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0;grid-template-columns:repeat(3,1fr);display:grid}:host([data-theme=dark]){--ccbar-color-surface:#0f172a;--ccbar-color-surface-muted:#1e293b;--ccbar-color-border:#334155;--ccbar-color-title:#f8fafc;--ccbar-color-text:#e2e8f0;--ccbar-color-muted:#94a3b8;--ccbar-color-primary:#3b82f6;--ccbar-color-primary-hover:#2563eb;--ccbar-color-success:#22c55e;--ccbar-color-warning:#f59e0b;--ccbar-color-danger:#ef4444}@media (prefers-reduced-motion:reduce){:host *,:host :before,:host :after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}", V = typeof HTMLElement == "function" ? HTMLElement : class {}, H = /* @__PURE__ */ new WeakSet(), U = [
751
+ var W = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f5f9;--ccbar-color-border:#d8e0ea;--ccbar-color-title:#0f172a;--ccbar-color-text:#334155;--ccbar-color-muted:#475569;--ccbar-color-primary:#2563eb;--ccbar-color-primary-hover:#1d4ed8;--ccbar-color-success:#15803d;--ccbar-color-warning:#a15c00;--ccbar-color-danger:#b91c1c;--ccbar-radius-sm:6px;--ccbar-radius:8px;--ccbar-radius-lg:12px;--ccbar-control-height:40px;--ccbar-control-height-touch:44px;--ccbar-space-1:4px;--ccbar-space-2:8px;--ccbar-space-3:12px;--ccbar-space-4:16px;--ccbar-space-6:24px;--ccbar-font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;--ccbar-panel-width:560px}:host{color:var(--ccbar-color-text);font-family:var(--ccbar-font-family);display:block}:host([floating]){z-index:2147483646;right:var(--ccbar-space-6);bottom:var(--ccbar-space-6);position:fixed}[part=panel]{background:var(--ccbar-color-surface);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-lg)}[part=status-rail]{align-items:center;gap:var(--ccbar-space-2);min-height:var(--ccbar-control-height);padding:var(--ccbar-space-2) var(--ccbar-space-3);border-bottom:1px solid var(--ccbar-color-border);color:var(--ccbar-color-muted);font-variant-numeric:tabular-nums;display:flex}[part=status-rail]:before{content:\"\";background:var(--ccbar-color-muted);border-radius:50%;flex:none;width:8px;height:8px}button{min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);background:var(--ccbar-color-surface);color:var(--ccbar-color-title);font:inherit}button[data-action=dial],button[data-action=signin],button[data-action=answer],button[data-variant=primary]{background:var(--ccbar-color-primary);border-color:var(--ccbar-color-primary);color:#fff}button[aria-pressed=true]{border-color:var(--ccbar-color-primary);color:var(--ccbar-color-primary);background:var(--ccbar-color-surface-muted)}button[data-action=hangup],button[data-action=reject]{background:var(--ccbar-color-danger);border-color:var(--ccbar-color-danger);color:#fff;margin-top:var(--ccbar-space-4)}button:disabled{opacity:.5}button:focus-visible,input:focus-visible{outline:2px solid var(--ccbar-color-primary);outline-offset:2px}input[type=tel]{width:100%;min-height:var(--ccbar-control-height);border:1px solid var(--ccbar-color-border);border-radius:var(--ccbar-radius-sm);font-variant-numeric:tabular-nums}.ccbar-call-list{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;padding:0;list-style:none;display:grid}.ccbar-call-list button{text-align:left;width:100%}.ccbar-call-current{color:var(--ccbar-color-title);display:block}[data-layout=compact]{min-height:80px;max-height:96px}[data-layout=compact] .ccbar-toolbar{gap:var(--ccbar-space-2);padding:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;display:grid}[data-layout=compact] .ccbar-more{right:var(--ccbar-space-3);gap:var(--ccbar-space-2);display:grid;position:absolute}[data-layout=panel]{width:min(var(--ccbar-panel-width), 100%);min-width:420px;max-width:560px;padding:var(--ccbar-space-3)}[data-layout=panel] .ccbar-bar-row{gap:var(--ccbar-space-2) var(--ccbar-space-3);grid-template-columns:48px minmax(0,1fr);align-items:center;min-height:36px;display:grid}[data-layout=panel] .ccbar-bar-row+.ccbar-bar-row{margin-top:var(--ccbar-space-2)}[data-layout=panel] .ccbar-bar-label{color:var(--ccbar-color-muted);font-size:12px}[data-layout=panel] .ccbar-bar-keys{align-items:center;gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=panel] .ccbar-bar-keys button{min-width:48px;min-height:32px;padding:0 10px;font-size:13px}[data-layout=panel] .ccbar-bar-keys input[type=tel]{max-width:320px}[data-layout=panel] .ccbar-bar-keys input[name=extension]{width:148px;max-width:148px}[data-layout=panel] .ccbar-ext-chip{background:var(--ccbar-color-surface-muted);height:28px;color:var(--ccbar-color-title);font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;margin-left:auto;padding:0 10px;font-size:12px;display:inline-flex}[data-layout=panel] [data-action=hangup]{margin-top:0}[data-layout=panel] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0 0;grid-template-columns:repeat(3,1fr);display:grid}[data-layout=panel] .ccbar-safe-actions{gap:var(--ccbar-space-2);flex-wrap:wrap;display:flex}[data-layout=mobile]{min-height:100vh;padding:var(--ccbar-space-4);padding-bottom:max(16px, env(safe-area-inset-bottom))}[data-layout=mobile] button{min-width:44px;min-height:44px}[data-layout=mobile] [data-action=enable-phone],[data-layout=mobile] [data-action=dial],[data-layout=mobile] [data-action=hangup]{min-height:52px}[data-layout=mobile] .ccbar-dialpad{gap:var(--ccbar-space-2);margin:var(--ccbar-space-3) 0;grid-template-columns:repeat(3,1fr);display:grid}:host([data-theme=dark]){--ccbar-color-surface:#0f172a;--ccbar-color-surface-muted:#1e293b;--ccbar-color-border:#334155;--ccbar-color-title:#f8fafc;--ccbar-color-text:#e2e8f0;--ccbar-color-muted:#94a3b8;--ccbar-color-primary:#3b82f6;--ccbar-color-primary-hover:#2563eb;--ccbar-color-success:#22c55e;--ccbar-color-warning:#f59e0b;--ccbar-color-danger:#ef4444}@media (prefers-reduced-motion:reduce){:host *,:host :before,:host :after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}", G = typeof HTMLElement == "function" ? HTMLElement : class {}, K = /* @__PURE__ */ new WeakSet(), q = [
644
752
  "connection.stateChanged",
645
753
  "connection.reconnecting",
646
754
  "connection.failed",
@@ -652,7 +760,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
652
760
  "media.permissionChanged",
653
761
  "agent.statusChanged",
654
762
  "error"
655
- ], W = class extends V {
763
+ ], J = class extends G {
656
764
  static get observedAttributes() {
657
765
  return [
658
766
  "mode",
@@ -713,7 +821,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
713
821
  }
714
822
  render() {
715
823
  let e = this.#k();
716
- e !== void 0 && (e.innerHTML = `<style>${B}</style>`, e.append(this.#S(this.#x())));
824
+ e !== void 0 && (e.innerHTML = `<style>${W}</style>`, e.append(this.#S(this.#x())));
717
825
  }
718
826
  #x() {
719
827
  let e = this.#e?.getCalls?.().map((e) => ({
@@ -722,7 +830,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
722
830
  destination: e.destination,
723
831
  direction: this.#o.has(e.id) ? "inbound" : "outbound"
724
832
  })) ?? [];
725
- return z({
833
+ return U({
726
834
  connectionState: this.#r,
727
835
  permission: this.#i,
728
836
  calls: e,
@@ -730,14 +838,14 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
730
838
  });
731
839
  }
732
840
  #S(e) {
733
- let t = this.#z(), n = this.#_ ?? this.#g ?? K(e, t), r = {
841
+ let t = this.#z(), n = this.#_ ?? this.#g ?? X(e, t), r = {
734
842
  ...t,
735
843
  status: n
736
844
  }, i = this.#C(e, r, n);
737
845
  return i.setAttribute("data-view", this.#E() && !this.#m ? "setup" : e.kind), i.hasAttribute("data-layout") || i.setAttribute("data-layout", this.#E() ? "mobile" : "panel"), i;
738
846
  }
739
847
  #C(e, t, n) {
740
- if (this.#E() && !this.#m) return N({
848
+ if (this.#E() && !this.#m) return L({
741
849
  enabling: this.#h,
742
850
  status: n,
743
851
  enablePhone: t.enablePhone
@@ -745,18 +853,18 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
745
853
  switch (e.kind) {
746
854
  case "permission-error":
747
855
  case "unrecoverable-error":
748
- case "unsupported": return A({
856
+ case "unsupported": return P({
749
857
  view: e,
750
858
  messages: t
751
859
  });
752
- case "incoming": return this.#E() ? P({
860
+ case "incoming": return this.#E() ? R({
753
861
  view: { kind: "ready" },
754
862
  messages: t,
755
863
  destination: this.#s,
756
864
  muted: this.#u,
757
- canDial: s(this.#s, this.#i, this.#r),
865
+ canDial: d(this.#s, this.#i, this.#r),
758
866
  showOutputDevice: this.#e?.media.supportsOutputSelection() === !0
759
- }) : j({
867
+ }) : F({
760
868
  view: e,
761
869
  messages: t
762
870
  });
@@ -766,20 +874,20 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
766
874
  case "ready":
767
875
  case "active":
768
876
  case "held":
769
- case "dialing": return this.#E() ? P({
877
+ case "dialing": return this.#E() ? R({
770
878
  view: e.kind === "held" ? { kind: "ready" } : e,
771
879
  messages: t,
772
880
  destination: this.#s,
773
881
  muted: this.#u,
774
- canDial: s(this.#s, this.#i, this.#r),
882
+ canDial: d(this.#s, this.#i, this.#r),
775
883
  showOutputDevice: this.#e?.media.supportsOutputSelection() === !0
776
- }) : _({
884
+ }) : x({
777
885
  mode: this.#T() === "compact" ? "compact" : "panel",
778
886
  view: e,
779
887
  messages: t,
780
888
  destination: this.#s,
781
889
  muted: this.#u,
782
- canDial: s(this.#s, this.#i, this.#r),
890
+ canDial: d(this.#s, this.#i, this.#r),
783
891
  moreOpen: this.#d,
784
892
  floating: this.hasAttribute("floating"),
785
893
  connected: this.#r === "connected",
@@ -828,9 +936,9 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
828
936
  this.#o.delete(e.callId), this.#u = !1;
829
937
  })), this.#n.push(e.on("call.failed", () => {
830
938
  this.#_ = this.#z().statusFailed;
831
- })), U.forEach((t) => {
939
+ })), q.forEach((t) => {
832
940
  this.#n.push(e.on(t, () => this.render()));
833
- }), this.#E() && typeof e.recover == "function" && (this.#v = a(e, {
941
+ }), this.#E() && typeof e.recover == "function" && (this.#v = l(e, {
834
942
  onChecking: () => {
835
943
  this.#g = this.#z().foregroundChecking, this.render();
836
944
  },
@@ -849,12 +957,12 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
849
957
  #k() {
850
958
  if (typeof this.attachShadow != "function") return;
851
959
  let e = this.shadowRoot ?? this.attachShadow({ mode: "open" });
852
- return H.has(e) || (H.add(e), e.addEventListener("click", (e) => this.#A(e)), e.addEventListener("input", (e) => this.#P(e)), e.addEventListener("pointerdown", (e) => this.#H(e))), e;
960
+ return K.has(e) || (K.add(e), e.addEventListener("click", (e) => this.#A(e)), e.addEventListener("input", (e) => this.#P(e)), e.addEventListener("pointerdown", (e) => this.#H(e))), e;
853
961
  }
854
962
  #A(e) {
855
- let t = J(e, this), n = t?.closest("[data-action=\"enable-phone\"]");
963
+ let t = Q(e, this), n = t?.closest("[data-action=\"enable-phone\"]");
856
964
  n instanceof HTMLButtonElement && (n.disabled = !0), this.#f = this.#f.then(() => this.#F(t)).catch((e) => {
857
- this.#_ = Y(e), this.render();
965
+ this.#_ = $(e), this.render();
858
966
  });
859
967
  }
860
968
  #j() {
@@ -870,7 +978,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
870
978
  return e instanceof HTMLInputElement ? e.value : "";
871
979
  }
872
980
  #P(e) {
873
- let t = J(e, this);
981
+ let t = Q(e, this);
874
982
  if (t instanceof HTMLInputElement && t.name !== "transfer-target") {
875
983
  if (t.name === "extension") {
876
984
  this.#c = t.value.trim();
@@ -893,7 +1001,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
893
1001
  }
894
1002
  let r = e.closest("[data-action]");
895
1003
  if (!(r instanceof HTMLElement) || r instanceof HTMLButtonElement && r.disabled && r.getAttribute("data-action") !== "enable-phone") return;
896
- let a = this.#e?.getActiveCall?.();
1004
+ let i = this.#e?.getActiveCall?.() ?? this.#e?.getCalls?.().find((e) => e.state === "held");
897
1005
  switch (r.getAttribute("data-action")) {
898
1006
  case "signin":
899
1007
  if (this.#e === void 0) return;
@@ -906,35 +1014,35 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
906
1014
  case "dial":
907
1015
  case "dial-internal":
908
1016
  if (this.#s = this.#j(), this.#e === void 0) return;
909
- this.#i !== "granted" && await this.#e.media?.requestPermission?.(), await c(this.#e, this.#s, r.getAttribute("data-action") === "dial-internal" ? "extension" : void 0);
1017
+ this.#i !== "granted" && await this.#e.media?.requestPermission?.(), await f(this.#e, this.#s, r.getAttribute("data-action") === "dial-internal" ? "extension" : void 0);
910
1018
  return;
911
1019
  case "mute":
912
- if (a === void 0) return;
913
- this.#u = await l(a, this.#u), this.#R();
1020
+ if (i === void 0) return;
1021
+ this.#u = await p(i, this.#u), this.#R();
914
1022
  return;
915
1023
  case "hold":
916
- a !== void 0 && await u(a);
1024
+ i !== void 0 && await m(i);
917
1025
  return;
918
1026
  case "resume":
919
- a !== void 0 && await a.resume();
1027
+ i !== void 0 && await i.resume();
920
1028
  return;
921
1029
  case "transfer":
922
- a !== void 0 && await f(a, this.#N());
1030
+ i !== void 0 && await g(i, this.#N());
923
1031
  return;
924
1032
  case "hangup":
925
- await a?.hangup();
1033
+ await i?.hangup();
926
1034
  return;
927
1035
  case "answer":
928
- a !== void 0 && await this.#e?.answer(a.id);
1036
+ i !== void 0 && await this.#e?.answer(i.id);
929
1037
  return;
930
1038
  case "reject":
931
- await a?.reject();
1039
+ await i?.reject();
932
1040
  return;
933
1041
  case "enable-phone":
934
1042
  if (this.#e === void 0 || this.#m) return;
935
1043
  this.#h = !0;
936
1044
  try {
937
- await i(this.#e), this.#m = !0;
1045
+ await c(this.#e), this.#m = !0;
938
1046
  } finally {
939
1047
  this.#h = !1, this.render();
940
1048
  }
@@ -957,9 +1065,9 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
957
1065
  }
958
1066
  }
959
1067
  async #I(e) {
960
- let t = this.#e?.getActiveCall?.();
1068
+ let t = this.#e?.getActiveCall?.() ?? this.#e?.getCalls?.().find((e) => e.state === "held");
961
1069
  if (t !== void 0 && (t.state === "active" || t.state === "held")) {
962
- await d(t, e);
1070
+ await h(t, e);
963
1071
  return;
964
1072
  }
965
1073
  this.#s += e;
@@ -967,7 +1075,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
967
1075
  n instanceof HTMLInputElement && (n.value = this.#s), this.#L();
968
1076
  }
969
1077
  #L() {
970
- let e = !s(this.#s, this.#i, this.#r);
1078
+ let e = !d(this.#s, this.#i, this.#r);
971
1079
  for (let t of ["dial", "dial-internal"]) {
972
1080
  let n = this.shadowRoot?.querySelector(`[data-action="${t}"]`);
973
1081
  n instanceof HTMLButtonElement && (n.disabled = e);
@@ -978,7 +1086,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
978
1086
  e instanceof HTMLButtonElement && (e.setAttribute("aria-pressed", this.#u ? "true" : "false"), e.textContent = this.#u ? this.#z().unmute : this.#z().mute);
979
1087
  }
980
1088
  #z() {
981
- return r(this.getAttribute("locale") ?? "zh-CN", void 0, this.#y);
1089
+ return s(this.getAttribute("locale") ?? "zh-CN", void 0, this.#y);
982
1090
  }
983
1091
  #B() {
984
1092
  this.#b?.(), this.#b = void 0;
@@ -1011,7 +1119,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
1011
1119
  }
1012
1120
  #U = (e) => {
1013
1121
  if (this.#p === void 0 || e.pointerId !== this.#p.pointerId) return;
1014
- let t = window.visualViewport, n = t?.width ?? window.innerWidth, r = t?.height ?? window.innerHeight, i = q(e.clientX - this.#p.offsetX, 0, Math.max(0, n - this.offsetWidth)), a = q(e.clientY - this.#p.offsetY, 0, Math.max(0, r - this.offsetHeight));
1122
+ let t = window.visualViewport, n = t?.width ?? window.innerWidth, r = t?.height ?? window.innerHeight, i = Z(e.clientX - this.#p.offsetX, 0, Math.max(0, n - this.offsetWidth)), a = Z(e.clientY - this.#p.offsetY, 0, Math.max(0, r - this.offsetHeight));
1015
1123
  this.style.left = `${i}px`, this.style.top = `${a}px`, this.style.right = "auto", this.style.bottom = "auto";
1016
1124
  };
1017
1125
  #W = (e) => {
@@ -1021,14 +1129,14 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
1021
1129
  this.#p = void 0, window.removeEventListener("pointermove", this.#U), window.removeEventListener("pointerup", this.#W);
1022
1130
  }
1023
1131
  };
1024
- function G(e = {}) {
1132
+ function Y(e = {}) {
1025
1133
  if (typeof customElements > "u") return;
1026
1134
  let t = e.tagName ?? "xcall-ccbar";
1027
1135
  if (customElements.get(t) !== void 0) return;
1028
- let n = t === "xcall-ccbar" ? W : class extends W {};
1136
+ let n = t === "xcall-ccbar" ? J : class extends J {};
1029
1137
  customElements.define(t, n);
1030
1138
  }
1031
- function K(e, t) {
1139
+ function X(e, t) {
1032
1140
  switch (e.kind) {
1033
1141
  case "unsupported": return t.statusUnsupported;
1034
1142
  case "permission-error": return t.statusPermission;
@@ -1044,18 +1152,18 @@ function K(e, t) {
1044
1152
  default: return e;
1045
1153
  }
1046
1154
  }
1047
- function q(e, t, n) {
1155
+ function Z(e, t, n) {
1048
1156
  return Math.min(n, Math.max(t, e));
1049
1157
  }
1050
- function J(e, t) {
1158
+ function Q(e, t) {
1051
1159
  for (let n of e.composedPath()) if (n instanceof Element && n !== t) return n;
1052
1160
  return e.target instanceof Element && e.target !== t ? e.target : void 0;
1053
1161
  }
1054
- function Y(e) {
1162
+ function $(e) {
1055
1163
  return typeof e == "object" && e && "code" in e && typeof e.code == "string" ? e.code : "SDK_INTERNAL_ERROR";
1056
1164
  }
1057
1165
  //#endregion
1058
1166
  //#region src/ui/index.ts
1059
- var X = "0.1.0";
1167
+ var ee = "0.1.0";
1060
1168
  //#endregion
1061
- export { W as XCallCCBarElement, G as defineCCBarElement, e as enUS, r as resolveMessages, X as uiVersion, t as zhCN };
1169
+ export { J as XCallCCBarElement, Y as defineCCBarElement, t as enUS, s as resolveMessages, ee as uiVersion, i as zhCN };