@machinemetrics/mm-react-tools 3.2.4-0 → 3.2.5-0

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.
@@ -22771,12 +22771,13 @@ const sl = Ms.createContext(), _F = () => {
22771
22771
  S,
22772
22772
  T
22773
22773
  ]);
22774
- const W = (te) => {
22774
+ const W = (te, ge) => {
22775
22775
  !f && !r || window.parent.postMessage(
22776
22776
  {
22777
22777
  type: "set-path",
22778
22778
  instanceId: g,
22779
- path: te
22779
+ path: te,
22780
+ ...ge
22780
22781
  },
22781
22782
  d
22782
22783
  );
@@ -31396,21 +31397,23 @@ const xb = (r, e) => {
31396
31397
  h.current,
31397
31398
  () => xb(h, f)
31398
31399
  ];
31399
- }, lq = nI(({ href: r, children: e, ...t }, n) => {
31400
- const { isEmbedded: i, navigateParent: a } = ai(qa);
31401
- return /* @__PURE__ */ sr.jsx(
31402
- "a",
31403
- {
31404
- ...t,
31405
- ref: n,
31406
- href: r,
31407
- onClick: (u) => {
31408
- !i || u.metaKey || u.ctrlKey || u.shiftKey || (u.preventDefault(), u.stopPropagation(), a(r));
31409
- },
31410
- children: e
31411
- }
31412
- );
31413
- });
31400
+ }, lq = nI(
31401
+ ({ href: r, asFlyout: e, flyoutTitle: t, children: n, ...i }, a) => {
31402
+ const { isEmbedded: u, navigateParent: c } = ai(qa);
31403
+ return /* @__PURE__ */ sr.jsx(
31404
+ "a",
31405
+ {
31406
+ ...i,
31407
+ ref: a,
31408
+ href: r,
31409
+ onClick: (f) => {
31410
+ !u || f.metaKey || f.ctrlKey || f.shiftKey || (f.preventDefault(), f.stopPropagation(), c(r, { asFlyout: e, flyoutTitle: t }));
31411
+ },
31412
+ children: n
31413
+ }
31414
+ );
31415
+ }
31416
+ );
31414
31417
  export {
31415
31418
  lq as Link,
31416
31419
  oq as MMProvider,
@@ -128,7 +128,7 @@ function print() { __p += __j.call(arguments, '') }
128
128
  `;T(K)},[y,m,h]),me.useEffect(()=>{_&&P()},[_,S]);const[P,{data:M,loading:U}]=L1(_,{fetchPolicy:"no-cache"});return me.useEffect(()=>{if(!M||!M.quantities)return;const W=ci.last(M.quantities);if(W&&d(W.eventTime),!n)i(M.quantities);else{const K=ci.drop(M.quantities);i([...n,...K])}},[M]),{data:n,error:c,loading:a}},GA=r=>{const[e,t]=me.useState(),[n,i]=me.useState(!0),[a,u]=me.useState(),{urls:c,request:f}=ti();return bo(async h=>{try{i(!0);const d=await f(`${c.apiUrl}/reports/downtime`,{method:"POST",body:r,signal:h});u(null),t(d)}catch(d){u(d)}i(!1)},[r]),{data:e,error:a,loading:n}},QA=r=>{const[e,t]=me.useState(),{urls:n,request:i,clientId:a}=ti(),u=`lab:${a}:${r}`,{data:c,loading:f,error:h}=f0("/templates");return me.useEffect(()=>{if(!c)return;const m=ci.filter(c.templates,{namespace:u});t(m)},[c]),[async({name:m,public:b,config:I})=>{const S={name:m,public:b,namespace:u,config:JSON.stringify(I)},_=JSON.stringify(S),T=await i(`${n.apiUrl}/templates`,{method:"POST",body:_});return t([...e,T.template]),T.template},async(m,{name:b,public:I,config:S})=>{const _={name:b,public:I,namespace:u,config:JSON.stringify(S)},T=JSON.stringify(_),P=await i(`${n.apiUrl}/templates/${m}`,{method:"PUT",body:T}),M=ci.findIndex(e,{id:m}),U=e.slice(0,M),W=e.slice(M+1);return t([...U,P.template,...W]),P.template},async m=>{await i(`${n.apiUrl}/templates/${m}`,{method:"DELETE"}),t(ci.reject(e,{id:m}))},{templates:e,loading:f,error:h}]},JA=()=>{const[r,e]=me.useState(),[t,n]=me.useState(),{urls:i}=ti();return me.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]),me.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}]},ti=()=>me.useContext(c0),YA=()=>(console.warn("useMMEmbeddedApp is deprecated. Use useMMAppTools and useMMAppContext."),me.useContext(fa)),KA=()=>me.useContext(fa),ZA=()=>{const{context:r}=me.useContext(fa);return r},XA=(r,e,t=[])=>{const{addSetting:n}=me.useContext(fa);me.useEffect(()=>{n(r,e)},[...t])},ek=()=>me.useContext(u0),tk=()=>{const{login:r,isAuthenticated:e}=ti();return bo(async()=>{e===!1&&await r()},[e]),e?nr.jsx(pn.Outlet,{}):nr.jsx("div",{})},h0="%[a-f0-9]{2}",d0=new RegExp("("+h0+")|([^%]+?)","gi"),p0=new RegExp("("+h0+")+","gi");function ah(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([],ah(t),ah(n))}function rk(r){try{return decodeURIComponent(r)}catch{let e=r.match(d0)||[];for(let t=1;t<e.length;t++)r=ah(e,t).join(""),e=r.match(d0)||[];return r}}function nk(r){const e={"%FE%FF":"��","%FF%FE":"��"};let t=p0.exec(r);for(;t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{const i=rk(t[0]);i!==t[0]&&(e[t[0]]=i)}t=p0.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 ik(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return nk(r)}}function sk(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}function m0(r,e){if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||e==="")return[];const t=r.indexOf(e);return t===-1?[]:[r.slice(0,t),r.slice(t+e.length)]}const ak=r=>r==null,ok=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),oh=Symbol("encodeFragmentIdentifier");function uk(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,[Sr(e,r),"[",i,"]"].join("")]:[...t,[Sr(e,r),"[",Sr(i,r),"]=",Sr(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Sr(e,r),"[]"].join("")]:[...t,[Sr(e,r),"[]=",Sr(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,[Sr(e,r),":list="].join("")]:[...t,[Sr(e,r),":list=",Sr(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?[[Sr(t,r),e,Sr(i,r)].join("")]:[[n,Sr(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,Sr(e,r)]:[...t,[Sr(e,r),"=",Sr(n,r)].join("")]}}function ck(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?[]:wi(n,r).split(r.arrayFormatSeparator);if(i[t]===void 0){i[t]=u;return}i[t]=[...i[t],...u]};default:return(t,n,i)=>{if(i[t]===void 0){i[t]=n;return}i[t]=[...[i[t]].flat(),n]}}}function y0(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Sr(r,e){return e.encode?e.strict?ok(r):encodeURIComponent(r):r}function wi(r,e){return e.decode?ik(r):r}function g0(r){return Array.isArray(r)?r.sort():typeof r=="object"?g0(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function v0(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function lk(r){let e="";const t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function b0(r,e,t){return t==="string"&&typeof r=="string"?r:typeof t=="function"&&typeof r=="string"?t(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":t==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""||e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function uh(r){r=v0(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function ch(r,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...e},y0(e.arrayFormatSeparator);const t=ck(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]=m0(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&&e.types[i]!=="string")for(const[u,c]of Object.entries(a)){const f=e.types[i]?e.types[i].replace("[]",""):void 0;a[u]=b0(c,e,f)}else typeof a=="object"&&a!==null&&e.types[i]==="string"?n[i]=Object.values(a).join(e.arrayFormatSeparator):n[i]=b0(a,e,e.types[i]);return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,a)=>{const u=n[a];return i[a]=u&&typeof u=="object"&&!Array.isArray(u)?g0(u):u,i},Object.create(null))}function w0(r,e){if(!r)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},y0(e.arrayFormatSeparator);const t=u=>e.skipNull&&ak(r[u])||e.skipEmptyString&&r[u]==="",n=uk(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?Sr(u,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?Sr(u,e)+"[]":c.reduce(n(u),[]).join("&"):Sr(u,e)+"="+Sr(c,e)}).filter(u=>u.length>0).join("&")}function _0(r,e){var i;e={decode:!0,...e};let[t,n]=m0(r,"#");return t===void 0&&(t=r),{url:((i=t==null?void 0:t.split("?"))==null?void 0:i[0])??"",query:ch(uh(r),e),...e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:wi(n,e)}:{}}}function x0(r,e){e={encode:!0,strict:!0,[oh]:!0,...e};const t=v0(r.url).split("?")[0]||"",n=uh(r.url),i={...ch(n,{sort:!1}),...r.query};let a=w0(i,e);a&&(a=`?${a}`);let u=lk(r.url);if(typeof r.fragmentIdentifier=="string"){const c=new URL(t);c.hash=r.fragmentIdentifier,u=e[oh]?c.hash:`#${r.fragmentIdentifier}`}return`${t}${a}${u}`}function S0(r,e,t){t={parseFragmentIdentifier:!0,[oh]:!1,...t};const{url:n,query:i,fragmentIdentifier:a}=_0(r,t);return x0({url:n,query:sk(i,e),fragmentIdentifier:a},t)}function fk(r,e,t){const n=Array.isArray(e)?i=>!e.includes(i):(i,a)=>!e(i,a);return S0(r,n,t)}const hk=Object.freeze(Object.defineProperty({__proto__:null,exclude:fk,extract:uh,parse:ch,parseUrl:_0,pick:S0,stringify:w0,stringifyUrl:x0},Symbol.toStringTag,{value:"Module"})),Ur=[];for(let r=0;r<256;++r)Ur.push((r+256).toString(16).slice(1));function dk(r,e=0){return(Ur[r[e+0]]+Ur[r[e+1]]+Ur[r[e+2]]+Ur[r[e+3]]+"-"+Ur[r[e+4]]+Ur[r[e+5]]+"-"+Ur[r[e+6]]+Ur[r[e+7]]+"-"+Ur[r[e+8]]+Ur[r[e+9]]+"-"+Ur[r[e+10]]+Ur[r[e+11]]+Ur[r[e+12]]+Ur[r[e+13]]+Ur[r[e+14]]+Ur[r[e+15]]).toLowerCase()}let lh;const pk=new Uint8Array(16);function mk(){if(!lh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");lh=crypto.getRandomValues.bind(crypto)}return lh(pk)}const E0={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function yk(r,e,t){if(E0.randomUUID&&!e&&!r)return E0.randomUUID();r=r||{};const n=r.random||(r.rng||mk)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,dk(n)}const fh="mm-auth-state",hh="mm-auth-destination",dh="mm-auth-access-token",_i=window.localStorage,gk=()=>_i.getItem(dh),vk=r=>{r?_i.setItem(dh,r):_i.removeItem(dh)},bk=()=>_i.getItem(hh),O0=r=>{r?_i.setItem(hh,r):_i.removeItem(hh)},wk=()=>_i.getItem(fh),T0=r=>{r?_i.setItem(fh,r):_i.removeItem(fh)},A0=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 _k(r){return er(r)&&"code"in r&&"reason"in r}function xk(r){var e;return er(r)&&((e=r.target)===null||e===void 0?void 0:e.readyState)===WebSocket.CLOSED}var Sk=function(r){Pn(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(L(L({},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=_k(a);return u||xk(a)?i.error(new Error("Socket closed".concat(u?" with event ".concat(a.code):"").concat(u?" ".concat(a.reason):""))):i.error(new yn({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Kr);function un(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function ks(r){return un(r)==="object"}function Ek(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function k0(r,e){return r.length<124?r:e}const Ok="graphql-transport-ws";var vn;(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"})(vn||(vn={}));var mr;(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"})(mr||(mr={}));function I0(r){if(!ks(r))throw new Error(`Message is expected to be an object, but got ${un(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 ${un(r.type)}`);switch(r.type){case mr.ConnectionInit:case mr.ConnectionAck:case mr.Ping:case mr.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 mr.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(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 ${un(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 ${un(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 ${un(r.payload.variables)}`);if(r.payload.operationName!=null&&un(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 ${un(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 ${un(r.payload.extensions)}`);break}case mr.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(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 ${un(r.payload)}`);break}case mr.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ek(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 mr.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${un(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 Tk(r,e){return I0(typeof r=="string"?JSON.parse(r,e):r)}function _o(r,e){return I0(r),JSON.stringify(r,e)}var ha=function(r){return this instanceof ha?(this.v=r,this):new ha(r)},Ak=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(b,I){a.push([g,m,b,I])>1||c(g,m)})})}function c(g,m){try{f(n[g](m))}catch(b){y(a[0][3],b)}}function f(g){g.value instanceof ha?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 kk(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(Me){let Se=1e3;for(let ge=0;ge<Me;ge++)Se*=2;await new Promise(ge=>setTimeout(ge,Se+Math.floor(Math.random()*2700+300)))},shouldRetry:y=ph,isFatalConnectionProblem:g,on:m,webSocketImpl:b,generateID:I=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Me=>{const Se=Math.random()*16|0;return(Me=="x"?Se:Se&3|8).toString(16)})},jsonMessageReplacer:S,jsonMessageReviver:_}=r;let T;if(b){if(!Ck(b))throw new Error("Invalid WebSocket implementation provided");T=b}else typeof WebSocket<"u"?T=WebSocket:typeof global<"u"?T=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(T=window.WebSocket||window.MozWebSocket);if(!T)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const P=T,M=(()=>{const de=(()=>{const Se={};return{on(ge,qe){return Se[ge]=qe,()=>{delete Se[ge]}},emit(ge){var qe;"id"in ge&&((qe=Se[ge.id])===null||qe===void 0||qe.call(Se,ge))}}})(),Me={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?[de.emit,m.message]:[de.emit],closed:m!=null&&m.closed?[m.closed]:[],error:m!=null&&m.error?[m.error]:[]};return{onMessage:de.on,on(Se,ge){const qe=Me[Se];return qe.push(ge),()=>{qe.splice(qe.indexOf(ge),1)}},emit(Se,...ge){for(const qe of[...Me[Se]])qe(...ge)}}})();function U(de){const Me=[M.on("error",Se=>{Me.forEach(ge=>ge()),de(Se)}),M.on("closed",Se=>{Me.forEach(ge=>ge()),de(Se)})]}let W,K=0,X,fe=!1,oe=0,ke=!1;async function te(){clearTimeout(X);const[de,Me]=await(W??(W=new Promise((qe,tt)=>(async()=>{if(fe){if(await d(oe),!K)return W=void 0,tt({code:1e3,reason:"All Subscriptions Gone"});oe++}M.emit("connecting",fe);const je=new P(typeof e=="function"?await e():e,Ok);let mt,Pt;function Jt(){isFinite(u)&&u>0&&(clearTimeout(Pt),Pt=setTimeout(()=>{je.readyState===P.OPEN&&(je.send(_o({type:mr.Ping})),M.emit("ping",!1,void 0))},u))}U(nt=>{W=void 0,clearTimeout(mt),clearTimeout(Pt),tt(nt),nt instanceof C0&&(je.close(4499,"Terminated"),je.onerror=null,je.onclose=null)}),je.onerror=nt=>M.emit("error",nt),je.onclose=nt=>M.emit("closed",nt),je.onopen=async()=>{try{M.emit("opened",je);const nt=typeof t=="function"?await t():t;if(je.readyState!==P.OPEN)return;je.send(_o(nt?{type:mr.ConnectionInit,payload:nt}:{type:mr.ConnectionInit},S)),isFinite(f)&&f>0&&(mt=setTimeout(()=>{je.close(vn.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},f)),Jt()}catch(nt){M.emit("error",nt),je.close(vn.InternalClientError,k0(nt instanceof Error?nt.message:new Error(nt).message,"Internal client error"))}};let Lt=!1;je.onmessage=({data:nt})=>{try{const rt=Tk(nt,_);if(M.emit("message",rt),rt.type==="ping"||rt.type==="pong"){M.emit(rt.type,!0,rt.payload),rt.type==="pong"?Jt():c||(je.send(_o(rt.payload?{type:mr.Pong,payload:rt.payload}:{type:mr.Pong})),M.emit("pong",!1,rt.payload));return}if(Lt)return;if(rt.type!==mr.ConnectionAck)throw new Error(`First message cannot be of type ${rt.type}`);clearTimeout(mt),Lt=!0,M.emit("connected",je,rt.payload,fe),fe=!1,oe=0,qe([je,new Promise((xt,Ne)=>U(Ne))])}catch(rt){je.onmessage=null,M.emit("error",rt),je.close(vn.BadResponse,k0(rt instanceof Error?rt.message:new Error(rt).message,"Bad response"))}}})())));de.readyState===P.CLOSING&&await Me;let Se=()=>{};const ge=new Promise(qe=>Se=qe);return[de,Se,Promise.race([ge.then(()=>{if(!K){const qe=()=>de.close(1e3,"Normal Closure");isFinite(a)&&a>0?X=setTimeout(()=>{de.readyState===P.OPEN&&qe()},a):qe()}}),Me])]}function ve(de){if(ph(de)&&(Ik(de.code)||[vn.InternalServerError,vn.InternalClientError,vn.BadRequest,vn.BadResponse,vn.Unauthorized,vn.SubprotocolNotAcceptable,vn.SubscriberAlreadyExists,vn.TooManyInitialisationRequests].includes(de.code)))throw de;if(ke)return!1;if(ph(de)&&de.code===1e3)return K>0;if(!h||oe>=h||!y(de)||g!=null&&g(de))throw de;return fe=!0}n||(async()=>{for(K++;;)try{const[,,de]=await te();await de}catch(de){try{if(!ve(de))return}catch(Me){return i==null?void 0:i(Me)}}})();function ye(de,Me){const Se=I(de);let ge=!1,qe=!1,tt=()=>{K--,ge=!0};return(async()=>{for(K++;;)try{const[je,mt,Pt]=await te();if(ge)return mt();const Jt=M.onMessage(Se,Lt=>{switch(Lt.type){case mr.Next:{Me.next(Lt.payload);return}case mr.Error:{qe=!0,ge=!0,Me.error(Lt.payload),tt();return}case mr.Complete:{ge=!0,tt();return}}});je.send(_o({id:Se,type:mr.Subscribe,payload:de},S)),tt=()=>{!ge&&je.readyState===P.OPEN&&je.send(_o({id:Se,type:mr.Complete},S)),K--,ge=!0,mt()},await Pt.finally(Jt);return}catch(je){if(!ve(je))return}})().then(()=>{qe||Me.complete()}).catch(je=>{Me.error(je)}),()=>{ge||tt()}}return{on:M.on,subscribe:ye,iterate(de){const Me=[],Se={done:!1,error:null,resolve:()=>{}},ge=ye(de,{next(tt){Me.push(tt),Se.resolve()},error(tt){Se.done=!0,Se.error=tt,Se.resolve()},complete(){Se.done=!0,Se.resolve()}}),qe=function(){return Ak(this,arguments,function*(){for(;;){for(Me.length||(yield ha(new Promise(mt=>Se.resolve=mt)));Me.length;)yield yield ha(Me.shift());if(Se.error)throw Se.error;if(Se.done)return yield ha(void 0)}})}();return qe.throw=async tt=>(Se.done||(Se.done=!0,Se.error=tt,Se.resolve()),{done:!0,value:void 0}),qe.return=async()=>(ge(),{done:!0,value:void 0}),qe},async dispose(){if(ke=!0,W){const[de]=await W;de.close(1e3,"Normal Closure")}},terminate(){W&&M.emit("closed",new C0)}}}class C0 extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function ph(r){return ks(r)&&"code"in r&&"reason"in r}function Ik(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function Ck(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function P0(r){return new Kr(function(e,t){var n=on(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 N0(r){return new Kr(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){Pn(e,r);function e(t){var n=r.call(this)||this;return n.link=N0(t),n}return e.prototype.request=function(t,n){return this.link.request(t,n)},e})(Kr);var mh={exports:{}};const Pk=ol(x1),Nk=ol(pO);var yh,R0;function da(){return R0||(R0=1,yh=TypeError),yh}const Rk=ol(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var gh,M0;function ec(){if(M0)return gh;M0=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,b=Boolean.prototype.valueOf,I=Object.prototype.toString,S=Function.prototype.toString,_=String.prototype.match,T=String.prototype.slice,P=String.prototype.replace,M=String.prototype.toUpperCase,U=String.prototype.toLowerCase,W=RegExp.prototype.test,K=Array.prototype.concat,X=Array.prototype.join,fe=Array.prototype.slice,oe=Math.floor,ke=typeof BigInt=="function"?BigInt.prototype.valueOf:null,te=Object.getOwnPropertySymbols,ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ye=typeof Symbol=="function"&&typeof Symbol.iterator=="object",de=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ye||!0)?Symbol.toStringTag:null,Me=Object.prototype.propertyIsEnumerable,Se=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(H){return H.__proto__}:null);function ge(H,G){if(H===1/0||H===-1/0||H!==H||H&&H>-1e3&&H<1e3||W.call(/e/,G))return G;var it=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof H=="number"){var gt=H<0?-oe(-H):oe(H);if(gt!==H){var ct=String(gt),We=T.call(G,ct.length+1);return P.call(ct,it,"$&_")+"."+P.call(P.call(We,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(G,it,"$&_")}var qe=Rk,tt=qe.custom,je=q(tt)?tt:null,mt={__proto__:null,double:'"',single:"'"},Pt={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};gh=function H(G,it,gt,ct){var We=it||{};if(V(We,"quoteStyle")&&!V(mt,We.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(We,"maxStringLength")&&(typeof We.maxStringLength=="number"?We.maxStringLength<0&&We.maxStringLength!==1/0:We.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Kt=V(We,"customInspect")?We.customInspect:!0;if(typeof Kt!="boolean"&&Kt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(We,"indent")&&We.indent!==null&&We.indent!==" "&&!(parseInt(We.indent,10)===We.indent&&We.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(We,"numericSeparator")&&typeof We.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Zt=We.numericSeparator;if(typeof G>"u")return"undefined";if(G===null)return"null";if(typeof G=="boolean")return G?"true":"false";if(typeof G=="string")return St(G,We);if(typeof G=="number"){if(G===0)return 1/0/G>0?"0":"-0";var Gt=String(G);return Zt?ge(G,Gt):Gt}if(typeof G=="bigint"){var kr=String(G)+"n";return Zt?ge(G,kr):kr}var Hr=typeof We.depth>"u"?5:We.depth;if(typeof gt>"u"&&(gt=0),gt>=Hr&&Hr>0&&typeof G=="object")return nt(G)?"[Array]":"[Object]";var Fr=dr(We,gt);if(typeof ct>"u")ct=[];else if($e(ct,G)>=0)return"[Circular]";function jt(Qe,Ke,Ze){if(Ke&&(ct=fe.call(ct),ct.push(Ke)),Ze){var yt={depth:We.depth};return V(We,"quoteStyle")&&(yt.quoteStyle=We.quoteStyle),H(Qe,yt,gt+1,ct)}return H(Qe,We,gt+1,ct)}if(typeof G=="function"&&!xt(G)){var Or=Ve(G),$r=zt(G,jt);return"[Function"+(Or?": "+Or:" (anonymous)")+"]"+($r.length>0?" { "+X.call($r,", ")+" }":"")}if(q(G)){var Lr=ye?P.call(String(G),/^(Symbol\(.*\))_[^)]*$/,"$1"):ve.call(G);return typeof G=="object"&&!ye?Ht(Lr):Lr}if(Yt(G)){for(var ar="<"+U.call(String(G.nodeName)),Gr=G.attributes||[],Tr=0;Tr<Gr.length;Tr++)ar+=" "+Gr[Tr].name+"="+Jt(Lt(Gr[Tr].value),"double",We);return ar+=">",G.childNodes&&G.childNodes.length&&(ar+="..."),ar+="</"+U.call(String(G.nodeName))+">",ar}if(nt(G)){if(G.length===0)return"[]";var gr=zt(G,jt);return Fr&&!sr(gr)?"["+Ar(gr,Fr)+"]":"[ "+X.call(gr,", ")+" ]"}if(Ne(G)){var Ir=zt(G,jt);return!("cause"in Error.prototype)&&"cause"in G&&!Me.call(G,"cause")?"{ ["+String(G)+"] "+X.call(K.call("[cause]: "+jt(G.cause),Ir),", ")+" }":Ir.length===0?"["+String(G)+"]":"{ ["+String(G)+"] "+X.call(Ir,", ")+" }"}if(typeof G=="object"&&Kt){if(je&&typeof G[je]=="function"&&qe)return qe(G,{depth:Hr-gt});if(Kt!=="symbol"&&typeof G.inspect=="function")return G.inspect()}if(se(G)){var Sn=[];return n&&n.call(G,function(Qe,Ke){Sn.push(jt(Ke,G,!0)+" => "+jt(Qe,G))}),Wt("Map",t.call(G),Sn,Fr)}if(ht(G)){var Un=[];return c&&c.call(G,function(Qe){Un.push(jt(Qe,G))}),Wt("Set",u.call(G),Un,Fr)}if(_e(G))return Er("WeakMap");if(dt(G))return Er("WeakSet");if(He(G))return Er("WeakRef");if(B(G))return Ht(jt(Number(G)));if(J(G))return Ht(jt(ke.call(G)));if(Q(G))return Ht(b.call(G));if(ze(G))return Ht(jt(String(G)));if(typeof window<"u"&&G===window)return"{ [object Window] }";if(typeof globalThis<"u"&&G===globalThis||typeof pi<"u"&&G===pi)return"{ [object globalThis] }";if(!rt(G)&&!xt(G)){var R=zt(G,jt),ue=Se?Se(G)===Object.prototype:G instanceof Object||G.constructor===Object,be=G instanceof Object?"":"null prototype",Ie=!ue&&de&&Object(G)===G&&de in G?T.call(xe(G),8,-1):be?"Object":"",Be=ue||typeof G.constructor!="function"?"":G.constructor.name?G.constructor.name+" ":"",ot=Be+(Ie||be?"["+X.call(K.call([],Ie||[],be||[]),": ")+"] ":"");return R.length===0?ot+"{}":Fr?ot+"{"+Ar(R,Fr)+"}":ot+"{ "+X.call(R,", ")+" }"}return String(G)};function Jt(H,G,it){var gt=it.quoteStyle||G,ct=mt[gt];return ct+H+ct}function Lt(H){return P.call(String(H),/"/g,"&quot;")}function nt(H){return xe(H)==="[object Array]"&&(!de||!(typeof H=="object"&&de in H))}function rt(H){return xe(H)==="[object Date]"&&(!de||!(typeof H=="object"&&de in H))}function xt(H){return xe(H)==="[object RegExp]"&&(!de||!(typeof H=="object"&&de in H))}function Ne(H){return xe(H)==="[object Error]"&&(!de||!(typeof H=="object"&&de in H))}function ze(H){return xe(H)==="[object String]"&&(!de||!(typeof H=="object"&&de in H))}function B(H){return xe(H)==="[object Number]"&&(!de||!(typeof H=="object"&&de in H))}function Q(H){return xe(H)==="[object Boolean]"&&(!de||!(typeof H=="object"&&de in H))}function q(H){if(ye)return H&&typeof H=="object"&&H instanceof Symbol;if(typeof H=="symbol")return!0;if(!H||typeof H!="object"||!ve)return!1;try{return ve.call(H),!0}catch{}return!1}function J(H){if(!H||typeof H!="object"||!ke)return!1;try{return ke.call(H),!0}catch{}return!1}var ee=Object.prototype.hasOwnProperty||function(H){return H in this};function V(H,G){return ee.call(H,G)}function xe(H){return I.call(H)}function Ve(H){if(H.name)return H.name;var G=_.call(S.call(H),/^function\s*([\w$]+)/);return G?G[1]:null}function $e(H,G){if(H.indexOf)return H.indexOf(G);for(var it=0,gt=H.length;it<gt;it++)if(H[it]===G)return it;return-1}function se(H){if(!t||!H||typeof H!="object")return!1;try{t.call(H);try{u.call(H)}catch{return!0}return H instanceof Map}catch{}return!1}function _e(H){if(!h||!H||typeof H!="object")return!1;try{h.call(H,h);try{y.call(H,y)}catch{return!0}return H instanceof WeakMap}catch{}return!1}function He(H){if(!m||!H||typeof H!="object")return!1;try{return m.call(H),!0}catch{}return!1}function ht(H){if(!u||!H||typeof H!="object")return!1;try{u.call(H);try{t.call(H)}catch{return!0}return H instanceof Set}catch{}return!1}function dt(H){if(!y||!H||typeof H!="object")return!1;try{y.call(H,y);try{h.call(H,h)}catch{return!0}return H instanceof WeakSet}catch{}return!1}function Yt(H){return!H||typeof H!="object"?!1:typeof HTMLElement<"u"&&H instanceof HTMLElement?!0:typeof H.nodeName=="string"&&typeof H.getAttribute=="function"}function St(H,G){if(H.length>G.maxStringLength){var it=H.length-G.maxStringLength,gt="... "+it+" more character"+(it>1?"s":"");return St(T.call(H,0,G.maxStringLength),G)+gt}var ct=Pt[G.quoteStyle||"single"];ct.lastIndex=0;var We=P.call(P.call(H,ct,"\\$1"),/[\x00-\x1f]/g,Vt);return Jt(We,"single",G)}function Vt(H){var G=H.charCodeAt(0),it={8:"b",9:"t",10:"n",12:"f",13:"r"}[G];return it?"\\"+it:"\\x"+(G<16?"0":"")+M.call(G.toString(16))}function Ht(H){return"Object("+H+")"}function Er(H){return H+" { ? }"}function Wt(H,G,it,gt){var ct=gt?Ar(it,gt):X.call(it,", ");return H+" ("+G+") {"+ct+"}"}function sr(H){for(var G=0;G<H.length;G++)if($e(H[G],`
129
129
  `)>=0)return!1;return!0}function dr(H,G){var it;if(H.indent===" ")it=" ";else if(typeof H.indent=="number"&&H.indent>0)it=X.call(Array(H.indent+1)," ");else return null;return{base:it,prev:X.call(Array(G+1),it)}}function Ar(H,G){if(H.length===0)return"";var it=`
130
130
  `+G.prev+G.base;return it+X.call(H,","+it)+`
131
- `+G.prev}function zt(H,G){var it=nt(H),gt=[];if(it){gt.length=H.length;for(var ct=0;ct<H.length;ct++)gt[ct]=V(H,ct)?G(H[ct],H):""}var We=typeof te=="function"?te(H):[],Kt;if(ye){Kt={};for(var Zt=0;Zt<We.length;Zt++)Kt["$"+We[Zt]]=We[Zt]}for(var Gt in H)V(H,Gt)&&(it&&String(Number(Gt))===Gt&&Gt<H.length||ye&&Kt["$"+Gt]instanceof Symbol||(W.call(/[^\w$]/,Gt)?gt.push(G(Gt,H)+": "+G(H[Gt],H)):gt.push(Gt+": "+G(H[Gt],H))));if(typeof te=="function")for(var kr=0;kr<We.length;kr++)Me.call(H,We[kr])&&gt.push("["+G(We[kr])+"]: "+G(H[We[kr]],H));return gt}return gh}var vh,D0;function Mk(){if(D0)return vh;D0=1;var r=ec(),e=da(),t=function(c,f,h){for(var d=c,y;(y=d.next)!=null;d=y)if(y.key===f)return d.next=y.next,h||(y.next=c.next,c.next=y),y},n=function(c,f){if(c){var h=t(c,f);return h&&h.value}},i=function(c,f,h){var d=t(c,f);d?d.value=h:c.next={key:f,next:c.next,value:h}},a=function(c,f){return c?!!t(c,f):!1},u=function(c,f){if(c)return t(c,f,!0)};return vh=function(){var f,h={assert:function(d){if(!h.has(d))throw new e("Side channel does not contain "+r(d))},delete:function(d){var y=f&&f.next,g=u(f,d);return g&&y&&y===g&&(f=void 0),!!g},get:function(d){return n(f,d)},has:function(d){return a(f,d)},set:function(d,y){f||(f={next:void 0}),i(f,d,y)}};return h},vh}var bh,F0;function L0(){return F0||(F0=1,bh=Object),bh}var wh,q0;function Dk(){return q0||(q0=1,wh=Error),wh}var _h,j0;function Fk(){return j0||(j0=1,_h=EvalError),_h}var xh,U0;function Lk(){return U0||(U0=1,xh=RangeError),xh}var Sh,$0;function qk(){return $0||($0=1,Sh=ReferenceError),Sh}var Eh,B0;function jk(){return B0||(B0=1,Eh=SyntaxError),Eh}var Oh,V0;function Uk(){return V0||(V0=1,Oh=URIError),Oh}var Th,W0;function $k(){return W0||(W0=1,Th=Math.abs),Th}var Ah,z0;function Bk(){return z0||(z0=1,Ah=Math.floor),Ah}var kh,H0;function Vk(){return H0||(H0=1,kh=Math.max),kh}var Ih,G0;function Wk(){return G0||(G0=1,Ih=Math.min),Ih}var Ch,Q0;function zk(){return Q0||(Q0=1,Ch=Math.pow),Ch}var Ph,J0;function Hk(){return J0||(J0=1,Ph=Math.round),Ph}var Nh,Y0;function Gk(){return Y0||(Y0=1,Nh=Number.isNaN||function(e){return e!==e}),Nh}var Rh,K0;function Qk(){if(K0)return Rh;K0=1;var r=Gk();return Rh=function(t){return r(t)||t===0?t:t<0?-1:1},Rh}var Mh,Z0;function Jk(){return Z0||(Z0=1,Mh=Object.getOwnPropertyDescriptor),Mh}var Dh,X0;function eb(){if(X0)return Dh;X0=1;var r=Jk();if(r)try{r([],"length")}catch{r=null}return Dh=r,Dh}var Fh,tb;function Yk(){if(tb)return Fh;tb=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return Fh=r,Fh}var Lh,rb;function Kk(){return rb||(rb=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(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(e,t);if(c.value!==i||c.enumerable!==!0)return!1}return!0}),Lh}var qh,nb;function Zk(){if(nb)return qh;nb=1;var r=typeof Symbol<"u"&&Symbol,e=Kk();return qh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},qh}var jh,ib;function sb(){return ib||(ib=1,jh=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),jh}var Uh,ab;function ob(){if(ab)return Uh;ab=1;var r=L0();return Uh=r.getPrototypeOf||null,Uh}var $h,ub;function Xk(){if(ub)return $h;ub=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 $h=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 _=h.apply(this,i(d,arguments));return Object(_)===_?_:this}return h.apply(f,i(d,arguments))},m=t(0,h.length-d.length),b=[],I=0;I<m;I++)b[I]="$"+I;if(y=Function("binder","return function ("+u(b,",")+"){ return binder.apply(this,arguments); }")(g),h.prototype){var S=function(){};S.prototype=h.prototype,y.prototype=new S,S.prototype=null}return y},$h}var Bh,cb;function tc(){if(cb)return Bh;cb=1;var r=Xk();return Bh=Function.prototype.bind||r,Bh}var Vh,lb;function Wh(){return lb||(lb=1,Vh=Function.prototype.call),Vh}var zh,fb;function hb(){return fb||(fb=1,zh=Function.prototype.apply),zh}var Hh,db;function eI(){return db||(db=1,Hh=typeof Reflect<"u"&&Reflect&&Reflect.apply),Hh}var Gh,pb;function tI(){if(pb)return Gh;pb=1;var r=tc(),e=hb(),t=Wh(),n=eI();return Gh=n||r.call(t,e),Gh}var Qh,mb;function yb(){if(mb)return Qh;mb=1;var r=tc(),e=da(),t=Wh(),n=tI();return Qh=function(a){if(a.length<1||typeof a[0]!="function")throw new e("a function is required");return n(r,t,a)},Qh}var Jh,gb;function rI(){if(gb)return Jh;gb=1;var r=yb(),e=eb(),t;try{t=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return Jh=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(c){return a(c==null?c:i(c))}:!1,Jh}var Yh,vb;function nI(){if(vb)return Yh;vb=1;var r=sb(),e=ob(),t=rI();return Yh=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,Yh}var Kh,bb;function iI(){if(bb)return Kh;bb=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=tc();return Kh=t.call(r,e),Kh}var Zh,wb;function Xh(){if(wb)return Zh;wb=1;var r,e=L0(),t=Dk(),n=Fk(),i=Lk(),a=qk(),u=jk(),c=da(),f=Uk(),h=$k(),d=Bk(),y=Vk(),g=Wk(),m=zk(),b=Hk(),I=Qk(),S=Function,_=function(Ne){try{return S('"use strict"; return ('+Ne+").constructor;")()}catch{}},T=eb(),P=Yk(),M=function(){throw new c},U=T?function(){try{return arguments.callee,M}catch{try{return T(arguments,"callee").get}catch{return M}}}():M,W=Zk()(),K=nI(),X=ob(),fe=sb(),oe=hb(),ke=Wh(),te={},ve=typeof Uint8Array>"u"||!K?r:K(Uint8Array),ye={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":W&&K?K([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":te,"%AsyncGenerator%":te,"%AsyncGeneratorFunction%":te,"%AsyncIteratorPrototype%":te,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":S,"%GeneratorFunction%":te,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":W&&K?K(K([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!W||!K?r:K(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":T,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!W||!K?r:K(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":W&&K?K(""[Symbol.iterator]()):r,"%Symbol%":W?Symbol:r,"%SyntaxError%":u,"%ThrowTypeError%":U,"%TypedArray%":ve,"%TypeError%":c,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":f,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet,"%Function.prototype.call%":ke,"%Function.prototype.apply%":oe,"%Object.defineProperty%":P,"%Object.getPrototypeOf%":X,"%Math.abs%":h,"%Math.floor%":d,"%Math.max%":y,"%Math.min%":g,"%Math.pow%":m,"%Math.round%":b,"%Math.sign%":I,"%Reflect.getPrototypeOf%":fe};if(K)try{null.error}catch(Ne){var de=K(K(Ne));ye["%Error.prototype%"]=de}var Me=function Ne(ze){var B;if(ze==="%AsyncFunction%")B=_("async function () {}");else if(ze==="%GeneratorFunction%")B=_("function* () {}");else if(ze==="%AsyncGeneratorFunction%")B=_("async function* () {}");else if(ze==="%AsyncGenerator%"){var Q=Ne("%AsyncGeneratorFunction%");Q&&(B=Q.prototype)}else if(ze==="%AsyncIteratorPrototype%"){var q=Ne("%AsyncGenerator%");q&&K&&(B=K(q.prototype))}return ye[ze]=B,B},Se={__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"]},ge=tc(),qe=iI(),tt=ge.call(ke,Array.prototype.concat),je=ge.call(oe,Array.prototype.splice),mt=ge.call(ke,String.prototype.replace),Pt=ge.call(ke,String.prototype.slice),Jt=ge.call(ke,RegExp.prototype.exec),Lt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,nt=/\\(\\)?/g,rt=function(ze){var B=Pt(ze,0,1),Q=Pt(ze,-1);if(B==="%"&&Q!=="%")throw new u("invalid intrinsic syntax, expected closing `%`");if(Q==="%"&&B!=="%")throw new u("invalid intrinsic syntax, expected opening `%`");var q=[];return mt(ze,Lt,function(J,ee,V,xe){q[q.length]=V?mt(xe,nt,"$1"):ee||J}),q},xt=function(ze,B){var Q=ze,q;if(qe(Se,Q)&&(q=Se[Q],Q="%"+q[0]+"%"),qe(ye,Q)){var J=ye[Q];if(J===te&&(J=Me(Q)),typeof J>"u"&&!B)throw new c("intrinsic "+ze+" exists, but is not available. Please file an issue!");return{alias:q,name:Q,value:J}}throw new u("intrinsic "+ze+" does not exist!")};return Zh=function(ze,B){if(typeof ze!="string"||ze.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof B!="boolean")throw new c('"allowMissing" argument must be a boolean');if(Jt(/^%?[^%]*%?$/,ze)===null)throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Q=rt(ze),q=Q.length>0?Q[0]:"",J=xt("%"+q+"%",B),ee=J.name,V=J.value,xe=!1,Ve=J.alias;Ve&&(q=Ve[0],je(Q,tt([0,1],Ve)));for(var $e=1,se=!0;$e<Q.length;$e+=1){var _e=Q[$e],He=Pt(_e,0,1),ht=Pt(_e,-1);if((He==='"'||He==="'"||He==="`"||ht==='"'||ht==="'"||ht==="`")&&He!==ht)throw new u("property names with quotes must have matching quotes");if((_e==="constructor"||!se)&&(xe=!0),q+="."+_e,ee="%"+q+"%",qe(ye,ee))V=ye[ee];else if(V!=null){if(!(_e in V)){if(!B)throw new c("base intrinsic for "+ze+" exists, but the property is not available.");return}if(T&&$e+1>=Q.length){var dt=T(V,_e);se=!!dt,se&&"get"in dt&&!("originalValue"in dt.get)?V=dt.get:V=V[_e]}else se=qe(V,_e),V=V[_e];se&&!xe&&(ye[ee]=V)}}return V},Zh}var ed,_b;function xb(){if(_b)return ed;_b=1;var r=Xh(),e=yb(),t=e([r("%String.prototype.indexOf%")]);return ed=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e([u]):u},ed}var td,Sb;function Eb(){if(Sb)return td;Sb=1;var r=Xh(),e=xb(),t=ec(),n=da(),i=r("%Map%",!0),a=e("Map.prototype.get",!0),u=e("Map.prototype.set",!0),c=e("Map.prototype.has",!0),f=e("Map.prototype.delete",!0),h=e("Map.prototype.size",!0);return td=!!i&&function(){var y,g={assert:function(m){if(!g.has(m))throw new n("Side channel does not contain "+t(m))},delete:function(m){if(y){var b=f(y,m);return h(y)===0&&(y=void 0),b}return!1},get:function(m){if(y)return a(y,m)},has:function(m){return y?c(y,m):!1},set:function(m,b){y||(y=new i),u(y,m,b)}};return g},td}var rd,Ob;function sI(){if(Ob)return rd;Ob=1;var r=Xh(),e=xb(),t=ec(),n=Eb(),i=da(),a=r("%WeakMap%",!0),u=e("WeakMap.prototype.get",!0),c=e("WeakMap.prototype.set",!0),f=e("WeakMap.prototype.has",!0),h=e("WeakMap.prototype.delete",!0);return rd=a?function(){var y,g,m={assert:function(b){if(!m.has(b))throw new i("Side channel does not contain "+t(b))},delete:function(b){if(a&&b&&(typeof b=="object"||typeof b=="function")){if(y)return h(y,b)}else if(n&&g)return g.delete(b);return!1},get:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&y?u(y,b):g&&g.get(b)},has:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&y?f(y,b):!!g&&g.has(b)},set:function(b,I){a&&b&&(typeof b=="object"||typeof b=="function")?(y||(y=new a),c(y,b,I)):n&&(g||(g=n()),g.set(b,I))}};return m}:n,rd}var nd,Tb;function aI(){if(Tb)return nd;Tb=1;var r=da(),e=ec(),t=Mk(),n=Eb(),i=sI(),a=i||n||t;return nd=function(){var c,f={assert:function(h){if(!f.has(h))throw new r("Side channel does not contain "+e(h))},delete:function(h){return!!c&&c.delete(h)},get:function(h){return c&&c.get(h)},has:function(h){return!!c&&c.has(h)},set:function(h,d){c||(c=a()),c.set(h,d)}};return f},nd}var id,Ab;function sd(){if(Ab)return id;Ab=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return id={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},id}var ad,kb;function Ib(){if(kb)return ad;kb=1;var r=sd(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var S=[],_=0;_<256;++_)S.push("%"+((_<16?"0":"")+_.toString(16)).toUpperCase());return S}(),i=function(_){for(;_.length>1;){var T=_.pop(),P=T.obj[T.prop];if(t(P)){for(var M=[],U=0;U<P.length;++U)typeof P[U]<"u"&&M.push(P[U]);T.obj[T.prop]=M}}},a=function(_,T){for(var P=T&&T.plainObjects?Object.create(null):{},M=0;M<_.length;++M)typeof _[M]<"u"&&(P[M]=_[M]);return P},u=function S(_,T,P){if(!T)return _;if(typeof T!="object"){if(t(_))_.push(T);else if(_&&typeof _=="object")(P&&(P.plainObjects||P.allowPrototypes)||!e.call(Object.prototype,T))&&(_[T]=!0);else return[_,T];return _}if(!_||typeof _!="object")return[_].concat(T);var M=_;return t(_)&&!t(T)&&(M=a(_,P)),t(_)&&t(T)?(T.forEach(function(U,W){if(e.call(_,W)){var K=_[W];K&&typeof K=="object"&&U&&typeof U=="object"?_[W]=S(K,U,P):_.push(U)}else _[W]=U}),_):Object.keys(T).reduce(function(U,W){var K=T[W];return e.call(U,W)?U[W]=S(U[W],K,P):U[W]=K,U},M)},c=function(_,T){return Object.keys(T).reduce(function(P,M){return P[M]=T[M],P},_)},f=function(S,_,T){var P=S.replace(/\+/g," ");if(T==="iso-8859-1")return P.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(P)}catch{return P}},h=1024,d=function(_,T,P,M,U){if(_.length===0)return _;var W=_;if(typeof _=="symbol"?W=Symbol.prototype.toString.call(_):typeof _!="string"&&(W=String(_)),P==="iso-8859-1")return escape(W).replace(/%u[0-9a-f]{4}/gi,function(ve){return"%26%23"+parseInt(ve.slice(2),16)+"%3B"});for(var K="",X=0;X<W.length;X+=h){for(var fe=W.length>=h?W.slice(X,X+h):W,oe=[],ke=0;ke<fe.length;++ke){var te=fe.charCodeAt(ke);if(te===45||te===46||te===95||te===126||te>=48&&te<=57||te>=65&&te<=90||te>=97&&te<=122||U===r.RFC1738&&(te===40||te===41)){oe[oe.length]=fe.charAt(ke);continue}if(te<128){oe[oe.length]=n[te];continue}if(te<2048){oe[oe.length]=n[192|te>>6]+n[128|te&63];continue}if(te<55296||te>=57344){oe[oe.length]=n[224|te>>12]+n[128|te>>6&63]+n[128|te&63];continue}ke+=1,te=65536+((te&1023)<<10|fe.charCodeAt(ke)&1023),oe[oe.length]=n[240|te>>18]+n[128|te>>12&63]+n[128|te>>6&63]+n[128|te&63]}K+=oe.join("")}return K},y=function(_){for(var T=[{obj:{o:_},prop:"o"}],P=[],M=0;M<T.length;++M)for(var U=T[M],W=U.obj[U.prop],K=Object.keys(W),X=0;X<K.length;++X){var fe=K[X],oe=W[fe];typeof oe=="object"&&oe!==null&&P.indexOf(oe)===-1&&(T.push({obj:W,prop:fe}),P.push(oe))}return i(T),_},g=function(_){return Object.prototype.toString.call(_)==="[object RegExp]"},m=function(_){return!_||typeof _!="object"?!1:!!(_.constructor&&_.constructor.isBuffer&&_.constructor.isBuffer(_))},b=function(_,T){return[].concat(_,T)},I=function(_,T){if(t(_)){for(var P=[],M=0;M<_.length;M+=1)P.push(T(_[M]));return P}return T(_)};return ad={arrayToObject:a,assign:c,combine:b,compact:y,decode:f,encode:d,isBuffer:m,isRegExp:g,maybeMap:I,merge:u},ad}var od,Cb;function oI(){if(Cb)return od;Cb=1;var r=aI(),e=Ib(),t=sd(),n=Object.prototype.hasOwnProperty,i={brackets:function(S){return S+"[]"},comma:"comma",indices:function(S,_){return S+"["+_+"]"},repeat:function(S){return S}},a=Array.isArray,u=Array.prototype.push,c=function(I,S){u.apply(I,a(S)?S:[S])},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(S){return f.call(S)},skipNulls:!1,strictNullHandling:!1},y=function(S){return typeof S=="string"||typeof S=="number"||typeof S=="boolean"||typeof S=="symbol"||typeof S=="bigint"},g={},m=function I(S,_,T,P,M,U,W,K,X,fe,oe,ke,te,ve,ye,de,Me,Se){for(var ge=S,qe=Se,tt=0,je=!1;(qe=qe.get(g))!==void 0&&!je;){var mt=qe.get(S);if(tt+=1,typeof mt<"u"){if(mt===tt)throw new RangeError("Cyclic object value");je=!0}typeof qe.get(g)>"u"&&(tt=0)}if(typeof fe=="function"?ge=fe(_,ge):ge instanceof Date?ge=te(ge):T==="comma"&&a(ge)&&(ge=e.maybeMap(ge,function(ee){return ee instanceof Date?te(ee):ee})),ge===null){if(U)return X&&!de?X(_,d.encoder,Me,"key",ve):_;ge=""}if(y(ge)||e.isBuffer(ge)){if(X){var Pt=de?_:X(_,d.encoder,Me,"key",ve);return[ye(Pt)+"="+ye(X(ge,d.encoder,Me,"value",ve))]}return[ye(_)+"="+ye(String(ge))]}var Jt=[];if(typeof ge>"u")return Jt;var Lt;if(T==="comma"&&a(ge))de&&X&&(ge=e.maybeMap(ge,X)),Lt=[{value:ge.length>0?ge.join(",")||null:void 0}];else if(a(fe))Lt=fe;else{var nt=Object.keys(ge);Lt=oe?nt.sort(oe):nt}var rt=K?_.replace(/\./g,"%2E"):_,xt=P&&a(ge)&&ge.length===1?rt+"[]":rt;if(M&&a(ge)&&ge.length===0)return xt+"[]";for(var Ne=0;Ne<Lt.length;++Ne){var ze=Lt[Ne],B=typeof ze=="object"&&typeof ze.value<"u"?ze.value:ge[ze];if(!(W&&B===null)){var Q=ke&&K?ze.replace(/\./g,"%2E"):ze,q=a(ge)?typeof T=="function"?T(xt,Q):xt:xt+(ke?"."+Q:"["+Q+"]");Se.set(S,tt);var J=r();J.set(g,Se),c(Jt,I(B,q,T,P,M,U,W,K,T==="comma"&&de&&a(ge)?null:X,fe,oe,ke,te,ve,ye,de,Me,J))}}return Jt},b=function(S){if(!S)return d;if(typeof S.allowEmptyArrays<"u"&&typeof S.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof S.encodeDotInKeys<"u"&&typeof S.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(S.encoder!==null&&typeof S.encoder<"u"&&typeof S.encoder!="function")throw new TypeError("Encoder has to be a function.");var _=S.charset||d.charset;if(typeof S.charset<"u"&&S.charset!=="utf-8"&&S.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var T=t.default;if(typeof S.format<"u"){if(!n.call(t.formatters,S.format))throw new TypeError("Unknown format option provided.");T=S.format}var P=t.formatters[T],M=d.filter;(typeof S.filter=="function"||a(S.filter))&&(M=S.filter);var U;if(S.arrayFormat in i?U=S.arrayFormat:"indices"in S?U=S.indices?"indices":"repeat":U=d.arrayFormat,"commaRoundTrip"in S&&typeof S.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var W=typeof S.allowDots>"u"?S.encodeDotInKeys===!0?!0:d.allowDots:!!S.allowDots;return{addQueryPrefix:typeof S.addQueryPrefix=="boolean"?S.addQueryPrefix:d.addQueryPrefix,allowDots:W,allowEmptyArrays:typeof S.allowEmptyArrays=="boolean"?!!S.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:U,charset:_,charsetSentinel:typeof S.charsetSentinel=="boolean"?S.charsetSentinel:d.charsetSentinel,commaRoundTrip:S.commaRoundTrip,delimiter:typeof S.delimiter>"u"?d.delimiter:S.delimiter,encode:typeof S.encode=="boolean"?S.encode:d.encode,encodeDotInKeys:typeof S.encodeDotInKeys=="boolean"?S.encodeDotInKeys:d.encodeDotInKeys,encoder:typeof S.encoder=="function"?S.encoder:d.encoder,encodeValuesOnly:typeof S.encodeValuesOnly=="boolean"?S.encodeValuesOnly:d.encodeValuesOnly,filter:M,format:T,formatter:P,serializeDate:typeof S.serializeDate=="function"?S.serializeDate:d.serializeDate,skipNulls:typeof S.skipNulls=="boolean"?S.skipNulls:d.skipNulls,sort:typeof S.sort=="function"?S.sort:null,strictNullHandling:typeof S.strictNullHandling=="boolean"?S.strictNullHandling:d.strictNullHandling}};return od=function(I,S){var _=I,T=b(S),P,M;typeof T.filter=="function"?(M=T.filter,_=M("",_)):a(T.filter)&&(M=T.filter,P=M);var U=[];if(typeof _!="object"||_===null)return"";var W=i[T.arrayFormat],K=W==="comma"&&T.commaRoundTrip;P||(P=Object.keys(_)),T.sort&&P.sort(T.sort);for(var X=r(),fe=0;fe<P.length;++fe){var oe=P[fe];T.skipNulls&&_[oe]===null||c(U,m(_[oe],oe,W,K,T.allowEmptyArrays,T.strictNullHandling,T.skipNulls,T.encodeDotInKeys,T.encode?T.encoder:null,T.filter,T.sort,T.allowDots,T.serializeDate,T.format,T.formatter,T.encodeValuesOnly,T.charset,X))}var ke=U.join(T.delimiter),te=T.addQueryPrefix===!0?"?":"";return T.charsetSentinel&&(T.charset==="iso-8859-1"?te+="utf8=%26%2310003%3B&":te+="utf8=%E2%9C%93&"),ke.length>0?te+ke:""},od}var ud,Pb;function uI(){if(Pb)return ud;Pb=1;var r=Ib(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(g){return g.replace(/&#(\d+);/g,function(m,b){return String.fromCharCode(parseInt(b,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,b){var I={__proto__:null},S=b.ignoreQueryPrefix?m.replace(/^\?/,""):m;S=S.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var _=b.parameterLimit===1/0?void 0:b.parameterLimit,T=S.split(b.delimiter,_),P=-1,M,U=b.charset;if(b.charsetSentinel)for(M=0;M<T.length;++M)T[M].indexOf("utf8=")===0&&(T[M]===c?U="utf-8":T[M]===u&&(U="iso-8859-1"),P=M,M=T.length);for(M=0;M<T.length;++M)if(M!==P){var W=T[M],K=W.indexOf("]="),X=K===-1?W.indexOf("="):K+1,fe,oe;X===-1?(fe=b.decoder(W,n.decoder,U,"key"),oe=b.strictNullHandling?null:""):(fe=b.decoder(W.slice(0,X),n.decoder,U,"key"),oe=r.maybeMap(a(W.slice(X+1),b),function(te){return b.decoder(te,n.decoder,U,"value")})),oe&&b.interpretNumericEntities&&U==="iso-8859-1"&&(oe=i(oe)),W.indexOf("[]=")>-1&&(oe=t(oe)?[oe]:oe);var ke=e.call(I,fe);ke&&b.duplicates==="combine"?I[fe]=r.combine(I[fe],oe):(!ke||b.duplicates==="last")&&(I[fe]=oe)}return I},h=function(g,m,b,I){for(var S=I?m:a(m,b),_=g.length-1;_>=0;--_){var T,P=g[_];if(P==="[]"&&b.parseArrays)T=b.allowEmptyArrays&&(S===""||b.strictNullHandling&&S===null)?[]:[].concat(S);else{T=b.plainObjects?Object.create(null):{};var M=P.charAt(0)==="["&&P.charAt(P.length-1)==="]"?P.slice(1,-1):P,U=b.decodeDotInKeys?M.replace(/%2E/g,"."):M,W=parseInt(U,10);!b.parseArrays&&U===""?T={0:S}:!isNaN(W)&&P!==U&&String(W)===U&&W>=0&&b.parseArrays&&W<=b.arrayLimit?(T=[],T[W]=S):U!=="__proto__"&&(T[U]=S)}S=T}return S},d=function(m,b,I,S){if(m){var _=I.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m,T=/(\[[^[\]]*])/,P=/(\[[^[\]]*])/g,M=I.depth>0&&T.exec(_),U=M?_.slice(0,M.index):_,W=[];if(U){if(!I.plainObjects&&e.call(Object.prototype,U)&&!I.allowPrototypes)return;W.push(U)}for(var K=0;I.depth>0&&(M=P.exec(_))!==null&&K<I.depth;){if(K+=1,!I.plainObjects&&e.call(Object.prototype,M[1].slice(1,-1))&&!I.allowPrototypes)return;W.push(M[1])}if(M){if(I.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+I.depth+" and strictDepth is true");W.push("["+_.slice(M.index)+"]")}return h(W,b,I,S)}},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 b=typeof m.charset>"u"?n.charset:m.charset,I=typeof m.duplicates>"u"?n.duplicates:m.duplicates;if(I!=="combine"&&I!=="first"&&I!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var S=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:n.allowDots:!!m.allowDots;return{allowDots:S,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:b,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:I,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,strictDepth:typeof m.strictDepth=="boolean"?!!m.strictDepth:n.strictDepth,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:n.strictNullHandling}};return ud=function(g,m){var b=y(m);if(g===""||g===null||typeof g>"u")return b.plainObjects?Object.create(null):{};for(var I=typeof g=="string"?f(g,b):g,S=b.plainObjects?Object.create(null):{},_=Object.keys(I),T=0;T<_.length;++T){var P=_[T],M=d(P,I[P],b,typeof g=="string");S=r.merge(S,M,b)}return b.allowSparse===!0?S:r.compact(S)},ud}var cd,Nb;function cI(){if(Nb)return cd;Nb=1;var r=oI(),e=uI(),t=sd();return cd={formats:t,parse:e,stringify:r},cd}(function(r,e){(function(t,n){n(e,Pk,Nk,cI())})(pi,function(t,n,i,a){var u=function(B,Q,q,J){function ee(V){return V instanceof q?V:new q(function(xe){xe(V)})}return new(q||(q=Promise))(function(V,xe){function Ve(_e){try{se(J.next(_e))}catch(He){xe(He)}}function $e(_e){try{se(J.throw(_e))}catch(He){xe(He)}}function se(_e){_e.done?V(_e.value):ee(_e.value).then(Ve,$e)}se((J=J.apply(B,Q||[])).next())})},c=function(B,Q){var q={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},J,ee,V,xe;return xe={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function Ve(se){return function(_e){return $e([se,_e])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,ee&&(V=se[0]&2?ee.return:se[0]?ee.throw||((V=ee.return)&&V.call(ee),0):ee.next)&&!(V=V.call(ee,se[1])).done)return V;switch(ee=0,V&&(se=[se[0]&2,V.value]),se[0]){case 0:case 1:V=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,ee=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(V=q.trys,!(V=V.length>0&&V[V.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!V||se[1]>V[0]&&se[1]<V[3])){q.label=se[1];break}if(se[0]===6&&q.label<V[1]){q.label=V[1],V=se;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(se);break}V[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(B,q)}catch(_e){se=[6,_e],ee=0}finally{J=V=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}};function f(B,Q){if(B.directives&&B.directives.length){var q={};return B.directives.forEach(function(J){q[J.name.value]=i.argumentsObjectFromField(J,Q)}),q}return null}var h=Object.prototype.hasOwnProperty;function d(B,Q){Q!==null&&typeof Q=="object"&&Object.keys(Q).forEach(function(q){var J=Q[q];h.call(B,q)?d(B[q],J):B[q]=J})}function y(B,Q,q,J,ee,V){V===void 0&&(V={});var xe=i.getMainDefinition(Q),Ve=i.getFragmentDefinitions(Q),$e=i.createFragmentMap(Ve),se=V.resultMapper,_e=V.fragmentMatcher||function(){return!0},He={fragmentMap:$e,contextValue:J,variableValues:ee,resultMapper:se,resolver:B,fragmentMatcher:_e};return g(xe.selectionSet,q,He)}function g(B,Q,q){return u(this,void 0,void 0,function(){var J,ee,V,xe,Ve,$e=this;return c(this,function(se){switch(se.label){case 0:return J=q.fragmentMap,ee=q.contextValue,V=q.variableValues,xe={},Ve=function(_e){return u($e,void 0,void 0,function(){var He,ht,dt,Yt,St;return c(this,function(Vt){switch(Vt.label){case 0:return i.shouldInclude(_e,V)?i.isField(_e)?[4,m(_e,Q,q)]:[3,2]:[2];case 1:return He=Vt.sent(),ht=i.resultKeyNameFromField(_e),He!==void 0&&(xe[ht]===void 0?xe[ht]=He:d(xe[ht],He)),[2];case 2:if(i.isInlineFragment(_e))dt=_e;else if(dt=J[_e.name.value],!dt)throw new Error("No fragment named "+_e.name.value);return Yt=dt.typeCondition.name.value,q.fragmentMatcher(Q,Yt,ee)?[4,g(dt.selectionSet,Q,q)]:[3,4];case 3:St=Vt.sent(),d(xe,St),Vt.label=4;case 4:return[2]}})})},[4,Promise.all(B.selections.map(Ve))];case 1:return se.sent(),q.resultMapper?[2,q.resultMapper(xe,Q)]:[2,xe]}})})}function m(B,Q,q){return u(this,void 0,void 0,function(){var J,ee,V,xe,Ve,$e,se;return c(this,function(_e){switch(_e.label){case 0:return J=q.variableValues,ee=q.contextValue,V=q.resolver,xe=B.name.value,Ve=i.argumentsObjectFromField(B,J),$e={isLeaf:!B.selectionSet,resultKey:i.resultKeyNameFromField(B),directives:f(B,J),field:B},[4,V(xe,Q,Ve,ee,$e)];case 1:return se=_e.sent(),B.selectionSet?se==null?[2,se]:Array.isArray(se)?[2,b(B,se,q)]:[2,g(B.selectionSet,se,q)]:[2,se]}})})}function b(B,Q,q){return Promise.all(Q.map(function(J){return J===null?null:Array.isArray(J)?b(B,J,q):g(B.selectionSet,J,q)}))}var I=function(){var B=function(Q,q){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,ee){J.__proto__=ee}||function(J,ee){for(var V in ee)ee.hasOwnProperty(V)&&(J[V]=ee[V])},B(Q,q)};return function(Q,q){B(Q,q);function J(){this.constructor=Q}Q.prototype=q===null?Object.create(q):(J.prototype=q.prototype,new J)}}(),S=function(){return S=Object.assign||function(B){for(var Q,q=1,J=arguments.length;q<J;q++){Q=arguments[q];for(var ee in Q)Object.prototype.hasOwnProperty.call(Q,ee)&&(B[ee]=Q[ee])}return B},S.apply(this,arguments)},_=function(B,Q,q,J){function ee(V){return V instanceof q?V:new q(function(xe){xe(V)})}return new(q||(q=Promise))(function(V,xe){function Ve(_e){try{se(J.next(_e))}catch(He){xe(He)}}function $e(_e){try{se(J.throw(_e))}catch(He){xe(He)}}function se(_e){_e.done?V(_e.value):ee(_e.value).then(Ve,$e)}se((J=J.apply(B,Q||[])).next())})},T=function(B,Q){var q={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},J,ee,V,xe;return xe={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function Ve(se){return function(_e){return $e([se,_e])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,ee&&(V=se[0]&2?ee.return:se[0]?ee.throw||((V=ee.return)&&V.call(ee),0):ee.next)&&!(V=V.call(ee,se[1])).done)return V;switch(ee=0,V&&(se=[se[0]&2,V.value]),se[0]){case 0:case 1:V=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,ee=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(V=q.trys,!(V=V.length>0&&V[V.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!V||se[1]>V[0]&&se[1]<V[3])){q.label=se[1];break}if(se[0]===6&&q.label<V[1]){q.label=V[1],V=se;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(se);break}V[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(B,q)}catch(_e){se=[6,_e],ee=0}finally{J=V=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}},P=function(){for(var B=0,Q=0,q=arguments.length;Q<q;Q++)B+=arguments[Q].length;for(var J=Array(B),ee=0,Q=0;Q<q;Q++)for(var V=arguments[Q],xe=0,Ve=V.length;xe<Ve;xe++,ee++)J[ee]=V[xe];return J},M=function(B){var Q=B.replace(/\s/g,""),q=Q.replace(/\[(.*)\]/,function(J,ee,V,xe){return((ee!=null&&ee.length)>0?ee:null)||Q});return q},U=function(B,Q,q,J){if(Array.isArray(B)){var ee=M(Q);return B.map(function(V){return U(V,ee,q,J)})}return B==null||typeof B=="number"||typeof B=="boolean"||typeof B=="string"?B:q(B,Q,q,J)},W=function(B){return B.directives&&B.directives.length?B.directives.find(function(Q){return Q.name.value==="rest"}):null};function K(B,Q,q,J,ee){return ee==null||Q==null||typeof Q=="number"||typeof Q=="boolean"||typeof Q=="string"||ee.selections.forEach(function(V){if(i.isInlineFragment(V))K(B,Q,q,J,V.selectionSet);else if(V.kind==="FragmentSpread"){var xe=J[V.name.value];K(B,Q,q,J,xe.selectionSet)}else if(i.isField(V)){var Ve=i.resultKeyNameFromField(V);Ve===B&&W(V)!=null?X(Q,q,J,V.selectionSet):K(B,Q,q,J,V.selectionSet)}else return function($e){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),Q}function X(B,Q,q,J){if(!(B==null||typeof B=="number"||typeof B=="boolean"||typeof B=="string")){if(Array.isArray(B)){B.forEach(function(ee){return X(ee,Q,q,J)});return}J.selections.forEach(function(ee){if(i.isInlineFragment(ee))X(B,Q,q,ee.selectionSet);else if(ee.kind==="FragmentSpread"){var V=q[ee.name.value];X(B,Q,q,V.selectionSet)}else if(i.isField(ee)){var xe=B[ee.name.value];ee.name.value==="__typename"||(typeof xe>"u"?B[ee.name.value]=null:xe!=null&&typeof xe=="object"&&ee.selectionSet!=null&&X(xe,Q,q,ee.selectionSet))}else return function(Ve){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var fe=function(B,Q){var q=B[Q||nt]||B[nt];return typeof q=="string"?{uri:q}:S({responseTransformer:null},q)},oe=function(B,Q,q){return q===void 0||Q===void 0?B:B.replace(":"+Q,q)},ke=function(){function B(){}return B.replacerForPath=function(Q){if(Q in B.cache)return B.cache[Q];var q=Q.indexOf("?"),J=Q.split(B.argReplacement),ee=[],V=!1;J.reduce(function(Ve,$e){if($e===""||$e==="{}")return Ve+$e.length;var se=Ve+$e.length;if($e[0]==="{"&&$e[$e.length-1]==="}"){var _e=$e.slice(1,$e.length-1).split(".");ee.push(function(He,ht){try{var dt=te(He,_e);return!ht||typeof dt!="object"||dt==null?String(dt):a.stringify(dt)}catch{var Yt=[Q,_e.join(".")].join("|");return Yt in B.warnTable||(console.warn("Warning: RestLink caught an error while unpacking",Yt,"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."),B.warnTable[Yt]=!0),""}})}else ee.push($e),!V&&se>=q&&(V=!0,ee.push(!0));return se},0);var xe=function(Ve){var $e=!1,se=ee.reduce(function(_e,He){return typeof He=="string"?_e+He:typeof He=="boolean"?($e=!0,_e):_e+He(Ve,$e)},"");return se};return B.cache[Q]=xe},B.cache={},B.warnTable={},B.argReplacement=/({[._a-zA-Z0-9]*})/,B}();function te(B,Q){if(Q.length===0)return B;var q=P(Q),J=q.shift();return te(B[J],q)}var ve=["__typename"],ye=typeof globalThis=="object"&&globalThis||pi,de=function(B,Q,q){q===void 0&&(q=[]);var J=null;return Q.length!=2?J=function(ee,V){return Q(ee)}:J=Q,Array.isArray(B)?B.map(function(ee,V){return de(ee,J,P(q,[String(V)]))}):B==null||typeof B!="object"||B.constructor!==Object||ye.FileList&&B instanceof FileList||ye.File&&B instanceof File?B:Object.keys(B).reduce(function(ee,V){var xe=B[V];if(ve.indexOf(V)!==-1)return ee[V]=xe,ee;var Ve=P(q,[V]);return ee[J(V,Ve)]=de(xe,J,Ve),ee},{})},Me=function(B){return B},Se=function(B){return B instanceof Headers?B:new Headers(B||{})},ge=function(){for(var B=[],Q=0;Q<arguments.length;Q++)B[Q]=arguments[Q];return B.reduce(function(q,J){return J&&(J.forEach||(J=Se(J)),J.forEach(function(ee,V){q.append(V,ee)})),q},new Headers)},qe=function(B,Q,q){var J=new Headers;return B.forEach(function(ee,V){Q.indexOf(V)===-1&&J.append(V,ee)}),ge(J,q||new Headers)},tt=function(B){return function(Q,q){return qe(Q,B,q)}},je=["GET","POST","PUT","PATCH","DELETE"],mt=function(B,Q){switch(Q){case"query":if(je.indexOf(B.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+B+'".');case"mutation":if(je.indexOf(B.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 q=Q;return q}},Pt=function(B,Q,q){var J=new Error(q);throw J.response=B,J.statusCode=B.status,J.result=Q,J},Jt=function(B,Q){return B==null||typeof B!="object"?B:Array.isArray(B)?B.map(function(q){return Jt(q,Q)}):(B.__typename=Q,B)},Lt=function(B,Q,q,J,ee){return _(void 0,void 0,void 0,function(){var V,xe,Ve,$e,se,_e,He,ht,dt,Yt,St,Vt,Ht,Er,Wt,sr,dr,Ar,zt,H,G,it,gt,ct,We,Kt,Zt,Gt,kr,Hr,Fr,jt,Or,$r,Lr,ar,Gr,Tr,gr,Ir,Sn,Un,R,ue,be,Ie,Be,ot,Qe,Ke;return T(this,function(Ze){switch(Ze.label){case 0:if(V=ee.directives,xe=ee.isLeaf,Ve=ee.resultKey,$e=J.exportVariablesByNode,se=$e.get(Q)||{},_e=function(yt){return yt instanceof Array?yt.forEach(_e):$e.set(yt,S({},se)),yt},He=(Q||{})[Ve],ht=(Q||{})[B],Q&&V&&V.export&&(se[V.export.as]=ht),dt=V&&V.type,!xe&&dt){if(V.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return _e(ht),[2,Jt(ht,V.type.name)]}if(Yt=!V||!V.rest,Yt)return[2,_e(He||ht)];if(St=J.credentials,Vt=J.endpoints,Ht=J.headers,Er=J.customFetch,Wt=J.operationType,sr=J.typePatcher,dr=J.mainDefinition,Ar=J.fragmentDefinitions,zt=J.fieldNameNormalizer,H=J.fieldNameDenormalizer,G=J.serializers,it=J.responseTransformer,gt=i.createFragmentMap(Ar),ct=V.rest,We=ct.path,Kt=ct.endpoint,Zt=ct.pathBuilder,Gt=fe(Vt,Kt),kr=We==null&&Zt==null,kr)throw new Error('One of ("path" | "pathBuilder") must be set in the @rest() directive. This request had neither, please add one');if(Zt||(We.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Zt=function(yt){var w=yt.args,k=yt.exportVariables,A=S(S({},w),k),C=Object.keys(A).reduce(function(D,$){return oe(D,$,A[$])},We);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}):Zt=ke.replacerForPath(We)),Hr={args:q,exportVariables:se,context:J,"@rest":V.rest,replacer:Zt},Fr=Zt(Hr),jt=V.rest,Or=jt.method,$r=jt.type,Lr=jt.bodyBuilder,ar=jt.bodyKey,Gr=jt.fieldNameDenormalizer,Tr=jt.fieldNameNormalizer,gr=jt.bodySerializer,Or||(Or="GET"),ar||(ar="input"),Ir=void 0,Sn=void 0,["GET","DELETE"].indexOf(Or)===-1){if(!Lr){if(Un=Hr.exportVariables[ar]||Hr.args&&Hr.args[ar],!Un)throw new Error("[GraphQL "+Or+" "+Wt+" using a REST call without a body]. No `"+ar+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Lr=function(yt){return Un}}if(Ir=de(Lr(Hr),Gr||H||Me),R=void 0,typeof gr=="string"){if(!G.hasOwnProperty(gr))throw new Error('"bodySerializer" must correspond to configured serializer. '+("Please make sure to specify a serializer called "+gr+' in the "bodySerializers" property of the RestLink.'));R=G[gr](Ir,Ht)}else R=gr?gr(Ir,Ht):G[rt](Ir,Ht);Ir=R.body,Sn=new Headers(R.headers)}return mt(Or,Wt||"query"),ue=S({method:Or,headers:Sn||Ht,body:Ir},St?{credentials:St}:{}),be=""+Gt.uri+Fr,[4,(Er||fetch)(be,ue)];case 1:return Ie=Ze.sent(),J.responses.push(Ie),Ie.ok?(Ie.status===204||Ie.headers.get("Content-Length")==="0"?Be={}:Be=Ie,[3,9]):[3,2];case 2:return Ie.status!==404?[3,3]:(Be=null,[3,9]);case 3:ot=void 0,Ze.label=4;case 4:return Ze.trys.push([4,6,,8]),[4,Ie.clone().json()];case 5:return ot=Ze.sent(),[3,8];case 6:return Ze.sent(),[4,Ie.clone().text()];case 7:return ot=Ze.sent(),[3,8];case 8:Pt(Ie,ot,"Response not successful: Received status code "+Ie.status),Ze.label=9;case 9:if(Qe=Gt.responseTransformer||it,!Qe)return[3,14];Ze.label=10;case 10:return Ze.trys.push([10,12,,13]),[4,Qe(Be,$r)];case 11:return Be=Ze.sent(),[3,13];case 12:throw Ke=Ze.sent(),console.warn("An error occurred in a responseTransformer:"),Ke;case 13:return[3,16];case 14:return Be&&Be.json?[4,Be.json()]:[3,16];case 15:Be=Ze.sent(),Ze.label=16;case 16:return Be=de(Be,Tr||zt||Me),Be=K(Ve,Be,dr,gt,dr.selectionSet),Be=U(Be,$r,sr,{resolverParams:{fieldName:B,root:Q,args:q,context:J,info:ee}}),[2,_e(Be)]}})})},nt="",rt="",xt=function(B,Q){return Q.has("content-type")||Q.append("Content-Type","application/json"),{body:JSON.stringify(B),headers:Q}},Ne={test:function(B){return B.name.value==="rest"},remove:!0},ze=function(B){I(Q,B);function Q(q){var J,ee=q.uri,V=q.endpoints,xe=q.headers,Ve=q.fieldNameNormalizer,$e=q.fieldNameDenormalizer,se=q.typePatcher,_e=q.customFetch,He=q.credentials,ht=q.bodySerializers,dt=q.defaultSerializer,Yt=q.responseTransformer,St=B.call(this)||this,Vt={};if(Vt[nt]=ee||"",St.endpoints=Object.assign({},V||Vt),ee==null&&V==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(ee!=null){var Ht=(V||{})[nt];if(Ht!=null&&Ht!=ee)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");St.endpoints[nt]=ee}if(St.endpoints[nt]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),se==null)St.typePatcher=function(Wt,sr,dr){return S({__typename:sr},Wt)};else if(!Array.isArray(se)&&typeof se=="object"&&Object.keys(se).map(function(Wt){return se[Wt]}).reduce(function(Wt,sr){return Wt&&typeof sr=="function"},!0)){var Er=se;St.typePatcher=function(Wt,sr,dr,Ar){var zt=Wt.__typename||sr;if(Array.isArray(Wt))return Wt.map(function(G){return dr(G,zt,dr,Ar)});var H=Er[zt]||function(G){return G};return S({__typename:zt},H(Wt,zt,dr,Ar))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return ht&&ht.hasOwnProperty(rt)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),St.responseTransformer=Yt||null,St.fieldNameNormalizer=Ve||null,St.fieldNameDenormalizer=$e||null,St.headers=Se(xe),St.credentials=He||null,St.customFetch=_e,St.serializers=S((J={},J[rt]=dt||xt,J),ht||{}),St.processedDocuments=new Map,St}return Q.prototype.removeRestSetsFromDocument=function(q){var J=this.processedDocuments.get(q);if(J)return J;i.checkDocument(q);var ee=i.removeDirectivesFromDocument([Ne],q);return this.processedDocuments.set(q,ee),ee},Q.prototype.request=function(q,J){var ee=q.query,V=q.variables,xe=q.getContext,Ve=q.setContext,$e=xe(),se=i.hasDirectives(["rest"],ee);if(!se)return J(q);var _e=this.removeRestSetsFromDocument(ee),He=$e.headersMergePolicy;He==null&&Array.isArray($e.headersToOverride)?He=tt($e.headersToOverride):He==null&&(He=ge);var ht=He(this.headers,$e.headers);ht.has("Accept")||ht.append("Accept","application/json");var dt=$e.credentials||this.credentials,Yt=i.addTypenameToDocument(ee),St=i.getMainDefinition(ee),Vt=i.getFragmentDefinitions(ee),Ht=(St||{}).operation||"query",Er={headers:ht,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:dt,customFetch:this.customFetch,operationType:Ht,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:St,fragmentDefinitions:Vt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},Wt={},sr;return _e&&J?(q.query=_e,sr=J(q)):sr=n.Observable.of({data:{}}),sr.flatMap(function(dr){var Ar=dr.data,zt=dr.errors;return new n.Observable(function(H){y(Lt,Yt,Ar,Er,V,Wt).then(function(G){Ve({restResponses:($e.restResponses||[]).concat(Er.responses)}),H.next({data:G,errors:zt}),H.complete()}).catch(function(G){G.name!=="AbortError"&&(G.result&&G.result.errors&&H.next(G.result),H.error(G))})})})},Q}(n.ApolloLink);t.RestLink=ze,t.PathBuilder=ke,Object.defineProperty(t,"__esModule",{value:!0})})})(mh,mh.exports);var lI=mh.exports;const rc=me.createContext(),fI=()=>{const{isAuthenticated:r,login:e}=ti(),{children:t,isEmbedded:n,setIsEmbedded:i,authError:a}=me.useContext(rc),u=pn.useNavigate(),c=pn.useLocation(),[f,h]=me.useState(!1),[d,y]=me.useState(),[g,m]=me.useState(),[b,I]=me.useState({}),[S,_]=me.useState({}),[T,P]=me.useState({}),[M,U]=me.useState(!1);me.useEffect(()=>{var te;if(!(!c||c.pathname!=="/mm-embedded-login")){if(r||a)if(((te=new URL(origin))==null?void 0:te.protocol)==="http:"){window.close();return}else{const ye=new URLSearchParams(c.search),de=ye.get("id"),Me=ye.get("origin");a?window.parent.postMessage({type:"authorize-failed",instanceId:de,error:a,authUrl:window.location.href},Me):window.parent.postMessage({type:"authorized",instanceId:de,authUrl:window.location.href},Me);return}r===!1&&e()}},[c]),me.useEffect(()=>{var de,Me;if(r===null||!c||c.pathname!=="/mm-embedded-interop")return;const te=new URLSearchParams(c.search),ve=te.get("id"),ye=te.get("origin");if(ye){const Se=(de=new URL(ye))==null?void 0:de.hostname;if(/^(?:[\w-]+\.)*(?:machinemetrics\.com|machinemetrics-us-gov\.com|m12s\.com)$/.test(Se))y(ye);else{alert("Invalid Embeddable Zone Host");return}}if(r===!1){if(ye){const Se={instanceId:ve,authUrl:`${window.location.protocol}//${window.location.host}/mm-embedded-login?id=${ve}&origin=${ye}`,origin:ye};if(((Me=new URL(ye))==null?void 0:Me.protocol)==="http:"){window.parent.postMessage({type:"login",...Se},ye);return}e({mm_instanceId:Se.instanceId,mm_authUrl:encodeURIComponent(Se.authUrl),mm_origin:Se.origin});return}e();return}ve&&m(ve),ve&&ye&&i(!0)},[c,r]),pn.useBlocker(({nextLocation:te})=>{var ve;return n?(ve=te.state)!=null&&ve.fromParent?(h(!0),!1):(W(`${te.pathname}${te.search}`),!0):!1}),me.useEffect(()=>{if(!n||!d)return;const te=ve=>{ve.metaKey&&ve.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:g},d)};return window.addEventListener("keydown",te),()=>{window.removeEventListener("keydown",te)}},[n,d]),me.useEffect(()=>{if(!n||!d)return;const te=({origin:ve,data:ye})=>{var de,Me;if(ve===d)switch(ye.type){case"navigate":u(ye.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":I(ye.context||{});break;case"set-configuring":U(ye.isConfiguring);break;case"load-options":(de=S[ye.name])==null||de.call(S,{filter:ye.filter});break;case"validate":(Me=T[ye.name])==null||Me.call(T,{value:ye.value});break}};return window.addEventListener("message",te),!f&&r&&window.parent.postMessage({type:"ready",instanceId:g},d),()=>{window.removeEventListener("message",te)}},[u,f,n,r,d,S,T]);const W=te=>{!f&&!r||window.parent.postMessage({type:"set-path",instanceId:g,path:te},d)},K=te=>{f&&window.parent.postMessage({type:"set-summary",instanceId:g,summary:te},d)},X=te=>{f&&window.parent.postMessage({type:"toast",instanceId:g,message:te},d)},fe=te=>{f&&window.parent.postMessage({type:"popup",instanceId:g,message:te},d)},oe=async(te,ve)=>{f&&(ve.validate&&typeof ve.validate=="function"&&P(ye=>{const de=async Me=>{const Se=await ve.validate(Me);window.parent.postMessage({type:"set-validation",instanceId:g,name:te,validation:Se},d)};return ye[te]&&de({value:""}),{...ye,[te]:de}}),ve.options&&_(ye=>{const de=async Me=>{const ge=await(typeof ve.options=="function"?ve.options:()=>ve.options)(Me);window.parent.postMessage({type:"set-options",instanceId:g,name:te,options:ge},d)};return ye[te]&&de({filter:""}),{...ye,[te]:de}}),window.parent.postMessage({type:"add-setting",instanceId:g,setting:{name:te,...ve,options:void 0,validate:void 0}},d))},ke=me.useMemo(()=>({isEmbedded:n,isConfiguring:M,navigateParent:W,setSummary:K,toast:X,popup:fe,context:b,addSetting:oe}),[n,M,W,K,X,fe,b,oe]);return nr.jsx(fa.Provider,{value:ke,children:c.pathname!=="/mm-embedded-interop"&&c.pathname!=="/mm-embedded-login"?t:nr.jsx(nr.Fragment,{})})},hI=()=>{const{urls:r,jwtRef:e,accessToken:t}=ti(),{graphQLRoleOverride:n,children:i}=me.useContext(rc),[a,u]=me.useState(),[c,f]=me.useState(),h=()=>{const g=new URL(r.graphQLUrl);return`//${g.host}${g.pathname}`},d=()=>n?{"X-Hasura-Role":n}:{};me.useEffect(()=>{const g=new Sk(kk({url:`wss:${h()}`,lazy:!0,reconnect:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...d()}})})),m=N0(({operation:P,networkError:M,forward:U})=>(Bi(P.query).operation==="subscription"&&M&&g.client.terminate(),U(P))),I=P0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${e.current}`,...d()}})).concat(uf({uri:`https:${h()}`,fetch:window.fetch})),S=m.split(({query:P})=>{const M=Bi(P);return M.kind==="OperationDefinition"&&M.operation==="subscription"},g,I),T=P0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${t}`}})).concat(new lI.RestLink({uri:r.apiUrl}));f(Kr.from([T,S]))},[]),me.useEffect(()=>{c&&u(new Cf({link:c,cache:new Of}))},[c]);const y=me.useMemo(()=>({link:c}),[c]);return nr.jsx(u0.Provider,{value:y,children:a?nr.jsx(S1,{client:a,children:nr.jsx(BA,{children:nr.jsx(fI,{children:i})})}):nr.jsx(nr.Fragment,{})})},dI=Qp.div`
131
+ `+G.prev}function zt(H,G){var it=nt(H),gt=[];if(it){gt.length=H.length;for(var ct=0;ct<H.length;ct++)gt[ct]=V(H,ct)?G(H[ct],H):""}var We=typeof te=="function"?te(H):[],Kt;if(ye){Kt={};for(var Zt=0;Zt<We.length;Zt++)Kt["$"+We[Zt]]=We[Zt]}for(var Gt in H)V(H,Gt)&&(it&&String(Number(Gt))===Gt&&Gt<H.length||ye&&Kt["$"+Gt]instanceof Symbol||(W.call(/[^\w$]/,Gt)?gt.push(G(Gt,H)+": "+G(H[Gt],H)):gt.push(Gt+": "+G(H[Gt],H))));if(typeof te=="function")for(var kr=0;kr<We.length;kr++)Me.call(H,We[kr])&&gt.push("["+G(We[kr])+"]: "+G(H[We[kr]],H));return gt}return gh}var vh,D0;function Mk(){if(D0)return vh;D0=1;var r=ec(),e=da(),t=function(c,f,h){for(var d=c,y;(y=d.next)!=null;d=y)if(y.key===f)return d.next=y.next,h||(y.next=c.next,c.next=y),y},n=function(c,f){if(c){var h=t(c,f);return h&&h.value}},i=function(c,f,h){var d=t(c,f);d?d.value=h:c.next={key:f,next:c.next,value:h}},a=function(c,f){return c?!!t(c,f):!1},u=function(c,f){if(c)return t(c,f,!0)};return vh=function(){var f,h={assert:function(d){if(!h.has(d))throw new e("Side channel does not contain "+r(d))},delete:function(d){var y=f&&f.next,g=u(f,d);return g&&y&&y===g&&(f=void 0),!!g},get:function(d){return n(f,d)},has:function(d){return a(f,d)},set:function(d,y){f||(f={next:void 0}),i(f,d,y)}};return h},vh}var bh,F0;function L0(){return F0||(F0=1,bh=Object),bh}var wh,q0;function Dk(){return q0||(q0=1,wh=Error),wh}var _h,j0;function Fk(){return j0||(j0=1,_h=EvalError),_h}var xh,U0;function Lk(){return U0||(U0=1,xh=RangeError),xh}var Sh,$0;function qk(){return $0||($0=1,Sh=ReferenceError),Sh}var Eh,B0;function jk(){return B0||(B0=1,Eh=SyntaxError),Eh}var Oh,V0;function Uk(){return V0||(V0=1,Oh=URIError),Oh}var Th,W0;function $k(){return W0||(W0=1,Th=Math.abs),Th}var Ah,z0;function Bk(){return z0||(z0=1,Ah=Math.floor),Ah}var kh,H0;function Vk(){return H0||(H0=1,kh=Math.max),kh}var Ih,G0;function Wk(){return G0||(G0=1,Ih=Math.min),Ih}var Ch,Q0;function zk(){return Q0||(Q0=1,Ch=Math.pow),Ch}var Ph,J0;function Hk(){return J0||(J0=1,Ph=Math.round),Ph}var Nh,Y0;function Gk(){return Y0||(Y0=1,Nh=Number.isNaN||function(e){return e!==e}),Nh}var Rh,K0;function Qk(){if(K0)return Rh;K0=1;var r=Gk();return Rh=function(t){return r(t)||t===0?t:t<0?-1:1},Rh}var Mh,Z0;function Jk(){return Z0||(Z0=1,Mh=Object.getOwnPropertyDescriptor),Mh}var Dh,X0;function eb(){if(X0)return Dh;X0=1;var r=Jk();if(r)try{r([],"length")}catch{r=null}return Dh=r,Dh}var Fh,tb;function Yk(){if(tb)return Fh;tb=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return Fh=r,Fh}var Lh,rb;function Kk(){return rb||(rb=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(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(e,t);if(c.value!==i||c.enumerable!==!0)return!1}return!0}),Lh}var qh,nb;function Zk(){if(nb)return qh;nb=1;var r=typeof Symbol<"u"&&Symbol,e=Kk();return qh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},qh}var jh,ib;function sb(){return ib||(ib=1,jh=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),jh}var Uh,ab;function ob(){if(ab)return Uh;ab=1;var r=L0();return Uh=r.getPrototypeOf||null,Uh}var $h,ub;function Xk(){if(ub)return $h;ub=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 $h=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 _=h.apply(this,i(d,arguments));return Object(_)===_?_:this}return h.apply(f,i(d,arguments))},m=t(0,h.length-d.length),b=[],I=0;I<m;I++)b[I]="$"+I;if(y=Function("binder","return function ("+u(b,",")+"){ return binder.apply(this,arguments); }")(g),h.prototype){var S=function(){};S.prototype=h.prototype,y.prototype=new S,S.prototype=null}return y},$h}var Bh,cb;function tc(){if(cb)return Bh;cb=1;var r=Xk();return Bh=Function.prototype.bind||r,Bh}var Vh,lb;function Wh(){return lb||(lb=1,Vh=Function.prototype.call),Vh}var zh,fb;function hb(){return fb||(fb=1,zh=Function.prototype.apply),zh}var Hh,db;function eI(){return db||(db=1,Hh=typeof Reflect<"u"&&Reflect&&Reflect.apply),Hh}var Gh,pb;function tI(){if(pb)return Gh;pb=1;var r=tc(),e=hb(),t=Wh(),n=eI();return Gh=n||r.call(t,e),Gh}var Qh,mb;function yb(){if(mb)return Qh;mb=1;var r=tc(),e=da(),t=Wh(),n=tI();return Qh=function(a){if(a.length<1||typeof a[0]!="function")throw new e("a function is required");return n(r,t,a)},Qh}var Jh,gb;function rI(){if(gb)return Jh;gb=1;var r=yb(),e=eb(),t;try{t=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return Jh=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(c){return a(c==null?c:i(c))}:!1,Jh}var Yh,vb;function nI(){if(vb)return Yh;vb=1;var r=sb(),e=ob(),t=rI();return Yh=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,Yh}var Kh,bb;function iI(){if(bb)return Kh;bb=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=tc();return Kh=t.call(r,e),Kh}var Zh,wb;function Xh(){if(wb)return Zh;wb=1;var r,e=L0(),t=Dk(),n=Fk(),i=Lk(),a=qk(),u=jk(),c=da(),f=Uk(),h=$k(),d=Bk(),y=Vk(),g=Wk(),m=zk(),b=Hk(),I=Qk(),S=Function,_=function(Ne){try{return S('"use strict"; return ('+Ne+").constructor;")()}catch{}},T=eb(),P=Yk(),M=function(){throw new c},U=T?function(){try{return arguments.callee,M}catch{try{return T(arguments,"callee").get}catch{return M}}}():M,W=Zk()(),K=nI(),X=ob(),fe=sb(),oe=hb(),ke=Wh(),te={},ve=typeof Uint8Array>"u"||!K?r:K(Uint8Array),ye={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":W&&K?K([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":te,"%AsyncGenerator%":te,"%AsyncGeneratorFunction%":te,"%AsyncIteratorPrototype%":te,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":S,"%GeneratorFunction%":te,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":W&&K?K(K([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!W||!K?r:K(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":T,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!W||!K?r:K(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":W&&K?K(""[Symbol.iterator]()):r,"%Symbol%":W?Symbol:r,"%SyntaxError%":u,"%ThrowTypeError%":U,"%TypedArray%":ve,"%TypeError%":c,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":f,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet,"%Function.prototype.call%":ke,"%Function.prototype.apply%":oe,"%Object.defineProperty%":P,"%Object.getPrototypeOf%":X,"%Math.abs%":h,"%Math.floor%":d,"%Math.max%":y,"%Math.min%":g,"%Math.pow%":m,"%Math.round%":b,"%Math.sign%":I,"%Reflect.getPrototypeOf%":fe};if(K)try{null.error}catch(Ne){var de=K(K(Ne));ye["%Error.prototype%"]=de}var Me=function Ne(ze){var B;if(ze==="%AsyncFunction%")B=_("async function () {}");else if(ze==="%GeneratorFunction%")B=_("function* () {}");else if(ze==="%AsyncGeneratorFunction%")B=_("async function* () {}");else if(ze==="%AsyncGenerator%"){var Q=Ne("%AsyncGeneratorFunction%");Q&&(B=Q.prototype)}else if(ze==="%AsyncIteratorPrototype%"){var q=Ne("%AsyncGenerator%");q&&K&&(B=K(q.prototype))}return ye[ze]=B,B},Se={__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"]},ge=tc(),qe=iI(),tt=ge.call(ke,Array.prototype.concat),je=ge.call(oe,Array.prototype.splice),mt=ge.call(ke,String.prototype.replace),Pt=ge.call(ke,String.prototype.slice),Jt=ge.call(ke,RegExp.prototype.exec),Lt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,nt=/\\(\\)?/g,rt=function(ze){var B=Pt(ze,0,1),Q=Pt(ze,-1);if(B==="%"&&Q!=="%")throw new u("invalid intrinsic syntax, expected closing `%`");if(Q==="%"&&B!=="%")throw new u("invalid intrinsic syntax, expected opening `%`");var q=[];return mt(ze,Lt,function(J,ee,V,xe){q[q.length]=V?mt(xe,nt,"$1"):ee||J}),q},xt=function(ze,B){var Q=ze,q;if(qe(Se,Q)&&(q=Se[Q],Q="%"+q[0]+"%"),qe(ye,Q)){var J=ye[Q];if(J===te&&(J=Me(Q)),typeof J>"u"&&!B)throw new c("intrinsic "+ze+" exists, but is not available. Please file an issue!");return{alias:q,name:Q,value:J}}throw new u("intrinsic "+ze+" does not exist!")};return Zh=function(ze,B){if(typeof ze!="string"||ze.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof B!="boolean")throw new c('"allowMissing" argument must be a boolean');if(Jt(/^%?[^%]*%?$/,ze)===null)throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Q=rt(ze),q=Q.length>0?Q[0]:"",J=xt("%"+q+"%",B),ee=J.name,V=J.value,xe=!1,Ve=J.alias;Ve&&(q=Ve[0],je(Q,tt([0,1],Ve)));for(var $e=1,se=!0;$e<Q.length;$e+=1){var _e=Q[$e],He=Pt(_e,0,1),ht=Pt(_e,-1);if((He==='"'||He==="'"||He==="`"||ht==='"'||ht==="'"||ht==="`")&&He!==ht)throw new u("property names with quotes must have matching quotes");if((_e==="constructor"||!se)&&(xe=!0),q+="."+_e,ee="%"+q+"%",qe(ye,ee))V=ye[ee];else if(V!=null){if(!(_e in V)){if(!B)throw new c("base intrinsic for "+ze+" exists, but the property is not available.");return}if(T&&$e+1>=Q.length){var dt=T(V,_e);se=!!dt,se&&"get"in dt&&!("originalValue"in dt.get)?V=dt.get:V=V[_e]}else se=qe(V,_e),V=V[_e];se&&!xe&&(ye[ee]=V)}}return V},Zh}var ed,_b;function xb(){if(_b)return ed;_b=1;var r=Xh(),e=yb(),t=e([r("%String.prototype.indexOf%")]);return ed=function(i,a){var u=r(i,!!a);return typeof u=="function"&&t(i,".prototype.")>-1?e([u]):u},ed}var td,Sb;function Eb(){if(Sb)return td;Sb=1;var r=Xh(),e=xb(),t=ec(),n=da(),i=r("%Map%",!0),a=e("Map.prototype.get",!0),u=e("Map.prototype.set",!0),c=e("Map.prototype.has",!0),f=e("Map.prototype.delete",!0),h=e("Map.prototype.size",!0);return td=!!i&&function(){var y,g={assert:function(m){if(!g.has(m))throw new n("Side channel does not contain "+t(m))},delete:function(m){if(y){var b=f(y,m);return h(y)===0&&(y=void 0),b}return!1},get:function(m){if(y)return a(y,m)},has:function(m){return y?c(y,m):!1},set:function(m,b){y||(y=new i),u(y,m,b)}};return g},td}var rd,Ob;function sI(){if(Ob)return rd;Ob=1;var r=Xh(),e=xb(),t=ec(),n=Eb(),i=da(),a=r("%WeakMap%",!0),u=e("WeakMap.prototype.get",!0),c=e("WeakMap.prototype.set",!0),f=e("WeakMap.prototype.has",!0),h=e("WeakMap.prototype.delete",!0);return rd=a?function(){var y,g,m={assert:function(b){if(!m.has(b))throw new i("Side channel does not contain "+t(b))},delete:function(b){if(a&&b&&(typeof b=="object"||typeof b=="function")){if(y)return h(y,b)}else if(n&&g)return g.delete(b);return!1},get:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&y?u(y,b):g&&g.get(b)},has:function(b){return a&&b&&(typeof b=="object"||typeof b=="function")&&y?f(y,b):!!g&&g.has(b)},set:function(b,I){a&&b&&(typeof b=="object"||typeof b=="function")?(y||(y=new a),c(y,b,I)):n&&(g||(g=n()),g.set(b,I))}};return m}:n,rd}var nd,Tb;function aI(){if(Tb)return nd;Tb=1;var r=da(),e=ec(),t=Mk(),n=Eb(),i=sI(),a=i||n||t;return nd=function(){var c,f={assert:function(h){if(!f.has(h))throw new r("Side channel does not contain "+e(h))},delete:function(h){return!!c&&c.delete(h)},get:function(h){return c&&c.get(h)},has:function(h){return!!c&&c.has(h)},set:function(h,d){c||(c=a()),c.set(h,d)}};return f},nd}var id,Ab;function sd(){if(Ab)return id;Ab=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return id={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},id}var ad,kb;function Ib(){if(kb)return ad;kb=1;var r=sd(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var S=[],_=0;_<256;++_)S.push("%"+((_<16?"0":"")+_.toString(16)).toUpperCase());return S}(),i=function(_){for(;_.length>1;){var T=_.pop(),P=T.obj[T.prop];if(t(P)){for(var M=[],U=0;U<P.length;++U)typeof P[U]<"u"&&M.push(P[U]);T.obj[T.prop]=M}}},a=function(_,T){for(var P=T&&T.plainObjects?Object.create(null):{},M=0;M<_.length;++M)typeof _[M]<"u"&&(P[M]=_[M]);return P},u=function S(_,T,P){if(!T)return _;if(typeof T!="object"){if(t(_))_.push(T);else if(_&&typeof _=="object")(P&&(P.plainObjects||P.allowPrototypes)||!e.call(Object.prototype,T))&&(_[T]=!0);else return[_,T];return _}if(!_||typeof _!="object")return[_].concat(T);var M=_;return t(_)&&!t(T)&&(M=a(_,P)),t(_)&&t(T)?(T.forEach(function(U,W){if(e.call(_,W)){var K=_[W];K&&typeof K=="object"&&U&&typeof U=="object"?_[W]=S(K,U,P):_.push(U)}else _[W]=U}),_):Object.keys(T).reduce(function(U,W){var K=T[W];return e.call(U,W)?U[W]=S(U[W],K,P):U[W]=K,U},M)},c=function(_,T){return Object.keys(T).reduce(function(P,M){return P[M]=T[M],P},_)},f=function(S,_,T){var P=S.replace(/\+/g," ");if(T==="iso-8859-1")return P.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(P)}catch{return P}},h=1024,d=function(_,T,P,M,U){if(_.length===0)return _;var W=_;if(typeof _=="symbol"?W=Symbol.prototype.toString.call(_):typeof _!="string"&&(W=String(_)),P==="iso-8859-1")return escape(W).replace(/%u[0-9a-f]{4}/gi,function(ve){return"%26%23"+parseInt(ve.slice(2),16)+"%3B"});for(var K="",X=0;X<W.length;X+=h){for(var fe=W.length>=h?W.slice(X,X+h):W,oe=[],ke=0;ke<fe.length;++ke){var te=fe.charCodeAt(ke);if(te===45||te===46||te===95||te===126||te>=48&&te<=57||te>=65&&te<=90||te>=97&&te<=122||U===r.RFC1738&&(te===40||te===41)){oe[oe.length]=fe.charAt(ke);continue}if(te<128){oe[oe.length]=n[te];continue}if(te<2048){oe[oe.length]=n[192|te>>6]+n[128|te&63];continue}if(te<55296||te>=57344){oe[oe.length]=n[224|te>>12]+n[128|te>>6&63]+n[128|te&63];continue}ke+=1,te=65536+((te&1023)<<10|fe.charCodeAt(ke)&1023),oe[oe.length]=n[240|te>>18]+n[128|te>>12&63]+n[128|te>>6&63]+n[128|te&63]}K+=oe.join("")}return K},y=function(_){for(var T=[{obj:{o:_},prop:"o"}],P=[],M=0;M<T.length;++M)for(var U=T[M],W=U.obj[U.prop],K=Object.keys(W),X=0;X<K.length;++X){var fe=K[X],oe=W[fe];typeof oe=="object"&&oe!==null&&P.indexOf(oe)===-1&&(T.push({obj:W,prop:fe}),P.push(oe))}return i(T),_},g=function(_){return Object.prototype.toString.call(_)==="[object RegExp]"},m=function(_){return!_||typeof _!="object"?!1:!!(_.constructor&&_.constructor.isBuffer&&_.constructor.isBuffer(_))},b=function(_,T){return[].concat(_,T)},I=function(_,T){if(t(_)){for(var P=[],M=0;M<_.length;M+=1)P.push(T(_[M]));return P}return T(_)};return ad={arrayToObject:a,assign:c,combine:b,compact:y,decode:f,encode:d,isBuffer:m,isRegExp:g,maybeMap:I,merge:u},ad}var od,Cb;function oI(){if(Cb)return od;Cb=1;var r=aI(),e=Ib(),t=sd(),n=Object.prototype.hasOwnProperty,i={brackets:function(S){return S+"[]"},comma:"comma",indices:function(S,_){return S+"["+_+"]"},repeat:function(S){return S}},a=Array.isArray,u=Array.prototype.push,c=function(I,S){u.apply(I,a(S)?S:[S])},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(S){return f.call(S)},skipNulls:!1,strictNullHandling:!1},y=function(S){return typeof S=="string"||typeof S=="number"||typeof S=="boolean"||typeof S=="symbol"||typeof S=="bigint"},g={},m=function I(S,_,T,P,M,U,W,K,X,fe,oe,ke,te,ve,ye,de,Me,Se){for(var ge=S,qe=Se,tt=0,je=!1;(qe=qe.get(g))!==void 0&&!je;){var mt=qe.get(S);if(tt+=1,typeof mt<"u"){if(mt===tt)throw new RangeError("Cyclic object value");je=!0}typeof qe.get(g)>"u"&&(tt=0)}if(typeof fe=="function"?ge=fe(_,ge):ge instanceof Date?ge=te(ge):T==="comma"&&a(ge)&&(ge=e.maybeMap(ge,function(ee){return ee instanceof Date?te(ee):ee})),ge===null){if(U)return X&&!de?X(_,d.encoder,Me,"key",ve):_;ge=""}if(y(ge)||e.isBuffer(ge)){if(X){var Pt=de?_:X(_,d.encoder,Me,"key",ve);return[ye(Pt)+"="+ye(X(ge,d.encoder,Me,"value",ve))]}return[ye(_)+"="+ye(String(ge))]}var Jt=[];if(typeof ge>"u")return Jt;var Lt;if(T==="comma"&&a(ge))de&&X&&(ge=e.maybeMap(ge,X)),Lt=[{value:ge.length>0?ge.join(",")||null:void 0}];else if(a(fe))Lt=fe;else{var nt=Object.keys(ge);Lt=oe?nt.sort(oe):nt}var rt=K?_.replace(/\./g,"%2E"):_,xt=P&&a(ge)&&ge.length===1?rt+"[]":rt;if(M&&a(ge)&&ge.length===0)return xt+"[]";for(var Ne=0;Ne<Lt.length;++Ne){var ze=Lt[Ne],B=typeof ze=="object"&&typeof ze.value<"u"?ze.value:ge[ze];if(!(W&&B===null)){var Q=ke&&K?ze.replace(/\./g,"%2E"):ze,q=a(ge)?typeof T=="function"?T(xt,Q):xt:xt+(ke?"."+Q:"["+Q+"]");Se.set(S,tt);var J=r();J.set(g,Se),c(Jt,I(B,q,T,P,M,U,W,K,T==="comma"&&de&&a(ge)?null:X,fe,oe,ke,te,ve,ye,de,Me,J))}}return Jt},b=function(S){if(!S)return d;if(typeof S.allowEmptyArrays<"u"&&typeof S.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof S.encodeDotInKeys<"u"&&typeof S.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(S.encoder!==null&&typeof S.encoder<"u"&&typeof S.encoder!="function")throw new TypeError("Encoder has to be a function.");var _=S.charset||d.charset;if(typeof S.charset<"u"&&S.charset!=="utf-8"&&S.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var T=t.default;if(typeof S.format<"u"){if(!n.call(t.formatters,S.format))throw new TypeError("Unknown format option provided.");T=S.format}var P=t.formatters[T],M=d.filter;(typeof S.filter=="function"||a(S.filter))&&(M=S.filter);var U;if(S.arrayFormat in i?U=S.arrayFormat:"indices"in S?U=S.indices?"indices":"repeat":U=d.arrayFormat,"commaRoundTrip"in S&&typeof S.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var W=typeof S.allowDots>"u"?S.encodeDotInKeys===!0?!0:d.allowDots:!!S.allowDots;return{addQueryPrefix:typeof S.addQueryPrefix=="boolean"?S.addQueryPrefix:d.addQueryPrefix,allowDots:W,allowEmptyArrays:typeof S.allowEmptyArrays=="boolean"?!!S.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:U,charset:_,charsetSentinel:typeof S.charsetSentinel=="boolean"?S.charsetSentinel:d.charsetSentinel,commaRoundTrip:S.commaRoundTrip,delimiter:typeof S.delimiter>"u"?d.delimiter:S.delimiter,encode:typeof S.encode=="boolean"?S.encode:d.encode,encodeDotInKeys:typeof S.encodeDotInKeys=="boolean"?S.encodeDotInKeys:d.encodeDotInKeys,encoder:typeof S.encoder=="function"?S.encoder:d.encoder,encodeValuesOnly:typeof S.encodeValuesOnly=="boolean"?S.encodeValuesOnly:d.encodeValuesOnly,filter:M,format:T,formatter:P,serializeDate:typeof S.serializeDate=="function"?S.serializeDate:d.serializeDate,skipNulls:typeof S.skipNulls=="boolean"?S.skipNulls:d.skipNulls,sort:typeof S.sort=="function"?S.sort:null,strictNullHandling:typeof S.strictNullHandling=="boolean"?S.strictNullHandling:d.strictNullHandling}};return od=function(I,S){var _=I,T=b(S),P,M;typeof T.filter=="function"?(M=T.filter,_=M("",_)):a(T.filter)&&(M=T.filter,P=M);var U=[];if(typeof _!="object"||_===null)return"";var W=i[T.arrayFormat],K=W==="comma"&&T.commaRoundTrip;P||(P=Object.keys(_)),T.sort&&P.sort(T.sort);for(var X=r(),fe=0;fe<P.length;++fe){var oe=P[fe];T.skipNulls&&_[oe]===null||c(U,m(_[oe],oe,W,K,T.allowEmptyArrays,T.strictNullHandling,T.skipNulls,T.encodeDotInKeys,T.encode?T.encoder:null,T.filter,T.sort,T.allowDots,T.serializeDate,T.format,T.formatter,T.encodeValuesOnly,T.charset,X))}var ke=U.join(T.delimiter),te=T.addQueryPrefix===!0?"?":"";return T.charsetSentinel&&(T.charset==="iso-8859-1"?te+="utf8=%26%2310003%3B&":te+="utf8=%E2%9C%93&"),ke.length>0?te+ke:""},od}var ud,Pb;function uI(){if(Pb)return ud;Pb=1;var r=Ib(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(g){return g.replace(/&#(\d+);/g,function(m,b){return String.fromCharCode(parseInt(b,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,b){var I={__proto__:null},S=b.ignoreQueryPrefix?m.replace(/^\?/,""):m;S=S.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var _=b.parameterLimit===1/0?void 0:b.parameterLimit,T=S.split(b.delimiter,_),P=-1,M,U=b.charset;if(b.charsetSentinel)for(M=0;M<T.length;++M)T[M].indexOf("utf8=")===0&&(T[M]===c?U="utf-8":T[M]===u&&(U="iso-8859-1"),P=M,M=T.length);for(M=0;M<T.length;++M)if(M!==P){var W=T[M],K=W.indexOf("]="),X=K===-1?W.indexOf("="):K+1,fe,oe;X===-1?(fe=b.decoder(W,n.decoder,U,"key"),oe=b.strictNullHandling?null:""):(fe=b.decoder(W.slice(0,X),n.decoder,U,"key"),oe=r.maybeMap(a(W.slice(X+1),b),function(te){return b.decoder(te,n.decoder,U,"value")})),oe&&b.interpretNumericEntities&&U==="iso-8859-1"&&(oe=i(oe)),W.indexOf("[]=")>-1&&(oe=t(oe)?[oe]:oe);var ke=e.call(I,fe);ke&&b.duplicates==="combine"?I[fe]=r.combine(I[fe],oe):(!ke||b.duplicates==="last")&&(I[fe]=oe)}return I},h=function(g,m,b,I){for(var S=I?m:a(m,b),_=g.length-1;_>=0;--_){var T,P=g[_];if(P==="[]"&&b.parseArrays)T=b.allowEmptyArrays&&(S===""||b.strictNullHandling&&S===null)?[]:[].concat(S);else{T=b.plainObjects?Object.create(null):{};var M=P.charAt(0)==="["&&P.charAt(P.length-1)==="]"?P.slice(1,-1):P,U=b.decodeDotInKeys?M.replace(/%2E/g,"."):M,W=parseInt(U,10);!b.parseArrays&&U===""?T={0:S}:!isNaN(W)&&P!==U&&String(W)===U&&W>=0&&b.parseArrays&&W<=b.arrayLimit?(T=[],T[W]=S):U!=="__proto__"&&(T[U]=S)}S=T}return S},d=function(m,b,I,S){if(m){var _=I.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m,T=/(\[[^[\]]*])/,P=/(\[[^[\]]*])/g,M=I.depth>0&&T.exec(_),U=M?_.slice(0,M.index):_,W=[];if(U){if(!I.plainObjects&&e.call(Object.prototype,U)&&!I.allowPrototypes)return;W.push(U)}for(var K=0;I.depth>0&&(M=P.exec(_))!==null&&K<I.depth;){if(K+=1,!I.plainObjects&&e.call(Object.prototype,M[1].slice(1,-1))&&!I.allowPrototypes)return;W.push(M[1])}if(M){if(I.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+I.depth+" and strictDepth is true");W.push("["+_.slice(M.index)+"]")}return h(W,b,I,S)}},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 b=typeof m.charset>"u"?n.charset:m.charset,I=typeof m.duplicates>"u"?n.duplicates:m.duplicates;if(I!=="combine"&&I!=="first"&&I!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var S=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:n.allowDots:!!m.allowDots;return{allowDots:S,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:b,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:I,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,strictDepth:typeof m.strictDepth=="boolean"?!!m.strictDepth:n.strictDepth,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:n.strictNullHandling}};return ud=function(g,m){var b=y(m);if(g===""||g===null||typeof g>"u")return b.plainObjects?Object.create(null):{};for(var I=typeof g=="string"?f(g,b):g,S=b.plainObjects?Object.create(null):{},_=Object.keys(I),T=0;T<_.length;++T){var P=_[T],M=d(P,I[P],b,typeof g=="string");S=r.merge(S,M,b)}return b.allowSparse===!0?S:r.compact(S)},ud}var cd,Nb;function cI(){if(Nb)return cd;Nb=1;var r=oI(),e=uI(),t=sd();return cd={formats:t,parse:e,stringify:r},cd}(function(r,e){(function(t,n){n(e,Pk,Nk,cI())})(pi,function(t,n,i,a){var u=function(B,Q,q,J){function ee(V){return V instanceof q?V:new q(function(xe){xe(V)})}return new(q||(q=Promise))(function(V,xe){function Ve(_e){try{se(J.next(_e))}catch(He){xe(He)}}function $e(_e){try{se(J.throw(_e))}catch(He){xe(He)}}function se(_e){_e.done?V(_e.value):ee(_e.value).then(Ve,$e)}se((J=J.apply(B,Q||[])).next())})},c=function(B,Q){var q={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},J,ee,V,xe;return xe={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function Ve(se){return function(_e){return $e([se,_e])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,ee&&(V=se[0]&2?ee.return:se[0]?ee.throw||((V=ee.return)&&V.call(ee),0):ee.next)&&!(V=V.call(ee,se[1])).done)return V;switch(ee=0,V&&(se=[se[0]&2,V.value]),se[0]){case 0:case 1:V=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,ee=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(V=q.trys,!(V=V.length>0&&V[V.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!V||se[1]>V[0]&&se[1]<V[3])){q.label=se[1];break}if(se[0]===6&&q.label<V[1]){q.label=V[1],V=se;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(se);break}V[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(B,q)}catch(_e){se=[6,_e],ee=0}finally{J=V=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}};function f(B,Q){if(B.directives&&B.directives.length){var q={};return B.directives.forEach(function(J){q[J.name.value]=i.argumentsObjectFromField(J,Q)}),q}return null}var h=Object.prototype.hasOwnProperty;function d(B,Q){Q!==null&&typeof Q=="object"&&Object.keys(Q).forEach(function(q){var J=Q[q];h.call(B,q)?d(B[q],J):B[q]=J})}function y(B,Q,q,J,ee,V){V===void 0&&(V={});var xe=i.getMainDefinition(Q),Ve=i.getFragmentDefinitions(Q),$e=i.createFragmentMap(Ve),se=V.resultMapper,_e=V.fragmentMatcher||function(){return!0},He={fragmentMap:$e,contextValue:J,variableValues:ee,resultMapper:se,resolver:B,fragmentMatcher:_e};return g(xe.selectionSet,q,He)}function g(B,Q,q){return u(this,void 0,void 0,function(){var J,ee,V,xe,Ve,$e=this;return c(this,function(se){switch(se.label){case 0:return J=q.fragmentMap,ee=q.contextValue,V=q.variableValues,xe={},Ve=function(_e){return u($e,void 0,void 0,function(){var He,ht,dt,Yt,St;return c(this,function(Vt){switch(Vt.label){case 0:return i.shouldInclude(_e,V)?i.isField(_e)?[4,m(_e,Q,q)]:[3,2]:[2];case 1:return He=Vt.sent(),ht=i.resultKeyNameFromField(_e),He!==void 0&&(xe[ht]===void 0?xe[ht]=He:d(xe[ht],He)),[2];case 2:if(i.isInlineFragment(_e))dt=_e;else if(dt=J[_e.name.value],!dt)throw new Error("No fragment named "+_e.name.value);return Yt=dt.typeCondition.name.value,q.fragmentMatcher(Q,Yt,ee)?[4,g(dt.selectionSet,Q,q)]:[3,4];case 3:St=Vt.sent(),d(xe,St),Vt.label=4;case 4:return[2]}})})},[4,Promise.all(B.selections.map(Ve))];case 1:return se.sent(),q.resultMapper?[2,q.resultMapper(xe,Q)]:[2,xe]}})})}function m(B,Q,q){return u(this,void 0,void 0,function(){var J,ee,V,xe,Ve,$e,se;return c(this,function(_e){switch(_e.label){case 0:return J=q.variableValues,ee=q.contextValue,V=q.resolver,xe=B.name.value,Ve=i.argumentsObjectFromField(B,J),$e={isLeaf:!B.selectionSet,resultKey:i.resultKeyNameFromField(B),directives:f(B,J),field:B},[4,V(xe,Q,Ve,ee,$e)];case 1:return se=_e.sent(),B.selectionSet?se==null?[2,se]:Array.isArray(se)?[2,b(B,se,q)]:[2,g(B.selectionSet,se,q)]:[2,se]}})})}function b(B,Q,q){return Promise.all(Q.map(function(J){return J===null?null:Array.isArray(J)?b(B,J,q):g(B.selectionSet,J,q)}))}var I=function(){var B=function(Q,q){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,ee){J.__proto__=ee}||function(J,ee){for(var V in ee)ee.hasOwnProperty(V)&&(J[V]=ee[V])},B(Q,q)};return function(Q,q){B(Q,q);function J(){this.constructor=Q}Q.prototype=q===null?Object.create(q):(J.prototype=q.prototype,new J)}}(),S=function(){return S=Object.assign||function(B){for(var Q,q=1,J=arguments.length;q<J;q++){Q=arguments[q];for(var ee in Q)Object.prototype.hasOwnProperty.call(Q,ee)&&(B[ee]=Q[ee])}return B},S.apply(this,arguments)},_=function(B,Q,q,J){function ee(V){return V instanceof q?V:new q(function(xe){xe(V)})}return new(q||(q=Promise))(function(V,xe){function Ve(_e){try{se(J.next(_e))}catch(He){xe(He)}}function $e(_e){try{se(J.throw(_e))}catch(He){xe(He)}}function se(_e){_e.done?V(_e.value):ee(_e.value).then(Ve,$e)}se((J=J.apply(B,Q||[])).next())})},T=function(B,Q){var q={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},J,ee,V,xe;return xe={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(xe[Symbol.iterator]=function(){return this}),xe;function Ve(se){return function(_e){return $e([se,_e])}}function $e(se){if(J)throw new TypeError("Generator is already executing.");for(;q;)try{if(J=1,ee&&(V=se[0]&2?ee.return:se[0]?ee.throw||((V=ee.return)&&V.call(ee),0):ee.next)&&!(V=V.call(ee,se[1])).done)return V;switch(ee=0,V&&(se=[se[0]&2,V.value]),se[0]){case 0:case 1:V=se;break;case 4:return q.label++,{value:se[1],done:!1};case 5:q.label++,ee=se[1],se=[0];continue;case 7:se=q.ops.pop(),q.trys.pop();continue;default:if(V=q.trys,!(V=V.length>0&&V[V.length-1])&&(se[0]===6||se[0]===2)){q=0;continue}if(se[0]===3&&(!V||se[1]>V[0]&&se[1]<V[3])){q.label=se[1];break}if(se[0]===6&&q.label<V[1]){q.label=V[1],V=se;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(se);break}V[2]&&q.ops.pop(),q.trys.pop();continue}se=Q.call(B,q)}catch(_e){se=[6,_e],ee=0}finally{J=V=0}if(se[0]&5)throw se[1];return{value:se[0]?se[1]:void 0,done:!0}}},P=function(){for(var B=0,Q=0,q=arguments.length;Q<q;Q++)B+=arguments[Q].length;for(var J=Array(B),ee=0,Q=0;Q<q;Q++)for(var V=arguments[Q],xe=0,Ve=V.length;xe<Ve;xe++,ee++)J[ee]=V[xe];return J},M=function(B){var Q=B.replace(/\s/g,""),q=Q.replace(/\[(.*)\]/,function(J,ee,V,xe){return((ee!=null&&ee.length)>0?ee:null)||Q});return q},U=function(B,Q,q,J){if(Array.isArray(B)){var ee=M(Q);return B.map(function(V){return U(V,ee,q,J)})}return B==null||typeof B=="number"||typeof B=="boolean"||typeof B=="string"?B:q(B,Q,q,J)},W=function(B){return B.directives&&B.directives.length?B.directives.find(function(Q){return Q.name.value==="rest"}):null};function K(B,Q,q,J,ee){return ee==null||Q==null||typeof Q=="number"||typeof Q=="boolean"||typeof Q=="string"||ee.selections.forEach(function(V){if(i.isInlineFragment(V))K(B,Q,q,J,V.selectionSet);else if(V.kind==="FragmentSpread"){var xe=J[V.name.value];K(B,Q,q,J,xe.selectionSet)}else if(i.isField(V)){var Ve=i.resultKeyNameFromField(V);Ve===B&&W(V)!=null?X(Q,q,J,V.selectionSet):K(B,Q,q,J,V.selectionSet)}else return function($e){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()}),Q}function X(B,Q,q,J){if(!(B==null||typeof B=="number"||typeof B=="boolean"||typeof B=="string")){if(Array.isArray(B)){B.forEach(function(ee){return X(ee,Q,q,J)});return}J.selections.forEach(function(ee){if(i.isInlineFragment(ee))X(B,Q,q,ee.selectionSet);else if(ee.kind==="FragmentSpread"){var V=q[ee.name.value];X(B,Q,q,V.selectionSet)}else if(i.isField(ee)){var xe=B[ee.name.value];ee.name.value==="__typename"||(typeof xe>"u"?B[ee.name.value]=null:xe!=null&&typeof xe=="object"&&ee.selectionSet!=null&&X(xe,Q,q,ee.selectionSet))}else return function(Ve){throw new Error("Unhandled Node Type in SelectionSetNode.selections")}()})}}var fe=function(B,Q){var q=B[Q||nt]||B[nt];return typeof q=="string"?{uri:q}:S({responseTransformer:null},q)},oe=function(B,Q,q){return q===void 0||Q===void 0?B:B.replace(":"+Q,q)},ke=function(){function B(){}return B.replacerForPath=function(Q){if(Q in B.cache)return B.cache[Q];var q=Q.indexOf("?"),J=Q.split(B.argReplacement),ee=[],V=!1;J.reduce(function(Ve,$e){if($e===""||$e==="{}")return Ve+$e.length;var se=Ve+$e.length;if($e[0]==="{"&&$e[$e.length-1]==="}"){var _e=$e.slice(1,$e.length-1).split(".");ee.push(function(He,ht){try{var dt=te(He,_e);return!ht||typeof dt!="object"||dt==null?String(dt):a.stringify(dt)}catch{var Yt=[Q,_e.join(".")].join("|");return Yt in B.warnTable||(console.warn("Warning: RestLink caught an error while unpacking",Yt,"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."),B.warnTable[Yt]=!0),""}})}else ee.push($e),!V&&se>=q&&(V=!0,ee.push(!0));return se},0);var xe=function(Ve){var $e=!1,se=ee.reduce(function(_e,He){return typeof He=="string"?_e+He:typeof He=="boolean"?($e=!0,_e):_e+He(Ve,$e)},"");return se};return B.cache[Q]=xe},B.cache={},B.warnTable={},B.argReplacement=/({[._a-zA-Z0-9]*})/,B}();function te(B,Q){if(Q.length===0)return B;var q=P(Q),J=q.shift();return te(B[J],q)}var ve=["__typename"],ye=typeof globalThis=="object"&&globalThis||pi,de=function(B,Q,q){q===void 0&&(q=[]);var J=null;return Q.length!=2?J=function(ee,V){return Q(ee)}:J=Q,Array.isArray(B)?B.map(function(ee,V){return de(ee,J,P(q,[String(V)]))}):B==null||typeof B!="object"||B.constructor!==Object||ye.FileList&&B instanceof FileList||ye.File&&B instanceof File?B:Object.keys(B).reduce(function(ee,V){var xe=B[V];if(ve.indexOf(V)!==-1)return ee[V]=xe,ee;var Ve=P(q,[V]);return ee[J(V,Ve)]=de(xe,J,Ve),ee},{})},Me=function(B){return B},Se=function(B){return B instanceof Headers?B:new Headers(B||{})},ge=function(){for(var B=[],Q=0;Q<arguments.length;Q++)B[Q]=arguments[Q];return B.reduce(function(q,J){return J&&(J.forEach||(J=Se(J)),J.forEach(function(ee,V){q.append(V,ee)})),q},new Headers)},qe=function(B,Q,q){var J=new Headers;return B.forEach(function(ee,V){Q.indexOf(V)===-1&&J.append(V,ee)}),ge(J,q||new Headers)},tt=function(B){return function(Q,q){return qe(Q,B,q)}},je=["GET","POST","PUT","PATCH","DELETE"],mt=function(B,Q){switch(Q){case"query":if(je.indexOf(B.toUpperCase())!==-1)return;throw new Error('A "query" operation can only support "GET" requests but got "'+B+'".');case"mutation":if(je.indexOf(B.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 q=Q;return q}},Pt=function(B,Q,q){var J=new Error(q);throw J.response=B,J.statusCode=B.status,J.result=Q,J},Jt=function(B,Q){return B==null||typeof B!="object"?B:Array.isArray(B)?B.map(function(q){return Jt(q,Q)}):(B.__typename=Q,B)},Lt=function(B,Q,q,J,ee){return _(void 0,void 0,void 0,function(){var V,xe,Ve,$e,se,_e,He,ht,dt,Yt,St,Vt,Ht,Er,Wt,sr,dr,Ar,zt,H,G,it,gt,ct,We,Kt,Zt,Gt,kr,Hr,Fr,jt,Or,$r,Lr,ar,Gr,Tr,gr,Ir,Sn,Un,R,ue,be,Ie,Be,ot,Qe,Ke;return T(this,function(Ze){switch(Ze.label){case 0:if(V=ee.directives,xe=ee.isLeaf,Ve=ee.resultKey,$e=J.exportVariablesByNode,se=$e.get(Q)||{},_e=function(yt){return yt instanceof Array?yt.forEach(_e):$e.set(yt,S({},se)),yt},He=(Q||{})[Ve],ht=(Q||{})[B],Q&&V&&V.export&&(se[V.export.as]=ht),dt=V&&V.type,!xe&&dt){if(V.rest)throw new Error("Invalid use of @type(name: ...) directive on a call that also has @rest(...)");return _e(ht),[2,Jt(ht,V.type.name)]}if(Yt=!V||!V.rest,Yt)return[2,_e(He||ht)];if(St=J.credentials,Vt=J.endpoints,Ht=J.headers,Er=J.customFetch,Wt=J.operationType,sr=J.typePatcher,dr=J.mainDefinition,Ar=J.fragmentDefinitions,zt=J.fieldNameNormalizer,H=J.fieldNameDenormalizer,G=J.serializers,it=J.responseTransformer,gt=i.createFragmentMap(Ar),ct=V.rest,We=ct.path,Kt=ct.endpoint,Zt=ct.pathBuilder,Gt=fe(Vt,Kt),kr=We==null&&Zt==null,kr)throw new Error('One of ("path" | "pathBuilder") must be set in the @rest() directive. This request had neither, please add one');if(Zt||(We.includes(":")?(console.warn("Deprecated: '@rest(path:' contains a ':' colon, this format will be removed in future versions"),Zt=function(yt){var w=yt.args,k=yt.exportVariables,A=S(S({},w),k),C=Object.keys(A).reduce(function(D,$){return oe(D,$,A[$])},We);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}):Zt=ke.replacerForPath(We)),Hr={args:q,exportVariables:se,context:J,"@rest":V.rest,replacer:Zt},Fr=Zt(Hr),jt=V.rest,Or=jt.method,$r=jt.type,Lr=jt.bodyBuilder,ar=jt.bodyKey,Gr=jt.fieldNameDenormalizer,Tr=jt.fieldNameNormalizer,gr=jt.bodySerializer,Or||(Or="GET"),ar||(ar="input"),Ir=void 0,Sn=void 0,["GET","DELETE"].indexOf(Or)===-1){if(!Lr){if(Un=Hr.exportVariables[ar]||Hr.args&&Hr.args[ar],!Un)throw new Error("[GraphQL "+Or+" "+Wt+" using a REST call without a body]. No `"+ar+"` was detected. Pass bodyKey, or bodyBuilder to the @rest() directive to resolve this.");Lr=function(yt){return Un}}if(Ir=de(Lr(Hr),Gr||H||Me),R=void 0,typeof gr=="string"){if(!G.hasOwnProperty(gr))throw new Error('"bodySerializer" must correspond to configured serializer. '+("Please make sure to specify a serializer called "+gr+' in the "bodySerializers" property of the RestLink.'));R=G[gr](Ir,Ht)}else R=gr?gr(Ir,Ht):G[rt](Ir,Ht);Ir=R.body,Sn=new Headers(R.headers)}return mt(Or,Wt||"query"),ue=S({method:Or,headers:Sn||Ht,body:Ir},St?{credentials:St}:{}),be=""+Gt.uri+Fr,[4,(Er||fetch)(be,ue)];case 1:return Ie=Ze.sent(),J.responses.push(Ie),Ie.ok?(Ie.status===204||Ie.headers.get("Content-Length")==="0"?Be={}:Be=Ie,[3,9]):[3,2];case 2:return Ie.status!==404?[3,3]:(Be=null,[3,9]);case 3:ot=void 0,Ze.label=4;case 4:return Ze.trys.push([4,6,,8]),[4,Ie.clone().json()];case 5:return ot=Ze.sent(),[3,8];case 6:return Ze.sent(),[4,Ie.clone().text()];case 7:return ot=Ze.sent(),[3,8];case 8:Pt(Ie,ot,"Response not successful: Received status code "+Ie.status),Ze.label=9;case 9:if(Qe=Gt.responseTransformer||it,!Qe)return[3,14];Ze.label=10;case 10:return Ze.trys.push([10,12,,13]),[4,Qe(Be,$r)];case 11:return Be=Ze.sent(),[3,13];case 12:throw Ke=Ze.sent(),console.warn("An error occurred in a responseTransformer:"),Ke;case 13:return[3,16];case 14:return Be&&Be.json?[4,Be.json()]:[3,16];case 15:Be=Ze.sent(),Ze.label=16;case 16:return Be=de(Be,Tr||zt||Me),Be=K(Ve,Be,dr,gt,dr.selectionSet),Be=U(Be,$r,sr,{resolverParams:{fieldName:B,root:Q,args:q,context:J,info:ee}}),[2,_e(Be)]}})})},nt="",rt="",xt=function(B,Q){return Q.has("content-type")||Q.append("Content-Type","application/json"),{body:JSON.stringify(B),headers:Q}},Ne={test:function(B){return B.name.value==="rest"},remove:!0},ze=function(B){I(Q,B);function Q(q){var J,ee=q.uri,V=q.endpoints,xe=q.headers,Ve=q.fieldNameNormalizer,$e=q.fieldNameDenormalizer,se=q.typePatcher,_e=q.customFetch,He=q.credentials,ht=q.bodySerializers,dt=q.defaultSerializer,Yt=q.responseTransformer,St=B.call(this)||this,Vt={};if(Vt[nt]=ee||"",St.endpoints=Object.assign({},V||Vt),ee==null&&V==null)throw new Error("A RestLink must be initialized with either 1 uri, or a map of keyed-endpoints");if(ee!=null){var Ht=(V||{})[nt];if(Ht!=null&&Ht!=ee)throw new Error("RestLink was configured with a default uri that doesn't match what's passed in to the endpoints map.");St.endpoints[nt]=ee}if(St.endpoints[nt]==null&&console.warn("RestLink configured without a default URI. All @rest(…) directives must provide an endpoint key!"),se==null)St.typePatcher=function(Wt,sr,dr){return S({__typename:sr},Wt)};else if(!Array.isArray(se)&&typeof se=="object"&&Object.keys(se).map(function(Wt){return se[Wt]}).reduce(function(Wt,sr){return Wt&&typeof sr=="function"},!0)){var Er=se;St.typePatcher=function(Wt,sr,dr,Ar){var zt=Wt.__typename||sr;if(Array.isArray(Wt))return Wt.map(function(G){return dr(G,zt,dr,Ar)});var H=Er[zt]||function(G){return G};return S({__typename:zt},H(Wt,zt,dr,Ar))}}else throw new Error("RestLink was configured with a typePatcher of invalid type!");return ht&&ht.hasOwnProperty(rt)&&console.warn("RestLink was configured to override the default serializer! This may result in unexpected behavior"),St.responseTransformer=Yt||null,St.fieldNameNormalizer=Ve||null,St.fieldNameDenormalizer=$e||null,St.headers=Se(xe),St.credentials=He||null,St.customFetch=_e,St.serializers=S((J={},J[rt]=dt||xt,J),ht||{}),St.processedDocuments=new Map,St}return Q.prototype.removeRestSetsFromDocument=function(q){var J=this.processedDocuments.get(q);if(J)return J;i.checkDocument(q);var ee=i.removeDirectivesFromDocument([Ne],q);return this.processedDocuments.set(q,ee),ee},Q.prototype.request=function(q,J){var ee=q.query,V=q.variables,xe=q.getContext,Ve=q.setContext,$e=xe(),se=i.hasDirectives(["rest"],ee);if(!se)return J(q);var _e=this.removeRestSetsFromDocument(ee),He=$e.headersMergePolicy;He==null&&Array.isArray($e.headersToOverride)?He=tt($e.headersToOverride):He==null&&(He=ge);var ht=He(this.headers,$e.headers);ht.has("Accept")||ht.append("Accept","application/json");var dt=$e.credentials||this.credentials,Yt=i.addTypenameToDocument(ee),St=i.getMainDefinition(ee),Vt=i.getFragmentDefinitions(ee),Ht=(St||{}).operation||"query",Er={headers:ht,endpoints:this.endpoints,exportVariablesByNode:new Map,credentials:dt,customFetch:this.customFetch,operationType:Ht,fieldNameNormalizer:this.fieldNameNormalizer,fieldNameDenormalizer:this.fieldNameDenormalizer,mainDefinition:St,fragmentDefinitions:Vt,typePatcher:this.typePatcher,serializers:this.serializers,responses:[],responseTransformer:this.responseTransformer},Wt={},sr;return _e&&J?(q.query=_e,sr=J(q)):sr=n.Observable.of({data:{}}),sr.flatMap(function(dr){var Ar=dr.data,zt=dr.errors;return new n.Observable(function(H){y(Lt,Yt,Ar,Er,V,Wt).then(function(G){Ve({restResponses:($e.restResponses||[]).concat(Er.responses)}),H.next({data:G,errors:zt}),H.complete()}).catch(function(G){G.name!=="AbortError"&&(G.result&&G.result.errors&&H.next(G.result),H.error(G))})})})},Q}(n.ApolloLink);t.RestLink=ze,t.PathBuilder=ke,Object.defineProperty(t,"__esModule",{value:!0})})})(mh,mh.exports);var lI=mh.exports;const rc=me.createContext(),fI=()=>{const{isAuthenticated:r,login:e}=ti(),{children:t,isEmbedded:n,setIsEmbedded:i,authError:a}=me.useContext(rc),u=pn.useNavigate(),c=pn.useLocation(),[f,h]=me.useState(!1),[d,y]=me.useState(),[g,m]=me.useState(),[b,I]=me.useState({}),[S,_]=me.useState({}),[T,P]=me.useState({}),[M,U]=me.useState(!1);me.useEffect(()=>{var te;if(!(!c||c.pathname!=="/mm-embedded-login")){if(r||a)if(((te=new URL(origin))==null?void 0:te.protocol)==="http:"){window.close();return}else{const ye=new URLSearchParams(c.search),de=ye.get("id"),Me=ye.get("origin");a?window.parent.postMessage({type:"authorize-failed",instanceId:de,error:a,authUrl:window.location.href},Me):window.parent.postMessage({type:"authorized",instanceId:de,authUrl:window.location.href},Me);return}r===!1&&e()}},[c]),me.useEffect(()=>{var de,Me;if(r===null||!c||c.pathname!=="/mm-embedded-interop")return;const te=new URLSearchParams(c.search),ve=te.get("id"),ye=te.get("origin");if(ye){const Se=(de=new URL(ye))==null?void 0:de.hostname;if(/^(?:[\w-]+\.)*(?:machinemetrics\.com|machinemetrics-us-gov\.com|m12s\.com)$/.test(Se))y(ye);else{alert("Invalid Embeddable Zone Host");return}}if(r===!1){if(ye){const Se={instanceId:ve,authUrl:`${window.location.protocol}//${window.location.host}/mm-embedded-login?id=${ve}&origin=${ye}`,origin:ye};if(((Me=new URL(ye))==null?void 0:Me.protocol)==="http:"){window.parent.postMessage({type:"login",...Se},ye);return}e({mm_instanceId:Se.instanceId,mm_authUrl:encodeURIComponent(Se.authUrl),mm_origin:Se.origin});return}e();return}ve&&m(ve),ve&&ye&&i(!0)},[c,r]),pn.useBlocker(({nextLocation:te})=>{var ve;return n?(ve=te.state)!=null&&ve.fromParent?(h(!0),!1):(W(`${te.pathname}${te.search}`),!0):!1}),me.useEffect(()=>{if(!n||!d)return;const te=ve=>{ve.metaKey&&ve.key==="k"&&window.parent.postMessage({type:"open-search",instanceId:g},d)};return window.addEventListener("keydown",te),()=>{window.removeEventListener("keydown",te)}},[n,d]),me.useEffect(()=>{if(!n||!d)return;const te=({origin:ve,data:ye})=>{var de,Me;if(ve===d)switch(ye.type){case"navigate":u(ye.path,{replace:!0,state:{fromParent:!0}});break;case"set-context":I(ye.context||{});break;case"set-configuring":U(ye.isConfiguring);break;case"load-options":(de=S[ye.name])==null||de.call(S,{filter:ye.filter});break;case"validate":(Me=T[ye.name])==null||Me.call(T,{value:ye.value});break}};return window.addEventListener("message",te),!f&&r&&window.parent.postMessage({type:"ready",instanceId:g},d),()=>{window.removeEventListener("message",te)}},[u,f,n,r,d,S,T]);const W=(te,ve)=>{!f&&!r||window.parent.postMessage({type:"set-path",instanceId:g,path:te,...ve},d)},K=te=>{f&&window.parent.postMessage({type:"set-summary",instanceId:g,summary:te},d)},X=te=>{f&&window.parent.postMessage({type:"toast",instanceId:g,message:te},d)},fe=te=>{f&&window.parent.postMessage({type:"popup",instanceId:g,message:te},d)},oe=async(te,ve)=>{f&&(ve.validate&&typeof ve.validate=="function"&&P(ye=>{const de=async Me=>{const Se=await ve.validate(Me);window.parent.postMessage({type:"set-validation",instanceId:g,name:te,validation:Se},d)};return ye[te]&&de({value:""}),{...ye,[te]:de}}),ve.options&&_(ye=>{const de=async Me=>{const ge=await(typeof ve.options=="function"?ve.options:()=>ve.options)(Me);window.parent.postMessage({type:"set-options",instanceId:g,name:te,options:ge},d)};return ye[te]&&de({filter:""}),{...ye,[te]:de}}),window.parent.postMessage({type:"add-setting",instanceId:g,setting:{name:te,...ve,options:void 0,validate:void 0}},d))},ke=me.useMemo(()=>({isEmbedded:n,isConfiguring:M,navigateParent:W,setSummary:K,toast:X,popup:fe,context:b,addSetting:oe}),[n,M,W,K,X,fe,b,oe]);return nr.jsx(fa.Provider,{value:ke,children:c.pathname!=="/mm-embedded-interop"&&c.pathname!=="/mm-embedded-login"?t:nr.jsx(nr.Fragment,{})})},hI=()=>{const{urls:r,jwtRef:e,accessToken:t}=ti(),{graphQLRoleOverride:n,children:i}=me.useContext(rc),[a,u]=me.useState(),[c,f]=me.useState(),h=()=>{const g=new URL(r.graphQLUrl);return`//${g.host}${g.pathname}`},d=()=>n?{"X-Hasura-Role":n}:{};me.useEffect(()=>{const g=new Sk(kk({url:`wss:${h()}`,lazy:!0,reconnect:!0,connectionParams:async()=>({headers:{Authorization:`Bearer ${e.current}`,...d()}})})),m=N0(({operation:P,networkError:M,forward:U})=>(Bi(P.query).operation==="subscription"&&M&&g.client.terminate(),U(P))),I=P0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${e.current}`,...d()}})).concat(uf({uri:`https:${h()}`,fetch:window.fetch})),S=m.split(({query:P})=>{const M=Bi(P);return M.kind==="OperationDefinition"&&M.operation==="subscription"},g,I),T=P0(async(P,{headers:M})=>({headers:{...M,Authorization:`Bearer ${t}`}})).concat(new lI.RestLink({uri:r.apiUrl}));f(Kr.from([T,S]))},[]),me.useEffect(()=>{c&&u(new Cf({link:c,cache:new Of}))},[c]);const y=me.useMemo(()=>({link:c}),[c]);return nr.jsx(u0.Provider,{value:y,children:a?nr.jsx(S1,{client:a,children:nr.jsx(BA,{children:nr.jsx(fI,{children:i})})}):nr.jsx(nr.Fragment,{})})},dI=Qp.div`
132
132
  text-align: center;
133
133
  padding-top: 200px;
134
134
  `,Rb=({loadError:r})=>{const e=bk();return r&&!e||e.indexOf("mm-embedded-login")===-1?nr.jsx(dI,{children:r}):(O0(),nr.jsx(pn.Navigate,{replace:!0,to:e||"/"}))};Qp.div`
@@ -162,4 +162,4 @@ ${f}`),y(b);return}c(null,I),n.strategy===ri.Count&&(h--,h===0&&y()),n.strategy=
162
162
 
163
163
  ${c.stack}`),f.unsubscribe(),u.reject(h)):(h=Vb(d),h?(c&&(h.stack+=`
164
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 Xb(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(Ce.errorForCode(we.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Mr;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 lP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===we.NoResponders&&(i.code=we.JetStreamNotEnabled),i}return t}jetstream(e={}){return new Fd(this,e)}getServerVersion(){const e=this.info;return e?Cs(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ce.errorForCode(we.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new pP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):this.protocol.reconnect()}}class pP{constructor(e){E(this,"nc");this.nc=e}add(e){try{return new No(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new GC(this.nc,e,t)}}class mP{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(gc)||"PUT"}get length(){const e=this.sm.header.get(en.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class yP{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(hd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(gc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var t;const e=((t=this.sm.headers)==null?void 0:t.get(en.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ew extends zI{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=yr.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 Ce(`unable to recreate ordered consumer ${a.stream} at seq ${t}`,we.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(hd(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=AI(409,`${qn.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 b=((g=(y=this.info)==null?void 0:y.ordered_consumer_sequence)==null?void 0:g.stream_seq)||0;return this._resetOrderedConsumer(b+1),(m=this.monitor)==null||m.restart(),!1}return!a.noIterator};this.monitor=new gd(t,u,i)}_checkHbOrderConsumer(t){const n=t.headers.get(en.ConsumerStalledHdr);n!==""&&this.js.nc.publish(n);const i=parseInt(t.headers.get(en.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 gP extends Ew{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=cr(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=cr(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 vP(r,e){return r?wP(e):bP(e)}function bP(r){return(e,t)=>e?[e,null]:(e=va(t),e?[e,null]:[null,Do(t,r)])}function wP(r){return(e,t)=>{if(e)return[e,null];const n=va(t);return n!==null?[Ow(n),null]:[null,Do(t,r)]}}function Ow(r){if(r!==null)switch(r.code){case we.JetStream404NoMessages:case we.JetStream408RequestTimeout:return null;case we.JetStream409:return kI(r)?r:null;default:return r}return null}function _P(r){r&&r.ack()}function xP(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 SP{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=xP(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]===Mo[0]&&e[1]===Mo[1]&&e[2]===Mo[2]&&e[3]===Mo[3]}async ackAck(e){var n;e=e||{},e.timeout=e.timeout||this.timeout;const t=ir();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 Xb(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,bw,{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(bw)}nak(e){let t=nP;e&&(t=Bb().encode(`-NAK ${JSON.stringify({delay:cr(e)})}`)),this.doAck(t)}working(){this.doAck(Mo)}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=cr(t.expires));const i=Ln().encode(n),a=_a.concat(iP,aP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=sP;(e==null?void 0:e.length)>0&&(t=Bb().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const EP="1.29.2",OP="nats.ws";class TP{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=EP,this.lang=OP,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ir(),this.closedNotification=ir()}async connect(e,t){const n=ir();if(t.tls)return n.reject(new Ce("tls",we.InvalidOption)),n;this.options=t;const i=e.src;if(t.wsFactory){const{socket:a,encrypted:u}=await t.wsFactory(e.src,t);this.socket=a,this.encrypted=u}else this.encrypted=i.indexOf("wss://")===0,this.socket=new WebSocket(i);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=a=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(a.data)),this.peeked){this.signal.resolve();return}const u=_a.concat(...this.yields),c=KI(u);if(c!==""){const f=jC.exec(c);if(!f){t.debug&&console.error("!!!",oc(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);LC(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 Ce(u.message,we.Unknown,new Error(u.error));n.reject(c)},n}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ya(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(`> ${oc(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=ir())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${oc(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${oc(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 AP(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 kP(r={}){return HI({defaultPort:443,urlParseFn:AP,factory:()=>new TP}),Ld.connect(r)}const Tw=["new","last","last_per_subject"],IP=async(r,e)=>(console.info(`Connecting to server ${r}`),await kP({servers:[r],authenticator:NC(new TextEncoder().encode(e))}));async function*CP(r){const e=Ln();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Aw=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},kw={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]"},PP={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},NP=(r,e,t)=>{if(!kw[r])throw new Error("Unknown stream name");const n=kw[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+="."+(PP[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},RP=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Tw.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Tw.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=ti(),f=me.useRef(),h=me.useRef();return me.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await IP(u.natsUrl,c.current);f.current=y;const g=NP(e,t,n==null?void 0:n[0]);console.info(`Consuming events from stream ${e} filtering by subject ${g}`);const b=await(await y.jetstream().consumers.get(e,{deliver_policy:i,filterSubjects:g})).consume({max_messages:1e3}),I=CP(b);if(h.current=I,typeof a=="function")for await(const S of I)a(S)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Aw(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Aw(h,f)]},MP=me.forwardRef(({href:r,children:e,...t},n)=>{const{isEmbedded:i,navigateParent:a}=me.useContext(fa);return nr.jsx("a",{...t,ref:n,href:r,onClick:u=>{!i||u.metaKey||u.ctrlKey||u.shiftKey||(u.preventDefault(),u.stopPropagation(),a(r))},children:e})});Ot.Link=MP,Ot.MMProvider=yI,Ot.PrivateLayout=tk,Ot._useMMApolloLinkContext=ek,Ot.useApiRequest=f0,Ot.useAsyncEffect=bo,Ot.useAsyncInterval=wo,Ot.useDowntimeQuery=GA,Ot.useEventStream=RP,Ot.useMMAppContext=ZA,Ot.useMMAppSetting=XA,Ot.useMMAppTools=KA,Ot.useMMAuth=ti,Ot.useMMEmbeddedApp=YA,Ot.useMMHash=JA,Ot.useMMTemplates=QA,Ot.useProductionQuery=zA,Ot.useQuantityStream=HA,Ot.useSearchParamsState=VA,Ot.useThrottleEffect=WA,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
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 Xb(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(Ce.errorForCode(we.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Mr;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 lP(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const i=n;throw i.code===we.NoResponders&&(i.code=we.JetStreamNotEnabled),i}return t}jetstream(e={}){return new Fd(this,e)}getServerVersion(){const e=this.info;return e?Cs(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ce.errorForCode(we.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new pP(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ce.errorForCode(we.ConnectionClosed)):this.isDraining()?Promise.reject(Ce.errorForCode(we.ConnectionDraining)):this.protocol.reconnect()}}class pP{constructor(e){E(this,"nc");this.nc=e}add(e){try{return new No(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new GC(this.nc,e,t)}}class mP{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(gc)||"PUT"}get length(){const e=this.sm.header.get(en.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class yP{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(hd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(gc))||"PUT"}get delta(){return this.sm.info.pending}get length(){var t;const e=((t=this.sm.headers)==null?void 0:t.get(en.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Ew extends zI{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=yr.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 Ce(`unable to recreate ordered consumer ${a.stream} at seq ${t}`,we.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(hd(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=AI(409,`${qn.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 b=((g=(y=this.info)==null?void 0:y.ordered_consumer_sequence)==null?void 0:g.stream_seq)||0;return this._resetOrderedConsumer(b+1),(m=this.monitor)==null||m.restart(),!1}return!a.noIterator};this.monitor=new gd(t,u,i)}_checkHbOrderConsumer(t){const n=t.headers.get(en.ConsumerStalledHdr);n!==""&&this.js.nc.publish(n);const i=parseInt(t.headers.get(en.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 gP extends Ew{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=cr(c));let f=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(f=e.idle_heartbeat,u.idle_heartbeat=cr(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 vP(r,e){return r?wP(e):bP(e)}function bP(r){return(e,t)=>e?[e,null]:(e=va(t),e?[e,null]:[null,Do(t,r)])}function wP(r){return(e,t)=>{if(e)return[e,null];const n=va(t);return n!==null?[Ow(n),null]:[null,Do(t,r)]}}function Ow(r){if(r!==null)switch(r.code){case we.JetStream404NoMessages:case we.JetStream408RequestTimeout:return null;case we.JetStream409:return kI(r)?r:null;default:return r}return null}function _P(r){r&&r.ack()}function xP(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 SP{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=xP(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]===Mo[0]&&e[1]===Mo[1]&&e[2]===Mo[2]&&e[3]===Mo[3]}async ackAck(e){var n;e=e||{},e.timeout=e.timeout||this.timeout;const t=ir();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 Xb(a.muxSubscriptions,this.msg.reply,{timeout:e.timeout},u);a.request(c);try{a.publish(this.msg.reply,bw,{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(bw)}nak(e){let t=nP;e&&(t=Bb().encode(`-NAK ${JSON.stringify({delay:cr(e)})}`)),this.doAck(t)}working(){this.doAck(Mo)}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=cr(t.expires));const i=Ln().encode(n),a=_a.concat(iP,aP,i),u=e?{reply:e}:void 0;this.msg.respond(a,u)}term(e=""){let t=sP;(e==null?void 0:e.length)>0&&(t=Bb().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}const EP="1.29.2",OP="nats.ws";class TP{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=EP,this.lang=OP,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ir(),this.closedNotification=ir()}async connect(e,t){const n=ir();if(t.tls)return n.reject(new Ce("tls",we.InvalidOption)),n;this.options=t;const i=e.src;if(t.wsFactory){const{socket:a,encrypted:u}=await t.wsFactory(e.src,t);this.socket=a,this.encrypted=u}else this.encrypted=i.indexOf("wss://")===0,this.socket=new WebSocket(i);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=a=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(a.data)),this.peeked){this.signal.resolve();return}const u=_a.concat(...this.yields),c=KI(u);if(c!==""){const f=jC.exec(c);if(!f){t.debug&&console.error("!!!",oc(u)),n.reject(new Error("unexpected response from server"));return}try{const h=JSON.parse(f[1]);LC(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 Ce(u.message,we.Unknown,new Error(u.error));n.reject(c)},n}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ya(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(`> ${oc(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=ir())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${oc(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${oc(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 AP(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 kP(r={}){return HI({defaultPort:443,urlParseFn:AP,factory:()=>new TP}),Ld.connect(r)}const Tw=["new","last","last_per_subject"],IP=async(r,e)=>(console.info(`Connecting to server ${r}`),await kP({servers:[r],authenticator:NC(new TextEncoder().encode(e))}));async function*CP(r){const e=Ln();for await(const t of r)try{yield e.decode(t.data)}catch(n){console.warn(`Skipping event: ${n}`)}}const Aw=(r,e)=>{r.current&&(r.current=void 0),e.current&&(e.current.close(),e.current=void 0)},kw={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]"},PP={undefined:0,event:1,eventset:2,quantity:3,state:4,count:5,info:6,beat:7},NP=(r,e,t)=>{if(!kw[r])throw new Error("Unknown stream name");const n=kw[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+="."+(PP[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},RP=r=>{const{streamName:e,locationRef:t,filters:n,deliverPolicy:i="new",dispatch:a}=r;if(!Tw.includes(i))throw new Error(`Invalid deliverPolicy "${i}" specified. Valid options are: ${Tw.join(", ")}`);n&&n.length>1&&console.warn("Multiple filters are not supported. Only the first filter will be used.");const{urls:u,natsCredsRef:c}=ti(),f=me.useRef(),h=me.useRef();return me.useEffect(()=>!u.natsUrl||!c.current||!e||!t?void 0:((async()=>{try{const y=await IP(u.natsUrl,c.current);f.current=y;const g=NP(e,t,n==null?void 0:n[0]);console.info(`Consuming events from stream ${e} filtering by subject ${g}`);const b=await(await y.jetstream().consumers.get(e,{deliver_policy:i,filterSubjects:g})).consume({max_messages:1e3}),I=CP(b);if(h.current=I,typeof a=="function")for await(const S of I)a(S)}catch(y){console.error(`Error setting up event stream. ${y}`)}})(),()=>Aw(h,f)),[e,t,i,u.natsUrl,c]),[h.current,()=>Aw(h,f)]},MP=me.forwardRef(({href:r,asFlyout:e,flyoutTitle:t,children:n,...i},a)=>{const{isEmbedded:u,navigateParent:c}=me.useContext(fa);return nr.jsx("a",{...i,ref:a,href:r,onClick:f=>{!u||f.metaKey||f.ctrlKey||f.shiftKey||(f.preventDefault(),f.stopPropagation(),c(r,{asFlyout:e,flyoutTitle:t}))},children:n})});Ot.Link=MP,Ot.MMProvider=yI,Ot.PrivateLayout=tk,Ot._useMMApolloLinkContext=ek,Ot.useApiRequest=f0,Ot.useAsyncEffect=bo,Ot.useAsyncInterval=wo,Ot.useDowntimeQuery=GA,Ot.useEventStream=RP,Ot.useMMAppContext=ZA,Ot.useMMAppSetting=XA,Ot.useMMAppTools=KA,Ot.useMMAuth=ti,Ot.useMMEmbeddedApp=YA,Ot.useMMHash=JA,Ot.useMMTemplates=QA,Ot.useProductionQuery=zA,Ot.useQuantityStream=HA,Ot.useSearchParamsState=VA,Ot.useThrottleEffect=WA,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machinemetrics/mm-react-tools",
3
- "version": "3.2.4-0",
3
+ "version": "3.2.5-0",
4
4
  "description": "Components, hooks, and helper functions for writing React apps using MachineMetrics APIs.",
5
5
  "author": "machinemetrics",
6
6
  "license": "MIT",