@machinemetrics/mm-react-tools 2.2.0-dev → 3.0.1-beta

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.
@@ -0,0 +1,165 @@
1
+ (function(jt,ve){typeof exports=="object"&&typeof module<"u"?ve(exports,require("react"),require("react-router-dom"),require("styled-components")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom","styled-components"],ve):(jt=typeof globalThis<"u"?globalThis:jt||self,ve(jt["mm-react-tools"]={},jt.React,jt.reactRouterDom,jt.styled))})(this,function(jt,ve,Hn,bp){"use strict";var o2=Object.defineProperty;var u2=(jt,ve,Hn)=>ve in jt?o2(jt,ve,{enumerable:!0,configurable:!0,writable:!0,value:Hn}):jt[ve]=Hn;var E=(jt,ve,Hn)=>u2(jt,typeof ve!="symbol"?ve+"":ve,Hn);function G_(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 di=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wp(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function el(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?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 tl={exports:{}},Ma={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its 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 _p;function J_(){if(_p)return Ma;_p=1;var r=ve,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(c,f,h){var d,y={},g=null,m=null;h!==void 0&&(g=""+h),f.key!==void 0&&(g=""+f.key),f.ref!==void 0&&(m=f.ref);for(d in f)n.call(f,d)&&!a.hasOwnProperty(d)&&(y[d]=f[d]);if(c&&c.defaultProps)for(d in f=c.defaultProps,f)y[d]===void 0&&(y[d]=f[d]);return{$$typeof:e,type:c,key:g,ref:m,props:y,_owner:i.current}}return Ma.Fragment=t,Ma.jsx=u,Ma.jsxs=u,Ma}var La={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its 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 xp;function Y_(){return xp||(xp=1,process.env.NODE_ENV!=="production"&&function(){var r=ve,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),x=Symbol.iterator,T="@@iterator";function w(R){if(R===null||typeof R!="object")return null;var se=x&&R[x]||R[T];return typeof se=="function"?se:null}var S=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function A(R){{for(var se=arguments.length,me=new Array(se>1?se-1:0),ke=1;ke<se;ke++)me[ke-1]=arguments[ke];P("error",R,me)}}function P(R,se,me){{var ke=S.ReactDebugCurrentFrame,Le=ke.getStackAddendum();Le!==""&&(se+="%s",me=me.concat([Le]));var at=me.map(function(nt){return String(nt)});at.unshift("Warning: "+se),Function.prototype.apply.call(console[R],console,at)}}var F=!1,L=!1,$=!1,X=!1,te=!1,he;he=Symbol.for("react.module.reference");function de(R){return!!(typeof R=="string"||typeof R=="function"||R===n||R===a||te||R===i||R===h||R===d||X||R===m||F||L||$||typeof R=="object"&&R!==null&&(R.$$typeof===g||R.$$typeof===y||R.$$typeof===u||R.$$typeof===c||R.$$typeof===f||R.$$typeof===he||R.getModuleId!==void 0))}function Ve(R,se,me){var ke=R.displayName;if(ke)return ke;var Le=se.displayName||se.name||"";return Le!==""?me+"("+Le+")":me}function Ae(R){return R.displayName||"Context"}function je(R){if(R==null)return null;if(typeof R.tag=="number"&&A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case n:return"Fragment";case t:return"Portal";case a:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case d:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var se=R;return Ae(se)+".Consumer";case u:var me=R;return Ae(me._context)+".Provider";case f:return Ve(R,R.render,"ForwardRef");case y:var ke=R.displayName||null;return ke!==null?ke:je(R.type)||"Memo";case g:{var Le=R,at=Le._payload,nt=Le._init;try{return je(nt(at))}catch{return null}}}return null}var Ge=Object.assign,ye=0,Je,ge,ue,Ee,Ne,xe,Xe;function Et(){}Et.__reactDisabledLog=!0;function lt(){{if(ye===0){Je=console.log,ge=console.info,ue=console.warn,Ee=console.error,Ne=console.group,xe=console.groupCollapsed,Xe=console.groupEnd;var R={configurable:!0,enumerable:!0,value:Et,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}ye++}}function It(){{if(ye--,ye===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ge({},R,{value:Je}),info:Ge({},R,{value:ge}),warn:Ge({},R,{value:ue}),error:Ge({},R,{value:Ee}),group:Ge({},R,{value:Ne}),groupCollapsed:Ge({},R,{value:xe}),groupEnd:Ge({},R,{value:Xe})})}ye<0&&A("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var et=S.ReactCurrentDispatcher,Ye;function dt(R,se,me){{if(Ye===void 0)try{throw Error()}catch(Le){var ke=Le.stack.trim().match(/\n( *(at )?)/);Ye=ke&&ke[1]||""}return`
18
+ `+Ye+R}}var Re=!1,bt;{var z=typeof WeakMap=="function"?WeakMap:Map;bt=new z}function Y(R,se){if(!R||Re)return"";{var me=bt.get(R);if(me!==void 0)return me}var ke;Re=!0;var Le=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var at;at=et.current,et.current=null,lt();try{if(se){var nt=function(){throw Error()};if(Object.defineProperty(nt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(nt,[])}catch(D){ke=D}Reflect.construct(R,[],nt)}else{try{nt.call()}catch(D){ke=D}R.call(nt.prototype)}}else{try{throw Error()}catch(D){ke=D}R()}}catch(D){if(D&&ke&&typeof D.stack=="string"){for(var tt=D.stack.split(`
19
+ `),rt=ke.stack.split(`
20
+ `),_t=tt.length-1,b=rt.length-1;_t>=1&&b>=0&&tt[_t]!==rt[b];)b--;for(;_t>=1&&b>=0;_t--,b--)if(tt[_t]!==rt[b]){if(_t!==1||b!==1)do if(_t--,b--,b<0||tt[_t]!==rt[b]){var I=`
21
+ `+tt[_t].replace(" at new "," at ");return R.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",R.displayName)),typeof R=="function"&&bt.set(R,I),I}while(_t>=1&&b>=0);break}}}finally{Re=!1,et.current=at,It(),Error.prepareStackTrace=Le}var k=R?R.displayName||R.name:"",C=k?dt(k):"";return typeof R=="function"&&bt.set(R,C),C}function V(R,se,me){return Y(R,!1)}function G(R){var se=R.prototype;return!!(se&&se.isReactComponent)}function Z(R,se,me){if(R==null)return"";if(typeof R=="function")return Y(R,G(R));if(typeof R=="string")return dt(R);switch(R){case h:return dt("Suspense");case d:return dt("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case f:return V(R.render);case y:return Z(R.type,se,me);case g:{var ke=R,Le=ke._payload,at=ke._init;try{return Z(at(Le),se,me)}catch{}}}return""}var Q=Object.prototype.hasOwnProperty,Te={},ze=S.ReactDebugCurrentFrame;function Ue(R){if(R){var se=R._owner,me=Z(R.type,R._source,se?se.type:null);ze.setExtraStackFrame(me)}else ze.setExtraStackFrame(null)}function ce(R,se,me,ke,Le){{var at=Function.call.bind(Q);for(var nt in R)if(at(R,nt)){var tt=void 0;try{if(typeof R[nt]!="function"){var rt=Error((ke||"React class")+": "+me+" type `"+nt+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[nt]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw rt.name="Invariant Violation",rt}tt=R[nt](se,nt,ke,me,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(_t){tt=_t}tt&&!(tt instanceof Error)&&(Ue(Le),A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ke||"React class",me,nt,typeof tt),Ue(null)),tt instanceof Error&&!(tt.message in Te)&&(Te[tt.message]=!0,Ue(Le),A("Failed %s type: %s",me,tt.message),Ue(null))}}}var be=Array.isArray;function Ze(R){return be(R)}function Ot(R){{var se=typeof Symbol=="function"&&Symbol.toStringTag,me=se&&R[Symbol.toStringTag]||R.constructor.name||"Object";return me}}function wt(R){try{return Gt(R),!1}catch{return!0}}function Gt(R){return""+R}function pt(R){if(wt(R))return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ot(R)),Gt(R)}var Lt=S.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0},Rr,zt,Jt;Jt={};function Zt(R){if(Q.call(R,"ref")){var se=Object.getOwnPropertyDescriptor(R,"ref").get;if(se&&se.isReactWarning)return!1}return R.ref!==void 0}function W(R){if(Q.call(R,"key")){var se=Object.getOwnPropertyDescriptor(R,"key").get;if(se&&se.isReactWarning)return!1}return R.key!==void 0}function H(R,se){if(typeof R.ref=="string"&&Lt.current&&se&&Lt.current.stateNode!==se){var me=je(Lt.current.type);Jt[me]||(A('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',je(Lt.current.type),R.ref),Jt[me]=!0)}}function Be(R,se){{var me=function(){Rr||(Rr=!0,A("%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://reactjs.org/link/special-props)",se))};me.isReactWarning=!0,Object.defineProperty(R,"key",{get:me,configurable:!0})}}function $e(R,se){{var me=function(){zt||(zt=!0,A("%s: `ref` 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://reactjs.org/link/special-props)",se))};me.isReactWarning=!0,Object.defineProperty(R,"ref",{get:me,configurable:!0})}}var Tt=function(R,se,me,ke,Le,at,nt){var tt={$$typeof:e,type:R,key:se,ref:me,props:nt,_owner:at};return tt._store={},Object.defineProperty(tt._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(tt,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.defineProperty(tt,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Le}),Object.freeze&&(Object.freeze(tt.props),Object.freeze(tt)),tt};function Ke(R,se,me,ke,Le){{var at,nt={},tt=null,rt=null;me!==void 0&&(pt(me),tt=""+me),W(se)&&(pt(se.key),tt=""+se.key),Zt(se)&&(rt=se.ref,H(se,Le));for(at in se)Q.call(se,at)&&!rr.hasOwnProperty(at)&&(nt[at]=se[at]);if(R&&R.defaultProps){var _t=R.defaultProps;for(at in _t)nt[at]===void 0&&(nt[at]=_t[at])}if(tt||rt){var b=typeof R=="function"?R.displayName||R.name||"Unknown":R;tt&&Be(nt,b),rt&&$e(nt,b)}return Tt(R,tt,rt,Le,ke,Lt.current,nt)}}var nr=S.ReactCurrentOwner,fr=S.ReactDebugCurrentFrame;function Dt(R){if(R){var se=R._owner,me=Z(R.type,R._source,se?se.type:null);fr.setExtraStackFrame(me)}else fr.setExtraStackFrame(null)}var Ht;Ht=!1;function Ur(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function $r(){{if(nr.current){var R=je(nr.current.type);if(R)return`
22
+
23
+ Check the render method of \``+R+"`."}return""}}function ir(R){return""}var un={};function _r(R){{var se=$r();if(!se){var me=typeof R=="string"?R:R.displayName||R.name;me&&(se=`
24
+
25
+ Check the top-level render call using <`+me+">.")}return se}}function xr(R,se){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var me=_r(se);if(un[me])return;un[me]=!0;var ke="";R&&R._owner&&R._owner!==nr.current&&(ke=" It was passed a child from "+je(R._owner.type)+"."),Dt(R),A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',me,ke),Dt(null)}}function Sr(R,se){{if(typeof R!="object")return;if(Ze(R))for(var me=0;me<R.length;me++){var ke=R[me];Ur(ke)&&xr(ke,se)}else if(Ur(R))R._store&&(R._store.validated=!0);else if(R){var Le=w(R);if(typeof Le=="function"&&Le!==R.entries)for(var at=Le.call(R),nt;!(nt=at.next()).done;)Ur(nt.value)&&xr(nt.value,se)}}}function Or(R){{var se=R.type;if(se==null||typeof se=="string")return;var me;if(typeof se=="function")me=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===f||se.$$typeof===y))me=se.propTypes;else return;if(me){var ke=je(se);ce(me,R.props,"prop",ke,R)}else if(se.PropTypes!==void 0&&!Ht){Ht=!0;var Le=je(se);A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Le||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(R){{for(var se=Object.keys(R.props),me=0;me<se.length;me++){var ke=se[me];if(ke!=="children"&&ke!=="key"){Dt(R),A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),Dt(null);break}}R.ref!==null&&(Dt(R),A("Invalid attribute `ref` supplied to `React.Fragment`."),Dt(null))}}var zr={};function Tr(R,se,me,ke,Le,at){{var nt=de(R);if(!nt){var tt="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(tt+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var rt=ir();rt?tt+=rt:tt+=$r();var _t;R===null?_t="null":Ze(R)?_t="array":R!==void 0&&R.$$typeof===e?(_t="<"+(je(R.type)||"Unknown")+" />",tt=" Did you accidentally export a JSX literal instead of a component?"):_t=typeof R,A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",_t,tt)}var b=Ke(R,se,me,Le,at);if(b==null)return b;if(nt){var I=se.children;if(I!==void 0)if(ke)if(Ze(I)){for(var k=0;k<I.length;k++)Sr(I[k],R);Object.freeze&&Object.freeze(I)}else A("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 Sr(I,R)}if(Q.call(se,"key")){var C=je(R),D=Object.keys(se).filter(function(le){return le!=="key"}),U=D.length>0?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}";if(!zr[C+U]){var ne=D.length>0?"{"+D.join(": ..., ")+": ...}":"{}";A(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,U,C,ne,C),zr[C+U]=!0}}return R===n?ur(b):Or(b),b}}function Er(R,se,me){return Tr(R,se,me,!0)}function Dr(R,se,me){return Tr(R,se,me,!1)}var cn=Dr,Ln=Er;La.Fragment=n,La.jsx=cn,La.jsxs=Ln}()),La}process.env.NODE_ENV==="production"?tl.exports=J_():tl.exports=Y_();var Mr=tl.exports,rl=function(r,e){return rl=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])},rl(r,e)};function kn(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");rl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var j=function(){return j=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},j.apply(this,arguments)};function pn(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 Li(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(d){try{h(n.next(d))}catch(y){u(y)}}function f(d){try{h(n.throw(d))}catch(y){u(y)}}function h(d){d.done?a(d.value):i(d.value).then(c,f)}h((n=n.apply(r,e||[])).next())})}function qi(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,u;return u={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(h){return function(d){return f([h,d])}}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(d){h=[6,d],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Lr(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 nl="Invariant Violation",Sp=Object.setPrototypeOf,K_=Sp===void 0?function(r,e){return r.__proto__=e,r}:Sp,Ep=function(r){kn(e,r);function e(t){t===void 0&&(t=nl);var n=r.call(this,typeof t=="number"?nl+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=nl,K_(n,e.prototype),n}return e}(Error);function ps(r,e){if(!r)throw new Ep(e)}var Jo=["debug","log","warn","error","silent"],il=Jo.indexOf("log");function Yo(r){return function(){if(Jo.indexOf(r)>=il){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=Yo("debug"),r.log=Yo("log"),r.warn=Yo("warn"),r.error=Yo("error")})(ps||(ps={}));function Op(r){var e=Jo[il];return il=Math.max(0,Jo.indexOf(r)),e}var sl="3.10.8";function In(r){try{return r()}catch{}}const al=In(function(){return globalThis})||In(function(){return window})||In(function(){return self})||In(function(){return global})||In(function(){return In.constructor("return this")()});var Tp=new Map;function Ko(r){var e=Tp.get(r)||1;return Tp.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function ol(r,e){e===void 0&&(e=0);var t=Ko("stringifyForDisplay");return JSON.stringify(r,function(n,i){return i===void 0?t:i},e).split(JSON.stringify(t)).join("<undefined>")}function Zo(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=ul(i),e||(e=cl(i,t),t=[])}r.apply(void 0,[e].concat(t))}}var Me=Object.assign(function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];e||ps(e,ul(t,n)||cl(t,n))},{debug:Zo(ps.debug),log:Zo(ps.log),warn:Zo(ps.warn),error:Zo(ps.error)});function Gr(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return new Ep(ul(r,e)||cl(r,e))}var Ap=Symbol.for("ApolloErrorMessageHandler_"+sl);function kp(r){if(typeof r=="string")return r;try{return ol(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function ul(r,e){if(e===void 0&&(e=[]),!!r)return al[Ap]&&al[Ap](r,e.map(kp))}function cl(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:sl,message:r,args:e.map(kp)})))}var Z_=globalThis.__DEV__!==!1;function Xo(r,e){if(!!!r)throw new Error(e)}function X_(r){return typeof r=="object"&&r!==null}function ex(r,e){if(!!!r)throw new Error("Unexpected invariant triggered.")}const tx=/\r\n|[\n\r]/g;function ll(r,e){let t=0,n=1;for(const i of r.body.matchAll(tx)){if(typeof i.index=="number"||ex(!1),i.index>=e)break;t=i.index+i[0].length,n+=1}return{line:n,column:e+1-t}}function rx(r){return Ip(r.source,ll(r.source,r.start))}function Ip(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}
31
+ `,d=n.split(/\r\n|[\n\r]/g),y=d[i];if(y.length>120){const g=Math.floor(f/80),m=f%80,x=[];for(let T=0;T<y.length;T+=80)x.push(y.slice(T,T+80));return h+Pp([[`${u} |`,x[0]],...x.slice(1,g+1).map(T=>["|",T]),["|","^".padStart(m)],["|",x[g+1]]])}return h+Pp([[`${u-1} |`,d[i-1]],[`${u} |`,y],["|","^".padStart(f)],[`${u+1} |`,d[i+1]]])}function Pp(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(`
32
+ `)}function nx(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 fl extends Error{constructor(e,...t){var n,i,a;const{nodes:u,source:c,positions:f,path:h,originalError:d,extensions:y}=nx(t);super(e),this.name="GraphQLError",this.path=h??void 0,this.originalError=d??void 0,this.nodes=Cp(Array.isArray(u)?u:u?[u]:void 0);const g=Cp((n=this.nodes)===null||n===void 0?void 0:n.map(x=>x.loc).filter(x=>x!=null));this.source=c??(g==null||(i=g[0])===null||i===void 0?void 0:i.source),this.positions=f??(g==null?void 0:g.map(x=>x.start)),this.locations=f&&c?f.map(x=>ll(c,x)):g==null?void 0:g.map(x=>ll(x.source,x.start));const m=X_(d==null?void 0:d.extensions)?d==null?void 0:d.extensions:void 0;this.extensions=(a=y??m)!==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}}),d!=null&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,fl):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+=`
33
+
34
+ `+rx(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+=`
35
+
36
+ `+Ip(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 Cp(r){return r===void 0||r.length===0?void 0:r}function Ir(r,e,t){return new fl(`Syntax Error: ${t}`,{source:r,positions:[e]})}class ix{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 Np{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 Rp={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"]},sx=new Set(Object.keys(Rp));function Dp(r){const e=r==null?void 0:r.kind;return typeof e=="string"&&sx.has(e)}var Us;(function(r){r.QUERY="query",r.MUTATION="mutation",r.SUBSCRIPTION="subscription"})(Us||(Us={}));var hl;(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"})(hl||(hl={}));var Ce;(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"})(Ce||(Ce={}));function dl(r){return r===9||r===32}function qa(r){return r>=48&&r<=57}function Fp(r){return r>=97&&r<=122||r>=65&&r<=90}function Mp(r){return Fp(r)||r===95}function ax(r){return Fp(r)||qa(r)||r===95}function ox(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=ux(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 ux(r){let e=0;for(;e<r.length&&dl(r.charCodeAt(e));)++e;return e}function cx(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(m=>m.length===0||dl(m.charCodeAt(0))),u=t.endsWith('\\"""'),c=r.endsWith('"')&&!u,f=r.endsWith("\\"),h=c||f,d=!i||r.length>70||h||a||u;let y="";const g=i&&dl(r.charCodeAt(0));return(d&&!g||a)&&(y+=`
37
+ `),y+=t,(d||h)&&(y+=`
38
+ `),'"""'+y+'"""'}var oe;(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"})(oe||(oe={}));class lx{constructor(e){const t=new Np(oe.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!==oe.EOF)do if(e.next)e=e.next;else{const t=hx(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===oe.COMMENT);return e}}function fx(r){return r===oe.BANG||r===oe.DOLLAR||r===oe.AMP||r===oe.PAREN_L||r===oe.PAREN_R||r===oe.SPREAD||r===oe.COLON||r===oe.EQUALS||r===oe.AT||r===oe.BRACKET_L||r===oe.BRACKET_R||r===oe.BRACE_L||r===oe.PIPE||r===oe.BRACE_R}function $s(r){return r>=0&&r<=55295||r>=57344&&r<=1114111}function eu(r,e){return Lp(r.charCodeAt(e))&&qp(r.charCodeAt(e+1))}function Lp(r){return r>=55296&&r<=56319}function qp(r){return r>=56320&&r<=57343}function ms(r,e){const t=r.source.body.codePointAt(e);if(t===void 0)return oe.EOF;if(t>=32&&t<=126){const n=String.fromCodePoint(t);return n==='"'?`'"'`:`"${n}"`}return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function vr(r,e,t,n,i){const a=r.line,u=1+t-r.lineStart;return new Np(e,t,n,a,u,i)}function hx(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 dx(r,i);case 33:return vr(r,oe.BANG,i,i+1);case 36:return vr(r,oe.DOLLAR,i,i+1);case 38:return vr(r,oe.AMP,i,i+1);case 40:return vr(r,oe.PAREN_L,i,i+1);case 41:return vr(r,oe.PAREN_R,i,i+1);case 46:if(t.charCodeAt(i+1)===46&&t.charCodeAt(i+2)===46)return vr(r,oe.SPREAD,i,i+3);break;case 58:return vr(r,oe.COLON,i,i+1);case 61:return vr(r,oe.EQUALS,i,i+1);case 64:return vr(r,oe.AT,i,i+1);case 91:return vr(r,oe.BRACKET_L,i,i+1);case 93:return vr(r,oe.BRACKET_R,i,i+1);case 123:return vr(r,oe.BRACE_L,i,i+1);case 124:return vr(r,oe.PIPE,i,i+1);case 125:return vr(r,oe.BRACE_R,i,i+1);case 34:return t.charCodeAt(i+1)===34&&t.charCodeAt(i+2)===34?bx(r,i):mx(r,i)}if(qa(a)||a===45)return px(r,i,a);if(Mp(a))return wx(r,i);throw Ir(r.source,i,a===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:$s(a)||eu(t,i)?`Unexpected character: ${ms(r,i)}.`:`Invalid character: ${ms(r,i)}.`)}return vr(r,oe.EOF,n,n)}function dx(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($s(a))++i;else if(eu(t,i))i+=2;else break}return vr(r,oe.COMMENT,e,i,t.slice(e+1,i))}function px(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),qa(a))throw Ir(r.source,i,`Invalid number, unexpected digit after 0: ${ms(r,i)}.`)}else i=pl(r,i,a),a=n.charCodeAt(i);if(a===46&&(u=!0,a=n.charCodeAt(++i),i=pl(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=pl(r,i,a),a=n.charCodeAt(i)),a===46||Mp(a))throw Ir(r.source,i,`Invalid number, expected digit but got: ${ms(r,i)}.`);return vr(r,u?oe.FLOAT:oe.INT,e,i,n.slice(e,i))}function pl(r,e,t){if(!qa(t))throw Ir(r.source,e,`Invalid number, expected digit but got: ${ms(r,e)}.`);const n=r.source.body;let i=e+1;for(;qa(n.charCodeAt(i));)++i;return i}function mx(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),vr(r,oe.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?yx(r,i):gx(r,i):vx(r,i);u+=f.value,i+=f.size,a=i;continue}if(c===10||c===13)break;if($s(c))++i;else if(eu(t,i))i+=2;else throw Ir(r.source,i,`Invalid character within String: ${ms(r,i)}.`)}throw Ir(r.source,i,"Unterminated string.")}function yx(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||!$s(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|ja(a),n<0)break}throw Ir(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+i)}".`)}function gx(r,e){const t=r.source.body,n=jp(t,e+2);if($s(n))return{value:String.fromCodePoint(n),size:6};if(Lp(n)&&t.charCodeAt(e+6)===92&&t.charCodeAt(e+7)===117){const i=jp(t,e+8);if(qp(i))return{value:String.fromCodePoint(n,i),size:12}}throw Ir(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+6)}".`)}function jp(r,e){return ja(r.charCodeAt(e))<<12|ja(r.charCodeAt(e+1))<<8|ja(r.charCodeAt(e+2))<<4|ja(r.charCodeAt(e+3))}function ja(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function vx(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:`
39
+ `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw Ir(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 d=vr(r,oe.BLOCK_STRING,e,a+3,ox(f).join(`
40
+ `));return r.line+=f.length-1,r.lineStart=i,d}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($s(h))++a;else if(eu(t,a))a+=2;else throw Ir(r.source,a,`Invalid character within String: ${ms(r,a)}.`)}throw Ir(r.source,a,"Unterminated string.")}function wx(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(ax(a))++i;else break}return vr(r,oe.NAME,e,i,t.slice(e,i))}const _x=10,Up=2;function ml(r){return tu(r,[])}function tu(r,e){switch(typeof r){case"string":return JSON.stringify(r);case"function":return r.name?`[function ${r.name}]`:"[function]";case"object":return xx(r,e);default:return String(r)}}function xx(r,e){if(r===null)return"null";if(e.includes(r))return"[Circular]";const t=[...e,r];if(Sx(r)){const n=r.toJSON();if(n!==r)return typeof n=="string"?n:tu(n,t)}else if(Array.isArray(r))return Ox(r,t);return Ex(r,t)}function Sx(r){return typeof r.toJSON=="function"}function Ex(r,e){const t=Object.entries(r);return t.length===0?"{}":e.length>Up?"["+Tx(r)+"]":"{ "+t.map(([i,a])=>i+": "+tu(a,e)).join(", ")+" }"}function Ox(r,e){if(r.length===0)return"[]";if(e.length>Up)return"[Array]";const t=Math.min(_x,r.length),n=r.length-t,i=[];for(let a=0;a<t;++a)i.push(tu(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function Tx(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 Ax=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=ml(e);throw new Error(`Cannot use ${i} "${u}" from another module or realm.
41
+
42
+ Ensure that there is only one instance of "graphql" in the node_modules
43
+ directory. If different versions of "graphql" are the dependencies of other
44
+ relied on modules, use "resolutions" to ensure only one version is installed.
45
+
46
+ https://yarnpkg.com/en/docs/selective-version-resolutions
47
+
48
+ Duplicate "graphql" modules cannot be used at the same time since different
49
+ versions may have different capabilities and behavior. The data from one
50
+ version used in the function from another could produce confusing and
51
+ spurious results.`)}}return!1};class $p{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||Xo(!1,`Body must be a string. Received: ${ml(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Xo(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Xo(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function kx(r){return Ax(r,$p)}function Ix(r,e){return new Px(r,e).parseDocument()}let Px=class{constructor(e,t={}){const n=kx(e)?e:new $p(e);this._lexer=new lx(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(oe.NAME);return this.node(e,{kind:Ce.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Ce.DOCUMENT,definitions:this.many(oe.SOF,this.parseDefinition,oe.EOF)})}parseDefinition(){if(this.peek(oe.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===oe.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 Ir(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(oe.BRACE_L))return this.node(e,{kind:Ce.OPERATION_DEFINITION,operation:Us.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(oe.NAME)&&(n=this.parseName()),this.node(e,{kind:Ce.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(oe.NAME);switch(e.value){case"query":return Us.QUERY;case"mutation":return Us.MUTATION;case"subscription":return Us.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(oe.PAREN_L,this.parseVariableDefinition,oe.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Ce.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(oe.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(oe.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(oe.DOLLAR),this.node(e,{kind:Ce.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Ce.SELECTION_SET,selections:this.many(oe.BRACE_L,this.parseSelection,oe.BRACE_R)})}parseSelection(){return this.peek(oe.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(oe.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:Ce.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(oe.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(oe.PAREN_L,t,oe.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:Ce.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(oe.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(oe.NAME)?this.node(e,{kind:Ce.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Ce.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:Ce.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:Ce.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 oe.BRACKET_L:return this.parseList(e);case oe.BRACE_L:return this.parseObject(e);case oe.INT:return this.advanceLexer(),this.node(t,{kind:Ce.INT,value:t.value});case oe.FLOAT:return this.advanceLexer(),this.node(t,{kind:Ce.FLOAT,value:t.value});case oe.STRING:case oe.BLOCK_STRING:return this.parseStringLiteral();case oe.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Ce.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Ce.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Ce.NULL});default:return this.node(t,{kind:Ce.ENUM,value:t.value})}case oe.DOLLAR:if(e)if(this.expectToken(oe.DOLLAR),this._lexer.token.kind===oe.NAME){const n=this._lexer.token.value;throw Ir(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:Ce.STRING,value:e.value,block:e.kind===oe.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Ce.LIST,values:this.any(oe.BRACKET_L,t,oe.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Ce.OBJECT,fields:this.any(oe.BRACE_L,t,oe.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:Ce.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(oe.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(oe.AT),this.node(t,{kind:Ce.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(oe.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(oe.BRACKET_R),t=this.node(e,{kind:Ce.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(oe.BANG)?this.node(e,{kind:Ce.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Ce.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(oe.STRING)||this.peek(oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);return this.node(e,{kind:Ce.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(oe.COLON);const n=this.parseNamedType();return this.node(e,{kind:Ce.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:Ce.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:Ce.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:u})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(oe.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseFieldDefinition,oe.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(oe.COLON);const a=this.parseTypeReference(),u=this.parseConstDirectives();return this.node(e,{kind:Ce.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:u})}parseArgumentDefs(){return this.optionalMany(oe.PAREN_L,this.parseInputValueDef,oe.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(oe.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(oe.EQUALS)&&(a=this.parseConstValueLiteral());const u=this.parseConstDirectives();return this.node(e,{kind:Ce.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:Ce.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:Ce.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(oe.EQUALS)?this.delimitedMany(oe.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:Ce.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(oe.BRACE_L,this.parseEnumValueDefinition,oe.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:Ce.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 Ir(this._lexer.source,this._lexer.token.start,`${ru(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:Ce.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseInputValueDef,oe.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:Ce.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:Ce.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:Ce.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:Ce.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:Ce.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:Ce.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:Ce.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(oe.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const u=this.parseDirectiveLocations();return this.node(e,{kind:Ce.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:u})}parseDirectiveLocations(){return this.delimitedMany(oe.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(hl,t.value))return t;throw this.unexpected(e)}node(e,t){return this._options.noLocation!==!0&&(t.loc=new ix(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 Ir(this._lexer.source,t.start,`Expected ${Bp(e)}, found ${ru(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===oe.NAME&&t.value===e)this.advanceLexer();else throw Ir(this._lexer.source,t.start,`Expected "${e}", found ${ru(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===oe.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return Ir(this._lexer.source,t.start,`Unexpected ${ru(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(e!==void 0&&t.kind!==oe.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Ir(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function ru(r){const e=r.value;return Bp(r.kind)+(e!=null?` "${e}"`:"")}function Bp(r){return fx(r)?`"${r}"`:r}function Cx(r){return`"${r.replace(Nx,Rx)}"`}const Nx=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Rx(r){return Dx[r.charCodeAt(0)]}const Dx=["\\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"],yl=Object.freeze({});function Pn(r,e,t=Rp){const n=new Map;for(const S of Object.values(Ce))n.set(S,Fx(e,S));let i,a=Array.isArray(r),u=[r],c=-1,f=[],h=r,d,y;const g=[],m=[];do{c++;const S=c===u.length,A=S&&f.length!==0;if(S){if(d=m.length===0?void 0:g[g.length-1],h=y,y=m.pop(),A)if(a){h=h.slice();let F=0;for(const[L,$]of f){const X=L-F;$===null?(h.splice(X,1),F++):h[X]=$}}else{h=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));for(const[F,L]of f)h[F]=L}c=i.index,u=i.keys,f=i.edits,a=i.inArray,i=i.prev}else if(y){if(d=a?c:u[c],h=y[d],h==null)continue;g.push(d)}let P;if(!Array.isArray(h)){var x,T;Dp(h)||Xo(!1,`Invalid AST Node: ${ml(h)}.`);const F=S?(x=n.get(h.kind))===null||x===void 0?void 0:x.leave:(T=n.get(h.kind))===null||T===void 0?void 0:T.enter;if(P=F==null?void 0:F.call(e,h,d,y,g,m),P===yl)break;if(P===!1){if(!S){g.pop();continue}}else if(P!==void 0&&(f.push([d,P]),!S))if(Dp(P))h=P;else{g.pop();continue}}if(P===void 0&&A&&f.push([d,h]),S)g.pop();else{var w;i={inArray:a,index:c,keys:u,edits:f,prev:i},a=Array.isArray(h),u=a?h:(w=t[h.kind])!==null&&w!==void 0?w:[],c=-1,f=[],y&&m.push(y),y=h}}while(i!==void 0);return f.length!==0?f[f.length-1][1]:r}function Fx(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 Mx(r){return Pn(r,qx)}const Lx=80,qx={Name:{leave:r=>r.value},Variable:{leave:r=>"$"+r.name},Document:{leave:r=>Fe(r.definitions,`
52
+
53
+ `)},OperationDefinition:{leave(r){const e=gt("(",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+gt(" = ",t)+gt(" ",Fe(n," "))},SelectionSet:{leave:({selections:r})=>Qn(r)},Field:{leave({alias:r,name:e,arguments:t,directives:n,selectionSet:i}){const a=gt("",r,": ")+e;let u=a+gt("(",Fe(t,", "),")");return u.length>Lx&&(u=a+gt(`(
54
+ `,nu(Fe(t,`
55
+ `)),`
56
+ )`)),Fe([u,Fe(n," "),i]," ")}},Argument:{leave:({name:r,value:e})=>r+": "+e},FragmentSpread:{leave:({name:r,directives:e})=>"..."+r+gt(" ",Fe(e," "))},InlineFragment:{leave:({typeCondition:r,directives:e,selectionSet:t})=>Fe(["...",gt("on ",r),Fe(e," "),t]," ")},FragmentDefinition:{leave:({name:r,typeCondition:e,variableDefinitions:t,directives:n,selectionSet:i})=>`fragment ${r}${gt("(",Fe(t,", "),")")} on ${e} ${gt("",Fe(n," ")," ")}`+i},IntValue:{leave:({value:r})=>r},FloatValue:{leave:({value:r})=>r},StringValue:{leave:({value:r,block:e})=>e?cx(r):Cx(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+gt("(",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})=>gt("",r,`
57
+ `)+Fe(["schema",Fe(e," "),Qn(t)]," ")},OperationTypeDefinition:{leave:({operation:r,type:e})=>r+": "+e},ScalarTypeDefinition:{leave:({description:r,name:e,directives:t})=>gt("",r,`
58
+ `)+Fe(["scalar",e,Fe(t," ")]," ")},ObjectTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>gt("",r,`
59
+ `)+Fe(["type",e,gt("implements ",Fe(t," & ")),Fe(n," "),Qn(i)]," ")},FieldDefinition:{leave:({description:r,name:e,arguments:t,type:n,directives:i})=>gt("",r,`
60
+ `)+e+(Vp(t)?gt(`(
61
+ `,nu(Fe(t,`
62
+ `)),`
63
+ )`):gt("(",Fe(t,", "),")"))+": "+n+gt(" ",Fe(i," "))},InputValueDefinition:{leave:({description:r,name:e,type:t,defaultValue:n,directives:i})=>gt("",r,`
64
+ `)+Fe([e+": "+t,gt("= ",n),Fe(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>gt("",r,`
65
+ `)+Fe(["interface",e,gt("implements ",Fe(t," & ")),Fe(n," "),Qn(i)]," ")},UnionTypeDefinition:{leave:({description:r,name:e,directives:t,types:n})=>gt("",r,`
66
+ `)+Fe(["union",e,Fe(t," "),gt("= ",Fe(n," | "))]," ")},EnumTypeDefinition:{leave:({description:r,name:e,directives:t,values:n})=>gt("",r,`
67
+ `)+Fe(["enum",e,Fe(t," "),Qn(n)]," ")},EnumValueDefinition:{leave:({description:r,name:e,directives:t})=>gt("",r,`
68
+ `)+Fe([e,Fe(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:r,name:e,directives:t,fields:n})=>gt("",r,`
69
+ `)+Fe(["input",e,Fe(t," "),Qn(n)]," ")},DirectiveDefinition:{leave:({description:r,name:e,arguments:t,repeatable:n,locations:i})=>gt("",r,`
70
+ `)+"directive @"+e+(Vp(t)?gt(`(
71
+ `,nu(Fe(t,`
72
+ `)),`
73
+ )`):gt("(",Fe(t,", "),")"))+(n?" repeatable":"")+" on "+Fe(i," | ")},SchemaExtension:{leave:({directives:r,operationTypes:e})=>Fe(["extend schema",Fe(r," "),Qn(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,gt("implements ",Fe(e," & ")),Fe(t," "),Qn(n)]," ")},InterfaceTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>Fe(["extend interface",r,gt("implements ",Fe(e," & ")),Fe(t," "),Qn(n)]," ")},UnionTypeExtension:{leave:({name:r,directives:e,types:t})=>Fe(["extend union",r,Fe(e," "),gt("= ",Fe(t," | "))]," ")},EnumTypeExtension:{leave:({name:r,directives:e,values:t})=>Fe(["extend enum",r,Fe(e," "),Qn(t)]," ")},InputObjectTypeExtension:{leave:({name:r,directives:e,fields:t})=>Fe(["extend input",r,Fe(e," "),Qn(t)]," ")}};function Fe(r,e=""){var t;return(t=r==null?void 0:r.filter(n=>n).join(e))!==null&&t!==void 0?t:""}function Qn(r){return gt(`{
74
+ `,nu(Fe(r,`
75
+ `)),`
76
+ }`)}function gt(r,e,t=""){return e!=null&&e!==""?r+e+t:""}function nu(r){return gt(" ",r.replace(/\n/g,`
77
+ `))}function Vp(r){var e;return(e=r==null?void 0:r.some(t=>t.includes(`
78
+ `)))!==null&&e!==void 0?e:!1}function Wp(r){return r.kind===Ce.FIELD||r.kind===Ce.FRAGMENT_SPREAD||r.kind===Ce.INLINE_FRAGMENT}function Bs(r,e){var t=r.directives;return!t||!t.length?!0:Hp(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],Me(u!==void 0,68,i.name.value)):u=a.value.value,i.name.value==="skip"?!u:u})}function jx(r){var e=[];return Pn(r,{Directive:function(t){e.push(t.name.value)}}),e}var Ux=function(r,e){return ji(r,e,!1)},$x=function(r,e){return ji(r,e,!0)};function ji(r,e,t){var n=new Set(r),i=n.size;return Pn(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return yl}}),t?!n.size:n.size<i}function zp(r){return r&&ji(["client","export"],r,!0)}function Bx(r){var e=r.name.value;return e==="skip"||e==="include"}function Hp(r){var e=[];return r&&r.length&&r.forEach(function(t){if(Bx(t)){var n=t.arguments,i=t.name.value;Me(n&&n.length===1,69,i);var a=n[0];Me(a.name&&a.name.value==="if",70,i);var u=a.value;Me(u&&(u.kind==="Variable"||u.kind==="BooleanValue"),71,i),e.push({directive:t,ifArgument:a})}}),e}const Vx=()=>Object.create(null),{forEach:Wx,slice:Qp}=Array.prototype,{hasOwnProperty:zx}=Object.prototype;let Vs=class Q_{constructor(e=!0,t=Vx){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return Wx.call(e,n=>t=t.getChildTrie(n)),zx.call(t,"data")?t.data:t.data=this.makeData(Qp.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(Qp.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 Q_(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&Hx(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}};function Hx(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Gp=In(function(){return navigator.product})=="ReactNative",Ui=typeof WeakMap=="function"&&!(Gp&&!global.HermesInternal),gl=typeof WeakSet=="function",iu=typeof Symbol=="function"&&typeof Symbol.for=="function",Ua=iu&&Symbol.asyncIterator,Jp=typeof In(function(){return window.document.createElement})=="function",Qx=In(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1,Yp=(Jp||Gp)&&!Qx;function Kt(r){return r!==null&&typeof r=="object"}function Kp(r){return r!==null&&typeof r=="object"&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function Zp(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw Gr(72,a.operation,a.name?" named '".concat(a.name.value,"'"):"");a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(Me(n.length===1,73,n.length),t=n[0].name.value);var i=j(j({},r),{definitions:Lr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function $a(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Ba(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 Me(n,74,t),n||null}default:return null}}function Gx(){}class vl{constructor(e=1/0,t=Gx){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 bl(){}const Jx=bl,Yx=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},Kx=typeof WeakMap<"u"?WeakMap:Map,Zx=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:bl,unregister:bl}},Xx=10024;class su{constructor(e=1/0,t=Jx){this.max=e,this.dispose=t,this.map=new Kx,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<Xx;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const u=a.key;delete a.key,a.keyRef=new Yx(u),this.registry.register(u,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new Zx(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 wl=new WeakSet;function Xp(r){r.size<=(r.max||-1)||wl.has(r)||(wl.add(r),setTimeout(function(){r.clean(),wl.delete(r)},100))}var au=function(r,e){var t=new su(r,e);return t.set=function(n,i){var a=su.prototype.set.call(this,n,i);return Xp(this),a},t},em=function(r,e){var t=new vl(r,e);return t.set=function(n,i){var a=vl.prototype.set.call(this,n,i);return Xp(this),a},t},eS=Symbol.for("apollo.cacheSize"),Gn=j({},al[eS]),ys={};function _l(r,e){ys[r]=e}var tS=globalThis.__DEV__!==!1?sS:void 0,rS=globalThis.__DEV__!==!1?aS:void 0,nS=globalThis.__DEV__!==!1?tm:void 0;function iS(){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,Gn[t]||n]}))}function sS(){var r,e,t,n,i;if(globalThis.__DEV__===!1)throw new Error("only supported in development mode");return{limits:iS(),sizes:j({print:(r=ys.print)===null||r===void 0?void 0:r.call(ys),parser:(e=ys.parser)===null||e===void 0?void 0:e.call(ys),canonicalStringify:(t=ys.canonicalStringify)===null||t===void 0?void 0:t.call(ys),links:Sl(this.link),queryManager:{getDocumentInfo:this.queryManager.transformCache.size,documentTransforms:nm(this.queryManager.documentTransform)}},(i=(n=this.cache).getMemoryInternals)===null||i===void 0?void 0:i.call(n))}}function tm(){return{cache:{fragmentQueryDocuments:$i(this.getFragmentDoc)}}}function aS(){var r=this.config.fragments;return j(j({},tm.apply(this)),{addTypenameDocumentTransform:nm(this.addTypenameTransform),inMemoryCache:{executeSelectionSet:$i(this.storeReader.executeSelectionSet),executeSubSelectedArray:$i(this.storeReader.executeSubSelectedArray),maybeBroadcastWatch:$i(this.maybeBroadcastWatch)},fragmentRegistry:{findFragmentSpreads:$i(r==null?void 0:r.findFragmentSpreads),lookup:$i(r==null?void 0:r.lookup),transform:$i(r==null?void 0:r.transform)}})}function oS(r){return!!r&&"dirtyKey"in r}function $i(r){return oS(r)?r.size:void 0}function rm(r){return r!=null}function nm(r){return xl(r).map(function(e){return{cache:e}})}function xl(r){return r?Lr(Lr([$i(r==null?void 0:r.performWork)],xl(r==null?void 0:r.left),!0),xl(r==null?void 0:r.right),!0).filter(rm):[]}function Sl(r){var e;return r?Lr(Lr([(e=r==null?void 0:r.getMemoryInternals)===null||e===void 0?void 0:e.call(r)],Sl(r==null?void 0:r.left),!0),Sl(r==null?void 0:r.right),!0).filter(rm):[]}var pi=Object.assign(function(e){return JSON.stringify(e,uS)},{reset:function(){Ws=new em(Gn.canonicalStringify||1e3)}});globalThis.__DEV__!==!1&&_l("canonicalStringify",function(){return Ws.size});var Ws;pi.reset();function uS(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(cS))return e;var i=JSON.stringify(n),a=Ws.get(i);if(!a){n.sort();var u=JSON.stringify(n);a=Ws.get(u)||n,Ws.set(i,a),Ws.set(u,a)}var c=Object.create(t);return a.forEach(function(f){c[f]=e[f]}),c}}return e}function cS(r,e,t){return e===0||t[e-1]<=r}function Bi(r){return{__ref:String(r)}}function Pt(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function im(r){return Kt(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function lS(r){return r.kind==="StringValue"}function fS(r){return r.kind==="BooleanValue"}function hS(r){return r.kind==="IntValue"}function dS(r){return r.kind==="FloatValue"}function pS(r){return r.kind==="Variable"}function mS(r){return r.kind==="ObjectValue"}function yS(r){return r.kind==="ListValue"}function gS(r){return r.kind==="EnumValue"}function vS(r){return r.kind==="NullValue"}function gs(r,e,t,n){if(hS(t)||dS(t))r[e.value]=Number(t.value);else if(fS(t)||lS(t))r[e.value]=t.value;else if(mS(t)){var i={};t.fields.map(function(u){return gs(i,u.name,u.value,n)}),r[e.value]=i}else if(pS(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(yS(t))r[e.value]=t.values.map(function(u){var c={};return gs(c,e,u,n),c[e.value]});else if(gS(t))r[e.value]=t.value;else if(vS(t))r[e.value]=null;else throw Gr(83,e.value,t.kind)}function sm(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 gs(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 gs(n,a,u,e)})),El(r.name.value,n,t)}var bS=["connection","include","skip","client","rest","export","nonreactive"],Va=pi,El=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(Va(i),")")}else return t.connection.key;var a=r;if(e){var u=Va(e);a+="(".concat(u,")")}return t&&Object.keys(t).forEach(function(c){bS.indexOf(c)===-1&&(t[c]&&Object.keys(t[c]).length?a+="@".concat(c,"(").concat(Va(t[c]),")"):a+="@".concat(c))}),a},{setStringify:function(r){var e=Va;return Va=r,e}});function Wa(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return gs(t,i,a,e)}),t}return null}function mi(r){return r.alias?r.alias.value:r.name.value}function ou(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[mi(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=ou(r,Ba(u,t).selectionSet,t);if(typeof h=="string")return h}}function yi(r){return r.kind==="Field"}function am(r){return r.kind==="InlineFragment"}function vs(r){Me(r&&r.kind==="Document",75);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw Gr(76,t.kind);return t});return Me(e.length<=1,77,e.length),r}function bs(r){return vs(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function uu(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function za(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Ol(r){var e=bs(r);return Me(e&&e.operation==="query",78),e}function om(r){Me(r.kind==="Document",79),Me(r.definitions.length<=1,80);var e=r.definitions[0];return Me(e.kind==="FragmentDefinition",81),e}function Vi(r){vs(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 Gr(82)}function cu(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&gs(e,n.variable.name,n.defaultValue)}),e}const wS=()=>Object.create(null),{forEach:_S,slice:xS}=Array.prototype,{hasOwnProperty:SS}=Object.prototype;class Tl{constructor(e=!0,t=wS){this.weakness=e,this.makeData=t}lookup(...e){return this.lookupArray(e)}lookupArray(e){let t=this;return _S.call(e,n=>t=t.getChildTrie(n)),SS.call(t,"data")?t.data:t.data=this.makeData(xS.call(e))}peek(...e){return this.peekArray(e)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=this.weakness&&um(e[n])?t.weak:t.strong;t=a&&a.get(e[n])}return t&&t.data}getChildTrie(e){const t=this.weakness&&um(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map);let n=t.get(e);return n||t.set(e,n=new Tl(this.weakness,this.makeData)),n}}function um(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}let qr=null;const cm={};let ES=1;const OS=()=>class{constructor(){this.id=["slot",ES++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=qr;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===cm)break;return e!==qr&&(qr.slots[this.id]=t),!0}return qr&&(qr.slots[this.id]=cm),!1}getValue(){if(this.hasValue())return qr.slots[this.id]}withValue(e,t,n,i){const a={__proto__:null,[this.id]:e},u=qr;qr={parent:u,slots:a};try{return t.apply(i,n)}finally{qr=u}}static bind(e){const t=qr;return function(){const n=qr;try{return qr=t,e.apply(this,arguments)}finally{qr=n}}}static noContext(e,t,n){if(qr){const i=qr;try{return qr=null,e.apply(n,t)}finally{qr=i}}else return e.apply(n,t)}};function lm(r){try{return r()}catch{}}const Al="@wry/context:Slot",fm=lm(()=>globalThis)||lm(()=>global)||Object.create(null),hm=fm[Al]||Array[Al]||function(r){try{Object.defineProperty(fm,Al,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(OS()),lu=new hm,{hasOwnProperty:TS}=Object.prototype,kl=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function Il(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const Ha=[],AS=100;function zs(r,e){if(!r)throw new Error(e||"assertion failure")}function dm(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function pm(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function mm(r){return r.slice(0)}class fu{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,++fu.count}peek(){if(this.value.length===1&&!Wi(this))return ym(this),this.value[0]}recompute(e){return zs(!this.recomputing,"already recomputing"),ym(this),Wi(this)?kS(this,e):pm(this.value)}setDirty(){this.dirty||(this.dirty=!0,gm(this),Il(this))}dispose(){this.setDirty(),xm(this),Pl(this,(e,t)=>{e.setDirty(),Sm(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=Ha.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(kl(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),Ha.push(this.deps),this.deps=null)}}fu.count=0;function ym(r){const e=lu.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Wi(r)?bm(e,r):wm(e,r),e}function kS(r,e){return xm(r),lu.withValue(r,IS,[r,e]),CS(r,e)&&PS(r),pm(r.value)}function IS(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=mm(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!dm(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Wi(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function PS(r){r.dirty=!1,!Wi(r)&&vm(r)}function gm(r){Pl(r,bm)}function vm(r){Pl(r,wm)}function Pl(r,e){const t=r.parents.size;if(t){const n=kl(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function bm(r,e){zs(r.childValues.has(e)),zs(Wi(e));const t=!Wi(r);if(!r.dirtyChildren)r.dirtyChildren=Ha.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&gm(r)}function wm(r,e){zs(r.childValues.has(e)),zs(!Wi(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,mm(e.value)):dm(t,e.value)||r.setDirty(),_m(r,e),!Wi(r)&&vm(r)}function _m(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ha.length<AS&&Ha.push(t),r.dirtyChildren=null))}function xm(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{Sm(r,t)}),r.forgetDeps(),zs(r.dirtyChildren===null)}function Sm(r,e){e.parents.delete(r),r.childValues.delete(e),_m(r,e)}function CS(r,e){if(typeof r.subscribe=="function")try{Il(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const NS={setDirty:!0,dispose:!0,forget:!0};function Em(r){const e=new Map;function t(n){const i=lu.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&&TS.call(NS,a)?a:"setDirty";kl(u).forEach(f=>f[c]()),e.delete(i),Il(u)}},t}let Om;function RS(...r){return(Om||(Om=new Tl(typeof WeakMap=="function"))).lookupArray(r)}const Cl=new Set;function Qa(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=RS,normalizeResult:i,subscribe:a,cache:u=vl}=Object.create(null)){const c=typeof u=="function"?new u(e,g=>g.dispose()):u,f=function(){const g=n.apply(null,t?t.apply(null,arguments):arguments);if(g===void 0)return r.apply(null,arguments);let m=c.get(g);m||(c.set(g,m=new fu(r)),m.normalizeResult=i,m.subscribe=a,m.forget=()=>c.delete(g));const x=m.recompute(Array.prototype.slice.call(arguments));return c.set(g,m),Cl.add(c),lu.hasValue()||(Cl.forEach(T=>T.clean()),Cl.clear()),x};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(g){const m=g&&c.get(g);m&&m.setDirty()}f.dirtyKey=h,f.dirty=function(){h(n.apply(null,arguments))};function d(g){const m=g&&c.get(g);if(m)return m.peek()}f.peekKey=d,f.peek=function(){return d(n.apply(null,arguments))};function y(g){return g?c.delete(g):!1}return f.forgetKey=y,f.forget=function(){return y(n.apply(null,arguments))},f.makeCacheKey=n,f.getKey=t?function(){return n.apply(null,t.apply(null,arguments))}:n,Object.freeze(f)}function DS(r){return r}var hu=function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=gl?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(DS,{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 Vs(Ui);this.performWork=Qa(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return Me(Array.isArray(i),67),t.lookupArray(i)},max:Gn["documentTransform.cache"],cache:su})}},r.prototype.performWork=function(e){return vs(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}(),Ga,Hs=Object.assign(function(r){var e=Ga.get(r);return e||(e=Mx(r),Ga.set(r,e)),e},{reset:function(){Ga=new au(Gn.print||2e3)}});Hs.reset(),globalThis.__DEV__!==!1&&_l("print",function(){return Ga?Ga.size:0});var ar=Array.isArray;function mn(r){return Array.isArray(r)&&r.length>0}var Tm={kind:Ce.FIELD,name:{kind:Ce.NAME,value:"__typename"}};function Am(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Ce.FRAGMENT_SPREAD&&Am(e[t.name.value],e)})}function Nl(r){return Am(bs(r)||om(r),$a(za(r)))?null:r}function FS(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 km(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 du(r,e){vs(e);for(var t=km(""),n=km(""),i=function(S){for(var A=0,P=void 0;A<S.length&&(P=S[A]);++A)if(!ar(P)){if(P.kind===Ce.OPERATION_DEFINITION)return t(P.name&&P.name.value);if(P.kind===Ce.FRAGMENT_DEFINITION)return n(P.name.value)}return globalThis.__DEV__!==!1&&Me.error(84),null},a=0,u=e.definitions.length-1;u>=0;--u)e.definitions[u].kind===Ce.OPERATION_DEFINITION&&++a;var c=FS(r),f=function(S){return mn(S)&&S.map(c).some(function(A){return A&&A.remove})},h=new Map,d=!1,y={enter:function(S){if(f(S.directives))return d=!0,null}},g=Pn(e,{Field:y,InlineFragment:y,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(S,A,P,F,L){var $=i(L);$&&$.variables.add(S.name.value)}},FragmentSpread:{enter:function(S,A,P,F,L){if(f(S.directives))return d=!0,null;var $=i(L);$&&$.fragmentSpreads.add(S.name.value)}},FragmentDefinition:{enter:function(S,A,P,F){h.set(JSON.stringify(F),S)},leave:function(S,A,P,F){var L=h.get(JSON.stringify(F));if(S===L)return S;if(a>0&&S.selectionSet.selections.every(function($){return $.kind===Ce.FIELD&&$.name.value==="__typename"}))return n(S.name.value).removed=!0,d=!0,null}},Directive:{leave:function(S){if(c(S))return d=!0,null}}});if(!d)return e;var m=function(S){return S.transitiveVars||(S.transitiveVars=new Set(S.variables),S.removed||S.fragmentSpreads.forEach(function(A){m(n(A)).transitiveVars.forEach(function(P){S.transitiveVars.add(P)})})),S},x=new Set;g.definitions.forEach(function(S){S.kind===Ce.OPERATION_DEFINITION?m(t(S.name&&S.name.value)).fragmentSpreads.forEach(function(A){x.add(A)}):S.kind===Ce.FRAGMENT_DEFINITION&&a===0&&!n(S.name.value).removed&&x.add(S.name.value)}),x.forEach(function(S){m(n(S)).fragmentSpreads.forEach(function(A){x.add(A)})});var T=function(S){return!!(!x.has(S)||n(S).removed)},w={enter:function(S){if(T(S.name.value))return null}};return Nl(Pn(g,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(S){if(S.variableDefinitions){var A=m(t(S.name&&S.name.value)).transitiveVars;if(A.size<S.variableDefinitions.length)return j(j({},S),{variableDefinitions:S.variableDefinitions.filter(function(P){return A.has(P.variable.name.value)})})}}}}))}var pu=Object.assign(function(r){return Pn(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Ce.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 j(j({},e),{selections:Lr(Lr([],i,!0),[Tm],!1)})}}}}}})},{added:function(r){return r===Tm}}),MS={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&&Me.warn(85),e}};function LS(r){return du([MS],vs(r))}function qS(r){return function(t){return r.some(function(n){return t.value&&t.value.kind===Ce.VARIABLE&&t.value.name&&(n.name===t.value.name.value||n.test&&n.test(t))})}}function jS(r,e){var t=qS(r);return Nl(Pn(e,{OperationDefinition:{enter:function(n){return j(j({},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 US(r,e){function t(n){if(r.some(function(i){return i.name===n.name.value}))return null}return Nl(Pn(e,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function Im(r){var e=Vi(r),t=e.operation;if(t==="query")return r;var n=Pn(r,{OperationDefinition:{enter:function(i){return j(j({},i),{operation:"query"})}}});return n}function Rl(r){vs(r);var e=du([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function Dl(r,e){var t;return((t=bs(r))===null||t===void 0?void 0:t.operation)===e}function $S(r){return Dl(r,"mutation")}function BS(r){return Dl(r,"query")}function VS(r){return Dl(r,"subscription")}var WS=Object.prototype.hasOwnProperty;function Ja(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Ya(r)}function Ya(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new gi,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var zS=function(r,e,t){return this.merge(r[t],e[t])},gi=function(){function r(e){e===void 0&&(e=zS),this.reconciler=e,this.isObject=Kt,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 Kt(t)&&Kt(e)?(Object.keys(t).forEach(function(u){if(WS.call(e,u)){var c=e[u];if(t[u]!==c){var f=n.reconciler.apply(n,Lr([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 Kt(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=j({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function HS(r){return r===void 0&&(r=!1),{keyArgs:r,merge:function(e,t){return e?Lr(Lr([],e,!0),t,!0):t}}}function QS(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 GS(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(y){n(i("node",y))&&(a.push(y),y.cursor&&(u=u||y.cursor||"",c=y.cursor||c))}),a.length>1&&u===c&&(u="");var f=e.pageInfo||{},h=f.startCursor,d=f.endCursor;return j(j({},Fl(e)),{edges:a,pageInfo:j(j({},e.pageInfo),{startCursor:h||u,endCursor:d||c})})},merge:function(e,t,n){var i=n.args,a=n.isReference,u=n.readField;if(e||(e=YS()),!t)return e;var c=t.edges?t.edges.map(function(te){return a(te=j({},te))&&(te.cursor=u("cursor",te)),te}):[];if(t.pageInfo){var f=t.pageInfo,h=f.startCursor,d=f.endCursor,y=c[0],g=c[c.length-1];y&&h&&(y.cursor=h),g&&d&&(g.cursor=d);var m=y&&y.cursor;m&&!h&&(t=Ja(t,{pageInfo:{startCursor:m}}));var x=g&&g.cursor;x&&!d&&(t=Ja(t,{pageInfo:{endCursor:x}}))}var T=e.edges,w=[];if(i&&i.after){var S=T.findIndex(function(te){return te.cursor===i.after});S>=0&&(T=T.slice(0,S+1))}else if(i&&i.before){var S=T.findIndex(function(he){return he.cursor===i.before});w=S<0?T:T.slice(S),T=[]}else t.edges&&(T=[]);var A=Lr(Lr(Lr([],T,!0),c,!0),w,!0),P=j(j({},t.pageInfo),e.pageInfo);if(t.pageInfo){var F=t.pageInfo,L=F.hasPreviousPage,$=F.hasNextPage,h=F.startCursor,d=F.endCursor,X=pn(F,["hasPreviousPage","hasNextPage","startCursor","endCursor"]);Object.assign(P,X),T.length||(L!==void 0&&(P.hasPreviousPage=L),h!==void 0&&(P.startCursor=h)),w.length||($!==void 0&&(P.hasNextPage=$),d!==void 0&&(P.endCursor=d))}return j(j(j({},Fl(e)),Fl(t)),{edges:A,pageInfo:P})}}}var Fl=function(r){return pn(r,JS)},JS=["edges","pageInfo"];function YS(){return{edges:[],pageInfo:{hasPreviousPage:!1,hasNextPage:!0,startCursor:"",endCursor:""}}}function KS(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=ZS(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.
79
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZS(r,e){if(r){if(typeof r=="string")return Pm(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 Pm(r,e)}}function Pm(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 Cm(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 Ml(r,e,t){return e&&Cm(r.prototype,e),t&&Cm(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Ll=function(){return typeof Symbol=="function"},ql=function(r){return Ll()&&!!Symbol[r]},jl=function(r){return ql(r)?Symbol[r]:"@@"+r};Ll()&&!ql("observable")&&(Symbol.observable=Symbol("observable"));var XS=jl("iterator"),Ul=jl("observable"),Nm=jl("species");function mu(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Ka(r){var e=r.constructor;return e!==void 0&&(e=e[Nm],e===null&&(e=void 0)),e!==void 0?e:Ct}function eE(r){return r instanceof Ct}function Qs(r){Qs.log?Qs.log(r):setTimeout(function(){throw r})}function yu(r){Promise.resolve().then(function(){try{r()}catch(e){Qs(e)}})}function Rm(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=mu(e,"unsubscribe");t&&t.call(e)}}catch(n){Qs(n)}}function $l(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function tE(r){var e=r._queue;if(e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Dm(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Dm(r,e,t){r._state="running";var n=r._observer;try{var i=mu(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if($l(r),i)i.call(n,t);else throw t;break;case"complete":$l(r),i&&i.call(n);break}}catch(a){Qs(a)}r._state==="closed"?Rm(r):r._state==="running"&&(r._state="ready")}function Bl(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}],yu(function(){return tE(r)});return}Dm(r,e,t)}}var rE=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new nE(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"&&($l(this),Rm(this))},Ml(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),nE=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){Bl(this._subscription,"next",n)},e.error=function(n){Bl(this._subscription,"error",n)},e.complete=function(){Bl(this._subscription,"complete")},Ml(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),Ct=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 rE(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(d){u(d),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=Ka(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=Ka(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=Ka(this),u=arguments.length>1,c=!1,f=arguments[1],h=f;return new a(function(d){return i.subscribe({next:function(y){var g=!c;if(c=!0,!g||u)try{h=n(h,y)}catch(m){return d.error(m)}else h=y},error:function(y){d.error(y)},complete:function(){if(!c&&!u)return d.error(new TypeError("Cannot reduce an empty sequence"));d.next(h),d.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=Ka(this);return new c(function(f){var h,d=0;function y(g){h=g.subscribe({next:function(m){f.next(m)},error:function(m){f.error(m)},complete:function(){d===a.length?(h=void 0,f.complete()):y(c.from(a[d++]))}})}return y(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=Ka(this);return new a(function(u){var c=[],f=i.subscribe({next:function(d){if(n)try{d=n(d)}catch(g){return u.error(g)}var y=a.from(d).subscribe({next:function(g){u.next(g)},error:function(g){u.error(g)},complete:function(){var g=c.indexOf(y);g>=0&&c.splice(g,1),h()}});c.push(y)},error:function(d){u.error(d)},complete:function(){h()}});function h(){f.closed&&c.length===0&&u.complete()}return function(){c.forEach(function(d){return d.unsubscribe()}),f.unsubscribe()}})},e[Ul]=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=mu(n,Ul);if(a){var u=a.call(n);if(Object(u)!==u)throw new TypeError(u+" is not an object");return eE(u)&&u.constructor===i?u:new i(function(c){return u.subscribe(c)})}if(ql("iterator")&&(a=mu(n,XS),a))return new i(function(c){yu(function(){if(!c.closed){for(var f=KS(a.call(n)),h;!(h=f()).done;){var d=h.value;if(c.next(d),c.closed)return}c.complete()}})});if(Array.isArray(n))return new i(function(c){yu(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){yu(function(){if(!c.closed){for(var f=0;f<i.length;++f)if(c.next(i[f]),c.closed)return;c.complete()}})})},Ml(r,null,[{key:Nm,get:function(){return this}}]),r}();Ll()&&Object.defineProperty(Ct,Symbol("extensions"),{value:{symbol:Ul,hostReportError:Qs},configurable:!0});function iE(r){var e=Promise.resolve(r);return e.status="fulfilled",e.value=r,e}function sE(r){var e=Promise.reject(r);return e.catch(function(){}),e.status="rejected",e.reason=r,e}function Fm(r){return"status"in r}function aE(r){if(Fm(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}var oE=Object.prototype.toString;function Vl(r){return Wl(r)}function Wl(r,e){switch(oE.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]=Wl(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]=Wl(r[i],e)}),n}default:return r}}function uE(r){var e=new Set([r]);return e.forEach(function(t){Kt(t)&&cE(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){Kt(t[n])&&e.add(t[n])})}),r}function cE(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 Gs(r){return globalThis.__DEV__!==!1&&uE(r),r}function Js(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function gu(r,e,t){return new Ct(function(n){var i={then:function(f){return new Promise(function(h){return h(f())})}};function a(f,h){return function(d){if(f){var y=function(){return n.closed?0:f(d)};i=i.then(y,y).then(function(g){return n.next(g)},function(g){return n.error(g)})}else n[h](d)}}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 zl(r){function e(t){Object.defineProperty(r,t,{value:Ct})}return iu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Mm(r){return r&&typeof r.then=="function"}var ws=function(r){kn(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),Js(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),Js(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?Mm(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"),Js(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new Ct(t)]),Mm(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}(Ct);zl(ws);function _s(r){return"incremental"in r}function Lm(r){return"hasNext"in r&&"data"in r}function qm(r){return _s(r)||Lm(r)}function jm(r){return Kt(r)&&"payload"in r}function Hl(r,e){var t=r,n=new gi;return _s(e)&&mn(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),d=h?[]:{};d[f]=a,a=d}t=n.merge(t,a)}),t}function Za(r){var e=vu(r);return mn(e)}function vu(r){var e=mn(r.errors)?r.errors.slice(0):[];return _s(r)&&mn(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function zi(){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 Hi(r,e){return zi(r,e,e.variables&&{variables:zi(j(j({},r&&r.variables),e.variables))})}function Um(r,e){return Ql(r,e)}function Ql(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=Ql(u,e,t);n||(n=f!==u),i[c]=f}),n)return i}else if(Kp(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=Ql(r[u],e,t);n||(n=c!==r[u]),a[u]=c}),n)return a}return r}function lE(r){return Um(r,"__typename")}const fE=Object.freeze(Object.defineProperty({__proto__:null,AutoCleanedStrongCache:em,AutoCleanedWeakCache:au,Concast:ws,DEV:Z_,DeepMerger:gi,DocumentTransform:hu,Observable:Ct,addTypenameToDocument:pu,argumentsObjectFromField:Wa,asyncMap:gu,buildQueryFromSelectionSet:Im,cacheSizes:Gn,canUseAsyncIteratorSymbol:Ua,canUseDOM:Jp,canUseLayoutEffect:Yp,canUseSymbol:iu,canUseWeakMap:Ui,canUseWeakSet:gl,canonicalStringify:pi,checkDocument:vs,cloneDeep:Vl,compact:zi,concatPagination:HS,createFragmentMap:$a,createFulfilledPromise:iE,createRejectedPromise:sE,fixObservableSubclass:zl,getDefaultValues:cu,getDirectiveNames:jx,getFragmentDefinition:om,getFragmentDefinitions:za,getFragmentFromSelection:Ba,getFragmentQueryDocument:Zp,getGraphQLErrorsFromResult:vu,getInclusionDirectives:Hp,getMainDefinition:Vi,getOperationDefinition:bs,getOperationName:uu,getQueryDefinition:Ol,getStoreKeyName:El,getTypenameFromResult:ou,graphQLResultHasError:Za,hasAllDirectives:$x,hasAnyDirectives:Ux,hasClientExports:zp,hasDirectives:ji,isApolloPayloadResult:jm,isArray:ar,isDocumentNode:im,isExecutionPatchIncrementalResult:_s,isExecutionPatchInitialResult:Lm,isExecutionPatchResult:qm,isField:yi,isInlineFragment:am,isMutationOperation:$S,isNonEmptyArray:mn,isNonNullObject:Kt,isPlainObject:Kp,isQueryOperation:BS,isReference:Pt,isStatefulPromise:Fm,isSubscriptionOperation:VS,iterateObserversSafely:Js,makeReference:Bi,makeUniqueId:Ko,maybe:In,maybeDeepFreeze:Gs,mergeDeep:Ja,mergeDeepArray:Ya,mergeIncrementalData:Hl,mergeOptions:Hi,offsetLimitPagination:QS,omitDeep:Um,print:Hs,relayStylePagination:GS,removeArgumentsFromDocument:jS,removeClientSetsFromDocument:Rl,removeConnectionDirectiveFromDocument:LS,removeDirectivesFromDocument:du,removeFragmentSpreadFromDocument:US,resultKeyNameFromField:mi,shouldInclude:Bs,storeKeyNameFromField:sm,stringifyForDisplay:ol,stripTypename:lE,valueToObjectRepresentation:gs,wrapPromiseWithState:aE},Symbol.toStringTag,{value:"Module"}));function bu(r){return new Ct(function(e){e.error(r)})}function hE(r){var e=!1;return new Promise(function(t,n){r.subscribe({next:function(i){e?globalThis.__DEV__!==!1&&Me.warn(42):(e=!0,t(i))},error:n})})}function dE(r){return new Ct(function(e){r.then(function(t){e.next(t),e.complete()}).catch(e.error.bind(e))})}var Gl=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 pE(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 Gr(43,i)}return r}function mE(r,e){var t=j({},r),n=function(a){typeof a=="function"?t=j(j({},t),a(t)):t=j(j({},t),a)},i=function(){return j({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function yE(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?uu(e.query)||void 0:""),e}function gE(r,e){var t=j({},r),n=new Set(Object.keys(r));return Pn(e,{Variable:function(i,a,u){u&&u.kind!=="VariableDefinition"&&n.delete(i.name.value)}}),n.forEach(function(i){delete t[i]}),t}function $m(r,e){return e?e(r):Ct.of()}function Xa(r){return typeof r=="function"?new Jr(r):r}function wu(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 Ct.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Xa).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Xa(t),a=Xa(n||new r($m)),u;return wu(i)&&wu(a)?u=new r(function(c){return e(c)?i.request(c)||Ct.of():a.request(c)||Ct.of()}):u=new r(function(c,f){return e(c)?i.request(c,f)||Ct.of():a.request(c,f)||Ct.of()}),Object.assign(u,{left:i,right:a})},r.execute=function(e,t){return e.request(mE(t.context,yE(pE(t))))||Ct.of()},r.concat=function(e,t){var n=Xa(e);if(wu(n))return globalThis.__DEV__!==!1&&Me.warn(35,n),n;var i=Xa(t),a;return wu(i)?a=new r(function(u){return n.request(u,function(c){return i.request(c)||Ct.of()})||Ct.of()}):a=new r(function(u,c){return n.request(u,function(f){return i.request(f,c)||Ct.of()})||Ct.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($m)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw Gr(36)},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}(),vE=Jr.empty,bE=Jr.from,wE=Jr.split,_E=Jr.concat,_u=Jr.execute;function xE(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function SE(r){var e=null,t=null,n=!1,i=[],a=[];function u(y){if(!t){if(a.length){var g=a.shift();if(Array.isArray(g)&&g[0])return g[0]({value:y,done:!1})}i.push(y)}}function c(y){t=y;var g=a.slice();g.forEach(function(m){m[1](y)}),!e||e()}function f(){n=!0;var y=a.slice();y.forEach(function(g){g[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(y,g){if(t)return g(t);if(i.length)return y({value:i.shift(),done:!1});if(n)return y({value:void 0,done:!0});a.push([y,g])})}var d={next:function(){return h()}};return Ua&&(d[Symbol.asyncIterator]=function(){return this}),d}function EE(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 Ua&&(t[Symbol.asyncIterator]=function(){return this}),t}function Bm(r){var e={next:function(){return r.read()}};return Ua&&(e[Symbol.asyncIterator]=function(){return this}),e}function OE(r){return!!r.body}function TE(r){return!!r.getReader}function AE(r){return!!(Ua&&r[Symbol.asyncIterator])}function kE(r){return!!r.stream}function IE(r){return!!r.arrayBuffer}function PE(r){return!!r.pipe}function CE(r){var e=r;if(OE(r)&&(e=r.body),AE(e))return xE(e);if(TE(e))return Bm(e.getReader());if(kE(e))return Bm(e.stream().getReader());if(IE(e))return EE(e.arrayBuffer());if(PE(e))return SE(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Jl=Symbol();function NE(r){return r.extensions?Array.isArray(r.extensions[Jl]):!1}function Vm(r){return r.hasOwnProperty("graphQLErrors")}var RE=function(r){var e=Lr(Lr(Lr([],r.graphQLErrors,!0),r.clientErrors,!0),r.protocolErrors,!0);return r.networkError&&e.push(r.networkError),e.map(function(t){return Kt(t)&&t.message||"Error message not found."}).join(`
80
+ `)},oi=function(r){kn(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||RE(h),h.extraInfo=f,h.__proto__=e.prototype,h}return e}(Error),Wm=Object.prototype.hasOwnProperty;function DE(r,e){return Li(this,void 0,void 0,function(){var t,n,i,a,u,c,f,h,d,y,g,m,x,T,w,S,A,P,F,L,$,X,te,he;return qi(this,function(de){switch(de.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=(he=r.headers)===null||he===void 0?void 0:he.get("content-type"),i="boundary=",a=n!=null&&n.includes(i)?n==null?void 0:n.substring((n==null?void 0:n.indexOf(i))+i.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u=`\r
81
+ --`.concat(a),c="",f=CE(r),h=!0,de.label=1;case 1:return h?[4,f.next()]:[3,3];case 2:for(d=de.sent(),y=d.value,g=d.done,m=typeof y=="string"?y:t.decode(y),x=c.length-u.length+1,h=!g,c+=m,T=c.indexOf(u,x);T>-1;){if(w=void 0,X=[c.slice(0,T),c.slice(T+u.length)],w=X[0],c=X[1],S=w.indexOf(`\r
82
+ \r
83
+ `),A=FE(w.slice(0,S)),P=A["content-type"],P&&P.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");if(F=w.slice(S),F){if(L=zm(r,F),Object.keys(L).length>1||"data"in L||"incremental"in L||"errors"in L||"payload"in L)if(jm(L)){if($={},"payload"in L){if(Object.keys(L).length===1&&L.payload===null)return[2];$=j({},L.payload)}"errors"in L&&($=j(j({},$),{extensions:j(j({},"extensions"in $?$.extensions:null),(te={},te[Jl]=L.errors,te))})),e($)}else e(L);else if(Object.keys(L).length===1&&"hasNext"in L&&!L.hasNext)return[2]}T=c.indexOf(u)}return[3,1];case 3:return[2]}})})}function FE(r){var e={};return r.split(`
84
+ `).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 zm(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Gl(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 ME(r,e){r.result&&r.result.errors&&r.result.data&&e.next(r.result),e.error(r)}function Hm(r){return function(e){return e.text().then(function(t){return zm(e,t)}).then(function(t){return!Array.isArray(t)&&!Wm.call(t,"data")&&!Wm.call(t,"errors")&&Gl(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var xu=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=Gr(39,e,i.message);throw n.parseError=i,n}return t},LE={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},qE={accept:"*/*","content-type":"application/json"},jE={method:"POST"},Qm={http:LE,headers:qE,options:jE},Yl=function(r,e){return e(r)};function UE(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return t.unshift(e),Kl.apply(void 0,Lr([r,Yl],t,!1))}function Kl(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(y){i=j(j(j({},i),y.options),{headers:j(j({},i.headers),y.headers)}),y.credentials&&(i.credentials=y.credentials),a=j(j({},a),y.http)}),i.headers&&(i.headers=$E(i.headers,a.preserveHeaderCase));var u=r.operationName,c=r.extensions,f=r.variables,h=r.query,d={operationName:u,variables:f};return a.includeExtensions&&(d.extensions=c),a.includeQuery&&(d.query=e(h,Hs)),{options:i,body:d}}function $E(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var n=Object.create(null);Object.keys(Object(r)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:r[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var Gm=function(r){if(!r&&typeof fetch>"u")throw Gr(37)},BE=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}},Jm=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function Ym(r,e){var t=[],n=function(y,g){t.push("".concat(y,"=").concat(encodeURIComponent(g)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=xu(e.variables,"Variables map")}catch(y){return{parseError:y}}n("variables",i)}if(e.extensions){var a=void 0;try{a=xu(e.extensions,"Extensions map")}catch(y){return{parseError:y}}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?"?":"&",d=c+h+t.join("&")+u;return{newURI:d}}var Km=In(function(){return fetch}),Zl=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?Yl:i,u=r.includeExtensions,c=r.preserveHeaderCase,f=r.useGETForQueries,h=r.includeUnusedVariables,d=h===void 0?!1:h,y=pn(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);globalThis.__DEV__!==!1&&Gm(n||Km);var g={http:{includeExtensions:u,preserveHeaderCase:c},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new Jr(function(m){var x=Jm(m,t),T=m.getContext(),w={};if(T.clientAwareness){var S=T.clientAwareness,A=S.name,P=S.version;A&&(w["apollographql-client-name"]=A),P&&(w["apollographql-client-version"]=P)}var F=j(j({},w),T.headers),L={http:T.http,options:T.fetchOptions,credentials:T.credentials,headers:F};if(ji(["client"],m.query)){var $=Rl(m.query);if(!$)return bu(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`."));m.query=$}var X=Kl(m,a,Qm,g,L),te=X.options,he=X.body;he.variables&&!d&&(he.variables=gE(he.variables,m.query));var de;!te.signal&&typeof AbortController<"u"&&(de=new AbortController,te.signal=de.signal);var Ve=function(Ee){return Ee.kind==="OperationDefinition"&&Ee.operation==="mutation"},Ae=function(Ee){return Ee.kind==="OperationDefinition"&&Ee.operation==="subscription"},je=Ae(Vi(m.query)),Ge=ji(["defer"],m.query);if(f&&!m.query.definitions.some(Ve)&&(te.method="GET"),Ge||je){te.headers=te.headers||{};var ye="multipart/mixed;";je&&Ge&&globalThis.__DEV__!==!1&&Me.warn(38),je?ye+="boundary=graphql;subscriptionSpec=1.0,application/json":Ge&&(ye+="deferSpec=20220824,application/json"),te.headers.accept=ye}if(te.method==="GET"){var Je=Ym(x,he),ge=Je.newURI,ue=Je.parseError;if(ue)return bu(ue);x=ge}else try{te.body=xu(he,"Payload")}catch(Ee){return bu(Ee)}return new Ct(function(Ee){var Ne=n||In(function(){return fetch})||Km,xe=Ee.next.bind(Ee);return Ne(x,te).then(function(Xe){var Et;m.setContext({response:Xe});var lt=(Et=Xe.headers)===null||Et===void 0?void 0:Et.get("content-type");return lt!==null&&/^multipart\/mixed/i.test(lt)?DE(Xe,xe):Hm(m)(Xe).then(xe)}).then(function(){de=void 0,Ee.complete()}).catch(function(Xe){de=void 0,ME(Xe,Ee)}),function(){de&&de.abort()}})})},Zm=function(r){kn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,Zl(t).request)||this;return n.options=t,n}return e}(Jr);const{toString:Xm,hasOwnProperty:VE}=Object.prototype,ey=Function.prototype.toString,Xl=new Map;function Ut(r,e){try{return ef(r,e)}finally{Xl.clear()}}function ef(r,e){if(r===e)return!0;const t=Xm.call(r),n=Xm.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(ry(r,e))return!0;const i=ty(r),a=ty(e),u=i.length;if(u!==a.length)return!1;for(let c=0;c<u;++c)if(!VE.call(e,i[c]))return!1;for(let c=0;c<u;++c){const f=i[c];if(!ef(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(ry(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&&!ef(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=ey.call(r);return i!==ey.call(e)?!1:!HE(i,zE)}}return!1}function ty(r){return Object.keys(r).filter(WE,r)}function WE(r){return this[r]!==void 0}const zE="{ [native code] }";function HE(r,e){const t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function ry(r,e){let t=Xl.get(r);if(t){if(t.has(e))return!0}else Xl.set(r,t=new Set);return t.add(e),!1}function ny(r,e,t,n){var i=e.data,a=pn(e,["data"]),u=t.data,c=pn(t,["data"]);return Ut(a,c)&&Su(Vi(r).selectionSet,i,u,{fragmentMap:$a(za(r)),variables:n})}function Su(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),!Bs(a,n.variables))||iy(a))return!0;if(yi(a)){var u=mi(a),c=e&&e[u],f=t&&t[u],h=a.selectionSet;if(!h)return Ut(c,f);var d=Array.isArray(c),y=Array.isArray(f);if(d!==y)return!1;if(d&&y){var g=c.length;if(f.length!==g)return!1;for(var m=0;m<g;++m)if(!Su(h,c[m],f[m],n))return!1;return!0}return Su(h,c,f,n)}else{var x=Ba(a,n.fragmentMap);if(x)return iy(x)?!0:Su(x.selectionSet,e,t,n)}})}function iy(r){return!!r.directives&&r.directives.some(QE)}function QE(r){return r.name.value==="nonreactive"}var tf=function(){function r(){this.assumeImmutableResults=!1,this.getFragmentDoc=Qa(Zp,{max:Gn["cache.fragmentQueryDocuments"]||1e3,cache:su})}return 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(j(j({},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=this.getFragmentDoc(n,i),h={returnPartialData:!0,id:typeof a=="string"?a:this.identify(a),query:f,optimistic:c},d;return new Ct(function(y){return t.watch(j(j({},h),{immediate:!0,callback:function(g){if(!(d&&ny(f,{data:d==null?void 0:d.result},{data:g.result}))){var m={data:g.result,complete:!!g.complete};g.missing&&(m.missing=Ya(g.missing.map(function(x){return x.missing}))),d=g,y.next(m)}}}))})},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(j(j({},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=pn(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=pn(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(j(j({},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(j(j({},e),{data:a})),a)}})},r}();globalThis.__DEV__!==!1&&(tf.prototype.getMemoryInternals=nS);var rf;rf||(rf={});var nf=function(r){kn(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),Pr=Object.prototype.hasOwnProperty;function eo(r){return r==null}function sf(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=eo(n)?eo(i)?void 0:{_id:i}:{id:n}),eo(n)&&!eo(i)&&(n=i),!eo(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var sy={dataIdFromObject:sf,addTypename:!0,resultCaching:!0,canonizeResults:!1};function GE(r){return zi(sy,r)}function ay(r){var e=r.canonizeResults;return e===void 0?sy.canonizeResults:e}function JE(r,e){return Pt(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var oy=/^[_a-z][_0-9a-z]*/i;function Qi(r){var e=r.match(oy);return e?e[0]:r}function af(r,e,t){return Kt(e)?ar(e)?e.every(function(n){return af(r,n,t)}):r.selections.every(function(n){if(yi(n)&&Bs(n,t)){var i=mi(n);return Pr.call(e,i)&&(!n.selectionSet||af(n.selectionSet,e[i],t))}return!0}):!1}function Ys(r){return Kt(r)&&!Pt(r)&&!ar(r)}function YE(){return new gi}function uy(r,e){var t=$a(za(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Eu=Object.create(null),of=function(){return Eu},cy=Object.create(null),to=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 Gs(Pt(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return Pt(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Bi(i);if(Pt(i))return i;var u=n.policies.identify(i)[0];if(u){var c=Bi(u);return a&&n.merge(u,i),c}}}return r.prototype.toObject=function(){return j({},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),Pr.call(this.data,e)){var n=this.data[e];if(n&&Pr.call(n,t))return n[t]}if(t==="__typename"&&Pr.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Gi)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Pr.call(this.data,e))return this.data[e];if(this instanceof Gi)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;Pt(e)&&(e=e.__ref),Pt(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){Me(typeof i=="string",1);var c=new gi(ZE).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 d=Qi(h);d!==h&&!n.policies.hasKeyArgs(c.__typename,d)&&(f[d]=1),c[h]===void 0&&!(n instanceof Gi)&&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:Eu,INVALIDATE:cy,isReference:Pt,toReference:this.toReference,canRead:this.canRead,readField:function(h,d){return n.policies.readField(typeof h=="string"?{fieldName:h,from:d||Bi(e)}:h,{store:n})}};if(Object.keys(i).forEach(function(h){var d=Qi(h),y=i[h];if(y!==void 0){var g=typeof t=="function"?t:t[h]||t[d];if(g){var m=g===of?Eu:g(Gs(y),j(j({},f),{fieldName:d,storeFieldName:h,storage:n.getStorage(e,h)}));if(m===cy)n.group.dirty(e,h);else if(m===Eu&&(m=void 0),m!==y&&(a[h]=m,u=!0,y=m,globalThis.__DEV__!==!1)){var x=function(L){if(n.lookup(L.__ref)===void 0)return globalThis.__DEV__!==!1&&Me.warn(2,L),!0};if(Pt(m))x(m);else if(Array.isArray(m))for(var T=!1,w=void 0,S=0,A=m;S<A.length;S++){var P=A[S];if(Pt(P)){if(T=!0,x(P))break}else if(typeof P=="object"&&P){var F=n.policies.identify(P)[0];F&&(w=P)}if(T&&w!==void 0){globalThis.__DEV__!==!1&&Me.warn(3,w);break}}}}y!==void 0&&(c=!1)}}),u)return this.merge(e,a),c&&(this instanceof Gi?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]=of,i):of)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(Pr.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Gi&&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){Pr.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&&Pr.call(e,a)||t.delete(a)}),e){var n=e.__META,i=pn(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 Gi?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){Pr.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 Gi;)a=a.parent;i.forEach(function(u){return a.delete(u)})}return i},r.prototype.findChildRefIds=function(e){if(!Pr.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){Pt(a)&&(t[a.__ref]=!0),Kt(a)&&Object.keys(a).forEach(function(u){var c=a[u];Kt(c)&&i.add(c)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}(),ly=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?Em():null,this.keyMaker=new Vs(Ui)},r.prototype.depend=function(e,t){if(this.d){this.d(uf(e,t));var n=Qi(t);n!==t&&this.d(uf(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(uf(e,t),t==="__exists"?"forget":"setDirty")},r}();function uf(r,e){return e+"#"+r}function fy(r,e){ro(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){kn(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 ly(c))||this;return h.stump=new KE(h),h.storageTrie=new Vs(Ui),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})(to||(to={}));var Gi=function(r){kn(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){Ut(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 j(j({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return Pr.call(this.data,t)?j(j({},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}(to),KE=function(r){kn(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new ly(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}(Gi);function ZE(r,e,t){var n=r[t],i=e[t];return Ut(n,i)?n:i}function ro(r){return!!(r instanceof to&&r.group.caching)}function XE(r){return Kt(r)?ar(r)?r.slice(0):j({__proto__:Object.getPrototypeOf(r)},r):r}var hy=function(){function r(){this.known=new(gl?WeakSet:Set),this.pool=new Vs(Ui),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return Kt(e)&&this.known.has(e)},r.prototype.pass=function(e){if(Kt(e)){var t=XE(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(Kt(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 d=f.length;h.sorted.forEach(function(m){f.push(t.admit(e[m]))});var u=this.pool.lookupArray(f);if(!u.object){var y=u.object=Object.create(c);this.known.add(y),h.sorted.forEach(function(m,x){y[m]=f[d+x]}),globalThis.__DEV__!==!1&&Object.freeze(y)}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 dy(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var eO=function(){function r(e){var t=this;this.knownResults=new(Ui?WeakMap:Map),this.config=zi(e,{addTypename:e.addTypename!==!1,canonizeResults:ay(e)}),this.canon=e.canon||new hy,this.executeSelectionSet=Qa(function(n){var i,a=n.context.canonizeResults,u=dy(n);u[3]=!a;var c=(i=t.executeSelectionSet).peek.apply(i,u);return c?a?j(j({},c),{result:t.canon.admit(c.result)}):c:(fy(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize||Gn["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:dy,makeCacheKey:function(n,i,a,u){if(ro(a.store))return a.store.makeCacheKey(n,Pt(i)?i.__ref:i,a.varString,u)}}),this.executeSubSelectedArray=Qa(function(n){return fy(n.context.store,n.enclosingRef.__ref),t.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize||Gn["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(n){var i=n.field,a=n.array,u=n.context;if(ro(u.store))return u.store.makeCacheKey(i,a,u.varString)}})}return r.prototype.resetCanon=function(){this.canon=new hy},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,d=h===void 0?this.config.canonizeResults:h,y=this.config.cache.policies;u=j(j({},cu(Ol(n))),u);var g=Bi(a),m=this.executeSelectionSet({selectionSet:Vi(n).selectionSet,objectOrReference:g,enclosingRef:g,context:j({store:t,query:n,policies:y,variables:u,varString:pi(u),canonizeResults:d},uy(n,this.config.fragments))}),x;if(m.missing&&(x=[new nf(tO(m.missing),m.missing,n,u)],!f))throw x[0];return{result:m.result,complete:!x,missing:x}},r.prototype.isFresh=function(e,t,n,i){if(ro(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(Pt(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,d=h.getFieldValue(i,"__typename"),y=[],g,m=new gi;this.config.addTypename&&typeof d=="string"&&!f.rootIdsByTypename[d]&&y.push({__typename:d});function x(P,F){var L;return P.missing&&(g=m.merge(g,(L={},L[F]=P.missing,L))),P.result}var T=new Set(n.selections);T.forEach(function(P){var F,L;if(Bs(P,c))if(yi(P)){var $=f.readField({fieldName:P.name.value,field:P,variables:u.variables,from:i},u),X=mi(P);$===void 0?pu.added(P)||(g=m.merge(g,(F={},F[X]="Can't find field '".concat(P.name.value,"' on ").concat(Pt(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),F))):ar($)?$.length>0&&($=x(t.executeSubSelectedArray({field:P,array:$,enclosingRef:a,context:u}),X)):P.selectionSet?$!=null&&($=x(t.executeSelectionSet({selectionSet:P.selectionSet,objectOrReference:$,enclosingRef:Pt($)?$:a,context:u}),X)):u.canonizeResults&&($=t.canon.pass($)),$!==void 0&&y.push((L={},L[X]=$,L))}else{var te=Ba(P,u.lookupFragment);if(!te&&P.kind===Ce.FRAGMENT_SPREAD)throw Gr(9,P.name.value);te&&f.fragmentMatches(te,d)&&te.selectionSet.selections.forEach(T.add,T)}});var w=Ya(y),S={result:w,missing:g},A=u.canonizeResults?this.canon.admit(S):Gs(S);return A.result&&this.knownResults.set(A.result,n),A},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,u=e.context,c,f=new gi;function h(d,y){var g;return d.missing&&(c=f.merge(c,(g={},g[y]=d.missing,g))),d.result}return n.selectionSet&&(i=i.filter(u.store.canRead)),i=i.map(function(d,y){return d===null?null:ar(d)?h(t.executeSubSelectedArray({field:n,array:d,enclosingRef:a,context:u}),y):n.selectionSet?h(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:d,enclosingRef:Pt(d)?d:a,context:u}),y):(globalThis.__DEV__!==!1&&rO(u.store,n,d),d)}),{result:u.canonizeResults?this.canon.admit(i):i,missing:c}},r}();function tO(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function rO(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){Kt(i)&&(Me(!Pt(i),10,JE(r,i),e.name.value),Object.values(i).forEach(n.add,n))})}}var cf=new hm,py=new WeakMap;function no(r){var e=py.get(r);return e||py.set(r,e={vars:new Set,dep:Em()}),e}function my(r){no(r).vars.forEach(function(e){return e.forgetCache(r)})}function nO(r){no(r).vars.forEach(function(e){return e.attachCache(r)})}function yy(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(f){no(f).dep.dirty(n),iO(f)});var u=Array.from(t);t.clear(),u.forEach(function(f){return f(r)})}}else{var c=cf.getValue();c&&(i(c),no(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),no(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function iO(r){r.broadcastWatches&&r.broadcastWatches()}var gy=Object.create(null);function lf(r){var e=JSON.stringify(r);return gy[e]||(gy[e]=Object.create(null))}function vy(r){var e=lf(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(u,c){return n.readField(c,u)},a=n.keyObject=ff(r,function(u){var c=Ks(n.storeObject,u,i);return c===void 0&&t!==n.storeObject&&Pr.call(t,u[0])&&(c=Ks(t,u,_y)),Me(c!==void 0,4,u.join("."),t),c});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function by(r){var e=lf(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,u=n.fieldName,c=ff(r,function(h){var d=h[0],y=d.charAt(0);if(y==="@"){if(i&&mn(i.directives)){var g=d.slice(1),m=i.directives.find(function(S){return S.name.value===g}),x=m&&Wa(m,a);return x&&Ks(x,h.slice(1))}return}if(y==="$"){var T=d.slice(1);if(a&&Pr.call(a,T)){var w=h.slice(0);return w[0]=T,Ks(a,w)}return}if(t)return Ks(t,h)}),f=JSON.stringify(c);return(t||f!=="{}")&&(u+=":"+f),u})}function ff(r,e){var t=new gi;return wy(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 wy(r){var e=lf(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ar(i)?(wy(i).forEach(function(u){return t.push(n.concat(u))}),n.length=0):(n.push(i),ar(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function _y(r,e){return r[e]}function Ks(r,e,t){return t=t||_y,xy(e.reduce(function n(i,a){return ar(i)?i.map(function(u){return n(u,a)}):i&&t(i,a)},r))}function xy(r){return Kt(r)?ar(r)?r.map(xy):ff(Object.keys(r).sort(),function(e){return Ks(r,e)}):r}function hf(r){return r.args!==void 0?r.args:r.field?Wa(r.field,r.variables):null}var sO=function(){},Sy=function(r,e){return e.fieldName},Ey=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Oy=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=j({dataIdFromObject:sf},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"];for(var u=t&&t.storeObject||e,c=j(j({},t),{typename:a,storeObject:u,readField:t&&t.readField||function(){var g=df(arguments,u);return i.readField(g,{store:i.cache.data,variables:g.variables})}}),f,h=a&&this.getTypePolicy(a),d=h&&h.keyFn||this.config.dataIdFromObject;d;){var y=d(j(j({},e),u),c);if(ar(y))d=vy(y);else{f=y;break}}return 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=pn(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),u&&t.setRootTypename("Mutation",n),c&&t.setRootTypename("Subscription",n),Pr.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?Ey:h===!1?Oy:f.merge}c(i,t.merge),i.keyFn=a===!1?sO:ar(a)?vy(a):typeof a=="function"?a:i.keyFn,u&&Object.keys(u).forEach(function(f){var h=n.getFieldPolicy(e,f,!0),d=u[f];if(typeof d=="function")h.read=d;else{var y=d.keyArgs,g=d.read,m=d.merge;h.keyFn=y===!1?Sy:ar(y)?by(y):typeof y=="function"?y:h.keyFn,typeof g=="function"&&(h.read=g),c(h,m)}h.read&&h.merge&&(h.keyFn=h.keyFn||Sy)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(Me(!i||i===e,5,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(oy);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Pr.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=pn(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(x){var T=a.getSupertypeSet(x,!1);T&&T.size&&f.indexOf(T)<0&&f.push(T)},d=!!(n&&this.fuzzySubtypes.size),y=!1,g=0;g<f.length;++g){var m=f[g];if(m.has(u))return c.has(u)||(y&&globalThis.__DEV__!==!1&&Me.warn(6,t,u),c.add(u)),!0;m.forEach(h),d&&g===f.length-1&&af(e.selectionSet,n,i)&&(d=!1,y=!0,this.fuzzySubtypes.forEach(function(x,T){var w=t.match(x);w&&w[0]===t&&h(T)}))}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=hf(e);u;){var h=u(f,c);if(ar(h))u=by(h);else{a=h||n;break}}return a===void 0&&(a=e.field?sm(e.field,e.variables):El(n,hf(e))),a===!1?n:n===Qi(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=Qi(u),f=t.store.getFieldValue(n,u),h=this.getFieldPolicy(e.typename,c,!1),d=h&&h.read;if(d){var y=Ty(this,n,e,t,t.store.getStorage(Pt(n)?n.__ref:n,u));return cf.withValue(this.cache,d,[f,y])}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===Ey?Ay(i.store)(e,t):f===Oy?t:(i.overwrite&&(e=void 0),f(e,t,Ty(this,void 0,{typename:c,fieldName:u.name.value,field:u,variables:i.variables},i,a||Object.create(null))))},r}();function Ty(r,e,t,n,i){var a=r.getStoreFieldName(t),u=Qi(a),c=t.variables||n.variables,f=n.store,h=f.toReference,d=f.canRead;return{args:hf(t),field:t.field||null,fieldName:u,storeFieldName:a,variables:c,isReference:Pt,toReference:h,storage:i,cache:r.cache,canRead:d,readField:function(){return r.readField(df(arguments,e,c),n)},mergeObjects:Ay(n.store)}}function df(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=j({},n),Pr.call(u,"from")||(u.from=e)),globalThis.__DEV__!==!1&&u.from===void 0&&globalThis.__DEV__!==!1&&Me.warn(7,ol(Array.from(r))),u.variables===void 0&&(u.variables=t),u}function Ay(r){return function(t,n){if(ar(t)||ar(n))throw Gr(8);if(Kt(t)&&Kt(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),u=i&&a&&i!==a;if(u)return n;if(Pt(t)&&Ys(n))return r.merge(t.__ref,n),t;if(Ys(t)&&Pt(n))return r.merge(t,n.__ref),n;if(Ys(t)&&Ys(n))return j(j({},t),n)}return n}}function pf(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:j(j({},r),{clientOnly:e,deferred:t})),i}var oO=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=bs(i),d=YE();c=j(j({},cu(h)),c);var y=j(j({store:e,written:Object.create(null),merge:function(m,x){return d.merge(m,x)},variables:c,varString:pi(c)},uy(i,this.fragments)),{overwrite:!!f,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),g=this.processSelectionSet({result:a||Object.create(null),dataId:u,selectionSet:h.selectionSet,mergeTree:{map:new Map},context:y});if(!Pt(g))throw Gr(11,a);return y.incomingById.forEach(function(m,x){var T=m.storeObject,w=m.mergeTree,S=m.fieldNodeSet,A=Bi(x);if(w&&w.map.size){var P=n.applyMerges(w,A,T,y);if(Pt(P))return;T=P}if(globalThis.__DEV__!==!1&&!y.overwrite){var F=Object.create(null);S.forEach(function(X){X.selectionSet&&(F[X.name.value]=!0)});var L=function(X){return F[Qi(X)]===!0},$=function(X){var te=w&&w.map.get(X);return!!(te&&te.info&&te.info.merge)};Object.keys(T).forEach(function(X){L(X)&&!$(X)&&uO(A,T,X,y.store)})}e.merge(x,T)}),e.retain(g.__ref),g},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),d=n&&f.rootTypenamesById[n]||ou(i,a,u.fragmentMap)||n&&u.store.get(n,"__typename");typeof d=="string"&&(h.__typename=d);var y=function(){var P=df(arguments,h,u.variables);if(Pt(P.from)){var F=u.incomingById.get(P.from.__ref);if(F){var L=f.readField(j(j({},P),{from:F.storeObject}),u);if(L!==void 0)return L}}return f.readField(P,u)},g=new Set;this.flattenFields(a,i,u,d).forEach(function(P,F){var L,$=mi(F),X=i[$];if(g.add(F),X!==void 0){var te=f.getStoreFieldName({typename:d,fieldName:F.name.value,field:F,variables:P.variables}),he=Iy(c,te),de=t.processFieldValue(X,F,F.selectionSet?pf(P,!1,!1):P,he),Ve=void 0;F.selectionSet&&(Pt(de)||Ys(de))&&(Ve=y("__typename",de));var Ae=f.getMergeFunction(d,F.name.value,Ve);Ae?he.info={field:F,typename:d,merge:Ae}:Py(c,te),h=P.merge(h,(L={},L[te]=de,L))}else globalThis.__DEV__!==!1&&!P.clientOnly&&!P.deferred&&!pu.added(F)&&!f.getReadFunction(d,F.name.value)&&globalThis.__DEV__!==!1&&Me.error(12,mi(F),i)});try{var m=f.identify(i,{typename:d,selectionSet:a,fragmentMap:u.fragmentMap,storeObject:h,readField:y}),x=m[0],T=m[1];n=n||x,T&&(h=u.merge(h,T))}catch(P){if(!n)throw P}if(typeof n=="string"){var w=Bi(n),S=u.written[n]||(u.written[n]=[]);if(S.indexOf(a)>=0||(S.push(a),this.reader&&this.reader.isFresh(i,w,a,u)))return w;var A=u.incomingById.get(n);return A?(A.storeObject=u.merge(A.storeObject,h),A.mergeTree=mf(A.mergeTree,c),g.forEach(function(P){return A.fieldNodeSet.add(P)})):u.incomingById.set(n,{storeObject:h,mergeTree:Ou(c)?void 0:c,fieldNodeSet:g}),w}return h},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?globalThis.__DEV__!==!1?Vl(e):e:ar(e)?e.map(function(u,c){var f=a.processFieldValue(u,t,n,Iy(i,c));return Py(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=ou(t,e,n.fragmentMap));var a=new Map,u=this.cache.policies,c=new Vs(!1);return function f(h,d){var y=c.lookup(h,d.clientOnly,d.deferred);y.visited||(y.visited=!0,h.selections.forEach(function(g){if(Bs(g,n.variables)){var m=d.clientOnly,x=d.deferred;if(!(m&&x)&&mn(g.directives)&&g.directives.forEach(function(S){var A=S.name.value;if(A==="client"&&(m=!0),A==="defer"){var P=Wa(S,n.variables);(!P||P.if!==!1)&&(x=!0)}}),yi(g)){var T=a.get(g);T&&(m=m&&T.clientOnly,x=x&&T.deferred),a.set(g,pf(n,m,x))}else{var w=Ba(g,n.lookupFragment);if(!w&&g.kind===Ce.FRAGMENT_SPREAD)throw Gr(13,g.name.value);w&&u.fragmentMatches(w,i,t,n.variables)&&f(w.selectionSet,pf(n,m,x))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var u,c=this;if(e.map.size&&!Pt(n)){var f=!ar(n)&&(Pt(t)||Ys(t))?t:void 0,h=n;f&&!a&&(a=[Pt(f)?f.__ref:f]);var d,y=function(g,m){return ar(g)?typeof m=="number"?g[m]:void 0:i.store.getFieldValue(g,String(m))};e.map.forEach(function(g,m){var x=y(f,m),T=y(h,m);if(T!==void 0){a&&a.push(m);var w=c.applyMerges(g,x,T,i,a);w!==T&&(d=d||new Map,d.set(m,w)),a&&Me(a.pop()===m)}}),d&&(n=ar(h)?h.slice(0):j({},h),d.forEach(function(g,m){n[m]=g}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(u=i.store).getStorage.apply(u,a)):n},r}(),ky=[];function Iy(r,e){var t=r.map;return t.has(e)||t.set(e,ky.pop()||{map:new Map}),t.get(e)}function mf(r,e){if(r===e||!e||Ou(e))return r;if(!r||Ou(r))return e;var t=r.info&&e.info?j(j({},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,mf(c,e.map.get(f))),u.delete(f)}),u.forEach(function(c){a.map.set(c,mf(e.map.get(c),r.map.get(c)))})}return a}function Ou(r){return!r||!(r.info||r.map.size)}function Py(r,e){var t=r.map,n=t.get(e);n&&Ou(n)&&(ky.push(n),t.delete(e))}var Cy=new Set;function uO(r,e,t,n){var i=function(y){var g=n.getFieldValue(y,t);return typeof g=="object"&&g},a=i(r);if(a){var u=i(e);if(u&&!Pt(a)&&!Ut(a,u)&&!Object.keys(a).every(function(y){return n.getFieldValue(u,y)!==void 0})){var c=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),f=Qi(t),h="".concat(c,".").concat(f);if(!Cy.has(h)){Cy.add(h);var d=[];!ar(a)&&!ar(u)&&[a,u].forEach(function(y){var g=n.getFieldValue(y,"__typename");typeof g=="string"&&!d.includes(g)&&d.push(g)}),globalThis.__DEV__!==!1&&Me.warn(14,f,c,d.length?"either ensure all objects of type "+d.join(" and ")+" have an ID or a custom merge function, or ":"",h,j({},a),j({},u))}}}}var yf=function(r){kn(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.addTypenameTransform=new hu(pu),n.assumeImmutableResults=!0,n.makeVar=yy,n.txCount=0,n.config=GE(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 to.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 oO(this,this.storeReader=new eO({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ay(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=Qa(function(u,c){return n.broadcastWatch(u,c)},{max:this.config.resultCacheMaxSize||Gn["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(u){var c=u.optimistic?n.optimisticData:n.data;if(ro(c)){var f=u.optimistic,h=u.id,d=u.variables;return c.makeCacheKey(u.query,u.callback,pi({optimistic:f,id:h,variables:d}))}}}),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(j(j({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof nf)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(Pr.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(j(j({},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||nO(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&my(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){var n;pi.reset(),Hs.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(Pt(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){globalThis.__DEV__!==!1&&Me.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(Pr.call(t,"id"))return!1;t=j(j({},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(),pi.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),my(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,d=function(g){var m=n,x=m.data,T=m.optimisticData;++n.txCount,g&&(n.data=n.optimisticData=g);try{return h=i(n)}finally{--n.txCount,n.data=x,n.optimisticData=T}},y=new Set;return f&&!this.txCount&&this.broadcastWatches(j(j({},t),{onWatchUpdated:function(g){return y.add(g),!1}})),typeof u=="string"?this.optimisticData=this.optimisticData.addLayer(u,d):u===!1?d(this.data):d(),typeof c=="string"&&(this.optimisticData=this.optimisticData.removeLayer(c)),f&&y.size?(this.broadcastWatches(j(j({},t),{onWatchUpdated:function(g,m){var x=f.call(this,g,m);return x!==!1&&y.delete(g),x}})),y.size&&y.forEach(function(g){return n.maybeBroadcastWatch.dirty(g)})):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.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||!Ut(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(tf);globalThis.__DEV__!==!1&&(yf.prototype.getMemoryInternals=rS);var St;(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"})(St||(St={}));function io(r){return r?r<7:!1}function cO(r){return r===7||r===8}var Ny=Object.assign,lO=Object.hasOwnProperty,Tu=function(r){kn(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,u=r.call(this,function(w){try{var S=w._subscription._observer;S&&!S.error&&(S.error=fO)}catch{}var A=!u.observers.size;u.observers.add(w);var P=u.last;return P&&P.error?w.error&&w.error(P.error):P&&P.result&&w.next&&w.next(P.result),A&&u.reobserve().catch(function(){}),function(){u.observers.delete(w)&&!u.observers.size&&u.tearDownQuery()}})||this;u.observers=new Set,u.subscriptions=new Set,u.queryInfo=i,u.queryManager=n,u.waitForOwnResult=gf(a.fetchPolicy),u.isTornDown=!1;var c=n.defaultOptions.watchQuery,f=c===void 0?{}:c,h=f.fetchPolicy,d=h===void 0?"cache-first":h,y=a.fetchPolicy,g=y===void 0?d:y,m=a.initialFetchPolicy,x=m===void 0?g==="standby"?d:g:m;u.options=j(j({},a),{initialFetchPolicy:x,fetchPolicy:g}),u.queryId=i.queryId||n.generateQueryId();var T=bs(u.query);return u.queryName=T&&T.name&&T.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.getCurrentResult=function(t){t===void 0&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||St.ready,a=j(j({},n),{loading:io(i),networkStatus:i}),u=this.options.fetchPolicy,c=u===void 0?"cache-first":u;if(!(gf(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),Ut(a.data,{})&&(a.data=void 0),f.complete?(delete a.partial,f.complete&&a.networkStatus===St.loading&&(c==="cache-first"||c==="cache-only")&&(a.networkStatus=St.ready,a.loading=!1)):a.partial=!0,globalThis.__DEV__!==!1&&!f.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Dy(f.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){if(!this.last)return!0;var i=this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective?!ny(this.query,this.last.result,t,this.variables):!Ut(this.last.result,t);return i||n&&!Ut(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ut(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==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",globalThis.__DEV__!==!1&&t&&lO.call(t,"variables")){var u=Ol(this.query),c=u.variableDefinitions;(!c||!c.some(function(f){return f.variable.name.value==="variables"}))&&globalThis.__DEV__!==!1&&Me.warn(20,t,((n=u.name)===null||n===void 0?void 0:n.value)||u)}return t&&!Ut(this.options.variables,t)&&(i.variables=this.options.variables=j(j({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,St.refetch)},e.prototype.fetchMore=function(t){var n=this,i=j(j({},t.query?t:j(j(j(j({},this.options),{query:this.options.query}),t),{variables:j(j({},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=St.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var f=new Set;return this.queryManager.fetchQuery(a,i,St.fetchMore).then(function(h){return n.queryManager.removeQuery(a),u.networkStatus===St.fetchMore&&(u.networkStatus=c),n.queryManager.cache.batch({update:function(d){var y=t.updateQuery;y?d.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(g){return y(g,{fetchMoreResult:h.data,variables:i.variables})}):d.writeQuery({query:i.query,variables:i.variables,data:h.data})},onWatchUpdated:function(d){f.add(d.query)}}),h}).finally(function(){f.has(n.query)||Ry(n)})},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){var h=f.variables;return u(c,{subscriptionData:a,variables:h})})},error:function(a){if(t.onError){t.onError(a);return}globalThis.__DEV__!==!1&&Me.error(21,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=zi(this.options,t||{});Ny(this.options,n)},e.prototype.setVariables=function(t){return Ut(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},St.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}).result,a=t(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,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){return this.queryManager.setObservableQuery(this),this.queryManager.fetchConcastWithInfo(this.queryId,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)){Me(a,22);var u=i||(this.pollingInfo={});u.interval=a;var c=function(){var h,d;t.pollingInfo&&(!io(t.queryInfo.networkStatus)&&!(!((d=(h=t.options).skipPollAttempt)===null||d===void 0)&&d.call(h))?t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},St.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&&!Ut(n,this.last.variables)&&(i=void 0),this.last=j({result:this.queryManager.assumeImmutableResults?t:Vl(t),variables:n},i?{error:i}:null)},e.prototype.reobserveAsConcast=function(t,n){var i=this;this.isTornDown=!1;var a=n===St.refetch||n===St.fetchMore||n===St.poll,u=this.options.variables,c=this.options.fetchPolicy,f=zi(this.options,t||{}),h=a?f:Ny(this.options,f),d=this.transformDocument(h.query);this.lastQuery=d,a||(this.updatePolling(),t&&t.variables&&!Ut(t.variables,u)&&h.fetchPolicy!=="standby"&&h.fetchPolicy===c&&(this.applyNextFetchPolicy("variables-changed",h),n===void 0&&(n=St.setVariables))),this.waitForOwnResult&&(this.waitForOwnResult=gf(h.fetchPolicy));var y=function(){i.concast===x&&(i.waitForOwnResult=!1)},g=h.variables&&j({},h.variables),m=this.fetch(h,n,d),x=m.concast,T=m.fromLink,w={next:function(S){Ut(i.variables,g)&&(y(),i.reportResult(S,g))},error:function(S){Ut(i.variables,g)&&(y(),i.reportError(S,g))}};return!a&&(T||!this.concast)&&(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=x,this.observer=w),x.addObserver(w),x},e.prototype.reobserve=function(t,n){return this.reobserveAsConcast(t,n).promise},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.getCurrentResult(!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)&&Js(this.observers,"next",t)},e.prototype.reportError=function(t,n){var i=j(j({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:St.error,loading:!1});this.updateLastResult(i,n),Js(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}(Ct);zl(Tu);function Ry(r){var e=r.options,t=e.fetchPolicy,n=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(i,a){return this.nextFetchPolicy=n,typeof this.nextFetchPolicy=="function"?this.nextFetchPolicy(i,a):t}}):r.reobserve()}function fO(r){globalThis.__DEV__!==!1&&Me.error(23,r.message,r.stack)}function Dy(r){globalThis.__DEV__!==!1&&r&&globalThis.__DEV__!==!1&&Me.debug(24,r)}function gf(r){return r==="network-only"||r==="no-cache"||r==="standby"}var Fy=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=Ja(t.resolvers,n)}):this.resolvers=Ja(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 Li(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 qi(this,function(h){return n?[2,this.resolveDocument(n,i.data,a,u,this.fragmentMatcher,f).then(function(d){return j(j({},i),{data:d.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return ji(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return Rl(e)},r.prototype.prepareContext=function(e){var t=this.cache;return j(j({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e){return Li(this,arguments,void 0,function(t,n,i){return n===void 0&&(n={}),i===void 0&&(i={}),qi(this,function(a){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,n)||{},this.prepareContext(i),n).then(function(u){return j(j({},n),u.exportedVariables)})]:[2,j({},n)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return Pn(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 yl}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:Im(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t){return Li(this,arguments,void 0,function(n,i,a,u,c,f){var h,d,y,g,m,x,T,w,S,A,P;return a===void 0&&(a={}),u===void 0&&(u={}),c===void 0&&(c=function(){return!0}),f===void 0&&(f=!1),qi(this,function(F){return h=Vi(n),d=za(n),y=$a(d),g=this.collectSelectionsToResolve(h,y),m=h.operation,x=m?m.charAt(0).toUpperCase()+m.slice(1):"Query",T=this,w=T.cache,S=T.client,A={fragmentMap:y,context:j(j({},a),{cache:w,client:S}),variables:u,fragmentMatcher:c,defaultOperationType:x,exportedVariables:{},selectionsToResolve:g,onlyRunForcedResolvers:f},P=!1,[2,this.resolveSelectionSet(h.selectionSet,P,i,A).then(function(L){return{result:L,exportedVariables:A.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Li(this,void 0,void 0,function(){var a,u,c,f,h,d=this;return qi(this,function(y){return a=i.fragmentMap,u=i.context,c=i.variables,f=[n],h=function(g){return Li(d,void 0,void 0,function(){var m,x;return qi(this,function(T){return!t&&!i.selectionsToResolve.has(g)?[2]:Bs(g,c)?yi(g)?[2,this.resolveField(g,t,n,i).then(function(w){var S;typeof w<"u"&&f.push((S={},S[mi(g)]=w,S))})]:(am(g)?m=g:(m=a[g.name.value],Me(m,18,g.name.value)),m&&m.typeCondition&&(x=m.typeCondition.name.value,i.fragmentMatcher(n,x,u))?[2,this.resolveSelectionSet(m.selectionSet,t,n,i).then(function(w){f.push(w)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(h)).then(function(){return Ya(f)})]})})},r.prototype.resolveField=function(e,t,n,i){return Li(this,void 0,void 0,function(){var a,u,c,f,h,d,y,g,m,x=this;return qi(this,function(T){return n?(a=i.variables,u=e.name.value,c=mi(e),f=u!==c,h=n[c]||n[u],d=Promise.resolve(h),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(y=n.__typename||i.defaultOperationType,g=this.resolvers&&this.resolvers[y],g&&(m=g[f?u:c],m&&(d=Promise.resolve(cf.withValue(this.cache,m,[n,Wa(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,d.then(function(w){var S,A;if(w===void 0&&(w=h),e.directives&&e.directives.forEach(function(F){F.name.value==="export"&&F.arguments&&F.arguments.forEach(function(L){L.name.value==="as"&&L.value.kind==="StringValue"&&(i.exportedVariables[L.value.value]=w)})}),!e.selectionSet||w==null)return w;var P=(A=(S=e.directives)===null||S===void 0?void 0:S.some(function(F){return F.name.value==="client"}))!==null&&A!==void 0?A:!1;if(Array.isArray(w))return x.resolveSubSelectedArray(e,t||P,w,i);if(e.selectionSet)return x.resolveSelectionSet(e.selectionSet,t||P,w,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),Pn(u,{Directive:function(f,h,d,y,g){f.name.value==="client"&&g.forEach(function(m){n(m)&&Wp(m)&&c.add(m)})},FragmentSpread:function(f,h,d,y,g){var m=t[f.name.value];Me(m,19,f.name.value);var x=a(m);x.size>0&&(g.forEach(function(T){n(T)&&Wp(T)&&c.add(T)}),c.add(f),x.forEach(function(T){c.add(T)}))}})}return i.get(u)}return a(e)},r}(),Zs=new(Ui?WeakMap:Map);function vf(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Zs.set(r,(Zs.get(r)+1)%1e15),t.apply(this,arguments)})}function My(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var bf=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;Zs.has(n)||(Zs.set(n,0),vf(n,"evict"),vf(n,"modify"),vf(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||St.loading;return this.variables&&this.networkStatus!==St.loading&&!Ut(this.variables,e.variables)&&(t=St.setVariables),Ut(e.variables,this.variables)||(this.lastDiff=void 0),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.reset=function(){My(this),this.dirty=!1},r.prototype.resetDiff=function(){this.lastDiff=void 0},r.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&Ut(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=this,n,i=this.lastDiff&&this.lastDiff.diff;e&&!e.complete&&(!((n=this.observableQuery)===null||n===void 0)&&n.getLastError())||(this.updateLastDiff(e),!this.dirty&&!Ut(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0))))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=t.getDiff();n.fromOptimisticTransaction?e.observe():Ry(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;My(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(io(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel;var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},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=j(j({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ut(i,this.lastWatch))&&(this.cancel(),this.cancel=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===Zs.get(this.cache)&&Ut(t,n.variables)&&Ut(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,u=new gi,c=mn(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&mn(e.incremental)){var f=Hl(this.getDiff().result,e);e.data=f}else if("hasNext"in e&&e.hasNext){var h=this.getDiff();e.data=u.merge(h.result,e.data)}this.graphQLErrors=c,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(wf(e,n.errorPolicy)?this.cache.performTransaction(function(d){if(a.shouldWrite(e,n.variables))d.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:Zs.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=d.diff(y);!a.stopped&&Ut(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=St.ready},r.prototype.markError=function(e){return this.networkStatus=St.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function wf(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!Za(r);return!n&&t&&r.data&&(n=!0),n}var hO=Object.prototype.hasOwnProperty,Ly=Object.create(null),dO=function(){function r(e){var t=e.cache,n=e.link,i=e.defaultOptions,a=e.documentTransform,u=e.queryDeduplication,c=u===void 0?!1:u,f=e.onBroadcast,h=e.ssrMode,d=h===void 0?!1:h,y=e.clientAwareness,g=y===void 0?{}:y,m=e.localState,x=e.assumeImmutableResults,T=x===void 0?!!t.assumeImmutableResults:x,w=e.defaultContext,S=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new au(Gn["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Vs(!1);var A=new hu(function(P){return S.cache.transformDocument(P)},{cache:!1});this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=c,this.clientAwareness=g,this.localState=m||new Fy({cache:t}),this.ssrMode=d,this.assumeImmutableResults=T,this.documentTransform=a?A.concat(a).concat(A):A,this.defaultContext=w||Object.create(null),(this.onBroadcast=f)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(Gr(25))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){return Li(this,arguments,void 0,function(t){var n,i,a,u,c,f,h,d=t.mutation,y=t.variables,g=t.optimisticResponse,m=t.updateQueries,x=t.refetchQueries,T=x===void 0?[]:x,w=t.awaitRefetchQueries,S=w===void 0?!1:w,A=t.update,P=t.onQueryUpdated,F=t.fetchPolicy,L=F===void 0?((f=this.defaultOptions.mutate)===null||f===void 0?void 0:f.fetchPolicy)||"network-only":F,$=t.errorPolicy,X=$===void 0?((h=this.defaultOptions.mutate)===null||h===void 0?void 0:h.errorPolicy)||"none":$,te=t.keepRootFields,he=t.context;return qi(this,function(de){switch(de.label){case 0:return Me(d,26),Me(L==="network-only"||L==="no-cache",27),n=this.generateMutationId(),d=this.cache.transformForLink(this.transform(d)),i=this.getDocumentInfo(d).hasClientExports,y=this.getVariables(d,y),i?[4,this.localState.addExportedVariables(d,y,he)]:[3,2];case 1:y=de.sent(),de.label=2;case 2:return a=this.mutationStore&&(this.mutationStore[n]={mutation:d,variables:y,loading:!0,error:null}),u=g&&this.markMutationOptimistic(g,{mutationId:n,document:d,variables:y,fetchPolicy:L,errorPolicy:X,context:he,updateQueries:m,update:A,keepRootFields:te}),this.broadcastQueries(),c=this,[2,new Promise(function(Ve,Ae){return gu(c.getObservableFromLink(d,j(j({},he),{optimisticResponse:u?g:void 0}),y,!1),function(je){if(Za(je)&&X==="none")throw new oi({graphQLErrors:vu(je)});a&&(a.loading=!1,a.error=null);var Ge=j({},je);return typeof T=="function"&&(T=T(Ge)),X==="ignore"&&Za(Ge)&&delete Ge.errors,c.markMutationResult({mutationId:n,result:Ge,document:d,variables:y,fetchPolicy:L,errorPolicy:X,context:he,update:A,updateQueries:m,awaitRefetchQueries:S,refetchQueries:T,removeOptimistic:u?n:void 0,onQueryUpdated:P,keepRootFields:te})}).subscribe({next:function(je){c.broadcastQueries(),(!("hasNext"in je)||je.hasNext===!1)&&Ve(je)},error:function(je){a&&(a.loading=!1,a.error=je),u&&c.cache.removeOptimistic(n),c.broadcastQueries(),Ae(je instanceof oi?je:new oi({networkError:je}))}})})]}})})},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&&wf(i,e.errorPolicy)){if(_s(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),_s(i)&&mn(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=Hl(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(y,g){var m=y.observableQuery,x=m&&m.queryName;if(!(!x||!hO.call(h,x))){var T=h[x],w=n.queries.get(g),S=w.document,A=w.variables,P=t.diff({query:S,variables:A,returnPartialData:!0,optimistic:!1}),F=P.result,L=P.complete;if(L&&F){var $=T(F,{mutationResult:i,queryName:S&&uu(S)||void 0,queryVariables:A});$&&a.push({result:$,dataId:"ROOT_QUERY",query:S,variables:A})}}})}if(a.length>0||(e.refetchQueries||"").length>0||e.update||e.onQueryUpdated||e.removeOptimistic){var d=[];if(this.refetchQueries({updateCache:function(y){u||a.forEach(function(T){return y.write(T)});var g=e.update,m=!qm(i)||_s(i)&&!i.hasNext;if(g){if(!u){var x=y.diff({id:"ROOT_MUTATION",query:n.getDocumentInfo(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});x.complete&&(i=j(j({},i),{data:x.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}m&&g(y,i,{context:e.context,variables:e.variables})}!u&&!e.keepRootFields&&m&&y.modify({id:"ROOT_MUTATION",fields:function(T,w){var S=w.fieldName,A=w.DELETE;return S==="__typename"?T:A}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(y){return d.push(y)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(d).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:Ly}):e;return i===Ly?!1:(this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(j(j({},t),{result:{data:i}}),a)}catch(u){globalThis.__DEV__!==!1&&Me.error(u)}},t.mutationId),!0)},r.prototype.fetchQuery=function(e,t,n){return this.fetchConcastWithInfo(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:zp(e),hasForcedResolvers:this.localState.shouldForceResolvers(e),hasNonreactiveDirective:ji(["nonreactive"],e),clientQuery:this.localState.clientQuery(e),serverQuery:du([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],e),defaultVars:cu(bs(e)),asQuery:j(j({},e),{definitions:e.definitions.map(function(i){return i.kind==="OperationDefinition"&&i.operation!=="query"?j(j({},i),{operation:"query"}):i})})};t.set(e,n)}return t.get(e)},r.prototype.getVariables=function(e,t){return j(j({},this.getDocumentInfo(e).defaultVars),t)},r.prototype.watchQuery=function(e){var t=this.transform(e.query);e=j(j({},e),{variables:this.getVariables(t,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var n=new bf(this),i=new Tu({queryManager:this,queryInfo:n,options:e});return i.lastQuery=t,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;return t===void 0&&(t=this.generateQueryId()),Me(e.query,28),Me(e.query.kind==="Document",29),Me(!e.returnPartialData,30),Me(!e.pollInterval,31),this.fetchQuery(t,j(j({},e),{query:this.transform(e.query)})).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(Gr(32)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=St.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 Set;return Array.isArray(e)&&e.forEach(function(u){typeof u=="string"?i.set(u,!1):im(u)?i.set(t.transform(u),!1):Kt(u)&&u.query&&a.add(u)}),this.queries.forEach(function(u,c){var f=u.observableQuery,h=u.document;if(f){if(e==="all"){n.set(c,f);return}var d=f.queryName,y=f.options.fetchPolicy;if(y==="standby"||e==="active"&&!f.hasObservers())return;(e==="active"||d&&i.has(d)||h&&i.has(h))&&(n.set(c,f),d&&i.set(d,!0),h&&i.set(h,!0))}}),a.size&&a.forEach(function(u){var c=Ko("legacyOneTimeQuery"),f=t.getQuery(c).init({document:u.query,variables:u.variables}),h=new Tu({queryManager:t,queryInfo:f,options:j(j({},u),{fetchPolicy:"network-only"})});Me(h.queryId===c),f.setObservableQuery(h),n.set(c,h)}),globalThis.__DEV__!==!1&&i.size&&i.forEach(function(u,c){u||globalThis.__DEV__!==!1&&Me.warn(typeof c=="string"?33:34,c)}),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.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,u=a===void 0?"none":a,c=e.variables,f=e.context,h=f===void 0?{}:f;n=this.transform(n),c=this.getVariables(n,c);var d=function(g){return t.getObservableFromLink(n,h,g).map(function(m){i!=="no-cache"&&(wf(m,u)&&t.cache.write({query:n,result:m.data,dataId:"ROOT_SUBSCRIPTION",variables:g}),t.broadcastQueries());var x=Za(m),T=NE(m);if(x||T){var w={};if(x&&(w.graphQLErrors=m.errors),T&&(w.protocolErrors=m.extensions[Jl]),u==="none"||T)throw new oi(w)}return u==="ignore"&&delete m.errors,m})};if(this.getDocumentInfo(n).hasClientExports){var y=this.localState.addExportedVariables(n,c,h).then(d);return new Ct(function(g){var m=null;return y.then(function(x){return m=x.subscribe(g)},g.error),function(){return m&&m.unsubscribe()}})}return d(c)},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){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i){var a=this,u;i===void 0&&(i=(u=t==null?void 0:t.queryDeduplication)!==null&&u!==void 0?u:this.queryDeduplication);var c,f=this.getDocumentInfo(e),h=f.serverQuery,d=f.clientQuery;if(h){var y=this,g=y.inFlightLinkObservables,m=y.link,x={query:h,variables:n,operationName:uu(h)||void 0,context:this.prepareContext(j(j({},t),{forceFetch:!i}))};if(t=x.context,i){var T=Hs(h),w=pi(n),S=g.lookup(T,w);if(c=S.observable,!c){var A=new ws([_u(m,x)]);c=S.observable=A,A.beforeNext(function(){g.remove(T,w)})}}else c=new ws([_u(m,x)])}else c=new ws([Ct.of({data:{}})]),t=this.prepareContext(t);return d&&(c=gu(c,function(P){return a.localState.runResolvers({document:d,remoteResult:P,context:t,variables:n})})),c},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(n.query);return gu(this.getObservableFromLink(a,n.context,n.variables),function(u){var c=vu(u),f=c.length>0;if(i>=e.lastRequestId){if(f&&n.errorPolicy==="none")throw e.markError(new oi({graphQLErrors:c}));e.markResult(u,a,n,t),e.markReady()}var h={data:u.data,loading:!1,networkStatus:St.ready};return f&&n.errorPolicy!=="ignore"&&(h.errors=c,h.networkStatus=St.error),h},function(u){var c=Vm(u)?u:new oi({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=St.loading),i===void 0&&(i=t.query);var u=this.getVariables(i,t.variables),c=this.getQuery(e),f=this.defaultOptions.watchQuery,h=t.fetchPolicy,d=h===void 0?f&&f.fetchPolicy||"cache-first":h,y=t.errorPolicy,g=y===void 0?f&&f.errorPolicy||"none":y,m=t.returnPartialData,x=m===void 0?!1:m,T=t.notifyOnNetworkStatusChange,w=T===void 0?!1:T,S=t.context,A=S===void 0?{}:S,P=Object.assign({},t,{query:i,variables:u,fetchPolicy:d,errorPolicy:g,returnPartialData:x,notifyOnNetworkStatusChange:w,context:A}),F=function(he){P.variables=he;var de=a.fetchQueryByPolicy(c,P,n);return P.fetchPolicy!=="standby"&&de.sources.length>0&&c.observableQuery&&c.observableQuery.applyNextFetchPolicy("after-fetch",t),de},L=function(){return a.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(he){L(),setTimeout(function(){return $.cancel(he)})});var $,X;if(this.getDocumentInfo(P.query).hasClientExports)$=new ws(this.localState.addExportedVariables(P.query,P.variables,P.context).then(F).then(function(he){return he.sources})),X=!0;else{var te=F(P.variables);X=te.fromLink,$=new ws(te.sources)}return $.promise.then(L,L),{concast:$,fromLink:X}},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?Ko("refetchQueries"):void 0:c,h=e.onQueryUpdated,d=new Map;i&&this.getObservableQueries(i).forEach(function(g,m){d.set(m,{oq:g,lastDiff:t.getQuery(m).getDiff()})});var y=new Map;return n&&this.cache.batch({update:n,optimistic:u&&f||!1,removeOptimistic:f,onWatchUpdated:function(g,m,x){var T=g.watcher instanceof bf&&g.watcher.observableQuery;if(T){if(h){d.delete(T.queryId);var w=h(T,m,x);return w===!0&&(w=T.refetch()),w!==!1&&y.set(T,w),w}h!==null&&d.set(T.queryId,{oq:T,lastDiff:x,diff:m})}}}),d.size&&d.forEach(function(g,m){var x=g.oq,T=g.lastDiff,w=g.diff,S;if(h){if(!w){var A=x.queryInfo;A.reset(),w=A.getDiff()}S=h(x,w,T)}(!h||S===!0)&&(S=x.refetch()),S!==!1&&y.set(x,S),m.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(m)}),f&&this.cache.removeOptimistic(f),y},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,d=t.returnPartialData,y=t.context,g=t.notifyOnNetworkStatusChange,m=e.networkStatus;e.init({document:a,variables:u,networkStatus:n});var x=function(){return e.getDiff()},T=function(F,L){L===void 0&&(L=e.networkStatus||St.loading);var $=F.result;globalThis.__DEV__!==!1&&!d&&!Ut($,{})&&Dy(F.missing);var X=function(te){return Ct.of(j({data:te,loading:io(L),networkStatus:L},F.complete?null:{partial:!0}))};return $&&i.getDocumentInfo(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:$},context:y,variables:u,onlyRunForcedResolvers:!0}).then(function(te){return X(te.data||void 0)}):h==="none"&&L===St.refetch&&Array.isArray(F.missing)?X(void 0):X($)},w=c==="no-cache"?0:n===St.refetch&&f!=="merge"?1:2,S=function(){return i.getResultsFromLink(e,w,{query:a,variables:u,context:y,fetchPolicy:c,errorPolicy:h})},A=g&&typeof m=="number"&&m!==n&&io(n);switch(c){default:case"cache-first":{var P=x();return P.complete?{fromLink:!1,sources:[T(P,e.markReady())]}:d||A?{fromLink:!0,sources:[T(P),S()]}:{fromLink:!0,sources:[S()]}}case"cache-and-network":{var P=x();return P.complete||d||A?{fromLink:!0,sources:[T(P),S()]}:{fromLink:!0,sources:[S()]}}case"cache-only":return{fromLink:!1,sources:[T(x(),e.markReady())]};case"network-only":return A?{fromLink:!0,sources:[T(x()),S()]}:{fromLink:!0,sources:[S()]};case"no-cache":return A?{fromLink:!0,sources:[T(e.getDiff()),S()]}:{fromLink:!0,sources:[S()]};case"standby":return{fromLink:!1,sources:[]}}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new bf(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return j(j(j({},this.defaultContext),t),{clientAwareness:this.clientAwareness})},r}(),qy=!1,_f=function(){function r(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw Gr(15);var n=e.uri,i=e.credentials,a=e.headers,u=e.cache,c=e.documentTransform,f=e.ssrMode,h=f===void 0?!1:f,d=e.ssrForceFetchDelay,y=d===void 0?0:d,g=e.connectToDevTools,m=g===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&globalThis.__DEV__!==!1:g,x=e.queryDeduplication,T=x===void 0?!0:x,w=e.defaultOptions,S=e.defaultContext,A=e.assumeImmutableResults,P=A===void 0?u.assumeImmutableResults:A,F=e.resolvers,L=e.typeDefs,$=e.fragmentMatcher,X=e.name,te=e.version,he=e.link;he||(he=n?new Zm({uri:n,credentials:i,headers:a}):Jr.empty()),this.link=he,this.cache=u,this.disableNetworkFetches=h||y>0,this.queryDeduplication=T,this.defaultOptions=w||Object.create(null),this.typeDefs=L,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=sl,this.localState=new Fy({cache:u,client:this,resolvers:F,fragmentMatcher:$}),this.queryManager=new dO({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:S,documentTransform:c,queryDeduplication:T,ssrMode:h,clientAwareness:{name:X,version:te},localState:this.localState,assumeImmutableResults:P,onBroadcast:m?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),m&&this.connectToDevTools()}return r.prototype.connectToDevTools=function(){if(typeof window=="object"){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this}!qy&&globalThis.__DEV__!==!1&&(qy=!0,setTimeout(function(){if(typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__&&/^(https?|file):$/.test(window.location.protocol)){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&&Me.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=Hi(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=j(j({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Hi(this.defaultOptions.query,e)),Me(e.fetchPolicy!=="cache-and-network",16),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=j(j({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Hi(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.watchFragment=function(e){return this.cache.watchFragment(e)},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 _u(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&&Me.debug(17,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&&(_f.prototype.getMemoryInternals=tS);var Au=new Map,xf=new Map,jy=!0,ku=!1;function Uy(r){return r.replace(/[\s,]+/g," ").trim()}function pO(r){return Uy(r.source.body.substring(r.start,r.end))}function mO(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=pO(n.loc),u=xf.get(i);u&&!u.has(a)?jy&&console.warn("Warning: fragment with name "+i+` already exists.
85
+ graphql-tag enforces all fragment names across your application to be unique; read more about
86
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):u||xf.set(i,u=new Set),u.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),j(j({},r),{definitions:t})}function yO(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 gO(r){var e=Uy(r);if(!Au.has(e)){var t=Ix(r,{experimentalFragmentVariables:ku,allowLegacyFragmentVariables:ku});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Au.set(e,yO(mO(t)))}return Au.get(e)}function Ji(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]}),gO(n)}function $y(){Au.clear(),xf.clear()}function By(){jy=!1}function Vy(){ku=!0}function Wy(){ku=!1}var so={gql:Ji,resetCaches:$y,disableFragmentWarnings:By,enableExperimentalFragmentVariables:Vy,disableExperimentalFragmentVariables:Wy};(function(r){r.gql=so.gql,r.resetCaches=so.resetCaches,r.disableFragmentWarnings=so.disableFragmentWarnings,r.enableExperimentalFragmentVariables=so.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=so.disableExperimentalFragmentVariables})(Ji||(Ji={})),Ji.default=Ji,Op(globalThis.__DEV__!==!1?"log":"silent");const vO=Object.freeze(Object.defineProperty({__proto__:null,ApolloCache:tf,ApolloClient:_f,ApolloError:oi,ApolloLink:Jr,get Cache(){return rf},DocumentTransform:hu,HttpLink:Zm,InMemoryCache:yf,MissingFieldError:nf,get NetworkStatus(){return St},Observable:Ct,ObservableQuery:Tu,checkFetcher:Gm,concat:_E,createHttpLink:Zl,createSignalIfSupported:BE,defaultDataIdFromObject:sf,defaultPrinter:Yl,disableExperimentalFragmentVariables:Wy,disableFragmentWarnings:By,empty:vE,enableExperimentalFragmentVariables:Vy,execute:_u,fallbackHttpConfig:Qm,from:bE,fromError:bu,fromPromise:dE,get gql(){return Ji},isApolloError:Vm,isNetworkRequestSettled:cO,isReference:Pt,makeReference:Bi,makeVar:yy,mergeOptions:Hi,parseAndCheckHttpResponse:Hm,resetCaches:$y,rewriteURIForGET:Ym,selectHttpOptionsAndBody:UE,selectHttpOptionsAndBodyInternal:Kl,selectURI:Jm,serializeFetchParameter:xu,setLogVerbosity:Op,split:wE,throwServerError:Gl,toPromise:hE},Symbol.toStringTag,{value:"Module"}));var zy={exports:{}};(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,ve)})(zy);var Nt=zy.exports;const Hy=G_({__proto__:null,default:wp(Nt)},[Nt]);var Qy=iu?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Sf(){Me("createContext"in Hy,45);var r=Nt.createContext[Qy];return r||(Object.defineProperty(Nt.createContext,Qy,{value:r=Nt.createContext({}),enumerable:!1,writable:!1,configurable:!0}),r.displayName="ApolloContext"),r}var bO=function(r){var e=r.client,t=r.children,n=Sf(),i=Nt.useContext(n),a=Nt.useMemo(function(){return j(j({},i),{client:e||i.client})},[i,e]);return Me(a.client,46),Nt.createElement(n.Provider,{value:a},t)};function Gy(r){var e=Nt.useContext(Sf()),t=r||e.client;return Me(!!t,49),t}var Jy=!1,wO="useSyncExternalStore",_O=Hy[wO],xO=_O||function(r,e,t){var n=e();globalThis.__DEV__!==!1&&!Jy&&n!==e()&&(Jy=!0,globalThis.__DEV__!==!1&&Me.error(58));var i=Nt.useState({inst:{value:n,getSnapshot:e}}),a=i[0].inst,u=i[1];return Yp?Nt.useLayoutEffect(function(){Object.assign(a,{value:n,getSnapshot:e}),Ef(a)&&u({inst:a})},[r,n,e]):Object.assign(a,{value:n,getSnapshot:e}),Nt.useEffect(function(){return Ef(a)&&u({inst:a}),r(function(){Ef(a)&&u({inst:a})})},[r]),n};function Ef(r){var e=r.value,t=r.getSnapshot;try{return e!==t()}catch{return!0}}var ui;(function(r){r[r.Query=0]="Query",r[r.Mutation=1]="Mutation",r[r.Subscription=2]="Subscription"})(ui||(ui={}));var xs;function Yy(r){var e;switch(r){case ui.Query:e="Query";break;case ui.Mutation:e="Mutation";break;case ui.Subscription:e="Subscription";break}return e}function Ky(r){xs||(xs=new au(Gn.parser||1e3));var e=xs.get(r);if(e)return e;var t,n,i;Me(!!r&&!!r.kind,60,r);for(var a=[],u=[],c=[],f=[],h=0,d=r.definitions;h<d.length;h++){var y=d[h];if(y.kind==="FragmentDefinition"){a.push(y);continue}if(y.kind==="OperationDefinition")switch(y.operation){case"query":u.push(y);break;case"mutation":c.push(y);break;case"subscription":f.push(y);break}}Me(!a.length||u.length||c.length||f.length,61),Me(u.length+c.length+f.length<=1,62,r,u.length,f.length,c.length),n=u.length?ui.Query:ui.Mutation,!u.length&&!c.length&&(n=ui.Subscription);var g=u.length?u:c.length?c:f;Me(g.length===1,63,r,g.length);var m=g[0];t=m.variableDefinitions||[],m.name&&m.name.kind==="Name"?i=m.name.value:i="data";var x={name:i,type:n,variables:t};return xs.set(r,x),x}Ky.resetCache=function(){xs=void 0},globalThis.__DEV__!==!1&&_l("parser",function(){return xs?xs.size:0});function Zy(r,e){var t=Ky(r),n=Yy(e),i=Yy(t.type);Me(t.type===e,64,n,n,i)}var SO=Object.prototype.hasOwnProperty;function EO(r,e){var t=Nt.useReducer(function(c){return c+1},0)[1];function n(c){return Object.assign(new OO(r,e,c),{forceUpdateState:t})}var i=Nt.useState(n),a=i[0],u=i[1];return(r!==a.client||e!==a.query)&&u(a=n(a)),a}var OO=function(){function r(e,t,n){var i=this;this.client=e,this.query=t,this.forceUpdate=function(){return i.forceUpdateState()},this.ssrDisabledResult=Gs({loading:!0,data:void 0,error:void 0,networkStatus:St.loading}),this.skipStandbyResult=Gs({loading:!1,data:void 0,error:void 0,networkStatus:St.ready}),this.toQueryResultCache=new(Ui?WeakMap:Map),Zy(t,ui.Query);var a=n&&n.result,u=a&&a.data;u&&(this.previousData=u)}return r.prototype.forceUpdateState=function(){globalThis.__DEV__!==!1&&Me.warn(51)},r.prototype.executeQuery=function(e){var t=this,n;e.query&&Object.assign(this,{query:e.query}),this.watchQueryOptions=this.createWatchQueryOptions(this.queryHookOptions=e);var i=this.observable.reobserveAsConcast(this.getObsQueryOptions());return this.previousData=((n=this.result)===null||n===void 0?void 0:n.data)||this.previousData,this.result=void 0,this.forceUpdate(),new Promise(function(a){var u;i.subscribe({next:function(c){u=c},error:function(){a(t.toQueryResult(t.observable.getCurrentResult()))},complete:function(){a(t.toQueryResult(u))}})})},r.prototype.useQuery=function(e){var t=this;this.renderPromises=Nt.useContext(Sf()).renderPromises,this.useOptions(e);var n=this.useObservableQuery(),i=xO(Nt.useCallback(function(a){if(t.renderPromises)return function(){};t.forceUpdate=a;var u=function(){var h=t.result,d=n.getCurrentResult();h&&h.loading===d.loading&&h.networkStatus===d.networkStatus&&Ut(h.data,d.data)||t.setResult(d)},c=function(h){if(f.unsubscribe(),f=n.resubscribeAfterError(u,c),!SO.call(h,"graphQLErrors"))throw h;var d=t.result;(!d||d&&d.loading||!Ut(h,d.error))&&t.setResult({data:d&&d.data,error:h,loading:!1,networkStatus:St.error})},f=n.subscribe(u,c);return function(){setTimeout(function(){return f.unsubscribe()}),t.forceUpdate=function(){return t.forceUpdateState()}}},[n,this.renderPromises,this.client.disableNetworkFetches]),function(){return t.getCurrentResult()},function(){return t.getCurrentResult()});return this.unsafeHandlePartialRefetch(i),this.toQueryResult(i)},r.prototype.useOptions=function(e){var t,n=this.createWatchQueryOptions(this.queryHookOptions=e),i=this.watchQueryOptions;Ut(n,i)||(this.watchQueryOptions=n,i&&this.observable&&(this.observable.reobserve(this.getObsQueryOptions()),this.previousData=((t=this.result)===null||t===void 0?void 0:t.data)||this.previousData,this.result=void 0)),this.onCompleted=e.onCompleted||r.prototype.onCompleted,this.onError=e.onError||r.prototype.onError,(this.renderPromises||this.client.disableNetworkFetches)&&this.queryHookOptions.ssr===!1&&!this.queryHookOptions.skip?this.result=this.ssrDisabledResult:this.queryHookOptions.skip||this.watchQueryOptions.fetchPolicy==="standby"?this.result=this.skipStandbyResult:(this.result===this.ssrDisabledResult||this.result===this.skipStandbyResult)&&(this.result=void 0)},r.prototype.getObsQueryOptions=function(){var e=[],t=this.client.defaultOptions.watchQuery;return t&&e.push(t),this.queryHookOptions.defaultOptions&&e.push(this.queryHookOptions.defaultOptions),e.push(zi(this.observable&&this.observable.options,this.watchQueryOptions)),e.reduce(Hi)},r.prototype.createWatchQueryOptions=function(e){var t;e===void 0&&(e={});var n=e.skip;e.ssr,e.onCompleted,e.onError,e.defaultOptions;var i=pn(e,["skip","ssr","onCompleted","onError","defaultOptions"]),a=Object.assign(i,{query:this.query});if(this.renderPromises&&(a.fetchPolicy==="network-only"||a.fetchPolicy==="cache-and-network")&&(a.fetchPolicy="cache-first"),a.variables||(a.variables={}),n){var u=a.fetchPolicy,c=u===void 0?this.getDefaultFetchPolicy():u,f=a.initialFetchPolicy,h=f===void 0?c:f;Object.assign(a,{initialFetchPolicy:h,fetchPolicy:"standby"})}else a.fetchPolicy||(a.fetchPolicy=((t=this.observable)===null||t===void 0?void 0:t.options.initialFetchPolicy)||this.getDefaultFetchPolicy());return a},r.prototype.getDefaultFetchPolicy=function(){var e,t;return((e=this.queryHookOptions.defaultOptions)===null||e===void 0?void 0:e.fetchPolicy)||((t=this.client.defaultOptions.watchQuery)===null||t===void 0?void 0:t.fetchPolicy)||"cache-first"},r.prototype.onCompleted=function(e){},r.prototype.onError=function(e){},r.prototype.useObservableQuery=function(){var e=this.observable=this.renderPromises&&this.renderPromises.getSSRObservable(this.watchQueryOptions)||this.observable||this.client.watchQuery(this.getObsQueryOptions());this.obsQueryFields=Nt.useMemo(function(){return{refetch:e.refetch.bind(e),reobserve:e.reobserve.bind(e),fetchMore:e.fetchMore.bind(e),updateQuery:e.updateQuery.bind(e),startPolling:e.startPolling.bind(e),stopPolling:e.stopPolling.bind(e),subscribeToMore:e.subscribeToMore.bind(e)}},[e]);var t=!(this.queryHookOptions.ssr===!1||this.queryHookOptions.skip);return this.renderPromises&&t&&(this.renderPromises.registerSSRObservable(e),e.getCurrentResult().loading&&this.renderPromises.addObservableQueryPromise(e)),e},r.prototype.setResult=function(e){var t=this.result;t&&t.data&&(this.previousData=t.data),this.result=e,this.forceUpdate(),this.handleErrorOrCompleted(e,t)},r.prototype.handleErrorOrCompleted=function(e,t){var n=this;if(!e.loading){var i=this.toApolloError(e);Promise.resolve().then(function(){i?n.onError(i):e.data&&(t==null?void 0:t.networkStatus)!==e.networkStatus&&e.networkStatus===St.ready&&n.onCompleted(e.data)}).catch(function(a){globalThis.__DEV__!==!1&&Me.warn(a)})}},r.prototype.toApolloError=function(e){return mn(e.errors)?new oi({graphQLErrors:e.errors}):e.error},r.prototype.getCurrentResult=function(){return this.result||this.handleErrorOrCompleted(this.result=this.observable.getCurrentResult()),this.result},r.prototype.toQueryResult=function(e){var t=this.toQueryResultCache.get(e);if(t)return t;var n=e.data;e.partial;var i=pn(e,["data","partial"]);return this.toQueryResultCache.set(e,t=j(j(j({data:n},i),this.obsQueryFields),{client:this.client,observable:this.observable,variables:this.observable.variables,called:!this.queryHookOptions.skip,previousData:this.previousData})),!t.error&&mn(e.errors)&&(t.error=new oi({graphQLErrors:e.errors})),t},r.prototype.unsafeHandlePartialRefetch=function(e){e.partial&&this.queryHookOptions.partialRefetch&&!e.loading&&(!e.data||Object.keys(e.data).length===0)&&this.observable.options.fetchPolicy!=="cache-only"&&(Object.assign(e,{loading:!0,networkStatus:St.refetch}),this.observable.refetch())},r}(),TO=["refetch","reobserve","fetchMore","updateQuery","startPolling","subscribeToMore"];function AO(r,e){var t,n=Nt.useRef(),i=Nt.useRef(),a=Nt.useRef(),u=Hi(e,n.current||{}),c=(t=u==null?void 0:u.query)!==null&&t!==void 0?t:r;i.current=e,a.current=c;var f=EO(Gy(e&&e.client),c),h=f.useQuery(j(j({},u),{skip:!n.current})),d=h.observable.options.initialFetchPolicy||f.getDefaultFetchPolicy(),y=f.forceUpdateState,g=f.obsQueryFields,m=Nt.useMemo(function(){for(var S={},A=function($){var X=g[$];S[$]=function(){return n.current||(n.current=Object.create(null),y()),X.apply(this,arguments)}},P=0,F=TO;P<F.length;P++){var L=F[P];A(L)}return S},[y,g]),x=!!n.current,T=Nt.useMemo(function(){return j(j(j({},h),m),{called:x})},[h,m,x]),w=Nt.useCallback(function(S){n.current=S?j(j({},S),{fetchPolicy:S.fetchPolicy||d}):{fetchPolicy:d};var A=Hi(i.current,j({query:a.current},n.current)),P=f.executeQuery(j(j({},A),{skip:!1})).then(function(F){return Object.assign(F,m)});return P.catch(function(){}),P},[m,d,f]);return[w,T]}function kO(r,e){var t=Nt.useRef(!1),n=Gy(e==null?void 0:e.client);Zy(r,ui.Subscription);var i=Nt.useState({loading:!(e!=null&&e.skip),error:void 0,data:void 0,variables:e==null?void 0:e.variables}),a=i[0],u=i[1];t.current||(t.current=!0,e!=null&&e.onSubscriptionData&&globalThis.__DEV__!==!1&&Me.warn(e.onData?52:53),e!=null&&e.onSubscriptionComplete&&globalThis.__DEV__!==!1&&Me.warn(e.onComplete?54:55));var c=Nt.useState(function(){return e!=null&&e.skip?null:n.subscribe({query:r,variables:e==null?void 0:e.variables,fetchPolicy:e==null?void 0:e.fetchPolicy,context:e==null?void 0:e.context})}),f=c[0],h=c[1],d=Nt.useRef(!1);Nt.useEffect(function(){return function(){d.current=!0}},[]);var y=Nt.useRef({client:n,subscription:r,options:e});return Nt.useEffect(function(){var g,m,x,T,w=e==null?void 0:e.shouldResubscribe;typeof w=="function"&&(w=!!w(e)),e!=null&&e.skip?(!(e!=null&&e.skip)!=!(!((g=y.current.options)===null||g===void 0)&&g.skip)||d.current)&&(u({loading:!1,data:void 0,error:void 0,variables:e==null?void 0:e.variables}),h(null),d.current=!1):(w!==!1&&(n!==y.current.client||r!==y.current.subscription||(e==null?void 0:e.fetchPolicy)!==((m=y.current.options)===null||m===void 0?void 0:m.fetchPolicy)||!(e!=null&&e.skip)!=!(!((x=y.current.options)===null||x===void 0)&&x.skip)||!Ut(e==null?void 0:e.variables,(T=y.current.options)===null||T===void 0?void 0:T.variables))||d.current)&&(u({loading:!0,data:void 0,error:void 0,variables:e==null?void 0:e.variables}),h(n.subscribe({query:r,variables:e==null?void 0:e.variables,fetchPolicy:e==null?void 0:e.fetchPolicy,context:e==null?void 0:e.context})),d.current=!1),Object.assign(y.current,{client:n,subscription:r,options:e})},[n,r,e,d.current]),Nt.useEffect(function(){if(f){var g=!1,m=f.subscribe({next:function(x){var T,w;if(!g){var S={loading:!1,data:x.data,error:void 0,variables:e==null?void 0:e.variables};u(S),!((T=y.current.options)===null||T===void 0)&&T.onData?y.current.options.onData({client:n,data:S}):!((w=y.current.options)===null||w===void 0)&&w.onSubscriptionData&&y.current.options.onSubscriptionData({client:n,subscriptionData:S})}},error:function(x){var T,w;g||(u({loading:!1,data:void 0,error:x,variables:e==null?void 0:e.variables}),(w=(T=y.current.options)===null||T===void 0?void 0:T.onError)===null||w===void 0||w.call(T,x))},complete:function(){var x,T;g||(!((x=y.current.options)===null||x===void 0)&&x.onComplete?y.current.options.onComplete():!((T=y.current.options)===null||T===void 0)&&T.onSubscriptionComplete&&y.current.options.onSubscriptionComplete())}});return function(){g=!0,setTimeout(function(){m.unsubscribe()})}}},[f]),a}class Ss extends Error{}class IO extends Ss{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class PO extends Ss{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class CO extends Ss{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Xs extends Ss{}class Xy extends Ss{constructor(e){super(`Invalid unit ${e}`)}}class sn extends Ss{}class Yi extends Ss{constructor(){super("Zone is an abstract class")}}const Se="numeric",Jn="short",yn="long",Iu={year:Se,month:Se,day:Se},eg={year:Se,month:Jn,day:Se},NO={year:Se,month:Jn,day:Se,weekday:Jn},tg={year:Se,month:yn,day:Se},rg={year:Se,month:yn,day:Se,weekday:yn},ng={hour:Se,minute:Se},ig={hour:Se,minute:Se,second:Se},sg={hour:Se,minute:Se,second:Se,timeZoneName:Jn},ag={hour:Se,minute:Se,second:Se,timeZoneName:yn},og={hour:Se,minute:Se,hourCycle:"h23"},ug={hour:Se,minute:Se,second:Se,hourCycle:"h23"},cg={hour:Se,minute:Se,second:Se,hourCycle:"h23",timeZoneName:Jn},lg={hour:Se,minute:Se,second:Se,hourCycle:"h23",timeZoneName:yn},fg={year:Se,month:Se,day:Se,hour:Se,minute:Se},hg={year:Se,month:Se,day:Se,hour:Se,minute:Se,second:Se},dg={year:Se,month:Jn,day:Se,hour:Se,minute:Se},pg={year:Se,month:Jn,day:Se,hour:Se,minute:Se,second:Se},RO={year:Se,month:Jn,day:Se,weekday:Jn,hour:Se,minute:Se},mg={year:Se,month:yn,day:Se,hour:Se,minute:Se,timeZoneName:Jn},yg={year:Se,month:yn,day:Se,hour:Se,minute:Se,second:Se,timeZoneName:Jn},gg={year:Se,month:yn,day:Se,weekday:yn,hour:Se,minute:Se,timeZoneName:yn},vg={year:Se,month:yn,day:Se,weekday:yn,hour:Se,minute:Se,second:Se,timeZoneName:yn};class ao{get type(){throw new Yi}get name(){throw new Yi}get ianaName(){return this.name}get isUniversal(){throw new Yi}offsetName(e,t){throw new Yi}formatOffset(e,t){throw new Yi}offset(e){throw new Yi}equals(e){throw new Yi}get isValid(){throw new Yi}}let Of=null;class Pu extends ao{static get instance(){return Of===null&&(Of=new Pu),Of}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Bg(e,t,n)}formatOffset(e,t){return lo(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let Cu={};function DO(r){return Cu[r]||(Cu[r]=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"})),Cu[r]}const FO={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function MO(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,d]=n;return[u,i,a,c,f,h,d]}function LO(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:a,value:u}=t[i],c=FO[a];a==="era"?n[c]=u:it(c)||(n[c]=parseInt(u,10))}return n}let Nu={};class vi extends ao{static create(e){return Nu[e]||(Nu[e]=new vi(e)),Nu[e]}static resetCache(){Nu={},Cu={}}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=vi.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Bg(e,t,n,this.name)}formatOffset(e,t){return lo(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const n=DO(this.name);let[i,a,u,c,f,h,d]=n.formatToParts?LO(n,t):MO(n,t);c==="BC"&&(i=-Math.abs(i)+1);const g=Lu({year:i,month:a,day:u,hour:f===24?0:f,minute:h,second:d,millisecond:0});let m=+t;const x=m%1e3;return m-=x>=0?x:1e3+x,(g-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let bg={};function qO(r,e={}){const t=JSON.stringify([r,e]);let n=bg[t];return n||(n=new Intl.ListFormat(r,e),bg[t]=n),n}let Tf={};function Af(r,e={}){const t=JSON.stringify([r,e]);let n=Tf[t];return n||(n=new Intl.DateTimeFormat(r,e),Tf[t]=n),n}let kf={};function jO(r,e={}){const t=JSON.stringify([r,e]);let n=kf[t];return n||(n=new Intl.NumberFormat(r,e),kf[t]=n),n}let If={};function UO(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let a=If[i];return a||(a=new Intl.RelativeTimeFormat(r,e),If[i]=a),a}let oo=null;function $O(){return oo||(oo=new Intl.DateTimeFormat().resolvedOptions().locale,oo)}let wg={};function BO(r){let e=wg[r];if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,wg[r]=e}return e}function VO(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=Af(r).resolvedOptions(),i=r}catch{const f=r.substring(0,t);n=Af(f).resolvedOptions(),i=f}const{numberingSystem:a,calendar:u}=n;return[i,a,u]}}function WO(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function zO(r){const e=[];for(let t=1;t<=12;t++){const n=ut.utc(2009,t,1);e.push(r(n))}return e}function HO(r){const e=[];for(let t=1;t<=7;t++){const n=ut.utc(2016,11,13+t);e.push(r(n))}return e}function Ru(r,e,t,n){const i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function QO(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}class GO{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=jO(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):Mf(e,3);return br(t,this.padTo)}}}class JO{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&&vi.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=Af(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 YO{constructor(e,t,n){this.opts={style:"long",...n},!t&&qg()&&(this.rtf=UO(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):y1(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const KO={firstDay:1,minimalDays:4,weekend:[6,7]};class Bt{static fromOpts(e){return Bt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,i,a=!1){const u=e||dr.defaultLocale,c=u||(a?"en-US":$O()),f=t||dr.defaultNumberingSystem,h=n||dr.defaultOutputCalendar,d=Df(i)||dr.defaultWeekSettings;return new Bt(c,f,h,d,u)}static resetCache(){oo=null,Tf={},kf={},If={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:i}={}){return Bt.create(e,t,n,i)}constructor(e,t,n,i,a){const[u,c,f]=VO(e);this.locale=u,this.numberingSystem=t||c||null,this.outputCalendar=n||f||null,this.weekSettings=i,this.intl=WO(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=QO(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:Bt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Df(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 Ru(this,e,zg,()=>{const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=zO(a=>this.extract(a,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return Ru(this,e,Gg,()=>{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]=HO(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Ru(this,void 0,()=>Jg,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ut.utc(2016,11,13,9),ut.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Ru(this,e,Yg,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[ut.utc(-40,1,1),ut.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 GO(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new JO(e,this.intl,t)}relFormatter(e={}){return new YO(this.intl,this.isEnglish(),e)}listFormatter(e={}){return qO(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:jg()?BO(this.locale):KO}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}}let Pf=null;class Yr extends ao{static get utcInstance(){return Pf===null&&(Pf=new Yr(0)),Pf}static instance(e){return e===0?Yr.utcInstance:new Yr(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Yr(qu(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${lo(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${lo(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return lo(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 ZO extends ao{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 Ki(r,e){if(it(r)||r===null)return e;if(r instanceof ao)return r;if(t1(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Pu.instance:t==="utc"||t==="gmt"?Yr.utcInstance:Yr.parseSpecifier(t)||vi.create(r)}else return Es(r)?Yr.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new ZO(r)}let _g=()=>Date.now(),xg="system",Sg=null,Eg=null,Og=null,Tg=60,Ag,kg=null;class dr{static get now(){return _g}static set now(e){_g=e}static set defaultZone(e){xg=e}static get defaultZone(){return Ki(xg,Pu.instance)}static get defaultLocale(){return Sg}static set defaultLocale(e){Sg=e}static get defaultNumberingSystem(){return Eg}static set defaultNumberingSystem(e){Eg=e}static get defaultOutputCalendar(){return Og}static set defaultOutputCalendar(e){Og=e}static get defaultWeekSettings(){return kg}static set defaultWeekSettings(e){kg=Df(e)}static get twoDigitCutoffYear(){return Tg}static set twoDigitCutoffYear(e){Tg=e%100}static get throwOnInvalid(){return Ag}static set throwOnInvalid(e){Ag=e}static resetCaches(){Bt.resetCache(),vi.resetCache()}}class Yn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Ig=[0,31,59,90,120,151,181,212,243,273,304,334],Pg=[0,31,60,91,121,152,182,213,244,274,305,335];function Cn(r,e){return new Yn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function Cf(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 Cg(r,e,t){return t+(uo(r)?Pg:Ig)[e-1]}function Ng(r,e){const t=uo(r)?Pg:Ig,n=t.findIndex(a=>a<e),i=e-t[n];return{month:n+1,day:i}}function Nf(r,e){return(r-e+7)%7+1}function Du(r,e=4,t=1){const{year:n,month:i,day:a}=r,u=Cg(n,i,a),c=Nf(Cf(n,i,a),t);let f=Math.floor((u-c+14-e)/7),h;return f<1?(h=n-1,f=co(h,e,t)):f>co(n,e,t)?(h=n+1,f=1):h=n,{weekYear:h,weekNumber:f,weekday:c,...Uu(r)}}function Rg(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:a}=r,u=Nf(Cf(n,1,e),t),c=ta(n);let f=i*7+a-u-7+e,h;f<1?(h=n-1,f+=ta(h)):f>c?(h=n+1,f-=ta(n)):h=n;const{month:d,day:y}=Ng(h,f);return{year:h,month:d,day:y,...Uu(r)}}function Rf(r){const{year:e,month:t,day:n}=r,i=Cg(e,t,n);return{year:e,ordinal:i,...Uu(r)}}function Dg(r){const{year:e,ordinal:t}=r,{month:n,day:i}=Ng(e,t);return{year:e,month:n,day:i,...Uu(r)}}function Fg(r,e){if(!it(r.localWeekday)||!it(r.localWeekNumber)||!it(r.localWeekYear)){if(!it(r.weekday)||!it(r.weekNumber)||!it(r.weekYear))throw new Xs("Cannot mix locale-based week fields with ISO-based week fields");return it(r.localWeekday)||(r.weekday=r.localWeekday),it(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),it(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 XO(r,e=4,t=1){const n=Fu(r.weekYear),i=Nn(r.weekNumber,1,co(r.weekYear,e,t)),a=Nn(r.weekday,1,7);return n?i?a?!1:Cn("weekday",r.weekday):Cn("week",r.weekNumber):Cn("weekYear",r.weekYear)}function e1(r){const e=Fu(r.year),t=Nn(r.ordinal,1,ta(r.year));return e?t?!1:Cn("ordinal",r.ordinal):Cn("year",r.year)}function Mg(r){const e=Fu(r.year),t=Nn(r.month,1,12),n=Nn(r.day,1,Mu(r.year,r.month));return e?t?n?!1:Cn("day",r.day):Cn("month",r.month):Cn("year",r.year)}function Lg(r){const{hour:e,minute:t,second:n,millisecond:i}=r,a=Nn(e,0,23)||e===24&&t===0&&n===0&&i===0,u=Nn(t,0,59),c=Nn(n,0,59),f=Nn(i,0,999);return a?u?c?f?!1:Cn("millisecond",i):Cn("second",n):Cn("minute",t):Cn("hour",e)}function it(r){return typeof r>"u"}function Es(r){return typeof r=="number"}function Fu(r){return typeof r=="number"&&r%1===0}function t1(r){return typeof r=="string"}function r1(r){return Object.prototype.toString.call(r)==="[object Date]"}function qg(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function jg(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function n1(r){return Array.isArray(r)?r:[r]}function Ug(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 i1(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function ea(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Df(r){if(r==null)return null;if(typeof r!="object")throw new sn("Week settings must be an object");if(!Nn(r.firstDay,1,7)||!Nn(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Nn(e,1,7)))throw new sn("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Nn(r,e,t){return Fu(r)&&r>=e&&r<=t}function s1(r,e){return r-e*Math.floor(r/e)}function br(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function Zi(r){if(!(it(r)||r===null||r===""))return parseInt(r,10)}function Os(r){if(!(it(r)||r===null||r===""))return parseFloat(r)}function Ff(r){if(!(it(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function Mf(r,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function uo(r){return r%4===0&&(r%100!==0||r%400===0)}function ta(r){return uo(r)?366:365}function Mu(r,e){const t=s1(e-1,12)+1,n=r+(e-t)/12;return t===2?uo(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Lu(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 $g(r,e,t){return-Nf(Cf(r,1,e),t)+e-1}function co(r,e=4,t=1){const n=$g(r,e,t),i=$g(r+1,e,t);return(ta(r)-n+i)/7}function Lf(r){return r>99?r:r>dr.twoDigitCutoffYear?1900+r:2e3+r}function Bg(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 qu(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 Vg(r){const e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new sn(`Invalid unit value ${r}`);return e}function ju(r,e){const t={};for(const n in r)if(ea(r,n)){const i=r[n];if(i==null)continue;t[e(n)]=Vg(i)}return t}function lo(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}${br(t,2)}:${br(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${br(t,2)}${br(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Uu(r){return i1(r,["hour","minute","second","millisecond"])}const a1=["January","February","March","April","May","June","July","August","September","October","November","December"],Wg=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o1=["J","F","M","A","M","J","J","A","S","O","N","D"];function zg(r){switch(r){case"narrow":return[...o1];case"short":return[...Wg];case"long":return[...a1];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 Hg=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Qg=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],u1=["M","T","W","T","F","S","S"];function Gg(r){switch(r){case"narrow":return[...u1];case"short":return[...Qg];case"long":return[...Hg];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Jg=["AM","PM"],c1=["Before Christ","Anno Domini"],l1=["BC","AD"],f1=["B","A"];function Yg(r){switch(r){case"narrow":return[...f1];case"short":return[...l1];case"long":return[...c1];default:return null}}function h1(r){return Jg[r.hour<12?0:1]}function d1(r,e){return Gg(e)[r.weekday-1]}function p1(r,e){return zg(e)[r.month-1]}function m1(r,e){return Yg(e)[r.year<0?0:1]}function y1(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 y=r==="days";switch(e){case 1:return y?"tomorrow":`next ${i[r][0]}`;case-1:return y?"yesterday":`last ${i[r][0]}`;case 0:return y?"today":`this ${i[r][0]}`}}const u=Object.is(e,-0)||e<0,c=Math.abs(e),f=c===1,h=i[r],d=n?f?h[1]:h[2]||h[1]:f?i[r][0]:r;return u?`${c} ${d} ago`:`in ${c} ${d}`}function Kg(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const g1={D:Iu,DD:eg,DDD:tg,DDDD:rg,t:ng,tt:ig,ttt:sg,tttt:ag,T:og,TT:ug,TTT:cg,TTTT:lg,f:fg,ff:dg,fff:mg,ffff:gg,F:hg,FF:pg,FFF:yg,FFFF:vg};class Wr{static create(e,t={}){return new Wr(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&&a.push({literal:i||/^\s+$/.test(n),val: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 g1[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){if(this.opts.forceSimple)return br(e,t);const n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(m,x)=>this.loc.extract(e,m,x),u=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",c=()=>n?h1(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),f=(m,x)=>n?p1(e,m):a(x?{month:m}:{month:m,day:"numeric"},"month"),h=(m,x)=>n?d1(e,m):a(x?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),d=m=>{const x=Wr.macroTokenToFormatOpts(m);return x?this.formatWithSystemDefault(e,x):m},y=m=>n?m1(e,m):a({era:m},"era"),g=m=>{switch(m){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 y("short");case"GG":return y("long");case"GGGGG":return y("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 d(m)}};return Kg(Wr.parseFormat(t),g)}formatDurationFromString(e,t){const n=f=>{switch(f[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=f=>h=>{const d=n(h);return d?this.num(f.get(d),h.length):h},a=Wr.parseFormat(t),u=a.reduce((f,{literal:h,val:d})=>h?f:f.concat(d),[]),c=e.shiftTo(...u.map(n).filter(f=>f));return Kg(a,i(c))}}const Zg=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ra(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function na(...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 ia(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 Xg(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=Zi(e[t+i]);return[n,null,t+i]}}const ev=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,v1=`(?:${ev.source}?(?:\\[(${Zg.source})\\])?)?`,qf=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,tv=RegExp(`${qf.source}${v1}`),jf=RegExp(`(?:T${tv.source})?`),b1=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,w1=/(\d{4})-?W(\d\d)(?:-?(\d))?/,_1=/(\d{4})-?(\d{3})/,x1=Xg("weekYear","weekNumber","weekDay"),S1=Xg("year","ordinal"),E1=/(\d{4})-(\d\d)-(\d\d)/,rv=RegExp(`${qf.source} ?(?:${ev.source}|(${Zg.source}))?`),O1=RegExp(`(?: ${rv.source})?`);function sa(r,e,t){const n=r[e];return it(n)?t:Zi(n)}function T1(r,e){return[{year:sa(r,e),month:sa(r,e+1,1),day:sa(r,e+2,1)},null,e+3]}function aa(r,e){return[{hours:sa(r,e,0),minutes:sa(r,e+1,0),seconds:sa(r,e+2,0),milliseconds:Ff(r[e+3])},null,e+4]}function fo(r,e){const t=!r[e]&&!r[e+1],n=qu(r[e+1],r[e+2]),i=t?null:Yr.instance(n);return[{},i,e+3]}function ho(r,e){const t=r[e]?vi.create(r[e]):null;return[{},t,e+1]}const A1=RegExp(`^T?${qf.source}$`),k1=/^-?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 I1(r){const[e,t,n,i,a,u,c,f,h]=r,d=e[0]==="-",y=f&&f[0]==="-",g=(m,x=!1)=>m!==void 0&&(x||m&&d)?-m:m;return[{years:g(Os(t)),months:g(Os(n)),weeks:g(Os(i)),days:g(Os(a)),hours:g(Os(u)),minutes:g(Os(c)),seconds:g(Os(f),f==="-0"),milliseconds:g(Ff(h),y)}]}const P1={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Uf(r,e,t,n,i,a,u){const c={year:e.length===2?Lf(Zi(e)):Zi(e),month:Wg.indexOf(t)+1,day:Zi(n),hour:Zi(i),minute:Zi(a)};return u&&(c.second=Zi(u)),r&&(c.weekday=r.length>3?Hg.indexOf(r)+1:Qg.indexOf(r)+1),c}const C1=/^(?:(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 N1(r){const[,e,t,n,i,a,u,c,f,h,d,y]=r,g=Uf(e,i,n,t,a,u,c);let m;return f?m=P1[f]:h?m=0:m=qu(d,y),[g,new Yr(m)]}function R1(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const D1=/^(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$/,F1=/^(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$/,M1=/^(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 nv(r){const[,e,t,n,i,a,u,c]=r;return[Uf(e,i,n,t,a,u,c),Yr.utcInstance]}function L1(r){const[,e,t,n,i,a,u,c]=r;return[Uf(e,c,t,n,i,a,u),Yr.utcInstance]}const q1=ra(b1,jf),j1=ra(w1,jf),U1=ra(_1,jf),$1=ra(tv),iv=na(T1,aa,fo,ho),B1=na(x1,aa,fo,ho),V1=na(S1,aa,fo,ho),W1=na(aa,fo,ho);function z1(r){return ia(r,[q1,iv],[j1,B1],[U1,V1],[$1,W1])}function H1(r){return ia(R1(r),[C1,N1])}function Q1(r){return ia(r,[D1,nv],[F1,nv],[M1,L1])}function G1(r){return ia(r,[k1,I1])}const J1=na(aa);function Y1(r){return ia(r,[A1,J1])}const K1=ra(E1,O1),Z1=ra(rv),X1=na(aa,fo,ho);function eT(r){return ia(r,[K1,iv],[Z1,X1])}const sv="Invalid Duration",av={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},tT={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:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...av},Rn=146097/400,oa=146097/4800,rT={years:{quarters:4,months:12,weeks:Rn/7,days:Rn,hours:Rn*24,minutes:Rn*24*60,seconds:Rn*24*60*60,milliseconds:Rn*24*60*60*1e3},quarters:{months:3,weeks:Rn/28,days:Rn/4,hours:Rn*24/4,minutes:Rn*24*60/4,seconds:Rn*24*60*60/4,milliseconds:Rn*24*60*60*1e3/4},months:{weeks:oa/7,days:oa,hours:oa*24,minutes:oa*24*60,seconds:oa*24*60*60,milliseconds:oa*24*60*60*1e3},...av},Ts=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],nT=Ts.slice(0).reverse();function Xi(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 At(n)}function ov(r,e){let t=e.milliseconds??0;for(const n of nT.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function uv(r,e){const t=ov(r,e)<0?-1:1;Ts.reduceRight((n,i)=>{if(it(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),Ts.reduce((n,i)=>{if(it(e[i]))return n;if(n){const a=e[n]%1;e[n]-=a,e[i]+=a*r[n][i]}return i},null)}function iT(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class At{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?rT:tT;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Bt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return At.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new sn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new At({values:ju(e,At.normalizeUnit),loc:Bt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Es(e))return At.fromMillis(e);if(At.isDuration(e))return e;if(typeof e=="object")return At.fromObject(e);throw new sn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=G1(e);return n?At.fromObject(n,t):At.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=Y1(e);return n?At.fromObject(n,t):At.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new sn("need to specify a reason the Duration is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(dr.throwOnInvalid)throw new CO(n);return new At({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 Xy(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?Wr.create(this.loc,n).formatDurationFromString(this,e):sv}toHuman(e={}){if(!this.isValid)return sv;const t=Ts.map(n=>{const i=this.values[n];return it(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}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+=Mf(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},ut.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?ov(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=At.fromDurationLike(e),n={};for(const i of Ts)(ea(t.values,i)||ea(this.values,i))&&(n[i]=t.get(i)+this.get(i));return Xi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=At.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]=Vg(e(this.values[n],n));return Xi(this,{values:t},!0)}get(e){return this[At.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...ju(e,At.normalizeUnit)};return Xi(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 Xi(this,u)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return uv(this.matrix,e),Xi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=iT(this.normalize().shiftToAll().toObject());return Xi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(u=>At.normalizeUnit(u));const t={},n={},i=this.toObject();let a;for(const u of Ts)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;Es(i[u])&&(c+=i[u]);const f=Math.trunc(c);t[u]=f,n[u]=(c*1e3-f*1e3)/1e3}else Es(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 uv(this.matrix,t),Xi(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 Xi(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 Ts)if(!t(this.values[n],e.values[n]))return!1;return!0}}const ua="Invalid Interval";function sT(r,e){return!r||!r.isValid?lr.invalid("missing or invalid start"):!e||!e.isValid?lr.invalid("missing or invalid end"):e<r?lr.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 lr{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 sn("need to specify a reason the Interval is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(dr.throwOnInvalid)throw new PO(n);return new lr({invalid:n})}static fromDateTimes(e,t){const n=mo(e),i=mo(t),a=sT(n,i);return a??new lr({start:n,end:i})}static after(e,t){const n=At.fromDurationLike(t),i=mo(e);return lr.fromDateTimes(i,i.plus(n))}static before(e,t){const n=At.fromDurationLike(t),i=mo(e);return lr.fromDateTimes(i.minus(n),i)}static fromISO(e,t){const[n,i]=(e||"").split("/",2);if(n&&i){let a,u;try{a=ut.fromISO(n,t),u=a.isValid}catch{u=!1}let c,f;try{c=ut.fromISO(i,t),f=c.isValid}catch{f=!1}if(u&&f)return lr.fromDateTimes(a,c);if(u){const h=At.fromISO(i,t);if(h.isValid)return lr.after(a,h)}else if(f){const h=At.fromISO(n,t);if(h.isValid)return lr.before(c,h)}}return lr.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 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!=null&&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?lr.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(mo).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(lr.fromDateTimes(i,c)),i=c,a+=1}return n}splitBy(e){const t=At.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(lr.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:lr.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 lr.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(lr.fromDateTimes(t,f.time)),t=null);return lr.merge(i)}difference(...e){return lr.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ua}[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=Iu,t={}){return this.isValid?Wr.create(this.s.loc.clone(t),e).formatInterval(this):ua}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ua}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ua}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ua}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ua}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):At.invalid(this.invalidReason)}mapEndpoints(e){return lr.fromDateTimes(e(this.s),e(this.e))}}class $u{static hasDST(e=dr.defaultZone){const t=ut.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return vi.isValidZone(e)}static normalizeZone(e){return Ki(e,dr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Bt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||Bt.create(t,n,a)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||Bt.create(t,n,a)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Bt.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Bt.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Bt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Bt.create(t,null,"gregory").eras(e)}static features(){return{relative:qg(),localeWeek:jg()}}}function cv(r,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(At.fromMillis(n).as("days"))}function aT(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 d=cv(f,h);return(d-d%7)/7}],["days",cv]],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 oT(r,e,t,n){let[i,a,u,c]=aT(r,e,t);const f=e-i,h=t.filter(y=>["hours","minutes","seconds","milliseconds"].indexOf(y)>=0);h.length===0&&(u<e&&(u=i.plus({[c]:1})),u!==i&&(a[c]=(a[c]||0)+f/(u-i)));const d=At.fromObject(a,n);return h.length>0?At.fromMillis(f,n).shiftTo(...h).plus(d):d}const $f={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},lv={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]},uT=$f.hanidec.replace(/[\[|\]]/g,"").split("");function cT(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($f.hanidec)!==-1)e+=uT.indexOf(r[t]);else for(const i in lv){const[a,u]=lv[i];n>=a&&n<=u&&(e+=n-a)}}return parseInt(e,10)}else return e}function Kn({numberingSystem:r},e=""){return new RegExp(`${$f[r||"latn"]}${e}`)}const lT="missing Intl.DateTimeFormat.formatToParts support";function Rt(r,e=t=>t){return{regex:r,deser:([t])=>e(cT(t))}}const fv="[  ]",hv=new RegExp(fv,"g");function fT(r){return r.replace(/\./g,"\\.?").replace(hv,fv)}function dv(r){return r.replace(/\./g,"").replace(hv," ").toLowerCase()}function Zn(r,e){return r===null?null:{regex:RegExp(r.map(fT).join("|")),deser:([t])=>r.findIndex(n=>dv(t)===dv(n))+e}}function pv(r,e){return{regex:r,deser:([,t,n])=>qu(t,n),groups:e}}function Bu(r){return{regex:r,deser:([e])=>e}}function hT(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function dT(r,e){const t=Kn(e),n=Kn(e,"{2}"),i=Kn(e,"{3}"),a=Kn(e,"{4}"),u=Kn(e,"{6}"),c=Kn(e,"{1,2}"),f=Kn(e,"{1,3}"),h=Kn(e,"{1,6}"),d=Kn(e,"{1,9}"),y=Kn(e,"{2,4}"),g=Kn(e,"{4,6}"),m=w=>({regex:RegExp(hT(w.val)),deser:([S])=>S,literal:!0}),T=(w=>{if(r.literal)return m(w);switch(w.val){case"G":return Zn(e.eras("short"),0);case"GG":return Zn(e.eras("long"),0);case"y":return Rt(h);case"yy":return Rt(y,Lf);case"yyyy":return Rt(a);case"yyyyy":return Rt(g);case"yyyyyy":return Rt(u);case"M":return Rt(c);case"MM":return Rt(n);case"MMM":return Zn(e.months("short",!0),1);case"MMMM":return Zn(e.months("long",!0),1);case"L":return Rt(c);case"LL":return Rt(n);case"LLL":return Zn(e.months("short",!1),1);case"LLLL":return Zn(e.months("long",!1),1);case"d":return Rt(c);case"dd":return Rt(n);case"o":return Rt(f);case"ooo":return Rt(i);case"HH":return Rt(n);case"H":return Rt(c);case"hh":return Rt(n);case"h":return Rt(c);case"mm":return Rt(n);case"m":return Rt(c);case"q":return Rt(c);case"qq":return Rt(n);case"s":return Rt(c);case"ss":return Rt(n);case"S":return Rt(f);case"SSS":return Rt(i);case"u":return Bu(d);case"uu":return Bu(c);case"uuu":return Rt(t);case"a":return Zn(e.meridiems(),0);case"kkkk":return Rt(a);case"kk":return Rt(y,Lf);case"W":return Rt(c);case"WW":return Rt(n);case"E":case"c":return Rt(t);case"EEE":return Zn(e.weekdays("short",!1),1);case"EEEE":return Zn(e.weekdays("long",!1),1);case"ccc":return Zn(e.weekdays("short",!0),1);case"cccc":return Zn(e.weekdays("long",!0),1);case"Z":case"ZZ":return pv(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return pv(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Bu(/[a-z_+-/]{1,256}?/i);case" ":return Bu(/[^\S\n\r]/);default:return m(w)}})(r)||{invalidReason:lT};return T.token=r,T}const pT={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 mT(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=pT[u];if(typeof c=="object"&&(c=c[a]),c)return{literal:!1,val:c}}function yT(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function gT(r,e,t){const n=r.match(e);if(n){const i={};let a=1;for(const u in t)if(ea(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 vT(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 it(r.z)||(t=vi.create(r.z)),it(r.Z)||(t||(t=new Yr(r.Z)),n=r.Z),it(r.q)||(r.M=(r.q-1)*3+1),it(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),it(r.u)||(r.S=Ff(r.u)),[Object.keys(r).reduce((a,u)=>{const c=e(u);return c&&(a[c]=r[u]),a},{}),t,n]}let Bf=null;function bT(){return Bf||(Bf=ut.fromMillis(1555555555555)),Bf}function wT(r,e){if(r.literal)return r;const t=Wr.macroTokenToFormatOpts(r.val),n=gv(t,e);return n==null||n.includes(void 0)?r:n}function mv(r,e){return Array.prototype.concat(...r.map(t=>wT(t,e)))}function yv(r,e,t){const n=mv(Wr.parseFormat(t),r),i=n.map(u=>dT(u,r)),a=i.find(u=>u.invalidReason);if(a)return{input:e,tokens:n,invalidReason:a.invalidReason};{const[u,c]=yT(i),f=RegExp(u,"i"),[h,d]=gT(e,f,c),[y,g,m]=d?vT(d):[null,null,void 0];if(ea(d,"a")&&ea(d,"H"))throw new Xs("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:f,rawMatches:h,matches:d,result:y,zone:g,specificOffset:m}}}function _T(r,e,t){const{result:n,zone:i,specificOffset:a,invalidReason:u}=yv(r,e,t);return[n,i,a,u]}function gv(r,e){if(!r)return null;const n=Wr.create(e,r).dtFormatter(bT()),i=n.formatToParts(),a=n.resolvedOptions();return i.map(u=>mT(u,r,a))}const Vf="Invalid DateTime",vv=864e13;function Vu(r){return new Yn("unsupported zone",`the zone "${r.name}" is not supported`)}function Wf(r){return r.weekData===null&&(r.weekData=Du(r.c)),r.weekData}function zf(r){return r.localWeekData===null&&(r.localWeekData=Du(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function As(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new ut({...t,...e,old:t})}function bv(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 Wu(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 zu(r,e,t){return bv(Lu(r),e,t)}function wv(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,Mu(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},u=At.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=Lu(a);let[f,h]=bv(c,t,r.zone);return u!==0&&(f+=u,h=r.zone.offset(f)),{ts:f,o:h}}function po(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=ut.fromObject(r,{...t,zone:f,specificOffset:a});return u?h:h.setZone(c)}else return ut.invalid(new Yn("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Hu(r,e,t=!0){return r.isValid?Wr.create(Bt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function Hf(r,e){const t=r.c.year>9999||r.c.year<0;let n="";return t&&r.c.year>=0&&(n+="+"),n+=br(r.c.year,t?6:4),e?(n+="-",n+=br(r.c.month),n+="-",n+=br(r.c.day)):(n+=br(r.c.month),n+=br(r.c.day)),n}function _v(r,e,t,n,i,a){let u=br(r.c.hour);return e?(u+=":",u+=br(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(u+=":")):u+=br(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(u+=br(r.c.second),(r.c.millisecond!==0||!n)&&(u+=".",u+=br(r.c.millisecond,3))),i&&(r.isOffsetFixed&&r.offset===0&&!a?u+="Z":r.o<0?(u+="-",u+=br(Math.trunc(-r.o/60)),u+=":",u+=br(Math.trunc(-r.o%60))):(u+="+",u+=br(Math.trunc(r.o/60)),u+=":",u+=br(Math.trunc(r.o%60)))),a&&(u+="["+r.zone.ianaName+"]"),u}const xv={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},xT={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ST={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Sv=["year","month","day","hour","minute","second","millisecond"],ET=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],OT=["year","ordinal","hour","minute","second","millisecond"];function TT(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 Xy(r);return e}function Ev(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return TT(r)}}function Ov(r,e){const t=Ki(e.zone,dr.defaultZone),n=Bt.fromObject(e),i=dr.now();let a,u;if(it(r.year))a=i;else{for(const h of Sv)it(r[h])&&(r[h]=xv[h]);const c=Mg(r)||Lg(r);if(c)return ut.invalid(c);const f=t.offset(i);[a,u]=zu(r,f,t)}return new ut({ts:a,zone:t,loc:n,o:u})}function Tv(r,e,t){const n=it(t.round)?!0:t.round,i=(u,c)=>(u=Mf(u,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(u,c)),a=u=>t.calendary?e.hasSame(r,u)?0:e.startOf(u).diff(r.startOf(u),u).get(u):e.diff(r,u).get(u);if(t.unit)return i(a(t.unit),t.unit);for(const u of t.units){const c=a(u);if(Math.abs(c)>=1)return i(c,u)}return i(r>e?-0:0,t.units[t.units.length-1])}function Av(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]}class ut{constructor(e){const t=e.zone||dr.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Yn("invalid input"):null)||(t.isValid?null:Vu(t));this.ts=it(e.ts)?dr.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=t.offset(this.ts);i=Wu(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||Bt.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=a,this.isLuxonDateTime=!0}static now(){return new ut({})}static local(){const[e,t]=Av(arguments),[n,i,a,u,c,f,h]=t;return Ov({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static utc(){const[e,t]=Av(arguments),[n,i,a,u,c,f,h]=t;return e.zone=Yr.utcInstance,Ov({year:n,month:i,day:a,hour:u,minute:c,second:f,millisecond:h},e)}static fromJSDate(e,t={}){const n=r1(e)?e.valueOf():NaN;if(Number.isNaN(n))return ut.invalid("invalid input");const i=Ki(t.zone,dr.defaultZone);return i.isValid?new ut({ts:n,zone:i,loc:Bt.fromObject(t)}):ut.invalid(Vu(i))}static fromMillis(e,t={}){if(Es(e))return e<-vv||e>vv?ut.invalid("Timestamp out of range"):new ut({ts:e,zone:Ki(t.zone,dr.defaultZone),loc:Bt.fromObject(t)});throw new sn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Es(e))return new ut({ts:e*1e3,zone:Ki(t.zone,dr.defaultZone),loc:Bt.fromObject(t)});throw new sn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Ki(t.zone,dr.defaultZone);if(!n.isValid)return ut.invalid(Vu(n));const i=Bt.fromObject(t),a=ju(e,Ev),{minDaysInFirstWeek:u,startOfWeek:c}=Fg(a,i),f=dr.now(),h=it(t.specificOffset)?n.offset(f):t.specificOffset,d=!it(a.ordinal),y=!it(a.year),g=!it(a.month)||!it(a.day),m=y||g,x=a.weekYear||a.weekNumber;if((m||d)&&x)throw new Xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(g&&d)throw new Xs("Can't mix ordinal dates with month/day");const T=x||a.weekday&&!m;let w,S,A=Wu(f,h);T?(w=ET,S=xT,A=Du(A,u,c)):d?(w=OT,S=ST,A=Rf(A)):(w=Sv,S=xv);let P=!1;for(const de of w){const Ve=a[de];it(Ve)?P?a[de]=S[de]:a[de]=A[de]:P=!0}const F=T?XO(a,u,c):d?e1(a):Mg(a),L=F||Lg(a);if(L)return ut.invalid(L);const $=T?Rg(a,u,c):d?Dg(a):a,[X,te]=zu($,h,n),he=new ut({ts:X,zone:n,o:te,loc:i});return a.weekday&&m&&e.weekday!==he.weekday?ut.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${he.toISO()}`):he}static fromISO(e,t={}){const[n,i]=z1(e);return po(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=H1(e);return po(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=Q1(e);return po(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(it(e)||it(t))throw new sn("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:a=null}=n,u=Bt.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),[c,f,h,d]=_T(u,e,t);return d?ut.invalid(d):po(c,f,n,`format ${t}`,e,h)}static fromString(e,t,n={}){return ut.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=eT(e);return po(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new sn("need to specify a reason the DateTime is invalid");const n=e instanceof Yn?e:new Yn(e,t);if(dr.throwOnInvalid)throw new IO(n);return new ut({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=gv(e,Bt.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return mv(Wr.parseFormat(e),Bt.fromObject(t)).map(i=>i.val).join("")}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?Wf(this).weekYear:NaN}get weekNumber(){return this.isValid?Wf(this).weekNumber:NaN}get weekday(){return this.isValid?Wf(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?zf(this).weekday:NaN}get localWeekNumber(){return this.isValid?zf(this).weekNumber:NaN}get localWeekYear(){return this.isValid?zf(this).weekYear:NaN}get ordinal(){return this.isValid?Rf(this.c).ordinal:NaN}get monthShort(){return this.isValid?$u.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?$u.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?$u.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?$u.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=Lu(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,d=Wu(f,u),y=Wu(h,c);return d.hour===y.hour&&d.minute===y.minute&&d.second===y.second&&d.millisecond===y.millisecond?[As(this,{ts:f}),As(this,{ts:h})]:[this]}get isInLeapYear(){return uo(this.year)}get daysInMonth(){return Mu(this.year,this.month)}get daysInYear(){return this.isValid?ta(this.year):NaN}get weeksInWeekYear(){return this.isValid?co(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?co(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:i}=Wr.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(Yr.instance(e),t)}toLocal(){return this.setZone(dr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=Ki(e,dr.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]=zu(u,a,e)}return As(this,{ts:i,zone:e})}else return ut.invalid(Vu(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return As(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=ju(e,Ev),{minDaysInFirstWeek:n,startOfWeek:i}=Fg(t,this.loc),a=!it(t.weekYear)||!it(t.weekNumber)||!it(t.weekday),u=!it(t.ordinal),c=!it(t.year),f=!it(t.month)||!it(t.day),h=c||f,d=t.weekYear||t.weekNumber;if((h||u)&&d)throw new Xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new Xs("Can't mix ordinal dates with month/day");let y;a?y=Rg({...Du(this.c,n,i),...t},n,i):it(t.ordinal)?(y={...this.toObject(),...t},it(t.day)&&(y.day=Math.min(Mu(y.year,y.month),y.day))):y=Dg({...Rf(this.c),...t});const[g,m]=zu(y,this.o,this.zone);return As(this,{ts:g,o:m})}plus(e){if(!this.isValid)return this;const t=At.fromDurationLike(e);return As(this,wv(this,t))}minus(e){if(!this.isValid)return this;const t=At.fromDurationLike(e).negate();return As(this,wv(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},i=At.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?Wr.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Vf}toLocaleString(e=Iu,t={}){return this.isValid?Wr.create(this.loc.clone(t),e).formatDateTime(this):Vf}toLocaleParts(e={}){return this.isValid?Wr.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:a=!1}={}){if(!this.isValid)return null;const u=e==="extended";let c=Hf(this,u);return c+="T",c+=_v(this,u,t,n,i,a),c}toISODate({format:e="extended"}={}){return this.isValid?Hf(this,e==="extended"):null}toISOWeekDate(){return Hu(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:a=!1,format:u="extended"}={}){return this.isValid?(i?"T":"")+_v(this,u==="extended",t,e,n,a):null}toRFC2822(){return Hu(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Hu(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Hf(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")),Hu(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Vf}[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 At.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=n1(t).map(At.normalizeUnit),u=e.valueOf()>this.valueOf(),c=u?this:e,f=u?e:this,h=oT(c,f,a,i);return u?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(ut.now(),e,t)}until(e){return this.isValid?lr.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||ut.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),Tv(t,this.plus(n),{...e,numeric:"always",units:i,unit:a})}toRelativeCalendar(e={}){return this.isValid?Tv(e.base||ut.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(ut.isDateTime))throw new sn("min requires all arguments be DateTimes");return Ug(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(ut.isDateTime))throw new sn("max requires all arguments be DateTimes");return Ug(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:i=null,numberingSystem:a=null}=n,u=Bt.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});return yv(u,e,t)}static fromStringExplain(e,t,n={}){return ut.fromFormatExplain(e,t,n)}static get DATE_SHORT(){return Iu}static get DATE_MED(){return eg}static get DATE_MED_WITH_WEEKDAY(){return NO}static get DATE_FULL(){return tg}static get DATE_HUGE(){return rg}static get TIME_SIMPLE(){return ng}static get TIME_WITH_SECONDS(){return ig}static get TIME_WITH_SHORT_OFFSET(){return sg}static get TIME_WITH_LONG_OFFSET(){return ag}static get TIME_24_SIMPLE(){return og}static get TIME_24_WITH_SECONDS(){return ug}static get TIME_24_WITH_SHORT_OFFSET(){return cg}static get TIME_24_WITH_LONG_OFFSET(){return lg}static get DATETIME_SHORT(){return fg}static get DATETIME_SHORT_WITH_SECONDS(){return hg}static get DATETIME_MED(){return dg}static get DATETIME_MED_WITH_SECONDS(){return pg}static get DATETIME_MED_WITH_WEEKDAY(){return RO}static get DATETIME_FULL(){return mg}static get DATETIME_FULL_WITH_SECONDS(){return yg}static get DATETIME_HUGE(){return gg}static get DATETIME_HUGE_WITH_SECONDS(){return vg}}function mo(r){if(ut.isDateTime(r))return r;if(r&&r.valueOf&&Es(r.valueOf()))return ut.fromJSDate(r);if(r&&typeof r=="object")return ut.fromObject(r);throw new sn(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var Qu={exports:{}};/**
87
+ * @license
88
+ * Lodash <https://lodash.com/>
89
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
90
+ * Released under MIT license <https://lodash.com/license>
91
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
92
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
93
+ */Qu.exports,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,d="__lodash_placeholder__",y=1,g=2,m=4,x=1,T=2,w=1,S=2,A=4,P=8,F=16,L=32,$=64,X=128,te=256,he=512,de=30,Ve="...",Ae=800,je=16,Ge=1,ye=2,Je=3,ge=1/0,ue=9007199254740991,Ee=17976931348623157e292,Ne=NaN,xe=4294967295,Xe=xe-1,Et=xe>>>1,lt=[["ary",X],["bind",w],["bindKey",S],["curry",P],["curryRight",F],["flip",he],["partial",L],["partialRight",$],["rearg",te]],It="[object Arguments]",et="[object Array]",Ye="[object AsyncFunction]",dt="[object Boolean]",Re="[object Date]",bt="[object DOMException]",z="[object Error]",Y="[object Function]",V="[object GeneratorFunction]",G="[object Map]",Z="[object Number]",Q="[object Null]",Te="[object Object]",ze="[object Promise]",Ue="[object Proxy]",ce="[object RegExp]",be="[object Set]",Ze="[object String]",Ot="[object Symbol]",wt="[object Undefined]",Gt="[object WeakMap]",pt="[object WeakSet]",Lt="[object ArrayBuffer]",rr="[object DataView]",Rr="[object Float32Array]",zt="[object Float64Array]",Jt="[object Int8Array]",Zt="[object Int16Array]",W="[object Int32Array]",H="[object Uint8Array]",Be="[object Uint8ClampedArray]",$e="[object Uint16Array]",Tt="[object Uint32Array]",Ke=/\b__p \+= '';/g,nr=/\b(__p \+=) '' \+/g,fr=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Dt=/&(?:amp|lt|gt|quot|#39);/g,Ht=/[&<>"']/g,Ur=RegExp(Dt.source),$r=RegExp(Ht.source),ir=/<%-([\s\S]+?)%>/g,un=/<%([\s\S]+?)%>/g,_r=/<%=([\s\S]+?)%>/g,xr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Sr=/^\w*$/,Or=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ur=/[\\^$.*+?()[\]{}|]/g,zr=RegExp(ur.source),Tr=/^\s+/,Er=/\s/,Dr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,cn=/\{\n\/\* \[wrapped with (.+)\] \*/,Ln=/,? & /,R=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,me=/\\(\\)?/g,ke=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Le=/\w*$/,at=/^[-+]0x[0-9a-f]+$/i,nt=/^0b[01]+$/i,tt=/^\[object .+?Constructor\]$/,rt=/^0o[0-7]+$/i,_t=/^(?:0|[1-9]\d*)$/,b=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,I=/($^)/,k=/['\n\r\u2028\u2029\\]/g,C="\\ud800-\\udfff",D="\\u0300-\\u036f",U="\\ufe20-\\ufe2f",ne="\\u20d0-\\u20ff",le=D+U+ne,J="\\u2700-\\u27bf",re="a-z\\xdf-\\xf6\\xf8-\\xff",De="\\xac\\xb1\\xd7\\xf7",mt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Xt="\\u2000-\\u206f",_n=" \\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",Ai="A-Z\\xc0-\\xd6\\xd8-\\xde",Tb="\\ufe0e\\ufe0f",Ab=De+mt+Xt+_n,cd="['’]",oP="["+C+"]",kb="["+Ab+"]",pc="["+le+"]",Ib="\\d+",uP="["+J+"]",Pb="["+re+"]",Cb="[^"+C+Ab+Ib+J+re+Ai+"]",ld="\\ud83c[\\udffb-\\udfff]",cP="(?:"+pc+"|"+ld+")",Nb="[^"+C+"]",fd="(?:\\ud83c[\\udde6-\\uddff]){2}",hd="[\\ud800-\\udbff][\\udc00-\\udfff]",xa="["+Ai+"]",Rb="\\u200d",Db="(?:"+Pb+"|"+Cb+")",lP="(?:"+xa+"|"+Cb+")",Fb="(?:"+cd+"(?:d|ll|m|re|s|t|ve))?",Mb="(?:"+cd+"(?:D|LL|M|RE|S|T|VE))?",Lb=cP+"?",qb="["+Tb+"]?",fP="(?:"+Rb+"(?:"+[Nb,fd,hd].join("|")+")"+qb+Lb+")*",hP="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",dP="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",jb=qb+Lb+fP,pP="(?:"+[uP,fd,hd].join("|")+")"+jb,mP="(?:"+[Nb+pc+"?",pc,fd,hd,oP].join("|")+")",yP=RegExp(cd,"g"),gP=RegExp(pc,"g"),dd=RegExp(ld+"(?="+ld+")|"+mP+jb,"g"),vP=RegExp([xa+"?"+Pb+"+"+Fb+"(?="+[kb,xa,"$"].join("|")+")",lP+"+"+Mb+"(?="+[kb,xa+Db,"$"].join("|")+")",xa+"?"+Db+"+"+Fb,xa+"+"+Mb,dP,hP,Ib,pP].join("|"),"g"),bP=RegExp("["+Rb+C+le+Tb+"]"),wP=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_P=["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"],xP=-1,er={};er[Rr]=er[zt]=er[Jt]=er[Zt]=er[W]=er[H]=er[Be]=er[$e]=er[Tt]=!0,er[It]=er[et]=er[Lt]=er[dt]=er[rr]=er[Re]=er[z]=er[Y]=er[G]=er[Z]=er[Te]=er[ce]=er[be]=er[Ze]=er[Gt]=!1;var Yt={};Yt[It]=Yt[et]=Yt[Lt]=Yt[rr]=Yt[dt]=Yt[Re]=Yt[Rr]=Yt[zt]=Yt[Jt]=Yt[Zt]=Yt[W]=Yt[G]=Yt[Z]=Yt[Te]=Yt[ce]=Yt[be]=Yt[Ze]=Yt[Ot]=Yt[H]=Yt[Be]=Yt[$e]=Yt[Tt]=!0,Yt[z]=Yt[Y]=Yt[Gt]=!1;var SP={À:"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"},EP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},OP={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},TP={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},AP=parseFloat,kP=parseInt,Ub=typeof di=="object"&&di&&di.Object===Object&&di,IP=typeof self=="object"&&self&&self.Object===Object&&self,Br=Ub||IP||Function("return this")(),pd=e&&!e.nodeType&&e,Cs=pd&&!0&&r&&!r.nodeType&&r,$b=Cs&&Cs.exports===pd,md=$b&&Ub.process,qn=function(){try{var q=Cs&&Cs.require&&Cs.require("util").types;return q||md&&md.binding&&md.binding("util")}catch{}}(),Bb=qn&&qn.isArrayBuffer,Vb=qn&&qn.isDate,Wb=qn&&qn.isMap,zb=qn&&qn.isRegExp,Hb=qn&&qn.isSet,Qb=qn&&qn.isTypedArray;function xn(q,ee,K){switch(K.length){case 0:return q.call(ee);case 1:return q.call(ee,K[0]);case 2:return q.call(ee,K[0],K[1]);case 3:return q.call(ee,K[0],K[1],K[2])}return q.apply(ee,K)}function PP(q,ee,K,Pe){for(var st=-1,Ft=q==null?0:q.length;++st<Ft;){var Ar=q[st];ee(Pe,Ar,K(Ar),q)}return Pe}function jn(q,ee){for(var K=-1,Pe=q==null?0:q.length;++K<Pe&&ee(q[K],K,q)!==!1;);return q}function CP(q,ee){for(var K=q==null?0:q.length;K--&&ee(q[K],K,q)!==!1;);return q}function Gb(q,ee){for(var K=-1,Pe=q==null?0:q.length;++K<Pe;)if(!ee(q[K],K,q))return!1;return!0}function ss(q,ee){for(var K=-1,Pe=q==null?0:q.length,st=0,Ft=[];++K<Pe;){var Ar=q[K];ee(Ar,K,q)&&(Ft[st++]=Ar)}return Ft}function mc(q,ee){var K=q==null?0:q.length;return!!K&&Sa(q,ee,0)>-1}function yd(q,ee,K){for(var Pe=-1,st=q==null?0:q.length;++Pe<st;)if(K(ee,q[Pe]))return!0;return!1}function sr(q,ee){for(var K=-1,Pe=q==null?0:q.length,st=Array(Pe);++K<Pe;)st[K]=ee(q[K],K,q);return st}function as(q,ee){for(var K=-1,Pe=ee.length,st=q.length;++K<Pe;)q[st+K]=ee[K];return q}function gd(q,ee,K,Pe){var st=-1,Ft=q==null?0:q.length;for(Pe&&Ft&&(K=q[++st]);++st<Ft;)K=ee(K,q[st],st,q);return K}function NP(q,ee,K,Pe){var st=q==null?0:q.length;for(Pe&&st&&(K=q[--st]);st--;)K=ee(K,q[st],st,q);return K}function vd(q,ee){for(var K=-1,Pe=q==null?0:q.length;++K<Pe;)if(ee(q[K],K,q))return!0;return!1}var RP=bd("length");function DP(q){return q.split("")}function FP(q){return q.match(R)||[]}function Jb(q,ee,K){var Pe;return K(q,function(st,Ft,Ar){if(ee(st,Ft,Ar))return Pe=Ft,!1}),Pe}function yc(q,ee,K,Pe){for(var st=q.length,Ft=K+(Pe?1:-1);Pe?Ft--:++Ft<st;)if(ee(q[Ft],Ft,q))return Ft;return-1}function Sa(q,ee,K){return ee===ee?QP(q,ee,K):yc(q,Yb,K)}function MP(q,ee,K,Pe){for(var st=K-1,Ft=q.length;++st<Ft;)if(Pe(q[st],ee))return st;return-1}function Yb(q){return q!==q}function Kb(q,ee){var K=q==null?0:q.length;return K?_d(q,ee)/K:Ne}function bd(q){return function(ee){return ee==null?t:ee[q]}}function wd(q){return function(ee){return q==null?t:q[ee]}}function Zb(q,ee,K,Pe,st){return st(q,function(Ft,Ar,Qt){K=Pe?(Pe=!1,Ft):ee(K,Ft,Ar,Qt)}),K}function LP(q,ee){var K=q.length;for(q.sort(ee);K--;)q[K]=q[K].value;return q}function _d(q,ee){for(var K,Pe=-1,st=q.length;++Pe<st;){var Ft=ee(q[Pe]);Ft!==t&&(K=K===t?Ft:K+Ft)}return K}function xd(q,ee){for(var K=-1,Pe=Array(q);++K<q;)Pe[K]=ee(K);return Pe}function qP(q,ee){return sr(ee,function(K){return[K,q[K]]})}function Xb(q){return q&&q.slice(0,nw(q)+1).replace(Tr,"")}function Sn(q){return function(ee){return q(ee)}}function Sd(q,ee){return sr(ee,function(K){return q[K]})}function Do(q,ee){return q.has(ee)}function ew(q,ee){for(var K=-1,Pe=q.length;++K<Pe&&Sa(ee,q[K],0)>-1;);return K}function tw(q,ee){for(var K=q.length;K--&&Sa(ee,q[K],0)>-1;);return K}function jP(q,ee){for(var K=q.length,Pe=0;K--;)q[K]===ee&&++Pe;return Pe}var UP=wd(SP),$P=wd(EP);function BP(q){return"\\"+TP[q]}function VP(q,ee){return q==null?t:q[ee]}function Ea(q){return bP.test(q)}function WP(q){return wP.test(q)}function zP(q){for(var ee,K=[];!(ee=q.next()).done;)K.push(ee.value);return K}function Ed(q){var ee=-1,K=Array(q.size);return q.forEach(function(Pe,st){K[++ee]=[st,Pe]}),K}function rw(q,ee){return function(K){return q(ee(K))}}function os(q,ee){for(var K=-1,Pe=q.length,st=0,Ft=[];++K<Pe;){var Ar=q[K];(Ar===ee||Ar===d)&&(q[K]=d,Ft[st++]=K)}return Ft}function gc(q){var ee=-1,K=Array(q.size);return q.forEach(function(Pe){K[++ee]=Pe}),K}function HP(q){var ee=-1,K=Array(q.size);return q.forEach(function(Pe){K[++ee]=[Pe,Pe]}),K}function QP(q,ee,K){for(var Pe=K-1,st=q.length;++Pe<st;)if(q[Pe]===ee)return Pe;return-1}function GP(q,ee,K){for(var Pe=K+1;Pe--;)if(q[Pe]===ee)return Pe;return Pe}function Oa(q){return Ea(q)?YP(q):RP(q)}function ni(q){return Ea(q)?KP(q):DP(q)}function nw(q){for(var ee=q.length;ee--&&Er.test(q.charAt(ee)););return ee}var JP=wd(OP);function YP(q){for(var ee=dd.lastIndex=0;dd.test(q);)++ee;return ee}function KP(q){return q.match(dd)||[]}function ZP(q){return q.match(vP)||[]}var XP=function q(ee){ee=ee==null?Br:Ta.defaults(Br.Object(),ee,Ta.pick(Br,_P));var K=ee.Array,Pe=ee.Date,st=ee.Error,Ft=ee.Function,Ar=ee.Math,Qt=ee.Object,Od=ee.RegExp,eC=ee.String,Un=ee.TypeError,vc=K.prototype,tC=Ft.prototype,Aa=Qt.prototype,bc=ee["__core-js_shared__"],wc=tC.toString,$t=Aa.hasOwnProperty,rC=0,iw=function(){var s=/[^.]+$/.exec(bc&&bc.keys&&bc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),_c=Aa.toString,nC=wc.call(Qt),iC=Br._,sC=Od("^"+wc.call($t).replace(ur,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xc=$b?ee.Buffer:t,us=ee.Symbol,Sc=ee.Uint8Array,sw=xc?xc.allocUnsafe:t,Ec=rw(Qt.getPrototypeOf,Qt),aw=Qt.create,ow=Aa.propertyIsEnumerable,Oc=vc.splice,uw=us?us.isConcatSpreadable:t,Fo=us?us.iterator:t,Ns=us?us.toStringTag:t,Tc=function(){try{var s=Ls(Qt,"defineProperty");return s({},"",{}),s}catch{}}(),aC=ee.clearTimeout!==Br.clearTimeout&&ee.clearTimeout,oC=Pe&&Pe.now!==Br.Date.now&&Pe.now,uC=ee.setTimeout!==Br.setTimeout&&ee.setTimeout,Ac=Ar.ceil,kc=Ar.floor,Td=Qt.getOwnPropertySymbols,cC=xc?xc.isBuffer:t,cw=ee.isFinite,lC=vc.join,fC=rw(Qt.keys,Qt),kr=Ar.max,Hr=Ar.min,hC=Pe.now,dC=ee.parseInt,lw=Ar.random,pC=vc.reverse,Ad=Ls(ee,"DataView"),Mo=Ls(ee,"Map"),kd=Ls(ee,"Promise"),ka=Ls(ee,"Set"),Lo=Ls(ee,"WeakMap"),qo=Ls(Qt,"create"),Ic=Lo&&new Lo,Ia={},mC=qs(Ad),yC=qs(Mo),gC=qs(kd),vC=qs(ka),bC=qs(Lo),Pc=us?us.prototype:t,jo=Pc?Pc.valueOf:t,fw=Pc?Pc.toString:t;function _(s){if(hr(s)&&!ot(s)&&!(s instanceof vt)){if(s instanceof $n)return s;if($t.call(s,"__wrapped__"))return h_(s)}return new $n(s)}var Pa=function(){function s(){}return function(o){if(!cr(o))return{};if(aw)return aw(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function Cc(){}function $n(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}_.templateSettings={escape:ir,evaluate:un,interpolate:_r,variable:"",imports:{_}},_.prototype=Cc.prototype,_.prototype.constructor=_,$n.prototype=Pa(Cc.prototype),$n.prototype.constructor=$n;function vt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=xe,this.__views__=[]}function wC(){var s=new vt(this.__wrapped__);return s.__actions__=ln(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=ln(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=ln(this.__views__),s}function _C(){if(this.__filtered__){var s=new vt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function xC(){var s=this.__wrapped__.value(),o=this.__dir__,l=ot(s),p=o<0,v=l?s.length:0,O=DN(0,v,this.__views__),N=O.start,M=O.end,B=M-N,ie=p?M:N-1,ae=this.__iteratees__,fe=ae.length,Oe=0,qe=Hr(B,this.__takeCount__);if(!l||!p&&v==B&&qe==B)return Fw(s,this.__actions__);var He=[];e:for(;B--&&Oe<qe;){ie+=o;for(var ft=-1,Qe=s[ie];++ft<fe;){var yt=ae[ft],xt=yt.iteratee,Tn=yt.type,nn=xt(Qe);if(Tn==ye)Qe=nn;else if(!nn){if(Tn==Ge)continue e;break e}}He[Oe++]=Qe}return He}vt.prototype=Pa(Cc.prototype),vt.prototype.constructor=vt;function Rs(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function SC(){this.__data__=qo?qo(null):{},this.size=0}function EC(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function OC(s){var o=this.__data__;if(qo){var l=o[s];return l===f?t:l}return $t.call(o,s)?o[s]:t}function TC(s){var o=this.__data__;return qo?o[s]!==t:$t.call(o,s)}function AC(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=qo&&o===t?f:o,this}Rs.prototype.clear=SC,Rs.prototype.delete=EC,Rs.prototype.get=OC,Rs.prototype.has=TC,Rs.prototype.set=AC;function ki(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function kC(){this.__data__=[],this.size=0}function IC(s){var o=this.__data__,l=Nc(o,s);if(l<0)return!1;var p=o.length-1;return l==p?o.pop():Oc.call(o,l,1),--this.size,!0}function PC(s){var o=this.__data__,l=Nc(o,s);return l<0?t:o[l][1]}function CC(s){return Nc(this.__data__,s)>-1}function NC(s,o){var l=this.__data__,p=Nc(l,s);return p<0?(++this.size,l.push([s,o])):l[p][1]=o,this}ki.prototype.clear=kC,ki.prototype.delete=IC,ki.prototype.get=PC,ki.prototype.has=CC,ki.prototype.set=NC;function Ii(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function RC(){this.size=0,this.__data__={hash:new Rs,map:new(Mo||ki),string:new Rs}}function DC(s){var o=Wc(this,s).delete(s);return this.size-=o?1:0,o}function FC(s){return Wc(this,s).get(s)}function MC(s){return Wc(this,s).has(s)}function LC(s,o){var l=Wc(this,s),p=l.size;return l.set(s,o),this.size+=l.size==p?0:1,this}Ii.prototype.clear=RC,Ii.prototype.delete=DC,Ii.prototype.get=FC,Ii.prototype.has=MC,Ii.prototype.set=LC;function Ds(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Ii;++o<l;)this.add(s[o])}function qC(s){return this.__data__.set(s,f),this}function jC(s){return this.__data__.has(s)}Ds.prototype.add=Ds.prototype.push=qC,Ds.prototype.has=jC;function ii(s){var o=this.__data__=new ki(s);this.size=o.size}function UC(){this.__data__=new ki,this.size=0}function $C(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function BC(s){return this.__data__.get(s)}function VC(s){return this.__data__.has(s)}function WC(s,o){var l=this.__data__;if(l instanceof ki){var p=l.__data__;if(!Mo||p.length<i-1)return p.push([s,o]),this.size=++l.size,this;l=this.__data__=new Ii(p)}return l.set(s,o),this.size=l.size,this}ii.prototype.clear=UC,ii.prototype.delete=$C,ii.prototype.get=BC,ii.prototype.has=VC,ii.prototype.set=WC;function hw(s,o){var l=ot(s),p=!l&&js(s),v=!l&&!p&&ds(s),O=!l&&!p&&!v&&Da(s),N=l||p||v||O,M=N?xd(s.length,eC):[],B=M.length;for(var ie in s)(o||$t.call(s,ie))&&!(N&&(ie=="length"||v&&(ie=="offset"||ie=="parent")||O&&(ie=="buffer"||ie=="byteLength"||ie=="byteOffset")||Ri(ie,B)))&&M.push(ie);return M}function dw(s){var o=s.length;return o?s[jd(0,o-1)]:t}function zC(s,o){return zc(ln(s),Fs(o,0,s.length))}function HC(s){return zc(ln(s))}function Id(s,o,l){(l!==t&&!si(s[o],l)||l===t&&!(o in s))&&Pi(s,o,l)}function Uo(s,o,l){var p=s[o];(!($t.call(s,o)&&si(p,l))||l===t&&!(o in s))&&Pi(s,o,l)}function Nc(s,o){for(var l=s.length;l--;)if(si(s[l][0],o))return l;return-1}function QC(s,o,l,p){return cs(s,function(v,O,N){o(p,v,l(v),N)}),p}function pw(s,o){return s&&fi(o,Fr(o),s)}function GC(s,o){return s&&fi(o,hn(o),s)}function Pi(s,o,l){o=="__proto__"&&Tc?Tc(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function Pd(s,o){for(var l=-1,p=o.length,v=K(p),O=s==null;++l<p;)v[l]=O?t:lp(s,o[l]);return v}function Fs(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,p,v,O){var N,M=o&y,B=o&g,ie=o&m;if(l&&(N=v?l(s,p,v,O):l(s)),N!==t)return N;if(!cr(s))return s;var ae=ot(s);if(ae){if(N=MN(s),!M)return ln(s,N)}else{var fe=Qr(s),Oe=fe==Y||fe==V;if(ds(s))return qw(s,M);if(fe==Te||fe==It||Oe&&!v){if(N=B||Oe?{}:n_(s),!M)return B?ON(s,GC(N,s)):EN(s,pw(N,s))}else{if(!Yt[fe])return v?s:{};N=LN(s,fe,M)}}O||(O=new ii);var qe=O.get(s);if(qe)return qe;O.set(s,N),N_(s)?s.forEach(function(Qe){N.add(Bn(Qe,o,l,Qe,s,O))}):P_(s)&&s.forEach(function(Qe,yt){N.set(yt,Bn(Qe,o,l,yt,s,O))});var He=ie?B?Yd:Jd:B?hn:Fr,ft=ae?t:He(s);return jn(ft||s,function(Qe,yt){ft&&(yt=Qe,Qe=s[yt]),Uo(N,yt,Bn(Qe,o,l,yt,s,O))}),N}function JC(s){var o=Fr(s);return function(l){return mw(l,s,o)}}function mw(s,o,l){var p=l.length;if(s==null)return!p;for(s=Qt(s);p--;){var v=l[p],O=o[v],N=s[v];if(N===t&&!(v in s)||!O(N))return!1}return!0}function yw(s,o,l){if(typeof s!="function")throw new Un(u);return Qo(function(){s.apply(t,l)},o)}function $o(s,o,l,p){var v=-1,O=mc,N=!0,M=s.length,B=[],ie=o.length;if(!M)return B;l&&(o=sr(o,Sn(l))),p?(O=yd,N=!1):o.length>=i&&(O=Do,N=!1,o=new Ds(o));e:for(;++v<M;){var ae=s[v],fe=l==null?ae:l(ae);if(ae=p||ae!==0?ae:0,N&&fe===fe){for(var Oe=ie;Oe--;)if(o[Oe]===fe)continue e;B.push(ae)}else O(o,fe,p)||B.push(ae)}return B}var cs=Vw(li),gw=Vw(Nd,!0);function YC(s,o){var l=!0;return cs(s,function(p,v,O){return l=!!o(p,v,O),l}),l}function Rc(s,o,l){for(var p=-1,v=s.length;++p<v;){var O=s[p],N=o(O);if(N!=null&&(M===t?N===N&&!On(N):l(N,M)))var M=N,B=O}return B}function KC(s,o,l,p){var v=s.length;for(l=ct(l),l<0&&(l=-l>v?0:v+l),p=p===t||p>v?v:ct(p),p<0&&(p+=v),p=l>p?0:D_(p);l<p;)s[l++]=o;return s}function vw(s,o){var l=[];return cs(s,function(p,v,O){o(p,v,O)&&l.push(p)}),l}function Vr(s,o,l,p,v){var O=-1,N=s.length;for(l||(l=jN),v||(v=[]);++O<N;){var M=s[O];o>0&&l(M)?o>1?Vr(M,o-1,l,p,v):as(v,M):p||(v[v.length]=M)}return v}var Cd=Ww(),bw=Ww(!0);function li(s,o){return s&&Cd(s,o,Fr)}function Nd(s,o){return s&&bw(s,o,Fr)}function Dc(s,o){return ss(o,function(l){return Di(s[l])})}function Ms(s,o){o=fs(o,s);for(var l=0,p=o.length;s!=null&&l<p;)s=s[hi(o[l++])];return l&&l==p?s:t}function ww(s,o,l){var p=o(s);return ot(s)?p:as(p,l(s))}function tn(s){return s==null?s===t?wt:Q:Ns&&Ns in Qt(s)?RN(s):HN(s)}function Rd(s,o){return s>o}function ZC(s,o){return s!=null&&$t.call(s,o)}function XC(s,o){return s!=null&&o in Qt(s)}function eN(s,o,l){return s>=Hr(o,l)&&s<kr(o,l)}function Dd(s,o,l){for(var p=l?yd:mc,v=s[0].length,O=s.length,N=O,M=K(O),B=1/0,ie=[];N--;){var ae=s[N];N&&o&&(ae=sr(ae,Sn(o))),B=Hr(ae.length,B),M[N]=!l&&(o||v>=120&&ae.length>=120)?new Ds(N&&ae):t}ae=s[0];var fe=-1,Oe=M[0];e:for(;++fe<v&&ie.length<B;){var qe=ae[fe],He=o?o(qe):qe;if(qe=l||qe!==0?qe:0,!(Oe?Do(Oe,He):p(ie,He,l))){for(N=O;--N;){var ft=M[N];if(!(ft?Do(ft,He):p(s[N],He,l)))continue e}Oe&&Oe.push(He),ie.push(qe)}}return ie}function tN(s,o,l,p){return li(s,function(v,O,N){o(p,l(v),O,N)}),p}function Bo(s,o,l){o=fs(o,s),s=o_(s,o);var p=s==null?s:s[hi(Wn(o))];return p==null?t:xn(p,s,l)}function _w(s){return hr(s)&&tn(s)==It}function rN(s){return hr(s)&&tn(s)==Lt}function nN(s){return hr(s)&&tn(s)==Re}function Vo(s,o,l,p,v){return s===o?!0:s==null||o==null||!hr(s)&&!hr(o)?s!==s&&o!==o:iN(s,o,l,p,Vo,v)}function iN(s,o,l,p,v,O){var N=ot(s),M=ot(o),B=N?et:Qr(s),ie=M?et:Qr(o);B=B==It?Te:B,ie=ie==It?Te:ie;var ae=B==Te,fe=ie==Te,Oe=B==ie;if(Oe&&ds(s)){if(!ds(o))return!1;N=!0,ae=!1}if(Oe&&!ae)return O||(O=new ii),N||Da(s)?e_(s,o,l,p,v,O):CN(s,o,B,l,p,v,O);if(!(l&x)){var qe=ae&&$t.call(s,"__wrapped__"),He=fe&&$t.call(o,"__wrapped__");if(qe||He){var ft=qe?s.value():s,Qe=He?o.value():o;return O||(O=new ii),v(ft,Qe,l,p,O)}}return Oe?(O||(O=new ii),NN(s,o,l,p,v,O)):!1}function sN(s){return hr(s)&&Qr(s)==G}function Fd(s,o,l,p){var v=l.length,O=v,N=!p;if(s==null)return!O;for(s=Qt(s);v--;){var M=l[v];if(N&&M[2]?M[1]!==s[M[0]]:!(M[0]in s))return!1}for(;++v<O;){M=l[v];var B=M[0],ie=s[B],ae=M[1];if(N&&M[2]){if(ie===t&&!(B in s))return!1}else{var fe=new ii;if(p)var Oe=p(ie,ae,B,s,o,fe);if(!(Oe===t?Vo(ae,ie,x|T,p,fe):Oe))return!1}}return!0}function xw(s){if(!cr(s)||$N(s))return!1;var o=Di(s)?sC:tt;return o.test(qs(s))}function aN(s){return hr(s)&&tn(s)==ce}function oN(s){return hr(s)&&Qr(s)==be}function uN(s){return hr(s)&&Kc(s.length)&&!!er[tn(s)]}function Sw(s){return typeof s=="function"?s:s==null?dn:typeof s=="object"?ot(s)?Tw(s[0],s[1]):Ow(s):z_(s)}function Md(s){if(!Ho(s))return fC(s);var o=[];for(var l in Qt(s))$t.call(s,l)&&l!="constructor"&&o.push(l);return o}function cN(s){if(!cr(s))return zN(s);var o=Ho(s),l=[];for(var p in s)p=="constructor"&&(o||!$t.call(s,p))||l.push(p);return l}function Ld(s,o){return s<o}function Ew(s,o){var l=-1,p=fn(s)?K(s.length):[];return cs(s,function(v,O,N){p[++l]=o(v,O,N)}),p}function Ow(s){var o=Zd(s);return o.length==1&&o[0][2]?s_(o[0][0],o[0][1]):function(l){return l===s||Fd(l,s,o)}}function Tw(s,o){return ep(s)&&i_(o)?s_(hi(s),o):function(l){var p=lp(l,s);return p===t&&p===o?fp(l,s):Vo(o,p,x|T)}}function Fc(s,o,l,p,v){s!==o&&Cd(o,function(O,N){if(v||(v=new ii),cr(O))lN(s,o,N,l,Fc,p,v);else{var M=p?p(rp(s,N),O,N+"",s,o,v):t;M===t&&(M=O),Id(s,N,M)}},hn)}function lN(s,o,l,p,v,O,N){var M=rp(s,l),B=rp(o,l),ie=N.get(B);if(ie){Id(s,l,ie);return}var ae=O?O(M,B,l+"",s,o,N):t,fe=ae===t;if(fe){var Oe=ot(B),qe=!Oe&&ds(B),He=!Oe&&!qe&&Da(B);ae=B,Oe||qe||He?ot(M)?ae=M:yr(M)?ae=ln(M):qe?(fe=!1,ae=qw(B,!0)):He?(fe=!1,ae=jw(B,!0)):ae=[]:Go(B)||js(B)?(ae=M,js(M)?ae=F_(M):(!cr(M)||Di(M))&&(ae=n_(B))):fe=!1}fe&&(N.set(B,ae),v(ae,B,p,O,N),N.delete(B)),Id(s,l,ae)}function Aw(s,o){var l=s.length;if(l)return o+=o<0?l:0,Ri(o,l)?s[o]:t}function kw(s,o,l){o.length?o=sr(o,function(O){return ot(O)?function(N){return Ms(N,O.length===1?O[0]:O)}:O}):o=[dn];var p=-1;o=sr(o,Sn(We()));var v=Ew(s,function(O,N,M){var B=sr(o,function(ie){return ie(O)});return{criteria:B,index:++p,value:O}});return LP(v,function(O,N){return SN(O,N,l)})}function fN(s,o){return Iw(s,o,function(l,p){return fp(s,p)})}function Iw(s,o,l){for(var p=-1,v=o.length,O={};++p<v;){var N=o[p],M=Ms(s,N);l(M,N)&&Wo(O,fs(N,s),M)}return O}function hN(s){return function(o){return Ms(o,s)}}function qd(s,o,l,p){var v=p?MP:Sa,O=-1,N=o.length,M=s;for(s===o&&(o=ln(o)),l&&(M=sr(s,Sn(l)));++O<N;)for(var B=0,ie=o[O],ae=l?l(ie):ie;(B=v(M,ae,B,p))>-1;)M!==s&&Oc.call(M,B,1),Oc.call(s,B,1);return s}function Pw(s,o){for(var l=s?o.length:0,p=l-1;l--;){var v=o[l];if(l==p||v!==O){var O=v;Ri(v)?Oc.call(s,v,1):Bd(s,v)}}return s}function jd(s,o){return s+kc(lw()*(o-s+1))}function dN(s,o,l,p){for(var v=-1,O=kr(Ac((o-s)/(l||1)),0),N=K(O);O--;)N[p?O:++v]=s,s+=l;return N}function Ud(s,o){var l="";if(!s||o<1||o>ue)return l;do o%2&&(l+=s),o=kc(o/2),o&&(s+=s);while(o);return l}function ht(s,o){return np(a_(s,o,dn),s+"")}function pN(s){return dw(Fa(s))}function mN(s,o){var l=Fa(s);return zc(l,Fs(o,0,l.length))}function Wo(s,o,l,p){if(!cr(s))return s;o=fs(o,s);for(var v=-1,O=o.length,N=O-1,M=s;M!=null&&++v<O;){var B=hi(o[v]),ie=l;if(B==="__proto__"||B==="constructor"||B==="prototype")return s;if(v!=N){var ae=M[B];ie=p?p(ae,B,M):t,ie===t&&(ie=cr(ae)?ae:Ri(o[v+1])?[]:{})}Uo(M,B,ie),M=M[B]}return s}var Cw=Ic?function(s,o){return Ic.set(s,o),s}:dn,yN=Tc?function(s,o){return Tc(s,"toString",{configurable:!0,enumerable:!1,value:dp(o),writable:!0})}:dn;function gN(s){return zc(Fa(s))}function Vn(s,o,l){var p=-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 O=K(v);++p<v;)O[p]=s[p+o];return O}function vN(s,o){var l;return cs(s,function(p,v,O){return l=o(p,v,O),!l}),!!l}function Mc(s,o,l){var p=0,v=s==null?p:s.length;if(typeof o=="number"&&o===o&&v<=Et){for(;p<v;){var O=p+v>>>1,N=s[O];N!==null&&!On(N)&&(l?N<=o:N<o)?p=O+1:v=O}return v}return $d(s,o,dn,l)}function $d(s,o,l,p){var v=0,O=s==null?0:s.length;if(O===0)return 0;o=l(o);for(var N=o!==o,M=o===null,B=On(o),ie=o===t;v<O;){var ae=kc((v+O)/2),fe=l(s[ae]),Oe=fe!==t,qe=fe===null,He=fe===fe,ft=On(fe);if(N)var Qe=p||He;else ie?Qe=He&&(p||Oe):M?Qe=He&&Oe&&(p||!qe):B?Qe=He&&Oe&&!qe&&(p||!ft):qe||ft?Qe=!1:Qe=p?fe<=o:fe<o;Qe?v=ae+1:O=ae}return Hr(O,Xe)}function Nw(s,o){for(var l=-1,p=s.length,v=0,O=[];++l<p;){var N=s[l],M=o?o(N):N;if(!l||!si(M,B)){var B=M;O[v++]=N===0?0:N}}return O}function Rw(s){return typeof s=="number"?s:On(s)?Ne:+s}function En(s){if(typeof s=="string")return s;if(ot(s))return sr(s,En)+"";if(On(s))return fw?fw.call(s):"";var o=s+"";return o=="0"&&1/s==-ge?"-0":o}function ls(s,o,l){var p=-1,v=mc,O=s.length,N=!0,M=[],B=M;if(l)N=!1,v=yd;else if(O>=i){var ie=o?null:IN(s);if(ie)return gc(ie);N=!1,v=Do,B=new Ds}else B=o?[]:M;e:for(;++p<O;){var ae=s[p],fe=o?o(ae):ae;if(ae=l||ae!==0?ae:0,N&&fe===fe){for(var Oe=B.length;Oe--;)if(B[Oe]===fe)continue e;o&&B.push(fe),M.push(ae)}else v(B,fe,l)||(B!==M&&B.push(fe),M.push(ae))}return M}function Bd(s,o){return o=fs(o,s),s=o_(s,o),s==null||delete s[hi(Wn(o))]}function Dw(s,o,l,p){return Wo(s,o,l(Ms(s,o)),p)}function Lc(s,o,l,p){for(var v=s.length,O=p?v:-1;(p?O--:++O<v)&&o(s[O],O,s););return l?Vn(s,p?0:O,p?O+1:v):Vn(s,p?O+1:0,p?v:O)}function Fw(s,o){var l=s;return l instanceof vt&&(l=l.value()),gd(o,function(p,v){return v.func.apply(v.thisArg,as([p],v.args))},l)}function Vd(s,o,l){var p=s.length;if(p<2)return p?ls(s[0]):[];for(var v=-1,O=K(p);++v<p;)for(var N=s[v],M=-1;++M<p;)M!=v&&(O[v]=$o(O[v]||N,s[M],o,l));return ls(Vr(O,1),o,l)}function Mw(s,o,l){for(var p=-1,v=s.length,O=o.length,N={};++p<v;){var M=p<O?o[p]:t;l(N,s[p],M)}return N}function Wd(s){return yr(s)?s:[]}function zd(s){return typeof s=="function"?s:dn}function fs(s,o){return ot(s)?s:ep(s,o)?[s]:f_(qt(s))}var bN=ht;function hs(s,o,l){var p=s.length;return l=l===t?p:l,!o&&l>=p?s:Vn(s,o,l)}var Lw=aC||function(s){return Br.clearTimeout(s)};function qw(s,o){if(o)return s.slice();var l=s.length,p=sw?sw(l):new s.constructor(l);return s.copy(p),p}function Hd(s){var o=new s.constructor(s.byteLength);return new Sc(o).set(new Sc(s)),o}function wN(s,o){var l=o?Hd(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function _N(s){var o=new s.constructor(s.source,Le.exec(s));return o.lastIndex=s.lastIndex,o}function xN(s){return jo?Qt(jo.call(s)):{}}function jw(s,o){var l=o?Hd(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function Uw(s,o){if(s!==o){var l=s!==t,p=s===null,v=s===s,O=On(s),N=o!==t,M=o===null,B=o===o,ie=On(o);if(!M&&!ie&&!O&&s>o||O&&N&&B&&!M&&!ie||p&&N&&B||!l&&B||!v)return 1;if(!p&&!O&&!ie&&s<o||ie&&l&&v&&!p&&!O||M&&l&&v||!N&&v||!B)return-1}return 0}function SN(s,o,l){for(var p=-1,v=s.criteria,O=o.criteria,N=v.length,M=l.length;++p<N;){var B=Uw(v[p],O[p]);if(B){if(p>=M)return B;var ie=l[p];return B*(ie=="desc"?-1:1)}}return s.index-o.index}function $w(s,o,l,p){for(var v=-1,O=s.length,N=l.length,M=-1,B=o.length,ie=kr(O-N,0),ae=K(B+ie),fe=!p;++M<B;)ae[M]=o[M];for(;++v<N;)(fe||v<O)&&(ae[l[v]]=s[v]);for(;ie--;)ae[M++]=s[v++];return ae}function Bw(s,o,l,p){for(var v=-1,O=s.length,N=-1,M=l.length,B=-1,ie=o.length,ae=kr(O-M,0),fe=K(ae+ie),Oe=!p;++v<ae;)fe[v]=s[v];for(var qe=v;++B<ie;)fe[qe+B]=o[B];for(;++N<M;)(Oe||v<O)&&(fe[qe+l[N]]=s[v++]);return fe}function ln(s,o){var l=-1,p=s.length;for(o||(o=K(p));++l<p;)o[l]=s[l];return o}function fi(s,o,l,p){var v=!l;l||(l={});for(var O=-1,N=o.length;++O<N;){var M=o[O],B=p?p(l[M],s[M],M,l,s):t;B===t&&(B=s[M]),v?Pi(l,M,B):Uo(l,M,B)}return l}function EN(s,o){return fi(s,Xd(s),o)}function ON(s,o){return fi(s,t_(s),o)}function qc(s,o){return function(l,p){var v=ot(l)?PP:QC,O=o?o():{};return v(l,s,We(p,2),O)}}function Ca(s){return ht(function(o,l){var p=-1,v=l.length,O=v>1?l[v-1]:t,N=v>2?l[2]:t;for(O=s.length>3&&typeof O=="function"?(v--,O):t,N&&rn(l[0],l[1],N)&&(O=v<3?t:O,v=1),o=Qt(o);++p<v;){var M=l[p];M&&s(o,M,p,O)}return o})}function Vw(s,o){return function(l,p){if(l==null)return l;if(!fn(l))return s(l,p);for(var v=l.length,O=o?v:-1,N=Qt(l);(o?O--:++O<v)&&p(N[O],O,N)!==!1;);return l}}function Ww(s){return function(o,l,p){for(var v=-1,O=Qt(o),N=p(o),M=N.length;M--;){var B=N[s?M:++v];if(l(O[B],B,O)===!1)break}return o}}function TN(s,o,l){var p=o&w,v=zo(s);function O(){var N=this&&this!==Br&&this instanceof O?v:s;return N.apply(p?l:this,arguments)}return O}function zw(s){return function(o){o=qt(o);var l=Ea(o)?ni(o):t,p=l?l[0]:o.charAt(0),v=l?hs(l,1).join(""):o.slice(1);return p[s]()+v}}function Na(s){return function(o){return gd(V_(B_(o).replace(yP,"")),s,"")}}function zo(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=Pa(s.prototype),p=s.apply(l,o);return cr(p)?p:l}}function AN(s,o,l){var p=zo(s);function v(){for(var O=arguments.length,N=K(O),M=O,B=Ra(v);M--;)N[M]=arguments[M];var ie=O<3&&N[0]!==B&&N[O-1]!==B?[]:os(N,B);if(O-=ie.length,O<l)return Yw(s,o,jc,v.placeholder,t,N,ie,t,t,l-O);var ae=this&&this!==Br&&this instanceof v?p:s;return xn(ae,this,N)}return v}function Hw(s){return function(o,l,p){var v=Qt(o);if(!fn(o)){var O=We(l,3);o=Fr(o),l=function(M){return O(v[M],M,v)}}var N=s(o,l,p);return N>-1?v[O?o[N]:N]:t}}function Qw(s){return Ni(function(o){var l=o.length,p=l,v=$n.prototype.thru;for(s&&o.reverse();p--;){var O=o[p];if(typeof O!="function")throw new Un(u);if(v&&!N&&Vc(O)=="wrapper")var N=new $n([],!0)}for(p=N?p:l;++p<l;){O=o[p];var M=Vc(O),B=M=="wrapper"?Kd(O):t;B&&tp(B[0])&&B[1]==(X|P|L|te)&&!B[4].length&&B[9]==1?N=N[Vc(B[0])].apply(N,B[3]):N=O.length==1&&tp(O)?N[M]():N.thru(O)}return function(){var ie=arguments,ae=ie[0];if(N&&ie.length==1&&ot(ae))return N.plant(ae).value();for(var fe=0,Oe=l?o[fe].apply(this,ie):ae;++fe<l;)Oe=o[fe].call(this,Oe);return Oe}})}function jc(s,o,l,p,v,O,N,M,B,ie){var ae=o&X,fe=o&w,Oe=o&S,qe=o&(P|F),He=o&he,ft=Oe?t:zo(s);function Qe(){for(var yt=arguments.length,xt=K(yt),Tn=yt;Tn--;)xt[Tn]=arguments[Tn];if(qe)var nn=Ra(Qe),An=jP(xt,nn);if(p&&(xt=$w(xt,p,v,qe)),O&&(xt=Bw(xt,O,N,qe)),yt-=An,qe&&yt<ie){var gr=os(xt,nn);return Yw(s,o,jc,Qe.placeholder,l,xt,gr,M,B,ie-yt)}var ai=fe?l:this,Mi=Oe?ai[s]:s;return yt=xt.length,M?xt=QN(xt,M):He&&yt>1&&xt.reverse(),ae&&B<yt&&(xt.length=B),this&&this!==Br&&this instanceof Qe&&(Mi=ft||zo(Mi)),Mi.apply(ai,xt)}return Qe}function Gw(s,o){return function(l,p){return tN(l,s,o(p),{})}}function Uc(s,o){return function(l,p){var v;if(l===t&&p===t)return o;if(l!==t&&(v=l),p!==t){if(v===t)return p;typeof l=="string"||typeof p=="string"?(l=En(l),p=En(p)):(l=Rw(l),p=Rw(p)),v=s(l,p)}return v}}function Qd(s){return Ni(function(o){return o=sr(o,Sn(We())),ht(function(l){var p=this;return s(o,function(v){return xn(v,p,l)})})})}function $c(s,o){o=o===t?" ":En(o);var l=o.length;if(l<2)return l?Ud(o,s):o;var p=Ud(o,Ac(s/Oa(o)));return Ea(o)?hs(ni(p),0,s).join(""):p.slice(0,s)}function kN(s,o,l,p){var v=o&w,O=zo(s);function N(){for(var M=-1,B=arguments.length,ie=-1,ae=p.length,fe=K(ae+B),Oe=this&&this!==Br&&this instanceof N?O:s;++ie<ae;)fe[ie]=p[ie];for(;B--;)fe[ie++]=arguments[++M];return xn(Oe,v?l:this,fe)}return N}function Jw(s){return function(o,l,p){return p&&typeof p!="number"&&rn(o,l,p)&&(l=p=t),o=Fi(o),l===t?(l=o,o=0):l=Fi(l),p=p===t?o<l?1:-1:Fi(p),dN(o,l,p,s)}}function Bc(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=zn(o),l=zn(l)),s(o,l)}}function Yw(s,o,l,p,v,O,N,M,B,ie){var ae=o&P,fe=ae?N:t,Oe=ae?t:N,qe=ae?O:t,He=ae?t:O;o|=ae?L:$,o&=~(ae?$:L),o&A||(o&=~(w|S));var ft=[s,o,v,qe,fe,He,Oe,M,B,ie],Qe=l.apply(t,ft);return tp(s)&&u_(Qe,ft),Qe.placeholder=p,c_(Qe,s,o)}function Gd(s){var o=Ar[s];return function(l,p){if(l=zn(l),p=p==null?0:Hr(ct(p),292),p&&cw(l)){var v=(qt(l)+"e").split("e"),O=o(v[0]+"e"+(+v[1]+p));return v=(qt(O)+"e").split("e"),+(v[0]+"e"+(+v[1]-p))}return o(l)}}var IN=ka&&1/gc(new ka([,-0]))[1]==ge?function(s){return new ka(s)}:yp;function Kw(s){return function(o){var l=Qr(o);return l==G?Ed(o):l==be?HP(o):qP(o,s(o))}}function Ci(s,o,l,p,v,O,N,M){var B=o&S;if(!B&&typeof s!="function")throw new Un(u);var ie=p?p.length:0;if(ie||(o&=~(L|$),p=v=t),N=N===t?N:kr(ct(N),0),M=M===t?M:ct(M),ie-=v?v.length:0,o&$){var ae=p,fe=v;p=v=t}var Oe=B?t:Kd(s),qe=[s,o,l,p,v,ae,fe,O,N,M];if(Oe&&WN(qe,Oe),s=qe[0],o=qe[1],l=qe[2],p=qe[3],v=qe[4],M=qe[9]=qe[9]===t?B?0:s.length:kr(qe[9]-ie,0),!M&&o&(P|F)&&(o&=~(P|F)),!o||o==w)var He=TN(s,o,l);else o==P||o==F?He=AN(s,o,M):(o==L||o==(w|L))&&!v.length?He=kN(s,o,l,p):He=jc.apply(t,qe);var ft=Oe?Cw:u_;return c_(ft(He,qe),s,o)}function Zw(s,o,l,p){return s===t||si(s,Aa[l])&&!$t.call(p,l)?o:s}function Xw(s,o,l,p,v,O){return cr(s)&&cr(o)&&(O.set(o,s),Fc(s,o,t,Xw,O),O.delete(o)),s}function PN(s){return Go(s)?t:s}function e_(s,o,l,p,v,O){var N=l&x,M=s.length,B=o.length;if(M!=B&&!(N&&B>M))return!1;var ie=O.get(s),ae=O.get(o);if(ie&&ae)return ie==o&&ae==s;var fe=-1,Oe=!0,qe=l&T?new Ds:t;for(O.set(s,o),O.set(o,s);++fe<M;){var He=s[fe],ft=o[fe];if(p)var Qe=N?p(ft,He,fe,o,s,O):p(He,ft,fe,s,o,O);if(Qe!==t){if(Qe)continue;Oe=!1;break}if(qe){if(!vd(o,function(yt,xt){if(!Do(qe,xt)&&(He===yt||v(He,yt,l,p,O)))return qe.push(xt)})){Oe=!1;break}}else if(!(He===ft||v(He,ft,l,p,O))){Oe=!1;break}}return O.delete(s),O.delete(o),Oe}function CN(s,o,l,p,v,O,N){switch(l){case rr:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Lt:return!(s.byteLength!=o.byteLength||!O(new Sc(s),new Sc(o)));case dt:case Re:case Z:return si(+s,+o);case z:return s.name==o.name&&s.message==o.message;case ce:case Ze:return s==o+"";case G:var M=Ed;case be:var B=p&x;if(M||(M=gc),s.size!=o.size&&!B)return!1;var ie=N.get(s);if(ie)return ie==o;p|=T,N.set(s,o);var ae=e_(M(s),M(o),p,v,O,N);return N.delete(s),ae;case Ot:if(jo)return jo.call(s)==jo.call(o)}return!1}function NN(s,o,l,p,v,O){var N=l&x,M=Jd(s),B=M.length,ie=Jd(o),ae=ie.length;if(B!=ae&&!N)return!1;for(var fe=B;fe--;){var Oe=M[fe];if(!(N?Oe in o:$t.call(o,Oe)))return!1}var qe=O.get(s),He=O.get(o);if(qe&&He)return qe==o&&He==s;var ft=!0;O.set(s,o),O.set(o,s);for(var Qe=N;++fe<B;){Oe=M[fe];var yt=s[Oe],xt=o[Oe];if(p)var Tn=N?p(xt,yt,Oe,o,s,O):p(yt,xt,Oe,s,o,O);if(!(Tn===t?yt===xt||v(yt,xt,l,p,O):Tn)){ft=!1;break}Qe||(Qe=Oe=="constructor")}if(ft&&!Qe){var nn=s.constructor,An=o.constructor;nn!=An&&"constructor"in s&&"constructor"in o&&!(typeof nn=="function"&&nn instanceof nn&&typeof An=="function"&&An instanceof An)&&(ft=!1)}return O.delete(s),O.delete(o),ft}function Ni(s){return np(a_(s,t,m_),s+"")}function Jd(s){return ww(s,Fr,Xd)}function Yd(s){return ww(s,hn,t_)}var Kd=Ic?function(s){return Ic.get(s)}:yp;function Vc(s){for(var o=s.name+"",l=Ia[o],p=$t.call(Ia,o)?l.length:0;p--;){var v=l[p],O=v.func;if(O==null||O==s)return v.name}return o}function Ra(s){var o=$t.call(_,"placeholder")?_:s;return o.placeholder}function We(){var s=_.iteratee||pp;return s=s===pp?Sw:s,arguments.length?s(arguments[0],arguments[1]):s}function Wc(s,o){var l=s.__data__;return UN(o)?l[typeof o=="string"?"string":"hash"]:l.map}function Zd(s){for(var o=Fr(s),l=o.length;l--;){var p=o[l],v=s[p];o[l]=[p,v,i_(v)]}return o}function Ls(s,o){var l=VP(s,o);return xw(l)?l:t}function RN(s){var o=$t.call(s,Ns),l=s[Ns];try{s[Ns]=t;var p=!0}catch{}var v=_c.call(s);return p&&(o?s[Ns]=l:delete s[Ns]),v}var Xd=Td?function(s){return s==null?[]:(s=Qt(s),ss(Td(s),function(o){return ow.call(s,o)}))}:gp,t_=Td?function(s){for(var o=[];s;)as(o,Xd(s)),s=Ec(s);return o}:gp,Qr=tn;(Ad&&Qr(new Ad(new ArrayBuffer(1)))!=rr||Mo&&Qr(new Mo)!=G||kd&&Qr(kd.resolve())!=ze||ka&&Qr(new ka)!=be||Lo&&Qr(new Lo)!=Gt)&&(Qr=function(s){var o=tn(s),l=o==Te?s.constructor:t,p=l?qs(l):"";if(p)switch(p){case mC:return rr;case yC:return G;case gC:return ze;case vC:return be;case bC:return Gt}return o});function DN(s,o,l){for(var p=-1,v=l.length;++p<v;){var O=l[p],N=O.size;switch(O.type){case"drop":s+=N;break;case"dropRight":o-=N;break;case"take":o=Hr(o,s+N);break;case"takeRight":s=kr(s,o-N);break}}return{start:s,end:o}}function FN(s){var o=s.match(cn);return o?o[1].split(Ln):[]}function r_(s,o,l){o=fs(o,s);for(var p=-1,v=o.length,O=!1;++p<v;){var N=hi(o[p]);if(!(O=s!=null&&l(s,N)))break;s=s[N]}return O||++p!=v?O:(v=s==null?0:s.length,!!v&&Kc(v)&&Ri(N,v)&&(ot(s)||js(s)))}function MN(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&$t.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function n_(s){return typeof s.constructor=="function"&&!Ho(s)?Pa(Ec(s)):{}}function LN(s,o,l){var p=s.constructor;switch(o){case Lt:return Hd(s);case dt:case Re:return new p(+s);case rr:return wN(s,l);case Rr:case zt:case Jt:case Zt:case W:case H:case Be:case $e:case Tt:return jw(s,l);case G:return new p;case Z:case Ze:return new p(s);case ce:return _N(s);case be:return new p;case Ot:return xN(s)}}function qN(s,o){var l=o.length;if(!l)return s;var p=l-1;return o[p]=(l>1?"& ":"")+o[p],o=o.join(l>2?", ":" "),s.replace(Dr,`{
94
+ /* [wrapped with `+o+`] */
95
+ `)}function jN(s){return ot(s)||js(s)||!!(uw&&s&&s[uw])}function Ri(s,o){var l=typeof s;return o=o??ue,!!o&&(l=="number"||l!="symbol"&&_t.test(s))&&s>-1&&s%1==0&&s<o}function rn(s,o,l){if(!cr(l))return!1;var p=typeof o;return(p=="number"?fn(l)&&Ri(o,l.length):p=="string"&&o in l)?si(l[o],s):!1}function ep(s,o){if(ot(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||On(s)?!0:Sr.test(s)||!xr.test(s)||o!=null&&s in Qt(o)}function UN(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function tp(s){var o=Vc(s),l=_[o];if(typeof l!="function"||!(o in vt.prototype))return!1;if(s===l)return!0;var p=Kd(l);return!!p&&s===p[0]}function $N(s){return!!iw&&iw in s}var BN=bc?Di:vp;function Ho(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||Aa;return s===l}function i_(s){return s===s&&!cr(s)}function s_(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in Qt(l))}}function VN(s){var o=Jc(s,function(p){return l.size===h&&l.clear(),p}),l=o.cache;return o}function WN(s,o){var l=s[1],p=o[1],v=l|p,O=v<(w|S|X),N=p==X&&l==P||p==X&&l==te&&s[7].length<=o[8]||p==(X|te)&&o[7].length<=o[8]&&l==P;if(!(O||N))return s;p&w&&(s[2]=o[2],v|=l&w?0:A);var M=o[3];if(M){var B=s[3];s[3]=B?$w(B,M,o[4]):M,s[4]=B?os(s[3],d):o[4]}return M=o[5],M&&(B=s[5],s[5]=B?Bw(B,M,o[6]):M,s[6]=B?os(s[5],d):o[6]),M=o[7],M&&(s[7]=M),p&X&&(s[8]=s[8]==null?o[8]:Hr(s[8],o[8])),s[9]==null&&(s[9]=o[9]),s[0]=o[0],s[1]=v,s}function zN(s){var o=[];if(s!=null)for(var l in Qt(s))o.push(l);return o}function HN(s){return _c.call(s)}function a_(s,o,l){return o=kr(o===t?s.length-1:o,0),function(){for(var p=arguments,v=-1,O=kr(p.length-o,0),N=K(O);++v<O;)N[v]=p[o+v];v=-1;for(var M=K(o+1);++v<o;)M[v]=p[v];return M[o]=l(N),xn(s,this,M)}}function o_(s,o){return o.length<2?s:Ms(s,Vn(o,0,-1))}function QN(s,o){for(var l=s.length,p=Hr(o.length,l),v=ln(s);p--;){var O=o[p];s[p]=Ri(O,l)?v[O]:t}return s}function rp(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var u_=l_(Cw),Qo=uC||function(s,o){return Br.setTimeout(s,o)},np=l_(yN);function c_(s,o,l){var p=o+"";return np(s,qN(p,GN(FN(p),l)))}function l_(s){var o=0,l=0;return function(){var p=hC(),v=je-(p-l);if(l=p,v>0){if(++o>=Ae)return arguments[0]}else o=0;return s.apply(t,arguments)}}function zc(s,o){var l=-1,p=s.length,v=p-1;for(o=o===t?p:o;++l<o;){var O=jd(l,v),N=s[O];s[O]=s[l],s[l]=N}return s.length=o,s}var f_=VN(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Or,function(l,p,v,O){o.push(v?O.replace(me,"$1"):p||l)}),o});function hi(s){if(typeof s=="string"||On(s))return s;var o=s+"";return o=="0"&&1/s==-ge?"-0":o}function qs(s){if(s!=null){try{return wc.call(s)}catch{}try{return s+""}catch{}}return""}function GN(s,o){return jn(lt,function(l){var p="_."+l[0];o&l[1]&&!mc(s,p)&&s.push(p)}),s.sort()}function h_(s){if(s instanceof vt)return s.clone();var o=new $n(s.__wrapped__,s.__chain__);return o.__actions__=ln(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function JN(s,o,l){(l?rn(s,o,l):o===t)?o=1:o=kr(ct(o),0);var p=s==null?0:s.length;if(!p||o<1)return[];for(var v=0,O=0,N=K(Ac(p/o));v<p;)N[O++]=Vn(s,v,v+=o);return N}function YN(s){for(var o=-1,l=s==null?0:s.length,p=0,v=[];++o<l;){var O=s[o];O&&(v[p++]=O)}return v}function KN(){var s=arguments.length;if(!s)return[];for(var o=K(s-1),l=arguments[0],p=s;p--;)o[p-1]=arguments[p];return as(ot(l)?ln(l):[l],Vr(o,1))}var ZN=ht(function(s,o){return yr(s)?$o(s,Vr(o,1,yr,!0)):[]}),XN=ht(function(s,o){var l=Wn(o);return yr(l)&&(l=t),yr(s)?$o(s,Vr(o,1,yr,!0),We(l,2)):[]}),eR=ht(function(s,o){var l=Wn(o);return yr(l)&&(l=t),yr(s)?$o(s,Vr(o,1,yr,!0),t,l):[]});function tR(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ct(o),Vn(s,o<0?0:o,p)):[]}function rR(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ct(o),o=p-o,Vn(s,0,o<0?0:o)):[]}function nR(s,o){return s&&s.length?Lc(s,We(o,3),!0,!0):[]}function iR(s,o){return s&&s.length?Lc(s,We(o,3),!0):[]}function sR(s,o,l,p){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&rn(s,o,l)&&(l=0,p=v),KC(s,o,l,p)):[]}function d_(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:ct(l);return v<0&&(v=kr(p+v,0)),yc(s,We(o,3),v)}function p_(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p-1;return l!==t&&(v=ct(l),v=l<0?kr(p+v,0):Hr(v,p-1)),yc(s,We(o,3),v,!0)}function m_(s){var o=s==null?0:s.length;return o?Vr(s,1):[]}function aR(s){var o=s==null?0:s.length;return o?Vr(s,ge):[]}function oR(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:ct(o),Vr(s,o)):[]}function uR(s){for(var o=-1,l=s==null?0:s.length,p={};++o<l;){var v=s[o];p[v[0]]=v[1]}return p}function y_(s){return s&&s.length?s[0]:t}function cR(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:ct(l);return v<0&&(v=kr(p+v,0)),Sa(s,o,v)}function lR(s){var o=s==null?0:s.length;return o?Vn(s,0,-1):[]}var fR=ht(function(s){var o=sr(s,Wd);return o.length&&o[0]===s[0]?Dd(o):[]}),hR=ht(function(s){var o=Wn(s),l=sr(s,Wd);return o===Wn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?Dd(l,We(o,2)):[]}),dR=ht(function(s){var o=Wn(s),l=sr(s,Wd);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?Dd(l,t,o):[]});function pR(s,o){return s==null?"":lC.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 p=s==null?0:s.length;if(!p)return-1;var v=p;return l!==t&&(v=ct(l),v=v<0?kr(p+v,0):Hr(v,p-1)),o===o?GP(s,o,v):yc(s,Yb,v,!0)}function yR(s,o){return s&&s.length?Aw(s,ct(o)):t}var gR=ht(g_);function g_(s,o){return s&&s.length&&o&&o.length?qd(s,o):s}function vR(s,o,l){return s&&s.length&&o&&o.length?qd(s,o,We(l,2)):s}function bR(s,o,l){return s&&s.length&&o&&o.length?qd(s,o,t,l):s}var wR=Ni(function(s,o){var l=s==null?0:s.length,p=Pd(s,o);return Pw(s,sr(o,function(v){return Ri(v,l)?+v:v}).sort(Uw)),p});function _R(s,o){var l=[];if(!(s&&s.length))return l;var p=-1,v=[],O=s.length;for(o=We(o,3);++p<O;){var N=s[p];o(N,p,s)&&(l.push(N),v.push(p))}return Pw(s,v),l}function ip(s){return s==null?s:pC.call(s)}function xR(s,o,l){var p=s==null?0:s.length;return p?(l&&typeof l!="number"&&rn(s,o,l)?(o=0,l=p):(o=o==null?0:ct(o),l=l===t?p:ct(l)),Vn(s,o,l)):[]}function SR(s,o){return Mc(s,o)}function ER(s,o,l){return $d(s,o,We(l,2))}function OR(s,o){var l=s==null?0:s.length;if(l){var p=Mc(s,o);if(p<l&&si(s[p],o))return p}return-1}function TR(s,o){return Mc(s,o,!0)}function AR(s,o,l){return $d(s,o,We(l,2),!0)}function kR(s,o){var l=s==null?0:s.length;if(l){var p=Mc(s,o,!0)-1;if(si(s[p],o))return p}return-1}function IR(s){return s&&s.length?Nw(s):[]}function PR(s,o){return s&&s.length?Nw(s,We(o,2)):[]}function CR(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:ct(o),Vn(s,0,o<0?0:o)):[]}function RR(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ct(o),o=p-o,Vn(s,o<0?0:o,p)):[]}function DR(s,o){return s&&s.length?Lc(s,We(o,3),!1,!0):[]}function FR(s,o){return s&&s.length?Lc(s,We(o,3)):[]}var MR=ht(function(s){return ls(Vr(s,1,yr,!0))}),LR=ht(function(s){var o=Wn(s);return yr(o)&&(o=t),ls(Vr(s,1,yr,!0),We(o,2))}),qR=ht(function(s){var o=Wn(s);return o=typeof o=="function"?o:t,ls(Vr(s,1,yr,!0),t,o)});function jR(s){return s&&s.length?ls(s):[]}function UR(s,o){return s&&s.length?ls(s,We(o,2)):[]}function $R(s,o){return o=typeof o=="function"?o:t,s&&s.length?ls(s,t,o):[]}function sp(s){if(!(s&&s.length))return[];var o=0;return s=ss(s,function(l){if(yr(l))return o=kr(l.length,o),!0}),xd(o,function(l){return sr(s,bd(l))})}function v_(s,o){if(!(s&&s.length))return[];var l=sp(s);return o==null?l:sr(l,function(p){return xn(o,t,p)})}var BR=ht(function(s,o){return yr(s)?$o(s,o):[]}),VR=ht(function(s){return Vd(ss(s,yr))}),WR=ht(function(s){var o=Wn(s);return yr(o)&&(o=t),Vd(ss(s,yr),We(o,2))}),zR=ht(function(s){var o=Wn(s);return o=typeof o=="function"?o:t,Vd(ss(s,yr),t,o)}),HR=ht(sp);function QR(s,o){return Mw(s||[],o||[],Uo)}function GR(s,o){return Mw(s||[],o||[],Wo)}var JR=ht(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,v_(s,l)});function b_(s){var o=_(s);return o.__chain__=!0,o}function YR(s,o){return o(s),s}function Hc(s,o){return o(s)}var KR=Ni(function(s){var o=s.length,l=o?s[0]:0,p=this.__wrapped__,v=function(O){return Pd(O,s)};return o>1||this.__actions__.length||!(p instanceof vt)||!Ri(l)?this.thru(v):(p=p.slice(l,+l+(o?1:0)),p.__actions__.push({func:Hc,args:[v],thisArg:t}),new $n(p,this.__chain__).thru(function(O){return o&&!O.length&&O.push(t),O}))});function ZR(){return b_(this)}function XR(){return new $n(this.value(),this.__chain__)}function eD(){this.__values__===t&&(this.__values__=R_(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 Cc;){var p=h_(l);p.__index__=0,p.__values__=t,o?v.__wrapped__=p:o=p;var v=p;l=l.__wrapped__}return v.__wrapped__=s,o}function nD(){var s=this.__wrapped__;if(s instanceof vt){var o=s;return this.__actions__.length&&(o=new vt(this)),o=o.reverse(),o.__actions__.push({func:Hc,args:[ip],thisArg:t}),new $n(o,this.__chain__)}return this.thru(ip)}function iD(){return Fw(this.__wrapped__,this.__actions__)}var sD=qc(function(s,o,l){$t.call(s,l)?++s[l]:Pi(s,l,1)});function aD(s,o,l){var p=ot(s)?Gb:YC;return l&&rn(s,o,l)&&(o=t),p(s,We(o,3))}function oD(s,o){var l=ot(s)?ss:vw;return l(s,We(o,3))}var uD=Hw(d_),cD=Hw(p_);function lD(s,o){return Vr(Qc(s,o),1)}function fD(s,o){return Vr(Qc(s,o),ge)}function hD(s,o,l){return l=l===t?1:ct(l),Vr(Qc(s,o),l)}function w_(s,o){var l=ot(s)?jn:cs;return l(s,We(o,3))}function __(s,o){var l=ot(s)?CP:gw;return l(s,We(o,3))}var dD=qc(function(s,o,l){$t.call(s,l)?s[l].push(o):Pi(s,l,[o])});function pD(s,o,l,p){s=fn(s)?s:Fa(s),l=l&&!p?ct(l):0;var v=s.length;return l<0&&(l=kr(v+l,0)),Zc(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&Sa(s,o,l)>-1}var mD=ht(function(s,o,l){var p=-1,v=typeof o=="function",O=fn(s)?K(s.length):[];return cs(s,function(N){O[++p]=v?xn(o,N,l):Bo(N,o,l)}),O}),yD=qc(function(s,o,l){Pi(s,l,o)});function Qc(s,o){var l=ot(s)?sr:Ew;return l(s,We(o,3))}function gD(s,o,l,p){return s==null?[]:(ot(o)||(o=o==null?[]:[o]),l=p?t:l,ot(l)||(l=l==null?[]:[l]),kw(s,o,l))}var vD=qc(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function bD(s,o,l){var p=ot(s)?gd:Zb,v=arguments.length<3;return p(s,We(o,4),l,v,cs)}function wD(s,o,l){var p=ot(s)?NP:Zb,v=arguments.length<3;return p(s,We(o,4),l,v,gw)}function _D(s,o){var l=ot(s)?ss:vw;return l(s,Yc(We(o,3)))}function xD(s){var o=ot(s)?dw:pN;return o(s)}function SD(s,o,l){(l?rn(s,o,l):o===t)?o=1:o=ct(o);var p=ot(s)?zC:mN;return p(s,o)}function ED(s){var o=ot(s)?HC:gN;return o(s)}function OD(s){if(s==null)return 0;if(fn(s))return Zc(s)?Oa(s):s.length;var o=Qr(s);return o==G||o==be?s.size:Md(s).length}function TD(s,o,l){var p=ot(s)?vd:vN;return l&&rn(s,o,l)&&(o=t),p(s,We(o,3))}var AD=ht(function(s,o){if(s==null)return[];var l=o.length;return l>1&&rn(s,o[0],o[1])?o=[]:l>2&&rn(o[0],o[1],o[2])&&(o=[o[0]]),kw(s,Vr(o,1),[])}),Gc=oC||function(){return Br.Date.now()};function kD(s,o){if(typeof o!="function")throw new Un(u);return s=ct(s),function(){if(--s<1)return o.apply(this,arguments)}}function x_(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Ci(s,X,t,t,t,t,o)}function S_(s,o){var l;if(typeof o!="function")throw new Un(u);return s=ct(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var ap=ht(function(s,o,l){var p=w;if(l.length){var v=os(l,Ra(ap));p|=L}return Ci(s,p,o,l,v)}),E_=ht(function(s,o,l){var p=w|S;if(l.length){var v=os(l,Ra(E_));p|=L}return Ci(o,p,s,l,v)});function O_(s,o,l){o=l?t:o;var p=Ci(s,P,t,t,t,t,t,o);return p.placeholder=O_.placeholder,p}function T_(s,o,l){o=l?t:o;var p=Ci(s,F,t,t,t,t,t,o);return p.placeholder=T_.placeholder,p}function A_(s,o,l){var p,v,O,N,M,B,ie=0,ae=!1,fe=!1,Oe=!0;if(typeof s!="function")throw new Un(u);o=zn(o)||0,cr(l)&&(ae=!!l.leading,fe="maxWait"in l,O=fe?kr(zn(l.maxWait)||0,o):O,Oe="trailing"in l?!!l.trailing:Oe);function qe(gr){var ai=p,Mi=v;return p=v=t,ie=gr,N=s.apply(Mi,ai),N}function He(gr){return ie=gr,M=Qo(yt,o),ae?qe(gr):N}function ft(gr){var ai=gr-B,Mi=gr-ie,H_=o-ai;return fe?Hr(H_,O-Mi):H_}function Qe(gr){var ai=gr-B,Mi=gr-ie;return B===t||ai>=o||ai<0||fe&&Mi>=O}function yt(){var gr=Gc();if(Qe(gr))return xt(gr);M=Qo(yt,ft(gr))}function xt(gr){return M=t,Oe&&p?qe(gr):(p=v=t,N)}function Tn(){M!==t&&Lw(M),ie=0,p=B=v=M=t}function nn(){return M===t?N:xt(Gc())}function An(){var gr=Gc(),ai=Qe(gr);if(p=arguments,v=this,B=gr,ai){if(M===t)return He(B);if(fe)return Lw(M),M=Qo(yt,o),qe(B)}return M===t&&(M=Qo(yt,o)),N}return An.cancel=Tn,An.flush=nn,An}var ID=ht(function(s,o){return yw(s,1,o)}),PD=ht(function(s,o,l){return yw(s,zn(o)||0,l)});function CD(s){return Ci(s,he)}function Jc(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new Un(u);var l=function(){var p=arguments,v=o?o.apply(this,p):p[0],O=l.cache;if(O.has(v))return O.get(v);var N=s.apply(this,p);return l.cache=O.set(v,N)||O,N};return l.cache=new(Jc.Cache||Ii),l}Jc.Cache=Ii;function Yc(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 S_(2,s)}var RD=bN(function(s,o){o=o.length==1&&ot(o[0])?sr(o[0],Sn(We())):sr(Vr(o,1),Sn(We()));var l=o.length;return ht(function(p){for(var v=-1,O=Hr(p.length,l);++v<O;)p[v]=o[v].call(this,p[v]);return xn(s,this,p)})}),op=ht(function(s,o){var l=os(o,Ra(op));return Ci(s,L,t,o,l)}),k_=ht(function(s,o){var l=os(o,Ra(k_));return Ci(s,$,t,o,l)}),DD=Ni(function(s,o){return Ci(s,te,t,t,t,o)});function FD(s,o){if(typeof s!="function")throw new Un(u);return o=o===t?o:ct(o),ht(s,o)}function MD(s,o){if(typeof s!="function")throw new Un(u);return o=o==null?0:kr(ct(o),0),ht(function(l){var p=l[o],v=hs(l,0,o);return p&&as(v,p),xn(s,this,v)})}function LD(s,o,l){var p=!0,v=!0;if(typeof s!="function")throw new Un(u);return cr(l)&&(p="leading"in l?!!l.leading:p,v="trailing"in l?!!l.trailing:v),A_(s,o,{leading:p,maxWait:o,trailing:v})}function qD(s){return x_(s,1)}function jD(s,o){return op(zd(o),s)}function UD(){if(!arguments.length)return[];var s=arguments[0];return ot(s)?s:[s]}function $D(s){return Bn(s,m)}function BD(s,o){return o=typeof o=="function"?o:t,Bn(s,m,o)}function VD(s){return Bn(s,y|m)}function WD(s,o){return o=typeof o=="function"?o:t,Bn(s,y|m,o)}function zD(s,o){return o==null||mw(s,o,Fr(o))}function si(s,o){return s===o||s!==s&&o!==o}var HD=Bc(Rd),QD=Bc(function(s,o){return s>=o}),js=_w(function(){return arguments}())?_w:function(s){return hr(s)&&$t.call(s,"callee")&&!ow.call(s,"callee")},ot=K.isArray,GD=Bb?Sn(Bb):rN;function fn(s){return s!=null&&Kc(s.length)&&!Di(s)}function yr(s){return hr(s)&&fn(s)}function JD(s){return s===!0||s===!1||hr(s)&&tn(s)==dt}var ds=cC||vp,YD=Vb?Sn(Vb):nN;function KD(s){return hr(s)&&s.nodeType===1&&!Go(s)}function ZD(s){if(s==null)return!0;if(fn(s)&&(ot(s)||typeof s=="string"||typeof s.splice=="function"||ds(s)||Da(s)||js(s)))return!s.length;var o=Qr(s);if(o==G||o==be)return!s.size;if(Ho(s))return!Md(s).length;for(var l in s)if($t.call(s,l))return!1;return!0}function XD(s,o){return Vo(s,o)}function eF(s,o,l){l=typeof l=="function"?l:t;var p=l?l(s,o):t;return p===t?Vo(s,o,t,l):!!p}function up(s){if(!hr(s))return!1;var o=tn(s);return o==z||o==bt||typeof s.message=="string"&&typeof s.name=="string"&&!Go(s)}function tF(s){return typeof s=="number"&&cw(s)}function Di(s){if(!cr(s))return!1;var o=tn(s);return o==Y||o==V||o==Ye||o==Ue}function I_(s){return typeof s=="number"&&s==ct(s)}function Kc(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=ue}function cr(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function hr(s){return s!=null&&typeof s=="object"}var P_=Wb?Sn(Wb):sN;function rF(s,o){return s===o||Fd(s,o,Zd(o))}function nF(s,o,l){return l=typeof l=="function"?l:t,Fd(s,o,Zd(o),l)}function iF(s){return C_(s)&&s!=+s}function sF(s){if(BN(s))throw new st(a);return xw(s)}function aF(s){return s===null}function oF(s){return s==null}function C_(s){return typeof s=="number"||hr(s)&&tn(s)==Z}function Go(s){if(!hr(s)||tn(s)!=Te)return!1;var o=Ec(s);if(o===null)return!0;var l=$t.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&wc.call(l)==nC}var cp=zb?Sn(zb):aN;function uF(s){return I_(s)&&s>=-ue&&s<=ue}var N_=Hb?Sn(Hb):oN;function Zc(s){return typeof s=="string"||!ot(s)&&hr(s)&&tn(s)==Ze}function On(s){return typeof s=="symbol"||hr(s)&&tn(s)==Ot}var Da=Qb?Sn(Qb):uN;function cF(s){return s===t}function lF(s){return hr(s)&&Qr(s)==Gt}function fF(s){return hr(s)&&tn(s)==pt}var hF=Bc(Ld),dF=Bc(function(s,o){return s<=o});function R_(s){if(!s)return[];if(fn(s))return Zc(s)?ni(s):ln(s);if(Fo&&s[Fo])return zP(s[Fo]());var o=Qr(s),l=o==G?Ed:o==be?gc:Fa;return l(s)}function Fi(s){if(!s)return s===0?s:0;if(s=zn(s),s===ge||s===-ge){var o=s<0?-1:1;return o*Ee}return s===s?s:0}function ct(s){var o=Fi(s),l=o%1;return o===o?l?o-l:o:0}function D_(s){return s?Fs(ct(s),0,xe):0}function zn(s){if(typeof s=="number")return s;if(On(s))return Ne;if(cr(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=cr(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=Xb(s);var l=nt.test(s);return l||rt.test(s)?kP(s.slice(2),l?2:8):at.test(s)?Ne:+s}function F_(s){return fi(s,hn(s))}function pF(s){return s?Fs(ct(s),-ue,ue):s===0?s:0}function qt(s){return s==null?"":En(s)}var mF=Ca(function(s,o){if(Ho(o)||fn(o)){fi(o,Fr(o),s);return}for(var l in o)$t.call(o,l)&&Uo(s,l,o[l])}),M_=Ca(function(s,o){fi(o,hn(o),s)}),Xc=Ca(function(s,o,l,p){fi(o,hn(o),s,p)}),yF=Ca(function(s,o,l,p){fi(o,Fr(o),s,p)}),gF=Ni(Pd);function vF(s,o){var l=Pa(s);return o==null?l:pw(l,o)}var bF=ht(function(s,o){s=Qt(s);var l=-1,p=o.length,v=p>2?o[2]:t;for(v&&rn(o[0],o[1],v)&&(p=1);++l<p;)for(var O=o[l],N=hn(O),M=-1,B=N.length;++M<B;){var ie=N[M],ae=s[ie];(ae===t||si(ae,Aa[ie])&&!$t.call(s,ie))&&(s[ie]=O[ie])}return s}),wF=ht(function(s){return s.push(t,Xw),xn(L_,t,s)});function _F(s,o){return Jb(s,We(o,3),li)}function xF(s,o){return Jb(s,We(o,3),Nd)}function SF(s,o){return s==null?s:Cd(s,We(o,3),hn)}function EF(s,o){return s==null?s:bw(s,We(o,3),hn)}function OF(s,o){return s&&li(s,We(o,3))}function TF(s,o){return s&&Nd(s,We(o,3))}function AF(s){return s==null?[]:Dc(s,Fr(s))}function kF(s){return s==null?[]:Dc(s,hn(s))}function lp(s,o,l){var p=s==null?t:Ms(s,o);return p===t?l:p}function IF(s,o){return s!=null&&r_(s,o,ZC)}function fp(s,o){return s!=null&&r_(s,o,XC)}var PF=Gw(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=_c.call(o)),s[o]=l},dp(dn)),CF=Gw(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=_c.call(o)),$t.call(s,o)?s[o].push(l):s[o]=[l]},We),NF=ht(Bo);function Fr(s){return fn(s)?hw(s):Md(s)}function hn(s){return fn(s)?hw(s,!0):cN(s)}function RF(s,o){var l={};return o=We(o,3),li(s,function(p,v,O){Pi(l,o(p,v,O),p)}),l}function DF(s,o){var l={};return o=We(o,3),li(s,function(p,v,O){Pi(l,v,o(p,v,O))}),l}var FF=Ca(function(s,o,l){Fc(s,o,l)}),L_=Ca(function(s,o,l,p){Fc(s,o,l,p)}),MF=Ni(function(s,o){var l={};if(s==null)return l;var p=!1;o=sr(o,function(O){return O=fs(O,s),p||(p=O.length>1),O}),fi(s,Yd(s),l),p&&(l=Bn(l,y|g|m,PN));for(var v=o.length;v--;)Bd(l,o[v]);return l});function LF(s,o){return q_(s,Yc(We(o)))}var qF=Ni(function(s,o){return s==null?{}:fN(s,o)});function q_(s,o){if(s==null)return{};var l=sr(Yd(s),function(p){return[p]});return o=We(o),Iw(s,l,function(p,v){return o(p,v[0])})}function jF(s,o,l){o=fs(o,s);var p=-1,v=o.length;for(v||(v=1,s=t);++p<v;){var O=s==null?t:s[hi(o[p])];O===t&&(p=v,O=l),s=Di(O)?O.call(s):O}return s}function UF(s,o,l){return s==null?s:Wo(s,o,l)}function $F(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Wo(s,o,l,p)}var j_=Kw(Fr),U_=Kw(hn);function BF(s,o,l){var p=ot(s),v=p||ds(s)||Da(s);if(o=We(o,4),l==null){var O=s&&s.constructor;v?l=p?new O:[]:cr(s)?l=Di(O)?Pa(Ec(s)):{}:l={}}return(v?jn:li)(s,function(N,M,B){return o(l,N,M,B)}),l}function VF(s,o){return s==null?!0:Bd(s,o)}function WF(s,o,l){return s==null?s:Dw(s,o,zd(l))}function zF(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Dw(s,o,zd(l),p)}function Fa(s){return s==null?[]:Sd(s,Fr(s))}function HF(s){return s==null?[]:Sd(s,hn(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),Fs(zn(s),o,l)}function GF(s,o,l){return o=Fi(o),l===t?(l=o,o=0):l=Fi(l),s=zn(s),eN(s,o,l)}function JF(s,o,l){if(l&&typeof l!="boolean"&&rn(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=Fi(s),o===t?(o=s,s=0):o=Fi(o)),s>o){var p=s;s=o,o=p}if(l||s%1||o%1){var v=lw();return Hr(s+v*(o-s+AP("1e-"+((v+"").length-1))),o)}return jd(s,o)}var YF=Na(function(s,o,l){return o=o.toLowerCase(),s+(l?$_(o):o)});function $_(s){return hp(qt(s).toLowerCase())}function B_(s){return s=qt(s),s&&s.replace(b,UP).replace(gP,"")}function KF(s,o,l){s=qt(s),o=En(o);var p=s.length;l=l===t?p:Fs(ct(l),0,p);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function ZF(s){return s=qt(s),s&&$r.test(s)?s.replace(Ht,$P):s}function XF(s){return s=qt(s),s&&zr.test(s)?s.replace(ur,"\\$&"):s}var eM=Na(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),tM=Na(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),rM=zw("toLowerCase");function nM(s,o,l){s=qt(s),o=ct(o);var p=o?Oa(s):0;if(!o||p>=o)return s;var v=(o-p)/2;return $c(kc(v),l)+s+$c(Ac(v),l)}function iM(s,o,l){s=qt(s),o=ct(o);var p=o?Oa(s):0;return o&&p<o?s+$c(o-p,l):s}function sM(s,o,l){s=qt(s),o=ct(o);var p=o?Oa(s):0;return o&&p<o?$c(o-p,l)+s:s}function aM(s,o,l){return l||o==null?o=0:o&&(o=+o),dC(qt(s).replace(Tr,""),o||0)}function oM(s,o,l){return(l?rn(s,o,l):o===t)?o=1:o=ct(o),Ud(qt(s),o)}function uM(){var s=arguments,o=qt(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var cM=Na(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function lM(s,o,l){return l&&typeof l!="number"&&rn(s,o,l)&&(o=l=t),l=l===t?xe:l>>>0,l?(s=qt(s),s&&(typeof o=="string"||o!=null&&!cp(o))&&(o=En(o),!o&&Ea(s))?hs(ni(s),0,l):s.split(o,l)):[]}var fM=Na(function(s,o,l){return s+(l?" ":"")+hp(o)});function hM(s,o,l){return s=qt(s),l=l==null?0:Fs(ct(l),0,s.length),o=En(o),s.slice(l,l+o.length)==o}function dM(s,o,l){var p=_.templateSettings;l&&rn(s,o,l)&&(o=t),s=qt(s),o=Xc({},o,p,Zw);var v=Xc({},o.imports,p.imports,Zw),O=Fr(v),N=Sd(v,O),M,B,ie=0,ae=o.interpolate||I,fe="__p += '",Oe=Od((o.escape||I).source+"|"+ae.source+"|"+(ae===_r?ke:I).source+"|"+(o.evaluate||I).source+"|$","g"),qe="//# sourceURL="+($t.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++xP+"]")+`
96
+ `;s.replace(Oe,function(Qe,yt,xt,Tn,nn,An){return xt||(xt=Tn),fe+=s.slice(ie,An).replace(k,BP),yt&&(M=!0,fe+=`' +
97
+ __e(`+yt+`) +
98
+ '`),nn&&(B=!0,fe+=`';
99
+ `+nn+`;
100
+ __p += '`),xt&&(fe+=`' +
101
+ ((__t = (`+xt+`)) == null ? '' : __t) +
102
+ '`),ie=An+Qe.length,Qe}),fe+=`';
103
+ `;var He=$t.call(o,"variable")&&o.variable;if(!He)fe=`with (obj) {
104
+ `+fe+`
105
+ }
106
+ `;else if(se.test(He))throw new st(c);fe=(B?fe.replace(Ke,""):fe).replace(nr,"$1").replace(fr,"$1;"),fe="function("+(He||"obj")+`) {
107
+ `+(He?"":`obj || (obj = {});
108
+ `)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(B?`, __j = Array.prototype.join;
109
+ function print() { __p += __j.call(arguments, '') }
110
+ `:`;
111
+ `)+fe+`return __p
112
+ }`;var ft=W_(function(){return Ft(O,qe+"return "+fe).apply(t,N)});if(ft.source=fe,up(ft))throw ft;return ft}function pM(s){return qt(s).toLowerCase()}function mM(s){return qt(s).toUpperCase()}function yM(s,o,l){if(s=qt(s),s&&(l||o===t))return Xb(s);if(!s||!(o=En(o)))return s;var p=ni(s),v=ni(o),O=ew(p,v),N=tw(p,v)+1;return hs(p,O,N).join("")}function gM(s,o,l){if(s=qt(s),s&&(l||o===t))return s.slice(0,nw(s)+1);if(!s||!(o=En(o)))return s;var p=ni(s),v=tw(p,ni(o))+1;return hs(p,0,v).join("")}function vM(s,o,l){if(s=qt(s),s&&(l||o===t))return s.replace(Tr,"");if(!s||!(o=En(o)))return s;var p=ni(s),v=ew(p,ni(o));return hs(p,v).join("")}function bM(s,o){var l=de,p=Ve;if(cr(o)){var v="separator"in o?o.separator:v;l="length"in o?ct(o.length):l,p="omission"in o?En(o.omission):p}s=qt(s);var O=s.length;if(Ea(s)){var N=ni(s);O=N.length}if(l>=O)return s;var M=l-Oa(p);if(M<1)return p;var B=N?hs(N,0,M).join(""):s.slice(0,M);if(v===t)return B+p;if(N&&(M+=B.length-M),cp(v)){if(s.slice(M).search(v)){var ie,ae=B;for(v.global||(v=Od(v.source,qt(Le.exec(v))+"g")),v.lastIndex=0;ie=v.exec(ae);)var fe=ie.index;B=B.slice(0,fe===t?M:fe)}}else if(s.indexOf(En(v),M)!=M){var Oe=B.lastIndexOf(v);Oe>-1&&(B=B.slice(0,Oe))}return B+p}function wM(s){return s=qt(s),s&&Ur.test(s)?s.replace(Dt,JP):s}var _M=Na(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),hp=zw("toUpperCase");function V_(s,o,l){return s=qt(s),o=l?t:o,o===t?WP(s)?ZP(s):FP(s):s.match(o)||[]}var W_=ht(function(s,o){try{return xn(s,t,o)}catch(l){return up(l)?l:new st(l)}}),xM=Ni(function(s,o){return jn(o,function(l){l=hi(l),Pi(s,l,ap(s[l],s))}),s});function SM(s){var o=s==null?0:s.length,l=We();return s=o?sr(s,function(p){if(typeof p[1]!="function")throw new Un(u);return[l(p[0]),p[1]]}):[],ht(function(p){for(var v=-1;++v<o;){var O=s[v];if(xn(O[0],this,p))return xn(O[1],this,p)}})}function EM(s){return JC(Bn(s,y))}function dp(s){return function(){return s}}function OM(s,o){return s==null||s!==s?o:s}var TM=Qw(),AM=Qw(!0);function dn(s){return s}function pp(s){return Sw(typeof s=="function"?s:Bn(s,y))}function kM(s){return Ow(Bn(s,y))}function IM(s,o){return Tw(s,Bn(o,y))}var PM=ht(function(s,o){return function(l){return Bo(l,s,o)}}),CM=ht(function(s,o){return function(l){return Bo(s,l,o)}});function mp(s,o,l){var p=Fr(o),v=Dc(o,p);l==null&&!(cr(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=Dc(o,Fr(o)));var O=!(cr(l)&&"chain"in l)||!!l.chain,N=Di(s);return jn(v,function(M){var B=o[M];s[M]=B,N&&(s.prototype[M]=function(){var ie=this.__chain__;if(O||ie){var ae=s(this.__wrapped__),fe=ae.__actions__=ln(this.__actions__);return fe.push({func:B,args:arguments,thisArg:s}),ae.__chain__=ie,ae}return B.apply(s,as([this.value()],arguments))})}),s}function NM(){return Br._===this&&(Br._=iC),this}function yp(){}function RM(s){return s=ct(s),ht(function(o){return Aw(o,s)})}var DM=Qd(sr),FM=Qd(Gb),MM=Qd(vd);function z_(s){return ep(s)?bd(hi(s)):hN(s)}function LM(s){return function(o){return s==null?t:Ms(s,o)}}var qM=Jw(),jM=Jw(!0);function gp(){return[]}function vp(){return!1}function UM(){return{}}function $M(){return""}function BM(){return!0}function VM(s,o){if(s=ct(s),s<1||s>ue)return[];var l=xe,p=Hr(s,xe);o=We(o),s-=xe;for(var v=xd(p,o);++l<s;)o(l);return v}function WM(s){return ot(s)?sr(s,hi):On(s)?[s]:ln(f_(qt(s)))}function zM(s){var o=++rC;return qt(s)+o}var HM=Uc(function(s,o){return s+o},0),QM=Gd("ceil"),GM=Uc(function(s,o){return s/o},1),JM=Gd("floor");function YM(s){return s&&s.length?Rc(s,dn,Rd):t}function KM(s,o){return s&&s.length?Rc(s,We(o,2),Rd):t}function ZM(s){return Kb(s,dn)}function XM(s,o){return Kb(s,We(o,2))}function e2(s){return s&&s.length?Rc(s,dn,Ld):t}function t2(s,o){return s&&s.length?Rc(s,We(o,2),Ld):t}var r2=Uc(function(s,o){return s*o},1),n2=Gd("round"),i2=Uc(function(s,o){return s-o},0);function s2(s){return s&&s.length?_d(s,dn):0}function a2(s,o){return s&&s.length?_d(s,We(o,2)):0}return _.after=kD,_.ary=x_,_.assign=mF,_.assignIn=M_,_.assignInWith=Xc,_.assignWith=yF,_.at=gF,_.before=S_,_.bind=ap,_.bindAll=xM,_.bindKey=E_,_.castArray=UD,_.chain=b_,_.chunk=JN,_.compact=YN,_.concat=KN,_.cond=SM,_.conforms=EM,_.constant=dp,_.countBy=sD,_.create=vF,_.curry=O_,_.curryRight=T_,_.debounce=A_,_.defaults=bF,_.defaultsDeep=wF,_.defer=ID,_.delay=PD,_.difference=ZN,_.differenceBy=XN,_.differenceWith=eR,_.drop=tR,_.dropRight=rR,_.dropRightWhile=nR,_.dropWhile=iR,_.fill=sR,_.filter=oD,_.flatMap=lD,_.flatMapDeep=fD,_.flatMapDepth=hD,_.flatten=m_,_.flattenDeep=aR,_.flattenDepth=oR,_.flip=CD,_.flow=TM,_.flowRight=AM,_.fromPairs=uR,_.functions=AF,_.functionsIn=kF,_.groupBy=dD,_.initial=lR,_.intersection=fR,_.intersectionBy=hR,_.intersectionWith=dR,_.invert=PF,_.invertBy=CF,_.invokeMap=mD,_.iteratee=pp,_.keyBy=yD,_.keys=Fr,_.keysIn=hn,_.map=Qc,_.mapKeys=RF,_.mapValues=DF,_.matches=kM,_.matchesProperty=IM,_.memoize=Jc,_.merge=FF,_.mergeWith=L_,_.method=PM,_.methodOf=CM,_.mixin=mp,_.negate=Yc,_.nthArg=RM,_.omit=MF,_.omitBy=LF,_.once=ND,_.orderBy=gD,_.over=DM,_.overArgs=RD,_.overEvery=FM,_.overSome=MM,_.partial=op,_.partialRight=k_,_.partition=vD,_.pick=qF,_.pickBy=q_,_.property=z_,_.propertyOf=LM,_.pull=gR,_.pullAll=g_,_.pullAllBy=vR,_.pullAllWith=bR,_.pullAt=wR,_.range=qM,_.rangeRight=jM,_.rearg=DD,_.reject=_D,_.remove=_R,_.rest=FD,_.reverse=ip,_.sampleSize=SD,_.set=UF,_.setWith=$F,_.shuffle=ED,_.slice=xR,_.sortBy=AD,_.sortedUniq=IR,_.sortedUniqBy=PR,_.split=lM,_.spread=MD,_.tail=CR,_.take=NR,_.takeRight=RR,_.takeRightWhile=DR,_.takeWhile=FR,_.tap=YR,_.throttle=LD,_.thru=Hc,_.toArray=R_,_.toPairs=j_,_.toPairsIn=U_,_.toPath=WM,_.toPlainObject=F_,_.transform=BF,_.unary=qD,_.union=MR,_.unionBy=LR,_.unionWith=qR,_.uniq=jR,_.uniqBy=UR,_.uniqWith=$R,_.unset=VF,_.unzip=sp,_.unzipWith=v_,_.update=WF,_.updateWith=zF,_.values=Fa,_.valuesIn=HF,_.without=BR,_.words=V_,_.wrap=jD,_.xor=VR,_.xorBy=WR,_.xorWith=zR,_.zip=HR,_.zipObject=QR,_.zipObjectDeep=GR,_.zipWith=JR,_.entries=j_,_.entriesIn=U_,_.extend=M_,_.extendWith=Xc,mp(_,_),_.add=HM,_.attempt=W_,_.camelCase=YF,_.capitalize=$_,_.ceil=QM,_.clamp=QF,_.clone=$D,_.cloneDeep=VD,_.cloneDeepWith=WD,_.cloneWith=BD,_.conformsTo=zD,_.deburr=B_,_.defaultTo=OM,_.divide=GM,_.endsWith=KF,_.eq=si,_.escape=ZF,_.escapeRegExp=XF,_.every=aD,_.find=uD,_.findIndex=d_,_.findKey=_F,_.findLast=cD,_.findLastIndex=p_,_.findLastKey=xF,_.floor=JM,_.forEach=w_,_.forEachRight=__,_.forIn=SF,_.forInRight=EF,_.forOwn=OF,_.forOwnRight=TF,_.get=lp,_.gt=HD,_.gte=QD,_.has=IF,_.hasIn=fp,_.head=y_,_.identity=dn,_.includes=pD,_.indexOf=cR,_.inRange=GF,_.invoke=NF,_.isArguments=js,_.isArray=ot,_.isArrayBuffer=GD,_.isArrayLike=fn,_.isArrayLikeObject=yr,_.isBoolean=JD,_.isBuffer=ds,_.isDate=YD,_.isElement=KD,_.isEmpty=ZD,_.isEqual=XD,_.isEqualWith=eF,_.isError=up,_.isFinite=tF,_.isFunction=Di,_.isInteger=I_,_.isLength=Kc,_.isMap=P_,_.isMatch=rF,_.isMatchWith=nF,_.isNaN=iF,_.isNative=sF,_.isNil=oF,_.isNull=aF,_.isNumber=C_,_.isObject=cr,_.isObjectLike=hr,_.isPlainObject=Go,_.isRegExp=cp,_.isSafeInteger=uF,_.isSet=N_,_.isString=Zc,_.isSymbol=On,_.isTypedArray=Da,_.isUndefined=cF,_.isWeakMap=lF,_.isWeakSet=fF,_.join=pR,_.kebabCase=eM,_.last=Wn,_.lastIndexOf=mR,_.lowerCase=tM,_.lowerFirst=rM,_.lt=hF,_.lte=dF,_.max=YM,_.maxBy=KM,_.mean=ZM,_.meanBy=XM,_.min=e2,_.minBy=t2,_.stubArray=gp,_.stubFalse=vp,_.stubObject=UM,_.stubString=$M,_.stubTrue=BM,_.multiply=r2,_.nth=yR,_.noConflict=NM,_.noop=yp,_.now=Gc,_.pad=nM,_.padEnd=iM,_.padStart=sM,_.parseInt=aM,_.random=JF,_.reduce=bD,_.reduceRight=wD,_.repeat=oM,_.replace=uM,_.result=jF,_.round=n2,_.runInContext=q,_.sample=xD,_.size=OD,_.snakeCase=cM,_.some=TD,_.sortedIndex=SR,_.sortedIndexBy=ER,_.sortedIndexOf=OR,_.sortedLastIndex=TR,_.sortedLastIndexBy=AR,_.sortedLastIndexOf=kR,_.startCase=fM,_.startsWith=hM,_.subtract=i2,_.sum=s2,_.sumBy=a2,_.template=dM,_.times=VM,_.toFinite=Fi,_.toInteger=ct,_.toLength=D_,_.toLower=pM,_.toNumber=zn,_.toSafeInteger=pF,_.toString=qt,_.toUpper=mM,_.trim=yM,_.trimEnd=gM,_.trimStart=vM,_.truncate=bM,_.unescape=wM,_.uniqueId=zM,_.upperCase=_M,_.upperFirst=hp,_.each=w_,_.eachRight=__,_.first=y_,mp(_,function(){var s={};return li(_,function(o,l){$t.call(_.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),_.VERSION=n,jn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){_[s].placeholder=_}),jn(["drop","take"],function(s,o){vt.prototype[s]=function(l){l=l===t?1:kr(ct(l),0);var p=this.__filtered__&&!o?new vt(this):this.clone();return p.__filtered__?p.__takeCount__=Hr(l,p.__takeCount__):p.__views__.push({size:Hr(l,xe),type:s+(p.__dir__<0?"Right":"")}),p},vt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),jn(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==Ge||l==Je;vt.prototype[s]=function(v){var O=this.clone();return O.__iteratees__.push({iteratee:We(v,3),type:l}),O.__filtered__=O.__filtered__||p,O}}),jn(["head","last"],function(s,o){var l="take"+(o?"Right":"");vt.prototype[s]=function(){return this[l](1).value()[0]}}),jn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");vt.prototype[s]=function(){return this.__filtered__?new vt(this):this[l](1)}}),vt.prototype.compact=function(){return this.filter(dn)},vt.prototype.find=function(s){return this.filter(s).head()},vt.prototype.findLast=function(s){return this.reverse().find(s)},vt.prototype.invokeMap=ht(function(s,o){return typeof s=="function"?new vt(this):this.map(function(l){return Bo(l,s,o)})}),vt.prototype.reject=function(s){return this.filter(Yc(We(s)))},vt.prototype.slice=function(s,o){s=ct(s);var l=this;return l.__filtered__&&(s>0||o<0)?new vt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=ct(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},vt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},vt.prototype.toArray=function(){return this.take(xe)},li(vt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),v=_[p?"take"+(o=="last"?"Right":""):o],O=p||/^find/.test(o);v&&(_.prototype[o]=function(){var N=this.__wrapped__,M=p?[1]:arguments,B=N instanceof vt,ie=M[0],ae=B||ot(N),fe=function(yt){var xt=v.apply(_,as([yt],M));return p&&Oe?xt[0]:xt};ae&&l&&typeof ie=="function"&&ie.length!=1&&(B=ae=!1);var Oe=this.__chain__,qe=!!this.__actions__.length,He=O&&!Oe,ft=B&&!qe;if(!O&&ae){N=ft?N:new vt(this);var Qe=s.apply(N,M);return Qe.__actions__.push({func:Hc,args:[fe],thisArg:t}),new $n(Qe,Oe)}return He&&ft?s.apply(this,M):(Qe=this.thru(fe),He?p?Qe.value()[0]:Qe.value():Qe)})}),jn(["pop","push","shift","sort","splice","unshift"],function(s){var o=vc[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",p=/^(?:pop|shift)$/.test(s);_.prototype[s]=function(){var v=arguments;if(p&&!this.__chain__){var O=this.value();return o.apply(ot(O)?O:[],v)}return this[l](function(N){return o.apply(ot(N)?N:[],v)})}}),li(vt.prototype,function(s,o){var l=_[o];if(l){var p=l.name+"";$t.call(Ia,p)||(Ia[p]=[]),Ia[p].push({name:o,func:l})}}),Ia[jc(t,S).name]=[{name:"wrapper",func:t}],vt.prototype.clone=wC,vt.prototype.reverse=_C,vt.prototype.value=xC,_.prototype.at=KR,_.prototype.chain=ZR,_.prototype.commit=XR,_.prototype.next=eD,_.prototype.plant=rD,_.prototype.reverse=nD,_.prototype.toJSON=_.prototype.valueOf=_.prototype.value=iD,_.prototype.first=_.prototype.head,Fo&&(_.prototype[Fo]=tD),_},Ta=XP();Cs?((Cs.exports=Ta)._=Ta,pd._=Ta):Br._=Ta}).call(di)}(Qu,Qu.exports);var AT=Qu.exports;const bi=wp(AT),kv=ve.createContext(),Iv=ve.createContext(),yo=async(r,e,t)=>{ve.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},kT=(r,e,t)=>{const n=ve.useRef(r);ve.useEffect(()=>{n.current=r},[r]);const i=ve.useCallback(bi.throttle(()=>{n.current()},e),[]);ve.useEffect(i,[...t])},go=(r,e=null,t)=>{const n=ve.useRef(r);ve.useEffect(()=>{n.current=r},[r]),yo(async i=>{let a;const u=async()=>{await n.current(i),e!==null&&(a=setTimeout(u,e))};return u(),()=>a&&clearTimeout(a)},[e,...t])},Pv=(r,e,t)=>{const[n,i]=ve.useState(),[a,u]=ve.useState(!0),[c,f]=ve.useState(),{urls:h,request:d}=Xn();return go(async y=>{try{const g={signal:y,...e||{}};if(g.skip)return;const m=await d(`${h.apiUrl}${r}`,g);i(m)}catch(g){f(g)}u(!1)},t,[r,e]),{data:n,error:c,loading:a}},IT=(r,e)=>{const[t,n]=ve.useState(),[i,a]=ve.useState(!0),[u,c]=ve.useState(),{urls:f,request:h}=Xn();return go(async d=>{try{if(!r)return;const y=await h(`${f.apiUrl}/reports/production`,{method:"POST",body:r,signal:d});n(y)}catch(y){c(y)}a(!1)},e,[r]),{data:t,error:u,loading:i}},PT=({machineRef:r,key:e,skip:t})=>{const[n,i]=ve.useState(),[a,u]=ve.useState(),[c,f]=ve.useState(),[h,d]=ve.useState(),[y,g]=ve.useState(),[m,x]=ve.useState(),T=Ji`
113
+ subscription MMToolsQuantityStreamSubscription {
114
+ currentQuantities(
115
+ where: { machineRef: { _eq: ${y} }, key: { _eq: "${m}" } }
116
+ ) {
117
+ value
118
+ eventTime
119
+ }
120
+ }
121
+ `,{data:w}=kO(T,{skip:t}),[S,A]=ve.useState();ve.useEffect(()=>{r!==y&&g(r),e!==m&&x(e),d(),i(),f(),u()},[r,e,m,y]),ve.useEffect(()=>{if(L||!r||!e)return;const $=h||ut.utc().minus({hours:1}).format(),X=Ji`
122
+ query MMToolsQuantityStreamQuery {
123
+ quantities(args:{machineRef:${y}, metricKey:"${m}", windowStart:"${$}"}, order_by:{eventTime:asc}) {
124
+ value
125
+ eventTime
126
+ }
127
+ }
128
+ `;A(X)},[y,m,h]),ve.useEffect(()=>{S&&P()},[S,w]);const[P,{data:F,loading:L}]=AO(S,{fetchPolicy:"no-cache"});return ve.useEffect(()=>{if(!F||!F.quantities)return;const $=bi.last(F.quantities);if($&&d($.eventTime),!n)i(F.quantities);else{const X=bi.drop(F.quantities);i([...n,...X])}},[F]),{data:n,error:c,loading:a}},CT=r=>{const[e,t]=ve.useState(),[n,i]=ve.useState(!0),[a,u]=ve.useState(),{urls:c,request:f}=Xn();return yo(async h=>{try{const d=await f(`${c.apiUrl}/reports/downtime`,{method:"POST",body:r,signal:h});t(d)}catch(d){u(d)}i(!1)},[r]),{data:e,error:a,loading:n}},NT=r=>{const[e,t]=ve.useState(),{urls:n,request:i,clientId:a}=Xn(),u=`lab:${a}:${r}`,{data:c,loading:f,error:h}=Pv("/templates");return ve.useEffect(()=>{if(!c)return;const m=bi.filter(c.templates,{namespace:u});t(m)},[c]),[async({name:m,public:x,config:T})=>{const w={name:m,public:x,namespace:u,config:JSON.stringify(T)},S=JSON.stringify(w),A=await i(`${n.apiUrl}/templates`,{method:"POST",body:S});return t([...e,A.template]),A.template},async(m,{name:x,public:T,config:w})=>{const S={name:x,public:T,namespace:u,config:JSON.stringify(w)},A=JSON.stringify(S),P=await i(`${n.apiUrl}/templates/${m}`,{method:"PUT",body:A}),F=bi.findIndex(e,{id:m}),L=e.slice(0,F),$=e.slice(F+1);return t([...L,P.template,...$]),P.template},async m=>{await i(`${n.apiUrl}/templates/${m}`,{method:"DELETE"}),t(bi.reject(e,{id:m}))},{templates:e,loading:f,error:h}]},RT=()=>{const[r,e]=ve.useState(),[t,n]=ve.useState(),{urls:i}=Xn();return ve.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]),ve.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}]},Xn=()=>ve.useContext(Iv),DT=()=>ve.useContext(kv),FT=()=>{const{login:r,isAuthenticated:e}=Xn();return yo(async()=>{e===!1&&await r()},[e]),e?Mr.jsx(Hn.Outlet,{}):Mr.jsx("div",{})},Cv="%[a-f0-9]{2}",Nv=new RegExp("("+Cv+")|([^%]+?)","gi"),Rv=new RegExp("("+Cv+")+","gi");function Qf(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([],Qf(t),Qf(n))}function MT(r){try{return decodeURIComponent(r)}catch{let e=r.match(Nv)||[];for(let t=1;t<e.length;t++)r=Qf(e,t).join(""),e=r.match(Nv)||[];return r}}function LT(r){const e={"%FE%FF":"��","%FF%FE":"��"};let t=Rv.exec(r);for(;t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{const i=MT(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Rv.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 qT(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return LT(r)}}function Dv(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)]}function jT(r,e){const t={};if(Array.isArray(e))for(const n of e){const i=Object.getOwnPropertyDescriptor(r,n);i!=null&&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}const UT=r=>r==null,$T=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Gf=Symbol("encodeFragmentIdentifier");function BT(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,[wr(e,r),"[",i,"]"].join("")]:[...t,[wr(e,r),"[",wr(i,r),"]=",wr(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[wr(e,r),"[]"].join("")]:[...t,[wr(e,r),"[]=",wr(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,[wr(e,r),":list="].join("")]:[...t,[wr(e,r),":list=",wr(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?[[wr(t,r),e,wr(i,r)].join("")]:[[n,wr(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,wr(e,r)]:[...t,[wr(e,r),"=",wr(n,r)].join("")]}}function VT(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&&wi(n,r).includes(r.arrayFormatSeparator);n=u?wi(n,r):n;const c=a||u?n.split(r.arrayFormatSeparator).map(f=>wi(f,r)):n===null?n:wi(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{const a=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!a){i[t]=n&&wi(n,r);return}const u=n===null?[]:n.split(r.arrayFormatSeparator).map(c=>wi(c,r));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 Fv(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function wr(r,e){return e.encode?e.strict?$T(r):encodeURIComponent(r):r}function wi(r,e){return e.decode?qT(r):r}function Mv(r){return Array.isArray(r)?r.sort():typeof r=="object"?Mv(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function Lv(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function WT(r){let e="";const t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function qv(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function Jf(r){r=Lv(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function Yf(r,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...e},Fv(e.arrayFormatSeparator);const t=VT(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]=Dv(a,"=");u===void 0&&(u=a),c=c===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?c:wi(c,e),t(wi(u,e),c,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null)for(const[u,c]of Object.entries(a))a[u]=qv(c,e);else n[i]=qv(a,e);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)?Mv(u):u,i},Object.create(null))}function jv(r,e){if(!r)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},Fv(e.arrayFormatSeparator);const t=u=>e.skipNull&&UT(r[u])||e.skipEmptyString&&r[u]==="",n=BT(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?wr(u,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?wr(u,e)+"[]":c.reduce(n(u),[]).join("&"):wr(u,e)+"="+wr(c,e)}).filter(u=>u.length>0).join("&")}function Uv(r,e){var i;e={decode:!0,...e};let[t,n]=Dv(r,"#");return t===void 0&&(t=r),{url:((i=t==null?void 0:t.split("?"))==null?void 0:i[0])??"",query:Yf(Jf(r),e),...e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:wi(n,e)}:{}}}function $v(r,e){e={encode:!0,strict:!0,[Gf]:!0,...e};const t=Lv(r.url).split("?")[0]||"",n=Jf(r.url),i={...Yf(n,{sort:!1}),...r.query};let a=jv(i,e);a&&(a=`?${a}`);let u=WT(r.url);if(typeof r.fragmentIdentifier=="string"){const c=new URL(t);c.hash=r.fragmentIdentifier,u=e[Gf]?c.hash:`#${r.fragmentIdentifier}`}return`${t}${a}${u}`}function Bv(r,e,t){t={parseFragmentIdentifier:!0,[Gf]:!1,...t};const{url:n,query:i,fragmentIdentifier:a}=Uv(r,t);return $v({url:n,query:jT(i,e),fragmentIdentifier:a},t)}function zT(r,e,t){const n=Array.isArray(e)?i=>!e.includes(i):(i,a)=>!e(i,a);return Bv(r,n,t)}const HT=Object.freeze(Object.defineProperty({__proto__:null,exclude:zT,extract:Jf,parse:Yf,parseUrl:Uv,pick:Bv,stringify:jv,stringifyUrl:$v},Symbol.toStringTag,{value:"Module"}));for(var jr=[],Kf=0;Kf<256;++Kf)jr.push((Kf+256).toString(16).slice(1));function QT(r,e=0){return(jr[r[e+0]]+jr[r[e+1]]+jr[r[e+2]]+jr[r[e+3]]+"-"+jr[r[e+4]]+jr[r[e+5]]+"-"+jr[r[e+6]]+jr[r[e+7]]+"-"+jr[r[e+8]]+jr[r[e+9]]+"-"+jr[r[e+10]]+jr[r[e+11]]+jr[r[e+12]]+jr[r[e+13]]+jr[r[e+14]]+jr[r[e+15]]).toLowerCase()}var Gu,GT=new Uint8Array(16);function JT(){if(!Gu&&(Gu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Gu))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gu(GT)}var YT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Vv={randomUUID:YT};function KT(r,e,t){if(Vv.randomUUID&&!e&&!r)return Vv.randomUUID();r=r||{};var n=r.random||(r.rng||JT)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,QT(n)}const Zf="mm-auth-state",Xf="mm-auth-destination",eh="mm-auth-access-token",_i=window.localStorage,ZT=()=>_i.getItem(eh),XT=r=>{r?_i.setItem(eh,r):_i.removeItem(eh)},eA=()=>_i.getItem(Xf),Wv=r=>{r?_i.setItem(Xf,r):_i.removeItem(Xf)},tA=()=>_i.getItem(Zf),zv=r=>{r?_i.setItem(Zf,r):_i.removeItem(Zf)},Hv=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 rA(r){return Kt(r)&&"code"in r&&"reason"in r}function nA(r){var e;return Kt(r)&&((e=r.target)===null||e===void 0?void 0:e.readyState)===WebSocket.CLOSED}var iA=function(r){kn(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 Ct(function(i){return n.client.subscribe(j(j({},t),{query:Hs(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=rA(a);return u||nA(a)?i.error(new Error("Socket closed".concat(u?" with event ".concat(a.code):"").concat(u?" ".concat(a.reason):""))):i.error(new oi({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Jr);function an(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function ks(r){return an(r)==="object"}function sA(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Qv(r,e){return r.length<124?r:e}const aA="graphql-transport-ws";var gn;(function(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"})(gn||(gn={}));var pr;(function(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"})(pr||(pr={}));function Gv(r){if(!ks(r))throw new Error(`Message is expected to be an object, but got ${an(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 ${an(r.type)}`);switch(r.type){case pr.ConnectionInit:case pr.ConnectionAck:case pr.Ping:case pr.Pong:{if(r.payload!=null&&!ks(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 pr.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${an(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!ks(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${an(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 ${an(r.payload.query)}`);if(r.payload.variables!=null&&!ks(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 ${an(r.payload.variables)}`);if(r.payload.operationName!=null&&an(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 ${an(r.payload.operationName)}`);if(r.payload.extensions!=null&&!ks(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 ${an(r.payload.extensions)}`);break}case pr.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${an(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!ks(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${an(r.payload)}`);break}case pr.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${an(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!sA(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 pr.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${an(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 oA(r,e){return Gv(typeof r=="string"?JSON.parse(r,e):r)}function vo(r,e){return Gv(r),JSON.stringify(r,e)}var ca=function(r){return this instanceof ca?(this.v=r,this):new ca(r)},uA=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},u("next"),u("throw"),u("return"),i[Symbol.asyncIterator]=function(){return this},i;function u(g){n[g]&&(i[g]=function(m){return new Promise(function(x,T){a.push([g,m,x,T])>1||c(g,m)})})}function c(g,m){try{f(n[g](m))}catch(x){y(a[0][3],x)}}function f(g){g.value instanceof ca?Promise.resolve(g.value.v).then(h,d):y(a[0][2],g)}function h(g){c("next",g)}function d(g){c("throw",g)}function y(g,m){g(m),a.shift(),a.length&&c(a[0][0],a[0][1])}};function cA(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:d=async function(Je){let ge=1e3;for(let ue=0;ue<Je;ue++)ge*=2;await new Promise(ue=>setTimeout(ue,ge+Math.floor(Math.random()*2700+300)))},shouldRetry:y=th,isFatalConnectionProblem:g,on:m,webSocketImpl:x,generateID:T=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Je=>{const ge=Math.random()*16|0;return(Je=="x"?ge:ge&3|8).toString(16)})},jsonMessageReplacer:w,jsonMessageReviver:S}=r;let A;if(x){if(!fA(x))throw new Error("Invalid WebSocket implementation provided");A=x}else typeof WebSocket<"u"?A=WebSocket:typeof global<"u"?A=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(A=window.WebSocket||window.MozWebSocket);if(!A)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const P=A,F=(()=>{const ye=(()=>{const ge={};return{on(ue,Ee){return ge[ue]=Ee,()=>{delete ge[ue]}},emit(ue){var Ee;"id"in ue&&((Ee=ge[ue.id])===null||Ee===void 0||Ee.call(ge,ue))}}})(),Je={connecting:m!=null&&m.connecting?[m.connecting]:[],opened:m!=null&&m.opened?[m.opened]:[],connected:m!=null&&m.connected?[m.connected]:[],ping:m!=null&&m.ping?[m.ping]:[],pong:m!=null&&m.pong?[m.pong]:[],message:m!=null&&m.message?[ye.emit,m.message]:[ye.emit],closed:m!=null&&m.closed?[m.closed]:[],error:m!=null&&m.error?[m.error]:[]};return{onMessage:ye.on,on(ge,ue){const Ee=Je[ge];return Ee.push(ue),()=>{Ee.splice(Ee.indexOf(ue),1)}},emit(ge,...ue){for(const Ee of[...Je[ge]])Ee(...ue)}}})();function L(ye){const Je=[F.on("error",ge=>{Je.forEach(ue=>ue()),ye(ge)}),F.on("closed",ge=>{Je.forEach(ue=>ue()),ye(ge)})]}let $,X=0,te,he=!1,de=0,Ve=!1;async function Ae(){clearTimeout(te);const[ye,Je]=await($??($=new Promise((Ee,Ne)=>(async()=>{if(he){if(await d(de),!X)return $=void 0,Ne({code:1e3,reason:"All Subscriptions Gone"});de++}F.emit("connecting",he);const xe=new P(typeof e=="function"?await e():e,aA);let Xe,Et;function lt(){isFinite(u)&&u>0&&(clearTimeout(Et),Et=setTimeout(()=>{xe.readyState===P.OPEN&&(xe.send(vo({type:pr.Ping})),F.emit("ping",!1,void 0))},u))}L(et=>{$=void 0,clearTimeout(Xe),clearTimeout(Et),Ne(et),et instanceof Jv&&(xe.close(4499,"Terminated"),xe.onerror=null,xe.onclose=null)}),xe.onerror=et=>F.emit("error",et),xe.onclose=et=>F.emit("closed",et),xe.onopen=async()=>{try{F.emit("opened",xe);const et=typeof t=="function"?await t():t;if(xe.readyState!==P.OPEN)return;xe.send(vo(et?{type:pr.ConnectionInit,payload:et}:{type:pr.ConnectionInit},w)),isFinite(f)&&f>0&&(Xe=setTimeout(()=>{xe.close(gn.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},f)),lt()}catch(et){F.emit("error",et),xe.close(gn.InternalClientError,Qv(et instanceof Error?et.message:new Error(et).message,"Internal client error"))}};let It=!1;xe.onmessage=({data:et})=>{try{const Ye=oA(et,S);if(F.emit("message",Ye),Ye.type==="ping"||Ye.type==="pong"){F.emit(Ye.type,!0,Ye.payload),Ye.type==="pong"?lt():c||(xe.send(vo(Ye.payload?{type:pr.Pong,payload:Ye.payload}:{type:pr.Pong})),F.emit("pong",!1,Ye.payload));return}if(It)return;if(Ye.type!==pr.ConnectionAck)throw new Error(`First message cannot be of type ${Ye.type}`);clearTimeout(Xe),It=!0,F.emit("connected",xe,Ye.payload,he),he=!1,de=0,Ee([xe,new Promise((dt,Re)=>L(Re))])}catch(Ye){xe.onmessage=null,F.emit("error",Ye),xe.close(gn.BadResponse,Qv(Ye instanceof Error?Ye.message:new Error(Ye).message,"Bad response"))}}})())));ye.readyState===P.CLOSING&&await Je;let ge=()=>{};const ue=new Promise(Ee=>ge=Ee);return[ye,ge,Promise.race([ue.then(()=>{if(!X){const Ee=()=>ye.close(1e3,"Normal Closure");isFinite(a)&&a>0?te=setTimeout(()=>{ye.readyState===P.OPEN&&Ee()},a):Ee()}}),Je])]}function je(ye){if(th(ye)&&(lA(ye.code)||[gn.InternalServerError,gn.InternalClientError,gn.BadRequest,gn.BadResponse,gn.Unauthorized,gn.SubprotocolNotAcceptable,gn.SubscriberAlreadyExists,gn.TooManyInitialisationRequests].includes(ye.code)))throw ye;if(Ve)return!1;if(th(ye)&&ye.code===1e3)return X>0;if(!h||de>=h||!y(ye)||g!=null&&g(ye))throw ye;return he=!0}n||(async()=>{for(X++;;)try{const[,,ye]=await Ae();await ye}catch(ye){try{if(!je(ye))return}catch(Je){return i==null?void 0:i(Je)}}})();function Ge(ye,Je){const ge=T(ye);let ue=!1,Ee=!1,Ne=()=>{X--,ue=!0};return(async()=>{for(X++;;)try{const[xe,Xe,Et]=await Ae();if(ue)return Xe();const lt=F.onMessage(ge,It=>{switch(It.type){case pr.Next:{Je.next(It.payload);return}case pr.Error:{Ee=!0,ue=!0,Je.error(It.payload),Ne();return}case pr.Complete:{ue=!0,Ne();return}}});xe.send(vo({id:ge,type:pr.Subscribe,payload:ye},w)),Ne=()=>{!ue&&xe.readyState===P.OPEN&&xe.send(vo({id:ge,type:pr.Complete},w)),X--,ue=!0,Xe()},await Et.finally(lt);return}catch(xe){if(!je(xe))return}})().then(()=>{Ee||Je.complete()}).catch(xe=>{Je.error(xe)}),()=>{ue||Ne()}}return{on:F.on,subscribe:Ge,iterate(ye){const Je=[],ge={done:!1,error:null,resolve:()=>{}},ue=Ge(ye,{next(Ne){Je.push(Ne),ge.resolve()},error(Ne){ge.done=!0,ge.error=Ne,ge.resolve()},complete(){ge.done=!0,ge.resolve()}}),Ee=function(){return uA(this,arguments,function*(){for(;;){for(Je.length||(yield ca(new Promise(Xe=>ge.resolve=Xe)));Je.length;)yield yield ca(Je.shift());if(ge.error)throw ge.error;if(ge.done)return yield ca(void 0)}})}();return Ee.throw=async Ne=>(ge.done||(ge.done=!0,ge.error=Ne,ge.resolve()),{done:!0,value:void 0}),Ee.return=async()=>(ue(),{done:!0,value:void 0}),Ee},async dispose(){if(Ve=!0,$){const[ye]=await $;ye.close(1e3,"Normal Closure")}},terminate(){$&&F.emit("closed",new Jv)}}}class Jv extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function th(r){return ks(r)&&"code"in r&&"reason"in r}function lA(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function fA(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Yv(r){return new Jr(function(e,t){var n=pn(e,[]);return new Ct(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 Kv(r){return new Jr(function(e,t){return new Ct(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}),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){kn(e,r);function e(t){var n=r.call(this)||this;return n.link=Kv(t),n}return e.prototype.request=function(t,n){return this.link.request(t,n)},e})(Jr);var rh={exports:{}};const hA=el(vO),dA=el(fE);var nh,Zv;function pA(){return Zv||(Zv=1,nh=Error),nh}var ih,Xv;function mA(){return Xv||(Xv=1,ih=EvalError),ih}var sh,e0;function yA(){return e0||(e0=1,sh=RangeError),sh}var ah,t0;function gA(){return t0||(t0=1,ah=ReferenceError),ah}var oh,r0;function n0(){return r0||(r0=1,oh=SyntaxError),oh}var uh,i0;function bo(){return i0||(i0=1,uh=TypeError),uh}var ch,s0;function vA(){return s0||(s0=1,ch=URIError),ch}var lh,a0;function bA(){return a0||(a0=1,lh=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(t 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 a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),lh}var fh,o0;function wA(){if(o0)return fh;o0=1;var r=typeof Symbol<"u"&&Symbol,e=bA();return fh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},fh}var hh,u0;function _A(){if(u0)return hh;u0=1;var r={__proto__:null,foo:{}},e=Object;return hh=function(){return{__proto__:r}.foo===r.foo&&!(r instanceof e)},hh}var dh,c0;function xA(){if(c0)return dh;c0=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 d=[],y=0;y<f.length;y+=1)d[y]=f[y];for(var g=0;g<h.length;g+=1)d[g+f.length]=h[g];return d},a=function(f,h){for(var d=[],y=h,g=0;y<f.length;y+=1,g+=1)d[g]=f[y];return d},u=function(c,f){for(var h="",d=0;d<c.length;d+=1)h+=c[d],d+1<c.length&&(h+=f);return h};return dh=function(f){var h=this;if(typeof h!="function"||e.apply(h)!==n)throw new TypeError(r+h);for(var d=a(arguments,1),y,g=function(){if(this instanceof y){var S=h.apply(this,i(d,arguments));return Object(S)===S?S:this}return h.apply(f,i(d,arguments))},m=t(0,h.length-d.length),x=[],T=0;T<m;T++)x[T]="$"+T;if(y=Function("binder","return function ("+u(x,",")+"){ return binder.apply(this,arguments); }")(g),h.prototype){var w=function(){};w.prototype=h.prototype,y.prototype=new w,w.prototype=null}return y},dh}var ph,l0;function mh(){if(l0)return ph;l0=1;var r=xA();return ph=Function.prototype.bind||r,ph}var yh,f0;function SA(){if(f0)return yh;f0=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=mh();return yh=t.call(r,e),yh}var gh,h0;function la(){if(h0)return gh;h0=1;var r,e=pA(),t=mA(),n=yA(),i=gA(),a=n0(),u=bo(),c=vA(),f=Function,h=function(ge){try{return f('"use strict"; return ('+ge+").constructor;")()}catch{}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch{d=null}var y=function(){throw new u},g=d?function(){try{return arguments.callee,y}catch{try{return d(arguments,"callee").get}catch{return y}}}():y,m=wA()(),x=_A()(),T=Object.getPrototypeOf||(x?function(ge){return ge.__proto__}:null),w={},S=typeof Uint8Array>"u"||!T?r:T(Uint8Array),A={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":m&&T?T([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":w,"%AsyncGenerator%":w,"%AsyncGeneratorFunction%":w,"%AsyncIteratorPrototype%":w,"%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%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":f,"%GeneratorFunction%":w,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&T?T(T([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!T?r:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!T?r:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&T?T(""[Symbol.iterator]()):r,"%Symbol%":m?Symbol:r,"%SyntaxError%":a,"%ThrowTypeError%":g,"%TypedArray%":S,"%TypeError%":u,"%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%":c,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(T)try{null.error}catch(ge){var P=T(T(ge));A["%Error.prototype%"]=P}var F=function ge(ue){var Ee;if(ue==="%AsyncFunction%")Ee=h("async function () {}");else if(ue==="%GeneratorFunction%")Ee=h("function* () {}");else if(ue==="%AsyncGeneratorFunction%")Ee=h("async function* () {}");else if(ue==="%AsyncGenerator%"){var Ne=ge("%AsyncGeneratorFunction%");Ne&&(Ee=Ne.prototype)}else if(ue==="%AsyncIteratorPrototype%"){var xe=ge("%AsyncGenerator%");xe&&T&&(Ee=T(xe.prototype))}return A[ue]=Ee,Ee},L={__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"]},$=mh(),X=SA(),te=$.call(Function.call,Array.prototype.concat),he=$.call(Function.apply,Array.prototype.splice),de=$.call(Function.call,String.prototype.replace),Ve=$.call(Function.call,String.prototype.slice),Ae=$.call(Function.call,RegExp.prototype.exec),je=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ge=/\\(\\)?/g,ye=function(ue){var Ee=Ve(ue,0,1),Ne=Ve(ue,-1);if(Ee==="%"&&Ne!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(Ne==="%"&&Ee!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var xe=[];return de(ue,je,function(Xe,Et,lt,It){xe[xe.length]=lt?de(It,Ge,"$1"):Et||Xe}),xe},Je=function(ue,Ee){var Ne=ue,xe;if(X(L,Ne)&&(xe=L[Ne],Ne="%"+xe[0]+"%"),X(A,Ne)){var Xe=A[Ne];if(Xe===w&&(Xe=F(Ne)),typeof Xe>"u"&&!Ee)throw new u("intrinsic "+ue+" exists, but is not available. Please file an issue!");return{alias:xe,name:Ne,value:Xe}}throw new a("intrinsic "+ue+" does not exist!")};return gh=function(ue,Ee){if(typeof ue!="string"||ue.length===0)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Ee!="boolean")throw new u('"allowMissing" argument must be a boolean');if(Ae(/^%?[^%]*%?$/,ue)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Ne=ye(ue),xe=Ne.length>0?Ne[0]:"",Xe=Je("%"+xe+"%",Ee),Et=Xe.name,lt=Xe.value,It=!1,et=Xe.alias;et&&(xe=et[0],he(Ne,te([0,1],et)));for(var Ye=1,dt=!0;Ye<Ne.length;Ye+=1){var Re=Ne[Ye],bt=Ve(Re,0,1),z=Ve(Re,-1);if((bt==='"'||bt==="'"||bt==="`"||z==='"'||z==="'"||z==="`")&&bt!==z)throw new a("property names with quotes must have matching quotes");if((Re==="constructor"||!dt)&&(It=!0),xe+="."+Re,Et="%"+xe+"%",X(A,Et))lt=A[Et];else if(lt!=null){if(!(Re in lt)){if(!Ee)throw new u("base intrinsic for "+ue+" exists, but the property is not available.");return}if(d&&Ye+1>=Ne.length){var Y=d(lt,Re);dt=!!Y,dt&&"get"in Y&&!("originalValue"in Y.get)?lt=Y.get:lt=lt[Re]}else dt=X(lt,Re),lt=lt[Re];dt&&!It&&(A[Et]=lt)}}return lt},gh}var vh={exports:{}},bh,d0;function wh(){if(d0)return bh;d0=1;var r=la(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return bh=e,bh}var _h,p0;function m0(){if(p0)return _h;p0=1;var r=la(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return _h=e,_h}var xh,y0;function EA(){if(y0)return xh;y0=1;var r=wh(),e=n0(),t=bo(),n=m0();return xh=function(a,u,c){if(!a||typeof a!="object"&&typeof a!="function")throw new t("`obj` must be an object or a function`");if(typeof u!="string"&&typeof u!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var f=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!n&&n(a,u);if(r)r(a,u,{configurable:d===null&&g?g.configurable:!d,enumerable:f===null&&g?g.enumerable:!f,value:c,writable:h===null&&g?g.writable:!h});else if(y||!f&&!h&&!d)a[u]=c;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},xh}var Sh,g0;function OA(){if(g0)return Sh;g0=1;var r=wh(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},Sh=e,Sh}var Eh,v0;function TA(){if(v0)return Eh;v0=1;var r=la(),e=EA(),t=OA()(),n=m0(),i=bo(),a=r("%Math.floor%");return Eh=function(c,f){if(typeof c!="function")throw new i("`fn` is not a function");if(typeof f!="number"||f<0||f>4294967295||a(f)!==f)throw new i("`length` must be a positive 32-bit integer");var h=arguments.length>2&&!!arguments[2],d=!0,y=!0;if("length"in c&&n){var g=n(c,"length");g&&!g.configurable&&(d=!1),g&&!g.writable&&(y=!1)}return(d||y||!h)&&(t?e(c,"length",f,!0,!0):e(c,"length",f)),c},Eh}var b0;function AA(){return b0||(b0=1,function(r){var e=mh(),t=la(),n=TA(),i=bo(),a=t("%Function.prototype.apply%"),u=t("%Function.prototype.call%"),c=t("%Reflect.apply%",!0)||e.call(u,a),f=wh(),h=t("%Math.max%");r.exports=function(g){if(typeof g!="function")throw new i("a function is required");var m=c(e,u,arguments);return n(m,1+h(0,g.length-(arguments.length-1)),!0)};var d=function(){return c(e,a,arguments)};f?f(r.exports,"apply",{value:d}):r.exports.apply=d}(vh)),vh.exports}var Oh,w0;function kA(){if(w0)return Oh;w0=1;var r=la(),e=AA(),t=e(r("String.prototype.indexOf"));return Oh=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e(u):u},Oh}const IA=el(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Th,_0;function PA(){if(_0)return Th;_0=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,d=typeof WeakSet=="function"&&WeakSet.prototype,y=d?WeakSet.prototype.has:null,g=typeof WeakRef=="function"&&WeakRef.prototype,m=g?WeakRef.prototype.deref:null,x=Boolean.prototype.valueOf,T=Object.prototype.toString,w=Function.prototype.toString,S=String.prototype.match,A=String.prototype.slice,P=String.prototype.replace,F=String.prototype.toUpperCase,L=String.prototype.toLowerCase,$=RegExp.prototype.test,X=Array.prototype.concat,te=Array.prototype.join,he=Array.prototype.slice,de=Math.floor,Ve=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ae=Object.getOwnPropertySymbols,je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ge=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ye=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ge||!0)?Symbol.toStringTag:null,Je=Object.prototype.propertyIsEnumerable,ge=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(W){return W.__proto__}:null);function ue(W,H){if(W===1/0||W===-1/0||W!==W||W&&W>-1e3&&W<1e3||$.call(/e/,H))return H;var Be=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof W=="number"){var $e=W<0?-de(-W):de(W);if($e!==W){var Tt=String($e),Ke=A.call(H,Tt.length+1);return P.call(Tt,Be,"$&_")+"."+P.call(P.call(Ke,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(H,Be,"$&_")}var Ee=IA,Ne=Ee.custom,xe=z(Ne)?Ne:null;Th=function W(H,Be,$e,Tt){var Ke=Be||{};if(G(Ke,"quoteStyle")&&Ke.quoteStyle!=="single"&&Ke.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(G(Ke,"maxStringLength")&&(typeof Ke.maxStringLength=="number"?Ke.maxStringLength<0&&Ke.maxStringLength!==1/0:Ke.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var nr=G(Ke,"customInspect")?Ke.customInspect:!0;if(typeof nr!="boolean"&&nr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(G(Ke,"indent")&&Ke.indent!==null&&Ke.indent!==" "&&!(parseInt(Ke.indent,10)===Ke.indent&&Ke.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(G(Ke,"numericSeparator")&&typeof Ke.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var fr=Ke.numericSeparator;if(typeof H>"u")return"undefined";if(H===null)return"null";if(typeof H=="boolean")return H?"true":"false";if(typeof H=="string")return wt(H,Ke);if(typeof H=="number"){if(H===0)return 1/0/H>0?"0":"-0";var Dt=String(H);return fr?ue(H,Dt):Dt}if(typeof H=="bigint"){var Ht=String(H)+"n";return fr?ue(H,Ht):Ht}var Ur=typeof Ke.depth>"u"?5:Ke.depth;if(typeof $e>"u"&&($e=0),$e>=Ur&&Ur>0&&typeof H=="object")return lt(H)?"[Array]":"[Object]";var $r=zt(Ke,$e);if(typeof Tt>"u")Tt=[];else if(Te(Tt,H)>=0)return"[Circular]";function ir(Le,at,nt){if(at&&(Tt=he.call(Tt),Tt.push(at)),nt){var tt={depth:Ke.depth};return G(Ke,"quoteStyle")&&(tt.quoteStyle=Ke.quoteStyle),W(Le,tt,$e+1,Tt)}return W(Le,Ke,$e+1,Tt)}if(typeof H=="function"&&!et(H)){var un=Q(H),_r=Zt(H,ir);return"[Function"+(un?": "+un:" (anonymous)")+"]"+(_r.length>0?" { "+te.call(_r,", ")+" }":"")}if(z(H)){var xr=Ge?P.call(String(H),/^(Symbol\(.*\))_[^)]*$/,"$1"):je.call(H);return typeof H=="object"&&!Ge?pt(xr):xr}if(Ot(H)){for(var Sr="<"+L.call(String(H.nodeName)),Or=H.attributes||[],ur=0;ur<Or.length;ur++)Sr+=" "+Or[ur].name+"="+Xe(Et(Or[ur].value),"double",Ke);return Sr+=">",H.childNodes&&H.childNodes.length&&(Sr+="..."),Sr+="</"+L.call(String(H.nodeName))+">",Sr}if(lt(H)){if(H.length===0)return"[]";var zr=Zt(H,ir);return $r&&!Rr(zr)?"["+Jt(zr,$r)+"]":"[ "+te.call(zr,", ")+" ]"}if(Ye(H)){var Tr=Zt(H,ir);return!("cause"in Error.prototype)&&"cause"in H&&!Je.call(H,"cause")?"{ ["+String(H)+"] "+te.call(X.call("[cause]: "+ir(H.cause),Tr),", ")+" }":Tr.length===0?"["+String(H)+"]":"{ ["+String(H)+"] "+te.call(Tr,", ")+" }"}if(typeof H=="object"&&nr){if(xe&&typeof H[xe]=="function"&&Ee)return Ee(H,{depth:Ur-$e});if(nr!=="symbol"&&typeof H.inspect=="function")return H.inspect()}if(ze(H)){var Er=[];return n&&n.call(H,function(Le,at){Er.push(ir(at,H,!0)+" => "+ir(Le,H))}),rr("Map",t.call(H),Er,$r)}if(be(H)){var Dr=[];return c&&c.call(H,function(Le){Dr.push(ir(Le,H))}),rr("Set",u.call(H),Dr,$r)}if(Ue(H))return Lt("WeakMap");if(Ze(H))return Lt("WeakSet");if(ce(H))return Lt("WeakRef");if(Re(H))return pt(ir(Number(H)));if(Y(H))return pt(ir(Ve.call(H)));if(bt(H))return pt(x.call(H));if(dt(H))return pt(ir(String(H)));if(typeof window<"u"&&H===window)return"{ [object Window] }";if(typeof globalThis<"u"&&H===globalThis||typeof di<"u"&&H===di)return"{ [object globalThis] }";if(!It(H)&&!et(H)){var cn=Zt(H,ir),Ln=ge?ge(H)===Object.prototype:H instanceof Object||H.constructor===Object,R=H instanceof Object?"":"null prototype",se=!Ln&&ye&&Object(H)===H&&ye in H?A.call(Z(H),8,-1):R?"Object":"",me=Ln||typeof H.constructor!="function"?"":H.constructor.name?H.constructor.name+" ":"",ke=me+(se||R?"["+te.call(X.call([],se||[],R||[]),": ")+"] ":"");return cn.length===0?ke+"{}":$r?ke+"{"+Jt(cn,$r)+"}":ke+"{ "+te.call(cn,", ")+" }"}return String(H)};function Xe(W,H,Be){var $e=(Be.quoteStyle||H)==="double"?'"':"'";return $e+W+$e}function Et(W){return P.call(String(W),/"/g,"&quot;")}function lt(W){return Z(W)==="[object Array]"&&(!ye||!(typeof W=="object"&&ye in W))}function It(W){return Z(W)==="[object Date]"&&(!ye||!(typeof W=="object"&&ye in W))}function et(W){return Z(W)==="[object RegExp]"&&(!ye||!(typeof W=="object"&&ye in W))}function Ye(W){return Z(W)==="[object Error]"&&(!ye||!(typeof W=="object"&&ye in W))}function dt(W){return Z(W)==="[object String]"&&(!ye||!(typeof W=="object"&&ye in W))}function Re(W){return Z(W)==="[object Number]"&&(!ye||!(typeof W=="object"&&ye in W))}function bt(W){return Z(W)==="[object Boolean]"&&(!ye||!(typeof W=="object"&&ye in W))}function z(W){if(Ge)return W&&typeof W=="object"&&W instanceof Symbol;if(typeof W=="symbol")return!0;if(!W||typeof W!="object"||!je)return!1;try{return je.call(W),!0}catch{}return!1}function Y(W){if(!W||typeof W!="object"||!Ve)return!1;try{return Ve.call(W),!0}catch{}return!1}var V=Object.prototype.hasOwnProperty||function(W){return W in this};function G(W,H){return V.call(W,H)}function Z(W){return T.call(W)}function Q(W){if(W.name)return W.name;var H=S.call(w.call(W),/^function\s*([\w$]+)/);return H?H[1]:null}function Te(W,H){if(W.indexOf)return W.indexOf(H);for(var Be=0,$e=W.length;Be<$e;Be++)if(W[Be]===H)return Be;return-1}function ze(W){if(!t||!W||typeof W!="object")return!1;try{t.call(W);try{u.call(W)}catch{return!0}return W instanceof Map}catch{}return!1}function Ue(W){if(!h||!W||typeof W!="object")return!1;try{h.call(W,h);try{y.call(W,y)}catch{return!0}return W instanceof WeakMap}catch{}return!1}function ce(W){if(!m||!W||typeof W!="object")return!1;try{return m.call(W),!0}catch{}return!1}function be(W){if(!u||!W||typeof W!="object")return!1;try{u.call(W);try{t.call(W)}catch{return!0}return W instanceof Set}catch{}return!1}function Ze(W){if(!y||!W||typeof W!="object")return!1;try{y.call(W,y);try{h.call(W,h)}catch{return!0}return W instanceof WeakSet}catch{}return!1}function Ot(W){return!W||typeof W!="object"?!1:typeof HTMLElement<"u"&&W instanceof HTMLElement?!0:typeof W.nodeName=="string"&&typeof W.getAttribute=="function"}function wt(W,H){if(W.length>H.maxStringLength){var Be=W.length-H.maxStringLength,$e="... "+Be+" more character"+(Be>1?"s":"");return wt(A.call(W,0,H.maxStringLength),H)+$e}var Tt=P.call(P.call(W,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Gt);return Xe(Tt,"single",H)}function Gt(W){var H=W.charCodeAt(0),Be={8:"b",9:"t",10:"n",12:"f",13:"r"}[H];return Be?"\\"+Be:"\\x"+(H<16?"0":"")+F.call(H.toString(16))}function pt(W){return"Object("+W+")"}function Lt(W){return W+" { ? }"}function rr(W,H,Be,$e){var Tt=$e?Jt(Be,$e):te.call(Be,", ");return W+" ("+H+") {"+Tt+"}"}function Rr(W){for(var H=0;H<W.length;H++)if(Te(W[H],`
129
+ `)>=0)return!1;return!0}function zt(W,H){var Be;if(W.indent===" ")Be=" ";else if(typeof W.indent=="number"&&W.indent>0)Be=te.call(Array(W.indent+1)," ");else return null;return{base:Be,prev:te.call(Array(H+1),Be)}}function Jt(W,H){if(W.length===0)return"";var Be=`
130
+ `+H.prev+H.base;return Be+te.call(W,","+Be)+`
131
+ `+H.prev}function Zt(W,H){var Be=lt(W),$e=[];if(Be){$e.length=W.length;for(var Tt=0;Tt<W.length;Tt++)$e[Tt]=G(W,Tt)?H(W[Tt],W):""}var Ke=typeof Ae=="function"?Ae(W):[],nr;if(Ge){nr={};for(var fr=0;fr<Ke.length;fr++)nr["$"+Ke[fr]]=Ke[fr]}for(var Dt in W)G(W,Dt)&&(Be&&String(Number(Dt))===Dt&&Dt<W.length||Ge&&nr["$"+Dt]instanceof Symbol||($.call(/[^\w$]/,Dt)?$e.push(H(Dt,W)+": "+H(W[Dt],W)):$e.push(Dt+": "+H(W[Dt],W))));if(typeof Ae=="function")for(var Ht=0;Ht<Ke.length;Ht++)Je.call(W,Ke[Ht])&&$e.push("["+H(Ke[Ht])+"]: "+H(W[Ke[Ht]],W));return $e}return Th}var Ah,x0;function CA(){if(x0)return Ah;x0=1;var r=la(),e=kA(),t=PA(),n=bo(),i=r("%WeakMap%",!0),a=r("%Map%",!0),u=e("WeakMap.prototype.get",!0),c=e("WeakMap.prototype.set",!0),f=e("WeakMap.prototype.has",!0),h=e("Map.prototype.get",!0),d=e("Map.prototype.set",!0),y=e("Map.prototype.has",!0),g=function(w,S){for(var A=w,P;(P=A.next)!==null;A=P)if(P.key===S)return A.next=P.next,P.next=w.next,w.next=P,P},m=function(w,S){var A=g(w,S);return A&&A.value},x=function(w,S,A){var P=g(w,S);P?P.value=A:w.next={key:S,next:w.next,value:A}},T=function(w,S){return!!g(w,S)};return Ah=function(){var S,A,P,F={assert:function(L){if(!F.has(L))throw new n("Side channel does not contain "+t(L))},get:function(L){if(i&&L&&(typeof L=="object"||typeof L=="function")){if(S)return u(S,L)}else if(a){if(A)return h(A,L)}else if(P)return m(P,L)},has:function(L){if(i&&L&&(typeof L=="object"||typeof L=="function")){if(S)return f(S,L)}else if(a){if(A)return y(A,L)}else if(P)return T(P,L);return!1},set:function(L,$){i&&L&&(typeof L=="object"||typeof L=="function")?(S||(S=new i),c(S,L,$)):a?(A||(A=new a),d(A,L,$)):(P||(P={key:{},next:null}),x(P,L,$))}};return F},Ah}var kh,S0;function Ih(){if(S0)return kh;S0=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return kh={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},kh}var Ph,E0;function O0(){if(E0)return Ph;E0=1;var r=Ih(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var w=[],S=0;S<256;++S)w.push("%"+((S<16?"0":"")+S.toString(16)).toUpperCase());return w}(),i=function(S){for(;S.length>1;){var A=S.pop(),P=A.obj[A.prop];if(t(P)){for(var F=[],L=0;L<P.length;++L)typeof P[L]<"u"&&F.push(P[L]);A.obj[A.prop]=F}}},a=function(S,A){for(var P=A&&A.plainObjects?Object.create(null):{},F=0;F<S.length;++F)typeof S[F]<"u"&&(P[F]=S[F]);return P},u=function w(S,A,P){if(!A)return S;if(typeof A!="object"){if(t(S))S.push(A);else if(S&&typeof S=="object")(P&&(P.plainObjects||P.allowPrototypes)||!e.call(Object.prototype,A))&&(S[A]=!0);else return[S,A];return S}if(!S||typeof S!="object")return[S].concat(A);var F=S;return t(S)&&!t(A)&&(F=a(S,P)),t(S)&&t(A)?(A.forEach(function(L,$){if(e.call(S,$)){var X=S[$];X&&typeof X=="object"&&L&&typeof L=="object"?S[$]=w(X,L,P):S.push(L)}else S[$]=L}),S):Object.keys(A).reduce(function(L,$){var X=A[$];return e.call(L,$)?L[$]=w(L[$],X,P):L[$]=X,L},F)},c=function(S,A){return Object.keys(A).reduce(function(P,F){return P[F]=A[F],P},S)},f=function(w,S,A){var P=w.replace(/\+/g," ");if(A==="iso-8859-1")return P.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(P)}catch{return P}},h=1024,d=function(S,A,P,F,L){if(S.length===0)return S;var $=S;if(typeof S=="symbol"?$=Symbol.prototype.toString.call(S):typeof S!="string"&&($=String(S)),P==="iso-8859-1")return escape($).replace(/%u[0-9a-f]{4}/gi,function(je){return"%26%23"+parseInt(je.slice(2),16)+"%3B"});for(var X="",te=0;te<$.length;te+=h){for(var he=$.length>=h?$.slice(te,te+h):$,de=[],Ve=0;Ve<he.length;++Ve){var Ae=he.charCodeAt(Ve);if(Ae===45||Ae===46||Ae===95||Ae===126||Ae>=48&&Ae<=57||Ae>=65&&Ae<=90||Ae>=97&&Ae<=122||L===r.RFC1738&&(Ae===40||Ae===41)){de[de.length]=he.charAt(Ve);continue}if(Ae<128){de[de.length]=n[Ae];continue}if(Ae<2048){de[de.length]=n[192|Ae>>6]+n[128|Ae&63];continue}if(Ae<55296||Ae>=57344){de[de.length]=n[224|Ae>>12]+n[128|Ae>>6&63]+n[128|Ae&63];continue}Ve+=1,Ae=65536+((Ae&1023)<<10|he.charCodeAt(Ve)&1023),de[de.length]=n[240|Ae>>18]+n[128|Ae>>12&63]+n[128|Ae>>6&63]+n[128|Ae&63]}X+=de.join("")}return X},y=function(S){for(var A=[{obj:{o:S},prop:"o"}],P=[],F=0;F<A.length;++F)for(var L=A[F],$=L.obj[L.prop],X=Object.keys($),te=0;te<X.length;++te){var he=X[te],de=$[he];typeof de=="object"&&de!==null&&P.indexOf(de)===-1&&(A.push({obj:$,prop:he}),P.push(de))}return i(A),S},g=function(S){return Object.prototype.toString.call(S)==="[object RegExp]"},m=function(S){return!S||typeof S!="object"?!1:!!(S.constructor&&S.constructor.isBuffer&&S.constructor.isBuffer(S))},x=function(S,A){return[].concat(S,A)},T=function(S,A){if(t(S)){for(var P=[],F=0;F<S.length;F+=1)P.push(A(S[F]));return P}return A(S)};return Ph={arrayToObject:a,assign:c,combine:x,compact:y,decode:f,encode:d,isBuffer:m,isRegExp:g,maybeMap:T,merge:u},Ph}var Ch,T0;function NA(){if(T0)return Ch;T0=1;var r=CA(),e=O0(),t=Ih(),n=Object.prototype.hasOwnProperty,i={brackets:function(w){return w+"[]"},comma:"comma",indices:function(w,S){return w+"["+S+"]"},repeat:function(w){return w}},a=Array.isArray,u=Array.prototype.push,c=function(T,w){u.apply(T,a(w)?w:[w])},f=Date.prototype.toISOString,h=t.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,format:h,formatter:t.formatters[h],indices:!1,serializeDate:function(w){return f.call(w)},skipNulls:!1,strictNullHandling:!1},y=function(w){return typeof w=="string"||typeof w=="number"||typeof w=="boolean"||typeof w=="symbol"||typeof w=="bigint"},g={},m=function T(w,S,A,P,F,L,$,X,te,he,de,Ve,Ae,je,Ge,ye,Je,ge){for(var ue=w,Ee=ge,Ne=0,xe=!1;(Ee=Ee.get(g))!==void 0&&!xe;){var Xe=Ee.get(w);if(Ne+=1,typeof Xe<"u"){if(Xe===Ne)throw new RangeError("Cyclic object value");xe=!0}typeof Ee.get(g)>"u"&&(Ne=0)}if(typeof he=="function"?ue=he(S,ue):ue instanceof Date?ue=Ae(ue):A==="comma"&&a(ue)&&(ue=e.maybeMap(ue,function(Z){return Z instanceof Date?Ae(Z):Z})),ue===null){if(L)return te&&!ye?te(S,d.encoder,Je,"key",je):S;ue=""}if(y(ue)||e.isBuffer(ue)){if(te){var Et=ye?S:te(S,d.encoder,Je,"key",je);return[Ge(Et)+"="+Ge(te(ue,d.encoder,Je,"value",je))]}return[Ge(S)+"="+Ge(String(ue))]}var lt=[];if(typeof ue>"u")return lt;var It;if(A==="comma"&&a(ue))ye&&te&&(ue=e.maybeMap(ue,te)),It=[{value:ue.length>0?ue.join(",")||null:void 0}];else if(a(he))It=he;else{var et=Object.keys(ue);It=de?et.sort(de):et}var Ye=X?S.replace(/\./g,"%2E"):S,dt=P&&a(ue)&&ue.length===1?Ye+"[]":Ye;if(F&&a(ue)&&ue.length===0)return dt+"[]";for(var Re=0;Re<It.length;++Re){var bt=It[Re],z=typeof bt=="object"&&typeof bt.value<"u"?bt.value:ue[bt];if(!($&&z===null)){var Y=Ve&&X?bt.replace(/\./g,"%2E"):bt,V=a(ue)?typeof A=="function"?A(dt,Y):dt:dt+(Ve?"."+Y:"["+Y+"]");ge.set(w,Ne);var G=r();G.set(g,ge),c(lt,T(z,V,A,P,F,L,$,X,A==="comma"&&ye&&a(ue)?null:te,he,de,Ve,Ae,je,Ge,ye,Je,G))}}return lt},x=function(w){if(!w)return d;if(typeof w.allowEmptyArrays<"u"&&typeof w.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof w.encodeDotInKeys<"u"&&typeof w.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(w.encoder!==null&&typeof w.encoder<"u"&&typeof w.encoder!="function")throw new TypeError("Encoder has to be a function.");var S=w.charset||d.charset;if(typeof w.charset<"u"&&w.charset!=="utf-8"&&w.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var A=t.default;if(typeof w.format<"u"){if(!n.call(t.formatters,w.format))throw new TypeError("Unknown format option provided.");A=w.format}var P=t.formatters[A],F=d.filter;(typeof w.filter=="function"||a(w.filter))&&(F=w.filter);var L;if(w.arrayFormat in i?L=w.arrayFormat:"indices"in w?L=w.indices?"indices":"repeat":L=d.arrayFormat,"commaRoundTrip"in w&&typeof w.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var $=typeof w.allowDots>"u"?w.encodeDotInKeys===!0?!0:d.allowDots:!!w.allowDots;return{addQueryPrefix:typeof w.addQueryPrefix=="boolean"?w.addQueryPrefix:d.addQueryPrefix,allowDots:$,allowEmptyArrays:typeof w.allowEmptyArrays=="boolean"?!!w.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:L,charset:S,charsetSentinel:typeof w.charsetSentinel=="boolean"?w.charsetSentinel:d.charsetSentinel,commaRoundTrip:w.commaRoundTrip,delimiter:typeof w.delimiter>"u"?d.delimiter:w.delimiter,encode:typeof w.encode=="boolean"?w.encode:d.encode,encodeDotInKeys:typeof w.encodeDotInKeys=="boolean"?w.encodeDotInKeys:d.encodeDotInKeys,encoder:typeof w.encoder=="function"?w.encoder:d.encoder,encodeValuesOnly:typeof w.encodeValuesOnly=="boolean"?w.encodeValuesOnly:d.encodeValuesOnly,filter:F,format:A,formatter:P,serializeDate:typeof w.serializeDate=="function"?w.serializeDate:d.serializeDate,skipNulls:typeof w.skipNulls=="boolean"?w.skipNulls:d.skipNulls,sort:typeof w.sort=="function"?w.sort:null,strictNullHandling:typeof w.strictNullHandling=="boolean"?w.strictNullHandling:d.strictNullHandling}};return Ch=function(T,w){var S=T,A=x(w),P,F;typeof A.filter=="function"?(F=A.filter,S=F("",S)):a(A.filter)&&(F=A.filter,P=F);var L=[];if(typeof S!="object"||S===null)return"";var $=i[A.arrayFormat],X=$==="comma"&&A.commaRoundTrip;P||(P=Object.keys(S)),A.sort&&P.sort(A.sort);for(var te=r(),he=0;he<P.length;++he){var de=P[he];A.skipNulls&&S[de]===null||c(L,m(S[de],de,$,X,A.allowEmptyArrays,A.strictNullHandling,A.skipNulls,A.encodeDotInKeys,A.encode?A.encoder:null,A.filter,A.sort,A.allowDots,A.serializeDate,A.format,A.formatter,A.encodeValuesOnly,A.charset,te))}var Ve=L.join(A.delimiter),Ae=A.addQueryPrefix===!0?"?":"";return A.charsetSentinel&&(A.charset==="iso-8859-1"?Ae+="utf8=%26%2310003%3B&":Ae+="utf8=%E2%9C%93&"),Ve.length>0?Ae+Ve:""},Ch}var Nh,A0;function RA(){if(A0)return Nh;A0=1;var r=O0(),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,strictNullHandling:!1},i=function(g){return g.replace(/&#(\d+);/g,function(m,x){return String.fromCharCode(parseInt(x,10))})},a=function(g,m){return g&&typeof g=="string"&&m.comma&&g.indexOf(",")>-1?g.split(","):g},u="utf8=%26%2310003%3B",c="utf8=%E2%9C%93",f=function(m,x){var T={__proto__:null},w=x.ignoreQueryPrefix?m.replace(/^\?/,""):m;w=w.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var S=x.parameterLimit===1/0?void 0:x.parameterLimit,A=w.split(x.delimiter,S),P=-1,F,L=x.charset;if(x.charsetSentinel)for(F=0;F<A.length;++F)A[F].indexOf("utf8=")===0&&(A[F]===c?L="utf-8":A[F]===u&&(L="iso-8859-1"),P=F,F=A.length);for(F=0;F<A.length;++F)if(F!==P){var $=A[F],X=$.indexOf("]="),te=X===-1?$.indexOf("="):X+1,he,de;te===-1?(he=x.decoder($,n.decoder,L,"key"),de=x.strictNullHandling?null:""):(he=x.decoder($.slice(0,te),n.decoder,L,"key"),de=r.maybeMap(a($.slice(te+1),x),function(Ae){return x.decoder(Ae,n.decoder,L,"value")})),de&&x.interpretNumericEntities&&L==="iso-8859-1"&&(de=i(de)),$.indexOf("[]=")>-1&&(de=t(de)?[de]:de);var Ve=e.call(T,he);Ve&&x.duplicates==="combine"?T[he]=r.combine(T[he],de):(!Ve||x.duplicates==="last")&&(T[he]=de)}return T},h=function(g,m,x,T){for(var w=T?m:a(m,x),S=g.length-1;S>=0;--S){var A,P=g[S];if(P==="[]"&&x.parseArrays)A=x.allowEmptyArrays&&(w===""||x.strictNullHandling&&w===null)?[]:[].concat(w);else{A=x.plainObjects?Object.create(null):{};var F=P.charAt(0)==="["&&P.charAt(P.length-1)==="]"?P.slice(1,-1):P,L=x.decodeDotInKeys?F.replace(/%2E/g,"."):F,$=parseInt(L,10);!x.parseArrays&&L===""?A={0:w}:!isNaN($)&&P!==L&&String($)===L&&$>=0&&x.parseArrays&&$<=x.arrayLimit?(A=[],A[$]=w):L!=="__proto__"&&(A[L]=w)}w=A}return w},d=function(m,x,T,w){if(m){var S=T.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m,A=/(\[[^[\]]*])/,P=/(\[[^[\]]*])/g,F=T.depth>0&&A.exec(S),L=F?S.slice(0,F.index):S,$=[];if(L){if(!T.plainObjects&&e.call(Object.prototype,L)&&!T.allowPrototypes)return;$.push(L)}for(var X=0;T.depth>0&&(F=P.exec(S))!==null&&X<T.depth;){if(X+=1,!T.plainObjects&&e.call(Object.prototype,F[1].slice(1,-1))&&!T.allowPrototypes)return;$.push(F[1])}return F&&$.push("["+S.slice(F.index)+"]"),h($,x,T,w)}},y=function(m){if(!m)return n;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.decodeDotInKeys<"u"&&typeof m.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(m.decoder!==null&&typeof m.decoder<"u"&&typeof m.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var x=typeof m.charset>"u"?n.charset:m.charset,T=typeof m.duplicates>"u"?n.duplicates:m.duplicates;if(T!=="combine"&&T!=="first"&&T!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var w=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:n.allowDots:!!m.allowDots;return{allowDots:w,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof m.allowPrototypes=="boolean"?m.allowPrototypes:n.allowPrototypes,allowSparse:typeof m.allowSparse=="boolean"?m.allowSparse:n.allowSparse,arrayLimit:typeof m.arrayLimit=="number"?m.arrayLimit:n.arrayLimit,charset:x,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:n.charsetSentinel,comma:typeof m.comma=="boolean"?m.comma:n.comma,decodeDotInKeys:typeof m.decodeDotInKeys=="boolean"?m.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof m.decoder=="function"?m.decoder:n.decoder,delimiter:typeof m.delimiter=="string"||r.isRegExp(m.delimiter)?m.delimiter:n.delimiter,depth:typeof m.depth=="number"||m.depth===!1?+m.depth:n.depth,duplicates:T,ignoreQueryPrefix:m.ignoreQueryPrefix===!0,interpretNumericEntities:typeof m.interpretNumericEntities=="boolean"?m.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof m.parameterLimit=="number"?m.parameterLimit:n.parameterLimit,parseArrays:m.parseArrays!==!1,plainObjects:typeof m.plainObjects=="boolean"?m.plainObjects:n.plainObjects,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:n.strictNullHandling}};return Nh=function(g,m){var x=y(m);if(g===""||g===null||typeof g>"u")return x.plainObjects?Object.create(null):{};for(var T=typeof g=="string"?f(g,x):g,w=x.plainObjects?Object.create(null):{},S=Object.keys(T),A=0;A<S.length;++A){var P=S[A],F=d(P,T[P],x,typeof g=="string");w=r.merge(w,F,x)}return x.allowSparse===!0?w:r.compact(w)},Nh}var Rh,k0;function DA(){if(k0)return Rh;k0=1;var r=NA(),e=RA(),t=Ih();return Rh={formats:t,parse:e,stringify:r},Rh}(function(r,e){(function(t,n){n(e,hA,dA,DA())})(di,function(t,n,i,a){var u=function(z,Y,V,G){function Z(Q){return Q instanceof V?Q:new V(function(Te){Te(Q)})}return new(V||(V=Promise))(function(Q,Te){function ze(be){try{ce(G.next(be))}catch(Ze){Te(Ze)}}function Ue(be){try{ce(G.throw(be))}catch(Ze){Te(Ze)}}function ce(be){be.done?Q(be.value):Z(be.value).then(ze,Ue)}ce((G=G.apply(z,Y||[])).next())})},c=function(z,Y){var V={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},G,Z,Q,Te;return Te={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(Te[Symbol.iterator]=function(){return this}),Te;function ze(ce){return function(be){return Ue([ce,be])}}function Ue(ce){if(G)throw new TypeError("Generator is already executing.");for(;V;)try{if(G=1,Z&&(Q=ce[0]&2?Z.return:ce[0]?Z.throw||((Q=Z.return)&&Q.call(Z),0):Z.next)&&!(Q=Q.call(Z,ce[1])).done)return Q;switch(Z=0,Q&&(ce=[ce[0]&2,Q.value]),ce[0]){case 0:case 1:Q=ce;break;case 4:return V.label++,{value:ce[1],done:!1};case 5:V.label++,Z=ce[1],ce=[0];continue;case 7:ce=V.ops.pop(),V.trys.pop();continue;default:if(Q=V.trys,!(Q=Q.length>0&&Q[Q.length-1])&&(ce[0]===6||ce[0]===2)){V=0;continue}if(ce[0]===3&&(!Q||ce[1]>Q[0]&&ce[1]<Q[3])){V.label=ce[1];break}if(ce[0]===6&&V.label<Q[1]){V.label=Q[1],Q=ce;break}if(Q&&V.label<Q[2]){V.label=Q[2],V.ops.push(ce);break}Q[2]&&V.ops.pop(),V.trys.pop();continue}ce=Y.call(z,V)}catch(be){ce=[6,be],Z=0}finally{G=Q=0}if(ce[0]&5)throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}};function f(z,Y){if(z.directives&&z.directives.length){var V={};return z.directives.forEach(function(G){V[G.name.value]=i.argumentsObjectFromField(G,Y)}),V}return null}var h=Object.prototype.hasOwnProperty;function d(z,Y){Y!==null&&typeof Y=="object"&&Object.keys(Y).forEach(function(V){var G=Y[V];h.call(z,V)?d(z[V],G):z[V]=G})}function y(z,Y,V,G,Z,Q){Q===void 0&&(Q={});var Te=i.getMainDefinition(Y),ze=i.getFragmentDefinitions(Y),Ue=i.createFragmentMap(ze),ce=Q.resultMapper,be=Q.fragmentMatcher||function(){return!0},Ze={fragmentMap:Ue,contextValue:G,variableValues:Z,resultMapper:ce,resolver:z,fragmentMatcher:be};return g(Te.selectionSet,V,Ze)}function g(z,Y,V){return u(this,void 0,void 0,function(){var G,Z,Q,Te,ze,Ue=this;return c(this,function(ce){switch(ce.label){case 0:return G=V.fragmentMap,Z=V.contextValue,Q=V.variableValues,Te={},ze=function(be){return u(Ue,void 0,void 0,function(){var Ze,Ot,wt,Gt,pt;return c(this,function(Lt){switch(Lt.label){case 0:return i.shouldInclude(be,Q)?i.isField(be)?[4,m(be,Y,V)]:[3,2]:[2];case 1:return Ze=Lt.sent(),Ot=i.resultKeyNameFromField(be),Ze!==void 0&&(Te[Ot]===void 0?Te[Ot]=Ze:d(Te[Ot],Ze)),[2];case 2:if(i.isInlineFragment(be))wt=be;else if(wt=G[be.name.value],!wt)throw new Error("No fragment named "+be.name.value);return Gt=wt.typeCondition.name.value,V.fragmentMatcher(Y,Gt,Z)?[4,g(wt.selectionSet,Y,V)]:[3,4];case 3:pt=Lt.sent(),d(Te,pt),Lt.label=4;case 4:return[2]}})})},[4,Promise.all(z.selections.map(ze))];case 1:return ce.sent(),V.resultMapper?[2,V.resultMapper(Te,Y)]:[2,Te]}})})}function m(z,Y,V){return u(this,void 0,void 0,function(){var G,Z,Q,Te,ze,Ue,ce;return c(this,function(be){switch(be.label){case 0:return G=V.variableValues,Z=V.contextValue,Q=V.resolver,Te=z.name.value,ze=i.argumentsObjectFromField(z,G),Ue={isLeaf:!z.selectionSet,resultKey:i.resultKeyNameFromField(z),directives:f(z,G),field:z},[4,Q(Te,Y,ze,Z,Ue)];case 1:return ce=be.sent(),z.selectionSet?ce==null?[2,ce]:Array.isArray(ce)?[2,x(z,ce,V)]:[2,g(z.selectionSet,ce,V)]:[2,ce]}})})}function x(z,Y,V){return Promise.all(Y.map(function(G){return G===null?null:Array.isArray(G)?x(z,G,V):g(z.selectionSet,G,V)}))}var T=function(){var z=function(Y,V){return z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(G,Z){G.__proto__=Z}||function(G,Z){for(var Q in Z)Z.hasOwnProperty(Q)&&(G[Q]=Z[Q])},z(Y,V)};return function(Y,V){z(Y,V);function G(){this.constructor=Y}Y.prototype=V===null?Object.create(V):(G.prototype=V.prototype,new G)}}(),w=function(){return w=Object.assign||function(z){for(var Y,V=1,G=arguments.length;V<G;V++){Y=arguments[V];for(var Z in Y)Object.prototype.hasOwnProperty.call(Y,Z)&&(z[Z]=Y[Z])}return z},w.apply(this,arguments)},S=function(z,Y,V,G){function Z(Q){return Q instanceof V?Q:new V(function(Te){Te(Q)})}return new(V||(V=Promise))(function(Q,Te){function ze(be){try{ce(G.next(be))}catch(Ze){Te(Ze)}}function Ue(be){try{ce(G.throw(be))}catch(Ze){Te(Ze)}}function ce(be){be.done?Q(be.value):Z(be.value).then(ze,Ue)}ce((G=G.apply(z,Y||[])).next())})},A=function(z,Y){var V={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},G,Z,Q,Te;return Te={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(Te[Symbol.iterator]=function(){return this}),Te;function ze(ce){return function(be){return Ue([ce,be])}}function Ue(ce){if(G)throw new TypeError("Generator is already executing.");for(;V;)try{if(G=1,Z&&(Q=ce[0]&2?Z.return:ce[0]?Z.throw||((Q=Z.return)&&Q.call(Z),0):Z.next)&&!(Q=Q.call(Z,ce[1])).done)return Q;switch(Z=0,Q&&(ce=[ce[0]&2,Q.value]),ce[0]){case 0:case 1:Q=ce;break;case 4:return V.label++,{value:ce[1],done:!1};case 5:V.label++,Z=ce[1],ce=[0];continue;case 7:ce=V.ops.pop(),V.trys.pop();continue;default:if(Q=V.trys,!(Q=Q.length>0&&Q[Q.length-1])&&(ce[0]===6||ce[0]===2)){V=0;continue}if(ce[0]===3&&(!Q||ce[1]>Q[0]&&ce[1]<Q[3])){V.label=ce[1];break}if(ce[0]===6&&V.label<Q[1]){V.label=Q[1],Q=ce;break}if(Q&&V.label<Q[2]){V.label=Q[2],V.ops.push(ce);break}Q[2]&&V.ops.pop(),V.trys.pop();continue}ce=Y.call(z,V)}catch(be){ce=[6,be],Z=0}finally{G=Q=0}if(ce[0]&5)throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}},P=function(){for(var z=0,Y=0,V=arguments.length;Y<V;Y++)z+=arguments[Y].length;for(var G=Array(z),Z=0,Y=0;Y<V;Y++)for(var Q=arguments[Y],Te=0,ze=Q.length;Te<ze;Te++,Z++)G[Z]=Q[Te];return G},F=function(z){var Y=z.replace(/\s/g,""),V=Y.replace(/\[(.*)\]/,function(G,Z,Q,Te){return((Z!=null&&Z.length)>0?Z:null)||Y});return V},L=function(z,Y,V,G){if(Array.isArray(z)){var Z=F(Y);return z.map(function(Q){return L(Q,Z,V,G)})}return z==null||typeof z=="number"||typeof z=="boolean"||typeof z=="string"?z:V(z,Y,V,G)},$=function(z){return z.directives&&z.directives.length?z.directives.find(function(Y){return Y.name.value==="rest"}):null};function X(z,Y,V,G,Z){return Z==null||Y==null||typeof Y=="number"||typeof Y=="boolean"||typeof Y=="string"||Z.selections.forEach(function(Q){if(i.isInlineFragment(Q))X(z,Y,V,G,Q.selectionSet);else if(Q.kind==="FragmentSpread"){var Te=G[Q.name.value];X(z,Y,V,G,Te.selectionSet)}else if(i.isField(Q)){var ze=i.resultKeyNameFromField(Q);ze===z&&$(Q)!=null?te(Y,V,G,Q.selectionSet):X(z,Y,V,G,Q.selectionSet)}else return function(Ue){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),Y}function te(z,Y,V,G){if(!(z==null||typeof z=="number"||typeof z=="boolean"||typeof z=="string")){if(Array.isArray(z)){z.forEach(function(Z){return te(Z,Y,V,G)});return}G.selections.forEach(function(Z){if(i.isInlineFragment(Z))te(z,Y,V,Z.selectionSet);else if(Z.kind==="FragmentSpread"){var Q=V[Z.name.value];te(z,Y,V,Q.selectionSet)}else if(i.isField(Z)){var Te=z[Z.name.value];Z.name.value==="__typename"||(typeof Te>"u"?z[Z.name.value]=null:Te!=null&&typeof Te=="object"&&Z.selectionSet!=null&&te(Te,Y,V,Z.selectionSet))}else return function(ze){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var he=function(z,Y){var V=z[Y||et]||z[et];return typeof V=="string"?{uri:V}:w({responseTransformer:null},V)},de=function(z,Y,V){return V===void 0||Y===void 0?z:z.replace(":"+Y,V)},Ve=function(){function z(){}return z.replacerForPath=function(Y){if(Y in z.cache)return z.cache[Y];var V=Y.indexOf("?"),G=Y.split(z.argReplacement),Z=[],Q=!1;G.reduce(function(ze,Ue){if(Ue===""||Ue==="{}")return ze+Ue.length;var ce=ze+Ue.length;if(Ue[0]==="{"&&Ue[Ue.length-1]==="}"){var be=Ue.slice(1,Ue.length-1).split(".");Z.push(function(Ze,Ot){try{var wt=Ae(Ze,be);return!Ot||typeof wt!="object"||wt==null?String(wt):a.stringify(wt)}catch{var Gt=[Y,be.join(".")].join("|");return Gt in z.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."),z.warnTable[Gt]=!0),""}})}else Z.push(Ue),!Q&&ce>=V&&(Q=!0,Z.push(!0));return ce},0);var Te=function(ze){var Ue=!1,ce=Z.reduce(function(be,Ze){return typeof Ze=="string"?be+Ze:typeof Ze=="boolean"?(Ue=!0,be):be+Ze(ze,Ue)},"");return ce};return z.cache[Y]=Te},z.cache={},z.warnTable={},z.argReplacement=/({[._a-zA-Z0-9]*})/,z}();function Ae(z,Y){if(Y.length===0)return z;var V=P(Y),G=V.shift();return Ae(z[G],V)}var je=["__typename"],Ge=typeof globalThis=="object"&&globalThis||di,ye=function(z,Y,V){V===void 0&&(V=[]);var G=null;return Y.length!=2?G=function(Z,Q){return Y(Z)}:G=Y,Array.isArray(z)?z.map(function(Z,Q){return ye(Z,G,P(V,[String(Q)]))}):z==null||typeof z!="object"||z.constructor!==Object||Ge.FileList&&z instanceof FileList||Ge.File&&z instanceof File?z:Object.keys(z).reduce(function(Z,Q){var Te=z[Q];if(je.indexOf(Q)!==-1)return Z[Q]=Te,Z;var ze=P(V,[Q]);return Z[G(Q,ze)]=ye(Te,G,ze),Z},{})},Je=function(z){return z},ge=function(z){return z instanceof Headers?z:new Headers(z||{})},ue=function(){for(var z=[],Y=0;Y<arguments.length;Y++)z[Y]=arguments[Y];return z.reduce(function(V,G){return G&&(G.forEach||(G=ge(G)),G.forEach(function(Z,Q){V.append(Q,Z)})),V},new Headers)},Ee=function(z,Y,V){var G=new Headers;return z.forEach(function(Z,Q){Y.indexOf(Q)===-1&&G.append(Q,Z)}),ue(G,V||new Headers)},Ne=function(z){return function(Y,V){return Ee(Y,z,V)}},xe=["GET","POST","PUT","PATCH","DELETE"],Xe=function(z,Y){switch(Y){case"query":if(xe.indexOf(z.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+z+'".');case"mutation":if(xe.indexOf(z.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 V=Y;return V}},Et=function(z,Y,V){var G=new Error(V);throw G.response=z,G.statusCode=z.status,G.result=Y,G},lt=function(z,Y){return z==null||typeof z!="object"?z:Array.isArray(z)?z.map(function(V){return lt(V,Y)}):(z.__typename=Y,z)},It=function(z,Y,V,G,Z){return S(void 0,void 0,void 0,function(){var Q,Te,ze,Ue,ce,be,Ze,Ot,wt,Gt,pt,Lt,rr,Rr,zt,Jt,Zt,W,H,Be,$e,Tt,Ke,nr,fr,Dt,Ht,Ur,$r,ir,un,_r,xr,Sr,Or,ur,zr,Tr,Er,Dr,cn,Ln,R,se,me,ke,Le,at,nt,tt;return A(this,function(rt){switch(rt.label){case 0:if(Q=Z.directives,Te=Z.isLeaf,ze=Z.resultKey,Ue=G.exportVariablesByNode,ce=Ue.get(Y)||{},be=function(_t){return _t instanceof Array?_t.forEach(be):Ue.set(_t,w({},ce)),_t},Ze=(Y||{})[ze],Ot=(Y||{})[z],Y&&Q&&Q.export&&(ce[Q.export.as]=Ot),wt=Q&&Q.type,!Te&&wt){if(Q.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return be(Ot),[2,lt(Ot,Q.type.name)]}if(Gt=!Q||!Q.rest,Gt)return[2,be(Ze||Ot)];if(pt=G.credentials,Lt=G.endpoints,rr=G.headers,Rr=G.customFetch,zt=G.operationType,Jt=G.typePatcher,Zt=G.mainDefinition,W=G.fragmentDefinitions,H=G.fieldNameNormalizer,Be=G.fieldNameDenormalizer,$e=G.serializers,Tt=G.responseTransformer,Ke=i.createFragmentMap(W),nr=Q.rest,fr=nr.path,Dt=nr.endpoint,Ht=nr.pathBuilder,Ur=he(Lt,Dt),$r=fr==null&&Ht==null,$r)throw new Error('One of ("path" | "pathBuilder") must be set in the @rest() directive. This request had neither, please add one');if(Ht||(fr.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Ht=function(_t){var b=_t.args,I=_t.exportVariables,k=w(w({},b),I),C=Object.keys(k).reduce(function(D,U){return de(D,U,k[U])},fr);if(C.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 C}):Ht=Ve.replacerForPath(fr)),ir={args:V,exportVariables:ce,context:G,"@rest":Q.rest,replacer:Ht},un=Ht(ir),_r=Q.rest,xr=_r.method,Sr=_r.type,Or=_r.bodyBuilder,ur=_r.bodyKey,zr=_r.fieldNameDenormalizer,Tr=_r.fieldNameNormalizer,Er=_r.bodySerializer,xr||(xr="GET"),ur||(ur="input"),Dr=void 0,cn=void 0,["GET","DELETE"].indexOf(xr)===-1){if(!Or){if(Ln=ir.exportVariables[ur]||ir.args&&ir.args[ur],!Ln)throw new Error("[GraphQL "+xr+" "+zt+" using a REST call without a body]. No `"+ur+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Or=function(_t){return Ln}}if(Dr=ye(Or(ir),zr||Be||Je),R=void 0,typeof Er=="string"){if(!$e.hasOwnProperty(Er))throw new Error('"bodySerializer" must correspond to configured serializer. '+("Please make sure to specify a serializer called "+Er+' in the "bodySerializers" property of the RestLink.'));R=$e[Er](Dr,rr)}else R=Er?Er(Dr,rr):$e[Ye](Dr,rr);Dr=R.body,cn=new Headers(R.headers)}return Xe(xr,zt||"query"),se=w({method:xr,headers:cn||rr,body:Dr},pt?{credentials:pt}:{}),me=""+Ur.uri+un,[4,(Rr||fetch)(me,se)];case 1:return ke=rt.sent(),G.responses.push(ke),ke.ok?(ke.status===204||ke.headers.get("Content-Length")==="0"?Le={}:Le=ke,[3,9]):[3,2];case 2:return ke.status!==404?[3,3]:(Le=null,[3,9]);case 3:at=void 0,rt.label=4;case 4:return rt.trys.push([4,6,,8]),[4,ke.clone().json()];case 5:return at=rt.sent(),[3,8];case 6:return rt.sent(),[4,ke.clone().text()];case 7:return at=rt.sent(),[3,8];case 8:Et(ke,at,"Response not successful: Received status code "+ke.status),rt.label=9;case 9:if(nt=Ur.responseTransformer||Tt,!nt)return[3,14];rt.label=10;case 10:return rt.trys.push([10,12,,13]),[4,nt(Le,Sr)];case 11:return Le=rt.sent(),[3,13];case 12:throw tt=rt.sent(),console.warn("An error occurred in a responseTransformer:"),tt;case 13:return[3,16];case 14:return Le&&Le.json?[4,Le.json()]:[3,16];case 15:Le=rt.sent(),rt.label=16;case 16:return Le=ye(Le,Tr||H||Je),Le=X(ze,Le,Zt,Ke,Zt.selectionSet),Le=L(Le,Sr,Jt,{resolverParams:{fieldName:z,root:Y,args:V,context:G,info:Z}}),[2,be(Le)]}})})},et="",Ye="",dt=function(z,Y){return Y.has("content-type")||Y.append("Content-Type","application/json"),{body:JSON.stringify(z),headers:Y}},Re={test:function(z){return z.name.value==="rest"},remove:!0},bt=function(z){T(Y,z);function Y(V){var G,Z=V.uri,Q=V.endpoints,Te=V.headers,ze=V.fieldNameNormalizer,Ue=V.fieldNameDenormalizer,ce=V.typePatcher,be=V.customFetch,Ze=V.credentials,Ot=V.bodySerializers,wt=V.defaultSerializer,Gt=V.responseTransformer,pt=z.call(this)||this,Lt={};if(Lt[et]=Z||"",pt.endpoints=Object.assign({},Q||Lt),Z==null&&Q==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(Z!=null){var rr=(Q||{})[et];if(rr!=null&&rr!=Z)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");pt.endpoints[et]=Z}if(pt.endpoints[et]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),ce==null)pt.typePatcher=function(zt,Jt,Zt){return w({__typename:Jt},zt)};else if(!Array.isArray(ce)&&typeof ce=="object"&&Object.keys(ce).map(function(zt){return ce[zt]}).reduce(function(zt,Jt){return zt&&typeof Jt=="function"},!0)){var Rr=ce;pt.typePatcher=function(zt,Jt,Zt,W){var H=zt.__typename||Jt;if(Array.isArray(zt))return zt.map(function($e){return Zt($e,H,Zt,W)});var Be=Rr[H]||function($e){return $e};return w({__typename:H},Be(zt,H,Zt,W))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return Ot&&Ot.hasOwnProperty(Ye)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),pt.responseTransformer=Gt||null,pt.fieldNameNormalizer=ze||null,pt.fieldNameDenormalizer=Ue||null,pt.headers=ge(Te),pt.credentials=Ze||null,pt.customFetch=be,pt.serializers=w((G={},G[Ye]=wt||dt,G),Ot||{}),pt.processedDocuments=new Map,pt}return Y.prototype.removeRestSetsFromDocument=function(V){var G=this.processedDocuments.get(V);if(G)return G;i.checkDocument(V);var Z=i.removeDirectivesFromDocument([Re],V);return this.processedDocuments.set(V,Z),Z},Y.prototype.request=function(V,G){var Z=V.query,Q=V.variables,Te=V.getContext,ze=V.setContext,Ue=Te(),ce=i.hasDirectives(["rest"],Z);if(!ce)return G(V);var be=this.removeRestSetsFromDocument(Z),Ze=Ue.headersMergePolicy;Ze==null&&Array.isArray(Ue.headersToOverride)?Ze=Ne(Ue.headersToOverride):Ze==null&&(Ze=ue);var Ot=Ze(this.headers,Ue.headers);Ot.has("Accept")||Ot.append("Accept","application/json");var wt=Ue.credentials||this.credentials,Gt=i.addTypenameToDocument(Z),pt=i.getMainDefinition(Z),Lt=i.getFragmentDefinitions(Z),rr=(pt||{}).operation||"query",Rr={headers:Ot,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:wt,customFetch:this.customFetch,operationType:rr,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:pt,fragmentDefinitions:Lt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},zt={},Jt;return be&&G?(V.query=be,Jt=G(V)):Jt=n.Observable.of({data:{}}),Jt.flatMap(function(Zt){var W=Zt.data,H=Zt.errors;return new n.Observable(function(Be){y(It,Gt,W,Rr,Q,zt).then(function($e){ze({restResponses:(Ue.restResponses||[]).concat(Rr.responses)}),Be.next({data:$e,errors:H}),Be.complete()}).catch(function($e){$e.name!=="AbortError"&&($e.result&&$e.result.errors&&Be.next($e.result),Be.error($e))})})})},Y}(n.ApolloLink);t.RestLink=bt,t.PathBuilder=Ve,Object.defineProperty(t,"__esModule",{value:!0})})})(rh,rh.exports);var FA=rh.exports;const Ju=ve.createContext(),I0=ve.createContext(),MA=()=>{const{urls:r}=Xn(),{children:e}=ve.useContext(Ju),t=Hn.useNavigate(),[n,i]=ve.useState(!1),a=!!window.parent;Hn.useBlocker(({nextLocation:f})=>{var h;return a?(h=f.state)!=null&&h.fromParent?(i(!0),!1):(u(`${f.pathname}${f.search}`),!0):!1}),ve.useEffect(()=>{if(!a)return;const f=h=>{h.metaKey&&h.key==="k"&&window.parent.postMessage({type:"open-search"},r.appUrl)};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[]),ve.useEffect(()=>{if(!a)return;const f=({origin:h,data:d})=>{if(h===r.appUrl)switch(d.type){case"navigate":t(d.path,{replace:!0,state:{fromParent:!0}});break}};return window.addEventListener("message",f),n||window.parent.postMessage({type:"ready"},r.appUrl),()=>{window.removeEventListener("message",f)}},[t,n]);const u=f=>{n&&window.parent.postMessage({type:"set-path",path:f},r.appUrl)},c=ve.useMemo(()=>({isEmbedded:a,navigateParent:u}),[a,u]);return Mr.jsx(I0.Provider,{value:c,children:e})},LA=()=>{const{urls:r,jwtRef:e,accessToken:t}=Xn(),{graphQLRoleOverride:n,children:i}=ve.useContext(Ju),[a,u]=ve.useState(),[c,f]=ve.useState(),h=()=>{const g=new URL(r.graphQLUrl);return`//${g.host}${g.pathname}`},d=()=>n?{"X-Hasura-Role":n}:{};ve.useEffect(()=>{const g=new iA(cA({url:`wss:${h()}`,lazy:!0,reconnect:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...d()}})})),m=Kv(({operation:P,networkError:F,forward:L})=>(Vi(P.query).operation==="subscription"&&F&&g.client.terminate(),L(P))),T=Yv(async(P,{headers:F})=>({headers:{...F,Authorization:`Bearer ${e.current}`,...d()}})).concat(Zl({uri:`https:${h()}`,fetch:window.fetch})),w=m.split(({query:P})=>{const F=Vi(P);return F.kind==="OperationDefinition"&&F.operation==="subscription"},g,T),A=Yv(async(P,{headers:F})=>({headers:{...F,Authorization:`Bearer ${t}`}})).concat(new FA.RestLink({uri:r.apiUrl}));f(Jr.from([A,w]))},[]),ve.useEffect(()=>{c&&u(new _f({link:c,cache:new yf}))},[c]);const y=ve.useMemo(()=>({link:c}),[c]);return Mr.jsx(kv.Provider,{value:y,children:a&&Mr.jsx(bO,{client:a,children:Mr.jsx(MA,{children:i})})})},qA=bp.div`
132
+ text-align: center;
133
+ padding-top: 200px;
134
+ `,P0=({loadError:r})=>{const e=eA();return r?Mr.jsx(qA,{children:r}):(Wv(),Mr.jsx(Hn.Navigate,{replace:!0,to:e||"/"}))},jA=bp.div`
135
+ font-size: 20px;
136
+ text-align: center;
137
+ margin-top: 300px;
138
+ `,UA=()=>{const[r,e]=ve.useState(),{isAuthenticated:t}=Xn(),{authorize:n}=ve.useContext(Ju);return yo(async i=>{try{await n(i)}catch(a){console.log(a),e("Login Failed. Try again.")}},[]),r?Mr.jsx(P0,{loadError:r}):t?Mr.jsx(P0,{}):Mr.jsx(jA,{children:"Authorizing..."})},Dh={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://development.graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"},demo:{loginUrl:"https://login-demo.machinemetrics.com",appUrl:"https://demo.machinemetrics.com",apiUrl:"https://api-demo.machinemetrics.com",graphQLUrl:"https://development.graphql.machinemetrics.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://development.graphql.machinemetrics.com/v1/graphql",natsUrl:"https://stream.data.dev.m12s.com"}},$A=Hn.createBrowserRouter([{path:"/authorize/mm/callback",element:Mr.jsx(UA,{})},{path:"/*",element:Mr.jsx(LA,{})}]),BA=({domain:r,children:e,scope:t,clientId:n,clientSecret:i,releaseStage:a,graphQLRoleOverride:u,urls:c})=>{r&&console.warn("MMProvider domain is no longer used. It is inferred from the url.");let f;if(Dh[a])f=Dh[a];else{const $=bi.keys(Dh).join(", ");throw Error(`MMProvider releaseStage must be one of the following: ${$}`)}f=bi.merge(f,c);const[h,d]=ve.useState(ZT());ve.useEffect(()=>{XT(h)},[h]);const y=()=>{const $=KT();zv($),Wv(window.location.pathname+window.location.search);const te=(de=>bi.map(de,(Ve,Ae)=>`${Ae}=${Ve}`).join("&"))({response_type:"code",state:$,scope:t,ttl:1209600,client_id:n,redirect_uri:`${window.location.origin}/authorize/mm/callback`}),he=`${f.loginUrl}/oauth/authorize?${te}`;window.location=he},g=async $=>{const X=HT.parse(window.location.search),te=X.code;if(X.state!==tA())throw Error("Oops");const he={grant_type:"authorization_code",client_id:n,client_secret:i,code:te,redirect_uri:`${window.location.origin}/authorize/mm/callback`},de=await Hv(`${f.loginUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:new URLSearchParams(he),signal:$});d(de.access_token),zv()},m=()=>{d()},x=async($,X={})=>{X.headers={...X.headers,"Content-Type":"application/json",Authorization:`Bearer ${h}`};const te=await Hv($,X);if(te.error&&te.error.status===401)throw await T(),Error("UNAUTHORIZED");return te},T=async()=>{await x(`${f.loginUrl}/logout`,{method:"DELETE"}),m()},[w,S]=ve.useState(),A=ve.useRef(),P=ve.useRef();go(async()=>{if(!h){A.current=null,S(!1);return}try{const $=await x(`${f.apiUrl}/user-token?graphql=1`);A.current=$,S(!0)}catch{}},1e3*60*4.5,[h]),go(async()=>{if(!h){P.current=null;return}try{const $=await x(`${f.apiUrl}/nats-token`);P.current=$}catch{}},1e3*60*9.5,[h]);const F=ve.useMemo(()=>({clientId:n,accessToken:h,jwtRef:A,natsCredsRef:P,isAuthenticated:w,login:y,logout:T,request:x,urls:f}),[h,n,w,A,y,T,P,x,f]),L=ve.useMemo(()=>({children:e,graphQLRoleOverride:u,authorize:g}),[e,u,g]);return Mr.jsx(Iv.Provider,{value:F,children:Mr.jsx(Ju.Provider,{value:L,children:Mr.jsx(Hn.RouterProvider,{router:$A})})})},vn=new Uint8Array(0),xi=new TextEncoder,on=new TextDecoder;function VA(...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 wo(...r){const e=[];for(let t=0;t<r.length;t++)e.push(xi.encode(r[t]));return e.length===0?vn:e.length===1?e[0]:VA(...e)}function C0(r){return!r||r.length===0?"":on.decode(r)}const N0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",R0=36,WA=0xcfd41b9100000,D0=33,zA=333,F0=22;function HA(r){for(let e=0;e<r.length;e++)r[e]=Math.floor(Math.random()*255)}function QA(r){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(r):HA(r)}class GA{constructor(){E(this,"buf");E(this,"seq");E(this,"inc");E(this,"inited");this.buf=new Uint8Array(F0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*WA),this.inc=Math.floor(Math.random()*(zA-D0)+D0)}setPre(){const e=new Uint8Array(12);QA(e);for(let t=0;t<12;t++){const n=e[t]%36;this.buf[t]=N0.charCodeAt(n)}}fillSeq(){let e=this.seq;for(let t=F0-1;t>=12;t--)this.buf[t]=N0.charCodeAt(e%R0),e=Math.floor(e/R0)}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 GA;var Si;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Si||(Si={}));var fa;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(fa||(fa={}));var pe;(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"})(pe||(pe={}));function JA(r){return typeof r.code=="string"}class M0{constructor(){E(this,"messages");this.messages=new Map,this.messages.set(pe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(pe.BadJson,"Bad JSON"),this.messages.set(pe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return YA.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const YA=new M0;class Ie extends Error{constructor(t,n,i){super(t);E(this,"name");E(this,"message");E(this,"code");E(this,"permissionContext");E(this,"chainedError");E(this,"api_error");this.name="NatsError",this.message=t,this.code=n,this.chainedError=i}static errorForCode(t,n){const i=M0.getMessage(t);return new Ie(i,t,n)}isAuthError(){return this.code===pe.AuthenticationExpired||this.code===pe.AuthorizationViolation||this.code===pe.AccountExpired}isAuthTimeout(){return this.code===pe.AuthenticationTimeout}isPermissionError(){return this.code===pe.PermissionsViolation}isProtocolError(){return this.code===pe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var bn;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(bn||(bn={}));var ei;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(ei||(ei={}));var _o;(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"})(_o||(_o={}));const Yu="Nats-Service-Error",Ku="Nats-Service-Error-Code";class Zu extends Error{constructor(t,n){super(n);E(this,"code");this.code=t}static isServiceError(t){return Zu.toServiceError(t)!==null}static toServiceError(t){var i,a;const n=((i=t==null?void 0:t.headers)==null?void 0:i.get(Ku))||"";if(n!==""){const u=parseInt(n)||400,c=((a=t==null?void 0:t.headers)==null?void 0:a.get(Yu))||"";return new Zu(u,c.length?c:n)}return null}}function Ei(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 Fh="127.0.0.1";var es;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(es||(es={}));function Xu(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 ec(r){return on.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ha(r,e=!0){const t=e?Ie.errorForCode(pe.Timeout):null;let n,i;const a=new Promise((u,c)=>{n={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{c(t===null?Ie.errorForCode(pe.Timeout):t)},r)});return Object.assign(a,n)}function da(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 tr(){let r={};const e=new Promise((t,n)=>{r={resolve:t,reject:n}});return Object.assign(e,r)}function L0(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 KA(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Mh(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 KA(t>e?r[e]:r[t])}}}function or(r){return r*1e6}function Lh(r){return Math.floor(r/1e6)}function q0(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 Ie(`'${r[a]}' is not a valid character for a header key`,pe.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 Oi(r=0,e=""){if(r===0&&e!==""||r>0&&e==="")throw new Error("setting status requires both code and description");return new ts(r,e)}const qh="NATS/1.0";class ts{constructor(e=0,t=""){E(this,"_code");E(this,"headers");E(this,"_description");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 ts,i=on.decode(e).split(`\r
139
+ `),a=i[0];if(a!==qh){let u=a.replace(qh,"").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=qh;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
140
+ ${t}: ${n[i]}`;return`${e}\r
141
+ \r
142
+ `}encode(){return xi.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new Ie("invalid header value - \\r and \\n are not allowed.",pe.BadHeader);return e.trim()}keys(){const e=[];for(const t of this.headers.keys())e.push(t);return e}findKeys(e,t=bn.Exact){const n=this.keys();switch(t){case bn.Exact:return n.filter(i=>i===e);case bn.CanonicalMIME:return e=q0(e),n.filter(i=>i===e);default:{const i=e.toLowerCase();return n.filter(a=>i===a.toLowerCase())}}}get(e,t=bn.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=bn.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=bn.Exact){return this.findKeys(e,t).length>0}set(e,t,n=bn.Exact){this.delete(e,n),this.append(e,t,n)}append(e,t,n=bn.Exact){const i=q0(e);n===bn.CanonicalMIME&&(e=i);const a=this.findKeys(e,n);e=a.length>0?a[0]:e;const u=ts.validHeaderValue(t);let c=this.headers.get(e);c||(c=[],this.headers.set(e,c)),c.push(u)}values(e,t=bn.Exact){const n=[];return this.findKeys(e,t).forEach(a=>{const u=this.headers.get(a);u&&n.push(...u)}),n}delete(e,t=bn.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 ts;for(const n in e)t.headers.set(n,e[n]);return t}}function j0(){return{encode(r){return xi.encode(r)},decode(r){return on.decode(r)}}}function Dn(r){return{encode(e){try{return e===void 0&&(e=null),xi.encode(JSON.stringify(e))}catch(t){throw Ie.errorForCode(pe.BadJson,t)}},decode(e){try{return JSON.parse(on.decode(e),r)}catch(t){throw Ie.errorForCode(pe.BadJson,t)}}}}function U0(r){var e;return r&&r.data.length===0&&((e=r.headers)==null?void 0:e.code)===503?Ie.errorForCode(pe.NoResponders):null}class jh{constructor(e,t,n){E(this,"_headers");E(this,"_msg");E(this,"_rdata");E(this,"_reply");E(this,"_subject");E(this,"publisher");this._msg=e,this._rdata=t,this.publisher=n}get subject(){return this._subject?this._subject:(this._subject=on.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=on.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=ts.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=vn,t){return this.reply?(this.publisher.publish(this.reply,e,t),!0):!1}size(){var i;const e=this._msg.subject.length,t=((i=this._msg.reply)==null?void 0:i.length)||0,n=this._msg.size===-1?0:this._msg.size;return e+t+n}json(e){return Dn(e).decode(this.data)}string(){return on.decode(this.data)}requestInfo(){var t;const e=(t=this.headers)==null?void 0:t.get("Nats-Request-Info");return e?JSON.parse(e,function(n,i){return(n==="start"||n==="stop")&&i!==""?new Date(Date.parse(i)):i}):null}}E(jh,"jc");function pa(r){return tc("durable",r)}function Kr(r){return tc("stream",r)}function tc(r,e=""){if(e==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
143
+ `,"\r"].forEach(n=>{if(e.indexOf(n)!==-1){switch(n){case`
144
+ `:n="\\n";break;case"\r":n="\\r";break;case" ":n="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${n}'`)}}),""}function xo(r,e=""){if(e==="")throw Error(`${r} name required`);const t=ZA(e);if(t.length)throw new Error(`invalid ${r} name - ${r} name ${t}`)}function ZA(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 Uh(r){if(r.data.length>0)return!1;const e=r.headers;return e?e.code>=100&&e.code<200:!1}function $h(r){var e;return Uh(r)&&((e=r.headers)==null?void 0:e.description)==="Idle Heartbeat"}function XA(r,e,t){const n=Oi(r,e),i={hdr:1,sid:0,size:0},a=new jh(i,vn,{});return a._headers=n,a._subject=t,a}function ma(r){if(r.data.length!==0)return null;const e=r.headers;return e?$0(e.code,e.description):null}var Fn;(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"})(Fn||(Fn={}));function ek(r){return r.code!==pe.JetStream409?!1:[Fn.MaxBatchExceeded,Fn.MaxExpiresExceeded,Fn.MaxBytesExceeded,Fn.MaxMessageSizeExceeded,Fn.PushConsumer,Fn.IdleHeartbeatMissed,Fn.ConsumerDeleted].find(t=>r.message.indexOf(t)!==-1)!==void 0}function $0(r,e=""){if(r<300)return null;switch(e=e.toLowerCase(),r){case 404:return new Ie(e,pe.JetStream404NoMessages);case 408:return new Ie(e,pe.JetStream408RequestTimeout);case 409:{const t=e.startsWith(Fn.IdleHeartbeatMissed)?pe.JetStreamIdleHeartBeat:pe.JetStream409;return new Ie(e,t)}case 503:return Ie.errorForCode(pe.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=pe.Unknown),new Ie(e,`${r}`)}}class Cr{constructor(){E(this,"inflight");E(this,"processed");E(this,"received");E(this,"noIterator");E(this,"iterClosed");E(this,"done");E(this,"signal");E(this,"yields");E(this,"filtered");E(this,"pendingFiltered");E(this,"ingestionFilterFn");E(this,"protocolFilterFn");E(this,"dispatchedFn");E(this,"ctx");E(this,"_data");E(this,"err");E(this,"time");E(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=tr(),this.yields=[],this.iterClosed=tr(),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 Ie("unsupported iterator",pe.ApiError);if(this.yielding)throw new Ie("already yielding",pe.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=tr())}}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 Bh{constructor(e,t,n={maxOut:2}){E(this,"interval");E(this,"maxOut");E(this,"cancelAfter");E(this,"timer");E(this,"autoCancelTimer");E(this,"last");E(this,"missed");E(this,"count");E(this,"callback");this.interval=e,this.maxOut=(n==null?void 0:n.maxOut)||2,this.cancelAfter=(n==null?void 0: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 Vh;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Vh||(Vh={}));var So;(function(r){r.Old="old",r.New="new"})(So||(So={}));var Wh;(function(r){r.File="file",r.Memory="memory"})(Wh||(Wh={}));var mr;(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"})(mr||(mr={}));var Nr;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(Nr||(Nr={}));var ya;(function(r){r.Instant="instant",r.Original="original"})(ya||(ya={}));var rs;(function(r){r.None="none",r.S2="s2"})(rs||(rs={}));var rc;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(rc||(rc={}));function tk(r,e={}){return Object.assign({name:r,deliver_policy:mr.All,ack_policy:Nr.Explicit,ack_wait:or(30*1e3),replay_policy:ya.Instant},e)}var B0;(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"})(B0||(B0={}));var Zr;(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"})(Zr||(Zr={}));var ti;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(ti||(ti={}));var ga;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(ga||(ga={}));var V0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(V0||(V0={}));const ri="KV_";class rk{constructor(e){E(this,"config");E(this,"ordered");E(this,"mack");E(this,"stream");E(this,"callbackFn");E(this,"max");E(this,"qname");E(this,"isBind");E(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=tk("",e||{})}getOpts(){var t;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&&((t=e.config.filter_subjects)==null||t.forEach(n=>{this.filterSubject(n)}),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?Nr.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 pa(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=mr.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=mr.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=mr.All,this}deliverLastPerSubject(){return this.config.deliver_policy=mr.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=mr.Last,this}deliverNew(){return this.config.deliver_policy=mr.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=Nr.None,this}ackAll(){return this.config.ack_policy=Nr.All,this}ackExplicit(){return this.config.ack_policy=Nr.Explicit,this}ackWait(e){return this.config.ack_wait=or(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=ya.Instant,this}replayOriginal(){return this.config.replay_policy=ya.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=or(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=or(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=or(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 ns(r){return new rk(r)}function W0(r){return typeof r.getOpts=="function"}class nk{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 Eo{static encode(e){return Eo.toB64URLEncoding(nk.encode(e))}static decode(e,t=!1){return Eo.decode(Eo.fromB64URLEncoding(e),t)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class va{constructor(){E(this,"buffers");E(this,"byteLength");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=""),xi.encode(e)}static toAscii(e){return on.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 z0(r){const e=r.length;let t=r.indexOf("=");t===-1&&(t=e);const n=t===e?0:4-t%4;return[t,n]}function ik(r,e,t=!1){function n(u,c){return Math.floor((u+c)*3/4-c)}function i(u){return r[u>>18&63]+r[u>>12&63]+r[u>>6&63]+r[u&63]}function a(u,c,f){const h=new Array((f-c)/3);for(let d=c,y=0;d<f;d+=3)h[y++]=i((u[d]<<16)+(u[d+1]<<8)+u[d+2]);return h.join("")}return{byteLength(u){return n.apply(null,z0(u))},toUint8Array(u){const[c,f]=z0(u),h=new Uint8Array(n(c,f)),d=f?c-4:c;let y,g=0,m;for(m=0;m<d;m+=4)y=e[u.charCodeAt(m)]<<18|e[u.charCodeAt(m+1)]<<12|e[u.charCodeAt(m+2)]<<6|e[u.charCodeAt(m+3)],h[g++]=y>>16&255,h[g++]=y>>8&255,h[g++]=y&255;return f===2?(y=e[u.charCodeAt(m)]<<2|e[u.charCodeAt(m+1)]>>4,h[g++]=y&255):f===1&&(y=e[u.charCodeAt(m)]<<10|e[u.charCodeAt(m+1)]<<4|e[u.charCodeAt(m+2)]>>2,h[g++]=y>>8&255,h[g++]=y&255),h},fromUint8Array(u){const f=u.length,h=f%3,d=f-h,y=new Array(Math.ceil(d/16383)+(h?1:0));let g=0,m;for(let T=0;T<d;T+=16383)m=T+16383,y[g++]=a(u,T,m>d?d:m);let x;return h===1?(x=u[d],y[g]=r[x>>2]+r[x<<4&63],t||(y[g]+="==")):h===2&&(x=u[d]<<8|u[d+1]&255,y[g]=r[x>>10]+r[x>>4&63]+r[x<<2&63],t||(y[g]+="=")),y.join("")}}}const H0=[],Q0=[],zh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";for(let r=0,e=zh.length;r<e;++r)H0[r]=zh[r],Q0[zh.charCodeAt(r)]=r;const{byteLength:m2,toUint8Array:sk,fromUint8Array:ak}=ik(H0,Q0,!0),ok=new TextDecoder,uk=new TextEncoder;function ck(r){return r.reduce((e,t)=>`${e}${t<16?"0":""}${t.toString(16)}`,"")}function lk(r){const e=r.length;if(e%2||!/^[0-9a-fA-F]+$/.test(r))throw new TypeError("Invalid hex string.");r=r.toLowerCase();const t=new Uint8Array(Math.floor(e/2)),n=e/2;for(let i=0;i<n;++i)t[i]=parseInt(r.substr(i*2,2),16);return t}function fk(r,e="utf8"){if(/^utf-?8$/i.test(e))return ok.decode(r);if(/^base64$/i.test(e))return ak(r);if(/^hex(?:adecimal)?$/i.test(e))return ck(r);throw new TypeError("Unsupported string encoding.")}function hk(r,e="utf8"){if(/^utf-?8$/i.test(e))return uk.encode(r);if(/^base64$/i.test(e))return sk(r);if(/^hex(?:adecimal)?$/i.test(e))return lk(r);throw new TypeError("Unsupported string encoding.")}class G0{constructor(){E(this,"hashSize",32);E(this,"_buf");E(this,"_bufIdx");E(this,"_count");E(this,"_K");E(this,"_H");E(this,"_finalized");this._buf=new Uint8Array(64),this._K=new Uint32Array([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]),this.init()}init(){return this._H=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),this._bufIdx=0,this._count=new Uint32Array(2),this._buf.fill(0),this._finalized=!1,this}update(e,t){if(e===null)throw new TypeError("msg must be a string or Uint8Array.");typeof e=="string"&&(e=hk(e,t));for(let i=0,a=e.length;i<a;i++)this._buf[this._bufIdx++]=e[i],this._bufIdx===64&&(this._transform(),this._bufIdx=0);const n=this._count;return(n[0]+=e.length<<3)<e.length<<3&&n[1]++,n[1]+=e.length>>>29,this}digest(e){if(this._finalized)throw new Error("digest has already been called.");this._finalized=!0;const t=this._buf;let n=this._bufIdx;for(t[n++]=128;n!==56;)n===64&&(this._transform(),n=0),t[n++]=0;const i=this._count;t[56]=i[1]>>>24&255,t[57]=i[1]>>>16&255,t[58]=i[1]>>>8&255,t[59]=i[1]>>>0&255,t[60]=i[0]>>>24&255,t[61]=i[0]>>>16&255,t[62]=i[0]>>>8&255,t[63]=i[0]>>>0&255,this._transform();const a=new Uint8Array(32);for(let u=0;u<8;u++)a[(u<<2)+0]=this._H[u]>>>24&255,a[(u<<2)+1]=this._H[u]>>>16&255,a[(u<<2)+2]=this._H[u]>>>8&255,a[(u<<2)+3]=this._H[u]>>>0&255;return this.init(),e?fk(a,e):a}_transform(){const e=this._H;let t=e[0],n=e[1],i=e[2],a=e[3],u=e[4],c=e[5],f=e[6],h=e[7];const d=new Uint32Array(16);let y;for(y=0;y<16;y++)d[y]=this._buf[(y<<2)+3]|this._buf[(y<<2)+2]<<8|this._buf[(y<<2)+1]<<16|this._buf[y<<2]<<24;for(y=0;y<64;y++){let g;if(y<16)g=d[y];else{let m=d[y+1&15],x=d[y+14&15];g=d[y&15]=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(x>>>17^x>>>19^x>>>10^x<<15^x<<13)+d[y&15]+d[y+9&15]|0}g=g+h+(u>>>6^u>>>11^u>>>25^u<<26^u<<21^u<<7)+(f^u&(c^f))+this._K[y]|0,h=f,f=c,c=u,u=a+g,a=i,i=n,n=t,t=g+(n&i^a&(n^i))+(n>>>2^n>>>13^n>>>22^n<<30^n<<19^n<<10)|0}e[0]=e[0]+t|0,e[1]=e[1]+n|0,e[2]=e[2]+i|0,e[3]=e[3]+a|0,e[4]=e[4]+u|0,e[5]=e[5]+c|0,e[6]=e[6]+f|0,e[7]=e[7]+h|0}}class J0{constructor(e,t,n=!0){E(this,"token");E(this,"received");E(this,"ctx");E(this,"requestSubject");E(this,"mux");this.mux=e,this.requestSubject=t,this.received=0,this.token=Is.next(),n&&(this.ctx=new Error)}}class dk extends J0{constructor(t,n,i={maxWait:1e3}){super(t,n);E(this,"callback");E(this,"done");E(this,"timer");E(this,"max");E(this,"opts");if(this.opts=i,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1,this.done=tr(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},i.maxWait)}cancel(t){t&&this.callback(t,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(t,n){t?(this.ctx&&(t.stack+=`
145
+
146
+ ${this.ctx.stack}`),this.cancel(t)):(this.callback(null,n),this.opts.strategy===ei.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===ei.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===ei.SentinelMsg&&n&&n.data.length===0&&this.cancel())}}class Y0 extends J0{constructor(t,n,i={timeout:1e3},a=!0){super(t,n,a);E(this,"deferred");E(this,"timer");this.deferred=tr(),this.timer=ha(i.timeout,a)}resolver(t,n){this.timer&&this.timer.cancel(),t?(this.ctx&&(t.stack+=`
147
+
148
+ ${this.ctx.stack}`),this.deferred.reject(t)):this.deferred.resolve(n),this.cancel()}cancel(t){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(t||Ie.errorForCode(pe.Cancelled))}}const pk="$JS.API";function mk(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Xu({apiPrefix:pk,timeout:5e3},r)}class Oo{constructor(e,t){E(this,"nc");E(this,"opts");E(this,"prefix");E(this,"timeout");E(this,"jc");this.nc=e,this.opts=mk(t),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Dn()}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=vn;t&&(i=this.jc.encode(t));let{retries:a}=n;a=a||1,a=a===-1?Number.MAX_SAFE_INTEGER:a;const u=Mh();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===pe.Timeout)&&c+1<a)await da(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=$0(n.error.code,n.error.description);if(i!==null)throw i.api_error=n.error,i}return t}}class To{constructor(e,t,n,i){E(this,"err");E(this,"offset");E(this,"pageInfo");E(this,"subject");E(this,"jsm");E(this,"filter");E(this,"payload");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){var t,n,i;switch(e==null?void 0:e.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((t=e.streams)==null?void 0:t.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((n=e.consumers)==null?void 0:n.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e==null?void 0:e.type}`),((i=e.streams)==null?void 0:i.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 Ps(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 Hh(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 kt;(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"})(kt||(kt={}));class yk{constructor(e){E(this,"server");E(this,"features");E(this,"disabled");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=Ps(e)),this.server=e,this.set(kt.JS_KV,"2.6.2"),this.set(kt.JS_OBJECTSTORE,"2.6.3"),this.set(kt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(kt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(kt.JS_ALLOW_DIRECT,"2.9.0"),this.set(kt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(kt.JS_SIMPLIFICATION,"2.9.4"),this.set(kt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(kt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(kt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(kt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(kt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(kt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(kt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(kt.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:Hh(this.server,Ps(t))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){var t;return((t=this.get(e))==null?void 0:t.ok)||!1}require(e){return typeof e=="string"&&(e=Ps(e)),Hh(this.server,e)>=0}}class Qh extends Oo{constructor(e,t){super(e,t)}async add(e,t,n=rc.Create){if(Kr(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&&pa(i.config.durable_name);const a=this.nc;let{min:u,ok:c}=a.features.get(kt.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{tc("name",f)}catch(g){const m=g.message,x=m.indexOf("cannot contain");throw x!==-1?new Error(`consumer 'name' ${m.substring(x)}`):g}let h,d="";if(Array.isArray(t.filter_subjects)){const{min:g,ok:m}=a.features.get(kt.JS_MULTIPLE_CONSUMER_FILTER);if(!m)throw new Error(`consumer 'filter_subjects' requires server ${g}`);c=!1}if(t.metadata){const{min:g,ok:m}=a.features.get(kt.JS_STREAM_CONSUMER_METADATA);if(!m)throw new Error(`consumer 'metadata' requires server ${g}`)}if(c&&(d=t.name??t.durable_name??""),d!==""){let g=t.filter_subject??void 0;g===">"&&(g=void 0),h=g!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${d}.${g}`:`${this.prefix}.CONSUMER.CREATE.${e}.${d}`}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),rc.Update)}async info(e,t){return Kr(e),pa(t),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`)}async delete(e,t){return Kr(e),pa(t),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success}list(e){Kr(e);const t=i=>i.consumers,n=`${this.prefix}.CONSUMER.LIST.${e}`;return new To(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 ba(r,e,t=!1){if(t===!0&&!r)throw Ie.errorForCode(pe.ApiError,new Error(`${e} is not a function`));if(r&&typeof r!="function")throw Ie.errorForCode(pe.ApiError,new Error(`${e} is not a function`))}class gk extends Cr{constructor(t,n,i){super();E(this,"sub");E(this,"adapter");E(this,"subIterDone");ba(i.adapter,"adapter",!0),this.adapter=i.adapter,i.callback&&ba(i.callback,"callback"),this.noIterator=typeof i.callback=="function",i.ingestionFilterFn&&(ba(i.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=i.ingestionFilterFn),i.protocolFilterFn&&(ba(i.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=i.protocolFilterFn),i.dispatchedFn&&(ba(i.dispatchedFn,"dispatchedFn"),this.dispatchedFn=i.dispatchedFn),i.cleanupFn&&ba(i.cleanupFn,"cleanupFn");let a=(d,y)=>{this.callback(d,y)};if(i.callback){const d=i.callback;a=(y,g)=>{const[m,x]=this.adapter(y,g);if(m){d(m,null);return}const{ingest:T}=this.ingestionFilterFn?this.ingestionFilterFn(x,this):{ingest:!0};T&&(!this.protocolFilterFn||this.protocolFilterFn(x))&&(d(m,x),this.dispatchedFn&&x&&this.dispatchedFn(x))}}const{max:u,queue:c,timeout:f}=i,h={queue:c,timeout:f,callback:a};u&&u>0&&(h.max=u),this.sub=t.subscribe(n,h),i.cleanupFn&&(this.sub.cleanupFn=i.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=tr(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.closed,this.stop()})(this.sub).then().catch()}unsubscribe(t){this.sub.unsubscribe(t)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(t,n){this.sub.cancelTimeout();const[i,a]=this.adapter(t,n);i&&this.stop(i),a&&this.push(a)}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 wn;function vk(r){wn=r}function K0(){return wn!==void 0&&wn.defaultPort!==void 0?wn.defaultPort:4222}function Gh(){return wn!==void 0&&wn.urlParseFn?wn.urlParseFn:void 0}function bk(){if(!wn||typeof wn.factory!="function")throw new Error("transport fn is not set");return wn.factory()}function Jh(){return wn!==void 0&&wn.dnsResolveFn?wn.dnsResolveFn:void 0}const nc=`\r
149
+ `,ic=va.fromAscii(nc),wk=new Uint8Array(ic)[0],_k=new Uint8Array(ic)[1];function xk(r){for(let e=0;e<r.length;e++){const t=e+1;if(r.byteLength>t&&r[e]===wk&&r[t]===_k)return t+1}return 0}function Sk(r){const e=xk(r);if(e>0){const n=new Uint8Array(r).slice(0,e);return on.decode(n)}return""}const Ek=4,Z0=48,Ok=65,Tk=97;function Ak(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 Yh(r){return kk(r)!==void 0}function kk(r){for(let e=0;e<r.length;e++)switch(r[e]){case".":return X0(r);case":":return Ik(r)}}function X0(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}=Pk(r);if(!a||n>255)return;r=r.substring(i),e[t]=n}return Ak(e[0],e[1],e[2],e[3])}function Ik(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}=Ck(r);if(!u||i>65535)return;if(a<r.length&&r[a]==="."){if(t<0&&n!=12||n+4>16)return;const c=X0(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+=Ek;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 Pk(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)-Z0),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 Ck(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)-Z0;else if(97<=r.charCodeAt(t)&&r.charCodeAt(t)<=102)e*=16,e+=r.charCodeAt(t)-Tk+10;else if(65<=r.charCodeAt(t)&&r.charCodeAt(t)<=70)e*=16,e+=r.charCodeAt(t)-Ok+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 Nk(r){return r.indexOf(".")!==-1?!0:r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.split(":").length<=2}function Kh(r){return!Nk(r)}function Rk(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 Dk(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=Rk(r),Kh(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const e=Kh(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 Ao{constructor(e,t=!1){E(this,"src");E(this,"listen");E(this,"hostname");E(this,"port");E(this,"didConnect");E(this,"reconnects");E(this,"lastConnect");E(this,"gossiped");E(this,"tlsName");E(this,"resolves");this.src=e,this.tlsName="";const n=Dk(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(Yh(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}://${Kh(i)?"["+i+"]":i}`);u.port=`${this.port}`;const c=new Ao(u.host,!1);c.tlsName=this.hostname,t.push(c)}}return e.randomize&&L0(t),this.resolves=t,t}}class Fk{constructor(e=[],t={}){E(this,"firstSelect");E(this,"servers");E(this,"currentServer");E(this,"tlsName");E(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=t.randomize||!1;const n=Gh();e&&(e.forEach(i=>{i=n?n(i):i,this.servers.push(new Ao(i))}),this.randomize&&(this.servers=L0(this.servers))),this.servers.length===0&&this.addServer(`${Fh}:${K0()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Yh(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=Gh();e=n?n(e):e;const i=new Ao(e,t);Yh(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=Gh(),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 Ao(f,!0);u.set(f,h)});const c=[];return this.servers.forEach((f,h)=>{const d=f.listen;f.gossiped&&this.currentServer.listen!==d&&u.get(d)===void 0&&c.push(h),u.delete(d)}),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 Mk{constructor(){E(this,"baseInbox");E(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Ei(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=U0(t)),i.resolver(e,t))}}}close(){const e=Ie.errorForCode(pe.Timeout);this.reqs.forEach(t=>{t.resolver(e,{})})}}class Lk{constructor(e,t,n){E(this,"ph");E(this,"interval");E(this,"maxOut");E(this,"timer");E(this,"pendings");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:fa.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=tr();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 qk extends Error{constructor(e){super(e),this.name="AssertionError"}}function jk(r,e="Assertion failed."){if(!r)throw new qk(e)}const eb=32*1024,Zh=2**32-2;function sc(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 Xh{constructor(e){E(this,"_buf");E(this,"_off");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){jk(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=sc(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(xi.encode(e))}write(e){const t=this._grow(e.byteLength);return sc(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)sc(this._buf.subarray(this._off),this._buf);else{if(i+e>Zh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const a=new Uint8Array(Math.min(2*i+e,Zh));sc(this._buf.subarray(this._off),a),this._buf=a}}return this._off=0,this._reslice(Math.min(t+e,Zh)),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(eb);for(;;){const i=this.capacity-this.length<eb,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 Xr;(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"})(Xr||(Xr={}));function tb(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const Uk=48;class rb{constructor(e){E(this,"dispatcher");E(this,"state");E(this,"as");E(this,"drop");E(this,"hdr");E(this,"ma");E(this,"argBuf");E(this,"msgBuf");this.dispatcher=e,this.state=we.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 we.OP_START:switch(n){case _e.M:case _e.m:this.state=we.OP_M,this.hdr=-1,this.ma=tb();break;case _e.H:case _e.h:this.state=we.OP_H,this.hdr=0,this.ma=tb();break;case _e.P:case _e.p:this.state=we.OP_P;break;case _e.PLUS:this.state=we.OP_PLUS;break;case _e.MINUS:this.state=we.OP_MINUS;break;case _e.I:case _e.i:this.state=we.OP_I;break;default:throw this.fail(e.subarray(t))}break;case we.OP_H:switch(n){case _e.M:case _e.m:this.state=we.OP_M;break;default:throw this.fail(e.subarray(t))}break;case we.OP_M:switch(n){case _e.S:case _e.s:this.state=we.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case we.OP_MS:switch(n){case _e.G:case _e.g:this.state=we.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case we.OP_MSG:switch(n){case _e.SPACE:case _e.TAB:this.state=we.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case we.OP_MSG_SPC:switch(n){case _e.SPACE:case _e.TAB:continue;default:this.state=we.MSG_ARG,this.as=t}break;case we.MSG_ARG:switch(n){case _e.CR:this.drop=1;break;case _e.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=we.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case we.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const i=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Xr.MSG,msg:this.ma,data:i}),this.argBuf=void 0,this.msgBuf=void 0,this.state=we.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:Xr.MSG,msg:this.ma,data:e.subarray(this.as,t)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=we.MSG_END);break;case we.MSG_END:switch(n){case _e.NL:this.drop=0,this.as=t+1,this.state=we.OP_START;break;default:continue}break;case we.OP_PLUS:switch(n){case _e.O:case _e.o:this.state=we.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case we.OP_PLUS_O:switch(n){case _e.K:case _e.k:this.state=we.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case we.OP_PLUS_OK:switch(n){case _e.NL:this.dispatcher.push({kind:Xr.OK}),this.drop=0,this.state=we.OP_START;break}break;case we.OP_MINUS:switch(n){case _e.E:case _e.e:this.state=we.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case we.OP_MINUS_E:switch(n){case _e.R:case _e.r:this.state=we.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case we.OP_MINUS_ER:switch(n){case _e.R:case _e.r:this.state=we.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case we.OP_MINUS_ERR:switch(n){case _e.SPACE:case _e.TAB:this.state=we.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case we.OP_MINUS_ERR_SPC:switch(n){case _e.SPACE:case _e.TAB:continue;default:this.state=we.MINUS_ERR_ARG,this.as=t}break;case we.MINUS_ERR_ARG:switch(n){case _e.CR:this.drop=1;break;case _e.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:Xr.ERR,data:i}),this.drop=0,this.as=t+1,this.state=we.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case we.OP_P:switch(n){case _e.I:case _e.i:this.state=we.OP_PI;break;case _e.O:case _e.o:this.state=we.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case we.OP_PO:switch(n){case _e.N:case _e.n:this.state=we.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case we.OP_PON:switch(n){case _e.G:case _e.g:this.state=we.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case we.OP_PONG:switch(n){case _e.NL:this.dispatcher.push({kind:Xr.PONG}),this.drop=0,this.state=we.OP_START;break}break;case we.OP_PI:switch(n){case _e.N:case _e.n:this.state=we.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case we.OP_PIN:switch(n){case _e.G:case _e.g:this.state=we.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case we.OP_PING:switch(n){case _e.NL:this.dispatcher.push({kind:Xr.PING}),this.drop=0,this.state=we.OP_START;break}break;case we.OP_I:switch(n){case _e.N:case _e.n:this.state=we.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case we.OP_IN:switch(n){case _e.F:case _e.f:this.state=we.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case we.OP_INF:switch(n){case _e.O:case _e.o:this.state=we.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case we.OP_INFO:switch(n){case _e.SPACE:case _e.TAB:this.state=we.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case we.OP_INFO_SPC:switch(n){case _e.SPACE:case _e.TAB:continue;default:this.state=we.INFO_ARG,this.as=t}break;case we.INFO_ARG:switch(n){case _e.CR:this.drop=1;break;case _e.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:Xr.INFO,data:i}),this.drop=0,this.as=t+1,this.state=we.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===we.MSG_ARG||this.state===we.MINUS_ERR_ARG||this.state===we.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Xh(e.subarray(this.as,t-this.drop))),this.state===we.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Xh(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 Xh(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 _e.SPACE:case _e.TAB:case _e.CR:case _e.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}: ${on.decode(e)}`)}processHeaderMsgArgs(e){const t=[];let n=-1;for(let i=0;i<e.length;i++)switch(e[i]){case _e.SPACE:case _e.TAB:case _e.CR:case _e.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]-Uk)}return t}}var we;(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"})(we||(we={}));var _e;(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"})(_e||(_e={})),function(r){var e=function(b,I){this.hi=b|0,this.lo=I|0},t=function(b){var I,k=new Float64Array(16);if(b)for(I=0;I<b.length;I++)k[I]=b[I];return k},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]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function x(b,I){return b<<I|b>>>32-I}function T(b,I){var k=b[I+3]&255;return k=k<<8|b[I+2]&255,k=k<<8|b[I+1]&255,k<<8|b[I+0]&255}function w(b,I){var k=b[I]<<24|b[I+1]<<16|b[I+2]<<8|b[I+3],C=b[I+4]<<24|b[I+5]<<16|b[I+6]<<8|b[I+7];return new e(k,C)}function S(b,I,k){var C;for(C=0;C<4;C++)b[I+C]=k&255,k>>>=8}function A(b,I,k){b[I]=k.hi>>24&255,b[I+1]=k.hi>>16&255,b[I+2]=k.hi>>8&255,b[I+3]=k.hi&255,b[I+4]=k.lo>>24&255,b[I+5]=k.lo>>16&255,b[I+6]=k.lo>>8&255,b[I+7]=k.lo&255}function P(b,I,k,C,D){var U,ne=0;for(U=0;U<D;U++)ne|=b[I+U]^k[C+U];return(1&ne-1>>>8)-1}function F(b,I,k,C){return P(b,I,k,C,16)}function L(b,I,k,C){return P(b,I,k,C,32)}function $(b,I,k,C,D){var U=new Uint32Array(16),ne=new Uint32Array(16),le=new Uint32Array(16),J=new Uint32Array(4),re,De,mt;for(re=0;re<4;re++)ne[5*re]=T(C,4*re),ne[1+re]=T(k,4*re),ne[6+re]=T(I,4*re),ne[11+re]=T(k,16+4*re);for(re=0;re<16;re++)le[re]=ne[re];for(re=0;re<20;re++){for(De=0;De<4;De++){for(mt=0;mt<4;mt++)J[mt]=ne[(5*De+4*mt)%16];for(J[1]^=x(J[0]+J[3]|0,7),J[2]^=x(J[1]+J[0]|0,9),J[3]^=x(J[2]+J[1]|0,13),J[0]^=x(J[3]+J[2]|0,18),mt=0;mt<4;mt++)U[4*De+(De+mt)%4]=J[mt]}for(mt=0;mt<16;mt++)ne[mt]=U[mt]}if(D){for(re=0;re<16;re++)ne[re]=ne[re]+le[re]|0;for(re=0;re<4;re++)ne[5*re]=ne[5*re]-T(C,4*re)|0,ne[6+re]=ne[6+re]-T(I,4*re)|0;for(re=0;re<4;re++)S(b,4*re,ne[5*re]),S(b,16+4*re,ne[6+re])}else for(re=0;re<16;re++)S(b,4*re,ne[re]+le[re]|0)}function X(b,I,k,C){return $(b,I,k,C,!1),0}function te(b,I,k,C){return $(b,I,k,C,!0),0}var he=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function de(b,I,k,C,D,U,ne){var le=new Uint8Array(16),J=new Uint8Array(64),re,De;if(!D)return 0;for(De=0;De<16;De++)le[De]=0;for(De=0;De<8;De++)le[De]=U[De];for(;D>=64;){for(X(J,le,ne,he),De=0;De<64;De++)b[I+De]=(k?k[C+De]:0)^J[De];for(re=1,De=8;De<16;De++)re=re+(le[De]&255)|0,le[De]=re&255,re>>>=8;D-=64,I+=64,k&&(C+=64)}if(D>0)for(X(J,le,ne,he),De=0;De<D;De++)b[I+De]=(k?k[C+De]:0)^J[De];return 0}function Ve(b,I,k,C,D){return de(b,I,null,0,k,C,D)}function Ae(b,I,k,C,D){var U=new Uint8Array(32);return te(U,C,D,he),Ve(b,I,k,C.subarray(16),U)}function je(b,I,k,C,D,U,ne){var le=new Uint8Array(32);return te(le,U,ne,he),de(b,I,k,C,D,U.subarray(16),le)}function Ge(b,I){var k,C=0;for(k=0;k<17;k++)C=C+(b[k]+I[k]|0)|0,b[k]=C&255,C>>>=8}var ye=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Je(b,I,k,C,D,U){var ne,le,J,re,De=new Uint32Array(17),mt=new Uint32Array(17),Xt=new Uint32Array(17),_n=new Uint32Array(17),Ai=new Uint32Array(17);for(J=0;J<17;J++)mt[J]=Xt[J]=0;for(J=0;J<16;J++)mt[J]=U[J];for(mt[3]&=15,mt[4]&=252,mt[7]&=15,mt[8]&=252,mt[11]&=15,mt[12]&=252,mt[15]&=15;D>0;){for(J=0;J<17;J++)_n[J]=0;for(J=0;J<16&&J<D;++J)_n[J]=k[C+J];for(_n[J]=1,C+=J,D-=J,Ge(Xt,_n),le=0;le<17;le++)for(De[le]=0,J=0;J<17;J++)De[le]=De[le]+Xt[J]*(J<=le?mt[le-J]:320*mt[le+17-J]|0)|0|0;for(le=0;le<17;le++)Xt[le]=De[le];for(re=0,J=0;J<16;J++)re=re+Xt[J]|0,Xt[J]=re&255,re>>>=8;for(re=re+Xt[16]|0,Xt[16]=re&3,re=5*(re>>>2)|0,J=0;J<16;J++)re=re+Xt[J]|0,Xt[J]=re&255,re>>>=8;re=re+Xt[16]|0,Xt[16]=re}for(J=0;J<17;J++)Ai[J]=Xt[J];for(Ge(Xt,ye),ne=-(Xt[16]>>>7)|0,J=0;J<17;J++)Xt[J]^=ne&(Ai[J]^Xt[J]);for(J=0;J<16;J++)_n[J]=U[J+16];for(_n[16]=0,Ge(Xt,_n),J=0;J<16;J++)b[I+J]=Xt[J];return 0}function ge(b,I,k,C,D,U){var ne=new Uint8Array(16);return Je(ne,0,k,C,D,U),F(b,I,ne,0)}function ue(b,I,k,C,D){var U;if(k<32)return-1;for(je(b,0,I,0,k,C,D),Je(b,16,b,32,k-32,b),U=0;U<16;U++)b[U]=0;return 0}function Ee(b,I,k,C,D){var U,ne=new Uint8Array(32);if(k<32||(Ae(ne,0,32,C,D),ge(I,16,I,32,k-32,ne)!==0))return-1;for(je(b,0,I,0,k,C,D),U=0;U<32;U++)b[U]=0;return 0}function Ne(b,I){var k;for(k=0;k<16;k++)b[k]=I[k]|0}function xe(b){var I,k;for(k=0;k<16;k++)b[k]+=65536,I=Math.floor(b[k]/65536),b[(k+1)*(k<15?1:0)]+=I-1+37*(I-1)*(k===15?1:0),b[k]-=I*65536}function Xe(b,I,k){for(var C,D=~(k-1),U=0;U<16;U++)C=D&(b[U]^I[U]),b[U]^=C,I[U]^=C}function Et(b,I){var k,C,D,U=t(),ne=t();for(k=0;k<16;k++)ne[k]=I[k];for(xe(ne),xe(ne),xe(ne),C=0;C<2;C++){for(U[0]=ne[0]-65517,k=1;k<15;k++)U[k]=ne[k]-65535-(U[k-1]>>16&1),U[k-1]&=65535;U[15]=ne[15]-32767-(U[14]>>16&1),D=U[15]>>16&1,U[14]&=65535,Xe(ne,U,1-D)}for(k=0;k<16;k++)b[2*k]=ne[k]&255,b[2*k+1]=ne[k]>>8}function lt(b,I){var k=new Uint8Array(32),C=new Uint8Array(32);return Et(k,b),Et(C,I),L(k,0,C,0)}function It(b){var I=new Uint8Array(32);return Et(I,b),I[0]&1}function et(b,I){var k;for(k=0;k<16;k++)b[k]=I[2*k]+(I[2*k+1]<<8);b[15]&=32767}function Ye(b,I,k){var C;for(C=0;C<16;C++)b[C]=I[C]+k[C]|0}function dt(b,I,k){var C;for(C=0;C<16;C++)b[C]=I[C]-k[C]|0}function Re(b,I,k){var C,D,U=new Float64Array(31);for(C=0;C<31;C++)U[C]=0;for(C=0;C<16;C++)for(D=0;D<16;D++)U[C+D]+=I[C]*k[D];for(C=0;C<15;C++)U[C]+=38*U[C+16];for(C=0;C<16;C++)b[C]=U[C];xe(b),xe(b)}function bt(b,I){Re(b,I,I)}function z(b,I){var k=t(),C;for(C=0;C<16;C++)k[C]=I[C];for(C=253;C>=0;C--)bt(k,k),C!==2&&C!==4&&Re(k,k,I);for(C=0;C<16;C++)b[C]=k[C]}function Y(b,I){var k=t(),C;for(C=0;C<16;C++)k[C]=I[C];for(C=250;C>=0;C--)bt(k,k),C!==1&&Re(k,k,I);for(C=0;C<16;C++)b[C]=k[C]}function V(b,I,k){var C=new Uint8Array(32),D=new Float64Array(80),U,ne,le=t(),J=t(),re=t(),De=t(),mt=t(),Xt=t();for(ne=0;ne<31;ne++)C[ne]=I[ne];for(C[31]=I[31]&127|64,C[0]&=248,et(D,k),ne=0;ne<16;ne++)J[ne]=D[ne],De[ne]=le[ne]=re[ne]=0;for(le[0]=De[0]=1,ne=254;ne>=0;--ne)U=C[ne>>>3]>>>(ne&7)&1,Xe(le,J,U),Xe(re,De,U),Ye(mt,le,re),dt(le,le,re),Ye(re,J,De),dt(J,J,De),bt(De,mt),bt(Xt,le),Re(le,re,le),Re(re,J,mt),Ye(mt,le,re),dt(le,le,re),bt(J,le),dt(re,De,Xt),Re(le,re,f),Ye(le,le,De),Re(re,re,le),Re(le,De,Xt),Re(De,J,D),bt(J,mt),Xe(le,J,U),Xe(re,De,U);for(ne=0;ne<16;ne++)D[ne+16]=le[ne],D[ne+32]=re[ne],D[ne+48]=J[ne],D[ne+64]=De[ne];var _n=D.subarray(32),Ai=D.subarray(16);return z(_n,_n),Re(Ai,Ai,_n),Et(b,Ai),0}function G(b,I){return V(b,I,a)}function Z(b,I){return n(I,32),G(b,I)}function Q(b,I,k){var C=new Uint8Array(32);return V(C,k,I),te(b,i,C,he)}var Te=ue,ze=Ee;function Ue(b,I,k,C,D,U){var ne=new Uint8Array(32);return Q(ne,D,U),Te(b,I,k,C,ne)}function ce(b,I,k,C,D,U){var ne=new Uint8Array(32);return Q(ne,D,U),ze(b,I,k,C,ne)}function be(){var b=0,I=0,k=0,C=0,D=65535,U,ne,le;for(le=0;le<arguments.length;le++)U=arguments[le].lo,ne=arguments[le].hi,b+=U&D,I+=U>>>16,k+=ne&D,C+=ne>>>16;return I+=b>>>16,k+=I>>>16,C+=k>>>16,new e(k&D|C<<16,b&D|I<<16)}function Ze(b,I){return new e(b.hi>>>I,b.lo>>>I|b.hi<<32-I)}function Ot(){var b=0,I=0,k;for(k=0;k<arguments.length;k++)b^=arguments[k].lo,I^=arguments[k].hi;return new e(I,b)}function wt(b,I){var k,C,D=32-I;return I<32?(k=b.hi>>>I|b.lo<<D,C=b.lo>>>I|b.hi<<D):I<64&&(k=b.lo>>>I|b.hi<<D,C=b.hi>>>I|b.lo<<D),new e(k,C)}function Gt(b,I,k){var C=b.hi&I.hi^~b.hi&k.hi,D=b.lo&I.lo^~b.lo&k.lo;return new e(C,D)}function pt(b,I,k){var C=b.hi&I.hi^b.hi&k.hi^I.hi&k.hi,D=b.lo&I.lo^b.lo&k.lo^I.lo&k.lo;return new e(C,D)}function Lt(b){return Ot(wt(b,28),wt(b,34),wt(b,39))}function rr(b){return Ot(wt(b,14),wt(b,18),wt(b,41))}function Rr(b){return Ot(wt(b,1),wt(b,8),Ze(b,7))}function zt(b){return Ot(wt(b,19),wt(b,61),Ze(b,6))}var Jt=[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 Zt(b,I,k){var C=[],D=[],U=[],ne=[],le,J,re;for(J=0;J<8;J++)C[J]=U[J]=w(b,8*J);for(var De=0;k>=128;){for(J=0;J<16;J++)ne[J]=w(I,8*J+De);for(J=0;J<80;J++){for(re=0;re<8;re++)D[re]=U[re];for(le=be(U[7],rr(U[4]),Gt(U[4],U[5],U[6]),Jt[J],ne[J%16]),D[7]=be(le,Lt(U[0]),pt(U[0],U[1],U[2])),D[3]=be(D[3],le),re=0;re<8;re++)U[(re+1)%8]=D[re];if(J%16===15)for(re=0;re<16;re++)ne[re]=be(ne[re],ne[(re+9)%16],Rr(ne[(re+1)%16]),zt(ne[(re+14)%16]))}for(J=0;J<8;J++)U[J]=be(U[J],C[J]),C[J]=U[J];De+=128,k-=128}for(J=0;J<8;J++)A(b,8*J,C[J]);return k}var W=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 H(b,I,k){var C=new Uint8Array(64),D=new Uint8Array(256),U,ne=k;for(U=0;U<64;U++)C[U]=W[U];for(Zt(C,I,k),k%=128,U=0;U<256;U++)D[U]=0;for(U=0;U<k;U++)D[U]=I[ne-k+U];for(D[k]=128,k=256-128*(k<112?1:0),D[k-9]=0,A(D,k-8,new e(ne/536870912|0,ne<<3)),Zt(C,D,k),U=0;U<64;U++)b[U]=C[U];return 0}function Be(b,I){var k=t(),C=t(),D=t(),U=t(),ne=t(),le=t(),J=t(),re=t(),De=t();dt(k,b[1],b[0]),dt(De,I[1],I[0]),Re(k,k,De),Ye(C,b[0],b[1]),Ye(De,I[0],I[1]),Re(C,C,De),Re(D,b[3],I[3]),Re(D,D,d),Re(U,b[2],I[2]),Ye(U,U,U),dt(ne,C,k),dt(le,U,D),Ye(J,U,D),Ye(re,C,k),Re(b[0],ne,le),Re(b[1],re,J),Re(b[2],J,le),Re(b[3],ne,re)}function $e(b,I,k){var C;for(C=0;C<4;C++)Xe(b[C],I[C],k)}function Tt(b,I){var k=t(),C=t(),D=t();z(D,I[2]),Re(k,I[0],D),Re(C,I[1],D),Et(b,C),b[31]^=It(k)<<7}function Ke(b,I,k){var C,D;for(Ne(b[0],u),Ne(b[1],c),Ne(b[2],c),Ne(b[3],u),D=255;D>=0;--D)C=k[D/8|0]>>(D&7)&1,$e(b,I,C),Be(I,b),Be(b,b),$e(b,I,C)}function nr(b,I){var k=[t(),t(),t(),t()];Ne(k[0],y),Ne(k[1],g),Ne(k[2],c),Re(k[3],y,g),Ke(b,k,I)}function fr(b,I,k){var C=new Uint8Array(64),D=[t(),t(),t(),t()],U;for(k||n(I,32),H(C,I,32),C[0]&=248,C[31]&=127,C[31]|=64,nr(D,C),Tt(b,D),U=0;U<32;U++)I[U+32]=b[U];return 0}var Dt=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 Ht(b,I){var k,C,D,U;for(C=63;C>=32;--C){for(k=0,D=C-32,U=C-12;D<U;++D)I[D]+=k-16*I[C]*Dt[D-(C-32)],k=Math.floor((I[D]+128)/256),I[D]-=k*256;I[D]+=k,I[C]=0}for(k=0,D=0;D<32;D++)I[D]+=k-(I[31]>>4)*Dt[D],k=I[D]>>8,I[D]&=255;for(D=0;D<32;D++)I[D]-=k*Dt[D];for(C=0;C<32;C++)I[C+1]+=I[C]>>8,b[C]=I[C]&255}function Ur(b){var I=new Float64Array(64),k;for(k=0;k<64;k++)I[k]=b[k];for(k=0;k<64;k++)b[k]=0;Ht(b,I)}function $r(b,I,k,C){var D=new Uint8Array(64),U=new Uint8Array(64),ne=new Uint8Array(64),le,J,re=new Float64Array(64),De=[t(),t(),t(),t()];H(D,C,32),D[0]&=248,D[31]&=127,D[31]|=64;var mt=k+64;for(le=0;le<k;le++)b[64+le]=I[le];for(le=0;le<32;le++)b[32+le]=D[32+le];for(H(ne,b.subarray(32),k+32),Ur(ne),nr(De,ne),Tt(b,De),le=32;le<64;le++)b[le]=C[le];for(H(U,b,k+64),Ur(U),le=0;le<64;le++)re[le]=0;for(le=0;le<32;le++)re[le]=ne[le];for(le=0;le<32;le++)for(J=0;J<32;J++)re[le+J]+=U[le]*D[J];return Ht(b.subarray(32),re),mt}function ir(b,I){var k=t(),C=t(),D=t(),U=t(),ne=t(),le=t(),J=t();return Ne(b[2],c),et(b[1],I),bt(D,b[1]),Re(U,D,h),dt(D,D,b[2]),Ye(U,b[2],U),bt(ne,U),bt(le,ne),Re(J,le,ne),Re(k,J,D),Re(k,k,U),Y(k,k),Re(k,k,D),Re(k,k,U),Re(k,k,U),Re(b[0],k,U),bt(C,b[0]),Re(C,C,U),lt(C,D)&&Re(b[0],b[0],m),bt(C,b[0]),Re(C,C,U),lt(C,D)?-1:(It(b[0])===I[31]>>7&&dt(b[0],u,b[0]),Re(b[3],b[0],b[1]),0)}function un(b,I,k,C){var D,U=new Uint8Array(32),ne=new Uint8Array(64),le=[t(),t(),t(),t()],J=[t(),t(),t(),t()];if(k<64||ir(J,C))return-1;for(D=0;D<k;D++)b[D]=I[D];for(D=0;D<32;D++)b[D+32]=C[D];if(H(ne,b,k),Ur(ne),Ke(le,J,ne),nr(J,I.subarray(32)),Be(le,J),Tt(U,le),k-=64,L(I,0,U,0)){for(D=0;D<k;D++)b[D]=0;return-1}for(D=0;D<k;D++)b[D]=I[D+64];return k}var _r=32,xr=24,Sr=32,Or=16,ur=32,zr=32,Tr=32,Er=32,Dr=32,cn=xr,Ln=Sr,R=Or,se=64,me=32,ke=64,Le=32,at=64;r.lowlevel={crypto_core_hsalsa20:te,crypto_stream_xor:je,crypto_stream:Ae,crypto_stream_salsa20_xor:de,crypto_stream_salsa20:Ve,crypto_onetimeauth:Je,crypto_onetimeauth_verify:ge,crypto_verify_16:F,crypto_verify_32:L,crypto_secretbox:ue,crypto_secretbox_open:Ee,crypto_scalarmult:V,crypto_scalarmult_base:G,crypto_box_beforenm:Q,crypto_box_afternm:Te,crypto_box:Ue,crypto_box_open:ce,crypto_box_keypair:Z,crypto_hash:H,crypto_sign:$r,crypto_sign_keypair:fr,crypto_sign_open:un,crypto_secretbox_KEYBYTES:_r,crypto_secretbox_NONCEBYTES:xr,crypto_secretbox_ZEROBYTES:Sr,crypto_secretbox_BOXZEROBYTES:Or,crypto_scalarmult_BYTES:ur,crypto_scalarmult_SCALARBYTES:zr,crypto_box_PUBLICKEYBYTES:Tr,crypto_box_SECRETKEYBYTES:Er,crypto_box_BEFORENMBYTES:Dr,crypto_box_NONCEBYTES:cn,crypto_box_ZEROBYTES:Ln,crypto_box_BOXZEROBYTES:R,crypto_sign_BYTES:se,crypto_sign_PUBLICKEYBYTES:me,crypto_sign_SECRETKEYBYTES:ke,crypto_sign_SEEDBYTES:Le,crypto_hash_BYTES:at,gf:t,D:h,L:Dt,pack25519:Et,unpack25519:et,M:Re,A:Ye,S:bt,Z:dt,pow2523:Y,add:Be,set25519:Ne,modL:Ht,scalarmult:Ke,scalarbase:nr};function nt(b,I){if(b.length!==_r)throw new Error("bad key size");if(I.length!==xr)throw new Error("bad nonce size")}function tt(b,I){if(b.length!==Tr)throw new Error("bad public key size");if(I.length!==Er)throw new Error("bad secret key size")}function rt(){for(var b=0;b<arguments.length;b++)if(!(arguments[b]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function _t(b){for(var I=0;I<b.length;I++)b[I]=0}r.randomBytes=function(b){var I=new Uint8Array(b);return n(I,b),I},r.secretbox=function(b,I,k){rt(b,I,k),nt(k,I);for(var C=new Uint8Array(Sr+b.length),D=new Uint8Array(C.length),U=0;U<b.length;U++)C[U+Sr]=b[U];return ue(D,C,C.length,I,k),D.subarray(Or)},r.secretbox.open=function(b,I,k){rt(b,I,k),nt(k,I);for(var C=new Uint8Array(Or+b.length),D=new Uint8Array(C.length),U=0;U<b.length;U++)C[U+Or]=b[U];return C.length<32||Ee(D,C,C.length,I,k)!==0?null:D.subarray(Sr)},r.secretbox.keyLength=_r,r.secretbox.nonceLength=xr,r.secretbox.overheadLength=Or,r.scalarMult=function(b,I){if(rt(b,I),b.length!==zr)throw new Error("bad n size");if(I.length!==ur)throw new Error("bad p size");var k=new Uint8Array(ur);return V(k,b,I),k},r.scalarMult.base=function(b){if(rt(b),b.length!==zr)throw new Error("bad n size");var I=new Uint8Array(ur);return G(I,b),I},r.scalarMult.scalarLength=zr,r.scalarMult.groupElementLength=ur,r.box=function(b,I,k,C){var D=r.box.before(k,C);return r.secretbox(b,I,D)},r.box.before=function(b,I){rt(b,I),tt(b,I);var k=new Uint8Array(Dr);return Q(k,b,I),k},r.box.after=r.secretbox,r.box.open=function(b,I,k,C){var D=r.box.before(k,C);return r.secretbox.open(b,I,D)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var b=new Uint8Array(Tr),I=new Uint8Array(Er);return Z(b,I),{publicKey:b,secretKey:I}},r.box.keyPair.fromSecretKey=function(b){if(rt(b),b.length!==Er)throw new Error("bad secret key size");var I=new Uint8Array(Tr);return G(I,b),{publicKey:I,secretKey:new Uint8Array(b)}},r.box.publicKeyLength=Tr,r.box.secretKeyLength=Er,r.box.sharedKeyLength=Dr,r.box.nonceLength=cn,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(b,I){if(rt(b,I),I.length!==ke)throw new Error("bad secret key size");var k=new Uint8Array(se+b.length);return $r(k,b,b.length,I),k},r.sign.open=function(b,I){if(rt(b,I),I.length!==me)throw new Error("bad public key size");var k=new Uint8Array(b.length),C=un(k,b,b.length,I);if(C<0)return null;for(var D=new Uint8Array(C),U=0;U<D.length;U++)D[U]=k[U];return D},r.sign.detached=function(b,I){for(var k=r.sign(b,I),C=new Uint8Array(se),D=0;D<C.length;D++)C[D]=k[D];return C},r.sign.detached.verify=function(b,I,k){if(rt(b,I,k),I.length!==se)throw new Error("bad signature size");if(k.length!==me)throw new Error("bad public key size");var C=new Uint8Array(se+b.length),D=new Uint8Array(se+b.length),U;for(U=0;U<se;U++)C[U]=I[U];for(U=0;U<b.length;U++)C[U+se]=b[U];return un(D,C,C.length,k)>=0},r.sign.keyPair=function(){var b=new Uint8Array(me),I=new Uint8Array(ke);return fr(b,I),{publicKey:b,secretKey:I}},r.sign.keyPair.fromSecretKey=function(b){if(rt(b),b.length!==ke)throw new Error("bad secret key size");for(var I=new Uint8Array(me),k=0;k<I.length;k++)I[k]=b[32+k];return{publicKey:I,secretKey:new Uint8Array(b)}},r.sign.keyPair.fromSeed=function(b){if(rt(b),b.length!==Le)throw new Error("bad seed size");for(var I=new Uint8Array(me),k=new Uint8Array(ke),C=0;C<32;C++)k[C]=b[C];return fr(I,k,!0),{publicKey:I,secretKey:k}},r.sign.publicKeyLength=me,r.sign.secretKeyLength=ke,r.sign.seedLength=Le,r.sign.signatureLength=se,r.hash=function(b){rt(b);var I=new Uint8Array(at);return H(I,b,b.length),I},r.hash.hashLength=at,r.verify=function(b,I){return rt(b,I),b.length===0||I.length===0||b.length!==I.length?!1:P(b,0,I,0,b.length)===0},r.setPRNG=function(b){n=b},function(){var b=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(b&&b.getRandomValues){var I=65536;r.setPRNG(function(k,C){var D,U=new Uint8Array(C);for(D=0;D<C;D+=I)b.getRandomValues(U.subarray(D,D+Math.min(C-D,I)));for(D=0;D<C;D++)k[D]=U[D];_t(U)})}else typeof require<"u"&&(b=require("crypto"),b&&b.randomBytes&&r.setPRNG(function(k,C){var D,U=b.randomBytes(C);for(D=0;D<C;D++)k[D]=U[D];_t(U)}))}()}(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const ac=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,$k={fromSeed:ac.sign.keyPair.fromSeed,sign:ac.sign.detached,verify:ac.sign.detached.verify,randomBytes:ac.randomBytes};let nb;function Bk(r){nb=r}function is(){return nb}const Vk=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 oc{static checksum(e){let t=0;for(let n=0;n<e.byteLength;n++){let i=e[n];t=t<<8&65535^Vk[(t>>8^i)&255]}return t}static validate(e,t){return oc.checksum(e)==t}}const ed="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class ib{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++]=ed.charAt(f).charCodeAt(0),t-=5}if(t>0){let c=n<<5-t&31;a[u++]=ed.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=ed.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 Vt extends Error{constructor(t,n){super(t);E(this,"name");E(this,"code");E(this,"chainedError");this.name="NKeysError",this.code=t,this.chainedError=n}}function Wk(){return uc(Wt.Operator)}function zk(){return uc(Wt.Account)}function Hk(){return uc(Wt.User)}var Mt;(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"})(Mt||(Mt={}));var Wt;(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"})(Wt||(Wt={}));class wa{static isValidPublicPrefix(e){return e==Wt.Server||e==Wt.Operator||e==Wt.Cluster||e==Wt.Account||e==Wt.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 Wt.Seed:return Wt.Seed;case Wt.Private:return Wt.Private;case Wt.Operator:return Wt.Operator;case Wt.Server:return Wt.Server;case Wt.Cluster:return Wt.Cluster;case Wt.Account:return Wt.Account;case Wt.User:return Wt.User;default:return-1}}}class en{static encode(e,t){if(!t||!(t instanceof Uint8Array))throw new Vt(Mt.SerializationError);if(!wa.isValidPrefix(e))throw new Vt(Mt.InvalidPrefixByte);return en._encode(!1,e,t)}static encodeSeed(e,t){if(!t)throw new Vt(Mt.ApiError);if(!wa.isValidPublicPrefix(e))throw new Vt(Mt.InvalidPrefixByte);if(t.byteLength!==32)throw new Vt(Mt.InvalidSeedLen);return en._encode(!0,e,t)}static decode(e,t){if(!wa.isValidPrefix(e))throw new Vt(Mt.InvalidPrefixByte);const n=en._decode(t);if(n[0]!==e)throw new Vt(Mt.InvalidPrefixByte);return n.slice(1)}static decodeSeed(e){const t=en._decode(e),n=en._decodePrefix(t);if(n[0]!=Wt.Seed)throw new Vt(Mt.InvalidSeed);if(!wa.isValidPublicPrefix(n[1]))throw new Vt(Mt.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 y=en._encodePrefix(Wt.Seed,t);f.set(y)}else f[0]=t;f.set(n,i);const h=oc.checksum(f.slice(0,c));return new DataView(f.buffer).setUint16(c,h,!0),ib.encode(f)}static _decode(e){if(e.byteLength<4)throw new Vt(Mt.InvalidEncoding);let t;try{t=ib.decode(e)}catch(c){throw new Vt(Mt.InvalidEncoding,c)}const n=t.byteLength-2,a=new DataView(t.buffer).getUint16(n,!0),u=t.slice(0,n);if(!oc.validate(u,a))throw new Vt(Mt.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 sb{constructor(e){E(this,"seed");this.seed=e}getRawSeed(){if(!this.seed)throw new Vt(Mt.ClearedPair);return en.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Vt(Mt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Vt(Mt.ClearedPair);const e=en.decodeSeed(this.seed),t=is().fromSeed(this.getRawSeed()),n=en.encode(e.prefix,t.publicKey);return new TextDecoder().decode(n)}getPrivateKey(){if(!this.seed)throw new Vt(Mt.ClearedPair);const e=is().fromSeed(this.getRawSeed());return en.encode(Wt.Private,e.secretKey)}sign(e){if(!this.seed)throw new Vt(Mt.ClearedPair);const t=is().fromSeed(this.getRawSeed());return is().sign(e,t.secretKey)}verify(e,t){if(!this.seed)throw new Vt(Mt.ClearedPair);const n=is().fromSeed(this.getRawSeed());return is().verify(e,t,n.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function uc(r){const e=is().randomBytes(32);let t=en.encodeSeed(r,new Uint8Array(e));return new sb(t)}class Qk{constructor(e){E(this,"publicKey");this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new Vt(Mt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Vt(Mt.PublicKeyOnly):new Vt(Mt.ClearedPair)}getSeed(){throw this.publicKey?new Vt(Mt.PublicKeyOnly):new Vt(Mt.ClearedPair)}sign(e){throw this.publicKey?new Vt(Mt.CannotSign):new Vt(Mt.ClearedPair)}verify(e,t){if(!this.publicKey)throw new Vt(Mt.ClearedPair);let n=en._decode(this.publicKey);return is().verify(e,t,n.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function Gk(r){const e=new TextEncoder().encode(r),t=en._decode(e),n=wa.parsePrefix(t[0]);if(wa.isValidPublicPrefix(n))return new Qk(e);throw new Vt(Mt.InvalidPublicKey)}function Jk(r){return en.decodeSeed(r),new sb(r)}function Yk(r){return btoa(String.fromCharCode(...r))}function Kk(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}Bk($k);const ab={createAccount:zk,createOperator:Wk,createPair:uc,createUser:Hk,fromPublic:Gk,fromSeed:Jk,NKeysError:Vt,NKeysErrorCode:Mt,Prefix:Wt,decode:Kk,encode:Yk};function Zk(r){return e=>{let t={};return r.forEach(n=>{const i=n(e)||{};t=Object.assign(t,i)}),t}}function Xk(){return()=>{}}function eI(r,e){return()=>{const t=typeof r=="function"?r():r,n=typeof e=="function"?e():e;return{user:t,pass:n}}}function tI(r){return()=>({auth_token:typeof r=="function"?r():r})}function rI(r){return e=>{const t=typeof r=="function"?r():r,n=t?ab.fromSeed(t):void 0,i=n?n.getPublicKey():"",a=xi.encode(e||""),u=n!==void 0&&e?n.sign(a):void 0,c=u?ab.encode(u):"";return{nkey:i,sig:c}}}function nI(r,e){return t=>{const n=typeof r=="function"?r():r,i=rI(e),{nkey:a,sig:u}=i(t);return{jwt:n,nkey:a,sig:u}}}function iI(r){const e=typeof r!="function"?()=>r:r,t=()=>{const a=/\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig,u=on.decode(e());let c=a.exec(u);if(!c)throw Ie.errorForCode(pe.BadCreds);const f=c[1].trim();if(c=a.exec(u),!c||!c)throw Ie.errorForCode(pe.BadCreds);const h=xi.encode(c[1].trim());return{jwt:f,seed:h}};return nI(()=>{const{jwt:a}=t();return a},()=>{const{seed:a}=t();return a})}const ob=2*60*1e3,sI=2,ub=2*1e3;function aI(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:ob,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:ub,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function oI(r){const e=[];return typeof r.authenticator=="function"&&e.push(r.authenticator),Array.isArray(r.authenticator)&&e.push(...r.authenticator),r.token&&e.push(tI(r.token)),r.user&&e.push(eI(r.user,r.pass)),e.length===0?Xk():Zk(e)}function uI(r){const e=`${Fh}:${K0()}`;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 Ie("port and servers options are mutually exclusive",pe.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Fh}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[e]);const t=Xu(aI(),r);if(t.authenticator=oI(t),["reconnectDelayHandler","authenticator"].forEach(n=>{if(t[n]&&typeof t[n]!="function")throw new Ie(`${n} option should be a function`,pe.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{Ei(t.inboxPrefix)}catch(n){throw new Ie(n.message,pe.ApiError)}if(t.resolve===void 0&&(t.resolve=typeof Jh()=="function"),t.resolve&&typeof Jh()!="function")throw new Ie("'resolve' is not supported on this client",pe.InvalidOption);return t}function cI(r,e){const{proto:t,tls_required:n,tls_available:i}=r;if((t===void 0||t<1)&&e.noEcho)throw new Ie("noEcho",pe.ServerOptionNotAvailable);const a=n||i||!1;if(e.tls&&!a)throw new Ie("tls",pe.ServerOptionNotAvailable)}const lI=1024*32,fI=/^INFO\s+([^\r\n]+)\r\n/i,hI=wo(`PONG\r
150
+ `),cb=wo(`PING\r
151
+ `);class dI{constructor(e,t,n){E(this,"echo");E(this,"no_responders");E(this,"protocol");E(this,"verbose");E(this,"pedantic");E(this,"jwt");E(this,"nkey");E(this,"sig");E(this,"user");E(this,"pass");E(this,"auth_token");E(this,"tls_required");E(this,"name");E(this,"lang");E(this,"version");E(this,"headers");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):{})||{};Xu(this,i)}}class lb extends Cr{constructor(t,n,i={}){var u;super();E(this,"sid");E(this,"queue");E(this,"draining");E(this,"max");E(this,"subject");E(this,"drained");E(this,"protocol");E(this,"timer");E(this,"info");E(this,"cleanupFn");E(this,"closed");E(this,"requestSubject");Xu(this,i),this.protocol=t,this.subject=n,this.draining=!1,this.noIterator=typeof i.callback=="function",this.closed=tr();const a=!((u=t.options)!=null&&u.noAsyncTraces);i.timeout&&(this.timer=ha(i.timeout,a),this.timer.then(()=>{this.timer=void 0}).catch(c=>{this.stop(c),this.noIterator&&this.callback(c,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(t){if(this.noIterator){const n=this.callback,i=t.ingestionFilterFn?t.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),a=t.protocolFilterFn?t.protocolFilterFn:()=>!0,u=t.dispatchedFn?t.dispatchedFn:()=>{};this.callback=(c,f)=>{const{ingest:h}=i(f);h&&a(f)&&(n(c,f),u(f))}}else this.protocolFilterFn=t.protocolFilterFn,this.dispatchedFn=t.dispatchedFn}callback(t,n){this.cancelTimeout(),t?this.stop(t):this.push(n)}close(){if(!this.isClosed()){this.cancelTimeout();const t=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?t():this.push(t)}}unsubscribe(t){this.protocol.unsubscribe(this,t)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Ie.errorForCode(pe.ConnectionClosed)):this.isClosed()?Promise.reject(Ie.errorForCode(pe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(tr()).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 pI{constructor(){E(this,"mux");E(this,"subs");E(this,"sidCounter");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 cc{constructor(e,t){E(this,"connected");E(this,"connectedOnce");E(this,"infoReceived");E(this,"info");E(this,"muxSubscriptions");E(this,"options");E(this,"outbound");E(this,"pongs");E(this,"subscriptions");E(this,"transport");E(this,"noMorePublishing");E(this,"connectError");E(this,"publisher");E(this,"_closed");E(this,"closed");E(this,"listeners");E(this,"heartbeats");E(this,"parser");E(this,"outMsgs");E(this,"inMsgs");E(this,"outBytes");E(this,"inBytes");E(this,"pendingLimit");E(this,"lastError");E(this,"abortReconnect");E(this,"whyClosed");E(this,"servers");E(this,"server");E(this,"features");E(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=lI,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new pI,this.muxSubscriptions=new Mk,this.outbound=new va,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new yk({major:0,minor:0,micro:0}),this.connectPromise=null;const n=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new Fk(n,{randomize:!e.noRandomize}),this.closed=tr(),this.parser=new rb(this),this.heartbeats=new Lk(this,this.options.pingInterval||ob,this.options.maxPingOut||sI)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const t=Ie.errorForCode(pe.Disconnect);t.stack="",e.forEach(n=>{n.reject(t)}),this.parser=new rb(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}status(){const e=new Cr;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=tr();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=bk(),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:fa.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:fa.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Si.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var t;this.dispatchStatus({type:Si.Reconnect,data:this.servers.getCurrentServer().toString()}),((t=this.lastError)==null?void 0:t.code)===pe.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=ha(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:Jh(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t});let i=null;for(const a of n)try{i=null,this.dispatchStatus({type:fa.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():ub;let n=t;const i=this.selectServer();if(!i||this.abortReconnect)throw e||(this.lastError?this.lastError:Ie.errorForCode(pe.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 da(n)}}static async connect(e,t){const n=new cc(e,t);return await n.dialLoop(),n}static toError(e){const t=e?e.toLowerCase():"";if(t.indexOf("permissions violation")!==-1){const n=new Ie(e,pe.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 Ie(e,pe.AuthorizationViolation):t.indexOf("user authentication expired")!==-1?new Ie(e,pe.AuthenticationExpired):t.indexOf("account authentication expired")!=-1?new Ie(e,pe.AccountExpired):t.indexOf("authentication timeout")!==-1?new Ie(e,pe.AuthenticationTimeout):new Ie(e,pe.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 jh(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(e){const t=C0(e),n=cc.toError(t),i={type:Si.Error,data:n.code};if(n.isPermissionError()){let a=!1;if(n.permissionContext){i.permissionContext=n.permissionContext;const u=this.subscriptions.getMux();a=(u==null?void 0:u.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(hI)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const t=JSON.parse(C0(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(Ps(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:a,lang:u}=this.transport;try{const c=new dI({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(wo(`CONNECT ${f}${nc}`)),this.transport.send(cb)}catch(c){this._close(c)}}n&&this.dispatchStatus({type:Si.Update,data:n}),(t.ldm!==void 0?t.ldm:!1)&&this.dispatchStatus({type:Si.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case Xr.MSG:{const{msg:t,data:n}=e;this.processMsg(t,n);break}case Xr.OK:break;case Xr.ERR:this.processError(e.data);break;case Xr.PING:this.processPing();break;case Xr.PONG:this.processPong();break;case Xr.INFO:this.processInfo(e.data);break}}sendCommand(e,...t){const n=this.outbound.length();let i;typeof e=="string"?i=wo(e):i=e,this.outbound.fill(i,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=vn,n){let i;if(t instanceof Uint8Array)i=t;else if(typeof t=="string")i=xi.encode(t);else throw Ie.errorForCode(pe.BadPayload);let a=i.length;n=n||{},n.reply=n.reply||"";let u=vn,c=0;if(n.headers){if(this.info&&!this.info.headers)throw new Ie("headers",pe.ServerOptionNotAvailable);u=n.headers.encode(),c=u.length,a=i.length+c}if(this.info&&a>this.info.max_payload)throw Ie.errorForCode(pe.MaxPayloadExceeded);this.outBytes+=a,this.outMsgs++;let f;n.headers?(n.reply?f=`HPUB ${e} ${n.reply} ${c} ${a}\r
152
+ `:f=`HPUB ${e} ${c} ${a}\r
153
+ `,this.sendCommand(f,u,i,ic)):(n.reply?f=`PUB ${e} ${n.reply} ${a}\r
154
+ `:f=`PUB ${e} ${a}\r
155
+ `,this.sendCommand(f,i,ic))}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
156
+ `):this.sendCommand(`SUB ${e.subject} ${e.sid}\r
157
+ `)}_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
158
+ `):this.sendCommand(`UNSUB ${e.sid}\r
159
+ `),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=tr()),this.pongs.push(e),this.outbound.fill(cb),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}${nc}`):e.push(`SUB ${n.subject} ${n.sid}${nc}`)}),e.length&&this.transport.send(wo(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 lb(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 mI="$SRV";class fb{constructor(e){E(this,"msg");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){var a,u;return i=i||{},i.headers=i.headers||Oi(),(a=i.headers)==null||a.set(Ku,`${e}`),(u=i.headers)==null||u.set(Yu,t),this.msg.respond(n,i)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class ko{constructor(e,t="",n=""){E(this,"subject");E(this,"queue");E(this,"srv");t!==""&&gI("service group",t);let i="";if(e instanceof Io)this.srv=e,i="";else if(e instanceof ko){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;xo("endpoint",e);let{subject:i,handler:a,metadata:u,queue:c}=n;i=i||e,c=c||this.queue,yI("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 ko(this,e,t)}}function yI(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 gI(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 Io{constructor(e,t={name:"",version:""}){E(this,"nc");E(this,"_id");E(this,"config");E(this,"handlers");E(this,"internal");E(this,"_stopped");E(this,"_done");E(this,"started");this.nc=e,this.config=Object.assign({},t),this.config.queue||(this.config.queue="q"),xo("name",this.config.name),xo("queue",this.config.queue),Ps(this.config.version),this._id=Is.next(),this.internal=[],this._done=tr(),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()})}static controlSubject(e,t="",n="",i){const a=i??mI;return t===""&&n===""?`${a}.${e}`:(xo("control subject name",t),n!==""?(xo("control subject id",n),`${a}.${e}.${t}.${n}`):`${a}.${e}.${t}`)}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=Oi();if(e instanceof Zu){const n=e;t.set(Yu,n.message),t.set(Ku,`${n.code}`)}else t.set(Yu,e.message),t.set(Ku,"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 vI(i,a,n),c.queue=n;const f=u?(h,d)=>{if(h){this.close(h);return}const y=Date.now();try{u(h,new fb(d))}catch(g){c.stats.countError(g),d==null||d.respond(vn,{headers:this.errorToHeader(g)})}finally{c.stats.countLatency(y)}}: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 d=new Error(`required subscription ${e.subject} errored: ${h.message}`);d.stack=h.stack,this.close(d).catch()}}),c}info(){return{type:_o.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:_o.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=Io.controlSubject(t,i,a),u.handler=n,this.setupHandler(u,!0)}start(){const e=Dn(),t=(u,c)=>u?(this.close(u),Promise.reject(u)):this.stats().then(f=>(c==null||c.respond(e.encode(f)),Promise.resolve())),n=(u,c)=>u?(this.close(u),Promise.reject(u)):(c==null||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(es.PING,a),this.addInternalHandler(es.STATS,t),this.addInternalHandler(es.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:_o.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 ko(this,e,t)}addEndpoint(e,t){return new ko(this).addEndpoint(e,t)}_addEndpoint(e){const t=new Cr;t.noIterator=typeof e.handler=="function",t.noIterator||(e.handler=(i,a)=>{i?this.stop(i).catch():t.push(new fb(a))},t.iterClosed.then(()=>{this.close().catch()}));const n=this.setupHandler(e,!1);return n.qi=t,this.handlers.push(n),t}}class vI{constructor(e,t,n=""){E(this,"name");E(this,"subject");E(this,"average_processing_time");E(this,"num_requests");E(this,"processing_time");E(this,"num_errors");E(this,"last_error");E(this,"data");E(this,"metadata");E(this,"queue");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+=or(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==null?void 0:t.noIterator)===!1&&(this.processing_time=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 bI{constructor(e,t={strategy:ei.JitterTimer,maxWait:2e3},n){E(this,"nc");E(this,"prefix");E(this,"opts");this.nc=e,this.prefix=n,this.opts=t}ping(e="",t=""){return this.q(es.PING,e,t)}stats(e="",t=""){return this.q(es.STATS,e,t)}info(e="",t=""){return this.q(es.INFO,e,t)}async q(e,t="",n=""){const i=new Cr,a=Dn(),u=Io.controlSubject(e,t,n,this.prefix),c=await this.nc.requestMany(u,vn,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 hb(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function wI(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:hb(),storage:Wh.File}}const lc="KV-Operation",db="$KV",_I=/^[-/=.\w]+$/,xI=/^[-/=.>*\w]+$/,SI=/^[-\w]+$/;function EI(r){if(r.startsWith(".")||r.endsWith(".")||!_I.test(r))throw new Error(`invalid key: ${r}`)}function OI(r){if(r.startsWith(".")||r.endsWith(".")||!xI.test(r))throw new Error(`invalid key: ${r}`)}function TI(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 fc(r){if(!SI.test(r))throw new Error(`invalid bucket name: ${r}`)}var ci;(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"})(ci||(ci={}));class Po{constructor(e,t,n){E(this,"js");E(this,"jsm");E(this,"stream");E(this,"bucket");E(this,"direct");E(this,"codec");E(this,"prefix");E(this,"editPrefix");E(this,"useJsPrefix");E(this,"_prefixLen");E(this,"validateKey",EI);E(this,"validateSearchKey",OI);E(this,"hasWildcards",TI);fc(e),this.js=t,this.jsm=n,this.bucket=e,this.prefix=db,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,t,n={}){fc(t);const i=await e.jetstreamManager(),a=new Po(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}};fc(t);const u=new Po(t,e,i);return a.config.name=n.streamName??u.bucketName(),Object.assign(u,a),u.stream=a.config.name,u.codec=n.codec||hb(),u.direct=a.config.allow_direct??!1,u.initializePrefixes(a),u}async init(e={}){const t=Object.assign(wI(),e);this.codec=t.codec;const n={};this.stream=n.name=e.streamName??this.bucketName(),n.retention=Vh.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 y=Object.assign({},e.mirror);y.name.startsWith(ri)||(y.name=`${ri}${y.name}`),n.mirror=y,n.mirror_direct=!0}else if(e.sources){const y=e.sources.map(g=>{const m=Object.assign({},g);m.name.startsWith(ri)||(m.name=`${ri}${m.name}`)});n.sources=y}else n.subjects=[this.subjectForBucket()];e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?rs.S2:rs.None);const a=this.js.nc,u=a.getServerVersion(),c=u?Hh(u,Ps("2.7.2"))>=0:!1;n.discard=c?So.New:So.Old;const{ok:f,min:h}=a.features.get(kt.JS_ALLOW_DIRECT);if(!f&&e.allow_direct===!0){const y=u?`${u.major}.${u.minor}.${u.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${y} - 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=or(t.ttl)),n.allow_rollup_hdrs=!0;let d;try{d=await this.jsm.streams.info(n.name),!d.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(y){if(y.message==="stream not found")d=await this.jsm.streams.add(n);else throw y}this.initializePrefixes(d)}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(ri)&&(n=n.substring(ri.length)),t.external&&t.external.api!==""){const i=t.name.substring(ri.length);this.useJsPrefix=!1,this.prefix=`$KV.${i}`,this.editPrefix=`${t.external.api}.$KV.${n}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${ri}${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}`:`${db}.${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(".")}close(){return Promise.resolve()}dataLen(e,t){const n=t&&t.get(Zr.MessageSizeHdr)||"";return n!==""?parseInt(n,10):e.length}smToEntry(e){return new $I(this.bucket,this.prefixLen,e)}jmToEntry(e){const t=this.decodeKey(e.subject.substring(this.prefixLen));return new BI(this.bucket,t,e)}async create(e,t){var a;let n;try{const u=await this.put(e,t,{previousSeq:0});return Promise.resolve(u)}catch(u){if(n=u,((a=u==null?void 0:u.api_error)==null?void 0:a.err_code)!==10071)return Promise.reject(u)}let i=0;try{const u=await this.get(e);return(u==null?void 0:u.operation)==="DEL"||(u==null?void 0:u.operation)==="PURGE"?(i=u!==null?u.revision:0,this.update(e,t,i)):Promise.reject(n)}catch(u){return Promise.reject(u)}}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={}){var u,c;const i=this.encodeKey(e);this.validateKey(i);const a={};if(n.previousSeq!==void 0){const f=Oi();a.headers=f,f.set(ci.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(i,!0),t,a)).seq}catch(f){const h=f;return h.isJetStreamError()?(h.message=(u=h.api_error)==null?void 0:u.description,h.code=`${(c=h.api_error)==null?void 0:c.code}`,Promise.reject(h)):Promise.reject(f)}}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===pe.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=30*60*1e3){const t=tr(),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=Oi();a.set(lc,t),t==="PURGE"&&a.set(Zr.RollupHdr,Zr.RollupValueSubject),n!=null&&n.previousSeq&&a.set(ci.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`),await this.js.publish(this.subjectForKey(i,!0),vn,{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=mr.LastPerSubject;t===ti.AllHistory&&(u=mr.All),t===ti.UpdatesOnly&&(u=mr.New);let c;return a.length===1&&(c=a[0],a=void 0),Object.assign({deliver_policy:u,ack_policy:Nr.None,filter_subjects:a,filter_subject:c,flow_control:!0,idle_heartbeat:or(5*1e3)},n)}remove(e){return this.purge(e)}async history(e={}){const t=e.key??">",n=new Cr,i={};i.headers_only=e.headers_only||!1;let a;a=()=>{n.stop()};let u=0;const c=this._buildCC(t,ti.AllHistory,i),f=c.filter_subject,h=ns(c);h.bindStream(this.stream),h.orderedConsumer(),h.callback((y,g)=>{if(y){n.stop(y);return}if(g){const m=this.jmToEntry(g);n.push(m),n.received++,(a&&u>0&&n.received>=u||g.info.pending===0)&&(n.push(a),a=void 0)}});const d=await this.js.subscribe(f,h);if(a){const{info:{last:y}}=d,g=y.num_pending+y.delivered.consumer_seq;if(g===0||n.received>=g)try{a()}catch(m){n.stop(m)}finally{a=void 0}else u=g}return n._data=d,n.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{n.stop()}).catch(y=>{n.stop(y)}),n}canSetWatcherName(){const t=this.js.nc,{ok:n}=t.features.get(kt.JS_NEW_CONSUMER_CREATE_API);return n}async watch(e={}){const t=e.key??">",n=new Cr,i={};i.headers_only=e.headers_only||!1;let a=ti.LastValue;e.include===ti.AllHistory?a=ti.AllHistory:e.include===ti.UpdatesOnly&&(a=ti.UpdatesOnly);const u=e.ignoreDeletes===!0;let c=e.initializedFn,f=0;const h=this._buildCC(t,a,i),d=h.filter_subject,y=ns(h);this.canSetWatcherName()&&y.consumerName(Is.next()),y.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&y.startSequence(e.resumeFromRevision),y.orderedConsumer(),y.callback((m,x)=>{if(m){n.stop(m);return}if(x){const T=this.jmToEntry(x);if(u&&T.operation==="DEL")return;n.push(T),n.received++,c&&(f>0&&n.received>=f||x.info.pending===0)&&(n.push(c),c=void 0)}});const g=await this.js.subscribe(d,y);if(c){const{info:{last:m}}=g,x=m.num_pending+m.delivered.consumer_seq;if(x===0||n.received>=x)try{c()}catch(T){n.stop(T)}finally{c=void 0}else f=x}return n._data=g,n.iterClosed.then(()=>{g.unsubscribe()}),g.closed.then(()=>{n.stop()}).catch(m=>{n.stop(m)}),n}async keys(e=">"){const t=new Cr,n=this._buildCC(e,ti.LastValue,{headers_only:!0}),i=Array.isArray(e)?">":n.filter_subject,a=ns(n);a.bindStream(this.stream),a.orderedConsumer();const u=await this.js.subscribe(i,a);return(async()=>{var f;for await(const h of u){const d=(f=h.headers)==null?void 0:f.get(lc);if(d!=="DEL"&&d!=="PURGE"){const y=this.decodeKey(h.subject.substring(this.prefixLen));t.push(y)}h.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(){var a;const t=((a=this.js.nc.info)==null?void 0:a.cluster)??"",n=this.bucketName(),i=await this.jsm.streams.info(n);return new pb(i,t)}}class pb{constructor(e,t=""){E(this,"si");E(this,"cluster");this.si=e,this.cluster=t}get bucket(){return this.si.config.name.startsWith(ri)?this.si.config.name.substring(ri.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 Lh(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(){var e;return((e=this.si.config.placement)==null?void 0:e.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!==rs.None:!1}}const td="OBJ_",mb="SHA-256=";function AI(r){return fc(r),`${td}${r}`}function kI(r){return r.startsWith(td)?r.substring(4):r}class rd{constructor(e){E(this,"si");E(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return kI(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!==rs.None:!1}}function hc(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 Mn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(Mn||(Mn={}));var Ti;(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"})(Ti||(Ti={}));var _a;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(_a||(_a={}));const yb=Uint8Array.of(43,65,67,75),II=Uint8Array.of(45,78,65,75),Co=Uint8Array.of(43,87,80,73),PI=Uint8Array.of(43,78,88,84),CI=Uint8Array.of(43,84,69,82,77),NI=Uint8Array.of(32);function No(r,e=5e3){return new JI(r,e)}class nd extends Cr{constructor(t,n,i=!1){super();E(this,"consumer");E(this,"opts");E(this,"sub");E(this,"monitor");E(this,"pending");E(this,"inbox");E(this,"refilling");E(this,"pong");E(this,"callback");E(this,"timeout");E(this,"cleanupHandler");E(this,"listeners");E(this,"statusIterator");E(this,"forOrderedConsumer");E(this,"resetHandler");E(this,"abortOnMissingResource");E(this,"bind");this.consumer=t;const a=n;this.opts=this.parseOptions(n,i),this.callback=a.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=i,this.timeout=null,this.inbox=Ei(t.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=a.abort_on_missing_resource===!0,this.bind=a.bind===!0,this.start()}start(){const{max_messages:t,max_bytes:n,idle_heartbeat:i,threshold_bytes:a,threshold_messages:u}=this.opts;this.closed().then(f=>{if(this.cleanupHandler)try{this.cleanupHandler(f)}catch{}});const{sub:c}=this;c&&c.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(f,h)=>{var y,g,m,x;if(f){this.stop(f);return}if((y=this.monitor)==null||y.work(),h.subject===this.inbox){if($h(h))return;const T=(g=h.headers)==null?void 0:g.code,w=((x=(m=h.headers)==null?void 0:m.description)==null?void 0:x.toLowerCase())||"unknown",{msgsLeft:S,bytesLeft:A}=this.parseDiscard(h.headers);if(S>0||A>0)this.pending.msgs-=S,this.pending.bytes-=A,this.pending.requests--,this.notify(_a.Discard,{msgsLeft:S,bytesLeft:A});else if(T===400){this.stop(new Ie(w,`${T}`));return}else if(T===409&&w==="consumer deleted"){if(this.notify(Ti.ConsumerDeleted,`${T} ${w}`),!this.refilling||this.abortOnMissingResource){const P=new Ie(w,`${T}`);this.stop(P);return}}else this.notify(_a.DebugEvent,`${T} ${w}`)}else this._push(No(h,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=h.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(t&&this.pending.msgs<=u||n&&this.pending.bytes<=a){const T=this.pullOptions();this.pull(T)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),i&&(this.monitor=new Bh(i,f=>(this.notify(Ti.HeartbeatsMissed,f),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var h;const f=this.consumer.api.nc.status();this.statusIterator=f;for await(const d of f)switch(d.type){case Si.Disconnect:(h=this.monitor)==null||h.cancel();break;case Si.Reconnect:this.resetPending().then(y=>{var g;y&&((g=this.monitor)==null||g.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(t){if(!this.callback)super.push(t);else{const n=typeof t=="function"?t:null;try{n?n():this.callback(t)}catch(i){this.stop(i)}}}notify(t,n){this.listeners.length>0&&this.listeners.forEach(i=>{i.done||i.push({type:t,data:n})})}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(){let t=0,n=0;const i=Mh();let a=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(),t=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(u){if(u.message==="stream not found"){if(n++,this.notify(Ti.StreamNotFound,n),!this.refilling||this.abortOnMissingResource)return this.stop(u),!1}else if(u.message==="consumer not found"){if(t++,this.notify(Ti.ConsumerNotFound,t),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(u),!1;if(this.forOrderedConsumer)return!1}else t=0,n=0;const c=i.backoff(a),f=da(c);await Promise.race([f,this.consumer.api.nc.closed()]),f.cancel(),a++}}}pull(t){this.pending.bytes+=t.max_bytes??0,this.pending.msgs+=t.batch??0,this.pending.requests++;const n=this.consumer.api.nc;this._push(()=>{n.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(t),{reply:this.inbox}),this.notify(_a.Next,t)})}pullOptions(){const t=this.opts.max_messages-this.pending.msgs,n=this.opts.max_bytes-this.pending.bytes,i=or(this.opts.idle_heartbeat),a=or(this.opts.expires);return{batch:t,max_bytes:n,idle_heartbeat:i,expires:a}}parseDiscard(t){const n={msgsLeft:0,bytesLeft:0},i=t==null?void 0:t.get(Zr.PendingMessagesHdr);i&&(n.msgsLeft=parseInt(i));const a=t==null?void 0:t.get(Zr.PendingBytesHdr);return a&&(n.bytesLeft=parseInt(a)),n}trackTimeout(t){this.timeout=t}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var t,n;(t=this.monitor)==null||t.cancel(),this.monitor=null,(n=this.timeout)==null||n.cancel(),this.timeout=null}setCleanupHandler(t){this.cleanupHandler=t}stop(t){var n,i;this.done||((n=this.sub)==null||n.unsubscribe(),this.clearTimers(),(i=this.statusIterator)==null||i.stop(),this._push(()=>{super.stop(t),this.listeners.forEach(a=>{a.stop()})}))}parseOptions(t,n=!1){const i=t||{};if(i.max_messages=i.max_messages||0,i.max_bytes=i.max_bytes||0,i.max_messages!==0&&i.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(i.max_messages===0&&(i.max_messages=100),i.expires=i.expires||3e4,i.expires<1e3)throw new Error("expires should be at least 1000ms");if(i.idle_heartbeat=i.idle_heartbeat||i.expires/2,i.idle_heartbeat=i.idle_heartbeat>3e4?3e4:i.idle_heartbeat,n){const a=Math.round(i.max_messages*.75)||1;i.threshold_messages=i.threshold_messages||a;const u=Math.round(i.max_bytes*.75)||1;i.threshold_bytes=i.threshold_bytes||u}return i}status(){const t=new Cr;return this.listeners.push(t),Promise.resolve(t)}}class RI extends Cr{constructor(){super();E(this,"src");E(this,"listeners");this.listeners=[]}setSource(t){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=t,this.src.setCleanupHandler(n=>{this.stop(n||void 0)}),(async()=>{const n=await this.src.status();for await(const i of n)this.notify(i.type,i.data)})().catch(()=>{})}notify(t,n){this.listeners.length>0&&this.listeners.forEach(i=>{i.done||i.push({type:t,data:n})})}stop(t){var n;this.done||((n=this.src)==null||n.stop(t),super.stop(t),this.listeners.forEach(i=>{i.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const t=new Cr;return this.listeners.push(t),Promise.resolve(t)}}class gb{constructor(e,t){E(this,"api");E(this,"_info");E(this,"stream");E(this,"name");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 nd(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const t=new nd(this,e,!1),n=Math.round(t.opts.expires*1.05),i=ha(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=tr(),n=e;n.max_messages=1;const i=new nd(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===Ti.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=ha(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 DI{constructor(e,t,n={}){E(this,"api");E(this,"consumerOpts");E(this,"consumer");E(this,"opts");E(this,"cursor");E(this,"stream");E(this,"namePrefix");E(this,"serial");E(this,"currentConsumer");E(this,"userCallback");E(this,"iter");E(this,"type");E(this,"startSeq");this.api=e,this.stream=t,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Is.next(),typeof n.name_prefix=="string"&&(tc("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=Mn.Unset,this.consumerOpts=n,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:mr.StartSequence,opt_start_seq:e,ack_policy:Nr.None,inactive_threshold:or(5*60*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||mr.StartSequence,(this.consumerOpts.deliver_policy===mr.LastPerSubject||this.consumerOpts.deliver_policy===mr.New||this.consumerOpts.deliver_policy===mr.Last)&&(delete n.opt_start_seq,n.deliver_policy=this.consumerOpts.deliver_policy),n.deliver_policy===mr.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=mr.StartTime,n.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(n.inactive_threshold=or(this.consumerOpts.inactive_threshold))),n}async resetConsumer(e=0){var a,u,c,f;(a=this.consumer)==null||a.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const t=this.getConsumerOpts(e);t.max_deliver=1,t.mem_storage=!0;const n=Mh();let i;for(let h=0;;h++)try{i=await this.api.add(this.stream,t),(u=this.iter)==null||u.notify(Ti.OrderedConsumerRecreated,i.name);break}catch(d){if(d.message==="stream not found"&&((c=this.iter)==null||c.notify(Ti.StreamNotFound,h),this.type===Mn.Fetch||this.opts.abort_on_missing_resource===!0))return(f=this.iter)==null||f.stop(d),Promise.reject(d);if(e===0&&h>=30)throw d;await da(n.backoff(h+1))}return i}internalHandler(e){return t=>{var i;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):(i=this.iter)==null||i.push(t)}}async reset(e={max_messages:100,expires:3e4},t){var f,h;t=t||{};const n=t.fromFetch||!1,i=t.orderedReset||!1;if(this.type===Mn.Fetch&&i){(f=this.iter)==null||f.src.stop(),await((h=this.iter)==null?void 0:h.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 RI),this.consumer=new gb(this.api,this.currentConsumer);const a=e;a.callback=this.internalHandler(this.serial);let u=null;this.type===Mn.Fetch&&n?u=await this.consumer.fetch(e):this.type===Mn.Consume&&(u=await this.consumer.consume(e));const c=u;c.forOrderedConsumer=!0,c.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(c)}notifyOrderedResetAndReset(){var e;(e=this.iter)==null||e.notify(_a.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===Mn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Mn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:n}=e;return n&&(this.userCallback=n),this.type=Mn.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){var i;if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===Mn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((i=this.iter)==null?void 0:i.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=Mn.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=tr();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.serial),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class vb{constructor(e){E(this,"api");E(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(kt.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}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 gb(this.api,n)).catch(n=>Promise.reject(n)))}async ordered(e,t){await this.checkVersion();const n=this.api;return new id(n.nc,n.opts).info(e).then(a=>Promise.resolve(new DI(this.api,e,t))).catch(a=>Promise.reject(a))}}class dc{constructor(e,t){E(this,"api");E(this,"_info");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 dc(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))}getConsumer(e){return new vb(new Qh(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 id extends Oo{constructor(e,t){super(e,t)}checkStreamConfigVersions(e){const t=this.nc;if(e.metadata){const{min:i,ok:a}=t.features.get(kt.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(kt.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(kt.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(kt.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(kt.JS_DEFAULT_CONSUMER_LIMITS);if(!a)throw new Error(`stream 'consumer_limits' requires server ${i}`)}function n(i,a){var c;if((((c=a.subject_transforms)==null?void 0:c.length)||0)>0){const{min:f,ok:h}=t.features.get(kt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!h)throw new Error(`${i} 'subject_transforms' requires server ${f}`)}}e.sources&&e.sources.forEach(i=>{n("stream sources",i)}),e.mirror&&n("stream mirror",e.mirror)}async add(e={}){var i;this.checkStreamConfigVersions(e),Kr(e.name),e.mirror=hc(e.mirror),e.sources=(i=e.sources)==null?void 0:i.map(hc);const n=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(n),n}async delete(e){return Kr(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,t={}){var c;if(typeof e=="object"){const f=e;e=f.name,t=f,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),Kr(e);const n=await this.info(e),i=Object.assign(n.config,t);i.mirror=hc(i.mirror),i.sources=(c=i.sources)==null?void 0:c.map(hc);const u=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,i);return this._fixInfo(u),u}async info(e,t){Kr(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],d=t||{};let y=0;for(;u>f;){y++,d.offset=c*y;const m=await this._request(n,d);u=m.total,h.push(m);const x=Object.getOwnPropertyNames(m.state.subjects).length;if(f+=x,x<c)break}let g={};for(let m=0;m<h.length;m++)a=h[m],a.state.subjects&&(g=Object.assign(g,a.state.subjects));a.offset=0,a.total=0,a.limit=0,a.state.subjects=g}return this._fixInfo(a),a}list(e=""){const t=e!=null&&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 To(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 Kr(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,t)}async deleteMessage(e,t,n=!0){Kr(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){Kr(e);const i=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,t);return new bb(i)}find(e){return this.findStream(e)}listKvs(){const e=n=>{var f;const a=n.streams.filter(h=>h.config.name.startsWith(ri));a.forEach(h=>{this._fixInfo(h)});let u="";return a.length&&(u=((f=this.nc.info)==null?void 0:f.cluster)??""),a.map(h=>new pb(h,u))},t=`${this.prefix}.STREAM.LIST`;return new To(t,e,this)}listObjectStores(){const e=n=>{const a=n.streams.filter(c=>c.config.name.startsWith(td));return a.forEach(c=>{this._fixInfo(c)}),a.map(c=>new rd(c))},t=`${this.prefix}.STREAM.LIST`;return new To(t,e,this)}names(e=""){const t=e!=null&&e.length?{subject:e}:{},n=a=>a.streams,i=`${this.prefix}.STREAM.NAMES`;return new To(i,n,this,t)}async get(e){const t=await this.info(e);return Promise.resolve(new dc(this,t))}}class FI extends Oo{constructor(e,t){super(e,t)}async getMessage(e,t){Kr(e);let n=t;const{last_by_subj:i}=n;i&&(n=null);const a=n?this.jc.encode(n):vn,u=this.opts.apiPrefix||"$JS.API",c=i?`${u}.DIRECT.GET.${e}.${i}`:`${u}.DIRECT.GET.${e}`,f=await this.nc.request(c,a),h=ma(f);if(h)return Promise.reject(h);const d=new sd(f);return Promise.resolve(d)}async getBatch(e,t){Kr(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 Cr,c=await this.nc.requestMany(i,a,{strategy:ei.SentinelMsg});return(async()=>{var y,g,m;let f=!1,h=!1,d;for await(const x of c){if(!f){f=!0;const T=((y=x.headers)==null?void 0:y.code)||0;if(T!==0&&T<200||T>299){d=(g=x.headers)==null?void 0:g.description.toLowerCase();break}if(((m=x.headers)==null?void 0:m.get("Nats-Num-Pending"))===""){h=!0;break}}if(x.data.length===0)break;u.push(new sd(x))}u.push(()=>{if(h)throw new Error("batch direct get not supported by the server");if(d)throw new Error(`bad request: ${d}`);u.stop()})})(),Promise.resolve(u)}}class sd{constructor(e){E(this,"data");E(this,"header");if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(ga.Subject)}get seq(){const e=this.header.last(ga.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(ga.TimeStamp)}get stream(){return this.header.last(ga.Stream)}json(e){return Dn(e).decode(this.data)}string(){return on.decode(this.data)}}E(sd,"jc");class MI extends Oo{constructor(t,n){super(t,n);E(this,"streams");E(this,"consumers");E(this,"direct");this.streams=new id(t,n),this.consumers=new Qh(t,n),this.direct=new FI(t,n)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const t=new Cr;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(n,i)=>{if(n)throw n;try{const a=this.parseJsResponse(i),u=a.type.split("."),c=u[u.length-1];t.push({kind:c,data:a})}catch(a){t.stop(a)}}}),t}}class bb{constructor(e){E(this,"_header");E(this,"smr");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):vn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=ts.decode(e)}else this._header=Oi();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 Dn(e).decode(this.data)}string(){return on.decode(this.data)}}E(bb,"jc");class LI{constructor(e){E(this,"api");this.api=e}get(e){return this.api.info(e).then(t=>new dc(this.api,t))}}class ad{constructor(e){E(this,"info");E(this,"hdrs");this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=ts.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(){var e,t;return((e=this.info.options)==null?void 0:e.link)!==void 0&&((t=this.info.options)==null?void 0:t.link)!==null}}function wb(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 qI(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Ro{constructor(e,t,n){E(this,"jsm");E(this,"js");E(this,"stream");E(this,"name");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 ad(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=Dn().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 rd(e)))}async status(e){const t=await this._si(e);return t===null?Promise.reject(new Error("object store not found")):Promise.resolve(new rd(t))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,t,n){var F;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,c=this.js.nc.info,f=(c==null?void 0:c.max_payload)||1024;e=e||{},e.options=e.options||{};let h=((F=e.options)==null?void 0:F.max_chunk_size)||128*1024;h=h>f?f:h,e.options.max_chunk_size=h;const d=await this.info(e.name),{name:y,error:g}=this._checkNotEmpty(e.name);if(g)return Promise.reject(g);const m=Is.next(),x=this._chunkSubject(m),T=this._metaSubject(y),w=Object.assign({bucket:this.name,nuid:m,size:0,chunks:0},wb(e)),S=tr(),A=[],P=new va;try{const L=t?t.getReader():null,$=new G0;for(;;){const{done:X,value:te}=L?await L.read():{done:!0,value:void 0};if(X){if(P.size()>0){const Ge=P.drain();$.update(Ge),w.chunks++,w.size+=Ge.length,A.push(this.js.publish(x,Ge,{timeout:a}))}await Promise.all(A),A.length=0,w.mtime=new Date().toISOString();const he=$.digest("base64"),de=he.length%3,Ve=de>0?"=".repeat(de):"";w.digest=`${mb}${he}${Ve}`,w.deleted=!1;const Ae=Oi();typeof u=="number"&&Ae.set(ci.ExpectedLastSubjectSequenceHdr,`${u}`),Ae.set(Zr.RollupHdr,Zr.RollupValueSubject);const je=await this.js.publish(T,Dn().encode(w),{headers:Ae,timeout:a});if(w.revision=je.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}S.resolve(new ad(w));break}if(te)for(P.fill(te);P.size()>h;){w.chunks++,w.size+=h;const he=P.drain(e.options.max_chunk_size);$.update(he),A.push(this.js.publish(x,he,{timeout:a}))}}}catch(L){await this.jsm.streams.purge(this.stream,{filter:x}),S.reject(L)}return S}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){var i;return(i=e==null?void 0:e.options)!=null&&i.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 va,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 d=t.options.link.name||"";if(d==="")throw new Error("link is a bucket");return(t.options.link.bucket!==this.name?await Ro.create(this.js,t.options.link.bucket):this).get(d)}const n=tr(),i={info:new ad(t),error:n};if(t.size===0)return i.data=qI(),n.resolve(null),Promise.resolve(i);let a;const u=ns();u.orderedConsumer();const c=new G0,f=`$O.${this.name}.C.${t.nuid}`,h=await this.js.subscribe(f,u);return(async()=>{for await(const d of h)if(d.data.length>0&&(c.update(d.data),a.enqueue(d.data)),d.info.pending===0){const y=c.digest("base64"),g=y.length%3,m=g>0?"=".repeat(g):"",x=`${mb}${y}${m}`;x!==t.digest?a.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${x}`)):a.close(),h.unsubscribe()}})().then(()=>{n.resolve()}).catch(d=>{a.error(d),n.reject(d)}),i.data=new ReadableStream({start(d){a=d},cancel(){h.unsubscribe()}}),i}linkStore(e,t){if(!(t instanceof Ro))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=Dn(),i=Oi();return i.set(Zr.RollupHdr,Zr.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,wb(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 Cr,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=Dn(),u=ns();u.orderedConsumer(),e.includeHistory?u.deliverLastPerSubject():(t=!0,u.deliverNew()),u.callback((f,h)=>{var d;if(f){n.stop(f);return}if(h!==null){const y=a.decode(h.data);y.deleted&&e.ignoreDeletes===!0||n.push(y),((d=h.info)==null?void 0:d.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.${Eo.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=AI(this.name)}catch(i){return Promise.reject(i)}const t=(e==null?void 0:e.ttl)||0;delete e.ttl;const n=Object.assign({max_age:t},e);n.name=this.stream,n.allow_direct=!0,n.allow_rollup_hdrs=!0,n.discard=So.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?rs.S2:rs.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 Ro(t,i,e);return await a.init(n),Promise.resolve(a)}}class jI{constructor(e){E(this,"js");this.js=e}kv(e,t={}){const n=this.js,{ok:i,min:a}=n.nc.features.get(kt.JS_KV);return i?t.bindOnly?Po.bind(this.js,e,t):Po.create(this.js,e,t):Promise.reject(new Error(`kv is only supported on servers ${a} or better`))}os(e,t={}){var u;if(typeof((u=crypto==null?void 0:crypto.subtle)==null?void 0:u.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(kt.JS_OBJECTSTORE);return i?Ro.create(this.js,e,t):Promise.reject(new Error(`objectstore is only supported on servers ${a} or better`))}}class od extends Oo{constructor(t,n){super(t,n);E(this,"consumers");E(this,"streams");E(this,"consumerAPI");E(this,"streamAPI");this.consumerAPI=new Qh(t,n),this.streamAPI=new id(t,n),this.consumers=new vb(this.consumerAPI),this.streams=new LI(this.streamAPI)}jetstreamManager(t){t===void 0&&(t=this.opts.checkAPI);const n=Object.assign({},this.opts,{checkAPI:t});return this.nc.jetstreamManager(n)}get apiPrefix(){return this.prefix}get views(){return new jI(this)}async publish(t,n=vn,i){i=i||{},i.expect=i.expect||{};const a=(i==null?void 0:i.headers)||Oi();i&&(i.msgID&&a.set(ci.MsgIdHdr,i.msgID),i.expect.lastMsgID&&a.set(ci.ExpectedLastMsgIdHdr,i.expect.lastMsgID),i.expect.streamName&&a.set(ci.ExpectedStreamHdr,i.expect.streamName),typeof i.expect.lastSequence=="number"&&a.set(ci.ExpectedLastSeqHdr,`${i.expect.lastSequence}`),typeof i.expect.lastSubjectSequence=="number"&&a.set(ci.ExpectedLastSubjectSequenceHdr,`${i.expect.lastSubjectSequence}`));const u=i.timeout||this.timeout,c={};u&&(c.timeout=u),i&&(c.headers=a);let{retries:f,retry_delay:h}=i;f=f||1,h=h||250;let d;for(let g=0;g<f;g++)try{d=await this.nc.request(t,n,c);break}catch(m){if(m.code==="503"&&g+1<f)await da(h);else throw m}const y=this.parseJsResponse(d);if(y.stream==="")throw Ie.errorForCode(pe.JetStreamInvalidAck);return y.duplicate=y.duplicate?y.duplicate:!1,y}async pull(t,n,i=0){Kr(t),pa(n);let a=this.timeout;i>a&&(a=i),i=i<0?0:or(i);const u={batch:1,no_wait:i===0,expires:i},c=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`,this.jc.encode(u),{noMux:!0,timeout:a}),f=ma(c);if(f)throw f;return No(c,this.timeout)}fetch(t,n,i={}){Kr(t),pa(n);let a=null;const u=(i.max_bytes??0)>0;let c=0;const f=u?i.max_bytes:0;let h=null;const d={};if(d.batch=i.batch||1,f){const A=this.nc.features.get(kt.JS_PULL_MAX_BYTES);if(!A.ok)throw new Error(`max_bytes is only supported on servers ${A.min} or better`);d.max_bytes=f}d.no_wait=i.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const y=i.expires||0;if(y&&(d.expires=or(y)),y===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const g=i.idle_heartbeat||0;g&&(d.idle_heartbeat=or(g),i.delay_heartbeat===!0&&(d.idle_heartbeat=or(g*4)));const m=new Cr,x=d.batch;let T=0;m.protocolFilterFn=(A,P=!1)=>$h(A.msg)?(h==null||h.work(),!1):!0,m.dispatchedFn=A=>{if(A){if(u&&(c+=A.data.length),T++,a&&A.info.pending===0)return;(m.getPending()===1&&A.info.pending===0||x===T||f>0&&c>=f)&&m.stop()}};const w=Ei(this.nc.options.inboxPrefix),S=this.nc.subscribe(w,{max:i.batch,callback:(A,P)=>{A===null&&(A=ma(P)),A!==null?(a&&(a.cancel(),a=null),JA(A)?m.stop(xb(A)===null?void 0:A):m.stop(A)):(h==null||h.work(),m.received++,m.push(No(P,this.timeout)))}});return y&&(a=ha(y),a.catch(()=>{S.isClosed()||(S.drain().catch(()=>{}),a=null),h&&h.cancel()})),(async()=>{try{g&&(h=new Bh(g,A=>(m.push(()=>{m.err=new Ie(`${Fn.IdleHeartbeatMissed}: ${A}`,pe.JetStreamIdleHeartBeat)}),!0)))}catch{}await S.closed,a!==null&&(a.cancel(),a=null),h&&h.cancel(),m.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`,this.jc.encode(d),{reply:w}),m}async pullSubscribe(t,n=ns()){const i=await this._processOptions(t,n);if(i.ordered)throw new Error("pull subscribers cannot be be ordered");if(i.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const a=i.config.ack_policy;if(a===Nr.None||a===Nr.All)throw new Error("ack policy for pull consumers must be explicit");const u=this._buildTypedSubscriptionOpts(i),c=new VI(this,i.deliver,u);c.info=i;try{await this._maybeCreateConsumer(i)}catch(f){throw c.unsubscribe(),f}return c}async subscribe(t,n=ns()){const i=await this._processOptions(t,n);if(!i.isBind&&!i.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const a=this._buildTypedSubscriptionOpts(i),u=new _b(this,i.deliver,a);u.info=i;try{await this._maybeCreateConsumer(i)}catch(c){throw u.unsubscribe(),c}return u._maybeSetupHbMonitoring(),u}async _processOptions(t,n=ns()){const i=W0(n)?n.getOpts():n;if(i.isBind=W0(n)?n.isBind:!1,i.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},i.ordered){if(i.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},i.config.ack_policy!==Nr.NotSet&&i.config.ack_policy!==Nr.None)throw new Ie("ordered consumer: ack_policy can only be set to 'none'",pe.ApiError);if(i.config.durable_name&&i.config.durable_name.length>0)throw new Ie("ordered consumer: durable_name cannot be set",pe.ApiError);if(i.config.deliver_subject&&i.config.deliver_subject.length>0)throw new Ie("ordered consumer: deliver_subject cannot be set",pe.ApiError);if(i.config.max_deliver!==void 0&&i.config.max_deliver>1)throw new Ie("ordered consumer: max_deliver cannot be set",pe.ApiError);if(i.config.deliver_group&&i.config.deliver_group.length>0)throw new Ie("ordered consumer: deliver_group cannot be set",pe.ApiError);i.config.deliver_subject=Ei(this.nc.options.inboxPrefix),i.config.ack_policy=Nr.None,i.config.max_deliver=1,i.config.flow_control=!0,i.config.idle_heartbeat=i.config.idle_heartbeat||or(5e3),i.config.ack_wait=or(22*60*60*1e3),i.config.mem_storage=!0,i.config.num_replicas=1}if(i.config.ack_policy===Nr.NotSet&&(i.config.ack_policy=Nr.All),i.api=this,i.config=i.config||{},i.stream=i.stream?i.stream:await this.findStream(t),i.attached=!1,i.config.durable_name)try{const a=await this.consumerAPI.info(i.stream,i.config.durable_name);if(a){if(a.config.filter_subject&&a.config.filter_subject!==t)throw new Error("subject does not match consumer");const u=i.config.deliver_group??"";if(u===""&&a.push_bound===!0)throw new Error("duplicate subscription");const c=a.config.deliver_group??"";if(u!==c)throw c===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${c}'`);i.last=a,i.config=a.config,i.attached=!0,i.config.durable_name||(i.name=a.name)}}catch(a){if(a.code!=="404")throw a}return!i.attached&&i.config.filter_subject===void 0&&i.config.filter_subjects===void 0&&(i.config.filter_subject=t),i.deliver=i.config.deliver_subject||Ei(this.nc.options.inboxPrefix),i}_buildTypedSubscriptionOpts(t){const n={};return n.adapter=WI(t.callbackFn===void 0,this.timeout),n.ingestionFilterFn=od.ingestionFn(t.ordered),n.protocolFilterFn=(i,a=!1)=>{const u=i;return Uh(u.msg)?(a||u.msg.respond(),!1):!0},!t.mack&&t.config.ack_policy!==Nr.None&&(n.dispatchedFn=QI),t.callbackFn&&(n.callback=t.callbackFn),n.max=t.max||0,n.queue=t.queue,n}async _maybeCreateConsumer(t){if(t.attached)return;if(t.isBind)throw new Error(`unable to bind - durable consumer ${t.config.durable_name} doesn't exist in ${t.stream}`);t.config=Object.assign({deliver_policy:mr.All,ack_policy:Nr.Explicit,ack_wait:or(30*1e3),replay_policy:ya.Instant},t.config);const n=await this.consumerAPI.add(t.stream,t.config);if(Array.isArray(t.config.filter_subjects&&!Array.isArray(n.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");t.name=n.name,t.config=n.config,t.last=n}static ingestionFn(t){return(n,i)=>{var f;const a=i;if(!n)return{ingest:!1,protocol:!1};const u=n;if(ma(u.msg)||(f=a.monitor)==null||f.work(),$h(u.msg)){const h=t?a._checkHbOrderConsumer(u.msg):!0;return t||a.info.flow_control.heartbeat_count++,{ingest:h,protocol:!0}}else if(Uh(u.msg))return a.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:t?a._checkOrderedConsumer(n):!0,protocol:!1}}}}class ud{constructor(e){E(this,"options");E(this,"protocol");E(this,"draining");E(this,"listeners");E(this,"_services");this.draining=!1,this.options=uI(e),this.listeners=[]}static connect(e={}){return new Promise((t,n)=>{const i=new ud(e);cc.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 Ie.errorForCode(pe.ConnectionClosed);if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw Ie.errorForCode(pe.ConnectionDraining);if(e=e||"",e.length===0)throw Ie.errorForCode(pe.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 lb(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=vn,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||ei.Timer,n.maxWait=n.maxWait||1e3,n.maxWait<1)return Promise.reject(new Ie("timeout",pe.InvalidOption));const a=new Cr;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 d=this.subscribe(Ei(this.options.inboxPrefix),{callback:(x,T)=>{var w,S;if(((w=T==null?void 0:T.data)==null?void 0:w.length)===0&&((S=T==null?void 0:T.headers)==null?void 0:S.status)===pe.NoResponders&&(x=Ie.errorForCode(pe.NoResponders)),x){f&&(x.stack+=`
160
+
161
+ ${f}`),y(x);return}c(null,T),n.strategy===ei.Count&&(h--,h===0&&y()),n.strategy===ei.JitterTimer&&(m(),g=setTimeout(()=>{y()},300)),n.strategy===ei.SentinelMsg&&T&&T.data.length===0&&y()}});d.requestSubject=e,d.closed.then(()=>{u()}).catch(x=>{a.stop(x)});const y=x=>{x&&a.push(()=>{throw x}),m(),d.drain().then(()=>{u()}).catch(T=>{u()})};a.iterClosed.then(()=>{m(),d==null||d.unsubscribe()}).catch(x=>{m(),d==null||d.unsubscribe()});try{this.publish(e,t,{reply:d.getSubject()})}catch(x){y(x)}let g=setTimeout(()=>{y()},n.maxWait);const m=()=>{g&&clearTimeout(g)}}else{const f=n;f.callback=c,a.iterClosed.then(()=>{h.cancel()}).catch(d=>{h.cancel(d)});const h=new dk(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(d){h.cancel(d)}}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 Ie("timeout",pe.InvalidOption));if(!n.noMux&&n.reply)return Promise.reject(new Ie("reply can only be used with noMux",pe.InvalidOption));if(n.noMux){const a=n.reply?n.reply:Ei(this.options.inboxPrefix),u=tr(),c=i?new Error:null,f=this.subscribe(a,{max:1,timeout:n.timeout,callback:(h,d)=>{h?(c&&h.code!==pe.Timeout&&(h.stack+=`
162
+
163
+ ${c.stack}`),f.unsubscribe(),u.reject(h)):(h=U0(d),h?(c&&(h.stack+=`
164
+
165
+ ${c.stack}`),u.reject(h)):u.resolve(d))}});return f.requestSubject=e,this.protocol.publish(e,t,{reply:a,headers:n.headers}),u}else{const a=new Y0(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(Ie.errorForCode(pe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ie.errorForCode(pe.ConnectionClosed)):this.isDraining()?Promise.reject(Ie.errorForCode(pe.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 Cr;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 MI(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===pe.NoResponders&&(i.code=pe.JetStreamNotEnabled),i}return t}jetstream(e={}){return new od(this,e)}getServerVersion(){const e=this.info;return e?Ps(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ie.errorForCode(pe.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 UI(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ie.errorForCode(pe.ConnectionClosed)):this.isDraining()?Promise.reject(Ie.errorForCode(pe.ConnectionDraining)):this.protocol.reconnect()}}class UI{constructor(e){E(this,"nc");this.nc=e}add(e){try{return new Io(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new bI(this.nc,e,t)}}class $I{constructor(e,t,n){E(this,"bucket");E(this,"sm");E(this,"prefixLen");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(lc)||"PUT"}get length(){const e=this.sm.header.get(Zr.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class BI{constructor(e,t,n){E(this,"bucket");E(this,"key");E(this,"sm");this.bucket=e,this.key=t,this.sm=n}get value(){return this.sm.data}get created(){return new Date(Lh(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(lc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var t;const e=((t=this.sm.headers)==null?void 0:t.get(Zr.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class _b extends gk{constructor(t,n,i){super(t.nc,n,i);E(this,"js");E(this,"monitor");this.js=t,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(t){this.sub.info=t}get info(){return this.sub.info}_resetOrderedConsumer(t){if(this.info===null||this.sub.isClosed())return;const n=Ei(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,n);const a=this.info;a.config.name=Is.next(),a.ordered_consumer_sequence.delivery_seq=0,a.flow_control.heartbeat_count=0,a.flow_control.fc_count=0,a.flow_control.consumer_restarts++,a.deliver=n,a.config.deliver_subject=n,a.config.deliver_policy=mr.StartSequence,a.config.opt_start_seq=t;const u={};u.stream_name=this.info.stream,u.config=a.config;const c=`${a.api.prefix}.CONSUMER.CREATE.${a.stream}`;this.js._request(c,u,{retries:-1}).then(f=>{const h=f,d=this.sub.info;d.last=h,this.info.config=h.config,this.info.name=h.name}).catch(f=>{const h=new Ie(`unable to recreate ordered consumer ${a.stream} at seq ${t}`,pe.RequestError,f);this.sub.callback(h,{})})}_maybeSetupHbMonitoring(){var n,i;const t=((i=(n=this.info)==null?void 0:n.config)==null?void 0:i.idle_heartbeat)||0;t&&this._setupHbMonitoring(Lh(t))}_setupHbMonitoring(t,n=0){const i={cancelAfter:0,maxOut:2};n&&(i.cancelAfter=n);const a=this.sub,u=c=>{var d,y,g,m;const f=XA(409,`${Fn.IdleHeartbeatMissed}: ${c}`,this.sub.subject);if(!((d=this.info)==null?void 0:d.ordered))this.sub.callback(null,f);else{if(!this.js.nc.protocol.connected)return!1;const x=((g=(y=this.info)==null?void 0:y.ordered_consumer_sequence)==null?void 0:g.stream_seq)||0;return this._resetOrderedConsumer(x+1),(m=this.monitor)==null||m.restart(),!1}return!a.noIterator};this.monitor=new Bh(t,u,i)}_checkHbOrderConsumer(t){const n=t.headers.get(Zr.ConsumerStalledHdr);n!==""&&this.js.nc.publish(n);const i=parseInt(t.headers.get(Zr.LastConsumerSeqHdr),10),a=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,i!==a.delivery_seq&&this._resetOrderedConsumer(a.stream_seq+1),!1}_checkOrderedConsumer(t){const n=this.info.ordered_consumer_sequence,i=t.info.streamSequence,a=t.info.deliverySequence;return a!=n.delivery_seq+1?(this._resetOrderedConsumer(n.stream_seq+1),!1):(n.delivery_seq=a,n.stream_seq=i,!0)}async destroy(){this.isClosed()||await this.drain();const t=this.sub.info,n=t.config.durable_name||t.name,i=`${t.api.prefix}.CONSUMER.DELETE.${t.stream}.${n}`;await t.api._request(i)}async consumerInfo(){const t=this.sub.info,n=t.config.durable_name||t.name,i=`${t.api.prefix}.CONSUMER.INFO.${t.stream}.${n}`,a=await t.api._request(i);return t.last=a,a}}class VI extends _b{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(kt.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=or(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=or(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,d=`${h.prefix}.CONSUMER.MSG.NEXT.${t}.${a}`,y=this.sub.subject;h.nc.publish(d,h.jc.encode(u),{reply:y})}}}function WI(r,e){return r?HI(e):zI(e)}function zI(r){return(e,t)=>e?[e,null]:(e=ma(t),e?[e,null]:[null,No(t,r)])}function HI(r){return(e,t)=>{if(e)return[e,null];const n=ma(t);return n!==null?[xb(n),null]:[null,No(t,r)]}}function xb(r){if(r!==null)switch(r.code){case pe.JetStream404NoMessages:case pe.JetStream408RequestTimeout:return null;case pe.JetStream409:return ek(r)?r:null;default:return r}return null}function QI(r){r&&r.ack()}function GI(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.redeliveryCount=parseInt(e[6],10),t.redelivered=t.redeliveryCount>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 JI{constructor(e,t){E(this,"msg");E(this,"di");E(this,"didAck");E(this,"timeout");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=GI(this.reply)),this.di}get redelivered(){return this.info.redeliveryCount>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]===Co[0]&&e[1]===Co[1]&&e[2]===Co[2]&&e[3]===Co[3]}async ackAck(e){var n;e=e||{},e.timeout=e.timeout||this.timeout;const t=tr();if(this.didAck)t.resolve(!1);else if(this.didAck=!0,this.msg.reply){const a=this.msg.publisher,u=!((n=a.options)!=null&&n.noAsyncTraces),c=new Y0(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,yb,{reply:`${a.muxSubscriptions.baseInbox}${c.token}`})}catch(f){c.cancel(f)}try{await Promise.race([c.timer,c.deferred]),t.resolve(!0)}catch(f){c.cancel(f),t.reject(f)}}else t.resolve(!1);return t}ack(){this.doAck(yb)}nak(e){let t=II;e&&(t=j0().encode(`-NAK ${JSON.stringify({delay:or(e)})}`)),this.doAck(t)}working(){this.doAck(Co)}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=or(t.expires));const i=Dn().encode(n),a=va.concat(PI,NI,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=CI;(e==null?void 0:e.length)>0&&(t=j0().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const YI="1.29.0",KI="nats.ws";class ZI{constructor(){E(this,"version");E(this,"lang");E(this,"closeError");E(this,"connected");E(this,"done");E(this,"socket");E(this,"options");E(this,"socketClosed");E(this,"encrypted");E(this,"peeked");E(this,"yields");E(this,"signal");E(this,"closedNotification");this.version=YI,this.lang=KI,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=tr(),this.closedNotification=tr()}async connect(e,t){const n=tr();if(t.tls)return n.reject(new Ie("tls",pe.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=va.concat(...this.yields),c=Sk(u);if(c!==""){const f=fI.exec(c);if(!f){t.debug&&console.error("!!!",ec(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);cI(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 Ie(u.message,pe.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 da(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(`> ${ec(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=tr())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${ec(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${ec(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function XI(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 eP(r={}){return vk({defaultPort:443,urlParseFn:XI,factory:()=>new ZI}),ud.connect(r)}const Sb=["new","last","last_per_subject"],tP=async(r,e)=>(console.info(`Connecting to server ${r}`),await eP({servers:[r],authenticator:iI(new TextEncoder().encode(e))}));async function*rP(r){const e=Dn();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Eb=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},Ob={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]"},nP={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},iP=(r,e,t)=>{if(!Ob[r])throw new Error("Unknown stream name");const n=Ob[r].split(".");let i="";return n.forEach((a,u)=>{switch(a){case"[location-ref]":i+="."+e;break;case"[machine-ref]":i+="."+((t==null?void 0:t.machineRef)||"*");break;case"[qualifier]":i+="."+((t==null?void 0:t.qualifier)||"0");break;case"[data-category]":i+="."+(nP[t==null?void 0:t.dataCategory]||"*");break;case"[metric-key]":i+="."+(t!=null&&t.metricKey?t==null?void 0:t.metricKey.toLowerCase().replace(/[^a-zA-Z0-9_\\-]/gi,"-"):"*");break;case"[message-type]":i+="."+((t==null?void 0:t.messageType)||"0");break;case"[edge-ref]":i+="."+((t==null?void 0:t.edgeRef)||"*");break;case"[service-name]":i+="."+((t==null?void 0:t.serviceName)||"*");break;case"[machine-source-ref]":i+="."+((t==null?void 0:t.machineSourceRef)||"*");break;default:u>0&&(i+="."),i+=a;break}}),i},sP=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Sb.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Sb.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=Xn(),f=ve.useRef(),h=ve.useRef();return ve.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await tP(u.natsUrl,c.current);f.current=y;const g=iP(e,t,n==null?void 0:n[0]);console.info(`Consuming events from stream ${e} filtering by subject ${g}`);const x=await(await y.jetstream().consumers.get(e,{deliver_policy:i,filterSubjects:g})).consume({max_messages:1e3}),T=rP(x);if(h.current=T,typeof a=="function")for await(const w of T)a(w)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Eb(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Eb(h,f)]},aP=({href:r,children:e,...t})=>{const{isEmbedded:n,navigateParent:i}=ve.useContext(I0);return Mr.jsx("a",{...t,href:r,onClick:a=>{!n||a.metaKey||a.ctrlKey||a.shiftKey||(a.preventDefault(),a.stopPropagation(),i(r))},children:e})};jt.Link=aP,jt.MMProvider=BA,jt.PrivateLayout=FT,jt._useMMApolloLinkContext=DT,jt.useApiRequest=Pv,jt.useAsyncEffect=yo,jt.useAsyncInterval=go,jt.useDowntimeQuery=CT,jt.useEventStream=sP,jt.useMMAuth=Xn,jt.useMMHash=RT,jt.useMMTemplates=NT,jt.useProductionQuery=IT,jt.useQuantityStream=PT,jt.useThrottleEffect=kT,Object.defineProperty(jt,Symbol.toStringTag,{value:"Module"})});