init
This commit is contained in:
73
mc_test/node_modules/zustand/system/context.development.js
generated
vendored
Executable file
73
mc_test/node_modules/zustand/system/context.development.js
generated
vendored
Executable file
@ -0,0 +1,73 @@
|
||||
System.register(['react', 'zustand/traditional'], (function (exports) {
|
||||
'use strict';
|
||||
var ReactExports, useStoreWithEqualityFn;
|
||||
return {
|
||||
setters: [function (module) {
|
||||
ReactExports = module.default;
|
||||
}, function (module) {
|
||||
useStoreWithEqualityFn = module.useStoreWithEqualityFn;
|
||||
}],
|
||||
execute: (function () {
|
||||
|
||||
exports("default", createContext);
|
||||
|
||||
const {
|
||||
createElement,
|
||||
createContext: reactCreateContext,
|
||||
useContext,
|
||||
useMemo,
|
||||
useRef
|
||||
} = ReactExports;
|
||||
function createContext() {
|
||||
{
|
||||
console.warn(
|
||||
"[DEPRECATED] `context` will be removed in a future version. Instead use `import { createStore, useStore } from 'zustand'`. See: https://github.com/pmndrs/zustand/discussions/1180."
|
||||
);
|
||||
}
|
||||
const ZustandContext = reactCreateContext(void 0);
|
||||
const Provider = ({
|
||||
createStore,
|
||||
children
|
||||
}) => {
|
||||
const storeRef = useRef();
|
||||
if (!storeRef.current) {
|
||||
storeRef.current = createStore();
|
||||
}
|
||||
return createElement(
|
||||
ZustandContext.Provider,
|
||||
{ value: storeRef.current },
|
||||
children
|
||||
);
|
||||
};
|
||||
const useContextStore = (selector, equalityFn) => {
|
||||
const store = useContext(ZustandContext);
|
||||
if (!store) {
|
||||
throw new Error(
|
||||
"Seems like you have not used zustand provider as an ancestor."
|
||||
);
|
||||
}
|
||||
return useStoreWithEqualityFn(
|
||||
store,
|
||||
selector,
|
||||
equalityFn
|
||||
);
|
||||
};
|
||||
const useStoreApi = () => {
|
||||
const store = useContext(ZustandContext);
|
||||
if (!store) {
|
||||
throw new Error(
|
||||
"Seems like you have not used zustand provider as an ancestor."
|
||||
);
|
||||
}
|
||||
return useMemo(() => ({ ...store }), [store]);
|
||||
};
|
||||
return {
|
||||
Provider,
|
||||
useStore: useContextStore,
|
||||
useStoreApi
|
||||
};
|
||||
}
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/context.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/context.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register(["react","zustand/traditional"],function(a){"use strict";var o,s;return{setters:[function(r){o=r.default},function(r){s=r.useStoreWithEqualityFn}],execute:function(){a("default",l);const{createElement:r,createContext:c,useContext:i,useMemo:d,useRef:f}=o;function l(){const n=c(void 0);return{Provider:({createStore:e,children:u})=>{const t=f();return t.current||(t.current=e()),r(n.Provider,{value:t.current},u)},useStore:(e,u)=>{const t=i(n);if(!t)throw new Error("Seems like you have not used zustand provider as an ancestor.");return s(t,e,u)},useStoreApi:()=>{const e=i(n);if(!e)throw new Error("Seems like you have not used zustand provider as an ancestor.");return d(()=>({...e}),[e])}}}}}});
|
||||
71
mc_test/node_modules/zustand/system/index.development.js
generated
vendored
Executable file
71
mc_test/node_modules/zustand/system/index.development.js
generated
vendored
Executable file
@ -0,0 +1,71 @@
|
||||
System.register(['zustand/vanilla', 'react', 'use-sync-external-store/shim/with-selector'], (function (exports) {
|
||||
'use strict';
|
||||
var _starExcludes = {
|
||||
__proto__: null,
|
||||
create: 1,
|
||||
default: 1,
|
||||
useStore: 1
|
||||
};
|
||||
var createStore, ReactExports, useSyncExternalStoreExports;
|
||||
return {
|
||||
setters: [function (module) {
|
||||
createStore = module.createStore;
|
||||
var setter = { __proto__: null };
|
||||
for (var name in module) {
|
||||
if (!_starExcludes[name]) setter[name] = module[name];
|
||||
}
|
||||
exports(setter);
|
||||
}, function (module) {
|
||||
ReactExports = module.default;
|
||||
}, function (module) {
|
||||
useSyncExternalStoreExports = module.default;
|
||||
}],
|
||||
execute: (function () {
|
||||
|
||||
exports("useStore", useStore);
|
||||
|
||||
const { useDebugValue } = ReactExports;
|
||||
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
|
||||
let didWarnAboutEqualityFn = false;
|
||||
const identity = (arg) => arg;
|
||||
function useStore(api, selector = identity, equalityFn) {
|
||||
if (equalityFn && !didWarnAboutEqualityFn) {
|
||||
console.warn(
|
||||
"[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"
|
||||
);
|
||||
didWarnAboutEqualityFn = true;
|
||||
}
|
||||
const slice = useSyncExternalStoreWithSelector(
|
||||
api.subscribe,
|
||||
api.getState,
|
||||
api.getServerState || api.getInitialState,
|
||||
selector,
|
||||
equalityFn
|
||||
);
|
||||
useDebugValue(slice);
|
||||
return slice;
|
||||
}
|
||||
const createImpl = (createState) => {
|
||||
if (typeof createState !== "function") {
|
||||
console.warn(
|
||||
"[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`."
|
||||
);
|
||||
}
|
||||
const api = typeof createState === "function" ? createStore(createState) : createState;
|
||||
const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
|
||||
Object.assign(useBoundStore, api);
|
||||
return useBoundStore;
|
||||
};
|
||||
const create = exports("create", (createState) => createState ? createImpl(createState) : createImpl);
|
||||
var react = exports("default", (createState) => {
|
||||
{
|
||||
console.warn(
|
||||
"[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`."
|
||||
);
|
||||
}
|
||||
return create(createState);
|
||||
});
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/index.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/index.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register(["zustand/vanilla","react","use-sync-external-store/shim/with-selector"],function(n){"use strict";var _={__proto__:null,create:1,default:1,useStore:1},o,i,l;return{setters:[function(t){o=t.createStore;var c={__proto__:null};for(var r in t)_[r]||(c[r]=t[r]);n(c)},function(t){i=t.default},function(t){l=t.default}],execute:function(){n("useStore",f);const{useDebugValue:t}=i,{useSyncExternalStoreWithSelector:c}=l,r=e=>e;function f(e,s=r,u){const a=c(e.subscribe,e.getState,e.getServerState||e.getInitialState,s,u);return t(a),a}const S=e=>{const s=typeof e=="function"?o(e):e,u=(a,g)=>f(s,a,g);return Object.assign(u,s),u},v=n("create",e=>e?S(e):S);var d=n("default",e=>v(e))}}});
|
||||
592
mc_test/node_modules/zustand/system/middleware.development.js
generated
vendored
Executable file
592
mc_test/node_modules/zustand/system/middleware.development.js
generated
vendored
Executable file
@ -0,0 +1,592 @@
|
||||
System.register([], (function (exports) {
|
||||
'use strict';
|
||||
return {
|
||||
execute: (function () {
|
||||
|
||||
exports("createJSONStorage", createJSONStorage);
|
||||
|
||||
const reduxImpl = (reducer, initial) => (set, _get, api) => {
|
||||
api.dispatch = (action) => {
|
||||
set((state) => reducer(state, action), false, action);
|
||||
return action;
|
||||
};
|
||||
api.dispatchFromDevtools = true;
|
||||
return { dispatch: (...a) => api.dispatch(...a), ...initial };
|
||||
};
|
||||
const redux = exports("redux", reduxImpl);
|
||||
|
||||
const trackedConnections = /* @__PURE__ */ new Map();
|
||||
const getTrackedConnectionState = (name) => {
|
||||
const api = trackedConnections.get(name);
|
||||
if (!api) return {};
|
||||
return Object.fromEntries(
|
||||
Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])
|
||||
);
|
||||
};
|
||||
const extractConnectionInformation = (store, extensionConnector, options) => {
|
||||
if (store === void 0) {
|
||||
return {
|
||||
type: "untracked",
|
||||
connection: extensionConnector.connect(options)
|
||||
};
|
||||
}
|
||||
const existingConnection = trackedConnections.get(options.name);
|
||||
if (existingConnection) {
|
||||
return { type: "tracked", store, ...existingConnection };
|
||||
}
|
||||
const newConnection = {
|
||||
connection: extensionConnector.connect(options),
|
||||
stores: {}
|
||||
};
|
||||
trackedConnections.set(options.name, newConnection);
|
||||
return { type: "tracked", store, ...newConnection };
|
||||
};
|
||||
const devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {
|
||||
const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;
|
||||
let extensionConnector;
|
||||
try {
|
||||
extensionConnector = (enabled != null ? enabled : true) && window.__REDUX_DEVTOOLS_EXTENSION__;
|
||||
} catch (_e) {
|
||||
}
|
||||
if (!extensionConnector) {
|
||||
if (enabled) {
|
||||
console.warn(
|
||||
"[zustand devtools middleware] Please install/enable Redux devtools extension"
|
||||
);
|
||||
}
|
||||
return fn(set, get, api);
|
||||
}
|
||||
const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);
|
||||
let isRecording = true;
|
||||
api.setState = (state, replace, nameOrAction) => {
|
||||
const r = set(state, replace);
|
||||
if (!isRecording) return r;
|
||||
const action = nameOrAction === void 0 ? { type: anonymousActionType || "anonymous" } : typeof nameOrAction === "string" ? { type: nameOrAction } : nameOrAction;
|
||||
if (store === void 0) {
|
||||
connection == null ? void 0 : connection.send(action, get());
|
||||
return r;
|
||||
}
|
||||
connection == null ? void 0 : connection.send(
|
||||
{
|
||||
...action,
|
||||
type: `${store}/${action.type}`
|
||||
},
|
||||
{
|
||||
...getTrackedConnectionState(options.name),
|
||||
[store]: api.getState()
|
||||
}
|
||||
);
|
||||
return r;
|
||||
};
|
||||
const setStateFromDevtools = (...a) => {
|
||||
const originalIsRecording = isRecording;
|
||||
isRecording = false;
|
||||
set(...a);
|
||||
isRecording = originalIsRecording;
|
||||
};
|
||||
const initialState = fn(api.setState, get, api);
|
||||
if (connectionInformation.type === "untracked") {
|
||||
connection == null ? void 0 : connection.init(initialState);
|
||||
} else {
|
||||
connectionInformation.stores[connectionInformation.store] = api;
|
||||
connection == null ? void 0 : connection.init(
|
||||
Object.fromEntries(
|
||||
Object.entries(connectionInformation.stores).map(([key, store2]) => [
|
||||
key,
|
||||
key === connectionInformation.store ? initialState : store2.getState()
|
||||
])
|
||||
)
|
||||
);
|
||||
}
|
||||
if (api.dispatchFromDevtools && typeof api.dispatch === "function") {
|
||||
let didWarnAboutReservedActionType = false;
|
||||
const originalDispatch = api.dispatch;
|
||||
api.dispatch = (...a) => {
|
||||
if (a[0].type === "__setState" && !didWarnAboutReservedActionType) {
|
||||
console.warn(
|
||||
'[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'
|
||||
);
|
||||
didWarnAboutReservedActionType = true;
|
||||
}
|
||||
originalDispatch(...a);
|
||||
};
|
||||
}
|
||||
connection.subscribe((message) => {
|
||||
var _a;
|
||||
switch (message.type) {
|
||||
case "ACTION":
|
||||
if (typeof message.payload !== "string") {
|
||||
console.error(
|
||||
"[zustand devtools middleware] Unsupported action format"
|
||||
);
|
||||
return;
|
||||
}
|
||||
return parseJsonThen(
|
||||
message.payload,
|
||||
(action) => {
|
||||
if (action.type === "__setState") {
|
||||
if (store === void 0) {
|
||||
setStateFromDevtools(action.state);
|
||||
return;
|
||||
}
|
||||
if (Object.keys(action.state).length !== 1) {
|
||||
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" } } }
|
||||
`
|
||||
);
|
||||
}
|
||||
const stateFromDevtools = action.state[store];
|
||||
if (stateFromDevtools === void 0 || stateFromDevtools === null) {
|
||||
return;
|
||||
}
|
||||
if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {
|
||||
setStateFromDevtools(stateFromDevtools);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!api.dispatchFromDevtools) return;
|
||||
if (typeof api.dispatch !== "function") return;
|
||||
api.dispatch(action);
|
||||
}
|
||||
);
|
||||
case "DISPATCH":
|
||||
switch (message.payload.type) {
|
||||
case "RESET":
|
||||
setStateFromDevtools(initialState);
|
||||
if (store === void 0) {
|
||||
return connection == null ? void 0 : connection.init(api.getState());
|
||||
}
|
||||
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
||||
case "COMMIT":
|
||||
if (store === void 0) {
|
||||
connection == null ? void 0 : connection.init(api.getState());
|
||||
return;
|
||||
}
|
||||
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
||||
case "ROLLBACK":
|
||||
return parseJsonThen(message.state, (state) => {
|
||||
if (store === void 0) {
|
||||
setStateFromDevtools(state);
|
||||
connection == null ? void 0 : connection.init(api.getState());
|
||||
return;
|
||||
}
|
||||
setStateFromDevtools(state[store]);
|
||||
connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
||||
});
|
||||
case "JUMP_TO_STATE":
|
||||
case "JUMP_TO_ACTION":
|
||||
return parseJsonThen(message.state, (state) => {
|
||||
if (store === void 0) {
|
||||
setStateFromDevtools(state);
|
||||
return;
|
||||
}
|
||||
if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {
|
||||
setStateFromDevtools(state[store]);
|
||||
}
|
||||
});
|
||||
case "IMPORT_STATE": {
|
||||
const { nextLiftedState } = message.payload;
|
||||
const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;
|
||||
if (!lastComputedState) return;
|
||||
if (store === void 0) {
|
||||
setStateFromDevtools(lastComputedState);
|
||||
} else {
|
||||
setStateFromDevtools(lastComputedState[store]);
|
||||
}
|
||||
connection == null ? void 0 : connection.send(
|
||||
null,
|
||||
// FIXME no-any
|
||||
nextLiftedState
|
||||
);
|
||||
return;
|
||||
}
|
||||
case "PAUSE_RECORDING":
|
||||
return isRecording = !isRecording;
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
return initialState;
|
||||
};
|
||||
const devtools = exports("devtools", devtoolsImpl);
|
||||
const parseJsonThen = (stringified, f) => {
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(stringified);
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"[zustand devtools middleware] Could not parse the received json",
|
||||
e
|
||||
);
|
||||
}
|
||||
if (parsed !== void 0) f(parsed);
|
||||
};
|
||||
|
||||
const subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
||||
const origSubscribe = api.subscribe;
|
||||
api.subscribe = (selector, optListener, options) => {
|
||||
let listener = selector;
|
||||
if (optListener) {
|
||||
const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
|
||||
let currentSlice = selector(api.getState());
|
||||
listener = (state) => {
|
||||
const nextSlice = selector(state);
|
||||
if (!equalityFn(currentSlice, nextSlice)) {
|
||||
const previousSlice = currentSlice;
|
||||
optListener(currentSlice = nextSlice, previousSlice);
|
||||
}
|
||||
};
|
||||
if (options == null ? void 0 : options.fireImmediately) {
|
||||
optListener(currentSlice, currentSlice);
|
||||
}
|
||||
}
|
||||
return origSubscribe(listener);
|
||||
};
|
||||
const initialState = fn(set, get, api);
|
||||
return initialState;
|
||||
};
|
||||
const subscribeWithSelector = exports("subscribeWithSelector", subscribeWithSelectorImpl);
|
||||
|
||||
const combine = exports("combine", (initialState, create) => (...a) => Object.assign({}, initialState, create(...a)));
|
||||
|
||||
function createJSONStorage(getStorage, options) {
|
||||
let storage;
|
||||
try {
|
||||
storage = getStorage();
|
||||
} catch (_e) {
|
||||
return;
|
||||
}
|
||||
const persistStorage = {
|
||||
getItem: (name) => {
|
||||
var _a;
|
||||
const parse = (str2) => {
|
||||
if (str2 === null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parse(str2, options == null ? void 0 : options.reviver);
|
||||
};
|
||||
const str = (_a = storage.getItem(name)) != null ? _a : null;
|
||||
if (str instanceof Promise) {
|
||||
return str.then(parse);
|
||||
}
|
||||
return parse(str);
|
||||
},
|
||||
setItem: (name, newValue) => storage.setItem(
|
||||
name,
|
||||
JSON.stringify(newValue, options == null ? void 0 : options.replacer)
|
||||
),
|
||||
removeItem: (name) => storage.removeItem(name)
|
||||
};
|
||||
return persistStorage;
|
||||
}
|
||||
const toThenable = (fn) => (input) => {
|
||||
try {
|
||||
const result = fn(input);
|
||||
if (result instanceof Promise) {
|
||||
return result;
|
||||
}
|
||||
return {
|
||||
then(onFulfilled) {
|
||||
return toThenable(onFulfilled)(result);
|
||||
},
|
||||
catch(_onRejected) {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
then(_onFulfilled) {
|
||||
return this;
|
||||
},
|
||||
catch(onRejected) {
|
||||
return toThenable(onRejected)(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
const oldImpl = (config, baseOptions) => (set, get, api) => {
|
||||
let options = {
|
||||
getStorage: () => localStorage,
|
||||
serialize: JSON.stringify,
|
||||
deserialize: JSON.parse,
|
||||
partialize: (state) => state,
|
||||
version: 0,
|
||||
merge: (persistedState, currentState) => ({
|
||||
...currentState,
|
||||
...persistedState
|
||||
}),
|
||||
...baseOptions
|
||||
};
|
||||
let hasHydrated = false;
|
||||
const hydrationListeners = /* @__PURE__ */ new Set();
|
||||
const finishHydrationListeners = /* @__PURE__ */ new Set();
|
||||
let storage;
|
||||
try {
|
||||
storage = options.getStorage();
|
||||
} catch (_e) {
|
||||
}
|
||||
if (!storage) {
|
||||
return config(
|
||||
(...args) => {
|
||||
console.warn(
|
||||
`[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
|
||||
);
|
||||
set(...args);
|
||||
},
|
||||
get,
|
||||
api
|
||||
);
|
||||
}
|
||||
const thenableSerialize = toThenable(options.serialize);
|
||||
const setItem = () => {
|
||||
const state = options.partialize({ ...get() });
|
||||
let errorInSync;
|
||||
const thenable = thenableSerialize({ state, version: options.version }).then(
|
||||
(serializedValue) => storage.setItem(options.name, serializedValue)
|
||||
).catch((e) => {
|
||||
errorInSync = e;
|
||||
});
|
||||
if (errorInSync) {
|
||||
throw errorInSync;
|
||||
}
|
||||
return thenable;
|
||||
};
|
||||
const savedSetState = api.setState;
|
||||
api.setState = (state, replace) => {
|
||||
savedSetState(state, replace);
|
||||
void setItem();
|
||||
};
|
||||
const configResult = config(
|
||||
(...args) => {
|
||||
set(...args);
|
||||
void setItem();
|
||||
},
|
||||
get,
|
||||
api
|
||||
);
|
||||
let stateFromStorage;
|
||||
const hydrate = () => {
|
||||
var _a;
|
||||
if (!storage) return;
|
||||
hasHydrated = false;
|
||||
hydrationListeners.forEach((cb) => cb(get()));
|
||||
const postRehydrationCallback = ((_a = options.onRehydrateStorage) == null ? void 0 : _a.call(options, get())) || void 0;
|
||||
return toThenable(storage.getItem.bind(storage))(options.name).then((storageValue) => {
|
||||
if (storageValue) {
|
||||
return options.deserialize(storageValue);
|
||||
}
|
||||
}).then((deserializedStorageValue) => {
|
||||
if (deserializedStorageValue) {
|
||||
if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
|
||||
if (options.migrate) {
|
||||
return options.migrate(
|
||||
deserializedStorageValue.state,
|
||||
deserializedStorageValue.version
|
||||
);
|
||||
}
|
||||
console.error(
|
||||
`State loaded from storage couldn't be migrated since no migrate function was provided`
|
||||
);
|
||||
} else {
|
||||
return deserializedStorageValue.state;
|
||||
}
|
||||
}
|
||||
}).then((migratedState) => {
|
||||
var _a2;
|
||||
stateFromStorage = options.merge(
|
||||
migratedState,
|
||||
(_a2 = get()) != null ? _a2 : configResult
|
||||
);
|
||||
set(stateFromStorage, true);
|
||||
return setItem();
|
||||
}).then(() => {
|
||||
postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
|
||||
hasHydrated = true;
|
||||
finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
|
||||
}).catch((e) => {
|
||||
postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
|
||||
});
|
||||
};
|
||||
api.persist = {
|
||||
setOptions: (newOptions) => {
|
||||
options = {
|
||||
...options,
|
||||
...newOptions
|
||||
};
|
||||
if (newOptions.getStorage) {
|
||||
storage = newOptions.getStorage();
|
||||
}
|
||||
},
|
||||
clearStorage: () => {
|
||||
storage == null ? void 0 : storage.removeItem(options.name);
|
||||
},
|
||||
getOptions: () => options,
|
||||
rehydrate: () => hydrate(),
|
||||
hasHydrated: () => hasHydrated,
|
||||
onHydrate: (cb) => {
|
||||
hydrationListeners.add(cb);
|
||||
return () => {
|
||||
hydrationListeners.delete(cb);
|
||||
};
|
||||
},
|
||||
onFinishHydration: (cb) => {
|
||||
finishHydrationListeners.add(cb);
|
||||
return () => {
|
||||
finishHydrationListeners.delete(cb);
|
||||
};
|
||||
}
|
||||
};
|
||||
hydrate();
|
||||
return stateFromStorage || configResult;
|
||||
};
|
||||
const newImpl = (config, baseOptions) => (set, get, api) => {
|
||||
let options = {
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
partialize: (state) => state,
|
||||
version: 0,
|
||||
merge: (persistedState, currentState) => ({
|
||||
...currentState,
|
||||
...persistedState
|
||||
}),
|
||||
...baseOptions
|
||||
};
|
||||
let hasHydrated = false;
|
||||
const hydrationListeners = /* @__PURE__ */ new Set();
|
||||
const finishHydrationListeners = /* @__PURE__ */ new Set();
|
||||
let storage = options.storage;
|
||||
if (!storage) {
|
||||
return config(
|
||||
(...args) => {
|
||||
console.warn(
|
||||
`[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
|
||||
);
|
||||
set(...args);
|
||||
},
|
||||
get,
|
||||
api
|
||||
);
|
||||
}
|
||||
const setItem = () => {
|
||||
const state = options.partialize({ ...get() });
|
||||
return storage.setItem(options.name, {
|
||||
state,
|
||||
version: options.version
|
||||
});
|
||||
};
|
||||
const savedSetState = api.setState;
|
||||
api.setState = (state, replace) => {
|
||||
savedSetState(state, replace);
|
||||
void setItem();
|
||||
};
|
||||
const configResult = config(
|
||||
(...args) => {
|
||||
set(...args);
|
||||
void setItem();
|
||||
},
|
||||
get,
|
||||
api
|
||||
);
|
||||
api.getInitialState = () => configResult;
|
||||
let stateFromStorage;
|
||||
const hydrate = () => {
|
||||
var _a, _b;
|
||||
if (!storage) return;
|
||||
hasHydrated = false;
|
||||
hydrationListeners.forEach((cb) => {
|
||||
var _a2;
|
||||
return cb((_a2 = get()) != null ? _a2 : configResult);
|
||||
});
|
||||
const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
|
||||
return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
|
||||
if (deserializedStorageValue) {
|
||||
if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
|
||||
if (options.migrate) {
|
||||
return [
|
||||
true,
|
||||
options.migrate(
|
||||
deserializedStorageValue.state,
|
||||
deserializedStorageValue.version
|
||||
)
|
||||
];
|
||||
}
|
||||
console.error(
|
||||
`State loaded from storage couldn't be migrated since no migrate function was provided`
|
||||
);
|
||||
} else {
|
||||
return [false, deserializedStorageValue.state];
|
||||
}
|
||||
}
|
||||
return [false, void 0];
|
||||
}).then((migrationResult) => {
|
||||
var _a2;
|
||||
const [migrated, migratedState] = migrationResult;
|
||||
stateFromStorage = options.merge(
|
||||
migratedState,
|
||||
(_a2 = get()) != null ? _a2 : configResult
|
||||
);
|
||||
set(stateFromStorage, true);
|
||||
if (migrated) {
|
||||
return setItem();
|
||||
}
|
||||
}).then(() => {
|
||||
postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
|
||||
stateFromStorage = get();
|
||||
hasHydrated = true;
|
||||
finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
|
||||
}).catch((e) => {
|
||||
postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
|
||||
});
|
||||
};
|
||||
api.persist = {
|
||||
setOptions: (newOptions) => {
|
||||
options = {
|
||||
...options,
|
||||
...newOptions
|
||||
};
|
||||
if (newOptions.storage) {
|
||||
storage = newOptions.storage;
|
||||
}
|
||||
},
|
||||
clearStorage: () => {
|
||||
storage == null ? void 0 : storage.removeItem(options.name);
|
||||
},
|
||||
getOptions: () => options,
|
||||
rehydrate: () => hydrate(),
|
||||
hasHydrated: () => hasHydrated,
|
||||
onHydrate: (cb) => {
|
||||
hydrationListeners.add(cb);
|
||||
return () => {
|
||||
hydrationListeners.delete(cb);
|
||||
};
|
||||
},
|
||||
onFinishHydration: (cb) => {
|
||||
finishHydrationListeners.add(cb);
|
||||
return () => {
|
||||
finishHydrationListeners.delete(cb);
|
||||
};
|
||||
}
|
||||
};
|
||||
if (!options.skipHydration) {
|
||||
hydrate();
|
||||
}
|
||||
return stateFromStorage || configResult;
|
||||
};
|
||||
const persistImpl = (config, baseOptions) => {
|
||||
if ("getStorage" in baseOptions || "serialize" in baseOptions || "deserialize" in baseOptions) {
|
||||
{
|
||||
console.warn(
|
||||
"[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."
|
||||
);
|
||||
}
|
||||
return oldImpl(config, baseOptions);
|
||||
}
|
||||
return newImpl(config, baseOptions);
|
||||
};
|
||||
const persist = exports("persist", persistImpl);
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
5
mc_test/node_modules/zustand/system/middleware.production.js
generated
vendored
Executable file
5
mc_test/node_modules/zustand/system/middleware.production.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
21
mc_test/node_modules/zustand/system/middleware/immer.development.js
generated
vendored
Executable file
21
mc_test/node_modules/zustand/system/middleware/immer.development.js
generated
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
System.register(['immer'], (function (exports) {
|
||||
'use strict';
|
||||
var produce;
|
||||
return {
|
||||
setters: [function (module) {
|
||||
produce = module.produce;
|
||||
}],
|
||||
execute: (function () {
|
||||
|
||||
const immerImpl = (initializer) => (set, get, store) => {
|
||||
store.setState = (updater, replace, ...a) => {
|
||||
const nextState = typeof updater === "function" ? produce(updater) : updater;
|
||||
return set(nextState, replace, ...a);
|
||||
};
|
||||
return initializer(store.setState, get, store);
|
||||
};
|
||||
const immer = exports("immer", immerImpl);
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/middleware/immer.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/middleware/immer.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register(["immer"],function(c){"use strict";var r;return{setters:[function(n){r=n.produce}],execute:function(){const S=c("immer",s=>(o,u,t)=>(t.setState=(e,i,...m)=>{const f=typeof e=="function"?r(e):e;return o(f,i,...m)},s(t.setState,u,t)))}}});
|
||||
60
mc_test/node_modules/zustand/system/react/shallow.development.js
generated
vendored
Executable file
60
mc_test/node_modules/zustand/system/react/shallow.development.js
generated
vendored
Executable file
@ -0,0 +1,60 @@
|
||||
System.register(['react'], (function (exports) {
|
||||
'use strict';
|
||||
var ReactExports;
|
||||
return {
|
||||
setters: [function (module) {
|
||||
ReactExports = module.default;
|
||||
}],
|
||||
execute: (function () {
|
||||
|
||||
exports("useShallow", useShallow);
|
||||
|
||||
function shallow(objA, objB) {
|
||||
if (Object.is(objA, objB)) {
|
||||
return true;
|
||||
}
|
||||
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
||||
return false;
|
||||
}
|
||||
if (objA instanceof Map && objB instanceof Map) {
|
||||
if (objA.size !== objB.size) return false;
|
||||
for (const [key, value] of objA) {
|
||||
if (!Object.is(value, objB.get(key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (objA instanceof Set && objB instanceof Set) {
|
||||
if (objA.size !== objB.size) return false;
|
||||
for (const value of objA) {
|
||||
if (!objB.has(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const keysA = Object.keys(objA);
|
||||
if (keysA.length !== Object.keys(objB).length) {
|
||||
return false;
|
||||
}
|
||||
for (const keyA of keysA) {
|
||||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const { useRef } = ReactExports;
|
||||
function useShallow(selector) {
|
||||
const prev = useRef();
|
||||
return (state) => {
|
||||
const next = selector(state);
|
||||
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
||||
};
|
||||
}
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/react/shallow.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/react/shallow.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register(["react"],function(o){"use strict";var c;return{setters:[function(s){c=s.default}],execute:function(){o("useShallow",u);function s(r,t){if(Object.is(r,t))return!0;if(typeof r!="object"||r===null||typeof t!="object"||t===null)return!1;if(r instanceof Map&&t instanceof Map){if(r.size!==t.size)return!1;for(const[e,i]of r)if(!Object.is(i,t.get(e)))return!1;return!0}if(r instanceof Set&&t instanceof Set){if(r.size!==t.size)return!1;for(const e of r)if(!t.has(e))return!1;return!0}const n=Object.keys(r);if(n.length!==Object.keys(t).length)return!1;for(const e of n)if(!Object.prototype.hasOwnProperty.call(t,e)||!Object.is(r[e],t[e]))return!1;return!0}const{useRef:f}=c;function u(r){const t=f();return n=>{const e=r(n);return s(t.current,e)?t.current:t.current=e}}}}});
|
||||
56
mc_test/node_modules/zustand/system/shallow.development.js
generated
vendored
Executable file
56
mc_test/node_modules/zustand/system/shallow.development.js
generated
vendored
Executable file
@ -0,0 +1,56 @@
|
||||
System.register([], (function (exports) {
|
||||
'use strict';
|
||||
return {
|
||||
execute: (function () {
|
||||
|
||||
exports("shallow", shallow$1);
|
||||
|
||||
function shallow$1(objA, objB) {
|
||||
if (Object.is(objA, objB)) {
|
||||
return true;
|
||||
}
|
||||
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
||||
return false;
|
||||
}
|
||||
if (objA instanceof Map && objB instanceof Map) {
|
||||
if (objA.size !== objB.size) return false;
|
||||
for (const [key, value] of objA) {
|
||||
if (!Object.is(value, objB.get(key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (objA instanceof Set && objB instanceof Set) {
|
||||
if (objA.size !== objB.size) return false;
|
||||
for (const value of objA) {
|
||||
if (!objB.has(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const keysA = Object.keys(objA);
|
||||
if (keysA.length !== Object.keys(objB).length) {
|
||||
return false;
|
||||
}
|
||||
for (const keyA of keysA) {
|
||||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
var shallow = exports("default", (objA, objB) => {
|
||||
{
|
||||
console.warn(
|
||||
"[DEPRECATED] Default export is deprecated. Instead use `import { shallow } from 'zustand/shallow'`."
|
||||
);
|
||||
}
|
||||
return shallow$1(objA, objB);
|
||||
});
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/shallow.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/shallow.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register([],function(n){"use strict";return{execute:function(){n("shallow",f);function f(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[e,o]of t)if(!Object.is(o,r.get(e)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const e of t)if(!r.has(e))return!1;return!0}const i=Object.keys(t);if(i.length!==Object.keys(r).length)return!1;for(const e of i)if(!Object.prototype.hasOwnProperty.call(r,e)||!Object.is(t[e],r[e]))return!1;return!0}var s=n("default",(t,r)=>f(t,r))}}});
|
||||
40
mc_test/node_modules/zustand/system/traditional.development.js
generated
vendored
Executable file
40
mc_test/node_modules/zustand/system/traditional.development.js
generated
vendored
Executable file
@ -0,0 +1,40 @@
|
||||
System.register(['react', 'use-sync-external-store/shim/with-selector', 'zustand/vanilla'], (function (exports) {
|
||||
'use strict';
|
||||
var ReactExports, useSyncExternalStoreExports, createStore;
|
||||
return {
|
||||
setters: [function (module) {
|
||||
ReactExports = module.default;
|
||||
}, function (module) {
|
||||
useSyncExternalStoreExports = module.default;
|
||||
}, function (module) {
|
||||
createStore = module.createStore;
|
||||
}],
|
||||
execute: (function () {
|
||||
|
||||
exports("useStoreWithEqualityFn", useStoreWithEqualityFn);
|
||||
|
||||
const { useDebugValue } = ReactExports;
|
||||
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
|
||||
const identity = (arg) => arg;
|
||||
function useStoreWithEqualityFn(api, selector = identity, equalityFn) {
|
||||
const slice = useSyncExternalStoreWithSelector(
|
||||
api.subscribe,
|
||||
api.getState,
|
||||
api.getServerState || api.getInitialState,
|
||||
selector,
|
||||
equalityFn
|
||||
);
|
||||
useDebugValue(slice);
|
||||
return slice;
|
||||
}
|
||||
const createWithEqualityFnImpl = (createState, defaultEqualityFn) => {
|
||||
const api = createStore(createState);
|
||||
const useBoundStoreWithEqualityFn = (selector, equalityFn = defaultEqualityFn) => useStoreWithEqualityFn(api, selector, equalityFn);
|
||||
Object.assign(useBoundStoreWithEqualityFn, api);
|
||||
return useBoundStoreWithEqualityFn;
|
||||
};
|
||||
const createWithEqualityFn = exports("createWithEqualityFn", (createState, defaultEqualityFn) => createState ? createWithEqualityFnImpl(createState, defaultEqualityFn) : createWithEqualityFnImpl);
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/traditional.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/traditional.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register(["react","use-sync-external-store/shim/with-selector","zustand/vanilla"],function(a){"use strict";var c,s,i;return{setters:[function(e){c=e.default},function(e){s=e.default},function(e){i=e.createStore}],execute:function(){a("useStoreWithEqualityFn",o);const{useDebugValue:e}=c,{useSyncExternalStoreWithSelector:S}=s,f=t=>t;function o(t,n=f,u){const r=S(t.subscribe,t.getState,t.getServerState||t.getInitialState,n,u);return e(r),r}const l=(t,n)=>{const u=i(t),r=(y,h=n)=>o(u,y,h);return Object.assign(r,u),r},g=a("createWithEqualityFn",(t,n)=>t?l(t,n):l)}}});
|
||||
47
mc_test/node_modules/zustand/system/vanilla.development.js
generated
vendored
Executable file
47
mc_test/node_modules/zustand/system/vanilla.development.js
generated
vendored
Executable file
@ -0,0 +1,47 @@
|
||||
System.register([], (function (exports) {
|
||||
'use strict';
|
||||
return {
|
||||
execute: (function () {
|
||||
|
||||
const createStoreImpl = (createState) => {
|
||||
let state;
|
||||
const listeners = /* @__PURE__ */ new Set();
|
||||
const setState = (partial, replace) => {
|
||||
const nextState = typeof partial === "function" ? partial(state) : partial;
|
||||
if (!Object.is(nextState, state)) {
|
||||
const previousState = state;
|
||||
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
||||
listeners.forEach((listener) => listener(state, previousState));
|
||||
}
|
||||
};
|
||||
const getState = () => state;
|
||||
const getInitialState = () => initialState;
|
||||
const subscribe = (listener) => {
|
||||
listeners.add(listener);
|
||||
return () => listeners.delete(listener);
|
||||
};
|
||||
const destroy = () => {
|
||||
{
|
||||
console.warn(
|
||||
"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
|
||||
);
|
||||
}
|
||||
listeners.clear();
|
||||
};
|
||||
const api = { setState, getState, getInitialState, subscribe, destroy };
|
||||
const initialState = state = createState(setState, getState, api);
|
||||
return api;
|
||||
};
|
||||
const createStore = exports("createStore", (createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
||||
var vanilla = exports("default", (createState) => {
|
||||
{
|
||||
console.warn(
|
||||
"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'."
|
||||
);
|
||||
}
|
||||
return createStore(createState);
|
||||
});
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/vanilla.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/vanilla.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register([],function(a){"use strict";return{execute:function(){const o=e=>{let t;const s=new Set,i=(c,l)=>{const n=typeof c=="function"?c(t):c;if(!Object.is(n,t)){const b=t;t=(l!=null?l:typeof n!="object"||n===null)?n:Object.assign({},t,n),s.forEach(d=>d(t,b))}},r=()=>t,u={setState:i,getState:r,getInitialState:()=>S,subscribe:c=>(s.add(c),()=>s.delete(c)),destroy:()=>{s.clear()}},S=t=e(i,r,u);return u},f=a("createStore",e=>e?o(e):o);var g=a("default",e=>f(e))}}});
|
||||
47
mc_test/node_modules/zustand/system/vanilla/shallow.development.js
generated
vendored
Executable file
47
mc_test/node_modules/zustand/system/vanilla/shallow.development.js
generated
vendored
Executable file
@ -0,0 +1,47 @@
|
||||
System.register([], (function (exports) {
|
||||
'use strict';
|
||||
return {
|
||||
execute: (function () {
|
||||
|
||||
exports("shallow", shallow);
|
||||
|
||||
function shallow(objA, objB) {
|
||||
if (Object.is(objA, objB)) {
|
||||
return true;
|
||||
}
|
||||
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
||||
return false;
|
||||
}
|
||||
if (objA instanceof Map && objB instanceof Map) {
|
||||
if (objA.size !== objB.size) return false;
|
||||
for (const [key, value] of objA) {
|
||||
if (!Object.is(value, objB.get(key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (objA instanceof Set && objB instanceof Set) {
|
||||
if (objA.size !== objB.size) return false;
|
||||
for (const value of objA) {
|
||||
if (!objB.has(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const keysA = Object.keys(objA);
|
||||
if (keysA.length !== Object.keys(objB).length) {
|
||||
return false;
|
||||
}
|
||||
for (const keyA of keysA) {
|
||||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
})
|
||||
};
|
||||
}));
|
||||
1
mc_test/node_modules/zustand/system/vanilla/shallow.production.js
generated
vendored
Executable file
1
mc_test/node_modules/zustand/system/vanilla/shallow.production.js
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
System.register([],function(f){"use strict";return{execute:function(){f("shallow",i);function i(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[e,o]of t)if(!Object.is(o,r.get(e)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const e of t)if(!r.has(e))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(r).length)return!1;for(const e of n)if(!Object.prototype.hasOwnProperty.call(r,e)||!Object.is(t[e],r[e]))return!1;return!0}}}});
|
||||
Reference in New Issue
Block a user