1import{_ as p,m as k,A as w,e as R}from"./ApolloContext-MQGfuinR.js";import{r as u}from"./index-yjs0jCN1.js";import{a as T,v as q,D as L}from"./gql-BXUds3tn.js";function B(f,o){var l=T(o==null?void 0:o.client);q(f,L.Mutation);var E=u.useState({called:!1,loading:!1,client:l}),M=E[0],c=E[1],r=u.useRef({result:M,mutationId:0,isMounted:!0,client:l,mutation:f,options:o});Object.assign(r.current,{client:l,options:o,mutation:f});var y=u.useCallback(function(t){t===void 0&&(t={});var b=r.current,D=b.options,j=b.mutation,C=p(p({},D),{mutation:j}),d=t.client||r.current.client;!r.current.result.loading&&!C.ignoreResults&&r.current.isMounted&&c(r.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:d});var I=++r.current.mutationId,i=k(C,t);return d.mutate(i).then(function(e){var n,a,s=e.data,m=e.errors,v=m&&m.length>0?new w({graphQLErrors:m}):void 0,h=t.onError||((n=r.current.options)===null||n===void 0?void 0:n.onError);if(v&&h&&h(v,i),I===r.current.mutationId&&!i.ignoreResults){var _={called:!0,loading:!1,data:s,error:v,client:d};r.current.isMounted&&!R(r.current.result,_)&&c(r.current.result=_)}var g=t.onCompleted||((a=r.current.options)===null||a===void 0?void 0:a.onCompleted);return v||g==null||g(e.data,i),e}).catch(function(e){var n;if(I===r.current.mutationId&&r.current.isMounted){var a={loading:!1,error:e,data:void 0,called:!0,client:d};R(r.current.result,a)||c(r.current.result=a)}var s=t.onError||((n=r.current.options)===null||n===void 0?void 0:n.onError);if(s)return s(e,i),{data:void 0,errors:e};throw e})},[]),A=u.useCallback(function(){if(r.current.isMounted){var t={called:!1,loading:!1,client:l};Object.assign(r.current,{mutationId:0,result:t}),c(t)}},[]);return u.useEffect(function(){return r.current.isMounted=!0,function(){r.current.isMounted=!1}},[]),[y,p({reset:A},M)]}export{B 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.