lizaui 9.0.45 → 9.0.46

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.
@@ -26,7 +26,7 @@ const jsxRuntime = require("react/jsx-runtime");
26
26
  const compilerRuntime = require("react/compiler-runtime");
27
27
  const React = require("react");
28
28
  const tailwindMerge = require("tailwind-merge");
29
- const tooltip = require("../chunks/tooltip-BT4TzSeu.js");
29
+ const tooltip = require("../chunks/tooltip-hhxclHkr.js");
30
30
  const loaderCircle = require("../chunks/loader-circle-DVLrRYRP.js");
31
31
  const uuid = require("uuid");
32
32
  const clsx = require("clsx");
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import React__default, { isValidElement, createContext, useContext, memo, forwardRef, useMemo, useState } from "react";
4
4
  import { twMerge } from "tailwind-merge";
5
- import { T as Tooltip } from "../chunks/tooltip-BVHPsFJx.js";
5
+ import { T as Tooltip } from "../chunks/tooltip-BVafMD5T.js";
6
6
  import { L as LoaderCircle } from "../chunks/loader-circle-CeKbzHTN.js";
7
7
  import { v4 } from "uuid";
8
8
  import clsx from "clsx";
@@ -168,16 +168,28 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
168
168
  changeToString(to, from, name);
169
169
  return to;
170
170
  }
171
+ const maxTimeoutValue = 2147483647;
171
172
  const cacheStore = /* @__PURE__ */ new WeakMap();
172
173
  const cacheTimerStore = /* @__PURE__ */ new WeakMap();
174
+ const cacheKeyStore = /* @__PURE__ */ new WeakMap();
175
+ function getValidCacheItem(cache, key) {
176
+ const item = cache.get(key);
177
+ if (!item) {
178
+ return void 0;
179
+ }
180
+ if (item.maxAge <= Date.now()) {
181
+ cache.delete(key);
182
+ return void 0;
183
+ }
184
+ return item;
185
+ }
173
186
  function memoize(function_, { cacheKey, cache = /* @__PURE__ */ new Map(), maxAge } = {}) {
174
187
  if (maxAge === 0) {
175
188
  return function_;
176
189
  }
177
- if (typeof maxAge === "number") {
178
- const maxSetIntervalValue = 2147483647;
179
- if (maxAge > maxSetIntervalValue) {
180
- throw new TypeError(`The \`maxAge\` option cannot exceed ${maxSetIntervalValue}.`);
190
+ if (typeof maxAge === "number" && Number.isFinite(maxAge)) {
191
+ if (maxAge > maxTimeoutValue) {
192
+ throw new TypeError(`The \`maxAge\` option cannot exceed ${maxTimeoutValue}.`);
181
193
  }
182
194
  if (maxAge < 0) {
183
195
  throw new TypeError("The `maxAge` option should not be a negative number.");
@@ -185,24 +197,36 @@ function memoize(function_, { cacheKey, cache = /* @__PURE__ */ new Map(), maxAg
185
197
  }
186
198
  const memoized = function(...arguments_) {
187
199
  const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
188
- const cacheItem = cache.get(key);
200
+ const cacheItem = getValidCacheItem(cache, key);
189
201
  if (cacheItem) {
190
202
  return cacheItem.data;
191
203
  }
192
204
  const result = function_.apply(this, arguments_);
193
205
  const computedMaxAge = typeof maxAge === "function" ? maxAge(...arguments_) : maxAge;
206
+ if (computedMaxAge !== void 0 && computedMaxAge !== Number.POSITIVE_INFINITY) {
207
+ if (!Number.isFinite(computedMaxAge)) {
208
+ throw new TypeError("The `maxAge` function must return a finite number, `0`, or `Infinity`.");
209
+ }
210
+ if (computedMaxAge <= 0) {
211
+ return result;
212
+ }
213
+ if (computedMaxAge > maxTimeoutValue) {
214
+ throw new TypeError(`The \`maxAge\` function result cannot exceed ${maxTimeoutValue}.`);
215
+ }
216
+ }
194
217
  cache.set(key, {
195
218
  data: result,
196
- maxAge: computedMaxAge ? Date.now() + computedMaxAge : Number.POSITIVE_INFINITY
219
+ maxAge: computedMaxAge === void 0 || computedMaxAge === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : Date.now() + computedMaxAge
197
220
  });
198
- if (computedMaxAge && computedMaxAge > 0 && computedMaxAge !== Number.POSITIVE_INFINITY) {
221
+ if (computedMaxAge !== void 0 && computedMaxAge !== Number.POSITIVE_INFINITY) {
199
222
  const timer = setTimeout(() => {
200
223
  cache.delete(key);
224
+ cacheTimerStore.get(memoized)?.delete(timer);
201
225
  }, computedMaxAge);
202
226
  timer.unref?.();
203
- const timers = cacheTimerStore.get(function_) ?? /* @__PURE__ */ new Set();
227
+ const timers = cacheTimerStore.get(memoized) ?? /* @__PURE__ */ new Set();
204
228
  timers.add(timer);
205
- cacheTimerStore.set(function_, timers);
229
+ cacheTimerStore.set(memoized, timers);
206
230
  }
207
231
  return result;
208
232
  };
@@ -210,6 +234,7 @@ function memoize(function_, { cacheKey, cache = /* @__PURE__ */ new Map(), maxAg
210
234
  ignoreNonConfigurable: true
211
235
  });
212
236
  cacheStore.set(memoized, cache);
237
+ cacheKeyStore.set(memoized, cacheKey ?? ((arguments_) => arguments_[0]));
213
238
  return memoized;
214
239
  }
215
240
  function isString(el) {