@sapia-ai/chatbot-v3 1.0.3 → 1.1.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 (49) hide show
  1. package/dist/{EmbeddedVideoPlayer-CNcds-dW.js → EmbeddedVideoPlayer-COUZHpPa.js} +14 -14
  2. package/dist/{Preview-Dmns6UWL.js → Preview-wPnYtccF.js} +3 -3
  3. package/dist/api/client.d.ts +6 -2
  4. package/dist/api/types/messages.d.ts +16 -5
  5. package/dist/api/types/responses.d.ts +48 -7
  6. package/dist/api.js +2 -2
  7. package/dist/core/bubbles/types.d.ts +2 -5
  8. package/dist/core/i18n/languages.d.ts +6 -1
  9. package/dist/core/interview.d.ts +15 -8
  10. package/dist/core/media/mimeTypes.d.ts +6 -1
  11. package/dist/core/media/recorder.d.ts +11 -2
  12. package/dist/core/store.d.ts +21 -1
  13. package/dist/core/theme/contrast.d.ts +6 -0
  14. package/dist/core/theme/cssVariables.d.ts +5 -0
  15. package/dist/core/theme/types.d.ts +3 -0
  16. package/dist/{dist-BSi28_cP.js → dist-BOe6WyvN.js} +92 -92
  17. package/dist/{dist-B9SbMqZU.js → dist-Bwlks_W8.js} +98 -98
  18. package/dist/{fix-webm-duration-BWL-ZRDX.js → fix-webm-duration-QAy9T6AR.js} +2 -2
  19. package/dist/index.js +7445 -5039
  20. package/dist/{jsx-runtime-8QqjHL5t.js → jsx-runtime-24G8w2Bf.js} +2 -2
  21. package/dist/{messages-Czlp86gl.js → messages-DCvBcspv.js} +260 -245
  22. package/dist/react/AnswerInput.d.ts +4 -5
  23. package/dist/react/bubbleViewModel.d.ts +25 -9
  24. package/dist/react/strings.d.ts +26 -3
  25. package/dist/{react-DJysvNxz.js → react-BjO903pN.js} +33 -33
  26. package/dist/{react-QrtEtv1G.js → react-Bw5AugJc.js} +31 -31
  27. package/dist/{react-dE7BdGuR.js → react-D8hV9uow.js} +10 -10
  28. package/dist/{react-NauLB_WU.js → react-DDjfkpOE.js} +38 -38
  29. package/dist/{react-Dbs-sPBo.js → react-DEF8h8hc.js} +37 -37
  30. package/dist/{react-B0K-sClg.js → react-DOgLiyZi.js} +2 -2
  31. package/dist/{react-be7q6yw_.js → react-DPFikgTM.js} +55 -55
  32. package/dist/{react-ChCcxVnw.js → react-qa12DkXH.js} +34 -34
  33. package/dist/{react-czRIxT0g.js → react-y4vaW3OH.js} +46 -46
  34. package/dist/ui/chat/ChatBubble/ChatBubble.d.ts +14 -5
  35. package/dist/ui/chat/ChatLog/ChatLog.d.ts +6 -4
  36. package/dist/ui/chat/EditBanner/EditBanner.d.ts +16 -0
  37. package/dist/ui/chat/SummaryCard/SummaryCard.d.ts +46 -0
  38. package/dist/ui/chat/types.d.ts +21 -8
  39. package/dist/ui/constants.d.ts +1 -0
  40. package/dist/ui/inputs/OptionList/OptionList.d.ts +3 -1
  41. package/dist/ui/inputs/TextAnswerInput/TextAnswerInput.d.ts +11 -4
  42. package/dist/ui/inputs/VideoRecorder/VideoRecorder.d.ts +6 -2
  43. package/dist/ui/markdown.d.ts +4 -0
  44. package/dist/ui/motion.d.ts +2 -0
  45. package/dist/ui/primitives/Button/Button.d.ts +5 -1
  46. package/dist/ui/primitives/Dialog/Dialog.d.ts +2 -1
  47. package/dist/ui/shell/WidgetRoot/WidgetRoot.d.ts +7 -1
  48. package/dist-umd/sapia-chatbot.umd.js +394 -270
  49. package/package.json +4 -1
@@ -1,6 +1,6 @@
1
1
  import { InterviewEngine } from '../core/interview';
2
2
  import { Region } from '../api/config';
3
- import { CurrentInputKind, TextRules } from './bubbleViewModel';
3
+ import { CurrentInputKind, EditingDraft, TextRules } from './bubbleViewModel';
4
4
  import { UiStrings } from './strings';
