3 lines
48 KiB
JavaScript
3 lines
48 KiB
JavaScript
|
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactQuery={},t.React)}(this,(function(t,e){"use strict";var n="default"in e?e.default:e;function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var i=function(){function t(){this.listeners=[]}var e=t.prototype;return e.subscribe=function(t){var e=this,n=t||function(){};return this.listeners.push(n),this.onSubscribe(),function(){e.listeners=e.listeners.filter((function(t){return t!==n})),e.onUnsubscribe()}},e.hasListeners=function(){return this.listeners.length>0},e.onSubscribe=function(){},e.onUnsubscribe=function(){},t}();function u(){return(u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var s="undefined"==typeof window;function o(){}function a(t){return"number"==typeof t&&t>=0&&t!==1/0}function c(t){return Array.isArray(t)?t:[t]}function l(t,e){return t.filter((function(t){return-1===e.indexOf(t)}))}function h(t,e){return Math.max(t+(e||0)-Date.now(),0)}function f(t,e,n){return R(t)?"function"==typeof e?u({},n,{queryKey:t,queryFn:e}):u({},e,{queryKey:t}):t}function d(t,e,n){return R(t)?[u({},e,{queryKey:t}),n]:[t||{},e]}function v(t,e){var n=t.active,r=t.exact,i=t.fetching,u=t.inactive,s=t.predicate,o=t.queryKey,a=t.stale;if(R(o))if(r){if(e.queryHash!==y(o,e.options))return!1}else if(!b(e.queryKey,o))return!1;var c=function(t,e){return!0===t&&!0===e||null==t&&null==e?"all":!1===t&&!1===e?"none":(null!=t?t:!e)?"active":"inactive"}(n,u);if("none"===c)return!1;if("all"!==c){var l=e.isActive();if("active"===c&&!l)return!1;if("inactive"===c&&l)return!1}return("boolean"!=typeof a||e.isStale()===a)&&(("boolean"!=typeof i||e.isFetching()===i)&&!(s&&!s(e)))}function p(t,e){var n=t.exact,r=t.fetching,i=t.predicate,u=t.mutationKey;if(R(u)){if(!e.options.mutationKey)return!1;if(n){if(m(e.options.mutationKey)!==m(u))return!1}else if(!b(e.options.mutationKey,u))return!1}return("boolean"!=typeof r||"loading"===e.state.status===r)&&!(i&&!i(e))}function y(t,e){return((null==e?void 0:e.queryKeyHashFn)||m)(t)}function m(t){var e,n=c(t);return e=n,JSON.stringify(e,(function(t,e){return O(e)?Object.keys(e).sort().reduce((function(t,n){return t[n]=e[n],t}),{}):e}))}function b(t,e){return function t(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(e&&n&&"object"==typeof e&&"object"==typeof n)return!Object.keys(n).some((function(r){return!t(e[r],n[r])}));return!1}(c(t),c(e))}function g(t,e){if(t===e)return t;var n=Array.isArray(t)&&Array.isArray(e);if(n||O(t)&&O(e)){for(var r=n?t.length:Object.keys(t).length,i=n?e:Object.keys(e),u=i.length,s=n?[]:{},o=0,a=0;a<u;a++){var c=n?a:i[a];s[c]=g(t[c],e[c]),s[c]===t[c]&&o++}return r===u&&o===r?t:s}return e}function O(t){if(!C(t))return!1;var e=t.constructor;if(void 0===e)return!0;var n=e.prototype;return!!C(n)&&!!n.hasOwnProperty("isPrototypeOf")}function C(t){return"[object Object]"===Object.prototype.toString.call(t)}function R(t){return"string"==typeof t||Array.isArray(t)}function P(t){Promise.resolve().then(t).catch((function(t){return setTimeout((function(){throw t}))}))}function q(){if("function"==typeof AbortController)return new AbortController}var Q=new(function(t){function e(){var e;return(e=t.call(this)||this).setup=function(t){var e;if(!s&&(null==(e=window)?void 0:e.addEventListener)){var n=function(){return t()};return window.addEventListener("visibilitychange",n,!1),window.addEventListener("focus",n,!1),function(){window.removeEventListener("visibilitychange",n),window.removeEventListener("focus",n)}}},e}r(e,t);var n=e.prototype;return n.onSubscribe=function(){this.cleanup||this.setEventListener(this.setup)},n.onUnsubscribe=function(){var t;this.hasListeners()||(null==(t=this.cleanup)||t.call(this),this.cleanup=void 0)},n.setEventListener=function(t){var e,n=this;this.setup=t,null==(e=this.cleanup)||e.call(this),this.cleanup=t(
|
||
|
|
//# sourceMappingURL=react-query.production.min.js.map
|