hermium 0.1.9 → 0.2.0
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/README.md +56 -0
- package/bin/hermium.mjs +185 -164
- package/dist/api.mjs +3513 -0
- package/dist/public/assets/css/index-Dfs9RUU9.css +1 -0
- package/dist/public/assets/css/styles-B8p6jk5Z.css +1 -0
- package/dist/public/assets/js/ChatInputBlock-Bw7AL70H.js +1 -0
- package/dist/public/assets/js/MarkdownMessage-8d7Y6VL-.js +1 -0
- package/dist/public/assets/js/base-ui-BvQbAt_1.js +1 -0
- package/dist/public/assets/js/chat._sessionId-BG6lVraH.js +1 -0
- package/dist/public/assets/js/chat.index-D2zdMPTT.js +1 -0
- package/dist/public/assets/js/index-C0AK45FU.js +60 -0
- package/dist/public/assets/js/index-Cx5En4FK.js +1 -0
- package/dist/public/assets/js/memory-CeSRdTkW.js +3 -0
- package/dist/public/assets/js/router-8uDKazL-.js +1 -0
- package/dist/public/assets/js/settings-Bc3Y5zXO.js +1 -0
- package/dist/public/assets/js/skills-DZv7sA_5.js +1 -0
- package/dist/public/assets/js/theme-CPkdkpaj.js +1 -0
- package/dist/public/assets/js/usage-DXQsT9_b.js +1 -0
- package/dist/public/assets/woff2/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/public/assets/woff2/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/public/assets/woff2/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/public/assets/woff2/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/public/assets/woff2/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/logo.png +0 -0
- package/package.json +1 -1
- package/dist/public/assets/IconAlertCircle-BHkmI3j7.js +0 -1
- package/dist/public/assets/IconAlertTriangle-wCJudlVg.js +0 -1
- package/dist/public/assets/IconCheck-CFuEh_p7.js +0 -1
- package/dist/public/assets/IconLoader2-BIx3OuF9.js +0 -1
- package/dist/public/assets/IconRefresh-Dgm93w3T.js +0 -1
- package/dist/public/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/dist/public/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/dist/public/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/dist/public/assets/index-Bbz3abmO.js +0 -14
- package/dist/public/assets/index-CWUaRwcE.js +0 -1
- package/dist/public/assets/index-CinLq3cd.js +0 -1
- package/dist/public/assets/index-CrQs9n6q.js +0 -29
- package/dist/public/assets/index-CtacpN3I.js +0 -1
- package/dist/public/assets/index-DY7aE-9s.js +0 -2
- package/dist/public/assets/index-DkYGodJj.js +0 -94
- package/dist/public/assets/index-DvDLadUx.js +0 -1
- package/dist/public/assets/index-U6RcWedt.js +0 -1
- package/dist/public/assets/index-_6iFZ0fh.js +0 -1
- package/dist/public/assets/index-enFS26SU.js +0 -1
- package/dist/public/assets/input-eNcwlDHp.js +0 -1
- package/dist/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/public/assets/queries-iHRgZzw2.js +0 -1
- package/dist/public/assets/styles-KcflDlA_.css +0 -1
- package/dist/public/assets/switch-B1DcZLwL.js +0 -1
- package/dist/public/assets/syntax-highlighter-DWPF-A_h.js +0 -6
- package/dist/public/assets/textarea-Di_syYTS.js +0 -1
- package/dist/public/favicon.png +0 -0
- package/dist/public/nous-logo.png +0 -0
- package/dist/server/index.mjs +0 -244
- package/dist/web-server/__23tanstack-start-plugin-adapters-Cwee5PKy.mjs +0 -6
- package/dist/web-server/_chunks/ssr-renderer.mjs +0 -22
- package/dist/web-server/_libs/babel__runtime.mjs +0 -237
- package/dist/web-server/_libs/bail.mjs +0 -8
- package/dist/web-server/_libs/base-ui__react.mjs +0 -9554
- package/dist/web-server/_libs/base-ui__utils.mjs +0 -1101
- package/dist/web-server/_libs/ccount.mjs +0 -16
- package/dist/web-server/_libs/character-entities-legacy.mjs +0 -111
- package/dist/web-server/_libs/character-entities.mjs +0 -2130
- package/dist/web-server/_libs/character-reference-invalid.mjs +0 -33
- package/dist/web-server/_libs/class-variance-authority.mjs +0 -44
- package/dist/web-server/_libs/clsx.mjs +0 -16
- package/dist/web-server/_libs/comma-separated-tokens.mjs +0 -31
- package/dist/web-server/_libs/cookie-es.mjs +0 -44
- package/dist/web-server/_libs/croner.mjs +0 -1
- package/dist/web-server/_libs/crossws.mjs +0 -1
- package/dist/web-server/_libs/decode-named-character-reference+[...].mjs +0 -8
- package/dist/web-server/_libs/devlop.mjs +0 -8
- package/dist/web-server/_libs/escape-string-regexp.mjs +0 -9
- package/dist/web-server/_libs/estree-util-is-identifier-name.mjs +0 -11
- package/dist/web-server/_libs/extend.mjs +0 -97
- package/dist/web-server/_libs/fault.mjs +0 -1
- package/dist/web-server/_libs/floating-ui__core.mjs +0 -663
- package/dist/web-server/_libs/floating-ui__dom.mjs +0 -624
- package/dist/web-server/_libs/floating-ui__react-dom.mjs +0 -279
- package/dist/web-server/_libs/floating-ui__utils.mjs +0 -322
- package/dist/web-server/_libs/format.mjs +0 -1
- package/dist/web-server/_libs/h3.mjs +0 -408
- package/dist/web-server/_libs/hast-util-parse-selector.mjs +0 -39
- package/dist/web-server/_libs/hast-util-to-jsx-runtime.mjs +0 -388
- package/dist/web-server/_libs/hast-util-whitespace.mjs +0 -10
- package/dist/web-server/_libs/hastscript.mjs +0 -200
- package/dist/web-server/_libs/highlight.js.mjs +0 -1
- package/dist/web-server/_libs/hookable.mjs +0 -1
- package/dist/web-server/_libs/html-url-attributes.mjs +0 -26
- package/dist/web-server/_libs/inline-style-parser.mjs +0 -142
- package/dist/web-server/_libs/is-alphabetical.mjs +0 -7
- package/dist/web-server/_libs/is-alphanumerical.mjs +0 -8
- package/dist/web-server/_libs/is-decimal.mjs +0 -7
- package/dist/web-server/_libs/is-hexadecimal.mjs +0 -7
- package/dist/web-server/_libs/is-plain-obj.mjs +0 -10
- package/dist/web-server/_libs/isbot.mjs +0 -21
- package/dist/web-server/_libs/longest-streak.mjs +0 -25
- package/dist/web-server/_libs/lowlight.mjs +0 -1
- package/dist/web-server/_libs/markdown-table.mjs +0 -142
- package/dist/web-server/_libs/mdast-util-find-and-replace.mjs +0 -109
- package/dist/web-server/_libs/mdast-util-from-markdown.mjs +0 -717
- package/dist/web-server/_libs/mdast-util-gfm-autolink-literal+[...].mjs +0 -156
- package/dist/web-server/_libs/mdast-util-gfm-footnote.mjs +0 -117
- package/dist/web-server/_libs/mdast-util-gfm-strikethrough.mjs +0 -54
- package/dist/web-server/_libs/mdast-util-gfm-table.mjs +0 -157
- package/dist/web-server/_libs/mdast-util-gfm-task-list-item.mjs +0 -77
- package/dist/web-server/_libs/mdast-util-gfm.mjs +0 -29
- package/dist/web-server/_libs/mdast-util-phrasing.mjs +0 -30
- package/dist/web-server/_libs/mdast-util-to-hast.mjs +0 -710
- package/dist/web-server/_libs/mdast-util-to-markdown.mjs +0 -798
- package/dist/web-server/_libs/mdast-util-to-string.mjs +0 -38
- package/dist/web-server/_libs/micromark-core-commonmark.mjs +0 -2259
- package/dist/web-server/_libs/micromark-extension-gfm-autolink-literal+[...].mjs +0 -344
- package/dist/web-server/_libs/micromark-extension-gfm-footnote+[...].mjs +0 -279
- package/dist/web-server/_libs/micromark-extension-gfm-strikethrough+[...].mjs +0 -98
- package/dist/web-server/_libs/micromark-extension-gfm-table.mjs +0 -491
- package/dist/web-server/_libs/micromark-extension-gfm-tagfilter+[...].mjs +0 -1
- package/dist/web-server/_libs/micromark-extension-gfm-task-list-item+[...].mjs +0 -77
- package/dist/web-server/_libs/micromark-extension-gfm.mjs +0 -18
- package/dist/web-server/_libs/micromark-factory-destination.mjs +0 -94
- package/dist/web-server/_libs/micromark-factory-label.mjs +0 -63
- package/dist/web-server/_libs/micromark-factory-space.mjs +0 -24
- package/dist/web-server/_libs/micromark-factory-title.mjs +0 -65
- package/dist/web-server/_libs/micromark-factory-whitespace.mjs +0 -22
- package/dist/web-server/_libs/micromark-util-character.mjs +0 -44
- package/dist/web-server/_libs/micromark-util-chunked.mjs +0 -36
- package/dist/web-server/_libs/micromark-util-classify-character+[...].mjs +0 -12
- package/dist/web-server/_libs/micromark-util-combine-extensions+[...].mjs +0 -41
- package/dist/web-server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +0 -19
- package/dist/web-server/_libs/micromark-util-decode-string.mjs +0 -21
- package/dist/web-server/_libs/micromark-util-encode.mjs +0 -1
- package/dist/web-server/_libs/micromark-util-html-tag-name.mjs +0 -69
- package/dist/web-server/_libs/micromark-util-normalize-identifier+[...].mjs +0 -6
- package/dist/web-server/_libs/micromark-util-resolve-all.mjs +0 -15
- package/dist/web-server/_libs/micromark-util-sanitize-uri.mjs +0 -41
- package/dist/web-server/_libs/micromark-util-subtokenize.mjs +0 -346
- package/dist/web-server/_libs/micromark.mjs +0 -906
- package/dist/web-server/_libs/ocache.mjs +0 -1
- package/dist/web-server/_libs/ohash.mjs +0 -1
- package/dist/web-server/_libs/parse-entities.mjs +0 -245
- package/dist/web-server/_libs/property-information.mjs +0 -1210
- package/dist/web-server/_libs/react-dom.mjs +0 -10779
- package/dist/web-server/_libs/react-markdown.mjs +0 -147
- package/dist/web-server/_libs/react-syntax-highlighter.mjs +0 -941
- package/dist/web-server/_libs/react.mjs +0 -513
- package/dist/web-server/_libs/refractor.mjs +0 -2425
- package/dist/web-server/_libs/remark-gfm.mjs +0 -20
- package/dist/web-server/_libs/remark-parse.mjs +0 -19
- package/dist/web-server/_libs/remark-rehype.mjs +0 -21
- package/dist/web-server/_libs/reselect.mjs +0 -1
- package/dist/web-server/_libs/rou3.mjs +0 -8
- package/dist/web-server/_libs/seroval-plugins.mjs +0 -58
- package/dist/web-server/_libs/seroval.mjs +0 -1775
- package/dist/web-server/_libs/space-separated-tokens.mjs +0 -11
- package/dist/web-server/_libs/srvx.mjs +0 -781
- package/dist/web-server/_libs/style-to-js.mjs +0 -72
- package/dist/web-server/_libs/style-to-object.mjs +0 -38
- package/dist/web-server/_libs/tabler__icons-react.mjs +0 -230
- package/dist/web-server/_libs/tanstack__history.mjs +0 -204
- package/dist/web-server/_libs/tanstack__query-core.mjs +0 -2552
- package/dist/web-server/_libs/tanstack__react-query.mjs +0 -190
- package/dist/web-server/_libs/tanstack__react-router.mjs +0 -1120
- package/dist/web-server/_libs/tanstack__react-store.mjs +0 -2
- package/dist/web-server/_libs/tanstack__router-core.mjs +0 -4288
- package/dist/web-server/_libs/tanstack__store.mjs +0 -1
- package/dist/web-server/_libs/trim-lines.mjs +0 -41
- package/dist/web-server/_libs/trough.mjs +0 -85
- package/dist/web-server/_libs/ufo.mjs +0 -54
- package/dist/web-server/_libs/unctx.mjs +0 -1
- package/dist/web-server/_libs/ungap__structured-clone.mjs +0 -224
- package/dist/web-server/_libs/unified.mjs +0 -661
- package/dist/web-server/_libs/unist-util-is.mjs +0 -100
- package/dist/web-server/_libs/unist-util-position.mjs +0 -27
- package/dist/web-server/_libs/unist-util-stringify-position.mjs +0 -27
- package/dist/web-server/_libs/unist-util-visit-parents.mjs +0 -83
- package/dist/web-server/_libs/unist-util-visit.mjs +0 -24
- package/dist/web-server/_libs/unstorage.mjs +0 -1
- package/dist/web-server/_libs/use-sync-external-store.mjs +0 -139
- package/dist/web-server/_libs/vfile-message.mjs +0 -138
- package/dist/web-server/_libs/vfile.mjs +0 -467
- package/dist/web-server/_libs/zod.mjs +0 -3915
- package/dist/web-server/_libs/zustand.mjs +0 -343
- package/dist/web-server/_libs/zwitch.mjs +0 -1
- package/dist/web-server/_ssr/index-0n2Z3BPQ.mjs +0 -369
- package/dist/web-server/_ssr/index-6itDALOw.mjs +0 -339
- package/dist/web-server/_ssr/index-BIRTrOmp.mjs +0 -449
- package/dist/web-server/_ssr/index-BPzfADac.mjs +0 -66
- package/dist/web-server/_ssr/index-BQE3bF14.mjs +0 -1870
- package/dist/web-server/_ssr/index-C5HpvlUP.mjs +0 -190
- package/dist/web-server/_ssr/index-C_ZxnypN.mjs +0 -213
- package/dist/web-server/_ssr/index-Ca8JFH8f.mjs +0 -612
- package/dist/web-server/_ssr/index-DNVESZiA.mjs +0 -513
- package/dist/web-server/_ssr/index.mjs +0 -1558
- package/dist/web-server/_ssr/input-CqXjTRQg.mjs +0 -20
- package/dist/web-server/_ssr/queries-3H_19mUt.mjs +0 -16
- package/dist/web-server/_ssr/router-sbsNus0Y.mjs +0 -2093
- package/dist/web-server/_ssr/start-HYkvq4Ni.mjs +0 -4
- package/dist/web-server/_ssr/switch-usf2F1UM.mjs +0 -33
- package/dist/web-server/_ssr/syntax-highlighter-5vezNTce.mjs +0 -62
- package/dist/web-server/_ssr/textarea-DfRheWY0.mjs +0 -18
- package/dist/web-server/_tanstack-start-manifest_v-DqW-pKEH.mjs +0 -4
- package/dist/web-server/index.mjs +0 -597
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
import { R as React } from "./react.mjs";
|
|
2
|
-
const createStoreImpl = (createState) => {
|
|
3
|
-
let state;
|
|
4
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
5
|
-
const setState = (partial, replace) => {
|
|
6
|
-
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
7
|
-
if (!Object.is(nextState, state)) {
|
|
8
|
-
const previousState = state;
|
|
9
|
-
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
10
|
-
listeners.forEach((listener) => listener(state, previousState));
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const getState = () => state;
|
|
14
|
-
const getInitialState = () => initialState;
|
|
15
|
-
const subscribe = (listener) => {
|
|
16
|
-
listeners.add(listener);
|
|
17
|
-
return () => listeners.delete(listener);
|
|
18
|
-
};
|
|
19
|
-
const api = { setState, getState, getInitialState, subscribe };
|
|
20
|
-
const initialState = state = createState(setState, getState, api);
|
|
21
|
-
return api;
|
|
22
|
-
};
|
|
23
|
-
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
24
|
-
const identity = (arg) => arg;
|
|
25
|
-
function useStore(api, selector = identity) {
|
|
26
|
-
const slice = React.useSyncExternalStore(
|
|
27
|
-
api.subscribe,
|
|
28
|
-
React.useCallback(() => selector(api.getState()), [api, selector]),
|
|
29
|
-
React.useCallback(() => selector(api.getInitialState()), [api, selector])
|
|
30
|
-
);
|
|
31
|
-
React.useDebugValue(slice);
|
|
32
|
-
return slice;
|
|
33
|
-
}
|
|
34
|
-
const createImpl = (createState) => {
|
|
35
|
-
const api = createStore(createState);
|
|
36
|
-
const useBoundStore = (selector) => useStore(api, selector);
|
|
37
|
-
Object.assign(useBoundStore, api);
|
|
38
|
-
return useBoundStore;
|
|
39
|
-
};
|
|
40
|
-
const create = ((createState) => createImpl);
|
|
41
|
-
const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": true, "TSS_DEV_SERVER": "false", "TSS_DEV_SSR_STYLES_BASEPATH": "/", "TSS_DEV_SSR_STYLES_ENABLED": "true", "TSS_INLINE_CSS_ENABLED": "false", "TSS_ROUTER_BASEPATH": "", "TSS_SERVER_FN_BASE": "/_serverFn/" };
|
|
42
|
-
const shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === "function";
|
|
43
|
-
const trackedConnections = /* @__PURE__ */ new Map();
|
|
44
|
-
const getTrackedConnectionState = (name) => {
|
|
45
|
-
const api = trackedConnections.get(name);
|
|
46
|
-
if (!api) return {};
|
|
47
|
-
return Object.fromEntries(
|
|
48
|
-
Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
const extractConnectionInformation = (store, extensionConnector, options) => {
|
|
52
|
-
if (store === void 0) {
|
|
53
|
-
return {
|
|
54
|
-
type: "untracked",
|
|
55
|
-
connection: extensionConnector.connect(options)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const existingConnection = trackedConnections.get(options.name);
|
|
59
|
-
if (existingConnection) {
|
|
60
|
-
return { type: "tracked", store, ...existingConnection };
|
|
61
|
-
}
|
|
62
|
-
const newConnection = {
|
|
63
|
-
connection: extensionConnector.connect(options),
|
|
64
|
-
stores: {}
|
|
65
|
-
};
|
|
66
|
-
trackedConnections.set(options.name, newConnection);
|
|
67
|
-
return { type: "tracked", store, ...newConnection };
|
|
68
|
-
};
|
|
69
|
-
const removeStoreFromTrackedConnections = (name, store) => {
|
|
70
|
-
if (store === void 0) return;
|
|
71
|
-
const connectionInfo = trackedConnections.get(name);
|
|
72
|
-
if (!connectionInfo) return;
|
|
73
|
-
delete connectionInfo.stores[store];
|
|
74
|
-
if (Object.keys(connectionInfo.stores).length === 0) {
|
|
75
|
-
trackedConnections.delete(name);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const v8StackLineRe = /.+ (.+) .+/;
|
|
79
|
-
const geckoStackLineRe = /^([^@]+)@/;
|
|
80
|
-
function findCallerName(stack) {
|
|
81
|
-
var _a, _b, _c;
|
|
82
|
-
if (!stack) return void 0;
|
|
83
|
-
const traceLines = stack.split("\n");
|
|
84
|
-
const apiSetStateLineIndex = traceLines.findIndex(
|
|
85
|
-
(traceLine) => traceLine.includes("api.setState")
|
|
86
|
-
);
|
|
87
|
-
if (apiSetStateLineIndex < 0) return void 0;
|
|
88
|
-
const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || "";
|
|
89
|
-
return ((_b = v8StackLineRe.exec(callerLine)) == null ? void 0 : _b[1]) || ((_c = geckoStackLineRe.exec(callerLine)) == null ? void 0 : _c[1]);
|
|
90
|
-
}
|
|
91
|
-
const devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {
|
|
92
|
-
const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;
|
|
93
|
-
let extensionConnector;
|
|
94
|
-
try {
|
|
95
|
-
extensionConnector = (enabled != null ? enabled : (__vite_import_meta_env__ ? "production" : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
96
|
-
} catch (e) {
|
|
97
|
-
}
|
|
98
|
-
if (!extensionConnector) {
|
|
99
|
-
return fn(set, get, api);
|
|
100
|
-
}
|
|
101
|
-
const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);
|
|
102
|
-
let isRecording = true;
|
|
103
|
-
api.setState = ((state, replace, nameOrAction) => {
|
|
104
|
-
const r = set(state, replace);
|
|
105
|
-
if (!isRecording) return r;
|
|
106
|
-
const action = nameOrAction === void 0 ? {
|
|
107
|
-
type: anonymousActionType || findCallerName(new Error().stack) || "anonymous"
|
|
108
|
-
} : typeof nameOrAction === "string" ? { type: nameOrAction } : nameOrAction;
|
|
109
|
-
if (store === void 0) {
|
|
110
|
-
connection == null ? void 0 : connection.send(action, get());
|
|
111
|
-
return r;
|
|
112
|
-
}
|
|
113
|
-
connection == null ? void 0 : connection.send(
|
|
114
|
-
{
|
|
115
|
-
...action,
|
|
116
|
-
type: `${store}/${action.type}`
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
...getTrackedConnectionState(options.name),
|
|
120
|
-
[store]: api.getState()
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
return r;
|
|
124
|
-
});
|
|
125
|
-
api.devtools = {
|
|
126
|
-
cleanup: () => {
|
|
127
|
-
if (connection && typeof connection.unsubscribe === "function") {
|
|
128
|
-
connection.unsubscribe();
|
|
129
|
-
}
|
|
130
|
-
removeStoreFromTrackedConnections(options.name, store);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const setStateFromDevtools = (...a) => {
|
|
134
|
-
const originalIsRecording = isRecording;
|
|
135
|
-
isRecording = false;
|
|
136
|
-
set(...a);
|
|
137
|
-
isRecording = originalIsRecording;
|
|
138
|
-
};
|
|
139
|
-
const initialState = fn(api.setState, get, api);
|
|
140
|
-
if (connectionInformation.type === "untracked") {
|
|
141
|
-
connection == null ? void 0 : connection.init(initialState);
|
|
142
|
-
} else {
|
|
143
|
-
connectionInformation.stores[connectionInformation.store] = api;
|
|
144
|
-
connection == null ? void 0 : connection.init(
|
|
145
|
-
Object.fromEntries(
|
|
146
|
-
Object.entries(connectionInformation.stores).map(([key, store2]) => [
|
|
147
|
-
key,
|
|
148
|
-
key === connectionInformation.store ? initialState : store2.getState()
|
|
149
|
-
])
|
|
150
|
-
)
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
if (shouldDispatchFromDevtools(api)) {
|
|
154
|
-
let didWarnAboutReservedActionType = false;
|
|
155
|
-
const originalDispatch = api.dispatch;
|
|
156
|
-
api.dispatch = (...args) => {
|
|
157
|
-
if ((__vite_import_meta_env__ ? "production" : void 0) !== "production" && args[0].type === "__setState" && !didWarnAboutReservedActionType) {
|
|
158
|
-
console.warn(
|
|
159
|
-
'[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'
|
|
160
|
-
);
|
|
161
|
-
didWarnAboutReservedActionType = true;
|
|
162
|
-
}
|
|
163
|
-
originalDispatch(...args);
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
connection.subscribe((message) => {
|
|
167
|
-
var _a;
|
|
168
|
-
switch (message.type) {
|
|
169
|
-
case "ACTION":
|
|
170
|
-
if (typeof message.payload !== "string") {
|
|
171
|
-
console.error(
|
|
172
|
-
"[zustand devtools middleware] Unsupported action format"
|
|
173
|
-
);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
return parseJsonThen(
|
|
177
|
-
message.payload,
|
|
178
|
-
(action) => {
|
|
179
|
-
if (action.type === "__setState") {
|
|
180
|
-
if (store === void 0) {
|
|
181
|
-
setStateFromDevtools(action.state);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (Object.keys(action.state).length !== 1) {
|
|
185
|
-
console.error(
|
|
186
|
-
`
|
|
187
|
-
[zustand devtools middleware] Unsupported __setState action format.
|
|
188
|
-
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
189
|
-
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
190
|
-
`
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
const stateFromDevtools = action.state[store];
|
|
194
|
-
if (stateFromDevtools === void 0 || stateFromDevtools === null) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {
|
|
198
|
-
setStateFromDevtools(stateFromDevtools);
|
|
199
|
-
}
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (shouldDispatchFromDevtools(api)) {
|
|
203
|
-
api.dispatch(action);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
case "DISPATCH":
|
|
208
|
-
switch (message.payload.type) {
|
|
209
|
-
case "RESET":
|
|
210
|
-
setStateFromDevtools(initialState);
|
|
211
|
-
if (store === void 0) {
|
|
212
|
-
return connection == null ? void 0 : connection.init(api.getState());
|
|
213
|
-
}
|
|
214
|
-
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
215
|
-
case "COMMIT":
|
|
216
|
-
if (store === void 0) {
|
|
217
|
-
connection == null ? void 0 : connection.init(api.getState());
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
221
|
-
case "ROLLBACK":
|
|
222
|
-
return parseJsonThen(message.state, (state) => {
|
|
223
|
-
if (store === void 0) {
|
|
224
|
-
setStateFromDevtools(state);
|
|
225
|
-
connection == null ? void 0 : connection.init(api.getState());
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
setStateFromDevtools(state[store]);
|
|
229
|
-
connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
230
|
-
});
|
|
231
|
-
case "JUMP_TO_STATE":
|
|
232
|
-
case "JUMP_TO_ACTION":
|
|
233
|
-
return parseJsonThen(message.state, (state) => {
|
|
234
|
-
if (store === void 0) {
|
|
235
|
-
setStateFromDevtools(state);
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {
|
|
239
|
-
setStateFromDevtools(state[store]);
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
case "IMPORT_STATE": {
|
|
243
|
-
const { nextLiftedState } = message.payload;
|
|
244
|
-
const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;
|
|
245
|
-
if (!lastComputedState) return;
|
|
246
|
-
if (store === void 0) {
|
|
247
|
-
setStateFromDevtools(lastComputedState);
|
|
248
|
-
} else {
|
|
249
|
-
setStateFromDevtools(lastComputedState[store]);
|
|
250
|
-
}
|
|
251
|
-
connection == null ? void 0 : connection.send(
|
|
252
|
-
null,
|
|
253
|
-
// FIXME no-any
|
|
254
|
-
nextLiftedState
|
|
255
|
-
);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
case "PAUSE_RECORDING":
|
|
259
|
-
return isRecording = !isRecording;
|
|
260
|
-
}
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
return initialState;
|
|
265
|
-
};
|
|
266
|
-
const devtools = devtoolsImpl;
|
|
267
|
-
const parseJsonThen = (stringified, fn) => {
|
|
268
|
-
let parsed;
|
|
269
|
-
try {
|
|
270
|
-
parsed = JSON.parse(stringified);
|
|
271
|
-
} catch (e) {
|
|
272
|
-
console.error(
|
|
273
|
-
"[zustand devtools middleware] Could not parse the received json",
|
|
274
|
-
e
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
if (parsed !== void 0) fn(parsed);
|
|
278
|
-
};
|
|
279
|
-
const isIterable = (obj) => Symbol.iterator in obj;
|
|
280
|
-
const hasIterableEntries = (value) => (
|
|
281
|
-
// HACK: avoid checking entries type
|
|
282
|
-
"entries" in value
|
|
283
|
-
);
|
|
284
|
-
const compareEntries = (valueA, valueB) => {
|
|
285
|
-
const mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());
|
|
286
|
-
const mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());
|
|
287
|
-
if (mapA.size !== mapB.size) {
|
|
288
|
-
return false;
|
|
289
|
-
}
|
|
290
|
-
for (const [key, value] of mapA) {
|
|
291
|
-
if (!mapB.has(key) || !Object.is(value, mapB.get(key))) {
|
|
292
|
-
return false;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return true;
|
|
296
|
-
};
|
|
297
|
-
const compareIterables = (valueA, valueB) => {
|
|
298
|
-
const iteratorA = valueA[Symbol.iterator]();
|
|
299
|
-
const iteratorB = valueB[Symbol.iterator]();
|
|
300
|
-
let nextA = iteratorA.next();
|
|
301
|
-
let nextB = iteratorB.next();
|
|
302
|
-
while (!nextA.done && !nextB.done) {
|
|
303
|
-
if (!Object.is(nextA.value, nextB.value)) {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
nextA = iteratorA.next();
|
|
307
|
-
nextB = iteratorB.next();
|
|
308
|
-
}
|
|
309
|
-
return !!nextA.done && !!nextB.done;
|
|
310
|
-
};
|
|
311
|
-
function shallow(valueA, valueB) {
|
|
312
|
-
if (Object.is(valueA, valueB)) {
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
if (typeof valueA !== "object" || valueA === null || typeof valueB !== "object" || valueB === null) {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
if (Object.getPrototypeOf(valueA) !== Object.getPrototypeOf(valueB)) {
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
if (isIterable(valueA) && isIterable(valueB)) {
|
|
322
|
-
if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {
|
|
323
|
-
return compareEntries(valueA, valueB);
|
|
324
|
-
}
|
|
325
|
-
return compareIterables(valueA, valueB);
|
|
326
|
-
}
|
|
327
|
-
return compareEntries(
|
|
328
|
-
{ entries: () => Object.entries(valueA) },
|
|
329
|
-
{ entries: () => Object.entries(valueB) }
|
|
330
|
-
);
|
|
331
|
-
}
|
|
332
|
-
function useShallow(selector) {
|
|
333
|
-
const prev = React.useRef(void 0);
|
|
334
|
-
return (state) => {
|
|
335
|
-
const next = selector(state);
|
|
336
|
-
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
export {
|
|
340
|
-
create as c,
|
|
341
|
-
devtools as d,
|
|
342
|
-
useShallow as u
|
|
343
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|