PageSourceSearch

https://1whnva.com/resources/v1/app/assets/useMutation-BnvjhEUP.js

js 1whnva.com collected 2026-10-08 05:55:56 UTC 2,435 bytes, 1 lines download raw bytes

1import{computed as m,shallowReactive as b,reactive as v,watch as a,onScopeDispose as y,shallowReadonly as f,readonly as O,toRefs as M}from"vue";import{y as g,bl as w,aE as h,am as R,b0 as S,c7 as C,a4 as E,by as K,bm as j}from"./logger-BOxpBNGt.js";var x=class extends g{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),w(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&h(s.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#o(),this.#r(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#o(),this.#r()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#o(){const t=this.#t?.state??R();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#r(t){S.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,i={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,i)}catch(e){Promise.reject(e)}try{this.#e.onSettled?.(t.data,null,s,r,i)}catch(e){Promise.reject(e)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,i)}catch(e){Promise.reject(e)}try{this.#e.onSettled?.(void 0,t.error,s,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function D(t,s){const r=C(),i=m(()=>{const o=typeof t=="function"?t():t;return r.defaultMutationOptions(E(o))}),e=new x(r,i.value),n=i.value.shallow?b(e.getCurrentResult()):v(e.getCurrentResult()),u=e.subscribe(o=>{K(n,o)}),c=(o,p)=>{e.mutate(o,p).catch(()=>{})};a(i,()=>{e.setOptions(i.value)}),y(()=>{u()});const l=i.value.shallow?f(n):O(n),d=M(l);return a(()=>n.error,o=>{if(o&&j(i.value.throwOnError,[o]))throw o}),{...d,mutate:c,mutateAsync:n.mutate,reset:n.reset}}export{D as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.