5
5
  export type AnswerInputProps = {
6
6
  engine: InterviewEngine;
@@ -12,10 +12,9 @@ export type AnswerInputProps = {
12
12
  region: Region;
13
13
  /** Max video answer length in seconds (video questions). */
14
14
  maxVideoSeconds?: number;
15
- /** True while re-editing an FTQ/PII answer; shows a cancel affordance. */
16
- editing?: boolean;
17
- cancelEditLabel?: string;
15
+ /** Stored answer to open the composer on when re-editing. */
16
+ draft?: EditingDraft;
18
17
  /** Called when the candidate pastes into a text answer (AGC paste log). */
19
18
  onPaste?: () => void;
20
19
  };
21
- export declare const AnswerInput: ({ engine, kind, disabled, textRules, strings, candidateCountryCode, region, maxVideoSeconds, editing, cancelEditLabel, onPaste, }: AnswerInputProps) => import("react").JSX.Element;
20
+ export declare const AnswerInput: ({ engine, kind, disabled, textRules, strings, candidateCountryCode, region, maxVideoSeconds, draft, onPaste, }: AnswerInputProps) => import("react").JSX.Element;
@@ -18,23 +18,32 @@ export type TextRules = {
18
18
  export declare const currentAgentBubble: (bubbles: MessageBubble[], editingQuestionId?: string) => MessageBubble | undefined;
19
19
  /** Id of the question the bottom input currently targets (for remounting per question). */
20
20
  export declare const currentQuestionId: (bubbles: MessageBubble[], editingQuestionId?: string) => string | undefined;
21
+ /** The stored answer of the question under edit, used to seed the composer. */
22
+ export type EditingDraft = {
23
+ text: string;
24
+ };
25
+ /**
26
+ * Answer text of the answer currently being re-edited, so the composer opens on it instead of
27
+ * blank. Reads the same source as the rendered bubble: `answer` for this session's submissions,
28
+ * message items for answers restored from history. Rich-text answers are markdown, which the
29
+ * composer renders back into the editor.
30
+ */
31
+ export declare const editingAnswerDraft: (bubbles: MessageBubble[], editingQuestionId?: string) => EditingDraft | undefined;
21
32
  /** Eyebrow/badge copy builders, supplied by react/strings (keeps i18n out of the view-model). */
22
33
  export type QuestionCardLabels = {
23
- /** "Question {n} of {total}" for written/video questions. */
34
+ /** "Question {n} of {total}", shown on every question card. */
24
35
  counter: (n: number, total: number) => string;
25
- /** Type eyebrow for MCQ/BGQ/DROPDOWN. */
26
- singleChoice: string;
27
36
  /** Dark badge shown on video question cards. */
28
37
  videoBadge: string;
29
38
  };
30
39
  /**
31
40
  * Marks every agent question turn as a card (matching the prototype's permanent
32
- * question styling); conversational agent turns stay plain. Written/video show
33
- * "Question n of N"; choice questions show a type eyebrow; video adds a badge.
34
- * The ordinal increments for each counted question even when its number isn't
35
- * displayed. Editing a past answer suppresses all cards (inline re-edit).
41
+ * question styling); conversational agent turns stay plain. Every card shows
42
+ * "Question n of N" (choice questions included, matching the reference); video
43
+ * adds a media badge. Cards persist through an edit — the docked edit banner, not a
44
+ * restyled transcript, is what signals edit mode.
36
45
  */
37
- export declare const buildQuestionCards: (bubbles: MessageBubble[], total: number, labels: QuestionCardLabels, editingQuestionId?: string) => Map<string, QuestionCard>;
46
+ export declare const buildQuestionCards: (bubbles: MessageBubble[], total: number, labels: QuestionCardLabels) => Map<string, QuestionCard>;
38
47
  /**
39
48
  * Bubble id of the active video question, so its recorder renders inside the
40
49
  * card. Undefined unless the current question is a (non-edited) video question.
@@ -43,7 +52,14 @@ export declare const activeVideoCardId: (bubbles: MessageBubble[], editingQuesti
43
52
  /** The bottom free-text/PII input is shown only for FTQ-typed questions. */
44
53
  export declare const isTextInputActive: (bubbles: MessageBubble[], editingQuestionId?: string) => boolean;
45
54
  /** Which composed input the current question needs (video, PII subtype, or plain text). */
46
- export type CurrentInputKind = 'text' | 'email' | 'name' | 'phone' | 'location' | 'video';
55
+ export declare enum CurrentInputKind {
56
+ TEXT = "text",
57
+ EMAIL = "email",
58
+ NAME = "name",
59
+ PHONE = "phone",
60
+ LOCATION = "location",
61
+ VIDEO = "video"
62
+ }
47
63
  export declare const currentInputKind: (bubbles: MessageBubble[], editingQuestionId?: string) => CurrentInputKind;
48
64
  export declare const currentTextRules: (bubbles: MessageBubble[], editingQuestionId?: string) => TextRules;
49
65
  /** Max video answer length in seconds (legacy reuses the voice-seconds rule). */
@@ -1,9 +1,9 @@
1
+ import { QuestionType } from '../api/types/messages';
1
2
  import { Translator } from '../core/i18n/translator';
3
+ import { SummaryKind } from '../ui/chat/SummaryCard/SummaryCard';
2
4
  export declare const buildStrings: (t: Translator) => {
3
5
  headerTitle: string;
4
6
  headerSubtitle: string;
5
- speakerInterviewer: string;
6
- singleChoiceLabel: string;
7
7
  videoBadge: string;
8
8
  typingLabel: string;
9
9
  typingReading: string;
@@ -25,12 +25,26 @@ export declare const buildStrings: (t: Translator) => {
25
25
  welcomePause: string;
26
26
  welcomeNext: string;
27
27
  welcomeReassurance: string;
28
+ /** Total-questions meta, e.g. "3 questions". */
29
+ summaryQuestions: (count: number) => string;
30
+ /** Estimated-time meta, e.g. "~9 min". */
31
+ summaryMinutes: (minutes: number) => string;
32
+ /** Uppercase label for the summary total panel, e.g. "Total". */
33
+ summaryTotal: string;
34
+ /**
35
+ * FE-owned label + description + icon kind for a breakdown category (the backend sends the
36
+ * QuestionType only). Unknown types fall back to a generic "Questions" label with no description.
37
+ */
38
+ summaryCategory: (type: QuestionType) => {
39
+ label: string;
40
+ description: string;
41
+ kind: SummaryKind;
42
+ };
28
43
  answerLooksGood: string;
29
44
  composerFooter: string;
30
45
  richToolbar: string;
31
46
  richBold: string;
32
47
  richItalic: string;
33
- richUnderline: string;
34
48
  richBulletList: string;
35
49
  richNumberList: string;
36
50
  inputPlaceholder: string;
@@ -39,7 +53,13 @@ export declare const buildStrings: (t: Translator) => {
39
53
  retryLabel: string;
40
54
  editLabel: string;
41
55
  cancelEditLabel: string;
56
+ editingLabel: string;
57
+ editBannerLabel: string;
42
58
  optionsGroupLabel: string;
59
+ senderAgent: string;
60
+ senderCandidate: string;
61
+ opensNewTab: string;
62
+ widgetLabel: string;
43
63
  sliderLabel: string;
44
64
  sliderHint: string;
45
65
  submitRatingLabel: string;
@@ -77,6 +97,9 @@ export declare const buildStrings: (t: Translator) => {
77
97
  videoOff: string;
78
98
  videoFinishHint: string;
79
99
  videoCameraOff: string;
100
+ videoRecordingStarted: string;
101
+ videoRecordingStopped: string;
102
+ videoSecondsRemaining: (seconds: number) => string;
80
103
  videoAttempts: (current: number, max: number) => string;
81
104
  videoUploadProgress: string;
82
105
  videoUploadFailed: string;
@@ -1,7 +1,7 @@
1
- import { b as e } from "./messages-Czlp86gl.js";
2
- import { t } from "./react-B0K-sClg.js";
3
- import { a as n, i as r, n as i, r as a, t as o } from "./classPrivateFieldSet2-DtQPURVD.js";
4
- import { t as s } from "./defineProperty-DiFpLzd2.js";
1
+ import { w as e } from "./messages-DCvBcspv.js";
2
+ import { t } from "./react-DOgLiyZi.js";
3
+ import { t as n } from "./defineProperty-DiFpLzd2.js";
4
+ import { a as r, i, n as a, r as o, t as s } from "./classPrivateFieldSet2-DtQPURVD.js";
5
5
  //#region ../../node_modules/.pnpm/spotify-audio-element@1.0.4/node_modules/spotify-audio-element/dist/spotify-audio-element.js
6
6
  var c = /* @__PURE__ */ e(t(), 1), l, u = "https://open.spotify.com", d = /open\.spotify\.com\/(\w+)\/(\w+)/i, f = "https://open.spotify.com/embed-podcast/iframe-api/v1", p = "SpotifyIframeApi", m = "onSpotifyIframeApiReady";
7
7
  function h(e, t = {}) {
@@ -46,45 +46,45 @@ function g(e, t) {
46
46
  }
47
47
  var _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakSet(), O = class extends ((l = globalThis.HTMLElement) == null ? class {} : l) {
48
48
  constructor() {
49
- super(), n(this, D), s(this, "loadComplete", new I()), r(this, _, void 0), r(this, v, void 0), r(this, y, void 0), r(this, b, !1), r(this, x, !1), r(this, S, !0), r(this, C, 0), r(this, w, NaN), r(this, T, !1), r(this, E, null), a(D, this, k).call(this, "config");
49
+ super(), r(this, D), n(this, "loadComplete", new I()), i(this, _, void 0), i(this, v, void 0), i(this, y, void 0), i(this, b, !1), i(this, x, !1), i(this, S, !0), i(this, C, 0), i(this, w, NaN), i(this, T, !1), i(this, E, null), o(D, this, k).call(this, "config");
50
50
  }
51
51
  async load() {
52
52
  var e, t, n;
53
- if (i(_, this)) return;
54
- i(v, this) && (this.loadComplete = new I()), o(v, this, !0), await o(_, this, Promise.resolve()), o(_, this, null), o(b, this, !1), o(x, this, !1), o(C, this, 0), o(w, this, NaN), o(T, this, !1), this.dispatchEvent(new Event("emptied"));
53
+ if (a(_, this)) return;
54
+ a(v, this) && (this.loadComplete = new I()), s(v, this, !0), await s(_, this, Promise.resolve()), s(_, this, null), s(b, this, !1), s(x, this, !1), s(C, this, 0), s(w, this, NaN), s(T, this, !1), this.dispatchEvent(new Event("emptied"));
55
55
  let r = this.api;
56
56
  if (this.api = null, !this.src) return;
57
57
  this.dispatchEvent(new Event("loadstart"));
58
- let a = {
58
+ let i = {
59
59
  t: (e = this.config) == null ? void 0 : e.startAt,
60
60
  theme: ((t = this.config) == null ? void 0 : t.theme) === "dark" ? "0" : null,
61
61
  preferVideo: (n = this.config) == null ? void 0 : n.preferVideo
62
62
  };
63
- if (i(y, this)) this.api = r, this.api.iframeElement.src = g(N(this.attributes), this);
63
+ if (a(y, this)) this.api = r, this.api.iframeElement.src = g(N(this.attributes), this);
64
64
  else {
65
- o(y, this, !0), this.shadowRoot || (this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = h(N(this.attributes), this));
65
+ s(y, this, !0), this.shadowRoot || (this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = h(N(this.attributes), this));
66
66
  let e = this.shadowRoot.querySelector("iframe"), t = await F(f, p, m);
67
- this.api = await new Promise((n) => t.createController(e, a, n)), this.api.iframeElement = e, this.api.addListener("ready", () => {
67
+ this.api = await new Promise((n) => t.createController(e, i, n)), this.api.iframeElement = e, this.api.addListener("ready", () => {
68
68
  this.dispatchEvent(new Event("loadedmetadata")), this.dispatchEvent(new Event("durationchange")), this.dispatchEvent(new Event("volumechange"));
69
69
  }), this.api.addListener("playback_update", (e) => {
70
- if (i(x, this) && i(S, this) && (e.data.isBuffering || !e.data.isPaused)) {
71
- o(x, this, !1), this.currentTime = 1;
70
+ if (a(x, this) && a(S, this) && (e.data.isBuffering || !e.data.isPaused)) {
71
+ s(x, this, !1), this.currentTime = 1;
72
72
  return;
73
73
  }
74
- if (e.data.duration / 1e3 !== i(w, this) && (o(x, this, !1), o(w, this, e.data.duration / 1e3), this.dispatchEvent(new Event("durationchange"))), e.data.position / 1e3 !== i(C, this) && (o(T, this, !1), o(x, this, !1), o(C, this, e.data.position / 1e3), this.dispatchEvent(new Event("timeupdate"))), !i(b, this) && !i(S, this) && e.data.isPaused) {
75
- o(S, this, !0), this.dispatchEvent(new Event("pause"));
74
+ if (e.data.duration / 1e3 !== a(w, this) && (s(x, this, !1), s(w, this, e.data.duration / 1e3), this.dispatchEvent(new Event("durationchange"))), e.data.position / 1e3 !== a(C, this) && (s(T, this, !1), s(x, this, !1), s(C, this, e.data.position / 1e3), this.dispatchEvent(new Event("timeupdate"))), !a(b, this) && !a(S, this) && e.data.isPaused) {
75
+ s(S, this, !0), this.dispatchEvent(new Event("pause"));
76
76
  return;
77
77
  }
78
- if (i(S, this) && (e.data.isBuffering || !e.data.isPaused)) {
79
- o(S, this, !1), this.dispatchEvent(new Event("play")), o(b, this, e.data.isBuffering), i(b, this) ? this.dispatchEvent(new Event("waiting")) : this.dispatchEvent(new Event("playing"));
78
+ if (a(S, this) && (e.data.isBuffering || !e.data.isPaused)) {
79
+ s(S, this, !1), this.dispatchEvent(new Event("play")), s(b, this, e.data.isBuffering), a(b, this) ? this.dispatchEvent(new Event("waiting")) : this.dispatchEvent(new Event("playing"));
80
80
  return;
81
81
  }
82
- if (i(b, this) && !e.data.isPaused) {
83
- o(b, this, !1), this.dispatchEvent(new Event("playing"));
82
+ if (a(b, this) && !e.data.isPaused) {
83
+ s(b, this, !1), this.dispatchEvent(new Event("playing"));
84
84
  return;
85
85
  }
86
- if (!this.paused && !this.seeking && !i(x, this) && Math.ceil(this.currentTime) >= this.duration) {
87
- if (o(x, this, !0), this.loop) {
86
+ if (!this.paused && !this.seeking && !a(x, this) && Math.ceil(this.currentTime) >= this.duration) {
87
+ if (s(x, this, !0), this.loop) {
88
88
  this.currentTime = 1;
89
89
  return;
90
90
  }
@@ -104,21 +104,21 @@ var _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /*
104
104
  }
105
105
  async play() {
106
106
  var e;
107
- return o(S, this, !1), o(b, this, !0), this.dispatchEvent(new Event("play")), await this.loadComplete, (e = this.api) == null ? void 0 : e.resume();
107
+ return s(S, this, !1), s(b, this, !0), this.dispatchEvent(new Event("play")), await this.loadComplete, (e = this.api) == null ? void 0 : e.resume();
108
108
  }
109
109
  async pause() {
110
110
  var e;
111
111
  return await this.loadComplete, (e = this.api) == null ? void 0 : e.pause();
112
112
  }
113
113
  get config() {
114
- return i(E, this);
114
+ return a(E, this);
115
115
  }
116
116
  set config(e) {
117
- o(E, this, e);
117
+ s(E, this, e);
118
118
  }
119
119
  get paused() {
120
120
  var e;
121
- return (e = i(S, this)) == null ? !0 : e;
121
+ return (e = a(S, this)) == null ? !0 : e;
122
122
  }
123
123
  get muted() {
124
124
  return !1;
@@ -132,7 +132,7 @@ var _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /*
132
132
  return Math.ceil(this.currentTime) >= this.duration;
133
133
  }
134
134
  get seeking() {
135
- return i(T, this);
135
+ return a(T, this);
136
136
  }
137
137
  get loop() {
138
138
  return this.hasAttribute("loop");
@@ -141,19 +141,19 @@ var _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /*
141
141
  this.loop != e && this.toggleAttribute("loop", !!e);
142
142
  }
143
143
  get currentTime() {
144
- return i(C, this);
144
+ return a(C, this);
145
145
  }
146
146
  set currentTime(e) {
147
147
  if (this.currentTime == e) return;
148
- o(T, this, !0);
149
- let t = i(C, this);
150
- o(C, this, e), this.dispatchEvent(new Event("timeupdate")), o(C, this, t), this.loadComplete.then(() => {
148
+ s(T, this, !0);
149
+ let t = a(C, this);
150
+ s(C, this, e), this.dispatchEvent(new Event("timeupdate")), s(C, this, t), this.loadComplete.then(() => {
151
151
  var t;
152
152
  (t = this.api) == null || t.seek(e);
153
153
  });
154
154
  }
155
155
  get duration() {
156
- return i(w, this);
156
+ return a(w, this);
157
157
  }
158
158
  get src() {
159
159
  return this.getAttribute("src");
@@ -168,7 +168,7 @@ function k(e) {
168
168
  delete this[e], this[e] = t;
169
169
  }
170
170
  }
171
- s(O, "getTemplateHTML", h), s(O, "shadowRootOptions", { mode: "open" }), s(O, "observedAttributes", [
171
+ n(O, "getTemplateHTML", h), n(O, "shadowRootOptions", { mode: "open" }), n(O, "observedAttributes", [
172
172
  "controls",
173
173
  "loop",
174
174
  "src"
@@ -309,4 +309,4 @@ var W = H({
309
309
  //#endregion
310
310
  export { W as default };
311
311
 
312
- //# sourceMappingURL=react-DJysvNxz.js.map
312
+ //# sourceMappingURL=react-BjO903pN.js.map
@@ -1,41 +1,41 @@
1
- import { b as e } from "./messages-Czlp86gl.js";
2
- import { t } from "./react-B0K-sClg.js";
3
- import { n } from "./hls-mBncGwsE.js";
4
- import { a as r, i, n as a, r as o, t as s } from "./classPrivateFieldSet2-DtQPURVD.js";
5
- import { t as c } from "./defineProperty-DiFpLzd2.js";
6
- import { n as l, t as u } from "./dist-BSi28_cP.js";
1
+ import { w as e } from "./messages-DCvBcspv.js";
2
+ import { t } from "./react-DOgLiyZi.js";
3
+ import { t as n } from "./defineProperty-DiFpLzd2.js";
4
+ import { n as r } from "./hls-mBncGwsE.js";
5
+ import { a as i, i as a, n as o, r as s, t as c } from "./classPrivateFieldSet2-DtQPURVD.js";
6
+ import { n as l, t as u } from "./dist-BOe6WyvN.js";
7
7
  //#region ../../node_modules/.pnpm/hls-video-element@1.5.11/node_modules/hls-video-element/dist/hls-video-element.js
8
8
  var d = /* @__PURE__ */ e(t(), 1), f = ((e) => {
9
9
  var t, l, u, d, f;
10
10
  return l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakSet(), f = /* @__PURE__ */ new WeakMap(), t = class extends e {
11
11
  constructor() {
12
- super(), r(this, d), i(this, l, null), i(this, u, null), i(this, f, () => {
12
+ super(), i(this, d), a(this, l, null), a(this, u, null), a(this, f, () => {
13
13
  var e, t, n;
14
14
  (e = this.nativeEl) != null && e.webkitCurrentPlaybackTargetIsWireless ? (t = this.api) == null || t.stopLoad() : (n = this.api) == null || n.startLoad();
15
- }), o(d, this, m).call(this, "config");
15
+ }), s(d, this, m).call(this, "config");
16
16
  }
17
17
  get config() {
18
- return a(u, this);
18
+ return o(u, this);
19
19
  }
20
20
  set config(e) {
21
- s(u, this, e);
21
+ c(u, this, e);
22
22
  }
23
23
  attributeChangedCallback(e, t, n) {
24
24
  e !== "src" && super.attributeChangedCallback(e, t, n), e === "src" && t != n && this.load();
25
25
  }
26
26
  async load() {
27
27
  var e, t;
28
- let r = !this.api;
29
- if (o(d, this, p).call(this), this.src) {
30
- if (r && !a(u, this) && s(u, this, JSON.parse(((e = this.shadowRoot.getElementById("config")) == null ? void 0 : e.textContent) || "{}")), n.isSupported()) {
31
- switch (await Promise.resolve(), this.api = new n({
28
+ let n = !this.api;
29
+ if (s(d, this, p).call(this), this.src) {
30
+ if (n && !o(u, this) && c(u, this, JSON.parse(((e = this.shadowRoot.getElementById("config")) == null ? void 0 : e.textContent) || "{}")), r.isSupported()) {
31
+ switch (await Promise.resolve(), this.api = new r({
32
32
  liveDurationInfinity: !0,
33
33
  autoStartLoad: !1,
34
34
  ...this.config
35
35
  }), this.api.loadSource(this.src), this.api.attachMedia(this.nativeEl), this.nativeEl.preload) {
36
36
  case "none": {
37
37
  let e = () => this.api.startLoad();
38
- this.nativeEl.addEventListener("play", e, { once: !0 }), this.api.on(n.Events.DESTROYING, () => {
38
+ this.nativeEl.addEventListener("play", e, { once: !0 }), this.api.on(r.Events.DESTROYING, () => {
39
39
  this.nativeEl.removeEventListener("play", e);
40
40
  });
41
41
  break;
@@ -43,19 +43,19 @@ var d = /* @__PURE__ */ e(t(), 1), f = ((e) => {
43
43
  case "metadata": {
44
44
  let e = this.api.config.maxBufferLength, t = this.api.config.maxBufferSize;
45
45
  this.api.config.maxBufferLength = 1, this.api.config.maxBufferSize = 1;
46
- let r = () => {
46
+ let n = () => {
47
47
  this.api.config.maxBufferLength = e, this.api.config.maxBufferSize = t;
48
48
  };
49
- this.nativeEl.addEventListener("play", r, { once: !0 }), this.api.on(n.Events.DESTROYING, () => {
50
- this.nativeEl.removeEventListener("play", r);
49
+ this.nativeEl.addEventListener("play", n, { once: !0 }), this.api.on(r.Events.DESTROYING, () => {
50
+ this.nativeEl.removeEventListener("play", n);
51
51
  }), this.api.startLoad();
52
52
  break;
53
53
  }
54
54
  default: this.api.startLoad();
55
55
  }
56
- this.nativeEl.webkitCurrentPlaybackTargetIsWireless && this.api.stopLoad(), this.nativeEl.addEventListener("webkitcurrentplaybacktargetiswirelesschanged", a(f, this)), s(l, this, document.createElement("source")), a(l, this).setAttribute("type", "application/x-mpegURL"), a(l, this).setAttribute("src", this.src), this.nativeEl.disableRemotePlayback = !1, this.nativeEl.append(a(l, this));
56
+ this.nativeEl.webkitCurrentPlaybackTargetIsWireless && this.api.stopLoad(), this.nativeEl.addEventListener("webkitcurrentplaybacktargetiswirelesschanged", o(f, this)), c(l, this, document.createElement("source")), o(l, this).setAttribute("type", "application/x-mpegURL"), o(l, this).setAttribute("src", this.src), this.nativeEl.disableRemotePlayback = !1, this.nativeEl.append(o(l, this));
57
57
  let e = /* @__PURE__ */ new WeakMap();
58
- this.api.on(n.Events.MANIFEST_PARSED, (t, n) => {
58
+ this.api.on(r.Events.MANIFEST_PARSED, (t, n) => {
59
59
  this.nativeEl.autoplay && this.nativeEl.paused && this.nativeEl.play().catch((e) => {
60
60
  console.warn("Autoplay failed:", e);
61
61
  }), i();
@@ -73,19 +73,19 @@ var d = /* @__PURE__ */ e(t(), 1), f = ((e) => {
73
73
  var e;
74
74
  let t = +((e = [...this.audioTracks].find((e) => e.enabled)) == null ? void 0 : e.id), n = this.api.audioTracks.map((e) => e.id);
75
75
  t != this.api.audioTrack && n.includes(t) && (this.api.audioTrack = t);
76
- }), this.api.on(n.Events.LEVELS_UPDATED, (t, n) => {
76
+ }), this.api.on(r.Events.LEVELS_UPDATED, (t, n) => {
77
77
  var r;
78
78
  let i = this.videoTracks[(r = this.videoTracks.selectedIndex) == null ? 0 : r];
79
79
  if (!i) return;
80
80
  let a = n.levels.map((t) => e.get(t));
81
81
  for (let e of this.videoRenditions) e.id && !a.includes(e.id) && i.removeRendition(e);
82
82
  });
83
- let r = null;
84
- this.api.on(n.Events.ERROR, (e, t) => {
85
- t.type === n.ErrorTypes.NETWORK_ERROR && t.details === n.ErrorDetails.FRAG_LOAD_ERROR && (r = t.frag.level);
86
- }), this.api.on(n.Events.LEVEL_SWITCHED, (e, t) => {
87
- let n = t.level;
88
- r !== null && n < r && (console.warn(`\u26A0\uFE0F hls.js downgraded quality from level ${r} to ${n} due to fragment load failure.`), this.videoRenditions.selectedIndex = n, r = null);
83
+ let n = null;
84
+ this.api.on(r.Events.ERROR, (e, t) => {
85
+ t.type === r.ErrorTypes.NETWORK_ERROR && t.details === r.ErrorDetails.FRAG_LOAD_ERROR && (n = t.frag.level);
86
+ }), this.api.on(r.Events.LEVEL_SWITCHED, (e, t) => {
87
+ let r = t.level;
88
+ n !== null && r < n && (console.warn(`\u26A0\uFE0F hls.js downgraded quality from level ${n} to ${r} due to fragment load failure.`), this.videoRenditions.selectedIndex = r, n = null);
89
89
  }), (t = this.videoRenditions) == null || t.addEventListener("change", (e) => {
90
90
  let t = e.target.selectedIndex;
91
91
  t != this.api.nextLevel && (this.api.nextLevel = t);
@@ -94,13 +94,13 @@ var d = /* @__PURE__ */ e(t(), 1), f = ((e) => {
94
94
  for (let e of this.videoTracks) this.removeVideoTrack(e);
95
95
  for (let e of this.audioTracks) this.removeAudioTrack(e);
96
96
  };
97
- this.api.once(n.Events.DESTROYING, i);
97
+ this.api.once(r.Events.DESTROYING, i);
98
98
  return;
99
99
  }
100
100
  await Promise.resolve(), this.nativeEl.canPlayType("application/vnd.apple.mpegurl") && (this.nativeEl.src = this.src);
101
101
  }
102
102
  }
103
- }, c(t, "shadowRootOptions", { ...e.shadowRootOptions }), c(t, "getTemplateHTML", (t, n = {}) => {
103
+ }, n(t, "shadowRootOptions", { ...e.shadowRootOptions }), n(t, "getTemplateHTML", (t, n = {}) => {
104
104
  let { src: r, ...i } = t;
105
105
  return `
106
106
  <script type="application/json" id="config">
@@ -111,7 +111,7 @@ var d = /* @__PURE__ */ e(t(), 1), f = ((e) => {
111
111
  }), t;
112
112
  function p() {
113
113
  var e, t;
114
- (e = a(l, this)) == null || e.remove(), (t = this.nativeEl) == null || t.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged", a(f, this)), this.api && (this.api.detachMedia(), this.api.destroy(), this.api = null);
114
+ (e = o(l, this)) == null || e.remove(), (t = this.nativeEl) == null || t.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged", o(f, this)), this.api && (this.api.detachMedia(), this.api.destroy(), this.api = null);
115
115
  }
116
116
  function m(e) {
117
117
  if (Object.prototype.hasOwnProperty.call(this, e)) {
@@ -215,4 +215,4 @@ var b = v({
215
215
  //#endregion
216
216
  export { b as default };
217
217
 
218
- //# sourceMappingURL=react-QrtEtv1G.js.map
218
+ //# sourceMappingURL=react-Bw5AugJc.js.map
@@ -1,12 +1,12 @@
1
- import { b as e } from "./messages-Czlp86gl.js";
2
- import { t } from "./react-B0K-sClg.js";
3
- import { i as n, n as r, t as i } from "./classPrivateFieldSet2-DtQPURVD.js";
4
- import { t as a } from "./defineProperty-DiFpLzd2.js";
5
- import { n as o, t as s } from "./dist-BSi28_cP.js";
1
+ import { w as e } from "./messages-DCvBcspv.js";
2
+ import { t } from "./react-DOgLiyZi.js";
3
+ import { t as n } from "./defineProperty-DiFpLzd2.js";
4
+ import { i as r, n as i, t as a } from "./classPrivateFieldSet2-DtQPURVD.js";
5
+ import { n as o, t as s } from "./dist-BOe6WyvN.js";
6
6
  //#region ../../node_modules/.pnpm/dash-video-element@0.3.2_@svta+cml-cta@1.0.6_@svta+cml-structured-field-values@1.1.3_@s_1d417b19612eff304477e3f6272644a6/node_modules/dash-video-element/dist/dash-video-element.js
7
7
  var c = /* @__PURE__ */ e(t(), 1), l = /* @__PURE__ */ new WeakMap(), u = class extends s(o) {
8
8
  constructor(...e) {
9
- super(...e), n(this, l, void 0);
9
+ super(...e), r(this, l, void 0);
10
10
  }
11
11
  attributeChangedCallback(e, t, n) {
12
12
  e !== "src" && super.attributeChangedCallback(e, t, n), e === "src" && t != n && this.load();
@@ -42,11 +42,11 @@ var c = /* @__PURE__ */ e(t(), 1), l = /* @__PURE__ */ new WeakMap(), u = class
42
42
  }
43
43
  }
44
44
  async load() {
45
- if (r(l, this)) {
45
+ if (i(l, this)) {
46
46
  this.api.attachSource(this.src);
47
47
  return;
48
48
  }
49
- i(l, this, !0);
49
+ a(l, this, !0);
50
50
  let e = await import("./dash.all.min-DZ1yEcJk.js");
51
51
  this.api = e.MediaPlayer().create(), this.api.initialize(this.nativeEl, this.src, this.autoplay), this.api.on(e.MediaPlayer.events.STREAM_INITIALIZED, () => {
52
52
  let e = this.api.getRepresentationsByType("video"), t = this.videoTracks.getTrackById("main");
@@ -63,7 +63,7 @@ var c = /* @__PURE__ */ e(t(), 1), l = /* @__PURE__ */ new WeakMap(), u = class
63
63
  });
64
64
  }
65
65
  };
66
- a(u, "shadowRootOptions", { ...o.shadowRootOptions }), a(u, "getTemplateHTML", (e) => {
66
+ n(u, "shadowRootOptions", { ...o.shadowRootOptions }), n(u, "getTemplateHTML", (e) => {
67
67
  let { src: t, ...n } = e;
68
68
  return o.getTemplateHTML(n);
69
69
  });
@@ -190,4 +190,4 @@ var S = b({
190
190
  //#endregion
191
191
  export { S as default };
192
192
 
193
- //# sourceMappingURL=react-dE7BdGuR.js.map
193
+ //# sourceMappingURL=react-D8hV9uow.js.map