UNPKG

react-redux-music

Version:

manage media control, playlist and custom player with wavesurfer.js

1,416 lines (1,414 loc) 272 kB
import * as Be from "react"; import xi, { useRef as _i, useEffect as gn, PureComponent as $y, memo as Uy, useMemo as fr, useState as pi } from "react"; var si = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Rc(o) { return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o; } var ui = { exports: {} }, ir = {}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ec; function zy() { if (ec) return ir; ec = 1; var o = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment"); function r(u, c, d) { var h = null; if (d !== void 0 && (h = "" + d), c.key !== void 0 && (h = "" + c.key), "key" in c) { d = {}; for (var g in c) g !== "key" && (d[g] = c[g]); } else d = c; return c = d.ref, { $$typeof: o, type: u, key: h, ref: c !== void 0 ? c : null, props: d }; } return ir.Fragment = i, ir.jsx = r, ir.jsxs = r, ir; } var or = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var tc; function Vy() { return tc || (tc = 1, process.env.NODE_ENV !== "production" && function() { function o(y) { if (y == null) return null; if (typeof y == "function") return y.$$typeof === kt ? null : y.displayName || y.name || null; if (typeof y == "string") return y; switch (y) { case $: return "Fragment"; case I: return "Portal"; case ne: return "Profiler"; case K: return "StrictMode"; case Mt: return "Suspense"; case Bn: return "SuspenseList"; } if (typeof y == "object") switch (typeof y.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), y.$$typeof) { case Ie: return (y.displayName || "Context") + ".Provider"; case ce: return (y._context.displayName || "Context") + ".Consumer"; case pt: var F = y.render; return y = y.displayName, y || (y = F.displayName || F.name || "", y = y !== "" ? "ForwardRef(" + y + ")" : "ForwardRef"), y; case bn: return F = y.displayName || null, F !== null ? F : o(y.type) || "Memo"; case Fn: F = y._payload, y = y._init; try { return o(y(F)); } catch { } } return null; } function i(y) { return "" + y; } function r(y) { try { i(y); var F = !1; } catch { F = !0; } if (F) { F = console; var U = F.error, oe = typeof Symbol == "function" && Symbol.toStringTag && y[Symbol.toStringTag] || y.constructor.name || "Object"; return U.call( F, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", oe ), i(y); } } function u() { } function c() { if (tn === 0) { bt = console.log, nn = console.info, gr = console.warn, Lt = console.error, Wt = console.group, vr = console.groupCollapsed, rn = console.groupEnd; var y = { configurable: !0, enumerable: !0, value: u, writable: !0 }; Object.defineProperties(console, { info: y, log: y, warn: y, error: y, group: y, groupCollapsed: y, groupEnd: y }); } tn++; } function d() { if (tn--, tn === 0) { var y = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: xe({}, y, { value: bt }), info: xe({}, y, { value: nn }), warn: xe({}, y, { value: gr }), error: xe({}, y, { value: Lt }), group: xe({}, y, { value: Wt }), groupCollapsed: xe({}, y, { value: vr }), groupEnd: xe({}, y, { value: rn }) }); } 0 > tn && console.error( "disabledDepth fell below zero. This is a bug in React. Please file an issue." ); } function h(y) { if (Bt === void 0) try { throw Error(); } catch (U) { var F = U.stack.trim().match(/\n( *(at )?)/); Bt = F && F[1] || "", Un = -1 < U.stack.indexOf(` at`) ? " (<anonymous>)" : -1 < U.stack.indexOf("@") ? "@unknown:0:0" : ""; } return ` ` + Bt + y + Un; } function g(y, F) { if (!y || Me) return ""; var U = wt.get(y); if (U !== void 0) return U; Me = !0, U = Error.prepareStackTrace, Error.prepareStackTrace = void 0; var oe = null; oe = mt.H, mt.H = null, c(); try { var ye = { DetermineComponentFrameRoot: function() { try { if (F) { var et = function() { throw Error(); }; if (Object.defineProperty(et.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(et, []); } catch (He) { var $t = He; } Reflect.construct(y, [], et); } else { try { et.call(); } catch (He) { $t = He; } y.call(et.prototype); } } else { try { throw Error(); } catch (He) { $t = He; } (et = y()) && typeof et.catch == "function" && et.catch(function() { }); } } catch (He) { if (He && $t && typeof He.stack == "string") return [He.stack, $t.stack]; } return [null, null]; } }; ye.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; var de = Object.getOwnPropertyDescriptor( ye.DetermineComponentFrameRoot, "name" ); de && de.configurable && Object.defineProperty( ye.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" } ); var Y = ye.DetermineComponentFrameRoot(), Re = Y[0], gt = Y[1]; if (Re && gt) { var we = Re.split(` `), ct = gt.split(` `); for (Y = de = 0; de < we.length && !we[de].includes( "DetermineComponentFrameRoot" ); ) de++; for (; Y < ct.length && !ct[Y].includes( "DetermineComponentFrameRoot" ); ) Y++; if (de === we.length || Y === ct.length) for (de = we.length - 1, Y = ct.length - 1; 1 <= de && 0 <= Y && we[de] !== ct[Y]; ) Y--; for (; 1 <= de && 0 <= Y; de--, Y--) if (we[de] !== ct[Y]) { if (de !== 1 || Y !== 1) do if (de--, Y--, 0 > Y || we[de] !== ct[Y]) { var Et = ` ` + we[de].replace( " at new ", " at " ); return y.displayName && Et.includes("<anonymous>") && (Et = Et.replace("<anonymous>", y.displayName)), typeof y == "function" && wt.set(y, Et), Et; } while (1 <= de && 0 <= Y); break; } } } finally { Me = !1, mt.H = oe, d(), Error.prepareStackTrace = U; } return we = (we = y ? y.displayName || y.name : "") ? h(we) : "", typeof y == "function" && wt.set(y, we), we; } function m(y) { if (y == null) return ""; if (typeof y == "function") { var F = y.prototype; return g( y, !(!F || !F.isReactComponent) ); } if (typeof y == "string") return h(y); switch (y) { case Mt: return h("Suspense"); case Bn: return h("SuspenseList"); } if (typeof y == "object") switch (y.$$typeof) { case pt: return y = g(y.render, !1), y; case bn: return m(y.type); case Fn: F = y._payload, y = y._init; try { return m(y(F)); } catch { } } return ""; } function b() { var y = mt.A; return y === null ? null : y.getOwner(); } function _(y) { if (en.call(y, "key")) { var F = Object.getOwnPropertyDescriptor(y, "key").get; if (F && F.isReactWarning) return !1; } return y.key !== void 0; } function S(y, F) { function U() { Qe || (Qe = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", F )); } U.isReactWarning = !0, Object.defineProperty(y, "key", { get: U, configurable: !0 }); } function O() { var y = o(this.type); return zn[y] || (zn[y] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), y = this.props.ref, y !== void 0 ? y : null; } function P(y, F, U, oe, ye, de) { return U = de.ref, y = { $$typeof: M, type: y, key: F, props: de, _owner: ye }, (U !== void 0 ? U : null) !== null ? Object.defineProperty(y, "ref", { enumerable: !1, get: O }) : Object.defineProperty(y, "ref", { enumerable: !1, value: null }), y._store = {}, Object.defineProperty(y._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(y, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y; } function D(y, F, U, oe, ye, de) { if (typeof y == "string" || typeof y == "function" || y === $ || y === ne || y === K || y === Mt || y === Bn || y === Ri || typeof y == "object" && y !== null && (y.$$typeof === Fn || y.$$typeof === bn || y.$$typeof === Ie || y.$$typeof === ce || y.$$typeof === pt || y.$$typeof === Ni || y.getModuleId !== void 0)) { var Y = F.children; if (Y !== void 0) if (oe) if ($n(Y)) { for (oe = 0; oe < Y.length; oe++) V(Y[oe], y); Object.freeze && Object.freeze(Y); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else V(Y, y); } else Y = "", (y === void 0 || typeof y == "object" && y !== null && Object.keys(y).length === 0) && (Y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), y === null ? oe = "null" : $n(y) ? oe = "array" : y !== void 0 && y.$$typeof === M ? (oe = "<" + (o(y.type) || "Unknown") + " />", Y = " Did you accidentally export a JSX literal instead of a component?") : oe = typeof y, console.error( "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", oe, Y ); if (en.call(F, "key")) { Y = o(y); var Re = Object.keys(F).filter(function(we) { return we !== "key"; }); oe = 0 < Re.length ? "{key: someKey, " + Re.join(": ..., ") + ": ...}" : "{key: someKey}", yr[Y + oe] || (Re = 0 < Re.length ? "{" + Re.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, oe, Y, Re, Y ), yr[Y + oe] = !0); } if (Y = null, U !== void 0 && (r(U), Y = "" + U), _(F) && (r(F.key), Y = "" + F.key), "key" in F) { U = {}; for (var gt in F) gt !== "key" && (U[gt] = F[gt]); } else U = F; return Y && S( U, typeof y == "function" ? y.displayName || y.name || "Unknown" : y ), P(y, Y, de, ye, b(), U); } function V(y, F) { if (typeof y == "object" && y && y.$$typeof !== Di) { if ($n(y)) for (var U = 0; U < y.length; U++) { var oe = y[U]; N(oe) && L(oe, F); } else if (N(y)) y._store && (y._store.validated = 1); else if (y === null || typeof y != "object" ? U = null : (U = Qt && y[Qt] || y["@@iterator"], U = typeof U == "function" ? U : null), typeof U == "function" && U !== y.entries && (U = U.call(y), U !== y)) for (; !(y = U.next()).done; ) N(y.value) && L(y.value, F); } } function N(y) { return typeof y == "object" && y !== null && y.$$typeof === M; } function L(y, F) { if (y._store && !y._store.validated && y.key == null && (y._store.validated = 1, F = H(F), !Ft[F])) { Ft[F] = !0; var U = ""; y && y._owner != null && y._owner !== b() && (U = null, typeof y._owner.tag == "number" ? U = o(y._owner.type) : typeof y._owner.name == "string" && (U = y._owner.name), U = " It was passed a child from " + U + "."); var oe = mt.getCurrentStack; mt.getCurrentStack = function() { var ye = m(y.type); return oe && (ye += oe() || ""), ye; }, console.error( 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.', F, U ), mt.getCurrentStack = oe; } } function H(y) { var F = "", U = b(); return U && (U = o(U.type)) && (F = ` Check the render method of \`` + U + "`."), F || (y = o(y)) && (F = ` Check the top-level render call using <` + y + ">."), F; } var W = xi, M = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), $ = Symbol.for("react.fragment"), K = Symbol.for("react.strict_mode"), ne = Symbol.for("react.profiler"), ce = Symbol.for("react.consumer"), Ie = Symbol.for("react.context"), pt = Symbol.for("react.forward_ref"), Mt = Symbol.for("react.suspense"), Bn = Symbol.for("react.suspense_list"), bn = Symbol.for("react.memo"), Fn = Symbol.for("react.lazy"), Ri = Symbol.for("react.offscreen"), Qt = Symbol.iterator, kt = Symbol.for("react.client.reference"), mt = W.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, en = Object.prototype.hasOwnProperty, xe = Object.assign, Ni = Symbol.for("react.client.reference"), $n = Array.isArray, tn = 0, bt, nn, gr, Lt, Wt, vr, rn; u.__reactDisabledLog = !0; var Bt, Un, Me = !1, wt = new (typeof WeakMap == "function" ? WeakMap : Map)(), Di = Symbol.for("react.client.reference"), Qe, zn = {}, yr = {}, Ft = {}; or.Fragment = $, or.jsx = function(y, F, U, oe, ye) { return D(y, F, U, !1, oe, ye); }, or.jsxs = function(y, F, U, oe, ye) { return D(y, F, U, !0, oe, ye); }; }()), or; } var nc; function Hy() { return nc || (nc = 1, process.env.NODE_ENV === "production" ? ui.exports = zy() : ui.exports = Vy()), ui.exports; } var vn = Hy(); function Ae(o) { return `Minified Redux error #${o}; visit https://redux.js.org/Errors?code=${o} for the full message or use the non-minified dev environment for full errors. `; } var Gy = typeof Symbol == "function" && Symbol.observable || "@@observable", rc = Gy, Yo = () => Math.random().toString(36).substring(7).split("").join("."), jy = { INIT: `@@redux/INIT${/* @__PURE__ */ Yo()}`, REPLACE: `@@redux/REPLACE${/* @__PURE__ */ Yo()}`, PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${Yo()}` }, yn = jy; function hr(o) { if (typeof o != "object" || o === null) return !1; let i = o; for (; Object.getPrototypeOf(i) !== null; ) i = Object.getPrototypeOf(i); return Object.getPrototypeOf(o) === i || Object.getPrototypeOf(o) === null; } function qy(o) { if (o === void 0) return "undefined"; if (o === null) return "null"; const i = typeof o; switch (i) { case "boolean": case "string": case "number": case "symbol": case "function": return i; } if (Array.isArray(o)) return "array"; if (Xy(o)) return "date"; if (Ky(o)) return "error"; const r = Yy(o); switch (r) { case "Symbol": case "Promise": case "WeakMap": case "WeakSet": case "Map": case "Set": return r; } return Object.prototype.toString.call(o).slice(8, -1).toLowerCase().replace(/\s/g, ""); } function Yy(o) { return typeof o.constructor == "function" ? o.constructor.name : null; } function Ky(o) { return o instanceof Error || typeof o.message == "string" && o.constructor && typeof o.constructor.stackTraceLimit == "number"; } function Xy(o) { return o instanceof Date ? !0 : typeof o.toDateString == "function" && typeof o.getDate == "function" && typeof o.setDate == "function"; } function Xt(o) { let i = typeof o; return process.env.NODE_ENV !== "production" && (i = qy(o)), i; } function hs(o, i, r) { if (typeof o != "function") throw new Error(process.env.NODE_ENV === "production" ? Ae(2) : `Expected the root reducer to be a function. Instead, received: '${Xt(o)}'`); if (typeof i == "function" && typeof r == "function" || typeof r == "function" && typeof arguments[3] == "function") throw new Error(process.env.NODE_ENV === "production" ? Ae(0) : "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example."); if (typeof i == "function" && typeof r > "u" && (r = i, i = void 0), typeof r < "u") { if (typeof r != "function") throw new Error(process.env.NODE_ENV === "production" ? Ae(1) : `Expected the enhancer to be a function. Instead, received: '${Xt(r)}'`); return r(hs)(o, i); } let u = o, c = i, d = /* @__PURE__ */ new Map(), h = d, g = 0, m = !1; function b() { h === d && (h = /* @__PURE__ */ new Map(), d.forEach((N, L) => { h.set(L, N); })); } function _() { if (m) throw new Error(process.env.NODE_ENV === "production" ? Ae(3) : "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store."); return c; } function S(N) { if (typeof N != "function") throw new Error(process.env.NODE_ENV === "production" ? Ae(4) : `Expected the listener to be a function. Instead, received: '${Xt(N)}'`); if (m) throw new Error(process.env.NODE_ENV === "production" ? Ae(5) : "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details."); let L = !0; b(); const H = g++; return h.set(H, N), function() { if (L) { if (m) throw new Error(process.env.NODE_ENV === "production" ? Ae(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details."); L = !1, b(), h.delete(H), d = null; } }; } function O(N) { if (!hr(N)) throw new Error(process.env.NODE_ENV === "production" ? Ae(7) : `Actions must be plain objects. Instead, the actual type was: '${Xt(N)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`); if (typeof N.type > "u") throw new Error(process.env.NODE_ENV === "production" ? Ae(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.'); if (typeof N.type != "string") throw new Error(process.env.NODE_ENV === "production" ? Ae(17) : `Action "type" property must be a string. Instead, the actual type was: '${Xt(N.type)}'. Value was: '${N.type}' (stringified)`); if (m) throw new Error(process.env.NODE_ENV === "production" ? Ae(9) : "Reducers may not dispatch actions."); try { m = !0, c = u(c, N); } finally { m = !1; } return (d = h).forEach((H) => { H(); }), N; } function P(N) { if (typeof N != "function") throw new Error(process.env.NODE_ENV === "production" ? Ae(10) : `Expected the nextReducer to be a function. Instead, received: '${Xt(N)}`); u = N, O({ type: yn.REPLACE }); } function D() { const N = S; return { /** * The minimal observable subscription method. * @param observer Any object that can be used as an observer. * The observer object should have a `next` method. * @returns An object with an `unsubscribe` method that can * be used to unsubscribe the observable from the store, and prevent further * emission of values from the observable. */ subscribe(L) { if (typeof L != "object" || L === null) throw new Error(process.env.NODE_ENV === "production" ? Ae(11) : `Expected the observer to be an object. Instead, received: '${Xt(L)}'`); function H() { const M = L; M.next && M.next(_()); } return H(), { unsubscribe: N(H) }; }, [rc]() { return this; } }; } return O({ type: yn.INIT }), { dispatch: O, subscribe: S, getState: _, replaceReducer: P, [rc]: D }; } function ic(o) { typeof console < "u" && typeof console.error == "function" && console.error(o); try { throw new Error(o); } catch { } } function Zy(o, i, r, u) { const c = Object.keys(i), d = r && r.type === yn.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer"; if (c.length === 0) return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers."; if (!hr(o)) return `The ${d} has unexpected type of "${Xt(o)}". Expected argument to be an object with the following keys: "${c.join('", "')}"`; const h = Object.keys(o).filter((g) => !i.hasOwnProperty(g) && !u[g]); if (h.forEach((g) => { u[g] = !0; }), !(r && r.type === yn.REPLACE) && h.length > 0) return `Unexpected ${h.length > 1 ? "keys" : "key"} "${h.join('", "')}" found in ${d}. Expected to find one of the known reducer keys instead: "${c.join('", "')}". Unexpected keys will be ignored.`; } function Jy(o) { Object.keys(o).forEach((i) => { const r = o[i]; if (typeof r(void 0, { type: yn.INIT }) > "u") throw new Error(process.env.NODE_ENV === "production" ? Ae(12) : `The slice reducer for key "${i}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`); if (typeof r(void 0, { type: yn.PROBE_UNKNOWN_ACTION() }) > "u") throw new Error(process.env.NODE_ENV === "production" ? Ae(13) : `The slice reducer for key "${i}" returned undefined when probed with a random type. Don't try to handle '${yn.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`); }); } function ps(o) { const i = Object.keys(o), r = {}; for (let h = 0; h < i.length; h++) { const g = i[h]; process.env.NODE_ENV !== "production" && typeof o[g] > "u" && ic(`No reducer provided for key "${g}"`), typeof o[g] == "function" && (r[g] = o[g]); } const u = Object.keys(r); let c; process.env.NODE_ENV !== "production" && (c = {}); let d; try { Jy(r); } catch (h) { d = h; } return function(g = {}, m) { if (d) throw d; if (process.env.NODE_ENV !== "production") { const S = Zy(g, r, m, c); S && ic(S); } let b = !1; const _ = {}; for (let S = 0; S < u.length; S++) { const O = u[S], P = r[O], D = g[O], V = P(D, m); if (typeof V > "u") { const N = m && m.type; throw new Error(process.env.NODE_ENV === "production" ? Ae(14) : `When called with an action of type ${N ? `"${String(N)}"` : "(unknown type)"}, the slice reducer for key "${O}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`); } _[O] = V, b = b || V !== D; } return b = b || u.length !== Object.keys(g).length, b ? _ : g; }; } function mi(...o) { return o.length === 0 ? (i) => i : o.length === 1 ? o[0] : o.reduce((i, r) => (...u) => i(r(...u))); } function Qy(...o) { return (i) => (r, u) => { const c = i(r, u); let d = () => { throw new Error(process.env.NODE_ENV === "production" ? Ae(15) : "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch."); }; const h = { getState: c.getState, dispatch: (m, ...b) => d(m, ...b) }, g = o.map((m) => m(h)); return d = mi(...g)(c.dispatch), { ...c, dispatch: d }; }; } function Nc(o) { return hr(o) && "type" in o && typeof o.type == "string"; } var Dc = Symbol.for("immer-nothing"), oc = Symbol.for("immer-draftable"), Ze = Symbol.for("immer-state"), e_ = process.env.NODE_ENV !== "production" ? [ // All error codes, starting by 0: function(o) { return `The plugin for '${o}' has not been loaded into Immer. To enable the plugin, import and call \`enable${o}()\` when initializing your application.`; }, function(o) { return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${o}'`; }, "This object has been frozen and should not be mutated", function(o) { return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + o; }, "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", "Immer forbids circular references", "The first or second argument to `produce` must be a function", "The third argument to `produce` must be a function or undefined", "First argument to `createDraft` must be a plain object, an array, or an immerable object", "First argument to `finishDraft` must be a draft returned by `createDraft`", function(o) { return `'current' expects a draft, got: ${o}`; }, "Object.defineProperty() cannot be used on an Immer draft", "Object.setPrototypeOf() cannot be used on an Immer draft", "Immer only supports deleting array indices", "Immer only supports setting array indices and the 'length' property", function(o) { return `'original' expects a draft, got: ${o}`; } // Note: if more errors are added, the errorOffset in Patches.ts should be increased // See Patches.ts for additional errors ] : []; function Ve(o, ...i) { if (process.env.NODE_ENV !== "production") { const r = e_[o], u = typeof r == "function" ? r.apply(null, i) : r; throw new Error(`[Immer] ${u}`); } throw new Error( `[Immer] minified error nr: ${o}. Full error at: https://bit.ly/3cXEKWf` ); } var kn = Object.getPrototypeOf; function _n(o) { return !!o && !!o[Ze]; } function It(o) { var i; return o ? Ic(o) || Array.isArray(o) || !!o[oc] || !!((i = o.constructor) != null && i[oc]) || Ci(o) || Ti(o) : !1; } var t_ = Object.prototype.constructor.toString(); function Ic(o) { if (!o || typeof o != "object") return !1; const i = kn(o); if (i === null) return !0; const r = Object.hasOwnProperty.call(i, "constructor") && i.constructor; return r === Object ? !0 : typeof r == "function" && Function.toString.call(r) === t_; } function bi(o, i) { Oi(o) === 0 ? Reflect.ownKeys(o).forEach((r) => { i(r, o[r], o); }) : o.forEach((r, u) => i(u, r, o)); } function Oi(o) { const i = o[Ze]; return i ? i.type_ : Array.isArray(o) ? 1 : Ci(o) ? 2 : Ti(o) ? 3 : 0; } function ns(o, i) { return Oi(o) === 2 ? o.has(i) : Object.prototype.hasOwnProperty.call(o, i); } function Mc(o, i, r) { const u = Oi(o); u === 2 ? o.set(i, r) : u === 3 ? o.add(r) : o[i] = r; } function n_(o, i) { return o === i ? o !== 0 || 1 / o === 1 / i : o !== o && i !== i; } function Ci(o) { return o instanceof Map; } function Ti(o) { return o instanceof Set; } function pn(o) { return o.copy_ || o.base_; } function rs(o, i) { if (Ci(o)) return new Map(o); if (Ti(o)) return new Set(o); if (Array.isArray(o)) return Array.prototype.slice.call(o); const r = Ic(o); if (i === !0 || i === "class_only" && !r) { const u = Object.getOwnPropertyDescriptors(o); delete u[Ze]; let c = Reflect.ownKeys(u); for (let d = 0; d < c.length; d++) { const h = c[d], g = u[h]; g.writable === !1 && (g.writable = !0, g.configurable = !0), (g.get || g.set) && (u[h] = { configurable: !0, writable: !0, // could live with !!desc.set as well here... enumerable: g.enumerable, value: o[h] }); } return Object.create(kn(o), u); } else { const u = kn(o); if (u !== null && r) return { ...o }; const c = Object.create(u); return Object.assign(c, o); } } function gs(o, i = !1) { return Ai(o) || _n(o) || !It(o) || (Oi(o) > 1 && (o.set = o.add = o.clear = o.delete = r_), Object.freeze(o), i && Object.entries(o).forEach(([r, u]) => gs(u, !0))), o; } function r_() { Ve(2); } function Ai(o) { return Object.isFrozen(o); } var i_ = {}; function mn(o) { const i = i_[o]; return i || Ve(0, o), i; } var lr; function kc() { return lr; } function o_(o, i) { return { drafts_: [], parent_: o, immer_: i, // Whenever the modified draft contains a draft from another scope, we // need to prevent auto-freezing so the unowned draft can be finalized. canAutoFreeze_: !0, unfinalizedDrafts_: 0 }; } function sc(o, i) { i && (mn("Patches"), o.patches_ = [], o.inversePatches_ = [], o.patchListener_ = i); } function is(o) { os(o), o.drafts_.forEach(s_), o.drafts_ = null; } function os(o) { o === lr && (lr = o.parent_); } function uc(o) { return lr = o_(lr, o); } function s_(o) { const i = o[Ze]; i.type_ === 0 || i.type_ === 1 ? i.revoke_() : i.revoked_ = !0; } function ac(o, i) { i.unfinalizedDrafts_ = i.drafts_.length; const r = i.drafts_[0]; return o !== void 0 && o !== r ? (r[Ze].modified_ && (is(i), Ve(4)), It(o) && (o = wi(i, o), i.parent_ || Ei(i, o)), i.patches_ && mn("Patches").generateReplacementPatches_( r[Ze].base_, o, i.patches_, i.inversePatches_ )) : o = wi(i, r, []), is(i), i.patches_ && i.patchListener_(i.patches_, i.inversePatches_), o !== Dc ? o : void 0; } function wi(o, i, r) { if (Ai(i)) return i; const u = i[Ze]; if (!u) return bi( i, (c, d) => cc(o, u, i, c, d, r) ), i; if (u.scope_ !== o) return i; if (!u.modified_) return Ei(o, u.base_, !0), u.base_; if (!u.finalized_) { u.finalized_ = !0, u.scope_.unfinalizedDrafts_--; const c = u.copy_; let d = c, h = !1; u.type_ === 3 && (d = new Set(c), c.clear(), h = !0), bi( d, (g, m) => cc(o, u, c, g, m, r, h) ), Ei(o, c, !1), r && o.patches_ && mn("Patches").generatePatches_( u, r, o.patches_, o.inversePatches_ ); } return u.copy_; } function cc(o, i, r, u, c, d, h) { if (process.env.NODE_ENV !== "production" && c === r && Ve(5), _n(c)) { const g = d && i && i.type_ !== 3 && // Set objects are atomic since they have no keys. !ns(i.assigned_, u) ? d.concat(u) : void 0, m = wi(o, c, g); if (Mc(r, u, m), _n(m)) o.canAutoFreeze_ = !1; else return; } else h && r.add(c); if (It(c) && !Ai(c)) { if (!o.immer_.autoFreeze_ && o.unfinalizedDrafts_ < 1) return; wi(o, c), (!i || !i.scope_.parent_) && typeof u != "symbol" && Object.prototype.propertyIsEnumerable.call(r, u) && Ei(o, c); } } function Ei(o, i, r = !1) { !o.parent_ && o.immer_.autoFreeze_ && o.canAutoFreeze_ && gs(i, r); } function u_(o, i) { const r = Array.isArray(o), u = { type_: r ? 1 : 0, // Track which produce call this is associated with. scope_: i ? i.scope_ : kc(), // True for both shallow and deep changes. modified_: !1, // Used during finalization. finalized_: !1, // Track which properties have been assigned (true) or deleted (false). assigned_: {}, // The parent draft state. parent_: i, // The base state. base_: o, // The base proxy. draft_: null, // set below // The base copy with any updated values. copy_: null, // Called by the `produce` function. revoke_: null, isManual_: !1 }; let c = u, d = vs; r && (c = [u], d = dr); const { revoke: h, proxy: g } = Proxy.revocable(c, d); return u.draft_ = g, u.revoke_ = h, g; } var vs = { get(o, i) { if (i === Ze) return o; const r = pn(o); if (!ns(r, i)) return a_(o, r, i); const u = r[i]; return o.finalized_ || !It(u) ? u : u === Ko(o.base_, i) ? (Xo(o), o.copy_[i] = us(u, o)) : u; }, has(o, i) { return i in pn(o); }, ownKeys(o) { return Reflect.ownKeys(pn(o)); }, set(o, i, r) { const u = Lc(pn(o), i); if (u != null && u.set) return u.set.call(o.draft_, r), !0; if (!o.modified_) { const c = Ko(pn(o), i), d = c == null ? void 0 : c[Ze]; if (d && d.base_ === r) return o.copy_[i] = r, o.assigned_[i] = !1, !0; if (n_(r, c) && (r !== void 0 || ns(o.base_, i))) return !0; Xo(o), ss(o); } return o.copy_[i] === r && // special case: handle new props with value 'undefined' (r !== void 0 || i in o.copy_) || // special case: NaN Number.isNaN(r) && Number.isNaN(o.copy_[i]) || (o.copy_[i] = r, o.assigned_[i] = !0), !0; }, deleteProperty(o, i) { return Ko(o.base_, i) !== void 0 || i in o.base_ ? (o.assigned_[i] = !1, Xo(o), ss(o)) : delete o.assigned_[i], o.copy_ && delete o.copy_[i], !0; }, // Note: We never coerce `desc.value` into an Immer draft, because we can't make // the same guarantee in ES5 mode. getOwnPropertyDescriptor(o, i) { const r = pn(o), u = Reflect.getOwnPropertyDescriptor(r, i); return u && { writable: !0, configurable: o.type_ !== 1 || i !== "length", enumerable: u.enumerable, value: r[i] }; }, defineProperty() { Ve(11); }, getPrototypeOf(o) { return kn(o.base_); }, setPrototypeOf() { Ve(12); } }, dr = {}; bi(vs, (o, i) => { dr[o] = function() { return arguments[0] = arguments[0][0], i.apply(this, arguments); }; }); dr.deleteProperty = function(o, i) { return process.env.NODE_ENV !== "production" && isNaN(parseInt(i)) && Ve(13), dr.set.call(this, o, i, void 0); }; dr.set = function(o, i, r) { return process.env.NODE_ENV !== "production" && i !== "length" && isNaN(parseInt(i)) && Ve(14), vs.set.call(this, o[0], i, r, o[0]); }; function Ko(o, i) { const r = o[Ze]; return (r ? pn(r) : o)[i]; } function a_(o, i, r) { var c; const u = Lc(i, r); return u ? "value" in u ? u.value : ( // This is a very special case, if the prop is a getter defined by the // prototype, we should invoke it with the draft as context! (c = u.get) == null ? void 0 : c.call(o.draft_) ) : void 0; } function Lc(o, i) { if (!(i in o)) return; let r = kn(o); for (; r; ) { const u = Object.getOwnPropertyDescriptor(r, i); if (u) return u; r = kn(r); } } function ss(o) { o.modified_ || (o.modified_ = !0, o.parent_ && ss(o.parent_)); } function Xo(o) { o.copy_ || (o.copy_ = rs( o.base_, o.scope_.immer_.useStrictShallowCopy_ )); } var c_ = class { constructor(o) { this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (i, r, u) => { if (typeof i == "function" && typeof r != "function") { const d = r; r = i; const h = this; return function(m = d, ...b) { return h.produce(m, (_) => r.call(this, _, ...b)); }; } typeof r != "function" && Ve(6), u !== void 0 && typeof u != "function" && Ve(7); let c; if (It(i)) { const d = uc(this), h = us(i, void 0); let g = !0; try { c = r(h), g = !1; } finally { g ? is(d) : os(d); } return sc(d, u), ac(c, d); } else if (!i || typeof i != "object") { if (c = r(i), c === void 0 && (c = i), c === Dc && (c = void 0), this.autoFreeze_ && gs(c, !0), u) { const d = [], h = []; mn("Patches").generateReplacementPatches_(i, c, d, h), u(d, h); } return c; } else Ve(1, i); }, this.produceWithPatches = (i, r) => { if (typeof i == "function") return (h, ...g) => this.produceWithPatches(h, (m) => i(m, ...g)); let u, c; return [this.produce(i, r, (h, g) => { u = h, c = g; }), u, c]; }, typeof (o == null ? void 0 : o.autoFreeze) == "boolean" && this.setAutoFreeze(o.autoFreeze), typeof (o == null ? void 0 : o.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(o.useStrictShallowCopy); } createDraft(o) { It(o) || Ve(8), _n(o) && (o = f_(o)); const i = uc(this), r = us(o, void 0); return r[Ze].isManual_ = !0, os(i), r; } finishDraft(o, i) { const r = o && o[Ze]; (!r || !r.isManual_) && Ve(9); const { scope_: u } = r; return sc(u, i), ac(void 0, u); } /** * Pass true to automatically freeze all copies created by Immer. * * By default, auto-freezing is enabled. */ setAutoFreeze(o) { this.autoFreeze_ = o; } /** * Pass true to enable strict shallow copy. * * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. */ setUseStrictShallowCopy(o) { this.useStrictShallowCopy_ = o; } applyPatches(o, i) { let r; for (r = i.length - 1; r >= 0; r--) { const c = i[r]; if (c.path.length === 0 && c.op === "replace") { o = c.value; break; } } r > -1 && (i = i.slice(r + 1)); const u = mn("Patches").applyPatches_; return _n(o) ? u(o, i) : this.produce( o, (c) => u(c, i) ); } }; function us(o, i) { const r = Ci(o) ? mn("MapSet").proxyMap_(o, i) : Ti(o) ? mn("MapSet").proxySet_(o, i) : u_(o, i); return (i ? i.scope_ : kc()).drafts_.push(r), r; } function f_(o) { return _n(o) || Ve(10, o), Wc(o); } function Wc(o) { if (!It(o) || Ai(o)) return o; const i = o[Ze]; let r; if (i) { if (!i.modified_) return i.base_; i.finalized_ = !0, r = rs(o, i.scope_.immer_.useStrictShallowCopy_); } else r = rs(o, !0); return bi(r, (u, c) => { Mc(r, u, Wc(c)); }), i && (i.finalized_ = !1), r; } var Je = new c_(), Bc = Je.produce; Je.produceWithPatches.bind( Je ); Je.setAutoFreeze.bind(Je); Je.setUseStrictShallowCopy.bind(Je); Je.applyPatches.bind(Je); Je.createDraft.bind(Je); Je.finishDraft.bind(Je); function Fc(o) { return ({ dispatch: r, getState: u }) => (c) => (d) => typeof d == "function" ? d(r, u, o) : c(d); } var l_ = Fc(), d_ = Fc, h_ = typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() { if (arguments.length !== 0) return typeof arguments[0] == "object" ? mi : mi.apply(null, arguments); }, p_ = (o) => o && typeof o.match == "function"; function fc(o, i) { function r(...u) { if (i) { let c = i(...u); if (!c) throw new Error(process.env.NODE_ENV === "production" ? pe(0) : "prepareAction did not return an object"); return { type: o, payload: c.payload, ..."meta" in c && { meta: c.meta }, ..."error" in c && { error: c.error } }; } return { type: o, payload: u[0] }; } return r.toString = () => `${o}`, r.type = o, r.match = (u) => Nc(u) && u.type === o, r; } function g_(o) { return typeof o == "function" && "type" in o && // hasMatchFunction only wants Matchers but I don't see the point in rewriting it p_(o); } function v_(o) { const i = o ? `${o}`.split("/") : [], r = i[i.length - 1] || "actionCreator"; return `Detected an action creator with type "${o || "unknown"}" being dispatched. Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${r}())\` instead of \`dispatch(${r})\`. This is necessary even if the action has no payload.`; } function y_(o = {}) { if (process.env.NODE_ENV === "production") return () => (r) => (u) => r(u); const { isActionCreator: i = g_ } = o; return () => (r) => (u) => (i(u) && console.warn(v_(u.type)), r(u)); } function $c(o, i) { let r = 0; return { measureTime(u) { const c = Date.now(); try { return u(); } finally { const d = Date.now(); r += d - c; } }, warnIfExceeded() { r > o && console.warn(`${i} took ${r}ms, which is more than the warning threshold of ${o}ms. If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions. It is disabled in production builds, so you don't need to worry about that.`); } }; } var Uc = class ur extends Array { constructor(...i) { super(...i), Object.setPrototypeOf(this, ur.prototype); } static get [Symbol.species]() { return ur; } concat(...i) { return super.concat.apply(this, i); } prepend(...i) { return i.length === 1 && Array.isArray(i[0]) ? new ur(...i[0].concat(this)) : new ur(...i.concat(this)); } }; function lc(o) { return It(o) ? Bc(o, () => { }) : o; } function dc(o, i, r) { return o.has(i) ? o.get(i) : o.set(i, r(i)).get(i); } function __(o) { return typeof o != "object" || o == null || Object.isFrozen(o); } function m_(o, i, r) { const u = zc(o, i, r); return { detectMutations() { return Vc(o, i, u, r); } }; } function zc(o, i = [], r, u = "", c = /* @__PURE__ */ new Set()) { const d = { value: r }; if (!o(r) && !c.has(r)) { c.add(r), d.children = {}; for (const h in r) { const g = u ? u + "." + h : h; i.length && i.indexOf(g) !== -1 || (d.children[h] = zc(o, i, r[h], g)); } } return d; } function Vc(o, i = [], r, u, c = !1, d = "") { const h = r ? r.value : void 0, g = h === u; if (c && !g && !Number.isNaN(u)) return { wasMutated: !0, path: d }; if (o(h) || o(u)) return { wasMutated: !1 }; const m = {}; for (let _ in r.children) m[_] = !0; for (let _ in u) m[_] = !0; const b = i.length > 0; for (let _ in m) { const S = d ? d + "." + _ : _; if (b && i.some((D) => D instanceof RegExp ? D.test(S) : S === D)) continue; const O = Vc(o, i, r.children[_], u[_], g, S); if (O.wasMutated) return O; } return { wasMutated: !1 }; } function b_(o = {}) { if (process.env.NODE_ENV === "production") return () => (i) => (r) => i(r); { let i = function(g, m, b, _) { return JSON.stringify(g, r(m, _), b); }, r = function(g, m) { let b = [], _ = []; return m || (m = function(S, O) { return b[0] === O ? "[Circular ~]" : "[Circular ~." + _.slice(0, b.indexOf(O)).join(".") + "]"; }), function(S, O) { if (b.length > 0) { var P = b.indexOf(this); ~P ? b.splice(P + 1) : b.push(this), ~P ? _.splice(P, 1 / 0, S) : _.push(S), ~b.indexOf(O) && (O = m.call(this, S, O)); } else b.push(O); return g == null ? O : g.call(this, S, O); }; }, { isImmutable: u = __, ignoredPaths: c, warnAfter: d = 32 } = o; const h = m_.bind(null, u, c); return ({ getState: g }) => { let m = g(), b = h(m), _; return (S) => (O) => { const P = $c(d, "ImmutableStateInvariantMiddleware"); P.measureTime(() => { if (m = g(), _ = b.detectMutations(), b = h(m), _.wasMutated) throw new Error(process.env.NODE_ENV === "production" ? pe(19) : `A state mutation was detected between dispatches, in the path '${_.path || ""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`); }); const D = S(O); return P.measureTime(() => { if (m = g(), _ = b.detectMutations(), b = h(m), _.wasMutated) throw new Error(process.env.NODE_ENV === "production" ? pe(20) : `A state mutation was detected inside a dispatch, in the path: ${_.path || ""}. Take a look at the reducer(s) handling the action ${i(O)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`); }), P.warnIfExceeded(), D; }; }; } } function Hc(o) { const i = typeof o; return o == null || i === "string" || i === "boolean" || i === "number" || Array.isArray(o) || hr(o); } function as(o, i = "", r = Hc, u, c = [], d) { let h; if (!r(o)) return { keyPath: i || "<root>", value: o }; if (typeof o != "object" || o === null || d != null && d.has(o)) return !1; const g = u != null ? u(o) : Object.entries(o), m = c.length > 0; for (const [b, _] of g) { const S = i ? i + "." + b : b; if (!(m && c.some((P) => P instanceof RegExp ? P.test(S) : S === P))) { if (!r(_)) return { keyPath: S, value: _ }; if (typeof _ == "object" && (h = as(_, S, r, u, c, d), h)) return h; } } return d && Gc(o) && d.add(o), !1; } function Gc(o) { if (!Object.isFrozen(o)) return !1; for (const i of Object.values(o)) if (!(typeof i != "object" || i === null) && !Gc(i)) return !1; return !0; } function w_(o = {}) { if (process.env.NODE_ENV === "production") return () => (i) => (r) => i(r); { const { isSerializable: i = Hc, getEntries: r, ignoredActions: u = [], ignoredActionPaths: c = ["meta.arg", "meta.baseQueryMeta"], ignoredPaths: d = [], warnAfter: h = 32, ignoreState: g = !1, ignoreActions: m = !1, disableCache: b = !1 } = o, _ = !b && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0; return (S) => (O) => (P) => { if (!Nc(P)) return O(P); const D = O(P), V = $c(h, "SerializableStateInvariantMiddleware"); return !m && !(u.length && u.indexOf(P.type) !== -1) && V.measureTime(() => { const N = as(P, "", i, r, c, _); if (N) { const { keyPath: L, value: H } = N; console.error(`A non-serializable value was detected in an action, in the path: \`${L}\`. Value:`, H, ` Take a look at the logic that dispatched this action: `, P, ` (See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)`, ` (To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`); } }), g || (V.measureTime(() => { const N = S.getState(), L = as(N, "", i, r, d, _); if (L) { const { keyPath: H, value: W } = L; console.error(`A non-serializable value was detected in the state, in the path: \`${H}\`. Value:`, W, ` Take a look at the reducer(s) handling this action type: ${P.type}. (See https://redux.js.org/faq/organizing-state#can-i-put-functions-p