1import{a as f,c as q}from"./tslib.es6.js";import{r as h,e as l,R as j,j as T,u as O,A as x,v as A,D as I,i as M}from"./index27.js";import{w as z}from"./wrapHook.js";import{T as w}from"./index7.js";import{c as K,N as S,i as W}from"./networkStatus.js";function v(r){var e=Promise.resolve(r);return e.status="fulfilled",e.value=r,e}function H(r){var e=Promise.reject(r);return e.catch(function(){}),e.status="rejected",e.reason=r,e}function L(r){return"status"in r}function g(r){if(L(r))return r;var e=r;return e.status="pending",e.then(function(t){if(e.status==="pending"){var i=e;i.status="fulfilled",i.value=t}},function(t){if(e.status==="pending"){var i=e;i.status="rejected",i.reason=t}}),r}function V(r,e){var t=h.useRef(void 0);return(!t.current||!l(t.current.deps,e))&&(t.current={value:r(),deps:e}),t.current.value}var B="use",G=j[B],U=G||function(e){var t=g(e);switch(t.status){case"pending":throw t;case"rejected":throw t.reason;case"fulfilled":return t.value}},J=["canonizeResults","context","errorPolicy","fetchPolicy","refetchWritePolicy","returnPartialData"],X=function(){function r(e,t){var i=this;this.key={},this.listeners=new Set,this.references=0,this.softReferences=0,this.handleNext=this.handleNext.bind(this),this.handleError=this.handleError.bind(this),this.dispose=this.dispose.bind(this),this.observable=e,t.onDispose&&(this.onDispose=t.onDispose),this.setResult(),this.subscribeToQuery();var s=function(){var o;i.references||(i.autoDisposeTimeoutId=setTimeout(i.dispose,(o=t.autoDisposeTimeoutMs)!==null&&o!==void 0?o:3e4))};this.promise.then(s,s)}return Object.defineProperty(r.prototype,"disposed",{get:function(){return this.subscription.closed},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"watchQueryOptions",{get:function(){return this.observable.options},enumerable:!1,configurable:!0}),r.prototype.reinitialize=function(){var e=this.observable,t=this.watchQueryOptions.fetchPolicy,i=t==="no-cache"||t==="standby";try{if(i?e.silentSetOptions({fetchPolicy:"standby"}):(e.resetLastResults(),e.silentSetOptions({fetchPolicy:"cache-first"})),this.subscribeToQuery(),i)return;e.resetDiff(),this.setResult()}finally{e.silentSetOptions({fetchPolicy:t})}},r.prototype.retain=function(){var e=this;this.references++,clearTimeout(this.autoDisposeTimeoutId);var t=!1;return function(){t||(t=!0,e.references--,setTimeout(function(){e.references||e.dispose()}))}},r.prototype.softRetain=function(){var e=this;this.softReferences++;var t=!1;return function(){t||(t=!0,e.softReferences--,setTimeout(function(){!e.softReferences&&!e.references&&e.dispose()}))}},r.prototype.didChangeOptions=function(e){var t=this;return J.some(function(i){return i in e&&!l(t.watchQueryOptions[i],e[i])})},r.prototype.applyOptions=function(e){var t=this.watchQueryOptions,i=t.fetchPolicy,s=t.canonizeResults;return i==="standby"&&i!==e.fetchPolicy?this.initiateFetch(this.observable.reobserve(e)):(this.observable.silentSetOptions(e),s!==e.canonizeResults&&(this.result=f(f({},this.result),this.observable.getCurrentResult()),this.promise=v(this.result))),this.promise},r.prototype.listen=function(e){var t=this;return this.listeners.add(e),function(){t.listeners.delete(e)}},r.prototype.refetch=function(e){return this.initiateFetch(this.observable.refetch(e))},r.prototype.fetchMore=function(e){return this.initiateFetch(this.observable.fetchMore(e))},r.prototype.dispose=function(){this.subscription.unsubscribe(),this.onDispose()},r.prototype.onDispose=function(){},r.prototype.handleNext=function(e){var t;switch(this.promise.status){case"pending":{e.data===void 0&&(e.data=this.result.data),this.result=e,(t=this.resolve)===null||t===void 0||t.call(this,e);break}default:{if(e.data===this.result.data&&e.networkStatus===this.result.networkStatus)return;e.data===void 0&&(e.data=this.result.data),this.result=e,this.promise=v(e),this.deliver(this.promise);break}}},r.prototype.handleError=function(e){var t;switch(this.subscription.unsubscribe(),this.subscription=this.observable.resubscribeAfterError(this.handleNext,this.handleError),this.promise.status){case"pending":{(t=this.reject)===null||t===void 0||t.call(this,e);break}default:this.promise=H(e),this.deliver(this.promise)}}
1,r.prototype.deliver=function(e){this.listeners.forEach(function(t){return t(e)})},r.prototype.initiateFetch=function(e){var t=this;return this.promise=this.createPendingPromise(),this.promise.catch(function(){}),e.then(function(){setTimeout(function(){var i;t.promise.status==="pending"&&(t.result=t.observable.getCurrentResult(),(i=t.resolve)===null||i===void 0||i.call(t,t.result))})}).catch(function(i){var s;return(s=t.reject)===null||s===void 0?void 0:s.call(t,i)}),e},r.prototype.subscribeToQuery=function(){var e=this;this.subscription=this.observable.filter(function(t){return!l(t.data,{})&&!l(t,e.result)}).subscribe(this.handleNext,this.handleError)},r.prototype.setResult=function(){var e=this.observable.getCurrentResult(!1);l(e,this.result)||(this.result=e,this.promise=e.data&&(!e.partial||this.watchQueryOptions.returnPartialData)?v(e):this.createPendingPromise())},r.prototype.createPendingPromise=function(){var e=this;return g(new Promise(function(t,i){e.resolve=t,e.reject=i}))},r}(),Y=function(){function r(e,t,i){var s=this;this.key={},this.listeners=new Set,this.references=0,this.dispose=this.dispose.bind(this),this.handleNext=this.handleNext.bind(this),this.handleError=this.handleError.bind(this),this.observable=e.watchFragment(t),i.onDispose&&(this.onDispose=i.onDispose);var o=this.getDiff(e,t),a=function(){var u;s.references||(s.autoDisposeTimeoutId=setTimeout(s.dispose,(u=i.autoDisposeTimeoutMs)!==null&&u!==void 0?u:3e4))};this.promise=o.complete?v(o.result):this.createPendingPromise(),this.subscribeToFragment(),this.promise.then(a,a)}return r.prototype.listen=function(e){var t=this;return this.listeners.add(e),function(){t.listeners.delete(e)}},r.prototype.retain=function(){var e=this;this.references++,clearTimeout(this.autoDisposeTimeoutId);var t=!1;return function(){t||(t=!0,e.references--,setTimeout(function(){e.references||e.dispose()}))}},r.prototype.dispose=function(){this.subscription.unsubscribe(),this.onDispose()},r.prototype.onDispose=function(){},r.prototype.subscribeToFragment=function(){this.subscription=this.observable.subscribe(this.handleNext.bind(this),this.handleError.bind(this))},r.prototype.handleNext=function(e){var t;switch(this.promise.status){case"pending":{if(e.complete)return(t=this.resolve)===null||t===void 0?void 0:t.call(this,e.data);this.deliver(this.promise);break}case"fulfilled":{if(l(this.promise.value,e.data))return;this.promise=e.complete?v(e.data):this.createPendingPromise(),this.deliver(this.promise)}}},r.prototype.handleError=function(e){var t;(t=this.reject)===null||t===void 0||t.call(this,e)},r.prototype.deliver=function(e){this.listeners.forEach(function(t){return t(e)})},r.prototype.createPendingPromise=function(){var e=this;return g(new Promise(function(t,i){e.resolve=t,e.reject=i}))},r.prototype.getDiff=function(e,t){var i=e.cache,s=t.from,o=t.fragment,a=t.fragmentName,u=i.diff(f(f({},t),{query:i.getFragmentDoc(o,a),returnPartialData:!0,id:s,optimistic:!0}));return f(f({},u),{result:e.queryManager.maskFragment({fragment:o,fragmentName:a,data:u.result})})},r}(),Z=function(){function r(e){e===void 0&&(e=Object.create(null)),this.queryRefs=new w(T),this.fragmentRefs=new w(T),this.options=e}return r.prototype.getQueryRef=function(e,t){var i=this.queryRefs.lookupArray(e);return i.current||(i.current=new X(t(),{autoDisposeTimeoutMs:this.options.autoDisposeTimeoutMs,onDispose:function(){delete i.current}})),i.current},r.prototype.getFragmentRef=function(e,t,i){var s=this.fragmentRefs.lookupArray(e);return s.current||(s.current=new Y(t,i,{autoDisposeTimeoutMs:this.options.autoDisposeTimeoutMs,onDispose:function(){delete s.current}})),s.current},r.prototype.add=function(e,t){var i=this.queryRefs.lookupArray(e);i.current=t},r}(),b=Symbol.for("apollo.suspenseCache");function $(r){var e;return r[b]||(r[b]=new Z((e=r.defaultOptions.react)===null||e===void 0?void 0:e.suspense)),r[b]}var ee=Symbol.for("apollo.skipToken");function he(r,e){return e===void 0&&(e=Object.create(null)),z("useSuspenseQuery",te,O(typeof e=="object"?e.client:void 0))(r,e)}function te(r,e){var t=O(e.client),i=$(t),s=ne({client:t,query:r,options:e}),o=s.fetchPolicy,a=s.variables,u=e.queryKey,N=u===void 0?[]:u,Q=q([r,K(a)],[].concat(N),!0),n=i.getQueryRef(Q,function(){return t.watchQuery(s)}
1),P=h.useState([n.key,n.promise]),p=P[0],m=P[1];p[0]!==n.key&&(p[0]=n.key,p[1]=n.promise);var D=p[1];n.didChangeOptions(s)&&(p[1]=D=n.applyOptions(s)),h.useEffect(function(){var c=n.retain(),d=n.listen(function(F){m([n.key,F])});return function(){d(),c()}},[n]);var C=h.useMemo(function(){var c=E(n.result);return{loading:!1,data:n.result.data,networkStatus:c?S.error:S.ready,error:c}},[n.result]),y=o==="standby"?C:U(D),_=h.useCallback(function(c){var d=n.fetchMore(c);return m([n.key,n.promise]),d},[n]),k=h.useCallback(function(c){var d=n.refetch(c);return m([n.key,n.promise]),d},[n]),R=n.observable.subscribeToMore;return h.useMemo(function(){return{client:t,data:y.data,error:E(y),networkStatus:y.networkStatus,fetchMore:_,refetch:k,subscribeToMore:R}},[t,_,k,y,R])}function re(r){var e=r.query,t=r.fetchPolicy,i=r.returnPartialData;A(e,I.Query),ie(t),se(t,i)}function ie(r){r===void 0&&(r="cache-first");var e=["cache-first","network-only","no-cache","cache-and-network"];M(e.includes(r),66,r)}function se(r,e){r==="no-cache"&&e&&globalThis.__DEV__!==!1&&M.warn(67)}function E(r){return W(r.errors)?new x({graphQLErrors:r.errors}):r.error}function ne(r){var e=r.client,t=r.query,i=r.options;return V(function(){var s;if(i===ee)return{query:t,fetchPolicy:"standby"};var o=i.fetchPolicy||((s=e.defaultOptions.watchQuery)===null||s===void 0?void 0:s.fetchPolicy)||"cache-first",a=f(f({},i),{fetchPolicy:o,query:t,notifyOnNetworkStatusChange:!1,nextFetchPolicy:void 0});return globalThis.__DEV__!==!1&&re(a),i.skip&&(a.fetchPolicy="standby"),a},[e,i,t])}export{ee as s,he 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.