@vindral/web-sdk 4.8.2-9-gec246501 → 4.8.3

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.
@@ -1,19 +1,38 @@
1
- import { t as e } from "./CFqytvUK.js";
2
- import { t } from "./CXMDq12B.js";
3
- import { t as n } from "./2sSTdNyC.js";
4
- //#region ../../libs/utils/src/assert.ts
5
- function r(e, t) {
1
+ import { n as e, t } from "./DvtbAkGW.js";
2
+ // ../../libs/utils/src/assert.ts
3
+ function n(e, t) {
6
4
  if (!e) throw Error(t);
7
5
  }
8
- //#endregion
9
- //#region ../../libs/utils/src/tryJsonParse.ts
10
- var i = (e) => {
6
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectSpread2.js
7
+ function r(e, t) {
8
+ var n = Object.keys(e);
9
+ if (Object.getOwnPropertySymbols) {
10
+ var r = Object.getOwnPropertySymbols(e);
11
+ t && (r = r.filter(function(t) {
12
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
13
+ })), n.push.apply(n, r);
14
+ }
15
+ return n;
16
+ }
17
+ function i(t) {
18
+ for (var n = 1; n < arguments.length; n++) {
19
+ var i = arguments[n] == null ? {} : arguments[n];
20
+ n % 2 ? r(Object(i), !0).forEach(function(n) {
21
+ e(t, n, i[n]);
22
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : r(Object(i)).forEach(function(e) {
23
+ Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(i, e));
24
+ });
25
+ }
26
+ return t;
27
+ }
28
+ // ../../libs/utils/src/tryJsonParse.ts
29
+ var a = (e) => {
11
30
  try {
12
31
  return JSON.parse(e);
13
32
  } catch (e) {
14
33
  return;
15
34
  }
16
- }, a = (e) => {
35
+ }, o = (e) => {
17
36
  switch (e) {
18
37
  case "h264":
19
38
  case "h265":
@@ -25,7 +44,7 @@ var i = (e) => {
25
44
  default: throw Error("Unknown codec");
26
45
  }
27
46
  };
28
- function o(e) {
47
+ function s(e) {
29
48
  if (e.startsWith("opus")) return "opus";
30
49
  if (e.startsWith("mp4a")) return "aac";
31
50
  if (e.startsWith("avc1")) return "h264";
@@ -33,53 +52,51 @@ function o(e) {
33
52
  if (e.startsWith("av01")) return "av1";
34
53
  if (e.startsWith("webvtt")) return "webvtt";
35
54
  }
36
- //#endregion
37
- //#region ../../libs/data-types/src/ConnectInfo.ts
38
- function s(e) {
55
+ // ../../libs/data-types/src/ConnectInfo.ts
56
+ function c(e) {
39
57
  return !(typeof e.edges[0] == "string" || e.channels[0] && !("catalog" in e.channels[0]));
40
58
  }
41
- function c(e) {
42
- return e.tracks.filter((e) => !!e.codec).filter((e) => o(e.codec || "")).map((e, t) => {
43
- let n = e.codec, i = e.bitrate;
44
- r(n, "codec is required"), r(i !== void 0, "bitrate is required");
45
- let s = o(n);
46
- if (r(s, "codec is required"), a(s) === "audio") {
47
- let r = e.samplerate || 0;
59
+ function l(e) {
60
+ return e.tracks.filter((e) => !!e.codec).filter((e) => s(e.codec || "")).map((e, t) => {
61
+ let r = e.codec, i = e.bitrate;
62
+ n(r, "codec is required"), n(i !== void 0, "bitrate is required");
63
+ let a = s(r);
64
+ if (n(a, "codec is required"), o(a) === "audio") {
65
+ let n = e.samplerate || 0;
48
66
  return {
49
67
  track: e,
50
68
  id: t,
51
- codec: s,
52
- codecString: n,
69
+ codec: a,
70
+ codecString: r,
53
71
  bitRate: i,
54
72
  channels: e.channelConfig === "stereo" ? 2 : 1,
55
- sampleRate: r,
73
+ sampleRate: n,
56
74
  language: e.language
57
75
  };
58
76
  }
59
- return a(s) === "text" ? {
77
+ return o(a) === "text" ? {
60
78
  track: e,
61
79
  id: t,
62
80
  bitRate: 0,
63
- codec: s,
81
+ codec: a,
64
82
  kind: "subtitles",
65
- codecString: n,
83
+ codecString: r,
66
84
  label: e.label,
67
85
  language: e.language
68
- } : (r(e.width, "width is required"), r(e.height, "width is required"), r(e.framerate, "framerate is required"), {
86
+ } : (n(e.width, "width is required"), n(e.height, "width is required"), n(e.framerate, "framerate is required"), {
69
87
  track: e,
70
88
  id: t,
71
- codec: s,
89
+ codec: a,
72
90
  bitRate: i,
73
- codecString: n,
91
+ codecString: r,
74
92
  width: e.width,
75
93
  height: e.height,
76
94
  frameRate: e.framerate
77
95
  });
78
96
  }).sort((e, t) => e.bitRate - t.bitRate);
79
97
  }
80
- //#endregion
81
- //#region ../../libs/api-client/src/auth.ts
82
- var l = (e) => e ? { Authorization: `Bearer ${e}` } : void 0, u = (e, t) => {
98
+ // ../../libs/api-client/src/auth.ts
99
+ var u = (e) => e ? { Authorization: `Bearer ${e}` } : void 0, d = (e, t) => {
83
100
  try {
84
101
  let t = e.ancestorOrigins;
85
102
  if (t && t.length > 0) return Array.from(t).join(",") || void 0;
@@ -87,34 +104,34 @@ var l = (e) => e ? { Authorization: `Bearer ${e}` } : void 0, u = (e, t) => {
87
104
  try {
88
105
  if (t.referrer) return new URL(t.referrer).origin || void 0;
89
106
  } catch (e) {}
90
- }, d = (e) => typeof e == "object" && !!e && "message" in e, f = class extends Error {
107
+ }, f = (e) => typeof e == "object" && !!e && "message" in e, p = class extends Error {
91
108
  constructor({ status: t, url: n, body: r }) {
92
- let a = i(r), o = d(a) ? a.message : `Url ${n.toString()}, Status code: ${t}, Body: ${r}`;
109
+ let i = a(r), o = f(i) ? i.message : `Url ${n.toString()}, Status code: ${t}, Body: ${r}`;
93
110
  super(o), e(this, "status", void 0), e(this, "body", void 0), e(this, "url", void 0), this.status = t, this.body = r, this.url = n, Object.setPrototypeOf(this, new.target.prototype);
94
111
  }
95
- }, p = (e) => typeof e.status == "number", m = () => {
96
- if (!(typeof window > "u" || typeof document > "u")) return u(window.location, document);
97
- }, h = (e) => {
98
- let t = m();
112
+ }, m = (e) => typeof e.status == "number", h = () => {
113
+ if (typeof window < "u" && typeof document < "u") return d(window.location, document);
114
+ }, g = (e) => {
115
+ let t = h();
99
116
  if (!t || e.searchParams.has("parentOrigin")) return e;
100
117
  let n = new URL(e.toString());
101
118
  return n.searchParams.append("parentOrigin", t), n;
102
- }, g = function() {
119
+ }, _ = function() {
103
120
  var e = t(function* (e, t) {
104
- let r = h(e), i = yield fetch(r.toString(), n({ mode: "cors" }, t));
105
- if (!i.ok) throw new f({
106
- status: i.status,
107
- url: r,
108
- body: yield i.text()
121
+ let n = g(e), r = yield fetch(n.toString(), i({ mode: "cors" }, t));
122
+ if (!r.ok) throw new p({
123
+ status: r.status,
124
+ url: n,
125
+ body: yield r.text()
109
126
  });
110
- return i;
127
+ return r;
111
128
  });
112
129
  return function(t, n) {
113
130
  return e.apply(this, arguments);
114
131
  };
115
- }(), _ = function() {
132
+ }(), v = function() {
116
133
  var e = t(function* (e, t) {
117
- return yield (yield g(e, n({}, t))).json();
134
+ return yield (yield _(e, i({}, t))).json();
118
135
  });
119
136
  return function(t, n) {
120
137
  return e.apply(this, arguments);
@@ -122,74 +139,73 @@ var l = (e) => e ? { Authorization: `Bearer ${e}` } : void 0, u = (e, t) => {
122
139
  }();
123
140
  (function() {
124
141
  var e = t(function* (e) {
125
- return g(e);
142
+ return _(e);
126
143
  });
127
144
  return function(t) {
128
145
  return e.apply(this, arguments);
129
146
  };
130
147
  })();
131
- var v = function() {
148
+ var y = function() {
132
149
  var e = t(function* (e, t) {
133
- return g(e, n({ method: "POST" }, t));
150
+ return _(e, i({ method: "POST" }, t));
134
151
  });
135
152
  return function(t, n) {
136
153
  return e.apply(this, arguments);
137
154
  };
138
155
  }();
139
- //#endregion
140
- //#region ../../libs/api-client/src/responses/connect.ts
141
- function y(e) {
156
+ // ../../libs/api-client/src/responses/connect.ts
157
+ function b(e) {
142
158
  var t;
143
159
  return !(typeof e.edges[0] == "string" || e.channels[0] && "catalog" in e.channels[0] && ((t = e.channels[0]) == null ? void 0 : t.catalog) === void 0);
144
160
  }
145
- //#endregion
146
- //#region ../../libs/api-client/src/client.ts
147
- var b = {
161
+ // ../../libs/api-client/src/client.ts
162
+ var x = {
148
163
  lbConnect: (e) => e.channelGroupId ? `connect?channelId=${e.channelId}&channelGroupId=${e.channelGroupId}` : `connect?channelId=${e.channelId}`,
149
164
  thumbnails: (e, t) => t ? e.channelGroupId ? `thumbnail/?channelGroupId=${e.channelGroupId}&auth.token=${t}&auth.type=jwt` : e.channelId ? `thumbnail/?channelId=${e.channelId}&auth.token=${t}&auth.type=jwt` : "thumbnail" : "thumbnail"
150
- }, x = class {
165
+ }, S = class {
151
166
  constructor(t) {
152
167
  e(this, "baseUrl", void 0), e(this, "tokenFactory", void 0), this.baseUrl = new URL("/api/v4/", t.publicEndpoint).toString(), this.tokenFactory = t.tokenFactory;
153
168
  }
154
169
  connect(e) {
155
- var r = this;
170
+ var n = this;
156
171
  return t(function* () {
157
- let { channelId: t, channelGroupId: i } = e, a = {
172
+ let { channelId: t, channelGroupId: r } = e, a = {
158
173
  channelId: t,
159
- channelGroupId: i
160
- }, o = new URL(b.lbConnect(e), r.baseUrl), s = r.getAuthToken(a), l = yield _(o, { headers: r.getHeaders(s) });
161
- if (y(l)) {
162
- let e = l.channels.map((e) => {
163
- let t = r.toChannel(e, a), i = c(e.catalog);
164
- return n(n(n({}, e), t), {}, { renditions: i });
174
+ channelGroupId: r
175
+ }, o = new URL(x.lbConnect(e), n.baseUrl), s = n.getAuthToken(a), c = yield v(o, { headers: n.getHeaders(s) });
176
+ if (b(c)) {
177
+ let e = c.channels.map((e) => {
178
+ let t = n.toChannel(e, a), r = l(e.catalog);
179
+ return i(i(i({}, e), t), {}, { renditions: r });
165
180
  });
166
- return n(n({}, l), {}, { channels: e });
167
- } else {
168
- let e = l.channels.map((e) => {
169
- let t = r.toChannel(e, a);
170
- return n(n({}, e), t);
181
+ return i(i({}, c), {}, { channels: e });
182
+ }
183
+ {
184
+ let e = c.channels.map((e) => {
185
+ let t = n.toChannel(e, a);
186
+ return i(i({}, e), t);
171
187
  });
172
- return n(n({}, l), {}, { channels: e });
188
+ return i(i({}, c), {}, { channels: e });
173
189
  }
174
190
  })();
175
191
  }
176
192
  getChannel(e) {
177
193
  var n = this;
178
194
  return t(function* () {
179
- let t = { channelId: e }, r = new URL(`channel/${e}`, n.baseUrl), i = n.getAuthToken(t), a = yield _(r, { headers: n.getHeaders(i) });
195
+ let t = { channelId: e }, r = new URL(`channel/${e}`, n.baseUrl), i = n.getAuthToken(t), a = yield v(r, { headers: n.getHeaders(i) });
180
196
  return n.toChannel(a, t, i);
181
197
  })();
182
198
  }
183
199
  getChannels(e) {
184
200
  var n = this;
185
201
  return t(function* () {
186
- let t = { channelGroupId: e }, r = new URL(`channels/${e}`, n.baseUrl), i = n.getAuthToken(t), a = yield _(r, { headers: n.getHeaders(i) }), o = Array.isArray(a) ? a : a.channels;
202
+ let t = { channelGroupId: e }, r = new URL(`channels/${e}`, n.baseUrl), i = n.getAuthToken(t), a = yield v(r, { headers: n.getHeaders(i) }), o = Array.isArray(a) ? a : a.channels;
187
203
  return n.toChannels(o, t, i);
188
204
  })();
189
205
  }
190
206
  getHeaders(e) {
191
207
  var t;
192
- return (t = l(e)) == null ? {} : t;
208
+ return (t = u(e)) == null ? {} : t;
193
209
  }
194
210
  getAuthToken(e) {
195
211
  return this.tokenFactory ? this.tokenFactory(e) : void 0;
@@ -198,7 +214,7 @@ var b = {
198
214
  return e.map((e) => this.toChannel(e, t, n));
199
215
  }
200
216
  toChannel(e, t, n) {
201
- let { baseUrl: r, sizes: i } = e.thumbnail, a = r || new URL(b.thumbnails(t, n), this.baseUrl), o = i.map((r) => new URL(`?channelId=${e.channelId}&width=${r.width}&height=${r.height}${S(t, n)}`, a).toString());
217
+ let { baseUrl: r, sizes: i } = e.thumbnail, a = r || new URL(x.thumbnails(t, n), this.baseUrl), o = i.map((r) => new URL(`?channelId=${e.channelId}&width=${r.width}&height=${r.height}${C(t, n)}`, a).toString());
202
218
  return {
203
219
  channelId: e.channelId,
204
220
  name: e.name,
@@ -206,6 +222,5 @@ var b = {
206
222
  thumbnailUrls: o
207
223
  };
208
224
  }
209
- }, S = (e, t) => t ? e.channelGroupId ? `&channelGroupId=${e.channelGroupId}&auth.token=${t}&auth.type=jwt` : `&auth.token=${t}&auth.type=jwt` : "";
210
- //#endregion
211
- export { s as a, i as c, c as i, r as l, p as n, o, v as r, a as s, x as t };
225
+ }, C = (e, t) => t ? e.channelGroupId ? `&channelGroupId=${e.channelGroupId}&auth.token=${t}&auth.type=jwt` : `&auth.token=${t}&auth.type=jwt` : "";
226
+ export { c as a, a as c, l as i, i as l, m as n, s as o, y as r, o as s, S as t, n as u };
@@ -1,9 +1,7 @@
1
- import { t as e } from "./CFqytvUK.js";
2
- import { t } from "./DJNS7hc2.js";
3
- import { t as n } from "./CXMDq12B.js";
4
- import { i as r, n as i, t as a } from "./CR_-dzIp.js";
5
- import { t as o } from "./2sSTdNyC.js";
6
- //#region ../../libs/web-sdk/src/decoders/WebCodecsAudioDecoderContext.ts
1
+ import { P as e, i as t, n, r } from "./CnefSzun.js";
2
+ import { n as i, t as a } from "./DvtbAkGW.js";
3
+ import { l as o } from "./BeCY4GvT.js";
4
+ // ../../libs/web-sdk/src/decoders/WebCodecsAudioDecoderContext.ts
7
5
  var s, c = globalThis, l = (e) => {
8
6
  var t, n;
9
7
  if (!e) return {
@@ -23,11 +21,11 @@ var s, c = globalThis, l = (e) => {
23
21
  }, u = class {
24
22
  constructor(s) {
25
23
  var c = this;
26
- e(this, "decodedSamples", []), e(this, "decoder", null), e(this, "logger", void 0), e(this, "initSegments", /* @__PURE__ */ new Map()), e(this, "previousSample", void 0), e(this, "previousCodec", void 0), e(this, "pendingSamples", new t(Infinity)), e(this, "priming", { remaining: 0 }), e(this, "sentCount", 0), e(this, "doneCount", 0), e(this, "errors", new t(10)), e(this, "resetDecoderState", () => {
24
+ i(this, "decodedSamples", []), i(this, "decoder", null), i(this, "logger", void 0), i(this, "initSegments", /* @__PURE__ */ new Map()), i(this, "previousSample", void 0), i(this, "previousCodec", void 0), i(this, "pendingSamples", new e(Infinity)), i(this, "priming", { remaining: 0 }), i(this, "sentCount", 0), i(this, "doneCount", 0), i(this, "errors", new e(10)), i(this, "resetDecoderState", () => {
27
25
  this.pendingSamples.clear(), this.doneCount = this.sentCount, this.previousSample = void 0, this.previousCodec = void 0;
28
- }), e(this, "dropUndecoded", (e) => {
26
+ }), i(this, "dropUndecoded", (e) => {
29
27
  for (; this.doneCount < e && this.pendingSamples.pop();) this.doneCount++;
30
- }), e(this, "ensureDecoder", () => ((!this.decoder || this.decoder.state === "closed") && (this.decoder = this.createDecoder()), this.decoder)), e(this, "createDecoder", () => new AudioDecoder({
28
+ }), i(this, "ensureDecoder", () => (this.decoder && this.decoder.state !== "closed" || (this.decoder = this.createDecoder()), this.decoder)), i(this, "createDecoder", () => new AudioDecoder({
31
29
  output: (e) => {
32
30
  let t = this.pendingSamples.pop();
33
31
  if (!t) {
@@ -68,18 +66,18 @@ var s, c = globalThis, l = (e) => {
68
66
  error: (e) => {
69
67
  this.logger.error("Decoder error:", e.name, e.message), this.resetDecoderState(), this.errors.push(e);
70
68
  }
71
- })), e(this, "buildCodecString", a), e(this, "getDescription", (e, t) => {
72
- let n = this.initSegments.get(t.renditionId);
73
- if (n && n.data.byteLength > 0 && n.codec === e) return n.data;
74
- if (e === "opus") return i(t.channels, t.sampleRate);
75
- if (e === "aac") return r(t.channels, t.sampleRate);
76
- }), e(this, "reset", () => {
69
+ })), i(this, "buildCodecString", n), i(this, "getDescription", (e, n) => {
70
+ let i = this.initSegments.get(n.renditionId);
71
+ if (i && i.data.byteLength > 0 && i.codec === e) return i.data;
72
+ if (e === "opus") return r(n.channels, n.sampleRate);
73
+ if (e === "aac") return t(n.channels, n.sampleRate);
74
+ }), i(this, "reset", () => {
77
75
  this.decodedSamples = [], this.decoder && this.decoder.state !== "closed" && this.decoder.reset(), this.resetDecoderState();
78
- }), e(this, "unload", () => {
76
+ }), i(this, "unload", () => {
79
77
  this.reset(), this.decoder && this.decoder.state !== "closed" && this.decoder.close(), this.decoder = null;
80
- }), e(this, "initSegment", (e) => {
78
+ }), i(this, "initSegment", (e) => {
81
79
  this.initSegments.set(e.renditionId, e);
82
- }), e(this, "enqueue", (e) => {
80
+ }), i(this, "enqueue", (e) => {
83
81
  var t, n;
84
82
  let r = this.ensureDecoder(), i = e.codec, a = ((t = this.previousSample) == null ? void 0 : t.channelId) !== e.channelId, o = ((n = this.previousSample) == null ? void 0 : n.renditionId) !== e.renditionId, s = this.previousCodec !== i;
85
83
  if (!this.previousSample || a || o || s) {
@@ -132,18 +130,18 @@ var s, c = globalThis, l = (e) => {
132
130
  } catch (e) {
133
131
  this.logger.error("Failed to decode chunk:", e), this.pendingSamples.popLast(), this.sentCount--, r.state === "closed" && (this.resetDecoderState(), this.ensureDecoder());
134
132
  }
135
- }), e(this, "flush", n(function* () {
133
+ }), i(this, "flush", a(function* () {
136
134
  if (c.decoder && c.decoder.state === "configured") try {
137
135
  let e = c.sentCount;
138
136
  yield c.decoder.flush(), c.dropUndecoded(e);
139
137
  } catch (e) {
140
138
  c.logger.error("Failed to flush decoder:", e), c.resetDecoderState();
141
139
  }
142
- })), e(this, "error", () => this.errors.pop()), e(this, "take", () => this.decodedSamples.shift()), this.logger = s, this.decoder = this.createDecoder();
140
+ })), i(this, "error", () => this.errors.pop()), i(this, "take", () => this.decodedSamples.shift()), this.logger = s, this.decoder = this.createDecoder();
143
141
  }
144
142
  };
145
- s = u, e(u, "isSupported", () => c.AudioDecoder !== void 0), e(u, "create", function() {
146
- var e = n(function* (e) {
143
+ s = u, i(u, "isSupported", () => c.AudioDecoder !== void 0), i(u, "create", function() {
144
+ var e = a(function* (e) {
147
145
  if (!s.isSupported()) throw Error("WebCodecs AudioDecoder is not supported in this environment");
148
146
  return new s(e);
149
147
  });
@@ -151,5 +149,4 @@ s = u, e(u, "isSupported", () => c.AudioDecoder !== void 0), e(u, "create", func
151
149
  return e.apply(this, arguments);
152
150
  };
153
151
  }());
154
- //#endregion
155
152
  export { u as WebCodecsAudioDecoderContext };
package/Bz5OiWeK.js ADDED
@@ -0,0 +1,129 @@
1
+ import { n as e } from "./DvtbAkGW.js";
2
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/checkPrivateRedeclaration.js
3
+ function t(e, t) {
4
+ if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
5
+ }
6
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/classPrivateFieldInitSpec.js
7
+ function n(e, n, r) {
8
+ t(e, n), n.set(e, r);
9
+ }
10
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/assertClassBrand.js
11
+ function r(e, t, n) {
12
+ if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
13
+ throw TypeError("Private element is not present on this object");
14
+ }
15
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/classPrivateFieldSet2.js
16
+ function i(e, t, n) {
17
+ return e.set(r(e, t), n), n;
18
+ }
19
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/classPrivateFieldGet2.js
20
+ function a(e, t) {
21
+ return e.get(r(e, t));
22
+ }
23
+ // ../../libs/utils/src/Emitter.ts
24
+ var o = class {
25
+ constructor() {
26
+ e(this, "listeners", {});
27
+ }
28
+ handleListenerError(e, t) {
29
+ throw e;
30
+ }
31
+ emit(e, t) {
32
+ let n = this.listeners[e];
33
+ if (n) {
34
+ let r = !1;
35
+ for (let e = 0; e < n.length; e++) if (n[e].once) {
36
+ r = !0;
37
+ break;
38
+ }
39
+ r && (this.listeners[e] = n.filter((e) => !e.once));
40
+ let i, a = n.length;
41
+ for (let r = 0; r < a; r++) try {
42
+ let e = n[r].fn(t);
43
+ typeof e == "function" && (i || (i = []), i.push(e));
44
+ } catch (t) {
45
+ this.handleListenerError(t, e);
46
+ }
47
+ if (i) for (let t = 0; t < i.length; t++) try {
48
+ i[t]();
49
+ } catch (t) {
50
+ this.handleListenerError(t, e);
51
+ }
52
+ }
53
+ }
54
+ off(e, t) {
55
+ let n = this.listeners[e];
56
+ n && (this.listeners[e] = n.filter((e) => e.fn !== t));
57
+ }
58
+ on(e, t) {
59
+ this.add(e, t, !1);
60
+ }
61
+ once(e, t) {
62
+ this.add(e, t, !0);
63
+ }
64
+ hasListeners(e) {
65
+ let t = this.listeners[e];
66
+ return t !== void 0 && t.length > 0;
67
+ }
68
+ reset() {
69
+ this.listeners = {};
70
+ }
71
+ add(e, t, n) {
72
+ let r = this.listeners[e], i = {
73
+ fn: t,
74
+ once: n
75
+ };
76
+ r ? r.push(i) : this.listeners[e] = [i];
77
+ }
78
+ }, s = [
79
+ "off",
80
+ "error",
81
+ "warn",
82
+ "info",
83
+ "debug",
84
+ "trace"
85
+ ], c = {
86
+ ERROR: "error",
87
+ WARN: "warn",
88
+ INFO: "info",
89
+ DEBUG: "debug",
90
+ TRACE: "trace",
91
+ OFF: "off"
92
+ }, l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), p = class t {
93
+ constructor({ context: t, logLevel: r, debug: o }) {
94
+ n(this, l, /* @__PURE__ */ new Map()), n(this, u, ""), n(this, d, !1), n(this, f, "off"), e(this, "trace", (...e) => {}), e(this, "debug", (...e) => {}), e(this, "info", (...e) => {}), e(this, "warn", (...e) => {}), e(this, "error", (...e) => {}), e(this, "table", (...e) => {}), e(this, "count", (...e) => {}), i(u, this, t), i(f, this, r), i(d, this, o || !1), this.setLevel(r), this.setDebug(a(d, this));
95
+ }
96
+ setDebug(e) {
97
+ i(d, this, e);
98
+ for (let [t, n] of a(l, this)) n.setDebug(e);
99
+ e ? (this.table = console.table.bind(console), this.count = console.count.bind(console)) : (this.table = () => {}, this.count = () => {});
100
+ }
101
+ getLevel() {
102
+ return a(f, this);
103
+ }
104
+ setLevel(e) {
105
+ i(f, this, e);
106
+ for (let [t, n] of a(l, this)) n.setLevel(e);
107
+ let t = s.indexOf(e);
108
+ for (let [e, n] of s.entries()) n !== "off" && (this[n] = e <= t ? console[n].bind(console, "%c%s %c%s", "font-weight:bold;", n.toUpperCase(), "font-weight:normal;", a(u, this)) : () => {});
109
+ }
110
+ createContext(e) {
111
+ let n = a(l, this).get(e);
112
+ if (!n) {
113
+ let n = new t({
114
+ context: `${e}`,
115
+ logLevel: a(f, this),
116
+ debug: a(d, this)
117
+ });
118
+ return a(l, this).set(e, n), n;
119
+ }
120
+ return n;
121
+ }
122
+ static get() {
123
+ return m._ || (m._ = new t({
124
+ context: "Vindral",
125
+ logLevel: "off"
126
+ })), m._;
127
+ }
128
+ }, m = { _: void 0 };
129
+ export { i as a, t as c, a as i, p as n, r as o, o as r, n as s, c as t };