epps
Version:
Enhances Pinia stores with advanced features such as persistence, encryption, and store extension. Simplifies state management and ensures data security for Vue.js and Nuxt applications.
22 lines • 51.8 kB
JavaScript
(function(_,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("pinia")):typeof define=="function"&&define.amd?define(["exports","pinia"],m):(_=typeof globalThis<"u"?globalThis:_||self,m(_.Epps={},_.Pinia))})(this,function(_,m){"use strict";var Pr=Object.defineProperty;var Tr=(_,m,x)=>m in _?Pr(_,m,{enumerable:!0,configurable:!0,writable:!0,value:x}):_[m]=x;var h=(_,m,x)=>Tr(_,typeof m!="symbol"?m+"":m,x);class x{constructor(t,s){h(this,"_storeConstructor");h(this,"_id");this._storeConstructor=s,this._id=t}get id(){return this._id}build(t){return t=t?`${t.substring(0,1)}${t.substring(1)}`:"",this._storeConstructor(`${this._id}${t}`)}}const G=class G{constructor(t){h(this,"_encoder",new TextEncoder);h(this,"_key");h(this,"_materialKey");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[s,r]=t.split(":"),n=await crypto.subtle.decrypt({name:"AES-GCM",iv:Uint8Array.from(atob(s),i=>i.charCodeAt(0))},await this.getKey(G.DECRYPT),Uint8Array.from(atob(r),i=>i.charCodeAt(0)));return new TextDecoder().decode(n)}async encrypt(t){const s=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},await this.getKey(G.ENCRYPT),this._encoder.encode(t));return btoa(String.fromCharCode(...new Uint8Array(s)))+":"+btoa(String.fromCharCode(...new Uint8Array(r)))}async init(){this._materialKey||await this.setKeyMaterial(this._key)}};h(G,"DECRYPT","decrypt"),h(G,"ENCRYPT","encrypt");let ct=G;const He="Epps!",zt=(e,t="white")=>`background-color: ${e}; color: ${t}; padding: 1px; margin-right: 5px; font-size: 12px`;function Ke(e,t,s){if(!t)throw new Error("Style instructions are required");console.log("%c%s",t,e,s)}function vt(e,t,s){const r=s?zt(s.bgColor,s.color):zt("#ffec73","green");e=` [${(s==null?void 0:s.icon)??"🍍⚡"} ${He} plugin] - ${e} `,Ke(e,r,t)}function $(e,t){vt(e,t,{bgColor:"#d24545",color:"white",icon:"🍍⚠️"})}class Le{constructor(t){h(this,"_storage");this._storage=t==="localStorage"?localStorage:sessionStorage}clear(){this._storage.clear()}async getItem(t){return new Promise((s,r)=>{const n=this._storage.getItem(t.toString());s(n?JSON.parse(n):void 0)})}removeItem(t){this._storage.removeItem(t.toString())}removeItems(t){for(let s=0;s<this._storage.length;s++){const r=this._storage.key(s);r&&(!t||!t.includes(r))&&this._storage.removeItem(r)}}setItem(t,s){this._storage.setItem(s,JSON.stringify(t))}}let Yt=class{constructor(t,s,r){h(this,"_db");h(this,"_localStorageVersionKey","IDBVersion");h(this,"_name","persistStore");h(this,"_objectStore");h(this,"_objectStoreOptions");h(this,"_objectStoreName");h(this,"_transactionMode","readwrite");h(this,"_version");this._objectStoreName=t,this._version=this.getStoredVersionNumber(),s&&(this._objectStoreOptions=s),r&&(this._transactionMode=r)}clear(){const t=()=>{if(this._objectStore){const s=this._objectStore.clear();this.requestEventsHandler(s,{error:()=>this.onError(s.error)})}};this.open({success:t})}createObjectStore(){this._db&&!this._db.objectStoreNames.contains(this._objectStoreName)&&this._db.createObjectStore(this._objectStoreName,this._objectStoreOptions)}deleteObjectStore(){const t=()=>{var s;(s=this._db)==null||s.deleteObjectStore(this._objectStoreName)};this.open({success:t})}async getItem(t){return new Promise(s=>{const r=()=>{if(this._objectStore){const n=this._objectStore.get(t);this.requestEventsHandler(n,{error:()=>this.onError(n.error,()=>s(void 0)),success:()=>s(n.result)})}};this.open({success:r})})}async getObjectStoreItem(t,s){return new Promise(r=>{const n=()=>{if(this._objectStore){const o=this._objectStore.index(t).get(s);this.requestEventsHandler(o,{error:()=>r(void 0),success:()=>r(o.result)})}};this.open({success:n})})}getStoredVersionNumber(){if(!localStorage)return 1;const t=localStorage.getItem(this._localStorageVersionKey);return t?parseInt(t):1}handleDeleteRequest(t,s){t.onerror=()=>$(`IndexedDB - Item "${s}" remove`,t.error)}onError(t,s){s&&s(t)}open(t){const s=indexedDB.open(this._name,this._version),r=()=>{this._db=s.result},n=o=>{try{if(r(),!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&&o()}catch(c){$("indexedDB - transaction error",[c])}};if(t!=null&&t.success){const o=t.success;t.success=()=>n(o)}if(t!=null&&t.upgrade){const o=t.upgrade.bind(this);t.upgrade=()=>{r(),o()}}const i=()=>{const o=c=>{if((c==null?void 0:c.name)==="VersionError"){this._version++,this.saveVersion(),this.open(t);return}t!=null&&t.error&&t.error(c)};this.onError(s.error,o)};return t&&this.openRequestEventsHandler(s,{...t,error:i}),s}openRequestEventsHandler(t,s){this.requestEventsHandler(t,s),s.upgrade&&(t.onupgradeneeded=s.upgrade)}removeItem(t){const s=()=>{if(this._objectStore){const r=this._objectStore.delete(t);this.handleDeleteRequest(r,t)}};this.open({success:s})}removeItems(t){const s=()=>{if(this._objectStore){const r=this._objectStore.getAllKeys(),n=()=>{r.result.forEach(c=>{if(this._objectStore&&(!t||!t.includes(c))){const a=this._objectStore.delete(c);this.handleDeleteRequest(a,c)}})},i=()=>$("IndexedDB - removeItems",[r.error]);this.requestEventsHandler(r,{error:i,success:n})}};this.open({success:s})}requestEventsHandler(t,s){const{error:r,success:n}=s;r&&(t.onerror=r),n&&(t.onsuccess=n)}saveVersion(){localStorage&&localStorage.setItem(this._localStorageVersionKey,this._version.toString())}setItem(t,s){const r=()=>{if(this._objectStore){const i=this._objectStore.add(t);if(s){const o=()=>{s.forEach(a=>{var l;(l=this._objectStore)==null||l.createIndex(a,a,{unique:!0}),vt(`"${a}" index created`)})},c=()=>this.onError(i.error);this.requestEventsHandler(i,{error:c,success:o})}}},n=this.createObjectStore;this.open({success:r,upgrade:n})}updateItem(t){const s=()=>{if(this._objectStore){const r=this._objectStore.put(t);r.onerror=()=>$("update item",[r.error,t])}};this.open({success:s})}};class at{constructor(t){h(this,"_db");h(this,"_db_options");if(!t)throw new Error("DbOptions is required");this._db_options=t,this._db=this.defineDb()}get dbName(){return this._db_options.name}defineDb(){let{keyPath:t,name:s}=this._db_options,r;switch(s){case"localStorage":case"sessionStorage":r=new Le(s);break;default:t||(t="storeName"),r=new Yt(s,{keyPath:t})}return r}getItem(t){return new Promise((s,r)=>{if(!this._db)return r("No db found");try{return this._db.getItem(t).then(n=>s(n))}catch(n){r(n)}})}removeItem(t){this._db.removeItem(t)}setItem(t,s){if(this._db instanceof Yt)try{this._db.getItem(t).then(r=>{r?this._db.updateItem(r):this._db.setItem({storeName:t,...s})})}catch(r){$("Persister - setItem Error",r),this._db.setItem({storename:t,...s})}else this._db.setItem(s,t)}}/**
* @vue/shared v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**//*! #__NO_SIDE_EFFECTS__ */function Be(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const Nt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Jt=()=>{},We=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),M=Object.assign,qe=Object.prototype.hasOwnProperty,Ot=(e,t)=>qe.call(e,t),S=Array.isArray,Q=e=>Gt(e)==="[object Map]",T=e=>typeof e=="function",I=e=>typeof e=="string",X=e=>typeof e=="symbol",E=e=>e!==null&&typeof e=="object",Ue=Object.prototype.toString,Gt=e=>Ue.call(e),Qt=e=>Gt(e).slice(8,-1),Pt=e=>I(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ze=(e=>{const t=Object.create(null);return s=>t[s]||(t[s]=e(s))})(e=>e.charAt(0).toUpperCase()+e.slice(1)),K=(e,t)=>!Object.is(e,t);let Xt;const ut=()=>Xt||(Xt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Tt(e){if(S(e)){const t={};for(let s=0;s<e.length;s++){const r=e[s],n=I(r)?Qe(r):Tt(r);if(n)for(const i in n)t[i]=n[i]}return t}else if(I(e)||E(e))return e}const Ye=/;(?![^(]*\))/g,Je=/:([^]+)/,Ge=/\/\*[^]*?\*\//g;function Qe(e){const t={};return e.replace(Ge,"").split(Ye).forEach(s=>{if(s){const r=s.split(Je);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function It(e){let t="";if(I(e))t=e;else if(S(e))for(let s=0;s<e.length;s++){const r=It(e[s]);r&&(t+=r+" ")}else if(E(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}/**
* @vue/reactivity v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function L(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let g,Zt=0,Z,k;function Xe(e,t=!1){if(e.flags|=8,t){e.next=k,k=e;return}e.next=Z,Z=e}function Rt(){Zt++}function Dt(){if(--Zt>0)return;if(k){let t=k;for(k=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;Z;){let t=Z;for(Z=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=s}}if(e)throw e}function Ze(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function ke(e){let t,s=e.depsTail,r=s;for(;r;){const n=r.prevDep;r.version===-1?(r===s&&(s=n),te(r),es(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}e.deps=t,e.depsTail=s}function ts(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(kt(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function kt(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===tt)||(e.globalVersion=tt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ts(e))))return;e.flags|=2;const t=e.dep,s=g,r=A;g=e,A=!0;try{Ze(e);const n=e.fn(e._value);(t.version===0||K(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(n){throw t.version++,n}finally{g=s,A=r,ke(e),e.flags&=-3}}function te(e,t=!1){const{dep:s,prevSub:r,nextSub:n}=e;if(r&&(r.nextSub=n,e.prevSub=void 0),n&&(n.prevSub=r,e.nextSub=void 0),process.env.NODE_ENV!=="production"&&s.subsHead===e&&(s.subsHead=n),s.subs===e&&(s.subs=r,!r&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)te(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function es(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let A=!0;const ee=[];function lt(){ee.push(A),A=!1}function ft(){const e=ee.pop();A=e===void 0?!0:e}let tt=0;class ss{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Vt{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){if(!g||!A||g===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==g)s=this.activeLink=new ss(g,this),g.deps?(s.prevDep=g.depsTail,g.depsTail.nextDep=s,g.depsTail=s):g.deps=g.depsTail=s,se(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const r=s.nextDep;r.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=r),s.prevDep=g.depsTail,s.nextDep=void 0,g.depsTail.nextDep=s,g.depsTail=s,g.deps===s&&(g.deps=r)}return process.env.NODE_ENV!=="production"&&g.onTrack&&g.onTrack(M({effect:g},t)),s}trigger(t){this.version++,tt++,this.notify(t)}notify(t){Rt();try{if(process.env.NODE_ENV!=="production")for(let s=this.subsHead;s;s=s.nextSub)s.sub.onTrigger&&!(s.sub.flags&8)&&s.sub.onTrigger(M({effect:s.sub},t));for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{Dt()}}}function se(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)se(r)}const s=e.dep.subs;s!==e&&(e.prevSub=s,s&&(s.nextSub=e)),process.env.NODE_ENV!=="production"&&e.dep.subsHead===void 0&&(e.dep.subsHead=e),e.dep.subs=e}}const pt=new WeakMap,F=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),xt=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),et=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function b(e,t,s){if(A&&g){let r=pt.get(e);r||pt.set(e,r=new Map);let n=r.get(s);n||(r.set(s,n=new Vt),n.map=r,n.key=s),process.env.NODE_ENV!=="production"?n.track({target:e,type:t,key:s}):n.track()}}function C(e,t,s,r,n,i){const o=pt.get(e);if(!o){tt++;return}const c=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:e,type:t,key:s,newValue:r,oldValue:n,oldTarget:i}):a.trigger())};if(Rt(),t==="clear")o.forEach(c);else{const a=S(e),l=a&&Pt(s);if(a&&s==="length"){const p=Number(r);o.forEach((u,d)=>{(d==="length"||d===et||!X(d)&&d>=p)&&c(u)})}else switch((s!==void 0||o.has(void 0))&&c(o.get(s)),l&&c(o.get(et)),t){case"add":a?l&&c(o.get("length")):(c(o.get(F)),Q(e)&&c(o.get(xt)));break;case"delete":a||(c(o.get(F)),Q(e)&&c(o.get(xt)));break;case"set":Q(e)&&c(o.get(F));break}}Dt()}function rs(e,t){const s=pt.get(e);return s&&s.get(t)}function B(e){const t=f(e);return t===e?t:(b(t,"iterate",et),N(e)?t:t.map(y))}function $t(e){return b(e=f(e),"iterate",et),e}const ns={__proto__:null,[Symbol.iterator](){return At(this,Symbol.iterator,y)},concat(...e){return B(this).concat(...e.map(t=>S(t)?B(t):t))},entries(){return At(this,"entries",e=>(e[1]=y(e[1]),e))},every(e,t){return R(this,"every",e,t,void 0,arguments)},filter(e,t){return R(this,"filter",e,t,s=>s.map(y),arguments)},find(e,t){return R(this,"find",e,t,y,arguments)},findIndex(e,t){return R(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return R(this,"findLast",e,t,y,arguments)},findLastIndex(e,t){return R(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return R(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ct(this,"includes",e)},indexOf(...e){return Ct(this,"indexOf",e)},join(e){return B(this).join(e)},lastIndexOf(...e){return Ct(this,"lastIndexOf",e)},map(e,t){return R(this,"map",e,t,void 0,arguments)},pop(){return st(this,"pop")},push(...e){return st(this,"push",e)},reduce(e,...t){return re(this,"reduce",e,t)},reduceRight(e,...t){return re(this,"reduceRight",e,t)},shift(){return st(this,"shift")},some(e,t){return R(this,"some",e,t,void 0,arguments)},splice(...e){return st(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 st(this,"unshift",e)},values(){return At(this,"values",y)}};function At(e,t,s){const r=$t(e),n=r[t]();return r!==e&&!N(e)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.value&&(i.value=s(i.value)),i}),n}const is=Array.prototype;function R(e,t,s,r,n,i){const o=$t(e),c=o!==e&&!N(e),a=o[t];if(a!==is[t]){const u=a.apply(e,i);return c?y(u):u}let l=s;o!==e&&(c?l=function(u,d){return s.call(this,y(u),d,e)}:s.length>2&&(l=function(u,d){return s.call(this,u,d,e)}));const p=a.call(o,l,r);return c&&n?n(p):p}function re(e,t,s,r){const n=$t(e);let i=s;return n!==e&&(N(e)?s.length>3&&(i=function(o,c,a){return s.call(this,o,c,a,e)}):i=function(o,c,a){return s.call(this,o,y(c),a,e)}),n[t](i,...r)}function Ct(e,t,s){const r=f(e);b(r,"iterate",et);const n=r[t](...s);return(n===-1||n===!1)&&_t(s[0])?(s[0]=f(s[0]),r[t](...s)):n}function st(e,t,s=[]){lt(),Rt();const r=f(e)[t].apply(e,s);return Dt(),ft(),r}const os=Be("__proto__,__v_isRef,__isVue"),ne=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(X));function cs(e){X(e)||(e=String(e));const t=f(this);return b(t,"has",e),t.hasOwnProperty(e)}class ie{constructor(t=!1,s=!1){this._isReadonly=t,this._isShallow=s}get(t,s,r){if(s==="__v_skip")return t.__v_skip;const n=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!n;if(s==="__v_isReadonly")return n;if(s==="__v_isShallow")return i;if(s==="__v_raw")return r===(n?i?ms:ue:i?gs:ae).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const o=S(t);if(!n){let a;if(o&&(a=ns[s]))return a;if(s==="hasOwnProperty")return cs}const c=Reflect.get(t,s,O(t)?t:r);return(X(s)?ne.has(s):os(s))||(n||b(t,"get",s),i)?c:O(c)?o&&Pt(s)?c:c.value:E(c)?n?fe(c):le(c):c}}class as extends ie{constructor(t=!1){super(!1,t)}set(t,s,r,n){let i=t[s];if(!this._isShallow){const a=D(i);if(!N(r)&&!D(r)&&(i=f(i),r=f(r)),!S(t)&&O(i)&&!O(r))return a?!1:(i.value=r,!0)}const o=S(t)&&Pt(s)?Number(s)<t.length:Ot(t,s),c=Reflect.set(t,s,r,O(t)?t:n);return t===f(n)&&(o?K(r,i)&&C(t,"set",s,r,i):C(t,"add",s,r)),c}deleteProperty(t,s){const r=Ot(t,s),n=t[s],i=Reflect.deleteProperty(t,s);return i&&r&&C(t,"delete",s,void 0,n),i}has(t,s){const r=Reflect.has(t,s);return(!X(s)||!ne.has(s))&&b(t,"has",s),r}ownKeys(t){return b(t,"iterate",S(t)?"length":F),Reflect.ownKeys(t)}}class us extends ie{constructor(t=!1){super(!0,t)}set(t,s){return process.env.NODE_ENV!=="production"&&L(`Set operation on key "${String(s)}" failed: target is readonly.`,t),!0}deleteProperty(t,s){return process.env.NODE_ENV!=="production"&&L(`Delete operation on key "${String(s)}" failed: target is readonly.`,t),!0}}const ls=new as,fs=new us,jt=e=>e,ht=e=>Reflect.getPrototypeOf(e);function ps(e,t,s){return function(...r){const n=this.__v_raw,i=f(n),o=Q(i),c=e==="entries"||e===Symbol.iterator&&o,a=e==="keys"&&o,l=n[e](...r),p=s?jt:t?Mt:y;return!t&&b(i,"iterate",a?xt:F),{next(){const{value:u,done:d}=l.next();return d?{value:u,done:d}:{value:c?[p(u[0]),p(u[1])]:p(u),done:d}},[Symbol.iterator](){return this}}}}function dt(e){return function(...t){if(process.env.NODE_ENV!=="production"){const s=t[0]?`on key "${t[0]}" `:"";L(`${ze(e)} operation ${s}failed: target is readonly.`,f(this))}return e==="delete"?!1:e==="clear"?void 0:this}}function hs(e,t){const s={get(n){const i=this.__v_raw,o=f(i),c=f(n);e||(K(n,c)&&b(o,"get",n),b(o,"get",c));const{has:a}=ht(o),l=t?jt:e?Mt:y;if(a.call(o,n))return l(i.get(n));if(a.call(o,c))return l(i.get(c));i!==o&&i.get(n)},get size(){const n=this.__v_raw;return!e&&b(f(n),"iterate",F),Reflect.get(n,"size",n)},has(n){const i=this.__v_raw,o=f(i),c=f(n);return e||(K(n,c)&&b(o,"has",n),b(o,"has",c)),n===c?i.has(n):i.has(n)||i.has(c)},forEach(n,i){const o=this,c=o.__v_raw,a=f(c),l=t?jt:e?Mt:y;return!e&&b(a,"iterate",F),c.forEach((p,u)=>n.call(i,l(p),l(u),o))}};return M(s,e?{add:dt("add"),set:dt("set"),delete:dt("delete"),clear:dt("clear")}:{add(n){!t&&!N(n)&&!D(n)&&(n=f(n));const i=f(this);return ht(i).has.call(i,n)||(i.add(n),C(i,"add",n,n)),this},set(n,i){!t&&!N(i)&&!D(i)&&(i=f(i));const o=f(this),{has:c,get:a}=ht(o);let l=c.call(o,n);l?process.env.NODE_ENV!=="production"&&ce(o,c,n):(n=f(n),l=c.call(o,n));const p=a.call(o,n);return o.set(n,i),l?K(i,p)&&C(o,"set",n,i,p):C(o,"add",n,i),this},delete(n){const i=f(this),{has:o,get:c}=ht(i);let a=o.call(i,n);a?process.env.NODE_ENV!=="production"&&ce(i,o,n):(n=f(n),a=o.call(i,n));const l=c?c.call(i,n):void 0,p=i.delete(n);return a&&C(i,"delete",n,void 0,l),p},clear(){const n=f(this),i=n.size!==0,o=process.env.NODE_ENV!=="production"?Q(n)?new Map(n):new Set(n):void 0,c=n.clear();return i&&C(n,"clear",void 0,void 0,o),c}}),["keys","values","entries",Symbol.iterator].forEach(n=>{s[n]=ps(n,e,t)}),s}function oe(e,t){const s=hs(e,t);return(r,n,i)=>n==="__v_isReactive"?!e:n==="__v_isReadonly"?e:n==="__v_raw"?r:Reflect.get(Ot(s,n)&&n in r?s:r,n,i)}const ds={get:oe(!1,!1)},_s={get:oe(!0,!1)};function ce(e,t,s){const r=f(s);if(r!==s&&t.call(e,r)){const n=Qt(e);L(`Reactive ${n} contains both the raw and reactive versions of the same object${n==="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 ae=new WeakMap,gs=new WeakMap,ue=new WeakMap,ms=new WeakMap;function Ss(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ys(e){return e.__v_skip||!Object.isExtensible(e)?0:Ss(Qt(e))}function le(e){return D(e)?e:pe(e,!1,ls,ds,ae)}function fe(e){return pe(e,!0,fs,_s,ue)}function pe(e,t,s,r,n){if(!E(e))return process.env.NODE_ENV!=="production"&&L(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=ys(e);if(i===0)return e;const o=n.get(e);if(o)return o;const c=new Proxy(e,i===2?r:s);return n.set(e,c),c}function he(e){return D(e)?he(e.__v_raw):!!(e&&e.__v_isReactive)}function D(e){return!!(e&&e.__v_isReadonly)}function N(e){return!!(e&&e.__v_isShallow)}function _t(e){return e?!!e.__v_raw:!1}function f(e){const t=e&&e.__v_raw;return t?f(t):e}const y=e=>E(e)?le(e):e,Mt=e=>E(e)?fe(e):e;function O(e){return e?e.__v_isRef===!0:!1}function gt(e){return bs(e,!1)}function bs(e,t){return O(e)?e:new Es(e,t)}class Es{constructor(t,s){this.dep=new Vt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?t:f(t),this._value=s?t:y(t),this.__v_isShallow=s}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 s=this._rawValue,r=this.__v_isShallow||N(t)||D(t);t=r?t:f(t),K(t,s)&&(this._rawValue=t,this._value=r?t:y(t),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:t,oldValue:s}):this.dep.trigger())}}class ws{constructor(t,s,r){this._object=t,this._key=s,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const t=this._object[this._key];return this._value=t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return rs(f(this._object),this._key)}}class vs{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 de(e,t,s){return O(e)?e:T(e)?new vs(e):E(e)&&arguments.length>1?Ns(e,t,s):gt(e)}function Ns(e,t,s){const r=e[t];return O(r)?r:new ws(e,t,s)}class Os{constructor(t,s,r){this.fn=t,this.setter=s,this._value=void 0,this.dep=new Vt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=tt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&g!==this)return Xe(this,!0),!0;process.env.NODE_ENV}get value(){const t=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return kt(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter?this.setter(t):process.env.NODE_ENV!=="production"&&L("Write operation failed: computed value is readonly")}}function Ps(e,t,s=!1){let r,n;T(e)?r=e:(r=e.get,n=e.set);const i=new Os(r,n,s);return process.env.NODE_ENV,i}/**
* @vue/runtime-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/const H=[];function Ts(e){H.push(e)}function Is(){H.pop()}let Ft=!1;function W(e,...t){if(Ft)return;Ft=!0,lt();const s=H.length?H[H.length-1].component:null,r=s&&s.appContext.config.warnHandler,n=Rs();if(r)Ht(r,s,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(""),s&&s.proxy,n.map(({vnode:i})=>`at <${xe(s,i.type)}>`).join(`
`),n]);else{const i=[`[Vue warn]: ${e}`,...t];n.length&&i.push(`
`,...Ds(n)),console.warn(...i)}ft(),Ft=!1}function Rs(){let e=H[H.length-1];if(!e)return[];const t=[];for(;e;){const s=t[0];s&&s.vnode===e?s.recurseCount++:t.push({vnode:e,recurseCount:0});const r=e.component&&e.component.parent;e=r&&r.vnode}return t}function Ds(e){const t=[];return e.forEach((s,r)=>{t.push(...r===0?[]:[`
`],...Vs(s))}),t}function Vs({vnode:e,recurseCount:t}){const s=t>0?`... (${t} recursive calls)`:"",r=e.component?e.component.parent==null:!1,n=` at <${xe(e.component,e.type,r)}`,i=">"+s;return e.props?[n,...xs(e.props),i]:[n+i]}function xs(e){const t=[],s=Object.keys(e);return s.slice(0,3).forEach(r=>{t.push(..._e(r,e[r]))}),s.length>3&&t.push(" ..."),t}function _e(e,t,s){return I(t)?(t=JSON.stringify(t),s?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?s?t:[`${e}=${t}`]:O(t)?(t=_e(e,f(t.value),!0),s?t:[`${e}=Ref<`,t,">"]):T(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=f(t),s?t:[`${e}=`,t])}const ge={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 Ht(e,t,s,r){try{return r?e(...r):e()}catch(n){me(n,t,s)}}function me(e,t,s,r=!0){const n=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||Nt;if(t){let c=t.parent;const a=t.proxy,l=process.env.NODE_ENV!=="production"?ge[s]:`https://vuejs.org/error-reference/#runtime-${s}`;for(;c;){const p=c.ec;if(p){for(let u=0;u<p.length;u++)if(p[u](e,a,l)===!1)return}c=c.parent}if(i){lt(),Ht(i,null,10,[e,a,l]),ft();return}}$s(e,s,n,r,o)}function $s(e,t,s,r=!0,n=!1){if(process.env.NODE_ENV!=="production"){const i=ge[t];if(s&&Ts(s),W(`Unhandled error${i?` during execution of ${i}`:""}`),s&&Is(),r)throw e;console.error(e)}else{if(n)throw e;console.error(e)}}const w=[];let V=-1;const q=[];let j=null,U=0;const As=Promise.resolve();let Kt=null;const Cs=100;function js(e){let t=V+1,s=w.length;for(;t<s;){const r=t+s>>>1,n=w[r],i=rt(n);i<e||i===e&&n.flags&2?t=r+1:s=r}return t}function Ms(e){if(!(e.flags&1)){const t=rt(e),s=w[w.length-1];!s||!(e.flags&2)&&t>=rt(s)?w.push(e):w.splice(js(t),0,e),e.flags|=1,Se()}}function Se(){Kt||(Kt=As.then(ye))}function Fs(e){S(e)?q.push(...e):j&&e.id===-1?j.splice(U+1,0,e):e.flags&1||(q.push(e),e.flags|=1),Se()}function Hs(e){if(q.length){const t=[...new Set(q)].sort((s,r)=>rt(s)-rt(r));if(q.length=0,j){j.push(...t);return}for(j=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),U=0;U<j.length;U++){const s=j[U];process.env.NODE_ENV!=="production"&&be(e,s)||(s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2)}j=null,U=0}}const rt=e=>e.id==null?e.flags&2?-1:1/0:e.id;function ye(e){process.env.NODE_ENV!=="production"&&(e=e||new Map);const t=process.env.NODE_ENV!=="production"?s=>be(e,s):Jt;try{for(V=0;V<w.length;V++){const s=w[V];if(s&&!(s.flags&8)){if(process.env.NODE_ENV!=="production"&&t(s))continue;s.flags&4&&(s.flags&=-2),Ht(s,s.i,s.i?15:14),s.flags&4||(s.flags&=-2)}}}finally{for(;V<w.length;V++){const s=w[V];s&&(s.flags&=-2)}V=-1,w.length=0,Hs(e),Kt=null,(w.length||q.length)&&ye(e)}}function be(e,t){const s=e.get(t)||0;if(s>Cs){const r=t.i,n=r&&Ve(r.type);return me(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. 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,s+1),!1}const Lt=new Map;process.env.NODE_ENV!=="production"&&(ut().__VUE_HMR_RUNTIME__={createRecord:Bt(Ks),rerender:Bt(Ls),reload:Bt(Bs)});const mt=new Map;function Ks(e,t){return mt.has(e)?!1:(mt.set(e,{initialDef:St(t),instances:new Set}),!0)}function St(e){return $e(e)?e.__vccOpts:e}function Ls(e,t){const s=mt.get(e);s&&(s.initialDef.render=t,[...s.instances].forEach(r=>{t&&(r.render=t,St(r.type).render=t),r.renderCache=[],r.update()}))}function Bs(e,t){const s=mt.get(e);if(!s)return;t=St(t),Ee(s.initialDef,t);const r=[...s.instances];for(let n=0;n<r.length;n++){const i=r[n],o=St(i.type);let c=Lt.get(o);c||(o!==s.initialDef&&Ee(o,t),Lt.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?Ms(()=>{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)}Fs(()=>{Lt.clear()})}function Ee(e,t){M(e,t);for(const s in e)s!=="__file"&&!(s in t)&&delete e[s]}function Bt(e){return(t,s)=>{try{return e(t,s)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let z,yt=[];function we(e,t){var s,r;z=e,z?(z.enabled=!0,yt.forEach(({event:n,args:i})=>z.emit(n,...i)),yt=[]):typeof window<"u"&&window.HTMLElement&&!((r=(s=window.navigator)==null?void 0:s.userAgent)!=null&&r.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{we(i,t)}),setTimeout(()=>{z||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,yt=[])},3e3)):yt=[]}let nt=null,Ws=null;const qs=e=>e.__isTeleport;function ve(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ve(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}ut().requestIdleCallback,ut().cancelIdleCallback;const Us=Symbol.for("v-ndc"),zs={};process.env.NODE_ENV!=="production"&&(zs.ownKeys=e=>(W("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 Ys={},Ne=e=>Object.getPrototypeOf(e)===Ys,Js=e=>e.__isSuspense,Oe=Symbol.for("v-fgt"),Gs=Symbol.for("v-txt"),Qs=Symbol.for("v-cmt");function Xs(e){return e?e.__v_isVNode===!0:!1}const Zs=(...e)=>Te(...e),Pe=({key:e})=>e??null,bt=({ref:e,ref_key:t,ref_for:s})=>(typeof e=="number"&&(e=""+e),e!=null?I(e)||O(e)||T(e)?{i:nt,r:e,k:t,f:!!s}:e:null);function ks(e,t=null,s=null,r=0,n=null,i=e===Oe?0:1,o=!1,c=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Pe(t),ref:t&&bt(t),scopeId:Ws,slotScopeIds:null,children:s,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:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:nt};return c?(Wt(a,s),i&128&&e.normalize(a)):s&&(a.shapeFlag|=I(s)?8:16),process.env.NODE_ENV!=="production"&&a.key!==a.key&&W("VNode created with invalid key (NaN). VNode type:",a.type),a}const tr=process.env.NODE_ENV!=="production"?Zs:Te;function Te(e,t=null,s=null,r=0,n=null,i=!1){if((!e||e===Us)&&(process.env.NODE_ENV!=="production"&&!e&&W(`Invalid vnode type when creating vnode: ${e}.`),e=Qs),Xs(e)){const c=Et(e,t,!0);return s&&Wt(c,s),c.patchFlag=-2,c}if($e(e)&&(e=e.__vccOpts),t){t=er(t);let{class:c,style:a}=t;c&&!I(c)&&(t.class=It(c)),E(a)&&(_t(a)&&!S(a)&&(a=M({},a)),t.style=Tt(a))}const o=I(e)?1:Js(e)?128:qs(e)?64:E(e)?4:T(e)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&_t(e)&&(e=f(e),W("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`.",`
Component that was made reactive: `,e)),ks(e,t,s,r,n,o,i,!0)}function er(e){return e?_t(e)||Ne(e)?M({},e):e:null}function Et(e,t,s=!1,r=!1){const{props:n,ref:i,patchFlag:o,children:c,transition:a}=e,l=t?rr(n||{},t):n,p={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Pe(l),ref:t&&t.ref?s&&i?S(i)?i.concat(bt(t)):[i,bt(t)]:bt(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&S(c)?c.map(Ie):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Oe?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&&Et(e.ssContent),ssFallback:e.ssFallback&&Et(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&r&&ve(p,a.clone(p)),p}function Ie(e){const t=Et(e);return S(e.children)&&(t.children=e.children.map(Ie)),t}function sr(e=" ",t=0){return tr(Gs,null,e,t)}function Wt(e,t){let s=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(S(t))s=16;else if(typeof t=="object")if(r&65){const n=t.default;n&&(n._c&&(n._d=!1),Wt(e,n()),n._c&&(n._d=!0));return}else s=32,!t._&&!Ne(t)&&(t._ctx=nt);else T(t)?(t={default:t,_ctx:nt},s=32):(t=String(t),r&64?(s=16,t=[sr(t)]):s=8);e.children=t,e.shapeFlag|=s}function rr(...e){const t={};for(let s=0;s<e.length;s++){const r=e[s];for(const n in r)if(n==="class")t.class!==r.class&&(t.class=It([t.class,r.class]));else if(n==="style")t.style=Tt([t.style,r.style]);else if(We(n)){const i=t[n],o=r[n];o&&i!==o&&!(S(i)&&i.includes(o))&&(t[n]=i?[].concat(i,o):o)}else n!==""&&(t[n]=r[n])}return t}let Re=null;const nr=()=>Re||nt;{const e=ut(),t=(s,r)=>{let n;return(n=e[s])||(n=e[s]=[]),n.push(r),i=>{n.length>1?n.forEach(o=>o(i)):n[0](i)}};t("__VUE_INSTANCE_SETTERS__",s=>Re=s),t("__VUE_SSR_SETTERS__",s=>De=s)}let De=!1;process.env.NODE_ENV;const ir=/(?:^|[-_])(\w)/g,or=e=>e.replace(ir,t=>t.toUpperCase()).replace(/[-_]/g,"");function Ve(e,t=!0){return T(e)?e.displayName||e.name:e.name||t&&e.__name}function xe(e,t,s=!1){let r=Ve(t);if(!r&&t.__file){const n=t.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&e&&e.parent){const n=i=>{for(const o in i)if(i[o]===t)return o};r=n(e.components||e.parent.type.components)||n(e.appContext.components)}return r?or(r):s?"App":"Anonymous"}function $e(e){return T(e)&&"__vccOpts"in e}const cr=(e,t)=>{const s=Ps(e,t,De);if(process.env.NODE_ENV!=="production"){const r=nr();r&&r.appContext.config.warnRecursiveComputed&&(s._warnRecursive=!0)}return s};function ar(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},s={style:"color:#f5222d"},r={style:"color:#eb2f96"},n={__vue_custom_formatter:!0,header(u){if(!E(u))return null;if(u.__isVue)return["div",e,"VueInstance"];if(O(u)){lt();const d=u.value;return ft(),["div",{},["span",e,p(u)],"<",c(d),">"]}else{if(he(u))return["div",{},["span",e,N(u)?"ShallowReactive":"Reactive"],"<",c(u),`>${D(u)?" (readonly)":""}`];if(D(u))return["div",{},["span",e,N(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 d=[];u.type.props&&u.props&&d.push(o("props",f(u.props))),u.setupState!==Nt&&d.push(o("setup",u.setupState)),u.data!==Nt&&d.push(o("data",f(u.data)));const v=a(u,"computed");v&&d.push(o("computed",v));const P=a(u,"inject");return P&&d.push(o("injected",P)),d.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:u}]]),d}function o(u,d){return d=M({},d),Object.keys(d).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},u],["div",{style:"padding-left:1.25em"},...Object.keys(d).map(v=>["div",{},["span",r,v+": "],c(d[v],!1)])]]:["span",{}]}function c(u,d=!0){return typeof u=="number"?["span",t,u]:typeof u=="string"?["span",s,JSON.stringify(u)]:typeof u=="boolean"?["span",r,u]:E(u)?["object",{object:d?f(u):u}]:["span",s,String(u)]}function a(u,d){const v=u.type;if(T(v))return;const P={};for(const ot in u.ctx)l(v,ot,d)&&(P[ot]=u.ctx[ot]);return P}function l(u,d,v){const P=u[v];if(S(P)&&P.includes(d)||E(P)&&d in P||u.extends&&l(u.extends,d,v)||u.mixins&&u.mixins.some(ot=>l(ot,d,v)))return!0}function p(u){return N(u)?"ShallowRef":u.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(n):window.devtoolsFormatters=[n]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;/**
* vue v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function ur(){ar()}process.env.NODE_ENV!=="production"&&ur();class it{constructor(t){h(this,"_actionsToExtends");h(this,"_childId");h(this,"_persist");h(this,"_parentsStores");h(this,"_parentsStoresBuilded");h(this,"_propertiesToRename");this._actionsToExtends=t.actionsToExtends,this._parentsStores=t.parentsStores,this._persist=t.persist,this._propertiesToRename=t.propertiesToRename}get actionsToExtends(){return this._actionsToExtends}get childId(){return this._childId}set childId(t){this._childId=t}get persist(){return this._persist}get propertiesToRename(){return this._propertiesToRename}buildStores(t){var s;!this._childId&&!t||(this._parentsStoresBuilded=(s=this._parentsStores)==null?void 0:s.map(r=>r.build(t??this.childId)))}getStore(t,s){if(this._parentsStores){if(typeof t=="string"){const r=this._parentsStores.find(n=>n.id===t);return r?r.build(s):void 0}if(typeof t=="number")return this._parentsStores[t].build(s)}}getStores(t){return this.parentsStores(t)}parentsStores(t){return this.buildStores(t),this._parentsStoresBuilded}}class Ae{constructor(t,s,r=!1){h(this,"_debug",!1);h(this,"_options");h(this,"_store");h(this,"_watchedStore");this._debug=r,this._options=(s==null?void 0:s.eppsOptions)??s,this._store=t}get debug(){return this._debug}set debug(t){this._debug=t}get options(){return this._options}get parentsStores(){var t;return this.debugLog(`Store.parentsStore - ${this.getStoreName()}`,this.options),this.options instanceof it||typeof((t=this.options)==null?void 0:t.buildStores)=="function"?(this.options.childId=this.store.$id,this.debugLog(`Store.parentsStore EppsOptions - ${this.getStoreName()}`,[this.options.childId,this.options.parentsStores(),this.options]),this.options.parentsStores()):typeof this.store.parentsStores=="function"&&this.store.parentsStores()}get state(){return this._store.$state}set state(t){this._store.$state=t}get store(){return this._store}addPropertiesToState(t,s){t.forEach(r=>this.addToState(r,s?s[r]:void 0))}addToState(t,s){this.isOptionApi()||s!=null&&s.value||(s=gt(s)),this.state[t]=s,this.store[t]=de(this.state,t)}debugLog(t,s){this._debug&&vt(t,s)}getOption(t){return this.options&&this.options[t]}getStatePropertyValue(t){return this.getValue(this.state[t])}getStoreName(){return this.store.hasOwnProperty("getStoreName")?this.store.getStoreName():this.store.$id}getValue(t){return t!=null&&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)}}class lr extends Ae{constructor(s,r,n=!1){super(s,r,n);h(this,"_extendedActions",["removePersistedState","watch","$reset"]);this.extendsStore()}get extendedActions(){var s;return[...this._extendedActions,...((s=this.options)==null?void 0:s.actionsToExtends)??this.getStatePropertyValue("actionsToExtends")??[]]}get propertiesToRename(){return this.options.propertiesToRename}addToCustomProperties(s){}createComputed(s,r){const n=typeof s[r]=="object";return cr({get:()=>this.getValue(s[r]),set:i=>{var o;n&&((o=s[r])!=null&&o.value)?s[r].value=i:s[r]=i}})}duplicateStore(s){const r=["$","_"];Object.keys(s).forEach(n=>{if(r.includes(n[0])&&n!=="$reset")return;const i=typeof s[n];i==="function"?this.storeHas(n)?this.extendedActions.includes(n)&&this.extendsAction(s,n):(this.store[n]=s[n],this.addToCustomProperties(n)):!this.storeHas(n)&&(i==="undefined"||i==="object")&&(this.store[n]=this.createComputed(s,n),this.addToCustomProperties(n))})}extendsAction(s,r){const n=this.store[r];this.isOptionApi()?this.store[r]=function(...i){s[r].apply(this,i),n.apply(this,i)}:this.store[r]=(...i)=>{s[r](...i),n(...i)}}extendsState(s){Object.keys(s.$state).forEach(r=>{if(!this.stateHas(r)){const n=this.getPropertyNameForChildState(r);this.store[n]=this.state[n]=de(s.$state,r),this.addToCustomProperties(n)}})}extendsStore(){if(this.parentsStores){const s=this.parentsStores;if(!s||!s.length)return;s.forEach(r=>{r!=null&&r.$state&&(this.duplicateStore(r),this.extendsState(r))})}}getPropertyNameForChildState(s){return(this.propertiesToRename&&this.propertiesToRename[s])??s}}function Y(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 wt=(e,t,s)=>{const r=Object.keys(e),n=t&&Object.keys(t);return!t||!n||!s&&r.length!==n.length||s&&r.filter(i=>!s.includes(i)).length!==n.filter(i=>!s.includes(i)).length?!1:Object.keys(e).reduce((i,o)=>{var c;return i&&(!s||!s.includes(o))&&(!e[o]||!t[o]?i=e[o]===t[o]:Array.isArray(e[o])?(i=e[o].length===((c=t[o])==null?void 0:c.length),i&&e[o].forEach((a,l)=>{if(!i)return i;typeof a=="object"?i=!Y(t[o][l])&&wt(a,t[o][l],s):a!==t[o][l]&&(i=!1)})):typeof e[o]=="object"?i=wt(e[o],t[o],s):i=e[o]===t[o]),i},!0)};class fr extends Ae{constructor(s,r,n,i,o,c=!1){var a;super(s,r,c);h(this,"_crypt");h(this,"_persister");h(this,"_statePropertiesNotToPersist",["@context","actionsToExtends","activeLink","computed","dep","excludedKeys","fn","isEncrypted","isLoading","persist","persistedPropertiesToEncrypt","subs","version","watchMutation"]);this._persister=n,this._watchedStore=i??[],o&&(this._crypt=o,(a=this.options)!=null&&a.persist&&(this.options.persist.isEncrypted=!1)),this.hasPersistProperty()&&(this.augmentStore(),this.remember(),this.debugLog("StorePersister constructor",[this.toBeWatched(),i,n,this.options,s]),this.toBeWatched()&&this.storeSubscription())}augmentStore(){var s;if((s=this.options)!=null&&s.persist){const{isEncrypted:r,persist:n,persistedPropertiesToEncrypt:i,watchMutation:o}=this.options.persist;r===void 0&&(this.options.persist.isEncrypted=!1),n===void 0&&(this.options.persist.persist=!!this.options.persist.watchMutation),i===void 0&&(this.options.persist.persistedPropertiesToEncrypt=[]),o===void 0&&(this.options.persist.watchMutation=!1)}else this.stateHas("persist")||this.addToState("persist",!1),this.stateHas("persistedPropertiesToEncrypt")||this.addToState("persistedPropertiesToEncrypt",[]),this.stateHas("watchMutation")||this.addToState("watchMutation",!1),this.stateHas("isEncrypted")||this.addToState("isEncrypted",!1);this.store.persistState=async()=>await this.persist(),this.store.remember=async()=>await this.remember(),this.store.removePersistedState=()=>this._persister.removeItem(this.getStoreName()),this.store.watch=()=>{var r;this.toBeWatched()&&((r=this.options)!=null&&r.persist?this.options.persist.watchMutation=!0:this.addToState("watchMutation",!0),this.storeSubscription())},this.store.stopWatch=()=>this.stopWatch()}async cryptState(s,r=!1){return await new Promise(async n=>{var a;const i=this._crypt,o=this.getPropertiesToEncrypt(),c=this.isEncrypted(s);if(this.debugLog(`cryptState - ${this.getStoreName()} ${r?"decrypt":"crypt"}`,["can",Array.isArray(o)&&o.length>0&&c===r&&!!i,[Array.isArray(o)&&o.length>0,i],s]),Array.isArray(o)&&o.length>0&&i){const l={};for(const p of o){const u=this.getValue(s[p]);if(u)if(r){if(u.indexOf(":")<1)return this.store.removePersistedState(),n({});l[p]=await i.decrypt(u)}else l[p]=await i.encrypt(u)}this.debugLog(`cryptState - ${this.getStoreName()}`,["encryptedState",l]),Y(l)||(s={...s,...l},(a=this.options)!=null&&a.persist?this.options.persist.isEncrypted=!r:s.isEncrypted=!r)}n(s)})}isEncrypted(s){var r;return(((r=this.options)==null?void 0:r.persist)&&this.options.persist.isEncrypted)??this.getValue(s?s.isEncrypted:this.state.isEncrypted)}getPropertiesToEncrypt(){var s,r;return(((s=this.options)==null?void 0:s.persist)&&((r=this.options.persist)==null?void 0:r.persistedPropertiesToEncrypt))??this.state.hasOwnProperty("persistedPropertiesToEncrypt")}async getPersistedState(){var r;const s=this.getStoreName();try{let n=await this._persister.getItem(s);return this.toBeCrypted()&&n&&(await((r=this._crypt)==null?void 0:r.init()),n=await this.cryptState({...f(this.state),...n},!0)),this.debugLog(`getPersistedState ${s}`,[n,this.state]),n}catch(n){$("getPersistedState Error",[s,n])}}getStatePropertyToNotPersist(){var s;return[...this._statePropertiesNotToPersist,...(((s=this.options)==null?void 0:s.persist)&&this.options.persist.excludedKeys)??this.getStatePropertyValue("excludedKeys")??[]]}getWatchMutation(){var s;return(((s=this.options)==null?void 0:s.persist)&&this.options.persist.watchMutation)??this.getStatePropertyValue("watchMutation")}hasPersistProperty(){return!!(this.options&&this.options.persist)||this.state.hasOwnProperty("persist")}async persist(){var i;let s=await this.getPersistedState(),r=this.state;this.toBeCrypted()&&(await((i=this._crypt)==null?void 0:i.init()),r=await this.cryptState(r));const n=this.populateState(r,s);this.debugLog(`persistStore persist ${this.getStoreName()}`,["toBeCrypted",this.toBeCrypted(),"areIdentical",wt(n,s??{},this.getStatePropertyToNotPersist()),"newState",n,"persistedState",s,"state",r,"store",this.store,"Crypt",this._crypt]),!(Y(n)||this.stateIsEmpty&&this.stateIsEmpty(n))&&(!s||!wt(n,s,this.getStatePropertyToNotPersist()))&&this._persister.setItem(this.getStoreName(),n)}populateState(s,r){const n=this.getStatePropertyToNotPersist(),i=["_","$"];return Object.keys(s).reduce((o,c)=>{if(!i.includes(c[0])&&!n.includes(c)){const a=this.getValue(s[c]),l=r&&this.getValue(r[c]);Y(a)&&l?o[c]=l:Array.isArray(a)?o[c]=a.map(p=>typeof p=="object"?this.populateState(p):f(p)):typeof a=="object"?o[c]=this.populateState(a,l):o[c]=f(a??l)}return o},{})}propertyShouldBePersisted(s){return!this.getStatePropertyToNotPersist().includes(s)}async remember(){return new Promise(async s=>{let r=await this.getPersistedState();return r&&!this.stateIsEmpty(r)&&this.store.$patch(r),s(!0)})}shouldBePersisted(){var s,r;return this.hasPersistProperty()&&(((r=(s=this.options)==null?void 0:s.persist)==null?void 0:r.persist)??this.getStatePropertyValue("persist"))}stateIsEmpty(s){var r,n;return((r=this.store)==null?void 0:r.stateIsEmpty)&&((n=this.store)==null?void 0:n.stateIsEmpty(s))}stopWatch(){var s,r;(s=this.options)!=null&&s.persist&&((r=this.options.persist)!=null&&r.watchMutation)?this.options.persist.watchMutation=!1:this.getStatePropertyValue("watchMutation")&&this.addToState("watchMutation",!1)}storeSubscription(){this.debugLog(`storeSubscription ${this.getStoreName()}`,[this.toBeWatched(),this.state,this.store]),this.toBeWatched()&&(this._watchedStore.push(this.getStoreName()),this.store.$subscribe((s,r)=>{this.debugLog(`store.$subscribe ${this.getStoreName()}`,[s.type!=="patch object",this.getWatchMutation(),s,this.state,this.store]),s.type!=="patch object"&&this.getWatchMutation()&&this.persist()}))}toBeCrypted(){return!!(this._crypt&&this.getPropertiesToEncrypt())}toBeWatched(){return this.shouldBePersisted()&&!this._watchedStore.includes(this.getStoreName())}}class qt{constructor(t,s,r=!1){h(this,"_db");h(this,"_debug",!1);h(this,"_crypt");h(this,"_watchedStore",[]);this._debug=r,t instanceof at&&(this._db=t),s&&(this._crypt=s)}get db(){return this._db}get crypt(){return this._crypt}eppsStoreNotDefinedByOptions({store:t,options:s}){Object.keys(t.$state).find(r=>["actionsToExtends","isExtended","parentsStores","persist","watchMutation"].includes(r))&&$(`Coming soon not maintained :
${t.$id} use state to define epps store options.`,"The configuration of the epps stores has been changed, see documentation : https://main.d1f2uye6dxmhh3.amplifyapp.com/docs/usage")}plugin(t){try{this.eppsStoreNotDefinedByOptions(t);const{store:s,options:r}=t;new lr(s,r,this._debug),this.db instanceof at&&new fr(s,r,this.db,this._watchedStore,this._crypt,this._debug),this.rewriteResetStore(t,Object.assign({},s.$state))}catch(s){$("plugin()",[s,t])}}rewriteResetStore({store:t},s){t.$reset=()=>{t.$state.persist&&t.removePersistedState();const r=typeof t.parentsStores=="function"&&t.parentsStores();Array.isArray(r)&&r.length&&r.forEach(n=>n.$reset()),t.$patch(Object.assign({},s))}}}function pr(e,t,s=!1){if(window){const r=!Y(e)&&e?new at({name:e,keyPath:"storeName"}):void 0;let n;t&&(n=new ct(t)),typeof s!="boolean"&&(s=!1);const i=new qt(r,n,s);return i.plugin.bind(i)}return()=>({})}class hr{constructor(){h(this,"_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 s of this._store.keys())t.includes(s)||this._store.delete(s);else this._store.clear()}setItem(t,s){this._store.set(s,t)}}let J={};const dr={clear:()=>J={},getItem:async e=>new Promise(t=>t(J[e])),removeItem:e=>delete J[e],removeItems:e=>e?e.forEach(t=>delete J[t]):J={},setItem:(e,t)=>{J[t]=e}};class _r extends at{defineDb(){return this.dbName==="localStorage"?dr:new hr}}function gr(e,t){let s;t&&(s=new ct(t));const r=new qt(new _r({name:e}),s);return r.plugin.bind(r)}const mr=(e=!0,t,s,r=!1)=>({excludedKeys:s,isEncrypted:r,persist:e,persistedPropertiesToEncrypt:t});function Ut(e,t,s){return s instanceof it&&(s={eppsOptions:s}),typeof t=="function"?Sr(e,t,s):yr(e,t,s)}function Sr(e,t,s){return m.defineStore(e,t,s)}function yr(e,t,s){return s&&(t={...t,...s??{}}),m.defineStore(e,t)}function br(e,t){return`${e}-${t}`}function Er(e,t,s=!0){return e.filter(r=>Object.keys(t).every(n=>{const i=typeof r[n]=="string"?r[n].toLowerCase():r[n],o=typeof t[n]=="string"?t[n].toLowerCase():t[n];return s?i==o:i.includes(o)}))}function wr(e,t){return e.find(s=>Object.keys(t).every(r=>s[r]===t[r]))}function Ce(e){return e.id?{id:e.id}:{"@id":e["@id"]}}const je=e=>m.defineStore(e??"collectionStore",{state:()=>({items:[]}),actions:{addItem(t){let s;if((t.id||t["@id"])&&(s=this.getItem(Ce(t)),s)){this.updateItem(t,s);return}this.items.push(t)},clear(){this.items=[]},getItem(t){return wr(this.items,t)},getItems(t){return t?Er(this.items,t):this.items},removeItem(t){this.items=this.items.filter(s=>s.id!==t.id)},setItems(t){Array