UNPKG

@open-condo/apollo

Version:

A wrapper over @apollo/client that allows you to use persistent cache from local storage, configure TTL, invalidate cache, and use a single configuration for getServerSideProps, SSR, and CSR

6 lines 261 kB
import*as e from"react";import{createContext as t,useContext as n,useEffect as r,useRef as i,useState as o,useMemo as a}from"react";import*as s from"@apollo/client/core";import{from as c,ApolloClient as u}from"@apollo/client/core";import*as l from"@apollo/client";import p from"crypto";import*as d from"@apollo/client/utilities";import*as f from"@apollo/client/link/http";var h,y=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},v=function(){function e(e){var t=e.debug,n=void 0!==t&&t;this.debug=n,this.lines=[]}return e.prototype.emit=function(t,n){if(t in console){var r=e.prefix;console[t].apply(console,y([r],n,!1))}},e.prototype.tailLogs=function(){var e=this;this.lines.forEach(function(t){var n=t[0],r=t[1];return e.emit(n,r)})},e.prototype.getLogs=function(){return this.lines},e.prototype.write=function(t,n){var r=e.buffer;this.lines=y(y([],this.lines.slice(1-r),!0),[[t,n]],!1),(this.debug||"log"!==t)&&this.emit(t,n)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("log",e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("warn",e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("error",e)},e.buffer=30,e.prefix="[apollo-cache-persist]",e}(),m=function(){function e(e){var t=e.cache,n=e.serialize,r=void 0===n||n;this.cache=t,this.serialize=r}return e.prototype.extract=function(){var e=this.cache.extract();return this.serialize&&(e=JSON.stringify(e)),e},e.prototype.restore=function(e){this.serialize&&"string"==typeof e&&(e=JSON.parse(e)),null!=e&&this.cache.restore(e)},e}(),g=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},E=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},T=function(){function e(e){var t=e.storage,n=e.key,r=void 0===n?"apollo-cache-persist":n;this.storage=t,this.key=r}return e.prototype.read=function(){return g(this,void 0,void 0,function(){return E(this,function(e){return[2,this.storage.getItem(this.key)]})})},e.prototype.write=function(e){return g(this,void 0,void 0,function(){return E(this,function(t){switch(t.label){case 0:return[4,this.storage.setItem(this.key,e)];case 1:return t.sent(),[2]}})})},e.prototype.purge=function(){return g(this,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(this.key)];case 1:return e.sent(),[2]}})})},e.prototype.getSize=function(){return g(this,void 0,void 0,function(){var e;return E(this,function(t){switch(t.label){case 0:return[4,this.storage.getItem(this.key)];case 1:return null==(e=t.sent())?[2,0]:[2,"string"==typeof e?e.length:null]}})})},e}(),b=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},_=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},N=function(){function e(e,t){var n=e.log,r=e.cache,i=e.storage,o=t.maxSize,a=void 0===o?1048576:o,s=t.persistenceMapper;this.log=n,this.cache=r,this.storage=i,this.paused=!1,s&&(this.persistenceMapper=s),a&&(this.maxSize=a)}return e.prototype.persist=function(){return b(this,void 0,void 0,function(){var e,t;return _(this,function(n){switch(n.label){case 0:return n.trys.push([0,6,,7]),e=this.cache.extract(),this.paused||!this.persistenceMapper?[3,2]:[4,this.persistenceMapper(e)];case 1:e=n.sent(),n.label=2;case 2:return null!=this.maxSize&&"string"==typeof e&&e.length>this.maxSize&&!this.paused?[4,this.purge()]:[3,4];case 3:return n.sent(),this.paused=!0,[2];case 4:return this.paused?[2]:[4,this.storage.write(e)];case 5:return n.sent(),this.log.info("string"==typeof e?"Persisted cache of size ".concat(e.length," characters"):"Persisted cache"),[3,7];case 6:throw t=n.sent(),this.log.error("Error persisting cache",t),t;case 7:return[2]}})})},e.prototype.restore=function(){return b(this,void 0,void 0,function(){var e,t;return _(this,function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),[4,this.storage.read()];case 1:return null==(e=n.sent())?[3,3]:[4,this.cache.restore(e)];case 2:return n.sent(),this.log.info("string"==typeof e?"Restored cache of size ".concat(e.length," characters"):"Restored cache"),[3,4];case 3:this.log.info("No stored cache to restore"),n.label=4;case 4:return[3,6];case 5:throw t=n.sent(),this.log.error("Error restoring cache",t),t;case 6:return[2]}})})},e.prototype.purge=function(){return b(this,void 0,void 0,function(){var e;return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.storage.purge()];case 1:return t.sent(),this.log.info("Purged cache storage"),[3,3];case 2:throw e=t.sent(),this.log.error("Error purging cache storage",e),e;case 3:return[2]}})})},e}(),I=function(e){var t=e.cache;return function(e){var n=t.write,r=t.evict,i=t.modify,o=t.gc;return t.write=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=n.apply(t,r);return e(),o},t.evict=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=r.apply(t,n);return e(),o},t.modify=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=i.apply(t,n);return e(),o},t.gc=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=o.apply(t,n);return e(),i},function(){t.write=n,t.evict=r,t.modify=i,t.gc=o}}},O=function(){function e(t,n){var r=t.log,i=t.persistor,o=this;this.fire=function(){o.debounce?(null!=o.timeout&&clearTimeout(o.timeout),o.timeout=setTimeout(o.persist,o.debounce)):o.persist()},this.persist=function(){o.paused||o.persistor.persist()};var a=e.defaultDebounce,s=n.cache,c=n.debounce,u=n.trigger,l=void 0===u?"write":u;if(l)switch(this.debounce=null!=c?c:a,this.persistor=i,this.paused=!1,l){case"write":this.uninstall=I({cache:s})(this.fire);break;case"background":c&&r.warn("Debounce is not recommended with `background` trigger"),this.debounce=c,this.uninstall=function(e){var t=e.log,n=e.cache;return function(e){return t.warn("Trigger option `background` not available on web; using `write` trigger"),I({cache:n})(e)}}({cache:s,log:r})(this.fire);break;default:if("function"!=typeof l)throw Error("Unrecognized trigger option: ".concat(l));this.uninstall=l(this.fire)}}return e.prototype.pause=function(){this.paused=!0},e.prototype.resume=function(){this.paused=!1},e.prototype.remove=function(){this.uninstall&&(this.uninstall(),this.uninstall=null,this.paused=!0)},e.defaultDebounce=1e3,e}(),w=function(){function e(e){if(!e.cache)throw new Error("In order to persist your Apollo Cache, you need to pass in a cache. Please see https://www.apollographql.com/docs/react/basics/caching.html for our default InMemoryCache.");if(!e.storage)throw new Error("In order to persist your Apollo Cache, you need to pass in an underlying storage provider. Please see https://github.com/apollographql/apollo-cache-persist#storage-providers");var t=new v(e),n=new m(e),r=new T(e),i=new N({log:t,cache:n,storage:r},e),o=new O({log:t,persistor:i},e);this.log=t,this.cache=n,this.storage=r,this.persistor=i,this.trigger=o}return e.prototype.persist=function(){return this.persistor.persist()},e.prototype.restore=function(){return this.persistor.restore()},e.prototype.purge=function(){return this.persistor.purge()},e.prototype.pause=function(){this.trigger.pause()},e.prototype.resume=function(){this.trigger.resume()},e.prototype.remove=function(){this.trigger.remove()},e.prototype.getLogs=function(e){if(void 0===e&&(e=!1),!e)return this.log.getLogs();this.log.tailLogs()},e.prototype.getSize=function(){return this.storage.getSize()},e}(),A=(h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},h(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});!function(e){function t(t){var n=e.call(this,t)||this;return n.storage=new D(t),n.persistor=new S({log:n.log,cache:n.cache,storage:n.storage},t),n}A(t,e),t.prototype.restoreSync=function(){this.persistor.restoreSync()}}(w);var S=function(e){function t(t,n){var r=t.log,i=t.cache,o=t.storage;return e.call(this,{log:r,cache:i,storage:o},n)||this}return A(t,e),t.prototype.restoreSync=function(){this.cache.restore(this.storage.readSync())},t}(N),D=function(e){function t(t){return e.call(this,t)||this}return A(t,e),t.prototype.readSync=function(){return this.storage.getItem(this.key)},t}(T),R=function(){function e(e){this.storage=e}return e.prototype.getItem=function(e){return this.storage.getItem(e)},e.prototype.removeItem=function(e){return this.storage.removeItem(e)},e.prototype.setItem=function(e,t){return null!==t?this.storage.setItem(e,t):this.removeItem(e)},e}();function F(){return"undefined"==typeof window}const k="__APOLLO_STATE__";function x(e){return new w({cache:e,storage:new R(window.localStorage),debug:"development"===process.env.NODE_ENV,key:"__APOLLO_PERSISTED_CACHE__"})}const j=t({});function C(){return n(j)}function P(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function L(e,t,n,r){return new(n||(n=Promise))(function(t,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n(function(e){e(r)})).then(o,a)}s((r=r.apply(e,[])).next())})}var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function M(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function V(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var U=V(s),B=V(f);const G=class{constructor({uri:e,name:t,type:n}){this.uri=e,this.name=t,this.type=n}};var Q=function(e){return"undefined"!=typeof File&&e instanceof File||"undefined"!=typeof Blob&&e instanceof Blob||e instanceof G};const Y=Q;var q=Q;const{ApolloLink:z,Observable:W}=U,{createSignalIfSupported:J,fallbackHttpConfig:K,parseAndCheckHttpResponse:X,rewriteURIForGET:H,selectHttpOptionsAndBody:Z,selectURI:ee,serializeFetchParameter:te}=B,ne=function(e,t="",n=Y){const r=new Map,i=new Map;return{clone:function e(t,o,a){let s=t;if(n(t)){s=null;const e=r.get(t);e?e.push(o):r.set(t,[o])}else{const n=Array.isArray(t)||"undefined"!=typeof FileList&&t instanceof FileList,r=t&&t.constructor===Object;if(n||r){const r=i.has(t);if(r?s=i.get(t):(s=n?[]:{},i.set(t,s)),!a.has(t)){const i=o?`${o}.`:"",c=new Set(a).add(t);if(n){let n=0;for(const o of t){const t=e(o,i+n++,c);r||s.push(t)}}else for(const n in t){const o=e(t[n],i+n,c);r||(s[n]=o)}}}}return s}(e,t,new Set),files:r}},re=function(e,t,n){e.append(t,n,n.name)},ie=q;var oe=function({uri:e="/graphql",useGETForQueries:t,isExtractableFile:n=ie,FormData:r,formDataAppendFile:i=re,fetch:o,fetchOptions:a,credentials:s,headers:c,includeExtensions:u}={}){const l={http:{includeExtensions:u},options:a,credentials:s,headers:c};return new z(a=>{const s=a.getContext(),{clientAwareness:{name:c,version:u}={},headers:p}=s,d={http:s.http,options:s.fetchOptions,credentials:s.credentials,headers:{...c&&{"apollographql-client-name":c},...u&&{"apollographql-client-version":u},...p}},{options:f,body:h}=Z(a,K,l,d),{clone:y,files:v}=ne(h,"",n);let m=ee(a,e);if(v.size){delete f.headers["content-type"];const e=new(r||FormData);e.append("operations",te(y,"Payload"));const t={};let n=0;v.forEach(e=>{t[++n]=e}),e.append("map",JSON.stringify(t)),n=0,v.forEach((t,r)=>{i(e,++n,r)}),f.body=e}else if(t&&!a.query.definitions.some(e=>"OperationDefinition"===e.kind&&"mutation"===e.operation)&&(f.method="GET"),"GET"===f.method){const{newURI:e,parseError:t}=H(m,h);if(t)return new W(e=>{e.error(t)});m=e}else f.body=te(y,"Payload");const{controller:g}=J();g&&(f.signal&&(f.signal.aborted?g.abort():f.signal.addEventListener("abort",()=>{g.abort()},{once:!0})),f.signal=g.signal);const E=o||fetch;return new W(e=>{let t;return E(m,f).then(e=>(a.setContext({response:e}),e)).then(X(a)).then(t=>{e.next(t),e.complete()}).catch(n=>{t||(n.result&&n.result.errors&&n.result.data&&e.next(n.result),e.error(n))}),()=>{t=!0,g&&g.abort()}})})},ae=M(oe);var se=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e},ce="object"==typeof $&&$&&$.Object===Object&&$,ue=ce,le="object"==typeof self&&self&&self.Object===Object&&self,pe=ue||le||Function("return this")(),de=pe.Symbol,fe=de,he=Object.prototype,ye=he.hasOwnProperty,ve=he.toString,me=fe?fe.toStringTag:void 0;var ge=function(e){var t=ye.call(e,me),n=e[me];try{e[me]=void 0;var r=!0}catch(e){}var i=ve.call(e);return r&&(t?e[me]=n:delete e[me]),i},Ee=Object.prototype.toString;var Te=ge,be=function(e){return Ee.call(e)},_e=de?de.toStringTag:void 0;var Ne=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_e&&_e in Object(e)?Te(e):be(e)};var Ie=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Oe=Ne,we=Ie;var Ae,Se=function(e){if(!we(e))return!1;var t=Oe(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},De=pe["__core-js_shared__"],Re=(Ae=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||""))?"Symbol(src)_1."+Ae:"";var Fe=function(e){return!!Re&&Re in e},ke=Function.prototype.toString;var xe=function(e){if(null!=e){try{return ke.call(e)}catch(e){}try{return e+""}catch(e){}}return""},je=Se,Ce=Fe,Pe=Ie,Le=xe,$e=/^\[object .+?Constructor\]$/,Me=Function.prototype,Ve=Object.prototype,Ue=Me.toString,Be=Ve.hasOwnProperty,Ge=RegExp("^"+Ue.call(Be).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Qe=function(e){return!(!Pe(e)||Ce(e))&&(je(e)?Ge:$e).test(Le(e))},Ye=function(e,t){return null==e?void 0:e[t]};var qe=function(e,t){var n=Ye(e,t);return Qe(n)?n:void 0},ze=qe,We=function(){try{var e=ze(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Je=We;var Ke=function(e,t,n){"__proto__"==t&&Je?Je(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n};var Xe=function(e){return e};var He=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Ze=He,et=Math.max;var tt=function(e,t,n){return t=et(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=et(r.length-t,0),a=Array(o);++i<o;)a[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(a),Ze(e,this,s)}};var nt=function(e){return function(){return e}},rt=We,it=rt?function(e,t){return rt(e,"toString",{configurable:!0,enumerable:!1,value:nt(t),writable:!0})}:Xe,ot=Date.now;var at=function(e){var t=0,n=0;return function(){var r=ot(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}},st=at(it),ct=Xe,ut=tt,lt=st;var pt=function(e,t){return lt(ut(e,t,ct),e+"")},dt=qe(pe,"WeakMap"),ft=dt&&new dt,ht=ft,yt=ht?function(e,t){return ht.set(e,t),e}:Xe,vt=Ie,mt=Object.create,gt=function(){function e(){}return function(t){if(!vt(t))return{};if(mt)return mt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Et=gt,Tt=Ie;var bt=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Et(e.prototype),r=e.apply(n,t);return Tt(r)?r:n}},_t=bt,Nt=pe;var It=function(e,t,n){var r=1&t,i=_t(e);return function t(){return(this&&this!==Nt&&this instanceof t?i:e).apply(r?n:this,arguments)}},Ot=Math.max;var wt=function(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,c=t.length,u=Ot(o-a,0),l=Array(c+u),p=!r;++s<c;)l[s]=t[s];for(;++i<a;)(p||i<o)&&(l[n[i]]=e[i]);for(;u--;)l[s++]=e[i++];return l},At=Math.max;var St=function(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,c=-1,u=t.length,l=At(o-s,0),p=Array(l+u),d=!r;++i<l;)p[i]=e[i];for(var f=i;++c<u;)p[f+c]=t[c];for(;++a<s;)(d||i<o)&&(p[f+n[a]]=e[i++]);return p};var Dt=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r};var Rt=function(){},Ft=gt,kt=Rt;function xt(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}xt.prototype=Ft(kt.prototype),xt.prototype.constructor=xt;var jt=xt;var Ct=ft,Pt=Ct?function(e){return Ct.get(e)}:function(){},Lt={},$t=Object.prototype.hasOwnProperty;var Mt=function(e){for(var t=e.name+"",n=Lt[t],r=$t.call(Lt,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t},Vt=gt,Ut=Rt;function Bt(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Bt.prototype=Vt(Ut.prototype),Bt.prototype.constructor=Bt;var Gt=Bt,Qt=Array.isArray;var Yt=function(e){return null!=e&&"object"==typeof e};var qt=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t},zt=jt,Wt=Gt,Jt=qt;var Kt=jt,Xt=Gt,Ht=Rt,Zt=Qt,en=Yt,tn=function(e){if(e instanceof zt)return e.clone();var t=new Wt(e.__wrapped__,e.__chain__);return t.__actions__=Jt(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t},nn=Object.prototype.hasOwnProperty;function rn(e){if(en(e)&&!Zt(e)&&!(e instanceof Kt)){if(e instanceof Xt)return e;if(nn.call(e,"__wrapped__"))return tn(e)}return new Xt(e)}rn.prototype=Ht.prototype,rn.prototype.constructor=rn;var on=jt,an=Pt,sn=Mt,cn=rn;var un=function(e){var t=sn(e),n=cn[t];if("function"!=typeof n||!(t in on.prototype))return!1;if(e===n)return!0;var r=an(n);return!!r&&e===r[0]},ln=at(yt),pn=/\{\n\/\* \[wrapped with (.+)\] \*/,dn=/,? & /;var fn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;var hn=function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1},yn=function(e){return e!=e},vn=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1};var mn=function(e,t,n){return t==t?vn(e,t,n):hn(e,yn,n)};var gn=se,En=function(e,t){return!!(null==e?0:e.length)&&mn(e,t,0)>-1},Tn=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];var bn=function(e){var t=e.match(pn);return t?t[1].split(dn):[]},_n=function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(fn,"{\n/* [wrapped with "+t+"] */\n")},Nn=st,In=function(e,t){return gn(Tn,function(n){var r="_."+n[0];t&n[1]&&!En(e,r)&&e.push(r)}),e.sort()};var On=function(e,t,n){var r=t+"";return Nn(e,_n(r,In(bn(r),n)))},wn=un,An=ln,Sn=On;var Dn=function(e,t,n,r,i,o,a,s,c,u){var l=8&t;t|=l?32:64,4&(t&=~(l?64:32))||(t&=-4);var p=[e,t,i,l?o:void 0,l?a:void 0,l?void 0:o,l?void 0:a,s,c,u],d=n.apply(void 0,p);return wn(e)&&An(d,p),d.placeholder=r,Sn(d,e,t)};var Rn=function(e){return e.placeholder},Fn=/^(?:0|[1-9]\d*)$/;var kn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Fn.test(e))&&e>-1&&e%1==0&&e<t},xn=qt,jn=kn,Cn=Math.min;var Pn="__lodash_placeholder__";var Ln=function(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n];a!==t&&a!==Pn||(e[n]=Pn,o[i++]=n)}return o},$n=wt,Mn=St,Vn=Dt,Un=bt,Bn=Dn,Gn=Rn,Qn=function(e,t){for(var n=e.length,r=Cn(t.length,n),i=xn(e);r--;){var o=t[r];e[r]=jn(o,n)?i[o]:void 0}return e},Yn=Ln,qn=pe;var zn=function e(t,n,r,i,o,a,s,c,u,l){var p=128&n,d=1&n,f=2&n,h=24&n,y=512&n,v=f?void 0:Un(t);return function m(){for(var g=arguments.length,E=Array(g),T=g;T--;)E[T]=arguments[T];if(h)var b=Gn(m),_=Vn(E,b);if(i&&(E=$n(E,i,o,h)),a&&(E=Mn(E,a,s,h)),g-=_,h&&g<l){var N=Yn(E,b);return Bn(t,n,e,m.placeholder,r,E,N,c,u,l-g)}var I=d?r:this,O=f?I[t]:t;return g=E.length,c?E=Qn(E,c):y&&g>1&&E.reverse(),p&&u<g&&(E.length=u),this&&this!==qn&&this instanceof m&&(O=v||Un(O)),O.apply(I,E)}},Wn=He,Jn=bt,Kn=zn,Xn=Dn,Hn=Rn,Zn=Ln,er=pe;var tr=function(e,t,n){var r=Jn(e);return function i(){for(var o=arguments.length,a=Array(o),s=o,c=Hn(i);s--;)a[s]=arguments[s];var u=o<3&&a[0]!==c&&a[o-1]!==c?[]:Zn(a,c);return(o-=u.length)<n?Xn(e,t,Kn,i.placeholder,void 0,a,u,void 0,void 0,n-o):Wn(this&&this!==er&&this instanceof i?r:e,this,a)}},nr=He,rr=bt,ir=pe;var or=function(e,t,n,r){var i=1&t,o=rr(e);return function t(){for(var a=-1,s=arguments.length,c=-1,u=r.length,l=Array(u+s),p=this&&this!==ir&&this instanceof t?o:e;++c<u;)l[c]=r[c];for(;s--;)l[c++]=arguments[++a];return nr(p,i?n:this,l)}},ar=wt,sr=St,cr=Ln,ur="__lodash_placeholder__",lr=128,pr=Math.min;var dr=/\s/;var fr=function(e){for(var t=e.length;t--&&dr.test(e.charAt(t)););return t},hr=/^\s+/;var yr=Ne,vr=Yt;var mr=function(e){return"symbol"==typeof e||vr(e)&&"[object Symbol]"==yr(e)},gr=function(e){return e?e.slice(0,fr(e)+1).replace(hr,""):e},Er=Ie,Tr=mr,br=/^[-+]0x[0-9a-f]+$/i,_r=/^0b[01]+$/i,Nr=/^0o[0-7]+$/i,Ir=parseInt;var Or=function(e){if("number"==typeof e)return e;if(Tr(e))return NaN;if(Er(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Er(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=gr(e);var n=_r.test(e);return n||Nr.test(e)?Ir(e.slice(2),n?2:8):br.test(e)?NaN:+e},wr=1/0;var Ar=function(e){return e?(e=Or(e))===wr||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var Sr=function(e){var t=Ar(e),n=t%1;return t==t?n?t-n:t:0},Dr=yt,Rr=It,Fr=tr,kr=zn,xr=or,jr=Pt,Cr=function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,a=r==lr&&8==n||r==lr&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!a)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var s=t[3];if(s){var c=e[3];e[3]=c?ar(c,s,t[4]):s,e[4]=c?cr(e[3],ur):t[4]}return(s=t[5])&&(c=e[5],e[5]=c?sr(c,s,t[6]):s,e[6]=c?cr(e[5],ur):t[6]),(s=t[7])&&(e[7]=s),r&lr&&(e[8]=null==e[8]?t[8]:pr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e},Pr=ln,Lr=On,$r=Sr,Mr=Math.max;var Vr=function(e,t,n,r,i,o,a,s){var c=2&t;if(!c&&"function"!=typeof e)throw new TypeError("Expected a function");var u=r?r.length:0;if(u||(t&=-97,r=i=void 0),a=void 0===a?a:Mr($r(a),0),s=void 0===s?s:$r(s),u-=i?i.length:0,64&t){var l=r,p=i;r=i=void 0}var d=c?void 0:jr(e),f=[e,t,n,r,i,l,p,o,a,s];if(d&&Cr(f,d),e=f[0],t=f[1],n=f[2],r=f[3],i=f[4],!(s=f[9]=void 0===f[9]?c?0:e.length:Mr(f[9]-u,0))&&24&t&&(t&=-25),t&&1!=t)h=8==t||16==t?Fr(e,t,s):32!=t&&33!=t||i.length?kr.apply(void 0,f):xr(e,t,n,r);else var h=Rr(e,t,n);return Lr((d?Dr:Pr)(h,f),e,t)},Ur=Rn,Br=Ln,Gr=pt(function(e,t,n){var r=1;if(n.length){var i=Br(n,Ur(Gr));r|=32}return Vr(e,r,t,n,i)});Gr.placeholder={};var Qr=Gr;var Yr=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},qr=Ne,zr=Yt;var Wr=function(e){return zr(e)&&"[object Arguments]"==qr(e)},Jr=Yt,Kr=Object.prototype,Xr=Kr.hasOwnProperty,Hr=Kr.propertyIsEnumerable,Zr=Wr(function(){return arguments}())?Wr:function(e){return Jr(e)&&Xr.call(e,"callee")&&!Hr.call(e,"callee")},ei=Zr,ti=Qt,ni=de?de.isConcatSpreadable:void 0;var ri=Yr,ii=function(e){return ti(e)||ei(e)||!!(ni&&e&&e[ni])};var oi=function e(t,n,r,i,o){var a=-1,s=t.length;for(r||(r=ii),o||(o=[]);++a<s;){var c=t[a];n>0&&r(c)?n>1?e(c,n-1,r,i,o):ri(o,c):i||(o[o.length]=c)}return o},ai=oi;var si=function(e){return(null==e?0:e.length)?ai(e,1):[]},ci=tt,ui=st;var li=function(e){return ui(ci(e,void 0,si),e+"")},pi=mr;var di=function(e){if("string"==typeof e||pi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},fi=se,hi=Ke,yi=Qr,vi=di,mi=M(li(function(e,t){return fi(t,function(t){t=vi(t),hi(e,t,yi(e[t],e))}),e})),gi=Qt,Ei=mr,Ti=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bi=/^\w*$/;var _i=function(e,t){if(gi(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ei(e))||(bi.test(e)||!Ti.test(e)||null!=t&&e in Object(t))},Ni=qe(Object,"create"),Ii=Ni;var Oi=function(){this.__data__=Ii?Ii(null):{},this.size=0};var wi=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ai=Ni,Si=Object.prototype.hasOwnProperty;var Di=function(e){var t=this.__data__;if(Ai){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Si.call(t,e)?t[e]:void 0},Ri=Ni,Fi=Object.prototype.hasOwnProperty;var ki=Ni;var xi=Oi,ji=wi,Ci=Di,Pi=function(e){var t=this.__data__;return Ri?void 0!==t[e]:Fi.call(t,e)},Li=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ki&&void 0===t?"__lodash_hash_undefined__":t,this};function $i(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$i.prototype.clear=xi,$i.prototype.delete=ji,$i.prototype.get=Ci,$i.prototype.has=Pi,$i.prototype.set=Li;var Mi=$i;var Vi=function(){this.__data__=[],this.size=0};var Ui=function(e,t){return e===t||e!=e&&t!=t},Bi=Ui;var Gi=function(e,t){for(var n=e.length;n--;)if(Bi(e[n][0],t))return n;return-1},Qi=Gi,Yi=Array.prototype.splice;var qi=Gi;var zi=Gi;var Wi=Gi;var Ji=Vi,Ki=function(e){var t=this.__data__,n=Qi(t,e);return!(n<0)&&(n==t.length-1?t.pop():Yi.call(t,n,1),--this.size,!0)},Xi=function(e){var t=this.__data__,n=qi(t,e);return n<0?void 0:t[n][1]},Hi=function(e){return zi(this.__data__,e)>-1},Zi=function(e,t){var n=this.__data__,r=Wi(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function eo(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}eo.prototype.clear=Ji,eo.prototype.delete=Ki,eo.prototype.get=Xi,eo.prototype.has=Hi,eo.prototype.set=Zi;var to=eo,no=qe(pe,"Map"),ro=Mi,io=to,oo=no;var ao=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var so=function(e,t){var n=e.__data__;return ao(t)?n["string"==typeof t?"string":"hash"]:n.map},co=so;var uo=so;var lo=so;var po=so;var fo=function(){this.size=0,this.__data__={hash:new ro,map:new(oo||io),string:new ro}},ho=function(e){var t=co(this,e).delete(e);return this.size-=t?1:0,t},yo=function(e){return uo(this,e).get(e)},vo=function(e){return lo(this,e).has(e)},mo=function(e,t){var n=po(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function go(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}go.prototype.clear=fo,go.prototype.delete=ho,go.prototype.get=yo,go.prototype.has=vo,go.prototype.set=mo;var Eo=go,To=Eo;function bo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(bo.Cache||To),n}bo.Cache=To;var _o=bo;var No=function(e){var t=_o(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t},Io=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oo=/\\(\\)?/g,wo=No(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Io,function(e,n,r,i){t.push(r?i.replace(Oo,"$1"):n||e)}),t});var Ao=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},So=Ao,Do=Qt,Ro=mr,Fo=de?de.prototype:void 0,ko=Fo?Fo.toString:void 0;var xo=function e(t){if("string"==typeof t)return t;if(Do(t))return So(t,e)+"";if(Ro(t))return ko?ko.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},jo=xo;var Co=Qt,Po=_i,Lo=wo,$o=function(e){return null==e?"":jo(e)};var Mo=function(e,t){return Co(e)?e:Po(e,t)?[e]:Lo($o(e))},Vo=Mo,Uo=di;var Bo=function(e,t){for(var n=0,r=(t=Vo(t,e)).length;null!=e&&n<r;)e=e[Uo(t[n++])];return n&&n==r?e:void 0},Go=Bo;var Qo=function(e,t,n){var r=null==e?void 0:Go(e,t);return void 0===r?n:r},Yo=M(Qo),qo=to;var zo=to,Wo=no,Jo=Eo;var Ko=to,Xo=function(){this.__data__=new qo,this.size=0},Ho=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Zo=function(e){return this.__data__.get(e)},ea=function(e){return this.__data__.has(e)},ta=function(e,t){var n=this.__data__;if(n instanceof zo){var r=n.__data__;if(!Wo||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Jo(r)}return n.set(e,t),this.size=n.size,this};function na(e){var t=this.__data__=new Ko(e);this.size=t.size}na.prototype.clear=Xo,na.prototype.delete=Ho,na.prototype.get=Zo,na.prototype.has=ea,na.prototype.set=ta;var ra=na;var ia=Eo,oa=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},aa=function(e){return this.__data__.has(e)};function sa(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ia;++t<n;)this.add(e[t])}sa.prototype.add=sa.prototype.push=oa,sa.prototype.has=aa;var ca=function(e,t){return e.has(t)},ua=sa,la=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},pa=ca;var da=function(e,t,n,r,i,o){var a=1&n,s=e.length,c=t.length;if(s!=c&&!(a&&c>s))return!1;var u=o.get(e),l=o.get(t);if(u&&l)return u==t&&l==e;var p=-1,d=!0,f=2&n?new ua:void 0;for(o.set(e,t),o.set(t,e);++p<s;){var h=e[p],y=t[p];if(r)var v=a?r(y,h,p,t,e,o):r(h,y,p,e,t,o);if(void 0!==v){if(v)continue;d=!1;break}if(f){if(!la(t,function(e,t){if(!pa(f,t)&&(h===e||i(h,e,n,r,o)))return f.push(t)})){d=!1;break}}else if(h!==y&&!i(h,y,n,r,o)){d=!1;break}}return o.delete(e),o.delete(t),d},fa=pe.Uint8Array;var ha=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},ya=fa,va=Ui,ma=da,ga=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},Ea=ha,Ta=de?de.prototype:void 0,ba=Ta?Ta.valueOf:void 0;var _a=function(e,t,n,r,i,o,a){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new ya(e),new ya(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return va(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=ga;case"[object Set]":var c=1&r;if(s||(s=Ea),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=ma(s(e),s(t),r,i,o,a);return a.delete(e),l;case"[object Symbol]":if(ba)return ba.call(e)==ba.call(t)}return!1},Na=Yr,Ia=Qt;var Oa=function(e,t,n){var r=t(e);return Ia(e)?r:Na(r,n(e))};var wa=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o};var Aa=function(){return[]},Sa=wa,Da=Aa,Ra=Object.prototype.propertyIsEnumerable,Fa=Object.getOwnPropertySymbols,ka=Fa?function(e){return null==e?[]:(e=Object(e),Sa(Fa(e),function(t){return Ra.call(e,t)}))}:Da;var xa=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},ja={exports:{}};var Ca=function(){return!1};!function(e,t){var n=pe,r=Ca,i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;e.exports=s}(ja,ja.exports);var Pa=ja.exports;var La=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},$a=Ne,Ma=La,Va=Yt,Ua={};Ua["[object Float32Array]"]=Ua["[object Float64Array]"]=Ua["[object Int8Array]"]=Ua["[object Int16Array]"]=Ua["[object Int32Array]"]=Ua["[object Uint8Array]"]=Ua["[object Uint8ClampedArray]"]=Ua["[object Uint16Array]"]=Ua["[object Uint32Array]"]=!0,Ua["[object Arguments]"]=Ua["[object Array]"]=Ua["[object ArrayBuffer]"]=Ua["[object Boolean]"]=Ua["[object DataView]"]=Ua["[object Date]"]=Ua["[object Error]"]=Ua["[object Function]"]=Ua["[object Map]"]=Ua["[object Number]"]=Ua["[object Object]"]=Ua["[object RegExp]"]=Ua["[object Set]"]=Ua["[object String]"]=Ua["[object WeakMap]"]=!1;var Ba=function(e){return Va(e)&&Ma(e.length)&&!!Ua[$a(e)]};var Ga=function(e){return function(t){return e(t)}},Qa={exports:{}};!function(e,t){var n=ce,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r&&n.process,a=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}(Qa,Qa.exports);var Ya=Qa.exports,qa=Ba,za=Ga,Wa=Ya&&Ya.isTypedArray,Ja=Wa?za(Wa):qa,Ka=xa,Xa=Zr,Ha=Qt,Za=Pa,es=kn,ts=Ja,ns=Object.prototype.hasOwnProperty;var rs=function(e,t){var n=Ha(e),r=!n&&Xa(e),i=!n&&!r&&Za(e),o=!n&&!r&&!i&&ts(e),a=n||r||i||o,s=a?Ka(e.length,String):[],c=s.length;for(var u in e)!t&&!ns.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||es(u,c))||s.push(u);return s},is=Object.prototype;var os=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||is)};var as=function(e,t){return function(n){return e(t(n))}},ss=as(Object.keys,Object),cs=os,us=ss,ls=Object.prototype.hasOwnProperty;var ps=Se,ds=La;var fs=function(e){return null!=e&&ds(e.length)&&!ps(e)},hs=rs,ys=function(e){if(!cs(e))return us(e);var t=[];for(var n in Object(e))ls.call(e,n)&&"constructor"!=n&&t.push(n);return t},vs=fs;var ms=function(e){return vs(e)?hs(e):ys(e)},gs=Oa,Es=ka,Ts=ms;var bs=function(e){return gs(e,Ts,Es)},_s=bs,Ns=Object.prototype.hasOwnProperty;var Is=function(e,t,n,r,i,o){var a=1&n,s=_s(e),c=s.length;if(c!=_s(t).length&&!a)return!1;for(var u=c;u--;){var l=s[u];if(!(a?l in t:Ns.call(t,l)))return!1}var p=o.get(e),d=o.get(t);if(p&&d)return p==t&&d==e;var f=!0;o.set(e,t),o.set(t,e);for(var h=a;++u<c;){var y=e[l=s[u]],v=t[l];if(r)var m=a?r(v,y,l,t,e,o):r(y,v,l,e,t,o);if(!(void 0===m?y===v||i(y,v,n,r,o):m)){f=!1;break}h||(h="constructor"==l)}if(f&&!h){var g=e.constructor,E=t.constructor;g==E||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof E&&E instanceof E||(f=!1)}return o.delete(e),o.delete(t),f},Os=qe(pe,"DataView"),ws=no,As=qe(pe,"Promise"),Ss=qe(pe,"Set"),Ds=dt,Rs=Ne,Fs=xe,ks="[object Map]",xs="[object Promise]",js="[object Set]",Cs="[object WeakMap]",Ps="[object DataView]",Ls=Fs(Os),$s=Fs(ws),Ms=Fs(As),Vs=Fs(Ss),Us=Fs(Ds),Bs=Rs;(Os&&Bs(new Os(new ArrayBuffer(1)))!=Ps||ws&&Bs(new ws)!=ks||As&&Bs(As.resolve())!=xs||Ss&&Bs(new Ss)!=js||Ds&&Bs(new Ds)!=Cs)&&(Bs=function(e){var t=Rs(e),n="[object Object]"==t?e.constructor:void 0,r=n?Fs(n):"";if(r)switch(r){case Ls:return Ps;case $s:return ks;case Ms:return xs;case Vs:return js;case Us:return Cs}return t});var Gs=Bs,Qs=ra,Ys=da,qs=_a,zs=Is,Ws=Gs,Js=Qt,Ks=Pa,Xs=Ja,Hs="[object Arguments]",Zs="[object Array]",ec="[object Object]",tc=Object.prototype.hasOwnProperty;var nc=function(e,t,n,r,i,o){var a=Js(e),s=Js(t),c=a?Zs:Ws(e),u=s?Zs:Ws(t),l=(c=c==Hs?ec:c)==ec,p=(u=u==Hs?ec:u)==ec,d=c==u;if(d&&Ks(e)){if(!Ks(t))return!1;a=!0,l=!1}if(d&&!l)return o||(o=new Qs),a||Xs(e)?Ys(e,t,n,r,i,o):qs(e,t,c,n,r,i,o);if(!(1&n)){var f=l&&tc.call(e,"__wrapped__"),h=p&&tc.call(t,"__wrapped__");if(f||h){var y=f?e.value():e,v=h?t.value():t;return o||(o=new Qs),i(y,v,n,r,o)}}return!!d&&(o||(o=new Qs),zs(e,t,n,r,i,o))},rc=Yt;var ic=function e(t,n,r,i,o){return t===n||(null==t||null==n||!rc(t)&&!rc(n)?t!=t&&n!=n:nc(t,n,r,i,e,o))},oc=ic;var ac=M(function(e,t){return oc(e,t)});var sc={},cc={},uc={},lc=V(l);!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReactiveVarsCache=e.makeCachedVar=e.initReactiveVarsCache=e.cachedReactiveVarTypename=void 0;const t=lc;var n;e.cachedReactiveVarTypename="CachedReactiveVar",e.initReactiveVarsCache=function(e){return n=new i({cache:e})};const r=t.gql` fragment ReadCachedReactiveVarFragment on CachedReactiveVar { id value } `;e.makeCachedVar=function(e,t){return n.registerCachedVar(e,t)};class i{constructor({cache:e}){this.registeredVars={},this.cache=e}watchReactiveVar(e,t){t.onNextChange(n=>{this.writeCachedVar(e,n),this.watchReactiveVar(e,t)})}registerCachedVar(e,n){const r=this.readCachedVar(e),i=(0,t.makeVar)(null!=r?r:n);return this.registeredVars[e]&&console.warn(`Duplicate cached reactive variable with ID ${e} detected. Multiple cached reactive variables should not share the same ID.`),this.registeredVars[e]={rv:i,defaultValue:n},r||this.writeCachedVar(e,n),this.watchReactiveVar(e,i),i}readCachedVar(t){var n;const i=this.cache.identify({__typename:e.cachedReactiveVarTypename,id:t}),o=this.cache.readFragment({fragment:r,id:i});return null!==(n=null==o?void 0:o.value)&&void 0!==n?n:null}writeCachedVar(t,i){void 0!==i&&this.cache.writeFragment({id:n.cache.identify({__typename:e.cachedReactiveVarTypename,id:t}),fragment:r,data:{__typename:e.cachedReactiveVarTypename,id:t,value:i}})}reset(){Object.keys(this.registeredVars).forEach(e=>{var t;const{rv:n,defaultValue:r}=this.registeredVars[e];n(null!==(t=this.readCachedVar(e))&&void 0!==t?t:r)})}}e.ReactiveVarsCache=i}(uc);var pc={};var dc=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i};var fc=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0};var hc=function(e){return function(t,n,r){for(var i=-1,o=Object(t),a=r(t),s=a.length;s--;){var c=a[e?s:++i];if(!1===n(o[c],c,o))break}return t}}(),yc=ms;var vc=fs;var mc=function(e,t){return function(n,r){if(null==n)return n;if(!vc(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Object(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}(function(e,t){return e&&hc(e,t,yc)}),gc=mc;var Ec=ra,Tc=ic;var bc=Ie;var _c=function(e){return e==e&&!bc(e)},Nc=_c,Ic=ms;var Oc=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}},wc=function(e,t,n,r){var i=n.length,o=i,a=!r;if(null==e)return!o;for(e=Object(e);i--;){var s=n[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){var c=(s=n[i])[0],u=e[c],l=s[1];if(a&&s[2]){if(void 0===u&&!(c in e))return!1}else{var p=new Ec;if(r)var d=r(u,l,c,e,t,p);if(!(void 0===d?Tc(l,u,3,r,p):d))return!1}}return!0},Ac=function(e){for(var t=Ic(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Nc(i)]}return t},Sc=Oc;var Dc=Mo,Rc=Zr,Fc=Qt,kc=kn,xc=La,jc=di;var Cc=function(e,t){return null!=e&&t in Object(e)},Pc=function(e,t,n){for(var r=-1,i=(t=Dc(t,e)).length,o=!1;++r<i;){var a=jc(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&xc(i)&&kc(a,i)&&(Fc(e)||Rc(e))};var Lc=function(e,t){return null!=e&&Pc(e,t,Cc)},$c=ic,Mc=Qo,Vc=Lc,Uc=_i,Bc=_c,Gc=Oc,Qc=di;var Yc=Bo;var qc=function(e){return function(t){return null==t?void 0:t[e]}},zc=function(e){return function(t){return Yc(t,e)}},Wc=_i,Jc=di;var Kc=function(e){var t=Ac(e);return 1==t.length&&t[0][2]?Sc(t[0][0],t[0][1]):function(n){return n===e||wc(n,e,t)}},Xc=function(e,t){return Uc(e)&&Bc(t)?Gc(Qc(e),t):function(n){var r=Mc(n,e);return void 0===r&&r===t?Vc(n,e):$c(t,r,3)}},Hc=Xe,Zc=Qt,eu=function(e){return Wc(e)?qc(Jc(e)):zc(e)};var tu=function(e){return"function"==typeof e?e:null==e?Hc:"object"==typeof e?Zc(e)?Xc(e[0],e[1]):Kc(e):eu(e)},nu=Ui,ru=fs,iu=kn,ou=Ie;var au=fc,su=function(e,t){var n=!0;return gc(e,function(e,r,i){return n=!!t(e,r,i)}),n},cu=tu,uu=Qt,lu=function(e,t,n){if(!ou(n))return!1;var r=typeof t;return!!("number"==r?ru(n)&&iu(t,n.length):"string"==r&&t in n)&&nu(n[t],e)};var pu=function(e,t,n){var r=uu(e)?au:su;return n&&lu(e,t,n)&&(t=void 0),r(e,cu(t))},du=Ke,fu=Ui,hu=Object.prototype.hasOwnProperty;var yu=function(e,t,n){var r=e[t];hu.call(e,t)&&fu(r,n)&&(void 0!==n||t in e)||du(e,t,n)},vu=yu,mu=Mo,gu=kn,Eu=Ie,Tu=di;var bu=function(e,t,n,r){if(!Eu(e))return e;for(var i=-1,o=(t=mu(t,e)).length,a=o-1,s=e;null!=s&&++i<o;){var c=Tu(t[i]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=a){var l=s[c];void 0===(u=r?r(l,c,s):void 0)&&(u=Eu(l)?l:gu(t[i+1])?[]:{})}vu(s,c,u),s=s[c]}return e},_u=Bo,Nu=bu,Iu=Mo;var Ou=function(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=_u(e,a);n(s,a)&&Nu(o,Iu(a,e),s)}return o},wu=Lc;var Au=function(e,t){return Ou(e,t,function(t,n){return wu(e,n)})},Su=li(function(e,t){return null==e?{}:Au(e,t)});var Du=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o},Ru=Sr;var Fu=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:Ru(t),Du(e,0,t<0?0:t)):[]};var ku=function(e){return null==e},xu=mc,ju=fs;var Cu=mr;var Pu=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=Cu(e),a=void 0!==t,s=null===t,c=t==t,u=Cu(t);if(!s&&!u&&!o&&e>t||o&&a&&c&&!s&&!u||r&&a&&c||!n&&c||!i)return 1;if(!r&&!o&&!u&&e<t||u&&n&&i&&!r&&!o||s&&n&&i||!a&&i||!c)return-1}return 0};var Lu=Ao,$u=Bo,Mu=tu,Vu=function(e,t){var n=-1,r=ju(e)?Array(e.length):[];return xu(e,function(e,i,o){r[++n]=t(e,i,o)}),r},Uu=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e},Bu=Ga,Gu=function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var c=Pu(i[r],o[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index},Qu=Xe,Yu=Qt;var qu=function(e,t,n){t=t.length?Lu(t,function(e){return Yu(e)?function(t){return $u(t,1===e.length?e[0]:e)}:e}):[Qu];var r=-1;t=Lu(t,Bu(Mu));var i=Vu(e,function(e,n,i){return{criteria:Lu(t,function(t){return t(e)}),index:++r,value:e}});return Uu(i,function(e,t){return Gu(e,t,n)})},zu=Qt;var Wu=function(e,t,n,r){return null==e?[]:(zu(t)||(t=null==t?[]:[t]),zu(n=r?void 0:n)||(n=null==n?[]:[n]),qu(e,t,n))},Ju={},Ku=Ne,Xu=Yt;var Hu,Zu,el,tl=function(e){return"number"==typeof e||Xu(e)&&"[object Number]"==Ku(e)},nl={};Object.defineProperty(nl,"__esModule",{value:!0}),nl.RenewalPolicy=nl.InvalidationPolicyLifecycleEvent=nl.InvalidationPolicyEvent=void 0,function(e){e.Write="Write",e.Evict="Evict",e.Read="Read"}(Hu||(nl.InvalidationPolicyEvent=Hu={})),function(e){e.Write="onWrite",e.Evict="onEvict"}(Zu||(nl.InvalidationPolicyLifecycleEvent=Zu={})),function(e){e.AccessOnly="access-only",e.AccessAndWrite="access-and-write",e.WriteOnly="write-only",e.None="none"}(el||(nl.RenewalPolicy=el={}));var rl={},il=yu,ol=Ke;var al=function(e,t,n,r){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=r?r(n[s],e[s],s,n,e):void 0;void 0===c&&(c=e[s]),i?ol(n,s,c):il(n,s,c)}return n},sl=al,cl=ms;var ul=function(e,t){return e&&sl(t,cl(t),e)};var ll=Ie,pl=os,dl=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},fl=Object.prototype.hasOwnProperty;var hl=rs,yl=function(e){if(!ll(e))return dl(e);var t=pl(e),n=[];for(var r in e)("constructor"!=r||!t&&fl.call(e,r))&&n.push(r);return n},vl=fs;var ml=function(e){return vl(e)?hl(e,!0):yl(e)},gl=al,El=ml;var Tl=function(e,t){return e&&gl(t,El(t),e)},bl={exports:{}};!function(e,t){var n=pe,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r?n.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}}(bl,bl.exports);var _l=bl.exports,Nl=al,Il=ka;var Ol=function(e,t){return Nl(e,Il(e),t)},wl=as(Object.getPrototypeOf,Object),Al=Yr,Sl=wl,Dl=ka,Rl=Aa,Fl=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Al(t,Dl(e)),e=Sl(e);return t}:Rl,kl=al,xl=Fl;var jl=function(e,t){return kl(e,xl(e),t)},Cl=Oa,Pl=Fl,Ll=ml;var $l=function(e){return Cl(e,Ll,Pl)},Ml=Object.prototype.hasOwnProperty;var Vl=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ml.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Ul=fa;var Bl=function(e){var t=new e.constructor(e.byteLength);return new Ul(t).set(new Ul(e)),t},Gl=Bl;var Ql=function(e,t){var n=t?Gl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Yl=/\w*$/;var ql=function(e){var t=new e.constructor(e.source,Yl.exec(e));return t.lastIndex=e.lastIndex,t},zl=de?de.prototype:void 0,Wl=zl?zl.valueOf:void 0;var Jl=Bl;var Kl=Bl,Xl=Ql,Hl=ql,Zl=function(e){return Wl?Object(Wl.call(e)):{}},ep=function(e,t){var n=t?Jl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var tp=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return Kl(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return Xl(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ep(e,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return Hl(e);case"[object Symbol]":return Zl(e)}},np=gt,rp=wl,ip=os;var op=function(e){return"function"!=typeof e.constructor||ip(e)?{}:np(rp(e))},ap=Gs,sp=Yt;var cp=function(e){return sp(e)&&"[object Map]"==ap(e)},up=Ga,lp=Ya&&Ya.isMap,pp=lp?up(lp):cp,dp=Gs,fp=Yt;var hp=function(e){return fp(e)&&"[object Set]"==dp(e)},yp=Ga,vp=Ya&&Ya.isSet,mp=vp?yp(vp):hp,gp=ra,Ep=se,Tp=yu,bp=ul,_p=Tl,Np=_l,Ip=qt,Op=Ol,wp=jl,Ap=bs,Sp=$l,Dp=Gs,Rp=Vl,Fp=tp,kp=op,xp=Qt,jp=Pa,Cp=pp,Pp=Ie,Lp=mp,$p=ms,Mp=ml,Vp="[object Arguments]",Up="[object Function]",Bp="[object Object]",Gp={};Gp[Vp]=Gp["[object Array]"]=Gp["[object ArrayBuffer]"]=Gp["[object DataView]"]=Gp["[object Boolean]"]=Gp["[object Date]"]=Gp["[object Float32Array]"]=Gp["[object Float64Array]"]=Gp["[object Int8Array]"]=Gp["[object Int16Array]"]=Gp["[object Int32Array]"]=Gp["[object Map]"]=Gp["[object Number]"]=Gp[Bp]=Gp["[object RegExp]"]=Gp["[object Set]"]=Gp["[object String]"]=Gp["[object Symbol]"]=Gp["[object Uint8Array]"]=Gp["[object Uint8ClampedArray]"]=Gp["[object Uint16Array]"]=Gp["[object Uint32Array]"]=!0,Gp["[object Error]"]=Gp[Up]=Gp["[object WeakMap]"]=!1;var Qp=function e(t,n,r,i,o,a){var s,c=1&n,u=2&n,l=4&n;if(r&&(s=o?r(t,i,o,a):r(t)),void 0!==s)return s;if(!Pp(t))return t;var p=xp(t);if(p){if(s=Rp(t),!c)return Ip(t,s)}else{var d=Dp(t),f=d==Up||"[object GeneratorFunction]"==d;if(jp(t))return Np(t,c);if(d==Bp||d==Vp||f&&!o){if(s=u||f?{}:kp(t),!c)return u?wp(t,_p(s,t)):Op(t,bp(s,t))}else{if(!Gp[d])return o?t:{};s=Fp(t,d,c)}}a||(a=new gp);var h=a.get(t);if(h)return h;a.set(t,s),Lp(t)?t.forEach(function(i){s.add(e(i,n,r,i,t,a))}):Cp(t)&&t.forEach(function(i,o){s.set(o,e(i,n,r,o,t,a))});var y=p?void 0:(l?u?Sp:Ap:u?Mp:$p)(t);return Ep(y||t,function(i,o){y&&(i=t[o=i]),Tp(s,o,e(i,n,r,o,t,a))}),s},Yp=Qp;var qp=function(e){return Yp(e,5)},zp=Ne,Wp=wl,Jp=Yt,Kp=Function.prototype,Xp=Object.prototype,Hp=Kp.toString,Zp=Xp.hasOwnProperty,ed=Hp.call(Object);var td=function(e){if(!Jp(e)||"[object Object]"!=zp(e))return!1;var t=Wp(e);if(null===t)return!0;var n=Zp.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Hp.call(n)==ed};function nd(){return p.randomBytes(16)}for(var rd,id,od=[],ad=0;ad<256;++ad)od[ad]=(ad+256).toString(16).substr(1);function sd(e,t){var n=0,r=od;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var cd=0,ud=0;function ld(e,t,n){var r=function(e,