@vindral/web-sdk 4.8.2 → 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,18 +1,38 @@
1
- import { n as e, t } from "./BsfwXDui.js";
2
- import { t as n } from "./D1kpe8tT.js";
3
- //#region ../../libs/utils/src/assert.ts
4
- function r(e, t) {
1
+ import { n as e, t } from "./DvtbAkGW.js";
2
+ // ../../libs/utils/src/assert.ts
3
+ function n(e, t) {
5
4
  if (!e) throw Error(t);
6
5
  }
7
- //#endregion
8
- //#region ../../libs/utils/src/tryJsonParse.ts
9
- 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) => {
10
30
  try {
11
31
  return JSON.parse(e);
12
32
  } catch (e) {
13
33
  return;
14
34
  }
15
- }, a = (e) => {
35
+ }, o = (e) => {
16
36
  switch (e) {
17
37
  case "h264":
18
38
  case "h265":
@@ -24,7 +44,7 @@ var i = (e) => {
24
44
  default: throw Error("Unknown codec");
25
45
  }
26
46
  };
27
- function o(e) {
47
+ function s(e) {
28
48
  if (e.startsWith("opus")) return "opus";
29
49
  if (e.startsWith("mp4a")) return "aac";
30
50
  if (e.startsWith("avc1")) return "h264";
@@ -32,53 +52,51 @@ function o(e) {
32
52
  if (e.startsWith("av01")) return "av1";
33
53
  if (e.startsWith("webvtt")) return "webvtt";
34
54
  }
35
- //#endregion
36
- //#region ../../libs/data-types/src/ConnectInfo.ts
37
- function s(e) {
55
+ // ../../libs/data-types/src/ConnectInfo.ts
56
+ function c(e) {
38
57
  return !(typeof e.edges[0] == "string" || e.channels[0] && !("catalog" in e.channels[0]));
39
58
  }
40
- function c(e) {
41
- return e.tracks.filter((e) => !!e.codec).filter((e) => o(e.codec || "")).map((e, t) => {
42
- let n = e.codec, i = e.bitrate;
43
- r(n, "codec is required"), r(i !== void 0, "bitrate is required");
44
- let s = o(n);
45
- if (r(s, "codec is required"), a(s) === "audio") {
46
- 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;
47
66
  return {
48
67
  track: e,
49
68
  id: t,
50
- codec: s,
51
- codecString: n,
69
+ codec: a,
70
+ codecString: r,
52
71
  bitRate: i,
53
72
  channels: e.channelConfig === "stereo" ? 2 : 1,
54
- sampleRate: r,
73
+ sampleRate: n,
55
74
  language: e.language
56
75
  };
57
76
  }
58
- return a(s) === "text" ? {
77
+ return o(a) === "text" ? {
59
78
  track: e,
60
79
  id: t,
61
80
  bitRate: 0,
62
- codec: s,
81
+ codec: a,
63
82
  kind: "subtitles",
64
- codecString: n,
83
+ codecString: r,
65
84
  label: e.label,
66
85
  language: e.language
67
- } : (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"), {
68
87
  track: e,
69
88
  id: t,
70
- codec: s,
89
+ codec: a,
71
90
  bitRate: i,
72
- codecString: n,
91
+ codecString: r,
73
92
  width: e.width,
74
93
  height: e.height,
75
94
  frameRate: e.framerate
76
95
  });
77
96
  }).sort((e, t) => e.bitRate - t.bitRate);
78
97
  }
79
- //#endregion
80
- //#region ../../libs/api-client/src/auth.ts
81
- 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) => {
82
100
  try {
83
101
  let t = e.ancestorOrigins;
84
102
  if (t && t.length > 0) return Array.from(t).join(",") || void 0;
@@ -86,34 +104,34 @@ var l = (e) => e ? { Authorization: `Bearer ${e}` } : void 0, u = (e, t) => {
86
104
  try {
87
105
  if (t.referrer) return new URL(t.referrer).origin || void 0;
88
106
  } catch (e) {}
89
- }, 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 {
90
108
  constructor({ status: t, url: n, body: r }) {
91
- 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}`;
92
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);
93
111
  }
94
- }, p = (e) => typeof e.status == "number", m = () => {
95
- if (!(typeof window > "u" || typeof document > "u")) return u(window.location, document);
96
- }, h = (e) => {
97
- 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();
98
116
  if (!t || e.searchParams.has("parentOrigin")) return e;
99
117
  let n = new URL(e.toString());
100
118
  return n.searchParams.append("parentOrigin", t), n;
101
- }, g = function() {
119
+ }, _ = function() {
102
120
  var e = t(function* (e, t) {
103
- let r = h(e), i = yield fetch(r.toString(), n({ mode: "cors" }, t));
104
- if (!i.ok) throw new f({
105
- status: i.status,
106
- url: r,
107
- 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()
108
126
  });
109
- return i;
127
+ return r;
110
128
  });
111
129
  return function(t, n) {
112
130
  return e.apply(this, arguments);
113
131
  };
114
- }(), _ = function() {
132
+ }(), v = function() {
115
133
  var e = t(function* (e, t) {
116
- return yield (yield g(e, n({}, t))).json();
134
+ return yield (yield _(e, i({}, t))).json();
117
135
  });
118
136
  return function(t, n) {
119
137
  return e.apply(this, arguments);
@@ -121,74 +139,73 @@ var l = (e) => e ? { Authorization: `Bearer ${e}` } : void 0, u = (e, t) => {
121
139
  }();
122
140
  (function() {
123
141
  var e = t(function* (e) {
124
- return g(e);
142
+ return _(e);
125
143
  });
126
144
  return function(t) {
127
145
  return e.apply(this, arguments);
128
146
  };
129
147
  })();
130
- var v = function() {
148
+ var y = function() {
131
149
  var e = t(function* (e, t) {
132
- return g(e, n({ method: "POST" }, t));
150
+ return _(e, i({ method: "POST" }, t));
133
151
  });
134
152
  return function(t, n) {
135
153
  return e.apply(this, arguments);
136
154
  };
137
155
  }();
138
- //#endregion
139
- //#region ../../libs/api-client/src/responses/connect.ts
140
- function y(e) {
156
+ // ../../libs/api-client/src/responses/connect.ts
157
+ function b(e) {
141
158
  var t;
142
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);
143
160
  }
144
- //#endregion
145
- //#region ../../libs/api-client/src/client.ts
146
- var b = {
161
+ // ../../libs/api-client/src/client.ts
162
+ var x = {
147
163
  lbConnect: (e) => e.channelGroupId ? `connect?channelId=${e.channelId}&channelGroupId=${e.channelGroupId}` : `connect?channelId=${e.channelId}`,
148
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"
149
- }, x = class {
165
+ }, S = class {
150
166
  constructor(t) {
151
167
  e(this, "baseUrl", void 0), e(this, "tokenFactory", void 0), this.baseUrl = new URL("/api/v4/", t.publicEndpoint).toString(), this.tokenFactory = t.tokenFactory;
152
168
  }
153
169
  connect(e) {
154
- var r = this;
170
+ var n = this;
155
171
  return t(function* () {
156
- let { channelId: t, channelGroupId: i } = e, a = {
172
+ let { channelId: t, channelGroupId: r } = e, a = {
157
173
  channelId: t,
158
- channelGroupId: i
159
- }, o = new URL(b.lbConnect(e), r.baseUrl), s = r.getAuthToken(a), l = yield _(o, { headers: r.getHeaders(s) });
160
- if (y(l)) {
161
- let e = l.channels.map((e) => {
162
- let t = r.toChannel(e, a), i = c(e.catalog);
163
- 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 });
164
180
  });
165
- return n(n({}, l), {}, { channels: e });
166
- } else {
167
- let e = l.channels.map((e) => {
168
- let t = r.toChannel(e, a);
169
- 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);
170
187
  });
171
- return n(n({}, l), {}, { channels: e });
188
+ return i(i({}, c), {}, { channels: e });
172
189
  }
173
190
  })();
174
191
  }
175
192
  getChannel(e) {
176
193
  var n = this;
177
194
  return t(function* () {
178
- 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) });
179
196
  return n.toChannel(a, t, i);
180
197
  })();
181
198
  }
182
199
  getChannels(e) {
183
200
  var n = this;
184
201
  return t(function* () {
185
- 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;
186
203
  return n.toChannels(o, t, i);
187
204
  })();
188
205
  }
189
206
  getHeaders(e) {
190
207
  var t;
191
- return (t = l(e)) == null ? {} : t;
208
+ return (t = u(e)) == null ? {} : t;
192
209
  }
193
210
  getAuthToken(e) {
194
211
  return this.tokenFactory ? this.tokenFactory(e) : void 0;
@@ -197,7 +214,7 @@ var b = {
197
214
  return e.map((e) => this.toChannel(e, t, n));
198
215
  }
199
216
  toChannel(e, t, n) {
200
- 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());
201
218
  return {
202
219
  channelId: e.channelId,
203
220
  name: e.name,
@@ -205,6 +222,5 @@ var b = {
205
222
  thumbnailUrls: o
206
223
  };
207
224
  }
208
- }, S = (e, t) => t ? e.channelGroupId ? `&channelGroupId=${e.channelGroupId}&auth.token=${t}&auth.type=jwt` : `&auth.token=${t}&auth.type=jwt` : "";
209
- //#endregion
210
- 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,8 +1,7 @@
1
- import { n as e, t } from "./BsfwXDui.js";
2
- import { t as n } from "./DrWNJwZx.js";
3
- import { i as r, n as i, t as a } from "./BdMchGeH.js";
4
- import { t as o } from "./D1kpe8tT.js";
5
- //#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
6
5
  var s, c = globalThis, l = (e) => {
7
6
  var t, n;
8
7
  if (!e) return {
@@ -22,11 +21,11 @@ var s, c = globalThis, l = (e) => {
22
21
  }, u = class {
23
22
  constructor(s) {
24
23
  var c = this;
25
- 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 n(Infinity)), e(this, "priming", { remaining: 0 }), e(this, "sentCount", 0), e(this, "doneCount", 0), e(this, "errors", new n(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", () => {
26
25
  this.pendingSamples.clear(), this.doneCount = this.sentCount, this.previousSample = void 0, this.previousCodec = void 0;
27
- }), e(this, "dropUndecoded", (e) => {
26
+ }), i(this, "dropUndecoded", (e) => {
28
27
  for (; this.doneCount < e && this.pendingSamples.pop();) this.doneCount++;
29
- }), 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({
30
29
  output: (e) => {
31
30
  let t = this.pendingSamples.pop();
32
31
  if (!t) {
@@ -67,18 +66,18 @@ var s, c = globalThis, l = (e) => {
67
66
  error: (e) => {
68
67
  this.logger.error("Decoder error:", e.name, e.message), this.resetDecoderState(), this.errors.push(e);
69
68
  }
70
- })), e(this, "buildCodecString", a), e(this, "getDescription", (e, t) => {
71
- let n = this.initSegments.get(t.renditionId);
72
- if (n && n.data.byteLength > 0 && n.codec === e) return n.data;
73
- if (e === "opus") return i(t.channels, t.sampleRate);
74
- if (e === "aac") return r(t.channels, t.sampleRate);
75
- }), 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", () => {
76
75
  this.decodedSamples = [], this.decoder && this.decoder.state !== "closed" && this.decoder.reset(), this.resetDecoderState();
77
- }), e(this, "unload", () => {
76
+ }), i(this, "unload", () => {
78
77
  this.reset(), this.decoder && this.decoder.state !== "closed" && this.decoder.close(), this.decoder = null;
79
- }), e(this, "initSegment", (e) => {
78
+ }), i(this, "initSegment", (e) => {
80
79
  this.initSegments.set(e.renditionId, e);
81
- }), e(this, "enqueue", (e) => {
80
+ }), i(this, "enqueue", (e) => {
82
81
  var t, n;
83
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;
84
83
  if (!this.previousSample || a || o || s) {
@@ -131,18 +130,18 @@ var s, c = globalThis, l = (e) => {
131
130
  } catch (e) {
132
131
  this.logger.error("Failed to decode chunk:", e), this.pendingSamples.popLast(), this.sentCount--, r.state === "closed" && (this.resetDecoderState(), this.ensureDecoder());
133
132
  }
134
- }), e(this, "flush", t(function* () {
133
+ }), i(this, "flush", a(function* () {
135
134
  if (c.decoder && c.decoder.state === "configured") try {
136
135
  let e = c.sentCount;
137
136
  yield c.decoder.flush(), c.dropUndecoded(e);
138
137
  } catch (e) {
139
138
  c.logger.error("Failed to flush decoder:", e), c.resetDecoderState();
140
139
  }
141
- })), 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();
142
141
  }
143
142
  };
144
- s = u, e(u, "isSupported", () => c.AudioDecoder !== void 0), e(u, "create", function() {
145
- var e = t(function* (e) {
143
+ s = u, i(u, "isSupported", () => c.AudioDecoder !== void 0), i(u, "create", function() {
144
+ var e = a(function* (e) {
146
145
  if (!s.isSupported()) throw Error("WebCodecs AudioDecoder is not supported in this environment");
147
146
  return new s(e);
148
147
  });
@@ -150,5 +149,4 @@ s = u, e(u, "isSupported", () => c.AudioDecoder !== void 0), e(u, "create", func
150
149
  return e.apply(this, arguments);
151
150
  };
152
151
  }());
153
- //#endregion
154
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 };