@tixyel/streamelements 6.0.0 → 6.0.2

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
@@ -1874,7 +1874,7 @@ interface CommandOptions {
1874
1874
  run: (this: Client, args: string[], event: CommandEvent) => void;
1875
1875
  test?: string;
1876
1876
  aliases?: string[];
1877
- permissions?: string[];
1877
+ permissions?: string[] | boolean;
1878
1878
  admins?: string[];
1879
1879
  }
1880
1880
  type CommandEvent = {
@@ -1919,7 +1919,7 @@ type QueueProps = {
1919
1919
  type QueueItem<T> = {
1920
1920
  value: T;
1921
1921
  } & QueueProps;
1922
- type QueueProcessor<T> = (item: T, queue: useQueue<T>) => Promise<any>;
1922
+ type QueueProcessor<T> = (this: useQueue<T>, item: T, queue: useQueue<T>) => Promise<any>;
1923
1923
  type QueueDuration = number | boolean | undefined;
1924
1924
  interface QueueOptions<T> {
1925
1925
  /**
@@ -1939,7 +1939,7 @@ interface QueueOptions<T> {
1939
1939
  * ```javascript
1940
1940
  * const myQueue = new useQueue({
1941
1941
  * duration: 1000,
1942
- * processor: async (item) => {
1942
+ * processor: async function (item) {
1943
1943
  * console.log('Processing item:', item);
1944
1944
  * },
1945
1945
  * });
@@ -1958,12 +1958,59 @@ declare class useQueue<T> extends EventProvider<QueueEvents<T>> {
1958
1958
  private loaded;
1959
1959
  processor: QueueProcessor<T>;
1960
1960
  constructor(options: QueueOptions<T>);
1961
+ /**
1962
+ * Enqueue an item or multiple items into the queue with optional processing options.
1963
+ * @param value - The item or items to be enqueued. Can be a single value of type T or an array of objects containing the value and options.
1964
+ * @param options - Optional processing options for the item(s) being enqueued. Ignored if an array of items is provided, as each item can have its own options.
1965
+ * @returns The instance of the queue for chaining.
1966
+ * @example
1967
+ * ```javascript
1968
+ * myQueue.enqueue('Single Item', { isPriority: true });
1969
+ * myQueue.enqueue([
1970
+ * { value: 'Item 1', options: { isPriority: true } },
1971
+ * { value: 'Item 2', options: { isLoop: true } }
1972
+ * ]);
1973
+ * ```
1974
+ */
1961
1975
  enqueue(value: T, options?: Partial<QueueProps>): this;
1976
+ enqueue(items: {
1977
+ value: T;
1978
+ options?: Partial<QueueProps>;
1979
+ }[]): this;
1962
1980
  private run;
1963
1981
  private next;
1982
+ /**
1983
+ * Resume processing the queue if it is paused. If the queue is already running, it will be restarted, which can be useful if new items have been added or if you want to reset the processing timer.
1984
+ * If the queue was empty before, it will start processing immediately.
1985
+ * @returns - The instance of the queue for chaining.
1986
+ * @example
1987
+ * ```javascript
1988
+ * myQueue.resume();
1989
+ * ```
1990
+ */
1964
1991
  resume(): this;
1992
+ /**
1993
+ * Update the queue's state with new values. This can be used to replace the current queue, priority queue, history, or timeouts with new data. If the queue is not currently running and there are items in the queue after the update, it will start processing immediately.
1994
+ * @param save - An object containing the new state for the queue, priority queue, history, and timeouts. Each property is optional, and if not provided, the current state will be retained.
1995
+ * @returns - The instance of the queue for chaining.
1996
+ * @example
1997
+ * ```javascript
1998
+ * myQueue.update({
1999
+ * queue: newQueueItems,
2000
+ * priorityQueue: newPriorityItems,
2001
+ * history: newHistory,
2002
+ * });
2003
+ * ```
2004
+ */
1965
2005
  update(save: Partial<useQueue<T>>): this;
2006
+ /**
2007
+ * Cancel all pending timeouts and stop the queue from processing further items. This will clear any scheduled processing and prevent any new items from being processed until `resume()` is called again. The current state of the queue, priority queue, and history will be retained, allowing you to resume processing later without losing any data.
2008
+ */
1966
2009
  cancel(): void;
2010
+ /**
2011
+ * Check if there are any items in the queue or priority queue. This method returns `true` if there are items waiting to be processed in either the main queue or the priority queue, and `false` if both queues are empty.
2012
+ * @returns - A boolean indicating whether there are items in the queue or priority queue.
2013
+ */
1967
2014
  hasItems(): boolean;
1968
2015
  on<K extends keyof QueueEvents<T>>(eventName: K, callback: (this: useQueue<T>, ...args: QueueEvents<T>[K]) => void): this;
1969
2016
  }
package/dist/index.es.js CHANGED
@@ -2057,7 +2057,7 @@ const wt = [
2057
2057
  "Szabolcs",
2058
2058
  "Hoda",
2059
2059
  "Naayf"
2060
- ], It = [
2060
+ ], Tt = [
2061
2061
  {
2062
2062
  emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
2063
2063
  shortcuts: [":pride-flower-rainbow-heart:"],
@@ -5233,7 +5233,7 @@ const wt = [
5233
5233
  ];
5234
5234
  var D;
5235
5235
  ((h) => {
5236
- h.avatars = wt, h.badges = vt, h.css_color_names = lt, h.emotes = kt, h.items = Ct, h.messages = jt, h.names = xt, h.tiers = Ut, h.tts = Et, h.youtube_emotes = It;
5236
+ h.avatars = wt, h.badges = vt, h.css_color_names = lt, h.emotes = kt, h.items = Ct, h.messages = jt, h.names = xt, h.tiers = Ut, h.tts = Et, h.youtube_emotes = Tt;
5237
5237
  })(D || (D = {}));
5238
5238
  var y;
5239
5239
  ((h) => {
@@ -5618,8 +5618,8 @@ var y;
5618
5618
  function A(r, u) {
5619
5619
  const w = r?.trim?.() ?? "";
5620
5620
  if (!w.length) return null;
5621
- const x = u[w], I = parseFloat(String(x !== void 0 ? x : w).replace(/\s/g, ""));
5622
- return isNaN(I) ? null : I;
5621
+ const x = u[w], T = parseFloat(String(x !== void 0 ? x : w).replace(/\s/g, ""));
5622
+ return isNaN(T) ? null : T;
5623
5623
  }
5624
5624
  function J(r, u, w) {
5625
5625
  const x = isNaN(Number(u)) ? 0 : Math.max(0, parseInt(String(u))), N = A(r, w);
@@ -5634,45 +5634,45 @@ var y;
5634
5634
  }
5635
5635
  }
5636
5636
  function U(r, u = /* @__PURE__ */ new Date()) {
5637
- const w = u.getTime() - r.getTime(), x = w >= 0, N = Math.abs(w), I = Math.floor(N / 1e3), T = Math.floor(I / 60), M = Math.floor(T / 60), E = Math.floor(M / 24), H = Math.floor(E / 30), _ = Math.floor(E / 365), Y = x ? "ago" : "from now";
5638
- return _ > 0 ? `${_}y ${Y}` : H > 0 ? `${H}mo ${Y}` : E > 0 ? `${E}d ${Y}` : M > 0 ? `${M}h ${Y}` : T > 0 ? `${T}m ${Y}` : `${Math.max(I, 0)}s ${Y}`;
5637
+ const w = u.getTime() - r.getTime(), x = w >= 0, N = Math.abs(w), T = Math.floor(N / 1e3), I = Math.floor(T / 60), M = Math.floor(I / 60), E = Math.floor(M / 24), H = Math.floor(E / 30), _ = Math.floor(E / 365), Y = x ? "ago" : "from now";
5638
+ return _ > 0 ? `${_}y ${Y}` : H > 0 ? `${H}mo ${Y}` : E > 0 ? `${E}d ${Y}` : M > 0 ? `${M}h ${Y}` : I > 0 ? `${I}m ${Y}` : `${Math.max(T, 0)}s ${Y}`;
5639
5639
  }
5640
5640
  function S(r, u, w) {
5641
5641
  const x = r?.trim?.() ?? "";
5642
5642
  if (!x.length) return r;
5643
- const N = w[x] ?? x, I = new Date(N);
5644
- if (isNaN(I.getTime())) return r;
5645
- const T = (u ?? "date").toString().toLowerCase();
5643
+ const N = w[x] ?? x, T = new Date(N);
5644
+ if (isNaN(T.getTime())) return r;
5645
+ const I = (u ?? "date").toString().toLowerCase();
5646
5646
  try {
5647
- switch (T) {
5647
+ switch (I) {
5648
5648
  case "time":
5649
- return I.toLocaleTimeString();
5649
+ return T.toLocaleTimeString();
5650
5650
  case "datetime":
5651
5651
  case "full":
5652
- return I.toLocaleString();
5652
+ return T.toLocaleString();
5653
5653
  case "relative":
5654
5654
  case "ago":
5655
- return U(I);
5655
+ return U(T);
5656
5656
  case "iso":
5657
- return I.toISOString();
5657
+ return T.toISOString();
5658
5658
  default:
5659
- return I.toLocaleDateString();
5659
+ return T.toLocaleDateString();
5660
5660
  }
5661
5661
  } catch {
5662
5662
  return r;
5663
5663
  }
5664
5664
  }
5665
5665
  function L(r, u, w) {
5666
- const x = r ?? "", [N, I = N] = x.split("|", 2), T = u?.trim();
5666
+ const x = r ?? "", [N, T = N] = x.split("|", 2), I = u?.trim();
5667
5667
  let M;
5668
- T && w[T] !== void 0 ? M = w[T] : M = w.amount ?? w.count;
5668
+ I && w[I] !== void 0 ? M = w[I] : M = w.amount ?? w.count;
5669
5669
  const E = parseFloat(String(M));
5670
- return isNaN(E) ? N : Math.abs(E) !== 1 ? I : N;
5670
+ return isNaN(E) ? N : Math.abs(E) !== 1 ? T : N;
5671
5671
  }
5672
5672
  function O(r, u, w) {
5673
- const x = u?.trim() ?? "", N = x && w[x] !== void 0 ? w[x] : "", I = String(N), T = (r ?? "").split("|").map((E) => E.trim()).filter((E) => E.length);
5673
+ const x = u?.trim() ?? "", N = x && w[x] !== void 0 ? w[x] : "", T = String(N), I = (r ?? "").split("|").map((E) => E.trim()).filter((E) => E.length);
5674
5674
  let M;
5675
- for (const E of T) {
5675
+ for (const E of I) {
5676
5676
  const H = E.indexOf(":");
5677
5677
  if (H === -1) continue;
5678
5678
  const _ = E.slice(0, H).trim(), Y = E.slice(H + 1);
@@ -5681,7 +5681,7 @@ var y;
5681
5681
  M = Y;
5682
5682
  continue;
5683
5683
  }
5684
- if (I === _) return Y;
5684
+ if (T === _) return Y;
5685
5685
  }
5686
5686
  }
5687
5687
  return M ?? "";
@@ -5695,14 +5695,14 @@ var y;
5695
5695
  const x = w[0], N = w[w.length - 1];
5696
5696
  if (x === '"' && N === '"' || x === "'" && N === "'")
5697
5697
  return w.slice(1, -1);
5698
- const I = w.toLowerCase();
5699
- if (I === "true") return !0;
5700
- if (I === "false") return !1;
5698
+ const T = w.toLowerCase();
5699
+ if (T === "true") return !0;
5700
+ if (T === "false") return !1;
5701
5701
  if (/^-?\d+(\.\d+)?$/.test(w)) return parseFloat(w);
5702
- const T = u?.[w];
5703
- if (T === void 0) return w;
5704
- const M = String(T).trim(), E = M.toLowerCase();
5705
- return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(M) ? parseFloat(M) : T;
5702
+ const I = u?.[w];
5703
+ if (I === void 0) return w;
5704
+ const M = String(I).trim(), E = M.toLowerCase();
5705
+ return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(M) ? parseFloat(M) : I;
5706
5706
  }
5707
5707
  function W(r) {
5708
5708
  if (typeof r == "boolean") return r;
@@ -5717,18 +5717,18 @@ var y;
5717
5717
  for (; w.startsWith("!"); )
5718
5718
  x = !x, w = w.slice(1).trim();
5719
5719
  const N = ["===", "!==", "==", "!=", ">=", "<=", ">", "<"];
5720
- let I = null, T = w, M = "";
5720
+ let T = null, I = w, M = "";
5721
5721
  for (const H of N) {
5722
5722
  const _ = w.indexOf(H);
5723
5723
  if (_ !== -1) {
5724
- I = H, T = w.slice(0, _), M = w.slice(_ + H.length);
5724
+ T = H, I = w.slice(0, _), M = w.slice(_ + H.length);
5725
5725
  break;
5726
5726
  }
5727
5727
  }
5728
5728
  let E;
5729
- if (I) {
5730
- const H = V(T, u), _ = V(M, u);
5731
- switch (I) {
5729
+ if (T) {
5730
+ const H = V(I, u), _ = V(M, u);
5731
+ switch (T) {
5732
5732
  case "===":
5733
5733
  E = H === _;
5734
5734
  break;
@@ -5758,7 +5758,7 @@ var y;
5758
5758
  break;
5759
5759
  }
5760
5760
  } else {
5761
- const H = V(T, u);
5761
+ const H = V(I, u);
5762
5762
  E = W(H);
5763
5763
  }
5764
5764
  return x ? !E : E;
@@ -5769,20 +5769,20 @@ var y;
5769
5769
  let x = !1;
5770
5770
  for (; w.startsWith("!"); )
5771
5771
  x = !x, w = w.slice(1).trim();
5772
- const N = w.split("||").map((T) => T.trim()).filter((T) => T.length);
5772
+ const N = w.split("||").map((I) => I.trim()).filter((I) => I.length);
5773
5773
  if (!N.length) return !!x;
5774
- let I = !1;
5775
- for (const T of N) {
5776
- const M = T.split("&&").map((H) => H.trim()).filter((H) => H.length);
5774
+ let T = !1;
5775
+ for (const I of N) {
5776
+ const M = I.split("&&").map((H) => H.trim()).filter((H) => H.length);
5777
5777
  if (!M.length) continue;
5778
5778
  let E = !0;
5779
5779
  for (const H of M) {
5780
5780
  const _ = F(H, u);
5781
5781
  if (E = E && _, !E) break;
5782
5782
  }
5783
- if (I = I || E, I) break;
5783
+ if (T = T || E, T) break;
5784
5784
  }
5785
- return x ? !I : I;
5785
+ return x ? !T : T;
5786
5786
  }
5787
5787
  const at = {
5788
5788
  COLOR: (r, u) => l(u && i.validate(u) ? `color: ${u}` : "", r, "color"),
@@ -5817,24 +5817,24 @@ var y;
5817
5817
  MAP: (r, u, w) => O(r, u, w),
5818
5818
  ESCAPE: (r) => z(r),
5819
5819
  IF: (r, u, w) => {
5820
- const x = r ?? "", [N, I] = x.split("?", 2);
5821
- if (!I) return x;
5822
- const [T, M = ""] = I.split("|", 2);
5823
- return B(N, w) ? T : M;
5820
+ const x = r ?? "", [N, T] = x.split("?", 2);
5821
+ if (!T) return x;
5822
+ const [I, M = ""] = T.split("|", 2);
5823
+ return B(N, w) ? I : M;
5824
5824
  },
5825
5825
  PRESET: (r, u) => {
5826
5826
  const w = u?.trim() ?? "";
5827
5827
  if (!w.length) return r;
5828
5828
  const x = n.PRESETS[w];
5829
5829
  if (!x || !x.length) return r;
5830
- const N = x.split(",").map((T) => T.trim()).filter((T) => T.length).map((T) => {
5831
- const [M, E] = T.split(":");
5830
+ const N = x.split(",").map((I) => I.trim()).filter((I) => I.length).map((I) => {
5831
+ const [M, E] = I.split(":");
5832
5832
  return { name: M.trim(), param: E?.trim() ?? null };
5833
5833
  });
5834
- let I = r;
5835
- for (const { name: T, param: M } of N)
5836
- I = K(I, T, M);
5837
- return I;
5834
+ let T = r;
5835
+ for (const { name: I, param: M } of N)
5836
+ T = K(T, I, M);
5837
+ return T;
5838
5838
  },
5839
5839
  FALLBACK: (r, u) => r.length ? r : u ?? r
5840
5840
  },
@@ -5871,22 +5871,22 @@ var y;
5871
5871
  ...d.aliases ?? {}
5872
5872
  };
5873
5873
  function K(r, u, w) {
5874
- const x = Object.entries(ct).find(([I, T]) => T.some((M) => M.toUpperCase() === u.toUpperCase()) ? !0 : I.toUpperCase() === u.toUpperCase()), N = x ? x[0] : u.toUpperCase();
5874
+ const x = Object.entries(ct).find(([T, I]) => I.some((M) => M.toUpperCase() === u.toUpperCase()) ? !0 : T.toUpperCase() === u.toUpperCase()), N = x ? x[0] : u.toUpperCase();
5875
5875
  try {
5876
5876
  return ot[N] ? ot[N](r, typeof w == "string" ? w.trim() : null, k) : d?.html ? l("", r, N.toLowerCase()) : r;
5877
- } catch (I) {
5878
- return d?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: u, param: w, error: I }), r;
5877
+ } catch (T) {
5878
+ return d?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: u, param: w, error: T }), r;
5879
5879
  }
5880
5880
  }
5881
5881
  function st(r) {
5882
5882
  let u = r, w;
5883
5883
  for (; (w = j.MODIFIERS.exec(u)) !== null; ) {
5884
- const [x, N, I] = w, T = N.split(",").map((E) => E.trim()).filter((E) => E.length).map((E) => {
5884
+ const [x, N, T] = w, I = N.split(",").map((E) => E.trim()).filter((E) => E.length).map((E) => {
5885
5885
  const [H, _] = E.split(":");
5886
5886
  return { name: H.trim(), param: _?.trim() ?? null };
5887
5887
  });
5888
- let M = st(I);
5889
- for (const { name: E, param: H } of T)
5888
+ let M = st(T);
5889
+ for (const { name: E, param: H } of I)
5890
5890
  M = K(M, E, H);
5891
5891
  u = u.replace(x, M ?? ""), j.MODIFIERS.lastIndex = 0;
5892
5892
  }
@@ -5895,23 +5895,23 @@ var y;
5895
5895
  function X(r) {
5896
5896
  let u = 0;
5897
5897
  const w = r.length;
5898
- function x(I) {
5899
- let T = "";
5898
+ function x(T) {
5899
+ let I = "";
5900
5900
  for (; u < w; )
5901
5901
  if (r[u] === "\\")
5902
- u + 1 < w ? (T += r[u + 1], u += 2) : u++;
5903
- else if (r[u] === "[" && (!I || I !== "["))
5904
- T += N();
5905
- else if (I && r[u] === I) {
5902
+ u + 1 < w ? (I += r[u + 1], u += 2) : u++;
5903
+ else if (r[u] === "[" && (!T || T !== "["))
5904
+ I += N();
5905
+ else if (T && r[u] === T) {
5906
5906
  u++;
5907
5907
  break;
5908
5908
  } else
5909
- T += r[u++];
5910
- return T;
5909
+ I += r[u++];
5910
+ return I;
5911
5911
  }
5912
5912
  function N() {
5913
5913
  u++;
5914
- const I = [];
5914
+ const T = [];
5915
5915
  for (; u < w && r[u] !== "="; ) {
5916
5916
  if (r[u] === ",") {
5917
5917
  u++;
@@ -5926,11 +5926,11 @@ var y;
5926
5926
  for (; u < w && r[u] !== "," && r[u] !== "="; ) u++;
5927
5927
  E = r.slice(H, u);
5928
5928
  }
5929
- M.length && I.push({ name: M, param: E }), r[u] === "," && u++;
5929
+ M.length && T.push({ name: M, param: E }), r[u] === "," && u++;
5930
5930
  }
5931
5931
  r[u] === "=" && u++;
5932
- const T = x("]");
5933
- return I.reduce((M, { name: E, param: H }) => K(M, E, H), T);
5932
+ const I = x("]");
5933
+ return T.reduce((M, { name: E, param: H }) => K(M, E, H), I);
5934
5934
  }
5935
5935
  return x();
5936
5936
  }
@@ -6090,7 +6090,7 @@ var y;
6090
6090
  })(y || (y = {}));
6091
6091
  class it {
6092
6092
  constructor(e) {
6093
- this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof G && (this.field = e.field ?? this.field, this.template = e.template ?? this.template, this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
6093
+ this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof G && (this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
6094
6094
  }
6095
6095
  generate(e) {
6096
6096
  return y.utils.typedValues(e).reduce(
@@ -7180,14 +7180,18 @@ class mt extends Z {
7180
7180
  });
7181
7181
  }
7182
7182
  enqueue(e, t = {}) {
7183
- const a = {
7184
- isoDate: (/* @__PURE__ */ new Date()).toISOString(),
7185
- isLoop: t?.isLoop ?? !1,
7186
- isPriority: t?.isPriority ?? !1,
7187
- isImmediate: t?.isImmediate ?? !1,
7188
- value: e
7189
- }, i = this.hasItems();
7190
- return a.isPriority && a.isImmediate ? (this.cancel(), this.priorityQueue.unshift(a)) : (a.isPriority ? this.priorityQueue : this.queue).push(a), this.running === !1 && i === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
7183
+ const a = this.hasItems(), i = Array.isArray(e) ? e.map((s) => ({ value: s.value, options: s.options ?? {} })) : [{ value: e, options: t }];
7184
+ for (const s of i) {
7185
+ const n = {
7186
+ isoDate: (/* @__PURE__ */ new Date()).toISOString(),
7187
+ isLoop: s.options?.isLoop ?? !1,
7188
+ isPriority: s.options?.isPriority ?? !1,
7189
+ isImmediate: s.options?.isImmediate ?? !1,
7190
+ value: s.value
7191
+ };
7192
+ n.isPriority && n.isImmediate ? (this.cancel(), this.priorityQueue.unshift(n)) : (n.isPriority ? this.priorityQueue : this.queue).push(n);
7193
+ }
7194
+ return this.running === !1 && a === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
7191
7195
  }
7192
7196
  async run() {
7193
7197
  if (!this.hasItems()) {
@@ -7211,15 +7215,44 @@ class mt extends Z {
7211
7215
  const t = e.isPriority ? this.priorityQueue : this.queue;
7212
7216
  e.isLoop && t.push(e);
7213
7217
  }
7218
+ /**
7219
+ * Resume processing the queue if it is paused. If the queue is already running, it will be restarted, which can be useful if new items have been added or if you want to reset the processing timer.
7220
+ * If the queue was empty before, it will start processing immediately.
7221
+ * @returns - The instance of the queue for chaining.
7222
+ * @example
7223
+ * ```javascript
7224
+ * myQueue.resume();
7225
+ * ```
7226
+ */
7214
7227
  resume() {
7215
7228
  return this.running && this.cancel(), this.hasItems() && this.run(), this;
7216
7229
  }
7230
+ /**
7231
+ * Update the queue's state with new values. This can be used to replace the current queue, priority queue, history, or timeouts with new data. If the queue is not currently running and there are items in the queue after the update, it will start processing immediately.
7232
+ * @param save - An object containing the new state for the queue, priority queue, history, and timeouts. Each property is optional, and if not provided, the current state will be retained.
7233
+ * @returns - The instance of the queue for chaining.
7234
+ * @example
7235
+ * ```javascript
7236
+ * myQueue.update({
7237
+ * queue: newQueueItems,
7238
+ * priorityQueue: newPriorityItems,
7239
+ * history: newHistory,
7240
+ * });
7241
+ * ```
7242
+ */
7217
7243
  update(e) {
7218
7244
  return this.queue = e.queue ?? this.queue, this.priorityQueue = e.priorityQueue ?? this.priorityQueue, this.history = e.history ?? this.history, this.hasItems() && this.running === !1 && window.client?.on("load", () => this.run()), this;
7219
7245
  }
7246
+ /**
7247
+ * Cancel all pending timeouts and stop the queue from processing further items. This will clear any scheduled processing and prevent any new items from being processed until `resume()` is called again. The current state of the queue, priority queue, and history will be retained, allowing you to resume processing later without losing any data.
7248
+ */
7220
7249
  cancel() {
7221
7250
  this.running && (this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts = [], this.running = !1, this.emit("cancel"));
7222
7251
  }
7252
+ /**
7253
+ * Check if there are any items in the queue or priority queue. This method returns `true` if there are items waiting to be processed in either the main queue or the priority queue, and `false` if both queues are empty.
7254
+ * @returns - A boolean indicating whether there are items in the queue or priority queue.
7255
+ */
7223
7256
  hasItems() {
7224
7257
  return this.queue.length > 0 || this.priorityQueue.length > 0;
7225
7258
  }
@@ -7449,7 +7482,7 @@ const nt = {
7449
7482
  list: {}
7450
7483
  }
7451
7484
  };
7452
- async function Tt() {
7485
+ async function It() {
7453
7486
  let h = localStorage.getItem("SE_API-STORE") ?? "", e = h ? JSON.parse(h) : {};
7454
7487
  return nt.store.list = e, nt;
7455
7488
  }
@@ -7748,7 +7781,7 @@ class ut {
7748
7781
  !this.enabled || !console.timeEnd || console.timeEnd(e);
7749
7782
  }
7750
7783
  }
7751
- const gt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(Tt()), R = new ut(), ht = {
7784
+ const gt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(It()), R = new ut(), ht = {
7752
7785
  SeAPI: gt,
7753
7786
  Client: G,
7754
7787
  Helper: y,