@tixyel/streamelements 6.4.2 → 6.4.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.
package/dist/index.d.ts CHANGED
@@ -2964,7 +2964,7 @@ declare const main: {
2964
2964
  declare global {
2965
2965
  interface Window {
2966
2966
  Tixyel: typeof main;
2967
- client: InstanceType<typeof main.Client>;
2967
+ client: InstanceType<typeof main.Client> | undefined;
2968
2968
  ComfyJS?: ComfyJSInstance;
2969
2969
  }
2970
2970
  interface WindowEventMap {
package/dist/index.es.js CHANGED
@@ -158,7 +158,9 @@ class Z {
158
158
  run(e, t) {
159
159
  }
160
160
  verify(e, t, a) {
161
- return this.arguments === !0 && (!a || !a.length) ? !1 : !!(this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) || this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length || Array.isArray(this.permissions) && (this.permissions.some((i) => e.toLowerCase() === i.toLowerCase() || t.map((s) => s.toLowerCase()).includes(i.toLowerCase())) || this.permissions.includes("*")));
161
+ return this.arguments === !0 && (!a || !a.length) ? !1 : !!(this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) || this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length || Array.isArray(this.permissions) && (this.permissions.some(
162
+ (i) => e.toLowerCase() === i.toLowerCase() || t.map((s) => s.toLowerCase()).includes(i.toLowerCase())
163
+ ) || this.permissions.includes("*")));
162
164
  }
163
165
  parse(e, t) {
164
166
  if (!(window.client instanceof q)) return !1;
@@ -203,7 +205,10 @@ class Z {
203
205
  });
204
206
  if (a.length && a.every((i) => i instanceof Z))
205
207
  return a.forEach((i) => {
206
- i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"), N.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
208
+ i.parse(t.event.data.text, e), window?.client?.emit("action", i, "executed"), N.received(
209
+ `Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`,
210
+ t
211
+ );
207
212
  }), !0;
208
213
  }
209
214
  } catch {
@@ -6196,18 +6201,27 @@ class at {
6196
6201
  type: "button",
6197
6202
  label: m
6198
6203
  };
6199
- let c = w.string.compose(String(this.value), { index: s, ...i }, { html: !1 });
6204
+ let c = w.string.compose(
6205
+ String(this.value),
6206
+ { index: s, ...i },
6207
+ { html: !1 }
6208
+ );
6200
6209
  return isNaN(Number(c)) ? c.toLowerCase() === "true" ? c = !0 : c.toLowerCase() === "false" && (c = !1) : c = Number(c), typeof c < "u" && c && (typeof c != "string" || c.length) && (a[n].value = c), a;
6201
6210
  },
6202
6211
  {}
6203
6212
  );
6204
6213
  }
6205
6214
  parse(e, t) {
6206
- var a = e.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
6215
+ var a = e.replace(
6216
+ typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "",
6217
+ ""
6218
+ ).trim();
6207
6219
  try {
6208
6220
  this.run.apply(window.client, [a.length ? a : e ?? e, t]);
6209
6221
  } catch (i) {
6210
- throw new Error(`Error running button "${this.field}": ${i instanceof Error ? i.message : i}`);
6222
+ throw new Error(
6223
+ `Error running button "${this.field}": ${i instanceof Error ? i.message : i}`
6224
+ );
6211
6225
  }
6212
6226
  return this;
6213
6227
  }
@@ -6224,9 +6238,11 @@ class at {
6224
6238
  if (a.length && a.every((i) => i instanceof at))
6225
6239
  return a.forEach((i) => {
6226
6240
  try {
6227
- i.parse(e, t), window.client.emit("action", i, "executed"), N.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
6241
+ i.parse(e, t), window?.client?.emit("action", i, "executed"), N.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
6228
6242
  } catch (s) {
6229
- N.error(`Error executing button "${e}": ${s instanceof Error ? s.message : s}`);
6243
+ N.error(
6244
+ `Error executing button "${e}": ${s instanceof Error ? s.message : s}`
6245
+ );
6230
6246
  }
6231
6247
  }), !0;
6232
6248
  }
@@ -6493,7 +6509,7 @@ class gt extends X {
6493
6509
  return;
6494
6510
  }
6495
6511
  window.client.on("load", () => {
6496
- e === "client" && (this.duration = window.client.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
6512
+ e === "client" && (this.duration = window?.client?.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
6497
6513
  });
6498
6514
  }
6499
6515
  enqueue(e, t = {}) {
@@ -6584,9 +6600,9 @@ var G;
6584
6600
  l.queue = new gt({
6585
6601
  duration: "client",
6586
6602
  processor: async function(a) {
6587
- if (window.dispatchEvent(new CustomEvent(a.listener, { detail: a.data })), a.listener === "onEventReceived" && a.session && client instanceof q && window?.client && window?.client?.session) {
6603
+ if (window.dispatchEvent(new CustomEvent(a.listener, { detail: a.data })), a.listener === "onEventReceived" && a.session) {
6588
6604
  const i = await l.generate.event.onSessionUpdate(
6589
- window?.client?.session,
6605
+ window?.client && window?.client instanceof q ? window.client.session : void 0,
6590
6606
  w.event.parseProvider(a.data)
6591
6607
  );
6592
6608
  window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: i }));