pinia-801b3705.js 3.5 KB

12345678
  1. import{an as t,e,am as n,aw as s,A as o,f as a,Z as c,B as r,ax as i,ac as u,g as f,b as p,n as l,_ as h,j as d}from"./@vue-c5a747fc.js";
  2. /*!
  3. * pinia v2.1.7
  4. * (c) 2023 Eduardo San Martin Morote
  5. * @license MIT
  6. */
  7. let y;const v=t=>y=t,b=Symbol();function _(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var j,O;function $(){const s=t(!0),o=s.run((()=>e({})));let a=[],c=[];const r=n({install(t){v(r),r._a=t,t.provide(b,r),t.config.globalProperties.$pinia=r,c.forEach((t=>a.push(t))),c=[]},use(t){return this._a?a.push(t):c.push(t),this},_p:a,_a:null,_e:s,_s:new Map,state:o});return r}(O=j||(j={})).direct="direct",O.patchObject="patch object",O.patchFunction="patch function";const g=()=>{};function m(t,e,n,s=g){t.push(e);const o=()=>{const n=t.indexOf(e);n>-1&&(t.splice(n,1),s())};return!n&&f()&&p(o),o}function P(t,...e){t.slice().forEach((t=>{t(...e)}))}const S=t=>t();function w(t,e){t instanceof Map&&e instanceof Map&&e.forEach(((e,n)=>t.set(n,e))),t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const n in e){if(!e.hasOwnProperty(n))continue;const s=e[n],o=t[n];_(o)&&_(s)&&t.hasOwnProperty(n)&&!r(s)&&!i(s)?t[n]=w(o,s):t[n]=s}return t}const E=Symbol();const{assign:x}=Object;function A(n,s,o={},f,p,h){let d;const y=x({actions:{}},o),b={deep:!0};let O,$,A,I=[],M=[];const F=f.state.value[n];let k;function B(t){let e;O=$=!1,"function"==typeof t?(t(f.state.value[n]),e={type:j.patchFunction,storeId:n,events:A}):(w(f.state.value[n],t),e={type:j.patchObject,payload:t,storeId:n,events:A});const s=k=Symbol();l().then((()=>{k===s&&(O=!0)})),$=!0,P(I,e,f.state.value[n])}h||F||(f.state.value[n]={}),e({});const C=h?function(){const{state:t}=o,e=t?t():{};this.$patch((t=>{x(t,e)}))}:g;function J(t,e){return function(){v(f);const s=Array.from(arguments),o=[],a=[];let c;P(M,{args:s,name:t,store:W,after:function(t){o.push(t)},onError:function(t){a.push(t)}});try{c=e.apply(this&&this.$id===n?this:W,s)}catch(r){throw P(a,r),r}return c instanceof Promise?c.then((t=>(P(o,t),t))).catch((t=>(P(a,t),Promise.reject(t)))):(P(o,c),c)}}const N={_p:f,$id:n,$onAction:m.bind(null,M),$patch:B,$reset:C,$subscribe(t,e={}){const s=m(I,t,e.detached,(()=>o())),o=d.run((()=>a((()=>f.state.value[n]),(s=>{("sync"===e.flush?$:O)&&t({storeId:n,type:j.direct,events:A},s)}),x({},b,e))));return s},$dispose:function(){d.stop(),I=[],M=[],f._s.delete(n)}},W=c(N);f._s.set(n,W);const Z=(f._a&&f._a.runWithContext||S)((()=>f._e.run((()=>(d=t()).run(s)))));for(const t in Z){const e=Z[t];if(r(e)&&(!r(z=e)||!z.effect)||i(e))h||(!F||_(q=e)&&q.hasOwnProperty(E)||(r(e)?e.value=F[t]:w(e,F[t])),f.state.value[n][t]=e);else if("function"==typeof e){const n=J(t,e);Z[t]=n,y.actions[t]=e}}var q,z;return x(W,Z),x(u(W),Z),Object.defineProperty(W,"$state",{get:()=>f.state.value[n],set:t=>{B((e=>{x(e,t)}))}}),f._p.forEach((t=>{x(W,d.run((()=>t({store:W,app:f._a,pinia:f,options:y}))))})),F&&h&&o.hydrate&&o.hydrate(W.$state,F),O=!0,$=!0,W}function I(t,e,a){let c,r;const i="function"==typeof e;function u(t,a){const u=s();(t=t||(u?o(b,null):null))&&v(t),(t=y)._s.has(c)||(i?A(c,e,r,t):function(t,e,s,o){const{state:a,actions:c,getters:r}=e,i=s.state.value[t];let u;u=A(t,(function(){i||(s.state.value[t]=a?a():{});const e=h(s.state.value[t]);return x(e,c,Object.keys(r||{}).reduce(((e,o)=>(e[o]=n(d((()=>{v(s);const e=s._s.get(t);return r[o].call(e,e)}))),e)),{}))}),e,s,0,!0)}(c,r,t));return t._s.get(c)}return"string"==typeof t?(c=t,r=i?a:e):(r=t,c=t.id),u.$id=c,u}export{$ as c,I as d};