@machinemetrics/mm-react-tools 4.2.1 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mm-react-tools.es.js +7608 -7886
- package/package.json +8 -5
- package/dist/mm-react-tools.umd.js +0 -157
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
(function(gt,ge){typeof exports=="object"&&typeof module<"u"?ge(exports,require("react"),require("react-router-dom"),require("styled-components")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom","styled-components"],ge):(gt=typeof globalThis<"u"?globalThis:gt||self,ge(gt["mm-react-tools"]={},gt.React,gt.reactRouterDom,gt.styled))})(this,function(gt,ge,ji,nm){"use strict";function yx(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(r,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function im(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function dl(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var nu={exports:{}},Ba={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var sm;function gx(){if(sm)return Ba;sm=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,a){var u=null;if(a!==void 0&&(u=""+a),i.key!==void 0&&(u=""+i.key),"key"in i){a={};for(var c in i)c!=="key"&&(a[c]=i[c])}else a=i;return i=a.ref,{$$typeof:r,type:n,key:u,ref:i!==void 0?i:null,props:a}}return Ba.Fragment=e,Ba.jsx=t,Ba.jsxs=t,Ba}var Va={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var am;function vx(){return am||(am=1,process.env.NODE_ENV!=="production"&&function(){function r(q){if(q==null)return null;if(typeof q=="function")return q.$$typeof===Y?null:q.displayName||q.name||null;if(typeof q=="string")return q;switch(q){case k:return"Fragment";case w:return"Profiler";case _:return"StrictMode";case O:return"Suspense";case N:return"SuspenseList";case U:return"Activity"}if(typeof q=="object")switch(typeof q.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),q.$$typeof){case b:return"Portal";case C:return(q.displayName||"Context")+".Provider";case T:return(q._context.displayName||"Context")+".Consumer";case R:var de=q.render;return q=q.displayName,q||(q=de.displayName||de.name||"",q=q!==""?"ForwardRef("+q+")":"ForwardRef"),q;case V:return de=q.displayName||null,de!==null?de:r(q.type)||"Memo";case D:de=q._payload,q=q._init;try{return r(q(de))}catch{}}return null}function e(q){return""+q}function t(q){try{e(q);var de=!1}catch{de=!0}if(de){de=console;var Oe=de.error,je=typeof Symbol=="function"&&Symbol.toStringTag&&q[Symbol.toStringTag]||q.constructor.name||"Object";return Oe.call(de,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",je),e(q)}}function n(q){if(q===k)return"<>";if(typeof q=="object"&&q!==null&&q.$$typeof===D)return"<...>";try{var de=r(q);return de?"<"+de+">":"<...>"}catch{return"<...>"}}function i(){var q=ae.A;return q===null?null:q.getOwner()}function a(){return Error("react-stack-top-frame")}function u(q){if(re.call(q,"key")){var de=Object.getOwnPropertyDescriptor(q,"key").get;if(de&&de.isReactWarning)return!1}return q.key!==void 0}function c(q,de){function Oe(){ve||(ve=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",de))}Oe.isReactWarning=!0,Object.defineProperty(q,"key",{get:Oe,configurable:!0})}function f(){var q=r(this.type);return be[q]||(be[q]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),q=this.props.ref,q!==void 0?q:null}function h(q,de,Oe,je,rt,Ve,Be,wt){return Oe=Ve.ref,q={$$typeof:g,type:q,key:de,props:Ve,_owner:rt},(Oe!==void 0?Oe:null)!==null?Object.defineProperty(q,"ref",{enumerable:!1,get:f}):Object.defineProperty(q,"ref",{enumerable:!1,value:null}),q._store={},Object.defineProperty(q._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(q,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(q,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Be}),Object.defineProperty(q,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:wt}),Object.freeze&&(Object.freeze(q.props),Object.freeze(q)),q}function p(q,de,Oe,je,rt,Ve,Be,wt){var Ye=de.children;if(Ye!==void 0)if(je)if(Se(Ye)){for(je=0;je<Ye.length;je++)m(Ye[je]);Object.freeze&&Object.freeze(Ye)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(Ye);if(re.call(de,"key")){Ye=r(q);var Me=Object.keys(de).filter(function(W){return W!=="key"});je=0<Me.length?"{key: someKey, "+Me.join(": ..., ")+": ...}":"{key: someKey}",pe[Ye+je]||(Me=0<Me.length?"{"+Me.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
-
let props = %s;
|
|
19
|
-
<%s {...props} />
|
|
20
|
-
React keys must be passed directly to JSX without using spread:
|
|
21
|
-
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,je,Ye,Me,Ye),pe[Ye+je]=!0)}if(Ye=null,Oe!==void 0&&(t(Oe),Ye=""+Oe),u(de)&&(t(de.key),Ye=""+de.key),"key"in de){Oe={};for(var Ue in de)Ue!=="key"&&(Oe[Ue]=de[Ue])}else Oe=de;return Ye&&c(Oe,typeof q=="function"?q.displayName||q.name||"Unknown":q),h(q,Ye,Ve,rt,i(),Oe,Be,wt)}function m(q){typeof q=="object"&&q!==null&&q.$$typeof===g&&q._store&&(q._store.validated=1)}var y=ge,g=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),C=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),Y=Symbol.for("react.client.reference"),ae=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=Object.prototype.hasOwnProperty,Se=Array.isArray,se=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(q){return q()}};var ve,be={},Ee=y.react_stack_bottom_frame.bind(y,a)(),ee=se(n(a)),pe={};Va.Fragment=k,Va.jsx=function(q,de,Oe,je,rt){var Ve=1e4>ae.recentlyCreatedOwnerStacks++;return p(q,de,Oe,!1,je,rt,Ve?Error("react-stack-top-frame"):Ee,Ve?se(n(q)):ee)},Va.jsxs=function(q,de,Oe,je,rt){var Ve=1e4>ae.recentlyCreatedOwnerStacks++;return p(q,de,Oe,!0,je,rt,Ve?Error("react-stack-top-frame"):Ee,Ve?se(n(q)):ee)}}()),Va}var om;function bx(){return om||(om=1,process.env.NODE_ENV==="production"?nu.exports=gx():nu.exports=vx()),nu.exports}var Bt=bx(),pl=function(r,e){return pl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},pl(r,e)};function xn(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var F=function(){return F=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},F.apply(this,arguments)};function Zr(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Ui(r,e,t,n){function i(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function c(p){try{h(n.next(p))}catch(m){u(m)}}function f(p){try{h(n.throw(p))}catch(m){u(m)}}function h(p){p.done?a(p.value):i(p.value).then(c,f)}h((n=n.apply(r,e||[])).next())})}function $i(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(h){return function(p){return f([h,p])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,h[0]&&(t=0)),t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(p){h=[6,p],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Xt(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var ml="Invariant Violation",um=Object.setPrototypeOf,wx=um===void 0?function(r,e){return r.__proto__=e,r}:um,cm=function(r){xn(e,r);function e(t){t===void 0&&(t=ml);var n=r.call(this,typeof t=="number"?ml+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=ml,wx(n,e.prototype),n}return e}(Error);function ws(r,e){if(!r)throw new cm(e)}var iu=["debug","log","warn","error","silent"],yl=iu.indexOf("log");function su(r){return function(){if(iu.indexOf(r)>=yl){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=su("debug"),r.log=su("log"),r.warn=su("warn"),r.error=su("error")})(ws||(ws={}));function lm(r){var e=iu[yl];return yl=Math.max(0,iu.indexOf(r)),e}var gl="3.13.9";function En(r){try{return r()}catch{}}const vl=En(function(){return globalThis})||En(function(){return window})||En(function(){return self})||En(function(){return global})||En(function(){return En.constructor("return this")()});var fm=new Map;function au(r){var e=fm.get(r)||1;return fm.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function bl(r,e){e===void 0&&(e=0);var t=au("stringifyForDisplay");return JSON.stringify(r,function(n,i){return i===void 0?t:i},e).split(JSON.stringify(t)).join("<undefined>")}function ou(r){return function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(typeof e=="number"){var i=e;e=wl(i),e||(e=_l(i,t),t=[])}r.apply(void 0,[e].concat(t))}}var ke=Object.assign(function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];e||ws(e,wl(t,n)||_l(t,n))},{debug:ou(ws.debug),log:ou(ws.log),warn:ou(ws.warn),error:ou(ws.error)});function qr(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return new cm(wl(r,e)||_l(r,e))}var hm=Symbol.for("ApolloErrorMessageHandler_"+gl);function dm(r){if(typeof r=="string")return r;try{return bl(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function wl(r,e){if(e===void 0&&(e=[]),!!r)return vl[hm]&&vl[hm](r,e.map(dm))}function _l(r,e){if(e===void 0&&(e=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:gl,message:r,args:e.map(dm)})))}var _x=globalThis.__DEV__!==!1;function uu(r,e){if(!!!r)throw new Error(e)}function Sx(r){return typeof r=="object"&&r!==null}function xx(r,e){if(!!!r)throw new Error("Unexpected invariant triggered.")}const Ex=/\r\n|[\n\r]/g;function Sl(r,e){let t=0,n=1;for(const i of r.body.matchAll(Ex)){if(typeof i.index=="number"||xx(!1),i.index>=e)break;t=i.index+i[0].length,n+=1}return{line:n,column:e+1-t}}function Ox(r){return pm(r.source,Sl(r.source,r.start))}function pm(r,e){const t=r.locationOffset.column-1,n="".padStart(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,u=e.line+a,c=e.line===1?t:0,f=e.column+c,h=`${r.name}:${u}:${f}
|
|
23
|
-
`,p=n.split(/\r\n|[\n\r]/g),m=p[i];if(m.length>120){const y=Math.floor(f/80),g=f%80,b=[];for(let k=0;k<m.length;k+=80)b.push(m.slice(k,k+80));return h+mm([[`${u} |`,b[0]],...b.slice(1,y+1).map(k=>["|",k]),["|","^".padStart(g)],["|",b[y+1]]])}return h+mm([[`${u-1} |`,p[i-1]],[`${u} |`,m],["|","^".padStart(f)],[`${u+1} |`,p[i+1]]])}function mm(r){const e=r.filter(([n,i])=>i!==void 0),t=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(t)+(i?" "+i:"")).join(`
|
|
24
|
-
`)}function Tx(r){const e=r[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:r[1],positions:r[2],path:r[3],originalError:r[4],extensions:r[5]}:e}class xl extends Error{constructor(e,...t){var n,i,a;const{nodes:u,source:c,positions:f,path:h,originalError:p,extensions:m}=Tx(t);super(e),this.name="GraphQLError",this.path=h??void 0,this.originalError=p??void 0,this.nodes=ym(Array.isArray(u)?u:u?[u]:void 0);const y=ym((n=this.nodes)===null||n===void 0?void 0:n.map(b=>b.loc).filter(b=>b!=null));this.source=c??(y==null||(i=y[0])===null||i===void 0?void 0:i.source),this.positions=f??y?.map(b=>b.start),this.locations=f&&c?f.map(b=>Sl(c,b)):y?.map(b=>Sl(b.source,b.start));const g=Sx(p?.extensions)?p?.extensions:void 0;this.extensions=(a=m??g)!==null&&a!==void 0?a:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),p!=null&&p.stack?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,xl):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const t of this.nodes)t.loc&&(e+=`
|
|
25
|
-
|
|
26
|
-
`+Ox(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+=`
|
|
27
|
-
|
|
28
|
-
`+pm(this.source,t);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function ym(r){return r===void 0||r.length===0?void 0:r}function wr(r,e,t){return new xl(`Syntax Error: ${t}`,{source:r,positions:[e]})}class Ax{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class gm{constructor(e,t,n,i,a,u){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=a,this.value=u,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const vm={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},kx=new Set(Object.keys(vm));function bm(r){const e=r?.kind;return typeof e=="string"&&kx.has(e)}var zs;(function(r){r.QUERY="query",r.MUTATION="mutation",r.SUBSCRIPTION="subscription"})(zs||(zs={}));var El;(function(r){r.QUERY="QUERY",r.MUTATION="MUTATION",r.SUBSCRIPTION="SUBSCRIPTION",r.FIELD="FIELD",r.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",r.FRAGMENT_SPREAD="FRAGMENT_SPREAD",r.INLINE_FRAGMENT="INLINE_FRAGMENT",r.VARIABLE_DEFINITION="VARIABLE_DEFINITION",r.SCHEMA="SCHEMA",r.SCALAR="SCALAR",r.OBJECT="OBJECT",r.FIELD_DEFINITION="FIELD_DEFINITION",r.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",r.INTERFACE="INTERFACE",r.UNION="UNION",r.ENUM="ENUM",r.ENUM_VALUE="ENUM_VALUE",r.INPUT_OBJECT="INPUT_OBJECT",r.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(El||(El={}));var Pe;(function(r){r.NAME="Name",r.DOCUMENT="Document",r.OPERATION_DEFINITION="OperationDefinition",r.VARIABLE_DEFINITION="VariableDefinition",r.SELECTION_SET="SelectionSet",r.FIELD="Field",r.ARGUMENT="Argument",r.FRAGMENT_SPREAD="FragmentSpread",r.INLINE_FRAGMENT="InlineFragment",r.FRAGMENT_DEFINITION="FragmentDefinition",r.VARIABLE="Variable",r.INT="IntValue",r.FLOAT="FloatValue",r.STRING="StringValue",r.BOOLEAN="BooleanValue",r.NULL="NullValue",r.ENUM="EnumValue",r.LIST="ListValue",r.OBJECT="ObjectValue",r.OBJECT_FIELD="ObjectField",r.DIRECTIVE="Directive",r.NAMED_TYPE="NamedType",r.LIST_TYPE="ListType",r.NON_NULL_TYPE="NonNullType",r.SCHEMA_DEFINITION="SchemaDefinition",r.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",r.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",r.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",r.FIELD_DEFINITION="FieldDefinition",r.INPUT_VALUE_DEFINITION="InputValueDefinition",r.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",r.UNION_TYPE_DEFINITION="UnionTypeDefinition",r.ENUM_TYPE_DEFINITION="EnumTypeDefinition",r.ENUM_VALUE_DEFINITION="EnumValueDefinition",r.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",r.DIRECTIVE_DEFINITION="DirectiveDefinition",r.SCHEMA_EXTENSION="SchemaExtension",r.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",r.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",r.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",r.UNION_TYPE_EXTENSION="UnionTypeExtension",r.ENUM_TYPE_EXTENSION="EnumTypeExtension",r.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(Pe||(Pe={}));function Ol(r){return r===9||r===32}function Wa(r){return r>=48&&r<=57}function wm(r){return r>=97&&r<=122||r>=65&&r<=90}function _m(r){return wm(r)||r===95}function Ix(r){return wm(r)||Wa(r)||r===95}function Cx(r){var e;let t=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let u=0;u<r.length;++u){var a;const c=r[u],f=Px(c);f!==c.length&&(n=(a=n)!==null&&a!==void 0?a:u,i=u,u!==0&&f<t&&(t=f))}return r.map((u,c)=>c===0?u:u.slice(t)).slice((e=n)!==null&&e!==void 0?e:0,i+1)}function Px(r){let e=0;for(;e<r.length&&Ol(r.charCodeAt(e));)++e;return e}function Nx(r,e){const t=r.replace(/"""/g,'\\"""'),n=t.split(/\r\n|[\n\r]/g),i=n.length===1,a=n.length>1&&n.slice(1).every(g=>g.length===0||Ol(g.charCodeAt(0))),u=t.endsWith('\\"""'),c=r.endsWith('"')&&!u,f=r.endsWith("\\"),h=c||f,p=!i||r.length>70||h||a||u;let m="";const y=i&&Ol(r.charCodeAt(0));return(p&&!y||a)&&(m+=`
|
|
29
|
-
`),m+=t,(p||h)&&(m+=`
|
|
30
|
-
`),'"""'+m+'"""'}var he;(function(r){r.SOF="<SOF>",r.EOF="<EOF>",r.BANG="!",r.DOLLAR="$",r.AMP="&",r.PAREN_L="(",r.PAREN_R=")",r.SPREAD="...",r.COLON=":",r.EQUALS="=",r.AT="@",r.BRACKET_L="[",r.BRACKET_R="]",r.BRACE_L="{",r.PIPE="|",r.BRACE_R="}",r.NAME="Name",r.INT="Int",r.FLOAT="Float",r.STRING="String",r.BLOCK_STRING="BlockString",r.COMMENT="Comment"})(he||(he={}));class Mx{constructor(e){const t=new gm(he.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==he.EOF)do if(e.next)e=e.next;else{const t=Dx(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===he.COMMENT);return e}}function Rx(r){return r===he.BANG||r===he.DOLLAR||r===he.AMP||r===he.PAREN_L||r===he.PAREN_R||r===he.SPREAD||r===he.COLON||r===he.EQUALS||r===he.AT||r===he.BRACKET_L||r===he.BRACKET_R||r===he.BRACE_L||r===he.PIPE||r===he.BRACE_R}function Hs(r){return r>=0&&r<=55295||r>=57344&&r<=1114111}function cu(r,e){return Sm(r.charCodeAt(e))&&xm(r.charCodeAt(e+1))}function Sm(r){return r>=55296&&r<=56319}function xm(r){return r>=56320&&r<=57343}function _s(r,e){const t=r.source.body.codePointAt(e);if(t===void 0)return he.EOF;if(t>=32&&t<=126){const n=String.fromCodePoint(t);return n==='"'?`'"'`:`"${n}"`}return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function lr(r,e,t,n,i){const a=r.line,u=1+t-r.lineStart;return new gm(e,t,n,a,u,i)}function Dx(r,e){const t=r.source.body,n=t.length;let i=e;for(;i<n;){const a=t.charCodeAt(i);switch(a){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++r.line,r.lineStart=i;continue;case 13:t.charCodeAt(i+1)===10?i+=2:++i,++r.line,r.lineStart=i;continue;case 35:return Fx(r,i);case 33:return lr(r,he.BANG,i,i+1);case 36:return lr(r,he.DOLLAR,i,i+1);case 38:return lr(r,he.AMP,i,i+1);case 40:return lr(r,he.PAREN_L,i,i+1);case 41:return lr(r,he.PAREN_R,i,i+1);case 46:if(t.charCodeAt(i+1)===46&&t.charCodeAt(i+2)===46)return lr(r,he.SPREAD,i,i+3);break;case 58:return lr(r,he.COLON,i,i+1);case 61:return lr(r,he.EQUALS,i,i+1);case 64:return lr(r,he.AT,i,i+1);case 91:return lr(r,he.BRACKET_L,i,i+1);case 93:return lr(r,he.BRACKET_R,i,i+1);case 123:return lr(r,he.BRACE_L,i,i+1);case 124:return lr(r,he.PIPE,i,i+1);case 125:return lr(r,he.BRACE_R,i,i+1);case 34:return t.charCodeAt(i+1)===34&&t.charCodeAt(i+2)===34?Bx(r,i):qx(r,i)}if(Wa(a)||a===45)return Lx(r,i,a);if(_m(a))return Vx(r,i);throw wr(r.source,i,a===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:Hs(a)||cu(t,i)?`Unexpected character: ${_s(r,i)}.`:`Invalid character: ${_s(r,i)}.`)}return lr(r,he.EOF,n,n)}function Fx(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(a===10||a===13)break;if(Hs(a))++i;else if(cu(t,i))i+=2;else break}return lr(r,he.COMMENT,e,i,t.slice(e+1,i))}function Lx(r,e,t){const n=r.source.body;let i=e,a=t,u=!1;if(a===45&&(a=n.charCodeAt(++i)),a===48){if(a=n.charCodeAt(++i),Wa(a))throw wr(r.source,i,`Invalid number, unexpected digit after 0: ${_s(r,i)}.`)}else i=Tl(r,i,a),a=n.charCodeAt(i);if(a===46&&(u=!0,a=n.charCodeAt(++i),i=Tl(r,i,a),a=n.charCodeAt(i)),(a===69||a===101)&&(u=!0,a=n.charCodeAt(++i),(a===43||a===45)&&(a=n.charCodeAt(++i)),i=Tl(r,i,a),a=n.charCodeAt(i)),a===46||_m(a))throw wr(r.source,i,`Invalid number, expected digit but got: ${_s(r,i)}.`);return lr(r,u?he.FLOAT:he.INT,e,i,n.slice(e,i))}function Tl(r,e,t){if(!Wa(t))throw wr(r.source,e,`Invalid number, expected digit but got: ${_s(r,e)}.`);const n=r.source.body;let i=e+1;for(;Wa(n.charCodeAt(i));)++i;return i}function qx(r,e){const t=r.source.body,n=t.length;let i=e+1,a=i,u="";for(;i<n;){const c=t.charCodeAt(i);if(c===34)return u+=t.slice(a,i),lr(r,he.STRING,e,i+1,u);if(c===92){u+=t.slice(a,i);const f=t.charCodeAt(i+1)===117?t.charCodeAt(i+2)===123?jx(r,i):Ux(r,i):$x(r,i);u+=f.value,i+=f.size,a=i;continue}if(c===10||c===13)break;if(Hs(c))++i;else if(cu(t,i))i+=2;else throw wr(r.source,i,`Invalid character within String: ${_s(r,i)}.`)}throw wr(r.source,i,"Unterminated string.")}function jx(r,e){const t=r.source.body;let n=0,i=3;for(;i<12;){const a=t.charCodeAt(e+i++);if(a===125){if(i<5||!Hs(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|za(a),n<0)break}throw wr(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+i)}".`)}function Ux(r,e){const t=r.source.body,n=Em(t,e+2);if(Hs(n))return{value:String.fromCodePoint(n),size:6};if(Sm(n)&&t.charCodeAt(e+6)===92&&t.charCodeAt(e+7)===117){const i=Em(t,e+8);if(xm(i))return{value:String.fromCodePoint(n,i),size:12}}throw wr(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+6)}".`)}function Em(r,e){return za(r.charCodeAt(e))<<12|za(r.charCodeAt(e+1))<<8|za(r.charCodeAt(e+2))<<4|za(r.charCodeAt(e+3))}function za(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function $x(r,e){const t=r.source.body;switch(t.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
31
|
-
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw wr(r.source,e,`Invalid character escape sequence: "${t.slice(e,e+2)}".`)}function Bx(r,e){const t=r.source.body,n=t.length;let i=r.lineStart,a=e+3,u=a,c="";const f=[];for(;a<n;){const h=t.charCodeAt(a);if(h===34&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34){c+=t.slice(u,a),f.push(c);const p=lr(r,he.BLOCK_STRING,e,a+3,Cx(f).join(`
|
|
32
|
-
`));return r.line+=f.length-1,r.lineStart=i,p}if(h===92&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34&&t.charCodeAt(a+3)===34){c+=t.slice(u,a),u=a+1,a+=4;continue}if(h===10||h===13){c+=t.slice(u,a),f.push(c),h===13&&t.charCodeAt(a+1)===10?a+=2:++a,c="",u=a,i=a;continue}if(Hs(h))++a;else if(cu(t,a))a+=2;else throw wr(r.source,a,`Invalid character within String: ${_s(r,a)}.`)}throw wr(r.source,a,"Unterminated string.")}function Vx(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(Ix(a))++i;else break}return lr(r,he.NAME,e,i,t.slice(e,i))}const Wx=10,Om=2;function Al(r){return lu(r,[])}function lu(r,e){switch(typeof r){case"string":return JSON.stringify(r);case"function":return r.name?`[function ${r.name}]`:"[function]";case"object":return zx(r,e);default:return String(r)}}function zx(r,e){if(r===null)return"null";if(e.includes(r))return"[Circular]";const t=[...e,r];if(Hx(r)){const n=r.toJSON();if(n!==r)return typeof n=="string"?n:lu(n,t)}else if(Array.isArray(r))return Gx(r,t);return Qx(r,t)}function Hx(r){return typeof r.toJSON=="function"}function Qx(r,e){const t=Object.entries(r);return t.length===0?"{}":e.length>Om?"["+Jx(r)+"]":"{ "+t.map(([i,a])=>i+": "+lu(a,e)).join(", ")+" }"}function Gx(r,e){if(r.length===0)return"[]";if(e.length>Om)return"[Array]";const t=Math.min(Wx,r.length),n=r.length-t,i=[];for(let a=0;a<t;++a)i.push(lu(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function Jx(r){const e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){const t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}const Yx=globalThis.process&&process.env.NODE_ENV==="production"?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if(typeof e=="object"&&e!==null){var n;const i=t.prototype[Symbol.toStringTag],a=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(i===a){const u=Al(e);throw new Error(`Cannot use ${i} "${u}" from another module or realm.
|
|
33
|
-
|
|
34
|
-
Ensure that there is only one instance of "graphql" in the node_modules
|
|
35
|
-
directory. If different versions of "graphql" are the dependencies of other
|
|
36
|
-
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
37
|
-
|
|
38
|
-
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
39
|
-
|
|
40
|
-
Duplicate "graphql" modules cannot be used at the same time since different
|
|
41
|
-
versions may have different capabilities and behavior. The data from one
|
|
42
|
-
version used in the function from another could produce confusing and
|
|
43
|
-
spurious results.`)}}return!1};class Tm{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||uu(!1,`Body must be a string. Received: ${Al(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||uu(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||uu(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Kx(r){return Yx(r,Tm)}function Zx(r,e){const t=new Xx(r,e),n=t.parseDocument();return Object.defineProperty(n,"tokenCount",{enumerable:!1,value:t.tokenCount}),n}let Xx=class{constructor(e,t={}){const n=Kx(e)?e:new Tm(e);this._lexer=new Mx(n),this._options=t,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(he.NAME);return this.node(e,{kind:Pe.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Pe.DOCUMENT,definitions:this.many(he.SOF,this.parseDefinition,he.EOF)})}parseDefinition(){if(this.peek(he.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===he.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw wr(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(he.BRACE_L))return this.node(e,{kind:Pe.OPERATION_DEFINITION,operation:zs.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(he.NAME)&&(n=this.parseName()),this.node(e,{kind:Pe.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(he.NAME);switch(e.value){case"query":return zs.QUERY;case"mutation":return zs.MUTATION;case"subscription":return zs.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(he.PAREN_L,this.parseVariableDefinition,he.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Pe.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(he.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(he.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(he.DOLLAR),this.node(e,{kind:Pe.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Pe.SELECTION_SET,selections:this.many(he.BRACE_L,this.parseSelection,he.BRACE_R)})}parseSelection(){return this.peek(he.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(he.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:Pe.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(he.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(he.PAREN_L,t,he.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(he.COLON),this.node(t,{kind:Pe.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(he.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(he.NAME)?this.node(e,{kind:Pe.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Pe.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:Pe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Pe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case he.BRACKET_L:return this.parseList(e);case he.BRACE_L:return this.parseObject(e);case he.INT:return this.advanceLexer(),this.node(t,{kind:Pe.INT,value:t.value});case he.FLOAT:return this.advanceLexer(),this.node(t,{kind:Pe.FLOAT,value:t.value});case he.STRING:case he.BLOCK_STRING:return this.parseStringLiteral();case he.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Pe.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Pe.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Pe.NULL});default:return this.node(t,{kind:Pe.ENUM,value:t.value})}case he.DOLLAR:if(e)if(this.expectToken(he.DOLLAR),this._lexer.token.kind===he.NAME){const n=this._lexer.token.value;throw wr(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Pe.STRING,value:e.value,block:e.kind===he.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Pe.LIST,values:this.any(he.BRACKET_L,t,he.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Pe.OBJECT,fields:this.any(he.BRACE_L,t,he.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(he.COLON),this.node(t,{kind:Pe.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(he.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(he.AT),this.node(t,{kind:Pe.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(he.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(he.BRACKET_R),t=this.node(e,{kind:Pe.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(he.BANG)?this.node(e,{kind:Pe.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Pe.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(he.STRING)||this.peek(he.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(he.BRACE_L,this.parseOperationTypeDefinition,he.BRACE_R);return this.node(e,{kind:Pe.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(he.COLON);const n=this.parseNamedType();return this.node(e,{kind:Pe.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:Pe.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),u=this.parseFieldsDefinition();return this.node(e,{kind:Pe.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(he.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(he.BRACE_L,this.parseFieldDefinition,he.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(he.COLON);const a=this.parseTypeReference(),u=this.parseConstDirectives();return this.node(e,{kind:Pe.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:u})}parseArgumentDefs(){return this.optionalMany(he.PAREN_L,this.parseInputValueDef,he.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(he.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(he.EQUALS)&&(a=this.parseConstValueLiteral());const u=this.parseConstDirectives();return this.node(e,{kind:Pe.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:a,directives:u})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),u=this.parseFieldsDefinition();return this.node(e,{kind:Pe.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:Pe.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(he.EQUALS)?this.delimitedMany(he.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:Pe.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(he.BRACE_L,this.parseEnumValueDefinition,he.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:Pe.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw wr(this._lexer.source,this._lexer.token.start,`${fu(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:Pe.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(he.BRACE_L,this.parseInputValueDef,he.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===he.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(he.BRACE_L,this.parseOperationTypeDefinition,he.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:Pe.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:Pe.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:Pe.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:Pe.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Pe.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Pe.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Pe.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(he.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const u=this.parseDirectiveLocations();return this.node(e,{kind:Pe.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:u})}parseDirectiveLocations(){return this.delimitedMany(he.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(El,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new Ax(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw wr(this._lexer.source,t.start,`Expected ${Am(e)}, found ${fu(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===he.NAME&&t.value===e)this.advanceLexer();else throw wr(this._lexer.source,t.start,`Expected "${e}", found ${fu(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===he.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return wr(this._lexer.source,t.start,`Unexpected ${fu(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}return[]}many(e,t,n){this.expectToken(e);const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(t.kind!==he.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw wr(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function fu(r){const e=r.value;return Am(r.kind)+(e!=null?` "${e}"`:"")}function Am(r){return Rx(r)?`"${r}"`:r}function eE(r){return`"${r.replace(tE,rE)}"`}const tE=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function rE(r){return nE[r.charCodeAt(0)]}const nE=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],hu=Object.freeze({});function Xr(r,e,t=vm){const n=new Map;for(const w of Object.values(Pe))n.set(w,iE(e,w));let i,a=Array.isArray(r),u=[r],c=-1,f=[],h=r,p,m;const y=[],g=[];do{c++;const w=c===u.length,T=w&&f.length!==0;if(w){if(p=g.length===0?void 0:y[y.length-1],h=m,m=g.pop(),T)if(a){h=h.slice();let R=0;for(const[O,N]of f){const V=O-R;N===null?(h.splice(V,1),R++):h[V]=N}}else{h={...h};for(const[R,O]of f)h[R]=O}c=i.index,u=i.keys,f=i.edits,a=i.inArray,i=i.prev}else if(m){if(p=a?c:u[c],h=m[p],h==null)continue;y.push(p)}let C;if(!Array.isArray(h)){var b,k;bm(h)||uu(!1,`Invalid AST Node: ${Al(h)}.`);const R=w?(b=n.get(h.kind))===null||b===void 0?void 0:b.leave:(k=n.get(h.kind))===null||k===void 0?void 0:k.enter;if(C=R?.call(e,h,p,m,y,g),C===hu)break;if(C===!1){if(!w){y.pop();continue}}else if(C!==void 0&&(f.push([p,C]),!w))if(bm(C))h=C;else{y.pop();continue}}if(C===void 0&&T&&f.push([p,h]),w)y.pop();else{var _;i={inArray:a,index:c,keys:u,edits:f,prev:i},a=Array.isArray(h),u=a?h:(_=t[h.kind])!==null&&_!==void 0?_:[],c=-1,f=[],m&&g.push(m),m=h}}while(i!==void 0);return f.length!==0?f[f.length-1][1]:r}function iE(r,e){const t=r[e];return typeof t=="object"?t:typeof t=="function"?{enter:t,leave:void 0}:{enter:r.enter,leave:r.leave}}function sE(r){return Xr(r,oE)}const aE=80,oE={Name:{leave:r=>r.value},Variable:{leave:r=>"$"+r.name},Document:{leave:r=>Fe(r.definitions,`
|
|
44
|
-
|
|
45
|
-
`)},OperationDefinition:{leave(r){const e=ht("(",Fe(r.variableDefinitions,", "),")"),t=Fe([r.operation,Fe([r.name,e]),Fe(r.directives," ")]," ");return(t==="query"?"":t+" ")+r.selectionSet}},VariableDefinition:{leave:({variable:r,type:e,defaultValue:t,directives:n})=>r+": "+e+ht(" = ",t)+ht(" ",Fe(n," "))},SelectionSet:{leave:({selections:r})=>Hn(r)},Field:{leave({alias:r,name:e,arguments:t,directives:n,selectionSet:i}){const a=ht("",r,": ")+e;let u=a+ht("(",Fe(t,", "),")");return u.length>aE&&(u=a+ht(`(
|
|
46
|
-
`,du(Fe(t,`
|
|
47
|
-
`)),`
|
|
48
|
-
)`)),Fe([u,Fe(n," "),i]," ")}},Argument:{leave:({name:r,value:e})=>r+": "+e},FragmentSpread:{leave:({name:r,directives:e})=>"..."+r+ht(" ",Fe(e," "))},InlineFragment:{leave:({typeCondition:r,directives:e,selectionSet:t})=>Fe(["...",ht("on ",r),Fe(e," "),t]," ")},FragmentDefinition:{leave:({name:r,typeCondition:e,variableDefinitions:t,directives:n,selectionSet:i})=>`fragment ${r}${ht("(",Fe(t,", "),")")} on ${e} ${ht("",Fe(n," ")," ")}`+i},IntValue:{leave:({value:r})=>r},FloatValue:{leave:({value:r})=>r},StringValue:{leave:({value:r,block:e})=>e?Nx(r):eE(r)},BooleanValue:{leave:({value:r})=>r?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:r})=>r},ListValue:{leave:({values:r})=>"["+Fe(r,", ")+"]"},ObjectValue:{leave:({fields:r})=>"{"+Fe(r,", ")+"}"},ObjectField:{leave:({name:r,value:e})=>r+": "+e},Directive:{leave:({name:r,arguments:e})=>"@"+r+ht("(",Fe(e,", "),")")},NamedType:{leave:({name:r})=>r},ListType:{leave:({type:r})=>"["+r+"]"},NonNullType:{leave:({type:r})=>r+"!"},SchemaDefinition:{leave:({description:r,directives:e,operationTypes:t})=>ht("",r,`
|
|
49
|
-
`)+Fe(["schema",Fe(e," "),Hn(t)]," ")},OperationTypeDefinition:{leave:({operation:r,type:e})=>r+": "+e},ScalarTypeDefinition:{leave:({description:r,name:e,directives:t})=>ht("",r,`
|
|
50
|
-
`)+Fe(["scalar",e,Fe(t," ")]," ")},ObjectTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>ht("",r,`
|
|
51
|
-
`)+Fe(["type",e,ht("implements ",Fe(t," & ")),Fe(n," "),Hn(i)]," ")},FieldDefinition:{leave:({description:r,name:e,arguments:t,type:n,directives:i})=>ht("",r,`
|
|
52
|
-
`)+e+(km(t)?ht(`(
|
|
53
|
-
`,du(Fe(t,`
|
|
54
|
-
`)),`
|
|
55
|
-
)`):ht("(",Fe(t,", "),")"))+": "+n+ht(" ",Fe(i," "))},InputValueDefinition:{leave:({description:r,name:e,type:t,defaultValue:n,directives:i})=>ht("",r,`
|
|
56
|
-
`)+Fe([e+": "+t,ht("= ",n),Fe(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>ht("",r,`
|
|
57
|
-
`)+Fe(["interface",e,ht("implements ",Fe(t," & ")),Fe(n," "),Hn(i)]," ")},UnionTypeDefinition:{leave:({description:r,name:e,directives:t,types:n})=>ht("",r,`
|
|
58
|
-
`)+Fe(["union",e,Fe(t," "),ht("= ",Fe(n," | "))]," ")},EnumTypeDefinition:{leave:({description:r,name:e,directives:t,values:n})=>ht("",r,`
|
|
59
|
-
`)+Fe(["enum",e,Fe(t," "),Hn(n)]," ")},EnumValueDefinition:{leave:({description:r,name:e,directives:t})=>ht("",r,`
|
|
60
|
-
`)+Fe([e,Fe(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:r,name:e,directives:t,fields:n})=>ht("",r,`
|
|
61
|
-
`)+Fe(["input",e,Fe(t," "),Hn(n)]," ")},DirectiveDefinition:{leave:({description:r,name:e,arguments:t,repeatable:n,locations:i})=>ht("",r,`
|
|
62
|
-
`)+"directive @"+e+(km(t)?ht(`(
|
|
63
|
-
`,du(Fe(t,`
|
|
64
|
-
`)),`
|
|
65
|
-
)`):ht("(",Fe(t,", "),")"))+(n?" repeatable":"")+" on "+Fe(i," | ")},SchemaExtension:{leave:({directives:r,operationTypes:e})=>Fe(["extend schema",Fe(r," "),Hn(e)]," ")},ScalarTypeExtension:{leave:({name:r,directives:e})=>Fe(["extend scalar",r,Fe(e," ")]," ")},ObjectTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>Fe(["extend type",r,ht("implements ",Fe(e," & ")),Fe(t," "),Hn(n)]," ")},InterfaceTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>Fe(["extend interface",r,ht("implements ",Fe(e," & ")),Fe(t," "),Hn(n)]," ")},UnionTypeExtension:{leave:({name:r,directives:e,types:t})=>Fe(["extend union",r,Fe(e," "),ht("= ",Fe(t," | "))]," ")},EnumTypeExtension:{leave:({name:r,directives:e,values:t})=>Fe(["extend enum",r,Fe(e," "),Hn(t)]," ")},InputObjectTypeExtension:{leave:({name:r,directives:e,fields:t})=>Fe(["extend input",r,Fe(e," "),Hn(t)]," ")}};function Fe(r,e=""){var t;return(t=r?.filter(n=>n).join(e))!==null&&t!==void 0?t:""}function Hn(r){return ht(`{
|
|
66
|
-
`,du(Fe(r,`
|
|
67
|
-
`)),`
|
|
68
|
-
}`)}function ht(r,e,t=""){return e!=null&&e!==""?r+e+t:""}function du(r){return ht(" ",r.replace(/\n/g,`
|
|
69
|
-
`))}function km(r){var e;return(e=r?.some(t=>t.includes(`
|
|
70
|
-
`)))!==null&&e!==void 0?e:!1}function Im(r){return r.kind===Pe.FIELD||r.kind===Pe.FRAGMENT_SPREAD||r.kind===Pe.INLINE_FRAGMENT}function Qs(r,e){var t=r.directives;return!t||!t.length?!0:Pm(t).every(function(n){var i=n.directive,a=n.ifArgument,u=!1;return a.value.kind==="Variable"?(u=e&&e[a.value.name.value],ke(u!==void 0,78,i.name.value)):u=a.value.value,i.name.value==="skip"?!u:u})}function uE(r){var e=[];return Xr(r,{Directive:function(t){e.push(t.name.value)}}),e}var cE=function(r,e){return Bi(r,e,!1)},lE=function(r,e){return Bi(r,e,!0)};function Bi(r,e,t){var n=new Set(r),i=n.size;return Xr(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return hu}}),t?!n.size:n.size<i}function Cm(r){return r&&Bi(["client","export"],r,!0)}function fE(r){var e=r.name.value;return e==="skip"||e==="include"}function Pm(r){var e=[];return r&&r.length&&r.forEach(function(t){if(fE(t)){var n=t.arguments,i=t.name.value;ke(n&&n.length===1,79,i);var a=n[0];ke(a.name&&a.name.value==="if",80,i);var u=a.value;ke(u&&(u.kind==="Variable"||u.kind==="BooleanValue"),81,i),e.push({directive:t,ifArgument:a})}}),e}function Nm(r){var e,t,n=(e=r.directives)===null||e===void 0?void 0:e.find(function(a){var u=a.name;return u.value==="unmask"});if(!n)return"mask";var i=(t=n.arguments)===null||t===void 0?void 0:t.find(function(a){var u=a.name;return u.value==="mode"});return globalThis.__DEV__!==!1&&i&&(i.value.kind===Pe.VARIABLE?globalThis.__DEV__!==!1&&ke.warn(82):i.value.kind!==Pe.STRING?globalThis.__DEV__!==!1&&ke.warn(83):i.value.value!=="migrate"&&globalThis.__DEV__!==!1&&ke.warn(84,i.value.value)),i&&"value"in i.value&&i.value.value==="migrate"?"migrate":"unmask"}const hE=()=>Object.create(null),{forEach:dE,slice:Mm}=Array.prototype,{hasOwnProperty:pE}=Object.prototype;class pi{constructor(e=!0,t=hE){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return dE.call(e,n=>t=t.getChildTrie(n)),pE.call(t,"data")?t.data:t.data=this.makeData(Mm.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=t.mapFor(e[n],!1);t=a&&a.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],i=this.mapFor(n,!1),a=i&&i.get(n);a&&(t=a.removeArray(Mm.call(e,1)),!a.data&&!a.weak&&!(a.strong&&a.strong.size)&&i.delete(n))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let n=t.get(e);return n||t.set(e,n=new pi(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&mE(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}function mE(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Rm=En(function(){return navigator.product})=="ReactNative",Vi=typeof WeakMap=="function"&&!(Rm&&!global.HermesInternal),pu=typeof WeakSet=="function",mu=typeof Symbol=="function"&&typeof Symbol.for=="function",Ha=mu&&Symbol.asyncIterator,kl=typeof En(function(){return window.document.createElement})=="function",yE=En(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,Dm=(kl||Rm)&&!yE;function qt(r){return r!==null&&typeof r=="object"}function Fm(r){return r!==null&&typeof r=="object"&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function Lm(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw qr(85,a.operation,a.name?" named '".concat(a.name.value,"'"):"");a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(ke(n.length===1,86,n.length),t=n[0].name.value);var i=F(F({},r),{definitions:Xt([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function Ss(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Qa(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return ke(n,87,t),n||null}default:return null}}function qm(r){var e=!0;return Xr(r,{FragmentSpread:function(t){if(e=!!t.directives&&t.directives.some(function(n){return n.name.value==="unmask"}),!e)return hu}}),e}function gE(){}class Il{constructor(e=1/0,t=gE){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1}}function Cl(){}const vE=Cl,bE=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},wE=typeof WeakMap<"u"?WeakMap:Map,_E=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:Cl,unregister:Cl}},SE=10024;class yu{constructor(e=1/0,t=vE){this.max=e,this.dispose=t,this.map=new wE,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const n=this.unfinalizedNodes.values();for(let i=0;i<SE;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const u=a.key;delete a.key,a.keyRef=new bE(u),this.registry.register(u,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new _E(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return t?(this.deleteNode(t),!0):!1}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}var Pl=new WeakSet;function jm(r){r.size<=(r.max||-1)||Pl.has(r)||(Pl.add(r),setTimeout(function(){r.clean(),Pl.delete(r)},100))}var gu=function(r,e){var t=new yu(r,e);return t.set=function(n,i){var a=yu.prototype.set.call(this,n,i);return jm(this),a},t},Um=function(r,e){var t=new Il(r,e);return t.set=function(n,i){var a=Il.prototype.set.call(this,n,i);return jm(this),a},t},xE=Symbol.for("apollo.cacheSize"),Qn=F({},vl[xE]),xs={};function Nl(r,e){xs[r]=e}var EE=globalThis.__DEV__!==!1?kE:void 0,OE=globalThis.__DEV__!==!1?IE:void 0,TE=globalThis.__DEV__!==!1?$m:void 0;function AE(){var r={parser:1e3,canonicalStringify:1e3,print:2e3,"documentTransform.cache":2e3,"queryManager.getDocumentInfo":2e3,"PersistedQueryLink.persistedQueryHashes":2e3,"fragmentRegistry.transform":2e3,"fragmentRegistry.lookup":1e3,"fragmentRegistry.findFragmentSpreads":4e3,"cache.fragmentQueryDocuments":1e3,"removeTypenameFromVariables.getVariableDefinitions":2e3,"inMemoryCache.maybeBroadcastWatch":5e3,"inMemoryCache.executeSelectionSet":5e4,"inMemoryCache.executeSubSelectedArray":1e4};return Object.fromEntries(Object.entries(r).map(function(e){var t=e[0],n=e[1];return[t,Qn[t]||n]}))}function kE(){var r,e,t,n,i;if(globalThis.__DEV__===!1)throw new Error("only supported in development mode");return{limits:AE(),sizes:F({print:(r=xs.print)===null||r===void 0?void 0:r.call(xs),parser:(e=xs.parser)===null||e===void 0?void 0:e.call(xs),canonicalStringify:(t=xs.canonicalStringify)===null||t===void 0?void 0:t.call(xs),links:Rl(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:Vm(this.queryManager.documentTransform)}},(i=(n=this.cache).getMemoryInternals)===null||i===void 0?void 0:i.call(n))}}function $m(){return{cache:{fragmentQueryDocuments:Wi(this.getFragmentDoc)}}}function IE(){var r=this.config.fragments;return F(F({},$m.apply(this)),{addTypenameDocumentTransform:Vm(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:Wi(this.storeReader.executeSelectionSet),executeSubSelectedArray:Wi(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:Wi(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:Wi(r?.findFragmentSpreads),lookup:Wi(r?.lookup),transform:Wi(r?.transform)}})}function CE(r){return!!r&&"dirtyKey"in r}function Wi(r){return CE(r)?r.size:void 0}function Bm(r){return r!=null}function Vm(r){return Ml(r).map(function(e){return{cache:e}})}function Ml(r){return r?Xt(Xt([Wi(r?.performWork)],Ml(r?.left),!0),Ml(r?.right),!0).filter(Bm):[]}function Rl(r){var e;return r?Xt(Xt([(e=r?.getMemoryInternals)===null||e===void 0?void 0:e.call(r)],Rl(r?.left),!0),Rl(r?.right),!0).filter(Bm):[]}var mi=Object.assign(function(e){return JSON.stringify(e,PE)},{reset:function(){Gs=new Um(Qn.canonicalStringify||1e3)}});globalThis.__DEV__!==!1&&Nl("canonicalStringify",function(){return Gs.size});var Gs;mi.reset();function PE(r,e){if(e&&typeof e=="object"){var t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){var n=Object.keys(e);if(n.every(NE))return e;var i=JSON.stringify(n),a=Gs.get(i);if(!a){n.sort();var u=JSON.stringify(n);a=Gs.get(u)||n,Gs.set(i,a),Gs.set(u,a)}var c=Object.create(t);return a.forEach(function(f){c[f]=e[f]}),c}}return e}function NE(r,e,t){return e===0||t[e-1]<=r}function zi(r){return{__ref:String(r)}}function _t(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function Wm(r){return qt(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function ME(r){return r.kind==="StringValue"}function RE(r){return r.kind==="BooleanValue"}function DE(r){return r.kind==="IntValue"}function FE(r){return r.kind==="FloatValue"}function LE(r){return r.kind==="Variable"}function qE(r){return r.kind==="ObjectValue"}function jE(r){return r.kind==="ListValue"}function UE(r){return r.kind==="EnumValue"}function $E(r){return r.kind==="NullValue"}function Es(r,e,t,n){if(DE(t)||FE(t))r[e.value]=Number(t.value);else if(RE(t)||ME(t))r[e.value]=t.value;else if(qE(t)){var i={};t.fields.map(function(u){return Es(i,u.name,u.value,n)}),r[e.value]=i}else if(LE(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(jE(t))r[e.value]=t.values.map(function(u){var c={};return Es(c,e,u,n),c[e.value]});else if(UE(t))r[e.value]=t.value;else if($E(t))r[e.value]=null;else throw qr(96,e.value,t.kind)}function zm(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var u=a.name,c=a.value;return Es(t[i.name.value],u,c,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,u=i.value;return Es(n,a,u,e)})),Dl(r.name.value,n,t)}var BE=["connection","include","skip","client","rest","export","nonreactive"],Ga=mi,Dl=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(c){i[c]=e[c]}),"".concat(t.connection.key,"(").concat(Ga(i),")")}else return t.connection.key;var a=r;if(e){var u=Ga(e);a+="(".concat(u,")")}return t&&Object.keys(t).forEach(function(c){BE.indexOf(c)===-1&&(t[c]&&Object.keys(t[c]).length?a+="@".concat(c,"(").concat(Ga(t[c]),")"):a+="@".concat(c))}),a},{setStringify:function(r){var e=Ga;return Ga=r,e}});function Ja(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Es(t,i,a,e)}),t}return null}function si(r){return r.alias?r.alias.value:r.name.value}function vu(r,e,t){for(var n,i=0,a=e.selections;i<a.length;i++){var u=a[i];if(yi(u)){if(u.name.value==="__typename")return r[si(u)]}else n?n.push(u):n=[u]}if(typeof r.__typename=="string")return r.__typename;if(n)for(var c=0,f=n;c<f.length;c++){var u=f[c],h=vu(r,Qa(u,t).selectionSet,t);if(typeof h=="string")return h}}function yi(r){return r.kind==="Field"}function Hm(r){return r.kind==="InlineFragment"}function Hi(r){ke(r&&r.kind==="Document",88);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw qr(89,t.kind);return t});return ke(e.length<=1,90,e.length),r}function gi(r){return Hi(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Js(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Os(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Fl(r){var e=gi(r);return ke(e&&e.operation==="query",91),e}function Ll(r){ke(r.kind==="Document",92),ke(r.definitions.length<=1,93);var e=r.definitions[0];return ke(e.kind==="FragmentDefinition",94),e}function Qi(r){Hi(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw qr(95)}function bu(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Es(e,n.variable.name,n.defaultValue)}),e}let Tr=null;const Qm={};let VE=1;const WE=()=>class{constructor(){this.id=["slot",VE++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Tr;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===Qm)break;return e!==Tr&&(Tr.slots[this.id]=t),!0}return Tr&&(Tr.slots[this.id]=Qm),!1}getValue(){if(this.hasValue())return Tr.slots[this.id]}withValue(e,t,n,i){const a={__proto__:null,[this.id]:e},u=Tr;Tr={parent:u,slots:a};try{return t.apply(i,n)}finally{Tr=u}}static bind(e){const t=Tr;return function(){const n=Tr;try{return Tr=t,e.apply(this,arguments)}finally{Tr=n}}}static noContext(e,t,n){if(Tr){const i=Tr;try{return Tr=null,e.apply(n,t)}finally{Tr=i}}else return e.apply(n,t)}};function Gm(r){try{return r()}catch{}}const ql="@wry/context:Slot",Jm=Gm(()=>globalThis)||Gm(()=>global)||Object.create(null),Ya=Jm[ql]||Array[ql]||function(r){try{Object.defineProperty(Jm,ql,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(WE()),{bind:c6,noContext:l6}=Ya,wu=new Ya,{hasOwnProperty:zE}=Object.prototype,jl=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function Ul(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const Ka=[],HE=100;function Ys(r,e){if(!r)throw new Error(e||"assertion failure")}function Ym(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Km(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Zm(r){return r.slice(0)}class _u{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++_u.count}peek(){if(this.value.length===1&&!Gi(this))return Xm(this),this.value[0]}recompute(e){return Ys(!this.recomputing,"already recomputing"),Xm(this),Gi(this)?QE(this,e):Km(this.value)}setDirty(){this.dirty||(this.dirty=!0,ey(this),Ul(this))}dispose(){this.setDirty(),sy(this),$l(this,(e,t)=>{e.setDirty(),ay(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=Ka.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(jl(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),Ka.push(this.deps),this.deps=null)}}_u.count=0;function Xm(r){const e=wu.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Gi(r)?ry(e,r):ny(e,r),e}function QE(r,e){return sy(r),wu.withValue(r,GE,[r,e]),YE(r,e)&&JE(r),Km(r.value)}function GE(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=Zm(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!Ym(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Gi(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function JE(r){r.dirty=!1,!Gi(r)&&ty(r)}function ey(r){$l(r,ry)}function ty(r){$l(r,ny)}function $l(r,e){const t=r.parents.size;if(t){const n=jl(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function ry(r,e){Ys(r.childValues.has(e)),Ys(Gi(e));const t=!Gi(r);if(!r.dirtyChildren)r.dirtyChildren=Ka.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&ey(r)}function ny(r,e){Ys(r.childValues.has(e)),Ys(!Gi(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,Zm(e.value)):Ym(t,e.value)||r.setDirty(),iy(r,e),!Gi(r)&&ty(r)}function iy(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ka.length<HE&&Ka.push(t),r.dirtyChildren=null))}function sy(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{ay(r,t)}),r.forgetDeps(),Ys(r.dirtyChildren===null)}function ay(r,e){e.parents.delete(r),r.childValues.delete(e),iy(r,e)}function YE(r,e){if(typeof r.subscribe=="function")try{Ul(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const KE={setDirty:!0,dispose:!0,forget:!0};function oy(r){const e=new Map;function t(n){const i=wu.getValue();if(i){let a=e.get(n);a||e.set(n,a=new Set),i.dependOn(a)}}return t.dirty=function(i,a){const u=e.get(i);if(u){const c=a&&zE.call(KE,a)?a:"setDirty";jl(u).forEach(f=>f[c]()),e.delete(i),Ul(u)}},t}let uy;function ZE(...r){return(uy||(uy=new pi(typeof WeakMap=="function"))).lookupArray(r)}const Bl=new Set;function Za(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=ZE,normalizeResult:i,subscribe:a,cache:u=Il}=Object.create(null)){const c=typeof u=="function"?new u(e,y=>y.dispose()):u,f=function(){const y=n.apply(null,t?t.apply(null,arguments):arguments);if(y===void 0)return r.apply(null,arguments);let g=c.get(y);g||(c.set(y,g=new _u(r)),g.normalizeResult=i,g.subscribe=a,g.forget=()=>c.delete(y));const b=g.recompute(Array.prototype.slice.call(arguments));return c.set(y,g),Bl.add(c),wu.hasValue()||(Bl.forEach(k=>k.clean()),Bl.clear()),b};Object.defineProperty(f,"size",{get:()=>c.size,configurable:!1,enumerable:!1}),Object.freeze(f.options={max:e,keyArgs:t,makeCacheKey:n,normalizeResult:i,subscribe:a,cache:c});function h(y){const g=y&&c.get(y);g&&g.setDirty()}f.dirtyKey=h,f.dirty=function(){h(n.apply(null,arguments))};function p(y){const g=y&&c.get(y);if(g)return g.peek()}f.peekKey=p,f.peek=function(){return p(n.apply(null,arguments))};function m(y){return y?c.delete(y):!1}return f.forgetKey=m,f.forget=function(){return m(n.apply(null,arguments))},f.makeCacheKey=n,f.getKey=t?function(){return n.apply(null,t.apply(null,arguments))}:n,Object.freeze(f)}function XE(r){return r}var Su=function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=pu?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=t.cache!==!1,this.resetCache()}return r.prototype.getCacheKey=function(e){return[e]},r.identity=function(){return new r(XE,{cache:!1})},r.split=function(e,t,n){return n===void 0&&(n=r.identity()),Object.assign(new r(function(i){var a=e(i)?t:n;return a.transformDocument(i)},{cache:!1}),{left:t,right:n})},r.prototype.resetCache=function(){var e=this;if(this.cached){var t=new pi(Vi);this.performWork=Za(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return ke(Array.isArray(i),77),t.lookupArray(i)},max:Qn["documentTransform.cache"],cache:yu})}},r.prototype.performWork=function(e){return Hi(e),this.transform(e)},r.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},r.prototype.concat=function(e){var t=this;return Object.assign(new r(function(n){return e.transformDocument(t.transformDocument(n))},{cache:!1}),{left:this,right:e})},r}(),Xa,vi=Object.assign(function(r){var e=Xa.get(r);return e||(e=sE(r),Xa.set(r,e)),e},{reset:function(){Xa=new gu(Qn.print||2e3)}});vi.reset(),globalThis.__DEV__!==!1&&Nl("print",function(){return Xa?Xa.size:0});var Qt=Array.isArray;function un(r){return Array.isArray(r)&&r.length>0}var cy={kind:Pe.FIELD,name:{kind:Pe.NAME,value:"__typename"}};function ly(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Pe.FRAGMENT_SPREAD&&ly(e[t.name.value],e)})}function Vl(r){return ly(gi(r)||Ll(r),Ss(Os(r)))?null:r}function e1(r){var e=new Map,t=new Map;return r.forEach(function(n){n&&(n.name?e.set(n.name,n):n.test&&t.set(n.test,n))}),function(n){var i=e.get(n.name.value);return!i&&t.size&&t.forEach(function(a,u){u(n)&&(i=a)}),i}}function fy(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function xu(r,e){Hi(e);for(var t=fy(""),n=fy(""),i=function(w){for(var T=0,C=void 0;T<w.length&&(C=w[T]);++T)if(!Qt(C)){if(C.kind===Pe.OPERATION_DEFINITION)return t(C.name&&C.name.value);if(C.kind===Pe.FRAGMENT_DEFINITION)return n(C.name.value)}return globalThis.__DEV__!==!1&&ke.error(97),null},a=0,u=e.definitions.length-1;u>=0;--u)e.definitions[u].kind===Pe.OPERATION_DEFINITION&&++a;var c=e1(r),f=function(w){return un(w)&&w.map(c).some(function(T){return T&&T.remove})},h=new Map,p=!1,m={enter:function(w){if(f(w.directives))return p=!0,null}},y=Xr(e,{Field:m,InlineFragment:m,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(w,T,C,R,O){var N=i(O);N&&N.variables.add(w.name.value)}},FragmentSpread:{enter:function(w,T,C,R,O){if(f(w.directives))return p=!0,null;var N=i(O);N&&N.fragmentSpreads.add(w.name.value)}},FragmentDefinition:{enter:function(w,T,C,R){h.set(JSON.stringify(R),w)},leave:function(w,T,C,R){var O=h.get(JSON.stringify(R));if(w===O)return w;if(a>0&&w.selectionSet.selections.every(function(N){return N.kind===Pe.FIELD&&N.name.value==="__typename"}))return n(w.name.value).removed=!0,p=!0,null}},Directive:{leave:function(w){if(c(w))return p=!0,null}}});if(!p)return e;var g=function(w){return w.transitiveVars||(w.transitiveVars=new Set(w.variables),w.removed||w.fragmentSpreads.forEach(function(T){g(n(T)).transitiveVars.forEach(function(C){w.transitiveVars.add(C)})})),w},b=new Set;y.definitions.forEach(function(w){w.kind===Pe.OPERATION_DEFINITION?g(t(w.name&&w.name.value)).fragmentSpreads.forEach(function(T){b.add(T)}):w.kind===Pe.FRAGMENT_DEFINITION&&a===0&&!n(w.name.value).removed&&b.add(w.name.value)}),b.forEach(function(w){g(n(w)).fragmentSpreads.forEach(function(T){b.add(T)})});var k=function(w){return!!(!b.has(w)||n(w).removed)},_={enter:function(w){if(k(w.name.value))return null}};return Vl(Xr(y,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(w){if(w.variableDefinitions){var T=g(t(w.name&&w.name.value)).transitiveVars;if(T.size<w.variableDefinitions.length)return F(F({},w),{variableDefinitions:w.variableDefinitions.filter(function(C){return T.has(C.variable.name.value)})})}}}}))}var Eu=Object.assign(function(r){return Xr(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Pe.OPERATION_DEFINITION)){var i=e.selections;if(i){var a=i.some(function(c){return yi(c)&&(c.name.value==="__typename"||c.name.value.lastIndexOf("__",0)===0)});if(!a){var u=n;if(!(yi(u)&&u.directives&&u.directives.some(function(c){return c.name.value==="export"})))return F(F({},e),{selections:Xt(Xt([],i,!0),[cy],!1)})}}}}}})},{added:function(r){return r===cy}}),t1={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&globalThis.__DEV__!==!1&&ke.warn(98),e}};function r1(r){return xu([t1],Hi(r))}function n1(r){return function(t){return r.some(function(n){return t.value&&t.value.kind===Pe.VARIABLE&&t.value.name&&(n.name===t.value.name.value||n.test&&n.test(t))})}}function i1(r,e){var t=n1(r);return Vl(Xr(e,{OperationDefinition:{enter:function(n){return F(F({},n),{variableDefinitions:n.variableDefinitions?n.variableDefinitions.filter(function(i){return!r.some(function(a){return a.name===i.variable.name.value})}):[]})}},Field:{enter:function(n){var i=r.some(function(u){return u.remove});if(i){var a=0;if(n.arguments&&n.arguments.forEach(function(u){t(u)&&(a+=1)}),a===1)return null}}},Argument:{enter:function(n){if(t(n))return null}}}))}function s1(r,e){function t(n){if(r.some(function(i){return i.name===n.name.value}))return null}return Vl(Xr(e,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function hy(r){var e=Qi(r),t=e.operation;if(t==="query")return r;var n=Xr(r,{OperationDefinition:{enter:function(i){return F(F({},i),{operation:"query"})}}});return n}function Wl(r){Hi(r);var e=xu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function dy(r){return Hi(r),Xr(r,{FragmentSpread:function(e){var t;if(!(!((t=e.directives)===null||t===void 0)&&t.some(function(n){return n.name.value==="unmask"})))return F(F({},e),{directives:Xt(Xt([],e.directives||[],!0),[{kind:Pe.DIRECTIVE,name:{kind:Pe.NAME,value:"nonreactive"}}],!1)})}})}function zl(r,e){var t;return((t=gi(r))===null||t===void 0?void 0:t.operation)===e}function a1(r){return zl(r,"mutation")}function o1(r){return zl(r,"query")}function u1(r){return zl(r,"subscription")}var c1=Object.prototype.hasOwnProperty;function eo(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return to(r)}function to(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new bi,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var l1=function(r,e,t){return this.merge(r[t],e[t])},bi=function(){function r(e){e===void 0&&(e=l1),this.reconciler=e,this.isObject=qt,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return qt(t)&&qt(e)?(Object.keys(t).forEach(function(u){if(c1.call(e,u)){var c=e[u];if(t[u]!==c){var f=n.reconciler.apply(n,Xt([e,t,u],i,!1));f!==c&&(e=n.shallowCopyForMerge(e),e[u]=f)}}else e=n.shallowCopyForMerge(e),e[u]=t[u]}),e):t},r.prototype.shallowCopyForMerge=function(e){return qt(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=F({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function f1(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t){return e?Xt(Xt([],e,!0),t,!0):t}}}function h1(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t,n){var i=n.args,a=e?e.slice(0):[];if(t)if(i)for(var u=i.offset,c=u===void 0?0:u,f=0;f<t.length;++f)a[c+f]=t[f];else a.push.apply(a,t);return a}}}function d1(r){return r===void 0&&(r=!1),{keyArgs:r,read:function(e,t){var n=t.canRead,i=t.readField;if(!e)return e;var a=[],u="",c="";e.edges.forEach(function(m){n(i("node",m))&&(a.push(m),m.cursor&&(u=u||m.cursor||"",c=m.cursor||c))}),a.length>1&&u===c&&(u="");var f=e.pageInfo||{},h=f.startCursor,p=f.endCursor;return F(F({},Hl(e)),{edges:a,pageInfo:F(F({},e.pageInfo),{startCursor:h||u,endCursor:p||c})})},merge:function(e,t,n){var i=n.args,a=n.isReference,u=n.readField;if(e||(e=m1()),!t)return e;var c=t.edges?t.edges.map(function(D){return a(D=F({},D))&&(D.cursor=u("cursor",D)),D}):[];if(t.pageInfo){var f=t.pageInfo,h=f.startCursor,p=f.endCursor,m=c[0],y=c[c.length-1];m&&h&&(m.cursor=h),y&&p&&(y.cursor=p);var g=m&&m.cursor;g&&!h&&(t=eo(t,{pageInfo:{startCursor:g}}));var b=y&&y.cursor;b&&!p&&(t=eo(t,{pageInfo:{endCursor:b}}))}var k=e.edges,_=[];if(i&&i.after){var w=k.findIndex(function(D){return D.cursor===i.after});w>=0&&(k=k.slice(0,w+1))}else if(i&&i.before){var w=k.findIndex(function(U){return U.cursor===i.before});_=w<0?k:k.slice(w),k=[]}else t.edges&&(k=[]);var T=Xt(Xt(Xt([],k,!0),c,!0),_,!0),C=F(F({},t.pageInfo),e.pageInfo);if(t.pageInfo){var R=t.pageInfo,O=R.hasPreviousPage,N=R.hasNextPage,h=R.startCursor,p=R.endCursor,V=Zr(R,["hasPreviousPage","hasNextPage","startCursor","endCursor"]);Object.assign(C,V),k.length||(O!==void 0&&(C.hasPreviousPage=O),h!==void 0&&(C.startCursor=h)),_.length||(N!==void 0&&(C.hasNextPage=N),p!==void 0&&(C.endCursor=p))}return F(F(F({},Hl(e)),Hl(t)),{edges:T,pageInfo:C})}}}var Hl=function(r){return Zr(r,p1)},p1=["edges","pageInfo"];function m1(){return{edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}}function y1(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=g1(r))||e){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
71
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g1(r,e){if(r){if(typeof r=="string")return py(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return py(r,e)}}function py(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function my(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Ql(r,e,t){return e&&my(r.prototype,e),t&&my(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Gl=function(){return typeof Symbol=="function"},Jl=function(r){return Gl()&&!!Symbol[r]},Yl=function(r){return Jl(r)?Symbol[r]:"@@"+r};Gl()&&!Jl("observable")&&(Symbol.observable=Symbol("observable"));var v1=Yl("iterator"),Kl=Yl("observable"),yy=Yl("species");function Ou(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ro(r){var e=r.constructor;return e!==void 0&&(e=e[yy],e===null&&(e=void 0)),e!==void 0?e:St}function b1(r){return r instanceof St}function Ks(r){Ks.log?Ks.log(r):setTimeout(function(){throw r})}function Tu(r){Promise.resolve().then(function(){try{r()}catch(e){Ks(e)}})}function gy(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Ou(e,"unsubscribe");t&&t.call(e)}}catch(n){Ks(n)}}function Zl(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function w1(r){var e=r._queue;if(e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(vy(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function vy(r,e,t){r._state="running";var n=r._observer;try{var i=Ou(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(Zl(r),i)i.call(n,t);else throw t;break;case"complete":Zl(r),i&&i.call(n);break}}catch(a){Ks(a)}r._state==="closed"?gy(r):r._state==="running"&&(r._state="ready")}function Xl(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Tu(function(){return w1(r)});return}vy(r,e,t)}}var _1=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new S1(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(Zl(this),gy(this))},Ql(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),S1=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){Xl(this._subscription,"next",n)},e.error=function(n){Xl(this._subscription,"error",n)},e.complete=function(){Xl(this._subscription,"complete")},Ql(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),St=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new _1(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,u){if(typeof n!="function"){u(new TypeError(n+" is not a function"));return}function c(){f.unsubscribe(),a()}var f=i.subscribe({next:function(h){try{n(h,c)}catch(p){u(p),f.unsubscribe()}},error:u,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this);return new a(function(u){return i.subscribe({next:function(c){try{c=n(c)}catch(f){return u.error(f)}u.next(c)},error:function(c){u.error(c)},complete:function(){u.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this);return new a(function(u){return i.subscribe({next:function(c){try{if(!n(c))return}catch(f){return u.error(f)}u.next(c)},error:function(c){u.error(c)},complete:function(){u.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this),u=arguments.length>1,c=!1,f=arguments[1],h=f;return new a(function(p){return i.subscribe({next:function(m){var y=!c;if(c=!0,!y||u)try{h=n(h,m)}catch(g){return p.error(g)}else h=m},error:function(m){p.error(m)},complete:function(){if(!c&&!u)return p.error(new TypeError("Cannot reduce an empty sequence"));p.next(h),p.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];var c=ro(this);return new c(function(f){var h,p=0;function m(y){h=y.subscribe({next:function(g){f.next(g)},error:function(g){f.error(g)},complete:function(){p===a.length?(h=void 0,f.complete()):m(c.from(a[p++]))}})}return m(n),function(){h&&(h.unsubscribe(),h=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ro(this);return new a(function(u){var c=[],f=i.subscribe({next:function(p){if(n)try{p=n(p)}catch(y){return u.error(y)}var m=a.from(p).subscribe({next:function(y){u.next(y)},error:function(y){u.error(y)},complete:function(){var y=c.indexOf(m);y>=0&&c.splice(y,1),h()}});c.push(m)},error:function(p){u.error(p)},complete:function(){h()}});function h(){f.closed&&c.length===0&&u.complete()}return function(){c.forEach(function(p){return p.unsubscribe()}),f.unsubscribe()}})},e[Kl]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=Ou(n,Kl);if(a){var u=a.call(n);if(Object(u)!==u)throw new TypeError(u+" is not an object");return b1(u)&&u.constructor===i?u:new i(function(c){return u.subscribe(c)})}if(Jl("iterator")&&(a=Ou(n,v1),a))return new i(function(c){Tu(function(){if(!c.closed){for(var f=y1(a.call(n)),h;!(h=f()).done;){var p=h.value;if(c.next(p),c.closed)return}c.complete()}})});if(Array.isArray(n))return new i(function(c){Tu(function(){if(!c.closed){for(var f=0;f<n.length;++f)if(c.next(n[f]),c.closed)return;c.complete()}})});throw new TypeError(n+" is not observable")},r.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var u=typeof this=="function"?this:r;return new u(function(c){Tu(function(){if(!c.closed){for(var f=0;f<i.length;++f)if(c.next(i[f]),c.closed)return;c.complete()}})})},Ql(r,null,[{key:yy,get:function(){return this}}]),r}();Gl()&&Object.defineProperty(St,Symbol("extensions"),{value:{symbol:Kl,hostReportError:Ks},configurable:!0});function x1(r){var e=Promise.resolve(r);return e.status="fulfilled",e.value=r,e}function E1(r){var e=Promise.reject(r);return e.catch(function(){}),e.status="rejected",e.reason=r,e}function by(r){return"status"in r}function O1(r){if(by(r))return r;var e=r;return e.status="pending",e.then(function(t){if(e.status==="pending"){var n=e;n.status="fulfilled",n.value=t}},function(t){if(e.status==="pending"){var n=e;n.status="rejected",n.reason=t}}),r}function wy(r){return r.catch(function(){}),r}var T1=Object.prototype.toString;function ef(r){return tf(r)}function tf(r,e){switch(T1.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(i,a){t[a]=tf(i,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var n=Object.create(Object.getPrototypeOf(r));return e.set(r,n),Object.keys(r).forEach(function(i){n[i]=tf(r[i],e)}),n}default:return r}}function A1(r){var e=new Set([r]);return e.forEach(function(t){qt(t)&&k1(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){qt(t[n])&&e.add(t[n])})}),r}function k1(r){if(globalThis.__DEV__!==!1&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Ts(r){return globalThis.__DEV__!==!1&&A1(r),r}function Zs(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function Au(r,e,t){return new St(function(n){var i={then:function(f){return new Promise(function(h){return h(f())})}};function a(f,h){return function(p){if(f){var m=function(){return n.closed?0:f(p)};i=i.then(m,m).then(function(y){return n.next(y)},function(y){return n.error(y)})}else n[h](p)}}var u={next:a(e,"next"),error:a(t,"error"),complete:function(){i.then(function(){return n.complete()})}},c=r.subscribe(u);return function(){return c.unsubscribe()}})}function rf(r){function e(t){Object.defineProperty(r,t,{value:St})}return mu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function _y(r){return r&&typeof r.then=="function"}var As=function(r){xn(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),Zs(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),Zs(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,u=i.sources,c=u===void 0?[]:u;if(a!==null){var f=c.shift();f?_y(f)?f.then(function(h){return n.sub=h.subscribe(n.handlers)},n.handlers.error):n.sub=f.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),Zs(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.error(i)},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new St(t)]),_y(t)?t.then(function(i){return n.start(i)},n.handlers.error):n.start(t),n}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var n=this.latest[0],i=t[n];i&&i.call(t,this.latest[1]),this.sub===null&&n==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(t,n)}))},e.prototype.beforeNext=function(t){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,t(i,a))})},e}(St);rf(As);function ks(r){return"incremental"in r}function Sy(r){return"hasNext"in r&&"data"in r}function xy(r){return ks(r)||Sy(r)}function Ey(r){return qt(r)&&"payload"in r}function nf(r,e){var t=r,n=new bi;return ks(e)&&un(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,u=i.path,c=u.length-1;c>=0;--c){var f=u[c],h=!isNaN(+f),p=h?[]:{};p[f]=a,a=p}t=n.merge(t,a)}),t}function no(r){var e=ku(r);return un(e)}function ku(r){var e=un(r.errors)?r.errors.slice(0):[];return ks(r)&&un(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Ji(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(n){n&&Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(t[i]=a)})}),t}function Yi(r,e){return Ji(r,e,e.variables&&{variables:Ji(F(F({},r&&r.variables),e.variables))})}function Oy(r,e){return sf(r,e)}function sf(r,e,t){if(t===void 0&&(t=new Map),t.has(r))return t.get(r);var n=!1;if(Array.isArray(r)){var i=[];if(t.set(r,i),r.forEach(function(u,c){var f=sf(u,e,t);n||(n=f!==u),i[c]=f}),n)return i}else if(Fm(r)){var a=Object.create(Object.getPrototypeOf(r));if(t.set(r,a),Object.keys(r).forEach(function(u){if(u===e){n=!0;return}var c=sf(r[u],e,t);n||(n=c!==r[u]),a[u]=c}),n)return a}return r}function I1(r){return Oy(r,"__typename")}const C1=Object.freeze(Object.defineProperty({__proto__:null,AutoCleanedStrongCache:Um,AutoCleanedWeakCache:gu,Concast:As,DEV:_x,DeepMerger:bi,DocumentTransform:Su,Observable:St,addNonReactiveToNamedFragments:dy,addTypenameToDocument:Eu,argumentsObjectFromField:Ja,asyncMap:Au,buildQueryFromSelectionSet:hy,cacheSizes:Qn,canUseAsyncIteratorSymbol:Ha,canUseDOM:kl,canUseLayoutEffect:Dm,canUseSymbol:mu,canUseWeakMap:Vi,canUseWeakSet:pu,canonicalStringify:mi,checkDocument:Hi,cloneDeep:ef,compact:Ji,concatPagination:f1,createFragmentMap:Ss,createFulfilledPromise:x1,createRejectedPromise:E1,fixObservableSubclass:rf,getDefaultValues:bu,getDirectiveNames:uE,getFragmentDefinition:Ll,getFragmentDefinitions:Os,getFragmentFromSelection:Qa,getFragmentMaskMode:Nm,getFragmentQueryDocument:Lm,getGraphQLErrorsFromResult:ku,getInclusionDirectives:Pm,getMainDefinition:Qi,getOperationDefinition:gi,getOperationName:Js,getQueryDefinition:Fl,getStoreKeyName:Dl,getTypenameFromResult:vu,graphQLResultHasError:no,hasAllDirectives:lE,hasAnyDirectives:cE,hasClientExports:Cm,hasDirectives:Bi,isApolloPayloadResult:Ey,isArray:Qt,isDocumentNode:Wm,isExecutionPatchIncrementalResult:ks,isExecutionPatchInitialResult:Sy,isExecutionPatchResult:xy,isField:yi,isFullyUnmaskedOperation:qm,isInlineFragment:Hm,isMutationOperation:a1,isNonEmptyArray:un,isNonNullObject:qt,isPlainObject:Fm,isQueryOperation:o1,isReference:_t,isStatefulPromise:by,isSubscriptionOperation:u1,iterateObserversSafely:Zs,makeReference:zi,makeUniqueId:au,maybe:En,maybeDeepFreeze:Ts,mergeDeep:eo,mergeDeepArray:to,mergeIncrementalData:nf,mergeOptions:Yi,offsetLimitPagination:h1,omitDeep:Oy,preventUnhandledRejection:wy,print:vi,relayStylePagination:d1,removeArgumentsFromDocument:i1,removeClientSetsFromDocument:Wl,removeConnectionDirectiveFromDocument:r1,removeDirectivesFromDocument:xu,removeFragmentSpreadFromDocument:s1,resultKeyNameFromField:si,shouldInclude:Qs,storeKeyNameFromField:zm,stringifyForDisplay:bl,stripTypename:I1,valueToObjectRepresentation:Es,wrapPromiseWithState:O1},Symbol.toStringTag,{value:"Module"}));function Iu(r){return new St(function(e){e.error(r)})}function P1(r){var e=!1;return new Promise(function(t,n){r.subscribe({next:function(i){e?globalThis.__DEV__!==!1&&ke.warn(45):(e=!0,t(i))},error:n})})}function N1(r){return new St(function(e){r.then(function(t){e.next(t),e.complete()}).catch(e.error.bind(e))})}var af=function(r,e,t){var n=new Error(t);throw n.name="ServerError",n.response=r,n.statusCode=r.status,n.result=e,n};function M1(r){for(var e=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(e.indexOf(i)<0)throw qr(46,i)}return r}function R1(r,e){var t=F({},r),n=function(a){typeof a=="function"?t=F(F({},t),a(t)):t=F(F({},t),a)},i=function(){return F({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function D1(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Js(e.query)||void 0:""),e}function F1(r,e){var t=F({},r),n=new Set(Object.keys(r));return Xr(e,{Variable:function(i,a,u){u&&u.kind!=="VariableDefinition"&&n.delete(i.name.value)}}),n.forEach(function(i){delete t[i]}),t}function Ty(r,e){return e?e(r):St.of()}function io(r){return typeof r=="function"?new jr(r):r}function Cu(r){return r.request.length<=1}var jr=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return St.of()})},r.from=function(e){return e.length===0?r.empty():e.map(io).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=io(t),a=io(n||new r(Ty)),u;return Cu(i)&&Cu(a)?u=new r(function(c){return e(c)?i.request(c)||St.of():a.request(c)||St.of()}):u=new r(function(c,f){return e(c)?i.request(c,f)||St.of():a.request(c,f)||St.of()}),Object.assign(u,{left:i,right:a})},r.execute=function(e,t){return e.request(R1(t.context,D1(M1(t))))||St.of()},r.concat=function(e,t){var n=io(e);if(Cu(n))return globalThis.__DEV__!==!1&&ke.warn(38,n),n;var i=io(t),a;return Cu(i)?a=new r(function(u){return n.request(u,function(c){return i.request(c)||St.of()})||St.of()}):a=new r(function(u,c){return n.request(u,function(f){return i.request(f,c)||St.of()})||St.of()}),Object.assign(a,{left:n,right:i})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(Ty)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw qr(39)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}(),L1=jr.empty,q1=jr.from,j1=jr.split,U1=jr.concat,Pu=jr.execute;function $1(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function B1(r){var e=null,t=null,n=!1,i=[],a=[];function u(m){if(!t){if(a.length){var y=a.shift();if(Array.isArray(y)&&y[0])return y[0]({value:m,done:!1})}i.push(m)}}function c(m){t=m;var y=a.slice();y.forEach(function(g){g[1](m)}),!e||e()}function f(){n=!0;var m=a.slice();m.forEach(function(y){y[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",u),r.removeListener("error",c),r.removeListener("end",f),r.removeListener("finish",f),r.removeListener("close",f)},r.on("data",u),r.on("error",c),r.on("end",f),r.on("finish",f),r.on("close",f);function h(){return new Promise(function(m,y){if(t)return y(t);if(i.length)return m({value:i.shift(),done:!1});if(n)return m({value:void 0,done:!0});a.push([m,y])})}var p={next:function(){return h()}};return Ha&&(p[Symbol.asyncIterator]=function(){return this}),p}function V1(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){r.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return Ha&&(t[Symbol.asyncIterator]=function(){return this}),t}function Ay(r){var e={next:function(){return r.read()}};return Ha&&(e[Symbol.asyncIterator]=function(){return this}),e}function W1(r){return!!r.body}function z1(r){return!!r.getReader}function H1(r){return!!(Ha&&r[Symbol.asyncIterator])}function Q1(r){return!!r.stream}function G1(r){return!!r.arrayBuffer}function J1(r){return!!r.pipe}function Y1(r){var e=r;if(W1(r)&&(e=r.body),H1(e))return $1(e);if(z1(e))return Ay(e.getReader());if(Q1(e))return Ay(e.stream().getReader());if(G1(e))return V1(e.arrayBuffer());if(J1(e))return B1(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Nu=Symbol();function ky(r){return r.extensions?Array.isArray(r.extensions[Nu]):!1}function of(r){return r.hasOwnProperty("graphQLErrors")}var K1=function(r){var e=Xt(Xt(Xt([],r.graphQLErrors,!0),r.clientErrors,!0),r.protocolErrors,!0);return r.networkError&&e.push(r.networkError),e.map(function(t){return qt(t)&&t.message||"Error message not found."}).join(`
|
|
72
|
-
`)},cn=function(r){xn(e,r);function e(t){var n=t.graphQLErrors,i=t.protocolErrors,a=t.clientErrors,u=t.networkError,c=t.errorMessage,f=t.extraInfo,h=r.call(this,c)||this;return h.name="ApolloError",h.graphQLErrors=n||[],h.protocolErrors=i||[],h.clientErrors=a||[],h.networkError=u||null,h.message=c||K1(h),h.extraInfo=f,h.cause=Xt(Xt(Xt([u],n||[],!0),i||[],!0),a||[],!0).find(function(p){return!!p})||null,h.__proto__=e.prototype,h}return e}(Error),Iy=Object.prototype.hasOwnProperty;function Z1(r,e){return Ui(this,void 0,void 0,function(){var t,n,i,a,u,c,f,h,p,m,y,g,b,k,_,w,T,C,R,O,N,V,D,U;return $i(this,function(Y){switch(Y.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");t=new TextDecoder("utf-8"),n=(U=r.headers)===null||U===void 0?void 0:U.get("content-type"),i="boundary=",a=n?.includes(i)?n?.substring(n?.indexOf(i)+i.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u=`\r
|
|
73
|
-
--`.concat(a),c="",f=Y1(r),h=!0,Y.label=1;case 1:return h?[4,f.next()]:[3,3];case 2:for(p=Y.sent(),m=p.value,y=p.done,g=typeof m=="string"?m:t.decode(m),b=c.length-u.length+1,h=!y,c+=g,k=c.indexOf(u,b);k>-1;){if(_=void 0,V=[c.slice(0,k),c.slice(k+u.length)],_=V[0],c=V[1],w=_.indexOf(`\r
|
|
74
|
-
\r
|
|
75
|
-
`),T=X1(_.slice(0,w)),C=T["content-type"],C&&C.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");if(R=_.slice(w),R){if(O=Cy(r,R),Object.keys(O).length>1||"data"in O||"incremental"in O||"errors"in O||"payload"in O)if(Ey(O)){if(N={},"payload"in O){if(Object.keys(O).length===1&&O.payload===null)return[2];N=F({},O.payload)}"errors"in O&&(N=F(F({},N),{extensions:F(F({},"extensions"in N?N.extensions:null),(D={},D[Nu]=O.errors,D))})),e(N)}else e(O);else if(Object.keys(O).length===1&&"hasNext"in O&&!O.hasNext)return[2]}k=c.indexOf(u)}return[3,1];case 3:return[2]}})})}function X1(r){var e={};return r.split(`
|
|
76
|
-
`).forEach(function(t){var n=t.indexOf(":");if(n>-1){var i=t.slice(0,n).trim().toLowerCase(),a=t.slice(n+1).trim();e[i]=a}}),e}function Cy(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};af(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=r,n.statusCode=r.status,n.bodyText=e,n}}function eO(r,e){r.result&&r.result.errors&&r.result.data&&e.next(r.result),e.error(r)}function Py(r){return function(e){return e.text().then(function(t){return Cy(e,t)}).then(function(t){return!Array.isArray(t)&&!Iy.call(t,"data")&&!Iy.call(t,"errors")&&af(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Mu=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=qr(42,e,i.message);throw n.parseError=i,n}return t},tO={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},rO={accept:"*/*","content-type":"application/json"},nO={method:"POST"},Ny={http:tO,headers:rO,options:nO},uf=function(r,e){return e(r)};function iO(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return t.unshift(e),cf.apply(void 0,Xt([r,uf],t,!1))}function cf(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(m){i=F(F(F({},i),m.options),{headers:F(F({},i.headers),m.headers)}),m.credentials&&(i.credentials=m.credentials),a=F(F({},a),m.http)}),i.headers&&(i.headers=sO(i.headers,a.preserveHeaderCase));var u=r.operationName,c=r.extensions,f=r.variables,h=r.query,p={operationName:u,variables:f};return a.includeExtensions&&(p.extensions=c),a.includeQuery&&(p.query=e(h,vi)),{options:i,body:p}}function sO(r,e){if(!e){var t={};return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var n={};Object.keys(Object(r)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:r[a]}});var i={};return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var My=function(r){if(!r&&typeof fetch>"u")throw qr(40)},aO=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}},Ry=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function Dy(r,e){var t=[],n=function(m,y){t.push("".concat(m,"=").concat(encodeURIComponent(y)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Mu(e.variables,"Variables map")}catch(m){return{parseError:m}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Mu(e.extensions,"Extensions map")}catch(m){return{parseError:m}}n("extensions",a)}var u="",c=r,f=r.indexOf("#");f!==-1&&(u=r.substr(f),c=r.substr(0,f));var h=c.indexOf("?")===-1?"?":"&",p=c+h+t.join("&")+u;return{newURI:p}}var Fy=En(function(){return fetch}),lf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,n=r.fetch,i=r.print,a=i===void 0?uf:i,u=r.includeExtensions,c=r.preserveHeaderCase,f=r.useGETForQueries,h=r.includeUnusedVariables,p=h===void 0?!1:h,m=Zr(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);globalThis.__DEV__!==!1&&My(n||Fy);var y={http:{includeExtensions:u,preserveHeaderCase:c},options:m.fetchOptions,credentials:m.credentials,headers:m.headers};return new jr(function(g){var b=Ry(g,t),k=g.getContext(),_={};if(k.clientAwareness){var w=k.clientAwareness,T=w.name,C=w.version;T&&(_["apollographql-client-name"]=T),C&&(_["apollographql-client-version"]=C)}var R=F(F({},_),k.headers),O={http:k.http,options:k.fetchOptions,credentials:k.credentials,headers:R};if(Bi(["client"],g.query)){var N=Wl(g.query);if(!N)return Iu(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));g.query=N}var V=cf(g,a,Ny,y,O),D=V.options,U=V.body;U.variables&&!p&&(U.variables=F1(U.variables,g.query));var Y;!D.signal&&typeof AbortController<"u"&&(Y=new AbortController,D.signal=Y.signal);var ae=function(pe){return pe.kind==="OperationDefinition"&&pe.operation==="mutation"},re=function(pe){return pe.kind==="OperationDefinition"&&pe.operation==="subscription"},Se=re(Qi(g.query)),se=Bi(["defer"],g.query);if(f&&!g.query.definitions.some(ae)&&(D.method="GET"),se||Se){D.headers=D.headers||{};var ve="multipart/mixed;";Se&&se&&globalThis.__DEV__!==!1&&ke.warn(41),Se?ve+="boundary=graphql;subscriptionSpec=1.0,application/json":se&&(ve+="deferSpec=20220824,application/json"),D.headers.accept=ve}if(D.method==="GET"){var be=Dy(b,U),Ee=be.newURI,ee=be.parseError;if(ee)return Iu(ee);b=Ee}else try{D.body=Mu(U,"Payload")}catch(pe){return Iu(pe)}return new St(function(pe){var q=n||En(function(){return fetch})||Fy,de=pe.next.bind(pe);return q(b,D).then(function(Oe){var je;g.setContext({response:Oe});var rt=(je=Oe.headers)===null||je===void 0?void 0:je.get("content-type");return rt!==null&&/^multipart\/mixed/i.test(rt)?Z1(Oe,de):Py(g)(Oe).then(de)}).then(function(){Y=void 0,pe.complete()}).catch(function(Oe){Y=void 0,eO(Oe,pe)}),function(){Y&&Y.abort()}})})},Ly=function(r){xn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,lf(t).request)||this;return n.options=t,n}return e}(jr);const{toString:qy,hasOwnProperty:oO}=Object.prototype,jy=Function.prototype.toString,ff=new Map;function xt(r,e){try{return hf(r,e)}finally{ff.clear()}}function hf(r,e){if(r===e)return!0;const t=qy.call(r),n=qy.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if($y(r,e))return!0;const i=Uy(r),a=Uy(e),u=i.length;if(u!==a.length)return!1;for(let c=0;c<u;++c)if(!oO.call(e,i[c]))return!1;for(let c=0;c<u;++c){const f=i[c];if(!hf(r[f],e[f]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if($y(r,e))return!0;const i=r.entries(),a=t==="[object Map]";for(;;){const u=i.next();if(u.done)break;const[c,f]=u.value;if(!e.has(c)||a&&!hf(f,e.get(c)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let i=r.byteLength;if(i===e.byteLength)for(;i--&&r[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const i=jy.call(r);return i!==jy.call(e)?!1:!lO(i,cO)}}return!1}function Uy(r){return Object.keys(r).filter(uO,r)}function uO(r){return this[r]!==void 0}const cO="{ [native code] }";function lO(r,e){const t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function $y(r,e){let t=ff.get(r);if(t){if(t.has(e))return!0}else ff.set(r,t=new Set);return t.add(e),!1}function By(r,e,t,n){var i=e.data,a=Zr(e,["data"]),u=t.data,c=Zr(t,["data"]);return xt(a,c)&&Ru(Qi(r).selectionSet,i,u,{fragmentMap:Ss(Os(r)),variables:n})}function Ru(r,e,t,n){if(e===t)return!0;var i=new Set;return r.selections.every(function(a){if(i.has(a)||(i.add(a),!Qs(a,n.variables))||Vy(a))return!0;if(yi(a)){var u=si(a),c=e&&e[u],f=t&&t[u],h=a.selectionSet;if(!h)return xt(c,f);var p=Array.isArray(c),m=Array.isArray(f);if(p!==m)return!1;if(p&&m){var y=c.length;if(f.length!==y)return!1;for(var g=0;g<y;++g)if(!Ru(h,c[g],f[g],n))return!1;return!0}return Ru(h,c,f,n)}else{var b=Qa(a,n.fragmentMap);if(b)return Vy(b)?!0:Ru(b.selectionSet,e,t,n)}})}function Vy(r){return!!r.directives&&r.directives.some(fO)}function fO(r){return r.name.value==="nonreactive"}var Wy=Vi?WeakMap:Map,zy=pu?WeakSet:Set,df=new Ya,Hy=!1;function Qy(){Hy||(Hy=!0,globalThis.__DEV__!==!1&&ke.warn(52))}function Gy(r,e,t){return df.withValue(!0,function(){var n=so(r,e,t,!1);return Object.isFrozen(r)&&Ts(n),n})}function hO(r,e){if(e.has(r))return e.get(r);var t=Array.isArray(r)?[]:Object.create(null);return e.set(r,t),t}function so(r,e,t,n,i){var a,u=t.knownChanged,c=hO(r,t.mutableTargets);if(Array.isArray(r)){for(var f=0,h=Array.from(r.entries());f<h.length;f++){var p=h[f],m=p[0],y=p[1];if(y===null){c[m]=null;continue}var g=so(y,e,t,n,globalThis.__DEV__!==!1?"".concat(i||"","[").concat(m,"]"):void 0);u.has(g)&&u.add(c),c[m]=g}return u.has(c)?c:r}for(var b=0,k=e.selections;b<k.length;b++){var _=k[b],w=void 0;if(n&&u.add(c),_.kind===Pe.FIELD){var T=si(_),C=_.selectionSet;if(w=c[T]||r[T],w===void 0)continue;if(C&&w!==null){var g=so(r[T],C,t,n,globalThis.__DEV__!==!1?"".concat(i||"",".").concat(T):void 0);u.has(g)&&(w=g)}globalThis.__DEV__===!1&&(c[T]=w),globalThis.__DEV__!==!1&&(n&&T!=="__typename"&&!(!((a=Object.getOwnPropertyDescriptor(c,T))===null||a===void 0)&&a.value)?Object.defineProperty(c,T,dO(T,w,i||"",t.operationName,t.operationType)):(delete c[T],c[T]=w))}if(_.kind===Pe.INLINE_FRAGMENT&&(!_.typeCondition||t.cache.fragmentMatches(_,r.__typename))&&(w=so(r,_.selectionSet,t,n,i)),_.kind===Pe.FRAGMENT_SPREAD){var R=_.name.value,O=t.fragmentMap[R]||(t.fragmentMap[R]=t.cache.lookupFragment(R));ke(O,47,R);var N=Nm(_);N!=="mask"&&(w=so(r,O.selectionSet,t,N==="migrate",i))}u.has(w)&&u.add(c)}return"__typename"in r&&!("__typename"in c)&&(c.__typename=r.__typename),Object.keys(c).length!==Object.keys(r).length&&u.add(c),u.has(c)?c:r}function dO(r,e,t,n,i){var a=function(){return df.getValue()||(globalThis.__DEV__!==!1&&ke.warn(48,n?"".concat(i," '").concat(n,"'"):"anonymous ".concat(i),"".concat(t,".").concat(r).replace(/^\./,"")),a=function(){return e}),e};return{get:function(){return a()},set:function(u){a=function(){return u}},enumerable:!0,configurable:!0}}function Jy(r,e,t,n){if(!t.fragmentMatches)return globalThis.__DEV__!==!1&&Qy(),r;var i=e.definitions.filter(function(u){return u.kind===Pe.FRAGMENT_DEFINITION});typeof n>"u"&&(ke(i.length===1,49,i.length),n=i[0].name.value);var a=i.find(function(u){return u.name.value===n});return ke(!!a,50,n),r==null||xt(r,{})?r:Gy(r,a.selectionSet,{operationType:"fragment",operationName:a.name.value,fragmentMap:Ss(Os(e)),cache:t,mutableTargets:new Wy,knownChanged:new zy})}function pO(r,e,t){var n;if(!t.fragmentMatches)return globalThis.__DEV__!==!1&&Qy(),r;var i=gi(e);return ke(i,51),r==null?r:Gy(r,i.selectionSet,{operationType:i.operation,operationName:(n=i.name)===null||n===void 0?void 0:n.value,fragmentMap:Ss(Os(e)),cache:t,mutableTargets:new Wy,knownChanged:new zy})}var pf=function(){function r(){this.assumeImmutableResults=!1,this.getFragmentDoc=Za(Lm,{max:Qn["cache.fragmentQueryDocuments"]||1e3,cache:yu})}return r.prototype.lookupFragment=function(e){return null},r.prototype.batch=function(e){var t=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(t)},n),i},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(F(F({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.watchFragment=function(e){var t=this,n=e.fragment,i=e.fragmentName,a=e.from,u=e.optimistic,c=u===void 0?!0:u,f=Zr(e,["fragment","fragmentName","from","optimistic"]),h=this.getFragmentDoc(n,i),p=typeof a>"u"||typeof a=="string"?a:this.identify(a),m=!!e[Symbol.for("apollo.dataMasking")];if(globalThis.__DEV__!==!1){var y=i||Ll(n).name.value;p||globalThis.__DEV__!==!1&&ke.warn(1,y)}var g=F(F({},f),{returnPartialData:!0,id:p,query:h,optimistic:c}),b;return new St(function(k){return t.watch(F(F({},g),{immediate:!0,callback:function(_){var w=m?Jy(_.result,n,t,i):_.result;if(!(b&&By(h,{data:b.result},{data:w},e.variables))){var T={data:w,complete:!!_.complete};_.missing&&(T.missing=to(_.missing.map(function(C){return C.missing}))),b=F(F({},_),{result:w}),k.next(T)}}}))})},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(F(F({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,n=e.data,i=Zr(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:n}))},r.prototype.writeFragment=function(e){var t=e.id,n=e.data,i=e.fragment,a=e.fragmentName,u=Zr(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(u,{query:this.getFragmentDoc(i,a),dataId:t,result:n}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(n){var i=n.readQuery(e),a=t(i);return a==null?i:(n.writeQuery(F(F({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(n){var i=n.readFragment(e),a=t(i);return a==null?i:(n.writeFragment(F(F({},e),{data:a})),a)}})},r}();globalThis.__DEV__!==!1&&(pf.prototype.getMemoryInternals=TE);var mf;mf||(mf={});var yf=function(r){xn(e,r);function e(t,n,i,a){var u,c=r.call(this,t)||this;if(c.message=t,c.path=n,c.query=i,c.variables=a,Array.isArray(c.path)){c.missing=c.message;for(var f=c.path.length-1;f>=0;--f)c.missing=(u={},u[c.path[f]]=c.missing,u)}else c.missing=c.path;return c.__proto__=e.prototype,c}return e}(Error),_r=Object.prototype.hasOwnProperty;function ao(r){return r==null}function gf(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=ao(n)?ao(i)?void 0:{_id:i}:{id:n}),ao(n)&&!ao(i)&&(n=i),!ao(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Yy={dataIdFromObject:gf,addTypename:!0,resultCaching:!0,canonizeResults:!1};function mO(r){return Ji(Yy,r)}function Ky(r){var e=r.canonizeResults;return e===void 0?Yy.canonizeResults:e}function yO(r,e){return _t(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Zy=/^[_a-z][_0-9a-z]*/i;function Ki(r){var e=r.match(Zy);return e?e[0]:r}function vf(r,e,t){return qt(e)?Qt(e)?e.every(function(n){return vf(r,n,t)}):r.selections.every(function(n){if(yi(n)&&Qs(n,t)){var i=si(n);return _r.call(e,i)&&(!n.selectionSet||vf(n.selectionSet,e[i],t))}return!0}):!1}function Xs(r){return qt(r)&&!_t(r)&&!Qt(r)}function gO(){return new bi}function Xy(r,e){var t=Ss(Os(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Du=Object.create(null),bf=function(){return Du},eg=Object.create(null),oo=function(){function r(e,t){var n=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Ts(_t(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return _t(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return zi(i);if(_t(i))return i;var u=n.policies.identify(i)[0];if(u){var c=zi(u);return a&&n.merge(u,i),c}}}return r.prototype.toObject=function(){return F({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),_r.call(this.data,e)){var n=this.data[e];if(n&&_r.call(n,t))return n[t]}if(t==="__typename"&&_r.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Zi)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),_r.call(this.data,e))return this.data[e];if(this instanceof Zi)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var n=this,i;_t(e)&&(e=e.__ref),_t(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(i=e):e,u=typeof t=="string"?this.lookup(i=t):t;if(u){ke(typeof i=="string",2);var c=new bi(bO).merge(a,u);if(this.data[i]=c,c!==a&&(delete this.refs[i],this.group.caching)){var f=Object.create(null);a||(f.__exists=1),Object.keys(u).forEach(function(h){if(!a||a[h]!==c[h]){f[h]=1;var p=Ki(h);p!==h&&!n.policies.hasKeyArgs(c.__typename,p)&&(f[p]=1),c[h]===void 0&&!(n instanceof Zi)&&delete c[h]}}),f.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===c.__typename&&delete f.__typename,Object.keys(f).forEach(function(h){return n.group.dirty(i,h)})}}},r.prototype.modify=function(e,t){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),u=!1,c=!0,f={DELETE:Du,INVALIDATE:eg,isReference:_t,toReference:this.toReference,canRead:this.canRead,readField:function(h,p){return n.policies.readField(typeof h=="string"?{fieldName:h,from:p||zi(e)}:h,{store:n})}};if(Object.keys(i).forEach(function(h){var p=Ki(h),m=i[h];if(m!==void 0){var y=typeof t=="function"?t:t[h]||t[p];if(y){var g=y===bf?Du:y(Ts(m),F(F({},f),{fieldName:p,storeFieldName:h,storage:n.getStorage(e,h)}));if(g===eg)n.group.dirty(e,h);else if(g===Du&&(g=void 0),g!==m&&(a[h]=g,u=!0,m=g,globalThis.__DEV__!==!1)){var b=function(O){if(n.lookup(O.__ref)===void 0)return globalThis.__DEV__!==!1&&ke.warn(3,O),!0};if(_t(g))b(g);else if(Array.isArray(g))for(var k=!1,_=void 0,w=0,T=g;w<T.length;w++){var C=T[w];if(_t(C)){if(k=!0,b(C))break}else if(typeof C=="object"&&C){var R=n.policies.identify(C)[0];R&&(_=C)}if(k&&_!==void 0){globalThis.__DEV__!==!1&&ke.warn(4,_);break}}}}m!==void 0&&(c=!1)}}),u)return this.merge(e,a),c&&(this instanceof Zi?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,n){var i,a=this.lookup(e);if(a){var u=this.getFieldValue(a,"__typename"),c=t&&n?this.policies.getStoreFieldName({typename:u,fieldName:t,args:n}):t;return this.modify(e,c?(i={},i[c]=bf,i):bf)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(_r.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Zi&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){_r.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(t.__META={extraRootIds:n.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&_r.call(e,a)||t.delete(a)}),e){var n=e.__META,i=Zr(e,["__META"]);Object.keys(i).forEach(function(a){t.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Zi?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),n=this.toObject();t.forEach(function(u){_r.call(n,u)&&(Object.keys(e.findChildRefIds(u)).forEach(t.add,t),delete n[u])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Zi;)a=a.parent;i.forEach(function(u){return a.delete(u)})}return i},r.prototype.findChildRefIds=function(e){if(!_r.call(this.refs,e)){var t=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return t;var i=new Set([n]);i.forEach(function(a){_t(a)&&(t[a.__ref]=!0),qt(a)&&Object.keys(a).forEach(function(u){var c=a[u];qt(c)&&i.add(c)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),tg=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?oy():null,this.keyMaker=new pi(Vi)},r.prototype.depend=function(e,t){if(this.d){this.d(wf(e,t));var n=Ki(t);n!==t&&this.d(wf(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(wf(e,t),t==="__exists"?"forget":"setDirty")},r}();function wf(r,e){return e+"#"+r}function rg(r,e){uo(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){xn(n,t);function n(i){var a=i.policies,u=i.resultCaching,c=u===void 0?!0:u,f=i.seed,h=t.call(this,a,new tg(c))||this;return h.stump=new vO(h),h.storageTrie=new pi(Vi),f&&h.replace(f),h}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(r);r.Root=e})(oo||(oo={}));var Zi=function(r){xn(e,r);function e(t,n,i,a){var u=r.call(this,n.policies,a)||this;return u.id=t,u.parent=n,u.replay=i,u.group=a,i(u),u}return e.prototype.addLayer=function(t,n){return new e(t,this,n,this.group)},e.prototype.removeLayer=function(t){var n=this,i=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var u=n.data[a],c=i.lookup(a);c?u?u!==c&&Object.keys(u).forEach(function(f){xt(u[f],c[f])||n.group.dirty(a,f)}):(n.group.dirty(a,"__exists"),Object.keys(c).forEach(function(f){n.group.dirty(a,f)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return F(F({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return _r.call(this.data,t)?F(F({},n),r.prototype.findChildRefIds.call(this,t)):n},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(oo),vO=function(r){xn(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new tg(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(t,n){return this.parent.merge(t,n)},e}(Zi);function bO(r,e,t){var n=r[t],i=e[t];return xt(n,i)?n:i}function uo(r){return!!(r instanceof oo&&r.group.caching)}function wO(r){return qt(r)?Qt(r)?r.slice(0):F({__proto__:Object.getPrototypeOf(r)},r):r}var ng=function(){function r(){this.known=new(pu?WeakSet:Set),this.pool=new pi(Vi),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return qt(e)&&this.known.has(e)},r.prototype.pass=function(e){if(qt(e)){var t=wO(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(qt(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),u=this.pool.lookupArray(a);return u.array||(this.known.add(u.array=a),globalThis.__DEV__!==!1&&Object.freeze(a)),u.array}case null:case Object.prototype:{if(this.known.has(e))return e;var c=Object.getPrototypeOf(e),f=[c],h=this.sortedKeys(e);f.push(h.json);var p=f.length;h.sorted.forEach(function(g){f.push(t.admit(e[g]))});var u=this.pool.lookupArray(f);if(!u.object){var m=u.object=Object.create(c);this.known.add(m),h.sorted.forEach(function(g,b){m[g]=f[p+b]}),globalThis.__DEV__!==!1&&Object.freeze(m)}return u.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();function ig(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var _O=function(){function r(e){var t=this;this.knownResults=new(Vi?WeakMap:Map),this.config=Ji(e,{addTypename:e.addTypename!==!1,canonizeResults:Ky(e)}),this.canon=e.canon||new ng,this.executeSelectionSet=Za(function(n){var i,a=n.context.canonizeResults,u=ig(n);u[3]=!a;var c=(i=t.executeSelectionSet).peek.apply(i,u);return c?a?F(F({},c),{result:t.canon.admit(c.result)}):c:(rg(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize||Qn["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:ig,makeCacheKey:function(n,i,a,u){if(uo(a.store))return a.store.makeCacheKey(n,_t(i)?i.__ref:i,a.varString,u)}}),this.executeSubSelectedArray=Za(function(n){return rg(n.context.store,n.enclosingRef.__ref),t.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize||Qn["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(n){var i=n.field,a=n.array,u=n.context;if(uo(u.store))return u.store.makeCacheKey(i,a,u.varString)}})}return r.prototype.resetCanon=function(){this.canon=new ng},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,u=e.variables,c=e.returnPartialData,f=c===void 0?!0:c,h=e.canonizeResults,p=h===void 0?this.config.canonizeResults:h,m=this.config.cache.policies;u=F(F({},bu(Fl(n))),u);var y=zi(a),g=this.executeSelectionSet({selectionSet:Qi(n).selectionSet,objectOrReference:y,enclosingRef:y,context:F({store:t,query:n,policies:m,variables:u,varString:mi(u),canonizeResults:p},Xy(n,this.config.fragments))}),b;if(g.missing&&(b=[new yf(SO(g.missing),g.missing,n,u)],!f))throw b[0];return{result:g.result,complete:!b,missing:b}},r.prototype.isFresh=function(e,t,n,i){if(uo(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,t,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,u=e.context;if(_t(i)&&!u.policies.rootTypenamesById[i.__ref]&&!u.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var c=u.variables,f=u.policies,h=u.store,p=h.getFieldValue(i,"__typename"),m=[],y,g=new bi;this.config.addTypename&&typeof p=="string"&&!f.rootIdsByTypename[p]&&m.push({__typename:p});function b(C,R){var O;return C.missing&&(y=g.merge(y,(O={},O[R]=C.missing,O))),C.result}var k=new Set(n.selections);k.forEach(function(C){var R,O;if(Qs(C,c))if(yi(C)){var N=f.readField({fieldName:C.name.value,field:C,variables:u.variables,from:i},u),V=si(C);N===void 0?Eu.added(C)||(y=g.merge(y,(R={},R[V]="Can't find field '".concat(C.name.value,"' on ").concat(_t(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),R))):Qt(N)?N.length>0&&(N=b(t.executeSubSelectedArray({field:C,array:N,enclosingRef:a,context:u}),V)):C.selectionSet?N!=null&&(N=b(t.executeSelectionSet({selectionSet:C.selectionSet,objectOrReference:N,enclosingRef:_t(N)?N:a,context:u}),V)):u.canonizeResults&&(N=t.canon.pass(N)),N!==void 0&&m.push((O={},O[V]=N,O))}else{var D=Qa(C,u.lookupFragment);if(!D&&C.kind===Pe.FRAGMENT_SPREAD)throw qr(10,C.name.value);D&&f.fragmentMatches(D,p)&&D.selectionSet.selections.forEach(k.add,k)}});var _=to(m),w={result:_,missing:y},T=u.canonizeResults?this.canon.admit(w):Ts(w);return T.result&&this.knownResults.set(T.result,n),T},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,u=e.context,c,f=new bi;function h(p,m){var y;return p.missing&&(c=f.merge(c,(y={},y[m]=p.missing,y))),p.result}return n.selectionSet&&(i=i.filter(u.store.canRead)),i=i.map(function(p,m){return p===null?null:Qt(p)?h(t.executeSubSelectedArray({field:n,array:p,enclosingRef:a,context:u}),m):n.selectionSet?h(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:p,enclosingRef:_t(p)?p:a,context:u}),m):(globalThis.__DEV__!==!1&&xO(u.store,n,p),p)}),{result:u.canonizeResults?this.canon.admit(i):i,missing:c}},r}();function SO(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function xO(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){qt(i)&&(ke(!_t(i),11,yO(r,i),e.name.value),Object.values(i).forEach(n.add,n))})}}var _f=new Ya,sg=new WeakMap;function co(r){var e=sg.get(r);return e||sg.set(r,e={vars:new Set,dep:oy()}),e}function ag(r){co(r).vars.forEach(function(e){return e.forgetCache(r)})}function EO(r){co(r).vars.forEach(function(e){return e.attachCache(r)})}function og(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(f){co(f).dep.dirty(n),OO(f)});var u=Array.from(t);t.clear(),u.forEach(function(f){return f(r)})}}else{var c=_f.getValue();c&&(i(c),co(c).dep(n))}return r};n.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var i=n.attachCache=function(a){return e.add(a),co(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function OO(r){r.broadcastWatches&&r.broadcastWatches()}var ug=Object.create(null);function Sf(r){var e=JSON.stringify(r);return ug[e]||(ug[e]=Object.create(null))}function cg(r){var e=Sf(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(u,c){return n.readField(c,u)},a=n.keyObject=xf(r,function(u){var c=ea(n.storeObject,u,i);return c===void 0&&t!==n.storeObject&&_r.call(t,u[0])&&(c=ea(t,u,hg)),ke(c!==void 0,5,u.join("."),t),c});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function lg(r){var e=Sf(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,u=n.fieldName,c=xf(r,function(h){var p=h[0],m=p.charAt(0);if(m==="@"){if(i&&un(i.directives)){var y=p.slice(1),g=i.directives.find(function(w){return w.name.value===y}),b=g&&Ja(g,a);return b&&ea(b,h.slice(1))}return}if(m==="$"){var k=p.slice(1);if(a&&_r.call(a,k)){var _=h.slice(0);return _[0]=k,ea(a,_)}return}if(t)return ea(t,h)}),f=JSON.stringify(c);return(t||f!=="{}")&&(u+=":"+f),u})}function xf(r,e){var t=new bi;return fg(r).reduce(function(n,i){var a,u=e(i);if(u!==void 0){for(var c=i.length-1;c>=0;--c)u=(a={},a[i[c]]=u,a);n=t.merge(n,u)}return n},Object.create(null))}function fg(r){var e=Sf(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){Qt(i)?(fg(i).forEach(function(u){return t.push(n.concat(u))}),n.length=0):(n.push(i),Qt(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function hg(r,e){return r[e]}function ea(r,e,t){return t=t||hg,dg(e.reduce(function n(i,a){return Qt(i)?i.map(function(u){return n(u,a)}):i&&t(i,a)},r))}function dg(r){return qt(r)?Qt(r)?r.map(dg):xf(Object.keys(r).sort(),function(e){return ea(r,e)}):r}function Ef(r){return r.args!==void 0?r.args:r.field?Ja(r.field,r.variables):null}var TO=function(){},pg=function(r,e){return e.fieldName},mg=function(r,e,t){var n=t.mergeObjects;return n(r,e)},yg=function(r,e){return e},AO=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=F({dataIdFromObject:gf},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var n,i=this,a=t&&(t.typename||((n=t.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];var u=t&&t.storeObject||e,c=F(F({},t),{typename:a,storeObject:u,readField:t&&t.readField||function(){var m=Of(arguments,u);return i.readField(m,{store:i.cache.data,variables:m.variables})}}),f,h=a&&this.getTypePolicy(a),p=h&&h.keyFn||this.config.dataIdFromObject;return df.withValue(!0,function(){for(;p;){var m=p(F(F({},e),u),c);if(Qt(m))p=cg(m);else{f=m;break}}}),f=f?String(f):void 0,c.keyObject?[f,c.keyObject]:[f]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,u=i.mutationType,c=i.subscriptionType,f=Zr(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),u&&t.setRootTypename("Mutation",n),c&&t.setRootTypename("Subscription",n),_r.call(t.toBeAdded,n)?t.toBeAdded[n].push(f):t.toBeAdded[n]=[f]})},r.prototype.updateTypePolicy=function(e,t){var n=this,i=this.getTypePolicy(e),a=t.keyFields,u=t.fields;function c(f,h){f.merge=typeof h=="function"?h:h===!0?mg:h===!1?yg:f.merge}c(i,t.merge),i.keyFn=a===!1?TO:Qt(a)?cg(a):typeof a=="function"?a:i.keyFn,u&&Object.keys(u).forEach(function(f){var h=n.getFieldPolicy(e,f,!0),p=u[f];if(typeof p=="function")h.read=p;else{var m=p.keyArgs,y=p.read,g=p.merge;h.keyFn=m===!1?pg:Qt(m)?lg(m):typeof m=="function"?m:h.keyFn,typeof y=="function"&&(h.read=y),c(h,g)}h.read&&h.merge&&(h.keyFn=h.keyFn||pg)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(ke(!i||i===e,6,e),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){t.getSupertypeSet(n,!0),e[n].forEach(function(i){t.getSupertypeSet(i,!0).add(n);var a=i.match(Zy);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!_r.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);!i&&this.fuzzySubtypes.size&&(i=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach(function(u,c){if(u.test(e)){var f=t.supertypeMap.get(c);f&&f.forEach(function(h){return i.add(h)})}})),i&&i.size&&i.forEach(function(u){var c=t.getTypePolicy(u),f=c.fields,h=Zr(c,["fields"]);Object.assign(n,h),Object.assign(n.fields,f)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(u){t.updateTypePolicy(e,u)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,n){if(e){var i=this.getTypePolicy(e).fields;return i[t]||n&&(i[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=new Set),n},r.prototype.fragmentMatches=function(e,t,n,i){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var u=e.typeCondition.name.value;if(t===u)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(u))for(var c=this.getSupertypeSet(t,!0),f=[c],h=function(b){var k=a.getSupertypeSet(b,!1);k&&k.size&&f.indexOf(k)<0&&f.push(k)},p=!!(n&&this.fuzzySubtypes.size),m=!1,y=0;y<f.length;++y){var g=f[y];if(g.has(u))return c.has(u)||(m&&globalThis.__DEV__!==!1&&ke.warn(7,t,u),c.add(u)),!0;g.forEach(h),p&&y===f.length-1&&vf(e.selectionSet,n,i)&&(p=!1,m=!0,this.fuzzySubtypes.forEach(function(b,k){var _=t.match(b);_&&_[0]===t&&h(k)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var n=this.getFieldPolicy(e,t,!1);return!!(n&&n.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,n=e.fieldName,i=this.getFieldPolicy(t,n,!1),a,u=i&&i.keyFn;if(u&&t)for(var c={typename:t,fieldName:n,field:e.field||null,variables:e.variables},f=Ef(e);u;){var h=u(f,c);if(Qt(h))u=lg(h);else{a=h||n;break}}return a===void 0&&(a=e.field?zm(e.field,e.variables):Dl(n,Ef(e))),a===!1?n:n===Ki(a)?a:n+":"+a},r.prototype.readField=function(e,t){var n=e.from;if(n){var i=e.field||e.fieldName;if(i){if(e.typename===void 0){var a=t.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var u=this.getStoreFieldName(e),c=Ki(u),f=t.store.getFieldValue(n,u),h=this.getFieldPolicy(e.typename,c,!1),p=h&&h.read;if(p){var m=gg(this,n,e,t,t.store.getStorage(_t(n)?n.__ref:n,u));return _f.withValue(this.cache,p,[f,m])}return f}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var u=n.field,c=n.typename,f=n.merge;return f===mg?vg(i.store)(e,t):f===yg?t:(i.overwrite&&(e=void 0),f(e,t,gg(this,void 0,{typename:c,fieldName:u.name.value,field:u,variables:i.variables},i,a||Object.create(null))))},r}();function gg(r,e,t,n,i){var a=r.getStoreFieldName(t),u=Ki(a),c=t.variables||n.variables,f=n.store,h=f.toReference,p=f.canRead;return{args:Ef(t),field:t.field||null,fieldName:u,storeFieldName:a,variables:c,isReference:_t,toReference:h,storage:i,cache:r.cache,canRead:p,readField:function(){return r.readField(Of(arguments,e,c),n)},mergeObjects:vg(n.store)}}function Of(r,e,t){var n=r[0],i=r[1],a=r.length,u;return typeof n=="string"?u={fieldName:n,from:a>1?i:e}:(u=F({},n),_r.call(u,"from")||(u.from=e)),globalThis.__DEV__!==!1&&u.from===void 0&&globalThis.__DEV__!==!1&&ke.warn(8,bl(Array.from(r))),u.variables===void 0&&(u.variables=t),u}function vg(r){return function(t,n){if(Qt(t)||Qt(n))throw qr(9);if(qt(t)&&qt(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),u=i&&a&&i!==a;if(u)return n;if(_t(t)&&Xs(n))return r.merge(t.__ref,n),t;if(Xs(t)&&_t(n))return r.merge(t,n.__ref),n;if(Xs(t)&&Xs(n))return F(F({},t),n)}return n}}function Tf(r,e,t){var n="".concat(e).concat(t),i=r.flavors.get(n);return i||r.flavors.set(n,i=r.clientOnly===e&&r.deferred===t?r:F(F({},r),{clientOnly:e,deferred:t})),i}var kO=function(){function r(e,t,n){this.cache=e,this.reader=t,this.fragments=n}return r.prototype.writeToStore=function(e,t){var n=this,i=t.query,a=t.result,u=t.dataId,c=t.variables,f=t.overwrite,h=gi(i),p=gO();c=F(F({},bu(h)),c);var m=F(F({store:e,written:Object.create(null),merge:function(g,b){return p.merge(g,b)},variables:c,varString:mi(c)},Xy(i,this.fragments)),{overwrite:!!f,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),y=this.processSelectionSet({result:a||Object.create(null),dataId:u,selectionSet:h.selectionSet,mergeTree:{map:new Map},context:m});if(!_t(y))throw qr(12,a);return m.incomingById.forEach(function(g,b){var k=g.storeObject,_=g.mergeTree,w=g.fieldNodeSet,T=zi(b);if(_&&_.map.size){var C=n.applyMerges(_,T,k,m);if(_t(C))return;k=C}if(globalThis.__DEV__!==!1&&!m.overwrite){var R=Object.create(null);w.forEach(function(V){V.selectionSet&&(R[V.name.value]=!0)});var O=function(V){return R[Ki(V)]===!0},N=function(V){var D=_&&_.map.get(V);return!!(D&&D.info&&D.info.merge)};Object.keys(k).forEach(function(V){O(V)&&!N(V)&&IO(T,k,V,m.store)})}e.merge(b,k)}),e.retain(y.__ref),y},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,u=e.context,c=e.mergeTree,f=this.cache.policies,h=Object.create(null),p=n&&f.rootTypenamesById[n]||vu(i,a,u.fragmentMap)||n&&u.store.get(n,"__typename");typeof p=="string"&&(h.__typename=p);var m=function(){var C=Of(arguments,h,u.variables);if(_t(C.from)){var R=u.incomingById.get(C.from.__ref);if(R){var O=f.readField(F(F({},C),{from:R.storeObject}),u);if(O!==void 0)return O}}return f.readField(C,u)},y=new Set;this.flattenFields(a,i,u,p).forEach(function(C,R){var O,N=si(R),V=i[N];if(y.add(R),V!==void 0){var D=f.getStoreFieldName({typename:p,fieldName:R.name.value,field:R,variables:C.variables}),U=wg(c,D),Y=t.processFieldValue(V,R,R.selectionSet?Tf(C,!1,!1):C,U),ae=void 0;R.selectionSet&&(_t(Y)||Xs(Y))&&(ae=m("__typename",Y));var re=f.getMergeFunction(p,R.name.value,ae);re?U.info={field:R,typename:p,merge:re}:_g(c,D),h=C.merge(h,(O={},O[D]=Y,O))}else globalThis.__DEV__!==!1&&!C.clientOnly&&!C.deferred&&!Eu.added(R)&&!f.getReadFunction(p,R.name.value)&&globalThis.__DEV__!==!1&&ke.error(13,si(R),i)});try{var g=f.identify(i,{typename:p,selectionSet:a,fragmentMap:u.fragmentMap,storeObject:h,readField:m}),b=g[0],k=g[1];n=n||b,k&&(h=u.merge(h,k))}catch(C){if(!n)throw C}if(typeof n=="string"){var _=zi(n),w=u.written[n]||(u.written[n]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(i,_,a,u)))return _;var T=u.incomingById.get(n);return T?(T.storeObject=u.merge(T.storeObject,h),T.mergeTree=Af(T.mergeTree,c),y.forEach(function(C){return T.fieldNodeSet.add(C)})):u.incomingById.set(n,{storeObject:h,mergeTree:Fu(c)?void 0:c,fieldNodeSet:y}),_}return h},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?globalThis.__DEV__!==!1?ef(e):e:Qt(e)?e.map(function(u,c){var f=a.processFieldValue(u,t,n,wg(i,c));return _g(i,c),f}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:i})},r.prototype.flattenFields=function(e,t,n,i){i===void 0&&(i=vu(t,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new pi(!1);return function f(h,p){var m=c.lookup(h,p.clientOnly,p.deferred);m.visited||(m.visited=!0,h.selections.forEach(function(y){if(Qs(y,n.variables)){var g=p.clientOnly,b=p.deferred;if(!(g&&b)&&un(y.directives)&&y.directives.forEach(function(w){var T=w.name.value;if(T==="client"&&(g=!0),T==="defer"){var C=Ja(w,n.variables);(!C||C.if!==!1)&&(b=!0)}}),yi(y)){var k=a.get(y);k&&(g=g&&k.clientOnly,b=b&&k.deferred),a.set(y,Tf(n,g,b))}else{var _=Qa(y,n.lookupFragment);if(!_&&y.kind===Pe.FRAGMENT_SPREAD)throw qr(14,y.name.value);_&&u.fragmentMatches(_,i,t,n.variables)&&f(_.selectionSet,Tf(n,g,b))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var u,c=this;if(e.map.size&&!_t(n)){var f=!Qt(n)&&(_t(t)||Xs(t))?t:void 0,h=n;f&&!a&&(a=[_t(f)?f.__ref:f]);var p,m=function(y,g){return Qt(y)?typeof g=="number"?y[g]:void 0:i.store.getFieldValue(y,String(g))};e.map.forEach(function(y,g){var b=m(f,g),k=m(h,g);if(k!==void 0){a&&a.push(g);var _=c.applyMerges(y,b,k,i,a);_!==k&&(p=p||new Map,p.set(g,_)),a&&ke(a.pop()===g)}}),p&&(n=Qt(h)?h.slice(0):F({},h),p.forEach(function(y,g){n[g]=y}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(u=i.store).getStorage.apply(u,a)):n},r}(),bg=[];function wg(r,e){var t=r.map;return t.has(e)||t.set(e,bg.pop()||{map:new Map}),t.get(e)}function Af(r,e){if(r===e||!e||Fu(e))return r;if(!r||Fu(r))return e;var t=r.info&&e.info?F(F({},r.info),e.info):r.info||e.info,n=r.map.size&&e.map.size,i=n?new Map:r.map.size?r.map:e.map,a={info:t,map:i};if(n){var u=new Set(e.map.keys());r.map.forEach(function(c,f){a.map.set(f,Af(c,e.map.get(f))),u.delete(f)}),u.forEach(function(c){a.map.set(c,Af(e.map.get(c),r.map.get(c)))})}return a}function Fu(r){return!r||!(r.info||r.map.size)}function _g(r,e){var t=r.map,n=t.get(e);n&&Fu(n)&&(bg.push(n),t.delete(e))}var Sg=new Set;function IO(r,e,t,n){var i=function(m){var y=n.getFieldValue(m,t);return typeof y=="object"&&y},a=i(r);if(a){var u=i(e);if(u&&!_t(a)&&!xt(a,u)&&!Object.keys(a).every(function(m){return n.getFieldValue(u,m)!==void 0})){var c=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),f=Ki(t),h="".concat(c,".").concat(f);if(!Sg.has(h)){Sg.add(h);var p=[];!Qt(a)&&!Qt(u)&&[a,u].forEach(function(m){var y=n.getFieldValue(m,"__typename");typeof y=="string"&&!p.includes(y)&&p.push(y)}),globalThis.__DEV__!==!1&&ke.warn(15,f,c,p.length?"either ensure all objects of type "+p.join(" and ")+" have an ID or a custom merge function, or ":"",h,F({},a),F({},u))}}}}var kf=function(r){xn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.addTypenameTransform=new Su(Eu),n.assumeImmutableResults=!0,n.makeVar=og,n.txCount=0,n.config=mO(t),n.addTypename=!!n.config.addTypename,n.policies=new AO({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var t=this.data=new oo.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new kO(this,this.storeReader=new _O({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Ky(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=Za(function(u,c){return n.broadcastWatch(u,c)},{max:this.config.resultCacheMaxSize||Qn["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(u){var c=u.optimistic?n.optimisticData:n.data;if(uo(c)){var f=u.optimistic,h=u.id,p=u.variables;return c.makeCacheKey(u.query,u.callback,mi({optimistic:f,id:h,variables:p}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(u){return u.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var n=t.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(F(F({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof yf)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if(_r.call(t,"id")&&!t.id)return!1;var n=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(F(F({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var n=this;return this.watches.size||EO(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&ag(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){var n;mi.reset(),vi.reset(),this.addTypenameTransform.resetCache(),(n=this.config.fragments)===null||n===void 0||n.resetCaches();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,n){return(n?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,n){return(n?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(_t(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){globalThis.__DEV__!==!1&&ke.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(_r.call(t,"id"))return!1;t=F(F({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var n=this;return this.init(),mi.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),ag(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,u=a===void 0?!0:a,c=t.removeOptimistic,f=t.onWatchUpdated,h,p=function(y){var g=n,b=g.data,k=g.optimisticData;++n.txCount,y&&(n.data=n.optimisticData=y);try{return h=i(n)}finally{--n.txCount,n.data=b,n.optimisticData=k}},m=new Set;return f&&!this.txCount&&this.broadcastWatches(F(F({},t),{onWatchUpdated:function(y){return m.add(y),!1}})),typeof u=="string"?this.optimisticData=this.optimisticData.addLayer(u,p):u===!1?p(this.data):p(),typeof c=="string"&&(this.optimisticData=this.optimisticData.removeLayer(c)),f&&m.size?(this.broadcastWatches(F(F({},t),{onWatchUpdated:function(y,g){var b=f.call(this,y,g);return b!==!1&&m.delete(y),b}})),m.size&&m.forEach(function(y){return n.maybeBroadcastWatch.dirty(y)})):this.broadcastWatches(t),h},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){return this.addTypenameToDocument(this.addFragmentsToDocument(t))},e.prototype.fragmentMatches=function(t,n){return this.policies.fragmentMatches(t,n)},e.prototype.lookupFragment=function(t){var n;return((n=this.config.fragments)===null||n===void 0?void 0:n.lookup(t))||null},e.prototype.broadcastWatches=function(t){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,t)})},e.prototype.addFragmentsToDocument=function(t){var n=this.config.fragments;return n?n.transform(t):t},e.prototype.addTypenameToDocument=function(t){return this.addTypename?this.addTypenameTransform.transformDocument(t):t},e.prototype.broadcastWatch=function(t,n){var i=t.lastDiff,a=this.diff(t);n&&(t.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,t,a,i)===!1)||(!i||!xt(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(pf);globalThis.__DEV__!==!1&&(kf.prototype.getMemoryInternals=OE);var dt;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(dt||(dt={}));function ta(r){return r?r<7:!1}function CO(r){return r===7||r===8}var xg=Object.assign,PO=Object.hasOwnProperty,ra=function(r){xn(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,u=this,c=e.inactiveOnCreation.getValue();u=r.call(this,function(w){u._getOrCreateQuery();try{var T=w._subscription._observer;T&&!T.error&&(T.error=NO)}catch{}var C=!u.observers.size;u.observers.add(w);var R=u.last;return R&&R.error?w.error&&w.error(R.error):R&&R.result&&w.next&&w.next(u.maskResult(R.result)),C&&u.reobserve().catch(function(){}),function(){u.observers.delete(w)&&!u.observers.size&&u.tearDownQuery()}})||this,u.observers=new Set,u.subscriptions=new Set,u.dirty=!1,u._getOrCreateQuery=function(){return c&&(n.queries.set(u.queryId,i),c=!1),u.queryManager.getOrCreateQuery(u.queryId)},u.queryInfo=i,u.queryManager=n,u.waitForOwnResult=If(a.fetchPolicy),u.isTornDown=!1,u.subscribeToMore=u.subscribeToMore.bind(u),u.maskResult=u.maskResult.bind(u);var f=n.defaultOptions.watchQuery,h=f===void 0?{}:f,p=h.fetchPolicy,m=p===void 0?"cache-first":p,y=a.fetchPolicy,g=y===void 0?m:y,b=a.initialFetchPolicy,k=b===void 0?g==="standby"?m:g:b;u.options=F(F({},a),{initialFetchPolicy:k,fetchPolicy:g}),u.queryId=i.queryId||n.generateQueryId();var _=gi(u.query);return u.queryName=_&&_.name&&_.name.value,u}return Object.defineProperty(e.prototype,"query",{get:function(){return this.lastQuery||this.options.query},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(n,i){var a={next:function(c){n(c),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){u.unsubscribe()},0)},error:i},u=t.subscribe(a)})},e.prototype.resetDiff=function(){this.queryInfo.resetDiff()},e.prototype.getCurrentFullResult=function(t){t===void 0&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||dt.ready,a=F(F({},n),{loading:ta(i),networkStatus:i}),u=this.options.fetchPolicy,c=u===void 0?"cache-first":u;if(!(If(c)||this.queryManager.getDocumentInfo(this.query).hasForcedResolvers))if(this.waitForOwnResult)this.queryInfo.updateWatch();else{var f=this.queryInfo.getDiff();(f.complete||this.options.returnPartialData)&&(a.data=f.result),xt(a.data,{})&&(a.data=void 0),f.complete?(delete a.partial,f.complete&&a.networkStatus===dt.loading&&(c==="cache-first"||c==="cache-only")&&(a.networkStatus=dt.ready,a.loading=!1)):a.partial=!0,a.networkStatus===dt.ready&&(a.error||a.errors)&&(a.networkStatus=dt.error),globalThis.__DEV__!==!1&&!f.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Eg(f.missing)}return t&&this.updateLastResult(a),a},e.prototype.getCurrentResult=function(t){return t===void 0&&(t=!0),this.maskResult(this.getCurrentFullResult(t))},e.prototype.isDifferentFromLastResult=function(t,n){if(!this.last)return!0;var i=this.queryManager.getDocumentInfo(this.query),a=this.queryManager.dataMasking,u=a?i.nonReactiveQuery:this.query,c=a||i.hasNonreactiveDirective?!By(u,this.last.result,t,this.variables):!xt(this.last.result,t);return c||n&&!xt(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||xt(i.variables,this.variables)))return i[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",globalThis.__DEV__!==!1&&t&&PO.call(t,"variables")){var u=Fl(this.query),c=u.variableDefinitions;(!c||!c.some(function(f){return f.variable.name.value==="variables"}))&&globalThis.__DEV__!==!1&&ke.warn(21,t,((n=u.name)===null||n===void 0?void 0:n.value)||u)}return t&&!xt(this.options.variables,t)&&(i.variables=this.options.variables=F(F({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,dt.refetch)},e.prototype.fetchMore=function(t){var n=this,i=F(F({},t.query?t:F(F(F(F({},this.options),{query:this.options.query}),t),{variables:F(F({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"});i.query=this.transformDocument(i.query);var a=this.queryManager.generateQueryId();this.lastQuery=t.query?this.transformDocument(this.options.query):i.query;var u=this.queryInfo,c=u.networkStatus;u.networkStatus=dt.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var f=new Set,h=t?.updateQuery,p=this.options.fetchPolicy!=="no-cache";return p||ke(h,22),this.queryManager.fetchQuery(a,i,dt.fetchMore).then(function(m){if(n.queryManager.removeQuery(a),u.networkStatus===dt.fetchMore&&(u.networkStatus=c),p)n.queryManager.cache.batch({update:function(b){var k=t.updateQuery;k?b.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(_){return k(_,{fetchMoreResult:m.data,variables:i.variables})}):b.writeQuery({query:i.query,variables:i.variables,data:m.data})},onWatchUpdated:function(b){f.add(b.query)}});else{var y=n.getLast("result"),g=h(y.data,{fetchMoreResult:m.data,variables:i.variables});n.reportResult(F(F({},y),{networkStatus:c,loading:ta(c),data:g}),n.variables)}return n.maskResult(m)}).finally(function(){p&&!f.has(n.query)&&n.reobserveCacheFirst()})},e.prototype.subscribeToMore=function(t){var n=this,i=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var u=t.updateQuery;u&&n.updateQuery(function(c,f){return u(c,F({subscriptionData:a},f))})},error:function(a){if(t.onError){t.onError(a);return}globalThis.__DEV__!==!1&&ke.error(23,a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.silentSetOptions=function(t){var n=Ji(this.options,t||{});xg(this.options,n)},e.prototype.setVariables=function(t){return xt(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},dt.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}),a=i.result,u=i.complete,c=t(a,{variables:this.variables,complete:!!u,previousData:a});c&&(n.cache.writeQuery({query:this.options.query,data:c,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,u=n.initialFetchPolicy,c=u===void 0?a:u;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:t,options:n,observable:this,initialFetchPolicy:c}):t==="variables-changed"?n.fetchPolicy=c:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(t,n,i){var a=this._getOrCreateQuery();return a.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(a,t,n,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a||!this.hasObservers()){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){ke(a,24);var u=i||(this.pollingInfo={});u.interval=a;var c=function(){var h,p;t.pollingInfo&&(!ta(t.queryInfo.networkStatus)&&!(!((p=(h=t.options).skipPollAttempt)===null||p===void 0)&&p.call(h))?t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},dt.poll).then(f,f):f())},f=function(){var h=t.pollingInfo;h&&(clearTimeout(h.timeout),h.timeout=setTimeout(c,h.interval))};f()}}},e.prototype.updateLastResult=function(t,n){n===void 0&&(n=this.variables);var i=this.getLastError();return i&&this.last&&!xt(n,this.last.variables)&&(i=void 0),this.last=F({result:this.queryManager.assumeImmutableResults?t:ef(t),variables:n},i?{error:i}:null)},e.prototype.reobserveAsConcast=function(t,n){var i=this;this.isTornDown=!1;var a=n===dt.refetch||n===dt.fetchMore||n===dt.poll,u=this.options.variables,c=this.options.fetchPolicy,f=Ji(this.options,t||{}),h=a?f:xg(this.options,f),p=this.transformDocument(h.query);this.lastQuery=p,a||(this.updatePolling(),t&&t.variables&&!xt(t.variables,u)&&h.fetchPolicy!=="standby"&&(h.fetchPolicy===c||typeof h.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",h),n===void 0&&(n=dt.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=If(h.fetchPolicy));var m=function(){i.concast===b&&(i.waitForOwnResult=!1)},y=h.variables&&F({},h.variables),g=this.fetch(h,n,p),b=g.concast,k=g.fromLink,_={next:function(w){xt(i.variables,y)&&(m(),i.reportResult(w,y))},error:function(w){xt(i.variables,y)&&(of(w)||(w=new cn({networkError:w})),m(),i.reportError(w,y))}};return!a&&(k||!this.concast)&&(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=b,this.observer=_),b.addObserver(_),b},e.prototype.reobserve=function(t,n){return wy(this.reobserveAsConcast(t,n).promise.then(this.maskResult))},e.prototype.resubscribeAfterError=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.last;this.resetLastResults();var a=this.subscribe.apply(this,t);return this.last=i,a},e.prototype.observe=function(){this.reportResult(this.getCurrentFullResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError(),a=this.isDifferentFromLastResult(t,n);(i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),(i||a)&&Zs(this.observers,"next",this.maskResult(t))},e.prototype.reportError=function(t,n){var i=F(F({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:dt.error,loading:!1});this.updateLastResult(i,n),Zs(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e.prototype.transformDocument=function(t){return this.queryManager.transform(t)},e.prototype.maskResult=function(t){return t&&"data"in t?F(F({},t),{data:this.queryManager.maskOperation({document:this.query,data:t.data,fetchPolicy:this.options.fetchPolicy,id:this.queryId})}):t},e.prototype.resetNotifications=function(){this.cancelNotifyTimeout(),this.dirty=!1},e.prototype.cancelNotifyTimeout=function(){this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0)},e.prototype.scheduleNotify=function(){var t=this;this.dirty||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},e.prototype.notify=function(){if(this.cancelNotifyTimeout(),this.dirty&&(this.options.fetchPolicy=="cache-only"||this.options.fetchPolicy=="cache-and-network"||!ta(this.queryInfo.networkStatus))){var t=this.queryInfo.getDiff();t.fromOptimisticTransaction?this.observe():this.reobserveCacheFirst()}this.dirty=!1},e.prototype.reobserveCacheFirst=function(){var t=this.options,n=t.fetchPolicy,i=t.nextFetchPolicy;return n==="cache-and-network"||n==="network-only"?this.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(a,u){return this.nextFetchPolicy=i,typeof this.nextFetchPolicy=="function"?this.nextFetchPolicy(a,u):n}}):this.reobserve()},e.inactiveOnCreation=new Ya,e}(St);rf(ra);function NO(r){globalThis.__DEV__!==!1&&ke.error(25,r.message,r.stack)}function Eg(r){globalThis.__DEV__!==!1&&r&&globalThis.__DEV__!==!1&&ke.debug(26,r)}function If(r){return r==="network-only"||r==="no-cache"||r==="standby"}var na=new(Vi?WeakMap:Map);function Cf(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return na.set(r,(na.get(r)+1)%1e15),t.apply(this,arguments)})}var Pf=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.document=null,this.lastRequestId=1,this.stopped=!1,this.observableQuery=null;var n=this.cache=e.cache;na.has(n)||(na.set(n,0),Cf(n,"evict"),Cf(n,"modify"),Cf(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||dt.loading;return this.variables&&this.networkStatus!==dt.loading&&!xt(this.variables,e.variables)&&(t=dt.setVariables),xt(e.variables,this.variables)||(this.lastDiff=void 0,this.cancel()),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.resetDiff=function(){this.lastDiff=void 0},r.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&xt(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var t=this.observableQuery;if(t&&t.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(e);return this.updateLastDiff(n,e),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t,n,i=this.lastDiff&&this.lastDiff.diff;e&&!e.complete&&(!((t=this.observableQuery)===null||t===void 0)&&t.getLastError())||(this.updateLastDiff(e),xt(i&&i.result,e&&e.result)||(n=this.observableQuery)===null||n===void 0||n.scheduleNotify())},r.prototype.setObservableQuery=function(e){e!==this.observableQuery&&(this.observableQuery=e,e&&(e.queryInfo=this))},r.prototype.stop=function(){var e;if(!this.stopped){this.stopped=!0,(e=this.observableQuery)===null||e===void 0||e.resetNotifications(),this.cancel();var t=this.observableQuery;t&&t.stopPolling()}},r.prototype.cancel=function(){var e;(e=this.cancelWatch)===null||e===void 0||e.call(this),this.cancelWatch=void 0},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=F(F({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!xt(i,this.lastWatch))&&(this.cancel(),this.cancelWatch=this.cache.watch(this.lastWatch=i))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===na.get(this.cache)&&xt(t,n.variables)&&xt(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,u,c=new bi,f=un(e.errors)?e.errors.slice(0):[];if((u=this.observableQuery)===null||u===void 0||u.resetNotifications(),"incremental"in e&&un(e.incremental)){var h=nf(this.getDiff().result,e);e.data=h}else if("hasNext"in e&&e.hasNext){var p=this.getDiff();e.data=c.merge(p.result,e.data)}this.graphQLErrors=f,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(Nf(e,n.errorPolicy)?this.cache.performTransaction(function(m){if(a.shouldWrite(e,n.variables))m.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:na.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var y=a.getDiffOptions(n.variables),g=m.diff(y);!a.stopped&&xt(a.variables,n.variables)&&a.updateWatch(n.variables),a.updateLastDiff(g,y),g.complete&&(e.data=g.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=dt.ready},r.prototype.markError=function(e){var t;return this.networkStatus=dt.error,this.lastWrite=void 0,(t=this.observableQuery)===null||t===void 0||t.resetNotifications(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Nf(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!no(r);return!n&&t&&r.data&&(n=!0),n}var MO=Object.prototype.hasOwnProperty,Og=Object.create(null),RO=function(){function r(e){var t=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new gu(Qn["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new pi(!1),this.noCacheWarningsByQueryId=new Set;var n=new Su(function(a){return t.cache.transformDocument(a)},{cache:!1});this.cache=e.cache,this.link=e.link,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientAwareness=e.clientAwareness,this.localState=e.localState,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults,this.dataMasking=e.dataMasking;var i=e.documentTransform;this.documentTransform=i?n.concat(i).concat(n):n,this.defaultContext=e.defaultContext||Object.create(null),(this.onBroadcast=e.onBroadcast)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(qr(27))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){return Ui(this,arguments,void 0,function(t){var n,i,a,u,c,f,h,p=t.mutation,m=t.variables,y=t.optimisticResponse,g=t.updateQueries,b=t.refetchQueries,k=b===void 0?[]:b,_=t.awaitRefetchQueries,w=_===void 0?!1:_,T=t.update,C=t.onQueryUpdated,R=t.fetchPolicy,O=R===void 0?((f=this.defaultOptions.mutate)===null||f===void 0?void 0:f.fetchPolicy)||"network-only":R,N=t.errorPolicy,V=N===void 0?((h=this.defaultOptions.mutate)===null||h===void 0?void 0:h.errorPolicy)||"none":N,D=t.keepRootFields,U=t.context;return $i(this,function(Y){switch(Y.label){case 0:return ke(p,28),ke(O==="network-only"||O==="no-cache",29),n=this.generateMutationId(),p=this.cache.transformForLink(this.transform(p)),i=this.getDocumentInfo(p).hasClientExports,m=this.getVariables(p,m),i?[4,this.localState.addExportedVariables(p,m,U)]:[3,2];case 1:m=Y.sent(),Y.label=2;case 2:return a=this.mutationStore&&(this.mutationStore[n]={mutation:p,variables:m,loading:!0,error:null}),u=y&&this.markMutationOptimistic(y,{mutationId:n,document:p,variables:m,fetchPolicy:O,errorPolicy:V,context:U,updateQueries:g,update:T,keepRootFields:D}),this.broadcastQueries(),c=this,[2,new Promise(function(ae,re){return Au(c.getObservableFromLink(p,F(F({},U),{optimisticResponse:u?y:void 0}),m,{},!1),function(Se){if(no(Se)&&V==="none")throw new cn({graphQLErrors:ku(Se)});a&&(a.loading=!1,a.error=null);var se=F({},Se);return typeof k=="function"&&(k=k(se)),V==="ignore"&&no(se)&&delete se.errors,c.markMutationResult({mutationId:n,result:se,document:p,variables:m,fetchPolicy:O,errorPolicy:V,context:U,update:T,updateQueries:g,awaitRefetchQueries:w,refetchQueries:k,removeOptimistic:u?n:void 0,onQueryUpdated:C,keepRootFields:D})}).subscribe({next:function(Se){c.broadcastQueries(),(!("hasNext"in Se)||Se.hasNext===!1)&&ae(F(F({},Se),{data:c.maskOperation({document:p,data:Se.data,fetchPolicy:O,id:n})}))},error:function(Se){a&&(a.loading=!1,a.error=Se),u&&c.cache.removeOptimistic(n),c.broadcastQueries(),re(Se instanceof cn?Se:new cn({networkError:Se}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var n=this;t===void 0&&(t=this.cache);var i=e.result,a=[],u=e.fetchPolicy==="no-cache";if(!u&&Nf(i,e.errorPolicy)){if(ks(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),ks(i)&&un(i.incremental)){var c=t.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),f=void 0;c.result&&(f=nf(c.result,i)),typeof f<"u"&&(i.data=f,a.push({result:f,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var h=e.updateQueries;h&&this.queries.forEach(function(m,y){var g=m.observableQuery,b=g&&g.queryName;if(!(!b||!MO.call(h,b))){var k=h[b],_=n.queries.get(y),w=_.document,T=_.variables,C=t.diff({query:w,variables:T,returnPartialData:!0,optimistic:!1}),R=C.result,O=C.complete;if(O&&R){var N=k(R,{mutationResult:i,queryName:w&&Js(w)||void 0,queryVariables:T});N&&a.push({result:N,dataId:"ROOT_QUERY",query:w,variables:T})}}})}if(a.length>0||(e.refetchQueries||"").length>0||e.update||e.onQueryUpdated||e.removeOptimistic){var p=[];if(this.refetchQueries({updateCache:function(m){u||a.forEach(function(k){return m.write(k)});var y=e.update,g=!xy(i)||ks(i)&&!i.hasNext;if(y){if(!u){var b=m.diff({id:"ROOT_MUTATION",query:n.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});b.complete&&(i=F(F({},i),{data:b.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}g&&y(m,i,{context:e.context,variables:e.variables})}!u&&!e.keepRootFields&&g&&m.modify({id:"ROOT_MUTATION",fields:function(k,_){var w=_.fieldName,T=_.DELETE;return w==="__typename"?k:T}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(m){return p.push(m)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(p).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables,{IGNORE:Og}):e;return i===Og?!1:(this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(F(F({},t),{result:{data:i}}),a)}catch(u){globalThis.__DEV__!==!1&&ke.error(u)}},t.mutationId),!0)},r.prototype.fetchQuery=function(e,t,n){return this.fetchConcastWithInfo(this.getOrCreateQuery(e),t,n).concast.promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,n){e[n]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},r.prototype.getDocumentInfo=function(e){var t=this.transformCache;if(!t.has(e)){var n={hasClientExports:Cm(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:Bi(["nonreactive"],e),nonReactiveQuery:dy(e),clientQuery:this.localState.clientQuery(e),serverQuery:xu([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"},{name:"unmask"}],e),defaultVars:bu(gi(e)),asQuery:F(F({},e),{definitions:e.definitions.map(function(i){return i.kind==="OperationDefinition"&&i.operation!=="query"?F(F({},i),{operation:"query"}):i})})};t.set(e,n)}return t.get(e)},r.prototype.getVariables=function(e,t){return F(F({},this.getDocumentInfo(e).defaultVars),t)},r.prototype.watchQuery=function(e){var t=this.transform(e.query);e=F(F({},e),{variables:this.getVariables(t,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var n=new Pf(this),i=new ra({queryManager:this,queryInfo:n,options:e});return i.lastQuery=t,ra.inactiveOnCreation.getValue()||this.queries.set(i.queryId,n),n.init({document:t,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var n=this;t===void 0&&(t=this.generateQueryId()),ke(e.query,30),ke(e.query.kind==="Document",31),ke(!e.returnPartialData,32),ke(!e.pollInterval,33);var i=this.transform(e.query);return this.fetchQuery(t,F(F({},e),{query:i})).then(function(a){return a&&F(F({},a),{data:n.maskOperation({document:i,data:a.data,fetchPolicy:e.fetchPolicy,id:t})})}).finally(function(){return n.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(qr(34)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=dt.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Map,u=new Set;return Array.isArray(e)&&e.forEach(function(c){if(typeof c=="string")i.set(c,c),a.set(c,!1);else if(Wm(c)){var f=vi(t.transform(c));i.set(f,Js(c)),a.set(f,!1)}else qt(c)&&c.query&&u.add(c)}),this.queries.forEach(function(c,f){var h=c.observableQuery,p=c.document;if(h){if(e==="all"){n.set(f,h);return}var m=h.queryName,y=h.options.fetchPolicy;if(y==="standby"||e==="active"&&!h.hasObservers())return;(e==="active"||m&&a.has(m)||p&&a.has(vi(p)))&&(n.set(f,h),m&&a.set(m,!0),p&&a.set(vi(p),!0))}}),u.size&&u.forEach(function(c){var f=au("legacyOneTimeQuery"),h=t.getOrCreateQuery(f).init({document:c.query,variables:c.variables}),p=new ra({queryManager:t,queryInfo:h,options:F(F({},c),{fetchPolicy:"network-only"})});ke(p.queryId===f),h.setObservableQuery(p),n.set(f,p)}),globalThis.__DEV__!==!1&&a.size&&a.forEach(function(c,f){if(!c){var h=i.get(f);h?globalThis.__DEV__!==!1&&ke.warn(35,h):globalThis.__DEV__!==!1&&ke.warn(36)}}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var u=i.options.fetchPolicy;i.resetLastResults(),(e||u!=="standby"&&u!=="cache-only")&&n.push(i.refetch()),(t.queries.get(a)||i.queryInfo).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.variables,a=e.fetchPolicy,u=e.errorPolicy,c=u===void 0?"none":u,f=e.context,h=f===void 0?{}:f,p=e.extensions,m=p===void 0?{}:p;n=this.transform(n),i=this.getVariables(n,i);var y=function(b){return t.getObservableFromLink(n,h,b,m).map(function(k){a!=="no-cache"&&(Nf(k,c)&&t.cache.write({query:n,result:k.data,dataId:"ROOT_SUBSCRIPTION",variables:b}),t.broadcastQueries());var _=no(k),w=ky(k);if(_||w){var T={};if(_&&(T.graphQLErrors=k.errors),w&&(T.protocolErrors=k.extensions[Nu]),c==="none"||w)throw new cn(T)}return c==="ignore"&&delete k.errors,k})};if(this.getDocumentInfo(n).hasClientExports){var g=this.localState.addExportedVariables(n,i,h).then(y);return new St(function(b){var k=null;return g.then(function(_){return k=_.subscribe(b)},b.error),function(){return k&&k.unsubscribe()}})}return y(i)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){var t;this.fetchCancelFns.delete(e),this.queries.has(e)&&((t=this.queries.get(e))===null||t===void 0||t.stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){var t;return(t=e.observableQuery)===null||t===void 0?void 0:t.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i,a){var u=this,c;a===void 0&&(a=(c=t?.queryDeduplication)!==null&&c!==void 0?c:this.queryDeduplication);var f,h=this.getDocumentInfo(e),p=h.serverQuery,m=h.clientQuery;if(p){var y=this,g=y.inFlightLinkObservables,b=y.link,k={query:p,variables:n,operationName:Js(p)||void 0,context:this.prepareContext(F(F({},t),{forceFetch:!a})),extensions:i};if(t=k.context,a){var _=vi(p),w=mi(n),T=g.lookup(_,w);if(f=T.observable,!f){var C=new As([Pu(b,k)]);f=T.observable=C,C.beforeNext(function R(O,N){O==="next"&&"hasNext"in N&&N.hasNext?C.beforeNext(R):g.remove(_,w)})}}else f=new As([Pu(b,k)])}else f=new As([St.of({data:{}})]),t=this.prepareContext(t);return m&&(f=Au(f,function(R){return u.localState.runResolvers({document:m,remoteResult:R,context:t,variables:n})})),f},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(n.query);return Au(this.getObservableFromLink(a,n.context,n.variables),function(u){var c=ku(u),f=c.length>0,h=n.errorPolicy;if(i>=e.lastRequestId){if(f&&h==="none")throw e.markError(new cn({graphQLErrors:c}));e.markResult(u,a,n,t),e.markReady()}var p={data:u.data,loading:!1,networkStatus:dt.ready};return f&&h==="none"&&(p.data=void 0),f&&h!=="ignore"&&(p.errors=c,p.networkStatus=dt.error),p},function(u){var c=of(u)?u:new cn({networkError:u});throw i>=e.lastRequestId&&e.markError(c),c})},r.prototype.fetchConcastWithInfo=function(e,t,n,i){var a=this;n===void 0&&(n=dt.loading),i===void 0&&(i=t.query);var u=this.getVariables(i,t.variables),c=this.defaultOptions.watchQuery,f=t.fetchPolicy,h=f===void 0?c&&c.fetchPolicy||"cache-first":f,p=t.errorPolicy,m=p===void 0?c&&c.errorPolicy||"none":p,y=t.returnPartialData,g=y===void 0?!1:y,b=t.notifyOnNetworkStatusChange,k=b===void 0?!1:b,_=t.context,w=_===void 0?{}:_,T=Object.assign({},t,{query:i,variables:u,fetchPolicy:h,errorPolicy:m,returnPartialData:g,notifyOnNetworkStatusChange:k,context:w}),C=function(D){T.variables=D;var U=a.fetchQueryByPolicy(e,T,n);return T.fetchPolicy!=="standby"&&U.sources.length>0&&e.observableQuery&&e.observableQuery.applyNextFetchPolicy("after-fetch",t),U},R=function(){return a.fetchCancelFns.delete(e.queryId)};this.fetchCancelFns.set(e.queryId,function(D){R(),setTimeout(function(){return O.cancel(D)})});var O,N;if(this.getDocumentInfo(T.query).hasClientExports)O=new As(this.localState.addExportedVariables(T.query,T.variables,T.context).then(C).then(function(D){return D.sources})),N=!0;else{var V=C(T.variables);N=V.fromLink,O=new As(V.sources)}return O.promise.then(R,R),{concast:O,fromLink:N}},r.prototype.refetchQueries=function(e){var t=this,n=e.updateCache,i=e.include,a=e.optimistic,u=a===void 0?!1:a,c=e.removeOptimistic,f=c===void 0?u?au("refetchQueries"):void 0:c,h=e.onQueryUpdated,p=new Map;i&&this.getObservableQueries(i).forEach(function(y,g){p.set(g,{oq:y,lastDiff:(t.queries.get(g)||y.queryInfo).getDiff()})});var m=new Map;return n&&this.cache.batch({update:n,optimistic:u&&f||!1,removeOptimistic:f,onWatchUpdated:function(y,g,b){var k=y.watcher instanceof Pf&&y.watcher.observableQuery;if(k){if(h){p.delete(k.queryId);var _=h(k,g,b);return _===!0&&(_=k.refetch()),_!==!1&&m.set(k,_),_}h!==null&&p.set(k.queryId,{oq:k,lastDiff:b,diff:g})}}}),p.size&&p.forEach(function(y,g){var b=y.oq,k=y.lastDiff,_=y.diff,w;h&&(_||(_=t.cache.diff(b.queryInfo.getDiffOptions())),w=h(b,_,k)),(!h||w===!0)&&(w=b.refetch()),w!==!1&&m.set(b,w),g.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(g)}),f&&this.cache.removeOptimistic(f),m},r.prototype.maskOperation=function(e){var t,n,i,a=e.document,u=e.data;if(globalThis.__DEV__!==!1){var c=e.fetchPolicy,f=e.id,h=(t=gi(a))===null||t===void 0?void 0:t.operation,p=((n=h?.[0])!==null&&n!==void 0?n:"o")+f;this.dataMasking&&c==="no-cache"&&!qm(a)&&!this.noCacheWarningsByQueryId.has(p)&&(this.noCacheWarningsByQueryId.add(p),globalThis.__DEV__!==!1&&ke.warn(37,(i=Js(a))!==null&&i!==void 0?i:"Unnamed ".concat(h??"operation")))}return this.dataMasking?pO(u,a,this.cache):u},r.prototype.maskFragment=function(e){var t=e.data,n=e.fragment,i=e.fragmentName;return this.dataMasking?Jy(t,n,this.cache,i):t},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,u=t.variables,c=t.fetchPolicy,f=t.refetchWritePolicy,h=t.errorPolicy,p=t.returnPartialData,m=t.context,y=t.notifyOnNetworkStatusChange,g=e.networkStatus;e.init({document:a,variables:u,networkStatus:n});var b=function(){return e.getDiff()},k=function(R,O){O===void 0&&(O=e.networkStatus||dt.loading);var N=R.result;globalThis.__DEV__!==!1&&!p&&!xt(N,{})&&Eg(R.missing);var V=function(D){return St.of(F({data:D,loading:ta(O),networkStatus:O},R.complete?null:{partial:!0}))};return N&&i.getDocumentInfo(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:m,variables:u,onlyRunForcedResolvers:!0}).then(function(D){return V(D.data||void 0)}):h==="none"&&O===dt.refetch&&Array.isArray(R.missing)?V(void 0):V(N)},_=c==="no-cache"?0:n===dt.refetch&&f!=="merge"?1:2,w=function(){return i.getResultsFromLink(e,_,{query:a,variables:u,context:m,fetchPolicy:c,errorPolicy:h})},T=y&&typeof g=="number"&&g!==n&&ta(n);switch(c){default:case"cache-first":{var C=b();return C.complete?{fromLink:!1,sources:[k(C,e.markReady())]}:p||T?{fromLink:!0,sources:[k(C),w()]}:{fromLink:!0,sources:[w()]}}case"cache-and-network":{var C=b();return C.complete||p||T?{fromLink:!0,sources:[k(C),w()]}:{fromLink:!0,sources:[w()]}}case"cache-only":return{fromLink:!1,sources:[k(b(),e.markReady())]};case"network-only":return T?{fromLink:!0,sources:[k(b()),w()]}:{fromLink:!0,sources:[w()]};case"no-cache":return T?{fromLink:!0,sources:[k(e.getDiff()),w()]}:{fromLink:!0,sources:[w()]};case"standby":return{fromLink:!1,sources:[]}}},r.prototype.getOrCreateQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Pf(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return F(F(F({},this.defaultContext),t),{clientAwareness:this.clientAwareness})},r}(),DO=function(){function r(e){var t=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){t.resolvers=eo(t.resolvers,n)}):this.resolvers=eo(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){return Ui(this,arguments,void 0,function(t){var n=t.document,i=t.remoteResult,a=t.context,u=t.variables,c=t.onlyRunForcedResolvers,f=c===void 0?!1:c;return $i(this,function(h){return n?[2,this.resolveDocument(n,i.data,a,u,this.fragmentMatcher,f).then(function(p){return F(F({},i),{data:p.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Bi(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return Wl(e)},r.prototype.prepareContext=function(e){var t=this.cache;return F(F({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e){return Ui(this,arguments,void 0,function(t,n,i){return n===void 0&&(n={}),i===void 0&&(i={}),$i(this,function(a){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,n)||{},this.prepareContext(i),n).then(function(u){return F(F({},n),u.exportedVariables)})]:[2,F({},n)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return Xr(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(t=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),t))return hu}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:hy(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t){return Ui(this,arguments,void 0,function(n,i,a,u,c,f){var h,p,m,y,g,b,k,_,w,T,C;return a===void 0&&(a={}),u===void 0&&(u={}),c===void 0&&(c=function(){return!0}),f===void 0&&(f=!1),$i(this,function(R){return h=Qi(n),p=Os(n),m=Ss(p),y=this.collectSelectionsToResolve(h,m),g=h.operation,b=g?g.charAt(0).toUpperCase()+g.slice(1):"Query",k=this,_=k.cache,w=k.client,T={fragmentMap:m,context:F(F({},a),{cache:_,client:w}),variables:u,fragmentMatcher:c,defaultOperationType:b,exportedVariables:{},selectionsToResolve:y,onlyRunForcedResolvers:f},C=!1,[2,this.resolveSelectionSet(h.selectionSet,C,i,T).then(function(O){return{result:O,exportedVariables:T.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Ui(this,void 0,void 0,function(){var a,u,c,f,h,p=this;return $i(this,function(m){return a=i.fragmentMap,u=i.context,c=i.variables,f=[n],h=function(y){return Ui(p,void 0,void 0,function(){var g,b;return $i(this,function(k){return!t&&!i.selectionsToResolve.has(y)?[2]:Qs(y,c)?yi(y)?[2,this.resolveField(y,t,n,i).then(function(_){var w;typeof _<"u"&&f.push((w={},w[si(y)]=_,w))})]:(Hm(y)?g=y:(g=a[y.name.value],ke(g,19,y.name.value)),g&&g.typeCondition&&(b=g.typeCondition.name.value,i.fragmentMatcher(n,b,u))?[2,this.resolveSelectionSet(g.selectionSet,t,n,i).then(function(_){f.push(_)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(h)).then(function(){return to(f)})]})})},r.prototype.resolveField=function(e,t,n,i){return Ui(this,void 0,void 0,function(){var a,u,c,f,h,p,m,y,g,b=this;return $i(this,function(k){return n?(a=i.variables,u=e.name.value,c=si(e),f=u!==c,h=n[c]||n[u],p=Promise.resolve(h),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(m=n.__typename||i.defaultOperationType,y=this.resolvers&&this.resolvers[m],y&&(g=y[f?u:c],g&&(p=Promise.resolve(_f.withValue(this.cache,g,[n,Ja(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,p.then(function(_){var w,T;if(_===void 0&&(_=h),e.directives&&e.directives.forEach(function(R){R.name.value==="export"&&R.arguments&&R.arguments.forEach(function(O){O.name.value==="as"&&O.value.kind==="StringValue"&&(i.exportedVariables[O.value.value]=_)})}),!e.selectionSet||_==null)return _;var C=(T=(w=e.directives)===null||w===void 0?void 0:w.some(function(R){return R.name.value==="client"}))!==null&&T!==void 0?T:!1;if(Array.isArray(_))return b.resolveSubSelectedArray(e,t||C,_,i);if(e.selectionSet)return b.resolveSelectionSet(e.selectionSet,t||C,_,i)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,n,i){var a=this;return Promise.all(n.map(function(u){if(u===null)return null;if(Array.isArray(u))return a.resolveSubSelectedArray(e,t,u,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,u,i)}))},r.prototype.collectSelectionsToResolve=function(e,t){var n=function(u){return!Array.isArray(u)},i=this.selectionsToResolveCache;function a(u){if(!i.has(u)){var c=new Set;i.set(u,c),Xr(u,{Directive:function(f,h,p,m,y){f.name.value==="client"&&y.forEach(function(g){n(g)&&Im(g)&&c.add(g)})},FragmentSpread:function(f,h,p,m,y){var g=t[f.name.value];ke(g,20,f.name.value);var b=a(g);b.size>0&&(y.forEach(function(k){n(k)&&Im(k)&&c.add(k)}),c.add(f),b.forEach(function(k){c.add(k)}))}})}return i.get(u)}return a(e)},r}(),Tg=!1,Mf=function(){function r(e){var t=this,n;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw qr(16);var i=e.uri,a=e.credentials,u=e.headers,c=e.cache,f=e.documentTransform,h=e.ssrMode,p=h===void 0?!1:h,m=e.ssrForceFetchDelay,y=m===void 0?0:m,g=e.connectToDevTools,b=e.queryDeduplication,k=b===void 0?!0:b,_=e.defaultOptions,w=e.defaultContext,T=e.assumeImmutableResults,C=T===void 0?c.assumeImmutableResults:T,R=e.resolvers,O=e.typeDefs,N=e.fragmentMatcher,V=e.name,D=e.version,U=e.devtools,Y=e.dataMasking,ae=e.link;ae||(ae=i?new Ly({uri:i,credentials:a,headers:u}):jr.empty()),this.link=ae,this.cache=c,this.disableNetworkFetches=p||y>0,this.queryDeduplication=k,this.defaultOptions=_||Object.create(null),this.typeDefs=O,this.devtoolsConfig=F(F({},U),{enabled:(n=U?.enabled)!==null&&n!==void 0?n:g}),this.devtoolsConfig.enabled===void 0&&(this.devtoolsConfig.enabled=globalThis.__DEV__!==!1),y&&setTimeout(function(){return t.disableNetworkFetches=!1},y),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=gl,this.localState=new DO({cache:c,client:this,resolvers:R,fragmentMatcher:N}),this.queryManager=new RO({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:w,documentTransform:f,queryDeduplication:k,ssrMode:p,dataMasking:!!Y,clientAwareness:{name:V,version:D},localState:this.localState,assumeImmutableResults:C,onBroadcast:this.devtoolsConfig.enabled?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),this.devtoolsConfig.enabled&&this.connectToDevTools()}return r.prototype.connectToDevTools=function(){if(!(typeof window>"u")){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this,!Tg&&globalThis.__DEV__!==!1&&(Tg=!0,window.document&&window.top===window.self&&/^(https?|file):$/.test(window.location.protocol)&&setTimeout(function(){if(!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__){var n=window.navigator,i=n&&n.userAgent,a=void 0;typeof i=="string"&&(i.indexOf("Chrome/")>-1?a="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":i.indexOf("Firefox/")>-1&&(a="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),a&&globalThis.__DEV__!==!1&&ke.log("Download the Apollo DevTools for a better development experience: %s",a)}},1e4))}},Object.defineProperty(r.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Yi(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=F(F({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Yi(this.defaultOptions.query,e)),ke(e.fetchPolicy!=="cache-and-network",17),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=F(F({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Yi(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){var t=this,n=this.queryManager.generateQueryId();return this.queryManager.startGraphQLSubscription(e).map(function(i){return F(F({},i),{data:t.queryManager.maskOperation({document:e.query,data:i.data,fetchPolicy:e.fetchPolicy,id:n})})})},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.watchFragment=function(e){var t;return this.cache.watchFragment(F(F({},e),(t={},t[Symbol.for("apollo.dataMasking")]=this.queryManager.dataMasking,t)))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Pu(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(u,c){n.push(c),i.push(u)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(u){globalThis.__DEV__!==!1&&ke.debug(18,u)}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},Object.defineProperty(r.prototype,"defaultContext",{get:function(){return this.queryManager.defaultContext},enumerable:!1,configurable:!0}),r}();globalThis.__DEV__!==!1&&(Mf.prototype.getMemoryInternals=EE);var Lu=new Map,Rf=new Map,Ag=!0,qu=!1;function kg(r){return r.replace(/[\s,]+/g," ").trim()}function FO(r){return kg(r.source.body.substring(r.start,r.end))}function LO(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=FO(n.loc),u=Rf.get(i);u&&!u.has(a)?Ag&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
77
|
-
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
78
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):u||Rf.set(i,u=new Set),u.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),F(F({},r),{definitions:t})}function qO(r){var e=new Set(r.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function jO(r){var e=kg(r);if(!Lu.has(e)){var t=Zx(r,{experimentalFragmentVariables:qu,allowLegacyFragmentVariables:qu});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Lu.set(e,qO(LO(t)))}return Lu.get(e)}function Xi(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var n=r[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=r[a+1]}),jO(n)}function Ig(){Lu.clear(),Rf.clear()}function Cg(){Ag=!1}function Pg(){qu=!0}function Ng(){qu=!1}var lo={gql:Xi,resetCaches:Ig,disableFragmentWarnings:Cg,enableExperimentalFragmentVariables:Pg,disableExperimentalFragmentVariables:Ng};(function(r){r.gql=lo.gql,r.resetCaches=lo.resetCaches,r.disableFragmentWarnings=lo.disableFragmentWarnings,r.enableExperimentalFragmentVariables=lo.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=lo.disableExperimentalFragmentVariables})(Xi||(Xi={})),Xi.default=Xi,lm(globalThis.__DEV__!==!1?"log":"silent");const UO=Object.freeze(Object.defineProperty({__proto__:null,ApolloCache:pf,ApolloClient:Mf,ApolloError:cn,ApolloLink:jr,get Cache(){return mf},DocumentTransform:Su,HttpLink:Ly,InMemoryCache:kf,MissingFieldError:yf,get NetworkStatus(){return dt},Observable:St,ObservableQuery:ra,checkFetcher:My,concat:U1,createHttpLink:lf,createSignalIfSupported:aO,defaultDataIdFromObject:gf,defaultPrinter:uf,disableExperimentalFragmentVariables:Ng,disableFragmentWarnings:Cg,empty:L1,enableExperimentalFragmentVariables:Pg,execute:Pu,fallbackHttpConfig:Ny,from:q1,fromError:Iu,fromPromise:N1,get gql(){return Xi},isApolloError:of,isNetworkRequestSettled:CO,isReference:_t,makeReference:zi,makeVar:og,mergeOptions:Yi,parseAndCheckHttpResponse:Py,resetCaches:Ig,rewriteURIForGET:Dy,selectHttpOptionsAndBody:iO,selectHttpOptionsAndBodyInternal:cf,selectURI:Ry,serializeFetchParameter:Mu,setLogVerbosity:lm,split:j1,throwServerError:af,toPromise:P1},Symbol.toStringTag,{value:"Module"}));var Df={exports:{}},Mg;function $O(){return Mg||(Mg=1,function(r){r.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=void 0,r.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,r.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=void 0,Object.assign(r.exports,ge)}(Df)),Df.exports}var et=$O();const BO=yx({__proto__:null,default:im(et)},[et]);var Rg=mu?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Ff(){ke(!0,54);var r=et.createContext[Rg];return r||(Object.defineProperty(et.createContext,Rg,{value:r=et.createContext({}),enumerable:!1,writable:!1,configurable:!0}),r.displayName="ApolloContext"),r}var VO=function(r){var e=r.client,t=r.children,n=Ff(),i=et.useContext(n),a=et.useMemo(function(){return F(F({},i),{client:e||i.client})},[i,e]);return ke(a.client,55),et.createElement(n.Provider,{value:a},t)};function Dg(r){var e=et.useContext(Ff()),t=r||e.client;return ke(!!t,58),t}var Fg=!1,WO="useSyncExternalStore",zO=BO[WO],Lg=zO||function(r,e,t){var n=e();globalThis.__DEV__!==!1&&!Fg&&n!==e()&&(Fg=!0,globalThis.__DEV__!==!1&&ke.error(68));var i=et.useState({inst:{value:n,getSnapshot:e}}),a=i[0].inst,u=i[1];return Dm?et.useLayoutEffect(function(){Object.assign(a,{value:n,getSnapshot:e}),Lf(a)&&u({inst:a})},[r,n,e]):Object.assign(a,{value:n,getSnapshot:e}),et.useEffect(function(){return Lf(a)&&u({inst:a}),r(function(){Lf(a)&&u({inst:a})})},[r]),n};function Lf(r){var e=r.value,t=r.getSnapshot;try{return e!==t()}catch{return!0}}var ai;(function(r){r[r.Query=0]="Query",r[r.Mutation=1]="Mutation",r[r.Subscription=2]="Subscription"})(ai||(ai={}));var Is;function qg(r){var e;switch(r){case ai.Query:e="Query";break;case ai.Mutation:e="Mutation";break;case ai.Subscription:e="Subscription";break}return e}function jg(r){Is||(Is=new gu(Qn.parser||1e3));var e=Is.get(r);if(e)return e;var t,n,i;ke(!!r&&!!r.kind,70,r);for(var a=[],u=[],c=[],f=[],h=0,p=r.definitions;h<p.length;h++){var m=p[h];if(m.kind==="FragmentDefinition"){a.push(m);continue}if(m.kind==="OperationDefinition")switch(m.operation){case"query":u.push(m);break;case"mutation":c.push(m);break;case"subscription":f.push(m);break}}ke(!a.length||u.length||c.length||f.length,71),ke(u.length+c.length+f.length<=1,72,r,u.length,f.length,c.length),n=u.length?ai.Query:ai.Mutation,!u.length&&!c.length&&(n=ai.Subscription);var y=u.length?u:c.length?c:f;ke(y.length===1,73,r,y.length);var g=y[0];t=g.variableDefinitions||[],g.name&&g.name.kind==="Name"?i=g.name.value:i="data";var b={name:i,type:n,variables:t};return Is.set(r,b),b}jg.resetCache=function(){Is=void 0},globalThis.__DEV__!==!1&&Nl("parser",function(){return Is?Is.size:0});function Ug(r,e){var t=jg(r),n=qg(e),i=qg(t.type);ke(t.type===e,74,n,n,i)}function HO(r,e){var t=et.useRef(void 0);return(!t.current||!xt(t.current.deps,e))&&(t.current={value:r(),deps:e}),t.current.value}var qf=kl?et.useLayoutEffect:et.useEffect,QO=Object.prototype.hasOwnProperty;function $g(){}var ju=Symbol();function GO(r,e,t,n,i){function a(m){var y;Ug(e,ai.Query);var g={client:r,query:e,observable:n&&n.getSSRObservable(i())||ra.inactiveOnCreation.withValue(!n,function(){return r.watchQuery(jf(void 0,r,t,i()))}),resultData:{previousData:(y=m?.resultData.current)===null||y===void 0?void 0:y.data}};return g}var u=et.useState(a),c=u[0],f=u[1];function h(m){var y,g;Object.assign(c.observable,(y={},y[ju]=m,y));var b=c.resultData;f(F(F({},c),{query:m.query,resultData:Object.assign(b,{previousData:((g=b.current)===null||g===void 0?void 0:g.data)||b.previousData,current:void 0})}))}if(r!==c.client||e!==c.query){var p=a(c);return f(p),[p,h]}return[c,h]}function JO(r,e){var t=Dg(e.client),n=et.useContext(Ff()).renderPromises,i=!!n,a=t.disableNetworkFetches,u=e.ssr!==!1&&!e.skip,c=e.partialRefetch,f=Bg(t,r,e,i),h=GO(t,r,e,n,f),p=h[0],m=p.observable,y=p.resultData,g=h[1],b=f(m);ZO(y,m,t,e,b);var k=et.useMemo(function(){return tT(m)},[m]);KO(m,n,u);var _=YO(y,m,t,e,b,a,c,i,{onCompleted:e.onCompleted||$g,onError:e.onError||$g});return{result:_,obsQueryFields:k,observable:m,resultData:y,client:t,onQueryExecuted:g}}function YO(r,e,t,n,i,a,u,c,f){var h=et.useRef(f);et.useEffect(function(){h.current=f});var p=(c||a)&&n.ssr===!1&&!n.skip?zg:n.skip||i.fetchPolicy==="standby"?Hg:void 0,m=r.previousData,y=et.useMemo(function(){return p&&Uu(p,m,e,t)},[t,e,p,m]);return Lg(et.useCallback(function(g){if(c)return function(){};var b=function(){var w=r.current,T=e.getCurrentResult();w&&w.loading===T.loading&&w.networkStatus===T.networkStatus&&xt(w.data,T.data)||Uf(T,r,e,t,u,g,h.current)},k=function(w){if(_.current.unsubscribe(),_.current=e.resubscribeAfterError(b,k),!QO.call(w,"graphQLErrors"))throw w;var T=r.current;(!T||T&&T.loading||!xt(w,T.error))&&Uf({data:T&&T.data,error:w,loading:!1,networkStatus:dt.error},r,e,t,u,g,h.current)},_={current:e.subscribe(b,k)};return function(){setTimeout(function(){return _.current.unsubscribe()})}},[a,c,e,r,u,t]),function(){return y||Vg(r,e,h.current,u,t)},function(){return y||Vg(r,e,h.current,u,t)})}function KO(r,e,t){e&&t&&(e.registerSSRObservable(r),r.getCurrentResult().loading&&e.addObservableQueryPromise(r))}function ZO(r,e,t,n,i){var a;e[ju]&&!xt(e[ju],i)&&(e.reobserve(jf(e,t,n,i)),r.previousData=((a=r.current)===null||a===void 0?void 0:a.data)||r.previousData,r.current=void 0),e[ju]=i}function Bg(r,e,t,n){t===void 0&&(t={});var i=t.skip;t.ssr,t.onCompleted,t.onError;var a=t.defaultOptions,u=Zr(t,["skip","ssr","onCompleted","onError","defaultOptions"]);return function(c){var f=Object.assign(u,{query:e});return n&&(f.fetchPolicy==="network-only"||f.fetchPolicy==="cache-and-network")&&(f.fetchPolicy="cache-first"),f.variables||(f.variables={}),i?(f.initialFetchPolicy=f.initialFetchPolicy||f.fetchPolicy||$f(a,r.defaultOptions),f.fetchPolicy="standby"):f.fetchPolicy||(f.fetchPolicy=c?.options.initialFetchPolicy||$f(a,r.defaultOptions)),f}}function jf(r,e,t,n){var i=[],a=e.defaultOptions.watchQuery;return a&&i.push(a),t.defaultOptions&&i.push(t.defaultOptions),i.push(Ji(r&&r.options,n)),i.reduce(Yi)}function Uf(r,e,t,n,i,a,u){var c=e.current;c&&c.data&&(e.previousData=c.data),!r.error&&un(r.errors)&&(r.error=new cn({graphQLErrors:r.errors})),e.current=Uu(eT(r,t,i),e.previousData,t,n),a(),XO(r,c?.networkStatus,u)}function XO(r,e,t){if(!r.loading){var n=Wg(r);Promise.resolve().then(function(){n?t.onError(n):r.data&&e!==r.networkStatus&&r.networkStatus===dt.ready&&t.onCompleted(r.data)}).catch(function(i){globalThis.__DEV__!==!1&&ke.warn(i)})}}function Vg(r,e,t,n,i){return r.current||Uf(e.getCurrentResult(),r,e,i,n,function(){},t),r.current}function $f(r,e){var t;return r?.fetchPolicy||((t=e?.watchQuery)===null||t===void 0?void 0:t.fetchPolicy)||"cache-first"}function Wg(r){return un(r.errors)?new cn({graphQLErrors:r.errors}):r.error}function Uu(r,e,t,n){var i=r.data;r.partial;var a=Zr(r,["data","partial"]),u=F(F({data:i},a),{client:n,observable:t,variables:t.variables,called:r!==zg&&r!==Hg,previousData:e});return u}function eT(r,e,t){return r.partial&&t&&!r.loading&&(!r.data||Object.keys(r.data).length===0)&&e.options.fetchPolicy!=="cache-only"?(e.refetch(),F(F({},r),{loading:!0,networkStatus:dt.refetch})):r}var zg=Ts({loading:!0,data:void 0,error:void 0,networkStatus:dt.loading}),Hg=Ts({loading:!1,data:void 0,error:void 0,networkStatus:dt.ready});function tT(r){return{refetch:r.refetch.bind(r),reobserve:r.reobserve.bind(r),fetchMore:r.fetchMore.bind(r),updateQuery:r.updateQuery.bind(r),startPolling:r.startPolling.bind(r),stopPolling:r.stopPolling.bind(r),subscribeToMore:r.subscribeToMore.bind(r)}}var rT=["refetch","reobserve","fetchMore","updateQuery","startPolling","stopPolling","subscribeToMore"];function nT(r,e){var t,n=et.useRef(void 0),i=et.useRef(void 0),a=et.useRef(void 0),u=Yi(e,n.current||{}),c=(t=u?.query)!==null&&t!==void 0?t:r;i.current=e,a.current=c;var f=F(F({},u),{skip:!n.current}),h=JO(c,f),p=h.obsQueryFields,m=h.result,y=h.client,g=h.resultData,b=h.observable,k=h.onQueryExecuted,_=b.options.initialFetchPolicy||$f(f.defaultOptions,y.defaultOptions),w=et.useReducer(function(D){return D+1},0)[1],T=et.useMemo(function(){for(var D={},U=function(Se){var se=p[Se];D[Se]=function(){return n.current||(n.current=Object.create(null),w()),se.apply(this,arguments)}},Y=0,ae=rT;Y<ae.length;Y++){var re=ae[Y];U(re)}return D},[w,p]),C=!!n.current,R=et.useMemo(function(){return F(F(F({},m),T),{called:C})},[m,T,C]),O=et.useCallback(function(D){n.current=D?F(F({},D),{fetchPolicy:D.fetchPolicy||_}):{fetchPolicy:_};var U=Yi(i.current,F({query:a.current},n.current)),Y=iT(g,b,y,c,F(F({},U),{skip:!1}),k).then(function(ae){return Object.assign(ae,T)});return Y.catch(function(){}),Y},[y,c,T,_,b,g,k]),N=et.useRef(O);qf(function(){N.current=O});var V=et.useCallback(function(){for(var D=[],U=0;U<arguments.length;U++)D[U]=arguments[U];return N.current.apply(N,D)},[]);return[V,R]}function iT(r,e,t,n,i,a){var u=i.query||n,c=Bg(t,u,i,!1)(e),f=e.reobserveAsConcast(jf(e,t,i,c));return a(c),new Promise(function(h){var p;f.subscribe({next:function(m){p=m},error:function(){h(Uu(e.getCurrentResult(),r.previousData,e,t))},complete:function(){h(Uu(e.maskResult(p),r.previousData,e,t))}})})}function sT(r,e){e===void 0&&(e=Object.create(null));var t=et.useRef(!1),n=Dg(e.client);Ug(r,ai.Subscription),t.current||(t.current=!0,e.onSubscriptionData&&globalThis.__DEV__!==!1&&ke.warn(e.onData?61:62),e.onSubscriptionComplete&&globalThis.__DEV__!==!1&&ke.warn(e.onComplete?63:64));var i=e.skip,a=e.fetchPolicy,u=e.errorPolicy,c=e.shouldResubscribe,f=e.context,h=e.extensions,p=e.ignoreResults,m=HO(function(){return e.variables},[e.variables]),y=function(){return aT(n,r,m,a,u,f,h)},g=et.useState(e.skip?null:y),b=g[0],k=g[1],_=et.useRef(y);qf(function(){_.current=y}),i?b&&k(b=null):(!b||(n!==b.__.client||r!==b.__.query||a!==b.__.fetchPolicy||u!==b.__.errorPolicy||!xt(m,b.__.variables))&&(typeof c=="function"?!!c(e):c)!==!1)&&k(b=y());var w=et.useRef(e);et.useEffect(function(){w.current=e});var T=!i&&!p,C=et.useMemo(function(){return{loading:T,error:void 0,data:void 0,variables:m}},[T,m]),R=et.useRef(p);qf(function(){R.current=p});var O=Lg(et.useCallback(function(V){if(!b)return function(){};var D=!1,U=b.__.variables,Y=b.__.client,ae=b.subscribe({next:function(re){var Se,se;if(!D){var ve={loading:!1,data:re.data,error:Wg(re),variables:U};b.__.setResult(ve),R.current||V(),ve.error?(se=(Se=w.current).onError)===null||se===void 0||se.call(Se,ve.error):w.current.onData?w.current.onData({client:Y,data:ve}):w.current.onSubscriptionData&&w.current.onSubscriptionData({client:Y,subscriptionData:ve})}},error:function(re){var Se,se;re=re instanceof cn?re:new cn({protocolErrors:[re]}),D||(b.__.setResult({loading:!1,data:void 0,error:re,variables:U}),R.current||V(),(se=(Se=w.current).onError)===null||se===void 0||se.call(Se,re))},complete:function(){D||(w.current.onComplete?w.current.onComplete():w.current.onSubscriptionComplete&&w.current.onSubscriptionComplete())}});return function(){D=!0,setTimeout(function(){ae.unsubscribe()})}},[b]),function(){return b&&!i&&!p?b.__.result:C},function(){return C}),N=et.useCallback(function(){ke(!w.current.skip,65),k(_.current())},[w,_]);return et.useMemo(function(){return F(F({},O),{restart:N})},[O,N])}function aT(r,e,t,n,i,a,u){var c={query:e,variables:t,fetchPolicy:n,errorPolicy:i,context:a,extensions:u},f=F(F({},c),{client:r,result:{loading:!0,data:void 0,error:void 0,variables:t},setResult:function(p){f.result=p}}),h=null;return Object.assign(new St(function(p){h||(h=r.subscribe(c));var m=h.subscribe(p);return function(){return m.unsubscribe()}}),{__:f})}class Cs extends Error{}class oT extends Cs{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class uT extends Cs{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class cT extends Cs{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class ia extends Cs{}class Qg extends Cs{constructor(e){super(`Invalid unit ${e}`)}}class Nr extends Cs{}class es extends Cs{constructor(){super("Zone is an abstract class")}}const Ie="numeric",Gn="short",ln="long",$u={year:Ie,month:Ie,day:Ie},Gg={year:Ie,month:Gn,day:Ie},lT={year:Ie,month:Gn,day:Ie,weekday:Gn},Jg={year:Ie,month:ln,day:Ie},Yg={year:Ie,month:ln,day:Ie,weekday:ln},Kg={hour:Ie,minute:Ie},Zg={hour:Ie,minute:Ie,second:Ie},Xg={hour:Ie,minute:Ie,second:Ie,timeZoneName:Gn},ev={hour:Ie,minute:Ie,second:Ie,timeZoneName:ln},tv={hour:Ie,minute:Ie,hourCycle:"h23"},rv={hour:Ie,minute:Ie,second:Ie,hourCycle:"h23"},nv={hour:Ie,minute:Ie,second:Ie,hourCycle:"h23",timeZoneName:Gn},iv={hour:Ie,minute:Ie,second:Ie,hourCycle:"h23",timeZoneName:ln},sv={year:Ie,month:Ie,day:Ie,hour:Ie,minute:Ie},av={year:Ie,month:Ie,day:Ie,hour:Ie,minute:Ie,second:Ie},ov={year:Ie,month:Gn,day:Ie,hour:Ie,minute:Ie},uv={year:Ie,month:Gn,day:Ie,hour:Ie,minute:Ie,second:Ie},fT={year:Ie,month:Gn,day:Ie,weekday:Gn,hour:Ie,minute:Ie},cv={year:Ie,month:ln,day:Ie,hour:Ie,minute:Ie,timeZoneName:Gn},lv={year:Ie,month:ln,day:Ie,hour:Ie,minute:Ie,second:Ie,timeZoneName:Gn},fv={year:Ie,month:ln,day:Ie,weekday:ln,hour:Ie,minute:Ie,timeZoneName:ln},hv={year:Ie,month:ln,day:Ie,weekday:ln,hour:Ie,minute:Ie,second:Ie,timeZoneName:ln};class fo{get type(){throw new es}get name(){throw new es}get ianaName(){return this.name}get isUniversal(){throw new es}offsetName(e,t){throw new es}formatOffset(e,t){throw new es}offset(e){throw new es}equals(e){throw new es}get isValid(){throw new es}}let Bf=null;class Bu extends fo{static get instance(){return Bf===null&&(Bf=new Bu),Bf}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return qv(e,t,n)}formatOffset(e,t){return yo(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Vf=new Map;function hT(r){let e=Vf.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Vf.set(r,e)),e}const dT={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function pT(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,a,u,c,f,h,p]=n;return[u,i,a,c,f,h,p]}function mT(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:a,value:u}=t[i],c=dT[a];a==="era"?n[c]=u:Je(c)||(n[c]=parseInt(u,10))}return n}const Wf=new Map;class wi extends fo{static create(e){let t=Wf.get(e);return t===void 0&&Wf.set(e,t=new wi(e)),t}static resetCache(){Wf.clear(),Vf.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=wi.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return qv(e,t,n,this.name)}formatOffset(e,t){return yo(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=hT(this.name);let[i,a,u,c,f,h,p]=n.formatToParts?mT(n,t):pT(n,t);c==="BC"&&(i=-Math.abs(i)+1);const y=Qu({year:i,month:a,day:u,hour:f===24?0:f,minute:h,second:p,millisecond:0});let g=+t;const b=g%1e3;return g-=b>=0?b:1e3+b,(y-g)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let dv={};function yT(r,e={}){const t=JSON.stringify([r,e]);let n=dv[t];return n||(n=new Intl.ListFormat(r,e),dv[t]=n),n}const zf=new Map;function Hf(r,e={}){const t=JSON.stringify([r,e]);let n=zf.get(t);return n===void 0&&(n=new Intl.DateTimeFormat(r,e),zf.set(t,n)),n}const Qf=new Map;function gT(r,e={}){const t=JSON.stringify([r,e]);let n=Qf.get(t);return n===void 0&&(n=new Intl.NumberFormat(r,e),Qf.set(t,n)),n}const Gf=new Map;function vT(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let a=Gf.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(r,e),Gf.set(i,a)),a}let ho=null;function bT(){return ho||(ho=new Intl.DateTimeFormat().resolvedOptions().locale,ho)}const Jf=new Map;function pv(r){let e=Jf.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),Jf.set(r,e)),e}const Yf=new Map;function wT(r){let e=Yf.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...mv,...e}),Yf.set(r,e)}return e}function _T(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let n,i;try{n=Hf(r).resolvedOptions(),i=r}catch{const f=r.substring(0,t);n=Hf(f).resolvedOptions(),i=f}const{numberingSystem:a,calendar:u}=n;return[i,a,u]}}function ST(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function xT(r){const e=[];for(let t=1;t<=12;t++){const n=Ke.utc(2009,t,1);e.push(r(n))}return e}function ET(r){const e=[];for(let t=1;t<=7;t++){const n=Ke.utc(2016,11,13+t);e.push(r(n))}return e}function Vu(r,e,t,n){const i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function OT(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||pv(r.locale).numberingSystem==="latn"}class TT{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:i,floor:a,...u}=n;if(!t||Object.keys(u).length>0){const c={useGrouping:!1,...n};n.padTo>0&&(c.minimumIntegerDigits=n.padTo),this.inf=gT(e,c)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):sh(e,3);return fr(t,this.padTo)}}}class AT{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const u=-1*(e.offset/60),c=u>=0?`Etc/GMT+${u}`:`Etc/GMT${u}`;e.offset!==0&&wi.create(c).valid?(i=c,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const a={...this.opts};a.timeZone=a.timeZone||i,this.dtf=Hf(t,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class kT{constructor(e,t,n){this.opts={style:"long",...n},!t&&Rv()&&(this.rtf=vT(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):YT(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const mv={firstDay:1,minimalDays:4,weekend:[6,7]};class At{static fromOpts(e){return At.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,i,a=!1){const u=e||er.defaultLocale,c=u||(a?"en-US":bT()),f=t||er.defaultNumberingSystem,h=n||er.defaultOutputCalendar,p=nh(i)||er.defaultWeekSettings;return new At(c,f,h,p,u)}static resetCache(){ho=null,zf.clear(),Qf.clear(),Gf.clear(),Jf.clear(),Yf.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:i}={}){return At.create(e,t,n,i)}constructor(e,t,n,i,a){const[u,c,f]=_T(e);this.locale=u,this.numberingSystem=t||c||null,this.outputCalendar=n||f||null,this.weekSettings=i,this.intl=ST(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=OT(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:At.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,nh(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Vu(this,e,$v,()=>{const n=this.intl==="ja"||this.intl.startsWith("ja-");t&=!n;const i=t?{month:e,day:"numeric"}:{month:e},a=t?"format":"standalone";if(!this.monthsCache[a][e]){const u=n?c=>this.dtFormatter(c,i).format():c=>this.extract(c,i,"month");this.monthsCache[a][e]=xT(u)}return this.monthsCache[a][e]})}weekdays(e,t=!1){return Vu(this,e,Wv,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=ET(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Vu(this,void 0,()=>zv,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ke.utc(2016,11,13,9),Ke.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Vu(this,e,Hv,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ke.utc(-40,1,1),Ke.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const i=this.dtFormatter(e,t),a=i.formatToParts(),u=a.find(c=>c.type.toLowerCase()===n);return u?u.value:null}numberFormatter(e={}){return new TT(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new AT(e,this.intl,t)}relFormatter(e={}){return new kT(this.intl,this.isEnglish(),e)}listFormatter(e={}){return yT(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||pv(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Dv()?wT(this.locale):mv}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Kf=null;class Ur extends fo{static get utcInstance(){return Kf===null&&(Kf=new Ur(0)),Kf}static instance(e){return e===0?Ur.utcInstance:new Ur(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Ur(Gu(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${yo(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${yo(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return yo(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class IT extends fo{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function ts(r,e){if(Je(r)||r===null)return e;if(r instanceof fo)return r;if(DT(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Bu.instance:t==="utc"||t==="gmt"?Ur.utcInstance:Ur.parseSpecifier(t)||wi.create(r)}else return rs(r)?Ur.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new IT(r)}const Zf={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},yv={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},CT=Zf.hanidec.replace(/[\[|\]]/g,"").split("");function PT(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const n=r.charCodeAt(t);if(r[t].search(Zf.hanidec)!==-1)e+=CT.indexOf(r[t]);else for(const i in yv){const[a,u]=yv[i];n>=a&&n<=u&&(e+=n-a)}}return parseInt(e,10)}else return e}const Xf=new Map;function NT(){Xf.clear()}function Jn({numberingSystem:r},e=""){const t=r||"latn";let n=Xf.get(t);n===void 0&&(n=new Map,Xf.set(t,n));let i=n.get(e);return i===void 0&&(i=new RegExp(`${Zf[t]}${e}`),n.set(e,i)),i}let gv=()=>Date.now(),vv="system",bv=null,wv=null,_v=null,Sv=60,xv,Ev=null;class er{static get now(){return gv}static set now(e){gv=e}static set defaultZone(e){vv=e}static get defaultZone(){return ts(vv,Bu.instance)}static get defaultLocale(){return bv}static set defaultLocale(e){bv=e}static get defaultNumberingSystem(){return wv}static set defaultNumberingSystem(e){wv=e}static get defaultOutputCalendar(){return _v}static set defaultOutputCalendar(e){_v=e}static get defaultWeekSettings(){return Ev}static set defaultWeekSettings(e){Ev=nh(e)}static get twoDigitCutoffYear(){return Sv}static set twoDigitCutoffYear(e){Sv=e%100}static get throwOnInvalid(){return xv}static set throwOnInvalid(e){xv=e}static resetCaches(){At.resetCache(),wi.resetCache(),Ke.resetCache(),NT()}}class Yn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Ov=[0,31,59,90,120,151,181,212,243,273,304,334],Tv=[0,31,60,91,121,152,182,213,244,274,305,335];function On(r,e){return new Yn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function eh(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return i===0?7:i}function Av(r,e,t){return t+(po(r)?Tv:Ov)[e-1]}function kv(r,e){const t=po(r)?Tv:Ov,n=t.findIndex(a=>a<e),i=e-t[n];return{month:n+1,day:i}}function th(r,e){return(r-e+7)%7+1}function Wu(r,e=4,t=1){const{year:n,month:i,day:a}=r,u=Av(n,i,a),c=th(eh(n,i,a),t);let f=Math.floor((u-c+14-e)/7),h;return f<1?(h=n-1,f=mo(h,e,t)):f>mo(n,e,t)?(h=n+1,f=1):h=n,{weekYear:h,weekNumber:f,weekday:c,...Yu(r)}}function Iv(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:a}=r,u=th(eh(n,1,e),t),c=aa(n);let f=i*7+a-u-7+e,h;f<1?(h=n-1,f+=aa(h)):f>c?(h=n+1,f-=aa(n)):h=n;const{month:p,day:m}=kv(h,f);return{year:h,month:p,day:m,...Yu(r)}}function rh(r){const{year:e,month:t,day:n}=r,i=Av(e,t,n);return{year:e,ordinal:i,...Yu(r)}}function Cv(r){const{year:e,ordinal:t}=r,{month:n,day:i}=kv(e,t);return{year:e,month:n,day:i,...Yu(r)}}function Pv(r,e){if(!Je(r.localWeekday)||!Je(r.localWeekNumber)||!Je(r.localWeekYear)){if(!Je(r.weekday)||!Je(r.weekNumber)||!Je(r.weekYear))throw new ia("Cannot mix locale-based week fields with ISO-based week fields");return Je(r.localWeekday)||(r.weekday=r.localWeekday),Je(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),Je(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function MT(r,e=4,t=1){const n=zu(r.weekYear),i=Tn(r.weekNumber,1,mo(r.weekYear,e,t)),a=Tn(r.weekday,1,7);return n?i?a?!1:On("weekday",r.weekday):On("week",r.weekNumber):On("weekYear",r.weekYear)}function RT(r){const e=zu(r.year),t=Tn(r.ordinal,1,aa(r.year));return e?t?!1:On("ordinal",r.ordinal):On("year",r.year)}function Nv(r){const e=zu(r.year),t=Tn(r.month,1,12),n=Tn(r.day,1,Hu(r.year,r.month));return e?t?n?!1:On("day",r.day):On("month",r.month):On("year",r.year)}function Mv(r){const{hour:e,minute:t,second:n,millisecond:i}=r,a=Tn(e,0,23)||e===24&&t===0&&n===0&&i===0,u=Tn(t,0,59),c=Tn(n,0,59),f=Tn(i,0,999);return a?u?c?f?!1:On("millisecond",i):On("second",n):On("minute",t):On("hour",e)}function Je(r){return typeof r>"u"}function rs(r){return typeof r=="number"}function zu(r){return typeof r=="number"&&r%1===0}function DT(r){return typeof r=="string"}function FT(r){return Object.prototype.toString.call(r)==="[object Date]"}function Rv(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Dv(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function LT(r){return Array.isArray(r)?r:[r]}function Fv(r,e,t){if(r.length!==0)return r.reduce((n,i)=>{const a=[e(i),i];return n&&t(n[0],a[0])===n[0]?n:a},null)[1]}function qT(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function sa(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function nh(r){if(r==null)return null;if(typeof r!="object")throw new Nr("Week settings must be an object");if(!Tn(r.firstDay,1,7)||!Tn(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Tn(e,1,7)))throw new Nr("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Tn(r,e,t){return zu(r)&&r>=e&&r<=t}function jT(r,e){return r-e*Math.floor(r/e)}function fr(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function ns(r){if(!(Je(r)||r===null||r===""))return parseInt(r,10)}function Ps(r){if(!(Je(r)||r===null||r===""))return parseFloat(r)}function ih(r){if(!(Je(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function sh(r,e,t="round"){const n=10**e;switch(t){case"expand":return r>0?Math.ceil(r*n)/n:Math.floor(r*n)/n;case"trunc":return Math.trunc(r*n)/n;case"round":return Math.round(r*n)/n;case"floor":return Math.floor(r*n)/n;case"ceil":return Math.ceil(r*n)/n;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function po(r){return r%4===0&&(r%100!==0||r%400===0)}function aa(r){return po(r)?366:365}function Hu(r,e){const t=jT(e-1,12)+1,n=r+(e-t)/12;return t===2?po(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Qu(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function Lv(r,e,t){return-th(eh(r,1,e),t)+e-1}function mo(r,e=4,t=1){const n=Lv(r,e,t),i=Lv(r+1,e,t);return(aa(r)-n+i)/7}function ah(r){return r>99?r:r>er.twoDigitCutoffYear?1900+r:2e3+r}function qv(r,e,t,n=null){const i=new Date(r),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);const u={timeZoneName:e,...a},c=new Intl.DateTimeFormat(t,u).formatToParts(i).find(f=>f.type.toLowerCase()==="timezonename");return c?c.value:null}function Gu(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-n:n;return t*60+i}function jv(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new Nr(`Invalid unit value ${r}`);return e}function Ju(r,e){const t={};for(const n in r)if(sa(r,n)){const i=r[n];if(i==null)continue;t[e(n)]=jv(i)}return t}function yo(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),i=r>=0?"+":"-";switch(e){case"short":return`${i}${fr(t,2)}:${fr(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${fr(t,2)}${fr(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Yu(r){return qT(r,["hour","minute","second","millisecond"])}const UT=["January","February","March","April","May","June","July","August","September","October","November","December"],Uv=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$T=["J","F","M","A","M","J","J","A","S","O","N","D"];function $v(r){switch(r){case"narrow":return[...$T];case"short":return[...Uv];case"long":return[...UT];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Bv=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Vv=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],BT=["M","T","W","T","F","S","S"];function Wv(r){switch(r){case"narrow":return[...BT];case"short":return[...Vv];case"long":return[...Bv];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const zv=["AM","PM"],VT=["Before Christ","Anno Domini"],WT=["BC","AD"],zT=["B","A"];function Hv(r){switch(r){case"narrow":return[...zT];case"short":return[...WT];case"long":return[...VT];default:return null}}function HT(r){return zv[r.hour<12?0:1]}function QT(r,e){return Wv(e)[r.weekday-1]}function GT(r,e){return $v(e)[r.month-1]}function JT(r,e){return Hv(e)[r.year<0?0:1]}function YT(r,e,t="always",n=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&a){const m=r==="days";switch(e){case 1:return m?"tomorrow":`next ${i[r][0]}`;case-1:return m?"yesterday":`last ${i[r][0]}`;case 0:return m?"today":`this ${i[r][0]}`}}const u=Object.is(e,-0)||e<0,c=Math.abs(e),f=c===1,h=i[r],p=n?f?h[1]:h[2]||h[1]:f?i[r][0]:r;return u?`${c} ${p} ago`:`in ${c} ${p}`}function Qv(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const KT={D:$u,DD:Gg,DDD:Jg,DDDD:Yg,t:Kg,tt:Zg,ttt:Xg,tttt:ev,T:tv,TT:rv,TTT:nv,TTTT:iv,f:sv,ff:ov,fff:cv,ffff:fv,F:av,FF:uv,FFF:lv,FFFF:hv};class Mr{static create(e,t={}){return new Mr(e,t)}static parseFormat(e){let t=null,n="",i=!1;const a=[];for(let u=0;u<e.length;u++){const c=e.charAt(u);c==="'"?((n.length>0||i)&&a.push({literal:i||/^\s+$/.test(n),val:n===""?"'":n}),t=null,n="",i=!i):i||c===t?n+=c:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=c,t=c)}return n.length>0&&a.push({literal:i||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(e){return KT[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return fr(e,t);const i={...this.opts};return t>0&&(i.padTo=t),n&&(i.signDisplay=n),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(g,b)=>this.loc.extract(e,g,b),u=g=>e.isOffsetFixed&&e.offset===0&&g.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,g.format):"",c=()=>n?HT(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),f=(g,b)=>n?GT(e,g):a(b?{month:g}:{month:g,day:"numeric"},"month"),h=(g,b)=>n?QT(e,g):a(b?{weekday:g}:{weekday:g,month:"long",day:"numeric"},"weekday"),p=g=>{const b=Mr.macroTokenToFormatOpts(g);return b?this.formatWithSystemDefault(e,b):g},m=g=>n?JT(e,g):a({era:g},"era"),y=g=>{switch(g){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return u({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return u({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return u({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return c();case"d":return i?a({day:"numeric"},"day"):this.num(e.day);case"dd":return i?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return h("short",!0);case"cccc":return h("long",!0);case"ccccc":return h("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return h("short",!1);case"EEEE":return h("long",!1);case"EEEEE":return h("narrow",!1);case"L":return i?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return f("short",!0);case"LLLL":return f("long",!0);case"LLLLL":return f("narrow",!0);case"M":return i?a({month:"numeric"},"month"):this.num(e.month);case"MM":return i?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return f("short",!1);case"MMMM":return f("long",!1);case"MMMMM":return f("narrow",!1);case"y":return i?a({year:"numeric"},"year"):this.num(e.year);case"yy":return i?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return m("short");case"GG":return m("long");case"GGGGG":return m("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return p(g)}};return Qv(Mr.parseFormat(t),y)}formatDurationFromString(e,t){const n=this.opts.signMode==="negativeLargestOnly"?-1:1,i=p=>{switch(p[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},a=(p,m)=>y=>{const g=i(y);if(g){const b=m.isNegativeDuration&&g!==m.largestUnit?n:1;let k;return this.opts.signMode==="negativeLargestOnly"&&g!==m.largestUnit?k="never":this.opts.signMode==="all"?k="always":k="auto",this.num(p.get(g)*b,y.length,k)}else return y},u=Mr.parseFormat(t),c=u.reduce((p,{literal:m,val:y})=>m?p:p.concat(y),[]),f=e.shiftTo(...c.map(i).filter(p=>p)),h={isNegativeDuration:f<0,largestUnit:Object.keys(f.values)[0]};return Qv(u,a(f,h))}}const Gv=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function oa(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function ua(...r){return e=>r.reduce(([t,n,i],a)=>{const[u,c,f]=a(e,i);return[{...t,...u},c||n,f]},[{},null,1]).slice(0,2)}function ca(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const i=t.exec(r);if(i)return n(i)}return[null,null]}function Jv(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=ns(e[t+i]);return[n,null,t+i]}}const Yv=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ZT=`(?:${Yv.source}?(?:\\[(${Gv.source})\\])?)?`,oh=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Kv=RegExp(`${oh.source}${ZT}`),uh=RegExp(`(?:[Tt]${Kv.source})?`),XT=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,eA=/(\d{4})-?W(\d\d)(?:-?(\d))?/,tA=/(\d{4})-?(\d{3})/,rA=Jv("weekYear","weekNumber","weekDay"),nA=Jv("year","ordinal"),iA=/(\d{4})-(\d\d)-(\d\d)/,Zv=RegExp(`${oh.source} ?(?:${Yv.source}|(${Gv.source}))?`),sA=RegExp(`(?: ${Zv.source})?`);function la(r,e,t){const n=r[e];return Je(n)?t:ns(n)}function aA(r,e){return[{year:la(r,e),month:la(r,e+1,1),day:la(r,e+2,1)},null,e+3]}function fa(r,e){return[{hours:la(r,e,0),minutes:la(r,e+1,0),seconds:la(r,e+2,0),milliseconds:ih(r[e+3])},null,e+4]}function go(r,e){const t=!r[e]&&!r[e+1],n=Gu(r[e+1],r[e+2]),i=t?null:Ur.instance(n);return[{},i,e+3]}function vo(r,e){const t=r[e]?wi.create(r[e]):null;return[{},t,e+1]}const oA=RegExp(`^T?${oh.source}$`),uA=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function cA(r){const[e,t,n,i,a,u,c,f,h]=r,p=e[0]==="-",m=f&&f[0]==="-",y=(g,b=!1)=>g!==void 0&&(b||g&&p)?-g:g;return[{years:y(Ps(t)),months:y(Ps(n)),weeks:y(Ps(i)),days:y(Ps(a)),hours:y(Ps(u)),minutes:y(Ps(c)),seconds:y(Ps(f),f==="-0"),milliseconds:y(ih(h),m)}]}const lA={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function ch(r,e,t,n,i,a,u){const c={year:e.length===2?ah(ns(e)):ns(e),month:Uv.indexOf(t)+1,day:ns(n),hour:ns(i),minute:ns(a)};return u&&(c.second=ns(u)),r&&(c.weekday=r.length>3?Bv.indexOf(r)+1:Vv.indexOf(r)+1),c}const fA=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function hA(r){const[,e,t,n,i,a,u,c,f,h,p,m]=r,y=ch(e,i,n,t,a,u,c);let g;return f?g=lA[f]:h?g=0:g=Gu(p,m),[y,new Ur(g)]}function dA(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const pA=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,mA=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,yA=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Xv(r){const[,e,t,n,i,a,u,c]=r;return[ch(e,i,n,t,a,u,c),Ur.utcInstance]}function gA(r){const[,e,t,n,i,a,u,c]=r;return[ch(e,c,t,n,i,a,u),Ur.utcInstance]}const vA=oa(XT,uh),bA=oa(eA,uh),wA=oa(tA,uh),_A=oa(Kv),e0=ua(aA,fa,go,vo),SA=ua(rA,fa,go,vo),xA=ua(nA,fa,go,vo),EA=ua(fa,go,vo);function OA(r){return ca(r,[vA,e0],[bA,SA],[wA,xA],[_A,EA])}function TA(r){return ca(dA(r),[fA,hA])}function AA(r){return ca(r,[pA,Xv],[mA,Xv],[yA,gA])}function kA(r){return ca(r,[uA,cA])}const IA=ua(fa);function CA(r){return ca(r,[oA,IA])}const PA=oa(iA,sA),NA=oa(Zv),MA=ua(fa,go,vo);function RA(r){return ca(r,[PA,e0],[NA,MA])}const t0="Invalid Duration",r0={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},DA={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...r0},An=146097/400,ha=146097/4800,FA={years:{quarters:4,months:12,weeks:An/7,days:An,hours:An*24,minutes:An*24*60,seconds:An*24*60*60,milliseconds:An*24*60*60*1e3},quarters:{months:3,weeks:An/28,days:An/4,hours:An*24/4,minutes:An*24*60/4,seconds:An*24*60*60/4,milliseconds:An*24*60*60*1e3/4},months:{weeks:ha/7,days:ha,hours:ha*24,minutes:ha*24*60,seconds:ha*24*60*60,milliseconds:ha*24*60*60*1e3},...r0},Ns=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],LA=Ns.slice(0).reverse();function _i(r,e,t=!1){const n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new vt(n)}function n0(r,e){let t=e.milliseconds??0;for(const n of LA.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function i0(r,e){const t=n0(r,e)<0?-1:1;Ns.reduceRight((n,i)=>{if(Je(e[i]))return n;if(n){const a=e[n]*t,u=r[i][n],c=Math.floor(a/u);e[i]+=c*t,e[n]-=c*u*t}return i},null),Ns.reduce((n,i)=>{if(Je(e[i]))return n;if(n){const a=e[n]%1;e[n]-=a,e[i]+=a*r[n][i]}return i},null)}function s0(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class vt{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?FA:DA;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||At.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return vt.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Nr(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new vt({values:Ju(e,vt.normalizeUnit),loc:At.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(rs(e))return vt.fromMillis(e);if(vt.isDuration(e))return e;if(typeof e=="object")return vt.fromObject(e);throw new Nr(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=kA(e);return n?vt.fromObject(n,t):vt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=CA(e);return n?vt.fromObject(n,t):vt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Nr("need to specify a reason the Duration is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(er.throwOnInvalid)throw new cT(n);return new vt({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Qg(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Mr.create(this.loc,n).formatDurationFromString(this,e):t0}toHuman(e={}){if(!this.isValid)return t0;const t=e.showZeros!==!1,n=Ns.map(i=>{const a=this.values[i];return Je(a)||a===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(a)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=sh(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},Ke.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?n0(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=vt.fromDurationLike(e),n={};for(const i of Ns)(sa(t.values,i)||sa(this.values,i))&&(n[i]=t.get(i)+this.get(i));return _i(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=vt.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=jv(e(this.values[n],n));return _i(this,{values:t},!0)}get(e){return this[vt.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Ju(e,vt.normalizeUnit)};return _i(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:i}={}){const u={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:n};return _i(this,u)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return i0(this.matrix,e),_i(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=s0(this.normalize().shiftToAll().toObject());return _i(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(u=>vt.normalizeUnit(u));const t={},n={},i=this.toObject();let a;for(const u of Ns)if(e.indexOf(u)>=0){a=u;let c=0;for(const h in n)c+=this.matrix[h][u]*n[h],n[h]=0;rs(i[u])&&(c+=i[u]);const f=Math.trunc(c);t[u]=f,n[u]=(c*1e3-f*1e3)/1e3}else rs(i[u])&&(n[u]=i[u]);for(const u in n)n[u]!==0&&(t[a]+=u===a?n[u]:n[u]/this.matrix[a][u]);return i0(this.matrix,t),_i(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return _i(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=s0(this.values);return _i(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(const n of Ns)if(!t(this.values[n],e.values[n]))return!1;return!0}}const da="Invalid Interval";function qA(r,e){return!r||!r.isValid?tr.invalid("missing or invalid start"):!e||!e.isValid?tr.invalid("missing or invalid end"):e<r?tr.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}class tr{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Nr("need to specify a reason the Interval is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(er.throwOnInvalid)throw new uT(n);return new tr({invalid:n})}static fromDateTimes(e,t){const n=_o(e),i=_o(t),a=qA(n,i);return a??new tr({start:n,end:i})}static after(e,t){const n=vt.fromDurationLike(t),i=_o(e);return tr.fromDateTimes(i,i.plus(n))}static before(e,t){const n=vt.fromDurationLike(t),i=_o(e);return tr.fromDateTimes(i.minus(n),i)}static fromISO(e,t){const[n,i]=(e||"").split("/",2);if(n&&i){let a,u;try{a=Ke.fromISO(n,t),u=a.isValid}catch{u=!1}let c,f;try{c=Ke.fromISO(i,t),f=c.isValid}catch{f=!1}if(u&&f)return tr.fromDateTimes(a,c);if(u){const h=vt.fromISO(i,t);if(h.isValid)return tr.after(a,h)}else if(f){const h=vt.fromISO(n,t);if(h.isValid)return tr.before(c,h)}}return tr.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(n,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?tr.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(_o).filter(u=>this.contains(u)).sort((u,c)=>u.toMillis()-c.toMillis()),n=[];let{s:i}=this,a=0;for(;i<this.e;){const u=t[a]||this.e,c=+u>+this.e?this.e:u;n.push(tr.fromDateTimes(i,c)),i=c,a+=1}return n}splitBy(e){const t=vt.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,i=1,a;const u=[];for(;n<this.e;){const c=this.start.plus(t.mapUnits(f=>f*i));a=+c>+this.e?this.e:c,u.push(tr.fromDateTimes(n,a)),n=a,i+=1}return u}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:tr.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return tr.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((i,a)=>i.s-a.s).reduce(([i,a],u)=>a?a.overlaps(u)||a.abutsStart(u)?[i,a.union(u)]:[i.concat([a]),u]:[i,u],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const i=[],a=e.map(f=>[{time:f.s,type:"s"},{time:f.e,type:"e"}]),u=Array.prototype.concat(...a),c=u.sort((f,h)=>f.time-h.time);for(const f of c)n+=f.type==="s"?1:-1,n===1?t=f.time:(t&&+t!=+f.time&&i.push(tr.fromDateTimes(t,f.time)),t=null);return tr.merge(i)}difference(...e){return tr.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:da}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=$u,t={}){return this.isValid?Mr.create(this.s.loc.clone(t),e).formatInterval(this):da}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:da}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:da}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:da}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:da}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):vt.invalid(this.invalidReason)}mapEndpoints(e){return tr.fromDateTimes(e(this.s),e(this.e))}}class Ku{static hasDST(e=er.defaultZone){const t=Ke.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return wi.isValidZone(e)}static normalizeZone(e){return ts(e,er.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||At.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||At.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||At.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||At.create(t,n,a)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||At.create(t,n,a)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||At.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||At.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return At.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return At.create(t,null,"gregory").eras(e)}static features(){return{relative:Rv(),localeWeek:Dv()}}}function a0(r,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(vt.fromMillis(n).as("days"))}function jA(r,e,t){const n=[["years",(f,h)=>h.year-f.year],["quarters",(f,h)=>h.quarter-f.quarter+(h.year-f.year)*4],["months",(f,h)=>h.month-f.month+(h.year-f.year)*12],["weeks",(f,h)=>{const p=a0(f,h);return(p-p%7)/7}],["days",a0]],i={},a=r;let u,c;for(const[f,h]of n)t.indexOf(f)>=0&&(u=f,i[f]=h(r,e),c=a.plus(i),c>e?(i[f]--,r=a.plus(i),r>e&&(c=r,i[f]--,r=a.plus(i))):r=c);return[r,i,c,u]}function UA(r,e,t,n){let[i,a,u,c]=jA(r,e,t);const f=e-i,h=t.filter(m=>["hours","minutes","seconds","milliseconds"].indexOf(m)>=0);h.length===0&&(u<e&&(u=i.plus({[c]:1})),u!==i&&(a[c]=(a[c]||0)+f/(u-i)));const p=vt.fromObject(a,n);return h.length>0?vt.fromMillis(f,n).shiftTo(...h).plus(p):p}const $A="missing Intl.DateTimeFormat.formatToParts support";function Et(r,e=t=>t){return{regex:r,deser:([t])=>e(PT(t))}}const o0="[ ]",u0=new RegExp(o0,"g");function BA(r){return r.replace(/\./g,"\\.?").replace(u0,o0)}function c0(r){return r.replace(/\./g,"").replace(u0," ").toLowerCase()}function Kn(r,e){return r===null?null:{regex:RegExp(r.map(BA).join("|")),deser:([t])=>r.findIndex(n=>c0(t)===c0(n))+e}}function l0(r,e){return{regex:r,deser:([,t,n])=>Gu(t,n),groups:e}}function Zu(r){return{regex:r,deser:([e])=>e}}function VA(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function WA(r,e){const t=Jn(e),n=Jn(e,"{2}"),i=Jn(e,"{3}"),a=Jn(e,"{4}"),u=Jn(e,"{6}"),c=Jn(e,"{1,2}"),f=Jn(e,"{1,3}"),h=Jn(e,"{1,6}"),p=Jn(e,"{1,9}"),m=Jn(e,"{2,4}"),y=Jn(e,"{4,6}"),g=_=>({regex:RegExp(VA(_.val)),deser:([w])=>w,literal:!0}),k=(_=>{if(r.literal)return g(_);switch(_.val){case"G":return Kn(e.eras("short"),0);case"GG":return Kn(e.eras("long"),0);case"y":return Et(h);case"yy":return Et(m,ah);case"yyyy":return Et(a);case"yyyyy":return Et(y);case"yyyyyy":return Et(u);case"M":return Et(c);case"MM":return Et(n);case"MMM":return Kn(e.months("short",!0),1);case"MMMM":return Kn(e.months("long",!0),1);case"L":return Et(c);case"LL":return Et(n);case"LLL":return Kn(e.months("short",!1),1);case"LLLL":return Kn(e.months("long",!1),1);case"d":return Et(c);case"dd":return Et(n);case"o":return Et(f);case"ooo":return Et(i);case"HH":return Et(n);case"H":return Et(c);case"hh":return Et(n);case"h":return Et(c);case"mm":return Et(n);case"m":return Et(c);case"q":return Et(c);case"qq":return Et(n);case"s":return Et(c);case"ss":return Et(n);case"S":return Et(f);case"SSS":return Et(i);case"u":return Zu(p);case"uu":return Zu(c);case"uuu":return Et(t);case"a":return Kn(e.meridiems(),0);case"kkkk":return Et(a);case"kk":return Et(m,ah);case"W":return Et(c);case"WW":return Et(n);case"E":case"c":return Et(t);case"EEE":return Kn(e.weekdays("short",!1),1);case"EEEE":return Kn(e.weekdays("long",!1),1);case"ccc":return Kn(e.weekdays("short",!0),1);case"cccc":return Kn(e.weekdays("long",!0),1);case"Z":case"ZZ":return l0(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return l0(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Zu(/[a-z_+-/]{1,256}?/i);case" ":return Zu(/[^\S\n\r]/);default:return g(_)}})(r)||{invalidReason:$A};return k.token=r,k}const zA={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function HA(r,e,t){const{type:n,value:i}=r;if(n==="literal"){const f=/^\s+$/.test(i);return{literal:!f,val:f?" ":i}}const a=e[n];let u=n;n==="hour"&&(e.hour12!=null?u=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?u="hour12":u="hour24":u=t.hour12?"hour12":"hour24");let c=zA[u];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function QA(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function GA(r,e,t){const n=r.match(e);if(n){const i={};let a=1;for(const u in t)if(sa(t,u)){const c=t[u],f=c.groups?c.groups+1:1;!c.literal&&c.token&&(i[c.token.val[0]]=c.deser(n.slice(a,a+f))),a+=f}return[n,i]}else return[n,{}]}function JA(r){const e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,n;return Je(r.z)||(t=wi.create(r.z)),Je(r.Z)||(t||(t=new Ur(r.Z)),n=r.Z),Je(r.q)||(r.M=(r.q-1)*3+1),Je(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),Je(r.u)||(r.S=ih(r.u)),[Object.keys(r).reduce((a,u)=>{const c=e(u);return c&&(a[c]=r[u]),a},{}),t,n]}let lh=null;function YA(){return lh||(lh=Ke.fromMillis(1555555555555)),lh}function KA(r,e){if(r.literal)return r;const t=Mr.macroTokenToFormatOpts(r.val),n=p0(t,e);return n==null||n.includes(void 0)?r:n}function f0(r,e){return Array.prototype.concat(...r.map(t=>KA(t,e)))}class h0{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=f0(Mr.parseFormat(t),e),this.units=this.tokens.map(n=>WA(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,i]=QA(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,n]=GA(e,this.regex,this.handlers),[i,a,u]=n?JA(n):[null,null,void 0];if(sa(n,"a")&&sa(n,"H"))throw new ia("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:i,zone:a,specificOffset:u}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function d0(r,e,t){return new h0(r,t).explainFromTokens(e)}function ZA(r,e,t){const{result:n,zone:i,specificOffset:a,invalidReason:u}=d0(r,e,t);return[n,i,a,u]}function p0(r,e){if(!r)return null;const n=Mr.create(e,r).dtFormatter(YA()),i=n.formatToParts(),a=n.resolvedOptions();return i.map(u=>HA(u,r,a))}const fh="Invalid DateTime",m0=864e13;function bo(r){return new Yn("unsupported zone",`the zone "${r.name}" is not supported`)}function hh(r){return r.weekData===null&&(r.weekData=Wu(r.c)),r.weekData}function dh(r){return r.localWeekData===null&&(r.localWeekData=Wu(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function Ms(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new Ke({...t,...e,old:t})}function y0(r,e,t){let n=r-e*60*1e3;const i=t.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;const a=t.offset(n);return i===a?[n,i]:[r-Math.min(i,a)*60*1e3,Math.max(i,a)]}function Xu(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function ec(r,e,t){return y0(Qu(r),e,t)}function g0(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),i=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...r.c,year:n,month:i,day:Math.min(r.c.day,Hu(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},u=vt.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),c=Qu(a);let[f,h]=y0(c,t,r.zone);return u!==0&&(f+=u,h=r.zone.offset(f)),{ts:f,o:h}}function pa(r,e,t,n,i,a){const{setZone:u,zone:c}=t;if(r&&Object.keys(r).length!==0||e){const f=e||c,h=Ke.fromObject(r,{...t,zone:f,specificOffset:a});return u?h:h.setZone(c)}else return Ke.invalid(new Yn("unparsable",`the input "${i}" can't be parsed as ${n}`))}function tc(r,e,t=!0){return r.isValid?Mr.create(At.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function ph(r,e,t){const n=r.c.year>9999||r.c.year<0;let i="";if(n&&r.c.year>=0&&(i+="+"),i+=fr(r.c.year,n?6:4),t==="year")return i;if(e){if(i+="-",i+=fr(r.c.month),t==="month")return i;i+="-"}else if(i+=fr(r.c.month),t==="month")return i;return i+=fr(r.c.day),i}function v0(r,e,t,n,i,a,u){let c=!t||r.c.millisecond!==0||r.c.second!==0,f="";switch(u){case"day":case"month":case"year":break;default:if(f+=fr(r.c.hour),u==="hour")break;if(e){if(f+=":",f+=fr(r.c.minute),u==="minute")break;c&&(f+=":",f+=fr(r.c.second))}else{if(f+=fr(r.c.minute),u==="minute")break;c&&(f+=fr(r.c.second))}if(u==="second")break;c&&(!n||r.c.millisecond!==0)&&(f+=".",f+=fr(r.c.millisecond,3))}return i&&(r.isOffsetFixed&&r.offset===0&&!a?f+="Z":r.o<0?(f+="-",f+=fr(Math.trunc(-r.o/60)),f+=":",f+=fr(Math.trunc(-r.o%60))):(f+="+",f+=fr(Math.trunc(r.o/60)),f+=":",f+=fr(Math.trunc(r.o%60)))),a&&(f+="["+r.zone.ianaName+"]"),f}const b0={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},XA={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ek={ordinal:1,hour:0,minute:0,second:0,millisecond:0},rc=["year","month","day","hour","minute","second","millisecond"],tk=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],rk=["year","ordinal","hour","minute","second","millisecond"];function nc(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new Qg(r);return e}function w0(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return nc(r)}}function nk(r){if(wo===void 0&&(wo=er.now()),r.type!=="iana")return r.offset(wo);const e=r.name;let t=mh.get(e);return t===void 0&&(t=r.offset(wo),mh.set(e,t)),t}function _0(r,e){const t=ts(e.zone,er.defaultZone);if(!t.isValid)return Ke.invalid(bo(t));const n=At.fromObject(e);let i,a;if(Je(r.year))i=er.now();else{for(const f of rc)Je(r[f])&&(r[f]=b0[f]);const u=Nv(r)||Mv(r);if(u)return Ke.invalid(u);const c=nk(t);[i,a]=ec(r,c,t)}return new Ke({ts:i,zone:t,loc:n,o:a})}function S0(r,e,t){const n=Je(t.round)?!0:t.round,i=Je(t.rounding)?"trunc":t.rounding,a=(c,f)=>(c=sh(c,n||t.calendary?0:2,t.calendary?"round":i),e.loc.clone(t).relFormatter(t).format(c,f)),u=c=>t.calendary?e.hasSame(r,c)?0:e.startOf(c).diff(r.startOf(c),c).get(c):e.diff(r,c).get(c);if(t.unit)return a(u(t.unit),t.unit);for(const c of t.units){const f=u(c);if(Math.abs(f)>=1)return a(f,c)}return a(r>e?-0:0,t.units[t.units.length-1])}function x0(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}let wo;const mh=new Map;class Ke{constructor(e){const t=e.zone||er.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Yn("invalid input"):null)||(t.isValid?null:bo(t));this.ts=Je(e.ts)?er.now():e.ts;let i=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,a]=[e.old.c,e.old.o];else{const c=rs(e.o)&&!e.old?e.o:t.offset(this.ts);i=Xu(this.ts,c),n=Number.isNaN(i.year)?new Yn("invalid input"):null,i=n?null:i,a=n?null:c}this._zone=t,this.loc=e.loc||At.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=a,this.isLuxonDateTime=!0}static now(){return new Ke({})}static local(){const[e,t]=x0(arguments),[n,i,a,u,c,f,h]=t;return _0({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static utc(){const[e,t]=x0(arguments),[n,i,a,u,c,f,h]=t;return e.zone=Ur.utcInstance,_0({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static fromJSDate(e,t={}){const n=FT(e)?e.valueOf():NaN;if(Number.isNaN(n))return Ke.invalid("invalid input");const i=ts(t.zone,er.defaultZone);return i.isValid?new Ke({ts:n,zone:i,loc:At.fromObject(t)}):Ke.invalid(bo(i))}static fromMillis(e,t={}){if(rs(e))return e<-m0||e>m0?Ke.invalid("Timestamp out of range"):new Ke({ts:e,zone:ts(t.zone,er.defaultZone),loc:At.fromObject(t)});throw new Nr(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(rs(e))return new Ke({ts:e*1e3,zone:ts(t.zone,er.defaultZone),loc:At.fromObject(t)});throw new Nr("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=ts(t.zone,er.defaultZone);if(!n.isValid)return Ke.invalid(bo(n));const i=At.fromObject(t),a=Ju(e,w0),{minDaysInFirstWeek:u,startOfWeek:c}=Pv(a,i),f=er.now(),h=Je(t.specificOffset)?n.offset(f):t.specificOffset,p=!Je(a.ordinal),m=!Je(a.year),y=!Je(a.month)||!Je(a.day),g=m||y,b=a.weekYear||a.weekNumber;if((g||p)&&b)throw new ia("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(y&&p)throw new ia("Can't mix ordinal dates with month/day");const k=b||a.weekday&&!g;let _,w,T=Xu(f,h);k?(_=tk,w=XA,T=Wu(T,u,c)):p?(_=rk,w=ek,T=rh(T)):(_=rc,w=b0);let C=!1;for(const Y of _){const ae=a[Y];Je(ae)?C?a[Y]=w[Y]:a[Y]=T[Y]:C=!0}const R=k?MT(a,u,c):p?RT(a):Nv(a),O=R||Mv(a);if(O)return Ke.invalid(O);const N=k?Iv(a,u,c):p?Cv(a):a,[V,D]=ec(N,h,n),U=new Ke({ts:V,zone:n,o:D,loc:i});return a.weekday&&g&&e.weekday!==U.weekday?Ke.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${U.toISO()}`):U.isValid?U:Ke.invalid(U.invalid)}static fromISO(e,t={}){const[n,i]=OA(e);return pa(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=TA(e);return pa(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=AA(e);return pa(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(Je(e)||Je(t))throw new Nr("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:a=null}=n,u=At.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),[c,f,h,p]=ZA(u,e,t);return p?Ke.invalid(p):pa(c,f,n,`format ${t}`,e,h)}static fromString(e,t,n={}){return Ke.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=RA(e);return pa(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Nr("need to specify a reason the DateTime is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(er.throwOnInvalid)throw new oT(n);return new Ke({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=p0(e,At.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return f0(Mr.parseFormat(e),At.fromObject(t)).map(i=>i.val).join("")}static resetCache(){wo=void 0,mh.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?hh(this).weekYear:NaN}get weekNumber(){return this.isValid?hh(this).weekNumber:NaN}get weekday(){return this.isValid?hh(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?dh(this).weekday:NaN}get localWeekNumber(){return this.isValid?dh(this).weekNumber:NaN}get localWeekYear(){return this.isValid?dh(this).weekYear:NaN}get ordinal(){return this.isValid?rh(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ku.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ku.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ku.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ku.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=Qu(this.c),i=this.zone.offset(n-e),a=this.zone.offset(n+e),u=this.zone.offset(n-i*t),c=this.zone.offset(n-a*t);if(u===c)return[this];const f=n-u*t,h=n-c*t,p=Xu(f,u),m=Xu(h,c);return p.hour===m.hour&&p.minute===m.minute&&p.second===m.second&&p.millisecond===m.millisecond?[Ms(this,{ts:f}),Ms(this,{ts:h})]:[this]}get isInLeapYear(){return po(this.year)}get daysInMonth(){return Hu(this.year,this.month)}get daysInYear(){return this.isValid?aa(this.year):NaN}get weeksInWeekYear(){return this.isValid?mo(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?mo(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:i}=Mr.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(Ur.instance(e),t)}toLocal(){return this.setZone(er.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=ts(e,er.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||n){const a=e.offset(this.ts),u=this.toObject();[i]=ec(u,a,e)}return Ms(this,{ts:i,zone:e})}else return Ke.invalid(bo(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Ms(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Ju(e,w0),{minDaysInFirstWeek:n,startOfWeek:i}=Pv(t,this.loc),a=!Je(t.weekYear)||!Je(t.weekNumber)||!Je(t.weekday),u=!Je(t.ordinal),c=!Je(t.year),f=!Je(t.month)||!Je(t.day),h=c||f,p=t.weekYear||t.weekNumber;if((h||u)&&p)throw new ia("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new ia("Can't mix ordinal dates with month/day");let m;a?m=Iv({...Wu(this.c,n,i),...t},n,i):Je(t.ordinal)?(m={...this.toObject(),...t},Je(t.day)&&(m.day=Math.min(Hu(m.year,m.month),m.day))):m=Cv({...rh(this.c),...t});const[y,g]=ec(m,this.o,this.zone);return Ms(this,{ts:y,o:g})}plus(e){if(!this.isValid)return this;const t=vt.fromDurationLike(e);return Ms(this,g0(this,t))}minus(e){if(!this.isValid)return this;const t=vt.fromDurationLike(e).negate();return Ms(this,g0(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},i=vt.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(t){const a=this.loc.getStartOfWeek(),{weekday:u}=this;u<a&&(n.weekNumber=this.weekNumber-1),n.weekday=a}else n.weekday=1;if(i==="quarters"){const a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Mr.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):fh}toLocaleString(e=$u,t={}){return this.isValid?Mr.create(this.loc.clone(t),e).formatDateTime(this):fh}toLocaleParts(e={}){return this.isValid?Mr.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:a=!1,precision:u="milliseconds"}={}){if(!this.isValid)return null;u=nc(u);const c=e==="extended";let f=ph(this,c,u);return rc.indexOf(u)>=3&&(f+="T"),f+=v0(this,c,t,n,i,a,u),f}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?ph(this,e==="extended",nc(t)):null}toISOWeekDate(){return tc(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:a=!1,format:u="extended",precision:c="milliseconds"}={}){return this.isValid?(c=nc(c),(i&&rc.indexOf(c)>=3?"T":"")+v0(this,u==="extended",t,e,n,a,c)):null}toRFC2822(){return tc(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return tc(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ph(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(n&&(i+=" "),t?i+="z":e&&(i+="ZZ")),tc(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():fh}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return vt.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=LT(t).map(vt.normalizeUnit),u=e.valueOf()>this.valueOf(),c=u?this:e,f=u?e:this,h=UA(c,f,a,i);return u?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(Ke.now(),e,t)}until(e){return this.isValid?tr.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const i=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(t,n)<=i&&i<=a.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||Ke.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let i=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(i=e.unit,a=void 0),S0(t,this.plus(n),{...e,numeric:"always",units:i,unit:a})}toRelativeCalendar(e={}){return this.isValid?S0(e.base||Ke.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(Ke.isDateTime))throw new Nr("min requires all arguments be DateTimes");return Fv(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(Ke.isDateTime))throw new Nr("max requires all arguments be DateTimes");return Fv(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:i=null,numberingSystem:a=null}=n,u=At.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});return d0(u,e,t)}static fromStringExplain(e,t,n={}){return Ke.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:i=null}=t,a=At.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new h0(a,e)}static fromFormatParser(e,t,n={}){if(Je(e)||Je(t))throw new Nr("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:a=null}=n,u=At.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!u.equals(t.locale))throw new Nr(`fromFormatParser called with a locale of ${u}, but the format parser was created for ${t.locale}`);const{result:c,zone:f,specificOffset:h,invalidReason:p}=t.explainFromTokens(e);return p?Ke.invalid(p):pa(c,f,n,`format ${t.format}`,e,h)}static get DATE_SHORT(){return $u}static get DATE_MED(){return Gg}static get DATE_MED_WITH_WEEKDAY(){return lT}static get DATE_FULL(){return Jg}static get DATE_HUGE(){return Yg}static get TIME_SIMPLE(){return Kg}static get TIME_WITH_SECONDS(){return Zg}static get TIME_WITH_SHORT_OFFSET(){return Xg}static get TIME_WITH_LONG_OFFSET(){return ev}static get TIME_24_SIMPLE(){return tv}static get TIME_24_WITH_SECONDS(){return rv}static get TIME_24_WITH_SHORT_OFFSET(){return nv}static get TIME_24_WITH_LONG_OFFSET(){return iv}static get DATETIME_SHORT(){return sv}static get DATETIME_SHORT_WITH_SECONDS(){return av}static get DATETIME_MED(){return ov}static get DATETIME_MED_WITH_SECONDS(){return uv}static get DATETIME_MED_WITH_WEEKDAY(){return fT}static get DATETIME_FULL(){return cv}static get DATETIME_FULL_WITH_SECONDS(){return lv}static get DATETIME_HUGE(){return fv}static get DATETIME_HUGE_WITH_SECONDS(){return hv}}function _o(r){if(Ke.isDateTime(r))return r;if(r&&r.valueOf&&rs(r.valueOf()))return Ke.fromJSDate(r);if(r&&typeof r=="object")return Ke.fromObject(r);throw new Nr(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var So={exports:{}};/**
|
|
79
|
-
* @license
|
|
80
|
-
* Lodash <https://lodash.com/>
|
|
81
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
82
|
-
* Released under MIT license <https://lodash.com/license>
|
|
83
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
84
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
85
|
-
*/var ik=So.exports,E0;function sk(){return E0||(E0=1,function(r,e){(function(){var t,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",c="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,p="__lodash_placeholder__",m=1,y=2,g=4,b=1,k=2,_=1,w=2,T=4,C=8,R=16,O=32,N=64,V=128,D=256,U=512,Y=30,ae="...",re=800,Se=16,se=1,ve=2,be=3,Ee=1/0,ee=9007199254740991,pe=17976931348623157e292,q=NaN,de=4294967295,Oe=de-1,je=de>>>1,rt=[["ary",V],["bind",_],["bindKey",w],["curry",C],["curryRight",R],["flip",U],["partial",O],["partialRight",N],["rearg",D]],Ve="[object Arguments]",Be="[object Array]",wt="[object AsyncFunction]",Ye="[object Boolean]",Me="[object Date]",Ue="[object DOMException]",W="[object Error]",J="[object Function]",$="[object GeneratorFunction]",Z="[object Map]",ne="[object Number]",G="[object Null]",xe="[object Object]",qe="[object Promise]",$e="[object Proxy]",le="[object RegExp]",_e="[object Set]",Ge="[object String]",ot="[object Symbol]",ut="[object Undefined]",Gt="[object WeakMap]",Ot="[object WeakSet]",Jt="[object ArrayBuffer]",sr="[object DataView]",mr="[object Float32Array]",Rt="[object Float64Array]",ar="[object Int8Array]",dr="[object Int16Array]",zr="[object Int32Array]",jt="[object Uint8Array]",Yt="[object Uint8ClampedArray]",Q="[object Uint16Array]",K="[object Uint32Array]",nt=/\b__p \+= '';/g,at=/\b(__p \+=) '' \+/g,ct=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ze=/&(?:amp|lt|gt|quot|#39);/g,Kt=/[&<>"']/g,kr=RegExp(ze.source),or=RegExp(Kt.source),yr=/<%-([\s\S]+?)%>/g,Mn=/<%([\s\S]+?)%>/g,rr=/<%=([\s\S]+?)%>/g,Dt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rn=/^\w*$/,Rr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gr=/[\\^$.*+?()[\]{}|]/g,Hr=RegExp(gr.source),Dr=/^\s+/,pr=/\s/,Ir=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Rn=/\{\n\/\* \[wrapped with (.+)\] \*/,li=/,? & /,Dn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Er=/[()=,{}\[\]\/\s]/,Qr=/\\(\\)?/g,zt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ft=/\w*$/,Fn=/^[-+]0x[0-9a-f]+$/i,Ln=/^0b[01]+$/i,mn=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,Gr=/^(?:0|[1-9]\d*)$/,S=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,I=/($^)/,A=/['\n\r\u2028\u2029\\]/g,P="\\ud800-\\udfff",j="\\u0300-\\u036f",z="\\ufe20-\\ufe2f",ue="\\u20d0-\\u20ff",me=j+z+ue,X="\\u2700-\\u27bf",oe="a-z\\xdf-\\xf6\\xf8-\\xff",De="\\xac\\xb1\\xd7\\xf7",lt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ut="\\u2000-\\u206f",yn=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ii="A-Z\\xc0-\\xd6\\xd8-\\xde",Jw="\\ufe0e\\ufe0f",Yw=De+lt+Ut+yn,Qd="['’]",oN="["+P+"]",Kw="["+Yw+"]",Ac="["+me+"]",Zw="\\d+",uN="["+X+"]",Xw="["+oe+"]",e_="[^"+P+Yw+Zw+X+oe+Ii+"]",Gd="\\ud83c[\\udffb-\\udfff]",cN="(?:"+Ac+"|"+Gd+")",t_="[^"+P+"]",Jd="(?:\\ud83c[\\udde6-\\uddff]){2}",Yd="[\\ud800-\\udbff][\\udc00-\\udfff]",ka="["+Ii+"]",r_="\\u200d",n_="(?:"+Xw+"|"+e_+")",lN="(?:"+ka+"|"+e_+")",i_="(?:"+Qd+"(?:d|ll|m|re|s|t|ve))?",s_="(?:"+Qd+"(?:D|LL|M|RE|S|T|VE))?",a_=cN+"?",o_="["+Jw+"]?",fN="(?:"+r_+"(?:"+[t_,Jd,Yd].join("|")+")"+o_+a_+")*",hN="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",dN="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",u_=o_+a_+fN,pN="(?:"+[uN,Jd,Yd].join("|")+")"+u_,mN="(?:"+[t_+Ac+"?",Ac,Jd,Yd,oN].join("|")+")",yN=RegExp(Qd,"g"),gN=RegExp(Ac,"g"),Kd=RegExp(Gd+"(?="+Gd+")|"+mN+u_,"g"),vN=RegExp([ka+"?"+Xw+"+"+i_+"(?="+[Kw,ka,"$"].join("|")+")",lN+"+"+s_+"(?="+[Kw,ka+n_,"$"].join("|")+")",ka+"?"+n_+"+"+i_,ka+"+"+s_,dN,hN,Zw,pN].join("|"),"g"),bN=RegExp("["+r_+P+me+Jw+"]"),wN=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_N=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],SN=-1,$t={};$t[mr]=$t[Rt]=$t[ar]=$t[dr]=$t[zr]=$t[jt]=$t[Yt]=$t[Q]=$t[K]=!0,$t[Ve]=$t[Be]=$t[Jt]=$t[Ye]=$t[sr]=$t[Me]=$t[W]=$t[J]=$t[Z]=$t[ne]=$t[xe]=$t[le]=$t[_e]=$t[Ge]=$t[Gt]=!1;var Lt={};Lt[Ve]=Lt[Be]=Lt[Jt]=Lt[sr]=Lt[Ye]=Lt[Me]=Lt[mr]=Lt[Rt]=Lt[ar]=Lt[dr]=Lt[zr]=Lt[Z]=Lt[ne]=Lt[xe]=Lt[le]=Lt[_e]=Lt[Ge]=Lt[ot]=Lt[jt]=Lt[Yt]=Lt[Q]=Lt[K]=!0,Lt[W]=Lt[J]=Lt[Gt]=!1;var xN={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},EN={"&":"&","<":"<",">":">",'"':""","'":"'"},ON={"&":"&","<":"<",">":">",""":'"',"'":"'"},TN={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},AN=parseFloat,kN=parseInt,c_=typeof bs=="object"&&bs&&bs.Object===Object&&bs,IN=typeof self=="object"&&self&&self.Object===Object&&self,Cr=c_||IN||Function("return this")(),Zd=e&&!e.nodeType&&e,Fs=Zd&&!0&&r&&!r.nodeType&&r,l_=Fs&&Fs.exports===Zd,Xd=l_&&c_.process,qn=function(){try{var B=Fs&&Fs.require&&Fs.require("util").types;return B||Xd&&Xd.binding&&Xd.binding("util")}catch{}}(),f_=qn&&qn.isArrayBuffer,h_=qn&&qn.isDate,d_=qn&&qn.isMap,p_=qn&&qn.isRegExp,m_=qn&&qn.isSet,y_=qn&&qn.isTypedArray;function gn(B,ie,te){switch(te.length){case 0:return B.call(ie);case 1:return B.call(ie,te[0]);case 2:return B.call(ie,te[0],te[1]);case 3:return B.call(ie,te[0],te[1],te[2])}return B.apply(ie,te)}function CN(B,ie,te,Re){for(var Ze=-1,Tt=B==null?0:B.length;++Ze<Tt;){var vr=B[Ze];ie(Re,vr,te(vr),B)}return Re}function jn(B,ie){for(var te=-1,Re=B==null?0:B.length;++te<Re&&ie(B[te],te,B)!==!1;);return B}function PN(B,ie){for(var te=B==null?0:B.length;te--&&ie(B[te],te,B)!==!1;);return B}function g_(B,ie){for(var te=-1,Re=B==null?0:B.length;++te<Re;)if(!ie(B[te],te,B))return!1;return!0}function ls(B,ie){for(var te=-1,Re=B==null?0:B.length,Ze=0,Tt=[];++te<Re;){var vr=B[te];ie(vr,te,B)&&(Tt[Ze++]=vr)}return Tt}function kc(B,ie){var te=B==null?0:B.length;return!!te&&Ia(B,ie,0)>-1}function ep(B,ie,te){for(var Re=-1,Ze=B==null?0:B.length;++Re<Ze;)if(te(ie,B[Re]))return!0;return!1}function Ht(B,ie){for(var te=-1,Re=B==null?0:B.length,Ze=Array(Re);++te<Re;)Ze[te]=ie(B[te],te,B);return Ze}function fs(B,ie){for(var te=-1,Re=ie.length,Ze=B.length;++te<Re;)B[Ze+te]=ie[te];return B}function tp(B,ie,te,Re){var Ze=-1,Tt=B==null?0:B.length;for(Re&&Tt&&(te=B[++Ze]);++Ze<Tt;)te=ie(te,B[Ze],Ze,B);return te}function NN(B,ie,te,Re){var Ze=B==null?0:B.length;for(Re&&Ze&&(te=B[--Ze]);Ze--;)te=ie(te,B[Ze],Ze,B);return te}function rp(B,ie){for(var te=-1,Re=B==null?0:B.length;++te<Re;)if(ie(B[te],te,B))return!0;return!1}var MN=np("length");function RN(B){return B.split("")}function DN(B){return B.match(Dn)||[]}function v_(B,ie,te){var Re;return te(B,function(Ze,Tt,vr){if(ie(Ze,Tt,vr))return Re=Tt,!1}),Re}function Ic(B,ie,te,Re){for(var Ze=B.length,Tt=te+(Re?1:-1);Re?Tt--:++Tt<Ze;)if(ie(B[Tt],Tt,B))return Tt;return-1}function Ia(B,ie,te){return ie===ie?QN(B,ie,te):Ic(B,b_,te)}function FN(B,ie,te,Re){for(var Ze=te-1,Tt=B.length;++Ze<Tt;)if(Re(B[Ze],ie))return Ze;return-1}function b_(B){return B!==B}function w_(B,ie){var te=B==null?0:B.length;return te?sp(B,ie)/te:q}function np(B){return function(ie){return ie==null?t:ie[B]}}function ip(B){return function(ie){return B==null?t:B[ie]}}function __(B,ie,te,Re,Ze){return Ze(B,function(Tt,vr,Mt){te=Re?(Re=!1,Tt):ie(te,Tt,vr,Mt)}),te}function LN(B,ie){var te=B.length;for(B.sort(ie);te--;)B[te]=B[te].value;return B}function sp(B,ie){for(var te,Re=-1,Ze=B.length;++Re<Ze;){var Tt=ie(B[Re]);Tt!==t&&(te=te===t?Tt:te+Tt)}return te}function ap(B,ie){for(var te=-1,Re=Array(B);++te<B;)Re[te]=ie(te);return Re}function qN(B,ie){return Ht(ie,function(te){return[te,B[te]]})}function S_(B){return B&&B.slice(0,T_(B)+1).replace(Dr,"")}function vn(B){return function(ie){return B(ie)}}function op(B,ie){return Ht(ie,function(te){return B[te]})}function Bo(B,ie){return B.has(ie)}function x_(B,ie){for(var te=-1,Re=B.length;++te<Re&&Ia(ie,B[te],0)>-1;);return te}function E_(B,ie){for(var te=B.length;te--&&Ia(ie,B[te],0)>-1;);return te}function jN(B,ie){for(var te=B.length,Re=0;te--;)B[te]===ie&&++Re;return Re}var UN=ip(xN),$N=ip(EN);function BN(B){return"\\"+TN[B]}function VN(B,ie){return B==null?t:B[ie]}function Ca(B){return bN.test(B)}function WN(B){return wN.test(B)}function zN(B){for(var ie,te=[];!(ie=B.next()).done;)te.push(ie.value);return te}function up(B){var ie=-1,te=Array(B.size);return B.forEach(function(Re,Ze){te[++ie]=[Ze,Re]}),te}function O_(B,ie){return function(te){return B(ie(te))}}function hs(B,ie){for(var te=-1,Re=B.length,Ze=0,Tt=[];++te<Re;){var vr=B[te];(vr===ie||vr===p)&&(B[te]=p,Tt[Ze++]=te)}return Tt}function Cc(B){var ie=-1,te=Array(B.size);return B.forEach(function(Re){te[++ie]=Re}),te}function HN(B){var ie=-1,te=Array(B.size);return B.forEach(function(Re){te[++ie]=[Re,Re]}),te}function QN(B,ie,te){for(var Re=te-1,Ze=B.length;++Re<Ze;)if(B[Re]===ie)return Re;return-1}function GN(B,ie,te){for(var Re=te+1;Re--;)if(B[Re]===ie)return Re;return Re}function Pa(B){return Ca(B)?YN(B):MN(B)}function ti(B){return Ca(B)?KN(B):RN(B)}function T_(B){for(var ie=B.length;ie--&&pr.test(B.charAt(ie)););return ie}var JN=ip(ON);function YN(B){for(var ie=Kd.lastIndex=0;Kd.test(B);)++ie;return ie}function KN(B){return B.match(Kd)||[]}function ZN(B){return B.match(vN)||[]}var XN=function B(ie){ie=ie==null?Cr:Na.defaults(Cr.Object(),ie,Na.pick(Cr,_N));var te=ie.Array,Re=ie.Date,Ze=ie.Error,Tt=ie.Function,vr=ie.Math,Mt=ie.Object,cp=ie.RegExp,e2=ie.String,Un=ie.TypeError,Pc=te.prototype,t2=Tt.prototype,Ma=Mt.prototype,Nc=ie["__core-js_shared__"],Mc=t2.toString,Ct=Ma.hasOwnProperty,r2=0,A_=function(){var s=/[^.]+$/.exec(Nc&&Nc.keys&&Nc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Rc=Ma.toString,n2=Mc.call(Mt),i2=Cr._,s2=cp("^"+Mc.call(Ct).replace(gr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Dc=l_?ie.Buffer:t,ds=ie.Symbol,Fc=ie.Uint8Array,k_=Dc?Dc.allocUnsafe:t,Lc=O_(Mt.getPrototypeOf,Mt),I_=Mt.create,C_=Ma.propertyIsEnumerable,qc=Pc.splice,P_=ds?ds.isConcatSpreadable:t,Vo=ds?ds.iterator:t,Ls=ds?ds.toStringTag:t,jc=function(){try{var s=Bs(Mt,"defineProperty");return s({},"",{}),s}catch{}}(),a2=ie.clearTimeout!==Cr.clearTimeout&&ie.clearTimeout,o2=Re&&Re.now!==Cr.Date.now&&Re.now,u2=ie.setTimeout!==Cr.setTimeout&&ie.setTimeout,Uc=vr.ceil,$c=vr.floor,lp=Mt.getOwnPropertySymbols,c2=Dc?Dc.isBuffer:t,N_=ie.isFinite,l2=Pc.join,f2=O_(Mt.keys,Mt),br=vr.max,Fr=vr.min,h2=Re.now,d2=ie.parseInt,M_=vr.random,p2=Pc.reverse,fp=Bs(ie,"DataView"),Wo=Bs(ie,"Map"),hp=Bs(ie,"Promise"),Ra=Bs(ie,"Set"),zo=Bs(ie,"WeakMap"),Ho=Bs(Mt,"create"),Bc=zo&&new zo,Da={},m2=Vs(fp),y2=Vs(Wo),g2=Vs(hp),v2=Vs(Ra),b2=Vs(zo),Vc=ds?ds.prototype:t,Qo=Vc?Vc.valueOf:t,R_=Vc?Vc.toString:t;function x(s){if(nr(s)&&!Xe(s)&&!(s instanceof pt)){if(s instanceof $n)return s;if(Ct.call(s,"__wrapped__"))return DS(s)}return new $n(s)}var Fa=function(){function s(){}return function(o){if(!Zt(o))return{};if(I_)return I_(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function Wc(){}function $n(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}x.templateSettings={escape:yr,evaluate:Mn,interpolate:rr,variable:"",imports:{_:x}},x.prototype=Wc.prototype,x.prototype.constructor=x,$n.prototype=Fa(Wc.prototype),$n.prototype.constructor=$n;function pt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=de,this.__views__=[]}function w2(){var s=new pt(this.__wrapped__);return s.__actions__=nn(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=nn(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=nn(this.__views__),s}function _2(){if(this.__filtered__){var s=new pt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function S2(){var s=this.__wrapped__.value(),o=this.__dir__,l=Xe(s),d=o<0,v=l?s.length:0,E=RM(0,v,this.__views__),M=E.start,L=E.end,H=L-M,ce=d?L:M-1,fe=this.__iteratees__,ye=fe.length,Ce=0,Le=Fr(H,this.__takeCount__);if(!l||!d&&v==H&&Le==H)return iS(s,this.__actions__);var He=[];e:for(;H--&&Ce<Le;){ce+=o;for(var it=-1,Qe=s[ce];++it<ye;){var ft=fe[it],yt=ft.iteratee,_n=ft.type,Kr=yt(Qe);if(_n==ve)Qe=Kr;else if(!Kr){if(_n==se)continue e;break e}}He[Ce++]=Qe}return He}pt.prototype=Fa(Wc.prototype),pt.prototype.constructor=pt;function qs(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var d=s[o];this.set(d[0],d[1])}}function x2(){this.__data__=Ho?Ho(null):{},this.size=0}function E2(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function O2(s){var o=this.__data__;if(Ho){var l=o[s];return l===f?t:l}return Ct.call(o,s)?o[s]:t}function T2(s){var o=this.__data__;return Ho?o[s]!==t:Ct.call(o,s)}function A2(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=Ho&&o===t?f:o,this}qs.prototype.clear=x2,qs.prototype.delete=E2,qs.prototype.get=O2,qs.prototype.has=T2,qs.prototype.set=A2;function Ci(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var d=s[o];this.set(d[0],d[1])}}function k2(){this.__data__=[],this.size=0}function I2(s){var o=this.__data__,l=zc(o,s);if(l<0)return!1;var d=o.length-1;return l==d?o.pop():qc.call(o,l,1),--this.size,!0}function C2(s){var o=this.__data__,l=zc(o,s);return l<0?t:o[l][1]}function P2(s){return zc(this.__data__,s)>-1}function N2(s,o){var l=this.__data__,d=zc(l,s);return d<0?(++this.size,l.push([s,o])):l[d][1]=o,this}Ci.prototype.clear=k2,Ci.prototype.delete=I2,Ci.prototype.get=C2,Ci.prototype.has=P2,Ci.prototype.set=N2;function Pi(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var d=s[o];this.set(d[0],d[1])}}function M2(){this.size=0,this.__data__={hash:new qs,map:new(Wo||Ci),string:new qs}}function R2(s){var o=nl(this,s).delete(s);return this.size-=o?1:0,o}function D2(s){return nl(this,s).get(s)}function F2(s){return nl(this,s).has(s)}function L2(s,o){var l=nl(this,s),d=l.size;return l.set(s,o),this.size+=l.size==d?0:1,this}Pi.prototype.clear=M2,Pi.prototype.delete=R2,Pi.prototype.get=D2,Pi.prototype.has=F2,Pi.prototype.set=L2;function js(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Pi;++o<l;)this.add(s[o])}function q2(s){return this.__data__.set(s,f),this}function j2(s){return this.__data__.has(s)}js.prototype.add=js.prototype.push=q2,js.prototype.has=j2;function ri(s){var o=this.__data__=new Ci(s);this.size=o.size}function U2(){this.__data__=new Ci,this.size=0}function $2(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function B2(s){return this.__data__.get(s)}function V2(s){return this.__data__.has(s)}function W2(s,o){var l=this.__data__;if(l instanceof Ci){var d=l.__data__;if(!Wo||d.length<i-1)return d.push([s,o]),this.size=++l.size,this;l=this.__data__=new Pi(d)}return l.set(s,o),this.size=l.size,this}ri.prototype.clear=U2,ri.prototype.delete=$2,ri.prototype.get=B2,ri.prototype.has=V2,ri.prototype.set=W2;function D_(s,o){var l=Xe(s),d=!l&&Ws(s),v=!l&&!d&&vs(s),E=!l&&!d&&!v&&Ua(s),M=l||d||v||E,L=M?ap(s.length,e2):[],H=L.length;for(var ce in s)(o||Ct.call(s,ce))&&!(M&&(ce=="length"||v&&(ce=="offset"||ce=="parent")||E&&(ce=="buffer"||ce=="byteLength"||ce=="byteOffset")||Di(ce,H)))&&L.push(ce);return L}function F_(s){var o=s.length;return o?s[xp(0,o-1)]:t}function z2(s,o){return il(nn(s),Us(o,0,s.length))}function H2(s){return il(nn(s))}function dp(s,o,l){(l!==t&&!ni(s[o],l)||l===t&&!(o in s))&&Ni(s,o,l)}function Go(s,o,l){var d=s[o];(!(Ct.call(s,o)&&ni(d,l))||l===t&&!(o in s))&&Ni(s,o,l)}function zc(s,o){for(var l=s.length;l--;)if(ni(s[l][0],o))return l;return-1}function Q2(s,o,l,d){return ps(s,function(v,E,M){o(d,v,l(v),M)}),d}function L_(s,o){return s&&hi(o,Or(o),s)}function G2(s,o){return s&&hi(o,an(o),s)}function Ni(s,o,l){o=="__proto__"&&jc?jc(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function pp(s,o){for(var l=-1,d=o.length,v=te(d),E=s==null;++l<d;)v[l]=E?t:Gp(s,o[l]);return v}function Us(s,o,l){return s===s&&(l!==t&&(s=s<=l?s:l),o!==t&&(s=s>=o?s:o)),s}function Bn(s,o,l,d,v,E){var M,L=o&m,H=o&y,ce=o&g;if(l&&(M=v?l(s,d,v,E):l(s)),M!==t)return M;if(!Zt(s))return s;var fe=Xe(s);if(fe){if(M=FM(s),!L)return nn(s,M)}else{var ye=Lr(s),Ce=ye==J||ye==$;if(vs(s))return oS(s,L);if(ye==xe||ye==Ve||Ce&&!v){if(M=H||Ce?{}:TS(s),!L)return H?OM(s,G2(M,s)):EM(s,L_(M,s))}else{if(!Lt[ye])return v?s:{};M=LM(s,ye,L)}}E||(E=new ri);var Le=E.get(s);if(Le)return Le;E.set(s,M),tx(s)?s.forEach(function(Qe){M.add(Bn(Qe,o,l,Qe,s,E))}):XS(s)&&s.forEach(function(Qe,ft){M.set(ft,Bn(Qe,o,l,ft,s,E))});var He=ce?H?Rp:Mp:H?an:Or,it=fe?t:He(s);return jn(it||s,function(Qe,ft){it&&(ft=Qe,Qe=s[ft]),Go(M,ft,Bn(Qe,o,l,ft,s,E))}),M}function J2(s){var o=Or(s);return function(l){return q_(l,s,o)}}function q_(s,o,l){var d=l.length;if(s==null)return!d;for(s=Mt(s);d--;){var v=l[d],E=o[v],M=s[v];if(M===t&&!(v in s)||!E(M))return!1}return!0}function j_(s,o,l){if(typeof s!="function")throw new Un(u);return tu(function(){s.apply(t,l)},o)}function Jo(s,o,l,d){var v=-1,E=kc,M=!0,L=s.length,H=[],ce=o.length;if(!L)return H;l&&(o=Ht(o,vn(l))),d?(E=ep,M=!1):o.length>=i&&(E=Bo,M=!1,o=new js(o));e:for(;++v<L;){var fe=s[v],ye=l==null?fe:l(fe);if(fe=d||fe!==0?fe:0,M&&ye===ye){for(var Ce=ce;Ce--;)if(o[Ce]===ye)continue e;H.push(fe)}else E(o,ye,d)||H.push(fe)}return H}var ps=hS(fi),U_=hS(yp,!0);function Y2(s,o){var l=!0;return ps(s,function(d,v,E){return l=!!o(d,v,E),l}),l}function Hc(s,o,l){for(var d=-1,v=s.length;++d<v;){var E=s[d],M=o(E);if(M!=null&&(L===t?M===M&&!wn(M):l(M,L)))var L=M,H=E}return H}function K2(s,o,l,d){var v=s.length;for(l=tt(l),l<0&&(l=-l>v?0:v+l),d=d===t||d>v?v:tt(d),d<0&&(d+=v),d=l>d?0:nx(d);l<d;)s[l++]=o;return s}function $_(s,o){var l=[];return ps(s,function(d,v,E){o(d,v,E)&&l.push(d)}),l}function Pr(s,o,l,d,v){var E=-1,M=s.length;for(l||(l=jM),v||(v=[]);++E<M;){var L=s[E];o>0&&l(L)?o>1?Pr(L,o-1,l,d,v):fs(v,L):d||(v[v.length]=L)}return v}var mp=dS(),B_=dS(!0);function fi(s,o){return s&&mp(s,o,Or)}function yp(s,o){return s&&B_(s,o,Or)}function Qc(s,o){return ls(o,function(l){return Fi(s[l])})}function $s(s,o){o=ys(o,s);for(var l=0,d=o.length;s!=null&&l<d;)s=s[di(o[l++])];return l&&l==d?s:t}function V_(s,o,l){var d=o(s);return Xe(s)?d:fs(d,l(s))}function Jr(s){return s==null?s===t?ut:G:Ls&&Ls in Mt(s)?MM(s):HM(s)}function gp(s,o){return s>o}function Z2(s,o){return s!=null&&Ct.call(s,o)}function X2(s,o){return s!=null&&o in Mt(s)}function eM(s,o,l){return s>=Fr(o,l)&&s<br(o,l)}function vp(s,o,l){for(var d=l?ep:kc,v=s[0].length,E=s.length,M=E,L=te(E),H=1/0,ce=[];M--;){var fe=s[M];M&&o&&(fe=Ht(fe,vn(o))),H=Fr(fe.length,H),L[M]=!l&&(o||v>=120&&fe.length>=120)?new js(M&&fe):t}fe=s[0];var ye=-1,Ce=L[0];e:for(;++ye<v&&ce.length<H;){var Le=fe[ye],He=o?o(Le):Le;if(Le=l||Le!==0?Le:0,!(Ce?Bo(Ce,He):d(ce,He,l))){for(M=E;--M;){var it=L[M];if(!(it?Bo(it,He):d(s[M],He,l)))continue e}Ce&&Ce.push(He),ce.push(Le)}}return ce}function tM(s,o,l,d){return fi(s,function(v,E,M){o(d,l(v),E,M)}),d}function Yo(s,o,l){o=ys(o,s),s=CS(s,o);var d=s==null?s:s[di(Wn(o))];return d==null?t:gn(d,s,l)}function W_(s){return nr(s)&&Jr(s)==Ve}function rM(s){return nr(s)&&Jr(s)==Jt}function nM(s){return nr(s)&&Jr(s)==Me}function Ko(s,o,l,d,v){return s===o?!0:s==null||o==null||!nr(s)&&!nr(o)?s!==s&&o!==o:iM(s,o,l,d,Ko,v)}function iM(s,o,l,d,v,E){var M=Xe(s),L=Xe(o),H=M?Be:Lr(s),ce=L?Be:Lr(o);H=H==Ve?xe:H,ce=ce==Ve?xe:ce;var fe=H==xe,ye=ce==xe,Ce=H==ce;if(Ce&&vs(s)){if(!vs(o))return!1;M=!0,fe=!1}if(Ce&&!fe)return E||(E=new ri),M||Ua(s)?xS(s,o,l,d,v,E):PM(s,o,H,l,d,v,E);if(!(l&b)){var Le=fe&&Ct.call(s,"__wrapped__"),He=ye&&Ct.call(o,"__wrapped__");if(Le||He){var it=Le?s.value():s,Qe=He?o.value():o;return E||(E=new ri),v(it,Qe,l,d,E)}}return Ce?(E||(E=new ri),NM(s,o,l,d,v,E)):!1}function sM(s){return nr(s)&&Lr(s)==Z}function bp(s,o,l,d){var v=l.length,E=v,M=!d;if(s==null)return!E;for(s=Mt(s);v--;){var L=l[v];if(M&&L[2]?L[1]!==s[L[0]]:!(L[0]in s))return!1}for(;++v<E;){L=l[v];var H=L[0],ce=s[H],fe=L[1];if(M&&L[2]){if(ce===t&&!(H in s))return!1}else{var ye=new ri;if(d)var Ce=d(ce,fe,H,s,o,ye);if(!(Ce===t?Ko(fe,ce,b|k,d,ye):Ce))return!1}}return!0}function z_(s){if(!Zt(s)||$M(s))return!1;var o=Fi(s)?s2:mn;return o.test(Vs(s))}function aM(s){return nr(s)&&Jr(s)==le}function oM(s){return nr(s)&&Lr(s)==_e}function uM(s){return nr(s)&&ll(s.length)&&!!$t[Jr(s)]}function H_(s){return typeof s=="function"?s:s==null?on:typeof s=="object"?Xe(s)?J_(s[0],s[1]):G_(s):px(s)}function wp(s){if(!eu(s))return f2(s);var o=[];for(var l in Mt(s))Ct.call(s,l)&&l!="constructor"&&o.push(l);return o}function cM(s){if(!Zt(s))return zM(s);var o=eu(s),l=[];for(var d in s)d=="constructor"&&(o||!Ct.call(s,d))||l.push(d);return l}function _p(s,o){return s<o}function Q_(s,o){var l=-1,d=sn(s)?te(s.length):[];return ps(s,function(v,E,M){d[++l]=o(v,E,M)}),d}function G_(s){var o=Fp(s);return o.length==1&&o[0][2]?kS(o[0][0],o[0][1]):function(l){return l===s||bp(l,s,o)}}function J_(s,o){return qp(s)&&AS(o)?kS(di(s),o):function(l){var d=Gp(l,s);return d===t&&d===o?Jp(l,s):Ko(o,d,b|k)}}function Gc(s,o,l,d,v){s!==o&&mp(o,function(E,M){if(v||(v=new ri),Zt(E))lM(s,o,M,l,Gc,d,v);else{var L=d?d(Up(s,M),E,M+"",s,o,v):t;L===t&&(L=E),dp(s,M,L)}},an)}function lM(s,o,l,d,v,E,M){var L=Up(s,l),H=Up(o,l),ce=M.get(H);if(ce){dp(s,l,ce);return}var fe=E?E(L,H,l+"",s,o,M):t,ye=fe===t;if(ye){var Ce=Xe(H),Le=!Ce&&vs(H),He=!Ce&&!Le&&Ua(H);fe=H,Ce||Le||He?Xe(L)?fe=L:ur(L)?fe=nn(L):Le?(ye=!1,fe=oS(H,!0)):He?(ye=!1,fe=uS(H,!0)):fe=[]:ru(H)||Ws(H)?(fe=L,Ws(L)?fe=ix(L):(!Zt(L)||Fi(L))&&(fe=TS(H))):ye=!1}ye&&(M.set(H,fe),v(fe,H,d,E,M),M.delete(H)),dp(s,l,fe)}function Y_(s,o){var l=s.length;if(l)return o+=o<0?l:0,Di(o,l)?s[o]:t}function K_(s,o,l){o.length?o=Ht(o,function(E){return Xe(E)?function(M){return $s(M,E.length===1?E[0]:E)}:E}):o=[on];var d=-1;o=Ht(o,vn(We()));var v=Q_(s,function(E,M,L){var H=Ht(o,function(ce){return ce(E)});return{criteria:H,index:++d,value:E}});return LN(v,function(E,M){return xM(E,M,l)})}function fM(s,o){return Z_(s,o,function(l,d){return Jp(s,d)})}function Z_(s,o,l){for(var d=-1,v=o.length,E={};++d<v;){var M=o[d],L=$s(s,M);l(L,M)&&Zo(E,ys(M,s),L)}return E}function hM(s){return function(o){return $s(o,s)}}function Sp(s,o,l,d){var v=d?FN:Ia,E=-1,M=o.length,L=s;for(s===o&&(o=nn(o)),l&&(L=Ht(s,vn(l)));++E<M;)for(var H=0,ce=o[E],fe=l?l(ce):ce;(H=v(L,fe,H,d))>-1;)L!==s&&qc.call(L,H,1),qc.call(s,H,1);return s}function X_(s,o){for(var l=s?o.length:0,d=l-1;l--;){var v=o[l];if(l==d||v!==E){var E=v;Di(v)?qc.call(s,v,1):Tp(s,v)}}return s}function xp(s,o){return s+$c(M_()*(o-s+1))}function dM(s,o,l,d){for(var v=-1,E=br(Uc((o-s)/(l||1)),0),M=te(E);E--;)M[d?E:++v]=s,s+=l;return M}function Ep(s,o){var l="";if(!s||o<1||o>ee)return l;do o%2&&(l+=s),o=$c(o/2),o&&(s+=s);while(o);return l}function st(s,o){return $p(IS(s,o,on),s+"")}function pM(s){return F_($a(s))}function mM(s,o){var l=$a(s);return il(l,Us(o,0,l.length))}function Zo(s,o,l,d){if(!Zt(s))return s;o=ys(o,s);for(var v=-1,E=o.length,M=E-1,L=s;L!=null&&++v<E;){var H=di(o[v]),ce=l;if(H==="__proto__"||H==="constructor"||H==="prototype")return s;if(v!=M){var fe=L[H];ce=d?d(fe,H,L):t,ce===t&&(ce=Zt(fe)?fe:Di(o[v+1])?[]:{})}Go(L,H,ce),L=L[H]}return s}var eS=Bc?function(s,o){return Bc.set(s,o),s}:on,yM=jc?function(s,o){return jc(s,"toString",{configurable:!0,enumerable:!1,value:Kp(o),writable:!0})}:on;function gM(s){return il($a(s))}function Vn(s,o,l){var d=-1,v=s.length;o<0&&(o=-o>v?0:v+o),l=l>v?v:l,l<0&&(l+=v),v=o>l?0:l-o>>>0,o>>>=0;for(var E=te(v);++d<v;)E[d]=s[d+o];return E}function vM(s,o){var l;return ps(s,function(d,v,E){return l=o(d,v,E),!l}),!!l}function Jc(s,o,l){var d=0,v=s==null?d:s.length;if(typeof o=="number"&&o===o&&v<=je){for(;d<v;){var E=d+v>>>1,M=s[E];M!==null&&!wn(M)&&(l?M<=o:M<o)?d=E+1:v=E}return v}return Op(s,o,on,l)}function Op(s,o,l,d){var v=0,E=s==null?0:s.length;if(E===0)return 0;o=l(o);for(var M=o!==o,L=o===null,H=wn(o),ce=o===t;v<E;){var fe=$c((v+E)/2),ye=l(s[fe]),Ce=ye!==t,Le=ye===null,He=ye===ye,it=wn(ye);if(M)var Qe=d||He;else ce?Qe=He&&(d||Ce):L?Qe=He&&Ce&&(d||!Le):H?Qe=He&&Ce&&!Le&&(d||!it):Le||it?Qe=!1:Qe=d?ye<=o:ye<o;Qe?v=fe+1:E=fe}return Fr(E,Oe)}function tS(s,o){for(var l=-1,d=s.length,v=0,E=[];++l<d;){var M=s[l],L=o?o(M):M;if(!l||!ni(L,H)){var H=L;E[v++]=M===0?0:M}}return E}function rS(s){return typeof s=="number"?s:wn(s)?q:+s}function bn(s){if(typeof s=="string")return s;if(Xe(s))return Ht(s,bn)+"";if(wn(s))return R_?R_.call(s):"";var o=s+"";return o=="0"&&1/s==-Ee?"-0":o}function ms(s,o,l){var d=-1,v=kc,E=s.length,M=!0,L=[],H=L;if(l)M=!1,v=ep;else if(E>=i){var ce=o?null:IM(s);if(ce)return Cc(ce);M=!1,v=Bo,H=new js}else H=o?[]:L;e:for(;++d<E;){var fe=s[d],ye=o?o(fe):fe;if(fe=l||fe!==0?fe:0,M&&ye===ye){for(var Ce=H.length;Ce--;)if(H[Ce]===ye)continue e;o&&H.push(ye),L.push(fe)}else v(H,ye,l)||(H!==L&&H.push(ye),L.push(fe))}return L}function Tp(s,o){return o=ys(o,s),s=CS(s,o),s==null||delete s[di(Wn(o))]}function nS(s,o,l,d){return Zo(s,o,l($s(s,o)),d)}function Yc(s,o,l,d){for(var v=s.length,E=d?v:-1;(d?E--:++E<v)&&o(s[E],E,s););return l?Vn(s,d?0:E,d?E+1:v):Vn(s,d?E+1:0,d?v:E)}function iS(s,o){var l=s;return l instanceof pt&&(l=l.value()),tp(o,function(d,v){return v.func.apply(v.thisArg,fs([d],v.args))},l)}function Ap(s,o,l){var d=s.length;if(d<2)return d?ms(s[0]):[];for(var v=-1,E=te(d);++v<d;)for(var M=s[v],L=-1;++L<d;)L!=v&&(E[v]=Jo(E[v]||M,s[L],o,l));return ms(Pr(E,1),o,l)}function sS(s,o,l){for(var d=-1,v=s.length,E=o.length,M={};++d<v;){var L=d<E?o[d]:t;l(M,s[d],L)}return M}function kp(s){return ur(s)?s:[]}function Ip(s){return typeof s=="function"?s:on}function ys(s,o){return Xe(s)?s:qp(s,o)?[s]:RS(It(s))}var bM=st;function gs(s,o,l){var d=s.length;return l=l===t?d:l,!o&&l>=d?s:Vn(s,o,l)}var aS=a2||function(s){return Cr.clearTimeout(s)};function oS(s,o){if(o)return s.slice();var l=s.length,d=k_?k_(l):new s.constructor(l);return s.copy(d),d}function Cp(s){var o=new s.constructor(s.byteLength);return new Fc(o).set(new Fc(s)),o}function wM(s,o){var l=o?Cp(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function _M(s){var o=new s.constructor(s.source,Ft.exec(s));return o.lastIndex=s.lastIndex,o}function SM(s){return Qo?Mt(Qo.call(s)):{}}function uS(s,o){var l=o?Cp(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function cS(s,o){if(s!==o){var l=s!==t,d=s===null,v=s===s,E=wn(s),M=o!==t,L=o===null,H=o===o,ce=wn(o);if(!L&&!ce&&!E&&s>o||E&&M&&H&&!L&&!ce||d&&M&&H||!l&&H||!v)return 1;if(!d&&!E&&!ce&&s<o||ce&&l&&v&&!d&&!E||L&&l&&v||!M&&v||!H)return-1}return 0}function xM(s,o,l){for(var d=-1,v=s.criteria,E=o.criteria,M=v.length,L=l.length;++d<M;){var H=cS(v[d],E[d]);if(H){if(d>=L)return H;var ce=l[d];return H*(ce=="desc"?-1:1)}}return s.index-o.index}function lS(s,o,l,d){for(var v=-1,E=s.length,M=l.length,L=-1,H=o.length,ce=br(E-M,0),fe=te(H+ce),ye=!d;++L<H;)fe[L]=o[L];for(;++v<M;)(ye||v<E)&&(fe[l[v]]=s[v]);for(;ce--;)fe[L++]=s[v++];return fe}function fS(s,o,l,d){for(var v=-1,E=s.length,M=-1,L=l.length,H=-1,ce=o.length,fe=br(E-L,0),ye=te(fe+ce),Ce=!d;++v<fe;)ye[v]=s[v];for(var Le=v;++H<ce;)ye[Le+H]=o[H];for(;++M<L;)(Ce||v<E)&&(ye[Le+l[M]]=s[v++]);return ye}function nn(s,o){var l=-1,d=s.length;for(o||(o=te(d));++l<d;)o[l]=s[l];return o}function hi(s,o,l,d){var v=!l;l||(l={});for(var E=-1,M=o.length;++E<M;){var L=o[E],H=d?d(l[L],s[L],L,l,s):t;H===t&&(H=s[L]),v?Ni(l,L,H):Go(l,L,H)}return l}function EM(s,o){return hi(s,Lp(s),o)}function OM(s,o){return hi(s,ES(s),o)}function Kc(s,o){return function(l,d){var v=Xe(l)?CN:Q2,E=o?o():{};return v(l,s,We(d,2),E)}}function La(s){return st(function(o,l){var d=-1,v=l.length,E=v>1?l[v-1]:t,M=v>2?l[2]:t;for(E=s.length>3&&typeof E=="function"?(v--,E):t,M&&Yr(l[0],l[1],M)&&(E=v<3?t:E,v=1),o=Mt(o);++d<v;){var L=l[d];L&&s(o,L,d,E)}return o})}function hS(s,o){return function(l,d){if(l==null)return l;if(!sn(l))return s(l,d);for(var v=l.length,E=o?v:-1,M=Mt(l);(o?E--:++E<v)&&d(M[E],E,M)!==!1;);return l}}function dS(s){return function(o,l,d){for(var v=-1,E=Mt(o),M=d(o),L=M.length;L--;){var H=M[s?L:++v];if(l(E[H],H,E)===!1)break}return o}}function TM(s,o,l){var d=o&_,v=Xo(s);function E(){var M=this&&this!==Cr&&this instanceof E?v:s;return M.apply(d?l:this,arguments)}return E}function pS(s){return function(o){o=It(o);var l=Ca(o)?ti(o):t,d=l?l[0]:o.charAt(0),v=l?gs(l,1).join(""):o.slice(1);return d[s]()+v}}function qa(s){return function(o){return tp(hx(fx(o).replace(yN,"")),s,"")}}function Xo(s){return function(){var o=arguments;switch(o.length){case 0:return new s;case 1:return new s(o[0]);case 2:return new s(o[0],o[1]);case 3:return new s(o[0],o[1],o[2]);case 4:return new s(o[0],o[1],o[2],o[3]);case 5:return new s(o[0],o[1],o[2],o[3],o[4]);case 6:return new s(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new s(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var l=Fa(s.prototype),d=s.apply(l,o);return Zt(d)?d:l}}function AM(s,o,l){var d=Xo(s);function v(){for(var E=arguments.length,M=te(E),L=E,H=ja(v);L--;)M[L]=arguments[L];var ce=E<3&&M[0]!==H&&M[E-1]!==H?[]:hs(M,H);if(E-=ce.length,E<l)return bS(s,o,Zc,v.placeholder,t,M,ce,t,t,l-E);var fe=this&&this!==Cr&&this instanceof v?d:s;return gn(fe,this,M)}return v}function mS(s){return function(o,l,d){var v=Mt(o);if(!sn(o)){var E=We(l,3);o=Or(o),l=function(L){return E(v[L],L,v)}}var M=s(o,l,d);return M>-1?v[E?o[M]:M]:t}}function yS(s){return Ri(function(o){var l=o.length,d=l,v=$n.prototype.thru;for(s&&o.reverse();d--;){var E=o[d];if(typeof E!="function")throw new Un(u);if(v&&!M&&rl(E)=="wrapper")var M=new $n([],!0)}for(d=M?d:l;++d<l;){E=o[d];var L=rl(E),H=L=="wrapper"?Dp(E):t;H&&jp(H[0])&&H[1]==(V|C|O|D)&&!H[4].length&&H[9]==1?M=M[rl(H[0])].apply(M,H[3]):M=E.length==1&&jp(E)?M[L]():M.thru(E)}return function(){var ce=arguments,fe=ce[0];if(M&&ce.length==1&&Xe(fe))return M.plant(fe).value();for(var ye=0,Ce=l?o[ye].apply(this,ce):fe;++ye<l;)Ce=o[ye].call(this,Ce);return Ce}})}function Zc(s,o,l,d,v,E,M,L,H,ce){var fe=o&V,ye=o&_,Ce=o&w,Le=o&(C|R),He=o&U,it=Ce?t:Xo(s);function Qe(){for(var ft=arguments.length,yt=te(ft),_n=ft;_n--;)yt[_n]=arguments[_n];if(Le)var Kr=ja(Qe),Sn=jN(yt,Kr);if(d&&(yt=lS(yt,d,v,Le)),E&&(yt=fS(yt,E,M,Le)),ft-=Sn,Le&&ft<ce){var cr=hs(yt,Kr);return bS(s,o,Zc,Qe.placeholder,l,yt,cr,L,H,ce-ft)}var ii=ye?l:this,qi=Ce?ii[s]:s;return ft=yt.length,L?yt=QM(yt,L):He&&ft>1&&yt.reverse(),fe&&H<ft&&(yt.length=H),this&&this!==Cr&&this instanceof Qe&&(qi=it||Xo(qi)),qi.apply(ii,yt)}return Qe}function gS(s,o){return function(l,d){return tM(l,s,o(d),{})}}function Xc(s,o){return function(l,d){var v;if(l===t&&d===t)return o;if(l!==t&&(v=l),d!==t){if(v===t)return d;typeof l=="string"||typeof d=="string"?(l=bn(l),d=bn(d)):(l=rS(l),d=rS(d)),v=s(l,d)}return v}}function Pp(s){return Ri(function(o){return o=Ht(o,vn(We())),st(function(l){var d=this;return s(o,function(v){return gn(v,d,l)})})})}function el(s,o){o=o===t?" ":bn(o);var l=o.length;if(l<2)return l?Ep(o,s):o;var d=Ep(o,Uc(s/Pa(o)));return Ca(o)?gs(ti(d),0,s).join(""):d.slice(0,s)}function kM(s,o,l,d){var v=o&_,E=Xo(s);function M(){for(var L=-1,H=arguments.length,ce=-1,fe=d.length,ye=te(fe+H),Ce=this&&this!==Cr&&this instanceof M?E:s;++ce<fe;)ye[ce]=d[ce];for(;H--;)ye[ce++]=arguments[++L];return gn(Ce,v?l:this,ye)}return M}function vS(s){return function(o,l,d){return d&&typeof d!="number"&&Yr(o,l,d)&&(l=d=t),o=Li(o),l===t?(l=o,o=0):l=Li(l),d=d===t?o<l?1:-1:Li(d),dM(o,l,d,s)}}function tl(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=zn(o),l=zn(l)),s(o,l)}}function bS(s,o,l,d,v,E,M,L,H,ce){var fe=o&C,ye=fe?M:t,Ce=fe?t:M,Le=fe?E:t,He=fe?t:E;o|=fe?O:N,o&=~(fe?N:O),o&T||(o&=-4);var it=[s,o,v,Le,ye,He,Ce,L,H,ce],Qe=l.apply(t,it);return jp(s)&&PS(Qe,it),Qe.placeholder=d,NS(Qe,s,o)}function Np(s){var o=vr[s];return function(l,d){if(l=zn(l),d=d==null?0:Fr(tt(d),292),d&&N_(l)){var v=(It(l)+"e").split("e"),E=o(v[0]+"e"+(+v[1]+d));return v=(It(E)+"e").split("e"),+(v[0]+"e"+(+v[1]-d))}return o(l)}}var IM=Ra&&1/Cc(new Ra([,-0]))[1]==Ee?function(s){return new Ra(s)}:em;function wS(s){return function(o){var l=Lr(o);return l==Z?up(o):l==_e?HN(o):qN(o,s(o))}}function Mi(s,o,l,d,v,E,M,L){var H=o&w;if(!H&&typeof s!="function")throw new Un(u);var ce=d?d.length:0;if(ce||(o&=-97,d=v=t),M=M===t?M:br(tt(M),0),L=L===t?L:tt(L),ce-=v?v.length:0,o&N){var fe=d,ye=v;d=v=t}var Ce=H?t:Dp(s),Le=[s,o,l,d,v,fe,ye,E,M,L];if(Ce&&WM(Le,Ce),s=Le[0],o=Le[1],l=Le[2],d=Le[3],v=Le[4],L=Le[9]=Le[9]===t?H?0:s.length:br(Le[9]-ce,0),!L&&o&(C|R)&&(o&=-25),!o||o==_)var He=TM(s,o,l);else o==C||o==R?He=AM(s,o,L):(o==O||o==(_|O))&&!v.length?He=kM(s,o,l,d):He=Zc.apply(t,Le);var it=Ce?eS:PS;return NS(it(He,Le),s,o)}function _S(s,o,l,d){return s===t||ni(s,Ma[l])&&!Ct.call(d,l)?o:s}function SS(s,o,l,d,v,E){return Zt(s)&&Zt(o)&&(E.set(o,s),Gc(s,o,t,SS,E),E.delete(o)),s}function CM(s){return ru(s)?t:s}function xS(s,o,l,d,v,E){var M=l&b,L=s.length,H=o.length;if(L!=H&&!(M&&H>L))return!1;var ce=E.get(s),fe=E.get(o);if(ce&&fe)return ce==o&&fe==s;var ye=-1,Ce=!0,Le=l&k?new js:t;for(E.set(s,o),E.set(o,s);++ye<L;){var He=s[ye],it=o[ye];if(d)var Qe=M?d(it,He,ye,o,s,E):d(He,it,ye,s,o,E);if(Qe!==t){if(Qe)continue;Ce=!1;break}if(Le){if(!rp(o,function(ft,yt){if(!Bo(Le,yt)&&(He===ft||v(He,ft,l,d,E)))return Le.push(yt)})){Ce=!1;break}}else if(!(He===it||v(He,it,l,d,E))){Ce=!1;break}}return E.delete(s),E.delete(o),Ce}function PM(s,o,l,d,v,E,M){switch(l){case sr:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Jt:return!(s.byteLength!=o.byteLength||!E(new Fc(s),new Fc(o)));case Ye:case Me:case ne:return ni(+s,+o);case W:return s.name==o.name&&s.message==o.message;case le:case Ge:return s==o+"";case Z:var L=up;case _e:var H=d&b;if(L||(L=Cc),s.size!=o.size&&!H)return!1;var ce=M.get(s);if(ce)return ce==o;d|=k,M.set(s,o);var fe=xS(L(s),L(o),d,v,E,M);return M.delete(s),fe;case ot:if(Qo)return Qo.call(s)==Qo.call(o)}return!1}function NM(s,o,l,d,v,E){var M=l&b,L=Mp(s),H=L.length,ce=Mp(o),fe=ce.length;if(H!=fe&&!M)return!1;for(var ye=H;ye--;){var Ce=L[ye];if(!(M?Ce in o:Ct.call(o,Ce)))return!1}var Le=E.get(s),He=E.get(o);if(Le&&He)return Le==o&&He==s;var it=!0;E.set(s,o),E.set(o,s);for(var Qe=M;++ye<H;){Ce=L[ye];var ft=s[Ce],yt=o[Ce];if(d)var _n=M?d(yt,ft,Ce,o,s,E):d(ft,yt,Ce,s,o,E);if(!(_n===t?ft===yt||v(ft,yt,l,d,E):_n)){it=!1;break}Qe||(Qe=Ce=="constructor")}if(it&&!Qe){var Kr=s.constructor,Sn=o.constructor;Kr!=Sn&&"constructor"in s&&"constructor"in o&&!(typeof Kr=="function"&&Kr instanceof Kr&&typeof Sn=="function"&&Sn instanceof Sn)&&(it=!1)}return E.delete(s),E.delete(o),it}function Ri(s){return $p(IS(s,t,qS),s+"")}function Mp(s){return V_(s,Or,Lp)}function Rp(s){return V_(s,an,ES)}var Dp=Bc?function(s){return Bc.get(s)}:em;function rl(s){for(var o=s.name+"",l=Da[o],d=Ct.call(Da,o)?l.length:0;d--;){var v=l[d],E=v.func;if(E==null||E==s)return v.name}return o}function ja(s){var o=Ct.call(x,"placeholder")?x:s;return o.placeholder}function We(){var s=x.iteratee||Zp;return s=s===Zp?H_:s,arguments.length?s(arguments[0],arguments[1]):s}function nl(s,o){var l=s.__data__;return UM(o)?l[typeof o=="string"?"string":"hash"]:l.map}function Fp(s){for(var o=Or(s),l=o.length;l--;){var d=o[l],v=s[d];o[l]=[d,v,AS(v)]}return o}function Bs(s,o){var l=VN(s,o);return z_(l)?l:t}function MM(s){var o=Ct.call(s,Ls),l=s[Ls];try{s[Ls]=t;var d=!0}catch{}var v=Rc.call(s);return d&&(o?s[Ls]=l:delete s[Ls]),v}var Lp=lp?function(s){return s==null?[]:(s=Mt(s),ls(lp(s),function(o){return C_.call(s,o)}))}:tm,ES=lp?function(s){for(var o=[];s;)fs(o,Lp(s)),s=Lc(s);return o}:tm,Lr=Jr;(fp&&Lr(new fp(new ArrayBuffer(1)))!=sr||Wo&&Lr(new Wo)!=Z||hp&&Lr(hp.resolve())!=qe||Ra&&Lr(new Ra)!=_e||zo&&Lr(new zo)!=Gt)&&(Lr=function(s){var o=Jr(s),l=o==xe?s.constructor:t,d=l?Vs(l):"";if(d)switch(d){case m2:return sr;case y2:return Z;case g2:return qe;case v2:return _e;case b2:return Gt}return o});function RM(s,o,l){for(var d=-1,v=l.length;++d<v;){var E=l[d],M=E.size;switch(E.type){case"drop":s+=M;break;case"dropRight":o-=M;break;case"take":o=Fr(o,s+M);break;case"takeRight":s=br(s,o-M);break}}return{start:s,end:o}}function DM(s){var o=s.match(Rn);return o?o[1].split(li):[]}function OS(s,o,l){o=ys(o,s);for(var d=-1,v=o.length,E=!1;++d<v;){var M=di(o[d]);if(!(E=s!=null&&l(s,M)))break;s=s[M]}return E||++d!=v?E:(v=s==null?0:s.length,!!v&&ll(v)&&Di(M,v)&&(Xe(s)||Ws(s)))}function FM(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&Ct.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function TS(s){return typeof s.constructor=="function"&&!eu(s)?Fa(Lc(s)):{}}function LM(s,o,l){var d=s.constructor;switch(o){case Jt:return Cp(s);case Ye:case Me:return new d(+s);case sr:return wM(s,l);case mr:case Rt:case ar:case dr:case zr:case jt:case Yt:case Q:case K:return uS(s,l);case Z:return new d;case ne:case Ge:return new d(s);case le:return _M(s);case _e:return new d;case ot:return SM(s)}}function qM(s,o){var l=o.length;if(!l)return s;var d=l-1;return o[d]=(l>1?"& ":"")+o[d],o=o.join(l>2?", ":" "),s.replace(Ir,`{
|
|
86
|
-
/* [wrapped with `+o+`] */
|
|
87
|
-
`)}function jM(s){return Xe(s)||Ws(s)||!!(P_&&s&&s[P_])}function Di(s,o){var l=typeof s;return o=o??ee,!!o&&(l=="number"||l!="symbol"&&Gr.test(s))&&s>-1&&s%1==0&&s<o}function Yr(s,o,l){if(!Zt(l))return!1;var d=typeof o;return(d=="number"?sn(l)&&Di(o,l.length):d=="string"&&o in l)?ni(l[o],s):!1}function qp(s,o){if(Xe(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||wn(s)?!0:rn.test(s)||!Dt.test(s)||o!=null&&s in Mt(o)}function UM(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function jp(s){var o=rl(s),l=x[o];if(typeof l!="function"||!(o in pt.prototype))return!1;if(s===l)return!0;var d=Dp(l);return!!d&&s===d[0]}function $M(s){return!!A_&&A_ in s}var BM=Nc?Fi:rm;function eu(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||Ma;return s===l}function AS(s){return s===s&&!Zt(s)}function kS(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in Mt(l))}}function VM(s){var o=ul(s,function(d){return l.size===h&&l.clear(),d}),l=o.cache;return o}function WM(s,o){var l=s[1],d=o[1],v=l|d,E=v<(_|w|V),M=d==V&&l==C||d==V&&l==D&&s[7].length<=o[8]||d==(V|D)&&o[7].length<=o[8]&&l==C;if(!(E||M))return s;d&_&&(s[2]=o[2],v|=l&_?0:T);var L=o[3];if(L){var H=s[3];s[3]=H?lS(H,L,o[4]):L,s[4]=H?hs(s[3],p):o[4]}return L=o[5],L&&(H=s[5],s[5]=H?fS(H,L,o[6]):L,s[6]=H?hs(s[5],p):o[6]),L=o[7],L&&(s[7]=L),d&V&&(s[8]=s[8]==null?o[8]:Fr(s[8],o[8])),s[9]==null&&(s[9]=o[9]),s[0]=o[0],s[1]=v,s}function zM(s){var o=[];if(s!=null)for(var l in Mt(s))o.push(l);return o}function HM(s){return Rc.call(s)}function IS(s,o,l){return o=br(o===t?s.length-1:o,0),function(){for(var d=arguments,v=-1,E=br(d.length-o,0),M=te(E);++v<E;)M[v]=d[o+v];v=-1;for(var L=te(o+1);++v<o;)L[v]=d[v];return L[o]=l(M),gn(s,this,L)}}function CS(s,o){return o.length<2?s:$s(s,Vn(o,0,-1))}function QM(s,o){for(var l=s.length,d=Fr(o.length,l),v=nn(s);d--;){var E=o[d];s[d]=Di(E,l)?v[E]:t}return s}function Up(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var PS=MS(eS),tu=u2||function(s,o){return Cr.setTimeout(s,o)},$p=MS(yM);function NS(s,o,l){var d=o+"";return $p(s,qM(d,GM(DM(d),l)))}function MS(s){var o=0,l=0;return function(){var d=h2(),v=Se-(d-l);if(l=d,v>0){if(++o>=re)return arguments[0]}else o=0;return s.apply(t,arguments)}}function il(s,o){var l=-1,d=s.length,v=d-1;for(o=o===t?d:o;++l<o;){var E=xp(l,v),M=s[E];s[E]=s[l],s[l]=M}return s.length=o,s}var RS=VM(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Rr,function(l,d,v,E){o.push(v?E.replace(Qr,"$1"):d||l)}),o});function di(s){if(typeof s=="string"||wn(s))return s;var o=s+"";return o=="0"&&1/s==-Ee?"-0":o}function Vs(s){if(s!=null){try{return Mc.call(s)}catch{}try{return s+""}catch{}}return""}function GM(s,o){return jn(rt,function(l){var d="_."+l[0];o&l[1]&&!kc(s,d)&&s.push(d)}),s.sort()}function DS(s){if(s instanceof pt)return s.clone();var o=new $n(s.__wrapped__,s.__chain__);return o.__actions__=nn(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function JM(s,o,l){(l?Yr(s,o,l):o===t)?o=1:o=br(tt(o),0);var d=s==null?0:s.length;if(!d||o<1)return[];for(var v=0,E=0,M=te(Uc(d/o));v<d;)M[E++]=Vn(s,v,v+=o);return M}function YM(s){for(var o=-1,l=s==null?0:s.length,d=0,v=[];++o<l;){var E=s[o];E&&(v[d++]=E)}return v}function KM(){var s=arguments.length;if(!s)return[];for(var o=te(s-1),l=arguments[0],d=s;d--;)o[d-1]=arguments[d];return fs(Xe(l)?nn(l):[l],Pr(o,1))}var ZM=st(function(s,o){return ur(s)?Jo(s,Pr(o,1,ur,!0)):[]}),XM=st(function(s,o){var l=Wn(o);return ur(l)&&(l=t),ur(s)?Jo(s,Pr(o,1,ur,!0),We(l,2)):[]}),eR=st(function(s,o){var l=Wn(o);return ur(l)&&(l=t),ur(s)?Jo(s,Pr(o,1,ur,!0),t,l):[]});function tR(s,o,l){var d=s==null?0:s.length;return d?(o=l||o===t?1:tt(o),Vn(s,o<0?0:o,d)):[]}function rR(s,o,l){var d=s==null?0:s.length;return d?(o=l||o===t?1:tt(o),o=d-o,Vn(s,0,o<0?0:o)):[]}function nR(s,o){return s&&s.length?Yc(s,We(o,3),!0,!0):[]}function iR(s,o){return s&&s.length?Yc(s,We(o,3),!0):[]}function sR(s,o,l,d){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&Yr(s,o,l)&&(l=0,d=v),K2(s,o,l,d)):[]}function FS(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=l==null?0:tt(l);return v<0&&(v=br(d+v,0)),Ic(s,We(o,3),v)}function LS(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=d-1;return l!==t&&(v=tt(l),v=l<0?br(d+v,0):Fr(v,d-1)),Ic(s,We(o,3),v,!0)}function qS(s){var o=s==null?0:s.length;return o?Pr(s,1):[]}function aR(s){var o=s==null?0:s.length;return o?Pr(s,Ee):[]}function oR(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:tt(o),Pr(s,o)):[]}function uR(s){for(var o=-1,l=s==null?0:s.length,d={};++o<l;){var v=s[o];d[v[0]]=v[1]}return d}function jS(s){return s&&s.length?s[0]:t}function cR(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=l==null?0:tt(l);return v<0&&(v=br(d+v,0)),Ia(s,o,v)}function lR(s){var o=s==null?0:s.length;return o?Vn(s,0,-1):[]}var fR=st(function(s){var o=Ht(s,kp);return o.length&&o[0]===s[0]?vp(o):[]}),hR=st(function(s){var o=Wn(s),l=Ht(s,kp);return o===Wn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?vp(l,We(o,2)):[]}),dR=st(function(s){var o=Wn(s),l=Ht(s,kp);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?vp(l,t,o):[]});function pR(s,o){return s==null?"":l2.call(s,o)}function Wn(s){var o=s==null?0:s.length;return o?s[o-1]:t}function mR(s,o,l){var d=s==null?0:s.length;if(!d)return-1;var v=d;return l!==t&&(v=tt(l),v=v<0?br(d+v,0):Fr(v,d-1)),o===o?GN(s,o,v):Ic(s,b_,v,!0)}function yR(s,o){return s&&s.length?Y_(s,tt(o)):t}var gR=st(US);function US(s,o){return s&&s.length&&o&&o.length?Sp(s,o):s}function vR(s,o,l){return s&&s.length&&o&&o.length?Sp(s,o,We(l,2)):s}function bR(s,o,l){return s&&s.length&&o&&o.length?Sp(s,o,t,l):s}var wR=Ri(function(s,o){var l=s==null?0:s.length,d=pp(s,o);return X_(s,Ht(o,function(v){return Di(v,l)?+v:v}).sort(cS)),d});function _R(s,o){var l=[];if(!(s&&s.length))return l;var d=-1,v=[],E=s.length;for(o=We(o,3);++d<E;){var M=s[d];o(M,d,s)&&(l.push(M),v.push(d))}return X_(s,v),l}function Bp(s){return s==null?s:p2.call(s)}function SR(s,o,l){var d=s==null?0:s.length;return d?(l&&typeof l!="number"&&Yr(s,o,l)?(o=0,l=d):(o=o==null?0:tt(o),l=l===t?d:tt(l)),Vn(s,o,l)):[]}function xR(s,o){return Jc(s,o)}function ER(s,o,l){return Op(s,o,We(l,2))}function OR(s,o){var l=s==null?0:s.length;if(l){var d=Jc(s,o);if(d<l&&ni(s[d],o))return d}return-1}function TR(s,o){return Jc(s,o,!0)}function AR(s,o,l){return Op(s,o,We(l,2),!0)}function kR(s,o){var l=s==null?0:s.length;if(l){var d=Jc(s,o,!0)-1;if(ni(s[d],o))return d}return-1}function IR(s){return s&&s.length?tS(s):[]}function CR(s,o){return s&&s.length?tS(s,We(o,2)):[]}function PR(s){var o=s==null?0:s.length;return o?Vn(s,1,o):[]}function NR(s,o,l){return s&&s.length?(o=l||o===t?1:tt(o),Vn(s,0,o<0?0:o)):[]}function MR(s,o,l){var d=s==null?0:s.length;return d?(o=l||o===t?1:tt(o),o=d-o,Vn(s,o<0?0:o,d)):[]}function RR(s,o){return s&&s.length?Yc(s,We(o,3),!1,!0):[]}function DR(s,o){return s&&s.length?Yc(s,We(o,3)):[]}var FR=st(function(s){return ms(Pr(s,1,ur,!0))}),LR=st(function(s){var o=Wn(s);return ur(o)&&(o=t),ms(Pr(s,1,ur,!0),We(o,2))}),qR=st(function(s){var o=Wn(s);return o=typeof o=="function"?o:t,ms(Pr(s,1,ur,!0),t,o)});function jR(s){return s&&s.length?ms(s):[]}function UR(s,o){return s&&s.length?ms(s,We(o,2)):[]}function $R(s,o){return o=typeof o=="function"?o:t,s&&s.length?ms(s,t,o):[]}function Vp(s){if(!(s&&s.length))return[];var o=0;return s=ls(s,function(l){if(ur(l))return o=br(l.length,o),!0}),ap(o,function(l){return Ht(s,np(l))})}function $S(s,o){if(!(s&&s.length))return[];var l=Vp(s);return o==null?l:Ht(l,function(d){return gn(o,t,d)})}var BR=st(function(s,o){return ur(s)?Jo(s,o):[]}),VR=st(function(s){return Ap(ls(s,ur))}),WR=st(function(s){var o=Wn(s);return ur(o)&&(o=t),Ap(ls(s,ur),We(o,2))}),zR=st(function(s){var o=Wn(s);return o=typeof o=="function"?o:t,Ap(ls(s,ur),t,o)}),HR=st(Vp);function QR(s,o){return sS(s||[],o||[],Go)}function GR(s,o){return sS(s||[],o||[],Zo)}var JR=st(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,$S(s,l)});function BS(s){var o=x(s);return o.__chain__=!0,o}function YR(s,o){return o(s),s}function sl(s,o){return o(s)}var KR=Ri(function(s){var o=s.length,l=o?s[0]:0,d=this.__wrapped__,v=function(E){return pp(E,s)};return o>1||this.__actions__.length||!(d instanceof pt)||!Di(l)?this.thru(v):(d=d.slice(l,+l+(o?1:0)),d.__actions__.push({func:sl,args:[v],thisArg:t}),new $n(d,this.__chain__).thru(function(E){return o&&!E.length&&E.push(t),E}))});function ZR(){return BS(this)}function XR(){return new $n(this.value(),this.__chain__)}function eD(){this.__values__===t&&(this.__values__=rx(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function tD(){return this}function rD(s){for(var o,l=this;l instanceof Wc;){var d=DS(l);d.__index__=0,d.__values__=t,o?v.__wrapped__=d:o=d;var v=d;l=l.__wrapped__}return v.__wrapped__=s,o}function nD(){var s=this.__wrapped__;if(s instanceof pt){var o=s;return this.__actions__.length&&(o=new pt(this)),o=o.reverse(),o.__actions__.push({func:sl,args:[Bp],thisArg:t}),new $n(o,this.__chain__)}return this.thru(Bp)}function iD(){return iS(this.__wrapped__,this.__actions__)}var sD=Kc(function(s,o,l){Ct.call(s,l)?++s[l]:Ni(s,l,1)});function aD(s,o,l){var d=Xe(s)?g_:Y2;return l&&Yr(s,o,l)&&(o=t),d(s,We(o,3))}function oD(s,o){var l=Xe(s)?ls:$_;return l(s,We(o,3))}var uD=mS(FS),cD=mS(LS);function lD(s,o){return Pr(al(s,o),1)}function fD(s,o){return Pr(al(s,o),Ee)}function hD(s,o,l){return l=l===t?1:tt(l),Pr(al(s,o),l)}function VS(s,o){var l=Xe(s)?jn:ps;return l(s,We(o,3))}function WS(s,o){var l=Xe(s)?PN:U_;return l(s,We(o,3))}var dD=Kc(function(s,o,l){Ct.call(s,l)?s[l].push(o):Ni(s,l,[o])});function pD(s,o,l,d){s=sn(s)?s:$a(s),l=l&&!d?tt(l):0;var v=s.length;return l<0&&(l=br(v+l,0)),fl(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&Ia(s,o,l)>-1}var mD=st(function(s,o,l){var d=-1,v=typeof o=="function",E=sn(s)?te(s.length):[];return ps(s,function(M){E[++d]=v?gn(o,M,l):Yo(M,o,l)}),E}),yD=Kc(function(s,o,l){Ni(s,l,o)});function al(s,o){var l=Xe(s)?Ht:Q_;return l(s,We(o,3))}function gD(s,o,l,d){return s==null?[]:(Xe(o)||(o=o==null?[]:[o]),l=d?t:l,Xe(l)||(l=l==null?[]:[l]),K_(s,o,l))}var vD=Kc(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function bD(s,o,l){var d=Xe(s)?tp:__,v=arguments.length<3;return d(s,We(o,4),l,v,ps)}function wD(s,o,l){var d=Xe(s)?NN:__,v=arguments.length<3;return d(s,We(o,4),l,v,U_)}function _D(s,o){var l=Xe(s)?ls:$_;return l(s,cl(We(o,3)))}function SD(s){var o=Xe(s)?F_:pM;return o(s)}function xD(s,o,l){(l?Yr(s,o,l):o===t)?o=1:o=tt(o);var d=Xe(s)?z2:mM;return d(s,o)}function ED(s){var o=Xe(s)?H2:gM;return o(s)}function OD(s){if(s==null)return 0;if(sn(s))return fl(s)?Pa(s):s.length;var o=Lr(s);return o==Z||o==_e?s.size:wp(s).length}function TD(s,o,l){var d=Xe(s)?rp:vM;return l&&Yr(s,o,l)&&(o=t),d(s,We(o,3))}var AD=st(function(s,o){if(s==null)return[];var l=o.length;return l>1&&Yr(s,o[0],o[1])?o=[]:l>2&&Yr(o[0],o[1],o[2])&&(o=[o[0]]),K_(s,Pr(o,1),[])}),ol=o2||function(){return Cr.Date.now()};function kD(s,o){if(typeof o!="function")throw new Un(u);return s=tt(s),function(){if(--s<1)return o.apply(this,arguments)}}function zS(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Mi(s,V,t,t,t,t,o)}function HS(s,o){var l;if(typeof o!="function")throw new Un(u);return s=tt(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var Wp=st(function(s,o,l){var d=_;if(l.length){var v=hs(l,ja(Wp));d|=O}return Mi(s,d,o,l,v)}),QS=st(function(s,o,l){var d=_|w;if(l.length){var v=hs(l,ja(QS));d|=O}return Mi(o,d,s,l,v)});function GS(s,o,l){o=l?t:o;var d=Mi(s,C,t,t,t,t,t,o);return d.placeholder=GS.placeholder,d}function JS(s,o,l){o=l?t:o;var d=Mi(s,R,t,t,t,t,t,o);return d.placeholder=JS.placeholder,d}function YS(s,o,l){var d,v,E,M,L,H,ce=0,fe=!1,ye=!1,Ce=!0;if(typeof s!="function")throw new Un(u);o=zn(o)||0,Zt(l)&&(fe=!!l.leading,ye="maxWait"in l,E=ye?br(zn(l.maxWait)||0,o):E,Ce="trailing"in l?!!l.trailing:Ce);function Le(cr){var ii=d,qi=v;return d=v=t,ce=cr,M=s.apply(qi,ii),M}function He(cr){return ce=cr,L=tu(ft,o),fe?Le(cr):M}function it(cr){var ii=cr-H,qi=cr-ce,mx=o-ii;return ye?Fr(mx,E-qi):mx}function Qe(cr){var ii=cr-H,qi=cr-ce;return H===t||ii>=o||ii<0||ye&&qi>=E}function ft(){var cr=ol();if(Qe(cr))return yt(cr);L=tu(ft,it(cr))}function yt(cr){return L=t,Ce&&d?Le(cr):(d=v=t,M)}function _n(){L!==t&&aS(L),ce=0,d=H=v=L=t}function Kr(){return L===t?M:yt(ol())}function Sn(){var cr=ol(),ii=Qe(cr);if(d=arguments,v=this,H=cr,ii){if(L===t)return He(H);if(ye)return aS(L),L=tu(ft,o),Le(H)}return L===t&&(L=tu(ft,o)),M}return Sn.cancel=_n,Sn.flush=Kr,Sn}var ID=st(function(s,o){return j_(s,1,o)}),CD=st(function(s,o,l){return j_(s,zn(o)||0,l)});function PD(s){return Mi(s,U)}function ul(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new Un(u);var l=function(){var d=arguments,v=o?o.apply(this,d):d[0],E=l.cache;if(E.has(v))return E.get(v);var M=s.apply(this,d);return l.cache=E.set(v,M)||E,M};return l.cache=new(ul.Cache||Pi),l}ul.Cache=Pi;function cl(s){if(typeof s!="function")throw new Un(u);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function ND(s){return HS(2,s)}var MD=bM(function(s,o){o=o.length==1&&Xe(o[0])?Ht(o[0],vn(We())):Ht(Pr(o,1),vn(We()));var l=o.length;return st(function(d){for(var v=-1,E=Fr(d.length,l);++v<E;)d[v]=o[v].call(this,d[v]);return gn(s,this,d)})}),zp=st(function(s,o){var l=hs(o,ja(zp));return Mi(s,O,t,o,l)}),KS=st(function(s,o){var l=hs(o,ja(KS));return Mi(s,N,t,o,l)}),RD=Ri(function(s,o){return Mi(s,D,t,t,t,o)});function DD(s,o){if(typeof s!="function")throw new Un(u);return o=o===t?o:tt(o),st(s,o)}function FD(s,o){if(typeof s!="function")throw new Un(u);return o=o==null?0:br(tt(o),0),st(function(l){var d=l[o],v=gs(l,0,o);return d&&fs(v,d),gn(s,this,v)})}function LD(s,o,l){var d=!0,v=!0;if(typeof s!="function")throw new Un(u);return Zt(l)&&(d="leading"in l?!!l.leading:d,v="trailing"in l?!!l.trailing:v),YS(s,o,{leading:d,maxWait:o,trailing:v})}function qD(s){return zS(s,1)}function jD(s,o){return zp(Ip(o),s)}function UD(){if(!arguments.length)return[];var s=arguments[0];return Xe(s)?s:[s]}function $D(s){return Bn(s,g)}function BD(s,o){return o=typeof o=="function"?o:t,Bn(s,g,o)}function VD(s){return Bn(s,m|g)}function WD(s,o){return o=typeof o=="function"?o:t,Bn(s,m|g,o)}function zD(s,o){return o==null||q_(s,o,Or(o))}function ni(s,o){return s===o||s!==s&&o!==o}var HD=tl(gp),QD=tl(function(s,o){return s>=o}),Ws=W_(function(){return arguments}())?W_:function(s){return nr(s)&&Ct.call(s,"callee")&&!C_.call(s,"callee")},Xe=te.isArray,GD=f_?vn(f_):rM;function sn(s){return s!=null&&ll(s.length)&&!Fi(s)}function ur(s){return nr(s)&&sn(s)}function JD(s){return s===!0||s===!1||nr(s)&&Jr(s)==Ye}var vs=c2||rm,YD=h_?vn(h_):nM;function KD(s){return nr(s)&&s.nodeType===1&&!ru(s)}function ZD(s){if(s==null)return!0;if(sn(s)&&(Xe(s)||typeof s=="string"||typeof s.splice=="function"||vs(s)||Ua(s)||Ws(s)))return!s.length;var o=Lr(s);if(o==Z||o==_e)return!s.size;if(eu(s))return!wp(s).length;for(var l in s)if(Ct.call(s,l))return!1;return!0}function XD(s,o){return Ko(s,o)}function eF(s,o,l){l=typeof l=="function"?l:t;var d=l?l(s,o):t;return d===t?Ko(s,o,t,l):!!d}function Hp(s){if(!nr(s))return!1;var o=Jr(s);return o==W||o==Ue||typeof s.message=="string"&&typeof s.name=="string"&&!ru(s)}function tF(s){return typeof s=="number"&&N_(s)}function Fi(s){if(!Zt(s))return!1;var o=Jr(s);return o==J||o==$||o==wt||o==$e}function ZS(s){return typeof s=="number"&&s==tt(s)}function ll(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ee}function Zt(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function nr(s){return s!=null&&typeof s=="object"}var XS=d_?vn(d_):sM;function rF(s,o){return s===o||bp(s,o,Fp(o))}function nF(s,o,l){return l=typeof l=="function"?l:t,bp(s,o,Fp(o),l)}function iF(s){return ex(s)&&s!=+s}function sF(s){if(BM(s))throw new Ze(a);return z_(s)}function aF(s){return s===null}function oF(s){return s==null}function ex(s){return typeof s=="number"||nr(s)&&Jr(s)==ne}function ru(s){if(!nr(s)||Jr(s)!=xe)return!1;var o=Lc(s);if(o===null)return!0;var l=Ct.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&Mc.call(l)==n2}var Qp=p_?vn(p_):aM;function uF(s){return ZS(s)&&s>=-ee&&s<=ee}var tx=m_?vn(m_):oM;function fl(s){return typeof s=="string"||!Xe(s)&&nr(s)&&Jr(s)==Ge}function wn(s){return typeof s=="symbol"||nr(s)&&Jr(s)==ot}var Ua=y_?vn(y_):uM;function cF(s){return s===t}function lF(s){return nr(s)&&Lr(s)==Gt}function fF(s){return nr(s)&&Jr(s)==Ot}var hF=tl(_p),dF=tl(function(s,o){return s<=o});function rx(s){if(!s)return[];if(sn(s))return fl(s)?ti(s):nn(s);if(Vo&&s[Vo])return zN(s[Vo]());var o=Lr(s),l=o==Z?up:o==_e?Cc:$a;return l(s)}function Li(s){if(!s)return s===0?s:0;if(s=zn(s),s===Ee||s===-Ee){var o=s<0?-1:1;return o*pe}return s===s?s:0}function tt(s){var o=Li(s),l=o%1;return o===o?l?o-l:o:0}function nx(s){return s?Us(tt(s),0,de):0}function zn(s){if(typeof s=="number")return s;if(wn(s))return q;if(Zt(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=Zt(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=S_(s);var l=Ln.test(s);return l||mt.test(s)?kN(s.slice(2),l?2:8):Fn.test(s)?q:+s}function ix(s){return hi(s,an(s))}function pF(s){return s?Us(tt(s),-ee,ee):s===0?s:0}function It(s){return s==null?"":bn(s)}var mF=La(function(s,o){if(eu(o)||sn(o)){hi(o,Or(o),s);return}for(var l in o)Ct.call(o,l)&&Go(s,l,o[l])}),sx=La(function(s,o){hi(o,an(o),s)}),hl=La(function(s,o,l,d){hi(o,an(o),s,d)}),yF=La(function(s,o,l,d){hi(o,Or(o),s,d)}),gF=Ri(pp);function vF(s,o){var l=Fa(s);return o==null?l:L_(l,o)}var bF=st(function(s,o){s=Mt(s);var l=-1,d=o.length,v=d>2?o[2]:t;for(v&&Yr(o[0],o[1],v)&&(d=1);++l<d;)for(var E=o[l],M=an(E),L=-1,H=M.length;++L<H;){var ce=M[L],fe=s[ce];(fe===t||ni(fe,Ma[ce])&&!Ct.call(s,ce))&&(s[ce]=E[ce])}return s}),wF=st(function(s){return s.push(t,SS),gn(ax,t,s)});function _F(s,o){return v_(s,We(o,3),fi)}function SF(s,o){return v_(s,We(o,3),yp)}function xF(s,o){return s==null?s:mp(s,We(o,3),an)}function EF(s,o){return s==null?s:B_(s,We(o,3),an)}function OF(s,o){return s&&fi(s,We(o,3))}function TF(s,o){return s&&yp(s,We(o,3))}function AF(s){return s==null?[]:Qc(s,Or(s))}function kF(s){return s==null?[]:Qc(s,an(s))}function Gp(s,o,l){var d=s==null?t:$s(s,o);return d===t?l:d}function IF(s,o){return s!=null&&OS(s,o,Z2)}function Jp(s,o){return s!=null&&OS(s,o,X2)}var CF=gS(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Rc.call(o)),s[o]=l},Kp(on)),PF=gS(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Rc.call(o)),Ct.call(s,o)?s[o].push(l):s[o]=[l]},We),NF=st(Yo);function Or(s){return sn(s)?D_(s):wp(s)}function an(s){return sn(s)?D_(s,!0):cM(s)}function MF(s,o){var l={};return o=We(o,3),fi(s,function(d,v,E){Ni(l,o(d,v,E),d)}),l}function RF(s,o){var l={};return o=We(o,3),fi(s,function(d,v,E){Ni(l,v,o(d,v,E))}),l}var DF=La(function(s,o,l){Gc(s,o,l)}),ax=La(function(s,o,l,d){Gc(s,o,l,d)}),FF=Ri(function(s,o){var l={};if(s==null)return l;var d=!1;o=Ht(o,function(E){return E=ys(E,s),d||(d=E.length>1),E}),hi(s,Rp(s),l),d&&(l=Bn(l,m|y|g,CM));for(var v=o.length;v--;)Tp(l,o[v]);return l});function LF(s,o){return ox(s,cl(We(o)))}var qF=Ri(function(s,o){return s==null?{}:fM(s,o)});function ox(s,o){if(s==null)return{};var l=Ht(Rp(s),function(d){return[d]});return o=We(o),Z_(s,l,function(d,v){return o(d,v[0])})}function jF(s,o,l){o=ys(o,s);var d=-1,v=o.length;for(v||(v=1,s=t);++d<v;){var E=s==null?t:s[di(o[d])];E===t&&(d=v,E=l),s=Fi(E)?E.call(s):E}return s}function UF(s,o,l){return s==null?s:Zo(s,o,l)}function $F(s,o,l,d){return d=typeof d=="function"?d:t,s==null?s:Zo(s,o,l,d)}var ux=wS(Or),cx=wS(an);function BF(s,o,l){var d=Xe(s),v=d||vs(s)||Ua(s);if(o=We(o,4),l==null){var E=s&&s.constructor;v?l=d?new E:[]:Zt(s)?l=Fi(E)?Fa(Lc(s)):{}:l={}}return(v?jn:fi)(s,function(M,L,H){return o(l,M,L,H)}),l}function VF(s,o){return s==null?!0:Tp(s,o)}function WF(s,o,l){return s==null?s:nS(s,o,Ip(l))}function zF(s,o,l,d){return d=typeof d=="function"?d:t,s==null?s:nS(s,o,Ip(l),d)}function $a(s){return s==null?[]:op(s,Or(s))}function HF(s){return s==null?[]:op(s,an(s))}function QF(s,o,l){return l===t&&(l=o,o=t),l!==t&&(l=zn(l),l=l===l?l:0),o!==t&&(o=zn(o),o=o===o?o:0),Us(zn(s),o,l)}function GF(s,o,l){return o=Li(o),l===t?(l=o,o=0):l=Li(l),s=zn(s),eM(s,o,l)}function JF(s,o,l){if(l&&typeof l!="boolean"&&Yr(s,o,l)&&(o=l=t),l===t&&(typeof o=="boolean"?(l=o,o=t):typeof s=="boolean"&&(l=s,s=t)),s===t&&o===t?(s=0,o=1):(s=Li(s),o===t?(o=s,s=0):o=Li(o)),s>o){var d=s;s=o,o=d}if(l||s%1||o%1){var v=M_();return Fr(s+v*(o-s+AN("1e-"+((v+"").length-1))),o)}return xp(s,o)}var YF=qa(function(s,o,l){return o=o.toLowerCase(),s+(l?lx(o):o)});function lx(s){return Yp(It(s).toLowerCase())}function fx(s){return s=It(s),s&&s.replace(S,UN).replace(gN,"")}function KF(s,o,l){s=It(s),o=bn(o);var d=s.length;l=l===t?d:Us(tt(l),0,d);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function ZF(s){return s=It(s),s&&or.test(s)?s.replace(Kt,$N):s}function XF(s){return s=It(s),s&&Hr.test(s)?s.replace(gr,"\\$&"):s}var eL=qa(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),tL=qa(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),rL=pS("toLowerCase");function nL(s,o,l){s=It(s),o=tt(o);var d=o?Pa(s):0;if(!o||d>=o)return s;var v=(o-d)/2;return el($c(v),l)+s+el(Uc(v),l)}function iL(s,o,l){s=It(s),o=tt(o);var d=o?Pa(s):0;return o&&d<o?s+el(o-d,l):s}function sL(s,o,l){s=It(s),o=tt(o);var d=o?Pa(s):0;return o&&d<o?el(o-d,l)+s:s}function aL(s,o,l){return l||o==null?o=0:o&&(o=+o),d2(It(s).replace(Dr,""),o||0)}function oL(s,o,l){return(l?Yr(s,o,l):o===t)?o=1:o=tt(o),Ep(It(s),o)}function uL(){var s=arguments,o=It(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var cL=qa(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function lL(s,o,l){return l&&typeof l!="number"&&Yr(s,o,l)&&(o=l=t),l=l===t?de:l>>>0,l?(s=It(s),s&&(typeof o=="string"||o!=null&&!Qp(o))&&(o=bn(o),!o&&Ca(s))?gs(ti(s),0,l):s.split(o,l)):[]}var fL=qa(function(s,o,l){return s+(l?" ":"")+Yp(o)});function hL(s,o,l){return s=It(s),l=l==null?0:Us(tt(l),0,s.length),o=bn(o),s.slice(l,l+o.length)==o}function dL(s,o,l){var d=x.templateSettings;l&&Yr(s,o,l)&&(o=t),s=It(s),o=hl({},o,d,_S);var v=hl({},o.imports,d.imports,_S),E=Or(v),M=op(v,E),L,H,ce=0,fe=o.interpolate||I,ye="__p += '",Ce=cp((o.escape||I).source+"|"+fe.source+"|"+(fe===rr?zt:I).source+"|"+(o.evaluate||I).source+"|$","g"),Le="//# sourceURL="+(Ct.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++SN+"]")+`
|
|
88
|
-
`;s.replace(Ce,function(Qe,ft,yt,_n,Kr,Sn){return yt||(yt=_n),ye+=s.slice(ce,Sn).replace(A,BN),ft&&(L=!0,ye+=`' +
|
|
89
|
-
__e(`+ft+`) +
|
|
90
|
-
'`),Kr&&(H=!0,ye+=`';
|
|
91
|
-
`+Kr+`;
|
|
92
|
-
__p += '`),yt&&(ye+=`' +
|
|
93
|
-
((__t = (`+yt+`)) == null ? '' : __t) +
|
|
94
|
-
'`),ce=Sn+Qe.length,Qe}),ye+=`';
|
|
95
|
-
`;var He=Ct.call(o,"variable")&&o.variable;if(!He)ye=`with (obj) {
|
|
96
|
-
`+ye+`
|
|
97
|
-
}
|
|
98
|
-
`;else if(Er.test(He))throw new Ze(c);ye=(H?ye.replace(nt,""):ye).replace(at,"$1").replace(ct,"$1;"),ye="function("+(He||"obj")+`) {
|
|
99
|
-
`+(He?"":`obj || (obj = {});
|
|
100
|
-
`)+"var __t, __p = ''"+(L?", __e = _.escape":"")+(H?`, __j = Array.prototype.join;
|
|
101
|
-
function print() { __p += __j.call(arguments, '') }
|
|
102
|
-
`:`;
|
|
103
|
-
`)+ye+`return __p
|
|
104
|
-
}`;var it=dx(function(){return Tt(E,Le+"return "+ye).apply(t,M)});if(it.source=ye,Hp(it))throw it;return it}function pL(s){return It(s).toLowerCase()}function mL(s){return It(s).toUpperCase()}function yL(s,o,l){if(s=It(s),s&&(l||o===t))return S_(s);if(!s||!(o=bn(o)))return s;var d=ti(s),v=ti(o),E=x_(d,v),M=E_(d,v)+1;return gs(d,E,M).join("")}function gL(s,o,l){if(s=It(s),s&&(l||o===t))return s.slice(0,T_(s)+1);if(!s||!(o=bn(o)))return s;var d=ti(s),v=E_(d,ti(o))+1;return gs(d,0,v).join("")}function vL(s,o,l){if(s=It(s),s&&(l||o===t))return s.replace(Dr,"");if(!s||!(o=bn(o)))return s;var d=ti(s),v=x_(d,ti(o));return gs(d,v).join("")}function bL(s,o){var l=Y,d=ae;if(Zt(o)){var v="separator"in o?o.separator:v;l="length"in o?tt(o.length):l,d="omission"in o?bn(o.omission):d}s=It(s);var E=s.length;if(Ca(s)){var M=ti(s);E=M.length}if(l>=E)return s;var L=l-Pa(d);if(L<1)return d;var H=M?gs(M,0,L).join(""):s.slice(0,L);if(v===t)return H+d;if(M&&(L+=H.length-L),Qp(v)){if(s.slice(L).search(v)){var ce,fe=H;for(v.global||(v=cp(v.source,It(Ft.exec(v))+"g")),v.lastIndex=0;ce=v.exec(fe);)var ye=ce.index;H=H.slice(0,ye===t?L:ye)}}else if(s.indexOf(bn(v),L)!=L){var Ce=H.lastIndexOf(v);Ce>-1&&(H=H.slice(0,Ce))}return H+d}function wL(s){return s=It(s),s&&kr.test(s)?s.replace(ze,JN):s}var _L=qa(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Yp=pS("toUpperCase");function hx(s,o,l){return s=It(s),o=l?t:o,o===t?WN(s)?ZN(s):DN(s):s.match(o)||[]}var dx=st(function(s,o){try{return gn(s,t,o)}catch(l){return Hp(l)?l:new Ze(l)}}),SL=Ri(function(s,o){return jn(o,function(l){l=di(l),Ni(s,l,Wp(s[l],s))}),s});function xL(s){var o=s==null?0:s.length,l=We();return s=o?Ht(s,function(d){if(typeof d[1]!="function")throw new Un(u);return[l(d[0]),d[1]]}):[],st(function(d){for(var v=-1;++v<o;){var E=s[v];if(gn(E[0],this,d))return gn(E[1],this,d)}})}function EL(s){return J2(Bn(s,m))}function Kp(s){return function(){return s}}function OL(s,o){return s==null||s!==s?o:s}var TL=yS(),AL=yS(!0);function on(s){return s}function Zp(s){return H_(typeof s=="function"?s:Bn(s,m))}function kL(s){return G_(Bn(s,m))}function IL(s,o){return J_(s,Bn(o,m))}var CL=st(function(s,o){return function(l){return Yo(l,s,o)}}),PL=st(function(s,o){return function(l){return Yo(s,l,o)}});function Xp(s,o,l){var d=Or(o),v=Qc(o,d);l==null&&!(Zt(o)&&(v.length||!d.length))&&(l=o,o=s,s=this,v=Qc(o,Or(o)));var E=!(Zt(l)&&"chain"in l)||!!l.chain,M=Fi(s);return jn(v,function(L){var H=o[L];s[L]=H,M&&(s.prototype[L]=function(){var ce=this.__chain__;if(E||ce){var fe=s(this.__wrapped__),ye=fe.__actions__=nn(this.__actions__);return ye.push({func:H,args:arguments,thisArg:s}),fe.__chain__=ce,fe}return H.apply(s,fs([this.value()],arguments))})}),s}function NL(){return Cr._===this&&(Cr._=i2),this}function em(){}function ML(s){return s=tt(s),st(function(o){return Y_(o,s)})}var RL=Pp(Ht),DL=Pp(g_),FL=Pp(rp);function px(s){return qp(s)?np(di(s)):hM(s)}function LL(s){return function(o){return s==null?t:$s(s,o)}}var qL=vS(),jL=vS(!0);function tm(){return[]}function rm(){return!1}function UL(){return{}}function $L(){return""}function BL(){return!0}function VL(s,o){if(s=tt(s),s<1||s>ee)return[];var l=de,d=Fr(s,de);o=We(o),s-=de;for(var v=ap(d,o);++l<s;)o(l);return v}function WL(s){return Xe(s)?Ht(s,di):wn(s)?[s]:nn(RS(It(s)))}function zL(s){var o=++r2;return It(s)+o}var HL=Xc(function(s,o){return s+o},0),QL=Np("ceil"),GL=Xc(function(s,o){return s/o},1),JL=Np("floor");function YL(s){return s&&s.length?Hc(s,on,gp):t}function KL(s,o){return s&&s.length?Hc(s,We(o,2),gp):t}function ZL(s){return w_(s,on)}function XL(s,o){return w_(s,We(o,2))}function e6(s){return s&&s.length?Hc(s,on,_p):t}function t6(s,o){return s&&s.length?Hc(s,We(o,2),_p):t}var r6=Xc(function(s,o){return s*o},1),n6=Np("round"),i6=Xc(function(s,o){return s-o},0);function s6(s){return s&&s.length?sp(s,on):0}function a6(s,o){return s&&s.length?sp(s,We(o,2)):0}return x.after=kD,x.ary=zS,x.assign=mF,x.assignIn=sx,x.assignInWith=hl,x.assignWith=yF,x.at=gF,x.before=HS,x.bind=Wp,x.bindAll=SL,x.bindKey=QS,x.castArray=UD,x.chain=BS,x.chunk=JM,x.compact=YM,x.concat=KM,x.cond=xL,x.conforms=EL,x.constant=Kp,x.countBy=sD,x.create=vF,x.curry=GS,x.curryRight=JS,x.debounce=YS,x.defaults=bF,x.defaultsDeep=wF,x.defer=ID,x.delay=CD,x.difference=ZM,x.differenceBy=XM,x.differenceWith=eR,x.drop=tR,x.dropRight=rR,x.dropRightWhile=nR,x.dropWhile=iR,x.fill=sR,x.filter=oD,x.flatMap=lD,x.flatMapDeep=fD,x.flatMapDepth=hD,x.flatten=qS,x.flattenDeep=aR,x.flattenDepth=oR,x.flip=PD,x.flow=TL,x.flowRight=AL,x.fromPairs=uR,x.functions=AF,x.functionsIn=kF,x.groupBy=dD,x.initial=lR,x.intersection=fR,x.intersectionBy=hR,x.intersectionWith=dR,x.invert=CF,x.invertBy=PF,x.invokeMap=mD,x.iteratee=Zp,x.keyBy=yD,x.keys=Or,x.keysIn=an,x.map=al,x.mapKeys=MF,x.mapValues=RF,x.matches=kL,x.matchesProperty=IL,x.memoize=ul,x.merge=DF,x.mergeWith=ax,x.method=CL,x.methodOf=PL,x.mixin=Xp,x.negate=cl,x.nthArg=ML,x.omit=FF,x.omitBy=LF,x.once=ND,x.orderBy=gD,x.over=RL,x.overArgs=MD,x.overEvery=DL,x.overSome=FL,x.partial=zp,x.partialRight=KS,x.partition=vD,x.pick=qF,x.pickBy=ox,x.property=px,x.propertyOf=LL,x.pull=gR,x.pullAll=US,x.pullAllBy=vR,x.pullAllWith=bR,x.pullAt=wR,x.range=qL,x.rangeRight=jL,x.rearg=RD,x.reject=_D,x.remove=_R,x.rest=DD,x.reverse=Bp,x.sampleSize=xD,x.set=UF,x.setWith=$F,x.shuffle=ED,x.slice=SR,x.sortBy=AD,x.sortedUniq=IR,x.sortedUniqBy=CR,x.split=lL,x.spread=FD,x.tail=PR,x.take=NR,x.takeRight=MR,x.takeRightWhile=RR,x.takeWhile=DR,x.tap=YR,x.throttle=LD,x.thru=sl,x.toArray=rx,x.toPairs=ux,x.toPairsIn=cx,x.toPath=WL,x.toPlainObject=ix,x.transform=BF,x.unary=qD,x.union=FR,x.unionBy=LR,x.unionWith=qR,x.uniq=jR,x.uniqBy=UR,x.uniqWith=$R,x.unset=VF,x.unzip=Vp,x.unzipWith=$S,x.update=WF,x.updateWith=zF,x.values=$a,x.valuesIn=HF,x.without=BR,x.words=hx,x.wrap=jD,x.xor=VR,x.xorBy=WR,x.xorWith=zR,x.zip=HR,x.zipObject=QR,x.zipObjectDeep=GR,x.zipWith=JR,x.entries=ux,x.entriesIn=cx,x.extend=sx,x.extendWith=hl,Xp(x,x),x.add=HL,x.attempt=dx,x.camelCase=YF,x.capitalize=lx,x.ceil=QL,x.clamp=QF,x.clone=$D,x.cloneDeep=VD,x.cloneDeepWith=WD,x.cloneWith=BD,x.conformsTo=zD,x.deburr=fx,x.defaultTo=OL,x.divide=GL,x.endsWith=KF,x.eq=ni,x.escape=ZF,x.escapeRegExp=XF,x.every=aD,x.find=uD,x.findIndex=FS,x.findKey=_F,x.findLast=cD,x.findLastIndex=LS,x.findLastKey=SF,x.floor=JL,x.forEach=VS,x.forEachRight=WS,x.forIn=xF,x.forInRight=EF,x.forOwn=OF,x.forOwnRight=TF,x.get=Gp,x.gt=HD,x.gte=QD,x.has=IF,x.hasIn=Jp,x.head=jS,x.identity=on,x.includes=pD,x.indexOf=cR,x.inRange=GF,x.invoke=NF,x.isArguments=Ws,x.isArray=Xe,x.isArrayBuffer=GD,x.isArrayLike=sn,x.isArrayLikeObject=ur,x.isBoolean=JD,x.isBuffer=vs,x.isDate=YD,x.isElement=KD,x.isEmpty=ZD,x.isEqual=XD,x.isEqualWith=eF,x.isError=Hp,x.isFinite=tF,x.isFunction=Fi,x.isInteger=ZS,x.isLength=ll,x.isMap=XS,x.isMatch=rF,x.isMatchWith=nF,x.isNaN=iF,x.isNative=sF,x.isNil=oF,x.isNull=aF,x.isNumber=ex,x.isObject=Zt,x.isObjectLike=nr,x.isPlainObject=ru,x.isRegExp=Qp,x.isSafeInteger=uF,x.isSet=tx,x.isString=fl,x.isSymbol=wn,x.isTypedArray=Ua,x.isUndefined=cF,x.isWeakMap=lF,x.isWeakSet=fF,x.join=pR,x.kebabCase=eL,x.last=Wn,x.lastIndexOf=mR,x.lowerCase=tL,x.lowerFirst=rL,x.lt=hF,x.lte=dF,x.max=YL,x.maxBy=KL,x.mean=ZL,x.meanBy=XL,x.min=e6,x.minBy=t6,x.stubArray=tm,x.stubFalse=rm,x.stubObject=UL,x.stubString=$L,x.stubTrue=BL,x.multiply=r6,x.nth=yR,x.noConflict=NL,x.noop=em,x.now=ol,x.pad=nL,x.padEnd=iL,x.padStart=sL,x.parseInt=aL,x.random=JF,x.reduce=bD,x.reduceRight=wD,x.repeat=oL,x.replace=uL,x.result=jF,x.round=n6,x.runInContext=B,x.sample=SD,x.size=OD,x.snakeCase=cL,x.some=TD,x.sortedIndex=xR,x.sortedIndexBy=ER,x.sortedIndexOf=OR,x.sortedLastIndex=TR,x.sortedLastIndexBy=AR,x.sortedLastIndexOf=kR,x.startCase=fL,x.startsWith=hL,x.subtract=i6,x.sum=s6,x.sumBy=a6,x.template=dL,x.times=VL,x.toFinite=Li,x.toInteger=tt,x.toLength=nx,x.toLower=pL,x.toNumber=zn,x.toSafeInteger=pF,x.toString=It,x.toUpper=mL,x.trim=yL,x.trimEnd=gL,x.trimStart=vL,x.truncate=bL,x.unescape=wL,x.uniqueId=zL,x.upperCase=_L,x.upperFirst=Yp,x.each=VS,x.eachRight=WS,x.first=jS,Xp(x,function(){var s={};return fi(x,function(o,l){Ct.call(x.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),x.VERSION=n,jn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){x[s].placeholder=x}),jn(["drop","take"],function(s,o){pt.prototype[s]=function(l){l=l===t?1:br(tt(l),0);var d=this.__filtered__&&!o?new pt(this):this.clone();return d.__filtered__?d.__takeCount__=Fr(l,d.__takeCount__):d.__views__.push({size:Fr(l,de),type:s+(d.__dir__<0?"Right":"")}),d},pt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),jn(["filter","map","takeWhile"],function(s,o){var l=o+1,d=l==se||l==be;pt.prototype[s]=function(v){var E=this.clone();return E.__iteratees__.push({iteratee:We(v,3),type:l}),E.__filtered__=E.__filtered__||d,E}}),jn(["head","last"],function(s,o){var l="take"+(o?"Right":"");pt.prototype[s]=function(){return this[l](1).value()[0]}}),jn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");pt.prototype[s]=function(){return this.__filtered__?new pt(this):this[l](1)}}),pt.prototype.compact=function(){return this.filter(on)},pt.prototype.find=function(s){return this.filter(s).head()},pt.prototype.findLast=function(s){return this.reverse().find(s)},pt.prototype.invokeMap=st(function(s,o){return typeof s=="function"?new pt(this):this.map(function(l){return Yo(l,s,o)})}),pt.prototype.reject=function(s){return this.filter(cl(We(s)))},pt.prototype.slice=function(s,o){s=tt(s);var l=this;return l.__filtered__&&(s>0||o<0)?new pt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=tt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},pt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},pt.prototype.toArray=function(){return this.take(de)},fi(pt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),d=/^(?:head|last)$/.test(o),v=x[d?"take"+(o=="last"?"Right":""):o],E=d||/^find/.test(o);v&&(x.prototype[o]=function(){var M=this.__wrapped__,L=d?[1]:arguments,H=M instanceof pt,ce=L[0],fe=H||Xe(M),ye=function(ft){var yt=v.apply(x,fs([ft],L));return d&&Ce?yt[0]:yt};fe&&l&&typeof ce=="function"&&ce.length!=1&&(H=fe=!1);var Ce=this.__chain__,Le=!!this.__actions__.length,He=E&&!Ce,it=H&&!Le;if(!E&&fe){M=it?M:new pt(this);var Qe=s.apply(M,L);return Qe.__actions__.push({func:sl,args:[ye],thisArg:t}),new $n(Qe,Ce)}return He&&it?s.apply(this,L):(Qe=this.thru(ye),He?d?Qe.value()[0]:Qe.value():Qe)})}),jn(["pop","push","shift","sort","splice","unshift"],function(s){var o=Pc[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);x.prototype[s]=function(){var v=arguments;if(d&&!this.__chain__){var E=this.value();return o.apply(Xe(E)?E:[],v)}return this[l](function(M){return o.apply(Xe(M)?M:[],v)})}}),fi(pt.prototype,function(s,o){var l=x[o];if(l){var d=l.name+"";Ct.call(Da,d)||(Da[d]=[]),Da[d].push({name:o,func:l})}}),Da[Zc(t,w).name]=[{name:"wrapper",func:t}],pt.prototype.clone=w2,pt.prototype.reverse=_2,pt.prototype.value=S2,x.prototype.at=KR,x.prototype.chain=ZR,x.prototype.commit=XR,x.prototype.next=eD,x.prototype.plant=rD,x.prototype.reverse=nD,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=iD,x.prototype.first=x.prototype.head,Vo&&(x.prototype[Vo]=tD),x},Na=XN();Fs?((Fs.exports=Na)._=Na,Zd._=Na):Cr._=Na}).call(ik)}(So,So.exports)),So.exports}var ak=sk();const oi=im(ak),O0=ge.createContext(),T0=ge.createContext(),A0=ge.createContext(),ok=({children:r})=>{const[e,t]=ji.useSearchParams(),[n,i]=ge.useState({});ge.useEffect(()=>{Object.keys(n).length>0&&(t(c=>{const f=new URLSearchParams(c);return Object.entries(n).forEach(([h,p])=>{p==null||p===""?f.delete(h):f.set(h,p)}),f}),i({}))},[n,t]);const a=c=>{i(f=>({...f,...c}))},u=ge.useMemo(()=>[Object.fromEntries(e.entries()),a],[e]);return Bt.jsx(A0.Provider,{value:u,children:r})},Si=ge.createContext(),uk=(r,e,t=i=>i,n=i=>i)=>{const[i,a]=ge.useContext(A0),u=i[r];return[u?t(u):e,h=>{if(typeof h=="function"){const m=i[r];h=h(m?t(m):e)}const p=n(h);a({[r]:p})}]},xo=async(r,e,t)=>{ge.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},ck=(r,e,t)=>{const n=ge.useRef(r);ge.useEffect(()=>{n.current=r},[r]);const i=ge.useCallback(oi.throttle(()=>{n.current()},e),[]);ge.useEffect(i,[...t])},Eo=(r,e=null,t)=>{const n=ge.useRef(r);ge.useEffect(()=>{n.current=r},[r]),xo(async i=>{let a;const u=async()=>{await n.current(i),e!==null&&(a=setTimeout(u,e))};return u(),()=>a&&clearTimeout(a)},[e,...t])},k0=(r,e,t)=>{const[n,i]=ge.useState(),[a,u]=ge.useState(!0),[c,f]=ge.useState(),{urls:h,request:p}=Zn();return Eo(async m=>{try{const y={signal:m,...e||{}};if(y.skip)return;const g=await p(`${h.apiUrl}${r}`,y);i(g)}catch(y){f(y)}u(!1)},t,[r,e]),{data:n,error:c,loading:a}},lk=(r,e)=>{const[t,n]=ge.useState(),[i,a]=ge.useState(!0),[u,c]=ge.useState(null),[f,h]=ge.useState(),{urls:p,request:m}=Zn();return ge.useEffect(()=>{a(u===null||u>0)},[u]),Eo(async y=>{try{if(!r)return;c(b=>(b||0)+1);const g=await m(`${p.apiUrl}/reports/production`,{method:"POST",body:r,signal:y});h(null),n(g)}catch(g){g.name!=="AbortError"&&h(g)}c(g=>g-1)},e,[r]),{data:t,error:f,loading:i}},fk=({machineRef:r,key:e,skip:t})=>{const[n,i]=ge.useState(),[a,u]=ge.useState(),[c,f]=ge.useState(),[h,p]=ge.useState(),[m,y]=ge.useState(),[g,b]=ge.useState(),k=Xi`
|
|
105
|
-
subscription MMToolsQuantityStreamSubscription {
|
|
106
|
-
currentQuantities(
|
|
107
|
-
where: { machineRef: { _eq: ${m} }, key: { _eq: "${g}" } }
|
|
108
|
-
) {
|
|
109
|
-
value
|
|
110
|
-
eventTime
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
`,{data:_}=sT(k,{skip:t}),[w,T]=ge.useState();ge.useEffect(()=>{r!==m&&y(r),e!==g&&b(e),p(),i(),f(),u()},[r,e,g,m]),ge.useEffect(()=>{if(O||!r||!e)return;const N=h||Ke.utc().minus({hours:1}).format(),V=Xi`
|
|
114
|
-
query MMToolsQuantityStreamQuery {
|
|
115
|
-
quantities(args:{machineRef:${m}, metricKey:"${g}", windowStart:"${N}"}, order_by:{eventTime:asc}) {
|
|
116
|
-
value
|
|
117
|
-
eventTime
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
`;T(V)},[m,g,h]),ge.useEffect(()=>{w&&C()},[w,_]);const[C,{data:R,loading:O}]=nT(w,{fetchPolicy:"no-cache"});return ge.useEffect(()=>{if(!R||!R.quantities)return;const N=oi.last(R.quantities);if(N&&p(N.eventTime),!n)i(R.quantities);else{const V=oi.drop(R.quantities);i([...n,...V])}},[R]),{data:n,error:c,loading:a}},hk=r=>{const[e,t]=ge.useState(),[n,i]=ge.useState(!0),[a,u]=ge.useState(),{urls:c,request:f}=Zn();return xo(async h=>{try{i(!0);const p=await f(`${c.apiUrl}/reports/downtime`,{method:"POST",body:r,signal:h});u(null),t(p)}catch(p){u(p)}i(!1)},[r]),{data:e,error:a,loading:n}},dk=r=>{const[e,t]=ge.useState(),{urls:n,request:i,clientId:a}=Zn(),u=`lab:${a}:${r}`,{data:c,loading:f,error:h}=k0("/templates");return ge.useEffect(()=>{if(!c)return;const g=oi.filter(c.templates,{namespace:u});t(g)},[c]),[async({name:g,public:b,config:k})=>{const _={name:g,public:b,namespace:u,config:JSON.stringify(k)},w=JSON.stringify(_),T=await i(`${n.apiUrl}/templates`,{method:"POST",body:w});return t([...e,T.template]),T.template},async(g,{name:b,public:k,config:_})=>{const w={name:b,public:k,namespace:u,config:JSON.stringify(_)},T=JSON.stringify(w),C=await i(`${n.apiUrl}/templates/${g}`,{method:"PUT",body:T}),R=oi.findIndex(e,{id:g}),O=e.slice(0,R),N=e.slice(R+1);return t([...O,C.template,...N]),C.template},async g=>{await i(`${n.apiUrl}/templates/${g}`,{method:"DELETE"}),t(oi.reject(e,{id:g}))},{templates:e,loading:f,error:h}]},pk=()=>{const[r,e]=ge.useState(),[t,n]=ge.useState(),{urls:i}=Zn();return ge.useEffect(()=>{window===window.top?(n(window.location.hash.substring(1)),e(!0)):(window.addEventListener("message",a=>{switch(a.data.event){case"init":n(a.data.hash.substring(1)),e(!0);break}}),window.top.postMessage({event:"ready"},i.appUrl))},[i]),ge.useEffect(()=>{r&&(window===window.top?window.location.hash=t:window.top.postMessage({event:"set-hash",hash:t},i.appUrl))},[r,t,i]),[n,{ready:r,hash:t}]},Zn=()=>ge.useContext(T0),mk=()=>{throw new Error("useMMEmbeddedApp is deprecated. Use useMMAppTools and useMMAppContext.")},yk=()=>{throw new Error("useMMAppTools is deprecated. Use useMMAppParams and useMMAppCommands.")},gk=()=>{const{context:r}=ge.useContext(Si);return r},I0=()=>{const{params:r}=ge.useContext(Si);return r},C0=()=>{const{commands:r}=ge.useContext(Si);return r},vk=(r,e,t=[])=>{const{addSetting:n}=ge.useContext(Si);ge.useEffect(()=>{n(r,e)},[...t])},bk=(r,e=[])=>{const{registerHandler:t}=ge.useContext(Si);ge.useEffect(()=>t({requestType:"set-claims",func:r}),[...e])},wk=(r,e=[])=>{const{registerHandler:t}=ge.useContext(Si);ge.useEffect(()=>t({requestType:"custom-input-open",func:r}),[...e])},_k=(r,e=[])=>{const{registerHandler:t}=ge.useContext(Si);ge.useEffect(()=>t({requestType:"custom-input-save",func:r}),[...e])},Sk=(r,e=[])=>{const{registerHandler:t}=ge.useContext(Si);ge.useEffect(()=>t({requestType:"custom-input-label",func:r}),[...e])},xk=()=>ge.useContext(O0),Ek=()=>{const{login:r,isAuthenticated:e}=Zn();return xo(async()=>{e===!1&&await r()},[e]),e?Bt.jsx(ji.Outlet,{}):Bt.jsx("div",{})},P0="%[a-f0-9]{2}",N0=new RegExp("("+P0+")|([^%]+?)","gi"),M0=new RegExp("("+P0+")+","gi");function yh(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;const t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],yh(t),yh(n))}function Ok(r){try{return decodeURIComponent(r)}catch{let e=r.match(N0)||[];for(let t=1;t<e.length;t++)r=yh(e,t).join(""),e=r.match(N0)||[];return r}}function Tk(r){const e={"%FE%FF":"��","%FF%FE":"��"};let t=M0.exec(r);for(;t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{const i=Ok(t[0]);i!==t[0]&&(e[t[0]]=i)}t=M0.exec(r)}e["%C2"]="�";const n=Object.keys(e);for(const i of n)r=r.replace(new RegExp(i,"g"),e[i]);return r}function Ak(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return Tk(r)}}function kk(r,e){const t={};if(Array.isArray(e))for(const n of e){const i=Object.getOwnPropertyDescriptor(r,n);i?.enumerable&&Object.defineProperty(t,n,i)}else for(const n of Reflect.ownKeys(r)){const i=Object.getOwnPropertyDescriptor(r,n);if(i.enumerable){const a=r[n];e(n,a,r)&&Object.defineProperty(t,n,i)}}return t}function R0(r,e){if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||e==="")return[];const t=r.indexOf(e);return t===-1?[]:[r.slice(0,t),r.slice(t+e.length)]}const Ik=r=>r==null,Ck=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),gh=Symbol("encodeFragmentIdentifier");function Pk(r){switch(r.arrayFormat){case"index":return e=>(t,n)=>{const i=t.length;return n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[hr(e,r),"[",i,"]"].join("")]:[...t,[hr(e,r),"[",hr(i,r),"]=",hr(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[hr(e,r),"[]"].join("")]:[...t,[hr(e,r),"[]=",hr(n,r)].join("")];case"colon-list-separator":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[hr(e,r),":list="].join("")]:[...t,[hr(e,r),":list=",hr(n,r)].join("")];case"comma":case"separator":case"bracket-separator":{const e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[hr(t,r),e,hr(i,r)].join("")]:[[n,hr(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,hr(e,r)]:[...t,[hr(e,r),"=",hr(n,r)].join("")]}}function Nk(r){let e;switch(r.arrayFormat){case"index":return(t,n,i)=>{if(e=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!e){i[t]=n;return}i[t]===void 0&&(i[t]={}),i[t][e[1]]=n};case"bracket":return(t,n,i)=>{if(e=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[...i[t],n]};case"colon-list-separator":return(t,n,i)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[...i[t],n]};case"comma":case"separator":return(t,n,i)=>{const a=typeof n=="string"&&n.includes(r.arrayFormatSeparator),u=typeof n=="string"&&!a&&xi(n,r).includes(r.arrayFormatSeparator);n=u?xi(n,r):n;const c=a||u?n.split(r.arrayFormatSeparator).map(f=>xi(f,r)):n===null?n:xi(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{const a=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!a){i[t]=n&&xi(n,r);return}const u=n===null?[]:xi(n,r).split(r.arrayFormatSeparator);if(i[t]===void 0){i[t]=u;return}i[t]=[...i[t],...u]};default:return(t,n,i)=>{if(i[t]===void 0){i[t]=n;return}i[t]=[...[i[t]].flat(),n]}}}function D0(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function hr(r,e){return e.encode?e.strict?Ck(r):encodeURIComponent(r):r}function xi(r,e){return e.decode?Ak(r):r}function F0(r){return Array.isArray(r)?r.sort():typeof r=="object"?F0(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function L0(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function Mk(r){let e="";const t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function q0(r,e,t){return t==="string"&&typeof r=="string"?r:typeof t=="function"&&typeof r=="string"?t(r):t==="boolean"&&r===null?!0:t==="boolean"&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":t==="boolean"&&r!==null&&(r.toLowerCase()==="1"||r.toLowerCase()==="0")?r.toLowerCase()==="1":t==="string[]"&&e.arrayFormat!=="none"&&typeof r=="string"?[r]:t==="number[]"&&e.arrayFormat!=="none"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?[Number(r)]:t==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function vh(r){r=L0(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function bh(r,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...e},D0(e.arrayFormatSeparator);const t=Nk(e),n=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return n;for(const i of r.split("&")){if(i==="")continue;const a=e.decode?i.replaceAll("+"," "):i;let[u,c]=R0(a,"=");u===void 0&&(u=a),c=c===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?c:xi(c,e),t(xi(u,e),c,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&e.types[i]!=="string")for(const[u,c]of Object.entries(a)){const f=e.types[i]?e.types[i].replace("[]",""):void 0;a[u]=q0(c,e,f)}else typeof a=="object"&&a!==null&&e.types[i]==="string"?n[i]=Object.values(a).join(e.arrayFormatSeparator):n[i]=q0(a,e,e.types[i]);return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,a)=>{const u=n[a];return i[a]=u&&typeof u=="object"&&!Array.isArray(u)?F0(u):u,i},Object.create(null))}function j0(r,e){if(!r)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},D0(e.arrayFormatSeparator);const t=u=>e.skipNull&&Ik(r[u])||e.skipEmptyString&&r[u]==="",n=Pk(e),i={};for(const[u,c]of Object.entries(r))t(u)||(i[u]=c);const a=Object.keys(i);return e.sort!==!1&&a.sort(e.sort),a.map(u=>{const c=r[u];return c===void 0?"":c===null?hr(u,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?hr(u,e)+"[]":c.reduce(n(u),[]).join("&"):hr(u,e)+"="+hr(c,e)}).filter(u=>u.length>0).join("&")}function U0(r,e){e={decode:!0,...e};let[t,n]=R0(r,"#");return t===void 0&&(t=r),{url:t?.split("?")?.[0]??"",query:bh(vh(r),e),...e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:xi(n,e)}:{}}}function $0(r,e){e={encode:!0,strict:!0,[gh]:!0,...e};const t=L0(r.url).split("?")[0]||"",n=vh(r.url),i={...bh(n,{sort:!1,...e}),...r.query};let a=j0(i,e);a&&=`?${a}`;let u=Mk(r.url);if(typeof r.fragmentIdentifier=="string"){const c=new URL(t);c.hash=r.fragmentIdentifier,u=e[gh]?c.hash:`#${r.fragmentIdentifier}`}return`${t}${a}${u}`}function B0(r,e,t){t={parseFragmentIdentifier:!0,[gh]:!1,...t};const{url:n,query:i,fragmentIdentifier:a}=U0(r,t);return $0({url:n,query:kk(i,e),fragmentIdentifier:a},t)}function Rk(r,e,t){const n=Array.isArray(e)?i=>!e.includes(i):(i,a)=>!e(i,a);return B0(r,n,t)}const Dk=Object.freeze(Object.defineProperty({__proto__:null,exclude:Rk,extract:vh,parse:bh,parseUrl:U0,pick:B0,stringify:j0,stringifyUrl:$0},Symbol.toStringTag,{value:"Module"})),Ar=[];for(let r=0;r<256;++r)Ar.push((r+256).toString(16).slice(1));function Fk(r,e=0){return(Ar[r[e+0]]+Ar[r[e+1]]+Ar[r[e+2]]+Ar[r[e+3]]+"-"+Ar[r[e+4]]+Ar[r[e+5]]+"-"+Ar[r[e+6]]+Ar[r[e+7]]+"-"+Ar[r[e+8]]+Ar[r[e+9]]+"-"+Ar[r[e+10]]+Ar[r[e+11]]+Ar[r[e+12]]+Ar[r[e+13]]+Ar[r[e+14]]+Ar[r[e+15]]).toLowerCase()}let wh;const Lk=new Uint8Array(16);function qk(){if(!wh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");wh=crypto.getRandomValues.bind(crypto)}return wh(Lk)}const V0={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function W0(r,e,t){if(V0.randomUUID&&!r)return V0.randomUUID();r=r||{};const n=r.random??r.rng?.()??qk();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Fk(n)}const _h="mm-auth-state",Sh="mm-auth-destination",xh="mm-auth-access-token",Ei=window.localStorage,jk=()=>Ei.getItem(xh),Uk=r=>{r?Ei.setItem(xh,r):Ei.removeItem(xh)},$k=()=>Ei.getItem(Sh),z0=r=>{r?Ei.setItem(Sh,r):Ei.removeItem(Sh)},Bk=()=>Ei.getItem(_h),H0=r=>{r?Ei.setItem(_h,r):Ei.removeItem(_h)},Q0=async(r,e)=>{const t=await window.fetch(r,e),n=await t.text(),i=n&&JSON.parse(n);return t.status>=200&&t.status<300?i:{...i,error:{message:t.statusText,status:t.status}}};function Vk(r){return qt(r)&&"code"in r&&"reason"in r}function Wk(r){var e;return qt(r)&&((e=r.target)===null||e===void 0?void 0:e.readyState)===WebSocket.CLOSED}var zk=function(r){xn(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new St(function(i){return n.client.subscribe(F(F({},t),{query:vi(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){if(a instanceof Error)return i.error(a);var u=Vk(a);return u||Wk(a)?i.error(new Error("Socket closed".concat(u?" with event ".concat(a.code):"").concat(u?" ".concat(a.reason):""))):i.error(new cn({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(jr);function en(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Rs(r){return en(r)==="object"}function Hk(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function G0(r,e){return r.length<124?r:e}const Qk="graphql-transport-ws";var kn=(r=>(r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests",r))(kn||{}),In=(r=>(r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete",r))(In||{});function J0(r){if(!Rs(r))throw new Error(`Message is expected to be an object, but got ${en(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${en(r.type)}`);switch(r.type){case"connection_init":case"connection_ack":case"ping":case"pong":{if(r.payload!=null&&!Rs(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case"subscribe":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${en(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Rs(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${en(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${en(r.payload.query)}`);if(r.payload.variables!=null&&!Rs(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${en(r.payload.variables)}`);if(r.payload.operationName!=null&&en(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${en(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Rs(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${en(r.payload.extensions)}`);break}case"next":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${en(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Rs(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${en(r.payload)}`);break}case"error":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${en(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Hk(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case"complete":{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${en(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function Gk(r,e){return J0(typeof r=="string"?JSON.parse(r,e):r)}function Oo(r,e){return J0(r),JSON.stringify(r,e)}function Jk(r){const{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:u=0,disablePong:c,connectionAckWaitTimeout:f=0,retryAttempts:h=5,retryWait:p=async function(ve){const be=Math.pow(2,ve);await new Promise(Ee=>setTimeout(Ee,be*1e3+Math.floor(Math.random()*2700+300)))},shouldRetry:m=Eh,on:y,webSocketImpl:g,generateID:b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ve=>{const be=Math.random()*16|0;return(ve=="x"?be:be&3|8).toString(16)})},jsonMessageReplacer:k,jsonMessageReviver:_}=r;let w;if(g){if(!Kk(g))throw new Error("Invalid WebSocket implementation provided");w=g}else typeof WebSocket<"u"?w=WebSocket:typeof global<"u"?w=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(w=window.WebSocket||window.MozWebSocket);if(!w)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const T=w,C=(()=>{const se=(()=>{const be={};return{on(Ee,ee){return be[Ee]=ee,()=>{delete be[Ee]}},emit(Ee){"id"in Ee&&be[Ee.id]?.(Ee)}}})(),ve={connecting:y?.connecting?[y.connecting]:[],opened:y?.opened?[y.opened]:[],connected:y?.connected?[y.connected]:[],ping:y?.ping?[y.ping]:[],pong:y?.pong?[y.pong]:[],message:y?.message?[se.emit,y.message]:[se.emit],closed:y?.closed?[y.closed]:[],error:y?.error?[y.error]:[]};return{onMessage:se.on,on(be,Ee){const ee=ve[be];return ee.push(Ee),()=>{ee.splice(ee.indexOf(Ee),1)}},emit(be,...Ee){for(const ee of[...ve[be]])ee(...Ee)}}})();function R(se){const ve=[C.on("error",be=>{ve.forEach(Ee=>Ee()),se(be)}),C.on("closed",be=>{ve.forEach(Ee=>Ee()),se(be)})]}let O,N=0,V,D=!1,U=0,Y=!1;async function ae(){clearTimeout(V);const[se,ve]=await(O??(O=new Promise((ee,pe)=>(async()=>{if(D){if(await p(U),!N)return O=void 0,pe({code:1e3,reason:"All Subscriptions Gone"});U++}C.emit("connecting",D);const q=new T(typeof e=="function"?await e():e,Qk);let de,Oe;function je(){isFinite(u)&&u>0&&(clearTimeout(Oe),Oe=setTimeout(()=>{q.readyState===T.OPEN&&(q.send(Oo({type:In.Ping})),C.emit("ping",!1,void 0))},u))}R(Ve=>{O=void 0,clearTimeout(de),clearTimeout(Oe),pe(Ve),Ve instanceof Y0&&(q.close(4499,"Terminated"),q.onerror=null,q.onclose=null)}),q.onerror=Ve=>C.emit("error",Ve),q.onclose=Ve=>C.emit("closed",Ve),q.onopen=async()=>{try{C.emit("opened",q);const Ve=typeof t=="function"?await t():t;if(q.readyState!==T.OPEN)return;q.send(Oo(Ve?{type:In.ConnectionInit,payload:Ve}:{type:In.ConnectionInit},k)),isFinite(f)&&f>0&&(de=setTimeout(()=>{q.close(kn.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},f)),je()}catch(Ve){C.emit("error",Ve),q.close(kn.InternalClientError,G0(Ve instanceof Error?Ve.message:String(Ve),"Internal client error"))}};let rt=!1;q.onmessage=({data:Ve})=>{try{const Be=Gk(Ve,_);if(C.emit("message",Be),Be.type==="ping"||Be.type==="pong"){C.emit(Be.type,!0,Be.payload),Be.type==="pong"?je():c||(q.send(Oo(Be.payload?{type:In.Pong,payload:Be.payload}:{type:In.Pong})),C.emit("pong",!1,Be.payload));return}if(rt)return;if(Be.type!==In.ConnectionAck)throw new Error(`First message cannot be of type ${Be.type}`);clearTimeout(de),rt=!0,C.emit("connected",q,Be.payload,D),D=!1,U=0,ee([q,new Promise((wt,Ye)=>R(Ye))])}catch(Be){q.onmessage=null,C.emit("error",Be),q.close(kn.BadResponse,G0(Be instanceof Error?Be.message:String(Be),"Bad response"))}}})())));se.readyState===T.CLOSING&&await ve;let be=()=>{};const Ee=new Promise(ee=>be=ee);return[se,be,Promise.race([Ee.then(()=>{if(!N){const ee=()=>se.close(1e3,"Normal Closure");isFinite(a)&&a>0?V=setTimeout(()=>{se.readyState===T.OPEN&&ee()},a):ee()}}),ve])]}function re(se){if(Eh(se)&&(Yk(se.code)||[kn.InternalServerError,kn.InternalClientError,kn.BadRequest,kn.BadResponse,kn.Unauthorized,kn.SubprotocolNotAcceptable,kn.SubscriberAlreadyExists,kn.TooManyInitialisationRequests].includes(se.code)))throw se;if(Y)return!1;if(Eh(se)&&se.code===1e3)return N>0;if(!h||U>=h||!m(se))throw se;return D=!0}n||(async()=>{for(N++;;)try{const[,,se]=await ae();await se}catch(se){try{if(!re(se))return}catch(ve){return i?.(ve)}}})();function Se(se,ve){const be=b(se);let Ee=!1,ee=!1,pe=()=>{N--,Ee=!0};return(async()=>{for(N++;;)try{const[q,de,Oe]=await ae();if(Ee)return de();const je=C.onMessage(be,rt=>{switch(rt.type){case In.Next:{ve.next(rt.payload);return}case In.Error:{ee=!0,Ee=!0,ve.error(rt.payload),pe();return}case In.Complete:{Ee=!0,pe();return}}});q.send(Oo({id:be,type:In.Subscribe,payload:se},k)),pe=()=>{!Ee&&q.readyState===T.OPEN&&q.send(Oo({id:be,type:In.Complete},k)),N--,Ee=!0,de()},await Oe.finally(je);return}catch(q){if(!re(q))return}})().then(()=>{ee||ve.complete()}).catch(q=>{ve.error(q)}),()=>{Ee||pe()}}return{on:C.on,subscribe:Se,iterate(se){const ve=[],be={done:!1,error:null,resolve:()=>{}},Ee=Se(se,{next(pe){ve.push(pe),be.resolve()},error(pe){be.done=!0,be.error=pe,be.resolve()},complete(){be.done=!0,be.resolve()}}),ee=async function*(){for(;;){for(ve.length||await new Promise(q=>be.resolve=q);ve.length;)yield ve.shift();if(be.error)throw be.error;if(be.done)return}}();return ee.throw=async pe=>(be.done||(be.done=!0,be.error=pe,be.resolve()),{done:!0,value:void 0}),ee.return=async()=>(Ee(),{done:!0,value:void 0}),ee},async dispose(){if(Y=!0,O){const[se]=await O;se.close(1e3,"Normal Closure")}},terminate(){O&&C.emit("closed",new Y0)}}}class Y0 extends Error{name="TerminatedCloseEvent";message="4499: Terminated";code=4499;reason="Terminated";wasClean=!1}function Eh(r){return Rs(r)&&"code"in r&&"reason"in r}function Yk(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function Kk(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function K0(r){return new jr(function(e,t){var n=Zr(e,[]);return new St(function(i){var a,u=!1;return Promise.resolve(n).then(function(c){return r(c,e.getContext())}).then(e.setContext).then(function(){u||(a=t(e).subscribe({next:i.next.bind(i),error:i.error.bind(i),complete:i.complete.bind(i)}))}).catch(i.error.bind(i)),function(){u=!0,a&&a.unsubscribe()}})})}function Z0(r){return new jr(function(e,t){return new St(function(n){var i,a,u;try{i=t(e).subscribe({next:function(c){if(c.errors?u=r({graphQLErrors:c.errors,response:c,operation:e,forward:t}):ky(c)&&(u=r({protocolErrors:c.extensions[Nu],response:c,operation:e,forward:t})),u){a=u.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.next(c)},error:function(c){if(u=r({operation:e,networkError:c,graphQLErrors:c&&c.result&&c.result.errors||void 0,forward:t}),u){a=u.subscribe({next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)});return}n.error(c)},complete:function(){u||n.complete.bind(n)()}})}catch(c){r({networkError:c,operation:e,forward:t}),n.error(c)}return function(){i&&i.unsubscribe(),a&&i.unsubscribe()}})})}(function(r){xn(e,r);function e(t){var n=r.call(this)||this;return n.link=Z0(t),n}return e.prototype.request=function(t,n){return this.link.request(t,n)},e})(jr);var To={exports:{}};const Zk=dl(UO),Xk=dl(C1);var Oh,X0;function ma(){return X0||(X0=1,Oh=TypeError),Oh}const eI=dl(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Th,eb;function ic(){if(eb)return Th;eb=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,a=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=i&&a&&typeof a.get=="function"?a.get:null,c=i&&Set.prototype.forEach,f=typeof WeakMap=="function"&&WeakMap.prototype,h=f?WeakMap.prototype.has:null,p=typeof WeakSet=="function"&&WeakSet.prototype,m=p?WeakSet.prototype.has:null,y=typeof WeakRef=="function"&&WeakRef.prototype,g=y?WeakRef.prototype.deref:null,b=Boolean.prototype.valueOf,k=Object.prototype.toString,_=Function.prototype.toString,w=String.prototype.match,T=String.prototype.slice,C=String.prototype.replace,R=String.prototype.toUpperCase,O=String.prototype.toLowerCase,N=RegExp.prototype.test,V=Array.prototype.concat,D=Array.prototype.join,U=Array.prototype.slice,Y=Math.floor,ae=typeof BigInt=="function"?BigInt.prototype.valueOf:null,re=Object.getOwnPropertySymbols,Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,se=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ve=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===se||!0)?Symbol.toStringTag:null,be=Object.prototype.propertyIsEnumerable,Ee=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(Q){return Q.__proto__}:null);function ee(Q,K){if(Q===1/0||Q===-1/0||Q!==Q||Q&&Q>-1e3&&Q<1e3||N.call(/e/,K))return K;var nt=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof Q=="number"){var at=Q<0?-Y(-Q):Y(Q);if(at!==Q){var ct=String(at),ze=T.call(K,ct.length+1);return C.call(ct,nt,"$&_")+"."+C.call(C.call(ze,/([0-9]{3})/g,"$&_"),/_$/,"")}}return C.call(K,nt,"$&_")}var pe=eI,q=pe.custom,de=Z(q)?q:null,Oe={__proto__:null,double:'"',single:"'"},je={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Th=function Q(K,nt,at,ct){var ze=nt||{};if(xe(ze,"quoteStyle")&&!xe(Oe,ze.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(xe(ze,"maxStringLength")&&(typeof ze.maxStringLength=="number"?ze.maxStringLength<0&&ze.maxStringLength!==1/0:ze.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Kt=xe(ze,"customInspect")?ze.customInspect:!0;if(typeof Kt!="boolean"&&Kt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(xe(ze,"indent")&&ze.indent!==null&&ze.indent!==" "&&!(parseInt(ze.indent,10)===ze.indent&&ze.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(xe(ze,"numericSeparator")&&typeof ze.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var kr=ze.numericSeparator;if(typeof K>"u")return"undefined";if(K===null)return"null";if(typeof K=="boolean")return K?"true":"false";if(typeof K=="string")return Jt(K,ze);if(typeof K=="number"){if(K===0)return 1/0/K>0?"0":"-0";var or=String(K);return kr?ee(K,or):or}if(typeof K=="bigint"){var yr=String(K)+"n";return kr?ee(K,yr):yr}var Mn=typeof ze.depth>"u"?5:ze.depth;if(typeof at>"u"&&(at=0),at>=Mn&&Mn>0&&typeof K=="object")return wt(K)?"[Array]":"[Object]";var rr=zr(ze,at);if(typeof ct>"u")ct=[];else if(le(ct,K)>=0)return"[Circular]";function Dt(mn,mt,Gr){if(mt&&(ct=U.call(ct),ct.push(mt)),Gr){var S={depth:ze.depth};return xe(ze,"quoteStyle")&&(S.quoteStyle=ze.quoteStyle),Q(mn,S,at+1,ct)}return Q(mn,ze,at+1,ct)}if(typeof K=="function"&&!Me(K)){var rn=$e(K),Rr=Yt(K,Dt);return"[Function"+(rn?": "+rn:" (anonymous)")+"]"+(Rr.length>0?" { "+D.call(Rr,", ")+" }":"")}if(Z(K)){var gr=se?C.call(String(K),/^(Symbol\(.*\))_[^)]*$/,"$1"):Se.call(K);return typeof K=="object"&&!se?mr(gr):gr}if(Ot(K)){for(var Hr="<"+O.call(String(K.nodeName)),Dr=K.attributes||[],pr=0;pr<Dr.length;pr++)Hr+=" "+Dr[pr].name+"="+rt(Ve(Dr[pr].value),"double",ze);return Hr+=">",K.childNodes&&K.childNodes.length&&(Hr+="..."),Hr+="</"+O.call(String(K.nodeName))+">",Hr}if(wt(K)){if(K.length===0)return"[]";var Ir=Yt(K,Dt);return rr&&!dr(Ir)?"["+jt(Ir,rr)+"]":"[ "+D.call(Ir,", ")+" ]"}if(Ue(K)){var Rn=Yt(K,Dt);return!("cause"in Error.prototype)&&"cause"in K&&!be.call(K,"cause")?"{ ["+String(K)+"] "+D.call(V.call("[cause]: "+Dt(K.cause),Rn),", ")+" }":Rn.length===0?"["+String(K)+"]":"{ ["+String(K)+"] "+D.call(Rn,", ")+" }"}if(typeof K=="object"&&Kt){if(de&&typeof K[de]=="function"&&pe)return pe(K,{depth:Mn-at});if(Kt!=="symbol"&&typeof K.inspect=="function")return K.inspect()}if(_e(K)){var li=[];return n&&n.call(K,function(mn,mt){li.push(Dt(mt,K,!0)+" => "+Dt(mn,K))}),ar("Map",t.call(K),li,rr)}if(ut(K)){var Dn=[];return c&&c.call(K,function(mn){Dn.push(Dt(mn,K))}),ar("Set",u.call(K),Dn,rr)}if(Ge(K))return Rt("WeakMap");if(Gt(K))return Rt("WeakSet");if(ot(K))return Rt("WeakRef");if(J(K))return mr(Dt(Number(K)));if(ne(K))return mr(Dt(ae.call(K)));if($(K))return mr(b.call(K));if(W(K))return mr(Dt(String(K)));if(typeof window<"u"&&K===window)return"{ [object Window] }";if(typeof globalThis<"u"&&K===globalThis||typeof bs<"u"&&K===bs)return"{ [object globalThis] }";if(!Ye(K)&&!Me(K)){var Er=Yt(K,Dt),Qr=Ee?Ee(K)===Object.prototype:K instanceof Object||K.constructor===Object,zt=K instanceof Object?"":"null prototype",Ft=!Qr&&ve&&Object(K)===K&&ve in K?T.call(qe(K),8,-1):zt?"Object":"",Fn=Qr||typeof K.constructor!="function"?"":K.constructor.name?K.constructor.name+" ":"",Ln=Fn+(Ft||zt?"["+D.call(V.call([],Ft||[],zt||[]),": ")+"] ":"");return Er.length===0?Ln+"{}":rr?Ln+"{"+jt(Er,rr)+"}":Ln+"{ "+D.call(Er,", ")+" }"}return String(K)};function rt(Q,K,nt){var at=nt.quoteStyle||K,ct=Oe[at];return ct+Q+ct}function Ve(Q){return C.call(String(Q),/"/g,""")}function Be(Q){return!ve||!(typeof Q=="object"&&(ve in Q||typeof Q[ve]<"u"))}function wt(Q){return qe(Q)==="[object Array]"&&Be(Q)}function Ye(Q){return qe(Q)==="[object Date]"&&Be(Q)}function Me(Q){return qe(Q)==="[object RegExp]"&&Be(Q)}function Ue(Q){return qe(Q)==="[object Error]"&&Be(Q)}function W(Q){return qe(Q)==="[object String]"&&Be(Q)}function J(Q){return qe(Q)==="[object Number]"&&Be(Q)}function $(Q){return qe(Q)==="[object Boolean]"&&Be(Q)}function Z(Q){if(se)return Q&&typeof Q=="object"&&Q instanceof Symbol;if(typeof Q=="symbol")return!0;if(!Q||typeof Q!="object"||!Se)return!1;try{return Se.call(Q),!0}catch{}return!1}function ne(Q){if(!Q||typeof Q!="object"||!ae)return!1;try{return ae.call(Q),!0}catch{}return!1}var G=Object.prototype.hasOwnProperty||function(Q){return Q in this};function xe(Q,K){return G.call(Q,K)}function qe(Q){return k.call(Q)}function $e(Q){if(Q.name)return Q.name;var K=w.call(_.call(Q),/^function\s*([\w$]+)/);return K?K[1]:null}function le(Q,K){if(Q.indexOf)return Q.indexOf(K);for(var nt=0,at=Q.length;nt<at;nt++)if(Q[nt]===K)return nt;return-1}function _e(Q){if(!t||!Q||typeof Q!="object")return!1;try{t.call(Q);try{u.call(Q)}catch{return!0}return Q instanceof Map}catch{}return!1}function Ge(Q){if(!h||!Q||typeof Q!="object")return!1;try{h.call(Q,h);try{m.call(Q,m)}catch{return!0}return Q instanceof WeakMap}catch{}return!1}function ot(Q){if(!g||!Q||typeof Q!="object")return!1;try{return g.call(Q),!0}catch{}return!1}function ut(Q){if(!u||!Q||typeof Q!="object")return!1;try{u.call(Q);try{t.call(Q)}catch{return!0}return Q instanceof Set}catch{}return!1}function Gt(Q){if(!m||!Q||typeof Q!="object")return!1;try{m.call(Q,m);try{h.call(Q,h)}catch{return!0}return Q instanceof WeakSet}catch{}return!1}function Ot(Q){return!Q||typeof Q!="object"?!1:typeof HTMLElement<"u"&&Q instanceof HTMLElement?!0:typeof Q.nodeName=="string"&&typeof Q.getAttribute=="function"}function Jt(Q,K){if(Q.length>K.maxStringLength){var nt=Q.length-K.maxStringLength,at="... "+nt+" more character"+(nt>1?"s":"");return Jt(T.call(Q,0,K.maxStringLength),K)+at}var ct=je[K.quoteStyle||"single"];ct.lastIndex=0;var ze=C.call(C.call(Q,ct,"\\$1"),/[\x00-\x1f]/g,sr);return rt(ze,"single",K)}function sr(Q){var K=Q.charCodeAt(0),nt={8:"b",9:"t",10:"n",12:"f",13:"r"}[K];return nt?"\\"+nt:"\\x"+(K<16?"0":"")+R.call(K.toString(16))}function mr(Q){return"Object("+Q+")"}function Rt(Q){return Q+" { ? }"}function ar(Q,K,nt,at){var ct=at?jt(nt,at):D.call(nt,", ");return Q+" ("+K+") {"+ct+"}"}function dr(Q){for(var K=0;K<Q.length;K++)if(le(Q[K],`
|
|
121
|
-
`)>=0)return!1;return!0}function zr(Q,K){var nt;if(Q.indent===" ")nt=" ";else if(typeof Q.indent=="number"&&Q.indent>0)nt=D.call(Array(Q.indent+1)," ");else return null;return{base:nt,prev:D.call(Array(K+1),nt)}}function jt(Q,K){if(Q.length===0)return"";var nt=`
|
|
122
|
-
`+K.prev+K.base;return nt+D.call(Q,","+nt)+`
|
|
123
|
-
`+K.prev}function Yt(Q,K){var nt=wt(Q),at=[];if(nt){at.length=Q.length;for(var ct=0;ct<Q.length;ct++)at[ct]=xe(Q,ct)?K(Q[ct],Q):""}var ze=typeof re=="function"?re(Q):[],Kt;if(se){Kt={};for(var kr=0;kr<ze.length;kr++)Kt["$"+ze[kr]]=ze[kr]}for(var or in Q)xe(Q,or)&&(nt&&String(Number(or))===or&&or<Q.length||se&&Kt["$"+or]instanceof Symbol||(N.call(/[^\w$]/,or)?at.push(K(or,Q)+": "+K(Q[or],Q)):at.push(or+": "+K(Q[or],Q))));if(typeof re=="function")for(var yr=0;yr<ze.length;yr++)be.call(Q,ze[yr])&&at.push("["+K(ze[yr])+"]: "+K(Q[ze[yr]],Q));return at}return Th}var Ah,tb;function tI(){if(tb)return Ah;tb=1;var r=ic(),e=ma(),t=function(c,f,h){for(var p=c,m;(m=p.next)!=null;p=m)if(m.key===f)return p.next=m.next,h||(m.next=c.next,c.next=m),m},n=function(c,f){if(c){var h=t(c,f);return h&&h.value}},i=function(c,f,h){var p=t(c,f);p?p.value=h:c.next={key:f,next:c.next,value:h}},a=function(c,f){return c?!!t(c,f):!1},u=function(c,f){if(c)return t(c,f,!0)};return Ah=function(){var f,h={assert:function(p){if(!h.has(p))throw new e("Side channel does not contain "+r(p))},delete:function(p){var m=f&&f.next,y=u(f,p);return y&&m&&m===y&&(f=void 0),!!y},get:function(p){return n(f,p)},has:function(p){return a(f,p)},set:function(p,m){f||(f={next:void 0}),i(f,p,m)}};return h},Ah}var kh,rb;function nb(){return rb||(rb=1,kh=Object),kh}var Ih,ib;function rI(){return ib||(ib=1,Ih=Error),Ih}var Ch,sb;function nI(){return sb||(sb=1,Ch=EvalError),Ch}var Ph,ab;function iI(){return ab||(ab=1,Ph=RangeError),Ph}var Nh,ob;function sI(){return ob||(ob=1,Nh=ReferenceError),Nh}var Mh,ub;function aI(){return ub||(ub=1,Mh=SyntaxError),Mh}var Rh,cb;function oI(){return cb||(cb=1,Rh=URIError),Rh}var Dh,lb;function uI(){return lb||(lb=1,Dh=Math.abs),Dh}var Fh,fb;function cI(){return fb||(fb=1,Fh=Math.floor),Fh}var Lh,hb;function lI(){return hb||(hb=1,Lh=Math.max),Lh}var qh,db;function fI(){return db||(db=1,qh=Math.min),qh}var jh,pb;function hI(){return pb||(pb=1,jh=Math.pow),jh}var Uh,mb;function dI(){return mb||(mb=1,Uh=Math.round),Uh}var $h,yb;function pI(){return yb||(yb=1,$h=Number.isNaN||function(e){return e!==e}),$h}var Bh,gb;function mI(){if(gb)return Bh;gb=1;var r=pI();return Bh=function(t){return r(t)||t===0?t:t<0?-1:1},Bh}var Vh,vb;function yI(){return vb||(vb=1,Vh=Object.getOwnPropertyDescriptor),Vh}var Wh,bb;function wb(){if(bb)return Wh;bb=1;var r=yI();if(r)try{r([],"length")}catch{r=null}return Wh=r,Wh}var zh,_b;function gI(){if(_b)return zh;_b=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return zh=r,zh}var Hh,Sb;function vI(){return Sb||(Sb=1,Hh=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(e,t);if(c.value!==i||c.enumerable!==!0)return!1}return!0}),Hh}var Qh,xb;function bI(){if(xb)return Qh;xb=1;var r=typeof Symbol<"u"&&Symbol,e=vI();return Qh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Qh}var Gh,Eb;function Ob(){return Eb||(Eb=1,Gh=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Gh}var Jh,Tb;function Ab(){if(Tb)return Jh;Tb=1;var r=nb();return Jh=r.getPrototypeOf||null,Jh}var Yh,kb;function wI(){if(kb)return Yh;kb=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(f,h){for(var p=[],m=0;m<f.length;m+=1)p[m]=f[m];for(var y=0;y<h.length;y+=1)p[y+f.length]=h[y];return p},a=function(f,h){for(var p=[],m=h,y=0;m<f.length;m+=1,y+=1)p[y]=f[m];return p},u=function(c,f){for(var h="",p=0;p<c.length;p+=1)h+=c[p],p+1<c.length&&(h+=f);return h};return Yh=function(f){var h=this;if(typeof h!="function"||e.apply(h)!==n)throw new TypeError(r+h);for(var p=a(arguments,1),m,y=function(){if(this instanceof m){var w=h.apply(this,i(p,arguments));return Object(w)===w?w:this}return h.apply(f,i(p,arguments))},g=t(0,h.length-p.length),b=[],k=0;k<g;k++)b[k]="$"+k;if(m=Function("binder","return function ("+u(b,",")+"){ return binder.apply(this,arguments); }")(y),h.prototype){var _=function(){};_.prototype=h.prototype,m.prototype=new _,_.prototype=null}return m},Yh}var Kh,Ib;function sc(){if(Ib)return Kh;Ib=1;var r=wI();return Kh=Function.prototype.bind||r,Kh}var Zh,Cb;function Xh(){return Cb||(Cb=1,Zh=Function.prototype.call),Zh}var ed,Pb;function Nb(){return Pb||(Pb=1,ed=Function.prototype.apply),ed}var td,Mb;function _I(){return Mb||(Mb=1,td=typeof Reflect<"u"&&Reflect&&Reflect.apply),td}var rd,Rb;function SI(){if(Rb)return rd;Rb=1;var r=sc(),e=Nb(),t=Xh(),n=_I();return rd=n||r.call(t,e),rd}var nd,Db;function Fb(){if(Db)return nd;Db=1;var r=sc(),e=ma(),t=Xh(),n=SI();return nd=function(a){if(a.length<1||typeof a[0]!="function")throw new e("a function is required");return n(r,t,a)},nd}var id,Lb;function xI(){if(Lb)return id;Lb=1;var r=Fb(),e=wb(),t;try{t=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return id=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(c){return a(c==null?c:i(c))}:!1,id}var sd,qb;function EI(){if(qb)return sd;qb=1;var r=Ob(),e=Ab(),t=xI();return sd=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,sd}var ad,jb;function OI(){if(jb)return ad;jb=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=sc();return ad=t.call(r,e),ad}var od,Ub;function ud(){if(Ub)return od;Ub=1;var r,e=nb(),t=rI(),n=nI(),i=iI(),a=sI(),u=aI(),c=ma(),f=oI(),h=uI(),p=cI(),m=lI(),y=fI(),g=hI(),b=dI(),k=mI(),_=Function,w=function(Me){try{return _('"use strict"; return ('+Me+").constructor;")()}catch{}},T=wb(),C=gI(),R=function(){throw new c},O=T?function(){try{return arguments.callee,R}catch{try{return T(arguments,"callee").get}catch{return R}}}():R,N=bI()(),V=EI(),D=Ab(),U=Ob(),Y=Nb(),ae=Xh(),re={},Se=typeof Uint8Array>"u"||!V?r:V(Uint8Array),se={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":N&&V?V([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":re,"%AsyncGenerator%":re,"%AsyncGeneratorFunction%":re,"%AsyncIteratorPrototype%":re,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":n,"%Float16Array%":typeof Float16Array>"u"?r:Float16Array,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":_,"%GeneratorFunction%":re,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":N&&V?V(V([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!N||!V?r:V(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":T,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!N||!V?r:V(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":N&&V?V(""[Symbol.iterator]()):r,"%Symbol%":N?Symbol:r,"%SyntaxError%":u,"%ThrowTypeError%":O,"%TypedArray%":Se,"%TypeError%":c,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":f,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet,"%Function.prototype.call%":ae,"%Function.prototype.apply%":Y,"%Object.defineProperty%":C,"%Object.getPrototypeOf%":D,"%Math.abs%":h,"%Math.floor%":p,"%Math.max%":m,"%Math.min%":y,"%Math.pow%":g,"%Math.round%":b,"%Math.sign%":k,"%Reflect.getPrototypeOf%":U};if(V)try{null.error}catch(Me){var ve=V(V(Me));se["%Error.prototype%"]=ve}var be=function Me(Ue){var W;if(Ue==="%AsyncFunction%")W=w("async function () {}");else if(Ue==="%GeneratorFunction%")W=w("function* () {}");else if(Ue==="%AsyncGeneratorFunction%")W=w("async function* () {}");else if(Ue==="%AsyncGenerator%"){var J=Me("%AsyncGeneratorFunction%");J&&(W=J.prototype)}else if(Ue==="%AsyncIteratorPrototype%"){var $=Me("%AsyncGenerator%");$&&V&&(W=V($.prototype))}return se[Ue]=W,W},Ee={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ee=sc(),pe=OI(),q=ee.call(ae,Array.prototype.concat),de=ee.call(Y,Array.prototype.splice),Oe=ee.call(ae,String.prototype.replace),je=ee.call(ae,String.prototype.slice),rt=ee.call(ae,RegExp.prototype.exec),Ve=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Be=/\\(\\)?/g,wt=function(Ue){var W=je(Ue,0,1),J=je(Ue,-1);if(W==="%"&&J!=="%")throw new u("invalid intrinsic syntax, expected closing `%`");if(J==="%"&&W!=="%")throw new u("invalid intrinsic syntax, expected opening `%`");var $=[];return Oe(Ue,Ve,function(Z,ne,G,xe){$[$.length]=G?Oe(xe,Be,"$1"):ne||Z}),$},Ye=function(Ue,W){var J=Ue,$;if(pe(Ee,J)&&($=Ee[J],J="%"+$[0]+"%"),pe(se,J)){var Z=se[J];if(Z===re&&(Z=be(J)),typeof Z>"u"&&!W)throw new c("intrinsic "+Ue+" exists, but is not available. Please file an issue!");return{alias:$,name:J,value:Z}}throw new u("intrinsic "+Ue+" does not exist!")};return od=function(Ue,W){if(typeof Ue!="string"||Ue.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof W!="boolean")throw new c('"allowMissing" argument must be a boolean');if(rt(/^%?[^%]*%?$/,Ue)===null)throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var J=wt(Ue),$=J.length>0?J[0]:"",Z=Ye("%"+$+"%",W),ne=Z.name,G=Z.value,xe=!1,qe=Z.alias;qe&&($=qe[0],de(J,q([0,1],qe)));for(var $e=1,le=!0;$e<J.length;$e+=1){var _e=J[$e],Ge=je(_e,0,1),ot=je(_e,-1);if((Ge==='"'||Ge==="'"||Ge==="`"||ot==='"'||ot==="'"||ot==="`")&&Ge!==ot)throw new u("property names with quotes must have matching quotes");if((_e==="constructor"||!le)&&(xe=!0),$+="."+_e,ne="%"+$+"%",pe(se,ne))G=se[ne];else if(G!=null){if(!(_e in G)){if(!W)throw new c("base intrinsic for "+Ue+" exists, but the property is not available.");return}if(T&&$e+1>=J.length){var ut=T(G,_e);le=!!ut,le&&"get"in ut&&!("originalValue"in ut.get)?G=ut.get:G=G[_e]}else le=pe(G,_e),G=G[_e];le&&!xe&&(se[ne]=G)}}return G},od}var cd,$b;function Bb(){if($b)return cd;$b=1;var r=ud(),e=Fb(),t=e([r("%String.prototype.indexOf%")]);return cd=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e([u]):u},cd}var ld,Vb;function Wb(){if(Vb)return ld;Vb=1;var r=ud(),e=Bb(),t=ic(),n=ma(),i=r("%Map%",!0),a=e("Map.prototype.get",!0),u=e("Map.prototype.set",!0),c=e("Map.prototype.has",!0),f=e("Map.prototype.delete",!0),h=e("Map.prototype.size",!0);return ld=!!i&&function(){var m,y={assert:function(g){if(!y.has(g))throw new n("Side channel does not contain "+t(g))},delete:function(g){if(m){var b=f(m,g);return h(m)===0&&(m=void 0),b}return!1},get:function(g){if(m)return a(m,g)},has:function(g){return m?c(m,g):!1},set:function(g,b){m||(m=new i),u(m,g,b)}};return y},ld}var fd,zb;function TI(){if(zb)return fd;zb=1;var r=ud(),e=Bb(),t=ic(),n=Wb(),i=ma(),a=r("%WeakMap%",!0),u=e("WeakMap.prototype.get",!0),c=e("WeakMap.prototype.set",!0),f=e("WeakMap.prototype.has",!0),h=e("WeakMap.prototype.delete",!0);return fd=a?function(){var m,y,g={assert:function(b){if(!g.has(b))throw new i("Side channel does not contain "+t(b))},delete:function(b){if(a&&b&&(typeof b=="object"||typeof b=="function")){if(m)return h(m,b)}else if(n&&y)return y.delete(b);return!1},get:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&m?u(m,b):y&&y.get(b)},has:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&m?f(m,b):!!y&&y.has(b)},set:function(b,k){a&&b&&(typeof b=="object"||typeof b=="function")?(m||(m=new a),c(m,b,k)):n&&(y||(y=n()),y.set(b,k))}};return g}:n,fd}var hd,Hb;function AI(){if(Hb)return hd;Hb=1;var r=ma(),e=ic(),t=tI(),n=Wb(),i=TI(),a=i||n||t;return hd=function(){var c,f={assert:function(h){if(!f.has(h))throw new r("Side channel does not contain "+e(h))},delete:function(h){return!!c&&c.delete(h)},get:function(h){return c&&c.get(h)},has:function(h){return!!c&&c.has(h)},set:function(h,p){c||(c=a()),c.set(h,p)}};return f},hd}var dd,Qb;function pd(){if(Qb)return dd;Qb=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return dd={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},dd}var md,Gb;function Jb(){if(Gb)return md;Gb=1;var r=pd(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var _=[],w=0;w<256;++w)_.push("%"+((w<16?"0":"")+w.toString(16)).toUpperCase());return _}(),i=function(w){for(;w.length>1;){var T=w.pop(),C=T.obj[T.prop];if(t(C)){for(var R=[],O=0;O<C.length;++O)typeof C[O]<"u"&&R.push(C[O]);T.obj[T.prop]=R}}},a=function(w,T){for(var C=T&&T.plainObjects?{__proto__:null}:{},R=0;R<w.length;++R)typeof w[R]<"u"&&(C[R]=w[R]);return C},u=function _(w,T,C){if(!T)return w;if(typeof T!="object"&&typeof T!="function"){if(t(w))w.push(T);else if(w&&typeof w=="object")(C&&(C.plainObjects||C.allowPrototypes)||!e.call(Object.prototype,T))&&(w[T]=!0);else return[w,T];return w}if(!w||typeof w!="object")return[w].concat(T);var R=w;return t(w)&&!t(T)&&(R=a(w,C)),t(w)&&t(T)?(T.forEach(function(O,N){if(e.call(w,N)){var V=w[N];V&&typeof V=="object"&&O&&typeof O=="object"?w[N]=_(V,O,C):w.push(O)}else w[N]=O}),w):Object.keys(T).reduce(function(O,N){var V=T[N];return e.call(O,N)?O[N]=_(O[N],V,C):O[N]=V,O},R)},c=function(w,T){return Object.keys(T).reduce(function(C,R){return C[R]=T[R],C},w)},f=function(_,w,T){var C=_.replace(/\+/g," ");if(T==="iso-8859-1")return C.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(C)}catch{return C}},h=1024,p=function(w,T,C,R,O){if(w.length===0)return w;var N=w;if(typeof w=="symbol"?N=Symbol.prototype.toString.call(w):typeof w!="string"&&(N=String(w)),C==="iso-8859-1")return escape(N).replace(/%u[0-9a-f]{4}/gi,function(Se){return"%26%23"+parseInt(Se.slice(2),16)+"%3B"});for(var V="",D=0;D<N.length;D+=h){for(var U=N.length>=h?N.slice(D,D+h):N,Y=[],ae=0;ae<U.length;++ae){var re=U.charCodeAt(ae);if(re===45||re===46||re===95||re===126||re>=48&&re<=57||re>=65&&re<=90||re>=97&&re<=122||O===r.RFC1738&&(re===40||re===41)){Y[Y.length]=U.charAt(ae);continue}if(re<128){Y[Y.length]=n[re];continue}if(re<2048){Y[Y.length]=n[192|re>>6]+n[128|re&63];continue}if(re<55296||re>=57344){Y[Y.length]=n[224|re>>12]+n[128|re>>6&63]+n[128|re&63];continue}ae+=1,re=65536+((re&1023)<<10|U.charCodeAt(ae)&1023),Y[Y.length]=n[240|re>>18]+n[128|re>>12&63]+n[128|re>>6&63]+n[128|re&63]}V+=Y.join("")}return V},m=function(w){for(var T=[{obj:{o:w},prop:"o"}],C=[],R=0;R<T.length;++R)for(var O=T[R],N=O.obj[O.prop],V=Object.keys(N),D=0;D<V.length;++D){var U=V[D],Y=N[U];typeof Y=="object"&&Y!==null&&C.indexOf(Y)===-1&&(T.push({obj:N,prop:U}),C.push(Y))}return i(T),w},y=function(w){return Object.prototype.toString.call(w)==="[object RegExp]"},g=function(w){return!w||typeof w!="object"?!1:!!(w.constructor&&w.constructor.isBuffer&&w.constructor.isBuffer(w))},b=function(w,T){return[].concat(w,T)},k=function(w,T){if(t(w)){for(var C=[],R=0;R<w.length;R+=1)C.push(T(w[R]));return C}return T(w)};return md={arrayToObject:a,assign:c,combine:b,compact:m,decode:f,encode:p,isBuffer:g,isRegExp:y,maybeMap:k,merge:u},md}var yd,Yb;function kI(){if(Yb)return yd;Yb=1;var r=AI(),e=Jb(),t=pd(),n=Object.prototype.hasOwnProperty,i={brackets:function(_){return _+"[]"},comma:"comma",indices:function(_,w){return _+"["+w+"]"},repeat:function(_){return _}},a=Array.isArray,u=Array.prototype.push,c=function(k,_){u.apply(k,a(_)?_:[_])},f=Date.prototype.toISOString,h=t.default,p={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,filter:void 0,format:h,formatter:t.formatters[h],indices:!1,serializeDate:function(_){return f.call(_)},skipNulls:!1,strictNullHandling:!1},m=function(_){return typeof _=="string"||typeof _=="number"||typeof _=="boolean"||typeof _=="symbol"||typeof _=="bigint"},y={},g=function k(_,w,T,C,R,O,N,V,D,U,Y,ae,re,Se,se,ve,be,Ee){for(var ee=_,pe=Ee,q=0,de=!1;(pe=pe.get(y))!==void 0&&!de;){var Oe=pe.get(_);if(q+=1,typeof Oe<"u"){if(Oe===q)throw new RangeError("Cyclic object value");de=!0}typeof pe.get(y)>"u"&&(q=0)}if(typeof U=="function"?ee=U(w,ee):ee instanceof Date?ee=re(ee):T==="comma"&&a(ee)&&(ee=e.maybeMap(ee,function(ne){return ne instanceof Date?re(ne):ne})),ee===null){if(O)return D&&!ve?D(w,p.encoder,be,"key",Se):w;ee=""}if(m(ee)||e.isBuffer(ee)){if(D){var je=ve?w:D(w,p.encoder,be,"key",Se);return[se(je)+"="+se(D(ee,p.encoder,be,"value",Se))]}return[se(w)+"="+se(String(ee))]}var rt=[];if(typeof ee>"u")return rt;var Ve;if(T==="comma"&&a(ee))ve&&D&&(ee=e.maybeMap(ee,D)),Ve=[{value:ee.length>0?ee.join(",")||null:void 0}];else if(a(U))Ve=U;else{var Be=Object.keys(ee);Ve=Y?Be.sort(Y):Be}var wt=V?String(w).replace(/\./g,"%2E"):String(w),Ye=C&&a(ee)&&ee.length===1?wt+"[]":wt;if(R&&a(ee)&&ee.length===0)return Ye+"[]";for(var Me=0;Me<Ve.length;++Me){var Ue=Ve[Me],W=typeof Ue=="object"&&Ue&&typeof Ue.value<"u"?Ue.value:ee[Ue];if(!(N&&W===null)){var J=ae&&V?String(Ue).replace(/\./g,"%2E"):String(Ue),$=a(ee)?typeof T=="function"?T(Ye,J):Ye:Ye+(ae?"."+J:"["+J+"]");Ee.set(_,q);var Z=r();Z.set(y,Ee),c(rt,k(W,$,T,C,R,O,N,V,T==="comma"&&ve&&a(ee)?null:D,U,Y,ae,re,Se,se,ve,be,Z))}}return rt},b=function(_){if(!_)return p;if(typeof _.allowEmptyArrays<"u"&&typeof _.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof _.encodeDotInKeys<"u"&&typeof _.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(_.encoder!==null&&typeof _.encoder<"u"&&typeof _.encoder!="function")throw new TypeError("Encoder has to be a function.");var w=_.charset||p.charset;if(typeof _.charset<"u"&&_.charset!=="utf-8"&&_.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var T=t.default;if(typeof _.format<"u"){if(!n.call(t.formatters,_.format))throw new TypeError("Unknown format option provided.");T=_.format}var C=t.formatters[T],R=p.filter;(typeof _.filter=="function"||a(_.filter))&&(R=_.filter);var O;if(_.arrayFormat in i?O=_.arrayFormat:"indices"in _?O=_.indices?"indices":"repeat":O=p.arrayFormat,"commaRoundTrip"in _&&typeof _.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var N=typeof _.allowDots>"u"?_.encodeDotInKeys===!0?!0:p.allowDots:!!_.allowDots;return{addQueryPrefix:typeof _.addQueryPrefix=="boolean"?_.addQueryPrefix:p.addQueryPrefix,allowDots:N,allowEmptyArrays:typeof _.allowEmptyArrays=="boolean"?!!_.allowEmptyArrays:p.allowEmptyArrays,arrayFormat:O,charset:w,charsetSentinel:typeof _.charsetSentinel=="boolean"?_.charsetSentinel:p.charsetSentinel,commaRoundTrip:!!_.commaRoundTrip,delimiter:typeof _.delimiter>"u"?p.delimiter:_.delimiter,encode:typeof _.encode=="boolean"?_.encode:p.encode,encodeDotInKeys:typeof _.encodeDotInKeys=="boolean"?_.encodeDotInKeys:p.encodeDotInKeys,encoder:typeof _.encoder=="function"?_.encoder:p.encoder,encodeValuesOnly:typeof _.encodeValuesOnly=="boolean"?_.encodeValuesOnly:p.encodeValuesOnly,filter:R,format:T,formatter:C,serializeDate:typeof _.serializeDate=="function"?_.serializeDate:p.serializeDate,skipNulls:typeof _.skipNulls=="boolean"?_.skipNulls:p.skipNulls,sort:typeof _.sort=="function"?_.sort:null,strictNullHandling:typeof _.strictNullHandling=="boolean"?_.strictNullHandling:p.strictNullHandling}};return yd=function(k,_){var w=k,T=b(_),C,R;typeof T.filter=="function"?(R=T.filter,w=R("",w)):a(T.filter)&&(R=T.filter,C=R);var O=[];if(typeof w!="object"||w===null)return"";var N=i[T.arrayFormat],V=N==="comma"&&T.commaRoundTrip;C||(C=Object.keys(w)),T.sort&&C.sort(T.sort);for(var D=r(),U=0;U<C.length;++U){var Y=C[U],ae=w[Y];T.skipNulls&&ae===null||c(O,g(ae,Y,N,V,T.allowEmptyArrays,T.strictNullHandling,T.skipNulls,T.encodeDotInKeys,T.encode?T.encoder:null,T.filter,T.sort,T.allowDots,T.serializeDate,T.format,T.formatter,T.encodeValuesOnly,T.charset,D))}var re=O.join(T.delimiter),Se=T.addQueryPrefix===!0?"?":"";return T.charsetSentinel&&(T.charset==="iso-8859-1"?Se+="utf8=%26%2310003%3B&":Se+="utf8=%E2%9C%93&"),re.length>0?Se+re:""},yd}var gd,Kb;function II(){if(Kb)return gd;Kb=1;var r=Jb(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},i=function(y){return y.replace(/&#(\d+);/g,function(g,b){return String.fromCharCode(parseInt(b,10))})},a=function(y,g,b){if(y&&typeof y=="string"&&g.comma&&y.indexOf(",")>-1)return y.split(",");if(g.throwOnLimitExceeded&&b>=g.arrayLimit)throw new RangeError("Array limit exceeded. Only "+g.arrayLimit+" element"+(g.arrayLimit===1?"":"s")+" allowed in an array.");return y},u="utf8=%26%2310003%3B",c="utf8=%E2%9C%93",f=function(g,b){var k={__proto__:null},_=b.ignoreQueryPrefix?g.replace(/^\?/,""):g;_=_.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var w=b.parameterLimit===1/0?void 0:b.parameterLimit,T=_.split(b.delimiter,b.throwOnLimitExceeded?w+1:w);if(b.throwOnLimitExceeded&&T.length>w)throw new RangeError("Parameter limit exceeded. Only "+w+" parameter"+(w===1?"":"s")+" allowed.");var C=-1,R,O=b.charset;if(b.charsetSentinel)for(R=0;R<T.length;++R)T[R].indexOf("utf8=")===0&&(T[R]===c?O="utf-8":T[R]===u&&(O="iso-8859-1"),C=R,R=T.length);for(R=0;R<T.length;++R)if(R!==C){var N=T[R],V=N.indexOf("]="),D=V===-1?N.indexOf("="):V+1,U,Y;D===-1?(U=b.decoder(N,n.decoder,O,"key"),Y=b.strictNullHandling?null:""):(U=b.decoder(N.slice(0,D),n.decoder,O,"key"),Y=r.maybeMap(a(N.slice(D+1),b,t(k[U])?k[U].length:0),function(re){return b.decoder(re,n.decoder,O,"value")})),Y&&b.interpretNumericEntities&&O==="iso-8859-1"&&(Y=i(String(Y))),N.indexOf("[]=")>-1&&(Y=t(Y)?[Y]:Y);var ae=e.call(k,U);ae&&b.duplicates==="combine"?k[U]=r.combine(k[U],Y):(!ae||b.duplicates==="last")&&(k[U]=Y)}return k},h=function(y,g,b,k){var _=0;if(y.length>0&&y[y.length-1]==="[]"){var w=y.slice(0,-1).join("");_=Array.isArray(g)&&g[w]?g[w].length:0}for(var T=k?g:a(g,b,_),C=y.length-1;C>=0;--C){var R,O=y[C];if(O==="[]"&&b.parseArrays)R=b.allowEmptyArrays&&(T===""||b.strictNullHandling&&T===null)?[]:r.combine([],T);else{R=b.plainObjects?{__proto__:null}:{};var N=O.charAt(0)==="["&&O.charAt(O.length-1)==="]"?O.slice(1,-1):O,V=b.decodeDotInKeys?N.replace(/%2E/g,"."):N,D=parseInt(V,10);!b.parseArrays&&V===""?R={0:T}:!isNaN(D)&&O!==V&&String(D)===V&&D>=0&&b.parseArrays&&D<=b.arrayLimit?(R=[],R[D]=T):V!=="__proto__"&&(R[V]=T)}T=R}return T},p=function(g,b,k,_){if(g){var w=k.allowDots?g.replace(/\.([^.[]+)/g,"[$1]"):g,T=/(\[[^[\]]*])/,C=/(\[[^[\]]*])/g,R=k.depth>0&&T.exec(w),O=R?w.slice(0,R.index):w,N=[];if(O){if(!k.plainObjects&&e.call(Object.prototype,O)&&!k.allowPrototypes)return;N.push(O)}for(var V=0;k.depth>0&&(R=C.exec(w))!==null&&V<k.depth;){if(V+=1,!k.plainObjects&&e.call(Object.prototype,R[1].slice(1,-1))&&!k.allowPrototypes)return;N.push(R[1])}if(R){if(k.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+k.depth+" and strictDepth is true");N.push("["+w.slice(R.index)+"]")}return h(N,b,k,_)}},m=function(g){if(!g)return n;if(typeof g.allowEmptyArrays<"u"&&typeof g.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof g.decodeDotInKeys<"u"&&typeof g.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(g.decoder!==null&&typeof g.decoder<"u"&&typeof g.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof g.charset<"u"&&g.charset!=="utf-8"&&g.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof g.throwOnLimitExceeded<"u"&&typeof g.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var b=typeof g.charset>"u"?n.charset:g.charset,k=typeof g.duplicates>"u"?n.duplicates:g.duplicates;if(k!=="combine"&&k!=="first"&&k!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var _=typeof g.allowDots>"u"?g.decodeDotInKeys===!0?!0:n.allowDots:!!g.allowDots;return{allowDots:_,allowEmptyArrays:typeof g.allowEmptyArrays=="boolean"?!!g.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof g.allowPrototypes=="boolean"?g.allowPrototypes:n.allowPrototypes,allowSparse:typeof g.allowSparse=="boolean"?g.allowSparse:n.allowSparse,arrayLimit:typeof g.arrayLimit=="number"?g.arrayLimit:n.arrayLimit,charset:b,charsetSentinel:typeof g.charsetSentinel=="boolean"?g.charsetSentinel:n.charsetSentinel,comma:typeof g.comma=="boolean"?g.comma:n.comma,decodeDotInKeys:typeof g.decodeDotInKeys=="boolean"?g.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof g.decoder=="function"?g.decoder:n.decoder,delimiter:typeof g.delimiter=="string"||r.isRegExp(g.delimiter)?g.delimiter:n.delimiter,depth:typeof g.depth=="number"||g.depth===!1?+g.depth:n.depth,duplicates:k,ignoreQueryPrefix:g.ignoreQueryPrefix===!0,interpretNumericEntities:typeof g.interpretNumericEntities=="boolean"?g.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof g.parameterLimit=="number"?g.parameterLimit:n.parameterLimit,parseArrays:g.parseArrays!==!1,plainObjects:typeof g.plainObjects=="boolean"?g.plainObjects:n.plainObjects,strictDepth:typeof g.strictDepth=="boolean"?!!g.strictDepth:n.strictDepth,strictNullHandling:typeof g.strictNullHandling=="boolean"?g.strictNullHandling:n.strictNullHandling,throwOnLimitExceeded:typeof g.throwOnLimitExceeded=="boolean"?g.throwOnLimitExceeded:!1}};return gd=function(y,g){var b=m(g);if(y===""||y===null||typeof y>"u")return b.plainObjects?{__proto__:null}:{};for(var k=typeof y=="string"?f(y,b):y,_=b.plainObjects?{__proto__:null}:{},w=Object.keys(k),T=0;T<w.length;++T){var C=w[T],R=p(C,k[C],b,typeof y=="string");_=r.merge(_,R,b)}return b.allowSparse===!0?_:r.compact(_)},gd}var vd,Zb;function CI(){if(Zb)return vd;Zb=1;var r=kI(),e=II(),t=pd();return vd={formats:t,parse:e,stringify:r},vd}var PI=To.exports,Xb;function NI(){return Xb||(Xb=1,function(r,e){(function(t,n){n(e,Zk,Xk,CI())})(PI,function(t,n,i,a){var u=function(W,J,$,Z){function ne(G){return G instanceof $?G:new $(function(xe){xe(G)})}return new($||($=Promise))(function(G,xe){function qe(_e){try{le(Z.next(_e))}catch(Ge){xe(Ge)}}function $e(_e){try{le(Z.throw(_e))}catch(Ge){xe(Ge)}}function le(_e){_e.done?G(_e.value):ne(_e.value).then(qe,$e)}le((Z=Z.apply(W,J||[])).next())})},c=function(W,J){var $={label:0,sent:function(){if(G[0]&1)throw G[1];return G[1]},trys:[],ops:[]},Z,ne,G,xe;return xe={next:qe(0),throw:qe(1),return:qe(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function qe(le){return function(_e){return $e([le,_e])}}function $e(le){if(Z)throw new TypeError("Generator is already executing.");for(;$;)try{if(Z=1,ne&&(G=le[0]&2?ne.return:le[0]?ne.throw||((G=ne.return)&&G.call(ne),0):ne.next)&&!(G=G.call(ne,le[1])).done)return G;switch(ne=0,G&&(le=[le[0]&2,G.value]),le[0]){case 0:case 1:G=le;break;case 4:return $.label++,{value:le[1],done:!1};case 5:$.label++,ne=le[1],le=[0];continue;case 7:le=$.ops.pop(),$.trys.pop();continue;default:if(G=$.trys,!(G=G.length>0&&G[G.length-1])&&(le[0]===6||le[0]===2)){$=0;continue}if(le[0]===3&&(!G||le[1]>G[0]&&le[1]<G[3])){$.label=le[1];break}if(le[0]===6&&$.label<G[1]){$.label=G[1],G=le;break}if(G&&$.label<G[2]){$.label=G[2],$.ops.push(le);break}G[2]&&$.ops.pop(),$.trys.pop();continue}le=J.call(W,$)}catch(_e){le=[6,_e],ne=0}finally{Z=G=0}if(le[0]&5)throw le[1];return{value:le[0]?le[1]:void 0,done:!0}}};function f(W,J){if(W.directives&&W.directives.length){var $={};return W.directives.forEach(function(Z){$[Z.name.value]=i.argumentsObjectFromField(Z,J)}),$}return null}var h=Object.prototype.hasOwnProperty;function p(W,J){J!==null&&typeof J=="object"&&Object.keys(J).forEach(function($){var Z=J[$];h.call(W,$)?p(W[$],Z):W[$]=Z})}function m(W,J,$,Z,ne,G){G===void 0&&(G={});var xe=i.getMainDefinition(J),qe=i.getFragmentDefinitions(J),$e=i.createFragmentMap(qe),le=G.resultMapper,_e=G.fragmentMatcher||function(){return!0},Ge={fragmentMap:$e,contextValue:Z,variableValues:ne,resultMapper:le,resolver:W,fragmentMatcher:_e};return y(xe.selectionSet,$,Ge)}function y(W,J,$){return u(this,void 0,void 0,function(){var Z,ne,G,xe,qe,$e=this;return c(this,function(le){switch(le.label){case 0:return Z=$.fragmentMap,ne=$.contextValue,G=$.variableValues,xe={},qe=function(_e){return u($e,void 0,void 0,function(){var Ge,ot,ut,Gt,Ot;return c(this,function(Jt){switch(Jt.label){case 0:return i.shouldInclude(_e,G)?i.isField(_e)?[4,g(_e,J,$)]:[3,2]:[2];case 1:return Ge=Jt.sent(),ot=i.resultKeyNameFromField(_e),Ge!==void 0&&(xe[ot]===void 0?xe[ot]=Ge:p(xe[ot],Ge)),[2];case 2:if(i.isInlineFragment(_e))ut=_e;else if(ut=Z[_e.name.value],!ut)throw new Error("No fragment named "+_e.name.value);return Gt=ut.typeCondition.name.value,$.fragmentMatcher(J,Gt,ne)?[4,y(ut.selectionSet,J,$)]:[3,4];case 3:Ot=Jt.sent(),p(xe,Ot),Jt.label=4;case 4:return[2]}})})},[4,Promise.all(W.selections.map(qe))];case 1:return le.sent(),$.resultMapper?[2,$.resultMapper(xe,J)]:[2,xe]}})})}function g(W,J,$){return u(this,void 0,void 0,function(){var Z,ne,G,xe,qe,$e,le;return c(this,function(_e){switch(_e.label){case 0:return Z=$.variableValues,ne=$.contextValue,G=$.resolver,xe=W.name.value,qe=i.argumentsObjectFromField(W,Z),$e={isLeaf:!W.selectionSet,resultKey:i.resultKeyNameFromField(W),directives:f(W,Z),field:W},[4,G(xe,J,qe,ne,$e)];case 1:return le=_e.sent(),W.selectionSet?le==null?[2,le]:Array.isArray(le)?[2,b(W,le,$)]:[2,y(W.selectionSet,le,$)]:[2,le]}})})}function b(W,J,$){return Promise.all(J.map(function(Z){return Z===null?null:Array.isArray(Z)?b(W,Z,$):y(W.selectionSet,Z,$)}))}var k=function(){var W=function(J,$){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Z,ne){Z.__proto__=ne}||function(Z,ne){for(var G in ne)ne.hasOwnProperty(G)&&(Z[G]=ne[G])},W(J,$)};return function(J,$){W(J,$);function Z(){this.constructor=J}J.prototype=$===null?Object.create($):(Z.prototype=$.prototype,new Z)}}(),_=function(){return _=Object.assign||function(W){for(var J,$=1,Z=arguments.length;$<Z;$++){J=arguments[$];for(var ne in J)Object.prototype.hasOwnProperty.call(J,ne)&&(W[ne]=J[ne])}return W},_.apply(this,arguments)},w=function(W,J,$,Z){function ne(G){return G instanceof $?G:new $(function(xe){xe(G)})}return new($||($=Promise))(function(G,xe){function qe(_e){try{le(Z.next(_e))}catch(Ge){xe(Ge)}}function $e(_e){try{le(Z.throw(_e))}catch(Ge){xe(Ge)}}function le(_e){_e.done?G(_e.value):ne(_e.value).then(qe,$e)}le((Z=Z.apply(W,J||[])).next())})},T=function(W,J){var $={label:0,sent:function(){if(G[0]&1)throw G[1];return G[1]},trys:[],ops:[]},Z,ne,G,xe;return xe={next:qe(0),throw:qe(1),return:qe(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function qe(le){return function(_e){return $e([le,_e])}}function $e(le){if(Z)throw new TypeError("Generator is already executing.");for(;$;)try{if(Z=1,ne&&(G=le[0]&2?ne.return:le[0]?ne.throw||((G=ne.return)&&G.call(ne),0):ne.next)&&!(G=G.call(ne,le[1])).done)return G;switch(ne=0,G&&(le=[le[0]&2,G.value]),le[0]){case 0:case 1:G=le;break;case 4:return $.label++,{value:le[1],done:!1};case 5:$.label++,ne=le[1],le=[0];continue;case 7:le=$.ops.pop(),$.trys.pop();continue;default:if(G=$.trys,!(G=G.length>0&&G[G.length-1])&&(le[0]===6||le[0]===2)){$=0;continue}if(le[0]===3&&(!G||le[1]>G[0]&&le[1]<G[3])){$.label=le[1];break}if(le[0]===6&&$.label<G[1]){$.label=G[1],G=le;break}if(G&&$.label<G[2]){$.label=G[2],$.ops.push(le);break}G[2]&&$.ops.pop(),$.trys.pop();continue}le=J.call(W,$)}catch(_e){le=[6,_e],ne=0}finally{Z=G=0}if(le[0]&5)throw le[1];return{value:le[0]?le[1]:void 0,done:!0}}},C=function(){for(var W=0,J=0,$=arguments.length;J<$;J++)W+=arguments[J].length;for(var Z=Array(W),ne=0,J=0;J<$;J++)for(var G=arguments[J],xe=0,qe=G.length;xe<qe;xe++,ne++)Z[ne]=G[xe];return Z},R=function(W){var J=W.replace(/\s/g,""),$=J.replace(/\[(.*)\]/,function(Z,ne,G,xe){return((ne!=null&&ne.length)>0?ne:null)||J});return $},O=function(W,J,$,Z){if(Array.isArray(W)){var ne=R(J);return W.map(function(G){return O(G,ne,$,Z)})}return W==null||typeof W=="number"||typeof W=="boolean"||typeof W=="string"?W:$(W,J,$,Z)},N=function(W){return W.directives&&W.directives.length?W.directives.find(function(J){return J.name.value==="rest"}):null};function V(W,J,$,Z,ne){return ne==null||J==null||typeof J=="number"||typeof J=="boolean"||typeof J=="string"||ne.selections.forEach(function(G){if(i.isInlineFragment(G))V(W,J,$,Z,G.selectionSet);else if(G.kind==="FragmentSpread"){var xe=Z[G.name.value];V(W,J,$,Z,xe.selectionSet)}else if(i.isField(G)){var qe=i.resultKeyNameFromField(G);qe===W&&N(G)!=null?D(J,$,Z,G.selectionSet):V(W,J,$,Z,G.selectionSet)}else return function($e){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),J}function D(W,J,$,Z){if(!(W==null||typeof W=="number"||typeof W=="boolean"||typeof W=="string")){if(Array.isArray(W)){W.forEach(function(ne){return D(ne,J,$,Z)});return}Z.selections.forEach(function(ne){if(i.isInlineFragment(ne))D(W,J,$,ne.selectionSet);else if(ne.kind==="FragmentSpread"){var G=$[ne.name.value];D(W,J,$,G.selectionSet)}else if(i.isField(ne)){var xe=W[ne.name.value];ne.name.value==="__typename"||(typeof xe>"u"?W[ne.name.value]=null:xe!=null&&typeof xe=="object"&&ne.selectionSet!=null&&D(xe,J,$,ne.selectionSet))}else return function(qe){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var U=function(W,J){var $=W[J||Be]||W[Be];return typeof $=="string"?{uri:$}:_({responseTransformer:null},$)},Y=function(W,J,$){return $===void 0||J===void 0?W:W.replace(":"+J,$)},ae=function(){function W(){}return W.replacerForPath=function(J){if(J in W.cache)return W.cache[J];var $=J.indexOf("?"),Z=J.split(W.argReplacement),ne=[],G=!1;Z.reduce(function(qe,$e){if($e===""||$e==="{}")return qe+$e.length;var le=qe+$e.length;if($e[0]==="{"&&$e[$e.length-1]==="}"){var _e=$e.slice(1,$e.length-1).split(".");ne.push(function(Ge,ot){try{var ut=re(Ge,_e);return!ot||typeof ut!="object"||ut==null?String(ut):a.stringify(ut)}catch{var Gt=[J,_e.join(".")].join("|");return Gt in W.warnTable||(console.warn("Warning: RestLink caught an error while unpacking",Gt,"This tends to happen if you forgot to pass a parameter needed for creating an @rest(path, or if RestLink was configured to deeply unpack a path parameter that wasn't provided. This message will only log once per detected instance. Trouble-shooting hint: check @rest(path: and the variables provided to this query."),W.warnTable[Gt]=!0),""}})}else ne.push($e),!G&&le>=$&&(G=!0,ne.push(!0));return le},0);var xe=function(qe){var $e=!1,le=ne.reduce(function(_e,Ge){return typeof Ge=="string"?_e+Ge:typeof Ge=="boolean"?($e=!0,_e):_e+Ge(qe,$e)},"");return le};return W.cache[J]=xe},W.cache={},W.warnTable={},W.argReplacement=/({[._a-zA-Z0-9]*})/,W}();function re(W,J){if(J.length===0)return W;var $=C(J),Z=$.shift();return re(W[Z],$)}var Se=["__typename"],se=typeof globalThis=="object"&&globalThis||bs,ve=function(W,J,$){$===void 0&&($=[]);var Z=null;return J.length!=2?Z=function(ne,G){return J(ne)}:Z=J,Array.isArray(W)?W.map(function(ne,G){return ve(ne,Z,C($,[String(G)]))}):W==null||typeof W!="object"||W.constructor!==Object||se.FileList&&W instanceof FileList||se.File&&W instanceof File?W:Object.keys(W).reduce(function(ne,G){var xe=W[G];if(Se.indexOf(G)!==-1)return ne[G]=xe,ne;var qe=C($,[G]);return ne[Z(G,qe)]=ve(xe,Z,qe),ne},{})},be=function(W){return W},Ee=function(W){return W instanceof Headers?W:new Headers(W||{})},ee=function(){for(var W=[],J=0;J<arguments.length;J++)W[J]=arguments[J];return W.reduce(function($,Z){return Z&&(Z.forEach||(Z=Ee(Z)),Z.forEach(function(ne,G){$.append(G,ne)})),$},new Headers)},pe=function(W,J,$){var Z=new Headers;return W.forEach(function(ne,G){J.indexOf(G)===-1&&Z.append(G,ne)}),ee(Z,$||new Headers)},q=function(W){return function(J,$){return pe(J,W,$)}},de=["GET","POST","PUT","PATCH","DELETE"],Oe=function(W,J){switch(J){case"query":if(de.indexOf(W.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+W+'".');case"mutation":if(de.indexOf(W.toUpperCase())!==-1)return;throw new Error('"mutation" operations do not support that HTTP-verb');case"subscription":throw new Error('A "subscription" operation is not supported yet.');default:var $=J;return $}},je=function(W,J,$){var Z=new Error($);throw Z.response=W,Z.statusCode=W.status,Z.result=J,Z},rt=function(W,J){return W==null||typeof W!="object"?W:Array.isArray(W)?W.map(function($){return rt($,J)}):(W.__typename=J,W)},Ve=function(W,J,$,Z,ne){return w(void 0,void 0,void 0,function(){var G,xe,qe,$e,le,_e,Ge,ot,ut,Gt,Ot,Jt,sr,mr,Rt,ar,dr,zr,jt,Yt,Q,K,nt,at,ct,ze,Kt,kr,or,yr,Mn,rr,Dt,rn,Rr,gr,Hr,Dr,pr,Ir,Rn,li,Dn,Er,Qr,zt,Ft,Fn,Ln,mn;return T(this,function(mt){switch(mt.label){case 0:if(G=ne.directives,xe=ne.isLeaf,qe=ne.resultKey,$e=Z.exportVariablesByNode,le=$e.get(J)||{},_e=function(Gr){return Gr instanceof Array?Gr.forEach(_e):$e.set(Gr,_({},le)),Gr},Ge=(J||{})[qe],ot=(J||{})[W],J&&G&&G.export&&(le[G.export.as]=ot),ut=G&&G.type,!xe&&ut){if(G.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return _e(ot),[2,rt(ot,G.type.name)]}if(Gt=!G||!G.rest,Gt)return[2,_e(Ge||ot)];if(Ot=Z.credentials,Jt=Z.endpoints,sr=Z.headers,mr=Z.customFetch,Rt=Z.operationType,ar=Z.typePatcher,dr=Z.mainDefinition,zr=Z.fragmentDefinitions,jt=Z.fieldNameNormalizer,Yt=Z.fieldNameDenormalizer,Q=Z.serializers,K=Z.responseTransformer,nt=i.createFragmentMap(zr),at=G.rest,ct=at.path,ze=at.endpoint,Kt=at.pathBuilder,kr=U(Jt,ze),or=ct==null&&Kt==null,or)throw new Error('One of ("path" | "pathBuilder") must be set in the @rest() directive. This request had neither, please add one');if(Kt||(ct.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Kt=function(Gr){var S=Gr.args,I=Gr.exportVariables,A=_(_({},S),I),P=Object.keys(A).reduce(function(j,z){return Y(j,z,A[z])},ct);if(P.includes(":"))throw new Error('Missing parameters to run query, specify it in the query params or use an export directive. (If you need to use ":" inside a variable string make sure to encode the variables properly using `encodeURIComponent`. Alternatively see documentation about using pathBuilder.)');return P}):Kt=ae.replacerForPath(ct)),yr={args:$,exportVariables:le,context:Z,"@rest":G.rest,replacer:Kt},Mn=Kt(yr),rr=G.rest,Dt=rr.method,rn=rr.type,Rr=rr.bodyBuilder,gr=rr.bodyKey,Hr=rr.fieldNameDenormalizer,Dr=rr.fieldNameNormalizer,pr=rr.bodySerializer,Dt||(Dt="GET"),gr||(gr="input"),Ir=void 0,Rn=void 0,["GET","DELETE"].indexOf(Dt)===-1){if(!Rr){if(li=yr.exportVariables[gr]||yr.args&&yr.args[gr],!li)throw new Error("[GraphQL "+Dt+" "+Rt+" using a REST call without a body]. No `"+gr+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Rr=function(Gr){return li}}if(Ir=ve(Rr(yr),Hr||Yt||be),Dn=void 0,typeof pr=="string"){if(!Q.hasOwnProperty(pr))throw new Error('"bodySerializer" must correspond to configured serializer. '+("Please make sure to specify a serializer called "+pr+' in the "bodySerializers" property of the RestLink.'));Dn=Q[pr](Ir,sr)}else Dn=pr?pr(Ir,sr):Q[wt](Ir,sr);Ir=Dn.body,Rn=new Headers(Dn.headers)}return Oe(Dt,Rt||"query"),Er=_({method:Dt,headers:Rn||sr,body:Ir},Ot?{credentials:Ot}:{}),Qr=""+kr.uri+Mn,[4,(mr||fetch)(Qr,Er)];case 1:return zt=mt.sent(),Z.responses.push(zt),zt.ok?(zt.status===204||zt.headers.get("Content-Length")==="0"?Ft={}:Ft=zt,[3,9]):[3,2];case 2:return zt.status!==404?[3,3]:(Ft=null,[3,9]);case 3:Fn=void 0,mt.label=4;case 4:return mt.trys.push([4,6,,8]),[4,zt.clone().json()];case 5:return Fn=mt.sent(),[3,8];case 6:return mt.sent(),[4,zt.clone().text()];case 7:return Fn=mt.sent(),[3,8];case 8:je(zt,Fn,"Response not successful: Received status code "+zt.status),mt.label=9;case 9:if(Ln=kr.responseTransformer||K,!Ln)return[3,14];mt.label=10;case 10:return mt.trys.push([10,12,,13]),[4,Ln(Ft,rn)];case 11:return Ft=mt.sent(),[3,13];case 12:throw mn=mt.sent(),console.warn("An error occurred in a responseTransformer:"),mn;case 13:return[3,16];case 14:return Ft&&Ft.json?[4,Ft.json()]:[3,16];case 15:Ft=mt.sent(),mt.label=16;case 16:return Ft=ve(Ft,Dr||jt||be),Ft=V(qe,Ft,dr,nt,dr.selectionSet),Ft=O(Ft,rn,ar,{resolverParams:{fieldName:W,root:J,args:$,context:Z,info:ne}}),[2,_e(Ft)]}})})},Be="",wt="",Ye=function(W,J){return J.has("content-type")||J.append("Content-Type","application/json"),{body:JSON.stringify(W),headers:J}},Me={test:function(W){return W.name.value==="rest"},remove:!0},Ue=function(W){k(J,W);function J($){var Z,ne=$.uri,G=$.endpoints,xe=$.headers,qe=$.fieldNameNormalizer,$e=$.fieldNameDenormalizer,le=$.typePatcher,_e=$.customFetch,Ge=$.credentials,ot=$.bodySerializers,ut=$.defaultSerializer,Gt=$.responseTransformer,Ot=W.call(this)||this,Jt={};if(Jt[Be]=ne||"",Ot.endpoints=Object.assign({},G||Jt),ne==null&&G==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(ne!=null){var sr=(G||{})[Be];if(sr!=null&&sr!=ne)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");Ot.endpoints[Be]=ne}if(Ot.endpoints[Be]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),le==null)Ot.typePatcher=function(Rt,ar,dr){return _({__typename:ar},Rt)};else if(!Array.isArray(le)&&typeof le=="object"&&Object.keys(le).map(function(Rt){return le[Rt]}).reduce(function(Rt,ar){return Rt&&typeof ar=="function"},!0)){var mr=le;Ot.typePatcher=function(Rt,ar,dr,zr){var jt=Rt.__typename||ar;if(Array.isArray(Rt))return Rt.map(function(Q){return dr(Q,jt,dr,zr)});var Yt=mr[jt]||function(Q){return Q};return _({__typename:jt},Yt(Rt,jt,dr,zr))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return ot&&ot.hasOwnProperty(wt)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),Ot.responseTransformer=Gt||null,Ot.fieldNameNormalizer=qe||null,Ot.fieldNameDenormalizer=$e||null,Ot.headers=Ee(xe),Ot.credentials=Ge||null,Ot.customFetch=_e,Ot.serializers=_((Z={},Z[wt]=ut||Ye,Z),ot||{}),Ot.processedDocuments=new Map,Ot}return J.prototype.removeRestSetsFromDocument=function($){var Z=this.processedDocuments.get($);if(Z)return Z;i.checkDocument($);var ne=i.removeDirectivesFromDocument([Me],$);return this.processedDocuments.set($,ne),ne},J.prototype.request=function($,Z){var ne=$.query,G=$.variables,xe=$.getContext,qe=$.setContext,$e=xe(),le=i.hasDirectives(["rest"],ne);if(!le)return Z($);var _e=this.removeRestSetsFromDocument(ne),Ge=$e.headersMergePolicy;Ge==null&&Array.isArray($e.headersToOverride)?Ge=q($e.headersToOverride):Ge==null&&(Ge=ee);var ot=Ge(this.headers,$e.headers);ot.has("Accept")||ot.append("Accept","application/json");var ut=$e.credentials||this.credentials,Gt=i.addTypenameToDocument(ne),Ot=i.getMainDefinition(ne),Jt=i.getFragmentDefinitions(ne),sr=(Ot||{}).operation||"query",mr={headers:ot,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:ut,customFetch:this.customFetch,operationType:sr,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:Ot,fragmentDefinitions:Jt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},Rt={},ar;return _e&&Z?($.query=_e,ar=Z($)):ar=n.Observable.of({data:{}}),ar.flatMap(function(dr){var zr=dr.data,jt=dr.errors;return new n.Observable(function(Yt){m(Ve,Gt,zr,mr,G,Rt).then(function(Q){qe({restResponses:($e.restResponses||[]).concat(mr.responses)}),Yt.next({data:Q,errors:jt}),Yt.complete()}).catch(function(Q){Q.name!=="AbortError"&&(Q.result&&Q.result.errors&&Yt.next(Q.result),Yt.error(Q))})})})},J}(n.ApolloLink);t.RestLink=Ue,t.PathBuilder=ae,Object.defineProperty(t,"__esModule",{value:!0})})}(To,To.exports)),To.exports}var MI=NI();const ac=ge.createContext(),RI=()=>{const{isAuthenticated:r,login:e}=Zn(),{children:t,isEmbedded:n,setIsEmbedded:i,authError:a}=ge.useContext(ac),u=ji.useNavigate(),c=ji.useLocation(),[f,h]=ge.useState(!1),[p,m]=ge.useState(),[y,g]=ge.useState(),[b,k]=ge.useState({}),_=ge.useRef({}),w=ge.useRef({}),[T,C]=ge.useState(!1),[R,O]=ge.useState({}),N=(ee,pe={})=>{f&&window.parent.postMessage({type:ee,instanceId:y,...pe},p)},V=(ee,pe,q={})=>{if(!ee)throw new Error("Namespace is required for sendMessage");N(`${ee}:${pe}`,q)};ge.useEffect(()=>{if(!(!c||c.pathname!=="/mm-embedded-login")){if(r||a)if(new URL(origin)?.protocol==="http:"){window.close();return}else{const pe=new URLSearchParams(c.search),q=pe.get("id"),de=pe.get("origin");a?window.parent.postMessage({type:"authorize-failed",instanceId:q,error:a,authUrl:window.location.href},de):window.parent.postMessage({type:"authorized",instanceId:q,authUrl:window.location.href},de);return}r===!1&&e()}},[c]),ge.useEffect(()=>{if(r===null||!c||c.pathname!=="/mm-embedded-interop")return;const ee=new URLSearchParams(c.search),pe=ee.get("id"),q=ee.get("origin");if(q){const de=new URL(q)?.hostname;if(/^(?:[\w-]+\.)*(?:machinemetrics\.com|machinemetrics-us-gov\.com|m12s\.com)$/.test(de))m(q);else{alert("Invalid Embeddable Zone Host");return}}if(r===!1){if(q){const de={instanceId:pe,authUrl:`${window.location.protocol}//${window.location.host}/mm-embedded-login?id=${pe}&origin=${q}`,origin:q};if(new URL(q)?.protocol==="http:"){window.parent.postMessage({type:"login",...de},q);return}e({mm_instanceId:de.instanceId,mm_authUrl:encodeURIComponent(de.authUrl),mm_origin:de.origin});return}e();return}pe&&g(pe),pe&&q&&i(!0)},[c,r]),ji.useBlocker(({nextLocation:ee})=>n?ee.state?.fromParent?(h(!0),!1):(D(`${ee.pathname}${ee.search}`),!0):!1),ge.useEffect(()=>{if(!n||!p)return;const ee=pe=>{pe.metaKey&&pe.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:y},p)};return window.addEventListener("keydown",ee),()=>{window.removeEventListener("keydown",ee)}},[n,p]),ge.useEffect(()=>{if(!n||!p)return;const ee=({origin:pe,data:q})=>{if(pe===p)switch(q.type){case"navigate":u(q.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":k(q.context||{});break;case"set-configuring":C(q.isConfiguring);break;case"set-params":O(q.params);break;case"load-options":_.current[`option-${q.name}`]?.({filter:q.filter||""});break;case"validate":_.current[`validate-${q.name}`]?.({value:q.value});break;case"request":w.current[q.requestType]?.(q);break;case"response":_.current[q.callbackId]?.(q.response);break}};return window.addEventListener("message",ee),!f&&r&&window.parent.postMessage({type:"ready",instanceId:y},p),()=>{window.removeEventListener("message",ee)}},[u,f,n,r,p]);const D=(ee,pe)=>{!f&&!r||N("set-path",{path:ee,...pe})},U=ee=>{N("set-summary",{summary:ee})},Y=ee=>{N("toast",{message:ee})},ae=ee=>{N("popup",{message:ee})},re=()=>{N("loaded")},Se=async({header:ee,body:pe,choices:q})=>f?new Promise(de=>{const Oe=W0(),je=async rt=>{delete _.current[Oe],de(rt)};_.current[Oe]=je,N("confirm",{header:ee,body:pe,choices:q,callbackId:Oe})}):Promise.reject(new Error("Not ready")),se=({requestType:ee,func:pe})=>{const q=async({callbackId:de,data:Oe})=>{try{const je=await pe(Oe);N("response",{callbackId:de,response:je})}catch(je){N("response",{callbackId:de,error:je.message})}};return w.current[ee]=q,N("mark-registered",{requestType:ee}),()=>{delete w.current[ee]}},ve=({callbackId:ee,func:pe,responseType:q="response",responseKey:de="response",props:Oe={},callOnRegister:je=!1})=>{const rt=async Be=>{const wt=await pe(Be);N(q,{...Oe,[de]:wt,callbackId:ee})},Ve=_.current[ee];_.current[ee]=rt,Ve&&je&&rt(Oe)},be=(ee,pe)=>{if(f){if(pe.validate&&typeof pe.validate=="function"&&ve({callbackId:`validate-${ee}`,func:pe.validate,responseType:"set-validation",responseKey:"validation",props:{name:ee}}),pe.options){const q=typeof pe.options=="function"?pe.options:()=>pe.options;ve({callbackId:`option-${ee}`,func:q,responseType:"set-options",responseKey:"options",props:{name:ee},callOnRegister:!0})}N("add-setting",{setting:{name:ee,...pe,options:void 0,validate:void 0}})}},Ee=ge.useMemo(()=>({commands:{navigateParent:D,setSummary:U,toast:Y,popup:ae,confirm:Se,setLoaded:re,sendMessage:V},context:{...b,get colorMode(){throw new Error("colorMode has been moved to useMMAppParams")},get isFullScreen(){throw new Error("isFullScreen has been moved to useMMAppParams")}},params:{isEmbedded:n,isConfiguring:T,colorMode:b.colorMode,isFullScreen:b.isFullScreen,...R},addSetting:be,registerHandler:se}),[n,T,D,U,Y,ae,Se,re,V,b,R,be,se]);return Bt.jsx(Si.Provider,{value:Ee,children:c.pathname!=="/mm-embedded-interop"&&c.pathname!=="/mm-embedded-login"&&c.pathname!=="/mm-embedded-print"?t:Bt.jsx(Bt.Fragment,{})})},DI=()=>{const{urls:r,jwtRef:e,accessToken:t}=Zn(),{graphQLRoleOverride:n,children:i}=ge.useContext(ac),[a,u]=ge.useState(),[c,f]=ge.useState(),h=()=>{const y=new URL(r.graphQLUrl);return`//${y.host}${y.pathname}`},p=()=>n?{"X-Hasura-Role":n}:{};ge.useEffect(()=>{const y=new zk(Jk({url:`wss:${h()}`,lazy:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...p()}})})),g=Z0(({operation:C,networkError:R,forward:O})=>(Qi(C.query).operation==="subscription"&&R&&y.client.terminate(),O(C))),k=K0(async(C,{headers:R})=>({headers:{...R,Authorization:`Bearer ${e.current}`,...p()}})).concat(lf({uri:`https:${h()}`,fetch:window.fetch})),_=g.split(({query:C})=>{const R=Qi(C);return R.kind==="OperationDefinition"&&R.operation==="subscription"},y,k),T=K0(async(C,{headers:R})=>({headers:{...R,Authorization:`Bearer ${t}`}})).concat(new MI.RestLink({uri:r.apiUrl}));f(jr.from([T,_]))},[]),ge.useEffect(()=>{c&&u(new Mf({link:c,cache:new kf}))},[c]);const m=ge.useMemo(()=>({link:c}),[c]);return Bt.jsx(O0.Provider,{value:m,children:a?Bt.jsx(VO,{client:a,children:Bt.jsx(ok,{children:Bt.jsx(RI,{children:i})})}):Bt.jsx(Bt.Fragment,{})})},FI=nm.div`
|
|
124
|
-
text-align: center;
|
|
125
|
-
padding-top: 200px;
|
|
126
|
-
`,ew=({loadError:r})=>{const e=$k();return r&&(!e||e.indexOf("mm-embedded-login")===-1)?Bt.jsx(FI,{children:r}):(z0(),Bt.jsx(ji.Navigate,{replace:!0,to:e||"/"}))};nm.div`
|
|
127
|
-
font-size: 20px;
|
|
128
|
-
text-align: center;
|
|
129
|
-
margin-top: 300px;
|
|
130
|
-
`;const LI=()=>{const{isAuthenticated:r}=Zn(),{authorize:e,authError:t,setAuthError:n}=ge.useContext(ac);return xo(async i=>{try{await e(i)}catch(a){console.log(a),n("Login Failed. Try again.")}},[]),t?Bt.jsx(ew,{loadError:t}):r?Bt.jsx(ew,{}):Bt.jsx(Bt.Fragment,{})},Ao={production:{loginUrl:"https://login.machinemetrics.com",appUrl:"https://app.machinemetrics.com",apiUrl:"https://api.machinemetrics.com",graphQLUrl:"https://graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.machinemetrics.com"},staging:{loginUrl:"https://login-staging.machinemetrics.com",appUrl:"https://staging.machinemetrics.com",apiUrl:"https://api-staging.machinemetrics.com",graphQLUrl:"https://hasura.tsdb.perlman.m12s.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"},development:{loginUrl:"https://login.development.machinemetrics.com",appUrl:"https://app.development.machinemetrics.com",apiUrl:"https://api.development.machinemetrics.com",graphQLUrl:"https://hasura.tsdb.perlman.m12s.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"}},qI=ji.createBrowserRouter([{path:"/authorize/mm/callback",element:Bt.jsx(LI,{})},{path:"/*",element:Bt.jsx(DI,{})}]),jI=({domain:r,children:e,scope:t,clientId:n,clientSecret:i,releaseStage:a,device:u,graphQLRoleOverride:c,urls:f})=>{r&&console.warn("MMProvider domain is no longer used. It is inferred from the url.");const[h,p]=ge.useState(),[m,y]=ge.useState(!1);let g;if(Ao[a])g=Ao[a];else if(!g){const se=oi.keys(Ao).join(", "),ve=oi.keys(Ao[Object.keys(Ao)[0]]);throw Error(`MMProvider releaseStage must be one of the following: ${se}, or the following urls need to be provided: ${ve}.`)}g=oi.merge(g,f);const[b,k]=ge.useState(jk());ge.useEffect(()=>{Uk(b)},[b]);const _=se=>{const ve=W0();H0(ve),z0(window.location.pathname+window.location.search);const Ee=(pe=>oi.map(pe,(q,de)=>`${de}=${q}`).join("&"))({response_type:"code",state:ve,scope:t,ttl:1209600,client_id:n,...u!==void 0&&{device:u},redirect_uri:`${window.location.origin}/authorize/mm/callback`,...se}),ee=`${g.loginUrl}/oauth/authorize?${Ee}`;window.location=ee},w=async se=>{const ve=Dk.parse(window.location.search),be=ve.code;if(ve.error)throw Error(ve.error_description);if(ve.state!==Bk())throw Error("Oops");const Ee={grant_type:"authorization_code",client_id:n,client_secret:i,code:be,redirect_uri:`${window.location.origin}/authorize/mm/callback`},ee=await Q0(`${g.loginUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:new URLSearchParams(Ee),signal:se});k(ee.access_token),H0()},T=()=>{k()},C=async(se,ve={})=>{ve.headers={...ve.headers,"Content-Type":"application/json",Authorization:`Bearer ${b}`};const be=await Q0(se,ve);if(be.error&&be.error.status===401)throw await R(),Error("UNAUTHORIZED");return be},R=async()=>{await C(`${g.loginUrl}/logout`,{method:"DELETE"}),T()},[O,N]=ge.useState(),[V,D]=ge.useState(0),U=ge.useRef(),Y=ge.useRef(),ae=()=>{D(se=>se+1)};Eo(async()=>{if(!b){U.current=null,N(!1);return}try{const se=await C(`${g.apiUrl}/user-token?graphql=1`);U.current=se,N(!0)}catch{}},1e3*60*4.5,[b,V]),Eo(async()=>{if(!b){Y.current=null;return}try{const se=await C(`${g.apiUrl}/nats-token`);Y.current=se}catch{}},1e3*60*9.5,[b]);const re=ge.useMemo(()=>({clientId:n,accessToken:b,jwtRef:U,natsCredsRef:Y,isAuthenticated:O,login:_,logout:R,request:C,refreshJwt:ae,urls:g}),[n,b,U,Y,O,_,R,C,ae,g]),Se=ge.useMemo(()=>({children:e,graphQLRoleOverride:c,authorize:w,isEmbedded:m,setIsEmbedded:y,authError:h,setAuthError:p}),[e,c,w,m,y,h,p]);return Bt.jsx(T0.Provider,{value:re,children:Bt.jsx(ac.Provider,{value:Se,children:Bt.jsx(ji.RouterProvider,{router:qI})})})},fn=new Uint8Array(0),Oi=new TextEncoder,tn=new TextDecoder;function UI(...r){let e=0;for(let i=0;i<r.length;i++)e+=r[i].length;const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++)t.set(r[i],n),n+=r[i].length;return t}function ko(...r){const e=[];for(let t=0;t<r.length;t++)e.push(Oi.encode(r[t]));return e.length===0?fn:e.length===1?e[0]:UI(...e)}function tw(r){return!r||r.length===0?"":tn.decode(r)}const rw="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",nw=36,$I=0xcfd41b9100000,iw=33,BI=333,sw=22;function VI(r){for(let e=0;e<r.length;e++)r[e]=Math.floor(Math.random()*255)}function WI(r){globalThis?.crypto?.getRandomValues?globalThis.crypto.getRandomValues(r):VI(r)}class zI{buf;seq;inc;inited;constructor(){this.buf=new Uint8Array(sw),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*$I),this.inc=Math.floor(Math.random()*(BI-iw)+iw)}setPre(){const e=new Uint8Array(12);WI(e);for(let t=0;t<12;t++){const n=e[t]%36;this.buf[t]=rw.charCodeAt(n)}}fillSeq(){let e=this.seq;for(let t=sw-1;t>=12;t--)this.buf[t]=rw.charCodeAt(e%nw),e=Math.floor(e/nw)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const is=new zI;var Ti;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Ti||(Ti={}));var ya;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(ya||(ya={}));var we;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(we||(we={}));function HI(r){return typeof r.code=="string"}class aw{messages;constructor(){this.messages=new Map,this.messages.set(we.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(we.BadJson,"Bad JSON"),this.messages.set(we.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return QI.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const QI=new aw;class Ne extends Error{name;message;code;permissionContext;chainedError;api_error;constructor(e,t,n){super(e),this.name="NatsError",this.message=e,this.code=t,this.chainedError=n}static errorForCode(e,t){const n=aw.getMessage(e);return new Ne(n,e,t)}isAuthError(){return this.code===we.AuthenticationExpired||this.code===we.AuthorizationViolation||this.code===we.AccountExpired}isAuthTimeout(){return this.code===we.AuthenticationTimeout}isPermissionError(){return this.code===we.PermissionsViolation}isProtocolError(){return this.code===we.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var hn;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(hn||(hn={}));var Xn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Xn||(Xn={}));var Io;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Io||(Io={}));const oc="Nats-Service-Error",uc="Nats-Service-Error-Code";class cc extends Error{code;constructor(e,t){super(t),this.code=e}static isServiceError(e){return cc.toServiceError(e)!==null}static toServiceError(e){const t=e?.headers?.get(uc)||"";if(t!==""){const n=parseInt(t)||400,i=e?.headers?.get(oc)||"";return new cc(n,i.length?i:t)}return null}}function Ai(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${is.next()}`}const bd="127.0.0.1";var ss;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(ss||(ss={}));function lc(r,...e){for(let t=0;t<e.length;t++){const n=e[t];Object.keys(n).forEach(function(i){r[i]=n[i]})}return r}function fc(r){return tn.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ga(r,e=!0){const t=e?Ne.errorForCode(we.Timeout):null;let n,i;const a=new Promise((u,c)=>{n={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{c(t===null?Ne.errorForCode(we.Timeout):t)},r)});return Object.assign(a,n)}function va(r=0){let e;const t=new Promise(n=>{const i=setTimeout(()=>{n()},r);e={cancel:()=>{i&&clearTimeout(i)}}});return Object.assign(t,e)}function Vt(){let r={};const e=new Promise((t,n)=>{r={resolve:t,reject:n}});return Object.assign(e,r)}function ow(r){for(let e=r.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return r}function GI(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function wd(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const e=r.length-1;return{backoff(t){return GI(t>e?r[e]:r[t])}}}function Wt(r){return r*1e6}function _d(r){return Math.floor(r/1e6)}function uw(r){let n=!0;const i=new Array(r.length);for(let a=0;a<r.length;a++){let u=r.charCodeAt(a);if(u===58||u<33||u>126)throw new Ne(`'${r[a]}' is not a valid character for a header key`,we.BadHeader);n&&97<=u&&u<=122?u-=32:!n&&65<=u&&u<=90&&(u+=32),i[a]=u,n=u==45}return String.fromCharCode(...i)}function ki(r=0,e=""){if(r===0&&e!==""||r>0&&e==="")throw new Error("setting status requires both code and description");return new as(r,e)}const Sd="NATS/1.0";class as{_code;headers;_description;constructor(e=0,t=""){this._code=e,this._description=t,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[t,n]of this.headers){const i=e.values(t);if(n.length!==i.length)return!1;const a=[...n].sort(),u=[...i].sort();for(let c=0;c<a.length;c++)if(a[c]!==u[c])return!1}return!0}return!1}static decode(e){const t=new as,i=tn.decode(e).split(`\r
|
|
131
|
-
`),a=i[0];if(a!==Sd){let u=a.replace(Sd,"").trim();if(u.length>0){t._code=parseInt(u,10),isNaN(t._code)&&(t._code=0);const c=t._code.toString();u=u.replace(c,""),t._description=u.trim()}}return i.length>=1&&i.slice(1).map(u=>{if(u){const c=u.indexOf(":");if(c>-1){const f=u.slice(0,c),h=u.slice(c+1).trim();t.append(f,h)}}}),t}toString(){if(this.headers.size===0&&this._code===0)return"";let e=Sd;this._code>0&&this._description!==""&&(e+=` ${this._code} ${this._description}`);for(const[t,n]of this.headers)for(let i=0;i<n.length;i++)e=`${e}\r
|
|
132
|
-
${t}: ${n[i]}`;return`${e}\r
|
|
133
|
-
\r
|
|
134
|
-
`}encode(){return Oi.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new Ne("invalid header value - \\r and \\n are not allowed.",we.BadHeader);return e.trim()}keys(){const e=[];for(const t of this.headers.keys())e.push(t);return e}findKeys(e,t=hn.Exact){const n=this.keys();switch(t){case hn.Exact:return n.filter(i=>i===e);case hn.CanonicalMIME:return e=uw(e),n.filter(i=>i===e);default:{const i=e.toLowerCase();return n.filter(a=>i===a.toLowerCase())}}}get(e,t=hn.Exact){const n=this.findKeys(e,t);if(n.length){const i=this.headers.get(n[0]);if(i)return Array.isArray(i)?i[0]:i}return""}last(e,t=hn.Exact){const n=this.findKeys(e,t);if(n.length){const i=this.headers.get(n[0]);if(i)return Array.isArray(i)?i[i.length-1]:i}return""}has(e,t=hn.Exact){return this.findKeys(e,t).length>0}set(e,t,n=hn.Exact){this.delete(e,n),this.append(e,t,n)}append(e,t,n=hn.Exact){const i=uw(e);n===hn.CanonicalMIME&&(e=i);const a=this.findKeys(e,n);e=a.length>0?a[0]:e;const u=as.validHeaderValue(t);let c=this.headers.get(e);c||(c=[],this.headers.set(e,c)),c.push(u)}values(e,t=hn.Exact){const n=[];return this.findKeys(e,t).forEach(a=>{const u=this.headers.get(a);u&&n.push(...u)}),n}delete(e,t=hn.Exact){this.findKeys(e,t).forEach(i=>{this.headers.delete(i)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const e={};return this.keys().forEach(t=>{e[t]=this.values(t)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(e){const t=new as;for(const n in e)t.headers.set(n,e[n]);return t}}function cw(){return{encode(r){return Oi.encode(r)},decode(r){return tn.decode(r)}}}function Cn(r){return{encode(e){try{return e===void 0&&(e=null),Oi.encode(JSON.stringify(e))}catch(t){throw Ne.errorForCode(we.BadJson,t)}},decode(e){try{return JSON.parse(tn.decode(e),r)}catch(t){throw Ne.errorForCode(we.BadJson,t)}}}}function lw(r){return r&&r.data.length===0&&r.headers?.code===503?Ne.errorForCode(we.NoResponders):null}class fw{_headers;_msg;_rdata;_reply;_subject;publisher;static jc;constructor(e,t,n){this._msg=e,this._rdata=t,this.publisher=n}get subject(){return this._subject?this._subject:(this._subject=tn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=tn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const e=this._rdata.subarray(0,this._msg.hdr);this._headers=as.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(e=fn,t){return this.reply?(this.publisher.publish(this.reply,e,t),!0):!1}size(){const e=this._msg.subject.length,t=this._msg.reply?.length||0,n=this._msg.size===-1?0:this._msg.size;return e+t+n}json(e){return Cn(e).decode(this.data)}string(){return tn.decode(this.data)}requestInfo(){const e=this.headers?.get("Nats-Request-Info");return e?JSON.parse(e,function(t,n){return(t==="start"||t==="stop")&&n!==""?new Date(Date.parse(n)):n}):null}}function ba(r){return hc("durable",r)}function $r(r){return hc("stream",r)}function hc(r,e=""){if(e==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
|
|
135
|
-
`,"\r"].forEach(n=>{if(e.indexOf(n)!==-1){switch(n){case`
|
|
136
|
-
`:n="\\n";break;case"\r":n="\\r";break;case" ":n="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${n}'`)}}),""}function Co(r,e=""){if(e==="")throw Error(`${r} name required`);const t=JI(e);if(t.length)throw new Error(`invalid ${r} name - ${r} name ${t}`)}function JI(r=""){if(r==="")throw Error("name required");const e=/^[-\w]+$/g;if(r.match(e)===null){for(const n of r.split(""))if(n.match(e)===null)return`cannot contain '${n}'`}return""}function xd(r){if(r.data.length>0)return!1;const e=r.headers;return e?e.code>=100&&e.code<200:!1}function Ed(r){return xd(r)&&r.headers?.description==="Idle Heartbeat"}function YI(r,e,t){const n=ki(r,e),i={hdr:1,sid:0,size:0},a=new fw(i,fn,{});return a._headers=n,a._subject=t,a}function wa(r){if(r.data.length!==0)return null;const e=r.headers;return e?hw(e.code,e.description):null}var Pn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(Pn||(Pn={}));function KI(r){return r.code!==we.JetStream409?!1:[Pn.MaxBatchExceeded,Pn.MaxExpiresExceeded,Pn.MaxBytesExceeded,Pn.MaxMessageSizeExceeded,Pn.PushConsumer,Pn.IdleHeartbeatMissed,Pn.ConsumerDeleted].find(t=>r.message.indexOf(t)!==-1)!==void 0}function hw(r,e=""){if(r<300)return null;switch(e=e.toLowerCase(),r){case 404:return new Ne(e,we.JetStream404NoMessages);case 408:return new Ne(e,we.JetStream408RequestTimeout);case 409:{const t=e.startsWith(Pn.IdleHeartbeatMissed)?we.JetStreamIdleHeartBeat:we.JetStream409;return new Ne(e,t)}case 503:return Ne.errorForCode(we.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=we.Unknown),new Ne(e,`${r}`)}}class Sr{inflight;processed;received;noIterator;iterClosed;done;signal;yields;filtered;pendingFiltered;ingestionFilterFn;protocolFilterFn;dispatchedFn;ctx;_data;err;time;yielding;constructor(){this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=Vt(),this.yields=[],this.iterClosed=Vt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(this.done)return;if(typeof e=="function"){this.yields.push(e),this.signal.resolve();return}const{ingest:t,protocol:n}=this.ingestionFilterFn?this.ingestionFilterFn(e,this.ctx||this):{ingest:!0,protocol:!1};t&&(n&&(this.filtered++,this.pendingFiltered++),this.yields.push(e),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Ne("unsupported iterator",we.ApiError);if(this.yielding)throw new Ne("already yielding",we.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const e=this.yields;this.inflight=e.length,this.yields=[];for(let t=0;t<e.length;t++){if(typeof e[t]=="function"){const i=e[t];try{i()}catch(a){throw a}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(e[t]):!0){this.processed++;const i=Date.now();yield e[t],this.time=Date.now()-i,this.dispatchedFn&&e[t]&&this.dispatchedFn(e[t])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=Vt())}}finally{this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Od{interval;maxOut;cancelAfter;timer;autoCancelTimer;last;missed;count;callback;constructor(e,t,n={maxOut:2}){this.interval=e,this.maxOut=n?.maxOut||2,this.cancelAfter=n?.cancelAfter||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=t,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(e,t=0,n=2){this.interval=e,this.maxOut=n,this.cancelAfter=t,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(e){console.log(e)}},this.interval)}}var Td;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Td||(Td={}));var Po;(function(r){r.Old="old",r.New="new"})(Po||(Po={}));var Ad;(function(r){r.File="file",r.Memory="memory"})(Ad||(Ad={}));var ir;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ir||(ir={}));var xr;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(xr||(xr={}));var _a;(function(r){r.Instant="instant",r.Original="original"})(_a||(_a={}));var os;(function(r){r.None="none",r.S2="s2"})(os||(os={}));var dc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(dc||(dc={}));function ZI(r,e={}){return Object.assign({name:r,deliver_policy:ir.All,ack_policy:xr.Explicit,ack_wait:Wt(30*1e3),replay_policy:_a.Instant},e)}var dw;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(dw||(dw={}));var Br;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Br||(Br={}));var ei;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(ei||(ei={}));var Sa;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(Sa||(Sa={}));var pw;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(pw||(pw={}));const dn="KV_";class XI{config;ordered;mack;stream;callbackFn;max;qname;isBind;filters;constructor(e){this.stream="",this.mack=!1,this.ordered=!1,this.config=ZI("",e||{})}getOpts(){const e={};if(e.config=Object.assign({},this.config),e.config.filter_subject&&(this.filterSubject(e.config.filter_subject),e.config.filter_subject=void 0),e.config.filter_subjects&&(e.config.filter_subjects?.forEach(t=>{this.filterSubject(t)}),e.config.filter_subjects=void 0),e.mack=this.mack,e.stream=this.stream,e.callbackFn=this.callbackFn,e.max=this.max,e.queue=this.qname,e.ordered=this.ordered,e.config.ack_policy=e.ordered?xr.None:e.config.ack_policy,e.isBind=e.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:e.config.filter_subject=this.filters[0];break;default:e.config.filter_subjects=this.filters}return e}description(e){return this.config.description=e,this}deliverTo(e){return this.config.deliver_subject=e,this}durable(e){return ba(e),this.config.durable_name=e,this}startSequence(e){if(e<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ir.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=ir.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=ir.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ir.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ir.Last,this}deliverNew(){return this.config.deliver_policy=ir.New,this}startAtTimeDelta(e){return this.startTime(new Date(Date.now()-e)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=xr.None,this}ackAll(){return this.config.ack_policy=xr.All,this}ackExplicit(){return this.config.ack_policy=xr.Explicit,this}ackWait(e){return this.config.ack_wait=Wt(e),this}maxDeliver(e){return this.config.max_deliver=e,this}filterSubject(e){return this.filters=this.filters||[],this.filters.push(e),this}replayInstantly(){return this.config.replay_policy=_a.Instant,this}replayOriginal(){return this.config.replay_policy=_a.Original,this}sample(e){if(e=Math.trunc(e),e<0||e>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${e}%`,this}limit(e){return this.config.rate_limit_bps=e,this}maxWaiting(e){return this.config.max_waiting=e,this}maxAckPending(e){return this.config.max_ack_pending=e,this}idleHeartbeat(e){return this.config.idle_heartbeat=Wt(e),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(e){return this.queue(e),this}manualAck(){return this.mack=!0,this}maxMessages(e){return this.max=e,this}callback(e){return this.callbackFn=e,this}queue(e){return this.qname=e,this.config.deliver_group=e,this}orderedConsumer(){return this.ordered=!0,this}bind(e,t){return this.stream=e,this.config.durable_name=t,this.isBind=!0,this}bindStream(e){return this.stream=e,this}inactiveEphemeralThreshold(e){return this.config.inactive_threshold=Wt(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=Wt(e),this}memory(){return this.config.mem_storage=!0,this}numReplicas(e){return this.config.num_replicas=e,this}consumerName(e){return this.config.name=e,this}}function us(r){return new XI(r)}function mw(r){return typeof r.getOpts=="function"}class eC{static encode(e){if(typeof e=="string")return btoa(e);const t=Array.from(e);return btoa(String.fromCharCode(...t))}static decode(e,t=!1){const n=atob(e);return t?Uint8Array.from(n,i=>i.charCodeAt(0)):n}}class xa{static encode(e){return xa.toB64URLEncoding(eC.encode(e))}static decode(e,t=!1){return xa.decode(xa.fromB64URLEncoding(e),t)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class Ea{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...e){let t=0;for(let a=0;a<e.length;a++)t+=e[a].length;const n=new Uint8Array(t);let i=0;for(let a=0;a<e.length;a++)n.set(e[a],i),i+=e[a].length;return n}static fromAscii(e){return e||(e=""),Oi.encode(e)}static toAscii(e){return tn.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const e=new Uint8Array(this.byteLength);let t=0;for(let n=0;n<this.buffers.length;n++)e.set(this.buffers[n],t),t+=this.buffers[n].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){const e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array(0)}drain(e){if(this.buffers.length){this.pack();const t=this.buffers.pop();if(t){const n=this.byteLength;(e===void 0||e>n)&&(e=n);const i=t.subarray(0,e);return n>e&&this.buffers.push(t.subarray(e)),this.byteLength=n-e,i}}return new Uint8Array(0)}fill(e,...t){e&&(this.buffers.push(e),this.byteLength+=e.length);for(let n=0;n<t.length;n++)t[n]&&t[n].length&&(this.buffers.push(t[n]),this.byteLength+=t[n].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function tC(r,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in r)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(r)}var rC=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},No=rC.performance||{};No.now||No.mozNow||No.msNow||No.oNow||No.webkitNow;var yw={versions:{}},nC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function iC(r){if(r.__esModule)return r;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(t){var n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:function(){return r[t]}})}),e}var kd,pc={exports:{}},gw={},vw=iC(tC({__proto__:null,default:gw},[gw]));kd=pc,function(){var r="input is invalid type",e=typeof window=="object",t=e?window:{};t.JS_SHA256_NO_WINDOW&&(e=!1);var n=!e&&typeof self=="object",i=!t.JS_SHA256_NO_NODE_JS&&yw.versions&&yw.versions.node;i?t=nC:n&&(t=self);var a=!t.JS_SHA256_NO_COMMON_JS&&kd.exports,u=!t.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),f=[-2147483648,8388608,32768,128],h=[24,16,8,0],p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],m=["hex","array","digest","arrayBuffer"],y=[];!t.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),!u||!t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});var g=function(O,N){return function(V){return new T(N,!0).update(V)[O]()}},b=function(O){var N=g("hex",O);i&&(N=k(N,O)),N.create=function(){return new T(O)},N.update=function(U){return N.create().update(U)};for(var V=0;V<m.length;++V){var D=m[V];N[D]=g(D,O)}return N},k=function(O,N){var V,D=vw,U=vw.Buffer,Y=N?"sha224":"sha256";return V=U.from&&!t.JS_SHA256_NO_BUFFER_FROM?U.from:function(ae){return new U(ae)},function(ae){if(typeof ae=="string")return D.createHash(Y).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===U?D.createHash(Y).update(V(ae)).digest("hex"):O(ae)}},_=function(O,N){return function(V,D){return new C(V,N,!0).update(D)[O]()}},w=function(O){var N=_("hex",O);N.create=function(U){return new C(U,O)},N.update=function(U,Y){return N.create(U).update(Y)};for(var V=0;V<m.length;++V){var D=m[V];N[D]=_(D,O)}return N};function T(O,N){N?(y[0]=y[16]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=0,this.blocks=y):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=O}function C(O,N,V){var D,U=typeof O;if(U==="string"){var Y,ae=[],re=O.length,Se=0;for(D=0;D<re;++D)(Y=O.charCodeAt(D))<128?ae[Se++]=Y:Y<2048?(ae[Se++]=192|Y>>>6,ae[Se++]=128|63&Y):Y<55296||Y>=57344?(ae[Se++]=224|Y>>>12,ae[Se++]=128|Y>>>6&63,ae[Se++]=128|63&Y):(Y=65536+((1023&Y)<<10|1023&O.charCodeAt(++D)),ae[Se++]=240|Y>>>18,ae[Se++]=128|Y>>>12&63,ae[Se++]=128|Y>>>6&63,ae[Se++]=128|63&Y);O=ae}else{if(U!=="object")throw new Error(r);if(O===null)throw new Error(r);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!(Array.isArray(O)||u&&ArrayBuffer.isView(O)))throw new Error(r)}O.length>64&&(O=new T(N,!0).update(O).array());var se=[],ve=[];for(D=0;D<64;++D){var be=O[D]||0;se[D]=92^be,ve[D]=54^be}T.call(this,N,V),this.update(ve),this.oKeyPad=se,this.inner=!0,this.sharedMemory=V}T.prototype.update=function(O){if(!this.finalized){var N,V=typeof O;if(V!=="string"){if(V!=="object")throw new Error(r);if(O===null)throw new Error(r);if(u&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!(Array.isArray(O)||u&&ArrayBuffer.isView(O)))throw new Error(r);N=!0}for(var D,U,Y=0,ae=O.length,re=this.blocks;Y<ae;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),N)for(U=this.start;Y<ae&&U<64;++Y)re[U>>>2]|=O[Y]<<h[3&U++];else for(U=this.start;Y<ae&&U<64;++Y)(D=O.charCodeAt(Y))<128?re[U>>>2]|=D<<h[3&U++]:D<2048?(re[U>>>2]|=(192|D>>>6)<<h[3&U++],re[U>>>2]|=(128|63&D)<<h[3&U++]):D<55296||D>=57344?(re[U>>>2]|=(224|D>>>12)<<h[3&U++],re[U>>>2]|=(128|D>>>6&63)<<h[3&U++],re[U>>>2]|=(128|63&D)<<h[3&U++]):(D=65536+((1023&D)<<10|1023&O.charCodeAt(++Y)),re[U>>>2]|=(240|D>>>18)<<h[3&U++],re[U>>>2]|=(128|D>>>12&63)<<h[3&U++],re[U>>>2]|=(128|D>>>6&63)<<h[3&U++],re[U>>>2]|=(128|63&D)<<h[3&U++]);this.lastByteIndex=U,this.bytes+=U-this.start,U>=64?(this.block=re[16],this.start=U-64,this.hash(),this.hashed=!0):this.start=U}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},T.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var O=this.blocks,N=this.lastByteIndex;O[16]=this.block,O[N>>>2]|=f[3&N],this.block=O[16],N>=56&&(this.hashed||this.hash(),O[0]=this.block,O[16]=O[1]=O[2]=O[3]=O[4]=O[5]=O[6]=O[7]=O[8]=O[9]=O[10]=O[11]=O[12]=O[13]=O[14]=O[15]=0),O[14]=this.hBytes<<3|this.bytes>>>29,O[15]=this.bytes<<3,this.hash()}},T.prototype.hash=function(){var O,N,V,D,U,Y,ae,re,Se,se=this.h0,ve=this.h1,be=this.h2,Ee=this.h3,ee=this.h4,pe=this.h5,q=this.h6,de=this.h7,Oe=this.blocks;for(O=16;O<64;++O)N=((U=Oe[O-15])>>>7|U<<25)^(U>>>18|U<<14)^U>>>3,V=((U=Oe[O-2])>>>17|U<<15)^(U>>>19|U<<13)^U>>>10,Oe[O]=Oe[O-16]+N+Oe[O-7]+V|0;for(Se=ve&be,O=0;O<64;O+=4)this.first?(this.is224?(Y=300032,de=(U=Oe[0]-1413257819)-150054599|0,Ee=U+24177077|0):(Y=704751109,de=(U=Oe[0]-210244248)-1521486534|0,Ee=U+143694565|0),this.first=!1):(N=(se>>>2|se<<30)^(se>>>13|se<<19)^(se>>>22|se<<10),D=(Y=se&ve)^se&be^Se,de=Ee+(U=de+(V=(ee>>>6|ee<<26)^(ee>>>11|ee<<21)^(ee>>>25|ee<<7))+(ee&pe^~ee&q)+p[O]+Oe[O])|0,Ee=U+(N+D)|0),N=(Ee>>>2|Ee<<30)^(Ee>>>13|Ee<<19)^(Ee>>>22|Ee<<10),D=(ae=Ee&se)^Ee&ve^Y,q=be+(U=q+(V=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ee^~de&pe)+p[O+1]+Oe[O+1])|0,N=((be=U+(N+D)|0)>>>2|be<<30)^(be>>>13|be<<19)^(be>>>22|be<<10),D=(re=be&Ee)^be&se^ae,pe=ve+(U=pe+(V=(q>>>6|q<<26)^(q>>>11|q<<21)^(q>>>25|q<<7))+(q&de^~q&ee)+p[O+2]+Oe[O+2])|0,N=((ve=U+(N+D)|0)>>>2|ve<<30)^(ve>>>13|ve<<19)^(ve>>>22|ve<<10),D=(Se=ve&be)^ve&Ee^re,ee=se+(U=ee+(V=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7))+(pe&q^~pe&de)+p[O+3]+Oe[O+3])|0,se=U+(N+D)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+se|0,this.h1=this.h1+ve|0,this.h2=this.h2+be|0,this.h3=this.h3+Ee|0,this.h4=this.h4+ee|0,this.h5=this.h5+pe|0,this.h6=this.h6+q|0,this.h7=this.h7+de|0},T.prototype.hex=function(){this.finalize();var O=this.h0,N=this.h1,V=this.h2,D=this.h3,U=this.h4,Y=this.h5,ae=this.h6,re=this.h7,Se=c[O>>>28&15]+c[O>>>24&15]+c[O>>>20&15]+c[O>>>16&15]+c[O>>>12&15]+c[O>>>8&15]+c[O>>>4&15]+c[15&O]+c[N>>>28&15]+c[N>>>24&15]+c[N>>>20&15]+c[N>>>16&15]+c[N>>>12&15]+c[N>>>8&15]+c[N>>>4&15]+c[15&N]+c[V>>>28&15]+c[V>>>24&15]+c[V>>>20&15]+c[V>>>16&15]+c[V>>>12&15]+c[V>>>8&15]+c[V>>>4&15]+c[15&V]+c[D>>>28&15]+c[D>>>24&15]+c[D>>>20&15]+c[D>>>16&15]+c[D>>>12&15]+c[D>>>8&15]+c[D>>>4&15]+c[15&D]+c[U>>>28&15]+c[U>>>24&15]+c[U>>>20&15]+c[U>>>16&15]+c[U>>>12&15]+c[U>>>8&15]+c[U>>>4&15]+c[15&U]+c[Y>>>28&15]+c[Y>>>24&15]+c[Y>>>20&15]+c[Y>>>16&15]+c[Y>>>12&15]+c[Y>>>8&15]+c[Y>>>4&15]+c[15&Y]+c[ae>>>28&15]+c[ae>>>24&15]+c[ae>>>20&15]+c[ae>>>16&15]+c[ae>>>12&15]+c[ae>>>8&15]+c[ae>>>4&15]+c[15&ae];return this.is224||(Se+=c[re>>>28&15]+c[re>>>24&15]+c[re>>>20&15]+c[re>>>16&15]+c[re>>>12&15]+c[re>>>8&15]+c[re>>>4&15]+c[15&re]),Se},T.prototype.toString=T.prototype.hex,T.prototype.digest=function(){this.finalize();var O=this.h0,N=this.h1,V=this.h2,D=this.h3,U=this.h4,Y=this.h5,ae=this.h6,re=this.h7,Se=[O>>>24&255,O>>>16&255,O>>>8&255,255&O,N>>>24&255,N>>>16&255,N>>>8&255,255&N,V>>>24&255,V>>>16&255,V>>>8&255,255&V,D>>>24&255,D>>>16&255,D>>>8&255,255&D,U>>>24&255,U>>>16&255,U>>>8&255,255&U,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||Se.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),Se},T.prototype.array=T.prototype.digest,T.prototype.arrayBuffer=function(){this.finalize();var O=new ArrayBuffer(this.is224?28:32),N=new DataView(O);return N.setUint32(0,this.h0),N.setUint32(4,this.h1),N.setUint32(8,this.h2),N.setUint32(12,this.h3),N.setUint32(16,this.h4),N.setUint32(20,this.h5),N.setUint32(24,this.h6),this.is224||N.setUint32(28,this.h7),O},C.prototype=new T,C.prototype.finalize=function(){if(T.prototype.finalize.call(this),this.inner){this.inner=!1;var O=this.array();T.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(O),T.prototype.finalize.call(this)}};var R=b();R.sha256=R,R.sha224=b(!0),R.sha256.hmac=w(),R.sha224.hmac=w(!0),a?kd.exports=R:(t.sha256=R.sha256,t.sha224=R.sha224)}(),pc.exports,pc.exports.sha224;var bw=pc.exports.sha256;function Id(r){return lC(r)}function sC(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const t=/^[0-9A-F]+$/.test(r),n=/^[0-9a-f]+$/.test(r);return t||n?r.length%2===0:!1}function aC(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function oC(r){return sC(r)?"hex":aC(r)?"b64":""}function uC(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2)e[t/2]=parseInt(r.substring(t,t+2),16);return e}function cC(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const e=atob(r);return Uint8Array.from(e,t=>t.charCodeAt(0))}function lC(r){switch(oC(r)){case"hex":return uC(r);case"b64":return cC(r)}return null}function fC(r,e){const t=typeof r=="string"?Id(r):r,n=typeof e=="string"?Id(e):e;if(t===null||n===null||t.length!==n.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}class ww{token;received;ctx;requestSubject;mux;constructor(e,t,n=!0){this.mux=e,this.requestSubject=t,this.received=0,this.token=is.next(),n&&(this.ctx=new Error)}}class hC extends ww{callback;done;timer;max;opts;constructor(e,t,n={maxWait:1e3}){if(super(e,t),this.opts=n,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof n.maxMessages=="number"&&n.maxMessages>0?n.maxMessages:-1,this.done=Vt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},n.maxWait)}cancel(e){e&&this.callback(e,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(e,t){e?(this.ctx&&(e.stack+=`
|
|
137
|
-
|
|
138
|
-
${this.ctx.stack}`),this.cancel(e)):(this.callback(null,t),this.opts.strategy===Xn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Xn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Xn.SentinelMsg&&t&&t.data.length===0&&this.cancel())}}class _w extends ww{deferred;timer;constructor(e,t,n={timeout:1e3},i=!0){super(e,t,i),this.deferred=Vt(),this.timer=ga(n.timeout,i)}resolver(e,t){this.timer&&this.timer.cancel(),e?(this.ctx&&(e.stack+=`
|
|
139
|
-
|
|
140
|
-
${this.ctx.stack}`),this.deferred.reject(e)):this.deferred.resolve(t),this.cancel()}cancel(e){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(e||Ne.errorForCode(we.Cancelled))}}const dC="$JS.API";function pC(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),lc({apiPrefix:dC,timeout:5e3},r)}class Mo{nc;opts;prefix;timeout;jc;constructor(e,t){this.nc=e,this.opts=pC(t),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Cn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let e=this.opts.apiPrefix;if(!e||e.length===0)throw new Error("invalid empty prefix");e[e.length-1]==="."&&(e=e.substr(0,e.length-1)),this.opts.apiPrefix=e}async _request(e,t=null,n){n=n||{},n.timeout=this.timeout;let i=fn;t&&(i=this.jc.encode(t));let{retries:a}=n;a=a||1,a=a===-1?Number.MAX_SAFE_INTEGER:a;const u=wd();for(let c=0;c<a;c++)try{const f=await this.nc.request(e,i,n);return this.parseJsResponse(f)}catch(f){const h=f;if((h.code==="503"||h.code===we.Timeout)&&c+1<a)await va(u.backoff(c));else throw f}}async findStream(e){const t={subject:e},i=await this._request(`${this.prefix}.STREAM.NAMES`,t);if(!i.streams||i.streams.length!==1)throw new Error("no stream matches subject");return i.streams[0]}getConnection(){return this.nc}parseJsResponse(e){const t=this.jc.decode(e.data),n=t;if(n.error){const i=hw(n.error.code,n.error.description);if(i!==null)throw i.api_error=n.error,i}return t}}class Ro{err;offset;pageInfo;subject;jsm;filter;payload;constructor(e,t,n,i){if(!e)throw new Error("subject is required");this.subject=e,this.jsm=n,this.offset=0,this.pageInfo={},this.filter=t,this.payload=i||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const e={offset:this.offset};this.payload&&Object.assign(e,this.payload);try{const t=await this.jsm._request(this.subject,e,{timeout:this.jsm.timeout});this.pageInfo=t;const n=this.countResponse(t);return n===0?[]:(this.offset+=n,this.filter(t))}catch(t){throw this.err=t,t}}countResponse(e){switch(e?.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return e.streams?.length||0;case"io.nats.jetstream.api.v1.consumer_list_response":return e.consumers?.length||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e?.type}`),e.streams?.length||0}return 0}async*[Symbol.asyncIterator](){let e=await this.next();for(;e.length>0;){for(const t of e)yield t;e=await this.next()}}}function Ds(r=""){const e=r.match(/(\d+).(\d+).(\d+)/);if(e)return{major:parseInt(e[1]),minor:parseInt(e[2]),micro:parseInt(e[3])};throw new Error(`'${r}' is not a semver value`)}function Cd(r,e){return r.major<e.major?-1:r.major>e.major?1:r.minor<e.minor?-1:r.minor>e.minor?1:r.micro<e.micro?-1:r.micro>e.micro?1:0}var bt;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(bt||(bt={}));class mC{server;features;disabled;constructor(e){this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e=="string"&&(e=Ds(e)),this.server=e,this.set(bt.JS_KV,"2.6.2"),this.set(bt.JS_OBJECTSTORE,"2.6.3"),this.set(bt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(bt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(bt.JS_ALLOW_DIRECT,"2.9.0"),this.set(bt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(bt.JS_SIMPLIFICATION,"2.9.4"),this.set(bt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(bt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(bt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(bt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(bt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(bt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(bt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(bt.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(t=>{this.features.delete(t)})}set(e,t){this.features.set(e,{min:t,ok:Cd(this.server,Ds(t))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){return this.get(e)?.ok||!1}require(e){return typeof e=="string"&&(e=Ds(e)),Cd(this.server,e)>=0}}class mc extends Mo{constructor(e,t){super(e,t)}async add(e,t,n=dc.Create){if($r(e),t.deliver_group&&t.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(t.deliver_group&&t.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const i={};i.config=t,i.stream_name=e,i.action=n,i.config.durable_name&&ba(i.config.durable_name);const a=this.nc;let{min:u,ok:c}=a.features.get(bt.JS_NEW_CONSUMER_CREATE_API);const f=t.name===""?void 0:t.name;if(f&&!c)throw new Error(`consumer 'name' requires server ${u}`);if(f)try{hc("name",f)}catch(y){const g=y.message,b=g.indexOf("cannot contain");throw b!==-1?new Error(`consumer 'name' ${g.substring(b)}`):y}let h,p="";if(Array.isArray(t.filter_subjects)){const{min:y,ok:g}=a.features.get(bt.JS_MULTIPLE_CONSUMER_FILTER);if(!g)throw new Error(`consumer 'filter_subjects' requires server ${y}`);c=!1}if(t.metadata){const{min:y,ok:g}=a.features.get(bt.JS_STREAM_CONSUMER_METADATA);if(!g)throw new Error(`consumer 'metadata' requires server ${y}`)}if(c&&(p=t.name??t.durable_name??""),p!==""){let y=t.filter_subject??void 0;y===">"&&(y=void 0),h=y!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${p}.${y}`:`${this.prefix}.CONSUMER.CREATE.${e}.${p}`}else h=t.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${t.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${e}`;return await this._request(h,i)}async update(e,t,n){const i=await this.info(e,t),a=n;return this.add(e,Object.assign(i.config,a),dc.Update)}async info(e,t){return $r(e),ba(t),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`)}async delete(e,t){return $r(e),ba(t),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success}list(e){$r(e);const t=i=>i.consumers,n=`${this.prefix}.CONSUMER.LIST.${e}`;return new Ro(n,t,this)}pause(e,t,n){const i=`${this.prefix}.CONSUMER.PAUSE.${e}.${t}`,a={pause_until:n.toISOString()};return this._request(i,a)}resume(e,t){return this.pause(e,t,new Date(0))}}function Oa(r,e,t=!1){if(t===!0&&!r)throw Ne.errorForCode(we.ApiError,new Error(`${e} is not a function`));if(r&&typeof r!="function")throw Ne.errorForCode(we.ApiError,new Error(`${e} is not a function`))}class yC extends Sr{sub;adapter;subIterDone;constructor(e,t,n){super(),Oa(n.adapter,"adapter",!0),this.adapter=n.adapter,n.callback&&Oa(n.callback,"callback"),this.noIterator=typeof n.callback=="function",n.ingestionFilterFn&&(Oa(n.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=n.ingestionFilterFn),n.protocolFilterFn&&(Oa(n.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=n.protocolFilterFn),n.dispatchedFn&&(Oa(n.dispatchedFn,"dispatchedFn"),this.dispatchedFn=n.dispatchedFn),n.cleanupFn&&Oa(n.cleanupFn,"cleanupFn");let i=(h,p)=>{this.callback(h,p)};if(n.callback){const h=n.callback;i=(p,m)=>{const[y,g]=this.adapter(p,m);if(y){h(y,null);return}const{ingest:b}=this.ingestionFilterFn?this.ingestionFilterFn(g,this):{ingest:!0};b&&(!this.protocolFilterFn||this.protocolFilterFn(g))&&(h(y,g),this.dispatchedFn&&g&&this.dispatchedFn(g))}}const{max:a,queue:u,timeout:c}=n,f={queue:u,timeout:c,callback:i};a&&a>0&&(f.max=a),this.sub=e.subscribe(t,f),n.cleanupFn&&(this.sub.cleanupFn=n.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Vt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async h=>{await h.closed,this.stop()})(this.sub).then().catch()}unsubscribe(e){this.sub.unsubscribe(e)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(e,t){this.sub.cancelTimeout();const[n,i]=this.adapter(e,t);n&&this.stop(n),i&&this.push(i)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let pn;function gC(r){pn=r}function Sw(){return pn!==void 0&&pn.defaultPort!==void 0?pn.defaultPort:4222}function Pd(){return pn!==void 0&&pn.urlParseFn?pn.urlParseFn:void 0}function vC(){if(!pn||typeof pn.factory!="function")throw new Error("transport fn is not set");return pn.factory()}function Nd(){return pn!==void 0&&pn.dnsResolveFn?pn.dnsResolveFn:void 0}const yc=`\r
|
|
141
|
-
`,gc=Ea.fromAscii(yc),bC=new Uint8Array(gc)[0],wC=new Uint8Array(gc)[1];function _C(r){for(let e=0;e<r.length;e++){const t=e+1;if(r.byteLength>t&&r[e]===bC&&r[t]===wC)return t+1}return 0}function SC(r){const e=_C(r);if(e>0){const n=new Uint8Array(r).slice(0,e);return tn.decode(n)}return""}const xC=4,xw=48,EC=65,OC=97;function TC(r,e,t,n){const i=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((u,c)=>{i[c]=u}),i[12]=r,i[13]=e,i[14]=t,i[15]=n,i}function Md(r){return AC(r)!==void 0}function AC(r){for(let e=0;e<r.length;e++)switch(r[e]){case".":return Ew(r);case":":return kC(r)}}function Ew(r){const e=new Uint8Array(4);for(let t=0;t<4;t++){if(r.length===0)return;if(t>0){if(r[0]!==".")return;r=r.substring(1)}const{n,c:i,ok:a}=IC(r);if(!a||n>255)return;r=r.substring(i),e[t]=n}return TC(e[0],e[1],e[2],e[3])}function kC(r){const e=new Uint8Array(16);let t=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(t=0,r=r.substring(2),r.length===0))return e;let n=0;for(;n<16;){const{n:i,c:a,ok:u}=CC(r);if(!u||i>65535)return;if(a<r.length&&r[a]==="."){if(t<0&&n!=12||n+4>16)return;const c=Ew(r);if(c===void 0)return;e[n]=c[12],e[n+1]=c[13],e[n+2]=c[14],e[n+3]=c[15],r="",n+=xC;break}if(e[n]=i>>8,e[n+1]=i,n+=2,r=r.substring(a),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(t>=0)return;if(t=n,r=r.substring(1),r.length===0)break}}if(r.length===0){if(n<16){if(t<0)return;const i=16-n;for(let a=n-1;a>=t;a--)e[a+i]=e[a];for(let a=t+i-1;a>=t;a--)e[a]=0}else if(t>=0)return;return e}}function IC(r){let e=0,t=0;for(e=0;e<r.length&&48<=r.charCodeAt(e)&&r.charCodeAt(e)<=57;e++)if(t=t*10+(r.charCodeAt(e)-xw),t>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:t,c:e,ok:!0}}function CC(r){let e=0,t=0;for(t=0;t<r.length;t++){if(48<=r.charCodeAt(t)&&r.charCodeAt(t)<=57)e*=16,e+=r.charCodeAt(t)-xw;else if(97<=r.charCodeAt(t)&&r.charCodeAt(t)<=102)e*=16,e+=r.charCodeAt(t)-OC+10;else if(65<=r.charCodeAt(t)&&r.charCodeAt(t)<=70)e*=16,e+=r.charCodeAt(t)-EC+10;else break;if(e>=16777215)return{n:0,c:t,ok:!1}}return t===0?{n:0,c:t,ok:!1}:{n:e,c:t,ok:!0}}function PC(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Rd(r){return!PC(r)}function NC(r){const e="::FFFF:",t=r.toUpperCase().indexOf(e);if(t!==-1&&r.indexOf(".")!==-1){let n=r.substring(t+e.length);return n=n.replace("[",""),n.replace("]","")}return r}function MC(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=NC(r),Rd(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const e=Rd(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),t=e&&e.length===3&&e[1]&&e[2]?parseInt(e[2]):4222,n=t===80?"https":"http",i=new URL(`${n}://${r}`);i.port=`${t}`;let a=i.hostname;return a.charAt(0)==="["&&(a=a.substring(1,a.length-1)),{listen:i.host,hostname:a,port:t}}class Do{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor(e,t=!1){this.src=e,this.tlsName="";const n=MC(e);this.listen=n.listen,this.hostname=n.hostname,this.port=n.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=t}toString(){return this.listen}async resolve(e){if(!e.fn||e.resolve===!1)return[this];const t=[];if(Md(this.hostname))return[this];{const n=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${n.join(",")}`);for(const i of n){const a=this.port===80?"https":"http",u=new URL(`${a}://${Rd(i)?"["+i+"]":i}`);u.port=`${this.port}`;const c=new Do(u.host,!1);c.tlsName=this.hostname,t.push(c)}}return e.randomize&&ow(t),this.resolves=t,t}}class RC{firstSelect;servers;currentServer;tlsName;randomize;constructor(e=[],t={}){this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=t.randomize||!1;const n=Pd();e&&(e.forEach(i=>{i=n?n(i):i,this.servers.push(new Do(i))}),this.randomize&&(this.servers=ow(this.servers))),this.servers.length===0&&this.addServer(`${bd}:${Sw()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Md(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(t=>{t.gossiped&&(t.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,t=!1){const n=Pd();e=n?n(e):e;const i=new Do(e,t);Md(i.hostname)&&(i.tlsName=this.tlsName),this.servers.push(i)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const t=this.servers.indexOf(e);this.servers.splice(t,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(e,t){const n=[];let i=[];const a=Pd(),u=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(f=>{f=a?a(f,t):f;const h=new Do(f,!0);u.set(f,h)});const c=[];return this.servers.forEach((f,h)=>{const p=f.listen;f.gossiped&&this.currentServer.listen!==p&&u.get(p)===void 0&&c.push(h),u.delete(p)}),c.reverse(),c.forEach(f=>{const h=this.servers.splice(f,1);i=i.concat(h[0].listen)}),u.forEach((f,h)=>{this.servers.push(f),n.push(h)}),{added:n,deleted:i}}}class DC{baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Ai(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const t=e.subject||"";return t.indexOf(this.baseInbox)===0?t.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,t){if(t&&t.permissionContext){if(e)return this.all().forEach(i=>{i.resolver(t,{})}),!0;const n=t.permissionContext;if(n.operation==="publish"){const i=this.all().find(a=>a.requestSubject===n.subject);if(i)return i.resolver(t,{}),!0}}return!1}dispatcher(){return(e,t)=>{const n=this.getToken(t);if(n){const i=this.get(n);i&&(e===null&&t.headers&&(e=lw(t)),i.resolver(e,t))}}}close(){const e=Ne.errorForCode(we.Timeout);this.reqs.forEach(t=>{t.resolver(e,{})})}}class FC{ph;interval;maxOut;timer;pendings;constructor(e,t,n){this.ph=e,this.interval=t,this.maxOut=n,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:ya.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=Vt();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class LC extends Error{constructor(e){super(e),this.name="AssertionError"}}function qC(r,e="Assertion failed."){if(!r)throw new LC(e)}const Ow=32*1024,Dd=2**32-2;function vc(r,e,t=0){const n=e.byteLength-t;return r.byteLength>n&&(r=r.subarray(0,n)),e.set(r,t),r.byteLength}class Fd{_buf;_off;constructor(e){if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const t=this._buf.byteLength;return e<=this.capacity-t?(this._reslice(t+e),t):-1}_reslice(e){qC(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const t=vc(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(Oi.encode(e))}write(e){const t=this._grow(e.byteLength);return vc(e,this._buf,t)}_grow(e){const t=this.length;t===0&&this._off!==0&&this.reset();const n=this._tryGrowByReslice(e);if(n>=0)return n;const i=this.capacity;if(e<=Math.floor(i/2)-t)vc(this._buf.subarray(this._off),this._buf);else{if(i+e>Dd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const a=new Uint8Array(Math.min(2*i+e,Dd));vc(this._buf.subarray(this._off),a),this._buf=a}}return this._off=0,this._reslice(Math.min(t+e,Dd)),t}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const t=this._grow(e);this._reslice(t)}readFrom(e){let t=0;const n=new Uint8Array(Ow);for(;;){const i=this.capacity-this.length<Ow,a=i?n:new Uint8Array(this._buf.buffer,this.length),u=e.read(a);if(u===null)return t;i?this.write(a.subarray(0,u)):this._reslice(this.length+u),t+=u}}}var Vr;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Vr||(Vr={}));function Tw(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const jC=48;class Aw{dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor(e){this.dispatcher=e,this.state=Te.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let t;for(t=0;t<e.length;t++){const n=e[t];switch(this.state){case Te.OP_START:switch(n){case Ae.M:case Ae.m:this.state=Te.OP_M,this.hdr=-1,this.ma=Tw();break;case Ae.H:case Ae.h:this.state=Te.OP_H,this.hdr=0,this.ma=Tw();break;case Ae.P:case Ae.p:this.state=Te.OP_P;break;case Ae.PLUS:this.state=Te.OP_PLUS;break;case Ae.MINUS:this.state=Te.OP_MINUS;break;case Ae.I:case Ae.i:this.state=Te.OP_I;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_H:switch(n){case Ae.M:case Ae.m:this.state=Te.OP_M;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_M:switch(n){case Ae.S:case Ae.s:this.state=Te.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_MS:switch(n){case Ae.G:case Ae.g:this.state=Te.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_MSG:switch(n){case Ae.SPACE:case Ae.TAB:this.state=Te.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_MSG_SPC:switch(n){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Te.MSG_ARG,this.as=t}break;case Te.MSG_ARG:switch(n){case Ae.CR:this.drop=1;break;case Ae.NL:{const i=this.argBuf?this.argBuf.bytes():e.subarray(this.as,t-this.drop);this.processMsgArgs(i),this.drop=0,this.as=t+1,this.state=Te.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case Te.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const i=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Vr.MSG,msg:this.ma,data:i}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Te.MSG_END}else{let i=this.ma.size-this.msgBuf.length;const a=e.length-t;a<i&&(i=a),i>0?(this.msgBuf.write(e.subarray(t,t+i)),t=t+i-1):this.msgBuf.writeByte(n)}else t-this.as>=this.ma.size&&(this.dispatcher.push({kind:Vr.MSG,msg:this.ma,data:e.subarray(this.as,t)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Te.MSG_END);break;case Te.MSG_END:switch(n){case Ae.NL:this.drop=0,this.as=t+1,this.state=Te.OP_START;break;default:continue}break;case Te.OP_PLUS:switch(n){case Ae.O:case Ae.o:this.state=Te.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_PLUS_O:switch(n){case Ae.K:case Ae.k:this.state=Te.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_PLUS_OK:switch(n){case Ae.NL:this.dispatcher.push({kind:Vr.OK}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_MINUS:switch(n){case Ae.E:case Ae.e:this.state=Te.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_MINUS_E:switch(n){case Ae.R:case Ae.r:this.state=Te.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_MINUS_ER:switch(n){case Ae.R:case Ae.r:this.state=Te.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_MINUS_ERR:switch(n){case Ae.SPACE:case Ae.TAB:this.state=Te.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_MINUS_ERR_SPC:switch(n){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Te.MINUS_ERR_ARG,this.as=t}break;case Te.MINUS_ERR_ARG:switch(n){case Ae.CR:this.drop=1;break;case Ae.NL:{let i;this.argBuf?(i=this.argBuf.bytes(),this.argBuf=void 0):i=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:Vr.ERR,data:i}),this.drop=0,this.as=t+1,this.state=Te.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case Te.OP_P:switch(n){case Ae.I:case Ae.i:this.state=Te.OP_PI;break;case Ae.O:case Ae.o:this.state=Te.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_PO:switch(n){case Ae.N:case Ae.n:this.state=Te.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_PON:switch(n){case Ae.G:case Ae.g:this.state=Te.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_PONG:switch(n){case Ae.NL:this.dispatcher.push({kind:Vr.PONG}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_PI:switch(n){case Ae.N:case Ae.n:this.state=Te.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_PIN:switch(n){case Ae.G:case Ae.g:this.state=Te.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_PING:switch(n){case Ae.NL:this.dispatcher.push({kind:Vr.PING}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_I:switch(n){case Ae.N:case Ae.n:this.state=Te.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_IN:switch(n){case Ae.F:case Ae.f:this.state=Te.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_INF:switch(n){case Ae.O:case Ae.o:this.state=Te.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_INFO:switch(n){case Ae.SPACE:case Ae.TAB:this.state=Te.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case Te.OP_INFO_SPC:switch(n){case Ae.SPACE:case Ae.TAB:continue;default:this.state=Te.INFO_ARG,this.as=t}break;case Te.INFO_ARG:switch(n){case Ae.CR:this.drop=1;break;case Ae.NL:{let i;this.argBuf?(i=this.argBuf.bytes(),this.argBuf=void 0):i=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:Vr.INFO,data:i}),this.drop=0,this.as=t+1,this.state=Te.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===Te.MSG_ARG||this.state===Te.MINUS_ERR_ARG||this.state===Te.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Fd(e.subarray(this.as,t-this.drop))),this.state===Te.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Fd(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,t=this.ma.reply?this.ma.reply.length:0,n=new Uint8Array(e+t);n.set(this.ma.subject),this.ma.reply&&n.set(this.ma.reply,e),this.argBuf=new Fd(n),this.ma.subject=n.subarray(0,e),this.ma.reply&&(this.ma.reply=n.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:n>=0&&(t.push(e.subarray(n,i)),n=-1);break;default:n<0&&(n=i)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 3:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(t[2]);break;case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.size=this.protoParseInt(t[3]);break;default:throw this.fail(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,t=""){return t?t=`${t} [${this.state}]`:t=`parse error [${this.state}]`,new Error(`${t}: ${tn.decode(e)}`)}processHeaderMsgArgs(e){const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case Ae.SPACE:case Ae.TAB:case Ae.CR:case Ae.NL:n>=0&&(t.push(e.subarray(n,i)),n=-1);break;default:n<0&&(n=i)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(t[2]),this.ma.size=this.protoParseInt(t[3]);break;case 5:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.hdr=this.protoParseInt(t[3]),this.ma.size=this.protoParseInt(t[4]);break;default:throw this.fail(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let t=0;for(let n=0;n<e.length;n++){if(e[n]<48||e[n]>57)return-1;t=t*10+(e[n]-jC)}return t}}var Te;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(Te||(Te={}));var Ae;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(Ae||(Ae={})),function(r){var e=function(S,I){this.hi=S|0,this.lo=I|0},t=function(S){var I,A=new Float64Array(16);if(S)for(I=0;I<S.length;I++)A[I]=S[I];return A},n=function(){throw new Error("no PRNG")},i=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var u=t(),c=t([1]),f=t([56129,1]),h=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),p=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),g=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function b(S,I){return S<<I|S>>>32-I}function k(S,I){var A=S[I+3]&255;return A=A<<8|S[I+2]&255,A=A<<8|S[I+1]&255,A<<8|S[I+0]&255}function _(S,I){var A=S[I]<<24|S[I+1]<<16|S[I+2]<<8|S[I+3],P=S[I+4]<<24|S[I+5]<<16|S[I+6]<<8|S[I+7];return new e(A,P)}function w(S,I,A){var P;for(P=0;P<4;P++)S[I+P]=A&255,A>>>=8}function T(S,I,A){S[I]=A.hi>>24&255,S[I+1]=A.hi>>16&255,S[I+2]=A.hi>>8&255,S[I+3]=A.hi&255,S[I+4]=A.lo>>24&255,S[I+5]=A.lo>>16&255,S[I+6]=A.lo>>8&255,S[I+7]=A.lo&255}function C(S,I,A,P,j){var z,ue=0;for(z=0;z<j;z++)ue|=S[I+z]^A[P+z];return(1&ue-1>>>8)-1}function R(S,I,A,P){return C(S,I,A,P,16)}function O(S,I,A,P){return C(S,I,A,P,32)}function N(S,I,A,P,j){var z=new Uint32Array(16),ue=new Uint32Array(16),me=new Uint32Array(16),X=new Uint32Array(4),oe,De,lt;for(oe=0;oe<4;oe++)ue[5*oe]=k(P,4*oe),ue[1+oe]=k(A,4*oe),ue[6+oe]=k(I,4*oe),ue[11+oe]=k(A,16+4*oe);for(oe=0;oe<16;oe++)me[oe]=ue[oe];for(oe=0;oe<20;oe++){for(De=0;De<4;De++){for(lt=0;lt<4;lt++)X[lt]=ue[(5*De+4*lt)%16];for(X[1]^=b(X[0]+X[3]|0,7),X[2]^=b(X[1]+X[0]|0,9),X[3]^=b(X[2]+X[1]|0,13),X[0]^=b(X[3]+X[2]|0,18),lt=0;lt<4;lt++)z[4*De+(De+lt)%4]=X[lt]}for(lt=0;lt<16;lt++)ue[lt]=z[lt]}if(j){for(oe=0;oe<16;oe++)ue[oe]=ue[oe]+me[oe]|0;for(oe=0;oe<4;oe++)ue[5*oe]=ue[5*oe]-k(P,4*oe)|0,ue[6+oe]=ue[6+oe]-k(I,4*oe)|0;for(oe=0;oe<4;oe++)w(S,4*oe,ue[5*oe]),w(S,16+4*oe,ue[6+oe])}else for(oe=0;oe<16;oe++)w(S,4*oe,ue[oe]+me[oe]|0)}function V(S,I,A,P){return N(S,I,A,P,!1),0}function D(S,I,A,P){return N(S,I,A,P,!0),0}var U=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Y(S,I,A,P,j,z,ue){var me=new Uint8Array(16),X=new Uint8Array(64),oe,De;if(!j)return 0;for(De=0;De<16;De++)me[De]=0;for(De=0;De<8;De++)me[De]=z[De];for(;j>=64;){for(V(X,me,ue,U),De=0;De<64;De++)S[I+De]=(A?A[P+De]:0)^X[De];for(oe=1,De=8;De<16;De++)oe=oe+(me[De]&255)|0,me[De]=oe&255,oe>>>=8;j-=64,I+=64,A&&(P+=64)}if(j>0)for(V(X,me,ue,U),De=0;De<j;De++)S[I+De]=(A?A[P+De]:0)^X[De];return 0}function ae(S,I,A,P,j){return Y(S,I,null,0,A,P,j)}function re(S,I,A,P,j){var z=new Uint8Array(32);return D(z,P,j,U),ae(S,I,A,P.subarray(16),z)}function Se(S,I,A,P,j,z,ue){var me=new Uint8Array(32);return D(me,z,ue,U),Y(S,I,A,P,j,z.subarray(16),me)}function se(S,I){var A,P=0;for(A=0;A<17;A++)P=P+(S[A]+I[A]|0)|0,S[A]=P&255,P>>>=8}var ve=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function be(S,I,A,P,j,z){var ue,me,X,oe,De=new Uint32Array(17),lt=new Uint32Array(17),Ut=new Uint32Array(17),yn=new Uint32Array(17),Ii=new Uint32Array(17);for(X=0;X<17;X++)lt[X]=Ut[X]=0;for(X=0;X<16;X++)lt[X]=z[X];for(lt[3]&=15,lt[4]&=252,lt[7]&=15,lt[8]&=252,lt[11]&=15,lt[12]&=252,lt[15]&=15;j>0;){for(X=0;X<17;X++)yn[X]=0;for(X=0;X<16&&X<j;++X)yn[X]=A[P+X];for(yn[X]=1,P+=X,j-=X,se(Ut,yn),me=0;me<17;me++)for(De[me]=0,X=0;X<17;X++)De[me]=De[me]+Ut[X]*(X<=me?lt[me-X]:320*lt[me+17-X]|0)|0|0;for(me=0;me<17;me++)Ut[me]=De[me];for(oe=0,X=0;X<16;X++)oe=oe+Ut[X]|0,Ut[X]=oe&255,oe>>>=8;for(oe=oe+Ut[16]|0,Ut[16]=oe&3,oe=5*(oe>>>2)|0,X=0;X<16;X++)oe=oe+Ut[X]|0,Ut[X]=oe&255,oe>>>=8;oe=oe+Ut[16]|0,Ut[16]=oe}for(X=0;X<17;X++)Ii[X]=Ut[X];for(se(Ut,ve),ue=-(Ut[16]>>>7)|0,X=0;X<17;X++)Ut[X]^=ue&(Ii[X]^Ut[X]);for(X=0;X<16;X++)yn[X]=z[X+16];for(yn[16]=0,se(Ut,yn),X=0;X<16;X++)S[I+X]=Ut[X];return 0}function Ee(S,I,A,P,j,z){var ue=new Uint8Array(16);return be(ue,0,A,P,j,z),R(S,I,ue,0)}function ee(S,I,A,P,j){var z;if(A<32)return-1;for(Se(S,0,I,0,A,P,j),be(S,16,S,32,A-32,S),z=0;z<16;z++)S[z]=0;return 0}function pe(S,I,A,P,j){var z,ue=new Uint8Array(32);if(A<32||(re(ue,0,32,P,j),Ee(I,16,I,32,A-32,ue)!==0))return-1;for(Se(S,0,I,0,A,P,j),z=0;z<32;z++)S[z]=0;return 0}function q(S,I){var A;for(A=0;A<16;A++)S[A]=I[A]|0}function de(S){var I,A;for(A=0;A<16;A++)S[A]+=65536,I=Math.floor(S[A]/65536),S[(A+1)*(A<15?1:0)]+=I-1+37*(I-1)*(A===15?1:0),S[A]-=I*65536}function Oe(S,I,A){for(var P,j=~(A-1),z=0;z<16;z++)P=j&(S[z]^I[z]),S[z]^=P,I[z]^=P}function je(S,I){var A,P,j,z=t(),ue=t();for(A=0;A<16;A++)ue[A]=I[A];for(de(ue),de(ue),de(ue),P=0;P<2;P++){for(z[0]=ue[0]-65517,A=1;A<15;A++)z[A]=ue[A]-65535-(z[A-1]>>16&1),z[A-1]&=65535;z[15]=ue[15]-32767-(z[14]>>16&1),j=z[15]>>16&1,z[14]&=65535,Oe(ue,z,1-j)}for(A=0;A<16;A++)S[2*A]=ue[A]&255,S[2*A+1]=ue[A]>>8}function rt(S,I){var A=new Uint8Array(32),P=new Uint8Array(32);return je(A,S),je(P,I),O(A,0,P,0)}function Ve(S){var I=new Uint8Array(32);return je(I,S),I[0]&1}function Be(S,I){var A;for(A=0;A<16;A++)S[A]=I[2*A]+(I[2*A+1]<<8);S[15]&=32767}function wt(S,I,A){var P;for(P=0;P<16;P++)S[P]=I[P]+A[P]|0}function Ye(S,I,A){var P;for(P=0;P<16;P++)S[P]=I[P]-A[P]|0}function Me(S,I,A){var P,j,z=new Float64Array(31);for(P=0;P<31;P++)z[P]=0;for(P=0;P<16;P++)for(j=0;j<16;j++)z[P+j]+=I[P]*A[j];for(P=0;P<15;P++)z[P]+=38*z[P+16];for(P=0;P<16;P++)S[P]=z[P];de(S),de(S)}function Ue(S,I){Me(S,I,I)}function W(S,I){var A=t(),P;for(P=0;P<16;P++)A[P]=I[P];for(P=253;P>=0;P--)Ue(A,A),P!==2&&P!==4&&Me(A,A,I);for(P=0;P<16;P++)S[P]=A[P]}function J(S,I){var A=t(),P;for(P=0;P<16;P++)A[P]=I[P];for(P=250;P>=0;P--)Ue(A,A),P!==1&&Me(A,A,I);for(P=0;P<16;P++)S[P]=A[P]}function $(S,I,A){var P=new Uint8Array(32),j=new Float64Array(80),z,ue,me=t(),X=t(),oe=t(),De=t(),lt=t(),Ut=t();for(ue=0;ue<31;ue++)P[ue]=I[ue];for(P[31]=I[31]&127|64,P[0]&=248,Be(j,A),ue=0;ue<16;ue++)X[ue]=j[ue],De[ue]=me[ue]=oe[ue]=0;for(me[0]=De[0]=1,ue=254;ue>=0;--ue)z=P[ue>>>3]>>>(ue&7)&1,Oe(me,X,z),Oe(oe,De,z),wt(lt,me,oe),Ye(me,me,oe),wt(oe,X,De),Ye(X,X,De),Ue(De,lt),Ue(Ut,me),Me(me,oe,me),Me(oe,X,lt),wt(lt,me,oe),Ye(me,me,oe),Ue(X,me),Ye(oe,De,Ut),Me(me,oe,f),wt(me,me,De),Me(oe,oe,me),Me(me,De,Ut),Me(De,X,j),Ue(X,lt),Oe(me,X,z),Oe(oe,De,z);for(ue=0;ue<16;ue++)j[ue+16]=me[ue],j[ue+32]=oe[ue],j[ue+48]=X[ue],j[ue+64]=De[ue];var yn=j.subarray(32),Ii=j.subarray(16);return W(yn,yn),Me(Ii,Ii,yn),je(S,Ii),0}function Z(S,I){return $(S,I,a)}function ne(S,I){return n(I,32),Z(S,I)}function G(S,I,A){var P=new Uint8Array(32);return $(P,A,I),D(S,i,P,U)}var xe=ee,qe=pe;function $e(S,I,A,P,j,z){var ue=new Uint8Array(32);return G(ue,j,z),xe(S,I,A,P,ue)}function le(S,I,A,P,j,z){var ue=new Uint8Array(32);return G(ue,j,z),qe(S,I,A,P,ue)}function _e(){var S=0,I=0,A=0,P=0,j=65535,z,ue,me;for(me=0;me<arguments.length;me++)z=arguments[me].lo,ue=arguments[me].hi,S+=z&j,I+=z>>>16,A+=ue&j,P+=ue>>>16;return I+=S>>>16,A+=I>>>16,P+=A>>>16,new e(A&j|P<<16,S&j|I<<16)}function Ge(S,I){return new e(S.hi>>>I,S.lo>>>I|S.hi<<32-I)}function ot(){var S=0,I=0,A;for(A=0;A<arguments.length;A++)S^=arguments[A].lo,I^=arguments[A].hi;return new e(I,S)}function ut(S,I){var A,P,j=32-I;return I<32?(A=S.hi>>>I|S.lo<<j,P=S.lo>>>I|S.hi<<j):I<64&&(A=S.lo>>>I|S.hi<<j,P=S.hi>>>I|S.lo<<j),new e(A,P)}function Gt(S,I,A){var P=S.hi&I.hi^~S.hi&A.hi,j=S.lo&I.lo^~S.lo&A.lo;return new e(P,j)}function Ot(S,I,A){var P=S.hi&I.hi^S.hi&A.hi^I.hi&A.hi,j=S.lo&I.lo^S.lo&A.lo^I.lo&A.lo;return new e(P,j)}function Jt(S){return ot(ut(S,28),ut(S,34),ut(S,39))}function sr(S){return ot(ut(S,14),ut(S,18),ut(S,41))}function mr(S){return ot(ut(S,1),ut(S,8),Ge(S,7))}function Rt(S){return ot(ut(S,19),ut(S,61),Ge(S,6))}var ar=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function dr(S,I,A){var P=[],j=[],z=[],ue=[],me,X,oe;for(X=0;X<8;X++)P[X]=z[X]=_(S,8*X);for(var De=0;A>=128;){for(X=0;X<16;X++)ue[X]=_(I,8*X+De);for(X=0;X<80;X++){for(oe=0;oe<8;oe++)j[oe]=z[oe];for(me=_e(z[7],sr(z[4]),Gt(z[4],z[5],z[6]),ar[X],ue[X%16]),j[7]=_e(me,Jt(z[0]),Ot(z[0],z[1],z[2])),j[3]=_e(j[3],me),oe=0;oe<8;oe++)z[(oe+1)%8]=j[oe];if(X%16===15)for(oe=0;oe<16;oe++)ue[oe]=_e(ue[oe],ue[(oe+9)%16],mr(ue[(oe+1)%16]),Rt(ue[(oe+14)%16]))}for(X=0;X<8;X++)z[X]=_e(z[X],P[X]),P[X]=z[X];De+=128,A-=128}for(X=0;X<8;X++)T(S,8*X,P[X]);return A}var zr=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function jt(S,I,A){var P=new Uint8Array(64),j=new Uint8Array(256),z,ue=A;for(z=0;z<64;z++)P[z]=zr[z];for(dr(P,I,A),A%=128,z=0;z<256;z++)j[z]=0;for(z=0;z<A;z++)j[z]=I[ue-A+z];for(j[A]=128,A=256-128*(A<112?1:0),j[A-9]=0,T(j,A-8,new e(ue/536870912|0,ue<<3)),dr(P,j,A),z=0;z<64;z++)S[z]=P[z];return 0}function Yt(S,I){var A=t(),P=t(),j=t(),z=t(),ue=t(),me=t(),X=t(),oe=t(),De=t();Ye(A,S[1],S[0]),Ye(De,I[1],I[0]),Me(A,A,De),wt(P,S[0],S[1]),wt(De,I[0],I[1]),Me(P,P,De),Me(j,S[3],I[3]),Me(j,j,p),Me(z,S[2],I[2]),wt(z,z,z),Ye(ue,P,A),Ye(me,z,j),wt(X,z,j),wt(oe,P,A),Me(S[0],ue,me),Me(S[1],oe,X),Me(S[2],X,me),Me(S[3],ue,oe)}function Q(S,I,A){var P;for(P=0;P<4;P++)Oe(S[P],I[P],A)}function K(S,I){var A=t(),P=t(),j=t();W(j,I[2]),Me(A,I[0],j),Me(P,I[1],j),je(S,P),S[31]^=Ve(A)<<7}function nt(S,I,A){var P,j;for(q(S[0],u),q(S[1],c),q(S[2],c),q(S[3],u),j=255;j>=0;--j)P=A[j/8|0]>>(j&7)&1,Q(S,I,P),Yt(I,S),Yt(S,S),Q(S,I,P)}function at(S,I){var A=[t(),t(),t(),t()];q(A[0],m),q(A[1],y),q(A[2],c),Me(A[3],m,y),nt(S,A,I)}function ct(S,I,A){var P=new Uint8Array(64),j=[t(),t(),t(),t()],z;for(A||n(I,32),jt(P,I,32),P[0]&=248,P[31]&=127,P[31]|=64,at(j,P),K(S,j),z=0;z<32;z++)I[z+32]=S[z];return 0}var ze=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Kt(S,I){var A,P,j,z;for(P=63;P>=32;--P){for(A=0,j=P-32,z=P-12;j<z;++j)I[j]+=A-16*I[P]*ze[j-(P-32)],A=Math.floor((I[j]+128)/256),I[j]-=A*256;I[j]+=A,I[P]=0}for(A=0,j=0;j<32;j++)I[j]+=A-(I[31]>>4)*ze[j],A=I[j]>>8,I[j]&=255;for(j=0;j<32;j++)I[j]-=A*ze[j];for(P=0;P<32;P++)I[P+1]+=I[P]>>8,S[P]=I[P]&255}function kr(S){var I=new Float64Array(64),A;for(A=0;A<64;A++)I[A]=S[A];for(A=0;A<64;A++)S[A]=0;Kt(S,I)}function or(S,I,A,P){var j=new Uint8Array(64),z=new Uint8Array(64),ue=new Uint8Array(64),me,X,oe=new Float64Array(64),De=[t(),t(),t(),t()];jt(j,P,32),j[0]&=248,j[31]&=127,j[31]|=64;var lt=A+64;for(me=0;me<A;me++)S[64+me]=I[me];for(me=0;me<32;me++)S[32+me]=j[32+me];for(jt(ue,S.subarray(32),A+32),kr(ue),at(De,ue),K(S,De),me=32;me<64;me++)S[me]=P[me];for(jt(z,S,A+64),kr(z),me=0;me<64;me++)oe[me]=0;for(me=0;me<32;me++)oe[me]=ue[me];for(me=0;me<32;me++)for(X=0;X<32;X++)oe[me+X]+=z[me]*j[X];return Kt(S.subarray(32),oe),lt}function yr(S,I){var A=t(),P=t(),j=t(),z=t(),ue=t(),me=t(),X=t();return q(S[2],c),Be(S[1],I),Ue(j,S[1]),Me(z,j,h),Ye(j,j,S[2]),wt(z,S[2],z),Ue(ue,z),Ue(me,ue),Me(X,me,ue),Me(A,X,j),Me(A,A,z),J(A,A),Me(A,A,j),Me(A,A,z),Me(A,A,z),Me(S[0],A,z),Ue(P,S[0]),Me(P,P,z),rt(P,j)&&Me(S[0],S[0],g),Ue(P,S[0]),Me(P,P,z),rt(P,j)?-1:(Ve(S[0])===I[31]>>7&&Ye(S[0],u,S[0]),Me(S[3],S[0],S[1]),0)}function Mn(S,I,A,P){var j,z=new Uint8Array(32),ue=new Uint8Array(64),me=[t(),t(),t(),t()],X=[t(),t(),t(),t()];if(A<64||yr(X,P))return-1;for(j=0;j<A;j++)S[j]=I[j];for(j=0;j<32;j++)S[j+32]=P[j];if(jt(ue,S,A),kr(ue),nt(me,X,ue),at(X,I.subarray(32)),Yt(me,X),K(z,me),A-=64,O(I,0,z,0)){for(j=0;j<A;j++)S[j]=0;return-1}for(j=0;j<A;j++)S[j]=I[j+64];return A}var rr=32,Dt=24,rn=32,Rr=16,gr=32,Hr=32,Dr=32,pr=32,Ir=32,Rn=Dt,li=rn,Dn=Rr,Er=64,Qr=32,zt=64,Ft=32,Fn=64;r.lowlevel={crypto_core_hsalsa20:D,crypto_stream_xor:Se,crypto_stream:re,crypto_stream_salsa20_xor:Y,crypto_stream_salsa20:ae,crypto_onetimeauth:be,crypto_onetimeauth_verify:Ee,crypto_verify_16:R,crypto_verify_32:O,crypto_secretbox:ee,crypto_secretbox_open:pe,crypto_scalarmult:$,crypto_scalarmult_base:Z,crypto_box_beforenm:G,crypto_box_afternm:xe,crypto_box:$e,crypto_box_open:le,crypto_box_keypair:ne,crypto_hash:jt,crypto_sign:or,crypto_sign_keypair:ct,crypto_sign_open:Mn,crypto_secretbox_KEYBYTES:rr,crypto_secretbox_NONCEBYTES:Dt,crypto_secretbox_ZEROBYTES:rn,crypto_secretbox_BOXZEROBYTES:Rr,crypto_scalarmult_BYTES:gr,crypto_scalarmult_SCALARBYTES:Hr,crypto_box_PUBLICKEYBYTES:Dr,crypto_box_SECRETKEYBYTES:pr,crypto_box_BEFORENMBYTES:Ir,crypto_box_NONCEBYTES:Rn,crypto_box_ZEROBYTES:li,crypto_box_BOXZEROBYTES:Dn,crypto_sign_BYTES:Er,crypto_sign_PUBLICKEYBYTES:Qr,crypto_sign_SECRETKEYBYTES:zt,crypto_sign_SEEDBYTES:Ft,crypto_hash_BYTES:Fn,gf:t,D:h,L:ze,pack25519:je,unpack25519:Be,M:Me,A:wt,S:Ue,Z:Ye,pow2523:J,add:Yt,set25519:q,modL:Kt,scalarmult:nt,scalarbase:at};function Ln(S,I){if(S.length!==rr)throw new Error("bad key size");if(I.length!==Dt)throw new Error("bad nonce size")}function mn(S,I){if(S.length!==Dr)throw new Error("bad public key size");if(I.length!==pr)throw new Error("bad secret key size")}function mt(){for(var S=0;S<arguments.length;S++)if(!(arguments[S]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Gr(S){for(var I=0;I<S.length;I++)S[I]=0}r.randomBytes=function(S){var I=new Uint8Array(S);return n(I,S),I},r.secretbox=function(S,I,A){mt(S,I,A),Ln(A,I);for(var P=new Uint8Array(rn+S.length),j=new Uint8Array(P.length),z=0;z<S.length;z++)P[z+rn]=S[z];return ee(j,P,P.length,I,A),j.subarray(Rr)},r.secretbox.open=function(S,I,A){mt(S,I,A),Ln(A,I);for(var P=new Uint8Array(Rr+S.length),j=new Uint8Array(P.length),z=0;z<S.length;z++)P[z+Rr]=S[z];return P.length<32||pe(j,P,P.length,I,A)!==0?null:j.subarray(rn)},r.secretbox.keyLength=rr,r.secretbox.nonceLength=Dt,r.secretbox.overheadLength=Rr,r.scalarMult=function(S,I){if(mt(S,I),S.length!==Hr)throw new Error("bad n size");if(I.length!==gr)throw new Error("bad p size");var A=new Uint8Array(gr);return $(A,S,I),A},r.scalarMult.base=function(S){if(mt(S),S.length!==Hr)throw new Error("bad n size");var I=new Uint8Array(gr);return Z(I,S),I},r.scalarMult.scalarLength=Hr,r.scalarMult.groupElementLength=gr,r.box=function(S,I,A,P){var j=r.box.before(A,P);return r.secretbox(S,I,j)},r.box.before=function(S,I){mt(S,I),mn(S,I);var A=new Uint8Array(Ir);return G(A,S,I),A},r.box.after=r.secretbox,r.box.open=function(S,I,A,P){var j=r.box.before(A,P);return r.secretbox.open(S,I,j)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var S=new Uint8Array(Dr),I=new Uint8Array(pr);return ne(S,I),{publicKey:S,secretKey:I}},r.box.keyPair.fromSecretKey=function(S){if(mt(S),S.length!==pr)throw new Error("bad secret key size");var I=new Uint8Array(Dr);return Z(I,S),{publicKey:I,secretKey:new Uint8Array(S)}},r.box.publicKeyLength=Dr,r.box.secretKeyLength=pr,r.box.sharedKeyLength=Ir,r.box.nonceLength=Rn,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(S,I){if(mt(S,I),I.length!==zt)throw new Error("bad secret key size");var A=new Uint8Array(Er+S.length);return or(A,S,S.length,I),A},r.sign.open=function(S,I){if(mt(S,I),I.length!==Qr)throw new Error("bad public key size");var A=new Uint8Array(S.length),P=Mn(A,S,S.length,I);if(P<0)return null;for(var j=new Uint8Array(P),z=0;z<j.length;z++)j[z]=A[z];return j},r.sign.detached=function(S,I){for(var A=r.sign(S,I),P=new Uint8Array(Er),j=0;j<P.length;j++)P[j]=A[j];return P},r.sign.detached.verify=function(S,I,A){if(mt(S,I,A),I.length!==Er)throw new Error("bad signature size");if(A.length!==Qr)throw new Error("bad public key size");var P=new Uint8Array(Er+S.length),j=new Uint8Array(Er+S.length),z;for(z=0;z<Er;z++)P[z]=I[z];for(z=0;z<S.length;z++)P[z+Er]=S[z];return Mn(j,P,P.length,A)>=0},r.sign.keyPair=function(){var S=new Uint8Array(Qr),I=new Uint8Array(zt);return ct(S,I),{publicKey:S,secretKey:I}},r.sign.keyPair.fromSecretKey=function(S){if(mt(S),S.length!==zt)throw new Error("bad secret key size");for(var I=new Uint8Array(Qr),A=0;A<I.length;A++)I[A]=S[32+A];return{publicKey:I,secretKey:new Uint8Array(S)}},r.sign.keyPair.fromSeed=function(S){if(mt(S),S.length!==Ft)throw new Error("bad seed size");for(var I=new Uint8Array(Qr),A=new Uint8Array(zt),P=0;P<32;P++)A[P]=S[P];return ct(I,A,!0),{publicKey:I,secretKey:A}},r.sign.publicKeyLength=Qr,r.sign.secretKeyLength=zt,r.sign.seedLength=Ft,r.sign.signatureLength=Er,r.hash=function(S){mt(S);var I=new Uint8Array(Fn);return jt(I,S,S.length),I},r.hash.hashLength=Fn,r.verify=function(S,I){return mt(S,I),S.length===0||I.length===0||S.length!==I.length?!1:C(S,0,I,0,S.length)===0},r.setPRNG=function(S){n=S},function(){var S=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(S&&S.getRandomValues){var I=65536;r.setPRNG(function(A,P){var j,z=new Uint8Array(P);for(j=0;j<P;j+=I)S.getRandomValues(z.subarray(j,j+Math.min(P-j,I)));for(j=0;j<P;j++)A[j]=z[j];Gr(z)})}else typeof require<"u"&&(S=require("crypto"),S&&S.randomBytes&&r.setPRNG(function(A,P){var j,z=S.randomBytes(P);for(j=0;j<P;j++)A[j]=z[j];Gr(z)}))}()}(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const bc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,UC={fromSeed:bc.sign.keyPair.fromSeed,sign:bc.sign.detached,verify:bc.sign.detached.verify,randomBytes:bc.randomBytes};let kw;function $C(r){kw=r}function cs(){return kw}const BC=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);class wc{static checksum(e){let t=0;for(let n=0;n<e.byteLength;n++){let i=e[n];t=t<<8&65535^BC[(t>>8^i)&255]}return t}static validate(e,t){return wc.checksum(e)==t}}const Ld="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class Iw{static encode(e){let t=0,n=0,i=new Uint8Array(e),a=new Uint8Array(e.byteLength*2),u=0;for(let c=0;c<i.byteLength;c++)for(n=n<<8|i[c],t+=8;t>=5;){let f=n>>>t-5&31;a[u++]=Ld.charAt(f).charCodeAt(0),t-=5}if(t>0){let c=n<<5-t&31;a[u++]=Ld.charAt(c).charCodeAt(0)}return a.slice(0,u)}static decode(e){let t=0,n=0,i=0,a=new Uint8Array(e),u=new Uint8Array(a.byteLength*5/8|0);for(let c=0;c<a.byteLength;c++){let f=String.fromCharCode(a[c]),h=Ld.indexOf(f);if(h===-1)throw new Error("Illegal Base32 character: "+a[c]);n=n<<5|h,t+=5,t>=8&&(u[i++]=n>>>t-8&255,t-=8)}return u.slice(0,i)}}class Pt extends Error{name;code;chainedError;constructor(e,t){super(e),this.name="NKeysError",this.code=e,this.chainedError=t}}function VC(){return _c(Nt.Operator)}function WC(){return _c(Nt.Account)}function zC(){return _c(Nt.User)}var kt;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(kt||(kt={}));var Nt;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(Nt||(Nt={}));class Ta{static isValidPublicPrefix(e){return e==Nt.Server||e==Nt.Operator||e==Nt.Cluster||e==Nt.Account||e==Nt.User}static startsWithValidPrefix(e){let t=e[0];return t=="S"||t=="P"||t=="O"||t=="N"||t=="C"||t=="A"||t=="U"}static isValidPrefix(e){return this.parsePrefix(e)!=-1}static parsePrefix(e){switch(e){case Nt.Seed:return Nt.Seed;case Nt.Private:return Nt.Private;case Nt.Operator:return Nt.Operator;case Nt.Server:return Nt.Server;case Nt.Cluster:return Nt.Cluster;case Nt.Account:return Nt.Account;case Nt.User:return Nt.User;default:return-1}}}class Wr{static encode(e,t){if(!t||!(t instanceof Uint8Array))throw new Pt(kt.SerializationError);if(!Ta.isValidPrefix(e))throw new Pt(kt.InvalidPrefixByte);return Wr._encode(!1,e,t)}static encodeSeed(e,t){if(!t)throw new Pt(kt.ApiError);if(!Ta.isValidPublicPrefix(e))throw new Pt(kt.InvalidPrefixByte);if(t.byteLength!==32)throw new Pt(kt.InvalidSeedLen);return Wr._encode(!0,e,t)}static decode(e,t){if(!Ta.isValidPrefix(e))throw new Pt(kt.InvalidPrefixByte);const n=Wr._decode(t);if(n[0]!==e)throw new Pt(kt.InvalidPrefixByte);return n.slice(1)}static decodeSeed(e){const t=Wr._decode(e),n=Wr._decodePrefix(t);if(n[0]!=Nt.Seed)throw new Pt(kt.InvalidSeed);if(!Ta.isValidPublicPrefix(n[1]))throw new Pt(kt.InvalidPrefixByte);return{buf:t.slice(2),prefix:n[1]}}static _encode(e,t,n){const i=e?2:1,a=n.byteLength,u=i+a+2,c=i+a,f=new Uint8Array(u);if(e){const m=Wr._encodePrefix(Nt.Seed,t);f.set(m)}else f[0]=t;f.set(n,i);const h=wc.checksum(f.slice(0,c));return new DataView(f.buffer).setUint16(c,h,!0),Iw.encode(f)}static _decode(e){if(e.byteLength<4)throw new Pt(kt.InvalidEncoding);let t;try{t=Iw.decode(e)}catch(c){throw new Pt(kt.InvalidEncoding,c)}const n=t.byteLength-2,a=new DataView(t.buffer).getUint16(n,!0),u=t.slice(0,n);if(!wc.validate(u,a))throw new Pt(kt.InvalidChecksum);return u}static _encodePrefix(e,t){const n=e|t>>5,i=(t&31)<<3;return new Uint8Array([n,i])}static _decodePrefix(e){const t=e[0]&248,n=(e[0]&7)<<5|(e[1]&248)>>3;return new Uint8Array([t,n])}}class Cw{seed;constructor(e){this.seed=e}getRawSeed(){if(!this.seed)throw new Pt(kt.ClearedPair);return Wr.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Pt(kt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Pt(kt.ClearedPair);const e=Wr.decodeSeed(this.seed),t=cs().fromSeed(this.getRawSeed()),n=Wr.encode(e.prefix,t.publicKey);return new TextDecoder().decode(n)}getPrivateKey(){if(!this.seed)throw new Pt(kt.ClearedPair);const e=cs().fromSeed(this.getRawSeed());return Wr.encode(Nt.Private,e.secretKey)}sign(e){if(!this.seed)throw new Pt(kt.ClearedPair);const t=cs().fromSeed(this.getRawSeed());return cs().sign(e,t.secretKey)}verify(e,t){if(!this.seed)throw new Pt(kt.ClearedPair);const n=cs().fromSeed(this.getRawSeed());return cs().verify(e,t,n.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function _c(r){const e=cs().randomBytes(32);let t=Wr.encodeSeed(r,new Uint8Array(e));return new Cw(t)}class HC{publicKey;constructor(e){this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new Pt(kt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Pt(kt.PublicKeyOnly):new Pt(kt.ClearedPair)}getSeed(){throw this.publicKey?new Pt(kt.PublicKeyOnly):new Pt(kt.ClearedPair)}sign(e){throw this.publicKey?new Pt(kt.CannotSign):new Pt(kt.ClearedPair)}verify(e,t){if(!this.publicKey)throw new Pt(kt.ClearedPair);let n=Wr._decode(this.publicKey);return cs().verify(e,t,n.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function QC(r){const e=new TextEncoder().encode(r),t=Wr._decode(e),n=Ta.parsePrefix(t[0]);if(Ta.isValidPublicPrefix(n))return new HC(e);throw new Pt(kt.InvalidPublicKey)}function GC(r){return Wr.decodeSeed(r),new Cw(r)}function JC(r){return btoa(String.fromCharCode(...r))}function YC(r){const e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}$C(UC);const Pw={createAccount:WC,createOperator:VC,createPair:_c,createUser:zC,fromPublic:QC,fromSeed:GC,NKeysError:Pt,NKeysErrorCode:kt,Prefix:Nt,decode:YC,encode:JC};function KC(r){return e=>{let t={};return r.forEach(n=>{const i=n(e)||{};t=Object.assign(t,i)}),t}}function ZC(){return()=>{}}function XC(r,e){return()=>{const t=typeof r=="function"?r():r,n=typeof e=="function"?e():e;return{user:t,pass:n}}}function eP(r){return()=>({auth_token:typeof r=="function"?r():r})}function tP(r){return e=>{const t=typeof r=="function"?r():r,n=t?Pw.fromSeed(t):void 0,i=n?n.getPublicKey():"",a=Oi.encode(e||""),u=n!==void 0&&e?n.sign(a):void 0,c=u?Pw.encode(u):"";return{nkey:i,sig:c}}}function rP(r,e){return t=>{const n=typeof r=="function"?r():r,i=tP(e),{nkey:a,sig:u}=i(t);return{jwt:n,nkey:a,sig:u}}}function nP(r){const e=typeof r!="function"?()=>r:r,t=()=>{const a=/\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig,u=tn.decode(e());let c=a.exec(u);if(!c)throw Ne.errorForCode(we.BadCreds);const f=c[1].trim();if(c=a.exec(u),!c||!c)throw Ne.errorForCode(we.BadCreds);const h=Oi.encode(c[1].trim());return{jwt:f,seed:h}};return rP(()=>{const{jwt:a}=t();return a},()=>{const{seed:a}=t();return a})}const Nw=120*1e3,iP=2,Mw=2*1e3;function sP(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Nw,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Mw,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function aP(r){const e=[];return typeof r.authenticator=="function"&&e.push(r.authenticator),Array.isArray(r.authenticator)&&e.push(...r.authenticator),r.token&&e.push(eP(r.token)),r.user&&e.push(XC(r.user,r.pass)),e.length===0?ZC():KC(e)}function oP(r){const e=`${bd}:${Sw()}`;if(r=r||{servers:[e]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new Ne("port and servers options are mutually exclusive",we.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${bd}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[e]);const t=lc(sP(),r);if(t.authenticator=aP(t),["reconnectDelayHandler","authenticator"].forEach(n=>{if(t[n]&&typeof t[n]!="function")throw new Ne(`${n} option should be a function`,we.NotFunction)}),t.reconnectDelayHandler||(t.reconnectDelayHandler=()=>{let n=t.tls?t.reconnectJitterTLS:t.reconnectJitter;return n&&(n++,n=Math.floor(Math.random()*n)),t.reconnectTimeWait+n}),t.inboxPrefix)try{Ai(t.inboxPrefix)}catch(n){throw new Ne(n.message,we.ApiError)}if(t.resolve===void 0&&(t.resolve=typeof Nd()=="function"),t.resolve&&typeof Nd()!="function")throw new Ne("'resolve' is not supported on this client",we.InvalidOption);return t}function uP(r,e){const{proto:t,tls_required:n,tls_available:i}=r;if((t===void 0||t<1)&&e.noEcho)throw new Ne("noEcho",we.ServerOptionNotAvailable);const a=n||i||!1;if(e.tls&&!a)throw new Ne("tls",we.ServerOptionNotAvailable)}const cP=1024*32,lP=/^INFO\s+([^\r\n]+)\r\n/i,fP=ko(`PONG\r
|
|
142
|
-
`),Rw=ko(`PING\r
|
|
143
|
-
`);class hP{echo;no_responders;protocol;verbose;pedantic;jwt;nkey;sig;user;pass;auth_token;tls_required;name;lang;version;headers;constructor(e,t,n){this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=t.noEcho?!1:void 0,this.verbose=t.verbose,this.pedantic=t.pedantic,this.tls_required=t.tls?!0:void 0,this.name=t.name;const i=(t&&typeof t.authenticator=="function"?t.authenticator(n):{})||{};lc(this,i)}}class Dw extends Sr{sid;queue;draining;max;subject;drained;protocol;timer;info;cleanupFn;closed;requestSubject;constructor(e,t,n={}){super(),lc(this,n),this.protocol=e,this.subject=t,this.draining=!1,this.noIterator=typeof n.callback=="function",this.closed=Vt();const i=!e.options?.noAsyncTraces;n.timeout&&(this.timer=ga(n.timeout,i),this.timer.then(()=>{this.timer=void 0}).catch(a=>{this.stop(a),this.noIterator&&this.callback(a,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(e){if(this.noIterator){const t=this.callback,n=e.ingestionFilterFn?e.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),i=e.protocolFilterFn?e.protocolFilterFn:()=>!0,a=e.dispatchedFn?e.dispatchedFn:()=>{};this.callback=(u,c)=>{const{ingest:f}=n(c);f&&i(c)&&(t(u,c),a(c))}}else this.protocolFilterFn=e.protocolFilterFn,this.dispatchedFn=e.dispatchedFn}callback(e,t){this.cancelTimeout(),e?this.stop(e):this.push(t)}close(){if(!this.isClosed()){this.cancelTimeout();const e=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?e():this.push(e)}}unsubscribe(e){this.protocol.unsubscribe(this,e)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Ne.errorForCode(we.ConnectionClosed)):this.isClosed()?Promise.reject(Ne.errorForCode(we.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Vt()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class dP{mux;subs;sidCounter;constructor(){this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const t=e.permissionContext,n=this.all();let i;if(t.operation==="subscription"&&(i=n.find(a=>a.subject===t.subject&&a.queue===t.queue)),t.operation==="publish"&&(i=n.find(a=>a.requestSubject===t.subject)),i)return i.callback(e,{}),i.close(),this.subs.delete(i.sid),i!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class Sc{connected;connectedOnce;infoReceived;info;muxSubscriptions;options;outbound;pongs;subscriptions;transport;noMorePublishing;connectError;publisher;_closed;closed;listeners;heartbeats;parser;outMsgs;inMsgs;outBytes;inBytes;pendingLimit;lastError;abortReconnect;whyClosed;servers;server;features;connectPromise;constructor(e,t){this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=cP,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new dP,this.muxSubscriptions=new DC,this.outbound=new Ea,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new mC({major:0,minor:0,micro:0}),this.connectPromise=null;const n=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new RC(n,{randomize:!e.noRandomize}),this.closed=Vt(),this.parser=new Aw(this),this.heartbeats=new FC(this,this.options.pingInterval||Nw,this.options.maxPingOut||iP)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const t=Ne.errorForCode(we.Disconnect);t.stack="",e.forEach(n=>{n.reject(t)}),this.parser=new Aw(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}status(){const e=new Sr;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=Vt();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=vC(),this.transport.closed().then(async t=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:ya.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ya.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Ti.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{this.dispatchStatus({type:Ti.Reconnect,data:this.servers.getCurrentServer().toString()}),this.lastError?.code===we.AuthenticationExpired&&(this.lastError=void 0)}).catch(t=>{this._close(t)}):await this._close(e)}async dial(e){const t=this.prepare();let n;try{n=ga(this.options.timeout||2e4);const i=this.transport.connect(e,this.options);await Promise.race([i,n]),(async()=>{try{for await(const a of this.transport)this.parser.parse(a)}catch(a){console.log("reader closed",a)}})().then()}catch(i){t.reject(i)}try{await Promise.race([n,t]),n&&n.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(i){throw n&&n.cancel(),await this.transport.close(i),i}}async _doDial(e){const{resolve:t}=this.options,n=await e.resolve({fn:Nd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t});let i=null;for(const a of n)try{i=null,this.dispatchStatus({type:ya.Reconnecting,data:a.toString()}),await this.dial(a);return}catch(u){i=u}throw i}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();const t=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Mw;let n=t;const i=this.selectServer();if(!i||this.abortReconnect)throw e||(this.lastError?this.lastError:Ne.errorForCode(we.ConnectionRefused));const a=Date.now();if(i.lastConnect===0||i.lastConnect+t<=a){i.lastConnect=Date.now();try{await this._doDial(i);break}catch(u){if(e=u,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}i.reconnects++;const c=this.options.maxReconnectAttempts||0;c!==-1&&i.reconnects>=c&&this.servers.removeCurrentServer()}}else n=Math.min(n,i.lastConnect+t-a),await va(n)}}static async connect(e,t){const n=new Sc(e,t);return await n.dialLoop(),n}static toError(e){const t=e?e.toLowerCase():"";if(t.indexOf("permissions violation")!==-1){const n=new Ne(e,we.PermissionsViolation),i=e.match(/(Publish|Subscription) to "(\S+)"/);if(i){n.permissionContext={operation:i[1].toLowerCase(),subject:i[2],queue:void 0};const a=e.match(/using queue "(\S+)"/);a&&(n.permissionContext.queue=a[1])}return n}else return t.indexOf("authorization violation")!==-1?new Ne(e,we.AuthorizationViolation):t.indexOf("user authentication expired")!==-1?new Ne(e,we.AuthenticationExpired):t.indexOf("account authentication expired")!=-1?new Ne(e,we.AccountExpired):t.indexOf("authentication timeout")!==-1?new Ne(e,we.AuthenticationTimeout):new Ne(e,we.ProtocolError)}processMsg(e,t){if(this.inMsgs++,this.inBytes+=t.length,!this.subscriptions.sidCounter)return;const n=this.subscriptions.get(e.sid);n&&(n.received+=1,n.callback&&n.callback(null,new fw(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(e){const t=tw(e),n=Sc.toError(t),i={type:Ti.Error,data:n.code};if(n.isPermissionError()){let a=!1;n.permissionContext&&(i.permissionContext=n.permissionContext,a=this.subscriptions.getMux()?.subject===n.permissionContext.subject),this.subscriptions.handleError(n),this.muxSubscriptions.handleError(a,n),a&&this.subscriptions.setMux(null)}this.dispatchStatus(i),this.handleError(n)}handleError(e){e.isAuthError()?this.handleAuthError(e):e.isProtocolError()?this.lastError=e:e.isAuthTimeout()&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(fP)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const t=JSON.parse(tw(e));this.info=t;const n=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(t,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ds(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:a,lang:u}=this.transport;try{const c=new hP({version:a,lang:u},this.options,t.nonce);t.headers&&(c.headers=!0,c.no_responders=!0);const f=JSON.stringify(c);this.transport.send(ko(`CONNECT ${f}${yc}`)),this.transport.send(Rw)}catch(c){this._close(c)}}n&&this.dispatchStatus({type:Ti.Update,data:n}),(t.ldm!==void 0?t.ldm:!1)&&this.dispatchStatus({type:Ti.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case Vr.MSG:{const{msg:t,data:n}=e;this.processMsg(t,n);break}case Vr.OK:break;case Vr.ERR:this.processError(e.data);break;case Vr.PING:this.processPing();break;case Vr.PONG:this.processPong();break;case Vr.INFO:this.processInfo(e.data);break}}sendCommand(e,...t){const n=this.outbound.length();let i;typeof e=="string"?i=ko(e):i=e,this.outbound.fill(i,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=fn,n){let i;if(t instanceof Uint8Array)i=t;else if(typeof t=="string")i=Oi.encode(t);else throw Ne.errorForCode(we.BadPayload);let a=i.length;n=n||{},n.reply=n.reply||"";let u=fn,c=0;if(n.headers){if(this.info&&!this.info.headers)throw new Ne("headers",we.ServerOptionNotAvailable);u=n.headers.encode(),c=u.length,a=i.length+c}if(this.info&&a>this.info.max_payload)throw Ne.errorForCode(we.MaxPayloadExceeded);this.outBytes+=a,this.outMsgs++;let f;n.headers?(n.reply?f=`HPUB ${e} ${n.reply} ${c} ${a}\r
|
|
144
|
-
`:f=`HPUB ${e} ${c} ${a}\r
|
|
145
|
-
`,this.sendCommand(f,u,i,gc)):(n.reply?f=`PUB ${e} ${n.reply} ${a}\r
|
|
146
|
-
`:f=`PUB ${e} ${a}\r
|
|
147
|
-
`,this.sendCommand(f,i,gc))}request(e){return this.initMux(),this.muxSubscriptions.add(e),e}subscribe(e){return this.subscriptions.add(e),this._subunsub(e),e}_sub(e){e.queue?this.sendCommand(`SUB ${e.subject} ${e.queue} ${e.sid}\r
|
|
148
|
-
`):this.sendCommand(`SUB ${e.subject} ${e.sid}\r
|
|
149
|
-
`)}_subunsub(e){return this._sub(e),e.max&&this.unsubscribe(e,e.max),e}unsubscribe(e,t){this.unsub(e,t),(e.max===void 0||e.received>=e.max)&&this.subscriptions.cancel(e)}unsub(e,t){!e||this.isClosed()||(t?this.sendCommand(`UNSUB ${e.sid} ${t}\r
|
|
150
|
-
`):this.sendCommand(`UNSUB ${e.sid}\r
|
|
151
|
-
`),e.max=t)}resub(e,t){!e||this.isClosed()||(this.unsub(e),e.subject=t,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||(e=Vt()),this.pongs.push(e),this.outbound.fill(Rw),this.flushPending(),e}sendSubscriptions(){const e=[];this.subscriptions.all().forEach(t=>{const n=t;n.queue?e.push(`SUB ${n.subject} ${n.queue} ${n.sid}${yc}`):e.push(`SUB ${n.subject} ${n.sid}${yc}`)}),e.length&&this.transport.send(ko(e.join("")))}async _close(e){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(e),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(t=>{t.stop()}),this._closed=!0,await this.transport.close(e),await this.closed.resolve(e))}close(){return this._close()}isClosed(){return this._closed}drain(){const e=this.subscriptions.all(),t=[];return e.forEach(n=>{t.push(n.drain())}),Promise.all(t).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){const t=this.muxSubscriptions.init(this.options.inboxPrefix),n=new Dw(this,`${t}*`);n.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(n),this.subscribe(n)}}selectServer(){const e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}const pP="$SRV";class Fw{msg;constructor(e){this.msg=e}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(e,t){return this.msg.respond(e,t)}respondError(e,t,n,i){return i=i||{},i.headers=i.headers||ki(),i.headers?.set(uc,`${e}`),i.headers?.set(oc,t),this.msg.respond(n,i)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class Fo{subject;queue;srv;constructor(e,t="",n=""){t!==""&&yP("service group",t);let i="";if(e instanceof Lo)this.srv=e,i="";else if(e instanceof Fo){const a=e;this.srv=a.srv,n===""&&a.queue!==""&&(n=a.queue),i=a.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(i,t),this.queue=n}calcSubject(e,t=""){return t===""?e:e!==""?`${e}.${t}`:t}addEndpoint(e="",t){t=t||{subject:e};const n=typeof t=="function"?{handler:t,subject:e}:t;Co("endpoint",e);let{subject:i,handler:a,metadata:u,queue:c}=n;i=i||e,c=c||this.queue,mP("endpoint subject",i),i=this.calcSubject(this.subject,i);const f={name:e,subject:i,queue:c,handler:a,metadata:u};return this.srv._addEndpoint(f)}addGroup(e="",t=""){return new Fo(this,e,t)}}function mP(r,e){if(e==="")throw new Error(`${r} cannot be empty`);if(e.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${e}'`);const t=e.split(".");t.forEach((n,i)=>{if(n===">"&&i!==t.length-1)throw new Error(`${r} cannot have internal '>': '${e}'`)})}function yP(r,e){if(e.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${e}'`);e.split(".").forEach(n=>{if(n===">")throw new Error(`${r} name cannot contain internal '>': '${e}'`)})}class Lo{nc;_id;config;handlers;internal;_stopped;_done;started;static controlSubject(e,t="",n="",i){const a=i??pP;return t===""&&n===""?`${a}.${e}`:(Co("control subject name",t),n!==""?(Co("control subject id",n),`${a}.${e}.${t}.${n}`):`${a}.${e}.${t}`)}constructor(e,t={name:"",version:""}){this.nc=e,this.config=Object.assign({},t),this.config.queue||(this.config.queue="q"),Co("name",this.config.name),Co("queue",this.config.queue),Ds(this.config.version),this._id=is.next(),this.internal=[],this._done=Vt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(n=>{this.close(n).catch()})}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(e){const t=ki();if(e instanceof cc){const n=e;t.set(oc,n.message),t.set(uc,`${n.code}`)}else t.set(oc,e.message),t.set(uc,"500");return t}setupHandler(e,t=!1){const n=t?"":e.queue?e.queue:this.config.queue,{name:i,subject:a,handler:u}=e,c=e;c.internal=t,t&&this.internal.push(c),c.stats=new gP(i,a,n),c.queue=n;const f=u?(h,p)=>{if(h){this.close(h);return}const m=Date.now();try{u(h,new Fw(p))}catch(y){c.stats.countError(y),p?.respond(fn,{headers:this.errorToHeader(y)})}finally{c.stats.countLatency(m)}}:void 0;return c.sub=this.nc.subscribe(a,{callback:f,queue:n}),c.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${e.subject} stopped`)).catch()}).catch(h=>{if(!this._stopped){const p=new Error(`required subscription ${e.subject} errored: ${h.message}`);p.stack=h.stack,this.close(p).catch()}}),c}info(){return{type:Io.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{const{subject:t,metadata:n,name:i,queue:a}=e;return{subject:t,metadata:n,name:i,queue_group:a}})}async stats(){const e=[];for(const t of this.handlers){if(typeof this.config.statsHandler=="function")try{t.stats.data=await this.config.statsHandler(t)}catch(n){t.stats.countError(n)}e.push(t.stats.stats(t.qi))}return{type:Io.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,t){const n=`${e}`.toUpperCase();this._doAddInternalHandler(`${n}-all`,e,t),this._doAddInternalHandler(`${n}-kind`,e,t,this.name),this._doAddInternalHandler(`${n}`,e,t,this.name,this.id)}_doAddInternalHandler(e,t,n,i="",a=""){const u={};u.name=e,u.subject=Lo.controlSubject(t,i,a),u.handler=n,this.setupHandler(u,!0)}start(){const e=Cn(),t=(u,c)=>u?(this.close(u),Promise.reject(u)):this.stats().then(f=>(c?.respond(e.encode(f)),Promise.resolve())),n=(u,c)=>u?(this.close(u),Promise.reject(u)):(c?.respond(e.encode(this.info())),Promise.resolve()),i=e.encode(this.ping()),a=(u,c)=>u?(this.close(u).then().catch(),Promise.reject(u)):(c.respond(i),Promise.resolve());return this.addInternalHandler(ss.PING,a),this.addInternalHandler(ss.STATS,t),this.addInternalHandler(ss.INFO,n),this.handlers.forEach(u=>{const{subject:c}=u;typeof c=="string"&&u.handler!==null&&this.setupHandler(u)}),Promise.resolve(this)}close(e){if(this._stopped)return this._done;this._stopped=!0;let t=[];return this.nc.isClosed()||(t=this.handlers.concat(this.internal).map(n=>n.sub.drain())),Promise.allSettled(t).then(()=>{this._done.resolve(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:Io.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const e of this.handlers)e.stats.reset(e.qi)}addGroup(e,t){return new Fo(this,e,t)}addEndpoint(e,t){return new Fo(this).addEndpoint(e,t)}_addEndpoint(e){const t=new Sr;t.noIterator=typeof e.handler=="function",t.noIterator||(e.handler=(i,a)=>{i?this.stop(i).catch():t.push(new Fw(a))},t.iterClosed.then(()=>{this.close().catch()}));const n=this.setupHandler(e,!1);return n.qi=t,this.handlers.push(n),t}}class gP{name;subject;average_processing_time;num_requests;processing_time;num_errors;last_error;data;metadata;queue;constructor(e,t,n=""){this.name=e,this.subject=t,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=n}reset(e){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const t=e;t&&(t.time=0,t.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=Wt(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){const{name:e,subject:t,average_processing_time:n,num_errors:i,num_requests:a,processing_time:u,last_error:c,data:f,queue:h}=this;return{name:e,subject:t,average_processing_time:n,num_errors:i,num_requests:a,processing_time:u,last_error:c,data:f,queue_group:h}}stats(e){const t=e;return t?.noIterator===!1&&(this.processing_time=Wt(t.time),this.num_requests=t.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class vP{nc;prefix;opts;constructor(e,t={strategy:Xn.JitterTimer,maxWait:2e3},n){this.nc=e,this.prefix=n,this.opts=t}ping(e="",t=""){return this.q(ss.PING,e,t)}stats(e="",t=""){return this.q(ss.STATS,e,t)}info(e="",t=""){return this.q(ss.INFO,e,t)}async q(e,t="",n=""){const i=new Sr,a=Cn(),u=Lo.controlSubject(e,t,n,this.prefix),c=await this.nc.requestMany(u,fn,this.opts);return(async()=>{for await(const f of c)try{const h=a.decode(f.data);i.push(h)}catch(h){i.push(()=>{i.stop(h)})}i.push(()=>{i.stop()})})().catch(f=>{i.stop(f)}),i}}function Lw(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function bP(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Lw(),storage:Ad.File}}const xc="KV-Operation",qw="$KV",wP=/^[-/=.\w]+$/,_P=/^[-/=.>*\w]+$/,SP=/^[-\w]+$/;function xP(r){if(r.startsWith(".")||r.endsWith(".")||!wP.test(r))throw new Error(`invalid key: ${r}`)}function EP(r){if(r.startsWith(".")||r.endsWith(".")||!_P.test(r))throw new Error(`invalid key: ${r}`)}function OP(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const e=r.split(".");let t=!1;for(let n=0;n<e.length;n++)switch(e[n]){case"*":t=!0;break;case">":if(n!==e.length-1)throw new Error(`invalid key: ${r}`);t=!0;break}return t}function Ec(r){if(!SP.test(r))throw new Error(`invalid bucket name: ${r}`)}var ui;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(ui||(ui={}));class qo{js;jsm;stream;bucket;direct;codec;prefix;editPrefix;useJsPrefix;_prefixLen;constructor(e,t,n){Ec(e),this.js=t,this.jsm=n,this.bucket=e,this.prefix=qw,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,t,n={}){Ec(t);const i=await e.jetstreamManager(),a=new qo(t,e,i);return await a.init(n),a}static async bind(e,t,n={}){const i=await e.jetstreamManager(),a={config:{allow_direct:n.allow_direct}};Ec(t);const u=new qo(t,e,i);return a.config.name=n.streamName??u.bucketName(),Object.assign(u,a),u.stream=a.config.name,u.codec=n.codec||Lw(),u.direct=a.config.allow_direct??!1,u.initializePrefixes(a),u}async init(e={}){const t=Object.assign(bP(),e);this.codec=t.codec;const n={};this.stream=n.name=e.streamName??this.bucketName(),n.retention=Td.Limits,n.max_msgs_per_subject=t.history,t.maxBucketSize&&(t.max_bytes=t.maxBucketSize),t.max_bytes&&(n.max_bytes=t.max_bytes),n.max_msg_size=t.maxValueSize,n.storage=t.storage;const i=e.placementCluster??"";if(i&&(e.placement={},e.placement.cluster=i,e.placement.tags=[]),e.placement&&(n.placement=e.placement),e.republish&&(n.republish=e.republish),e.description&&(n.description=e.description),e.mirror){const m=Object.assign({},e.mirror);m.name.startsWith(dn)||(m.name=`${dn}${m.name}`),n.mirror=m,n.mirror_direct=!0}else if(e.sources){const m=e.sources.map(y=>{const g=Object.assign({},y),b=g.name.startsWith(dn)?g.name.substring(dn.length):g.name;return g.name.startsWith(dn)||(g.name=`${dn}${g.name}`),!y.external&&b!==this.bucket&&(g.subject_transforms=[{src:`$KV.${b}.>`,dest:`$KV.${this.bucket}.>`}]),g});n.sources=m,n.subjects=[this.subjectForBucket()]}else n.subjects=[this.subjectForBucket()];e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?os.S2:os.None);const a=this.js.nc,u=a.getServerVersion(),c=u?Cd(u,Ds("2.7.2"))>=0:!1;n.discard=c?Po.New:Po.Old;const{ok:f,min:h}=a.features.get(bt.JS_ALLOW_DIRECT);if(!f&&e.allow_direct===!0){const m=u?`${u.major}.${u.minor}.${u.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${m} - requires ${h}`))}e.allow_direct=typeof e.allow_direct=="boolean"?e.allow_direct:f,n.allow_direct=e.allow_direct,this.direct=n.allow_direct,n.num_replicas=t.replicas,t.ttl&&(n.max_age=Wt(t.ttl)),n.allow_rollup_hdrs=!0;let p;try{p=await this.jsm.streams.info(n.name),!p.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(m){if(m.message==="stream not found")p=await this.jsm.streams.add(n);else throw m}this.initializePrefixes(p)}initializePrefixes(e){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:t}=e.config;if(t){let n=t.name;if(n.startsWith(dn)&&(n=n.substring(dn.length)),t.external&&t.external.api!==""){const i=t.name.substring(dn.length);this.useJsPrefix=!1,this.prefix=`$KV.${i}`,this.editPrefix=`${t.external.api}.$KV.${n}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${dn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(e,t=!1){const n=[];return t?(this.useJsPrefix&&n.push(this.js.apiPrefix),this.editPrefix!==""?n.push(this.editPrefix):n.push(this.prefix)):this.prefix&&n.push(this.prefix),n.push(e),n.join(".")}fullKeyName(e){return this.prefix!==""?`${this.prefix}.${e}`:`${qw}.${this.bucket}.${e}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.encode(n));break}return t.join(".")}decodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.decode(n));break}return t.join(".")}validateKey=xP;validateSearchKey=EP;hasWildcards=OP;close(){return Promise.resolve()}dataLen(e,t){const n=t&&t.get(Br.MessageSizeHdr)||"";return n!==""?parseInt(n,10):e.length}smToEntry(e){return new $P(this.bucket,this.prefixLen,e)}jmToEntry(e){const t=this.decodeKey(e.subject.substring(this.prefixLen));return new BP(this.bucket,t,e)}async create(e,t){let n;try{const a=await this.put(e,t,{previousSeq:0});return Promise.resolve(a)}catch(a){if(n=a,a?.api_error?.err_code!==10071)return Promise.reject(a)}let i=0;try{const a=await this.get(e);return a?.operation==="DEL"||a?.operation==="PURGE"?(i=a!==null?a.revision:0,this.update(e,t,i)):Promise.reject(n)}catch(a){return Promise.reject(a)}}update(e,t,n){if(n<=0)throw new Error("version must be greater than 0");return this.put(e,t,{previousSeq:n})}async put(e,t,n={}){const i=this.encodeKey(e);this.validateKey(i);const a={};if(n.previousSeq!==void 0){const u=ki();a.headers=u,u.set(ui.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(i,!0),t,a)).seq}catch(u){const c=u;return c.isJetStreamError()?(c.message=c.api_error?.description,c.code=`${c.api_error?.code}`,Promise.reject(c)):Promise.reject(u)}}async get(e,t){const n=this.encodeKey(e);this.validateKey(n);let i={last_by_subj:this.subjectForKey(n)};t&&t.revision>0&&(i={seq:t.revision});let a;try{this.direct?a=await this.jsm.direct.getMessage(this.bucketName(),i):a=await this.jsm.streams.getMessage(this.bucketName(),i);const u=this.smToEntry(a);return u.key!==n?null:u}catch(u){if(u.code===we.JetStream404NoMessages)return null;throw u}}purge(e,t){return this._deleteOrPurge(e,"PURGE",t)}delete(e,t){return this._deleteOrPurge(e,"DEL",t)}async purgeDeletes(e=1800*1e3){const t=Vt(),n=[],i=await this.watch({key:">",initializedFn:()=>{t.resolve()}});(async()=>{for await(const f of i)(f.operation==="DEL"||f.operation==="PURGE")&&n.push(f)})().then(),await t,i.stop();const a=Date.now()-e,u=n.map(f=>{const h=this.subjectForKey(f.key);return f.created.getTime()>=a?this.jsm.streams.purge(this.stream,{filter:h,keep:1}):this.jsm.streams.purge(this.stream,{filter:h,keep:0})}),c=await Promise.all(u);return c.unshift({success:!0,purged:0}),c.reduce((f,h)=>(f.purged+=h.purged,f))}async _deleteOrPurge(e,t,n){if(!this.hasWildcards(e))return this._doDeleteOrPurge(e,t,n);const i=await this.keys(e),a=[];for await(const u of i)a.push(this._doDeleteOrPurge(u,t)),a.length===100&&(await Promise.all(a),a.length=0);a.length>0&&await Promise.all(a)}async _doDeleteOrPurge(e,t,n){const i=this.encodeKey(e);this.validateKey(i);const a=ki();a.set(xc,t),t==="PURGE"&&a.set(Br.RollupHdr,Br.RollupValueSubject),n?.previousSeq&&a.set(ui.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`),await this.js.publish(this.subjectForKey(i,!0),fn,{headers:a})}_buildCC(e,t,n={}){let a=(Array.isArray(e)?e:[e]).map(f=>{const h=this.encodeKey(f);return this.validateSearchKey(f),this.fullKeyName(h)}),u=ir.LastPerSubject;t===ei.AllHistory&&(u=ir.All),t===ei.UpdatesOnly&&(u=ir.New);let c;return a.length===1&&(c=a[0],a=void 0),Object.assign({deliver_policy:u,ack_policy:xr.None,filter_subjects:a,filter_subject:c,flow_control:!0,idle_heartbeat:Wt(5*1e3)},n)}remove(e){return this.purge(e)}async history(e={}){const t=e.key??">",n=new Sr,i={};i.headers_only=e.headers_only||!1;let a;a=()=>{n.stop()};let u=0;const c=this._buildCC(t,ei.AllHistory,i),f=c.filter_subject,h=us(c);h.bindStream(this.stream),h.orderedConsumer(),h.callback((m,y)=>{if(m){n.stop(m);return}if(y){const g=this.jmToEntry(y);n.push(g),n.received++,(a&&u>0&&n.received>=u||y.info.pending===0)&&(n.push(a),a=void 0)}});const p=await this.js.subscribe(f,h);if(a){const{info:{last:m}}=p,y=m.num_pending+m.delivered.consumer_seq;if(y===0||n.received>=y)try{a()}catch(g){n.stop(g)}finally{a=void 0}else u=y}return n._data=p,n.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{n.stop()}).catch(m=>{n.stop(m)}),n}canSetWatcherName(){const t=this.js.nc,{ok:n}=t.features.get(bt.JS_NEW_CONSUMER_CREATE_API);return n}async watch(e={}){const t=e.key??">",n=new Sr,i={};i.headers_only=e.headers_only||!1;let a=ei.LastValue;e.include===ei.AllHistory?a=ei.AllHistory:e.include===ei.UpdatesOnly&&(a=ei.UpdatesOnly);const u=e.ignoreDeletes===!0;let c=e.initializedFn,f=0;const h=this._buildCC(t,a,i),p=h.filter_subject,m=us(h);this.canSetWatcherName()&&m.consumerName(is.next()),m.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&m.startSequence(e.resumeFromRevision),m.orderedConsumer(),m.callback((g,b)=>{if(g){n.stop(g);return}if(b){const k=this.jmToEntry(b);if(u&&k.operation==="DEL")return;n.push(k),n.received++,c&&(f>0&&n.received>=f||b.info.pending===0)&&(n.push(c),c=void 0)}});const y=await this.js.subscribe(p,m);if(c){const{info:{last:g}}=y,b=g.num_pending+g.delivered.consumer_seq;if(b===0||n.received>=b)try{c()}catch(k){n.stop(k)}finally{c=void 0}else f=b}return n._data=y,n.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{n.stop()}).catch(g=>{n.stop(g)}),n}async keys(e=">"){const t=new Sr,n=this._buildCC(e,ei.LastValue,{headers_only:!0}),i=Array.isArray(e)?">":n.filter_subject,a=us(n);a.bindStream(this.stream),a.orderedConsumer();const u=await this.js.subscribe(i,a);return(async()=>{for await(const f of u){const h=f.headers?.get(xc);if(h!=="DEL"&&h!=="PURGE"){const p=this.decodeKey(f.subject.substring(this.prefixLen));t.push(p)}f.info.pending===0&&u.unsubscribe()}})().then(()=>{t.stop()}).catch(f=>{t.stop(f)}),u.info.last.num_pending===0&&u.unsubscribe(),t}purgeBucket(e){return this.jsm.streams.purge(this.bucketName(),e)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){const t=this.js.nc.info?.cluster??"",n=this.bucketName(),i=await this.jsm.streams.info(n);return new jw(i,t)}}class jw{si;cluster;constructor(e,t=""){this.si=e,this.cluster=t}get bucket(){return this.si.config.name.startsWith(dn)?this.si.config.name.substring(dn.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return _d(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){return this.si.config.placement?.cluster??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==os.None:!1}}const qd="OBJ_",Uw="SHA-256=";function TP(r){return Ec(r),`${qd}${r}`}function AP(r){return r.startsWith(qd)?r.substring(4):r}class jd{si;backingStore;constructor(e){this.si=e,this.backingStore="JetStream"}get bucket(){return AP(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==os.None:!1}}function Oc(r){if(r===void 0)return;const{domain:e}=r;if(e===void 0)return r;const t=Object.assign({},r);if(delete t.domain,e==="")return t;if(t.external)throw new Error("domain and external are both set");return t.external={api:`$JS.${e}.API`},t}var Nn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(Nn||(Nn={}));var ci;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(ci||(ci={}));var Aa;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Aa||(Aa={}));const $w=Uint8Array.of(43,65,67,75),kP=Uint8Array.of(45,78,65,75),jo=Uint8Array.of(43,87,80,73),IP=Uint8Array.of(43,78,88,84),CP=Uint8Array.of(43,84,69,82,77),PP=Uint8Array.of(32);function Uo(r,e=5e3){return new JP(r,e)}class Ud extends Sr{consumer;opts;sub;monitor;pending;inbox;refilling;pong;callback;timeout;cleanupHandler;listeners;statusIterator;forOrderedConsumer;resetHandler;abortOnMissingResource;bind;inBackOff;constructor(e,t,n=!1){super(),this.consumer=e;const i=t;this.opts=this.parseOptions(t,n),this.callback=i.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=n,this.timeout=null,this.inbox=Ai(e.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=i.abort_on_missing_resource===!0,this.bind=i.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:e,max_bytes:t,idle_heartbeat:n,threshold_bytes:i,threshold_messages:a}=this.opts;this.closed().then(c=>{if(this.cleanupHandler)try{this.cleanupHandler(c)}catch{}});const{sub:u}=this;u&&u.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(c,f)=>{if(c){this.stop(c);return}if(this.monitor?.work(),f.subject===this.inbox){if(Ed(f))return;const p=f.headers?.code,m=f.headers?.description?.toLowerCase()||"unknown",{msgsLeft:y,bytesLeft:g}=this.parseDiscard(f.headers);if(y>0||g>0)this.pending.msgs-=y,this.pending.bytes-=g,this.pending.requests--,this.notify(Aa.Discard,{msgsLeft:y,bytesLeft:g});else if(p===400){this.stop(new Ne(m,`${p}`));return}else if(p===409&&m==="consumer deleted"){if(this.notify(ci.ConsumerDeleted,`${p} ${m}`),!this.refilling||this.abortOnMissingResource){const b=new Ne(m,`${p}`);this.stop(b);return}}else if(p===503){if(this.notify(ci.NoResponders,`${p} No Responders`),!this.refilling||this.abortOnMissingResource){const b=new Ne("no responders",`${p}`);this.stop(b);return}}else this.notify(Aa.DebugEvent,`${p} ${m}`)}else this._push(Uo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(e&&this.pending.msgs<=a||t&&this.pending.bytes<=i){const p=this.pullOptions();this.pull(p)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),n&&(this.monitor=new Od(n,c=>(this.notify(ci.HeartbeatsMissed,c),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{const c=this.consumer.api.nc.status();this.statusIterator=c;for await(const f of c)switch(f.type){case Ti.Disconnect:this.monitor?.cancel();break;case Ti.Reconnect:this.resetPending().then(h=>{h&&this.monitor?.restart()}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(e){if(!this.callback)super.push(e);else{const t=typeof e=="function"?e:null;try{t?t():this.callback(e)}catch(n){this.stop(n)}}}notify(e,t){this.listeners.length>0&&this.listeners.forEach(n=>{n.done||n.push({type:e,data:t})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let e=0,t=0;const n=wd([this.opts.expires]);let i=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,e=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(a){if(a.message==="stream not found"){if(t++,this.notify(ci.StreamNotFound,t),!this.refilling||this.abortOnMissingResource)return this.stop(a),!1}else if(a.message==="consumer not found"){if(e++,this.notify(ci.ConsumerNotFound,e),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(a),!1;if(this.forOrderedConsumer)return!1}else e=0,t=0;this.inBackOff=!0;const u=n.backoff(i),c=va(u);await Promise.race([c,this.consumer.api.nc.closed()]),c.cancel(),i++}}}pull(e){this.pending.bytes+=e.max_bytes??0,this.pending.msgs+=e.batch??0,this.pending.requests++;const t=this.consumer.api.nc;this._push(()=>{t.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(e),{reply:this.inbox}),this.notify(Aa.Next,e)})}pullOptions(){const e=this.opts.max_messages-this.pending.msgs,t=this.opts.max_bytes-this.pending.bytes,n=Wt(this.opts.idle_heartbeat),i=Wt(this.opts.expires);return{batch:e,max_bytes:t,idle_heartbeat:n,expires:i}}parseDiscard(e){const t={msgsLeft:0,bytesLeft:0},n=e?.get(Br.PendingMessagesHdr);n&&(t.msgsLeft=parseInt(n));const i=e?.get(Br.PendingBytesHdr);return i&&(t.bytesLeft=parseInt(i)),t}trackTimeout(e){this.timeout=e}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){this.monitor?.cancel(),this.monitor=null,this.timeout?.cancel(),this.timeout=null}setCleanupHandler(e){this.cleanupHandler=e}stop(e){this.done||(this.sub?.unsubscribe(),this.clearTimers(),this.statusIterator?.stop(),this._push(()=>{super.stop(e),this.listeners.forEach(t=>{t.stop()})}))}parseOptions(e,t=!1){const n=e||{};if(n.max_messages=n.max_messages||0,n.max_bytes=n.max_bytes||0,n.max_messages!==0&&n.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(n.max_messages===0&&(n.max_messages=100),n.expires=n.expires||3e4,n.expires<1e3)throw new Error("expires should be at least 1000ms");if(n.idle_heartbeat=n.idle_heartbeat||n.expires/2,n.idle_heartbeat=n.idle_heartbeat>3e4?3e4:n.idle_heartbeat,t){const i=Math.round(n.max_messages*.75)||1;n.threshold_messages=n.threshold_messages||i;const a=Math.round(n.max_bytes*.75)||1;n.threshold_bytes=n.threshold_bytes||a}return n}status(){const e=new Sr;return this.listeners.push(e),Promise.resolve(e)}}class NP extends Sr{src;listeners;constructor(){super(),this.listeners=[]}setSource(e){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=e,this.src.setCleanupHandler(t=>{this.stop(t||void 0)}),(async()=>{const t=await this.src.status();for await(const n of t)this.notify(n.type,n.data)})().catch(()=>{})}notify(e,t){this.listeners.length>0&&this.listeners.forEach(n=>{n.done||n.push({type:e,data:t})})}stop(e){this.done||(this.src?.stop(e),super.stop(e),this.listeners.forEach(t=>{t.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const e=new Sr;return this.listeners.push(e),Promise.resolve(e)}}class $d{api;_info;stream;name;constructor(e,t){this.api=e,this._info=t,this.stream=t.stream_name,this.name=t.name}consume(e={max_messages:100,expires:3e4}){return Promise.resolve(new Ud(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const t=new Ud(this,e,!1),n=Math.round(t.opts.expires*1.05),i=ga(n);return t.closed().catch(()=>{}).finally(()=>{i.cancel()}),i.catch(()=>{t.close().catch()}),t.trackTimeout(i),Promise.resolve(t)}next(e={expires:3e4}){const t=Vt(),n=e;n.max_messages=1;const i=new Ud(this,n,!1),a=Math.round(i.opts.expires*1.05);a>=6e4&&(async()=>{for await(const c of await i.status())if(c.type===ci.HeartbeatsMissed&&c.data>=2){t.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const c of i){t.resolve(c);break}})().catch(()=>{});const u=ga(a);return i.closed().then(c=>{c?t.reject(c):t.resolve(null)}).catch(c=>{t.reject(c)}).finally(()=>{u.cancel()}),u.catch(c=>{t.resolve(null),i.close().catch()}),i.trackTimeout(u),t}delete(){const{stream_name:e,name:t}=this._info;return this.api.delete(e,t)}info(e=!1){if(e)return Promise.resolve(this._info);const{stream_name:t,name:n}=this._info;return this.api.info(t,n).then(i=>(this._info=i,this._info))}}class MP{api;consumerOpts;consumer;opts;cursor;stream;namePrefix;serial;currentConsumer;userCallback;iter;type;startSeq;maxInitialReset;constructor(e,t,n={}){this.api=e,this.stream=t,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=is.next(),typeof n.name_prefix=="string"&&(hc("name_prefix",n.name_prefix),this.namePrefix=n.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Nn.Unset,this.consumerOpts=n,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(e){this.serial++;const t=`${this.namePrefix}_${this.serial}`;e=e===0?1:e;const n={name:t,deliver_policy:ir.StartSequence,opt_start_seq:e,ack_policy:xr.None,inactive_threshold:Wt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(n.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(n.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(n.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(n.replay_policy=this.consumerOpts.replay_policy),e===this.startSeq+1&&(n.deliver_policy=this.consumerOpts.deliver_policy||ir.StartSequence,(this.consumerOpts.deliver_policy===ir.LastPerSubject||this.consumerOpts.deliver_policy===ir.New||this.consumerOpts.deliver_policy===ir.Last)&&(delete n.opt_start_seq,n.deliver_policy=this.consumerOpts.deliver_policy),n.deliver_policy===ir.LastPerSubject&&typeof n.filter_subjects>"u"&&typeof n.filter_subject>"u"&&(n.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete n.opt_start_seq,n.deliver_policy=ir.StartTime,n.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(n.inactive_threshold=Wt(this.consumerOpts.inactive_threshold))),n}async resetConsumer(e=0){is.next();const t=this.serial===0;this.consumer?.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const n=this.getConsumerOpts(e);n.max_deliver=1,n.mem_storage=!0;const i=wd([this.opts?.expires||3e4]);let a;for(let u=0;;u++)try{a=await this.api.add(this.stream,n),this.iter?.notify(ci.OrderedConsumerRecreated,a.name);break}catch(c){if(c.message==="stream not found"&&(this.iter?.notify(ci.StreamNotFound,u),this.type===Nn.Fetch||this.opts.abort_on_missing_resource===!0))return this.iter?.stop(c),Promise.reject(c);if(t&&u>=this.maxInitialReset)throw c;await va(i.backoff(u+1))}return a}internalHandler(e){return t=>{if(this.serial!==e)return;const n=t.info.deliverySequence;if(n!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=n,this.cursor.stream_seq=t.info.streamSequence,this.userCallback?this.userCallback(t):this.iter?.push(t)}}async reset(e={max_messages:100,expires:3e4},t){t=t||{};const n=t.fromFetch||!1,i=t.orderedReset||!1;if(this.type===Nn.Fetch&&i){this.iter?.src.stop(),await this.iter?.closed(),this.currentConsumer=null;return}(this.currentConsumer===null||i)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||n)&&(this.iter=new NP),this.consumer=new $d(this.api,this.currentConsumer);const a=e;a.callback=this.internalHandler(this.serial);let u=null;this.type===Nn.Fetch&&n?u=await this.consumer.fetch(e):this.type===Nn.Consume&&(u=await this.consumer.consume(e));const c=u;c.forOrderedConsumer=!0,c.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(c)}notifyOrderedResetAndReset(){this.iter?.notify(Aa.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Nn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Nn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:n}=e;return n&&(this.userCallback=n),this.type=Nn.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Nn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(this.iter?.done===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:n}=e;return n&&(this.userCallback=n),this.type=Nn.Fetch,this.opts=e,await this.reset(e,{fromFetch:!0}),this.iter}async next(e={expires:3e4}){const t=e;if(t.bind)return Promise.reject(new Error("bind is not supported"));t.max_messages=1;const n=Vt();return t.callback=a=>{this.userCallback=null,n.resolve(a)},(await this.fetch(t)).iterClosed.then(a=>{a&&n.reject(a),n.resolve(null)}).catch(a=>{n.reject(a)}),n}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(e=>Promise.resolve(e)).catch(e=>Promise.reject(e)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(e){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Bd{api;notified;constructor(e){this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(bt.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}getPullConsumerFor(e){if(e.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new $d(this.api,e)}async get(e,t={}){return typeof t=="object"?this.ordered(e,t):(await this.checkVersion(),this.api.info(e,t).then(n=>n.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new $d(this.api,n)).catch(n=>Promise.reject(n)))}async ordered(e,t){await this.checkVersion();const n=this.api;return new Vd(n.nc,n.opts).info(e).then(a=>Promise.resolve(new MP(this.api,e,t))).catch(a=>Promise.reject(a))}}class Tc{api;_info;constructor(e,t){this.api=e,this._info=t}get name(){return this._info.config.name}alternates(){return this.info().then(e=>e.alternates?e.alternates:[])}async best(){if(await this.info(),this._info.alternates){const e=await this.api.info(this._info.alternates[0].name);return new Tc(this.api,e)}else return this}info(e=!1,t){return e?Promise.resolve(this._info):this.api.info(this.name,t).then(n=>(this._info=n,this._info))}getConsumerFromInfo(e){return new Bd(new mc(this.api.nc,this.api.opts)).getPullConsumerFor(e)}getConsumer(e){return new Bd(new mc(this.api.nc,this.api.opts)).get(this.name,e)}getMessage(e){return this.api.getMessage(this.name,e)}deleteMessage(e,t){return this.api.deleteMessage(this.name,e,t)}}class Vd extends Mo{constructor(e,t){super(e,t)}checkStreamConfigVersions(e){const t=this.nc;if(e.metadata){const{min:i,ok:a}=t.features.get(bt.JS_STREAM_CONSUMER_METADATA);if(!a)throw new Error(`stream 'metadata' requires server ${i}`)}if(e.first_seq){const{min:i,ok:a}=t.features.get(bt.JS_STREAM_FIRST_SEQ);if(!a)throw new Error(`stream 'first_seq' requires server ${i}`)}if(e.subject_transform){const{min:i,ok:a}=t.features.get(bt.JS_STREAM_SUBJECT_TRANSFORM);if(!a)throw new Error(`stream 'subject_transform' requires server ${i}`)}if(e.compression){const{min:i,ok:a}=t.features.get(bt.JS_STREAM_COMPRESSION);if(!a)throw new Error(`stream 'compression' requires server ${i}`)}if(e.consumer_limits){const{min:i,ok:a}=t.features.get(bt.JS_DEFAULT_CONSUMER_LIMITS);if(!a)throw new Error(`stream 'consumer_limits' requires server ${i}`)}function n(i,a){if((a?.subject_transforms?.length||0)>0){const{min:c,ok:f}=t.features.get(bt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${i} 'subject_transforms' requires server ${c}`)}}e.sources&&e.sources.forEach(i=>{n("stream sources",i)}),e.mirror&&n("stream mirror",e.mirror)}async add(e={}){this.checkStreamConfigVersions(e),$r(e.name),e.mirror=Oc(e.mirror),e.sources=e.sources?.map(Oc);const n=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(n),n}async delete(e){return $r(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,t={}){if(typeof e=="object"){const c=e;e=c.name,t=c,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(t),$r(e);const n=await this.info(e),i=Object.assign(n.config,t);i.mirror=Oc(i.mirror),i.sources=i.sources?.map(Oc);const u=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,i);return this._fixInfo(u),u}async info(e,t){$r(e);const n=`${this.prefix}.STREAM.INFO.${e}`;let a=await this._request(n,t),{total:u,limit:c}=a,f=a.state.subjects?Object.getOwnPropertyNames(a.state.subjects).length:1;if(u&&u>f){const h=[a],p=t||{};let m=0;for(;u>f;){m++,p.offset=c*m;const g=await this._request(n,p);u=g.total,h.push(g);const b=Object.getOwnPropertyNames(g.state.subjects).length;if(f+=b,b<c)break}let y={};for(let g=0;g<h.length;g++)a=h[g],a.state.subjects&&(y=Object.assign(y,a.state.subjects));a.offset=0,a.total=0,a.limit=0,a.state.subjects=y}return this._fixInfo(a),a}list(e=""){const t=e?.length?{subject:e}:{},n=a=>{const u=a;return u.streams.forEach(c=>{this._fixInfo(c)}),u.streams},i=`${this.prefix}.STREAM.LIST`;return new Ro(i,n,this,t)}_fixInfo(e){e.config.sealed=e.config.sealed||!1,e.config.deny_delete=e.config.deny_delete||!1,e.config.deny_purge=e.config.deny_purge||!1,e.config.allow_rollup_hdrs=e.config.allow_rollup_hdrs||!1}async purge(e,t){if(t){const{keep:i,seq:a}=t;if(typeof i=="number"&&typeof a=="number")throw new Error("can specify one of keep or seq")}return $r(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,t)}async deleteMessage(e,t,n=!0){$r(e);const i={seq:t};return n||(i.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${e}`,i)).success}async getMessage(e,t){$r(e);const i=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,t);return new FP(i)}find(e){return this.findStream(e)}listKvs(){const e=n=>{const a=n.streams.filter(f=>f.config.name.startsWith(dn));a.forEach(f=>{this._fixInfo(f)});let u="";return a.length&&(u=this.nc.info?.cluster??""),a.map(f=>new jw(f,u))},t=`${this.prefix}.STREAM.LIST`;return new Ro(t,e,this)}listObjectStores(){const e=n=>{const a=n.streams.filter(c=>c.config.name.startsWith(qd));return a.forEach(c=>{this._fixInfo(c)}),a.map(c=>new jd(c))},t=`${this.prefix}.STREAM.LIST`;return new Ro(t,e,this)}names(e=""){const t=e?.length?{subject:e}:{},n=a=>a.streams,i=`${this.prefix}.STREAM.NAMES`;return new Ro(i,n,this,t)}async get(e){const t=await this.info(e);return Promise.resolve(new Tc(this,t))}}class RP extends Mo{constructor(e,t){super(e,t)}async getMessage(e,t){$r(e);let n=t;const{last_by_subj:i}=n;i&&(n=null);const a=n?this.jc.encode(n):fn,u=this.opts.apiPrefix||"$JS.API",c=i?`${u}.DIRECT.GET.${e}.${i}`:`${u}.DIRECT.GET.${e}`,f=await this.nc.request(c,a,{timeout:this.timeout}),h=wa(f);if(h)return Promise.reject(h);const p=new Bw(f);return Promise.resolve(p)}async getBatch(e,t){$r(e);const i=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${e}`;if(!Array.isArray(t.multi_last)||t.multi_last.length===0)return Promise.reject("multi_last is required");const a=JSON.stringify(t,(f,h)=>f==="up_to_time"&&h instanceof Date?h.toISOString():h),u=new Sr,c=await this.nc.requestMany(i,a,{strategy:Xn.SentinelMsg});return(async()=>{let f=!1,h=!1,p;for await(const m of c){if(!f){f=!0;const y=m.headers?.code||0;if(y!==0&&y<200||y>299){p=m.headers?.description.toLowerCase();break}if(m.headers?.get("Nats-Num-Pending")===""){h=!0;break}}if(m.data.length===0)break;u.push(new Bw(m))}u.push(()=>{if(h)throw new Error("batch direct get not supported by the server");if(p)throw new Error(`bad request: ${p}`);u.stop()})})(),Promise.resolve(u)}}class Bw{data;header;static jc;constructor(e){if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(Sa.Subject)}get seq(){const e=this.header.last(Sa.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Sa.TimeStamp)}get stream(){return this.header.last(Sa.Stream)}json(e){return Cn(e).decode(this.data)}string(){return tn.decode(this.data)}}class DP extends Mo{streams;consumers;direct;constructor(e,t){super(e,t),this.streams=new Vd(e,t),this.consumers=new mc(e,t),this.direct=new RP(e,t)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const e=new Sr;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(t,n)=>{if(t)throw t;try{const i=this.parseJsResponse(n),a=i.type.split("."),u=a[a.length-1];e.push({kind:u,data:i})}catch(i){e.stop(i)}}}),e}}class FP{_header;smr;static jc;constructor(e){this.smr=e}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):fn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=as.decode(e)}else this._header=ki();return this._header}_parse(e){const t=atob(e),n=t.length,i=new Uint8Array(n);for(let a=0;a<n;a++)i[a]=t.charCodeAt(a);return i}json(e){return Cn(e).decode(this.data)}string(){return tn.decode(this.data)}}class LP{api;constructor(e){this.api=e}get(e){return this.api.info(e).then(t=>new Tc(this.api,t))}}class Wd{info;hdrs;constructor(e){this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=as.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){return this.info.options?.link!==void 0&&this.info.options?.link!==null}}function Vw(r){const e={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const t=r.headers;e.headers=t.toRecord()}return e}function qP(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class $o{jsm;js;stream;name;constructor(e,t,n){this.name=e,this.jsm=t,this.js=n}_checkNotEmpty(e){return!e||e.length===0?{name:e,error:new Error("name cannot be empty")}:{name:e}}async info(e){const t=await this.rawInfo(e);return t?new Wd(t):null}async list(){const e=[],t=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const n of t){if(n===null)break;e.push(n)}return Promise.resolve(e)}async rawInfo(e){const{name:t,error:n}=this._checkNotEmpty(e);if(n)return Promise.reject(n);const i=this._metaSubject(t);try{const a=await this.jsm.streams.getMessage(this.stream,{last_by_subj:i}),c=Cn().decode(a.data);return c.revision=a.seq,c}catch(a){return a.code==="404"?null:Promise.reject(a)}}async _si(e){try{return await this.jsm.streams.info(this.stream,e)}catch(t){return t.code==="404"?null:Promise.reject(t)}}async seal(){let e=await this._si();return e===null?Promise.reject(new Error("object store not found")):(e.config.sealed=!0,e=await this.jsm.streams.update(this.stream,e.config),Promise.resolve(new jd(e)))}async status(e){const t=await this._si(e);return t===null?Promise.reject(new Error("object store not found")):Promise.resolve(new jd(t))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,t,n){const i=this.js.getOptions();n=n||{timeout:i.timeout},n.timeout=n.timeout||i.timeout,n.previousRevision=n.previousRevision??void 0;const{timeout:a,previousRevision:u}=n,f=this.js.nc.info?.max_payload||1024;e=e||{},e.options=e.options||{};let h=e.options?.max_chunk_size||128*1024;h=h>f?f:h,e.options.max_chunk_size=h;const p=await this.info(e.name),{name:m,error:y}=this._checkNotEmpty(e.name);if(y)return Promise.reject(y);const g=is.next(),b=this._chunkSubject(g),k=this._metaSubject(m),_=Object.assign({bucket:this.name,nuid:g,size:0,chunks:0},Vw(e)),w=Vt(),T=[],C=new Ea;try{const R=t?t.getReader():null,O=bw.create();for(;;){const{done:N,value:V}=R?await R.read():{done:!0,value:void 0};if(N){if(C.size()>0){const ae=C.drain();O.update(ae),_.chunks++,_.size+=ae.length,T.push(this.js.publish(b,ae,{timeout:a}))}await Promise.all(T),T.length=0,_.mtime=new Date().toISOString();const D=xa.encode(O.digest());_.digest=`${Uw}${D}`,_.deleted=!1;const U=ki();typeof u=="number"&&U.set(ui.ExpectedLastSubjectSequenceHdr,`${u}`),U.set(Br.RollupHdr,Br.RollupValueSubject);const Y=await this.js.publish(k,Cn().encode(_),{headers:U,timeout:a});if(_.revision=Y.seq,p)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${p.nuid}`})}catch{}w.resolve(new Wd(_));break}if(V)for(C.fill(V);C.size()>h;){_.chunks++,_.size+=h;const D=C.drain(e.options.max_chunk_size);O.update(D),T.push(this.js.publish(b,D,{timeout:a}))}}}catch(R){await this.jsm.streams.purge(this.stream,{filter:b}),w.reject(R)}return w}putBlob(e,t,n){function i(a){return new ReadableStream({pull(u){u.enqueue(a),u.close()}})}return t===null&&(t=new Uint8Array(0)),this.put(e,i(t),n)}put(e,t,n){return e?.options?.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(e,t,n)}async getBlob(e){async function t(a){const u=new Ea,c=a.getReader();for(;;){const{done:f,value:h}=await c.read();if(f)return u.drain();h&&h.length&&u.fill(h)}}const n=await this.get(e);if(n===null)return Promise.resolve(null);const i=await Promise.all([n.error,t(n.data)]);return i[0]?Promise.reject(i[0]):Promise.resolve(i[1])}async get(e){const t=await this.rawInfo(e);if(t===null||t.deleted)return Promise.resolve(null);if(t.options&&t.options.link){const m=t.options.link.name||"";if(m==="")throw new Error("link is a bucket");return(t.options.link.bucket!==this.name?await $o.create(this.js,t.options.link.bucket):this).get(m)}if(!t.digest.startsWith(Uw))return Promise.reject(new Error(`unknown digest type: ${t.digest}`));const n=Id(t.digest.substring(8));if(n===null)return Promise.reject(new Error(`unable to parse digest: ${t.digest}`));const i=Vt(),a={info:new Wd(t),error:i};if(t.size===0)return a.data=qP(),i.resolve(null),Promise.resolve(a);let u;const c=us();c.orderedConsumer();const f=bw.create(),h=`$O.${this.name}.C.${t.nuid}`,p=await this.js.subscribe(h,c);return(async()=>{for await(const m of p)m.data.length>0&&(f.update(m.data),u.enqueue(m.data)),m.info.pending===0&&(fC(n,f.digest())?u.close():u.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${n}`)),p.unsubscribe())})().then(()=>{i.resolve()}).catch(m=>{u.error(m),i.reject(m)}),a.data=new ReadableStream({start(m){u=m},cancel(){p.unsubscribe()}}),a}linkStore(e,t){if(!(t instanceof $o))return Promise.reject("bucket required");const n=t,{name:i,error:a}=this._checkNotEmpty(e);if(a)return Promise.reject(a);const u={name:i,options:{link:{bucket:n.name}}};return this._put(u,null)}async link(e,t){const{name:n,error:i}=this._checkNotEmpty(e);if(i)return Promise.reject(i);if(t.deleted)return Promise.reject(new Error("src object is deleted"));if(t.isLink())return Promise.reject(new Error("src object is a link"));const a=await this.rawInfo(e);if(a!==null&&!a.deleted)return Promise.reject(new Error("an object already exists with that name"));const u={bucket:t.bucket,name:t.name},c={name:n,bucket:t.bucket,options:{link:u}};await this.js.publish(this._metaSubject(e),JSON.stringify(c));const f=await this.info(e);return Promise.resolve(f)}async delete(e){const t=await this.rawInfo(e);if(t===null)return Promise.resolve({purged:0,success:!1});t.deleted=!0,t.size=0,t.chunks=0,t.digest="";const n=Cn(),i=ki();return i.set(Br.RollupHdr,Br.RollupValueSubject),await this.js.publish(this._metaSubject(t.name),n.encode(t),{headers:i}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(t.nuid)})}async update(e,t={}){const n=await this.rawInfo(e);if(n===null)return Promise.reject(new Error("object not found"));if(n.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));t.name=t.name??n.name;const{name:i,error:a}=this._checkNotEmpty(t.name);if(a)return Promise.reject(a);if(e!==t.name){const f=await this.info(t.name);if(f&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"))}t.name=i;const u=Object.assign({},n,Vw(t)),c=await this.js.publish(this._metaSubject(u.name),JSON.stringify(u));return e!==t.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(e)}),Promise.resolve(c)}async watch(e={}){e.includeHistory=e.includeHistory??!1,e.ignoreDeletes=e.ignoreDeletes??!1;let t=!1;const n=new Sr,i=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:i})}catch(f){f.code==="404"?(n.push(null),t=!0):n.stop(f)}const a=Cn(),u=us();u.orderedConsumer(),e.includeHistory?u.deliverLastPerSubject():(t=!0,u.deliverNew()),u.callback((f,h)=>{if(f){n.stop(f);return}if(h!==null){const p=a.decode(h.data);p.deleted&&e.ignoreDeletes===!0||n.push(p),h.info?.pending===0&&!t&&(t=!0,n.push(null))}});const c=await this.js.subscribe(i,u);return n._data=c,n.iterClosed.then(()=>{c.unsubscribe()}),c.closed.then(()=>{n.stop()}).catch(f=>{n.stop(f)}),n}_chunkSubject(e){return`$O.${this.name}.C.${e}`}_metaSubject(e){return`$O.${this.name}.M.${xa.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=TP(this.name)}catch(i){return Promise.reject(i)}const t=e?.ttl||0;delete e.ttl;const n=Object.assign({max_age:t},e);n.name=this.stream,n.num_replicas=e.replicas??1,n.allow_direct=!0,n.allow_rollup_hdrs=!0,n.discard=Po.New,n.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],e.placement&&(n.placement=e.placement),e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?os.S2:os.None);try{await this.jsm.streams.info(n.name)}catch(i){i.message==="stream not found"&&await this.jsm.streams.add(n)}}static async create(e,t,n={}){const i=await e.jetstreamManager(),a=new $o(t,i,e);return await a.init(n),Promise.resolve(a)}}class jP{js;constructor(e){this.js=e}kv(e,t={}){const n=this.js,{ok:i,min:a}=n.nc.features.get(bt.JS_KV);return i?t.bindOnly?qo.bind(this.js,e,t):qo.create(this.js,e,t):Promise.reject(new Error(`kv is only supported on servers ${a} or better`))}os(e,t={}){if(typeof crypto?.subtle?.digest!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const n=this.js,{ok:i,min:a}=n.nc.features.get(bt.JS_OBJECTSTORE);return i?$o.create(this.js,e,t):Promise.reject(new Error(`objectstore is only supported on servers ${a} or better`))}}class zd extends Mo{consumers;streams;consumerAPI;streamAPI;constructor(e,t){super(e,t),this.consumerAPI=new mc(e,t),this.streamAPI=new Vd(e,t),this.consumers=new Bd(this.consumerAPI),this.streams=new LP(this.streamAPI)}jetstreamManager(e){e===void 0&&(e=this.opts.checkAPI);const t=Object.assign({},this.opts,{checkAPI:e});return this.nc.jetstreamManager(t)}get apiPrefix(){return this.prefix}get views(){return new jP(this)}async publish(e,t=fn,n){n=n||{},n.expect=n.expect||{};const i=n?.headers||ki();n&&(n.msgID&&i.set(ui.MsgIdHdr,n.msgID),n.expect.lastMsgID&&i.set(ui.ExpectedLastMsgIdHdr,n.expect.lastMsgID),n.expect.streamName&&i.set(ui.ExpectedStreamHdr,n.expect.streamName),typeof n.expect.lastSequence=="number"&&i.set(ui.ExpectedLastSeqHdr,`${n.expect.lastSequence}`),typeof n.expect.lastSubjectSequence=="number"&&i.set(ui.ExpectedLastSubjectSequenceHdr,`${n.expect.lastSubjectSequence}`));const a=n.timeout||this.timeout,u={};a&&(u.timeout=a),n&&(u.headers=i);let{retries:c,retry_delay:f}=n;c=c||1,f=f||250;let h;for(let m=0;m<c;m++)try{h=await this.nc.request(e,t,u);break}catch(y){if(y.code==="503"&&m+1<c)await va(f);else throw y}const p=this.parseJsResponse(h);if(p.stream==="")throw Ne.errorForCode(we.JetStreamInvalidAck);return p.duplicate=p.duplicate?p.duplicate:!1,p}async pull(e,t,n=0){$r(e),ba(t);let i=this.timeout;n>i&&(i=n),n=n<0?0:Wt(n);const a={batch:1,no_wait:n===0,expires:n},u=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${e}.${t}`,this.jc.encode(a),{noMux:!0,timeout:i}),c=wa(u);if(c)throw c;return Uo(u,this.timeout)}fetch(e,t,n={}){$r(e),ba(t);let i=null;const a=(n.max_bytes??0)>0;let u=0;const c=a?n.max_bytes:0;let f=null;const h={};if(h.batch=n.batch||1,c){const w=this.nc.features.get(bt.JS_PULL_MAX_BYTES);if(!w.ok)throw new Error(`max_bytes is only supported on servers ${w.min} or better`);h.max_bytes=c}h.no_wait=n.no_wait||!1,h.no_wait&&h.expires&&(h.expires=0);const p=n.expires||0;if(p&&(h.expires=Wt(p)),p===0&&h.no_wait===!1)throw new Error("expires or no_wait is required");const m=n.idle_heartbeat||0;m&&(h.idle_heartbeat=Wt(m),n.delay_heartbeat===!0&&(h.idle_heartbeat=Wt(m*4)));const y=new Sr,g=h.batch;let b=0;y.protocolFilterFn=(w,T=!1)=>Ed(w.msg)?(f?.work(),!1):!0,y.dispatchedFn=w=>{if(w){if(a&&(u+=w.data.length),b++,i&&w.info.pending===0)return;(y.getPending()===1&&w.info.pending===0||g===b||c>0&&u>=c)&&y.stop()}};const k=Ai(this.nc.options.inboxPrefix),_=this.nc.subscribe(k,{max:n.batch,callback:(w,T)=>{w===null&&(w=wa(T)),w!==null?(i&&(i.cancel(),i=null),HI(w)?y.stop(zw(w)===null?void 0:w):y.stop(w)):(f?.work(),y.received++,y.push(Uo(T,this.timeout)))}});return p&&(i=ga(p),i.catch(()=>{_.isClosed()||(_.drain().catch(()=>{}),i=null),f&&f.cancel()})),(async()=>{try{m&&(f=new Od(m,w=>(y.push(()=>{y.err=new Ne(`${Pn.IdleHeartbeatMissed}: ${w}`,we.JetStreamIdleHeartBeat)}),!0)))}catch{}await _.closed,i!==null&&(i.cancel(),i=null),f&&f.cancel(),y.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${e}.${t}`,this.jc.encode(h),{reply:k}),y}async pullSubscribe(e,t=us()){const n=await this._processOptions(e,t);if(n.ordered)throw new Error("pull subscribers cannot be be ordered");if(n.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const i=n.config.ack_policy;if(i===xr.None||i===xr.All)throw new Error("ack policy for pull consumers must be explicit");const a=this._buildTypedSubscriptionOpts(n),u=new VP(this,n.deliver,a);u.info=n;try{await this._maybeCreateConsumer(n)}catch(c){throw u.unsubscribe(),c}return u}async subscribe(e,t=us()){const n=await this._processOptions(e,t);if(!n.isBind&&!n.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const i=this._buildTypedSubscriptionOpts(n),a=new Ww(this,n.deliver,i);a.info=n;try{await this._maybeCreateConsumer(n)}catch(u){throw a.unsubscribe(),u}return a._maybeSetupHbMonitoring(),a}async _processOptions(e,t=us()){const n=mw(t)?t.getOpts():t;if(n.isBind=mw(t)?t.isBind:!1,n.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},n.ordered){if(n.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},n.config.ack_policy!==xr.NotSet&&n.config.ack_policy!==xr.None)throw new Ne("ordered consumer: ack_policy can only be set to 'none'",we.ApiError);if(n.config.durable_name&&n.config.durable_name.length>0)throw new Ne("ordered consumer: durable_name cannot be set",we.ApiError);if(n.config.deliver_subject&&n.config.deliver_subject.length>0)throw new Ne("ordered consumer: deliver_subject cannot be set",we.ApiError);if(n.config.max_deliver!==void 0&&n.config.max_deliver>1)throw new Ne("ordered consumer: max_deliver cannot be set",we.ApiError);if(n.config.deliver_group&&n.config.deliver_group.length>0)throw new Ne("ordered consumer: deliver_group cannot be set",we.ApiError);n.config.deliver_subject=Ai(this.nc.options.inboxPrefix),n.config.ack_policy=xr.None,n.config.max_deliver=1,n.config.flow_control=!0,n.config.idle_heartbeat=n.config.idle_heartbeat||Wt(5e3),n.config.ack_wait=Wt(1320*60*1e3),n.config.mem_storage=!0,n.config.num_replicas=1}if(n.config.ack_policy===xr.NotSet&&(n.config.ack_policy=xr.All),n.api=this,n.config=n.config||{},n.stream=n.stream?n.stream:await this.findStream(e),n.attached=!1,n.config.durable_name)try{const i=await this.consumerAPI.info(n.stream,n.config.durable_name);if(i){if(i.config.filter_subject&&i.config.filter_subject!==e)throw new Error("subject does not match consumer");const a=n.config.deliver_group??"";if(a===""&&i.push_bound===!0)throw new Error("duplicate subscription");const u=i.config.deliver_group??"";if(a!==u)throw u===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${u}'`);n.last=i,n.config=i.config,n.attached=!0,n.config.durable_name||(n.name=i.name)}}catch(i){if(i.code!=="404")throw i}return!n.attached&&n.config.filter_subject===void 0&&n.config.filter_subjects===void 0&&(n.config.filter_subject=e),n.deliver=n.config.deliver_subject||Ai(this.nc.options.inboxPrefix),n}_buildTypedSubscriptionOpts(e){const t={};return t.adapter=WP(e.callbackFn===void 0,this.timeout),t.ingestionFilterFn=zd.ingestionFn(e.ordered),t.protocolFilterFn=(n,i=!1)=>{const a=n;return xd(a.msg)?(i||a.msg.respond(),!1):!0},!e.mack&&e.config.ack_policy!==xr.None&&(t.dispatchedFn=QP),e.callbackFn&&(t.callback=e.callbackFn),t.max=e.max||0,t.queue=e.queue,t}async _maybeCreateConsumer(e){if(e.attached)return;if(e.isBind)throw new Error(`unable to bind - durable consumer ${e.config.durable_name} doesn't exist in ${e.stream}`);e.config=Object.assign({deliver_policy:ir.All,ack_policy:xr.Explicit,ack_wait:Wt(30*1e3),replay_policy:_a.Instant},e.config);const t=await this.consumerAPI.add(e.stream,e.config);if(Array.isArray(e.config.filter_subjects&&!Array.isArray(t.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");e.name=t.name,e.config=t.config,e.last=t}static ingestionFn(e){return(t,n)=>{const i=n;if(!t)return{ingest:!1,protocol:!1};const a=t;if(wa(a.msg)||i.monitor?.work(),Ed(a.msg)){const c=e?i._checkHbOrderConsumer(a.msg):!0;return e||i.info.flow_control.heartbeat_count++,{ingest:c,protocol:!0}}else if(xd(a.msg))return i.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:e?i._checkOrderedConsumer(t):!0,protocol:!1}}}}class Hd{options;protocol;draining;listeners;_services;constructor(e){this.draining=!1,this.options=oP(e),this.listeners=[]}static connect(e={}){return new Promise((t,n)=>{const i=new Hd(e);Sc.connect(i.options,i).then(a=>{i.protocol=a,async function(){for await(const u of a.status())i.listeners.forEach(c=>{c.push(u)})}(),t(i)}).catch(a=>{n(a)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(e,t,n){if(this.isClosed())throw Ne.errorForCode(we.ConnectionClosed);if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw Ne.errorForCode(we.ConnectionDraining);if(e=e||"",e.length===0)throw Ne.errorForCode(we.BadSubject)}publish(e,t,n){this._check(e,!1,!0),this.protocol.publish(e,t,n)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,t={}){this._check(e,!0,!1);const n=new Dw(this.protocol,e,t);return this.protocol.subscribe(n),n}_resub(e,t,n){this._check(t,!0,!1);const i=e;i.max=n,n&&(i.max=n+i.received),this.protocol.resub(i,t)}requestMany(e,t=fn,n={maxWait:1e3,maxMessages:-1}){const i=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(f){return Promise.reject(f)}if(n.strategy=n.strategy||Xn.Timer,n.maxWait=n.maxWait||1e3,n.maxWait<1)return Promise.reject(new Ne("timeout",we.InvalidOption));const a=new Sr;function u(f){a.push(()=>{a.stop(f)})}function c(f,h){f||h===null?u(f===null?void 0:f):a.push(h)}if(n.noMux){const f=i?new Error().stack:null;let h=typeof n.maxMessages=="number"&&n.maxMessages>0?n.maxMessages:-1;const p=this.subscribe(Ai(this.options.inboxPrefix),{callback:(b,k)=>{if(k?.data?.length===0&&k?.headers?.status===we.NoResponders&&(b=Ne.errorForCode(we.NoResponders)),b){f&&(b.stack+=`
|
|
152
|
-
|
|
153
|
-
${f}`),m(b);return}c(null,k),n.strategy===Xn.Count&&(h--,h===0&&m()),n.strategy===Xn.JitterTimer&&(g(),y=setTimeout(()=>{m()},300)),n.strategy===Xn.SentinelMsg&&k&&k.data.length===0&&m()}});p.requestSubject=e,p.closed.then(()=>{u()}).catch(b=>{a.stop(b)});const m=b=>{b&&a.push(()=>{throw b}),g(),p.drain().then(()=>{u()}).catch(k=>{u()})};a.iterClosed.then(()=>{g(),p?.unsubscribe()}).catch(b=>{g(),p?.unsubscribe()});try{this.publish(e,t,{reply:p.getSubject()})}catch(b){m(b)}let y=setTimeout(()=>{m()},n.maxWait);const g=()=>{y&&clearTimeout(y)}}else{const f=n;f.callback=c,a.iterClosed.then(()=>{h.cancel()}).catch(p=>{h.cancel(p)});const h=new hC(this.protocol.muxSubscriptions,e,f);this.protocol.request(h);try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${h.token}`,headers:n.headers})}catch(p){h.cancel(p)}}return Promise.resolve(a)}request(e,t,n={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(a){return Promise.reject(a)}const i=!this.protocol.options.noAsyncTraces;if(n.timeout=n.timeout||1e3,n.timeout<1)return Promise.reject(new Ne("timeout",we.InvalidOption));if(!n.noMux&&n.reply)return Promise.reject(new Ne("reply can only be used with noMux",we.InvalidOption));if(n.noMux){const a=n.reply?n.reply:Ai(this.options.inboxPrefix),u=Vt(),c=i?new Error:null,f=this.subscribe(a,{max:1,timeout:n.timeout,callback:(h,p)=>{h?(c&&h.code!==we.Timeout&&(h.stack+=`
|
|
154
|
-
|
|
155
|
-
${c.stack}`),f.unsubscribe(),u.reject(h)):(h=lw(p),h?(c&&(h.stack+=`
|
|
156
|
-
|
|
157
|
-
${c.stack}`),u.reject(h)):u.resolve(p))}});return f.requestSubject=e,this.protocol.publish(e,t,{reply:a,headers:n.headers}),u}else{const a=new _w(this.protocol.muxSubscriptions,e,n,i);this.protocol.request(a);try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${a.token}`,headers:n.headers})}catch(c){a.cancel(c)}const u=Promise.race([a.timer,a.deferred]);return u.catch(()=>{a.cancel()}),u}}flush(){return this.isClosed()?Promise.reject(Ne.errorForCode(we.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ne.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(we.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Sr;return e.iterClosed.then(()=>{const t=this.listeners.indexOf(e);this.listeners.splice(t,1)}),this.listeners.push(e),e}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((t,n)=>t==="time"?new Date(Date.parse(n)):n)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(e={}){const t=new DP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===we.NoResponders&&(i.code=we.JetStreamNotEnabled),i}return t}jetstream(e={}){return new zd(this,e)}getServerVersion(){const e=this.info;return e?Ds(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ne.errorForCode(we.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new UP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ne.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(we.ConnectionDraining)):this.protocol.reconnect()}}class UP{nc;constructor(e){this.nc=e}add(e){try{return new Lo(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new vP(this.nc,e,t)}}class $P{bucket;sm;prefixLen;constructor(e,t,n){this.bucket=e,this.prefixLen=t,this.sm=n}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(xc)||"PUT"}get length(){const e=this.sm.header.get(Br.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class BP{bucket;key;sm;constructor(e,t,n){this.bucket=e,this.key=t,this.sm=n}get value(){return this.sm.data}get created(){return new Date(_d(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){return this.sm.headers?.get(xc)||"PUT"}get delta(){return this.sm.info.pending}get length(){const e=this.sm.headers?.get(Br.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ww extends yC{js;monitor;constructor(e,t,n){super(e.nc,t,n),this.js=e,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(e){this.sub.info=e}get info(){return this.sub.info}_resetOrderedConsumer(e){if(this.info===null||this.sub.isClosed())return;const t=Ai(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,t);const i=this.info;i.config.name=is.next(),i.ordered_consumer_sequence.delivery_seq=0,i.flow_control.heartbeat_count=0,i.flow_control.fc_count=0,i.flow_control.consumer_restarts++,i.deliver=t,i.config.deliver_subject=t,i.config.deliver_policy=ir.StartSequence,i.config.opt_start_seq=e;const a={};a.stream_name=this.info.stream,a.config=i.config;const u=`${i.api.prefix}.CONSUMER.CREATE.${i.stream}`;this.js._request(u,a,{retries:-1}).then(c=>{const f=c,h=this.sub.info;h.last=f,this.info.config=f.config,this.info.name=f.name}).catch(c=>{const f=new Ne(`unable to recreate ordered consumer ${i.stream} at seq ${e}`,we.RequestError,c);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){const e=this.info?.config?.idle_heartbeat||0;e&&this._setupHbMonitoring(_d(e))}_setupHbMonitoring(e,t=0){const n={cancelAfter:0,maxOut:2};t&&(n.cancelAfter=t);const i=this.sub,a=u=>{const c=YI(409,`${Pn.IdleHeartbeatMissed}: ${u}`,this.sub.subject);if(!this.info?.ordered)this.sub.callback(null,c);else{if(!this.js.nc.protocol.connected)return!1;const h=this.info?.ordered_consumer_sequence?.stream_seq||0;return this._resetOrderedConsumer(h+1),this.monitor?.restart(),!1}return!i.noIterator};this.monitor=new Od(e,a,n)}_checkHbOrderConsumer(e){const t=e.headers.get(Br.ConsumerStalledHdr);t!==""&&this.js.nc.publish(t);const n=parseInt(e.headers.get(Br.LastConsumerSeqHdr),10),i=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,n!==i.delivery_seq&&this._resetOrderedConsumer(i.stream_seq+1),!1}_checkOrderedConsumer(e){const t=this.info.ordered_consumer_sequence,n=e.info.streamSequence,i=e.info.deliverySequence;return i!=t.delivery_seq+1?(this._resetOrderedConsumer(t.stream_seq+1),!1):(t.delivery_seq=i,t.stream_seq=n,!0)}async destroy(){this.isClosed()||await this.drain();const e=this.sub.info,t=e.config.durable_name||e.name,n=`${e.api.prefix}.CONSUMER.DELETE.${e.stream}.${t}`;await e.api._request(n)}async consumerInfo(){const e=this.sub.info,t=e.config.durable_name||e.name,n=`${e.api.prefix}.CONSUMER.INFO.${e.stream}.${t}`,i=await e.api._request(n);return e.last=i,i}}class VP extends Ww{constructor(e,t,n){super(e,t,n)}pull(e={batch:1}){const{stream:t,config:n,name:i}=this.sub.info,a=n.durable_name??i,u={};if(u.batch=e.batch||1,u.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const h=this.js.nc.features.get(bt.JS_PULL_MAX_BYTES);if(!h.ok)throw new Error(`max_bytes is only supported on servers ${h.min} or better`);u.max_bytes=e.max_bytes}let c=0;e.expires&&e.expires>0&&(c=e.expires,u.expires=Wt(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=Wt(f)),f&&c===0)throw new Error("idle_heartbeat requires expires");if(f>c)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),c&&f&&(this.monitor?this.monitor._change(f,c):this._setupHbMonitoring(f,c));const h=this.info.api,p=`${h.prefix}.CONSUMER.MSG.NEXT.${t}.${a}`,m=this.sub.subject;h.nc.publish(p,h.jc.encode(u),{reply:m})}}}function WP(r,e){return r?HP(e):zP(e)}function zP(r){return(e,t)=>e?[e,null]:(e=wa(t),e?[e,null]:[null,Uo(t,r)])}function HP(r){return(e,t)=>{if(e)return[e,null];const n=wa(t);return n!==null?[zw(n),null]:[null,Uo(t,r)]}}function zw(r){if(r!==null)switch(r.code){case we.JetStream404NoMessages:case we.JetStream408RequestTimeout:return null;case we.JetStream409:return KI(r)?r:null;default:return r}return null}function QP(r){r&&r.ack()}function GP(r){const e=r.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const t={};return t.domain=e[2]==="_"?"":e[2],t.account_hash=e[3],t.stream=e[4],t.consumer=e[5],t.deliveryCount=parseInt(e[6],10),t.redeliveryCount=t.deliveryCount,t.redelivered=t.deliveryCount>1,t.streamSequence=parseInt(e[7],10),t.deliverySequence=parseInt(e[8],10),t.timestampNanos=parseInt(e[9],10),t.pending=parseInt(e[10],10),t}class JP{msg;di;didAck;timeout;constructor(e,t){this.msg=e,this.didAck=!1,this.timeout=t}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=GP(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===jo[0]&&e[1]===jo[1]&&e[2]===jo[2]&&e[3]===jo[3]}async ackAck(e){e=e||{},e.timeout=e.timeout||this.timeout;const t=Vt();if(this.didAck)t.resolve(!1);else if(this.didAck=!0,this.msg.reply){const i=this.msg.publisher,a=!i.options?.noAsyncTraces,u=new _w(i.muxSubscriptions,this.msg.reply,{timeout:e.timeout},a);i.request(u);try{i.publish(this.msg.reply,$w,{reply:`${i.muxSubscriptions.baseInbox}${u.token}`})}catch(c){u.cancel(c)}try{await Promise.race([u.timer,u.deferred]),t.resolve(!0)}catch(c){u.cancel(c),t.reject(c)}}else t.resolve(!1);return t}ack(){this.doAck($w)}nak(e){let t=kP;e&&(t=cw().encode(`-NAK ${JSON.stringify({delay:Wt(e)})}`)),this.doAck(t)}working(){this.doAck(jo)}next(e,t={batch:1}){const n={};n.batch=t.batch||1,n.no_wait=t.no_wait||!1,t.expires&&t.expires>0&&(n.expires=Wt(t.expires));const i=Cn().encode(n),a=Ea.concat(IP,PP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=CP;e?.length>0&&(t=cw().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const YP="1.30.3",KP="nats.ws";class ZP{version;lang;closeError;connected;done;socket;options;socketClosed;encrypted;peeked;yields;signal;closedNotification;constructor(){this.version=YP,this.lang=KP,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Vt(),this.closedNotification=Vt()}async connect(e,t){const n=Vt();if(t.tls)return n.reject(new Ne("tls",we.InvalidOption)),n;this.options=t;const i=e.src;if(t.wsFactory){const{socket:a,encrypted:u}=await t.wsFactory(e.src,t);this.socket=a,this.encrypted=u}else this.encrypted=i.indexOf("wss://")===0,this.socket=new WebSocket(i);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=a=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(a.data)),this.peeked){this.signal.resolve();return}const u=Ea.concat(...this.yields),c=SC(u);if(c!==""){const f=lP.exec(c);if(!f){t.debug&&console.error("!!!",fc(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);uP(h,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),n.resolve()}catch(h){n.reject(h);return}}},this.socket.onclose=a=>{if(this.isDiscarded())return;this.socketClosed=!0;let u;this.done||(a.wasClean||(u=new Error(a.reason)),this._closed(u))},this.socket.onerror=a=>{if(this.isDiscarded())return;const u=a,c=new Ne(u.message,we.Unknown,new Error(u.error));n.reject(c)},n}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await va(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}t&&this.closedNotification.resolve(e)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const e=this.yields;this.yields=[];for(let t=0;t<e.length;t++)this.options.debug&&console.info(`> ${fc(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=Vt())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${fc(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${fc(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){this.done=!0;try{this.socket?.close()}catch{}}}function XP(r,e){/^(.*:\/\/)(.*)/.test(r)||(typeof e=="boolean"?r=`${e===!0?"https":"http"}://${r}`:r=`https://${r}`);let n=new URL(r);const i=n.protocol.toLowerCase();i==="ws:"&&(e=!1),i==="wss:"&&(e=!0),i!=="https:"&&i!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),n=new URL(`http://${r}`));let a,u;const c=n.hostname,f=n.pathname,h=n.search||"";switch(i){case"http:":case"ws:":case"nats:":u=n.port||"80",a="ws:";break;case"https:":case"wss:":case"tls:":u=n.port||"443",a="wss:";break;default:u=n.port||e===!0?"443":"80",a=e===!0?"wss:":"ws:";break}return`${a}//${c}:${u}${f}${h}`}function eN(r={}){return gC({defaultPort:443,urlParseFn:XP,factory:()=>new ZP}),Hd.connect(r)}const Hw=["new","last","last_per_subject"],tN=async(r,e)=>(console.info(`Connecting to server ${r}`),await eN({servers:[r],authenticator:nP(new TextEncoder().encode(e))}));async function*rN(r){const e=Cn();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Qw=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},Gw={scada:"mm.0.[location-ref].[machine-ref].[qualifier].[data-category].[metric-key].[message-type]","machine-service":"mm.2.[location-ref].[machine-ref].[service-name].[qualifier].[data-category].[metric-key].[message-type]","edge-service":"mm.3.[location-ref].[edge-ref].[service-name].[data-category].[metric-key].[message-type]","machine-source-service":"mm.4.[location-ref].[machine-ref].[machine-source-ref].[service-name].[data-category].[metric-key].[message-type]",edge:"mm.7.[location-ref].[edge-ref].[data-category].[metric-key].[message-type]"},nN={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},iN=(r,e,t)=>{if(!Gw[r])throw new Error("Unknown stream name");const n=Gw[r].split(".");let i="";return n.forEach((a,u)=>{switch(a){case"[location-ref]":i+="."+e;break;case"[machine-ref]":i+="."+(t?.machineRef||"*");break;case"[qualifier]":i+="."+(t?.qualifier||"0");break;case"[data-category]":i+="."+(nN[t?.dataCategory]||"*");break;case"[metric-key]":i+="."+(t?.metricKey?t?.metricKey.toLowerCase().replace(/[^a-zA-Z0-9_\\-]/gi,"-"):"*");break;case"[message-type]":i+="."+(t?.messageType||"0");break;case"[edge-ref]":i+="."+(t?.edgeRef||"*");break;case"[service-name]":i+="."+(t?.serviceName||"*");break;case"[machine-source-ref]":i+="."+(t?.machineSourceRef||"*");break;default:u>0&&(i+="."),i+=a;break}}),i},sN=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Hw.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Hw.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=Zn(),f=ge.useRef(),h=ge.useRef();return ge.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const m=await tN(u.natsUrl,c.current);f.current=m;const y=iN(e,t,n?.[0]);console.info(`Consuming events from stream ${e} filtering by subject ${y}`);const b=await(await m.jetstream().consumers.get(e,{deliver_policy:i,filterSubjects:y})).consume({max_messages:1e3}),k=rN(b);if(h.current=k,typeof a=="function")for await(const _ of k)a(_)}catch(m){console.error(`Error setting up event stream. ${m}`)}})(),()=>Qw(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Qw(h,f)]},aN=ge.forwardRef(({href:r,asFlyout:e,children:t,...n},i)=>{const{isEmbedded:a}=I0(),{navigateParent:u}=C0();return Bt.jsx("a",{...n,ref:i,href:r,onClick:c=>{!a||c.metaKey||c.ctrlKey||c.shiftKey||(c.preventDefault(),c.stopPropagation(),u(r,{asFlyout:e}))},children:t})});gt.Link=aN,gt.MMProvider=jI,gt.PrivateLayout=Ek,gt._useMMApolloLinkContext=xk,gt.useApiRequest=k0,gt.useAsyncEffect=xo,gt.useAsyncInterval=Eo,gt.useDowntimeQuery=hk,gt.useEventStream=sN,gt.useMMAppCommands=C0,gt.useMMAppContext=gk,gt.useMMAppCustomInputLabel=Sk,gt.useMMAppCustomInputOpen=wk,gt.useMMAppCustomInputSave=_k,gt.useMMAppParams=I0,gt.useMMAppSetClaims=bk,gt.useMMAppSetting=vk,gt.useMMAppTools=yk,gt.useMMAuth=Zn,gt.useMMEmbeddedApp=mk,gt.useMMHash=pk,gt.useMMTemplates=dk,gt.useProductionQuery=lk,gt.useQuantityStream=fk,gt.useSearchParamsState=uk,gt.useThrottleEffect=ck,Object.defineProperty(gt,Symbol.toStringTag,{value:"Module"})});
|