Files
boc/cc-frontend/node_modules/react-query/dist/broadcastQueryClient-experimental.production.min.js
T

3 lines
11 KiB
JavaScript
Raw Normal View History

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).ReactQueryBroadcastQueryClientExperimental={})}(this,(function(e){"use strict";function n(e){return e||(e=0),new Promise((function(n){return setTimeout(n,e)}))}function t(){return Math.random().toString(36).substring(2)}var r=0,o=0;function s(){var e=(new Date).getTime();return e===r?1e3*e+ ++o:(r=e,o=0,1e3*e)}var i="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var a={create:function(e){var n={messagesCallback:null,bc:new BroadcastChannel(e),subFns:[]};return n.bc.onmessage=function(e){n.messagesCallback&&n.messagesCallback(e.data)},n},close:function(e){e.bc.close(),e.subFns=[]},onMessage:function(e,n){e.messagesCallback=n},postMessage:function(e,n){e.bc.postMessage(n,!1)},canBeUsed:function(){if(i&&"undefined"==typeof window)return!1;if("function"==typeof BroadcastChannel){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}return!1},type:"native",averageResponseTime:function(){return 150},microSeconds:s},u=function(e){var n=new Set,t=new Map;this.has=n.has.bind(n),this.add=function(r){t.set(r,c()),n.add(r),function(){var r=c()-e,o=n[Symbol.iterator]();for(;;){var s=o.next().value;if(!s)return;if(!(t.get(s)<r))return;t.delete(s),n.delete(s)}}()},this.clear=function(){n.clear(),t.clear()}};function c(){return(new Date).getTime()}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=JSON.parse(JSON.stringify(e));return void 0===n.webWorkerSupport&&(n.webWorkerSupport=!0),n.idb||(n.idb={}),n.idb.ttl||(n.idb.ttl=45e3),n.idb.fallbackInterval||(n.idb.fallbackInterval=150),e.idb&&"function"==typeof e.idb.onclose&&(n.idb.onclose=e.idb.onclose),n.localstorage||(n.localstorage={}),n.localstorage.removeTimeout||(n.localstorage.removeTimeout=6e4),e.methods&&(n.methods=e.methods),n.node||(n.node={}),n.node.ttl||(n.node.ttl=12e4),void 0===n.node.useFastPath&&(n.node.useFastPath=!0),n}function l(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function f(e,n){var t=e.transaction("messages").objectStore("messages"),r=[];return new Promise((function(e){(function(){try{var e=IDBKeyRange.bound(n+1,1/0);return t.openCursor(e)}catch(e){return t.openCursor()}}()).onsuccess=function(t){var o=t.target.result;o?o.value.id<n+1?o.continue(n+1):(r.push(o.value),o.continue()):e(r)}}))}function m(e,n){return function(e,n){var t=(new Date).getTime()-n,r=e.transaction("messages").objectStore("messages"),o=[];return new Promise((function(e){r.openCursor().onsuccess=function(n){var r=n.target.result;if(r){var s=r.value;if(!(s.time<t))return void e(o);o.push(s),r.continue()}else e(o)}}))}(e,n).then((function(n){return Promise.all(n.map((function(n){return function(e,n){var t=e.transaction(["messages"],"readwrite").objectStore("messages").delete(n);return new Promise((function(e){t.onsuccess=function(){return e()}}))}(e,n.id)})))}))}function h(e){return e.closed?Promise.resolve():e.messagesCallback?f(e.db,e.lastCursorId).then((function(n){return n.filter((function(e){return!!e})).map((function(n){return n.id>e.lastCursorId&&(e.lastCursorId=n.id),n})).filter((function(n){return function(e,n){return e.uuid!==n.uuid&&(!n.eMIs.has(e.id)&&!(e.data.time<n.messagesCallbackTime))}(n,e)})).sort((function(e,n){return e.time-n.time})).forEach((function(n){e.messagesCallback&&(e.eMIs.add(n.id),e.messagesCallback(n.data))})),Promise.resolve()})):Promise.resolve()}var p={create:function(e,r){return r=d(r),function(e){var n="pubkey.broadcast-channel-0-"+e,t=l().open(n,1);return t.onupgradeneeded=function(e){e.target.result.createObjectStore("messages",{keyPath:"id",autoIncrement:!0})},new Promise((function(e,n){t.onerror=functio
//# sourceMappingURL=broadcastQueryClient-experimental.production.min.js.map