forked from bombastictranz/awesome-go
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path4930-c662bfa98c9d65ec.js.download
1 lines (1 loc) · 12.4 KB
/
4930-c662bfa98c9d65ec.js.download
1
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4930],{17497:function(t,e,n){n.d(e,{j:function(){return o}});var i=n(37343),r=n(48703);class s extends i.l{onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var t;null==(t=this.cleanup)||t.call(this),this.cleanup=void 0}}setEventListener(t){var e;this.setup=t,null==(e=this.cleanup)||e.call(this),this.cleanup=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.focused=t,t&&this.onFocus()}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){return"boolean"==typeof this.focused?this.focused:"undefined"==typeof document||[void 0,"visible","prerender"].includes(document.visibilityState)}constructor(){super(),this.setup=t=>{if(!r.sk&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",e,!1),()=>{window.removeEventListener("visibilitychange",e),window.removeEventListener("focus",e)}}}}}let o=new s},8406:function(t,e,n){n.d(e,{_:function(){return i}});let i=console},67756:function(t,e,n){n.d(e,{R:function(){return a},m:function(){return u}});var i=n(8406),r=n(99065),s=n(52951),o=n(26810);class u extends s.F{setOptions(t){this.options={...this.defaultOptions,...t},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(t){this.dispatch({type:"setState",state:t})}addObserver(t){-1===this.observers.indexOf(t)&&(this.observers.push(t),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.observers=this.observers.filter(e=>e!==t),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.observers.length||("loading"===this.state.status?this.scheduleGc():this.mutationCache.remove(this))}continue(){var t,e;return null!=(t=null==(e=this.retryer)?void 0:e.continue())?t:this.execute()}async execute(){var t,e,n,i,r,s,u,a,l,c,h,f,d,v,p,y,b,m,w,C;let g="loading"===this.state.status;try{if(!g){this.dispatch({type:"loading",variables:this.options.variables}),await (null==(l=(c=this.mutationCache.config).onMutate)?void 0:l.call(c,this.state.variables,this));let t=await (null==(h=(f=this.options).onMutate)?void 0:h.call(f,this.state.variables));t!==this.state.context&&this.dispatch({type:"loading",context:t,variables:this.state.variables})}let d=await (()=>{var t;return this.retryer=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(t,e)=>{this.dispatch({type:"failed",failureCount:t,error:e})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:null!=(t=this.options.retry)?t:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise})();return await (null==(t=(e=this.mutationCache.config).onSuccess)?void 0:t.call(e,d,this.state.variables,this.state.context,this)),await (null==(n=(i=this.options).onSuccess)?void 0:n.call(i,d,this.state.variables,this.state.context)),await (null==(r=(s=this.mutationCache.config).onSettled)?void 0:r.call(s,d,null,this.state.variables,this.state.context,this)),await (null==(u=(a=this.options).onSettled)?void 0:u.call(a,d,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:d}),d}catch(t){try{throw await (null==(d=(v=this.mutationCache.config).onError)?void 0:d.call(v,t,this.state.variables,this.state.context,this)),await (null==(p=(y=this.options).onError)?void 0:p.call(y,t,this.state.variables,this.state.context)),await (null==(b=(m=this.mutationCache.config).onSettled)?void 0:b.call(m,void 0,t,this.state.variables,this.state.context,this)),await (null==(w=(C=this.options).onSettled)?void 0:w.call(C,void 0,t,this.state.variables,this.state.context)),t}finally{this.dispatch({type:"error",error:t})}}}dispatch(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"loading":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!(0,o.Kw)(this.options.networkMode),status:"loading",variables:t.variables};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"};case"setState":return{...e,...t.state}}})(this.state),r.V.batch(()=>{this.observers.forEach(e=>{e.onMutationUpdate(t)}),this.mutationCache.notify({mutation:this,type:"updated",action:t})})}constructor(t){super(),this.defaultOptions=t.defaultOptions,this.mutationId=t.mutationId,this.mutationCache=t.mutationCache,this.logger=t.logger||i._,this.observers=[],this.state=t.state||a(),this.setOptions(t.options),this.scheduleGc()}}function a(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}},99065:function(t,e,n){n.d(e,{V:function(){return r}});var i=n(48703);let r=function(){let t=[],e=0,n=t=>{t()},r=t=>{t()},s=r=>{e?t.push(r):(0,i.A4)(()=>{n(r)})},o=()=>{let e=t;t=[],e.length&&(0,i.A4)(()=>{r(()=>{e.forEach(t=>{n(t)})})})};return{batch:t=>{let n;e++;try{n=t()}finally{--e||o()}return n},batchCalls:t=>function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];s(()=>{t(...n)})},schedule:s,setNotifyFunction:t=>{n=t},setBatchNotifyFunction:t=>{r=t}}}()},14342:function(t,e,n){n.d(e,{N:function(){return o}});var i=n(37343),r=n(48703);class s extends i.l{onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var t;null==(t=this.cleanup)||t.call(this),this.cleanup=void 0}}setEventListener(t){var e;this.setup=t,null==(e=this.cleanup)||e.call(this),this.cleanup=t(t=>{"boolean"==typeof t?this.setOnline(t):this.onOnline()})}setOnline(t){this.online=t,t&&this.onOnline()}onOnline(){this.listeners.forEach(t=>{t()})}isOnline(){return"boolean"==typeof this.online?this.online:"undefined"==typeof navigator||void 0===navigator.onLine||navigator.onLine}constructor(){super(),this.setup=t=>{if(!r.sk&&window.addEventListener){let e=()=>t();return window.addEventListener("online",e,!1),window.addEventListener("offline",e,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}}}}}let o=new s},52951:function(t,e,n){n.d(e,{F:function(){return r}});var i=n(48703);class r{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,i.PN)(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(t){this.cacheTime=Math.max(this.cacheTime||0,null!=t?t:i.sk?1/0:3e5)}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}},26810:function(t,e,n){n.d(e,{DV:function(){return l},Kw:function(){return u},Mz:function(){return c}});var i=n(17497),r=n(14342),s=n(48703);function o(t){return Math.min(1e3*2**t,3e4)}function u(t){return(null!=t?t:"online")!=="online"||r.N.isOnline()}class a{constructor(t){this.revert=null==t?void 0:t.revert,this.silent=null==t?void 0:t.silent}}function l(t){return t instanceof a}function c(t){let e,n,l,c=!1,h=0,f=!1,d=new Promise((t,e)=>{n=t,l=e}),v=()=>!i.j.isFocused()||"always"!==t.networkMode&&!r.N.isOnline(),p=i=>{f||(f=!0,null==t.onSuccess||t.onSuccess(i),null==e||e(),n(i))},y=n=>{f||(f=!0,null==t.onError||t.onError(n),null==e||e(),l(n))},b=()=>new Promise(n=>{e=t=>{let e=f||!v();return e&&n(t),e},null==t.onPause||t.onPause()}).then(()=>{e=void 0,f||null==t.onContinue||t.onContinue()}),m=()=>{let e;if(!f){try{e=t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(p).catch(e=>{var n,i;if(f)return;let r=null!=(n=t.retry)?n:3,u=null!=(i=t.retryDelay)?i:o,a="function"==typeof u?u(h,e):u,l=!0===r||"number"==typeof r&&h<r||"function"==typeof r&&r(h,e);if(c||!l){y(e);return}h++,null==t.onFail||t.onFail(h,e),(0,s.Gh)(a).then(()=>{if(v())return b()}).then(()=>{c?y(e):m()})})}};return u(t.networkMode)?m():b().then(m),{promise:d,cancel:e=>{f||(y(new a(e)),null==t.abort||t.abort())},continue:()=>(null==e?void 0:e())?d:Promise.resolve(),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1}}}},37343:function(t,e,n){n.d(e,{l:function(){return i}});class i{subscribe(t){return this.listeners.push(t),this.onSubscribe(),()=>{this.listeners=this.listeners.filter(e=>e!==t),this.onUnsubscribe()}}hasListeners(){return this.listeners.length>0}onSubscribe(){}onUnsubscribe(){}constructor(){this.listeners=[],this.subscribe=this.subscribe.bind(this)}}},48703:function(t,e,n){n.d(e,{A4:function(){return P},G9:function(){return F},Gh:function(){return S},I6:function(){return f},Kp:function(){return l},PN:function(){return o},Rc:function(){return a},Rm:function(){return y},SE:function(){return s},VS:function(){return C},X7:function(){return p},ZT:function(){return r},_v:function(){return c},_x:function(){return v},cb:function(){return d},e5:function(){return u},lV:function(){return h},oE:function(){return L},sk:function(){return i},to:function(){return m},yF:function(){return b}});let i="Deno"in window;function r(){}function s(t,e){return"function"==typeof t?t(e):t}function o(t){return"number"==typeof t&&t>=0&&t!==1/0}function u(t,e){return t.filter(t=>-1===e.indexOf(t))}function a(t,e,n){let i=t.slice(0);return i[e]=n,i}function l(t,e){return Math.max(t+(e||0)-Date.now(),0)}function c(t,e,n){return O(t)?"function"==typeof e?{...n,queryKey:t,queryFn:e}:{...e,queryKey:t}:t}function h(t,e,n){return O(t)?"function"==typeof e?{...n,mutationKey:t,mutationFn:e}:{...e,mutationKey:t}:"function"==typeof t?{...e,mutationFn:t}:{...t}}function f(t,e,n){return O(t)?[{...e,queryKey:t},n]:[t||{},e]}function d(t,e,n){return O(t)?[{...e,mutationKey:t},n]:[t||{},e]}function v(t,e){let{type:n="all",exact:i,fetchStatus:r,predicate:s,queryKey:o,stale:u}=t;if(O(o)){if(i){if(e.queryHash!==y(o,e.options))return!1}else{if(!w(e.queryKey,o))return!1}}if("all"!==n){let t=e.isActive();if("active"===n&&!t||"inactive"===n&&t)return!1}return("boolean"!=typeof u||e.isStale()===u)&&(void 0===r||r===e.state.fetchStatus)&&(!s||!!s(e))}function p(t,e){let{exact:n,fetching:i,predicate:r,mutationKey:s}=t;if(O(s)){if(!e.options.mutationKey)return!1;if(n){if(b(e.options.mutationKey)!==b(s))return!1}else{if(!w(e.options.mutationKey,s))return!1}}return("boolean"!=typeof i||"loading"===e.state.status===i)&&(!r||!!r(e))}function y(t,e){return((null==e?void 0:e.queryKeyHashFn)||b)(t)}function b(t){return JSON.stringify(t,(t,e)=>E(e)?Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{}):e)}function m(t,e){return w(t,e)}function w(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&!Object.keys(e).some(n=>!w(t[n],e[n]))}function C(t,e){if(t&&!e||e&&!t)return!1;for(let n in t)if(t[n]!==e[n])return!1;return!0}function g(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function E(t){if(!x(t))return!1;let e=t.constructor;if(void 0===e)return!0;let n=e.prototype;return!!(x(n)&&n.hasOwnProperty("isPrototypeOf"))}function x(t){return"[object Object]"===Object.prototype.toString.call(t)}function O(t){return Array.isArray(t)}function S(t){return new Promise(e=>{setTimeout(e,t)})}function P(t){S(0).then(t)}function F(){if("function"==typeof AbortController)return new AbortController}function L(t,e,n){return null!=n.isDataEqual&&n.isDataEqual(t,e)?t:"function"==typeof n.structuralSharing?n.structuralSharing(t,e):!1!==n.structuralSharing?function t(e,n){if(e===n)return e;let i=g(e)&&g(n);if(i||E(e)&&E(n)){let r=i?e.length:Object.keys(e).length,s=i?n:Object.keys(n),o=s.length,u=i?[]:{},a=0;for(let r=0;r<o;r++){let o=i?r:s[r];u[o]=t(e[o],n[o]),u[o]===e[o]&&a++}return r===o&&a===r?e:u}return n}(t,e):e}},5159:function(t,e,n){n.r(e),n.d(e,{QueryClientProvider:function(){return a},defaultContext:function(){return r},useQueryClient:function(){return u}});var i=n(91710);let r=i.createContext(void 0),s=i.createContext(!1);function o(t,e){return t||(e?(window.ReactQueryClientContext||(window.ReactQueryClientContext=r),window.ReactQueryClientContext):r)}let u=function(){let{context:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=i.useContext(o(t,i.useContext(s)));if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},a=t=>{let{client:e,children:n,context:r,contextSharing:u=!1}=t;i.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]);let a=o(r,u);return i.createElement(s.Provider,{value:!r&&u},i.createElement(a.Provider,{value:e},n))}}}]);