vue-composable
Advanced tools
Comparing version 1.0.0-alpha.34 to 1.0.0-alpha.35
@@ -381,2 +381,4 @@ import { ComputedRef } from '@vue/runtime-core'; | ||
export declare const MAX_ARRAY_SIZE: number; | ||
export declare function minMax(val: number, min: number, max: number): number; | ||
@@ -836,2 +838,71 @@ | ||
export declare interface UndoOperation { | ||
/** | ||
* Move state | ||
* @param step - Positive position | ||
*/ | ||
(step: number): void; | ||
/** | ||
* Move 1 step in history | ||
*/ | ||
(): void; | ||
} | ||
export declare interface UndoOptions<T> { | ||
/** | ||
* Watch `deep` option for changes | ||
*/ | ||
deep: boolean; | ||
/** | ||
* Max history change | ||
* @default MAX_ARRAY_SIZE | ||
* | ||
*/ | ||
maxLength: number; | ||
/** | ||
* Clone strategy | ||
* @default (x)=>x | ||
*/ | ||
clone: (entry: T) => T; | ||
} | ||
export declare interface UndoReturn<T> { | ||
/** | ||
* Current value | ||
*/ | ||
value: Ref<T>; | ||
/** | ||
* Undo state to the previous | ||
*/ | ||
undo(): void; | ||
/** | ||
* Undo state | ||
* @param step - Positive position | ||
*/ | ||
undo(step: number): void; | ||
/** | ||
* Redo state to the previous | ||
*/ | ||
redo(): void; | ||
/** | ||
* Redo state | ||
* @param step - Positive position | ||
*/ | ||
redo(step: number): void; | ||
/** | ||
* Moves the cursor to delta | ||
* @param delta - If positive it will `undo` the state, if negative it will `redo` | ||
*/ | ||
jump(delta: number): void; | ||
/** | ||
* List of previous states | ||
*/ | ||
prev: ComputedRef<T[]>; | ||
/** | ||
* List of next states | ||
* This is only populated if you `undo` or `jump` | ||
*/ | ||
next: ComputedRef<T[]>; | ||
} | ||
export declare function unwrap<T>(o: RefTyped<T>): T; | ||
@@ -1010,3 +1081,3 @@ | ||
export declare function useHydration(): Readonly<Ref<boolean>>; | ||
export declare function useHydration(): Ref<Boolean>; | ||
@@ -1236,2 +1307,6 @@ /** | ||
export declare function useUndo<T = any>(): UndoReturn<T | undefined>; | ||
export declare function useUndo<T>(defaultValue: RefTyped<T>, options?: Partial<UndoOptions<T>>): UndoReturn<T>; | ||
declare type UseValidation<T> = { | ||
@@ -1238,0 +1313,0 @@ [K in keyof T]: ValidationInput<T[K]>; |
@@ -1,1 +0,1 @@ | ||
var vueComposable=function(e,t){"use strict";function n(e){return t.isRef(e)?e.value:e}function r(e){return t.isRef(e)?e:t.ref(e)}const o=Array.isArray,a=e=>"function"==typeof e,s=e=>"string"==typeof e,u=e=>"boolean"==typeof e,l=e=>c(e)&&a(e.getTime),i=e=>"number"==typeof e,c=e=>null!==e&&"object"==typeof e,v=e=>c(e)&&!!e.tagName;function d(e){return c(e)&&a(e.then)&&a(e.catch)}const f=()=>{},m=()=>!1,p={passive:!0};function h(e){return new Promise(t=>{setTimeout(t,e)})}function g(e,t,n){return e<t?t:e>n?n:e}const y="undefined"!=typeof window;function w(e,...t){for(let r=0;r<t.length;r++){const o=t[r];if(void 0===o||!c(o))continue;const a=Object.keys(o);for(let t=0;t<a.length;t++){const r=a[t],s=n(o[r]),u=typeof s,l=typeof e[r];void 0!==e[r]&&u!==l||(e[r]=c(s)?w(e[r]||{},s):o[r])}}return e}function b(e,n,o,a){let s=f;if(e){const u=r(e),l=e=>e.removeEventListener(n,o),i=e=>e.addEventListener(n,o,a),c=t.watch(u,(e,t,n)=>{e&&(i(e),n(()=>l(e)))},{immediate:!0});s=()=>{l(u.value),c()}}return s}function E(e,t,n){return S(e,t,n)}function S(e,t=50,n={isImmediate:!1}){let r;return function(...o){const a=this,s=n.isImmediate&&void 0===r;void 0!==r&&clearTimeout(r),r=setTimeout((function(){r=void 0,n.isImmediate||e.apply(a,o)}),t),s&&e.apply(a,o)}}function $(e,n){if(!e)throw new Error(`[usePromise] argument can't be '${e}'`);if("function"!=typeof e)throw new Error("[usePromise] expects function, but received "+typeof e);const[r,o]=u(n)?[n,!1]:c(n)?[n.lazy,n.throwException]:[!1,!1],a=t.ref(!1),s=t.ref(null),l=t.ref(null),i=t.ref(),v=async(...t)=>{a.value=!0,s.value=null;const n=t&&e.length!==t.length&&t.length>0&&u(t[t.length-1])?t[t.length-1]:o,r=i.value=e(...t);try{const e=await r;return i.value===r&&(l.value=e),e}catch(e){return i.value===r&&(s.value=e,l.value=null),n?r:void 0}finally{i.value===r&&(a.value=!1)}};return r||v(),{exec:v,result:l,promise:i,loading:a,error:s}}function M(e,n){const r=t.ref(!1);let o=void 0;return{...$((...t)=>{return n=e(...t),new Promise((e,t)=>{o=e=>{r.value=!0,t(e)},n.then(e).catch(t)});var n},n),cancel:e=>{o&&o(e)},cancelled:r}}const k=Symbol(""),I=Symbol(""),x=async(e,t,n,r)=>{const o=t[k].value;let a=-1;const s=e.maxRetries||9001,u=e.retryDelay||L;t.retryErrors.value=[],t.isRetrying.value=!1,t.nextRetry.value=void 0;let c=void 0;do{let e=!1,v=null;try{if(++a,v=r?n(...r):n(),d(v)&&(v=await v),t[I].value)return null;e=!0}catch(e){v=null,t.retryErrors.value.push(e)}if(o!==t[k].value)return v;if(e)return t.isRetrying.value=!1,t.nextRetry.value=void 0,v;if(a>=s)return t.isRetrying.value=!1,t.nextRetry.value=void 0,Promise.reject(new Error("[useRetry] max retries reached "+s));t.isRetrying.value=!0;const f=Date.now(),m=u(a),p=d(m)?await m:m;if(!d(m)||p){if(i(p))c=p;else{if(!l(p))throw new Error(`[useRetry] invalid value received from options.retryDelay '${typeof p}'`);c=p.getTime()}c<f?t.nextRetry.value=f+c:(t.nextRetry.value=c,c-=f),c>0&&await h(c)}if(t[I].value)return null;if(o!==t[k].value)return v}while(a<9e3);return null};const L=()=>0;function R(e){return e&&(u(e.isJson)||u(e.parseImmediate))}let O=void 0;let P=void 0,T=void 0;let C=void 0,j=void 0;function D(e,n){const r=y&&"BroadcastChannel"in self,o=t.ref(null),a=t.ref(null),s=t.ref(null),u=t.ref(!1),l=t.ref(!1);let i=f,c=f,v=f;if(r){const r=new BroadcastChannel(e);r.addEventListener("messageerror",e=>{s.value=e,u.value=!0},p),r.addEventListener("message",e=>{a.value=e,o.value=e.data},p),i=e=>r.postMessage(e),c=()=>{r.close(),l.value=!0},v=(e,n)=>{r.addEventListener("message",e,n),t.onUnmounted(()=>r.removeEventListener("message",e))},t.onUnmounted(()=>{n&&n(),c()})}return{supported:r,data:o,messageEvent:a,errorEvent:s,errored:u,isClosed:l,send:i,close:c,addListener:v}}function F(e,t){const n=getComputedStyle(e).getPropertyValue(t);return n?n.trim():null}function A(e,t,n){e.style.setProperty(t,n)}const V={attributes:!0,childList:!0,subtree:!0},U=e=>e.length<=2||"-"!==e[0]||"-"!==e[1]?"--"+e:e;const W=e=>function(t){const n=t.data||[];return new Promise(t=>{try{Promise.resolve(e.apply(e,n)).then(e=>t(postMessage([!0,e]))).catch(e=>t(postMessage([!1,e])))}catch(e){t(postMessage([!1,e]))}})};function z(e){const n=!!y&&"matchMedia"in window;let r=void 0,o=void 0,a=f;if(n){r=t.ref(matchMedia(e)),o=t.ref(r.value.matches);const n=e=>{o.value=e.matches};r.value.addEventListener("change",n,p);const a=()=>r.value.removeEventListener("change",n);t.onUnmounted(a)}else r=t.ref({}),o=t.ref(!1);return{supported:n,mediaQueryList:r,matches:o,remove:a}}function N(e,n){const{addListener:r,send:o,close:a,supported:s}=D(e,()=>w()),u=Date.now(),l=t.ref(!1),i=t.ref(0),v=t.computed(()=>1!==i.value||l.value),d=t.ref([]),f=t.ref(n);let m=!1,h=void 0;o({type:0});const g=()=>o({type:5,id:u}),w=()=>{0!==d.value.length&&(l.value&&o({type:3,mind:1,id:Math.min(...d.value)}),o({type:4,id:u}))};return r(e=>{switch(e.data.type){case 0:o({type:2,value:f.value,mind:i.value});break;case 4:{const t=d.value.indexOf(e.data.id);t>=0&&d.value.splice(t,1),h===e.data.id&&d.value.length>0&&o({type:3,mind:1,id:Math.min(u,...d.value)});break}case 2:m=!0,f.value=e.data.value,i.value=e.data.mind;break;case 3:i.value=e.data.mind,h=1===e.data.mind&&e.data.id||void 0,l.value=h===u,l.value&&(d.value=[],g());break;case 5:d.value=[e.data.id],o({type:6,id:u});break;case 6:d.value.push(e.data.id)}},p),g(),t.watch(f,(e,t)=>{if(m)m=!1;else{if(1===i.value&&!1===l.value)return m=!0,void(f.value=t);o({type:2,mind:i.value,value:c(e)?{...e}:e}),m=!1}},{deep:!0,immediate:!1}),y&&window.addEventListener("unload",w,p),t.onUnmounted(()=>{w(),a()}),{supported:s,id:u,data:f,master:l,mind:i,editable:v,targets:d,ping:g,setMind:e=>{switch(e){case 1:l.value=!0;break;case 0:l.value=!1}i.value=e,o({type:3,id:u,mind:i.value})},addListener:r}}function B(e,n){const r=Symbol(),o=t.inject(e,r);return o===r?n():o}function H(e,n){const a=r(n),u=r(e);return c(a.value)||t.isRef(n)?[void 0!==u.value?u:void 0,a]:!c(u.value)||o(u.value)||s(u.value)?[u.value?u:void 0,void 0]:[void 0,u]}function _(e,r){const[o,a]=H(e,r),s=t.computed(()=>new Intl.NumberFormat(n(o),n(a))),u=(e,t,r)=>(t||r?new Intl.NumberFormat(n(r)||n(o),{...n(a),...n(t)}):s.value).format(n(e));return{format:(e,n,r)=>t.computed(()=>u(e,n,r)),formatString:u,formatter:s}}function K(e){if(e)return i(e)?e:q(e)}const q=e=>{const t=e.match(/^(\d+)px$/);if(t)return+t[1]};function J(e){const n={},r=new Map,o=t.ref();let a=[];const s=[];for(const o in e){const u=e[o],l=K(u);if(void 0!==l){const e=t.ref(!1);n[o]=e,r.set(l,{name:o,valid:e}),a.push(l)}else{const{matches:e,remove:t}=z(u);n[o]=e,s.push(t)}}a=a.sort((e,t)=>t-e);const u=y?()=>{const e=window.innerWidth;let t=void 0;for(let n=0;n<a.length;n++){const o=a[n],s=r.get(o);s.valid.value=e>=o,e>=o&&void 0===t&&(t=s.name)}o.value=t}:f,l=E(u,10),i=y?()=>window.removeEventListener("resize",l):f;return y&&(t.onMounted(()=>{u(),window.addEventListener("resize",l,p)}),t.onUnmounted(()=>{i(),s.forEach(e=>e())})),{...n,remove:i,current:o}}const Q=Symbol(""),G={sm:640,md:768,lg:1024,xl:1280};function X(e){return c(e)&&c(e.theme)&&c(e.theme.screens)}function Y(e){return!!c(e)&&(s(e.min)||s(e.max)||i(e.min)||i(e.max))}function Z(e){const t=[];if(o(e)){const n=e.map(Z);for(let e=0;e<n.length;e++){const r=n[e];t.push(...r)}}else c(n=e)&&s(n.raw)?t.push(e.raw):Y(e)?t.push(function(e){return Y(e)?`(${[e.max&&"max-width: "+e.max,e.min&&"min-width: "+e.min].filter(Boolean).join(" and ")})`:""}(e)):(s(e)||i(e))&&t.push("min-width: "+e);var n;return t}function ee(e){const n=X(e)?e.theme.screens:e;if(X(e))for(const e in n)n.hasOwnProperty(e)&&(n[e]=Z(n[e]).join(" or "));const r=J(n);return t.provide(Q,r),r}function te(e,t){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&(t&&0!==t.length||!1)}function ne(e){try{if(!e)return!1;const t=":$";return e.setItem(t,t),e.removeItem(t),!0}catch(t){return te(t,e)}}function re(e,t){try{return e.parse(t)}catch{return t}}let oe=void 0;function ae(e,n=JSON,o=10){const a=y?window[e]:void 0,u=ne(a);oe||(oe=new Map,y&&window.addEventListener("storage",e=>{if(e.newValue===e.oldValue)return;let t=oe.get("localStorage");t=e.storageArea===window.localStorage?oe.get("localStorage"):oe.get("sessionStorage"),t&&Object.keys(t.$syncKeys).length>0&&(null===e.key?t.clear():t.$syncKeys[e.key]&&(null===e.newValue?t.removeItem(e.key):t.updateItem(e.key,e.newValue)))}));let l,i=oe.get(e);return u&&a?i?l=i.$quotaError:(l=t.ref(!1),i={$refMap:new Map,$watchHandlers:new Map,$syncKeys:{},$quotaError:l,key:a.key,length:a.length,setSync(e,t){t?this.$syncKeys[e]=!0:delete this.$syncKeys[e]},clear(){this.$refMap.forEach((e,t)=>this.removeItem(t))},removeItem(e){const t=this.$refMap.get(e);t&&(t.value=void 0);const n=this.$watchHandlers.get(e);n&&n(),delete this.$syncKeys[e],this.$refMap.delete(e),a.removeItem(e)},getItem(e){const t=a.getItem(e);return t?this.setItem(e,re(n,t)):null},setItem(e,u){const i=r(u);this.$refMap.set(e,i);const c=(e,t)=>{try{const r=a.getItem(e),o=s(t)?t:n.stringify(t);a.setItem(e,o),r!==o&&y&&this.$syncKeys[e]&&window.dispatchEvent(new StorageEvent(e,{newValue:o,oldValue:r,storageArea:a}))}catch(e){l.value=te(e,a)}};c(e,u);const v=t.watch(i,S(t=>{c(e,t)},o),{immediate:!1,deep:!0});return this.$watchHandlers.set(e,v),i},updateItem(e,t){let r=this.$refMap.get(e);r&&(r.value=re(n,t))}},oe.set(e,i)):(l=t.ref(!1),i={}),{supported:u,quotaError:l,store:i,remove:()=>oe.delete(e)}}function se(e,n,r){const{supported:o,store:a}=ae("localStorage");let s=f,u=f,l=f,i=void 0;return o&&a?(l=t=>a.setSync(e,t),s=()=>a.removeItem(e),u=()=>a.clear(),i=a.getItem(e),i||(i=a.setItem(e,n)),!1!==r&&l(!0)):i=t.ref(n),{supported:o,storage:i,clear:u,remove:s,setSync:l}}function ue(e,n,r){const{supported:o,store:a}=ae("sessionStorage");let s=f,u=f,l=m,i=void 0;return o&&a?(s=()=>a.removeItem(e),u=()=>a.clear(),i=a.getItem(e),i||(i=a.setItem(e,n))):i=t.ref(n),{supported:o,storage:i,clear:u,remove:s,setSync:l}}let le=void 0;function ie(e){const n=r(e.currentPage),o=r(e.pageSize),a=t.ref(0),s=r(e.total),u=t.computed({get:()=>a.value,set(e){i(e)&&(a.value=Math.min(e,s.value))}}),l=t.computed({get:()=>n.value,set(e){i(e)&&(n.value=g(e,1,v.value),u.value=(n.value-1)*c.value)}}),c=t.computed({get:()=>o.value,set(e){i(e)&&(o.value=e)}}),v=t.computed(()=>Math.ceil(s.value/c.value));l.value=n.value;return t.watch([s,c],e=>{l.value>v.value&&(l.value=v.value)},{immediate:!1}),{pageSize:c,total:s,currentPage:l,offset:u,lastPage:v,next:()=>++l.value,prev:()=>--l.value,first:()=>l.value=1,last:()=>l.value=v.value}}function ce(e){const n=e&&e.refreshMs||1e3,r=!e||!u(e.sync)||e.sync,o=e&&a(e.timeFn)&&e.timeFn||Date.now;let s=void 0,l=void 0;const i=t.ref(o()),c=()=>{clearInterval(s),clearTimeout(l)},v=y?()=>s=setInterval(()=>i.value=o(),n):f;if(r){const e=1e3-(i.value-1e3*Math.floor(i.value/1e3));l=setTimeout(v,e)}else v();return t.onUnmounted(c),{now:i,remove:c}}function ve(e,r){return t.computed(()=>{const a=n(e);if(!r)return a;const s=t.isRef(r)?t.reactive(r.value):t.reactive(r);return a.replace(/({?{[\w\s]*}?})/g,e=>{const t=e.replace("{","").replace("}","").trim();if(e[0]===e[1]&&"{"===e[0])return""+t;const r=o(s)?s[+t]:s[t];return void 0===r?e:""+n(r)})})}function de(e,r,o=".",a=f){return t.computed(()=>{const t=n(e),s=n(r);if(void 0===t)return a(s,t,s,t);if(!s)return t;const u=s.split(o);let l=t;for(let e=0;e<u.length;e++){let n=u[e];if("]"===n[n.length-1]){const t=/\[[`'"]?([^`'"\]]*)[`'"]?\]/g;let r=n,o=t.exec(r);if(o){let a=o[0].length,s=o.index-a,l=1;do{o.index,s=o.index,a=o[0].length,n=n.slice(0,-o[0].length),u.splice(e+l,0,o[1]),++l}while(o=t.exec(r));if(!n&&"["===r[0]&&r.length>2)continue}else n="",console.warn(`[usePath] invalid path provided "${r}"`)}if(!c(l))return a(u.slice(0,e+1).join(o),l,s,t);if(!n)return a(u.slice(0,e+1).join(o),l,s,t);if(l=l[n],!l)return a(u.slice(0,e+1).join(o),l,s,t)}return l})}function fe(e){return void 0!==e.$value}const me=(e,r,o)=>{const{$message:a,$validator:s,...u}=function(e){return c(e)}(r)?r:{$validator:r,$message:""},{$pending:l,$promise:i,$invalid:v,$error:f}=((e,r,o)=>{const a=t.ref(null),s=t.ref(!1),u=t.ref(),l=t.ref(!1);let i=void 0;const c=e=>{a.value=(async()=>{try{s.value=!0;const t=r(e,i);d(t)?l.value=!await t:l.value=!t}catch(e){throw l.value=!0,e}finally{s.value=!1}})().catch(e=>(u.value=n(e),l.value=!0,e))};return o.push(n=>{i=n,t.watch(()=>{try{r(e.value,i)}catch(e){}return e.value},c,{deep:!0,immediate:!0})}),{$promise:a,$pending:s,$invalid:l,$error:u}})(e,s,o);return{$pending:l,$error:f,$promise:i,$invalid:v,$message:a,...u}},pe=(e,o)=>{const a={},s=fe(e)?r(e.$value):void 0;for(const r of Object.keys(e))if("$"!==r[0])if(s){const t=me(s,e[r],o);a[r]={...t,$value:s}}else{const s=pe(e[r],o);let l,i,c=void 0;if(fe(s)){const e=Object.keys(s).filter(e=>"$"!==e[0]).map(e=>s[e]);l=t.computed(()=>e.map(e=>e.$error).filter(Boolean).map(e=>n(e))),i=t.computed(()=>e.some(e=>!!n(e.$invalid)))}else{const e=Object.keys(s).map(e=>s[e]);l=t.computed(()=>e.map(e=>n(e.$errors)).filter(Boolean).filter(e=>e.some(Boolean))),c=t.computed(()=>e.some(e=>e.$anyDirty||u(n(e.$dirty))&&n(e.$dirty))),i=t.computed(()=>e.some(e=>!!n(e.$anyInvalid)))}a[r]={...s,$errors:l,$anyInvalid:i},c&&(a[r].$anyDirty=c)}else{if("$value"===r){a[r]=s;const e=t.ref(!1),n=t.watch(s,()=>{e.value=!0,n()},{immediate:!1,deep:!0});a.$dirty=e;continue}a[r]=e[r]}return a};const he=Symbol("");function ge(e){const o=t.ref(Object.keys(e.messages)),s=t.ref(e.messages),l=t.ref(e.locale),i=t.ref({});let c=t.ref();const v={},f=(e,n)=>{if(v[e])return v[e];const o=n.value[e];if(!o)return t.ref({});let s=a(o)?o():o;return d(s)?s.then(t=>v[e]=r(t)):a(o)?r(s):v[e]=t.computed(()=>n.value[e])},m=!!e.fallback&&(!u(e.notFoundFallback)||e.notFoundFallback);let p=!1;if(m){const t=f(e.fallback,s);d(t)?(t.then(e=>{c.value=e.value}),p=!0):c.value=t.value}else c.value={};const h=t.ref(0);t.watch(s,()=>h.value++,{deep:!0,immediate:!1}),t.watch([l,c,h],([t,r,o])=>{if(t===e.fallback&&m)i.value=r;else{const e=e=>i.value=w({},r,n(e)),o=f(t,s);d(o)?o.then(e):e(o)}},{immediate:!p});const g=(t,n)=>e.resolve?r(e.resolve(i.value,t,n)):ve(de(i,t,".",(e,t,n,r)=>n),n);return{locale:l,locales:o,i18n:i,$t:g,$ts:(e,t)=>g(e,t).value,addLocale:(e,t)=>{o.value.indexOf(e)>=0||o.value.push(e),delete v[e],s.value[e]=t},removeLocale:t=>{const n=o.value.indexOf(t);if(n>=0){const r=[l.value,c.value&&e.fallback,...o.value].find(e=>e&&e!==t);r&&(t===e.fallback&&(c.value=void 0),t===l.value&&(l.value=r)),o.value.splice(n,1)}delete s.value[t],delete v[t]}}}function ye(e){const n=ge(e);return t.provide(he,n),n}const we=Symbol("");const be=Symbol(""),Ee={install(e){const n=t.ref(!0),r=t.readonly(n);{e._context.provides[be]=r;const t=e.mount;e.mount=(...e)=>{const r=t(...e);return n.value=!1,r}}}};return e.COMMIT="44bb00c",e.FALSE_OP=m,e.NO_OP=f,e.PASSIVE_EV=p,e.VERSION="1.0.0-alpha.34",e.VUE_VERSION="3",e.buildI18n=ge,e.debounce=S,e.deepClone=w,e.exponentialDelay=e=>{const t=100*Math.pow(2,e);return t+.2*t*Math.random()},e.exposeWorker=function(e){this.onmessage=async t=>{const n=e(t.data);if(void 0===n)this.postMessage(n);else if(null===n)this.postMessage(n);else if(o(n))this.postMessage(n);else if(n[Symbol.asyncIterator])for await(const e of n)this.postMessage(e);else if(n[Symbol.iterator])for(const e of n)this.postMessage(e);else this.postMessage(await n)}},e.getCssVariableFor=F,e.hydrationPlugin=Ee,e.injectFactory=B,e.isArray=o,e.isBoolean=u,e.isClient=y,e.isDate=l,e.isElement=v,e.isFunction=a,e.isNumber=i,e.isObject=c,e.isPromise=d,e.isString=s,e.isSymbol=e=>"symbol"==typeof e,e.minMax=g,e.noDelay=L,e.promisedTimeout=h,e.provideSSRTitle=function(e,t){const n=r(void 0===t?"":t);return e.provide(we,n),n},e.refShared=function(e,n){const r=t.getCurrentInstance(),o=n||r.vnode.scopeId;if(!o)return t.ref(e);const{data:a,supported:s}=N(o,e);return a},e.setBreakpointTailwindCSS=ee,e.setCssVariableFor=A,e.setI18n=ye,e.storageAvailable=ne,e.unwrap=n,e.useArrayPagination=function(e,n){const o=r(e),a=ie({currentPage:1,pageSize:10,...n,total:t.computed(()=>o.value.length)}),s=t.computed(()=>{const e=o.value;return Array.isArray(e)?e.slice(a.offset.value,a.offset.value+a.pageSize.value):[]});return{...a,result:s}},e.useBreakpoint=J,e.useBreakpointChrome=function(){return J({mobileS:320,mobileM:375,mobileL:425,tablet:768,laptop:1024,laptopL:1440,desktop4K:2560})},e.useBreakpointTailwindCSS=function(e){return B(Q,()=>ee(e||G))},e.useBroadcastChannel=D,e.useCancellablePromise=M,e.useCssVariables=function(e,o,a){const u=y&&"MutationObserver"in self,[l,i]=t.isRef(o)||v(o)?[o,a||V]:[u&&document.documentElement||{},o||V],c=t.ref(!0),d={},m=[],p=Object.entries(e).map(e=>{const[t,o]=s(e[1])?[e[1]]:[e[1].name,e[1].value];return o&&(m.push(()=>A(n(l),t,n(o))),d[e[0]]=r(o)),[e[0],U(t)]});for(let e=0;e<p.length;e++){const[o,a]=p[e];d[o]||(d[o]=t.ref(t.isRef(l)&&!l.value||!u?null:F(n(l),a))),u&&t.watch([d[o],r(l)],e=>{c&&e[1]&&e[0]!==F(e[1],a)&&A(e[1],a,e[0])},{immediate:!t.isRef(l)})}if(!u)return{...d,stop:f,resume:f,supported:u,observing:c};const h=()=>{for(let e=0;e<p.length;e++){const[t,r]=p[e];d[t].value=F(n(l),r)}},g=new MutationObserver(h),w=()=>{g.disconnect(),c.value=!1},b=()=>{c.value||h(),g.observe(n(l),i),c.value=!0};return t.onUnmounted(w),t.isRef(l)?t.onMounted(()=>{m.forEach(e=>e()),t.watch(l,(e,t)=>{t&&w(),e&&b()})}):(y||l)&&(m.forEach(e=>e()),b()),{...d,supported:u,resume:b,stop:w,observing:c}},e.useCurrencyFormat=function(e,r,o){const a=n(e),s=!c(a),u=s?e:t.computed(()=>n(e).currency),[l,i]=H(r,s?o:e),v=t.computed(()=>{const e=n(i)||{},t=n(u)||e.currency;return{style:"currency",...e,currency:t}}),d=_(l),f=(e,t,r,o,a)=>{const s={...v.value,...n(o)},u=n(t)||s.currency,l=n(r)||s.currencyDisplay;return d.formatString(e,{...s,currency:u,currencyDisplay:l},a)};return{format:(e,n,r,o,a)=>t.computed(()=>f(e,n,r,o,a)),formatString:f}},e.useDateNow=function(e){return ce({refreshMs:e&&e.refreshMs||1e3,sync:!e||!u(e.sync)||e.sync,timeFn:Date.now})},e.useDebounce=E,e.useEvent=b,e.useFetch=function(e,n){const r=t.ref(null),o=t.ref(""),a=t.ref(),u=t.ref(null),[l,i]=R(e)?[!1!==e.isJson,!1!==e.parseImmediate]:R(n)?[!1!==n.isJson,!1!==n.parseImmediate]:[!0,!0],c=e?s(e)?n:R(e)?e:s(e.url)?n:e:void 0,v=t.ref(!1),d=t.ref();let f=void 0;const m=$(async(e,t)=>{f=new AbortController;const n=await fetch(e,{signal:f.signal,...c,...t});if(n){const e=[l?n.clone().json().then(e=>r.value=e).catch(e=>{r.value=null,u.value=e}):Promise.resolve(),n.clone().blob().then(e=>{a.value=e}),n.clone().text().then(e=>{o.value=e})];i&&await Promise.all(e)}return n},!0),p=t.computed(()=>m.result.value&&m.result.value.status||null),h=t.computed(()=>m.result.value&&m.result.value.statusText||null);return e&&(s(e)||s(e.url))&&m.exec(e,void 0,!1),{...m,cancel:e=>{f&&(f.abort(),v.value=!0,d.value=e)},isCancelled:v,cancelledMessage:d,text:o,blob:a,json:r,jsonError:u,status:p,statusText:h}},e.useFormat=ve,e.useGeolocation=function(e){const n=y&&!!navigator.geolocation,r=t.ref(e?!1===e.immediate:void 0),o=t.ref(null),a=t.ref(null),s=t.ref(null),l=t.ref(e&&e.enableHighAccuracy||null);let i=f;if(n){const n=e=>{a.value=e.timestamp,s.value=e.coords,o.value=null},c=e=>{a.value=Date.now(),s.value=null,o.value=e},v=()=>!0!==r.value&&f&&navigator.geolocation.clearWatch(f);let d=()=>navigator.geolocation.getCurrentPosition(n,c,e);i=r.value?()=>{r.value?r.value=!1:d()}:d;let f=0;t.onMounted(()=>t.watch([l,r],t=>{v();const r=u(t[0])?t[0]:e?e.enableHighAccuracy:void 0;f=navigator.geolocation.watchPosition(n,c,e?{...e,enableHighAccuracy:r}:{enableHighAccuracy:r})},{immediate:!r.value})),t.onUnmounted(v)}return{supported:n,refresh:i,error:o,timestamp:a,coords:s,highAccuracy:l}},e.useHydration=function(){return t.inject(be,t.computed(()=>!1))},e.useI18n=function(e){return e?ye(e):t.inject(he)},e.useIntersectionObserver=function(e,o){const a=y&&"IntersectionObserver"in window,s=e?r(e):void 0,u=!s||!v(s.value)&&s.value?void 0:s,l=t.computed(()=>o?n(o):u?void 0:n(e)),i=t.ref([]),c=t.computed(()=>i.value.length>0&&i.value.every(e=>e.isIntersecting)),d=e=>{i.value=e};let m=t.ref();a&&t.watch(l,e=>{m.value&&m.value.disconnect();const t=e&&e&&{root:n(e.root),rootMargin:n(e.rootMargin),threshold:n(e.threshold)}||void 0;m.value=new IntersectionObserver(d,t);i.value.map(e=>e.target).forEach(m.value.observe)},{deep:!0,immediate:!0});const p=a?e=>{const t=n(e);m.value.observe(t)}:f,h=a?e=>{const t=n(e);m.value.unobserve(t)}:f,g=()=>m.value.disconnect();return u&&(t.onMounted(()=>{u.value&&p(u)}),t.onUnmounted(()=>{g()})),{supported:a,elements:i,observe:p,unobserve:h,disconnect:g,isIntersecting:c}},e.useIntlNumberFormat=_,e.useLanguage=function(){if(C||(C=y?t.ref(navigator.language):t.ref("")),!j)if(y){j=t.ref(navigator.languages);const e=()=>{C.value=navigator.language,j.value=navigator.languages};window.addEventListener("languagechange",e,p)}else j=t.ref([]);return{language:C,languages:j}},e.useLocalStorage=se,e.useMatchMedia=z,e.useNetworkInformation=function(){const e=!!y&&(navigator.connection||navigator.mozConnection||navigator.webkitConnection),n=!!e,r=t.ref(0),o=t.ref(0),a=t.ref("none"),s=t.ref(0),u=t.ref(!1),l=t.ref("none");let i=f,c=f;return e&&(i=()=>{r.value=e.downlink,o.value=e.downlinkMax,a.value=e.effectiveType,s.value=e.rtt,u.value=e.saveData,l.value=e.type},c=b(e,"change",i,p),i()),{supported:n,downlink:r,downlinkMax:o,effectiveType:a,rtt:s,saveData:u,type:l,remove:c}},e.useNow=ce,e.useOnMouseMove=function(e,n,r){const o=t.ref(0),a=t.ref(0);let s=e=>{o.value=e.x,a.value=e.y};const[u,l]=i(n)?[void 0,n]:[n,r];l&&(s=E(s,r));const c=b(e,"mousemove",s,u);return{mouseX:o,mouseY:a,remove:c}},e.useOnResize=function(e,n,o){const a=r(e),s=t.ref(a.value&&a.value.clientHeight),u=t.ref(a.value&&a.value.clientWidth);let l=()=>{s.value=a.value.clientHeight,u.value=a.value.clientWidth};const[c,v]=i(n)?[void 0,n]:[n,o];v&&(l=E(l,o));const d=y?b(window,"resize",l,c||p):f;return{height:s,width:u,remove:d}},e.useOnScroll=function(e,n,o){const a=e=>!(i(e)||u(e)||!v(e)&&!t.isRef(e)||!e),s=a(e)?r(e):t.ref(y&&window||void 0),l=a(e)?s:t.ref(y&&window.document.scrollingElement||void 0),c=t.ref(l.value&&l.value.scrollTop||0),d=t.ref(l.value&&l.value.scrollLeft||0);let f=()=>{c.value=l.value.scrollTop,d.value=l.value.scrollLeft};const m=(...e)=>l.value&&l.value.scrollTo&&l.value.scrollTo.apply(l.value,e),h=e=>m({top:e}),g=e=>m({left:e}),[w,S]=i(e)||!e?[p,e]:i(n)?[p,n]:[n,o];S&&(f=E(f,o));const $=b(s,"scroll",f,w),M=t.watch(c,h,{immediate:!1}),k=t.watch(d,g,{immediate:!1});return{scrollTop:c,scrollLeft:d,scrollTo:m,remove:()=>{$(),k(),M()},scrollTopTo:h,scrollLeftTo:g}},e.useOnline=function(){const e=y&&"onLine"in navigator;return e||(O=t.ref(!1)),O||(O=t.ref(navigator.onLine),window.addEventListener("offline",()=>O.value=!1,p),window.addEventListener("online",()=>O.value=!0,p)),{supported:e,online:O}},e.usePageVisibility=function(){return T||(T=t.ref(y&&document.hidden)),P||(y?(P=t.ref(document.visibilityState),document.addEventListener("visibilitychange",()=>{P.value=document.visibilityState,T.value=document.hidden},p)):P=t.ref("visible")),{visibility:P,hidden:T}},e.usePagination=ie,e.usePath=de,e.usePerformanceNow=function(e){return ce({refreshMs:e&&e.refreshMs||1e3,sync:!e||!u(e.sync)||e.sync,timeFn:()=>performance.now()})},e.usePromise=$,e.usePromiseLazy=function(e,t=!1){return $(e,{lazy:!0,throwException:t})},e.useRetry=function(e,n){const r=!e||a(e)?{}:e,o=a(e)?e:n;if(!a(e)&&!c(e))throw new Error("[useRetry] options needs to be 'object'");if(o&&!a(o))throw new Error("[useRetry] factory needs to be 'function'");const s=t.ref(!1),u=t.ref(),l=t.ref([]),i={value:!1},v={isRetrying:s,retryCount:t.computed(()=>l.value.length),nextRetry:u,retryErrors:l,[k]:{value:0},[I]:i},d=o?(...e)=>(++v[k].value,x(r,v,o,e)):e=>(++v[k].value,x(r,v,e,void 0));return{...v,cancel:()=>{v.isRetrying.value=!1,v.retryErrors.value.push(new Error("[useRetry] cancelled")),v.nextRetry.value=void 0,i.value=!0},exec:d}},e.useSSRTitle=function(e){const n=Symbol(),r=t.inject(we,n);return r===n||void 0===r?t.ref(s(e)?e:""):(s(e)&&(r.value=e),r)},e.useSessionStorage=ue,e.useShare=function(e){const n=y&&"share"in navigator;let r=()=>Promise.resolve(!1),o=m,a=t.ref(!1),s=t.ref(!1);return n&&(r=e=>(a.value=!1,s.value=!1,navigator.share(e).then(e=>(a.value=!0,e)).catch(e=>(a.value=!1,s.value=!0,!1))),o=e=>navigator.canShare(e),e&&o(e)&&r(e)),{supported:n,share:r,canShare:o,shared:a,cancelled:s}},e.useSharedRef=N,e.useStorage=function(e,t,n){return void 0===le&&(le=ae("localStorage").supported),le?se(e,t,n):ue(e,t)},e.useTitle=function(e=null){const n=t.ref(s(e)?e:document.title),r=new MutationObserver(e=>{n.value=e[0].target.textContent});t.watch(n,(e,t)=>{s(e)&&e!==t&&(document.title=e)},{immediate:!0,flush:"sync"});const o=document.querySelector("title");return r.observe(o,{childList:!0}),t.onUnmounted(()=>r.disconnect()),n},e.useVModel=function(e,n){const r=t.getCurrentInstance();return r?t.computed({get:()=>e[n],set(e){r.emit("update:"+n,e)}}):t.ref()},e.useValidation=function(e){const n=[],r=pe({input:e},n),o=t.reactive(r.input);return n.forEach(e=>e(o)),o},e.useWebSocket=function(e,n){const r=y&&"WebSocket"in window;let o=null;const a=t.ref(null),s=t.ref(null),u=t.ref(null),l=t.ref(!1),i=t.ref(!1),c=t.ref(!1);let v=f,d=f;return r&&(o=new WebSocket(e,n),o.addEventListener("message",e=>{a.value=e,u.value=e.data}),o.addEventListener("error",e=>{s.value=e,c.value=!0}),o.addEventListener("close",()=>{l.value=!1,i.value=!0}),o.addEventListener("open",()=>{l.value=!0,i.value=!1}),v=e=>o.send(e),d=(e,t)=>{o.close(e,t)}),{supported:r,ws:o,send:v,close:d,messageEvent:a,errorEvent:s,data:u,isOpen:l,isClosed:i,errored:c}},e.useWebStorage=ae,e.useWorker=function(e,n,r){const o=y&&"Worker"in self,a=t.ref(),s=t.ref(),u=t.ref(!o),l=t.ref(!o);if(!o)return u.value=!0,{worker:void 0,data:s,postMessage:f,terminate:f,errorEvent:a,errored:l,terminated:u};const i=new Worker(e,r),c=e=>i.postMessage(e);function v(){i.terminate(),u.value=!0}return i.addEventListener("message",e=>{s.value=e.data},p),i.addEventListener("error",e=>{a.value=e,l.value=!0},p),t.onUnmounted(v),n&&c(n),{worker:i,data:s,postMessage:c,terminate:v,errorEvent:a,errored:l,terminated:u}},e.useWorkerFunction=function(e,r){const o=y&&"Worker"in self,a=t.computed(()=>r&&n(r.dependencies)||[]),s=t.computed(()=>r&&n(r.timeout));if(!o)return M(e,{lazy:!0,throwException:!0});const u=M((...n)=>new Promise((r,o)=>{const l=function(e,t){const n=[t.length>0?`importScripts("${t.join('","')}");`:"","onmessage=",`(${W.toString()})(${e.toString()})`],r=new Blob(n,{type:"text/javascript"});return URL.createObjectURL(r)}(e,a.value),i=new Worker(l);let c=-1;const v=s.value,d=()=>{i.terminate(),URL.revokeObjectURL(l),clearTimeout(c),h()},m=n.length===e.length+1&&t.isRef(n[n.length-1])&&!1===n[n.length-1].value?t.computed(()=>u.cancelled.value||n[n.length-1].value):u.cancelled,h=m?t.watch(m,()=>{d(),r(void 0)},{immediate:!1}):f;i.addEventListener("message",e=>{e.data[0]?r(e.data[1]):o(e.data[1]),d()},p),i.addEventListener("error",e=>{d(),o(e)},p),i.postMessage([...n]),v&&(c=setTimeout(()=>{u.cancel(`[WebWorker] timeout after ${v}ms`)},v))}),{lazy:!0,throwException:!0});return u},e.wrap=r,e}({},VueRuntimeCore); | ||
var vueComposable=function(e,t){"use strict";function n(e){return t.isRef(e)?e.value:e}function r(e){return t.isRef(e)?e:t.ref(e)}const o=Array.isArray,a=e=>"function"==typeof e,u=e=>"string"==typeof e,l=e=>"boolean"==typeof e,s=e=>c(e)&&a(e.getTime),i=e=>"number"==typeof e,c=e=>null!==e&&"object"==typeof e,v=e=>c(e)&&!!e.tagName;function d(e){return c(e)&&a(e.then)&&a(e.catch)}const f=()=>{},m=()=>!1,p={passive:!0};function h(e){return new Promise(t=>{setTimeout(t,e)})}function g(e,t,n){return e<t?t:e>n?n:e}const y="undefined"!=typeof window;function w(e,...t){for(let r=0;r<t.length;r++){const o=t[r];if(void 0===o||!c(o))continue;const a=Object.keys(o);for(let t=0;t<a.length;t++){const r=a[t],u=n(o[r]),l=typeof u,s=typeof e[r];void 0!==e[r]&&l!==s||(e[r]=c(u)?w(e[r]||{},u):o[r])}}return e}function b(e,n,o,a){let u=f;if(e){const l=r(e),s=e=>e.removeEventListener(n,o),i=e=>e.addEventListener(n,o,a),c=t.watch(l,(e,t,n)=>{e&&(i(e),n(()=>s(e)))},{immediate:!0});u=()=>{s(l.value),c()}}return u}function E(e,t,n){return S(e,t,n)}function S(e,t=50,n={isImmediate:!1}){let r;return function(...o){const a=this,u=n.isImmediate&&void 0===r;void 0!==r&&clearTimeout(r),r=setTimeout((function(){r=void 0,n.isImmediate||e.apply(a,o)}),t),u&&e.apply(a,o)}}function M(e,n){if(!e)throw new Error(`[usePromise] argument can't be '${e}'`);if("function"!=typeof e)throw new Error("[usePromise] expects function, but received "+typeof e);const[r,o]=l(n)?[n,!1]:c(n)?[n.lazy,n.throwException]:[!1,!1],a=t.ref(!1),u=t.ref(null),s=t.ref(null),i=t.ref(),v=async(...t)=>{a.value=!0,u.value=null;const n=t&&e.length!==t.length&&t.length>0&&l(t[t.length-1])?t[t.length-1]:o,r=i.value=e(...t);try{const e=await r;return i.value===r&&(s.value=e),e}catch(e){return i.value===r&&(u.value=e,s.value=null),n?r:void 0}finally{i.value===r&&(a.value=!1)}};return r||v(),{exec:v,result:s,promise:i,loading:a,error:u}}function $(e,n){const r=t.ref(!1);let o=void 0;return{...M((...t)=>{return n=e(...t),new Promise((e,t)=>{o=e=>{r.value=!0,t(e)},n.then(e).catch(t)});var n},n),cancel:e=>{o&&o(e)},cancelled:r}}const x=Symbol(""),I=Symbol(""),k=async(e,t,n,r)=>{const o=t[x].value;let a=-1;const u=e.maxRetries||9001,l=e.retryDelay||L;t.retryErrors.value=[],t.isRetrying.value=!1,t.nextRetry.value=void 0;let c=void 0;do{let e=!1,v=null;try{if(++a,v=r?n(...r):n(),d(v)&&(v=await v),t[I].value)return null;e=!0}catch(e){v=null,t.retryErrors.value.push(e)}if(o!==t[x].value)return v;if(e)return t.isRetrying.value=!1,t.nextRetry.value=void 0,v;if(a>=u)return t.isRetrying.value=!1,t.nextRetry.value=void 0,Promise.reject(new Error("[useRetry] max retries reached "+u));t.isRetrying.value=!0;const f=Date.now(),m=l(a),p=d(m)?await m:m;if(!d(m)||p){if(i(p))c=p;else{if(!s(p))throw new Error(`[useRetry] invalid value received from options.retryDelay '${typeof p}'`);c=p.getTime()}c<f?t.nextRetry.value=f+c:(t.nextRetry.value=c,c-=f),c>0&&await h(c)}if(t[I].value)return null;if(o!==t[x].value)return v}while(a<9e3);return null};const L=()=>0;function R(e){return e&&(l(e.isJson)||l(e.parseImmediate))}let O=void 0;let P=void 0,T=void 0;let j=void 0,C=void 0;function A(e,n){const r=y&&"BroadcastChannel"in self,o=t.ref(null),a=t.ref(null),u=t.ref(null),l=t.ref(!1),s=t.ref(!1);let i=f,c=f,v=f;if(r){const r=new BroadcastChannel(e);r.addEventListener("messageerror",e=>{u.value=e,l.value=!0},p),r.addEventListener("message",e=>{a.value=e,o.value=e.data},p),i=e=>r.postMessage(e),c=()=>{r.close(),s.value=!0},v=(e,n)=>{r.addEventListener("message",e,n),t.onUnmounted(()=>r.removeEventListener("message",e))},t.onUnmounted(()=>{n&&n(),c()})}return{supported:r,data:o,messageEvent:a,errorEvent:u,errored:l,isClosed:s,send:i,close:c,addListener:v}}function D(e,t){const n=getComputedStyle(e).getPropertyValue(t);return n?n.trim():null}function F(e,t,n){e.style.setProperty(t,n)}const V={attributes:!0,childList:!0,subtree:!0},U=e=>e.length<=2||"-"!==e[0]||"-"!==e[1]?"--"+e:e;const W=e=>function(t){const n=t.data||[];return new Promise(t=>{try{Promise.resolve(e.apply(e,n)).then(e=>t(postMessage([!0,e]))).catch(e=>t(postMessage([!1,e])))}catch(e){t(postMessage([!1,e]))}})};function z(e){const n=!!y&&"matchMedia"in window;let r=void 0,o=void 0,a=f;if(n){r=t.ref(matchMedia(e)),o=t.ref(r.value.matches);const n=e=>{o.value=e.matches};r.value.addEventListener("change",n,p);const a=()=>r.value.removeEventListener("change",n);t.onUnmounted(a)}else r=t.ref({}),o=t.ref(!1);return{supported:n,mediaQueryList:r,matches:o,remove:a}}function N(e,n){const{addListener:r,send:o,close:a,supported:u}=A(e,()=>w()),l=Date.now(),s=t.ref(!1),i=t.ref(0),v=t.computed(()=>1!==i.value||s.value),d=t.ref([]),f=t.ref(n);let m=!1,h=void 0;o({type:0});const g=()=>o({type:5,id:l}),w=()=>{0!==d.value.length&&(s.value&&o({type:3,mind:1,id:Math.min(...d.value)}),o({type:4,id:l}))};return r(e=>{switch(e.data.type){case 0:o({type:2,value:f.value,mind:i.value});break;case 4:{const t=d.value.indexOf(e.data.id);t>=0&&d.value.splice(t,1),h===e.data.id&&d.value.length>0&&o({type:3,mind:1,id:Math.min(l,...d.value)});break}case 2:m=!0,f.value=e.data.value,i.value=e.data.mind;break;case 3:i.value=e.data.mind,h=1===e.data.mind&&e.data.id||void 0,s.value=h===l,s.value&&(d.value=[],g());break;case 5:d.value=[e.data.id],o({type:6,id:l});break;case 6:d.value.push(e.data.id)}},p),g(),t.watch(f,(e,t)=>{if(m)m=!1;else{if(1===i.value&&!1===s.value)return m=!0,void(f.value=t);o({type:2,mind:i.value,value:c(e)?{...e}:e}),m=!1}},{deep:!0,immediate:!1}),y&&window.addEventListener("unload",w,p),t.onUnmounted(()=>{w(),a()}),{supported:u,id:l,data:f,master:s,mind:i,editable:v,targets:d,ping:g,setMind:e=>{switch(e){case 1:s.value=!0;break;case 0:s.value=!1}i.value=e,o({type:3,id:l,mind:i.value})},addListener:r}}function B(e,n){const r=Symbol(),o=t.inject(e,r);return o===r?n():o}function H(e,n){const a=r(n),l=r(e);return c(a.value)||t.isRef(n)?[void 0!==l.value?l:void 0,a]:!c(l.value)||o(l.value)||u(l.value)?[l.value?l:void 0,void 0]:[void 0,l]}function _(e,r){const[o,a]=H(e,r),u=t.computed(()=>new Intl.NumberFormat(n(o),n(a))),l=(e,t,r)=>(t||r?new Intl.NumberFormat(n(r)||n(o),{...n(a),...n(t)}):u.value).format(n(e));return{format:(e,n,r)=>t.computed(()=>l(e,n,r)),formatString:l,formatter:u}}function K(e){if(e)return i(e)?e:q(e)}const q=e=>{const t=e.match(/^(\d+)px$/);if(t)return+t[1]};function J(e){const n={},r=new Map,o=t.ref();let a=[];const u=[];for(const o in e){const l=e[o],s=K(l);if(void 0!==s){const e=t.ref(!1);n[o]=e,r.set(s,{name:o,valid:e}),a.push(s)}else{const{matches:e,remove:t}=z(l);n[o]=e,u.push(t)}}a=a.sort((e,t)=>t-e);const l=y?()=>{const e=window.innerWidth;let t=void 0;for(let n=0;n<a.length;n++){const o=a[n],u=r.get(o);u.valid.value=e>=o,e>=o&&void 0===t&&(t=u.name)}o.value=t}:f,s=E(l,10),i=y?()=>window.removeEventListener("resize",s):f;return y&&(t.onMounted(()=>{l(),window.addEventListener("resize",s,p)}),t.onUnmounted(()=>{i(),u.forEach(e=>e())})),{...n,remove:i,current:o}}const Q=Symbol(""),X={sm:640,md:768,lg:1024,xl:1280};function Y(e){return c(e)&&c(e.theme)&&c(e.theme.screens)}function G(e){return!!c(e)&&(u(e.min)||u(e.max)||i(e.min)||i(e.max))}function Z(e){const t=[];if(o(e)){const n=e.map(Z);for(let e=0;e<n.length;e++){const r=n[e];t.push(...r)}}else c(n=e)&&u(n.raw)?t.push(e.raw):G(e)?t.push(function(e){return G(e)?`(${[e.max&&"max-width: "+e.max,e.min&&"min-width: "+e.min].filter(Boolean).join(" and ")})`:""}(e)):(u(e)||i(e))&&t.push("min-width: "+e);var n;return t}function ee(e){const n=Y(e)?e.theme.screens:e;if(Y(e))for(const e in n)n.hasOwnProperty(e)&&(n[e]=Z(n[e]).join(" or "));const r=J(n);return t.provide(Q,r),r}function te(e,t){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&(t&&0!==t.length||!1)}function ne(e){try{if(!e)return!1;const t=":$";return e.setItem(t,t),e.removeItem(t),!0}catch(t){return te(t,e)}}function re(e,t){try{return e.parse(t)}catch{return t}}let oe=void 0;function ae(e,n=JSON,o=10){const a=y?window[e]:void 0,l=ne(a);oe||(oe=new Map,y&&window.addEventListener("storage",e=>{if(e.newValue===e.oldValue)return;let t=oe.get("localStorage");t=e.storageArea===window.localStorage?oe.get("localStorage"):oe.get("sessionStorage"),t&&Object.keys(t.$syncKeys).length>0&&(null===e.key?t.clear():t.$syncKeys[e.key]&&(null===e.newValue?t.removeItem(e.key):t.updateItem(e.key,e.newValue)))}));let s,i=oe.get(e);return l&&a?i?s=i.$quotaError:(s=t.ref(!1),i={$refMap:new Map,$watchHandlers:new Map,$syncKeys:{},$quotaError:s,key:a.key,length:a.length,setSync(e,t){t?this.$syncKeys[e]=!0:delete this.$syncKeys[e]},clear(){this.$refMap.forEach((e,t)=>this.removeItem(t))},removeItem(e){const t=this.$refMap.get(e);t&&(t.value=void 0);const n=this.$watchHandlers.get(e);n&&n(),delete this.$syncKeys[e],this.$refMap.delete(e),a.removeItem(e)},getItem(e){const t=a.getItem(e);return t?this.setItem(e,re(n,t)):null},setItem(e,l){const i=r(l);this.$refMap.set(e,i);const c=(e,t)=>{try{const r=a.getItem(e),o=u(t)?t:n.stringify(t);a.setItem(e,o),r!==o&&y&&this.$syncKeys[e]&&window.dispatchEvent(new StorageEvent(e,{newValue:o,oldValue:r,storageArea:a}))}catch(e){s.value=te(e,a)}};c(e,l);const v=t.watch(i,S(t=>{c(e,t)},o),{immediate:!1,deep:!0});return this.$watchHandlers.set(e,v),i},updateItem(e,t){let r=this.$refMap.get(e);r&&(r.value=re(n,t))}},oe.set(e,i)):(s=t.ref(!1),i={}),{supported:l,quotaError:s,store:i,remove:()=>oe.delete(e)}}function ue(e,n,r){const{supported:o,store:a}=ae("localStorage");let u=f,l=f,s=f,i=void 0;return o&&a?(s=t=>a.setSync(e,t),u=()=>a.removeItem(e),l=()=>a.clear(),i=a.getItem(e),i||(i=a.setItem(e,n)),!1!==r&&s(!0)):i=t.ref(n),{supported:o,storage:i,clear:l,remove:u,setSync:s}}function le(e,n,r){const{supported:o,store:a}=ae("sessionStorage");let u=f,l=f,s=m,i=void 0;return o&&a?(u=()=>a.removeItem(e),l=()=>a.clear(),i=a.getItem(e),i||(i=a.setItem(e,n))):i=t.ref(n),{supported:o,storage:i,clear:l,remove:u,setSync:s}}let se=void 0;function ie(e){const n=r(e.currentPage),o=r(e.pageSize),a=t.ref(0),u=r(e.total),l=t.computed({get:()=>a.value,set(e){i(e)&&(a.value=Math.min(e,u.value))}}),s=t.computed({get:()=>n.value,set(e){i(e)&&(n.value=g(e,1,v.value),l.value=(n.value-1)*c.value)}}),c=t.computed({get:()=>o.value,set(e){i(e)&&(o.value=e)}}),v=t.computed(()=>Math.ceil(u.value/c.value));s.value=n.value;return t.watch([u,c],e=>{s.value>v.value&&(s.value=v.value)},{immediate:!1}),{pageSize:c,total:u,currentPage:s,offset:l,lastPage:v,next:()=>++s.value,prev:()=>--s.value,first:()=>s.value=1,last:()=>s.value=v.value}}function ce(e){const n=e&&e.refreshMs||1e3,r=!e||!l(e.sync)||e.sync,o=e&&a(e.timeFn)&&e.timeFn||Date.now;let u=void 0,s=void 0;const i=t.ref(o()),c=()=>{clearInterval(u),clearTimeout(s)},v=y?()=>u=setInterval(()=>i.value=o(),n):f;if(r){const e=1e3-(i.value-1e3*Math.floor(i.value/1e3));s=setTimeout(v,e)}else v();return t.onUnmounted(c),{now:i,remove:c}}function ve(e,r){return t.computed(()=>{const a=n(e);if(!r)return a;const u=t.isRef(r)?t.reactive(r.value):t.reactive(r);return a.replace(/({?{[\w\s]*}?})/g,e=>{const t=e.replace("{","").replace("}","").trim();if(e[0]===e[1]&&"{"===e[0])return""+t;const r=o(u)?u[+t]:u[t];return void 0===r?e:""+n(r)})})}function de(e,r,o=".",a=f){return t.computed(()=>{const t=n(e),u=n(r);if(void 0===t)return a(u,t,u,t);if(!u)return t;const l=u.split(o);let s=t;for(let e=0;e<l.length;e++){let n=l[e];if("]"===n[n.length-1]){const t=/\[[`'"]?([^`'"\]]*)[`'"]?\]/g;let r=n,o=t.exec(r);if(o){let a=o[0].length,u=o.index-a,s=1;do{o.index,u=o.index,a=o[0].length,n=n.slice(0,-o[0].length),l.splice(e+s,0,o[1]),++s}while(o=t.exec(r));if(!n&&"["===r[0]&&r.length>2)continue}else n="",console.warn(`[usePath] invalid path provided "${r}"`)}if(!c(s))return a(l.slice(0,e+1).join(o),s,u,t);if(!n)return a(l.slice(0,e+1).join(o),s,u,t);if(s=s[n],!s)return a(l.slice(0,e+1).join(o),s,u,t)}return s})}function fe(e){return void 0!==e.$value}const me=(e,r,o)=>{const{$message:a,$validator:u,...l}=function(e){return c(e)}(r)?r:{$validator:r,$message:""},{$pending:s,$promise:i,$invalid:v,$error:f}=((e,r,o)=>{const a=t.ref(null),u=t.ref(!1),l=t.ref(),s=t.ref(!1);let i=void 0;const c=e=>{a.value=(async()=>{try{u.value=!0;const t=r(e,i);d(t)?s.value=!await t:s.value=!t}catch(e){throw s.value=!0,e}finally{u.value=!1}})().catch(e=>(l.value=n(e),s.value=!0,e))};return o.push(n=>{i=n,t.watch(()=>{try{r(e.value,i)}catch(e){}return e.value},c,{deep:!0,immediate:!0})}),{$promise:a,$pending:u,$invalid:s,$error:l}})(e,u,o);return{$pending:s,$error:f,$promise:i,$invalid:v,$message:a,...l}},pe=(e,o)=>{const a={},u=fe(e)?r(e.$value):void 0;for(const r of Object.keys(e))if("$"!==r[0])if(u){const t=me(u,e[r],o);a[r]={...t,$value:u}}else{const u=pe(e[r],o);let s,i,c=void 0;if(fe(u)){const e=Object.keys(u).filter(e=>"$"!==e[0]).map(e=>u[e]);s=t.computed(()=>e.map(e=>e.$error).filter(Boolean).map(e=>n(e))),i=t.computed(()=>e.some(e=>!!n(e.$invalid)))}else{const e=Object.keys(u).map(e=>u[e]);s=t.computed(()=>e.map(e=>n(e.$errors)).filter(Boolean).filter(e=>e.some(Boolean))),c=t.computed(()=>e.some(e=>e.$anyDirty||l(n(e.$dirty))&&n(e.$dirty))),i=t.computed(()=>e.some(e=>!!n(e.$anyInvalid)))}a[r]={...u,$errors:s,$anyInvalid:i},c&&(a[r].$anyDirty=c)}else{if("$value"===r){a[r]=u;const e=t.ref(!1),n=t.watch(u,()=>{e.value=!0,n()},{immediate:!1,deep:!0});a.$dirty=e;continue}a[r]=e[r]}return a};const he=Symbol("");function ge(e){const o=t.ref(Object.keys(e.messages)),u=t.ref(e.messages),s=t.ref(e.locale),i=t.ref({});let c=t.ref();const v={},f=(e,n)=>{if(v[e])return v[e];const o=n.value[e];if(!o)return t.ref({});let u=a(o)?o():o;return d(u)?u.then(t=>v[e]=r(t)):a(o)?r(u):v[e]=t.computed(()=>n.value[e])},m=!!e.fallback&&(!l(e.notFoundFallback)||e.notFoundFallback);let p=!1;if(m){const t=f(e.fallback,u);d(t)?(t.then(e=>{c.value=e.value}),p=!0):c.value=t.value}else c.value={};const h=t.ref(0);t.watch(u,()=>h.value++,{deep:!0,immediate:!1}),t.watch([s,c,h],([t,r,o])=>{if(t===e.fallback&&m)i.value=r;else{const e=e=>i.value=w({},r,n(e)),o=f(t,u);d(o)?o.then(e):e(o)}},{immediate:!p});const g=(t,n)=>e.resolve?r(e.resolve(i.value,t,n)):ve(de(i,t,".",(e,t,n,r)=>n),n);return{locale:s,locales:o,i18n:i,$t:g,$ts:(e,t)=>g(e,t).value,addLocale:(e,t)=>{o.value.indexOf(e)>=0||o.value.push(e),delete v[e],u.value[e]=t},removeLocale:t=>{const n=o.value.indexOf(t);if(n>=0){const r=[s.value,c.value&&e.fallback,...o.value].find(e=>e&&e!==t);r&&(t===e.fallback&&(c.value=void 0),t===s.value&&(s.value=r)),o.value.splice(n,1)}delete u.value[t],delete v[t]}}}function ye(e){const n=ge(e);return t.provide(he,n),n}const we=Symbol("");const be=Symbol(""),Ee={install(e){const n=t.ref(!0),r=t.readonly(n);{e._context.provides[be]=r;const t=e.mount;e.mount=(...e)=>{const r=t(...e);return n.value=!1,r}}}};return e.COMMIT="63aa3f0",e.FALSE_OP=m,e.MAX_ARRAY_SIZE=2**32-2,e.NO_OP=f,e.PASSIVE_EV=p,e.VERSION="1.0.0-alpha.35",e.VUE_VERSION="3",e.buildI18n=ge,e.debounce=S,e.deepClone=w,e.exponentialDelay=e=>{const t=100*Math.pow(2,e);return t+.2*t*Math.random()},e.exposeWorker=function(e){this.onmessage=async t=>{const n=e(t.data);if(void 0===n)this.postMessage(n);else if(null===n)this.postMessage(n);else if(o(n))this.postMessage(n);else if(n[Symbol.asyncIterator])for await(const e of n)this.postMessage(e);else if(n[Symbol.iterator])for(const e of n)this.postMessage(e);else this.postMessage(await n)}},e.getCssVariableFor=D,e.hydrationPlugin=Ee,e.injectFactory=B,e.isArray=o,e.isBoolean=l,e.isClient=y,e.isDate=s,e.isElement=v,e.isFunction=a,e.isNumber=i,e.isObject=c,e.isPromise=d,e.isString=u,e.isSymbol=e=>"symbol"==typeof e,e.minMax=g,e.noDelay=L,e.promisedTimeout=h,e.provideSSRTitle=function(e,t){const n=r(void 0===t?"":t);return e.provide(we,n),n},e.refShared=function(e,n){const r=t.getCurrentInstance(),o=n||r.vnode.scopeId;if(!o)return t.ref(e);const{data:a,supported:u}=N(o,e);return a},e.setBreakpointTailwindCSS=ee,e.setCssVariableFor=F,e.setI18n=ye,e.storageAvailable=ne,e.unwrap=n,e.useArrayPagination=function(e,n){const o=r(e),a=ie({currentPage:1,pageSize:10,...n,total:t.computed(()=>o.value.length)}),u=t.computed(()=>{const e=o.value;return Array.isArray(e)?e.slice(a.offset.value,a.offset.value+a.pageSize.value):[]});return{...a,result:u}},e.useBreakpoint=J,e.useBreakpointChrome=function(){return J({mobileS:320,mobileM:375,mobileL:425,tablet:768,laptop:1024,laptopL:1440,desktop4K:2560})},e.useBreakpointTailwindCSS=function(e){return B(Q,()=>ee(e||X))},e.useBroadcastChannel=A,e.useCancellablePromise=$,e.useCssVariables=function(e,o,a){const l=y&&"MutationObserver"in self,[s,i]=t.isRef(o)||v(o)?[o,a||V]:[l&&document.documentElement||{},o||V],c=t.ref(!0),d={},m=[],p=Object.entries(e).map(e=>{const[t,o]=u(e[1])?[e[1]]:[e[1].name,e[1].value];return o&&(m.push(()=>F(n(s),t,n(o))),d[e[0]]=r(o)),[e[0],U(t)]});for(let e=0;e<p.length;e++){const[o,a]=p[e];d[o]||(d[o]=t.ref(t.isRef(s)&&!s.value||!l?null:D(n(s),a))),l&&t.watch([d[o],r(s)],e=>{c&&e[1]&&e[0]!==D(e[1],a)&&F(e[1],a,e[0])},{immediate:!t.isRef(s)})}if(!l)return{...d,stop:f,resume:f,supported:l,observing:c};const h=()=>{for(let e=0;e<p.length;e++){const[t,r]=p[e];d[t].value=D(n(s),r)}},g=new MutationObserver(h),w=()=>{g.disconnect(),c.value=!1},b=()=>{c.value||h(),g.observe(n(s),i),c.value=!0};return t.onUnmounted(w),t.isRef(s)?t.onMounted(()=>{m.forEach(e=>e()),t.watch(s,(e,t)=>{t&&w(),e&&b()})}):(y||s)&&(m.forEach(e=>e()),b()),{...d,supported:l,resume:b,stop:w,observing:c}},e.useCurrencyFormat=function(e,r,o){const a=n(e),u=!c(a),l=u?e:t.computed(()=>n(e).currency),[s,i]=H(r,u?o:e),v=t.computed(()=>{const e=n(i)||{},t=n(l)||e.currency;return{style:"currency",...e,currency:t}}),d=_(s),f=(e,t,r,o,a)=>{const u={...v.value,...n(o)},l=n(t)||u.currency,s=n(r)||u.currencyDisplay;return d.formatString(e,{...u,currency:l,currencyDisplay:s},a)};return{format:(e,n,r,o,a)=>t.computed(()=>f(e,n,r,o,a)),formatString:f}},e.useDateNow=function(e){return ce({refreshMs:e&&e.refreshMs||1e3,sync:!e||!l(e.sync)||e.sync,timeFn:Date.now})},e.useDebounce=E,e.useEvent=b,e.useFetch=function(e,n){const r=t.ref(null),o=t.ref(""),a=t.ref(),l=t.ref(null),[s,i]=R(e)?[!1!==e.isJson,!1!==e.parseImmediate]:R(n)?[!1!==n.isJson,!1!==n.parseImmediate]:[!0,!0],c=e?u(e)?n:R(e)?e:u(e.url)?n:e:void 0,v=t.ref(!1),d=t.ref();let f=void 0;const m=M(async(e,t)=>{f=new AbortController;const n=await fetch(e,{signal:f.signal,...c,...t});if(n){const e=[s?n.clone().json().then(e=>r.value=e).catch(e=>{r.value=null,l.value=e}):Promise.resolve(),n.clone().blob().then(e=>{a.value=e}),n.clone().text().then(e=>{o.value=e})];i&&await Promise.all(e)}return n},!0),p=t.computed(()=>m.result.value&&m.result.value.status||null),h=t.computed(()=>m.result.value&&m.result.value.statusText||null);return e&&(u(e)||u(e.url))&&m.exec(e,void 0,!1),{...m,cancel:e=>{f&&(f.abort(),v.value=!0,d.value=e)},isCancelled:v,cancelledMessage:d,text:o,blob:a,json:r,jsonError:l,status:p,statusText:h}},e.useFormat=ve,e.useGeolocation=function(e){const n=y&&!!navigator.geolocation,r=t.ref(e?!1===e.immediate:void 0),o=t.ref(null),a=t.ref(null),u=t.ref(null),s=t.ref(e&&e.enableHighAccuracy||null);let i=f;if(n){const n=e=>{a.value=e.timestamp,u.value=e.coords,o.value=null},c=e=>{a.value=Date.now(),u.value=null,o.value=e},v=()=>!0!==r.value&&f&&navigator.geolocation.clearWatch(f);let d=()=>navigator.geolocation.getCurrentPosition(n,c,e);i=r.value?()=>{r.value?r.value=!1:d()}:d;let f=0;t.onMounted(()=>t.watch([s,r],t=>{v();const r=l(t[0])?t[0]:e?e.enableHighAccuracy:void 0;f=navigator.geolocation.watchPosition(n,c,e?{...e,enableHighAccuracy:r}:{enableHighAccuracy:r})},{immediate:!r.value})),t.onUnmounted(v)}return{supported:n,refresh:i,error:o,timestamp:a,coords:u,highAccuracy:s}},e.useHydration=function(){return t.inject(be,t.computed(()=>!1))},e.useI18n=function(e){return e?ye(e):t.inject(he)},e.useIntersectionObserver=function(e,o){const a=y&&"IntersectionObserver"in window,u=e?r(e):void 0,l=!u||!v(u.value)&&u.value?void 0:u,s=t.computed(()=>o?n(o):l?void 0:n(e)),i=t.ref([]),c=t.computed(()=>i.value.length>0&&i.value.every(e=>e.isIntersecting)),d=e=>{i.value=e};let m=t.ref();a&&t.watch(s,e=>{m.value&&m.value.disconnect();const t=e&&e&&{root:n(e.root),rootMargin:n(e.rootMargin),threshold:n(e.threshold)}||void 0;m.value=new IntersectionObserver(d,t);i.value.map(e=>e.target).forEach(m.value.observe)},{deep:!0,immediate:!0});const p=a?e=>{const t=n(e);m.value.observe(t)}:f,h=a?e=>{const t=n(e);m.value.unobserve(t)}:f,g=()=>m.value.disconnect();return l&&(t.onMounted(()=>{l.value&&p(l)}),t.onUnmounted(()=>{g()})),{supported:a,elements:i,observe:p,unobserve:h,disconnect:g,isIntersecting:c}},e.useIntlNumberFormat=_,e.useLanguage=function(){if(j||(j=y?t.ref(navigator.language):t.ref("")),!C)if(y){C=t.ref(navigator.languages);const e=()=>{j.value=navigator.language,C.value=navigator.languages};window.addEventListener("languagechange",e,p)}else C=t.ref([]);return{language:j,languages:C}},e.useLocalStorage=ue,e.useMatchMedia=z,e.useNetworkInformation=function(){const e=!!y&&(navigator.connection||navigator.mozConnection||navigator.webkitConnection),n=!!e,r=t.ref(0),o=t.ref(0),a=t.ref("none"),u=t.ref(0),l=t.ref(!1),s=t.ref("none");let i=f,c=f;return e&&(i=()=>{r.value=e.downlink,o.value=e.downlinkMax,a.value=e.effectiveType,u.value=e.rtt,l.value=e.saveData,s.value=e.type},c=b(e,"change",i,p),i()),{supported:n,downlink:r,downlinkMax:o,effectiveType:a,rtt:u,saveData:l,type:s,remove:c}},e.useNow=ce,e.useOnMouseMove=function(e,n,r){const o=t.ref(0),a=t.ref(0);let u=e=>{o.value=e.x,a.value=e.y};const[l,s]=i(n)?[void 0,n]:[n,r];s&&(u=E(u,r));const c=b(e,"mousemove",u,l);return{mouseX:o,mouseY:a,remove:c}},e.useOnResize=function(e,n,o){const a=r(e),u=t.ref(a.value&&a.value.clientHeight),l=t.ref(a.value&&a.value.clientWidth);let s=()=>{u.value=a.value.clientHeight,l.value=a.value.clientWidth};const[c,v]=i(n)?[void 0,n]:[n,o];v&&(s=E(s,o));const d=y?b(window,"resize",s,c||p):f;return{height:u,width:l,remove:d}},e.useOnScroll=function(e,n,o){const a=e=>!(i(e)||l(e)||!v(e)&&!t.isRef(e)||!e),u=a(e)?r(e):t.ref(y&&window||void 0),s=a(e)?u:t.ref(y&&window.document.scrollingElement||void 0),c=t.ref(s.value&&s.value.scrollTop||0),d=t.ref(s.value&&s.value.scrollLeft||0);let f=()=>{c.value=s.value.scrollTop,d.value=s.value.scrollLeft};const m=(...e)=>s.value&&s.value.scrollTo&&s.value.scrollTo.apply(s.value,e),h=e=>m({top:e}),g=e=>m({left:e}),[w,S]=i(e)||!e?[p,e]:i(n)?[p,n]:[n,o];S&&(f=E(f,o));const M=b(u,"scroll",f,w),$=t.watch(c,h,{immediate:!1}),x=t.watch(d,g,{immediate:!1});return{scrollTop:c,scrollLeft:d,scrollTo:m,remove:()=>{M(),x(),$()},scrollTopTo:h,scrollLeftTo:g}},e.useOnline=function(){const e=y&&"onLine"in navigator;return e||(O=t.ref(!1)),O||(O=t.ref(navigator.onLine),window.addEventListener("offline",()=>O.value=!1,p),window.addEventListener("online",()=>O.value=!0,p)),{supported:e,online:O}},e.usePageVisibility=function(){return T||(T=t.ref(y&&document.hidden)),P||(y?(P=t.ref(document.visibilityState),document.addEventListener("visibilitychange",()=>{P.value=document.visibilityState,T.value=document.hidden},p)):P=t.ref("visible")),{visibility:P,hidden:T}},e.usePagination=ie,e.usePath=de,e.usePerformanceNow=function(e){return ce({refreshMs:e&&e.refreshMs||1e3,sync:!e||!l(e.sync)||e.sync,timeFn:()=>performance.now()})},e.usePromise=M,e.usePromiseLazy=function(e,t=!1){return M(e,{lazy:!0,throwException:t})},e.useRetry=function(e,n){const r=!e||a(e)?{}:e,o=a(e)?e:n;if(!a(e)&&!c(e))throw new Error("[useRetry] options needs to be 'object'");if(o&&!a(o))throw new Error("[useRetry] factory needs to be 'function'");const u=t.ref(!1),l=t.ref(),s=t.ref([]),i={value:!1},v={isRetrying:u,retryCount:t.computed(()=>s.value.length),nextRetry:l,retryErrors:s,[x]:{value:0},[I]:i},d=o?(...e)=>(++v[x].value,k(r,v,o,e)):e=>(++v[x].value,k(r,v,e,void 0));return{...v,cancel:()=>{v.isRetrying.value=!1,v.retryErrors.value.push(new Error("[useRetry] cancelled")),v.nextRetry.value=void 0,i.value=!0},exec:d}},e.useSSRTitle=function(e){const n=Symbol(),r=t.inject(we,n);return r===n||void 0===r?t.ref(u(e)?e:""):(u(e)&&(r.value=e),r)},e.useSessionStorage=le,e.useShare=function(e){const n=y&&"share"in navigator;let r=()=>Promise.resolve(!1),o=m,a=t.ref(!1),u=t.ref(!1);return n&&(r=e=>(a.value=!1,u.value=!1,navigator.share(e).then(e=>(a.value=!0,e)).catch(e=>(a.value=!1,u.value=!0,!1))),o=e=>navigator.canShare(e),e&&o(e)&&r(e)),{supported:n,share:r,canShare:o,shared:a,cancelled:u}},e.useSharedRef=N,e.useStorage=function(e,t,n){return void 0===se&&(se=ae("localStorage").supported),se?ue(e,t,n):le(e,t)},e.useTitle=function(e=null){const n=t.ref(u(e)?e:document.title),r=new MutationObserver(e=>{n.value=e[0].target.textContent});t.watch(n,(e,t)=>{u(e)&&e!==t&&(document.title=e)},{immediate:!0,flush:"sync"});const o=document.querySelector("title");return r.observe(o,{childList:!0}),t.onUnmounted(()=>r.disconnect()),n},e.useUndo=function(e,n){const o=r(e),a=t.ref([]),u=t.ref(0),l=n&&n.maxLength||2**32-2,s=n&&n.clone||(e=>e);t.watch(o,e=>{if(a.value[u.value]!==e){if(u.value>0){const e=u.value;a.value.splice(0,e),u.value=0}a.value.length>l&&a.value.pop(),a.value.unshift(s(e))}},{...n,immediate:!0,flush:"sync"});const i=e=>{const t=Math.sign(e)<=0?Math.max(e,-v.value.length):Math.min(e,c.value.length);u.value+=t,o.value=a.value[u.value]},c=t.computed(()=>{const e=0===u.value?1:u.value;return a.value.slice(e)}),v=t.computed(()=>{const e=0===u.value?1:0;return a.value.slice(e,u.value)});return{value:o,undo:(e=1)=>i(e),redo:(e=1)=>i(-e),jump:i,prev:c,next:v}},e.useVModel=function(e,n){const r=t.getCurrentInstance();return r?t.computed({get:()=>e[n],set(e){r.emit("update:"+n,e)}}):t.ref()},e.useValidation=function(e){const n=[],r=pe({input:e},n),o=t.reactive(r.input);return n.forEach(e=>e(o)),o},e.useWebSocket=function(e,n){const r=y&&"WebSocket"in window;let o=null;const a=t.ref(null),u=t.ref(null),l=t.ref(null),s=t.ref(!1),i=t.ref(!1),c=t.ref(!1);let v=f,d=f;return r&&(o=new WebSocket(e,n),o.addEventListener("message",e=>{a.value=e,l.value=e.data}),o.addEventListener("error",e=>{u.value=e,c.value=!0}),o.addEventListener("close",()=>{s.value=!1,i.value=!0}),o.addEventListener("open",()=>{s.value=!0,i.value=!1}),v=e=>o.send(e),d=(e,t)=>{o.close(e,t)}),{supported:r,ws:o,send:v,close:d,messageEvent:a,errorEvent:u,data:l,isOpen:s,isClosed:i,errored:c}},e.useWebStorage=ae,e.useWorker=function(e,n,r){const o=y&&"Worker"in self,a=t.ref(),u=t.ref(),l=t.ref(!o),s=t.ref(!o);if(!o)return l.value=!0,{worker:void 0,data:u,postMessage:f,terminate:f,errorEvent:a,errored:s,terminated:l};const i=new Worker(e,r),c=e=>i.postMessage(e);function v(){i.terminate(),l.value=!0}return i.addEventListener("message",e=>{u.value=e.data},p),i.addEventListener("error",e=>{a.value=e,s.value=!0},p),t.onUnmounted(v),n&&c(n),{worker:i,data:u,postMessage:c,terminate:v,errorEvent:a,errored:s,terminated:l}},e.useWorkerFunction=function(e,r){const o=y&&"Worker"in self,a=t.computed(()=>r&&n(r.dependencies)||[]),u=t.computed(()=>r&&n(r.timeout));if(!o)return $(e,{lazy:!0,throwException:!0});const l=$((...n)=>new Promise((r,o)=>{const s=function(e,t){const n=[t.length>0?`importScripts("${t.join('","')}");`:"","onmessage=",`(${W.toString()})(${e.toString()})`],r=new Blob(n,{type:"text/javascript"});return URL.createObjectURL(r)}(e,a.value),i=new Worker(s);let c=-1;const v=u.value,d=()=>{i.terminate(),URL.revokeObjectURL(s),clearTimeout(c),h()},m=n.length===e.length+1&&t.isRef(n[n.length-1])&&!1===n[n.length-1].value?t.computed(()=>l.cancelled.value||n[n.length-1].value):l.cancelled,h=m?t.watch(m,()=>{d(),r(void 0)},{immediate:!1}):f;i.addEventListener("message",e=>{e.data[0]?r(e.data[1]):o(e.data[1]),d()},p),i.addEventListener("error",e=>{d(),o(e)},p),i.postMessage([...n]),v&&(c=setTimeout(()=>{l.cancel(`[WebWorker] timeout after ${v}ms`)},v))}),{lazy:!0,throwException:!0});return l},e.wrap=r,e}({},VueRuntimeCore); |
{ | ||
"name": "vue-composable", | ||
"version": "1.0.0-alpha.34", | ||
"version": "1.0.0-alpha.35", | ||
"description": "vue-composable", | ||
@@ -46,5 +46,5 @@ "main": "index.js", | ||
"peerDependencies2": { | ||
"@vue/composition-api": "^0.5.0", | ||
"@vue/composition-api": "^0.6.2", | ||
"vue": "^2.6.10" | ||
} | ||
} |
@@ -118,2 +118,6 @@ # vue-composable | ||
### State | ||
- [Undo](https://pikax.me/vue-composable/composable/state/undo) - Tracks variable history, to allow `undo` and `redo` | ||
### Web | ||
@@ -120,0 +124,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
470249
12377
197