pinia-plugin-subscription 0.1.5 → 0.1.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +81 -1
- package/dist/pinia-plugin-subscription.js +1176 -1051
- package/dist/pinia-plugin-subscription.umd.cjs +5 -5
- package/dist/types/index.d.ts +27 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(d,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],F):(d=typeof globalThis<"u"?globalThis:d||self,F(d["pinia-plugin-subscription"]={},d.Pinia))})(this,(function(d,F){"use strict";class we{_console;_createInstance;_name;_pluginOptions;_storeInstance;_resetStoreCallback;_storeOnActionSubscription;_storeMutationSubscription;_subscriptions;pluginCreated;get console(){return this._console??console}get name(){return this._name}get pluginOptions(){return this._pluginOptions??{}}set pluginOptions(e){this._pluginOptions=e}get resetStoreCallback(){return this._resetStoreCallback}get storeOnActionSubscription(){return this._storeOnActionSubscription}get storeMutationSubscription(){return this._storeMutationSubscription}get subscriptions(){return this._subscriptions}set subscriptions(e){this._subscriptions=e}constructor(e,n,r){this._name=e,this._createInstance=n,r&&(this._console=r)}invoke({store:e,options:n},r){return this._storeInstance=this._createInstance(e,{...n,...this.pluginOptions},r,this.console),this._storeInstance?(this._subscriptions=this._storeInstance.getSubscriptions(),this._storeMutationSubscription=this._storeInstance.storeSubscribe,this._storeOnActionSubscription=this._storeInstance.onAction,this.pluginCreated&&this.pluginCreated(e),!0):!1}}class xt{_console;_debug=!1;get console(){return this._console??console}set console(e){this._console=e}get debug(){return this._debug}set debug(e){this._debug=e}constructor(e,n){this._debug=e,n&&(this._console=n)}debugLog(...e){this._debug&&(Array.isArray(e)&&(e[0]=`${this._className} - ${e[0]}`),this.console.log(...e))}logError(...e){this.console.error(...e)}}const pt="pinia-plugin-subscription",Ne=(t,e="white")=>`background-color: ${t}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;function ve(t,e){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e.shift(),...e)}class Tt{_bgColor="#ffec73";_color="green";_icon="🍍⚡";_errorBgColor="#d24545";_errorColor="white";_errorIcon="🍍⚠️";_styles={error:{bgColor:this._errorBgColor,color:this._errorColor,icon:this._errorIcon},info:{bgColor:this._bgColor,color:this._color,icon:this._icon}};formatMessage(e,n){return` [${n} ${pt}] - ${e} `}generateStyle(e){return Ne(e.bgColor,e.color)}getStyleDefinition(e){return this._styles[e??"info"]}log(...e){this.useLog(this.getStyleDefinition(),e)}error(...e){this.useLog(this.getStyleDefinition("error"),e)}rebuildArgs(e,n){if(typeof e=="string")return[this.formatMessage(e,n)];if(Array.isArray(e))return[this.formatMessage(e.shift(),n),...e??[]]}useLog(e,n){ve(this.generateStyle(e),this.rebuildArgs(n,e.icon))}}class Re extends Tt{_pluginName=pt}const Ce=new Re;function Q(t){return t?Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:typeof t=="string"?t.trim()==="":!1:!(typeof t=="boolean"||typeof t=="number")}const Mt="PluginSubscription";class Pt extends xt{_className=Mt;_pluginDebug;_resetStoreCallback=[];_subscribers=[];_subscribersDelivered=new Set;_subscriptions=[];_subscriptionsDelivered=new Set;set subscribers(e){this._subscribers=e}get subscriptions(){if(!Q(this._subscriptions))return this._subscriptions}constructor(e,n){super(Array.isArray(n)&&!!n?.includes(Mt),Ce),this._pluginDebug=Array.isArray(n)?n:void 0,this._subscribers=e}addResetStoreCallback(e){this._resetStoreCallback.push(e)}definePluginDebug(e){return!!this._pluginDebug?.includes(e.name)}executeResetStoreCallbacks(e){this._resetStoreCallback.forEach(n=>n(e))}plugin({store:e,options:n}){if(this._subscribers.length){this.debugLog(`plugin() - ${e.$id}`,["subscriber:",this._subscribers,"store:",e,"options:",n]);try{this._subscribers.forEach(r=>{this._subscribersDelivered.has(`${r.name}-${e.$id}`)||r.invoke({store:e,options:n},this.definePluginDebug(r))&&(this._subscribersDelivered.add(`${r.name}-${e.$id}`),r.subscriptions&&this.subscriptionDelivery({store:e,options:n},r.subscriptions),r.storeMutationSubscription&&this.storeMutationSubscription(r.storeMutationSubscription),r.storeOnActionSubscription&&this.storeOnActionSubscription(r.storeOnActionSubscription),r.resetStoreCallback&&this.addResetStoreCallback(r.resetStoreCallback))}),this.rewriteResetStore({store:e},JSON.stringify(e.$state),Object.assign({},e))}catch(r){this.logError(r,e,n)}}}rewriteResetStore({store:e},n,r){e.$reset=()=>{this.debugLog("rewriteResetStore()",{initState:n,store:e,customStore:r}),this.executeResetStoreCallbacks(e),e.$patch(JSON.parse(n))}}storeOnActionSubscription(e){const{store:n,callback:r}=e();n.$onAction(({after:s,args:i,name:o})=>{this.debugLog(`storeOnActionSubscription ${n.$id}`,{after:s,args:i,name:o,store:n}),r({after:s,args:i,name:o})})}storeMutationSubscription(e){const{store:n,callback:r}=e();n.$subscribe(s=>{this.debugLog(`$subscribe ${n.$id}`,{mutation:s,store:n}),r(s)})}subscriptionDelivery({store:e,options:n},r){Object.entries(r).forEach(([s,i])=>{try{if(this._subscriptionsDelivered.has(`${s}-${e.$id}`))return;const{subscription:o,subscriptionOptions:c,stores:u}=i;this.debugLog(`subscriptionDelivery() - store: ${e.$id}`,["pluginName:",s,"subscription:",o,"options:",i,"stores:",u]);const l={storeOptions:{...n?.storeOptions??{},...c}};o.invoke({store:e,options:{...n,...l}},this.debug),this._subscriptionsDelivered.add(`${s}-${e.$id}`),Q(u)||u?.forEach(p=>o.invoke({store:p,options:{...n,...l,...p?.storeOptions??{}}},this.debug))}catch(o){this.logError("subscriptionDelivery()",o,e,n)}})}}function Ae(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const dt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Ft=()=>{},Ie=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),$e=t=>t.startsWith("onUpdate:"),V=Object.assign,De=Object.prototype.hasOwnProperty,_t=(t,e)=>De.call(t,e),_=Array.isArray,z=t=>kt(t)==="[object Map]",I=t=>typeof t=="function",v=t=>typeof t=="string",x=t=>typeof t=="symbol",b=t=>t!==null&&typeof t=="object",Ve=Object.prototype.toString,kt=t=>Ve.call(t),jt=t=>kt(t).slice(8,-1),X=t=>v(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,xe=(t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))})(t=>t.charAt(0).toUpperCase()+t.slice(1)),T=(t,e)=>!Object.is(t,e);let Kt;const Z=()=>Kt||(Kt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function gt(t){if(_(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],s=v(r)?Fe(r):gt(r);if(s)for(const i in s)e[i]=s[i]}return e}else if(v(t)||b(t))return t}const Te=/;(?![^(]*\))/g,Me=/:([^]+)/,Pe=/\/\*[^]*?\*\//g;function Fe(t){const e={};return t.replace(Pe,"").split(Te).forEach(n=>{if(n){const r=n.split(Me);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function bt(t){let e="";if(v(t))e=t;else if(_(t))for(let n=0;n<t.length;n++){const r=bt(t[n]);r&&(e+=r+" ")}else if(b(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function k(t,...e){console.warn(`[Vue warn] ${t}`,...e)}let ke,Ht=0,mt;function St(){Ht++}function yt(){if(--Ht>0)return;let t;for(;mt;){let e=mt;for(mt=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}let tt=!0;const Lt=[];function et(){Lt.push(tt),tt=!1}function nt(){const t=Lt.pop();tt=t===void 0?!0:t}class Wt{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){}trigger(e){this.version++,this.notify(e)}notify(e){St();try{if(process.env.NODE_ENV!=="production")for(let n=this.subsHead;n;n=n.nextSub)n.sub.onTrigger&&!(n.sub.flags&8)&&n.sub.onTrigger(V({effect:n.sub},e));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{yt()}}}const st=new WeakMap,M=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Et=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),U=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function g(t,e,n){if(tt&&ke){let r=st.get(t);r||st.set(t,r=new Map);let s=r.get(n);s||(r.set(n,s=new Wt),s.map=r,s.key=n),process.env.NODE_ENV!=="production"?s.track({target:t,type:e,key:n}):s.track()}}function $(t,e,n,r,s,i){const o=st.get(t);if(!o)return;const c=u=>{u&&(process.env.NODE_ENV!=="production"?u.trigger({target:t,type:e,key:n,newValue:r,oldValue:s,oldTarget:i}):u.trigger())};if(St(),e==="clear")o.forEach(c);else{const u=_(t),l=u&&X(n);if(u&&n==="length"){const p=Number(r);o.forEach((a,f)=>{(f==="length"||f===U||!x(f)&&f>=p)&&c(a)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),l&&c(o.get(U)),e){case"add":u?l&&c(o.get("length")):(c(o.get(M)),z(t)&&c(o.get(Et)));break;case"delete":u||(c(o.get(M)),z(t)&&c(o.get(Et)));break;case"set":z(t)&&c(o.get(M));break}}yt()}function je(t,e){const n=st.get(t);return n&&n.get(e)}function j(t){const e=h(t);return e===t?e:(g(e,"iterate",U),S(t)?e:e.map(C))}function Ot(t){return g(t=h(t),"iterate",U),t}function O(t,e){return w(t)?J(Ct(t)?C(e):e):C(e)}const Ke={__proto__:null,[Symbol.iterator](){return wt(this,Symbol.iterator,t=>O(this,t))},concat(...t){return j(this).concat(...t.map(e=>_(e)?j(e):e))},entries(){return wt(this,"entries",t=>(t[1]=O(this,t[1]),t))},every(t,e){return R(this,"every",t,e,void 0,arguments)},filter(t,e){return R(this,"filter",t,e,n=>n.map(r=>O(this,r)),arguments)},find(t,e){return R(this,"find",t,e,n=>O(this,n),arguments)},findIndex(t,e){return R(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return R(this,"findLast",t,e,n=>O(this,n),arguments)},findLastIndex(t,e){return R(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return R(this,"forEach",t,e,void 0,arguments)},includes(...t){return Nt(this,"includes",t)},indexOf(...t){return Nt(this,"indexOf",t)},join(t){return j(this).join(t)},lastIndexOf(...t){return Nt(this,"lastIndexOf",t)},map(t,e){return R(this,"map",t,e,void 0,arguments)},pop(){return q(this,"pop")},push(...t){return q(this,"push",t)},reduce(t,...e){return zt(this,"reduce",t,e)},reduceRight(t,...e){return zt(this,"reduceRight",t,e)},shift(){return q(this,"shift")},some(t,e){return R(this,"some",t,e,void 0,arguments)},splice(...t){return q(this,"splice",t)},toReversed(){return j(this).toReversed()},toSorted(t){return j(this).toSorted(t)},toSpliced(...t){return j(this).toSpliced(...t)},unshift(...t){return q(this,"unshift",t)},values(){return wt(this,"values",t=>O(this,t))}};function wt(t,e,n){const r=Ot(t),s=r[e]();return r!==t&&!S(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const He=Array.prototype;function R(t,e,n,r,s,i){const o=Ot(t),c=o!==t&&!S(t),u=o[e];if(u!==He[e]){const a=u.apply(t,i);return c?C(a):a}let l=n;o!==t&&(c?l=function(a,f){return n.call(this,O(t,a),f,t)}:n.length>2&&(l=function(a,f){return n.call(this,a,f,t)}));const p=u.call(o,l,r);return c&&s?s(p):p}function zt(t,e,n,r){const s=Ot(t),i=s!==t&&!S(t);let o=n,c=!1;s!==t&&(i?(c=r.length===0,o=function(l,p,a){return c&&(c=!1,l=O(t,l)),n.call(this,l,O(t,p),a,t)}):n.length>3&&(o=function(l,p,a){return n.call(this,l,p,a,t)}));const u=s[e](o,...r);return c?O(t,u):u}function Nt(t,e,n){const r=h(t);g(r,"iterate",U);const s=r[e](...n);return(s===-1||s===!1)&&B(n[0])?(n[0]=h(n[0]),r[e](...n)):s}function q(t,e,n=[]){et(),St();const r=h(t)[e].apply(t,n);return yt(),nt(),r}const Le=Ae("__proto__,__v_isRef,__isVue"),Ut=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(x));function We(t){x(t)||(t=String(t));const e=h(this);return g(e,"has",t),e.hasOwnProperty(t)}class qt{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?Ze:Gt:i?Xe:Yt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=_(e);if(!s){let u;if(o&&(u=Ke[n]))return u;if(n==="hasOwnProperty")return We}const c=Reflect.get(e,n,m(e)?e:r);if((x(n)?Ut.has(n):Le(n))||(s||g(e,"get",n),i))return c;if(m(c)){const u=o&&X(n)?c:c.value;return s&&b(u)?Rt(u):u}return b(c)?s?Rt(c):Qt(c):c}}class ze extends qt{constructor(e=!1){super(!1,e)}set(e,n,r,s){let i=e[n];const o=_(e)&&X(n);if(!this._isShallow){const l=w(i);if(!S(r)&&!w(r)&&(i=h(i),r=h(r)),!o&&m(i)&&!m(r))return l?(process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,e[n]),!0):(i.value=r,!0)}const c=o?Number(n)<e.length:_t(e,n),u=Reflect.set(e,n,r,m(e)?e:s);return e===h(s)&&u&&(c?T(r,i)&&$(e,"set",n,r,i):$(e,"add",n,r)),u}deleteProperty(e,n){const r=_t(e,n),s=e[n],i=Reflect.deleteProperty(e,n);return i&&r&&$(e,"delete",n,void 0,s),i}has(e,n){const r=Reflect.has(e,n);return(!x(n)||!Ut.has(n))&&g(e,"has",n),r}ownKeys(e){return g(e,"iterate",_(e)?"length":M),Reflect.ownKeys(e)}}class Ue extends qt{constructor(e=!1){super(!0,e)}set(e,n){return process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,e),!0}deleteProperty(e,n){return process.env.NODE_ENV!=="production"&&k(`Delete operation on key "${String(n)}" failed: target is readonly.`,e),!0}}const qe=new ze,Be=new Ue,vt=t=>t,rt=t=>Reflect.getPrototypeOf(t);function Je(t,e,n){return function(...r){const s=this.__v_raw,i=h(s),o=z(i),c=t==="entries"||t===Symbol.iterator&&o,u=t==="keys"&&o,l=s[t](...r),p=n?vt:e?J:C;return!e&&g(i,"iterate",u?Et:M),V(Object.create(l),{next(){const{value:a,done:f}=l.next();return f?{value:a,done:f}:{value:c?[p(a[0]),p(a[1])]:p(a),done:f}}})}}function it(t){return function(...e){if(process.env.NODE_ENV!=="production"){const n=e[0]?`on key "${e[0]}" `:"";k(`${xe(t)} operation ${n}failed: target is readonly.`,h(this))}return t==="delete"?!1:t==="clear"?void 0:this}}function Ye(t,e){const n={get(s){const i=this.__v_raw,o=h(i),c=h(s);t||(T(s,c)&&g(o,"get",s),g(o,"get",c));const{has:u}=rt(o),l=e?vt:t?J:C;if(u.call(o,s))return l(i.get(s));if(u.call(o,c))return l(i.get(c));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!t&&g(h(s),"iterate",M),s.size},has(s){const i=this.__v_raw,o=h(i),c=h(s);return t||(T(s,c)&&g(o,"has",s),g(o,"has",c)),s===c?i.has(s):i.has(s)||i.has(c)},forEach(s,i){const o=this,c=o.__v_raw,u=h(c),l=e?vt:t?J:C;return!t&&g(u,"iterate",M),c.forEach((p,a)=>s.call(i,l(p),l(a),o))}};return V(n,t?{add:it("add"),set:it("set"),delete:it("delete"),clear:it("clear")}:{add(s){const i=h(this),o=rt(i),c=h(s),u=!e&&!S(s)&&!w(s)?c:s;return o.has.call(i,u)||T(s,u)&&o.has.call(i,s)||T(c,u)&&o.has.call(i,c)||(i.add(u),$(i,"add",u,u)),this},set(s,i){!e&&!S(i)&&!w(i)&&(i=h(i));const o=h(this),{has:c,get:u}=rt(o);let l=c.call(o,s);l?process.env.NODE_ENV!=="production"&&Jt(o,c,s):(s=h(s),l=c.call(o,s));const p=u.call(o,s);return o.set(s,i),l?T(i,p)&&$(o,"set",s,i,p):$(o,"add",s,i),this},delete(s){const i=h(this),{has:o,get:c}=rt(i);let u=o.call(i,s);u?process.env.NODE_ENV!=="production"&&Jt(i,o,s):(s=h(s),u=o.call(i,s));const l=c?c.call(i,s):void 0,p=i.delete(s);return u&&$(i,"delete",s,void 0,l),p},clear(){const s=h(this),i=s.size!==0,o=process.env.NODE_ENV!=="production"?z(s)?new Map(s):new Set(s):void 0,c=s.clear();return i&&$(s,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Je(s,t,e)}),n}function Bt(t,e){const n=Ye(t,e);return(r,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?r:Reflect.get(_t(n,s)&&s in r?n:r,s,i)}const Ge={get:Bt(!1,!1)},Qe={get:Bt(!0,!1)};function Jt(t,e,n){const r=h(n);if(r!==n&&e.call(t,r)){const s=jt(t);k(`Reactive ${s} contains both the raw and reactive versions of the same object${s==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Yt=new WeakMap,Xe=new WeakMap,Gt=new WeakMap,Ze=new WeakMap;function tn(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Qt(t){return w(t)?t:Xt(t,!1,qe,Ge,Yt)}function Rt(t){return Xt(t,!0,Be,Qe,Gt)}function Xt(t,e,n,r,s){if(!b(t))return process.env.NODE_ENV!=="production"&&k(`value cannot be made ${e?"readonly":"reactive"}: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const i=s.get(t);if(i)return i;const o=tn(jt(t));if(o===0)return t;const c=new Proxy(t,o===2?r:n);return s.set(t,c),c}function Ct(t){return w(t)?Ct(t.__v_raw):!!(t&&t.__v_isReactive)}function w(t){return!!(t&&t.__v_isReadonly)}function S(t){return!!(t&&t.__v_isShallow)}function B(t){return t?!!t.__v_raw:!1}function h(t){const e=t&&t.__v_raw;return e?h(e):t}const C=t=>b(t)?Qt(t):t,J=t=>b(t)?Rt(t):t;function m(t){return t?t.__v_isRef===!0:!1}function Zt(t){return en(t,!1)}function en(t,e){return m(t)?t:new nn(t,e)}class nn{constructor(e,n){this.dep=new Wt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:h(e),this._value=n?e:C(e),this.__v_isShallow=n}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||S(e)||w(e);e=r?e:h(e),T(e,n)&&(this._rawValue=e,this._value=r?e:C(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:n}):this.dep.trigger())}}function sn(t){return m(t)?t.value:t}class rn{constructor(e,n,r){this._object=e,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=x(n)?n:String(n),this._raw=h(e);let s=!0,i=e;if(!_(e)||x(this._key)||!X(this._key))do s=!B(i)||S(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=sn(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&m(this._raw[this._key])){const n=this._object[this._key];if(m(n)){n.value=e;return}}this._object[this._key]=e}get dep(){return je(this._raw,this._key)}}class on{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function cn(t,e,n){return m(t)?t:I(t)?new on(t):b(t)&&arguments.length>1?an(t,e,n):Zt(t)}function an(t,e,n){return new rn(t,e,n)}const P=[];function un(t){P.push(t)}function ln(){P.pop()}let At=!1;function K(t,...e){if(At)return;At=!0,et();const n=P.length?P[P.length-1].component:null,r=n&&n.appContext.config.warnHandler,s=fn();if(r)It(r,n,11,[t+e.map(i=>{var o,c;return(c=(o=i.toString)==null?void 0:o.call(i))!=null?c:JSON.stringify(i)}).join(""),n&&n.proxy,s.map(({vnode:i})=>`at <${_e(n,i.type)}>`).join(`
|
|
2
|
-
`),
|
|
3
|
-
`,...
|
|
4
|
-
`],...
|
|
5
|
-
Component that was made reactive: `,
|
|
1
|
+
(function(p,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],F):(p=typeof globalThis<"u"?globalThis:p||self,F(p["pinia-plugin-subscription"]={},p.Pinia))})(this,(function(p,F){"use strict";class Nt{_console;_createInstance;_name;_pluginOptions;_storeInstance;_resetStoreCallback;_storeOnActionSubscription;_storeMutationSubscription;_subscriptions;pluginCreated;execution;hydrationScheduler;get console(){return this._console??console}get name(){return this._name}get storeInstance(){return this._storeInstance}get pluginOptions(){return this._pluginOptions??{}}set pluginOptions(t){this._pluginOptions=t}get resetStoreCallback(){return this._resetStoreCallback}get storeOnActionSubscription(){return this._storeOnActionSubscription}get storeMutationSubscription(){return this._storeMutationSubscription}get subscriptions(){return this._subscriptions}set subscriptions(t){this._subscriptions=t}constructor(t,n,s){this._name=t,this._createInstance=n,s&&(this._console=s)}hydrate(t,n){}afterHydration(t,n){}invoke({store:t,options:n},s){return this._storeInstance=this._createInstance(t,{...n,...this.pluginOptions},s,this.console),this._storeInstance?(this._subscriptions=this._storeInstance.getSubscriptions(),this._storeMutationSubscription=this._storeInstance.storeSubscribe,this._storeOnActionSubscription=this._storeInstance.onAction,this.pluginCreated&&this.pluginCreated(t),!0):!1}}class Fe{_console;_debug=!1;get console(){return this._console??console}set console(t){this._console=t}get debug(){return this._debug}set debug(t){this._debug=t}constructor(t,n){this._debug=t,n&&(this._console=n)}debugLog(...t){this._debug&&(Array.isArray(t)&&(t[0]=`${this._className} - ${t[0]}`),this.console.log(...t))}logError(...t){this.console.error(...t)}}const pe="pinia-plugin-subscription",Ct=(e,t="white")=>`background-color: ${e}; color: ${t}; padding: 1px; margin-right: 5px; font-size: 12px`;function Rt(e,t){if(!e)throw new Error("Style instructions are required");console.log("%c%s",e,t.shift(),...t)}class ke{_bgColor="#ffec73";_color="green";_icon="🍍⚡";_errorBgColor="#d24545";_errorColor="white";_errorIcon="🍍⚠️";_styles={error:{bgColor:this._errorBgColor,color:this._errorColor,icon:this._errorIcon},info:{bgColor:this._bgColor,color:this._color,icon:this._icon}};formatMessage(t,n){return` [${n} ${pe}] - ${t} `}generateStyle(t){return Ct(t.bgColor,t.color)}getStyleDefinition(t){return this._styles[t??"info"]}log(...t){this.useLog(this.getStyleDefinition(),t)}error(...t){this.useLog(this.getStyleDefinition("error"),t)}rebuildArgs(t,n){if(typeof t=="string")return[this.formatMessage(t,n)];if(Array.isArray(t))return[this.formatMessage(t.shift(),n),...t??[]]}useLog(t,n){Rt(this.generateStyle(t),this.rebuildArgs(n,t.icon))}}class At extends ke{_pluginName=pe}const xt=new At;function X(e){return e?Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:typeof e=="string"?e.trim()==="":!1:!(typeof e=="boolean"||typeof e=="number")}const Ke="PluginSubscription",It={environment:"both",hydration:"immediate"};function Dt(e){if(typeof window<"u"&&typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(()=>globalThis.setTimeout(e,0));return}globalThis.setTimeout(e,0)}function $t(e){return e!==void 0&&!Array.isArray(e)}class _e extends Fe{_className=Ke;_hydrationScheduler;_options;_pluginDebug;_resetStoreCallback=[];_subscribers=[];_subscribersDelivered=new Set;_subscribersScheduled=new Set;_subscriptions=[];_subscriptionsDelivered=new Set;_subscriptionsScheduled=new Set;set subscribers(t){this._subscribers=t}get subscriptions(){if(!X(this._subscriptions))return this._subscriptions}constructor(t,n,s){const r=Array.isArray(n)?n:void 0,i=$t(n)?n:s;super(Array.isArray(r)&&!!r?.includes(Ke),xt),this._hydrationScheduler=i?.hydrationScheduler??Dt,this._options=i,this._pluginDebug=Array.isArray(r)?r:void 0,this._subscribers=t}addResetStoreCallback(t){this._resetStoreCallback.push(t)}defineCurrentEnvironment(){return this._options?.runtimeEnvironment??(typeof window>"u"?"server":"client")}definePluginDebug(t){return!!this._pluginDebug?.includes(t.name)}definePluginExecution(t){return{...It,...this._options?.execution??{},...t.execution??{},...this._options?.subscriberExecution?.[t.name]??{}}}defineHydrationScheduler(t){return t.hydrationScheduler??this._hydrationScheduler}defineSubscriberKey(t,n){return`${t.name}-${n.$id}`}defineSubscriptionKey(t,n){return`${t}-${n.$id}`}executeResetStoreCallbacks(t){this._resetStoreCallback.forEach(n=>n(t))}executeSubscriber(t,n){const s=this.defineSubscriberKey(n,t.store),r=this.definePluginDebug(n);if(this._subscribersDelivered.has(s)||!n.invoke(t,r))return;this._subscribersDelivered.add(s);const i=n.hydrate?.(t,r);i&&typeof i.then=="function"&&i.catch(c=>this.logError(c,t.store,t.options));const o=n.afterHydration?.(t,r);o&&typeof o.then=="function"&&o.catch(c=>this.logError(c,t.store,t.options)),n.subscriptions&&this.subscriptionDelivery(t,n.subscriptions),n.storeMutationSubscription&&this.storeMutationSubscription(n.storeMutationSubscription),n.storeOnActionSubscription&&this.storeOnActionSubscription(n.storeOnActionSubscription),n.resetStoreCallback&&this.addResetStoreCallback(n.resetStoreCallback)}executeSubscriberSafely(t,n){try{this.executeSubscriber(t,n)}catch(s){this.logError(s,t.store,t.options)}}queueSubscriberExecution(t,n,s){const r=this.defineHydrationScheduler(n);this._subscribersScheduled.add(s),r(()=>{this._subscribersScheduled.delete(s),this.executeSubscriberSafely(t,n)})}shouldInvokePlugin(t){const n=this.defineCurrentEnvironment();return t.environment==="both"||t.environment===n}shouldScheduleAfterHydration(t){return this.defineCurrentEnvironment()==="client"&&t.hydration==="defer"}plugin({store:t,options:n}){if(this._subscribers.length){this.debugLog(`plugin() - ${t.$id}`,["subscriber:",this._subscribers,"store:",t,"options:",n]);try{this._subscribers.forEach(s=>{const r=this.defineSubscriberKey(s,t),i=this.definePluginExecution(s);if(!(this._subscribersDelivered.has(r)||this._subscribersScheduled.has(r))&&this.shouldInvokePlugin(i)){if(this.shouldScheduleAfterHydration(i)){this.queueSubscriberExecution({store:t,options:n},s,r);return}this.executeSubscriber({store:t,options:n},s)}}),this.rewriteResetStore({store:t},JSON.stringify(t.$state),Object.assign({},t))}catch(s){this.logError(s,t,n)}}}rewriteResetStore({store:t},n,s){t.$reset=()=>{this.debugLog("rewriteResetStore()",{initState:n,store:t,customStore:s}),this.executeResetStoreCallbacks(t),t.$patch(JSON.parse(n))}}storeOnActionSubscription(t){const{store:n,callback:s}=t();n.$onAction(({after:r,args:i,name:o})=>{this.debugLog(`storeOnActionSubscription ${n.$id}`,{after:r,args:i,name:o,store:n}),s({after:r,args:i,name:o})})}storeMutationSubscription(t){const{store:n,callback:s}=t();n.$subscribe(r=>{this.debugLog(`$subscribe ${n.$id}`,{mutation:r,store:n}),s(r)})}subscriptionDelivery(t,n){Object.entries(n).forEach(([s,r])=>{const i=this.defineSubscriptionKey(s,t.store),o=this.definePluginExecution(r.subscription);if(!(this._subscriptionsDelivered.has(i)||this._subscriptionsScheduled.has(i))&&this.shouldInvokePlugin(o)){if(this.shouldScheduleAfterHydration(o)){const c=this.defineHydrationScheduler(r.subscription);this._subscriptionsScheduled.add(i),c(()=>{this._subscriptionsScheduled.delete(i),this.subscriptionDeliverySafely(t,s,r)});return}this.subscriptionDeliverySafely(t,s,r)}})}subscriptionDeliverySafely({store:t,options:n},s,r){try{if(this._subscriptionsDelivered.has(this.defineSubscriptionKey(s,t)))return;const{subscription:i,subscriptionOptions:o,stores:c}=r;this.debugLog(`subscriptionDelivery() - store: ${t.$id}`,["pluginName:",s,"subscription:",i,"options:",r,"stores:",c]);const a={storeOptions:{...n?.storeOptions??{},...o}};i.invoke({store:t,options:{...n,...a}},this.debug),this._subscriptionsDelivered.add(this.defineSubscriptionKey(s,t)),X(c)||c?.forEach(l=>i.invoke({store:l,options:{...n,...a,...l?.storeOptions??{}}},this.debug))}catch(i){this.logError("subscriptionDelivery()",i,t,n)}}}function Vt(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const ge=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const He=()=>{},Tt=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Pt=e=>e.startsWith("onUpdate:"),$=Object.assign,Mt=Object.prototype.hasOwnProperty,be=(e,t)=>Mt.call(e,t),_=Array.isArray,z=e=>je(e)==="[object Map]",x=e=>typeof e=="function",N=e=>typeof e=="string",V=e=>typeof e=="symbol",b=e=>e!==null&&typeof e=="object",Ft=Object.prototype.toString,je=e=>Ft.call(e),Le=e=>je(e).slice(8,-1),Z=e=>N(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,kt=(e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))})(e=>e.charAt(0).toUpperCase()+e.slice(1)),T=(e,t)=>!Object.is(e,t);let We;const ee=()=>We||(We=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Se(e){if(_(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=N(s)?Lt(s):Se(s);if(r)for(const i in r)t[i]=r[i]}return t}else if(N(e)||b(e))return e}const Kt=/;(?![^(]*\))/g,Ht=/:([^]+)/,jt=/\/\*[^]*?\*\//g;function Lt(e){const t={};return e.replace(jt,"").split(Kt).forEach(n=>{if(n){const s=n.split(Ht);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function ye(e){let t="";if(N(e))t=e;else if(_(e))for(let n=0;n<e.length;n++){const s=ye(e[n]);s&&(t+=s+" ")}else if(b(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function k(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let Wt,ze=0,me;function Ee(){ze++}function we(){if(--ze>0)return;let e;for(;me;){let t=me;for(me=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}let te=!0;const qe=[];function ne(){qe.push(te),te=!1}function re(){const e=qe.pop();te=e===void 0?!0:e}class Ue{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(t){}trigger(t){this.version++,this.notify(t)}notify(t){Ee();try{if(process.env.NODE_ENV!=="production")for(let n=this.subsHead;n;n=n.nextSub)n.sub.onTrigger&&!(n.sub.flags&8)&&n.sub.onTrigger($({effect:n.sub},t));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{we()}}}const se=new WeakMap,P=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Oe=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),q=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function g(e,t,n){if(te&&Wt){let s=se.get(e);s||se.set(e,s=new Map);let r=s.get(n);r||(s.set(n,r=new Ue),r.map=s,r.key=n),process.env.NODE_ENV!=="production"?r.track({target:e,type:t,key:n}):r.track()}}function I(e,t,n,s,r,i){const o=se.get(e);if(!o)return;const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:e,type:t,key:n,newValue:s,oldValue:r,oldTarget:i}):a.trigger())};if(Ee(),t==="clear")o.forEach(c);else{const a=_(e),l=a&&Z(n);if(a&&n==="length"){const h=Number(s);o.forEach((u,f)=>{(f==="length"||f===q||!V(f)&&f>=h)&&c(u)})}else switch((n!==void 0||o.has(void 0))&&c(o.get(n)),l&&c(o.get(q)),t){case"add":a?l&&c(o.get("length")):(c(o.get(P)),z(e)&&c(o.get(Oe)));break;case"delete":a||(c(o.get(P)),z(e)&&c(o.get(Oe)));break;case"set":z(e)&&c(o.get(P));break}}we()}function zt(e,t){const n=se.get(e);return n&&n.get(t)}function K(e){const t=d(e);return t===e?t:(g(t,"iterate",q),y(e)?t:t.map(R))}function ve(e){return g(e=d(e),"iterate",q),e}function w(e,t){return O(e)?J(xe(e)?R(t):t):R(t)}const qt={__proto__:null,[Symbol.iterator](){return Ne(this,Symbol.iterator,e=>w(this,e))},concat(...e){return K(this).concat(...e.map(t=>_(t)?K(t):t))},entries(){return Ne(this,"entries",e=>(e[1]=w(this,e[1]),e))},every(e,t){return C(this,"every",e,t,void 0,arguments)},filter(e,t){return C(this,"filter",e,t,n=>n.map(s=>w(this,s)),arguments)},find(e,t){return C(this,"find",e,t,n=>w(this,n),arguments)},findIndex(e,t){return C(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return C(this,"findLast",e,t,n=>w(this,n),arguments)},findLastIndex(e,t){return C(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return C(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ce(this,"includes",e)},indexOf(...e){return Ce(this,"indexOf",e)},join(e){return K(this).join(e)},lastIndexOf(...e){return Ce(this,"lastIndexOf",e)},map(e,t){return C(this,"map",e,t,void 0,arguments)},pop(){return U(this,"pop")},push(...e){return U(this,"push",e)},reduce(e,...t){return Be(this,"reduce",e,t)},reduceRight(e,...t){return Be(this,"reduceRight",e,t)},shift(){return U(this,"shift")},some(e,t){return C(this,"some",e,t,void 0,arguments)},splice(...e){return U(this,"splice",e)},toReversed(){return K(this).toReversed()},toSorted(e){return K(this).toSorted(e)},toSpliced(...e){return K(this).toSpliced(...e)},unshift(...e){return U(this,"unshift",e)},values(){return Ne(this,"values",e=>w(this,e))}};function Ne(e,t,n){const s=ve(e),r=s[t]();return s!==e&&!y(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=n(i.value)),i}),r}const Ut=Array.prototype;function C(e,t,n,s,r,i){const o=ve(e),c=o!==e&&!y(e),a=o[t];if(a!==Ut[t]){const u=a.apply(e,i);return c?R(u):u}let l=n;o!==e&&(c?l=function(u,f){return n.call(this,w(e,u),f,e)}:n.length>2&&(l=function(u,f){return n.call(this,u,f,e)}));const h=a.call(o,l,s);return c&&r?r(h):h}function Be(e,t,n,s){const r=ve(e),i=r!==e&&!y(e);let o=n,c=!1;r!==e&&(i?(c=s.length===0,o=function(l,h,u){return c&&(c=!1,l=w(e,l)),n.call(this,l,w(e,h),u,e)}):n.length>3&&(o=function(l,h,u){return n.call(this,l,h,u,e)}));const a=r[t](o,...s);return c?w(e,a):a}function Ce(e,t,n){const s=d(e);g(s,"iterate",q);const r=s[t](...n);return(r===-1||r===!1)&&B(n[0])?(n[0]=d(n[0]),s[t](...n)):r}function U(e,t,n=[]){ne(),Ee();const s=d(e)[t].apply(e,n);return we(),re(),s}const Bt=Vt("__proto__,__v_isRef,__isVue"),Je=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(V));function Jt(e){V(e)||(e=String(e));const t=d(this);return g(t,"has",e),t.hasOwnProperty(e)}class Ye{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return i;if(n==="__v_raw")return s===(r?i?sn:Ze:i?rn:Xe).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const o=_(t);if(!r){let a;if(o&&(a=qt[n]))return a;if(n==="hasOwnProperty")return Jt}const c=Reflect.get(t,n,S(t)?t:s);if((V(n)?Je.has(n):Bt(n))||(r||g(t,"get",n),i))return c;if(S(c)){const a=o&&Z(n)?c:c.value;return r&&b(a)?Ae(a):a}return b(c)?r?Ae(c):et(c):c}}class Yt extends Ye{constructor(t=!1){super(!1,t)}set(t,n,s,r){let i=t[n];const o=_(t)&&Z(n);if(!this._isShallow){const l=O(i);if(!y(s)&&!O(s)&&(i=d(i),s=d(s)),!o&&S(i)&&!S(s))return l?(process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,t[n]),!0):(i.value=s,!0)}const c=o?Number(n)<t.length:be(t,n),a=Reflect.set(t,n,s,S(t)?t:r);return t===d(r)&&a&&(c?T(s,i)&&I(t,"set",n,s,i):I(t,"add",n,s)),a}deleteProperty(t,n){const s=be(t,n),r=t[n],i=Reflect.deleteProperty(t,n);return i&&s&&I(t,"delete",n,void 0,r),i}has(t,n){const s=Reflect.has(t,n);return(!V(n)||!Je.has(n))&&g(t,"has",n),s}ownKeys(t){return g(t,"iterate",_(t)?"length":P),Reflect.ownKeys(t)}}class Gt extends Ye{constructor(t=!1){super(!0,t)}set(t,n){return process.env.NODE_ENV!=="production"&&k(`Set operation on key "${String(n)}" failed: target is readonly.`,t),!0}deleteProperty(t,n){return process.env.NODE_ENV!=="production"&&k(`Delete operation on key "${String(n)}" failed: target is readonly.`,t),!0}}const Qt=new Yt,Xt=new Gt,Re=e=>e,ie=e=>Reflect.getPrototypeOf(e);function Zt(e,t,n){return function(...s){const r=this.__v_raw,i=d(r),o=z(i),c=e==="entries"||e===Symbol.iterator&&o,a=e==="keys"&&o,l=r[e](...s),h=n?Re:t?J:R;return!t&&g(i,"iterate",a?Oe:P),$(Object.create(l),{next(){const{value:u,done:f}=l.next();return f?{value:u,done:f}:{value:c?[h(u[0]),h(u[1])]:h(u),done:f}}})}}function oe(e){return function(...t){if(process.env.NODE_ENV!=="production"){const n=t[0]?`on key "${t[0]}" `:"";k(`${kt(e)} operation ${n}failed: target is readonly.`,d(this))}return e==="delete"?!1:e==="clear"?void 0:this}}function en(e,t){const n={get(r){const i=this.__v_raw,o=d(i),c=d(r);e||(T(r,c)&&g(o,"get",r),g(o,"get",c));const{has:a}=ie(o),l=t?Re:e?J:R;if(a.call(o,r))return l(i.get(r));if(a.call(o,c))return l(i.get(c));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!e&&g(d(r),"iterate",P),r.size},has(r){const i=this.__v_raw,o=d(i),c=d(r);return e||(T(r,c)&&g(o,"has",r),g(o,"has",c)),r===c?i.has(r):i.has(r)||i.has(c)},forEach(r,i){const o=this,c=o.__v_raw,a=d(c),l=t?Re:e?J:R;return!e&&g(a,"iterate",P),c.forEach((h,u)=>r.call(i,l(h),l(u),o))}};return $(n,e?{add:oe("add"),set:oe("set"),delete:oe("delete"),clear:oe("clear")}:{add(r){const i=d(this),o=ie(i),c=d(r),a=!t&&!y(r)&&!O(r)?c:r;return o.has.call(i,a)||T(r,a)&&o.has.call(i,r)||T(c,a)&&o.has.call(i,c)||(i.add(a),I(i,"add",a,a)),this},set(r,i){!t&&!y(i)&&!O(i)&&(i=d(i));const o=d(this),{has:c,get:a}=ie(o);let l=c.call(o,r);l?process.env.NODE_ENV!=="production"&&Qe(o,c,r):(r=d(r),l=c.call(o,r));const h=a.call(o,r);return o.set(r,i),l?T(i,h)&&I(o,"set",r,i,h):I(o,"add",r,i),this},delete(r){const i=d(this),{has:o,get:c}=ie(i);let a=o.call(i,r);a?process.env.NODE_ENV!=="production"&&Qe(i,o,r):(r=d(r),a=o.call(i,r));const l=c?c.call(i,r):void 0,h=i.delete(r);return a&&I(i,"delete",r,void 0,l),h},clear(){const r=d(this),i=r.size!==0,o=process.env.NODE_ENV!=="production"?z(r)?new Map(r):new Set(r):void 0,c=r.clear();return i&&I(r,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=Zt(r,e,t)}),n}function Ge(e,t){const n=en(e,t);return(s,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(be(n,r)&&r in s?n:s,r,i)}const tn={get:Ge(!1,!1)},nn={get:Ge(!0,!1)};function Qe(e,t,n){const s=d(n);if(s!==n&&t.call(e,s)){const r=Le(e);k(`Reactive ${r} contains both the raw and reactive versions of the same object${r==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Xe=new WeakMap,rn=new WeakMap,Ze=new WeakMap,sn=new WeakMap;function on(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function et(e){return O(e)?e:tt(e,!1,Qt,tn,Xe)}function Ae(e){return tt(e,!0,Xt,nn,Ze)}function tt(e,t,n,s,r){if(!b(e))return process.env.NODE_ENV!=="production"&&k(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const i=r.get(e);if(i)return i;const o=on(Le(e));if(o===0)return e;const c=new Proxy(e,o===2?s:n);return r.set(e,c),c}function xe(e){return O(e)?xe(e.__v_raw):!!(e&&e.__v_isReactive)}function O(e){return!!(e&&e.__v_isReadonly)}function y(e){return!!(e&&e.__v_isShallow)}function B(e){return e?!!e.__v_raw:!1}function d(e){const t=e&&e.__v_raw;return t?d(t):e}const R=e=>b(e)?et(e):e,J=e=>b(e)?Ae(e):e;function S(e){return e?e.__v_isRef===!0:!1}function nt(e){return cn(e,!1)}function cn(e,t){return S(e)?e:new un(e,t)}class un{constructor(t,n){this.dep=new Ue,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:d(t),this._value=n?t:R(t),this.__v_isShallow=n}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||y(t)||O(t);t=s?t:d(t),T(t,n)&&(this._rawValue=t,this._value=s?t:R(t),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:t,oldValue:n}):this.dep.trigger())}}function an(e){return S(e)?e.value:e}class ln{constructor(t,n,s){this._object=t,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._key=V(n)?n:String(n),this._raw=d(t);let r=!0,i=t;if(!_(t)||V(this._key)||!Z(this._key))do r=!B(i)||y(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let t=this._object[this._key];return this._shallow&&(t=an(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&S(this._raw[this._key])){const n=this._object[this._key];if(S(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return zt(this._raw,this._key)}}class fn{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function dn(e,t,n){return S(e)?e:x(e)?new fn(e):b(e)&&arguments.length>1?hn(e,t,n):nt(e)}function hn(e,t,n){return new ln(e,t,n)}const M=[];function pn(e){M.push(e)}function _n(){M.pop()}let Ie=!1;function H(e,...t){if(Ie)return;Ie=!0,ne();const n=M.length?M[M.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=gn();if(s)De(s,n,11,[e+t.map(i=>{var o,c;return(c=(o=i.toString)==null?void 0:o.call(i))!=null?c:JSON.stringify(i)}).join(""),n&&n.proxy,r.map(({vnode:i})=>`at <${St(n,i.type)}>`).join(`
|
|
2
|
+
`),r]);else{const i=[`[Vue warn]: ${e}`,...t];r.length&&i.push(`
|
|
3
|
+
`,...bn(r)),console.warn(...i)}re(),Ie=!1}function gn(){let e=M[M.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const s=e.component&&e.component.parent;e=s&&s.vnode}return t}function bn(e){const t=[];return e.forEach((n,s)=>{t.push(...s===0?[]:[`
|
|
4
|
+
`],...Sn(n))}),t}function Sn({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",s=e.component?e.component.parent==null:!1,r=` at <${St(e.component,e.type,s)}`,i=">"+n;return e.props?[r,...yn(e.props),i]:[r+i]}function yn(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(s=>{t.push(...rt(s,e[s]))}),n.length>3&&t.push(" ..."),t}function rt(e,t,n){return N(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:S(t)?(t=rt(e,d(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):x(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=d(t),n?t:[`${e}=`,t])}const st={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function De(e,t,n,s){try{return s?e(...s):e()}catch(r){it(r,t,n)}}function it(e,t,n,s=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||ge;if(t){let c=t.parent;const a=t.proxy,l=process.env.NODE_ENV!=="production"?st[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const h=c.ec;if(h){for(let u=0;u<h.length;u++)if(h[u](e,a,l)===!1)return}c=c.parent}if(i){ne(),De(i,null,10,[e,a,l]),re();return}}mn(e,n,r,s,o)}function mn(e,t,n,s=!0,r=!1){if(process.env.NODE_ENV!=="production"){const i=st[t];if(n&&pn(n),H(`Unhandled error${i?` during execution of ${i}`:""}`),n&&_n(),s)throw e;console.error(e)}else{if(r)throw e;console.error(e)}}const m=[];let A=-1;const j=[];let D=null,L=0;const En=Promise.resolve();let $e=null;const wn=100;function On(e){let t=A+1,n=m.length;for(;t<n;){const s=t+n>>>1,r=m[s],i=Y(r);i<e||i===e&&r.flags&2?t=s+1:n=s}return t}function vn(e){if(!(e.flags&1)){const t=Y(e),n=m[m.length-1];!n||!(e.flags&2)&&t>=Y(n)?m.push(e):m.splice(On(t),0,e),e.flags|=1,ot()}}function ot(){$e||($e=En.then(ct))}function Nn(e){_(e)?j.push(...e):D&&e.id===-1?D.splice(L+1,0,e):e.flags&1||(j.push(e),e.flags|=1),ot()}function Cn(e){if(j.length){const t=[...new Set(j)].sort((n,s)=>Y(n)-Y(s));if(j.length=0,D){D.push(...t);return}for(D=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),L=0;L<D.length;L++){const n=D[L];process.env.NODE_ENV!=="production"&&ut(e,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}D=null,L=0}}const Y=e=>e.id==null?e.flags&2?-1:1/0:e.id;function ct(e){process.env.NODE_ENV!=="production"&&(e=e||new Map);const t=process.env.NODE_ENV!=="production"?n=>ut(e,n):He;try{for(A=0;A<m.length;A++){const n=m[A];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&t(n))continue;n.flags&4&&(n.flags&=-2),De(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;A<m.length;A++){const n=m[A];n&&(n.flags&=-2)}A=-1,m.length=0,Cn(e),$e=null,(m.length||j.length)&&ct(e)}}function ut(e,t){const n=e.get(t)||0;if(n>wn){const s=t.i,r=s&&bt(s.type);return it(`Maximum recursive updates exceeded${r?` in component <${r}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return e.set(t,n+1),!1}const Ve=new Map;process.env.NODE_ENV!=="production"&&(ee().__VUE_HMR_RUNTIME__={createRecord:Te(Rn),rerender:Te(An),reload:Te(xn)});const ce=new Map;function Rn(e,t){return ce.has(e)?!1:(ce.set(e,{initialDef:ue(t),instances:new Set}),!0)}function ue(e){return yt(e)?e.__vccOpts:e}function An(e,t){const n=ce.get(e);n&&(n.initialDef.render=t,[...n.instances].forEach(s=>{t&&(s.render=t,ue(s.type).render=t),s.renderCache=[],s.job.flags&8||s.update()}))}function xn(e,t){const n=ce.get(e);if(!n)return;t=ue(t),at(n.initialDef,t);const s=[...n.instances];for(let r=0;r<s.length;r++){const i=s[r],o=ue(i.type);let c=Ve.get(o);c||(o!==n.initialDef&&at(o,t),Ve.set(o,c=new Set)),c.add(i),i.appContext.propsCache.delete(i.type),i.appContext.emitsCache.delete(i.type),i.appContext.optionsCache.delete(i.type),i.ceReload?(c.add(i),i.ceReload(t.styles),c.delete(i)):i.parent?vn(()=>{i.job.flags&8||(i.parent.update(),c.delete(i))}):i.appContext.reload?i.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),i.root.ce&&i!==i.root&&i.root.ce._removeChildStyle(o)}Nn(()=>{Ve.clear()})}function at(e,t){$(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function Te(e){return(t,n)=>{try{return e(t,n)}catch(s){console.error(s),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let W,ae=[];function lt(e,t){var n,s;W=e,W?(W.enabled=!0,ae.forEach(({event:r,args:i})=>W.emit(r,...i)),ae=[]):typeof window<"u"&&window.HTMLElement&&!((s=(n=window.navigator)==null?void 0:n.userAgent)!=null&&s.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{lt(i,t)}),setTimeout(()=>{W||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ae=[])},3e3)):ae=[]}let le=null,In=null;const Dn=e=>e.__isTeleport;function ft(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ft(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}ee().requestIdleCallback,ee().cancelIdleCallback;const $n=Symbol.for("v-ndc"),Vn={};process.env.NODE_ENV!=="production"&&(Vn.ownKeys=e=>(H("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(e)));const Tn={},dt=e=>Object.getPrototypeOf(e)===Tn,Pn=e=>e.__isSuspense,ht=Symbol.for("v-fgt"),Mn=Symbol.for("v-txt"),Fn=Symbol.for("v-cmt");function kn(e){return e?e.__v_isVNode===!0:!1}const Kn=(...e)=>_t(...e),pt=({key:e})=>e??null,fe=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?N(e)||S(e)||x(e)?{i:le,r:e,k:t,f:!!n}:e:null);function Hn(e,t=null,n=null,s=0,r=null,i=e===ht?0:1,o=!1,c=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&pt(t),ref:t&&fe(t),scopeId:In,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:le};return c?(he(a,n),i&128&&e.normalize(a)):n&&(a.shapeFlag|=N(n)?8:16),process.env.NODE_ENV!=="production"&&a.key!==a.key&&H("VNode created with invalid key (NaN). VNode type:",a.type),a}const jn=process.env.NODE_ENV!=="production"?Kn:_t;function _t(e,t=null,n=null,s=0,r=null,i=!1){if((!e||e===$n)&&(process.env.NODE_ENV!=="production"&&!e&&H(`Invalid vnode type when creating vnode: ${e}.`),e=Fn),kn(e)){const c=de(e,t,!0);return n&&he(c,n),c.patchFlag=-2,c}if(yt(e)&&(e=e.__vccOpts),t){t=Ln(t);let{class:c,style:a}=t;c&&!N(c)&&(t.class=ye(c)),b(a)&&(B(a)&&!_(a)&&(a=$({},a)),t.style=Se(a))}const o=N(e)?1:Pn(e)?128:Dn(e)?64:b(e)?4:x(e)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&B(e)&&(e=d(e),H("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
|
|
5
|
+
Component that was made reactive: `,e)),Hn(e,t,n,s,r,o,i,!0)}function Ln(e){return e?B(e)||dt(e)?$({},e):e:null}function de(e,t,n=!1,s=!1){const{props:r,ref:i,patchFlag:o,children:c,transition:a}=e,l=t?zn(r||{},t):r,h={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&pt(l),ref:t&&t.ref?n&&i?_(i)?i.concat(fe(t)):[i,fe(t)]:fe(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&_(c)?c.map(gt):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ht?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&de(e.ssContent),ssFallback:e.ssFallback&&de(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&s&&ft(h,a.clone(h)),h}function gt(e){const t=de(e);return _(e.children)&&(t.children=e.children.map(gt)),t}function Wn(e=" ",t=0){return jn(Mn,null,e,t)}function he(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(_(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),he(e,r()),r._c&&(r._d=!0));return}else n=32,!t._&&!dt(t)&&(t._ctx=le);else if(x(t)){if(s&65){he(e,{default:t});return}t={default:t,_ctx:le},n=32}else t=String(t),s&64?(n=16,t=[Wn(t)]):n=8;e.children=t,e.shapeFlag|=n}function zn(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const r in s)if(r==="class")t.class!==s.class&&(t.class=ye([t.class,s.class]));else if(r==="style")t.style=Se([t.style,s.style]);else if(Tt(r)){const i=t[r],o=s[r];o&&i!==o&&!(_(i)&&i.includes(o))?t[r]=i?[].concat(i,o):o:o==null&&i==null&&!Pt(r)&&(t[r]=o)}else r!==""&&(t[r]=s[r])}return t}{const e=ee(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};t("__VUE_INSTANCE_SETTERS__",n=>n),t("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const qn=/(?:^|[-_])\w/g,Un=e=>e.replace(qn,t=>t.toUpperCase()).replace(/[-_]/g,"");function bt(e,t=!0){return x(e)?e.displayName||e.name:e.name||t&&e.__name}function St(e,t,n=!1){let s=bt(t);if(!s&&t.__file){const r=t.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&e){const r=i=>{for(const o in i)if(i[o]===t)return o};s=r(e.components)||e.parent&&r(e.parent.type.components)||r(e.appContext.components)}return s?Un(s):n?"App":"Anonymous"}function yt(e){return x(e)&&"__vccOpts"in e}function Bn(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},n={style:"color:#f5222d"},s={style:"color:#eb2f96"},r={__vue_custom_formatter:!0,header(u){if(!b(u))return null;if(u.__isVue)return["div",e,"VueInstance"];if(S(u)){ne();const f=u.value;return re(),["div",{},["span",e,h(u)],"<",c(f),">"]}else{if(xe(u))return["div",{},["span",e,y(u)?"ShallowReactive":"Reactive"],"<",c(u),`>${O(u)?" (readonly)":""}`];if(O(u))return["div",{},["span",e,y(u)?"ShallowReadonly":"Readonly"],"<",c(u),">"]}return null},hasBody(u){return u&&u.__isVue},body(u){if(u&&u.__isVue)return["div",{},...i(u.$)]}};function i(u){const f=[];u.type.props&&u.props&&f.push(o("props",d(u.props))),u.setupState!==ge&&f.push(o("setup",u.setupState)),u.data!==ge&&f.push(o("data",d(u.data)));const E=a(u,"computed");E&&f.push(o("computed",E));const v=a(u,"inject");return v&&f.push(o("injected",v)),f.push(["div",{},["span",{style:s.style+";opacity:0.66"},"$ (internal): "],["object",{object:u}]]),f}function o(u,f){return f=$({},f),Object.keys(f).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},u],["div",{style:"padding-left:1.25em"},...Object.keys(f).map(E=>["div",{},["span",s,E+": "],c(f[E],!1)])]]:["span",{}]}function c(u,f=!0){return typeof u=="number"?["span",t,u]:typeof u=="string"?["span",n,JSON.stringify(u)]:typeof u=="boolean"?["span",s,u]:b(u)?["object",{object:f?d(u):u}]:["span",n,String(u)]}function a(u,f){const E=u.type;if(x(E))return;const v={};for(const Q in u.ctx)l(E,Q,f)&&(v[Q]=u.ctx[Q]);return v}function l(u,f,E){const v=u[E];if(_(v)&&v.includes(f)||b(v)&&f in v||u.extends&&l(u.extends,f,E)||u.mixins&&u.mixins.some(Q=>l(Q,f,E)))return!0}function h(u){return y(u)?"ShallowRef":u.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(r):window.devtoolsFormatters=[r]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Jn(){Bn()}process.env.NODE_ENV!=="production"&&Jn();const Pe=new WeakMap,G=new Map,mt=new WeakSet,Yn=50;function Gn(e){return e?.storeOptions?.debug===!0}function Me(e,t,n){if(!Gn(t))return;const s=G.size;console.debug(`[defineAStoreSetup] ${e} - ${n} (contextsById=${s})`),s>=Yn&&console.warn(`[defineAStoreSetup] contextsById reached ${s} entries`)}function Qn(e,t,n){if(mt.has(e)||typeof e.$dispose!="function")return;const s=e.$dispose;e.$dispose=(...r)=>(Pe.delete(e),G.delete(t),Me(t,n,"dispose cleanup"),s.apply(e,r)),mt.add(e)}function Xn(e,t,n){const s=n?{storeOptions:n}:{};return typeof t=="function"?Et(e,t,s):er(e,t,s)}function Zn(e,t,n){const s=n?{storeOptions:{...n,enhancedStore:!0}}:{storeOptions:{enhancedStore:!0}};return Et(e,t,s)}function Et(e,t,n){const s={id:e,extensions:{}},r=n?.storeOptions?.enhancedStore===!0,i=F.defineStore(e,()=>t(s),n);return Object.assign(((...o)=>{r&&(G.set(e,s),Me(e,n,"registered context by id"));const c=i(...o);return r&&(Pe.set(c,s),G.delete(e),Me(e,n,"moved context to weak map"),Qn(c,e,n)),c}),i)}function er(e,t,n){return n&&(t={...t,...n??{}}),F.defineStore(e,t)}const tr=new Set(["_","$"]);function nr(e){return tr.has(e[0])}function wt(e){return Pe.get(e)??(typeof e?.$id=="string"?G.get(e.$id):void 0)}function Ot(e){const t=e.extensions.enhancedStore??e.extensions.extending;if(!t)throw new Error(`${e.id}Store - getEnhancedStore - Error: enhanced store is required`);return t}function vt(e,t){e.extensions.enhancedStore=t,e.extensions.extending=t}function rr(e){return Ot(e)}class sr extends Fe{_className="Store";_onAction;_options;_store;_subscriptions={};_storeSubscribe;static _requiredKeys;get onAction(){if(this._onAction)return()=>({store:this.store,callback:this._onAction})}set onAction(t){this._onAction=t}get options(){return this._options}get state(){return this._store.$state}set state(t){this._store.$state=t}get store(){return this._store}hydrate(){}afterHydration(){}get storeSubscribe(){if(this._storeSubscribe)return()=>({store:this.store,callback:this._storeSubscribe})}set storeSubscribe(t){this._storeSubscribe=t}constructor(t,n,s=!1,r){if(super(s,r),this._options=n.storeOptions,this._store=t,this._options?.enhancedStore){const i=wt(this.store);i&&vt(i,this.store)}}addToState(t,n){this.isOptionApi()||n?.value||(n=nt(n)),this.state[t]=n,this.store[t]=dn(this.state,t)}addSubscription(t,n,s){this._subscriptions[t]={subscription:n,...s??{}}}static customizeStore(t,n,s=!1,r){if(n.storeOptions&&this.hasRequiredKeys(n.storeOptions))return new this(t,n,s,r)}hasDeniedFirstChar(t){return nr(t[0])}static hasRequiredKeys(t){return this._requiredKeys!==void 0&&this._requiredKeys?.every(n=>!!t[n])}getOption(t){return this.options&&this.options[t]}getStatePropertyValue(t){return this.getValue(this.state[t])}getSubscriptions(){if(!X(this._subscriptions))return this._subscriptions}getValue(t){return t?.__v_isRef?t.value:t}isOptionApi(){return this.store._isOptionsAPI}stateHas(t){return this.state.hasOwnProperty(t)}storeHas(t){return this.store.hasOwnProperty(t)}}function ir(e,t){const n=new _e(e,t);return n.plugin.bind(n)}function or(e,t){const n=new _e(e,t?.debug,{execution:t?.execution,hydrationScheduler:t?.hydrationScheduler,runtimeEnvironment:t?.runtimeEnvironment,subscriberExecution:t?.subscriberExecution});return n.plugin.bind(n)}p.CustomConsole=ke,p.PLUGIN_NAME=pe,p.PluginSubscriber=Nt,p.PluginSubscription=_e,p.Store=sr,p.createHydrationPlugin=or,p.createPlugin=ir,p.defineAStore=Xn,p.defineAStoreCtx=Zn,p.getDefineAStoreSetupContext=wt,p.getEnhancedStore=Ot,p.getExtendingStore=rr,p.isEmpty=X,p.setEnhancedStore=vt,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -39,6 +39,20 @@ export interface DefineAStoreSetupContext<TEnhancedStore, TExtraExtensions exten
|
|
|
39
39
|
export type StatePropertyValue = StdStatePropertyValue | Ref<StdStatePropertyValue> | StdStatePropertyValue[] | Ref<StdStatePropertyValue[]> | Ref<StdStatePropertyValue>[];
|
|
40
40
|
export type StoreOptions = Record<string, StoreOptionsPropertyValue>;
|
|
41
41
|
export type StoreOptionsPropertyValue = OptionBaseProperty | OptionBaseProperty[] | ObjectBaseProperty | ObjectBaseProperty[];
|
|
42
|
+
export type PluginHydrationScheduler = (callback: () => void) => void;
|
|
43
|
+
export type PluginHydrationTiming = 'defer' | 'immediate';
|
|
44
|
+
export type PluginRuntimeEnvironment = 'client' | 'server';
|
|
45
|
+
export type PluginExecutionEnvironment = PluginRuntimeEnvironment | 'both';
|
|
46
|
+
export interface PluginExecutionOptions {
|
|
47
|
+
environment?: PluginExecutionEnvironment;
|
|
48
|
+
hydration?: PluginHydrationTiming;
|
|
49
|
+
}
|
|
50
|
+
export interface PluginSubscriptionOptions {
|
|
51
|
+
execution?: PluginExecutionOptions;
|
|
52
|
+
hydrationScheduler?: PluginHydrationScheduler;
|
|
53
|
+
runtimeEnvironment?: PluginRuntimeEnvironment;
|
|
54
|
+
subscriberExecution?: Record<string, PluginExecutionOptions>;
|
|
55
|
+
}
|
|
42
56
|
export interface NativePiniaSubscriptionReturn<Callback> {
|
|
43
57
|
store: PiniaStore;
|
|
44
58
|
callback: Callback;
|
|
@@ -50,12 +64,16 @@ export interface StoreOnActionCallbackParameters {
|
|
|
50
64
|
}
|
|
51
65
|
export interface PluginSubscriberInterface {
|
|
52
66
|
console?: Console;
|
|
67
|
+
execution?: PluginExecutionOptions;
|
|
68
|
+
hydrate?: (context: PiniaPluginContext, debug: boolean) => void | Promise<void>;
|
|
69
|
+
hydrationScheduler?: PluginHydrationScheduler;
|
|
53
70
|
invoke: (context: PiniaPluginContext, debug: boolean) => boolean;
|
|
54
71
|
name: string;
|
|
55
72
|
resetStoreCallback?: (store?: PiniaStore) => void;
|
|
56
73
|
storeOnActionSubscription?: StoreOnActionSubscription;
|
|
57
74
|
storeMutationSubscription?: StoreMutationSubscription;
|
|
58
75
|
subscriptions?: PluginSubscriptions;
|
|
76
|
+
afterHydration?: (context: PiniaPluginContext, debug: boolean) => void | Promise<void>;
|
|
59
77
|
}
|
|
60
78
|
export interface PluginSubscriptionDefinition {
|
|
61
79
|
stores?: PiniaStore[];
|
|
@@ -70,6 +88,7 @@ export type StoreMutationSubscriptionCallback = (mutation: SubscriptionCallbackM
|
|
|
70
88
|
export type StoreMutationSubscription = NativePiniaSubscription<StoreMutationSubscriptionCallback>;
|
|
71
89
|
export declare const PLUGIN_NAME: string;
|
|
72
90
|
export declare function createPlugin(subscribers: PluginSubscriberInterface[], debug?: string[]): PiniaPlugin;
|
|
91
|
+
export declare function createHydrationPlugin(subscribers: PluginSubscriberInterface[], options?: PluginSubscriptionOptions): PiniaPlugin;
|
|
73
92
|
export declare function defineAStore<Sto, Sta>(id: string, storeDefinition: Omit<DefineStoreOptions<string, StateTree & Sta, AnyObject, Partial<Sto>>, 'id'>, options?: StoreOptions): StoreDefinition & Sta & Sto;
|
|
74
93
|
export declare function defineAStore<Sto, Sta>(id: string, storeDefinition: (ctx?: DefineAStoreSetupContext<AnyObject>) => AnyObject, options?: StoreOptions): StoreDefinition & Sta & Sto;
|
|
75
94
|
export declare function defineAStoreCtx<Sto, Sta>(id: string, storeDefinition: (ctx: DefineAStoreSetupContext<Sto & Sta>) => AnyObject, options?: StoreOptions): StoreDefinition & Sta & Sto;
|
|
@@ -103,20 +122,25 @@ export declare abstract class CustomConsole implements Console {
|
|
|
103
122
|
}
|
|
104
123
|
export declare abstract class PluginSubscriber<Instance extends Store> implements PluginSubscriberInterface {
|
|
105
124
|
console: Console;
|
|
125
|
+
execution?: PluginExecutionOptions;
|
|
126
|
+
hydrate(context: PiniaPluginContext, debug: boolean): void | Promise<void>;
|
|
127
|
+
hydrationScheduler?: PluginHydrationScheduler;
|
|
106
128
|
name: string;
|
|
107
129
|
pluginOptions: AnyObject;
|
|
108
130
|
resetStoreCallback?: (store?: PiniaStore) => void;
|
|
109
131
|
storeOnActionSubscription?: StoreOnActionSubscription;
|
|
110
132
|
storeMutationSubscription?: StoreMutationSubscription;
|
|
111
133
|
subscriptions?: PluginSubscriptions;
|
|
134
|
+
afterHydration(context: PiniaPluginContext, debug: boolean): void | Promise<void>;
|
|
112
135
|
protected pluginCreated?: (store: PiniaStore) => void;
|
|
113
136
|
protected _resetStoreCallback?: (store?: PiniaStore) => void;
|
|
114
137
|
constructor(pluginName: string, createInstanceFunction: (store: PiniaStore, options: AnyObject, debug: boolean, customConsole?: Console) => Instance | undefined, pluginConsole?: Console);
|
|
115
138
|
invoke(context: PiniaPluginContext, debug: boolean): boolean;
|
|
139
|
+
get storeInstance(): Instance | undefined;
|
|
116
140
|
}
|
|
117
141
|
export declare class PluginSubscription extends Debug {
|
|
118
142
|
protected _className: string;
|
|
119
|
-
constructor(subscribers: PluginSubscriberInterface[], debug?: string[]);
|
|
143
|
+
constructor(subscribers: PluginSubscriberInterface[], debug?: string[], pluginOptions?: PluginSubscriptionOptions);
|
|
120
144
|
plugin(context: PiniaPluginContext): void;
|
|
121
145
|
}
|
|
122
146
|
export declare class Store extends Debug {
|
|
@@ -127,6 +151,8 @@ export declare class Store extends Debug {
|
|
|
127
151
|
state: StateTree;
|
|
128
152
|
storeSubscribe: StoreMutationSubscriptionCallback | undefined;
|
|
129
153
|
readonly store: AnyObject;
|
|
154
|
+
hydrate(): void | Promise<void>;
|
|
155
|
+
afterHydration(): void | Promise<void>;
|
|
130
156
|
constructor(store: PiniaStore, options: AnyObject, debug?: boolean, customConsole?: Console);
|
|
131
157
|
addSubscription(pluginName: string, subscription: PluginSubscriberInterface, options?: {
|
|
132
158
|
subscriptionOptions?: StoreOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinia-plugin-subscription",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6-beta.1",
|
|
4
4
|
"description": "Pinia plugin for Vue.js that helps building Pinia plugins by centralizing subscriber registration and providing a Store base class for store helpers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|