let { __state } = await import("https://esm.town/v/abc3354/__state");
export const state = function (
id: string,
defaultValue: { [key: string]: any }
): { [key: string]: any } {
if (__state == null) {
__state = {};
}
if (__state[id] == null) {
__state = {
...__state,
[id]: defaultValue,
};
}
return [
__state[id],
function (newState) {
const newStore = {
...__state,
[id]: newState,
};
__state = newStore;
},
];
return state;
};