Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

199 lines
7.2 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 09166d9658efb080.e1742a6c63.js
* Module id: 226508
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
let t = {
get url() {
return `file://${e.P("node_modules/.pnpm/zustand@4.5.7_@types+react@18.3.27_immer@10.2.0_react@18.3.1/node_modules/zustand/esm/middleware.mjs")}`;
},
},
n = new Map(),
o = (e) => {
let t = n.get(e);
return t
? Object.fromEntries(
Object.entries(t.stores).map(([e, t]) => [e, t.getState()]),
)
: {};
},
i =
(e, i = {}) =>
(a, s, l) => {
let d,
{ enabled: u, anonymousActionType: c, store: p, ...h } = i;
try {
d =
(null != u
? u
: (t.env ? t.env.MODE : void 0) !== "production") &&
window.__REDUX_DEVTOOLS_EXTENSION__;
} catch (e) {}
if (!d)
return (
(t.env ? t.env.MODE : void 0) !== "production" &&
u &&
console.warn(
"[zustand devtools middleware] Please install/enable Redux devtools extension",
),
e(a, s, l)
);
let { connection: g, ...f } = ((e, t, o) => {
if (void 0 === e)
return { type: "untracked", connection: t.connect(o) };
let i = n.get(o.name);
if (i) return { type: "tracked", store: e, ...i };
let r = { connection: t.connect(o), stores: {} };
return n.set(o.name, r), { type: "tracked", store: e, ...r };
})(p, d, h),
m = !0;
l.setState = (e, t, n) => {
let i = a(e, t);
if (!m) return i;
let r =
void 0 === n
? { type: c || "anonymous" }
: "string" == typeof n
? { type: n }
: n;
return (
void 0 === p
? null == g || g.send(r, s())
: null == g ||
g.send(
{ ...r, type: `${p}/${r.type}` },
{ ...o(h.name), [p]: l.getState() },
),
i
);
};
let y = (...e) => {
let t = m;
(m = !1), a(...e), (m = t);
},
v = e(l.setState, s, l);
if (
("untracked" === f.type
? null == g || g.init(v)
: ((f.stores[f.store] = l),
null == g ||
g.init(
Object.fromEntries(
Object.entries(f.stores).map(([e, t]) => [
e,
e === f.store ? v : t.getState(),
]),
),
)),
l.dispatchFromDevtools && "function" == typeof l.dispatch)
) {
let e = !1,
n = l.dispatch;
l.dispatch = (...o) => {
(t.env ? t.env.MODE : void 0) === "production" ||
"__setState" !== o[0].type ||
e ||
(console.warn(
'[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.',
),
(e = !0)),
n(...o);
};
}
return (
g.subscribe((e) => {
var t;
switch (e.type) {
case "ACTION":
if ("string" != typeof e.payload)
return void console.error(
"[zustand devtools middleware] Unsupported action format",
);
return r(e.payload, (e) => {
if ("__setState" === e.type) {
if (void 0 === p) return void y(e.state);
1 !== Object.keys(e.state).length &&
console.error(`
[zustand devtools middleware] Unsupported __setState action format.
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
`);
let t = e.state[p];
return void (
null == t ||
(JSON.stringify(l.getState()) !== JSON.stringify(t) &&
y(t))
);
}
l.dispatchFromDevtools &&
"function" == typeof l.dispatch &&
l.dispatch(e);
});
case "DISPATCH":
switch (e.payload.type) {
case "RESET":
if ((y(v), void 0 === p))
return null == g ? void 0 : g.init(l.getState());
return null == g ? void 0 : g.init(o(h.name));
case "COMMIT":
if (void 0 === p) {
null == g || g.init(l.getState());
break;
}
return null == g ? void 0 : g.init(o(h.name));
case "ROLLBACK":
return r(e.state, (e) => {
if (void 0 === p) {
y(e), null == g || g.init(l.getState());
return;
}
y(e[p]), null == g || g.init(o(h.name));
});
case "JUMP_TO_STATE":
case "JUMP_TO_ACTION":
return r(e.state, (e) => {
void 0 === p
? y(e)
: JSON.stringify(l.getState()) !==
JSON.stringify(e[p]) && y(e[p]);
});
case "IMPORT_STATE": {
let { nextLiftedState: n } = e.payload,
o =
null == (t = n.computedStates.slice(-1)[0])
? void 0
: t.state;
if (!o) return;
void 0 === p ? y(o) : y(o[p]),
null == g || g.send(null, n);
break;
}
case "PAUSE_RECORDING":
return (m = !m);
}
return;
}
}),
v
);
},
r = (e, t) => {
let n;
try {
n = JSON.parse(e);
} catch (e) {
console.error(
"[zustand devtools middleware] Could not parse the received json",
e,
);
}
void 0 !== n && t(n);
};
e.s(["devtools", () => i]);
};
export default moduleFactory;