Warp/node_modules/@vueuse/integrations/index.iife.min.js

2 lines
10 KiB
JavaScript
Raw Normal View History

2024-01-31 06:33:19 +00:00
var VueDemi=function(l,o,T){if(l.install)return l;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),l;if(o.version.slice(0,4)==="2.7."){let h=function(b,k){var C,B={},G={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(E,L){return B[E]=L,this},directive:function(E,L){return L?(o.directive(E,L),G):o.directive(E)},mount:function(E,L){return C||(C=new o(Object.assign({propsData:k},b,{provide:Object.assign(B,b.provide)})),C.$mount(E,L),C)},unmount:function(){C&&(C.$destroy(),C=void 0)}};return G};var j=h;for(var n in o)l[n]=o[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.warn=o.util.warn,l.hasInjectionContext=()=>!!l.getCurrentInstance(),l.createApp=h}else if(o.version.slice(0,2)==="2.")if(T){for(var n in T)l[n]=T[n];l.isVue2=!0,l.isVue3=!1,l.install=function(){},l.Vue=o,l.Vue2=o,l.version=o.version,l.hasInjectionContext=()=>!!l.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var n in o)l[n]=o[n];l.isVue2=!1,l.isVue3=!0,l.install=function(){},l.Vue=o,l.Vue2=void 0,l.version=o.version,l.set=function(h,b,k){return Array.isArray(h)?(h.length=Math.max(h.length,b),h.splice(b,1,k),k):(h[b]=k,k)},l.del=function(h,b){if(Array.isArray(h)){h.splice(b,1);return}delete h[b]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return l}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(l,o,T,n,j,h,b,k,C,B,G,E,L,_,V,$){"use strict";const D=T.default||T;function ee(t,r,e={}){const{validateOption:a={},immediate:s=!0,manual:f=!1}=e,c=o.toRef(t),i=n.shallowRef(null),u=n.ref(!0),p=n.ref(!s||f),w=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.errors)||[]}),y=n.computed(()=>{var d;return((d=i.value)==null?void 0:d.fields)||{}}),R=n.computed(()=>new D(o.toValue(r))),g=async()=>{u.value=!1,p.value=!1;try{await R.value.validate(c.value,a),p.value=!0,i.value=null}catch(d){i.value=d}finally{u.value=!0}return{pass:p.value,errorInfo:i.value,errors:w.value,errorFields:y.value}};f||n.watch([c,R],()=>g(),{immediate:s,deep:!0});const I={isFinished:u,pass:p,errors:w,errorInfo:i,errorFields:y,execute:g};function O(){return new Promise((d,S)=>{o.until(u).toBe(!0).then(()=>d(I)).catch(F=>S(F))})}return{...I,then(d,S){return O().then(d,S)}}}function te(...t){const r=typeof t[0]=="string"?t[0]:void 0,e=typeof r=="string"?1:0,a={immediate:!!e,shallow:!0};let s={},f=j,c=a;const i=A=>!!A?.request;t.length>0+e&&(i(t[0+e])?f=t[0+e]:s=t[0+e]),t.length>1+e&&i(t[1+e])&&(f=t[1+e]),(t.length===2+e&&!i(t[1+e])||t.length===3+e)&&(c=t[t.length-1]||a);const{initialData:u,shallow:p,onSuccess:w=o.noop,onError:y=o.noop,immediate:R,resetOnExecute:g=!1}=c,I=n.shallowRef(),O=(p?n.shallowRef:n.ref)(u),d=n.ref(!1),S=n.ref(!1),F=n.ref(!1),m=n.shallowRef(),N=j.CancelToken.source;let U=N();const v=A=>{d.value||!S.value||(U.cancel(A),U=N(),F.value=!0,S.value=!1,d.value=!1)},P=A=>{S.value=A,d.value=!A},ve=()=>{g&&(O.value=u)},q=()=>new Promise((A,W)=>{o.until(d).toBe(!0).then(()=>m.value?W(m.value):A(Y))}),J={then:(...A)=>q().then(...A),catch:(...A)=>q().catch(...A)};let Q=0;const X=(A=r,W={})=>{m.value=void 0;const Z=typeof A=="string"?A:r??W.url;if(Z===void 0)return m.value=new j.AxiosError(j.AxiosError.ERR_INVALID_URL),d.value=!0,J;ve(),v(),P(!0),Q+=1;const pe=Q;return F.value=!1,f(Z,{...s,...typeof A=="object"?A:W,cancelToken:U.token}).then(H=>{if(F.value)return;I.value=H;const K=H.data;O.value=K,w(K)}).catch(H=>{m.value=H,y(H)}).finally(()=>{var H;(H=c.onFinish)==null||H.call(c),pe===Q&&P(!1)}),J};R&&r&&X();const Y={response:I,data:O,error:m,isFinished:d,isLoading:S,cancel:v,isAborted:F,isCanceled:F,abort:v,execute:X};return{...Y,...J}}var x=Object.freeze({__proto__:null,camelCase:h.camelCase,capitalCase:h.cap