pinia-plugin-persist-state 0.0.0-alpha.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/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/pinia-plugin-persist-state.js +2814 -0
- package/dist/pinia-plugin-persist-state.umd.cjs +9 -0
- package/dist/services/Crypt.d.ts +23 -0
- package/dist/services/IndexedDB.d.ts +34 -0
- package/dist/services/Persister.d.ts +15 -0
- package/dist/services/WindowStorage.d.ts +10 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/storage.d.ts +12 -0
- package/dist/types/store.d.ts +27 -0
- package/dist/utils/constantes.d.ts +1 -0
- package/dist/utils/pluginConsole.d.ts +6 -0
- package/package.json +41 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(function(R,ee){typeof exports=="object"&&typeof module<"u"?ee(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],ee):(R=typeof globalThis<"u"?globalThis:R||self,ee(R["pinia-plugin-persist-state"]={}))})(this,(function(R){"use strict";class ee{_storage;constructor(t){this._storage=t==="localStorage"?localStorage:sessionStorage}clear(){this._storage.clear()}async getItem(t){return new Promise((n,s)=>{const r=this._storage.getItem(t.toString());n(r?JSON.parse(r):void 0)})}removeItem(t){this._storage.removeItem(t.toString())}removeItems(t){for(let n=0;n<this._storage.length;n++){const s=this._storage.key(n);s&&(!t||!t.includes(s))&&this._storage.removeItem(s)}}setItem(t,n){this._storage.setItem(n,JSON.stringify(t))}}class pn{_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(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)}invoke({store:t,options:n},s){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))}}class hn{_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 dn="pinia-plugin-subscription",_n=(e,t="white")=>`background-color: ${e}; color: ${t}; padding: 1px; margin-right: 5px; font-size: 12px`;function gn(e,t){if(!e)throw new Error("Style instructions are required");console.log("%c%s",e,t.shift(),...t)}class yn{_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} ${dn}] - ${t} `}generateStyle(t){return _n(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){gn(this.generateStyle(t),this.rebuildArgs(n,t.icon))}}const mn=new Set(["_","$"]);function bn(e){return mn.has(e[0])}function L(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")}function Sn(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Ce=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const vn=()=>{},wn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),U=Object.assign,En=Object.prototype.hasOwnProperty,xe=(e,t)=>En.call(e,t),g=Array.isArray,te=e=>ct(e)==="[object Map]",I=e=>typeof e=="function",O=e=>typeof e=="string",ne=e=>typeof e=="symbol",y=e=>e!==null&&typeof e=="object",Nn=Object.prototype.toString,ct=e=>Nn.call(e),at=e=>ct(e).slice(8,-1),ue=e=>O(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,On=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Vn=On(e=>e.charAt(0).toUpperCase()+e.slice(1)),Re=(e,t)=>!Object.is(e,t);let lt;const fe=()=>lt||(lt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ie(e){if(g(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=O(s)?Rn(s):Ie(s);if(r)for(const o in r)t[o]=r[o]}return t}else if(O(e)||y(e))return e}const kn=/;(?![^(]*\))/g,Cn=/:([^]+)/,xn=/\/\*[^]*?\*\//g;function Rn(e){const t={};return e.replace(xn,"").split(kn).forEach(n=>{if(n){const s=n.split(Cn);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function De(e){let t="";if(O(e))t=e;else if(g(e))for(let n=0;n<e.length;n++){const s=De(e[n]);s&&(t+=s+" ")}else if(y(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function z(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let ut=0,Pe;function je(){ut++}function $e(){if(--ut>0)return;let e;for(;Pe;){let t=Pe;for(Pe=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}class In{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){je();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(U({effect:n.sub},t));for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{$e()}}}const ft=new WeakMap,Te=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),pt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ht=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function D(e,t,n,s,r,o){const i=ft.get(e);if(!i)return;const c=l=>{l&&(process.env.NODE_ENV!=="production"?l.trigger({target:e,type:t,key:n,newValue:s,oldValue:r,oldTarget:o}):l.trigger())};if(je(),t==="clear")i.forEach(c);else{const l=g(e),f=l&&ue(n);if(l&&n==="length"){const h=Number(s);i.forEach((a,u)=>{(u==="length"||u===ht||!ne(u)&&u>=h)&&c(a)})}else switch((n!==void 0||i.has(void 0))&&c(i.get(n)),f&&c(i.get(ht)),t){case"add":l?f&&c(i.get("length")):(c(i.get(Te)),te(e)&&c(i.get(pt)));break;case"delete":l||(c(i.get(Te)),te(e)&&c(i.get(pt)));break;case"set":te(e)&&c(i.get(Te));break}}$e()}function Dn(e,t){const n=ft.get(e);return n&&n.get(t)}function B(e){const t=p(e);return t===e||b(e)?t:t.map(k)}function Ae(e){return e=p(e),e}function P(e,t){return E(e)?He(e)?oe(k(t)):oe(t):k(t)}const Pn={__proto__:null,[Symbol.iterator](){return Me(this,Symbol.iterator,e=>P(this,e))},concat(...e){return B(this).concat(...e.map(t=>g(t)?B(t):t))},entries(){return Me(this,"entries",e=>(e[1]=P(this,e[1]),e))},every(e,t){return V(this,"every",e,t,void 0,arguments)},filter(e,t){return V(this,"filter",e,t,n=>n.map(s=>P(this,s)),arguments)},find(e,t){return V(this,"find",e,t,n=>P(this,n),arguments)},findIndex(e,t){return V(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return V(this,"findLast",e,t,n=>P(this,n),arguments)},findLastIndex(e,t){return V(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return V(this,"forEach",e,t,void 0,arguments)},includes(...e){return Fe(this,"includes",e)},indexOf(...e){return Fe(this,"indexOf",e)},join(e){return B(this).join(e)},lastIndexOf(...e){return Fe(this,"lastIndexOf",e)},map(e,t){return V(this,"map",e,t,void 0,arguments)},pop(){return se(this,"pop")},push(...e){return se(this,"push",e)},reduce(e,...t){return dt(this,"reduce",e,t)},reduceRight(e,...t){return dt(this,"reduceRight",e,t)},shift(){return se(this,"shift")},some(e,t){return V(this,"some",e,t,void 0,arguments)},splice(...e){return se(this,"splice",e)},toReversed(){return B(this).toReversed()},toSorted(e){return B(this).toSorted(e)},toSpliced(...e){return B(this).toSpliced(...e)},unshift(...e){return se(this,"unshift",e)},values(){return Me(this,"values",e=>P(this,e))}};function Me(e,t,n){const s=Ae(e),r=s[t]();return s!==e&&!b(e)&&(r._next=r.next,r.next=()=>{const o=r._next();return o.done||(o.value=n(o.value)),o}),r}const jn=Array.prototype;function V(e,t,n,s,r,o){const i=Ae(e),c=i!==e&&!b(e),l=i[t];if(l!==jn[t]){const a=l.apply(e,o);return c?k(a):a}let f=n;i!==e&&(c?f=function(a,u){return n.call(this,P(e,a),u,e)}:n.length>2&&(f=function(a,u){return n.call(this,a,u,e)}));const h=l.call(i,f,s);return c&&r?r(h):h}function dt(e,t,n,s){const r=Ae(e);let o=n;return r!==e&&(b(e)?n.length>3&&(o=function(i,c,l){return n.call(this,i,c,l,e)}):o=function(i,c,l){return n.call(this,i,P(e,c),l,e)}),r[t](o,...s)}function Fe(e,t,n){const s=p(e),r=s[t](...n);return(r===-1||r===!1)&&re(n[0])?(n[0]=p(n[0]),s[t](...n)):r}function se(e,t,n=[]){je();const s=p(e)[t].apply(e,n);return $e(),s}const $n=Sn("__proto__,__v_isRef,__isVue"),_t=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ne));function Tn(e){return ne(e)||(e=String(e)),p(this).hasOwnProperty(e)}class gt{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,o=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return o;if(n==="__v_raw")return s===(r?o?Bn:St:o?zn:bt).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const i=g(t);if(!r){let l;if(i&&(l=Pn[n]))return l;if(n==="hasOwnProperty")return Tn}const c=Reflect.get(t,n,m(t)?t:s);if((ne(n)?_t.has(n):$n(n))||o)return c;if(m(c)){const l=i&&ue(n)?c:c.value;return r&&y(l)?Ke(l):l}return y(c)?r?Ke(c):vt(c):c}}class An extends gt{constructor(t=!1){super(!1,t)}set(t,n,s,r){let o=t[n];const i=g(t)&&ue(n);if(!this._isShallow){const f=E(o);if(!b(s)&&!E(s)&&(o=p(o),s=p(s)),!i&&m(o)&&!m(s))return f?(process.env.NODE_ENV!=="production"&&z(`Set operation on key "${String(n)}" failed: target is readonly.`,t[n]),!0):(o.value=s,!0)}const c=i?Number(n)<t.length:xe(t,n),l=Reflect.set(t,n,s,m(t)?t:r);return t===p(r)&&(c?Re(s,o)&&D(t,"set",n,s,o):D(t,"add",n,s)),l}deleteProperty(t,n){const s=xe(t,n),r=t[n],o=Reflect.deleteProperty(t,n);return o&&s&&D(t,"delete",n,void 0,r),o}has(t,n){const s=Reflect.has(t,n);return!ne(n)||_t.has(n),s}ownKeys(t){return Reflect.ownKeys(t)}}class Mn extends gt{constructor(t=!1){super(!0,t)}set(t,n){return process.env.NODE_ENV!=="production"&&z(`Set operation on key "${String(n)}" failed: target is readonly.`,t),!0}deleteProperty(t,n){return process.env.NODE_ENV!=="production"&&z(`Delete operation on key "${String(n)}" failed: target is readonly.`,t),!0}}const Fn=new An,Kn=new Mn,pe=e=>Reflect.getPrototypeOf(e);function Hn(e,t,n){return function(...s){const r=this.__v_raw,o=p(r),i=te(o),c=e==="entries"||e===Symbol.iterator&&i,l=r[e](...s),f=t?oe:k;return{next(){const{value:h,done:a}=l.next();return a?{value:h,done:a}:{value:c?[f(h[0]),f(h[1])]:f(h),done:a}},[Symbol.iterator](){return this}}}}function he(e){return function(...t){if(process.env.NODE_ENV!=="production"){const n=t[0]?`on key "${t[0]}" `:"";z(`${Vn(e)} operation ${n}failed: target is readonly.`,p(this))}return e==="delete"?!1:e==="clear"?void 0:this}}function qn(e,t){const n={get(s){const r=this.__v_raw,o=p(r),i=p(s),{has:c}=pe(o),l=e?oe:k;if(c.call(o,s))return l(r.get(s));if(c.call(o,i))return l(r.get(i));r!==o&&r.get(s)},get size(){const s=this.__v_raw;return!e&&p(s),s.size},has(s){const r=this.__v_raw;p(r);const o=p(s);return s===o?r.has(s):r.has(s)||r.has(o)},forEach(s,r){const o=this,i=o.__v_raw;p(i);const c=e?oe:k;return i.forEach((l,f)=>s.call(r,c(l),c(f),o))}};return U(n,e?{add:he("add"),set:he("set"),delete:he("delete"),clear:he("clear")}:{add(s){!b(s)&&!E(s)&&(s=p(s));const r=p(this);return pe(r).has.call(r,s)||(r.add(s),D(r,"add",s,s)),this},set(s,r){!b(r)&&!E(r)&&(r=p(r));const o=p(this),{has:i,get:c}=pe(o);let l=i.call(o,s);l?process.env.NODE_ENV!=="production"&&mt(o,i,s):(s=p(s),l=i.call(o,s));const f=c.call(o,s);return o.set(s,r),l?Re(r,f)&&D(o,"set",s,r,f):D(o,"add",s,r),this},delete(s){const r=p(this),{has:o,get:i}=pe(r);let c=o.call(r,s);c?process.env.NODE_ENV!=="production"&&mt(r,o,s):(s=p(s),c=o.call(r,s));const l=i?i.call(r,s):void 0,f=r.delete(s);return c&&D(r,"delete",s,void 0,l),f},clear(){const s=p(this),r=s.size!==0,o=process.env.NODE_ENV!=="production"?te(s)?new Map(s):new Set(s):void 0,i=s.clear();return r&&D(s,"clear",void 0,void 0,o),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Hn(s,e)}),n}function yt(e,t){const n=qn(e);return(s,r,o)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(xe(n,r)&&r in s?n:s,r,o)}const Ln={get:yt(!1)},Un={get:yt(!0)};function mt(e,t,n){const s=p(n);if(s!==n&&t.call(e,s)){const r=at(e);z(`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 bt=new WeakMap,zn=new WeakMap,St=new WeakMap,Bn=new WeakMap;function Wn(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Jn(e){return e.__v_skip||!Object.isExtensible(e)?0:Wn(at(e))}function vt(e){return E(e)?e:wt(e,!1,Fn,Ln,bt)}function Ke(e){return wt(e,!0,Kn,Un,St)}function wt(e,t,n,s,r){if(!y(e))return process.env.NODE_ENV!=="production"&&z(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Jn(e);if(o===0)return e;const i=r.get(e);if(i)return i;const c=new Proxy(e,o===2?s:n);return r.set(e,c),c}function He(e){return E(e)?He(e.__v_raw):!!(e&&e.__v_isReactive)}function E(e){return!!(e&&e.__v_isReadonly)}function b(e){return!!(e&&e.__v_isShallow)}function re(e){return e?!!e.__v_raw:!1}function p(e){const t=e&&e.__v_raw;return t?p(t):e}const k=e=>y(e)?vt(e):e,oe=e=>y(e)?Ke(e):e;function m(e){return e?e.__v_isRef===!0:!1}function Et(e){return Yn(e,!1)}function Yn(e,t){return m(e)?e:new Gn(e,t)}class Gn{constructor(t,n){this.dep=new In,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:p(t),this._value=n?t:k(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||b(t)||E(t);t=s?t:p(t),Re(t,n)&&(this._rawValue=t,this._value=s?t:k(t),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:t,oldValue:n}):this.dep.trigger())}}function Qn(e){return m(e)?e.value:e}class Zn{constructor(t,n,s){this._object=t,this._key=n,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._raw=p(t);let r=!0,o=t;if(!g(t)||!ue(String(n)))do r=!re(o)||b(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let t=this._object[this._key];return this._shallow&&(t=Qn(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&m(this._raw[this._key])){const n=this._object[this._key];if(m(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return Dn(this._raw,this._key)}}class Xn{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 es(e,t,n){return m(e)?e:I(e)?new Xn(e):y(e)&&arguments.length>1?ts(e,t,n):Et(e)}function ts(e,t,n){return new Zn(e,t,n)}const M=[];function ns(e){M.push(e)}function ss(){M.pop()}let qe=!1;function ie(e,...t){if(qe)return;qe=!0;const n=M.length?M[M.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=rs();if(s)Le(s,n,11,[e+t.map(o=>{var i,c;return(c=(i=o.toString)==null?void 0:i.call(o))!=null?c:JSON.stringify(o)}).join(""),n&&n.proxy,r.map(({vnode:o})=>`at <${Mt(n,o.type)}>`).join(`
|
|
2
|
+
`),r]);else{const o=[`[Vue warn]: ${e}`,...t];r.length&&o.push(`
|
|
3
|
+
`,...os(r)),console.warn(...o)}qe=!1}function rs(){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 os(e){const t=[];return e.forEach((n,s)=>{t.push(...s===0?[]:[`
|
|
4
|
+
`],...is(n))}),t}function is({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",s=e.component?e.component.parent==null:!1,r=` at <${Mt(e.component,e.type,s)}`,o=">"+n;return e.props?[r,...cs(e.props),o]:[r+o]}function cs(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(s=>{t.push(...Nt(s,e[s]))}),n.length>3&&t.push(" ..."),t}function Nt(e,t,n){return O(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:m(t)?(t=Nt(e,p(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):I(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=p(t),n?t:[`${e}=`,t])}const Ot={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 Le(e,t,n,s){try{return s?e(...s):e()}catch(r){Vt(r,t,n)}}function Vt(e,t,n,s=!0){const r=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Ce;if(t){let c=t.parent;const l=t.proxy,f=process.env.NODE_ENV!=="production"?Ot[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const h=c.ec;if(h){for(let a=0;a<h.length;a++)if(h[a](e,l,f)===!1)return}c=c.parent}if(o){Le(o,null,10,[e,l,f]);return}}as(e,n,r,s,i)}function as(e,t,n,s=!0,r=!1){if(process.env.NODE_ENV!=="production"){const o=Ot[t];if(n&&ns(n),ie(`Unhandled error${o?` during execution of ${o}`:""}`),n&&ss(),s)throw e;console.error(e)}else{if(r)throw e;console.error(e)}}const S=[];let C=-1;const W=[];let j=null,J=0;const ls=Promise.resolve();let Ue=null;const us=100;function fs(e){let t=C+1,n=S.length;for(;t<n;){const s=t+n>>>1,r=S[s],o=ce(r);o<e||o===e&&r.flags&2?t=s+1:n=s}return t}function ps(e){if(!(e.flags&1)){const t=ce(e),n=S[S.length-1];!n||!(e.flags&2)&&t>=ce(n)?S.push(e):S.splice(fs(t),0,e),e.flags|=1,kt()}}function kt(){Ue||(Ue=ls.then(Ct))}function hs(e){g(e)?W.push(...e):j&&e.id===-1?j.splice(J+1,0,e):e.flags&1||(W.push(e),e.flags|=1),kt()}function ds(e){if(W.length){const t=[...new Set(W)].sort((n,s)=>ce(n)-ce(s));if(W.length=0,j){j.push(...t);return}for(j=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),J=0;J<j.length;J++){const n=j[J];process.env.NODE_ENV!=="production"&&xt(e,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}j=null,J=0}}const ce=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=>xt(e,n):vn;try{for(C=0;C<S.length;C++){const n=S[C];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&t(n))continue;n.flags&4&&(n.flags&=-2),Le(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;C<S.length;C++){const n=S[C];n&&(n.flags&=-2)}C=-1,S.length=0,ds(e),Ue=null,(S.length||W.length)&&Ct(e)}}function xt(e,t){const n=e.get(t)||0;if(n>us){const s=t.i,r=s&&At(s.type);return Vt(`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 ze=new Map;process.env.NODE_ENV!=="production"&&(fe().__VUE_HMR_RUNTIME__={createRecord:Be(_s),rerender:Be(gs),reload:Be(ys)});const de=new Map;function _s(e,t){return de.has(e)?!1:(de.set(e,{initialDef:_e(t),instances:new Set}),!0)}function _e(e){return Ft(e)?e.__vccOpts:e}function gs(e,t){const n=de.get(e);n&&(n.initialDef.render=t,[...n.instances].forEach(s=>{t&&(s.render=t,_e(s.type).render=t),s.renderCache=[],s.job.flags&8||s.update()}))}function ys(e,t){const n=de.get(e);if(!n)return;t=_e(t),Rt(n.initialDef,t);const s=[...n.instances];for(let r=0;r<s.length;r++){const o=s[r],i=_e(o.type);let c=ze.get(i);c||(i!==n.initialDef&&Rt(i,t),ze.set(i,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(t.styles),c.delete(o)):o.parent?ps(()=>{o.job.flags&8||(o.parent.update(),c.delete(o))}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(i)}hs(()=>{ze.clear()})}function Rt(e,t){U(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function Be(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 ge=null,ms=null;const bs=e=>e.__isTeleport;function It(e,t){e.shapeFlag&6&&e.component?(e.transition=t,It(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}fe().requestIdleCallback,fe().cancelIdleCallback;const Ss=Symbol.for("v-ndc");process.env.NODE_ENV;const vs={},Dt=e=>Object.getPrototypeOf(e)===vs,ws=e=>e.__isSuspense,Pt=Symbol.for("v-fgt"),Es=Symbol.for("v-txt"),Ns=Symbol.for("v-cmt");function Os(e){return e?e.__v_isVNode===!0:!1}const Vs=(...e)=>$t(...e),jt=({key:e})=>e??null,ye=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?O(e)||m(e)||I(e)?{i:ge,r:e,k:t,f:!!n}:e:null);function ks(e,t=null,n=null,s=0,r=null,o=e===Pt?0:1,i=!1,c=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&jt(t),ref:t&&ye(t),scopeId:ms,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:o,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ge};return c?(We(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=O(n)?8:16),process.env.NODE_ENV!=="production"&&l.key!==l.key&&ie("VNode created with invalid key (NaN). VNode type:",l.type),l}const Cs=process.env.NODE_ENV!=="production"?Vs:$t;function $t(e,t=null,n=null,s=0,r=null,o=!1){if((!e||e===Ss)&&(process.env.NODE_ENV!=="production"&&!e&&ie(`Invalid vnode type when creating vnode: ${e}.`),e=Ns),Os(e)){const c=me(e,t,!0);return n&&We(c,n),c.patchFlag=-2,c}if(Ft(e)&&(e=e.__vccOpts),t){t=xs(t);let{class:c,style:l}=t;c&&!O(c)&&(t.class=De(c)),y(l)&&(re(l)&&!g(l)&&(l=U({},l)),t.style=Ie(l))}const i=O(e)?1:ws(e)?128:bs(e)?64:y(e)?4:I(e)?2:0;return process.env.NODE_ENV!=="production"&&i&4&&re(e)&&(e=p(e),ie("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)),ks(e,t,n,s,r,i,o,!0)}function xs(e){return e?re(e)||Dt(e)?U({},e):e:null}function me(e,t,n=!1,s=!1){const{props:r,ref:o,patchFlag:i,children:c,transition:l}=e,f=t?Is(r||{},t):r,h={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&jt(f),ref:t&&t.ref?n&&o?g(o)?o.concat(ye(t)):[o,ye(t)]:ye(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&i===-1&&g(c)?c.map(Tt):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Pt?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&me(e.ssContent),ssFallback:e.ssFallback&&me(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&s&&It(h,l.clone(h)),h}function Tt(e){const t=me(e);return g(e.children)&&(t.children=e.children.map(Tt)),t}function Rs(e=" ",t=0){return Cs(Es,null,e,t)}function We(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(g(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),We(e,r()),r._c&&(r._d=!0));return}else n=32,!t._&&!Dt(t)&&(t._ctx=ge);else I(t)?(t={default:t,_ctx:ge},n=32):(t=String(t),s&64?(n=16,t=[Rs(t)]):n=8);e.children=t,e.shapeFlag|=n}function Is(...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=De([t.class,s.class]));else if(r==="style")t.style=Ie([t.style,s.style]);else if(wn(r)){const o=t[r],i=s[r];i&&o!==i&&!(g(o)&&o.includes(i))&&(t[r]=o?[].concat(o,i):i)}else r!==""&&(t[r]=s[r])}return t}{const e=fe(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),o=>{r.length>1?r.forEach(i=>i(o)):r[0](o)}};t("__VUE_INSTANCE_SETTERS__",n=>n),t("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const Ds=/(?:^|[-_])\w/g,Ps=e=>e.replace(Ds,t=>t.toUpperCase()).replace(/[-_]/g,"");function At(e,t=!0){return I(e)?e.displayName||e.name:e.name||t&&e.__name}function Mt(e,t,n=!1){let s=At(t);if(!s&&t.__file){const r=t.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&e){const r=o=>{for(const i in o)if(o[i]===t)return i};s=r(e.components)||e.parent&&r(e.parent.type.components)||r(e.appContext.components)}return s?Ps(s):n?"App":"Anonymous"}function Ft(e){return I(e)&&"__vccOpts"in e}function js(){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(a){if(!y(a))return null;if(a.__isVue)return["div",e,"VueInstance"];if(m(a)){const u=a.value;return["div",{},["span",e,h(a)],"<",c(u),">"]}else{if(He(a))return["div",{},["span",e,b(a)?"ShallowReactive":"Reactive"],"<",c(a),`>${E(a)?" (readonly)":""}`];if(E(a))return["div",{},["span",e,b(a)?"ShallowReadonly":"Readonly"],"<",c(a),">"]}return null},hasBody(a){return a&&a.__isVue},body(a){if(a&&a.__isVue)return["div",{},...o(a.$)]}};function o(a){const u=[];a.type.props&&a.props&&u.push(i("props",p(a.props))),a.setupState!==Ce&&u.push(i("setup",a.setupState)),a.data!==Ce&&u.push(i("data",p(a.data)));const d=l(a,"computed");d&&u.push(i("computed",d));const _=l(a,"inject");return _&&u.push(i("injected",_)),u.push(["div",{},["span",{style:s.style+";opacity:0.66"},"$ (internal): "],["object",{object:a}]]),u}function i(a,u){return u=U({},u),Object.keys(u).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},a],["div",{style:"padding-left:1.25em"},...Object.keys(u).map(d=>["div",{},["span",s,d+": "],c(u[d],!1)])]]:["span",{}]}function c(a,u=!0){return typeof a=="number"?["span",t,a]:typeof a=="string"?["span",n,JSON.stringify(a)]:typeof a=="boolean"?["span",s,a]:y(a)?["object",{object:u?p(a):a}]:["span",n,String(a)]}function l(a,u){const d=a.type;if(I(d))return;const _={};for(const w in a.ctx)f(d,w,u)&&(_[w]=a.ctx[w]);return _}function f(a,u,d){const _=a[d];if(g(_)&&_.includes(u)||y(_)&&u in _||a.extends&&f(a.extends,u,d)||a.mixins&&a.mixins.some(w=>f(w,u,d)))return!0}function h(a){return b(a)?"ShallowRef":a.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 $s(){js()}process.env.NODE_ENV!=="production"&&$s();class Ts extends hn{_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}get storeSubscribe(){if(this._storeSubscribe)return()=>({store:this.store,callback:this._storeSubscribe})}set storeSubscribe(t){this._storeSubscribe=t}constructor(t,n,s=!1,r){super(s,r),this._options=n.storeOptions,this._store=t}addToState(t,n){this.isOptionApi()||n?.value||(n=Et(n)),this.state[t]=n,this.store[t]=es(this.state,t)}addSubscription(t,n,s){this._subscriptions[t]={subscription:n,subscriptionOptions:s}}static customizeStore(t,n,s=!1,r){if(s&&r&&r.log(`Store - customizeStore() - ${t.$id}`,n),n.storeOptions&&this.hasRequiredKeys(n.storeOptions))return new this(t,n,s,r)}hasDeniedFirstChar(t){return bn(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(!L(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)}}const Kt="pinia-plugin-persist-state";class As extends yn{_pluginName=Kt}const F=new As;let Ht=class{_db;_localStorageVersionKey="IDBVersion";_name="persistStore";_objectStore;_objectStoreOptions;_objectStoreName;_transactionMode="readwrite";_version;constructor(t,n,s){this._objectStoreName=t,this._version=this.getStoredVersionNumber(),n&&(this._objectStoreOptions=n),s&&(this._transactionMode=s)}clear(){const t=()=>{if(this._objectStore){const n=this._objectStore.clear();this.requestEventsHandler(n,{error:()=>this.onError(n.error)})}};this.open({success:t})}createObjectStore(){this._db&&!this._db.objectStoreNames.contains(this._objectStoreName)&&this._db.createObjectStore(this._objectStoreName,this._objectStoreOptions)}deleteObjectStore(){const t=()=>{this._db?.deleteObjectStore(this._objectStoreName)};this.open({success:t})}async getItem(t){return new Promise(n=>{const s=()=>{if(this._objectStore){const r=this._objectStore.get(t);this.requestEventsHandler(r,{error:()=>this.onError(r.error,()=>n(void 0)),success:()=>n(r.result)})}};this.open({success:s})})}async getObjectStoreItem(t,n){return new Promise(s=>{const r=()=>{if(this._objectStore){const i=this._objectStore.index(t).get(n);this.requestEventsHandler(i,{error:()=>s(void 0),success:()=>s(i.result)})}};this.open({success:r})})}getStoredVersionNumber(){if(!localStorage)return 1;const t=localStorage.getItem(this._localStorageVersionKey);return t?parseInt(t):1}handleDeleteRequest(t,n){t.onerror=()=>F.error(`IndexedDB - Item "${n}" remove`,t.error)}onError(t,n){n&&n(t)}open(t){const n=indexedDB.open(this._name,this._version),s=()=>{this._db=n.result},r=i=>{try{if(s(),!this._db)return;const c=this._db.transaction(this._objectStoreName,this._transactionMode);c.onerror=()=>this.onError(c.error),this._objectStore=c.objectStore(this._objectStoreName),this._objectStore&&i()}catch(c){F.error("indexedDB - transaction error",[c])}};if(t?.success){const i=t.success;t.success=()=>r(i)}if(t?.upgrade){const i=t.upgrade.bind(this);t.upgrade=()=>{s(),i()}}const o=()=>{const i=c=>{if(c?.name==="VersionError"){this._version++,this.saveVersion(),this.open(t);return}t?.error&&t.error(c)};this.onError(n.error,i)};return t&&this.openRequestEventsHandler(n,{...t,error:o}),n}openRequestEventsHandler(t,n){this.requestEventsHandler(t,n),n.upgrade&&(t.onupgradeneeded=n.upgrade)}removeItem(t){const n=()=>{if(this._objectStore){const s=this._objectStore.delete(t);this.handleDeleteRequest(s,t)}};this.open({success:n})}removeItems(t){const n=()=>{if(this._objectStore){const s=this._objectStore.getAllKeys(),r=()=>{s.result.forEach(c=>{if(this._objectStore&&(!t||!t.includes(c))){const l=this._objectStore.delete(c);this.handleDeleteRequest(l,c)}})},o=()=>F.error("IndexedDB - removeItems",[s.error]);this.requestEventsHandler(s,{error:o,success:r})}};this.open({success:n})}requestEventsHandler(t,n){const{error:s,success:r}=n;s&&(t.onerror=s),r&&(t.onsuccess=r)}saveVersion(){localStorage&&localStorage.setItem(this._localStorageVersionKey,this._version.toString())}setItem(t,n){const s=()=>{if(this._objectStore){const o=this._objectStore.add(t);if(n){const i=()=>{n.forEach(l=>{this._objectStore?.createIndex(l,l,{unique:!0}),F.log(`"${l}" index created`)})},c=()=>this.onError(o.error);this.requestEventsHandler(o,{error:c,success:i})}}},r=this.createObjectStore;this.open({success:s,upgrade:r})}updateItem(t){const n=()=>{if(this._objectStore){const s=this._objectStore.put(t);s.onerror=()=>F.error("update item",[s.error,t])}};this.open({success:n})}};class qt{_db;_db_options;get dbName(){return this._db_options.name}constructor(t){if(!t)throw new Error("DbOptions is required");this._db_options=t,this._db=this.defineDb()}defineDb(){const{keyPath:t,name:n}=this._db_options;return n==="localStorage"||n==="sessionStorage"?new ee(n):new Ht(n,{keyPath:t})}getItem(t){return new Promise((n,s)=>{try{return this._db.getItem(t).then(r=>n(r))}catch(r){s(r)}})}removeItem(t){this._db.removeItem(t)}setItem(t,n){if(console.log("Persister - setItem",[t,n,this._db]),this._db instanceof Ht)try{this._db.getItem(t).then(s=>{s?this._db.updateItem(s):this._db.setItem({storeName:t,...n})})}catch(s){F.error("Persister - setItem Error",s),this._db.setItem({storename:t,...n})}else this._db.setItem(n,t)}}class Ms{_store=new Map;clear(){this._store.clear()}keyToString(t){return typeof t=="number"?t.toString():t}async getItem(t){return this._store.get(this.keyToString(t))}removeItem(t){this._store.delete(this.keyToString(t))}removeItems(t){if(t)for(const n of this._store.keys())t.includes(n)||this._store.delete(n);else this._store.clear()}setItem(t,n){this._store.set(n,t)}}let Y={};const Fs={clear:()=>Y={},getItem:async e=>new Promise(t=>t(Y[e])),removeItem:e=>delete Y[e],removeItems:e=>e?e.forEach(t=>delete Y[t]):Y={},setItem:(e,t)=>{Y[t]=e}};class Lt extends qt{defineDb(){return this.dbName==="localStorage"||this.dbName==="sessionStorage"?Fs:new Ms}}class ae{_encoder=new TextEncoder;_key;_materialKey;static DECRYPT="decrypt";static ENCRYPT="encrypt";constructor(t){this._key=t}async getKey(t){return await crypto.subtle.deriveKey({name:"PBKDF2",salt:this._encoder.encode("salt"),iterations:1e5,hash:"SHA-256"},this._materialKey,{name:"AES-GCM",length:256},!1,[t])}async setKeyMaterial(t){this._materialKey=await crypto.subtle.importKey("raw",this._encoder.encode(t),{name:"PBKDF2"},!1,["deriveKey"])}async decrypt(t){const[n,s]=t.split(":"),r=await crypto.subtle.decrypt({name:"AES-GCM",iv:Uint8Array.from(atob(n),o=>o.charCodeAt(0))},await this.getKey(ae.DECRYPT),Uint8Array.from(atob(s),o=>o.charCodeAt(0)));return new TextDecoder().decode(r)}async encrypt(t){const n=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},await this.getKey(ae.ENCRYPT),this._encoder.encode(t));return btoa(String.fromCharCode(...new Uint8Array(n)))+":"+btoa(String.fromCharCode(...new Uint8Array(s)))}async init(){this._materialKey||await this.setKeyMaterial(this._key)}}const Je=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Ut=()=>{},Ks=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),be=Object.assign,N=Array.isArray,K=e=>typeof e=="function",$=e=>typeof e=="string",Hs=e=>typeof e=="symbol",H=e=>e!==null&&typeof e=="object";let zt;const Se=()=>zt||(zt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ye(e){if(N(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=$(s)?zs(s):Ye(s);if(r)for(const o in r)t[o]=r[o]}return t}else if($(e)||H(e))return e}const qs=/;(?![^(]*\))/g,Ls=/:([^]+)/,Us=/\/\*[^]*?\*\//g;function zs(e){const t={};return e.replace(Us,"").split(qs).forEach(n=>{if(n){const s=n.split(Ls);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function Ge(e){let t="";if($(e))t=e;else if(N(e))for(let n=0;n<e.length;n++){const s=Ge(e[n]);s&&(t+=s+" ")}else if(H(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV,new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Hs));function Bt(e){return Qe(e)?Bt(e.__v_raw):!!(e&&e.__v_isReactive)}function Qe(e){return!!(e&&e.__v_isReadonly)}function Ze(e){return!!(e&&e.__v_isShallow)}function Xe(e){return e?!!e.__v_raw:!1}function T(e){const t=e&&e.__v_raw;return t?T(t):e}function et(e){return e?e.__v_isRef===!0:!1}const q=[];function Bs(e){q.push(e)}function Ws(){q.pop()}let tt=!1;function G(e,...t){if(tt)return;tt=!0;const n=q.length?q[q.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=Js();if(s)nt(s,n,11,[e+t.map(o=>{var i,c;return(c=(i=o.toString)==null?void 0:i.call(o))!=null?c:JSON.stringify(o)}).join(""),n&&n.proxy,r.map(({vnode:o})=>`at <${ln(n,o.type)}>`).join(`
|
|
6
|
+
`),r]);else{const o=[`[Vue warn]: ${e}`,...t];r.length&&o.push(`
|
|
7
|
+
`,...Ys(r)),console.warn(...o)}tt=!1}function Js(){let e=q[q.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 Ys(e){const t=[];return e.forEach((n,s)=>{t.push(...s===0?[]:[`
|
|
8
|
+
`],...Gs(n))}),t}function Gs({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",s=e.component?e.component.parent==null:!1,r=` at <${ln(e.component,e.type,s)}`,o=">"+n;return e.props?[r,...Qs(e.props),o]:[r+o]}function Qs(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(s=>{t.push(...Wt(s,e[s]))}),n.length>3&&t.push(" ..."),t}function Wt(e,t,n){return $(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:et(t)?(t=Wt(e,T(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):K(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=T(t),n?t:[`${e}=`,t])}const Jt={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 nt(e,t,n,s){try{return s?e(...s):e()}catch(r){Yt(r,t,n)}}function Yt(e,t,n,s=!0){const r=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Je;if(t){let c=t.parent;const l=t.proxy,f=process.env.NODE_ENV!=="production"?Jt[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const h=c.ec;if(h){for(let a=0;a<h.length;a++)if(h[a](e,l,f)===!1)return}c=c.parent}if(o){nt(o,null,10,[e,l,f]);return}}Zs(e,n,r,s,i)}function Zs(e,t,n,s=!0,r=!1){if(process.env.NODE_ENV!=="production"){const o=Jt[t];if(n&&Bs(n),G(`Unhandled error${o?` during execution of ${o}`:""}`),n&&Ws(),s)throw e;console.error(e)}else{if(r)throw e;console.error(e)}}const v=[];let x=-1;const Q=[];let A=null,Z=0;const Xs=Promise.resolve();let st=null;const er=100;function tr(e){let t=x+1,n=v.length;for(;t<n;){const s=t+n>>>1,r=v[s],o=le(r);o<e||o===e&&r.flags&2?t=s+1:n=s}return t}function nr(e){if(!(e.flags&1)){const t=le(e),n=v[v.length-1];!n||!(e.flags&2)&&t>=le(n)?v.push(e):v.splice(tr(t),0,e),e.flags|=1,Gt()}}function Gt(){st||(st=Xs.then(Qt))}function sr(e){N(e)?Q.push(...e):A&&e.id===-1?A.splice(Z+1,0,e):e.flags&1||(Q.push(e),e.flags|=1),Gt()}function rr(e){if(Q.length){const t=[...new Set(Q)].sort((n,s)=>le(n)-le(s));if(Q.length=0,A){A.push(...t);return}for(A=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),Z=0;Z<A.length;Z++){const n=A[Z];process.env.NODE_ENV!=="production"&&Zt(e,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}A=null,Z=0}}const le=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Qt(e){process.env.NODE_ENV!=="production"&&(e=e||new Map);const t=process.env.NODE_ENV!=="production"?n=>Zt(e,n):Ut;try{for(x=0;x<v.length;x++){const n=v[x];if(n&&!(n.flags&8)){if(process.env.NODE_ENV!=="production"&&t(n))continue;n.flags&4&&(n.flags&=-2),nt(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;x<v.length;x++){const n=v[x];n&&(n.flags&=-2)}x=-1,v.length=0,rr(e),st=null,(v.length||Q.length)&&Qt(e)}}function Zt(e,t){const n=e.get(t)||0;if(n>er){const s=t.i,r=s&&an(s.type);return Yt(`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 rt=new Map;process.env.NODE_ENV!=="production"&&(Se().__VUE_HMR_RUNTIME__={createRecord:ot(or),rerender:ot(ir),reload:ot(cr)});const ve=new Map;function or(e,t){return ve.has(e)?!1:(ve.set(e,{initialDef:we(t),instances:new Set}),!0)}function we(e){return un(e)?e.__vccOpts:e}function ir(e,t){const n=ve.get(e);n&&(n.initialDef.render=t,[...n.instances].forEach(s=>{t&&(s.render=t,we(s.type).render=t),s.renderCache=[],s.job.flags&8||s.update()}))}function cr(e,t){const n=ve.get(e);if(!n)return;t=we(t),Xt(n.initialDef,t);const s=[...n.instances];for(let r=0;r<s.length;r++){const o=s[r],i=we(o.type);let c=rt.get(i);c||(i!==n.initialDef&&Xt(i,t),rt.set(i,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(t.styles),c.delete(o)):o.parent?nr(()=>{o.job.flags&8||(o.parent.update(),c.delete(o))}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(i)}sr(()=>{rt.clear()})}function Xt(e,t){be(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function ot(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 X,Ee=[];function en(e,t){var n,s;X=e,X?(X.enabled=!0,Ee.forEach(({event:r,args:o})=>X.emit(r,...o)),Ee=[]):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(o=>{en(o,t)}),setTimeout(()=>{X||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Ee=[])},3e3)):Ee=[]}let Ne=null,ar=null;const lr=e=>e.__isTeleport;function tn(e,t){e.shapeFlag&6&&e.component?(e.transition=t,tn(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}Se().requestIdleCallback,Se().cancelIdleCallback;const ur=Symbol.for("v-ndc"),fr={};process.env.NODE_ENV!=="production"&&(fr.ownKeys=e=>(G("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 pr={},nn=e=>Object.getPrototypeOf(e)===pr,hr=e=>e.__isSuspense,sn=Symbol.for("v-fgt"),dr=Symbol.for("v-txt"),_r=Symbol.for("v-cmt");function gr(e){return e?e.__v_isVNode===!0:!1}const yr=(...e)=>on(...e),rn=({key:e})=>e??null,Oe=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?$(e)||et(e)||K(e)?{i:Ne,r:e,k:t,f:!!n}:e:null);function mr(e,t=null,n=null,s=0,r=null,o=e===sn?0:1,i=!1,c=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&rn(t),ref:t&&Oe(t),scopeId:ar,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:o,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Ne};return c?(it(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=$(n)?8:16),process.env.NODE_ENV!=="production"&&l.key!==l.key&&G("VNode created with invalid key (NaN). VNode type:",l.type),l}const br=process.env.NODE_ENV!=="production"?yr:on;function on(e,t=null,n=null,s=0,r=null,o=!1){if((!e||e===ur)&&(process.env.NODE_ENV!=="production"&&!e&&G(`Invalid vnode type when creating vnode: ${e}.`),e=_r),gr(e)){const c=Ve(e,t,!0);return n&&it(c,n),c.patchFlag=-2,c}if(un(e)&&(e=e.__vccOpts),t){t=Sr(t);let{class:c,style:l}=t;c&&!$(c)&&(t.class=Ge(c)),H(l)&&(Xe(l)&&!N(l)&&(l=be({},l)),t.style=Ye(l))}const i=$(e)?1:hr(e)?128:lr(e)?64:H(e)?4:K(e)?2:0;return process.env.NODE_ENV!=="production"&&i&4&&Xe(e)&&(e=T(e),G("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`.",`
|
|
9
|
+
Component that was made reactive: `,e)),mr(e,t,n,s,r,i,o,!0)}function Sr(e){return e?Xe(e)||nn(e)?be({},e):e:null}function Ve(e,t,n=!1,s=!1){const{props:r,ref:o,patchFlag:i,children:c,transition:l}=e,f=t?wr(r||{},t):r,h={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&rn(f),ref:t&&t.ref?n&&o?N(o)?o.concat(Oe(t)):[o,Oe(t)]:Oe(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&i===-1&&N(c)?c.map(cn):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==sn?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ve(e.ssContent),ssFallback:e.ssFallback&&Ve(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&s&&tn(h,l.clone(h)),h}function cn(e){const t=Ve(e);return N(e.children)&&(t.children=e.children.map(cn)),t}function vr(e=" ",t=0){return br(dr,null,e,t)}function it(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(N(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),it(e,r()),r._c&&(r._d=!0));return}else n=32,!t._&&!nn(t)&&(t._ctx=Ne);else K(t)?(t={default:t,_ctx:Ne},n=32):(t=String(t),s&64?(n=16,t=[vr(t)]):n=8);e.children=t,e.shapeFlag|=n}function wr(...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=Ge([t.class,s.class]));else if(r==="style")t.style=Ye([t.style,s.style]);else if(Ks(r)){const o=t[r],i=s[r];i&&o!==i&&!(N(o)&&o.includes(i))&&(t[r]=o?[].concat(o,i):i)}else r!==""&&(t[r]=s[r])}return t}{const e=Se(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),o=>{r.length>1?r.forEach(i=>i(o)):r[0](o)}};t("__VUE_INSTANCE_SETTERS__",n=>n),t("__VUE_SSR_SETTERS__",n=>n)}process.env.NODE_ENV;const Er=/(?:^|[-_])\w/g,Nr=e=>e.replace(Er,t=>t.toUpperCase()).replace(/[-_]/g,"");function an(e,t=!0){return K(e)?e.displayName||e.name:e.name||t&&e.__name}function ln(e,t,n=!1){let s=an(t);if(!s&&t.__file){const r=t.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&e){const r=o=>{for(const i in o)if(o[i]===t)return i};s=r(e.components)||e.parent&&r(e.parent.type.components)||r(e.appContext.components)}return s?Nr(s):n?"App":"Anonymous"}function un(e){return K(e)&&"__vccOpts"in e}function Or(){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(a){if(!H(a))return null;if(a.__isVue)return["div",e,"VueInstance"];if(et(a)){const u=a.value;return["div",{},["span",e,h(a)],"<",c(u),">"]}else{if(Bt(a))return["div",{},["span",e,Ze(a)?"ShallowReactive":"Reactive"],"<",c(a),`>${Qe(a)?" (readonly)":""}`];if(Qe(a))return["div",{},["span",e,Ze(a)?"ShallowReadonly":"Readonly"],"<",c(a),">"]}return null},hasBody(a){return a&&a.__isVue},body(a){if(a&&a.__isVue)return["div",{},...o(a.$)]}};function o(a){const u=[];a.type.props&&a.props&&u.push(i("props",T(a.props))),a.setupState!==Je&&u.push(i("setup",a.setupState)),a.data!==Je&&u.push(i("data",T(a.data)));const d=l(a,"computed");d&&u.push(i("computed",d));const _=l(a,"inject");return _&&u.push(i("injected",_)),u.push(["div",{},["span",{style:s.style+";opacity:0.66"},"$ (internal): "],["object",{object:a}]]),u}function i(a,u){return u=be({},u),Object.keys(u).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},a],["div",{style:"padding-left:1.25em"},...Object.keys(u).map(d=>["div",{},["span",s,d+": "],c(u[d],!1)])]]:["span",{}]}function c(a,u=!0){return typeof a=="number"?["span",t,a]:typeof a=="string"?["span",n,JSON.stringify(a)]:typeof a=="boolean"?["span",s,a]:H(a)?["object",{object:u?T(a):a}]:["span",n,String(a)]}function l(a,u){const d=a.type;if(K(d))return;const _={};for(const w in a.ctx)f(d,w,u)&&(_[w]=a.ctx[w]);return _}function f(a,u,d){const _=a[d];if(N(_)&&_.includes(u)||H(_)&&u in _||a.extends&&f(a.extends,u,d)||a.mixins&&a.mixins.some(w=>f(w,u,d)))return!0}function h(a){return Ze(a)?"ShallowRef":a.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 Vr(){Or()}process.env.NODE_ENV!=="production"&&Vr();const kr=["@context","activeLink","computed","dep","excludedKeys","fn","isEncrypted","isLoading","subs","version"];class fn extends Ts{_className="StorePersister";_crypt;_excludedKeys;_persister;_propertiesToEncrypt;_watchedStore;_localOptions;get effectiveOptions(){return this.options??this._localOptions??{}}constructor(t,n,s,r){super(t,n,s,r);const{crypt:o,persister:i,watchedStore:c}=n;this.options||(this._localOptions={excludedKeys:[],persistedPropertiesToEncrypt:[],isEncrypted:!1,watchMutation:!1,...n}),this._excludedKeys=this.initExcludedKeys(),this._persister=i,this._propertiesToEncrypt=new Set(this.getPropertiesToEncrypt()),this._watchedStore=c,o&&(this._crypt=o,this.options&&(this.options.isEncrypted=!1)),this.augmentStore(),this.remember(),this.debugLog("StorePersister constructor",[this.toBeWatched(),c,i,this.options,t,n]),this.toBeWatched()&&(this._watchedStore.add(this.store.$id),this.storeSubscribe=this.storeSubscription.bind(this))}augmentStore(){const t=this.effectiveOptions,{isEncrypted:n,persistedPropertiesToEncrypt:s,watchMutation:r}=typeof t=="object"?t:{};n===void 0&&(t.isEncrypted=!1),s===void 0&&(t.persistedPropertiesToEncrypt=[]),r===void 0&&(t.watchMutation=!1),this.stateHas("isLoading")||this.addToState("isLoading",!1),this.store.persistState=async()=>await this.persist(),this.store.remember=async()=>await this.remember(),this.store.removePersistedState=()=>this._persister.removeItem(this.store.$id),this.store.watch=this.watch,this.store.stopWatch=this.stopWatch}async cryptProperty(t,n,s=!1){return s?await t.decrypt(n):await t.encrypt(n)}async cryptState(t,n=!1){return await new Promise(async s=>{const r=this._crypt,o=this.getPropertiesToEncrypt(),i=this.isEncrypted();if(this.debugLog(`cryptState - ${this.store.$id} ${n?"decrypt":"crypt"}`,["can",this._propertiesToEncrypt.size>0&&i===n&&!!r,r,t]),this._propertiesToEncrypt.size>0&&r){const c={};for(const l of o){const f=this.getValue(t[l]);f&&(c[l]=await this.cryptProperty(r,f,n))}this.debugLog(`cryptState - ${this.store.$id}`,["encryptedState",c]),L(c)||(t={...t,...c},this.options&&(this.options.isEncrypted=!n))}s(t)})}isEncrypted(){return this.effectiveOptions.isEncrypted}getPropertiesToEncrypt(){return this.effectiveOptions?.persistedPropertiesToEncrypt??[]}async getPersistedState(t=!0){const n=this.store.$id;try{let s=await this._persister.getItem(n);return t&&this.toBeCrypted()&&s&&(await this._crypt?.init(),s=await this.cryptState(s,!0)),this.debugLog(`getPersistedState ${n}`,[s,this.state]),s}catch(s){console.log("getPersistedState Error",[n,s])}}async getStateToPersist(){const t=this._excludedKeys,n=this.state,s=this._propertiesToEncrypt.size>0,r=this._crypt;s&&await r.init();const o={};for(const i of Object.keys(n))if(!this.hasDeniedFirstChar(i[0])&&!t.has(i)){const c=n[i];L(c)||(s&&this._propertiesToEncrypt.has(i)?o[i]=await this.cryptProperty(r,c,!1):o[i]=T(c))}return o}getWatchMutation(){return this.effectiveOptions.watchMutation}initExcludedKeys(){return new Set([...kr,...this.effectiveOptions.excludedKeys??[]])}async persist(){const t=await this.getStateToPersist();this.debugLog(`persist() ${this.store.$id} - stateToPersist:`,t),L(t)||this._persister.setItem(this.store.$id,t)}propertyShouldBePersisted(t){return!this._excludedKeys.has(t)}async remember(){return this.state.isLoading=!0,new Promise(async t=>{let n=await this.getPersistedState();return n&&!L(n)&&this.store.$patch(n),this.state.isLoading=!1,t(!0)})}stopWatch(){this.effectiveOptions?.watchMutation&&(this.options?this.options.watchMutation=!1:this._localOptions.watchMutation=!1,this._watchedStore.delete(this.store.$id))}storeSubscription(t){this.debugLog(`store.$subscribe ${this.store.$id}`,[t.type!=="patch object",this.getWatchMutation(),t,this.state,this.store]),t.type!=="patch object"&&this.getWatchMutation()&&this.persist().then(()=>{this.store.mutationCallback&&this.store.mutationCallback(this.state,t)})}toBeCrypted(){return!!(this._crypt&&this.getPropertiesToEncrypt())}toBeWatched(){return!this._watchedStore.has(this.store.$id)}watch(){this.toBeWatched()&&(this.options?this.options.watchMutation=!0:this._localOptions.watchMutation=!0,this.storeSubscribe=this.storeSubscription.bind(this))}}class Cr extends pn{constructor(){super(Kt,fn.customizeStore.bind(fn),F)}}const ke=new Cr;function xr(e,t){return ke.pluginOptions=Rr(e,t),ke}function Rr(e,t){let n,s;const r=new Set;try{if(window)return!L(e)&&e&&(n=new qt({name:e,keyPath:"storeName"})),t&&(s=new ae(t)),{persister:n,crypt:s,watchedStore:r}}catch{}return{persister:n,crypt:s,watchedStore:r}}function Ir(e,t){let n;return t&&(n=new ae(t)),ke.pluginOptions={persister:new Lt({name:e}),crypt:n,watchedStore:new Set},ke}R.PersisterMock=Lt,R.createPersistStatePlugin=xr,R.createPluginMock=Ir,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default class Crypt {
|
|
2
|
+
private _encoder;
|
|
3
|
+
private _key;
|
|
4
|
+
private _materialKey;
|
|
5
|
+
private static DECRYPT;
|
|
6
|
+
private static ENCRYPT;
|
|
7
|
+
constructor(key: string);
|
|
8
|
+
getKey(mode: 'decrypt' | 'encrypt'): Promise<CryptoKey>;
|
|
9
|
+
setKeyMaterial(key: string): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Decrypt string passed in parameter
|
|
12
|
+
* @param {string} item - encrypted string
|
|
13
|
+
* @returns {string} decrypted item
|
|
14
|
+
*/
|
|
15
|
+
decrypt(item: string): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Encrypt string passed in parameter
|
|
18
|
+
* @param {string} item
|
|
19
|
+
* @returns {Promise<string>} encrypted item
|
|
20
|
+
*/
|
|
21
|
+
encrypt(item: string): Promise<string>;
|
|
22
|
+
init(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ClientStorage, StorageItem } from "../types/storage";
|
|
2
|
+
interface ObjectStoreCreationOptions {
|
|
3
|
+
autoIncrement?: boolean;
|
|
4
|
+
keyPath?: string;
|
|
5
|
+
}
|
|
6
|
+
type ObjectItemKey = string | number;
|
|
7
|
+
export default class IndexedDB implements ClientStorage {
|
|
8
|
+
private _db?;
|
|
9
|
+
private _localStorageVersionKey;
|
|
10
|
+
private _name;
|
|
11
|
+
private _objectStore?;
|
|
12
|
+
private _objectStoreOptions?;
|
|
13
|
+
private _objectStoreName;
|
|
14
|
+
private _transactionMode;
|
|
15
|
+
private _version;
|
|
16
|
+
constructor(objectStoreName: string, objectStoreCreationOptions?: ObjectStoreCreationOptions, transactionMode?: IDBTransactionMode);
|
|
17
|
+
clear(): void;
|
|
18
|
+
private createObjectStore;
|
|
19
|
+
deleteObjectStore(): void;
|
|
20
|
+
getItem(key: ObjectItemKey): Promise<StorageItem | undefined>;
|
|
21
|
+
getObjectStoreItem(indexName: string, indexValue: string | number): Promise<Object | undefined>;
|
|
22
|
+
private getStoredVersionNumber;
|
|
23
|
+
private handleDeleteRequest;
|
|
24
|
+
private onError;
|
|
25
|
+
private open;
|
|
26
|
+
private openRequestEventsHandler;
|
|
27
|
+
removeItem(key: ObjectItemKey): void;
|
|
28
|
+
removeItems(excludedItems?: any[]): void;
|
|
29
|
+
private requestEventsHandler;
|
|
30
|
+
private saveVersion;
|
|
31
|
+
setItem(item: Object, index?: string[]): void;
|
|
32
|
+
updateItem(item: Object): void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AllowedKeyPath, ClientStorage, StorageItem } from '../types/storage';
|
|
2
|
+
export type DbOptions = {
|
|
3
|
+
keyPath?: AllowedKeyPath;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
export default class Persister {
|
|
7
|
+
private _db;
|
|
8
|
+
private _db_options;
|
|
9
|
+
get dbName(): string;
|
|
10
|
+
constructor(dbOptions: DbOptions);
|
|
11
|
+
defineDb(): ClientStorage;
|
|
12
|
+
getItem(itemKey: string): Promise<StorageItem | undefined>;
|
|
13
|
+
removeItem(itemKey: string): void;
|
|
14
|
+
setItem(key: string, item: any): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientStorage, StorageItem } from "../types/storage";
|
|
2
|
+
export default class WindowStorage implements ClientStorage {
|
|
3
|
+
private _storage;
|
|
4
|
+
constructor(storageType: "localStorage" | "sessionStorage");
|
|
5
|
+
clear(): void;
|
|
6
|
+
getItem(key: string | number): Promise<StorageItem>;
|
|
7
|
+
removeItem(key: string | number): void;
|
|
8
|
+
removeItems(excludedItems?: any[]): void;
|
|
9
|
+
setItem(item: StorageItem, key: string): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PluginSubscriberInterface } from "pinia-plugin-subscription"
|
|
2
|
+
import { PersistedStore, PersistedStoreOptions } from "./store"
|
|
3
|
+
|
|
4
|
+
declare module 'pinia-plugin-persist-state' {
|
|
5
|
+
export const PeristPiniaState: PluginSubscriberInterface
|
|
6
|
+
|
|
7
|
+
export function createPersistStatePlugin(dbName?: string, cryptKey?: string): PluginSubscriberInterface
|
|
8
|
+
|
|
9
|
+
export function createPluginMock(dbName: string, cryptKey?: string): PluginSubscriberInterface
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module 'pinia' {
|
|
13
|
+
export interface PiniaCustomProperties extends PersistedStore {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface DefineStoreOptionsBase<S, Store> {
|
|
17
|
+
storeOptions?: PersistedStoreOptions
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type { PersistedStore, PersistedStoreOptions, PluginPersistedStoreOptions, } from "./store";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ClientStorage {
|
|
2
|
+
clear(): void;
|
|
3
|
+
getItem(key: string | number): Promise<StorageItem | undefined>;
|
|
4
|
+
removeItem(key: string | number): void;
|
|
5
|
+
removeItems(excludedItems?: any[]): void;
|
|
6
|
+
setItem(item: StorageItem, keyOrIndex?: string | string[]): void;
|
|
7
|
+
}
|
|
8
|
+
export type AllowedKeyPath = 'storeName' | 'id';
|
|
9
|
+
type StorageItemAllowedTypes = boolean | number | string;
|
|
10
|
+
export type StorageItemObject = Record<number | string | symbol, StorageItemAllowedTypes | StorageItemAllowedTypes[] | Record<number | string | symbol, StorageItemAllowedTypes | StorageItemAllowedTypes[]>>;
|
|
11
|
+
export type StorageItem = StorageItemAllowedTypes | StorageItemAllowedTypes[] | StorageItemObject;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Crypt from "../services/Crypt";
|
|
2
|
+
import Persister from "../services/Persister";
|
|
3
|
+
export interface PersistedState {
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface PersistedStore {
|
|
7
|
+
persistState: () => Promise<void>;
|
|
8
|
+
remember: () => Promise<void>;
|
|
9
|
+
removePersistedState: () => void;
|
|
10
|
+
stateIsEmpty?: () => boolean;
|
|
11
|
+
stopWatch: () => void;
|
|
12
|
+
watch: () => void;
|
|
13
|
+
}
|
|
14
|
+
export interface PersistedStoreOptions {
|
|
15
|
+
dbName?: string;
|
|
16
|
+
excludedKeys?: string[];
|
|
17
|
+
isEncrypted?: boolean;
|
|
18
|
+
persist?: boolean;
|
|
19
|
+
persistedPropertiesToEncrypt?: string[];
|
|
20
|
+
watchMutation?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type PluginPersistedStoreOptions = {
|
|
23
|
+
crypt?: Crypt;
|
|
24
|
+
persister?: Persister;
|
|
25
|
+
storeOptions: PersistedStoreOptions;
|
|
26
|
+
watchedStore: Set<string>;
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pluginName = "pinia-plugin-persist-state";
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Alexandre Bidaud <alexbidaud85@gmail.com> (https://github.com/AlxBDo)",
|
|
3
|
+
"name": "pinia-plugin-persist-state",
|
|
4
|
+
"description": "Pinia plugin for persisting store state",
|
|
5
|
+
"version": "0.0.0-alpha.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/types/index.d.ts",
|
|
10
|
+
"import": "./dist/pinia-plugin-persist-state.js",
|
|
11
|
+
"require": "./dist/pinia-plugin-persist-state.umd.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/pinia-plugin-persist-state.umd.cjs",
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "vitest && vite build && tsc --emitDeclarationOnly --outDir dist",
|
|
22
|
+
"preview": "vite preview",
|
|
23
|
+
"test": "vitest",
|
|
24
|
+
"coverage": "vitest run --coverage"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"pinia-plugin-subscription": "^0.0.0-beta.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^24.10.1",
|
|
31
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
32
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
33
|
+
"@vue/tsconfig": "^0.8.1",
|
|
34
|
+
"pinia": "^3.0.2",
|
|
35
|
+
"typescript": "~5.9.3",
|
|
36
|
+
"vite": "^7.2.4",
|
|
37
|
+
"vitest": "^4.0.16",
|
|
38
|
+
"vue": "^3.5.24",
|
|
39
|
+
"vue-tsc": "^3.1.4"
|
|
40
|
+
}
|
|
41
|
+
}
|