"use strict";const zustand=require("zustand"),middleware=require("zustand/middleware"),immer=require("zustand/middleware/immer"),taro=require("@tarojs/taro"),shallow=require("zustand/react/shallow"),vanilla=require("zustand/vanilla");class StateStorageImpl{async getItem(e){const{data:t}=await taro.getStorage({key:e});return t}async setItem(e,t){await taro.setStorage({key:e,data:t})}async removeItem(e){await taro.removeStorage({key:e})}}function createPersistStore(r,e,t=()=>({}),a){return zustand.create(middleware.persist(immer.immer(middleware.combine(e,t)),{name:r,storage:middleware.createJSONStorage(()=>new StateStorageImpl),...a}))}function createStore(r,e=()=>({})){return zustand.create(immer.immer(middleware.combine(r,e)))}function select(r,e={}){const t={};for(let a of Object.keys(r.getState()))t[a]=()=>r(s=>s[a]);return Object.assign(t,e.hooks,{apis:e.apis})}exports.createJSONStorage=middleware.createJSONStorage,exports.useShallow=shallow.useShallow,exports.createVanillaStore=vanilla.createStore,exports.createPersistStore=createPersistStore,exports.createStore=createStore,exports.select=select;