import{i as Q,g as U,b as X,r as Y,j as Z,k as E,l as F,t as G,w as M,n as A,m as $,q as T,c as tt,v as et,x as st}from"./vue-ChXMuCsz.js";let H;const I=t=>H=t,nt=Symbol();function R(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var k;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(k||(k={}));const V=()=>{};function p(t,c,s,e=V){t.push(c);const r=()=>{const f=t.indexOf(c);f>-1&&(t.splice(f,1),e())};return!s&&et()&&st(r),r}function x(t,...c){t.slice().forEach(s=>{s(...c)})}const ot=t=>t();function L(t,c){t instanceof Map&&c instanceof Map&&c.forEach((s,e)=>t.set(e,s)),t instanceof Set&&c instanceof Set&&c.forEach(t.add,t);for(const s in c){if(!c.hasOwnProperty(s))continue;const e=c[s],r=t[s];R(r)&&R(e)&&t.hasOwnProperty(s)&&!E(e)&&!F(e)?t[s]=L(r,e):t[s]=e}return t}const ct=Symbol();function rt(t){return!R(t)||!t.hasOwnProperty(ct)}const{assign:y}=Object;function ut(t){return!!(E(t)&&t.effect)}function ft(t,c,s,e){const{state:r,actions:f,getters:l}=c,u=s.state.value[t];let P;function b(){u||(s.state.value[t]=r?r():{});const v=$(s.state.value[t]);return y(v,f,Object.keys(l||{}).reduce((m,j)=>(m[j]=T(tt(()=>{I(s);const d=s._s.get(t);return l[j].call(d,d)})),m),{}))}return P=q(t,b,c,s,e,!0),P}function q(t,c,s={},e,r,f){let l;const u=y({actions:{}},s),P={deep:!0};let b,v,m=[],j=[],d;const g=e.state.value[t];!f&&!g&&(e.state.value[t]={}),X({});let W;function O(o){let n;b=v=!1,typeof o=="function"?(o(e.state.value[t]),n={type:k.patchFunction,storeId:t,events:d}):(L(e.state.value[t],o),n={type:k.patchObject,payload:o,storeId:t,events:d});const h=W=Symbol();A().then(()=>{W===h&&(b=!0)}),v=!0,x(m,n,e.state.value[t])}const D=f?function(){const{state:n}=s,h=n?n():{};this.$patch(S=>{y(S,h)})}:V;function J(){l.stop(),m=[],j=[],e._s.delete(t)}function N(o,n){return function(){I(e);const h=Array.from(arguments),S=[],w=[];function B(a){S.push(a)}function K(a){w.push(a)}x(j,{args:h,name:o,store:i,after:B,onError:K});let C;try{C=n.apply(this&&this.$id===t?this:i,h)}catch(a){throw x(w,a),a}return C instanceof Promise?C.then(a=>(x(S,a),a)).catch(a=>(x(w,a),Promise.reject(a))):(x(S,C),C)}}const z={_p:e,$id:t,$onAction:p.bind(null,j),$patch:O,$reset:D,$subscribe(o,n={}){const h=p(m,o,n.detached,()=>S()),S=l.run(()=>M(()=>e.state.value[t],w=>{(n.flush==="sync"?v:b)&&o({storeId:t,type:k.direct,events:d},w)},y({},P,n)));return h},$dispose:J},i=Y(z);e._s.set(t,i);const _=(e._a&&e._a.runWithContext||ot)(()=>e._e.run(()=>(l=Z()).run(c)));for(const o in _){const n=_[o];if(E(n)&&!ut(n)||F(n))f||(g&&rt(n)&&(E(n)?n.value=g[o]:L(n,g[o])),e.state.value[t][o]=n);else if(typeof n=="function"){const h=N(o,n);_[o]=h,u.actions[o]=n}}return y(i,_),y(G(i),_),Object.defineProperty(i,"$state",{get:()=>e.state.value[t],set:o=>{O(n=>{y(n,o)})}}),e._p.forEach(o=>{y(i,l.run(()=>o({store:i,app:e._a,pinia:e,options:u})))}),g&&f&&s.hydrate&&s.hydrate(i.$state,g),b=!0,v=!0,i}function it(t,c,s){let e,r;const f=typeof c=="function";typeof t=="string"?(e=t,r=f?s:c):(r=t,e=t.id);function l(u,P){const b=U();return u=u||(b?Q(nt,null):null),u&&I(u),u=H,u._s.has(e)||(f?q(e,c,r,u):ft(e,r,u)),u._s.get(e)}return l.$id=e,l}export{it as d};
