ed-widget 1.56.9 → 1.56.10-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ed-widget.js CHANGED
@@ -200,7 +200,7 @@ Check the render method of %s.`,Et(Cn)||"Unknown"));var j=Yu(x,O);j.payload={ele
200
200
 
201
201
  let root = createRoot(domContainer);
202
202
  root.render(<App />);`),o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(S=o.identifierPrefix),o.onRecoverableError!==void 0&&(x=o.onRecoverableError),o.transitionCallbacks!==void 0&&o.transitionCallbacks);var O=sH(a,DC,null,c,p,S,x);z(O.current,a);var I=a.nodeType===oi?a.parentNode:a;return Wl(I),new aR(O)}function j2(a){this._internalRoot=a}function ipe(a){a&&TE(a)}j2.prototype.unstable_scheduleHydration=ipe;function ape(a,o,c){if(!V2(a))throw new Error("hydrateRoot(...): Target container is not a DOM element.");kH(a),o===void 0&&l("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var p=c??null,S=c!=null&&c.hydratedSources||null,x=!1,O=!1,I="",j=RH;c!=null&&(c.unstable_strictMode===!0&&(x=!0),c.identifierPrefix!==void 0&&(I=c.identifierPrefix),c.onRecoverableError!==void 0&&(j=c.onRecoverableError));var q=lH(o,null,a,DC,p,x,O,I,j);if(z(q.current,a),Wl(a),S)for(var Q=0;Q<S.length;Q++){var he=S[Q];ufe(q,he)}return new j2(q)}function V2(a){return!!(a&&(a.nodeType===eo||a.nodeType===Xs||a.nodeType===Fp))}function Yy(a){return!!(a&&(a.nodeType===eo||a.nodeType===Xs||a.nodeType===Fp||a.nodeType===oi&&a.nodeValue===" react-mount-point-unstable "))}function kH(a){a.nodeType===eo&&a.tagName&&a.tagName.toUpperCase()==="BODY"&&l("createRoot(): Creating roots directly with document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try using a container element created for your app."),oe(a)&&(a._reactRootContainer?l("You are calling ReactDOMClient.createRoot() on a container that was previously passed to ReactDOM.render(). This is not supported."):l("You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it."))}var ope=n.ReactCurrentOwner,OH;OH=function(a){if(a._reactRootContainer&&a.nodeType!==oi){var o=cH(a._reactRootContainer.current);o&&o.parentNode!==a&&l("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.")}var c=!!a._reactRootContainer,p=oR(a),S=!!(p&&ve(p));S&&!c&&l("render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render."),a.nodeType===eo&&a.tagName&&a.tagName.toUpperCase()==="BODY"&&l("render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.")};function oR(a){return a?a.nodeType===Xs?a.documentElement:a.firstChild:null}function NH(){}function spe(a,o,c,p,S){if(S){if(typeof p=="function"){var x=p;p=function(){var de=F2(O);x.call(de)}}var O=lH(o,p,a,yf,null,!1,!1,"",NH);a._reactRootContainer=O,z(O.current,a);var I=a.nodeType===oi?a.parentNode:a;return Wl(I),Ju(),O}else{for(var j;j=a.lastChild;)a.removeChild(j);if(typeof p=="function"){var q=p;p=function(){var de=F2(Q);q.call(de)}}var Q=sH(a,yf,null,!1,!1,"",NH);a._reactRootContainer=Q,z(Q.current,a);var he=a.nodeType===oi?a.parentNode:a;return Wl(he),Ju(function(){Gy(o,Q,c,p)}),Q}}function lpe(a,o){a!==null&&typeof a!="function"&&l("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",o,a)}function U2(a,o,c,p,S){OH(c),lpe(S===void 0?null:S,"render");var x=c._reactRootContainer,O;if(!x)O=spe(c,o,a,S,p);else{if(O=x,typeof S=="function"){var I=S;S=function(){var j=F2(O);I.call(j)}}Gy(o,O,a,S)}return F2(O)}var MH=!1;function upe(a){{MH||(MH=!0,l("findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node"));var o=ope.current;if(o!==null&&o.stateNode!==null){var c=o.stateNode._warnedAboutRefsInRender;c||l("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",tt(o.type)||"A component"),o.stateNode._warnedAboutRefsInRender=!0}}return a==null?null:a.nodeType===eo?a:Ghe(a,"findDOMNode")}function cpe(a,o,c){if(l("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!Yy(o))throw new Error("Target container is not a DOM element.");{var p=oe(o)&&o._reactRootContainer===void 0;p&&l("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call hydrateRoot(container, element)?")}return U2(null,a,o,!0,c)}function fpe(a,o,c){if(l("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!Yy(o))throw new Error("Target container is not a DOM element.");{var p=oe(o)&&o._reactRootContainer===void 0;p&&l("You are calling ReactDOM.render() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.render(element)?")}return U2(null,a,o,!1,c)}function dpe(a,o,c,p){if(l("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!Yy(c))throw new Error("Target container is not a DOM element.");if(a==null||!B(a))throw new Error("parentComponent must be a valid React Component");return U2(a,o,c,!1,p)}var DH=!1;function hpe(a){if(DH||(DH=!0,l("unmountComponentAtNode is deprecated and will be removed in the next major release. Switch to the createRoot API. Learn more: https://reactjs.org/link/switch-to-createroot")),!Yy(a))throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");{var o=oe(a)&&a._reactRootContainer===void 0;o&&l("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?")}if(a._reactRootContainer){{var c=oR(a),p=c&&!ve(c);p&&l("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.")}return Ju(function(){U2(null,null,a,!1,function(){a._reactRootContainer=null,W(a)})}),!0}else{{var S=oR(a),x=!!(S&&ve(S)),O=a.nodeType===eo&&Yy(a.parentNode)&&!!a.parentNode._reactRootContainer;x&&l("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s",O?"You may have accidentally passed in a React root node instead of its container.":"Instead, have the parent component update its state and rerender in order to remove this component.")}return!1}}C4(Yhe),wg(Khe),Tg(Qhe),_4(Ho),_E(S4),(typeof Map!="function"||Map.prototype==null||typeof Map.prototype.forEach!="function"||typeof Set!="function"||Set.prototype==null||typeof Set.prototype.clear!="function"||typeof Set.prototype.forEach!="function")&&l("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),KT($9),ya(F7,ahe,Ju);function ppe(a,o){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!V2(o))throw new Error("Target container is not a DOM element.");return Whe(a,o,null,c)}function mpe(a,o,c,p){return dpe(a,o,c,p)}var sR={usingClientEntryPoint:!1,Events:[ve,ze,Be,ld,Wp,F7]};function vpe(a,o){return sR.usingClientEntryPoint||l('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),rpe(a,o)}function gpe(a,o,c){return sR.usingClientEntryPoint||l('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),ape(a,o,c)}function ype(a){return Uz()&&l("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."),Ju(a)}var bpe=npe({findFiberByHostInstance:ue,bundleType:1,version:eR,rendererPackageName:"react-dom"});if(!bpe&&Me&&window.top===window.self&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)){var LH=window.location.protocol;/^(https?|file):$/.test(LH)&&console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools"+(LH==="file:"?`
203
- You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}Ro.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sR,Ro.createPortal=ppe,Ro.createRoot=vpe,Ro.findDOMNode=upe,Ro.flushSync=ype,Ro.hydrate=cpe,Ro.hydrateRoot=gpe,Ro.render=fpe,Ro.unmountComponentAtNode=hpe,Ro.unstable_batchedUpdates=F7,Ro.unstable_renderSubtreeIntoContainer=mpe,Ro.version=eR,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})(),Ro}var vR;function gR(){return vR||(vR=1,B2.exports=zH()),B2.exports}var yR;function HH(){if(yR)return Qy;yR=1;var t=gR();{var e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Qy.createRoot=function(n,r){e.usingClientEntryPoint=!0;try{return t.createRoot(n,r)}finally{e.usingClientEntryPoint=!1}},Qy.hydrateRoot=function(n,r,i){e.usingClientEntryPoint=!0;try{return t.hydrateRoot(n,r,i)}finally{e.usingClientEntryPoint=!1}}}return Qy}var bR=HH(),vv=gR();const SR=ou(vv),ER=!1;function Hs(t){try{return t()}catch{}}const W2=Hs(()=>globalThis)||Hs(()=>window)||Hs(()=>self)||Hs(()=>global)||Hs(function(){return Hs.constructor("return this")()}),G2="4.2.3",CR=new Map;function _R(t){const e=CR.get(t)||1;return CR.set(t,e+1),`${t}:${e}:${Math.random().toString(36).slice(2)}`}function BH(t,e=0){const n=_R("stringifyForDisplay");return JSON.stringify(t,(r,i)=>i===void 0?n:i,e).split(JSON.stringify(n)).join("<undefined>")}const xR="Invariant Violation";class Y2 extends Error{constructor(e=xR){super(e),this.name=xR,Object.setPrototypeOf(this,Y2.prototype)}}const wR=["debug","log","warn","error","silent"];let qH=wR.indexOf("silent");function wn(t,...e){if(!t)throw ds(...e)}function Zy(t){return function(e,...n){if(wR.indexOf(t)>=qH){const r=console[t]||console.log;if(typeof e=="number"){const i=e;e=AR(i),e||(e=RR(i,n),n=[])}r(e,...n)}}}wn.debug=Zy("debug"),wn.log=Zy("log"),wn.warn=Zy("warn"),wn.error=Zy("error");function ds(t,...e){return new Y2(AR(t,e)||RR(t,e))}const TR=Symbol.for("ApolloErrorMessageHandler_"+G2);function K2(t){if(typeof t=="string")return t;try{return BH(t,2).slice(0,1e3)}catch{return"<non-serializable>"}}function AR(t,e=[]){if(t)return W2[TR]&&W2[TR](t,e.map(K2))}function RR(t,e=[]){if(t)return typeof t=="string"?e.reduce((n,r)=>n.replace(/%[sdfo]/,K2(r)),t):`An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#${encodeURIComponent(JSON.stringify({version:G2,message:t,args:e.map(K2)}))}`}const kR=Symbol.for("__APOLLO_CONTEXT__");function Q2(){wn("createContext"in mh,37);let t=D.createContext[kR];return t||(Object.defineProperty(D.createContext,kR,{value:t=D.createContext({}),enumerable:!1,writable:!1,configurable:!0}),t.displayName="ApolloContext"),t}const $H=({client:t,children:e})=>{const n=Q2(),r=D.useContext(n),i=D.useMemo(()=>({...r,client:t||r.client}),[r,t]);return wn(i.client,38),D.createElement(n.Provider,{value:i},e)};function Mf(t){const e=D.useContext(Q2()),n=t||e.client;return wn(!!n,28),n}const{toString:OR,hasOwnProperty:WH}=Object.prototype,NR=Function.prototype.toString,Z2=new Map;function Yn(t,e){try{return J2(t,e)}finally{Z2.clear()}}function J2(t,e){if(t===e)return!0;const n=OR.call(t),r=OR.call(e);if(n!==r)return!1;switch(n){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(DR(t,e))return!0;const i=MR(t),s=MR(e),l=i.length;if(l!==s.length)return!1;for(let u=0;u<l;++u)if(!WH.call(e,i[u]))return!1;for(let u=0;u<l;++u){const d=i[u];if(!J2(t[d],e[d]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(DR(t,e))return!0;const i=t.entries(),s=n==="[object Map]";for(;;){const l=i.next();if(l.done)break;const[u,d]=l.value;if(!e.has(u)||s&&!J2(d,e.get(u)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let i=t.byteLength;if(i===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const i=NR.call(t);return i!==NR.call(e)?!1:!KH(i,YH)}}return!1}function MR(t){return Object.keys(t).filter(GH,t)}function GH(t){return this[t]!==void 0}const YH="{ [native code] }";function KH(t,e){const n=t.length-e.length;return n>=0&&t.indexOf(e,n)===n}function DR(t,e){let n=Z2.get(t);if(n){if(n.has(e))return!0}else Z2.set(t,n=new Set);return n.add(e),!1}function QH(t,e){if(!!!t)throw new Error(e)}const LR={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:["name","directives"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},ZH=new Set(Object.keys(LR));function PR(t){const e=t==null?void 0:t.kind;return typeof e=="string"&&ZH.has(e)}var Df;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(Df||(Df={}));var ur;(function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.DIRECTIVE_EXTENSION="DirectiveExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",t.TYPE_COORDINATE="TypeCoordinate",t.MEMBER_COORDINATE="MemberCoordinate",t.ARGUMENT_COORDINATE="ArgumentCoordinate",t.DIRECTIVE_COORDINATE="DirectiveCoordinate",t.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(ur||(ur={}));function IR(t){return t===9||t===32}function JH(t,e){const n=t.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(b=>b.length===0||IR(b.charCodeAt(0))),l=n.endsWith('\\"""'),u=t.endsWith('"')&&!l,d=t.endsWith("\\"),h=u||d,m=!i||t.length>70||h||s||l;let g="";const y=i&&IR(t.charCodeAt(0));return(m&&!y||s)&&(g+=`
203
+ You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}Ro.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sR,Ro.createPortal=ppe,Ro.createRoot=vpe,Ro.findDOMNode=upe,Ro.flushSync=ype,Ro.hydrate=cpe,Ro.hydrateRoot=gpe,Ro.render=fpe,Ro.unmountComponentAtNode=hpe,Ro.unstable_batchedUpdates=F7,Ro.unstable_renderSubtreeIntoContainer=mpe,Ro.version=eR,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})(),Ro}var vR;function gR(){return vR||(vR=1,B2.exports=zH()),B2.exports}var yR;function HH(){if(yR)return Qy;yR=1;var t=gR();{var e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Qy.createRoot=function(n,r){e.usingClientEntryPoint=!0;try{return t.createRoot(n,r)}finally{e.usingClientEntryPoint=!1}},Qy.hydrateRoot=function(n,r,i){e.usingClientEntryPoint=!0;try{return t.hydrateRoot(n,r,i)}finally{e.usingClientEntryPoint=!1}}}return Qy}var bR=HH(),vv=gR();const SR=ou(vv),ER=!1;function Hs(t){try{return t()}catch{}}const W2=Hs(()=>globalThis)||Hs(()=>window)||Hs(()=>self)||Hs(()=>global)||Hs(function(){return Hs.constructor("return this")()}),G2="4.2.5",CR=new Map;function _R(t){const e=CR.get(t)||1;return CR.set(t,e+1),`${t}:${e}:${Math.random().toString(36).slice(2)}`}function BH(t,e=0){const n=_R("stringifyForDisplay");return JSON.stringify(t,(r,i)=>i===void 0?n:i,e).split(JSON.stringify(n)).join("<undefined>")}const xR="Invariant Violation";class Y2 extends Error{constructor(e=xR){super(e),this.name=xR,Object.setPrototypeOf(this,Y2.prototype)}}const wR=["debug","log","warn","error","silent"];let qH=wR.indexOf("silent");function wn(t,...e){if(!t)throw ds(...e)}function Zy(t){return function(e,...n){if(wR.indexOf(t)>=qH){const r=console[t]||console.log;if(typeof e=="number"){const i=e;e=AR(i),e||(e=RR(i,n),n=[])}r(e,...n)}}}wn.debug=Zy("debug"),wn.log=Zy("log"),wn.warn=Zy("warn"),wn.error=Zy("error");function ds(t,...e){return new Y2(AR(t,e)||RR(t,e))}const TR=Symbol.for("ApolloErrorMessageHandler_"+G2);function K2(t){if(typeof t=="string")return t;try{return BH(t,2).slice(0,1e3)}catch{return"<non-serializable>"}}function AR(t,e=[]){if(t)return W2[TR]&&W2[TR](t,e.map(K2))}function RR(t,e=[]){if(t)return typeof t=="string"?e.reduce((n,r)=>n.replace(/%[sdfo]/,K2(r)),t):`An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#${encodeURIComponent(JSON.stringify({version:G2,message:t,args:e.map(K2)}))}`}const kR=Symbol.for("__APOLLO_CONTEXT__");function Q2(){wn("createContext"in mh,37);let t=D.createContext[kR];return t||(Object.defineProperty(D.createContext,kR,{value:t=D.createContext({}),enumerable:!1,writable:!1,configurable:!0}),t.displayName="ApolloContext"),t}const $H=({client:t,children:e})=>{const n=Q2(),r=D.useContext(n),i=D.useMemo(()=>({...r,client:t||r.client}),[r,t]);return wn(i.client,38),D.createElement(n.Provider,{value:i},e)};function Mf(t){const e=D.useContext(Q2()),n=t||e.client;return wn(!!n,28),n}const{toString:OR,hasOwnProperty:WH}=Object.prototype,NR=Function.prototype.toString,Z2=new Map;function Yn(t,e){try{return J2(t,e)}finally{Z2.clear()}}function J2(t,e){if(t===e)return!0;const n=OR.call(t),r=OR.call(e);if(n!==r)return!1;switch(n){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(DR(t,e))return!0;const i=MR(t),s=MR(e),l=i.length;if(l!==s.length)return!1;for(let u=0;u<l;++u)if(!WH.call(e,i[u]))return!1;for(let u=0;u<l;++u){const d=i[u];if(!J2(t[d],e[d]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(DR(t,e))return!0;const i=t.entries(),s=n==="[object Map]";for(;;){const l=i.next();if(l.done)break;const[u,d]=l.value;if(!e.has(u)||s&&!J2(d,e.get(u)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let i=t.byteLength;if(i===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const i=NR.call(t);return i!==NR.call(e)?!1:!KH(i,YH)}}return!1}function MR(t){return Object.keys(t).filter(GH,t)}function GH(t){return this[t]!==void 0}const YH="{ [native code] }";function KH(t,e){const n=t.length-e.length;return n>=0&&t.indexOf(e,n)===n}function DR(t,e){let n=Z2.get(t);if(n){if(n.has(e))return!0}else Z2.set(t,n=new Set);return n.add(e),!1}function QH(t,e){if(!!!t)throw new Error(e)}const LR={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:["name","directives"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},ZH=new Set(Object.keys(LR));function PR(t){const e=t==null?void 0:t.kind;return typeof e=="string"&&ZH.has(e)}var Df;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(Df||(Df={}));var ur;(function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.DIRECTIVE_EXTENSION="DirectiveExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",t.TYPE_COORDINATE="TypeCoordinate",t.MEMBER_COORDINATE="MemberCoordinate",t.ARGUMENT_COORDINATE="ArgumentCoordinate",t.DIRECTIVE_COORDINATE="DirectiveCoordinate",t.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(ur||(ur={}));function IR(t){return t===9||t===32}function JH(t,e){const n=t.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(b=>b.length===0||IR(b.charCodeAt(0))),l=n.endsWith('\\"""'),u=t.endsWith('"')&&!l,d=t.endsWith("\\"),h=u||d,m=!i||t.length>70||h||s||l;let g="";const y=i&&IR(t.charCodeAt(0));return(m&&!y||s)&&(g+=`
204
204
  `),g+=n,(m||h)&&(g+=`
205
205
  `),'"""'+g+'"""'}const XH=10,FR=2;function eB(t){return Jy(t,[])}function Jy(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return tB(t,e);default:return String(t)}}function tB(t,e){if(t===null)return"null";if(e.includes(t))return"[Circular]";const n=[...e,t];if(nB(t)){const r=t.toJSON();if(r!==t)return typeof r=="string"?r:Jy(r,n)}else if(Array.isArray(t))return iB(t,n);return rB(t,n)}function nB(t){return typeof t.toJSON=="function"}function rB(t,e){const n=Object.entries(t);return n.length===0?"{}":e.length>FR?"["+aB(t)+"]":"{ "+n.map(([i,s])=>i+": "+Jy(s,e)).join(", ")+" }"}function iB(t,e){if(t.length===0)return"[]";if(e.length>FR)return"[Array]";const n=Math.min(XH,t.length),r=t.length-n,i=[];for(let s=0;s<n;++s)i.push(Jy(t[s],e));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function aB(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){const n=t.constructor.name;if(typeof n=="string"&&n!=="")return n}return e}function oB(t){return`"${t.replace(sB,lB)}"`}const sB=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function lB(t){return uB[t.charCodeAt(0)]}const uB=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],X2=Object.freeze({});function Sl(t,e,n=LR){const r=new Map;for(const R of Object.values(ur))r.set(R,cB(e,R));let i,s=Array.isArray(t),l=[t],u=-1,d=[],h=t,m,g;const y=[],b=[];do{u++;const R=u===l.length,k=R&&d.length!==0;if(R){if(m=b.length===0?void 0:y[y.length-1],h=g,g=b.pop(),k)if(s){h=h.slice();let N=0;for(const[A,P]of d){const F=A-N;P===null?(h.splice(F,1),N++):h[F]=P}}else{h={...h};for(const[N,A]of d)h[N]=A}u=i.index,l=i.keys,d=i.edits,s=i.inArray,i=i.prev}else if(g){if(m=s?u:l[u],h=g[m],h==null)continue;y.push(m)}let L;if(!Array.isArray(h)){var C,w;PR(h)||QH(!1,`Invalid AST Node: ${eB(h)}.`);const N=R?(C=r.get(h.kind))===null||C===void 0?void 0:C.leave:(w=r.get(h.kind))===null||w===void 0?void 0:w.enter;if(L=N==null?void 0:N.call(e,h,m,g,y,b),L===X2)break;if(L===!1){if(!R){y.pop();continue}}else if(L!==void 0&&(d.push([m,L]),!R))if(PR(L))h=L;else{y.pop();continue}}if(L===void 0&&k&&d.push([m,h]),R)y.pop();else{var _;i={inArray:s,index:u,keys:l,edits:d,prev:i},s=Array.isArray(h),l=s?h:(_=n[h.kind])!==null&&_!==void 0?_:[],u=-1,d=[],g&&b.push(g),g=h}}while(i!==void 0);return d.length!==0?d[d.length-1][1]:t}function cB(t,e){const n=t[e];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}function fB(t){return Sl(t,hB)}const dB=80,hB={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>_t(t.definitions,`
206
206
 
@@ -239,7 +239,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
239
239
  `+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
240
240
  `):"",this.name="UnsubscriptionError",this.errors=n}});function e0(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var gv=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,s;if(!this.closed){this.closed=!0;var l=this._parentage;if(l)if(this._parentage=null,Array.isArray(l))try{for(var u=vh(l),d=u.next();!d.done;d=u.next()){var h=d.value;h.remove(this)}}catch(w){e={error:w}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else l.remove(this);var m=this.initialTeardown;if(Si(m))try{m()}catch(w){s=w instanceof r6?w.errors:[w]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var y=vh(g),b=y.next();!b.done;b=y.next()){var C=b.value;try{zR(C)}catch(w){s=s??[],w instanceof r6?s=yh(yh([],gh(s)),gh(w.errors)):s.push(w)}}}catch(w){r={error:w}}finally{try{b&&!b.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}}if(s)throw new r6(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)zR(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&e0(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&e0(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})(),VR=gv.EMPTY;function UR(t){return t instanceof gv||t&&"closed"in t&&Si(t.remove)&&Si(t.add)&&Si(t.unsubscribe)}function zR(t){Si(t)?t():t.unsubscribe()}var gB={Promise:void 0},yB={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,yh([t,e],gh(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function HR(t){yB.setTimeout(function(){throw t})}function BR(){}function t0(t){t()}var i6=(function(t){hs(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,UR(n)&&n.add(r)):r.destination=EB,r}return e.create=function(n,r,i){return new yv(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(gv),bB=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){n0(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){n0(r)}else n0(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){n0(n)}},t})(),yv=(function(t){hs(e,t);function e(n,r,i){var s=t.call(this)||this,l;return Si(n)||!n?l={next:n??void 0,error:r??void 0,complete:i??void 0}:l=n,s.destination=new bB(l),s}return e})(i6);function n0(t){HR(t)}function SB(t){throw t}var EB={closed:!0,next:BR,error:SB,complete:BR},a6=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function r0(t){return t}function CB(t){return t.length===0?r0:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var Qr=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,s=xB(e)?e:new yv(e,n,r);return t0(function(){var l=i,u=l.operator,d=l.source;s.add(u?u.call(s,d):d?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=qR(n),new n(function(i,s){var l=new yv({next:function(u){try{e(u)}catch(d){s(d),l.unsubscribe()}},error:s,complete:i});r.subscribe(l)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[a6]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return CB(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=qR(e),new e(function(r,i){var s;n.subscribe(function(l){return s=l},function(l){return i(l)},function(){return r(s)})})},t.create=function(e){return new t(e)},t})();function qR(t){var e;return(e=t??gB.Promise)!==null&&e!==void 0?e:Promise}function _B(t){return t&&Si(t.next)&&Si(t.error)&&Si(t.complete)}function xB(t){return t&&t instanceof i6||_B(t)&&UR(t)}function wB(t){return Si(t==null?void 0:t.lift)}function qs(t){return function(e){if(wB(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function su(t,e,n,r,i){return new TB(t,e,n,r,i)}var TB=(function(t){hs(e,t);function e(n,r,i,s,l,u){var d=t.call(this,n)||this;return d.onFinalize=l,d.shouldUnsubscribe=u,d._next=r?function(h){try{r(h)}catch(m){n.error(m)}}:t.prototype._next,d._error=s?function(h){try{s(h)}catch(m){n.error(m)}finally{this.unsubscribe()}}:t.prototype._error,d._complete=i?function(){try{i()}catch(h){n.error(h)}finally{this.unsubscribe()}}:t.prototype._complete,d}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e})(i6),AB=n6(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Sh=(function(t){hs(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new $R(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new AB},e.prototype.next=function(n){var r=this;t0(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var l=vh(r.currentObservers),u=l.next();!u.done;u=l.next()){var d=u.value;d.next(n)}}catch(h){i={error:h}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;t0(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;t0(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,s=i.hasError,l=i.isStopped,u=i.observers;return s||l?VR:(this.currentObservers=null,u.push(n),new gv(function(){r.currentObservers=null,e0(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,s=r.thrownError,l=r.isStopped;i?n.error(s):l&&n.complete()},e.prototype.asObservable=function(){var n=new Qr;return n.source=this,n},e.create=function(n,r){return new $R(n,r)},e})(Qr),$R=(function(t){hs(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:VR},e})(Sh),RB=(function(t){hs(e,t);function e(n){var r=t.call(this)||this;return r._value=n,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},e.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,s=n._value;if(r)throw i;return this._throwIfClosed(),s},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e})(Sh),o6={now:function(){return(o6.delegate||Date).now()},delegate:void 0},WR=(function(t){hs(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=o6);var s=t.call(this)||this;return s._bufferSize=n,s._windowTime=r,s._timestampProvider=i,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,n),s._windowTime=Math.max(1,r),s}return e.prototype.next=function(n){var r=this,i=r.isStopped,s=r._buffer,l=r._infiniteTimeWindow,u=r._timestampProvider,d=r._windowTime;i||(s.push(n),!l&&s.push(u.now()+d)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),i=this,s=i._infiniteTimeWindow,l=i._buffer,u=l.slice(),d=0;d<u.length&&!n.closed;d+=s?1:2)n.next(u[d]);return this._checkFinalizedStatuses(n),r},e.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,i=n._timestampProvider,s=n._buffer,l=n._infiniteTimeWindow,u=(l?1:2)*r;if(r<1/0&&u<s.length&&s.splice(0,s.length-u),!l){for(var d=i.now(),h=0,m=1;m<s.length&&s[m]<=d;m+=2)h=m;h&&s.splice(0,h+1)}},e})(Sh),kB=(function(t){hs(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e})(gv),GR={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,yh([t,e],gh(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},YR=(function(t){hs(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i.pending=!1,i}return e.prototype.schedule=function(n,r){var i;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var s=this.id,l=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(l,s,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(l,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),GR.setInterval(n.flush.bind(n,this),i)},e.prototype.recycleAsyncId=function(n,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;r!=null&&GR.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(n,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var i=!1,s;try{this.work(n)}catch(l){i=!0,s=l||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,e0(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e})(kB),OB=1,s6,l6={};function KR(t){return t in l6?(delete l6[t],!0):!1}var QR={setImmediate:function(t){var e=OB++;return l6[e]=!0,s6||(s6=Promise.resolve()),s6.then(function(){return KR(e)&&t()}),e},clearImmediate:function(t){KR(t)}},NB=QR.setImmediate,MB=QR.clearImmediate,ZR={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return NB.apply(void 0,yh([],gh(t)))},clearImmediate:function(t){return MB(t)},delegate:void 0},DB=(function(t){hs(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i}return e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),i!==null&&i>0?t.prototype.requestAsyncId.call(this,n,r,i):(n.actions.push(this),n._scheduled||(n._scheduled=ZR.setImmediate(n.flush.bind(n,void 0))))},e.prototype.recycleAsyncId=function(n,r,i){var s;if(i===void 0&&(i=0),i!=null?i>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,n,r,i);var l=n.actions;r!=null&&((s=l[l.length-1])===null||s===void 0?void 0:s.id)!==r&&(ZR.clearImmediate(r),n._scheduled===r&&(n._scheduled=void 0))},e})(YR),JR=(function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=o6.now,t})(),XR=(function(t){hs(e,t);function e(n,r){r===void 0&&(r=JR.now);var i=t.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},e})(JR),LB=(function(t){hs(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.flush=function(n){this._active=!0;var r=this._scheduled;this._scheduled=void 0;var i=this.actions,s;n=n||i.shift();do if(s=n.execute(n.state,n.delay))break;while((n=i[0])&&n.id===r&&i.shift());if(this._active=!1,s){for(;(n=i[0])&&n.id===r&&i.shift();)n.unsubscribe();throw s}},e})(XR),PB=new LB(DB),IB=new XR(YR),FB=IB,bv=new Qr(function(t){return t.complete()});function jB(t){return t&&Si(t.schedule)}function VB(t){return t[t.length-1]}function ek(t){return jB(VB(t))?t.pop():void 0}var tk=(function(t){return t&&typeof t.length=="number"&&typeof t!="function"});function nk(t){return Si(t==null?void 0:t.then)}function rk(t){return Si(t[a6])}function ik(t){return Symbol.asyncIterator&&Si(t==null?void 0:t[Symbol.asyncIterator])}function ak(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function UB(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ok=UB();function sk(t){return Si(t==null?void 0:t[ok])}function lk(t){return mB(this,arguments,function(){var n,r,i,s;return jR(this,function(l){switch(l.label){case 0:n=t.getReader(),l.label=1;case 1:l.trys.push([1,,9,10]),l.label=2;case 2:return[4,bh(n.read())];case 3:return r=l.sent(),i=r.value,s=r.done,s?[4,bh(void 0)]:[3,5];case 4:return[2,l.sent()];case 5:return[4,bh(i)];case 6:return[4,l.sent()];case 7:return l.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function uk(t){return Si(t==null?void 0:t.getReader)}function tc(t){if(t instanceof Qr)return t;if(t!=null){if(rk(t))return zB(t);if(tk(t))return HB(t);if(nk(t))return BB(t);if(ik(t))return ck(t);if(sk(t))return qB(t);if(uk(t))return $B(t)}throw ak(t)}function zB(t){return new Qr(function(e){var n=t[a6]();if(Si(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function HB(t){return new Qr(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function BB(t){return new Qr(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,HR)})}function qB(t){return new Qr(function(e){var n,r;try{for(var i=vh(t),s=i.next();!s.done;s=i.next()){var l=s.value;if(e.next(l),e.closed)return}}catch(u){n={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function ck(t){return new Qr(function(e){WB(t,e).catch(function(n){return e.error(n)})})}function $B(t){return ck(lk(t))}function WB(t,e){var n,r,i,s;return pB(this,void 0,void 0,function(){var l,u;return jR(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,11]),n=vB(t),d.label=1;case 1:return[4,n.next()];case 2:if(r=d.sent(),!!r.done)return[3,4];if(l=r.value,e.next(l),e.closed)return[2];d.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=d.sent(),i={error:u},[3,11];case 6:return d.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:d.sent(),d.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Lf(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var s=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(s),!i)return s}function u6(t,e){return e===void 0&&(e=0),qs(function(n,r){n.subscribe(su(r,function(i){return Lf(r,t,function(){return r.next(i)},e)},function(){return Lf(r,t,function(){return r.complete()},e)},function(i){return Lf(r,t,function(){return r.error(i)},e)}))})}function fk(t,e){return e===void 0&&(e=0),qs(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function GB(t,e){return tc(t).pipe(fk(e),u6(e))}function YB(t,e){return tc(t).pipe(fk(e),u6(e))}function KB(t,e){return new Qr(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function QB(t,e){return new Qr(function(n){var r;return Lf(n,e,function(){r=t[ok](),Lf(n,e,function(){var i,s,l;try{i=r.next(),s=i.value,l=i.done}catch(u){n.error(u);return}l?n.complete():n.next(s)},0,!0)}),function(){return Si(r==null?void 0:r.return)&&r.return()}})}function dk(t,e){if(!t)throw new Error("Iterable cannot be null");return new Qr(function(n){Lf(n,e,function(){var r=t[Symbol.asyncIterator]();Lf(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function ZB(t,e){return dk(lk(t),e)}function JB(t,e){if(t!=null){if(rk(t))return GB(t,e);if(tk(t))return KB(t,e);if(nk(t))return YB(t,e);if(ik(t))return dk(t,e);if(sk(t))return QB(t,e);if(uk(t))return ZB(t,e)}throw ak(t)}function Pf(t,e){return e?JB(t,e):tc(t)}function If(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ek(t);return Pf(t,n)}function hk(t,e){var n=Si(t)?t:function(){return t},r=function(i){return i.error(n())};return new Qr(r)}var pk;(function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"})(pk||(pk={}));var c6=(function(){function t(e,n,r){this.kind=e,this.value=n,this.error=r,this.hasValue=e==="N"}return t.prototype.observe=function(e){return XB(this,e)},t.prototype.do=function(e,n,r){var i=this,s=i.kind,l=i.value,u=i.error;return s==="N"?e==null?void 0:e(l):s==="E"?n==null?void 0:n(u):r==null?void 0:r()},t.prototype.accept=function(e,n,r){var i;return Si((i=e)===null||i===void 0?void 0:i.next)?this.observe(e):this.do(e,n,r)},t.prototype.toObservable=function(){var e=this,n=e.kind,r=e.value,i=e.error,s=n==="N"?If(r):n==="E"?hk(function(){return i}):n==="C"?bv:0;if(!s)throw new TypeError("Unexpected notification kind "+n);return s},t.createNext=function(e){return new t("N",e)},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t})();function XB(t,e){var n,r,i,s=t,l=s.kind,u=s.value,d=s.error;if(typeof l!="string")throw new TypeError('Invalid notification, missing "kind"');l==="N"?(n=e.next)===null||n===void 0||n.call(e,u):l==="E"?(r=e.error)===null||r===void 0||r.call(e,d):(i=e.complete)===null||i===void 0||i.call(e)}var eq=n6(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function tq(t,e){var n=typeof e=="object";return new Promise(function(r,i){var s=!1,l;t.subscribe({next:function(u){l=u,s=!0},error:i,complete:function(){s?r(l):n?r(e.defaultValue):i(new eq)}})})}function nq(t){return t instanceof Date&&!isNaN(t)}function nc(t,e){return qs(function(n,r){var i=0;n.subscribe(su(r,function(s){r.next(t.call(e,s,i++))}))})}function rq(t,e,n,r,i,s,l,u){var d=[],h=0,m=0,g=!1,y=function(){g&&!d.length&&!h&&e.complete()},b=function(w){return h<r?C(w):d.push(w)},C=function(w){h++;var _=!1;tc(n(w,m++)).subscribe(su(e,function(R){e.next(R)},function(){_=!0},void 0,function(){if(_)try{h--;for(var R=function(){var k=d.shift();l||C(k)};d.length&&h<r;)R();y()}catch(k){e.error(k)}}))};return t.subscribe(su(e,b,function(){g=!0,y()})),function(){}}function Eh(t,e,n){return n===void 0&&(n=1/0),Si(e)?Eh(function(r,i){return nc(function(s,l){return e(r,s,i,l)})(tc(t(r,i)))},n):(typeof e=="number"&&(n=e),qs(function(r,i){return rq(r,i,t,n)}))}function iq(t){return Eh(r0,t)}function aq(){return iq(1)}function f6(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return aq()(Pf(t,ek(t)))}function oq(t,e,n){return n===void 0&&(n=FB),new Qr(function(r){var i=nq(t)?+t-n.now():t;i<0&&(i=0);var s=0;return n.schedule(function(){r.closed||(r.next(s++),r.complete())},i)})}function mk(t,e){return qs(function(n,r){var i=0;n.subscribe(su(r,function(s){return t.call(e,s,i++)&&r.next(s)}))})}function i0(t){return qs(function(e,n){var r=null,i=!1,s;r=e.subscribe(su(n,void 0,void 0,function(l){s=tc(t(l,i0(t)(e))),r?(r.unsubscribe(),r=null,s.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,s.subscribe(n))})}function sq(t,e){return e===void 0&&(e=r0),t=t??lq,qs(function(n,r){var i,s=!0;n.subscribe(su(r,function(l){var u=e(l);(s||!t(i,u))&&(s=!1,i=u,r.next(l))}))})}function lq(t,e){return t===e}function uq(t){return qs(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}function cq(){return qs(function(t,e){t.subscribe(su(e,function(n){e.next(c6.createNext(n))},function(){e.next(c6.createComplete()),e.complete()},function(n){e.next(c6.createError(n)),e.complete()}))})}function Sv(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new Sh}:e,r=t.resetOnError,i=r===void 0?!0:r,s=t.resetOnComplete,l=s===void 0?!0:s,u=t.resetOnRefCountZero,d=u===void 0?!0:u;return function(h){var m,g,y,b=0,C=!1,w=!1,_=function(){g==null||g.unsubscribe(),g=void 0},R=function(){_(),m=y=void 0,C=w=!1},k=function(){var L=m;R(),L==null||L.unsubscribe()};return qs(function(L,N){b++,!w&&!C&&_();var A=y=y??n();N.add(function(){b--,b===0&&!w&&!C&&(g=d6(k,d))}),A.subscribe(N),!m&&b>0&&(m=new yv({next:function(P){return A.next(P)},error:function(P){w=!0,_(),g=d6(R,i,P),A.error(P)},complete:function(){C=!0,_(),g=d6(R,l),A.complete()}}),tc(L).subscribe(m))})(h)}}function d6(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(e===!0){t();return}if(e!==!1){var i=new yv({next:function(){i.unsubscribe(),t()}});return tc(e.apply(void 0,yh([],gh(n)))).subscribe(i)}}function h6(t,e,n){var r,i,s,l,u=!1;return t&&typeof t=="object"?(r=t.bufferSize,l=r===void 0?1/0:r,i=t.windowTime,e=i===void 0?1/0:i,s=t.refCount,u=s===void 0?!1:s,n=t.scheduler):l=t??1/0,Sv({connector:function(){return new WR(l,e,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}function Ev(t,e,n){var r=Si(t)||e||n?{next:t,error:e,complete:n}:t;return r?qs(function(i,s){var l;(l=r.subscribe)===null||l===void 0||l.call(r);var u=!0;i.subscribe(su(s,function(d){var h;(h=r.next)===null||h===void 0||h.call(r,d),s.next(d)},function(){var d;u=!1,(d=r.complete)===null||d===void 0||d.call(r),s.complete()},function(d){var h;u=!1,(h=r.error)===null||h===void 0||h.call(r,d),s.error(d)},function(){var d,h;u&&((d=r.unsubscribe)===null||d===void 0||d.call(r)),(h=r.finalize)===null||h===void 0||h.call(r)}))}):r0}function Ch(t,e,n,r){if(n.kind===ur.INT||n.kind===ur.FLOAT)t[e.value]=Number(n.value);else if(n.kind===ur.BOOLEAN||n.kind===ur.STRING)t[e.value]=n.value;else if(n.kind===ur.OBJECT){const i={};n.fields.map(s=>Ch(i,s.name,s.value,r)),t[e.value]=i}else if(n.kind===ur.VARIABLE){const i=(r||{})[n.name.value];t[e.value]=i}else if(n.kind===ur.LIST)t[e.value]=n.values.map(i=>{const s={};return Ch(s,e,i,r),s[e.value]});else if(n.kind===ur.ENUM)t[e.value]=n.value;else if(n.kind===ur.NULL)t[e.value]=null;else throw ds(19,e.value,n.kind)}function p6(t,e){if(t.arguments&&t.arguments.length){const n={};return t.arguments.forEach(({name:r,value:i})=>Ch(n,r,i,e)),n}return null}const vk=typeof Hs(()=>window.document.createElement)=="function",fq=Symbol.for("apollo.cacheSize"),lu={...W2[fq]};function _h(t,e){var n;return((n=t.definitions.find(r=>r.kind==="OperationDefinition"&&!!r.name))==null?void 0:n.name.value)??e}const dq=()=>Object.create(null),{forEach:hq,slice:gk}=Array.prototype,{hasOwnProperty:pq}=Object.prototype;class El{constructor(e=!0,n=dq){this.weakness=e,this.makeData=n}lookup(){return this.lookupArray(arguments)}lookupArray(e){let n=this;return hq.call(e,r=>n=n.getChildTrie(r)),pq.call(n,"data")?n.data:n.data=this.makeData(gk.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let n=this;for(let r=0,i=e.length;n&&r<i;++r){const s=n.mapFor(e[r],!1);n=s&&s.get(e[r])}return n&&n.data}remove(){return this.removeArray(arguments)}removeArray(e){let n;if(e.length){const r=e[0],i=this.mapFor(r,!1),s=i&&i.get(r);s&&(n=s.removeArray(gk.call(e,1)),!s.data&&!s.weak&&!(s.strong&&s.strong.size)&&i.delete(r))}else n=this.data,delete this.data;return n}getChildTrie(e){const n=this.mapFor(e,!0);let r=n.get(e);return r||n.set(e,r=new El(this.weakness,this.makeData)),r}mapFor(e,n){return this.weakness&&mq(e)?this.weak||(n?this.weak=new WeakMap:void 0):this.strong||(n?this.strong=new Map:void 0)}}function mq(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}function vq(){}class m6{constructor(e=1/0,n=vq){this.max=e,this.dispose=n,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const n=this.getNode(e);return n&&n.value}get size(){return this.map.size}getNode(e){const n=this.map.get(e);if(n&&n!==this.newest){const{older:r,newer:i}=n;i&&(i.older=r),r&&(r.newer=i),n.older=this.newest,n.older.newer=n,n.newer=null,this.newest=n,n===this.oldest&&(this.oldest=i)}return n}set(e,n){let r=this.getNode(e);return r?r.value=n:(r={key:e,value:n,newer:null,older:this.newest},this.newest&&(this.newest.newer=r),this.newest=r,this.oldest=this.oldest||r,this.map.set(e,r),r.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const n=this.map.get(e);return n?(n===this.newest&&(this.newest=n.older),n===this.oldest&&(this.oldest=n.newer),n.newer&&(n.newer.older=n.older),n.older&&(n.older.newer=n.newer),this.map.delete(e),this.dispose(n.value,e),!0):!1}}function v6(){}const gq=v6,yq=typeof WeakRef<"u"?WeakRef:function(t){return{deref:()=>t}},bq=typeof WeakMap<"u"?WeakMap:Map,Sq=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:v6,unregister:v6}},Eq=10024;class a0{constructor(e=1/0,n=gq){this.max=e,this.dispose=n,this.map=new bq,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const r=this.unfinalizedNodes.values();for(let i=0;i<Eq;i++){const s=r.next().value;if(!s)break;this.unfinalizedNodes.delete(s);const l=s.key;delete s.key,s.keyRef=new yq(l),this.registry.register(l,s,s)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new Sq(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const n=this.getNode(e);return n&&n.value}getNode(e){const n=this.map.get(e);if(n&&n!==this.newest){const{older:r,newer:i}=n;i&&(i.older=r),r&&(r.newer=i),n.older=this.newest,n.older.newer=n,n.newer=null,this.newest=n,n===this.oldest&&(this.oldest=i)}return n}set(e,n){let r=this.getNode(e);return r?r.value=n:(r={key:e,value:n,newer:null,older:this.newest},this.newest&&(this.newest.newer=r),this.newest=r,this.oldest=this.oldest||r,this.scheduleFinalization(r),this.map.set(e,r),this.size++,r.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const n=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,n),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),n&&this.map.delete(n)}delete(e){const n=this.map.get(e);return n?(this.deleteNode(n),!0):!1}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}const g6=new WeakSet;function yk(t){t.size<=(t.max||-1)||g6.has(t)||(g6.add(t),setTimeout(()=>{t.clean(),g6.delete(t)},100))}const y6=function(t,e){const n=new a0(t,e);return n.set=function(r,i){const s=a0.prototype.set.call(this,r,i);return yk(this),s},n},Cq=function(t,e){const n=new m6(t,e);return n.set=function(r,i){const s=m6.prototype.set.call(this,r,i);return yk(this),s},n};function bk(t,{max:e,makeCacheKey:n=r=>r}){const r=new El(!0),i=new y6(e);return(...s)=>{const l=r.lookupArray(n(s)),u=i.get(l);if(u){if(u.error)throw u.error;return u.result}const d=i.set(l,{});try{return d.result=t(...s)}catch(h){throw d.error=h,h}}}const rc=bk((t,e)=>{wn(t&&t.kind==="Document",1);const n=t.definitions.filter(r=>r.kind==="OperationDefinition");e&&wn(n.length==1&&n[0].operation===e,4,e,e,n[0].operation),Sl(t,{Field(r,i,s,l){var u;if(r.alias&&(r.alias.value==="__typename"||r.alias.value.startsWith("__ac_"))&&r.alias.value!==r.name.value){let d=t,h=[];for(const m of l)d=d[m],d.kind===ur.FIELD&&h.push(((u=d.alias)==null?void 0:u.value)||d.name.value);throw h.splice(-1,1,r.name.value),ds(5,r.alias.value,h.join("."),n[0].operation,_h(t,"(anonymous)"))}}})},{max:lu.checkDocument||2e3});function _q(t){return t.length===0?bv:new Qr(e=>{const{length:n}=t,r=new Array(n),i=new Map;t.forEach((d,h)=>{i.has(d)||i.set(d,new Set),i.get(d).add(h)});let s=i.size,l=i.size,u;i.forEach((d,h)=>{let m=!1;const g=h.subscribe({next:y=>{d.forEach(b=>r[b]=y),m||(m=!0,l--),l||(u||(u=new Set(t.filter(b=>b.dirty))),u.delete(h),u.size||(e.next(r.slice()),u=void 0))},complete:()=>{s--,s||e.complete()},error:e.error.bind(e)});e.add(g)})})}function Yo(...t){const e={};return t.forEach(n=>{n&&Reflect.ownKeys(n).forEach(r=>{const i=n[r];i!==void 0&&(e[r]=i)})}),e}function Cv(t=[]){const e={};return t.forEach(n=>{e[n.name.value]=n}),e}function Ga(t){return t!==null&&typeof t=="object"}const{hasOwnProperty:xq}=Object.prototype,wq=function(t,e,n){return this.merge(t[n],e[n])},Sk=t=>isNaN(+t)?{}:[];class xh{constructor(e={}){Ae(this,"options");Ae(this,"reconciler");Ae(this,"isObject",Ga);Ae(this,"pastCopies",new Set);this.options=e,this.reconciler=e.reconciler||wq}merge(e,n,r={}){const i=r.atPath;if(i!=null&&i.length){const[s,...l]=i;e===void 0&&(e=Sk(s));let u=e[s];u===void 0&&l.length&&(u=Sk(l[0]));const d=this.merge(u,n,{...r,atPath:l});return u!==d&&(e=this.shallowCopyForMerge(e),e[s]=d),e}return Array.isArray(e)&&Array.isArray(n)&&this.options.arrayMerge==="truncate"&&e.length>n.length&&(e=e.slice(0,n.length),this.pastCopies.add(e)),Ga(n)&&Ga(e)?(Object.keys(n).forEach(s=>{if(xq.call(e,s)){const l=e[s];if(n[s]!==l){const u=this.reconciler(e,n,s);u!==l&&(e=this.shallowCopyForMerge(e),e[s]=u)}}else e=this.shallowCopyForMerge(e),e[s]=n[s]}),e):n}shallowCopyForMerge(e){return Ga(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e={__proto__:Object.getPrototypeOf(e),...e},this.pastCopies.add(e))),e}}function b6(t){const e={},n=t&&t.variableDefinitions;return n&&n.length&&n.forEach(r=>{r.defaultValue&&Ch(e,r.variable.name,r.defaultValue)}),e}function o0(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{const n=t.name.value;if(typeof e=="function")return e(n);const r=e&&e[n];return wn(r,9,n),r||null}default:return null}}function Tq(t,e){let n=e;const r=[];return t.definitions.forEach(s=>{if(s.kind==="OperationDefinition")throw ds(10,s.operation,s.name?` named '${s.name.value}'`:"");s.kind==="FragmentDefinition"&&r.push(s)}),typeof n>"u"&&(wn(r.length===1,11,r.length),n=r[0].name.value),{...t,definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:n}}]}},...t.definitions]}}function Aq(t){wn(t.kind==="Document",6),wn(t.definitions.length<=1,7);const e=t.definitions[0];return wn(e.kind==="FragmentDefinition",8),e}function _v(t){return t.definitions.filter(e=>e.kind==="FragmentDefinition")}function S6(t){rc(t);let e;for(let n of t.definitions){if(n.kind==="OperationDefinition")return n;n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw ds(12)}function uu(t){return rc(t),t.definitions.filter(e=>e.kind==="OperationDefinition")[0]}function Rq(t){const e=uu(t);return wn(e&&e.operation==="query",13),e}const cu=Object.assign(function(e){return JSON.stringify(e,kq)},{reset(){xv=new Cq(lu.canonicalStringify||1e3)}});let xv;cu.reset();function kq(t,e){if(e&&typeof e=="object"){const n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){const r=Object.keys(e);if(r.every(Oq))return e;const i=JSON.stringify(r);let s=xv.get(i);if(!s){r.sort();const u=JSON.stringify(r);s=xv.get(u)||r,xv.set(i,s),xv.set(u,s)}const l=Object.create(n);return s.forEach(u=>{l[u]=e[u]}),l}}return e}function Oq(t,e,n){return e===0||n[e-1]<=t}const Nq=["connection","include","skip","client","rest","export","nonreactive","stream"];let wv=cu;const Ek=Object.assign(function(t,e,n){if(e&&n&&n.connection&&n.connection.key){if(n.connection.filter&&n.connection.filter.length>0){const i=n.connection.filter?n.connection.filter:[];i.sort();const s={};i.forEach(u=>{s[u]=e[u]});const l=wv(s);if(l!=="{}")return`${n.connection.key}(${l})`}return n.connection.key}let r=t;if(e){const i=wv(e);i!=="{}"&&(r+=`(${i})`)}return n&&Object.keys(n).forEach(i=>{Nq.indexOf(i)===-1&&(n[i]&&Object.keys(n[i]).length?r+=`@${i}(${wv(n[i])})`:r+=`@${i}`)}),r},{setStringify(t){const e=wv;return wv=t,e}});function wh(t){var e;return!!((e=t.errors)!=null&&e.length)}function Th(t,e,n){const r=new Set(t),i=r.size;return Sl(e,{Directive(s){if(r.delete(s.name.value)&&(!n||!r.size))return X2}}),n?!r.size:r.size<i}function Mq(t){let e=!1;return Sl(t,{Directive:{enter(n){if(n.name.value==="client"&&n.arguments&&(e=n.arguments.some(r=>r.name.value==="always"&&r.value.kind==="BooleanValue"&&r.value.value===!0),e))return X2}}}),e}const Ui=Array.isArray;function Dq(t){return Ga(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function Tv(t){return t.kind==="Field"}function E6(t){return Array.isArray(t)&&t.length>0}function Ah(t){return{__ref:String(t)}}function xpe(t){return t}function Lq(t){let e=t[0]||{};const n=t.length;if(n>1){const r=new xh;for(let i=1;i<n;++i)e=r.merge(e,t[i])}return e}function Ff(t,e){return Yo(t,e,e.variables&&{variables:Yo({...t&&t.variables,...e.variables})})}function C6(t){return t.catch(()=>{}),t}function Pq(t,e){rc(e);const n=Ck(""),r=Ck(""),i=_=>{for(let R=0,k;R<_.length&&(k=_[R]);++R)if(!Ui(k)){if(k.kind===ur.OPERATION_DEFINITION)return n(k.name&&k.name.value);if(k.kind===ur.FRAGMENT_DEFINITION)return r(k.name.value)}return wn.error(14),null};let s=0;for(let _=e.definitions.length-1;_>=0;--_)e.definitions[_].kind===ur.OPERATION_DEFINITION&&++s;const l=Iq(t),u=_=>E6(_)&&_.map(l).some(R=>R&&R.remove),d=new Map;let h=!1;const m={enter(_){if(u(_.directives))return h=!0,null}},g=Sl(e,{Field:m,InlineFragment:m,VariableDefinition:{enter(){return!1}},Variable:{enter(_,R,k,L,N){const A=i(N);A&&A.variables.add(_.name.value)}},FragmentSpread:{enter(_,R,k,L,N){if(u(_.directives))return h=!0,null;const A=i(N);A&&A.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter(_,R,k,L){d.set(JSON.stringify(L),_)},leave(_,R,k,L){const N=d.get(JSON.stringify(L));if(_===N)return _;if(s>0&&_.selectionSet.selections.every(A=>A.kind===ur.FIELD&&A.name.value==="__typename"))return r(_.name.value).removed=!0,h=!0,null}},Directive:{leave(_){if(l(_))return h=!0,null}}});if(!h)return e;const y=_=>(_.transitiveVars||(_.transitiveVars=new Set(_.variables),_.removed||_.fragmentSpreads.forEach(R=>{y(r(R)).transitiveVars.forEach(k=>{_.transitiveVars.add(k)})})),_),b=new Set;g.definitions.forEach(_=>{_.kind===ur.OPERATION_DEFINITION?y(n(_.name&&_.name.value)).fragmentSpreads.forEach(R=>{b.add(R)}):_.kind===ur.FRAGMENT_DEFINITION&&s===0&&!r(_.name.value).removed&&b.add(_.name.value)}),b.forEach(_=>{y(r(_)).fragmentSpreads.forEach(R=>{b.add(R)})});const C=_=>!!(!b.has(_)||r(_).removed),w={enter(_){if(C(_.name.value))return null}};return Fq(Sl(g,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave(_){if(_.variableDefinitions){const R=y(n(_.name&&_.name.value)).transitiveVars;if(R.size<_.variableDefinitions.length)return{..._,variableDefinitions:_.variableDefinitions.filter(k=>R.has(k.variable.name.value))}}}}}))}function Ck(t){const e=new Map;return function(r=t){let i=e.get(r);return i||e.set(r,i={variables:new Set,fragmentSpreads:new Set}),i}}function Iq(t){const e=new Map,n=new Map;return t.forEach(r=>{r&&(r.name?e.set(r.name,r):r.test&&n.set(r.test,r))}),r=>{let i=e.get(r.name.value);return!i&&n.size&&n.forEach((s,l)=>{l(r)&&(i=s)}),i}}function _k(t,e){return!t||t.selectionSet.selections.every(n=>n.kind===ur.FRAGMENT_SPREAD&&_k(e[n.name.value],e))}function Fq(t){return _k(uu(t)||Aq(t),Cv(_v(t)))?null:t}function jq(t){return Sl(t,{FragmentSpread(e){var n;if(!((n=e.directives)!=null&&n.some(({name:r})=>r.value==="unmask")))return null}})}function Rh(t){return t.alias?t.alias.value:t.name.value}function s0({directives:t},e){return!t||!t.length?!0:Uq(t).every(({directive:n,ifArgument:r})=>{let i=!1;return r.value.kind==="Variable"?(i=e&&e[r.value.name.value],wn(i!==void 0,15,n.name.value)):i=r.value.value,n.name.value==="skip"?!i:i})}function Vq({name:{value:t}}){return t==="skip"||t==="include"}function Uq(t){const e=[];return t&&t.length&&t.forEach(n=>{if(!Vq(n))return;const r=n.arguments,i=n.name.value;wn(r&&r.length===1,16,i);const s=r[0];wn(s.name&&s.name.value==="if",17,i);const l=s.value;wn(l&&(l.kind==="Variable"||l.kind==="BooleanValue"),18,i),e.push({directive:n,ifArgument:s})}),e}function zq(t,e){let n=null;t.directives&&(n={},t.directives.forEach(i=>{n[i.name.value]={},i.arguments&&i.arguments.forEach(({name:s,value:l})=>Ch(n[i.name.value],s,l,e))}));let r=null;return t.arguments&&t.arguments.length&&(r={},t.arguments.forEach(({name:i,value:s})=>Ch(r,i,s,e))),Ek(t.name.value,r,n)}function Av(t){const e={data:t.data};return t.error&&(e.error=t.error),e}function _6(t,e=()=>{}){return n=>new Qr(r=>{let i=e();return n.subscribe({next(s){let l;try{l=t(s,i)}catch(u){r.error(u)}l!==void 0&&r.next(l)},error(s){r.error(s)},complete(){r.complete()}})})}function xk(t,{data:e,...n},{data:r,...i},s){return Yn(n,i)&&l0(S6(t).selectionSet,e,r,{fragmentMap:Cv(_v(t)),variables:s})}function l0(t,e,n,r){if(e===n)return!0;const i=new Set;return t.selections.every(s=>{if(i.has(s)||(i.add(s),!s0(s,r.variables))||wk(s))return!0;if(Tv(s)){const l=Rh(s),u=e&&e[l],d=n&&n[l],h=s.selectionSet;if(!h)return Yn(u,d);const m=Array.isArray(u),g=Array.isArray(d);if(m!==g)return!1;if(m&&g){const y=u.length;if(d.length!==y)return!1;for(let b=0;b<y;++b)if(!l0(h,u[b],d[b],r))return!1;return!0}return l0(h,u,d,r)}else{const l=o0(s,r.fragmentMap);if(l)return wk(l)?!0:l0(l.selectionSet,e,n,r)}})}function wk(t){return!!t.directives&&t.directives.some(Hq)}function Hq(t){return t.name.value==="nonreactive"}function Bq(t,e){let n,r;function i(s){return s!==n&&(n=s,r=e(n)),r}return Object.assign(t.pipe(nc(i),h6({bufferSize:1,refCount:!0})),{getCurrentResult:()=>i(t.getCurrentResult())})}const qq=bk(function(e,n,r){return Bq(e,r)},{max:1,makeCacheKey:t=>t.slice(0,2)}),Tk=Symbol.for("apollo.result.extensions"),ic=Symbol.for("apollo.result.streamInfo"),x6=Symbol.for("apollo.observableQuery.variablesUnknown");let Ea=null;const Ak={};let $q=1;const Wq=()=>class{constructor(){this.id=["slot",$q++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ea;e;e=e.parent)if(this.id in e.slots){const n=e.slots[this.id];if(n===Ak)break;return e!==Ea&&(Ea.slots[this.id]=n),!0}return Ea&&(Ea.slots[this.id]=Ak),!1}getValue(){if(this.hasValue())return Ea.slots[this.id]}withValue(e,n,r,i){const s={__proto__:null,[this.id]:e},l=Ea;Ea={parent:l,slots:s};try{return n.apply(i,r)}finally{Ea=l}}static bind(e){const n=Ea;return function(){const r=Ea;try{return Ea=n,e.apply(this,arguments)}finally{Ea=r}}}static noContext(e,n,r){if(Ea){const i=Ea;try{return Ea=null,e.apply(r,n)}finally{Ea=i}}else return e.apply(r,n)}};function Rk(t){try{return t()}catch{}}const w6="@wry/context:Slot",kk=Rk(()=>globalThis)||Rk(()=>global)||Object.create(null),u0=kk[w6]||Array[w6]||(function(t){try{Object.defineProperty(kk,w6,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}})(Wq()),{bind:Tpe,noContext:Ape}=u0,c0=new u0,{hasOwnProperty:Gq}=Object.prototype,T6=Array.from||function(t){const e=[];return t.forEach(n=>e.push(n)),e};function A6(t){const{unsubscribe:e}=t;typeof e=="function"&&(t.unsubscribe=void 0,e())}const Rv=[],Yq=100;function kh(t,e){if(!t)throw new Error(e||"assertion failure")}function Ok(t,e){const n=t.length;return n>0&&n===e.length&&t[n-1]===e[n-1]}function Nk(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function Mk(t){return t.slice(0)}class f0{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++f0.count}peek(){if(this.value.length===1&&!ac(this))return Dk(this),this.value[0]}recompute(e){return kh(!this.recomputing,"already recomputing"),Dk(this),ac(this)?Kq(this,e):Nk(this.value)}setDirty(){this.dirty||(this.dirty=!0,Lk(this),A6(this))}dispose(){this.setDirty(),Vk(this),R6(this,(e,n)=>{e.setDirty(),Uk(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=Rv.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(T6(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),Rv.push(this.deps),this.deps=null)}}f0.count=0;function Dk(t){const e=c0.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),ac(t)?Ik(e,t):Fk(e,t),e}function Kq(t,e){return Vk(t),c0.withValue(t,Qq,[t,e]),Jq(t,e)&&Zq(t),Nk(t.value)}function Qq(t,e){t.recomputing=!0;const{normalizeResult:n}=t;let r;n&&t.value.length===1&&(r=Mk(t.value)),t.value.length=0;try{if(t.value[0]=t.fn.apply(null,e),n&&r&&!Ok(r,t.value))try{t.value[0]=n(t.value[0],r[0])}catch{}}catch(i){t.value[1]=i}t.recomputing=!1}function ac(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function Zq(t){t.dirty=!1,!ac(t)&&Pk(t)}function Lk(t){R6(t,Ik)}function Pk(t){R6(t,Fk)}function R6(t,e){const n=t.parents.size;if(n){const r=T6(t.parents);for(let i=0;i<n;++i)e(r[i],t)}}function Ik(t,e){kh(t.childValues.has(e)),kh(ac(e));const n=!ac(t);if(!t.dirtyChildren)t.dirtyChildren=Rv.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),n&&Lk(t)}function Fk(t,e){kh(t.childValues.has(e)),kh(!ac(e));const n=t.childValues.get(e);n.length===0?t.childValues.set(e,Mk(e.value)):Ok(n,e.value)||t.setDirty(),jk(t,e),!ac(t)&&Pk(t)}function jk(t,e){const n=t.dirtyChildren;n&&(n.delete(e),n.size===0&&(Rv.length<Yq&&Rv.push(n),t.dirtyChildren=null))}function Vk(t){t.childValues.size>0&&t.childValues.forEach((e,n)=>{Uk(t,n)}),t.forgetDeps(),kh(t.dirtyChildren===null)}function Uk(t,e){e.parents.delete(t),t.childValues.delete(e),jk(t,e)}function Jq(t,e){if(typeof t.subscribe=="function")try{A6(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}const Xq={setDirty:!0,dispose:!0,forget:!0};function zk(t){const e=new Map;function n(r){const i=c0.getValue();if(i){let s=e.get(r);s||e.set(r,s=new Set),i.dependOn(s)}}return n.dirty=function(i,s){const l=e.get(i);if(l){const u=s&&Gq.call(Xq,s)?s:"setDirty";T6(l).forEach(d=>d[u]()),e.delete(i),A6(l)}},n}let Hk;function Bk(...t){return(Hk||(Hk=new El(typeof WeakMap=="function"))).lookupArray(t)}const k6=new Set;function kv(t,{max:e=Math.pow(2,16),keyArgs:n,makeCacheKey:r=Bk,normalizeResult:i,subscribe:s,cache:l=m6}=Object.create(null)){const u=typeof l=="function"?new l(e,y=>y.dispose()):l,d=function(){const y=r.apply(null,n?n.apply(null,arguments):arguments);if(y===void 0)return t.apply(null,arguments);let b=u.get(y);b||(u.set(y,b=new f0(t)),b.normalizeResult=i,b.subscribe=s,b.forget=()=>u.delete(y));const C=b.recompute(Array.prototype.slice.call(arguments));return u.set(y,b),k6.add(u),c0.hasValue()||(k6.forEach(w=>w.clean()),k6.clear()),C};Object.defineProperty(d,"size",{get:()=>u.size,configurable:!1,enumerable:!1}),Object.freeze(d.options={max:e,keyArgs:n,makeCacheKey:r,normalizeResult:i,subscribe:s,cache:u});function h(y){const b=y&&u.get(y);b&&b.setDirty()}d.dirtyKey=h,d.dirty=function(){h(r.apply(null,arguments))};function m(y){const b=y&&u.get(y);if(b)return b.peek()}d.peekKey=m,d.peek=function(){return m(r.apply(null,arguments))};function g(y){return y?u.delete(y):!1}return d.forgetKey=g,d.forget=function(){return g(r.apply(null,arguments))},d.makeCacheKey=r,d.getKey=n?function(){return r.apply(null,n.apply(null,arguments))}:r,Object.freeze(d)}function e$(...t){return Bk.bind(null,...t)}class t${constructor(){Ae(this,"startRequest")}isIncrementalResult(e){return!1}prepareRequest(e){return wn(!Th(["defer","stream"],e.query),67),e}extractErrors(){}}function n$(t,{client:e}){const n={query:t.query,variables:t.variables||{},extensions:t.extensions||{},operationName:_h(t.query),operationType:uu(t.query).operation};let r={...t.context};const i=l=>{typeof l=="function"?r={...r,...l(s())}:r={...r,...l}},s=()=>Object.freeze({...r});return Object.defineProperty(n,"setContext",{enumerable:!1,value:i}),Object.defineProperty(n,"getContext",{enumerable:!1,value:s}),Object.defineProperty(n,"client",{enumerable:!1,value:e}),n}function r$(t,e){const n={...t},r=new Set(Object.keys(t));return Sl(e,{Variable(i,s,l){l&&l.kind!=="VariableDefinition"&&r.delete(i.name.value)}}),r.forEach(i=>{delete n[i]}),n}class oa{constructor(e){Ae(this,"left");Ae(this,"right");e&&(this.request=e)}static empty(){return new oa(()=>bv)}static from(e){if(e.length===0)return oa.empty();const[n,...r]=e;return n.concat(...r)}static split(e,n,r=new oa((i,s)=>s(i))){const i=new oa((s,l)=>e(s)?n.request(s,l):r.request(s,l));return Object.assign(i,{left:n,right:r})}static execute(e,n,r){return e.request(n$(n,r),()=>bv)}static concat(...e){return oa.from(e)}split(e,n,r){return this.concat(oa.split(e,n,r))}concat(...e){return e.length===0?this:e.reduce(this.combine.bind(this),this)}combine(e,n){const r=new oa((i,s)=>e.request(i,l=>n.request(l,s)));return Object.assign(r,{left:e,right:n})}request(e,n){throw ds(65)}}const O6=oa.execute;function i$(t){return t}class fu{constructor(e,n={}){Ae(this,"transform");Ae(this,"cached");Ae(this,"resultCache",new WeakSet);Ae(this,"left");Ae(this,"right");this.transform=e,n.getCacheKey&&(this.getCacheKey=n.getCacheKey),this.cached=n.cache!==!1,this.resetCache()}getCacheKey(e){return[e]}static identity(){return new fu(i$,{cache:!1})}static split(e,n,r=fu.identity()){return Object.assign(new fu(i=>(e(i)?n:r).transformDocument(i),{cache:!1}),{left:n,right:r})}resetCache(){if(this.cached){const e=new El;this.performWork=kv(fu.prototype.performWork.bind(this),{makeCacheKey:n=>{const r=this.getCacheKey(n);if(r)return wn(Array.isArray(r),20),e.lookupArray(r)},max:lu["documentTransform.cache"],cache:a0})}}performWork(e){return rc(e),this.transform(e)}transformDocument(e){if(this.resultCache.has(e))return e;const n=this.performWork(e);return this.resultCache.add(n),n}concat(e){return Object.assign(new fu(n=>e.transformDocument(this.transformDocument(n)),{cache:!1}),{left:this,right:e})}}let N6;const jf=Object.assign(t=>{let e=N6.get(t);return e||(e=fB(t),N6.set(t,e)),e},{reset(){N6=new y6(lu.print||2e3)}});jf.reset();function ti(t){return!!(t&&typeof t=="object"&&typeof t.__ref=="string")}const qk={kind:ur.FIELD,name:{kind:ur.NAME,value:"__typename"}},$k=Object.assign(function(t){return Sl(t,{SelectionSet:{enter(e,n,r){if(r&&r.kind===ur.OPERATION_DEFINITION)return;const{selections:i}=e;if(!i||i.some(u=>u.kind===ur.FIELD&&(u.name.value==="__typename"||u.name.value.lastIndexOf("__",0)===0)))return;const l=r;if(!(l.kind===ur.FIELD&&l.directives&&l.directives.some(u=>u.name.value==="export")))return{...e,selections:[...i,qk]}}}})},{added(t){return t===qk}});function Wk(t,e){var n;return((n=uu(t))==null?void 0:n.operation)===e}function a$(t){return Wk(t,"mutation")}function o$(t){return Wk(t,"subscription")}function Gk(t){return t===7||t===8}function d0(t){return!Gk(t)}class s${constructor(){Ae(this,"assumeImmutableResults",!1);Ae(this,"fragmentWatches",new El(!0));Ae(this,"onAfterBroadcast",e=>e());Ae(this,"getFragmentDoc",kv(Tq,{max:lu["cache.fragmentQueryDocuments"]||1e3,cache:a0,makeCacheKey:e$(this)}))}lookupFragment(e){return null}batch(e){const n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0;let r;return this.performTransaction(()=>r=e.update(this),n),r}recordOptimisticTransaction(e,n){this.performTransaction(e,n)}transformDocument(e){return e}transformForLink(e){return e}identify(e){}gc(){return[]}modify(e){return!1}readQuery(e,n=!!e.optimistic){return this.read({...e,rootId:e.id||"ROOT_QUERY",optimistic:n})}watchFragment(e){const{fragment:n,fragmentName:r,from:i}=e,s=this.getFragmentDoc(n,r),u=(Array.isArray(i)?i:[i]).map(b=>b==null?b:this.toCacheId(b));if(!Array.isArray(i)){const b=this.watchSingleFragment(u[0],s,e);return i===null?b:qq(b,Symbol.for("apollo.transform.individualResult"),C=>({...C,data:C.data??{}}))}let d;function h(b){const C=b.reduce((w,_,R)=>(w.data.push(_.data),w.complete&&(w.complete=_.complete),w.dataState=w.complete?"complete":"partial",_.missing&&(w.missing||(w.missing={}),w.missing[R]=_.missing),w),{data:[],dataState:"complete",complete:!0});return Yn(d,C)||(d=C),d}if(u.length===0)return u$;let m=!1;const g=u.map(b=>this.watchSingleFragment(b,s,e)),y=_q(g).pipe(nc(h),Ev({subscribe:()=>m=!0,unsubscribe:()=>m=!1}),h6({bufferSize:1,refCount:!0}));return Object.assign(y,{getCurrentResult:()=>{if(m&&d)return d;const b=g.map(C=>C.getCurrentResult());return h(b)}})}watchSingleFragment(e,n,r){if(e===null)return l$;const{optimistic:i=!0,variables:s}=r,l=[n,cu({id:e,optimistic:i,variables:s})],u=this.fragmentWatches.lookupArray(l);if(!u.observable){let m=function(y){const b=y.result;return(!h||!xk(n,{data:h.data},{data:b},r.variables))&&(h={data:b,dataState:y.complete?"complete":"partial",complete:y.complete},y.missing&&(h.missing=y.missing.missing)),h},d=!1,h;const g=new Qr(y=>{d=!0;const b=this.watch({variables:s,returnPartialData:!0,id:e,query:n,optimistic:i,immediate:!0,callback:C=>{g.dirty=!0,this.onAfterBroadcast(()=>{y.next(m(C)),g.dirty=!1})}});return()=>{d=!1,b(),this.fragmentWatches.removeArray(l)}}).pipe(sq(),Sv({connector:()=>new WR(1),resetOnRefCountZero:()=>oq(0)}));u.observable=Object.assign(g,{dirty:!1,getCurrentResult:()=>d&&h?h:m(this.diff({id:e,query:n,returnPartialData:!0,optimistic:i,variables:s}))})}return u.observable}readFragment(e,n=!!e.optimistic){const r=e.from!==void 0?this.toCacheId(e.from):e.id;return this.read({...e,query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:r,optimistic:n})}writeQuery({id:e,data:n,...r}){return this.write(Object.assign(r,{dataId:e||"ROOT_QUERY",result:n}))}writeFragment({data:e,fragment:n,fragmentName:r,...i}){const s=i.from!==void 0?this.toCacheId(i.from):i.id;return this.write(Object.assign(i,{query:this.getFragmentDoc(n,r),dataId:s,result:e}))}updateQuery(e,n){return this.batch({update(r){const i=r.readQuery(e),s=n(i);return s==null?i:(r.writeQuery({...e,data:s}),s)}})}updateFragment(e,n){return this.batch({update(r){const i=r.readFragment(e),s=n(i);return s==null?i:(r.writeFragment({...e,data:s}),s)}})}toCacheId(e){return typeof e=="string"?e:this.identify(e)}}const Yk=Object.freeze({data:null,dataState:"complete",complete:!0}),l$=Object.assign(new Qr(t=>{t.next(Yk)}),{dirty:!1,getCurrentResult:()=>Yk}),Kk=Object.freeze({data:[],dataState:"complete",complete:!0}),u$=Object.assign(new Qr(t=>{t.next(Kk)}),{getCurrentResult:()=>Kk});class M6 extends Error{constructor(n,r,i,s){super(n);Ae(this,"message");Ae(this,"path");Ae(this,"query");Ae(this,"variables");Ae(this,"missing");if(this.message=n,this.path=r,this.query=i,this.variables=s,this.name="MissingFieldError",Array.isArray(this.path)){this.missing=this.message;for(let l=this.path.length-1;l>=0;--l)this.missing={[this.path[l]]:this.missing}}else this.missing=this.path;this.__proto__=M6.prototype}}const{hasOwnProperty:sa}=Object.prototype;function Qk({__typename:t,id:e,_id:n},r){if(typeof t=="string"&&(r&&(r.keyObject=e!=null?{id:e}:n!=null?{_id:n}:void 0),e==null&&n!=null&&(e=n),e!=null))return`${t}:${typeof e=="number"||typeof e=="string"?e:JSON.stringify(e)}`}const c$={dataIdFromObject:Qk,resultCaching:!0};function f$(t){return Yo(c$,t)}const Zk=/^[_a-z][_0-9a-z]*/i;function Oh(t){const e=t.match(Zk);return e?e[0]:t}function D6(t,e,n){return Ga(e)?Ui(e)?e.every(r=>D6(t,r,n)):t.selections.every(r=>{if(Tv(r)&&s0(r,n)){const i=Rh(r);return sa.call(e,i)&&(!r.selectionSet||D6(r.selectionSet,e[i],n))}return!0}):!1}function Nh(t){return Ga(t)&&!ti(t)&&!Ui(t)}function d$(){return new xh}function Jk(t,e){const n=Cv(_v(t));return{fragmentMap:n,lookupFragment(r){let i=n[r];return!i&&e&&(i=e.lookup(r)),i||null}}}const h0={},L6=()=>h0,Xk={};class p0{constructor(e,n){Ae(this,"policies");Ae(this,"group");Ae(this,"data",{});Ae(this,"rootIds",{});Ae(this,"refs",{});Ae(this,"getFieldValue",(e,n)=>ti(e)?this.get(e.__ref,n):e&&e[n]);Ae(this,"canRead",e=>ti(e)?this.has(e.__ref):typeof e=="object");Ae(this,"toReference",(e,n)=>{if(typeof e=="string")return Ah(e);if(ti(e))return e;const[r]=this.policies.identify(e);if(r){const i=Ah(r);return n&&this.merge(r,e),i}});this.policies=e,this.group=n}toObject(){return{...this.data}}has(e){return this.lookup(e,!0)!==void 0}get(e,n){if(this.group.depend(e,n),sa.call(this.data,e)){const r=this.data[e];if(r&&sa.call(r,n))return r[n]}if(n==="__typename"&&sa.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Cl)return this.parent.get(e,n)}lookup(e,n){if(n&&this.group.depend(e,"__exists"),sa.call(this.data,e))return this.data[e];if(this instanceof Cl)return this.parent.lookup(e,n);if(this.policies.rootTypenamesById[e])return{}}merge(e,n){let r;ti(e)&&(e=e.__ref),ti(n)&&(n=n.__ref);const i=typeof e=="string"?this.lookup(r=e):e,s=typeof n=="string"?this.lookup(r=n):n;if(!s)return;wn(typeof r=="string",104);const l=new xh({reconciler:m$}).merge(i,s);if(this.data[r]=l,l!==i&&(delete this.refs[r],this.group.caching)){const u={};i||(u.__exists=1),Object.keys(s).forEach(d=>{if(!i||i[d]!==l[d]){u[d]=1;const h=Oh(d);h!==d&&!this.policies.hasKeyArgs(l.__typename,h)&&(u[h]=1),l[d]===void 0&&!(this instanceof Cl)&&delete l[d]}}),u.__typename&&!(i&&i.__typename)&&this.policies.rootTypenamesById[r]===l.__typename&&delete u.__typename,Object.keys(u).forEach(d=>this.group.dirty(r,d))}}modify(e,n,r){const i=this.lookup(e);if(i){const s={};let l=!1,u=!0;const d={DELETE:h0,INVALIDATE:Xk,isReference:ti,toReference:this.toReference,canRead:this.canRead,readField:(h,m)=>this.policies.readField(typeof h=="string"?{fieldName:h,from:m||Ah(e)}:h,{store:this})};if(Object.keys(i).forEach(h=>{const m=Oh(h);let g=i[h];if(g===void 0)return;const y=typeof n=="function"?n:n[h]||(r?void 0:n[m]);if(y){let b=y===L6?h0:y(g,{...d,fieldName:m,storeFieldName:h,storage:this.getStorage(e,h)});b===Xk?this.group.dirty(e,h):(b===h0&&(b=void 0),b!==g&&(s[h]=b,l=!0,g=b))}g!==void 0&&(u=!1)}),l)return this.merge(e,s),u&&(this instanceof Cl?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1}delete(e,n,r){const i=this.lookup(e);if(i){const s=this.getFieldValue(i,"__typename"),l=n&&r?this.policies.getStoreFieldName({typename:s,fieldName:n,args:r}):n;return this.modify(e,l?{[l]:L6}:L6,!!r)}return!1}evict(e,n){let r=!1;return e.id&&(sa.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof Cl&&this!==n&&(r=this.parent.evict(e,n)||r),(e.fieldName||r)&&this.group.dirty(e.id,e.fieldName||"__exists")),r}clear(){this.replace(null)}extract(){const e=this.toObject(),n=[];return this.getRootIdSet().forEach(r=>{sa.call(this.policies.rootTypenamesById,r)||n.push(r)}),n.length&&(e.__META={extraRootIds:n.sort()}),e}replace(e){if(Object.keys(this.data).forEach(n=>{e&&sa.call(e,n)||this.delete(n)}),e){const{__META:n,...r}=e;Object.keys(r).forEach(i=>{this.merge(i,r[i])}),n&&n.extraRootIds.forEach(this.retain,this)}}retain(e){return this.rootIds[e]=(this.rootIds[e]||0)+1}release(e){if(this.rootIds[e]>0){const n=--this.rootIds[e];return n||delete this.rootIds[e],n}return 0}getRootIdSet(e=new Set){return Object.keys(this.rootIds).forEach(e.add,e),this instanceof Cl?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e}gc(){const e=this.getRootIdSet(),n=this.toObject();e.forEach(i=>{sa.call(n,i)&&(Object.keys(this.findChildRefIds(i)).forEach(e.add,e),delete n[i])});const r=Object.keys(n);if(r.length){let i=this;for(;i instanceof Cl;)i=i.parent;r.forEach(s=>i.delete(s))}return r}findChildRefIds(e){if(!sa.call(this.refs,e)){const n=this.refs[e]={},r=this.data[e];if(!r)return n;const i=new Set([r]);i.forEach(s=>{ti(s)&&(n[s.__ref]=!0),Ga(s)&&Object.keys(s).forEach(l=>{const u=s[l];Ga(u)&&i.add(u)})})}return this.refs[e]}makeCacheKey(){return this.group.keyMaker.lookupArray(arguments)}get supportsResultCaching(){return this.group.caching}}class eO{constructor(e,n=null){Ae(this,"caching");Ae(this,"parent");Ae(this,"d",null);Ae(this,"keyMaker");this.caching=e,this.parent=n,this.resetCaching()}resetCaching(){this.d=this.caching?zk():null,this.keyMaker=new El}depend(e,n){if(this.d){this.d(P6(e,n));const r=Oh(n);r!==n&&this.d(P6(e,r)),this.parent&&this.parent.depend(e,n)}}dirty(e,n){this.d&&this.d.dirty(P6(e,n),n==="__exists"?"forget":"setDirty")}}function P6(t,e){return e+"#"+t}function tO(t,e){Ov(t)&&t.group.depend(e,"__exists")}class h$ extends p0{constructor({policies:n,resultCaching:r=!0,seed:i}){super(n,new eO(r));Ae(this,"stump",new p$(this));Ae(this,"storageTrie",new El);i&&this.replace(i)}addLayer(n,r){return this.stump.addLayer(n,r)}removeLayer(){return this}getStorage(){return this.storageTrie.lookupArray(arguments)}}p0.Root=h$;class Cl extends p0{constructor(n,r,i,s){super(r.policies,s);Ae(this,"id");Ae(this,"parent");Ae(this,"replay");Ae(this,"group");this.id=n,this.parent=r,this.replay=i,this.group=s,i(this)}addLayer(n,r){return new Cl(n,this,r,this.group)}removeLayer(n){const r=this.parent.removeLayer(n);return n===this.id?(this.group.caching&&Object.keys(this.data).forEach(i=>{const s=this.data[i],l=r.lookup(i);l?s?s!==l&&Object.keys(s).forEach(u=>{Yn(s[u],l[u])||this.group.dirty(i,u)}):(this.group.dirty(i,"__exists"),Object.keys(l).forEach(u=>{this.group.dirty(i,u)})):this.delete(i)}),r):r===this.parent?this:r.addLayer(this.id,this.replay)}toObject(){return{...this.parent.toObject(),...this.data}}findChildRefIds(n){const r=this.parent.findChildRefIds(n);return sa.call(this.data,n)?{...r,...super.findChildRefIds(n)}:r}getStorage(...n){let r=this.parent;for(;r.parent;)r=r.parent;return r.getStorage(...n)}}class p$ extends Cl{constructor(e){super("EntityStore.Stump",e,()=>{},new eO(e.group.caching,e.group))}removeLayer(){return this}merge(e,n){return this.parent.merge(e,n)}}function m$(t,e,n){const r=t[n],i=e[n];return Yn(r,i)?r:i}function Ov(t){return!!(t&&t.supportsResultCaching)}const nO=new u0;function v$(t){var r,i;const e=(r=t.directives)==null?void 0:r.find(({name:s})=>s.value==="unmask");if(!e)return"mask";const n=(i=e.arguments)==null?void 0:i.find(({name:s})=>s.value==="mode");return n&&"value"in n.value&&n.value.value==="migrate"?"migrate":"unmask"}function rO(t,e,n){return nO.withValue(!0,()=>Nv(t,e,n,!1))}function g$(t,e){if(e.has(t))return e.get(t);const n=Array.isArray(t)?[]:{};return e.set(t,n),n}function Nv(t,e,n,r,i){const{knownChanged:s}=n,l=g$(t,n.mutableTargets);if(Array.isArray(t)){for(const[u,d]of Array.from(t.entries())){if(d===null){l[u]=null;continue}const h=Nv(d,e,n,r);s.has(h)&&s.add(l),l[u]=h}return s.has(l)?l:t}for(const u of e.selections){let d;if(r&&s.add(l),u.kind===ur.FIELD){const h=Rh(u),m=u.selectionSet;if(d=l[h]||t[h],d===void 0)continue;if(m&&d!==null){const g=Nv(t[h],m,n,r);s.has(g)&&(d=g)}l[h]=d}if(u.kind===ur.INLINE_FRAGMENT&&(!u.typeCondition||n.cache.fragmentMatches(u,t.__typename))&&(d=Nv(t,u.selectionSet,n,r)),u.kind===ur.FRAGMENT_SPREAD){const h=u.name.value,m=n.fragmentMap[h]||(n.fragmentMap[h]=n.cache.lookupFragment(h));wn(m,39,h);const g=v$(u);g!=="mask"&&(d=Nv(t,m.selectionSet,n,g==="migrate"))}s.has(d)&&s.add(l)}return"__typename"in t&&!("__typename"in l)&&(l.__typename=t.__typename),Object.keys(l).length!==Object.keys(t).length&&s.add(l),s.has(l)?l:t}function y$(t,e,n,r){const i=e.definitions.filter(l=>l.kind===ur.FRAGMENT_DEFINITION);typeof r>"u"&&(wn(i.length===1,41,i.length),r=i[0].name.value);const s=i.find(l=>l.name.value===r);return wn(!!s,42,r),t==null||Yn(t,{})?t:rO(t,s.selectionSet,{operationName:s.name.value,fragmentMap:Cv(_v(e)),cache:n,mutableTargets:new WeakMap,knownChanged:new WeakSet})}function b$(t,e,n){var i;const r=uu(e);return wn(r,43),t==null?t:rO(t,r.selectionSet,{operationType:r.operation,operationName:(i=r.name)==null?void 0:i.value,fragmentMap:Cv(_v(e)),cache:n,mutableTargets:new WeakMap,knownChanged:new WeakSet})}const iO={};function I6(t){const e=JSON.stringify(t);return iO[e]||(iO[e]={})}function aO(t){const e=I6(t);return e.keyFieldsFn||(e.keyFieldsFn=(n,r)=>{const i=(l,u)=>r.readField(u,l),s=r.keyObject=F6(t,l=>{let u=Mh(r.storeObject,l,i);return u===void 0&&n!==r.storeObject&&sa.call(n,l[0])&&(u=Mh(n,l,lO)),wn(u!==void 0,107,l.join("."),n),u});return`${r.typename}:${JSON.stringify(s)}`})}function oO(t){const e=I6(t);return e.keyArgsFn||(e.keyArgsFn=(n,{field:r,variables:i,fieldName:s})=>{const l=F6(t,d=>{const h=d[0],m=h.charAt(0);if(m==="@"){if(r&&E6(r.directives)){const g=h.slice(1),y=r.directives.find(C=>C.name.value===g),b=y&&p6(y,i);return b&&Mh(b,d.slice(1))}return}if(m==="$"){const g=h.slice(1);if(i&&sa.call(i,g)){const y=d.slice(0);return y[0]=g,Mh(i,y)}return}if(n)return Mh(n,d)}),u=JSON.stringify(l);return(n||u!=="{}")&&(s+=":"+u),s})}function F6(t,e){const n=new xh;return sO(t).reduce((r,i)=>{let s=e(i);if(s!==void 0){for(let l=i.length-1;l>=0;--l)s={[i[l]]:s};r=n.merge(r,s)}return r},{})}function sO(t){const e=I6(t);if(!e.paths){const n=e.paths=[],r=[];t.forEach((i,s)=>{Ui(i)?(sO(i).forEach(l=>n.push(r.concat(l))),r.length=0):(r.push(i),Ui(t[s+1])||(n.push(r.slice(0)),r.length=0))})}return e.paths}function lO(t,e){return t[e]}function Mh(t,e,n){return n=n||lO,uO(e.reduce(function r(i,s){return Ui(i)?i.map(l=>r(l,s)):i&&n(i,s)},t))}function uO(t){return Ga(t)?Ui(t)?t.map(uO):F6(Object.keys(t).sort(),e=>Mh(t,e)):t}const cO=new u0,fO=new WeakMap;function Mv(t){let e=fO.get(t);return e||fO.set(t,e={vars:new Set,dep:zk()}),e}function dO(t){Mv(t).vars.forEach(e=>e.forgetCache(t))}function S$(t){Mv(t).vars.forEach(e=>e.attachCache(t))}function E$(t){const e=new Set,n=new Set,r=function(s){if(arguments.length>0){if(t!==s){t=s,e.forEach(u=>{Mv(u).dep.dirty(r),C$(u)});const l=Array.from(n);n.clear(),l.forEach(u=>u(t))}}else{const l=cO.getValue();l&&(i(l),Mv(l).dep(r))}return t};r.onNextChange=s=>(n.add(s),()=>{n.delete(s)});const i=r.attachCache=s=>(e.add(s),Mv(s).vars.add(r),r);return r.forgetCache=s=>e.delete(s),r}function C$(t){t.broadcastWatches&&t.broadcastWatches()}function j6(t){return t.args!==void 0?t.args:t.field?p6(t.field,t.variables):null}const _$=()=>{},hO=(t,e)=>e.fieldName,pO=(t,e,{mergeObjects:n})=>n(t,e),mO=(t,e)=>e,x$=(t,e,{streamFieldInfo:n,existingData:r})=>{if(!t&&!r)return e;const i=[],s=t??r,l=n!=null&&n.isLastChunk?e.length:Math.max(s.length,e.length);for(let u=0;u<l;u++)i[u]=e[u]===void 0?s[u]:e[u];return i};class w${constructor(e){Ae(this,"config");Ae(this,"typePolicies",{});Ae(this,"toBeAdded",{});Ae(this,"supertypeMap",new Map);Ae(this,"fuzzySubtypes",new Map);Ae(this,"cache");Ae(this,"rootIdsByTypename",{});Ae(this,"rootTypenamesById",{});Ae(this,"usingPossibleTypes",!1);this.config=e,this.config={dataIdFromObject:Qk,...e},this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}identify(e,n){var m;const r=this,i=n&&(n.typename||((m=n.storeObject)==null?void 0:m.__typename))||e.__typename;if(i===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];const s=n&&n.storeObject||e,l={...n,typename:i,storeObject:s,readField:n&&n.readField||((...g)=>{const y=V6(g,s);return r.readField(y,{store:r.cache.data,variables:y.variables})})};let u;const d=i&&this.getTypePolicy(i);let h=d&&d.keyFn||this.config.dataIdFromObject;return nO.withValue(!0,()=>{for(;h;){const g=h({...e,...s},l);if(Ui(g))h=aO(g);else{u=g;break}}}),u=u?String(u):void 0,l.keyObject?[u,l.keyObject]:[u]}addTypePolicies(e){Object.keys(e).forEach(n=>{const{queryType:r,mutationType:i,subscriptionType:s,...l}=e[n];r&&this.setRootTypename("Query",n),i&&this.setRootTypename("Mutation",n),s&&this.setRootTypename("Subscription",n),sa.call(this.toBeAdded,n)?this.toBeAdded[n].push(l):this.toBeAdded[n]=[l]})}updateTypePolicy(e,n,r){const i=this.getTypePolicy(e),{keyFields:s,fields:l}=n;function u(d,h){d.merge=typeof h=="function"?h:h===!0?pO:h===!1?mO:d.merge}u(i,n.merge),i.keyFn=s===!1?_$:Ui(s)?aO(s):typeof s=="function"?s:i.keyFn,l&&Object.keys(l).forEach(d=>{let h=r[d];(!h||(h==null?void 0:h.typename)!==e)&&(h=r[d]={typename:e});const m=l[d];if(typeof m=="function")h.read=m;else{const{keyArgs:g,read:y,merge:b}=m;h.keyFn=g===!1?hO:Ui(g)?oO(g):typeof g=="function"?g:h.keyFn,typeof y=="function"&&(h.read=y),u(h,b)}h.read&&h.merge&&(h.keyFn=h.keyFn||hO)})}setRootTypename(e,n=e){const r="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[r];n!==i&&(wn(!i||i===e,108,e),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[n]=r,this.rootTypenamesById[r]=n)}addPossibleTypes(e){this.usingPossibleTypes=!0,Object.keys(e).forEach(n=>{this.getSupertypeSet(n,!0),e[n].forEach(r=>{this.getSupertypeSet(r,!0).add(n);const i=r.match(Zk);(!i||i[0]!==r)&&this.fuzzySubtypes.set(r,new RegExp(r))})})}getTypePolicy(e){if(!sa.call(this.typePolicies,e)){const r=this.typePolicies[e]={};r.fields={};let i=this.supertypeMap.get(e);!i&&this.fuzzySubtypes.size&&(i=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach((s,l)=>{if(s.test(e)){const u=this.supertypeMap.get(l);u&&u.forEach(d=>i.add(d))}})),i&&i.size&&i.forEach(s=>{const{fields:l,...u}=this.getTypePolicy(s);Object.assign(r,u),Object.assign(r.fields,l)})}const n=this.toBeAdded[e];return n&&n.length&&n.splice(0).forEach(r=>{this.updateTypePolicy(e,r,this.typePolicies[e].fields)}),this.typePolicies[e]}getFieldPolicy(e,n){if(e)return this.getTypePolicy(e).fields[n]}getSupertypeSet(e,n){let r=this.supertypeMap.get(e);return!r&&n&&this.supertypeMap.set(e,r=new Set),r}fragmentMatches(e,n,r,i){if(!e.typeCondition)return!0;if(!n)return!1;const s=e.typeCondition.name.value;if(n===s)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(s)){const l=this.getSupertypeSet(n,!0),u=[l],d=m=>{const g=this.getSupertypeSet(m,!1);g&&g.size&&u.indexOf(g)<0&&u.push(g)};let h=!!(r&&this.fuzzySubtypes.size);for(let m=0;m<u.length;++m){const g=u[m];if(g.has(s))return l.has(s)||l.add(s),!0;g.forEach(d),h&&m===u.length-1&&D6(e.selectionSet,r,i)&&(h=!1,this.fuzzySubtypes.forEach((y,b)=>{const C=n.match(y);C&&C[0]===n&&d(b)}))}}return!1}hasKeyArgs(e,n){const r=this.getFieldPolicy(e,n);return!!(r&&r.keyFn)}getStoreFieldName(e){const{typename:n,fieldName:r}=e,i=this.getFieldPolicy(n,r);let s,l=i&&i.keyFn;if(l&&n){const u={typename:n,fieldName:r,field:e.field||null,variables:e.variables},d=j6(e);for(;l;){const h=l(d,u);if(Ui(h))l=oO(h);else{s=h||r;break}}}return s===void 0&&(s=e.field?zq(e.field,e.variables):Ek(r,j6(e))),s===!1?r:r===Oh(s)?s:r+":"+s}readField(e,n){const r=e.from;if(!r||!(e.field||e.fieldName))return;if(e.typename===void 0){const m=n.store.getFieldValue(r,"__typename");m&&(e.typename=m)}const s=this.getStoreFieldName(e),l=Oh(s),u=n.store.getFieldValue(r,s),d=this.getFieldPolicy(e.typename,l),h=d&&d.read;if(h){const m=vO(this,r,e,n,n.store.getStorage(ti(r)?r.__ref:r,s));return cO.withValue(this.cache,h,[u,m])}return u}getReadFunction(e,n){const r=this.getFieldPolicy(e,n);return r&&r.read}getMergeFunction(e,n,r){let i=this.getFieldPolicy(e,n),s=i&&i.merge;return!s&&r&&(i=this.getTypePolicy(r),s=i&&i.merge),s}runMergeFunction(e,n,{field:r,typename:i,merge:s,path:l},u,d){var y,b,C;const h=e;if(s===pO)return gO(u.store)(e,n);if(s===mO)return n;u.overwrite&&(e=void 0);const m=(C=(b=(y=u.extensions)==null?void 0:y[ic])==null?void 0:b.deref())==null?void 0:C.peekArray(l);if(m){const{current:w,previous:_}=m;if(_&&Yn(_.incoming,n)&&Yn(_.streamFieldInfo,w))return _.result}const g=s(e,n,T$(this,void 0,{typename:i,fieldName:r.name.value,field:r,variables:u.variables,path:l},u,d||{},h));return m&&(m.previous={incoming:n,streamFieldInfo:m.current,result:g}),g}}function vO(t,e,n,r,i){const s=t.getStoreFieldName(n),l=Oh(s),u=n.variables||r.variables,{toReference:d,canRead:h}=r.store;return{args:j6(n),field:n.field||null,fieldName:l,storeFieldName:s,variables:u,isReference:ti,toReference:d,storage:i,cache:t.cache,canRead:h,readField(...m){return t.readField(V6(m,e,u),r)},mergeObjects:gO(r.store)}}function T$(t,e,n,r,i,s){var d;const l={...vO(t,e,n,r,i),extensions:r.extensions,existingData:s},u=r.extensions;if(u&&ic in u){const{[ic]:h,...m}=u,g=(d=h==null?void 0:h.deref())==null?void 0:d.peekArray(n.path);g&&(l.streamFieldInfo=g.current),l.extensions=Object.keys(m).length===0?void 0:m}return l}function V6(t,e,n){const{0:r,1:i,length:s}=t;let l;return typeof r=="string"?l={fieldName:r,from:s>1?i:e}:(l={...r},sa.call(l,"from")||(l.from=e)),l.variables===void 0&&(l.variables=n),l}function gO(t){return function(n,r){if(Ui(n)||Ui(r))throw ds(111);if(Ga(n)&&Ga(r)){const i=t.getFieldValue(n,"__typename"),s=t.getFieldValue(r,"__typename");if(i&&s&&i!==s)return r;if(ti(n)&&Nh(r))return t.merge(n.__ref,r),n;if(Nh(n)&&ti(r))return t.merge(n,r.__ref),r;if(Nh(n)&&Nh(r))return{...n,...r}}return r}}function yO(t){return[t.selectionSet,t.objectOrReference,t.context]}class A${constructor(e){Ae(this,"executeSelectionSet");Ae(this,"executeSubSelectedArray");Ae(this,"config");Ae(this,"knownResults",new WeakMap);this.config=e,this.executeSelectionSet=kv(n=>{const r=yO(n),i=this.executeSelectionSet.peek(...r);return i||(tO(n.context.store,n.enclosingRef.__ref),this.execSelectionSetImpl(n))},{max:lu["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:yO,makeCacheKey(n,r,i){if(Ov(i.store))return i.store.makeCacheKey(n,ti(r)?r.__ref:r,i.varString)}}),this.executeSubSelectedArray=kv(n=>(tO(n.context.store,n.enclosingRef.__ref),this.execSubSelectedArrayImpl(n)),{max:lu["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey({field:n,array:r,context:i}){if(Ov(i.store))return i.store.makeCacheKey(n,r,i.varString)}})}diffQueryAgainstStore({store:e,query:n,rootId:r="ROOT_QUERY",variables:i,returnPartialData:s=!0}){const l=this.config.cache.policies;i={...b6(Rq(n)),...i};const u=Ah(r),d=this.executeSelectionSet({selectionSet:S6(n).selectionSet,objectOrReference:u,enclosingRef:u,context:{store:e,query:n,policies:l,variables:i,varString:cu(i),...Jk(n,this.config.fragments)}});let h;d.missing&&(h=new M6(R$(d.missing),d.missing,n,i));const m=!h,{result:g}=d;return{result:m?g:s?Object.keys(g).length===0?null:g:null,complete:m,missing:h}}isFresh(e,n,r,i){if(Ov(i.store)&&this.knownResults.get(e)===r){const s=this.executeSelectionSet.peek(r,n,i);if(s&&e===s.result)return!0}return!1}execSelectionSetImpl({selectionSet:e,objectOrReference:n,enclosingRef:r,context:i}){if(ti(n)&&!i.policies.rootTypenamesById[n.__ref]&&!i.store.has(n.__ref))return{result:{},missing:`Dangling reference to missing ${n.__ref} object`};const{variables:s,policies:l,store:u}=i,d=u.getFieldValue(n,"__typename"),h=[];let m;const g=new xh;typeof d=="string"&&!l.rootIdsByTypename[d]&&h.push({__typename:d});function y(R,k){return R.missing&&(m=g.merge(m,{[k]:R.missing})),R.result}const b=new Set(e.selections);b.forEach(R=>{if(s0(R,s))if(Tv(R)){let k=l.readField({fieldName:R.name.value,field:R,variables:i.variables,from:n},i);const L=Rh(R);k===void 0?$k.added(R)||(m=g.merge(m,{[L]:`Can't find field '${R.name.value}' on ${ti(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)}`})):Ui(k)?k.length>0&&(k=y(this.executeSubSelectedArray({field:R,array:k,enclosingRef:r,context:i}),L)):R.selectionSet&&k!=null&&(k=y(this.executeSelectionSet({selectionSet:R.selectionSet,objectOrReference:k,enclosingRef:ti(k)?k:r,context:i}),L)),k!==void 0&&h.push({[L]:k})}else{const k=o0(R,i.lookupFragment);if(!k&&R.kind===ur.FRAGMENT_SPREAD)throw ds(112,R.name.value);k&&l.fragmentMatches(k,d)&&k.selectionSet.selections.forEach(b.add,b)}});const w={result:Lq(h),missing:m},_=w;return _.result&&this.knownResults.set(_.result,e),_}execSubSelectedArrayImpl({field:e,array:n,enclosingRef:r,context:i}){let s,l=new xh;function u(d,h){return d.missing&&(s=l.merge(s,{[h]:d.missing})),d.result}return e.selectionSet&&(n=n.filter(d=>d===void 0||i.store.canRead(d))),n=n.map((d,h)=>d===null?null:Ui(d)?u(this.executeSubSelectedArray({field:e,array:d,enclosingRef:r,context:i}),h):e.selectionSet?u(this.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:d,enclosingRef:ti(d)?d:r,context:i}),h):d),{result:n,missing:s}}}function R$(t){try{JSON.stringify(t,(e,n)=>{if(typeof n=="string")throw n;return n})}catch(e){return e}}function U6(t,e,n){const r=`${e}${n}`;let i=t.flavors.get(r);return i||t.flavors.set(r,i=t.clientOnly===e&&t.deferred===n?t:{...t,clientOnly:e,deferred:n}),i}class k${constructor(e,n,r){Ae(this,"cache");Ae(this,"reader");Ae(this,"fragments");this.cache=e,this.reader=n,this.fragments=r}writeToStore(e,{query:n,result:r,dataId:i,variables:s,overwrite:l,extensions:u}){const d=uu(n),h=d$();s={...b6(d),...s};const m={store:e,written:{},merge(y,b){return h.merge(y,b)},variables:s,varString:cu(s),...Jk(n,this.fragments),overwrite:!!l,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map,extensions:u},g=this.processSelectionSet({result:r||{},dataId:i,selectionSet:d.selectionSet,mergeTree:{map:new Map},context:m,path:[]});if(!ti(g))throw ds(114,r);return m.incomingById.forEach(({storeObject:y,mergeTree:b,fieldNodeSet:C},w)=>{const _=Ah(w);if(b&&b.map.size){const R=this.applyMerges(b,_,y,m);if(ti(R))return;y=R}e.merge(w,y)}),e.retain(g.__ref),g}processSelectionSet({dataId:e,result:n,selectionSet:r,context:i,mergeTree:s,path:l}){const{policies:u}=this.cache;let d={};const h=e&&u.rootTypenamesById[e]||H6(n,r,i.fragmentMap)||e&&i.store.get(e,"__typename");typeof h=="string"&&(d.__typename=h);const m=(...y)=>{const b=V6(y,d,i.variables);if(ti(b.from)){const C=i.incomingById.get(b.from.__ref);if(C){const w=u.readField({...b,from:C.storeObject},i);if(w!==void 0)return w}}return u.readField(b,i)},g=new Set;this.flattenFields(r,n,i,h).forEach((y,b)=>{var R;const C=Rh(b),w=n[C],_=[...l,b.name.value];if(g.add(b),w!==void 0){const k=u.getStoreFieldName({typename:h,fieldName:b.name.value,field:b,variables:y.variables}),L=SO(s,k);let N=this.processFieldValue(w,b,b.selectionSet?U6(y,!1,!1):y,L,_),A;b.selectionSet&&(ti(N)||Nh(N))&&(A=m("__typename",N));const P=u.getMergeFunction(h,b.name.value,A);P?L.info={field:b,typename:h,merge:P,path:_}:Th(["stream"],b)&&Array.isArray(N)&&((R=y.extensions)!=null&&R[ic])?L.info={field:b,typename:h,merge:x$,path:_}:EO(s,k),d=y.merge(d,{[k]:N})}});try{const[y,b]=u.identify(n,{typename:h,selectionSet:r,fragmentMap:i.fragmentMap,storeObject:d,readField:m});e=e||y,b&&(d=i.merge(d,b))}catch(y){if(!e)throw y}if(typeof e=="string"){const y=Ah(e),b=i.written[e]||(i.written[e]=[]);if(b.indexOf(r)>=0||(b.push(r),this.reader&&this.reader.isFresh(n,y,r,i)))return y;const C=i.incomingById.get(e);return C?(C.storeObject=i.merge(C.storeObject,d),C.mergeTree=z6(C.mergeTree,s),g.forEach(w=>C.fieldNodeSet.add(w))):i.incomingById.set(e,{storeObject:d,mergeTree:m0(s)?void 0:s,fieldNodeSet:g}),y}return d}processFieldValue(e,n,r,i,s){return!n.selectionSet||e===null?e:Ui(e)?e.map((l,u)=>{const d=this.processFieldValue(l,n,r,SO(i,u),[...s,u]);return EO(i,u),d}):this.processSelectionSet({result:e,selectionSet:n.selectionSet,context:r,mergeTree:i,path:s})}flattenFields(e,n,r,i=H6(n,e,r.fragmentMap)){const s=new Map,{policies:l}=this.cache,u=new El(!1);return(function d(h,m){const g=u.lookup(h,m.clientOnly,m.deferred);g.visited||(g.visited=!0,h.selections.forEach(y=>{if(!s0(y,r.variables))return;let{clientOnly:b,deferred:C}=m;if(!(b&&C)&&E6(y.directives)&&y.directives.forEach(w=>{const _=w.name.value;if(_==="client"&&(b=!0),_==="defer"){const R=p6(w,r.variables);(!R||R.if!==!1)&&(C=!0)}}),Tv(y)){const w=s.get(y);w&&(b=b&&w.clientOnly,C=C&&w.deferred),s.set(y,U6(r,b,C))}else{const w=o0(y,r.lookupFragment);if(!w&&y.kind===ur.FRAGMENT_SPREAD)throw ds(116,y.name.value);w&&l.fragmentMatches(w,i,n,r.variables)&&d(w.selectionSet,U6(r,b,C))}}))})(e,r),s}applyMerges(e,n,r,i,s){if(e.map.size&&!ti(r)){const l=!Ui(r)&&(ti(n)||Nh(n))?n:void 0,u=r;l&&!s&&(s=[ti(l)?l.__ref:l]);let d;const h=(m,g)=>Ui(m)?typeof g=="number"?m[g]:void 0:i.store.getFieldValue(m,String(g));e.map.forEach((m,g)=>{const y=h(l,g),b=h(u,g);if(b===void 0)return;s&&s.push(g);const C=this.applyMerges(m,y,b,i,s);C!==b&&(d=d||new Map,d.set(g,C)),s&&wn(s.pop()===g)}),d&&(r=Ui(u)?u.slice(0):{...u},d.forEach((m,g)=>{r[g]=m}))}return e.info?this.cache.policies.runMergeFunction(n,r,e.info,i,s&&i.store.getStorage(...s)):r}}const bO=[];function SO({map:t},e){return t.has(e)||t.set(e,bO.pop()||{map:new Map}),t.get(e)}function z6(t,e){if(t===e||!e||m0(e))return t;if(!t||m0(t))return e;const n=t.info&&e.info?{...t.info,...e.info}:t.info||e.info,r=t.map.size&&e.map.size,i=r?new Map:t.map.size?t.map:e.map,s={info:n,map:i};if(r){const l=new Set(e.map.keys());t.map.forEach((u,d)=>{s.map.set(d,z6(u,e.map.get(d))),l.delete(d)}),l.forEach(u=>{s.map.set(u,z6(e.map.get(u),t.map.get(u)))})}return s}function m0(t){return!t||!(t.info||t.map.size)}function EO({map:t},e){const n=t.get(e);n&&m0(n)&&(bO.push(n),t.delete(e))}function H6(t,e,n){let r;for(const i of e.selections)if(Tv(i)){if(i.name.value==="__typename")return t[Rh(i)]}else r?r.push(i):r=[i];if(typeof t.__typename=="string")return t.__typename;if(r)for(const i of r){const s=H6(t,o0(i,n).selectionSet,n);if(typeof s=="string")return s}}class O$ extends s${constructor(n={}){super();Ae(this,"data");Ae(this,"optimisticData");Ae(this,"config");Ae(this,"watches",new Set);Ae(this,"storeReader");Ae(this,"storeWriter");Ae(this,"addTypenameTransform",new fu($k));Ae(this,"maybeBroadcastWatch");Ae(this,"assumeImmutableResults",!0);Ae(this,"policies");Ae(this,"makeVar",E$);Ae(this,"txCount",0);this.config=f$(n),this.policies=new w$({cache:this,dataIdFromObject:this.config.dataIdFromObject,possibleTypes:this.config.possibleTypes,typePolicies:this.config.typePolicies}),this.init()}init(){const n=this.data=new p0.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=n.stump,this.resetResultCache()}resetResultCache(){const{fragments:n}=this.config;this.addTypenameTransform.resetCache(),n==null||n.resetCaches(),this.storeWriter=new k$(this,this.storeReader=new A$({cache:this,fragments:n}),n),this.maybeBroadcastWatch=kv((r,i)=>this.broadcastWatch(r,i),{max:lu["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:r=>{const i=r.optimistic?this.optimisticData:this.data;if(Ov(i)){const{optimistic:s,id:l,variables:u}=r;return i.makeCacheKey(r.query,r.callback,cu({optimistic:s,id:l,variables:u}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(r=>r.resetCaching())}restore(n){return this.init(),n&&this.data.replace(n),this}extract(n=!1){return(n?this.optimisticData:this.data).extract()}read(n){const{returnPartialData:r=!1}=n;return this.storeReader.diffQueryAgainstStore({...n,store:n.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:r}).result}write(n){try{return++this.txCount,this.storeWriter.writeToStore(this.data,n)}finally{!--this.txCount&&n.broadcast!==!1&&this.broadcastWatches()}}modify(n){if(sa.call(n,"id")&&!n.id)return!1;const r=n.optimistic?this.optimisticData:this.data;try{return++this.txCount,r.modify(n.id||"ROOT_QUERY",n.fields,!1)}finally{!--this.txCount&&n.broadcast!==!1&&this.broadcastWatches()}}diff(n){return this.storeReader.diffQueryAgainstStore({...n,store:n.optimistic?this.optimisticData:this.data,rootId:n.id||"ROOT_QUERY",config:this.config})}watch(n){return this.watches.size||S$(this),this.watches.add(n),n.immediate&&this.maybeBroadcastWatch(n),()=>{this.watches.delete(n)&&!this.watches.size&&dO(this),this.maybeBroadcastWatch.forget(n)}}gc(n){cu.reset(),jf.reset();const r=this.optimisticData.gc();return n&&!this.txCount&&n.resetResultCache&&this.resetResultCache(),r}retain(n,r){return(r?this.optimisticData:this.data).retain(n)}release(n,r){return(r?this.optimisticData:this.data).release(n)}identify(n){if(ti(n))return n.__ref;try{return this.policies.identify(n)[0]}catch{}}evict(n){if(!n.id){if(sa.call(n,"id"))return!1;n={...n,id:"ROOT_QUERY"}}try{return++this.txCount,this.optimisticData.evict(n,this.data)}finally{!--this.txCount&&n.broadcast!==!1&&this.broadcastWatches()}}reset(n){return this.init(),cu.reset(),n&&n.discardWatches?(this.watches.forEach(r=>this.maybeBroadcastWatch.forget(r)),this.watches.clear(),dO(this)):this.broadcastWatches(),Promise.resolve()}removeOptimistic(n){const r=this.optimisticData.removeLayer(n);r!==this.optimisticData&&(this.optimisticData=r,this.broadcastWatches())}batch(n){const{update:r,optimistic:i=!0,removeOptimistic:s,onWatchUpdated:l}=n;let u;const d=m=>{const{data:g,optimisticData:y}=this;++this.txCount,m&&(this.data=this.optimisticData=m);try{return u=r(this)}finally{--this.txCount,this.data=g,this.optimisticData=y}},h=new Set;return l&&!this.txCount&&this.broadcastWatches({...n,onWatchUpdated(m){return h.add(m),!1}}),typeof i=="string"?this.optimisticData=this.optimisticData.addLayer(i,d):i===!1?d(this.data):d(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),l&&h.size?(this.broadcastWatches({...n,onWatchUpdated(m,g){const y=l.call(this,m,g);return y!==!1&&h.delete(m),y}}),h.size&&h.forEach(m=>this.maybeBroadcastWatch.dirty(m))):this.broadcastWatches(n),u}performTransaction(n,r){return this.batch({update:n,optimistic:r||r!==null})}transformDocument(n){return this.addTypenameTransform.transformDocument(this.addFragmentsToDocument(n))}fragmentMatches(n,r){return this.policies.fragmentMatches(n,r)}lookupFragment(n){var r;return((r=this.config.fragments)==null?void 0:r.lookup(n))||null}resolvesClientField(n,r){return!!this.policies.getReadFunction(n,r)}broadcastWatches(n){if(!this.txCount){const r=this.onAfterBroadcast,i=new Set;this.onAfterBroadcast=s=>{i.add(s)};try{this.watches.forEach(s=>this.maybeBroadcastWatch(s,n)),i.forEach(s=>s())}finally{this.onAfterBroadcast=r}}}addFragmentsToDocument(n){const{fragments:r}=this.config;return r?r.transform(n):n}broadcastWatch(n,r){const{lastDiff:i}=n,s=this.diff(n);r&&(n.optimistic&&typeof r.optimistic=="string"&&(s.fromOptimisticTransaction=!0),r.onWatchUpdated&&r.onWatchUpdated.call(this,n,s,i)===!1)||(!i||!Yn(i.result,s.result))&&n.callback(n.lastDiff=s,i)}}function Dv(t,e){return typeof t=="object"&&t!==null&&t[Symbol.for("apollo.error")]===e}function Lv(t){Object.defineProperty(t,Symbol.for("apollo.error"),{value:t.name,enumerable:!1,writable:!1,configurable:!1})}function CO(t){return t.map(e=>e.message||"Error message not found.").join(`
241
241
  `)}const B1=class B1 extends Error{constructor(n){super(B1.formatMessage(n,{defaultFormatMessage:CO}));Ae(this,"errors");this.name="CombinedProtocolErrors",this.errors=n,Lv(this),Object.setPrototypeOf(this,B1.prototype)}static is(n){return Dv(n,"CombinedProtocolErrors")}};Ae(B1,"formatMessage",CO);let v0=B1;function N$(t){return t!==null&&typeof t=="object"&&typeof t.message=="string"&&typeof t.name=="string"&&(typeof t.stack=="string"||typeof t.stack>"u")}class B6 extends Error{static is(e){return Dv(e,"UnconventionalError")}constructor(e){super("An error of unexpected shape occurred.",{cause:e}),this.name="UnconventionalError",Lv(this),Object.setPrototypeOf(this,B6.prototype)}}function _O(t){return t.filter(e=>e).map(e=>e.message||"Error message not found.").join(`
242
- `)}const q1=class q1 extends Error{constructor(n,r=n.errors||[]){super(q1.formatMessage(r,{result:n,defaultFormatMessage:_O}));Ae(this,"errors");Ae(this,"data");Ae(this,"extensions");this.errors=r,this.data=n.data,this.extensions=n.extensions,this.name="CombinedGraphQLErrors",Lv(this),Object.setPrototypeOf(this,q1.prototype)}static is(n){return Dv(n,"CombinedGraphQLErrors")}};Ae(q1,"formatMessage",_O);let du=q1;const M$=new WeakSet;function D$(t){M$.add(t)}class g0 extends Error{constructor(n,r){super(n);Ae(this,"response");Ae(this,"statusCode");Ae(this,"bodyText");this.name="ServerError",this.response=r.response,this.statusCode=r.response.status,this.bodyText=r.bodyText,Lv(this),Object.setPrototypeOf(this,g0.prototype)}static is(n){return Dv(n,"ServerError")}}class y0 extends Error{constructor(n,r){super(n instanceof Error?n.message:"Could not parse server response",{cause:n});Ae(this,"response");Ae(this,"statusCode");Ae(this,"bodyText");this.name="ServerParseError",this.response=r.response,this.statusCode=r.response.status,this.bodyText=r.bodyText,Lv(this),Object.setPrototypeOf(this,y0.prototype)}static is(n){return Dv(n,"ServerParseError")}}const Pv=Symbol();function xO(t){return"extensions"in t?v0.is(t.extensions[Pv]):!1}function q6(t){return N$(t)?t:typeof t=="string"?new Error(t,{cause:t}):new B6(t)}var un;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error",t[t.streaming=9]="streaming"})(un||(un={}));const{assign:wO}=Object,Dh={loading:!0,networkStatus:un.loading,data:void 0,dataState:"empty",partial:!0},$6={loading:!1,networkStatus:un.ready,data:void 0,dataState:"empty",partial:!0};kV=Symbol.observable;class W6{constructor({queryManager:e,options:n,transformedQuery:r=e.transform(n.query)}){Ae(this,"options");Ae(this,"queryName");Ae(this,"variablesUnknown",!1);Ae(this,"_lastWrite");Ae(this,"unsubscribeFromCache");Ae(this,"input");Ae(this,"subject");Ae(this,"isTornDown");Ae(this,"queryManager");Ae(this,"subscriptions",new Set);Ae(this,"waitForNetworkResult");Ae(this,"lastQuery");Ae(this,"linkSubscription");Ae(this,"pollingInfo");Ae(this,"subscribe");Ae(this,"pipe");Ae(this,kV);Ae(this,"@@observable");Ae(this,"stableLastResult");Ae(this,"didWarnCacheOnlyPolling",!1);Ae(this,"dirty",!1);Ae(this,"notifyTimeout");Ae(this,"activeOperations",new Set);Ae(this,"operator",_6(e=>{const{query:n,variables:r,meta:i}=e;if(e.source==="setResult")return{query:n,variables:r,result:e.value,meta:i};if(e.kind==="C"||!Iv(e,this))return;let s;const l=this.subject.getValue();if(e.source==="cache"){if(s=e.value,s.networkStatus===un.ready&&s.partial&&(!this.options.returnPartialData||l.result.networkStatus===un.error)&&this.options.fetchPolicy!=="cache-only")return}else if(e.source==="network")this.waitForNetworkResult&&(this.waitForNetworkResult=!1,this.resubscribeCache()),s=e.kind==="E"?{...Iv(l,e)?l.result:{data:void 0,dataState:"empty",partial:!0},error:e.error,networkStatus:un.error,loading:!1}:e.value,e.kind==="E"&&s.dataState==="streaming"&&(s.dataState="complete"),s.error&&(i.shouldEmit=1);else if(e.source==="newNetworkStatus"){const u=Iv(l,e)?l.result:this.getInitialResult(i.fetchPolicy),{resetError:d}=e.value,h=d?void 0:u.error,m=h?un.error:un.ready;s={...u,error:h,networkStatus:m}}return wn(s),s.error||delete s.error,s.networkStatus=this.calculateNetworkStatus(s.networkStatus),s.loading=d0(s.networkStatus),s=this.maskResult(s),l.result.data!==void 0&&s.data!==l.result.data&&Yn(s.data,l.result.data)&&(s.data=l.result.data),{query:n,variables:r,result:s,meta:i}}));this.queryManager=e,this.waitForNetworkResult=n.fetchPolicy==="network-only",this.isTornDown=!1,this.subscribeToMore=this.subscribeToMore.bind(this),this.maskResult=this.maskResult.bind(this);const{watchQuery:{fetchPolicy:i="cache-first"}={}}=e.defaultOptions,{fetchPolicy:s=i,initialFetchPolicy:l=s==="standby"?i:s}=n;n[x6]&&(wn(s==="standby",82),this.variablesUnknown=!0),this.lastQuery=r,this.options={...n,initialFetchPolicy:l,fetchPolicy:s,variables:this.getVariablesWithDefaults(n.variables)},this.initializeObservablesQueue(),this["@@observable"]=()=>this,Symbol.observable&&(this[Symbol.observable]=()=>this);const u=uu(this.query);this.queryName=u&&u.name&&u.name.value}get query(){return this.lastQuery}get variables(){return this.options.variables}get networkStatus(){return this.subject.getValue().result.networkStatus}get cache(){return this.queryManager.cache}initializeObservablesQueue(){this.subject=new RB({query:this.query,variables:this.variables,result:Dh,meta:{}});const e=this.subject.pipe(Ev({subscribe:()=>{this.subject.observed||(this.reobserve(),setTimeout(()=>this.updatePolling()))},unsubscribe:()=>{this.subject.observed||this.tearDownQuery()}}),_6(({query:n,variables:r,result:i,meta:s},l)=>{const{shouldEmit:u}=s;if(i===Dh&&(l.previous=void 0,l.previousVariables=void 0),this.options.fetchPolicy==="standby"||u===2)return;if(u===1)return m();const{previous:d,previousVariables:h}=l;if(d){const g=this.queryManager.getDocumentInfo(n),y=this.queryManager.dataMasking,b=y?g.nonReactiveQuery:n;if((y||g.hasNonreactiveDirective?xk(b,d,i,r):Yn(d,i))&&Yn(h,r))return}if(u===3&&(!this.options.notifyOnNetworkStatusChange||Yn(d,i)))return;return m();function m(){return l.previous=i,l.previousVariables=r,i}},()=>({})));this.pipe=e.pipe.bind(e),this.subscribe=e.subscribe.bind(e),this.input=new Sh,this.input.complete=()=>{},this.input.pipe(this.operator).subscribe(this.subject)}getCacheDiff({optimistic:e=!0}={}){return this.cache.diff({query:this.query,variables:this.variables,returnPartialData:!0,optimistic:e})}getInitialResult(e){let n=e||this.options.fetchPolicy;this.queryManager.prioritizeCacheValues&&(n==="network-only"||n==="cache-and-network")&&(n="cache-first");const r=()=>{const i=this.getCacheDiff(),s=this.options.returnPartialData||i.complete?i.result??void 0:void 0;return this.maskResult({data:s,dataState:i.complete?"complete":s===void 0?"empty":"partial",loading:!i.complete,networkStatus:i.complete?un.ready:un.loading,partial:!i.complete})};switch(n){case"cache-only":return{...r(),loading:!1,networkStatus:un.ready};case"cache-first":return r();case"cache-and-network":return{...r(),loading:!0,networkStatus:un.loading};case"standby":return $6;default:return Dh}}resubscribeCache(){var d;const{variables:e,fetchPolicy:n}=this.options,r=this.query,i=n==="standby"||n==="no-cache"||this.waitForNetworkResult,s=!Iv({query:r,variables:e},this.unsubscribeFromCache)&&!this.waitForNetworkResult;if((i||s)&&((d=this.unsubscribeFromCache)==null||d.call(this)),i||!s)return;const l={query:r,variables:e,optimistic:!0,watcher:this,callback:h=>{const m=this.queryManager.getDocumentInfo(r);if((m.hasClientExports||m.hasForcedResolvers)&&(l.lastDiff=void 0),l.lastOwnDiff===h)return;const{result:g}=this.subject.getValue();!h.complete&&(g.error||g===Dh||g===$6)||Yn(g.data,h.result)||this.scheduleNotify()}},u=this.cache.watch(l);this.unsubscribeFromCache=Object.assign(()=>{this.unsubscribeFromCache=void 0,u()},{query:r,variables:e})}getCurrentResult(){const{result:e}=this.subject.getValue();let n=e.networkStatus===un.error||this.hasObservers()||this.options.fetchPolicy==="no-cache"?e:this.getInitialResult();return n===Dh&&(n=this.getInitialResult()),Yn(this.stableLastResult,n)||(this.stableLastResult=n),this.stableLastResult}refetch(e){const{fetchPolicy:n}=this.options,r={pollInterval:0};return n==="no-cache"?r.fetchPolicy="no-cache":r.fetchPolicy="network-only",e&&!Yn(this.variables,e)&&(r.variables=this.options.variables=this.getVariablesWithDefaults({...this.variables,...e})),this._lastWrite=void 0,this._reobserve(r,{newNetworkStatus:un.refetch})}fetchMore({query:e,variables:n,context:r,errorPolicy:i,updateQuery:s}){wn(this.options.fetchPolicy!=="cache-only",84,_h(this.query,"(anonymous)"));const l={...Yo(this.options,{errorPolicy:"none"},{query:e,context:r,errorPolicy:i}),variables:e?n:{...this.variables,...n},fetchPolicy:"no-cache",notifyOnNetworkStatusChange:this.options.notifyOnNetworkStatusChange};l.query=this.transformDocument(l.query),this.lastQuery=e?this.transformDocument(this.options.query):l.query;let u=!1;const d=this.options.fetchPolicy!=="no-cache";d||wn(s,85);const{finalize:h,pushNotification:m}=this.pushOperation(un.fetchMore);m({source:"newNetworkStatus",kind:"N",value:{}},{shouldEmit:3});const{promise:g,operator:y}=TO(),{observable:b}=this.queryManager.fetchObservableWithInfo(l,{networkStatus:un.fetchMore,exposeExtensions:!0}),C=b.pipe(y,mk(w=>w.kind==="N"&&w.source==="network")).subscribe({next:w=>{u=!1;const _=w.value,R=_[Tk];if(Gk(w.value.networkStatus)&&h(),d){const k=this.getCacheDiff();this.cache.batch({update:L=>{s?L.updateQuery({query:this.query,variables:this.variables,returnPartialData:!0,optimistic:!1,extensions:R},N=>s(N,{fetchMoreResult:_.data,variables:l.variables})):L.writeQuery({query:l.query,variables:l.variables,data:_.data,extensions:R})},onWatchUpdated:(L,N)=>{if(L.watcher===this&&!Yn(N.result,k.result)){u=!0;const A=this.getCurrentResult();d0(_.networkStatus)&&m({kind:"N",source:"network",value:{...A,networkStatus:_.networkStatus===un.error?un.ready:_.networkStatus,loading:!1,data:N.result,dataState:_.dataState==="streaming"?"streaming":"complete"}})}}})}else{const k=this.getCurrentResult(),L=s(k.data,{fetchMoreResult:_.data,variables:l.variables});m({kind:"N",value:{...k,networkStatus:un.ready,loading:!1,data:L,dataState:k.dataState==="streaming"?"streaming":"complete"},source:"network"})}}});return C6(g.then(w=>Av(this.maskResult(w))).finally(()=>{if(C.unsubscribe(),h(),d&&!u){const w=this.getCurrentResult();w.dataState==="streaming"?m({kind:"N",source:"network",value:{...w,dataState:"complete",networkStatus:un.ready}}):m({kind:"N",source:"newNetworkStatus",value:{}},{shouldEmit:1})}}))}subscribeToMore(e){const n=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:r=>{const{updateQuery:i,onError:s}=e,{error:l}=r;if(l){s?s(l):wn.error(86,l);return}i&&this.updateQuery((u,d)=>i(u,{subscriptionData:r,...d}))}});return this.subscriptions.add(n),()=>{this.subscriptions.delete(n)&&n.unsubscribe()}}applyOptions(e){const n=Yo(this.options,e||{});wO(this.options,n),this.updatePolling()}async setVariables(e){return e=this.getVariablesWithDefaults(e),Yn(this.variables,e)?Av(this.getCurrentResult()):(this.options.variables=e,this.hasObservers()?this._reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},{newNetworkStatus:un.setVariables}):Av(this.getCurrentResult()))}updateQuery(e){const{queryManager:n}=this,{result:r,complete:i}=this.getCacheDiff({optimistic:!1}),s=e(r,{variables:this.variables,complete:!!i,previousData:r});s&&(this.cache.writeQuery({query:this.options.query,data:s,variables:this.variables}),n.broadcastQueries())}startPolling(e){this.options.pollInterval=e,this.updatePolling()}stopPolling(){this.options.pollInterval=0,this.updatePolling()}applyNextFetchPolicy(e,n){if(n.nextFetchPolicy){const{fetchPolicy:r="cache-first",initialFetchPolicy:i=r}=n;r==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy.call(n,r,{reason:e,options:n,observable:this,initialFetchPolicy:i}):e==="variables-changed"?n.fetchPolicy=i:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy}fetch(e,n,r,i){const s=this.options.fetchPolicy;e.context??(e.context={});let l=!1;const u=()=>{l=!0},d=_=>new Qr(R=>{try{return _.subscribe({next(k){l=!0,R.next(k)},error:k=>R.error(k),complete:()=>R.complete()})}finally{l||(b.override=n,this.input.next({kind:"N",source:"newNetworkStatus",value:{resetError:!0},query:g,variables:y,meta:{shouldEmit:3,fetchPolicy:s}}))}});let{observable:h,fromLink:m}=this.queryManager.fetchObservableWithInfo(e,{networkStatus:n,query:r,onCacheHit:u,fetchQueryOperator:d,observableQuery:this});const{query:g,variables:y}=this,b={abort:()=>{w.unsubscribe()},query:g,variables:y};this.activeOperations.add(b);let C=n==un.refetch||n==un.setVariables;h=h.pipe(i,Sv());const w=h.pipe(Ev({next:_=>{_.source==="newNetworkStatus"||_.kind==="N"&&_.value.loading?b.override=n:delete b.override},finalize:()=>this.activeOperations.delete(b)})).subscribe({next:_=>{const R={};C&&_.kind==="N"&&"loading"in _.value&&!_.value.loading&&(C=!1,R.shouldEmit=1),this.input.next({..._,query:g,variables:y,meta:R})}});return{fromLink:m,subscription:w,observable:h}}updatePolling(){if(this.queryManager.ssrMode)return;const{pollingInfo:e,options:{fetchPolicy:n,pollInterval:r}}=this,i=()=>{const{options:d}=this;return!d.pollInterval||!this.hasObservers()||d.fetchPolicy==="cache-only"||d.fetchPolicy==="standby"};if(i()){this.cancelPolling();return}if((e==null?void 0:e.interval)===r)return;const s=e||(this.pollingInfo={});s.interval=r;const l=()=>{var d,h;if(i())return this.cancelPolling();this.pollingInfo&&(!d0(this.networkStatus)&&!((h=(d=this.options).skipPollAttempt)!=null&&h.call(d))?this._reobserve({fetchPolicy:this.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},{newNetworkStatus:un.poll}).then(u,u):u())},u=()=>{const d=this.pollingInfo;d&&(clearTimeout(d.timeout),d.timeout=setTimeout(l,d.interval))};u()}cancelPolling(){this.pollingInfo&&(clearTimeout(this.pollingInfo.timeout),delete this.pollingInfo)}reobserve(e){return this._reobserve(e)}_reobserve(e,n){this.isTornDown=!1;let{newNetworkStatus:r}=n||{};this.queryManager.obsQueries.add(this);const i=r===un.refetch||r===un.poll,s=this.variables,l=this.options.fetchPolicy,u=Yo(this.options,e||{});this.variablesUnknown&&(this.variablesUnknown=u.fetchPolicy==="standby");const d=i?u:wO(this.options,u),h=this.transformDocument(d.query);this.lastQuery=h,e&&"variables"in e&&(d.variables=this.getVariablesWithDefaults(e.variables)),i||(this.updatePolling(),e&&e.variables&&!Yn(e.variables,s)&&d.fetchPolicy!=="standby"&&(d.fetchPolicy===l||typeof d.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",d),r===void 0&&(r=un.setVariables)));const m=this.networkStatus;r||(r=un.loading,m!==un.loading&&(e!=null&&e.variables)&&!Yn(e.variables,s)&&(r=un.setVariables),d.fetchPolicy==="standby"&&(r=un.ready)),d.fetchPolicy==="standby"&&this.cancelPolling(),this.resubscribeCache();const{promise:g,operator:y}=TO(d.fetchPolicy==="standby"?{data:void 0}:void 0),{subscription:b,observable:C,fromLink:w}=this.fetch(d,r,h,y);!i&&(w||!this.linkSubscription)&&(this.linkSubscription&&this.linkSubscription.unsubscribe(),this.linkSubscription=b);const _=Object.assign(C6(g.then(R=>Av(this.maskResult(R))).finally(()=>{!this.hasObservers()&&this.activeOperations.size===0&&this.tearDownQuery()})),{retain:()=>{const R=C.subscribe({}),k=()=>R.unsubscribe();return g.then(k,k),_}});return _}hasObservers(){return this.subject.observed}stop(){this.subject.complete(),this.initializeObservablesQueue(),this.tearDownQuery()}tearDownQuery(){var e;this.isTornDown||(this.resetNotifications(),(e=this.unsubscribeFromCache)==null||e.call(this),this.linkSubscription&&(this.linkSubscription.unsubscribe(),delete this.linkSubscription),this.stopPolling(),this.subscriptions.forEach(n=>n.unsubscribe()),this.subscriptions.clear(),this.queryManager.obsQueries.delete(this),this.isTornDown=!0,this.abortActiveOperations(),this._lastWrite=void 0)}transformDocument(e){return this.queryManager.transform(e)}maskResult(e){const n=this.queryManager.maskOperation({document:this.query,data:e.data,fetchPolicy:this.options.fetchPolicy,cause:this});return n===e.data?e:{...e,data:n}}resetNotifications(){this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0),this.dirty=!1}scheduleNotify(){this.dirty||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(()=>this.notify(!0),0)))}notify(e=!1){if(!e){const r=this.queryManager.getDocumentInfo(this.query);if(r.hasClientExports||r.hasForcedResolvers)return}const{dirty:n}=this;if(this.resetNotifications(),n&&(this.options.fetchPolicy==="cache-only"||this.options.fetchPolicy==="cache-and-network"||!this.activeOperations.size)){const r=this.getCacheDiff();Yn(r.result,this.getCacheDiff({optimistic:!1}).result)?this.reobserveCacheFirst():this.input.next({kind:"N",value:{data:r.result,dataState:r.complete?"complete":r.result?"partial":"empty",networkStatus:un.ready,loading:!1,error:void 0,partial:!r.complete},source:"cache",query:this.query,variables:this.variables,meta:{}})}}pushOperation(e){let n=!1;const{query:r,variables:i}=this,s=()=>{this.activeOperations.delete(l)},l={override:e,abort:()=>{n=!0,s()},query:r,variables:i};return this.activeOperations.add(l),{finalize:s,pushNotification:(u,d)=>{n||this.input.next({...u,query:r,variables:i,meta:{...d}})}}}calculateNetworkStatus(e){if(e===un.streaming)return e;const n=Array.from(this.activeOperations.values()).reverse().find(r=>Iv(r,this)&&r.override!==void 0);return(n==null?void 0:n.override)??e}abortActiveOperations(){this.activeOperations.forEach(e=>e.abort())}reset(){const e=this.options.fetchPolicy==="cache-only";this.setResult(e?$6:Dh,{shouldEmit:e?1:2}),this.abortActiveOperations()}setResult(e,n){this.input.next({source:"setResult",kind:"N",value:e,query:this.query,variables:this.variables,meta:{...n}})}reobserveCacheFirst(){const{fetchPolicy:e,nextFetchPolicy:n}=this.options;e==="cache-and-network"||e==="network-only"?this.reobserve({fetchPolicy:"cache-first",nextFetchPolicy(r,i){return this.nextFetchPolicy=n,typeof this.nextFetchPolicy=="function"?this.nextFetchPolicy(r,i):e}}):this.reobserve()}getVariablesWithDefaults(e){return this.queryManager.getVariables(this.query,e)}}function Iv(t,e){return!!(t&&e&&t.query===e.query&&Yn(t.variables,e.variables))}function TO(t){let e=t,n,r;const i=new Promise((l,u)=>{n=l,r=u}),s=Ev({next(l){if(l.kind==="E")return r(l.error);l.kind==="N"&&l.source!=="newNetworkStatus"&&!l.value.loading&&(e=l.value)},finalize:()=>{if(e)n(e);else{const l="The operation was aborted.",u="AbortError";r(typeof DOMException<"u"?new DOMException(l,u):Object.assign(new Error(l),{name:u}))}}});return{promise:i,operator:s}}const AO={},Lh=new WeakMap;function G6(t,e){const n=t[e];typeof n=="function"&&(t[e]=function(){return Lh.set(t,(Lh.get(t)+1)%1e15),n.apply(this,arguments)})}const RO=new WeakMap;class Y6{constructor(e,n){Ae(this,"lastRequestId",1);Ae(this,"cache");Ae(this,"queryManager");Ae(this,"id");Ae(this,"observableQuery");Ae(this,"incremental");Ae(this,"_lastWrite");const r=this.cache=e.cache,i=(RO.get(e)||0)+1;RO.set(e,i),this.id=i+"",this.observableQuery=n,this.queryManager=e,Lh.has(r)||(Lh.set(r,0),G6(r,"evict"),G6(r,"modify"),G6(r,"reset"))}get lastWrite(){return(this.observableQuery||this)._lastWrite}set lastWrite(e){(this.observableQuery||this)._lastWrite=e}resetLastWrite(){this.lastWrite=void 0}shouldWrite(e,n){var i,s;const{lastWrite:r}=this;return!(r&&r.dmCount===Lh.get(this.cache)&&Yn(n,r.variables)&&Yn(e.data,r.result.data)&&((i=e.extensions)==null?void 0:i[ic])===((s=r.result.extensions)==null?void 0:s[ic]))}get hasNext(){return this.incremental?this.incremental.hasNext:!1}maybeHandleIncrementalResult(e,n,r){const{incrementalHandler:i}=this.queryManager;return i.isIncrementalResult(n)?(this.incremental||(this.incremental=i.startRequest({query:r})),this.incremental.handle(e,n)):n}markQueryResult(e,{document:n,variables:r,errorPolicy:i,cacheWriteBehavior:s}){var m;const l={query:n,variables:r,returnPartialData:!0,optimistic:!0};(m=this.observableQuery)==null||m.resetNotifications();const u=s===0,d=u?void 0:this.cache.diff(l);let h=this.maybeHandleIncrementalResult(d==null?void 0:d.result,e,n);return u||(K6(h,i)?this.cache.batch({onWatchUpdated:(g,y)=>{g.watcher===this.observableQuery&&(g.lastOwnDiff=y)},update:g=>{if(this.shouldWrite(h,r))g.writeQuery({query:n,data:h.data,variables:r,overwrite:s===1,extensions:h.extensions}),this.lastWrite={result:h,variables:r,dmCount:Lh.get(this.cache)};else if(d&&d.complete){h={...h,data:d.result};return}const y=g.diff(l);y.complete&&(h={...h,data:y.result})}}):this.lastWrite=void 0),h}markMutationResult(e,n,r=this.cache){const i=[],s=n.cacheWriteBehavior===0;let l=this.maybeHandleIncrementalResult(s?void 0:r.diff({id:"ROOT_MUTATION",query:this.queryManager.getDocumentInfo(n.document).asQuery,variables:n.variables,optimistic:!1,returnPartialData:!0}).result,e,n.document);if(n.errorPolicy==="ignore"&&(l={...l,errors:[]}),wh(l)&&n.errorPolicy==="none")return Promise.resolve(l);const u=()=>({...l,dataState:this.hasNext?"streaming":"complete"});if(!s&&K6(l,n.errorPolicy)){i.push({result:l.data,dataId:"ROOT_MUTATION",query:n.document,variables:n.variables,extensions:l.extensions});const{updateQueries:h}=n;h&&this.queryManager.getObservableQueries("all").forEach(m=>{const g=m&&m.queryName;if(!g||!Object.hasOwnProperty.call(h,g))return;const y=h[g],{query:b,variables:C}=m,{result:w,complete:_}=m.getCacheDiff({optimistic:!1});if(_&&w){const R=y(w,{mutationResult:u(),queryName:b&&_h(b)||void 0,queryVariables:C});R&&i.push({result:R,dataId:"ROOT_QUERY",query:b,variables:C})}})}let d=n.refetchQueries;if(typeof d=="function"&&(d=d(u())),i.length>0||(d||"").length>0||n.update||n.onQueryUpdated||n.removeOptimistic){const h=[];if(this.queryManager.refetchQueries({updateCache:m=>{s||i.forEach(y=>m.write(y));const{update:g}=n;if(g){if(!s){const y=m.diff({id:"ROOT_MUTATION",query:this.queryManager.getDocumentInfo(n.document).asQuery,variables:n.variables,optimistic:!1,returnPartialData:!0});y.complete&&(l={...l,data:y.result})}this.hasNext||g(m,l,{context:n.context,variables:n.variables})}!s&&!n.keepRootFields&&!this.hasNext&&m.modify({id:"ROOT_MUTATION",fields(y,{fieldName:b,DELETE:C}){return b==="__typename"?y:C}})},include:d,optimistic:!1,removeOptimistic:n.removeOptimistic,onQueryUpdated:n.onQueryUpdated||null}).forEach(m=>h.push(m)),n.awaitRefetchQueries||n.onQueryUpdated)return Promise.all(h).then(()=>l)}return Promise.resolve(l)}markMutationOptimistic(e,n){const r=typeof e=="function"?e(n.variables,{IGNORE:AO}):e;return r===AO?!1:(this.cache.recordOptimisticTransaction(i=>{try{this.markMutationResult({data:r},n,i)}catch(s){wn.error(s)}},this.id),!0)}markSubscriptionResult(e,{document:n,variables:r,errorPolicy:i,cacheWriteBehavior:s}){s!==0&&(K6(e,i)&&this.cache.write({query:n,result:e.data,dataId:"ROOT_SUBSCRIPTION",variables:r,extensions:e.extensions}),this.queryManager.broadcastQueries())}}function K6(t,e="none"){const n=e==="ignore"||e==="all";let r=!wh(t);return!r&&n&&t.data&&(r=!0),r}class L${constructor(e){Ae(this,"defaultOptions");Ae(this,"client");Ae(this,"clientOptions");Ae(this,"assumeImmutableResults");Ae(this,"documentTransform");Ae(this,"ssrMode");Ae(this,"defaultContext");Ae(this,"dataMasking");Ae(this,"incrementalHandler");Ae(this,"localState");Ae(this,"queryDeduplication");Ae(this,"prioritizeCacheValues",!1);Ae(this,"onBroadcast");Ae(this,"mutationStore");Ae(this,"obsQueries",new Set);Ae(this,"fetchCancelFns",new Map);Ae(this,"transformCache",new y6(lu["queryManager.getDocumentInfo"]||2e3));Ae(this,"requestIdCounter",1);Ae(this,"inFlightLinkObservables",new El(!1));Ae(this,"noCacheWarningsByCause",new WeakSet);const n=new fu(i=>this.cache.transformDocument(i),{cache:!1});this.client=e.client,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientOptions=e.clientOptions,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults,this.dataMasking=e.dataMasking,this.localState=e.localState,this.incrementalHandler=e.incrementalHandler;const r=e.documentTransform;this.documentTransform=r?n.concat(r).concat(n):n,this.defaultContext=e.defaultContext||{},(this.onBroadcast=e.onBroadcast)&&(this.mutationStore={})}get link(){return this.client.link}get cache(){return this.client.cache}stop(){this.obsQueries.forEach(e=>e.stop()),this.cancelPendingFetches(ds(89))}cancelPendingFetches(e){this.fetchCancelFns.forEach(n=>n(e)),this.fetchCancelFns.clear()}async mutate({mutation:e,variables:n,optimisticResponse:r,updateQueries:i,refetchQueries:s=[],awaitRefetchQueries:l=!1,update:u,onQueryUpdated:d,fetchPolicy:h,errorPolicy:m,keepRootFields:g,context:y}){const b=new Y6(this);e=this.cache.transformForLink(this.transform(e));const{hasClientExports:C}=this.getDocumentInfo(e);n=this.getVariables(e,n),C&&(n=await this.localState.getExportedVariables({client:this.client,document:e,variables:n,context:y}));const w=this.mutationStore&&(this.mutationStore[b.id]={mutation:e,variables:n,loading:!0,error:null}),_=r&&b.markMutationOptimistic(r,{document:e,variables:n,cacheWriteBehavior:h==="no-cache"?0:2,errorPolicy:m,context:y,updateQueries:i,update:u,keepRootFields:g});return this.broadcastQueries(),new Promise((R,k)=>{const L={};return this.getObservableFromLink(e,{...y,optimisticResponse:_?r:void 0},n,h,{},!1).observable.pipe(kO(),Eh(N=>{const A={...N};return Pf(b.markMutationResult(A,{document:e,variables:n,cacheWriteBehavior:h==="no-cache"?0:2,errorPolicy:m,context:y,update:u,updateQueries:i,awaitRefetchQueries:l,refetchQueries:s,removeOptimistic:_?b.id:void 0,onQueryUpdated:d,keepRootFields:g}))})).pipe(nc(N=>{if(wh(N)&&m==="none")throw new du(Q6(N));return w&&(w.loading=!1,w.error=null),N})).subscribe({next:N=>{if(this.broadcastQueries(),!b.hasNext){const A={data:this.maskOperation({document:e,data:N.data,fetchPolicy:h,cause:L})};wh(N)&&(A.error=new du(N)),Object.keys(N.extensions||{}).length&&(A.extensions=N.extensions),R(A)}},error:N=>{if(w&&(w.loading=!1,w.error=N),_&&this.cache.removeOptimistic(b.id),this.broadcastQueries(),m==="ignore")return R({data:void 0});if(m==="all")return R({data:void 0,error:N});k(N)}})})}fetchQuery(e,n){return rc(e.query,Df.QUERY),(async()=>tq(this.fetchObservableWithInfo(e,{networkStatus:n}).observable.pipe(_6(r=>{switch(r.kind){case"E":throw r.error;case"N":if(r.source!=="newNetworkStatus")return Av(r.value)}})),{defaultValue:{data:void 0}}))()}transform(e){return this.documentTransform.transformDocument(e)}getDocumentInfo(e){const{transformCache:n}=this;if(!n.has(e)){const i=uu(e),s={hasClientExports:Th(["client","export"],e,!0),hasForcedResolvers:Mq(e),hasNonreactiveDirective:Th(["nonreactive"],e),hasIncrementalDirective:Th(["defer"],e),nonReactiveQuery:P$(e),clientQuery:Th(["client"],e)?e:null,serverQuery:Pq([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"},{name:"unmask"}],e),operationType:i==null?void 0:i.operation,defaultVars:b6(i),asQuery:{...e,definitions:e.definitions.map(l=>l.kind==="OperationDefinition"&&l.operation!=="query"?{...l,operation:"query"}:l)}};n.set(e,s)}const r=n.get(e);if(r.violation)throw r.violation;return r}getVariables(e,n){const r=this.getDocumentInfo(e).defaultVars,i=Object.entries(n??{}).map(([s,l])=>[s,l===void 0?r[s]:l]);return{...r,...Object.fromEntries(i)}}watchQuery(e){rc(e.query,Df.QUERY);const n=this.transform(e.query);return e={...e,variables:this.getVariables(n,e.variables)},typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!0),new W6({queryManager:this,options:e,transformedQuery:n})}query(e){const n=this.transform(e.query);return this.fetchQuery({...e,query:n}).then(r=>({...r,data:this.maskOperation({document:n,data:r==null?void 0:r.data,fetchPolicy:e.fetchPolicy})}))}generateRequestId(){return this.requestIdCounter++}clearStore(e={discardWatches:!0}){return this.cancelPendingFetches(ds(91)),this.obsQueries.forEach(n=>{n.reset()}),this.mutationStore&&(this.mutationStore={}),this.cache.reset(e)}getObservableQueries(e="active"){const n=new Set,r=new Map,i=new Map,s=new Set;return Array.isArray(e)&&e.forEach(l=>{if(typeof l=="string")r.set(l,l),i.set(l,!1);else if(Dq(l)){const u=jf(this.transform(l));r.set(u,_h(l)),i.set(u,!1)}else Ga(l)&&l.query&&s.add(l)}),this.obsQueries.forEach(l=>{const u=jf(this.transform(l.options.query));if(e==="all"){n.add(l);return}const{queryName:d,options:{fetchPolicy:h}}=l;e==="active"&&h==="standby"||(e==="active"||d&&i.has(d)||u&&i.has(u))&&(n.add(l),d&&i.set(d,!0),u&&i.set(u,!0))}),s.size&&s.forEach(l=>{const u=new W6({queryManager:this,options:{...Ff(this.defaultOptions.watchQuery,l),fetchPolicy:"network-only"}});n.add(u)}),n}refetchObservableQueries(e=!1){const n=[];return this.getObservableQueries(e?"all":"active").forEach(r=>{const{fetchPolicy:i}=r.options;(e||i!=="standby")&&i!=="cache-only"&&n.push(r.refetch())}),this.broadcastQueries(),Promise.all(n)}startGraphQLSubscription(e){let{query:n,variables:r}=e;const{fetchPolicy:i="cache-first",errorPolicy:s="none",context:l={},extensions:u={}}=e;rc(n,Df.SUBSCRIPTION),n=this.transform(n),r=this.getVariables(n,r);let d;const h=(this.getDocumentInfo(n).hasClientExports?Pf(this.localState.getExportedVariables({client:this.client,document:n,variables:r,context:l})):If(r)).pipe(Eh(m=>{const{observable:g,restart:y}=this.getObservableFromLink(n,l,m,i,u),b=new Y6(this);return d=y,g.pipe(nc(C=>{b.markSubscriptionResult(C,{document:n,variables:m,errorPolicy:s,cacheWriteBehavior:i==="no-cache"?0:2});const w={data:C.data??void 0};return wh(C)?w.error=new du(C):xO(C)&&(w.error=C.extensions[Pv],delete C.extensions[Pv]),C.extensions&&Object.keys(C.extensions).length&&(w.extensions=C.extensions),w.error&&s==="none"&&(w.data=void 0),s==="ignore"&&delete w.error,w}),i0(C=>If(s==="ignore"?{data:void 0}:{data:void 0,error:C})),mk(C=>!!(C.data||C.error)))}));return Object.assign(h,{restart:()=>d==null?void 0:d()})}broadcastQueries(){this.onBroadcast&&this.onBroadcast(),this.obsQueries.forEach(e=>e.notify())}getObservableFromLink(e,n,r,i,s,l=(n==null?void 0:n.queryDeduplication)??this.queryDeduplication){let u={};const{serverQuery:d,clientQuery:h,operationType:m,hasIncrementalDirective:g}=this.getDocumentInfo(e),y=_h(e),b={client:this.client};if(d){const{inFlightLinkObservables:C,link:w}=this;try{let R=function(k){return new Qr(L=>{function N(){return k.subscribe({next:L.next.bind(L),complete:L.complete.bind(L),error:L.error.bind(L)})}let A=N();return u.restart||(u.restart=()=>{A.unsubscribe(),A=N()}),()=>{A.unsubscribe(),u.restart=void 0}})};const _=this.incrementalHandler.prepareRequest({query:d,variables:r,context:{...this.defaultContext,...n,queryDeduplication:l},extensions:s});if(n=_.context,l){const k=jf(d),L=cu(r);u=C.lookup(k,L),u.observable||(u.observable=O6(w,_,b).pipe(R,uq(()=>{C.peek(k,L)===u&&C.remove(k,L)}),m===Df.SUBSCRIPTION?Sv():h6({refCount:!0})))}else u.observable=O6(w,_,b).pipe(R)}catch(_){u.observable=hk(()=>_)}}else u.observable=If({data:{}});if(h){const{operation:C}=uu(e);wn(!g,96,C[0].toUpperCase()+C.slice(1),y??"(anonymous)"),u.observable=u.observable.pipe(Eh(w=>Pf(this.localState.execute({client:this.client,document:h,remoteResult:w,context:n,variables:r,fetchPolicy:i}))))}return{restart:()=>{var C;return(C=u.restart)==null?void 0:C.call(u)},observable:u.observable.pipe(i0(C=>{throw C=q6(C),D$(C),C}))}}getResultsFromLink(e,{queryInfo:n,cacheWriteBehavior:r,observableQuery:i,exposeExtensions:s}){const l=n.lastRequestId=this.generateRequestId(),{errorPolicy:u}=e,d=this.cache.transformForLink(e.query);return this.getObservableFromLink(d,e.context,e.variables,e.fetchPolicy).observable.pipe(nc(h=>{const m=n.markQueryResult(h,{...e,document:d,cacheWriteBehavior:r}),g=wh(m);if(g&&u==="none")throw n.resetLastWrite(),i==null||i.resetNotifications(),new du(Q6(m));const y={data:m.data,...n.hasNext?{loading:!0,networkStatus:un.streaming,dataState:"streaming",partial:!0}:{dataState:m.data?"complete":"empty",loading:!1,networkStatus:un.ready,partial:!m.data}};return s&&"extensions"in m&&(y[Tk]=m.extensions),g&&(u==="none"&&(y.data=void 0,y.dataState="empty"),u!=="ignore"&&(y.error=new du(Q6(m)),y.dataState!=="streaming"&&(y.networkStatus=un.error))),y}),i0(h=>{if(l>=n.lastRequestId&&u==="none")throw n.resetLastWrite(),i==null||i.resetNotifications(),h;const m={data:void 0,dataState:"empty",loading:!1,networkStatus:un.ready,partial:!0};return u!=="ignore"&&(m.error=h,m.networkStatus=un.error),If(m)}))}fetchObservableWithInfo(e,{networkStatus:n=un.loading,query:r=e.query,fetchQueryOperator:i=d=>d,onCacheHit:s=()=>{},observableQuery:l,exposeExtensions:u}){const d=this.getVariables(r,e.variables);let{fetchPolicy:h="cache-first",errorPolicy:m="none",returnPartialData:g=!1,notifyOnNetworkStatusChange:y=!0,context:b={}}=e;this.prioritizeCacheValues&&(h==="network-only"||h==="cache-and-network")&&(h="cache-first");const C=Object.assign({},e,{query:r,variables:d,fetchPolicy:h,errorPolicy:m,returnPartialData:g,notifyOnNetworkStatusChange:y,context:b}),w=new Y6(this,l),_=A=>{C.variables=A;const P=h==="no-cache"?0:n===un.refetch&&C.refetchWritePolicy!=="merge"?1:2,F=this.fetchQueryByPolicy(C,{queryInfo:w,cacheWriteBehavior:P,onCacheHit:s,observableQuery:l,exposeExtensions:u});return F.observable=F.observable.pipe(i),C.fetchPolicy!=="standby"&&(l==null||l.applyNextFetchPolicy("after-fetch",e)),F},R=()=>{this.fetchCancelFns.delete(w.id)};this.fetchCancelFns.set(w.id,A=>{k.next({kind:"E",error:A,source:"network"})});const k=new Sh;let L,N;if(this.getDocumentInfo(C.query).hasClientExports)L=Pf(this.localState.getExportedVariables({client:this.client,document:C.query,variables:C.variables,context:C.context})).pipe(Eh(A=>_(A).observable)),N=!0;else{const A=_(C.variables);N=A.fromLink,L=A.observable}return{observable:new Qr(A=>{A.add(R),L.subscribe(A),k.subscribe(A)}).pipe(Sv()),fromLink:N}}refetchQueries({updateCache:e,include:n,optimistic:r=!1,removeOptimistic:i=r?_R("refetchQueries"):void 0,onQueryUpdated:s}){const l=new Map;n&&this.getObservableQueries(n).forEach(d=>{if(d.options.fetchPolicy==="cache-only"||d.variablesUnknown)return;const h=d.getCurrentResult();l.set(d,{oq:d,lastDiff:{result:h==null?void 0:h.data,complete:!(h!=null&&h.partial)}})});const u=new Map;if(e){const d=new Set;this.cache.batch({update:e,optimistic:r&&i||!1,removeOptimistic:i,onWatchUpdated(h,m,g){const y=h.watcher;if(y instanceof W6&&!d.has(y)){if(d.add(y),s){l.delete(y);let b=s(y,m,g);return b===!0&&(b=y.refetch().retain()),b!==!1&&u.set(y,b),b}s!==null&&y.options.fetchPolicy!=="cache-only"&&l.set(y,{oq:y,lastDiff:g,diff:m})}}})}return l.size&&l.forEach(({oq:d,lastDiff:h,diff:m})=>{let g;s&&(m||(m=d.getCacheDiff()),g=s(d,m,h)),(!s||g===!0)&&(g=d.refetch().retain()),g!==!1&&u.set(d,g)}),i&&this.cache.removeOptimistic(i),u}maskOperation(e){const{document:n,data:r}=e;return this.dataMasking?b$(r,n,this.cache):r}maskFragment(e){const{data:n,fragment:r,fragmentName:i}=e;return this.dataMasking?y$(n,r,this.cache,i):n}fetchQueryByPolicy({query:e,variables:n,fetchPolicy:r,errorPolicy:i,returnPartialData:s,context:l},{cacheWriteBehavior:u,onCacheHit:d,queryInfo:h,observableQuery:m,exposeExtensions:g}){const y=()=>this.cache.diff({query:e,variables:n,returnPartialData:!0,optimistic:!0}),b=(w,_)=>{const R=w.result,k=N=>(!w.complete&&!s&&(N=void 0),{data:N,dataState:w.complete?"complete":N?"partial":"empty",loading:d0(_),networkStatus:_,partial:!w.complete}),L=N=>If({kind:"N",value:k(N),source:"cache"});return(w.complete||s)&&this.getDocumentInfo(e).hasForcedResolvers?(d(),Pf(this.localState.execute({client:this.client,document:e,remoteResult:R?{data:R}:void 0,context:l,variables:n,onlyRunForcedResolvers:!0,returnPartialData:!0,fetchPolicy:r}).then(N=>({kind:"N",value:k(N.data||void 0),source:"cache"})))):i==="none"&&_===un.refetch&&w.missing?L(void 0):L(R||void 0)},C=()=>this.getResultsFromLink({query:e,variables:n,context:l,fetchPolicy:r,errorPolicy:i},{cacheWriteBehavior:u,queryInfo:h,observableQuery:m,exposeExtensions:g}).pipe(kO(),cq(),nc(w=>({...w,source:"network"})));switch(r){default:case"cache-first":{const w=y();return w.complete?{fromLink:!1,observable:b(w,un.ready)}:s?{fromLink:!0,observable:f6(b(w,un.loading),C())}:{fromLink:!0,observable:C()}}case"cache-and-network":{const w=y();return w.complete||s?{fromLink:!0,observable:f6(b(w,un.loading),C())}:{fromLink:!0,observable:C()}}case"cache-only":return{fromLink:!1,observable:f6(b(y(),un.ready))};case"network-only":return{fromLink:!0,observable:C()};case"no-cache":return{fromLink:!0,observable:C()};case"standby":return{fromLink:!1,observable:bv}}}}function kO(){let t=!1;return Ev({next(){t=!0},complete(){wn(t,100)}})}function P$(t){return Sl(t,{FragmentSpread:e=>{var n;if(!((n=e.directives)!=null&&n.some(r=>r.name.value==="unmask")))return{...e,directives:[...e.directives||[],{kind:ur.DIRECTIVE,name:{kind:ur.NAME,value:"nonreactive"}}]}}})}function Q6(t){var i;if(((i=t.extensions)==null?void 0:i[ic])==null)return t;const{extensions:{[ic]:e,...n},...r}=t;return Object.keys(n).length>0&&(r.extensions=n),r}class I${constructor(e){Ae(this,"link");Ae(this,"cache");Ae(this,"disableNetworkFetches");Ae(this,"version");Ae(this,"queryDeduplication");Ae(this,"defaultOptions");Ae(this,"devtoolsConfig");Ae(this,"refetchEventManager");Ae(this,"queryManager");Ae(this,"devToolsHookCb");Ae(this,"resetStoreCallbacks",[]);Ae(this,"clearStoreCallbacks",[]);Ae(this,"query",e=>(this.defaultOptions.query&&(e=Ff(this.defaultOptions.query,e)),this.queryManager.query(e)));Ae(this,"mutate",e=>{const n=Ff(Yo({fetchPolicy:"network-only",errorPolicy:"none"},this.defaultOptions.mutate),e);return rc(n.mutation,Df.MUTATION),this.queryManager.mutate(n)});Ae(this,"reFetchObservableQueries");Ae(this,"maskedFragmentTransform",new fu(jq));var R;const{cache:n,documentTransform:r,ssrMode:i=!1,ssrForceFetchDelay:s=0,queryDeduplication:l=!0,defaultOptions:u,defaultContext:d,assumeImmutableResults:h=n.assumeImmutableResults,localState:m,devtools:g,dataMasking:y,link:b,incrementalHandler:C=new t$,experiments:w=[],refetchEventManager:_}=e;this.link=b,this.cache=n,this.queryDeduplication=l,this.defaultOptions=u||{},this.devtoolsConfig={...g,enabled:(g==null?void 0:g.enabled)??ER},this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.refetchObservableQueries=this.refetchObservableQueries.bind(this),this.version=G2,this.queryManager=new L$({client:this,defaultOptions:this.defaultOptions,defaultContext:d,documentTransform:r,queryDeduplication:l,ssrMode:i,dataMasking:!!y,clientOptions:e,incrementalHandler:C,assumeImmutableResults:h,onBroadcast:this.devtoolsConfig.enabled?()=>{this.devToolsHookCb&&this.devToolsHookCb()}:void 0,localState:m}),this.prioritizeCacheValues=i||s>0,s&&setTimeout(()=>{this.prioritizeCacheValues=!1},s),this.devtoolsConfig.enabled&&this.connectToDevTools(),w.forEach(k=>k.call(this,e)),this.refetchEventManager=_,(R=this.refetchEventManager)==null||R.connect(this)}set prioritizeCacheValues(e){this.queryManager.prioritizeCacheValues=e}get prioritizeCacheValues(){return this.queryManager.prioritizeCacheValues}connectToDevTools(){if(typeof window>"u")return;const e=window,n=Symbol.for("apollo.devtools");(e[n]=e[n]||[]).push(this),e.__APOLLO_CLIENT__=this}get documentTransform(){return this.queryManager.documentTransform}get localState(){return this.queryManager.localState}set localState(e){this.queryManager.localState=e}stop(){var e;this.queryManager.stop(),(e=this.refetchEventManager)==null||e.disconnect(this)}watchQuery(e){const{refetchOn:n}=e;if(this.defaultOptions.watchQuery){const r=this.defaultOptions.watchQuery.refetchOn;let i;n&&typeof n=="object"&&(typeof r=="object"?i={...r,...n}:r!=null&&(i=s=>{const l=n[s.source]??r;return typeof l=="function"?l(s):l})),e=Ff(this.defaultOptions.watchQuery,e),i&&(e.refetchOn=i)}return this.queryManager.watchQuery(e)}subscribe(e){const n={},r=this.queryManager.startGraphQLSubscription(e),i=r.pipe(nc(s=>({...s,data:this.queryManager.maskOperation({document:e.query,data:s.data,fetchPolicy:e.fetchPolicy,cause:n})})));return Object.assign(i,{restart:r.restart})}readQuery(e,n=!1){return this.cache.readQuery({...e,query:this.transform(e.query)},n)}watchFragment(e){const n=this.queryManager.dataMasking;return this.cache.watchFragment({...e,fragment:this.transform(e.fragment,n)})}readFragment(e,n=!1){return this.cache.readFragment({...e,fragment:this.transform(e.fragment)},n)}writeQuery(e){const n=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),n}writeFragment(e){const n=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),n}__actionHookForDevTools(e){this.devToolsHookCb=e}__requestRaw(e){return O6(this.link,e,{client:this})}resetStore(){return Promise.resolve().then(()=>this.queryManager.clearStore({discardWatches:!1})).then(()=>Promise.all(this.resetStoreCallbacks.map(e=>e()))).then(()=>this.refetchObservableQueries())}clearStore(){return Promise.resolve().then(()=>this.queryManager.clearStore({discardWatches:!0})).then(()=>Promise.all(this.clearStoreCallbacks.map(e=>e())))}onResetStore(e){return this.resetStoreCallbacks.push(e),()=>{this.resetStoreCallbacks=this.resetStoreCallbacks.filter(n=>n!==e)}}onClearStore(e){return this.clearStoreCallbacks.push(e),()=>{this.clearStoreCallbacks=this.clearStoreCallbacks.filter(n=>n!==e)}}refetchObservableQueries(e){return this.queryManager.refetchObservableQueries(e)}refetchQueries(e){const n=this.queryManager.refetchQueries(e),r=[],i=[];n.forEach((l,u)=>{r.push(u),i.push(l)});const s=Promise.all(i);return s.queries=r,s.results=i,s.catch(l=>{}),s}getObservableQueries(e="active"){return this.queryManager.getObservableQueries(e)}extract(e){return this.cache.extract(e)}restore(e){return this.cache.restore(e)}setLink(e){this.link=e}get defaultContext(){return this.queryManager.defaultContext}transform(e,n=!1){const r=this.queryManager.transform(e);return n?this.maskedFragmentTransform.transformDocument(r):r}}const{hasOwnProperty:OO}=Object.prototype;function F$(t){return Ga(t)&&"payload"in t}async function*j$(t){var y;const e=new TextDecoder("utf-8"),n=(y=t.headers)==null?void 0:y.get("content-type"),r=n==null?void 0:n.match(/;\s*boundary=(?:'([^']+)'|"([^"]+)"|([^"'].+?))\s*(?:;|$)/i),i=`\r
242
+ `)}const q1=class q1 extends Error{constructor(n,r=n.errors||[]){super(q1.formatMessage(r,{result:n,defaultFormatMessage:_O}));Ae(this,"errors");Ae(this,"data");Ae(this,"extensions");this.errors=r,this.data=n.data,this.extensions=n.extensions,this.name="CombinedGraphQLErrors",Lv(this),Object.setPrototypeOf(this,q1.prototype)}static is(n){return Dv(n,"CombinedGraphQLErrors")}};Ae(q1,"formatMessage",_O);let du=q1;const M$=new WeakSet;function D$(t){M$.add(t)}class g0 extends Error{constructor(n,r){super(n);Ae(this,"response");Ae(this,"statusCode");Ae(this,"bodyText");this.name="ServerError",this.response=r.response,this.statusCode=r.response.status,this.bodyText=r.bodyText,Lv(this),Object.setPrototypeOf(this,g0.prototype)}static is(n){return Dv(n,"ServerError")}}class y0 extends Error{constructor(n,r){super(n instanceof Error?n.message:"Could not parse server response",{cause:n});Ae(this,"response");Ae(this,"statusCode");Ae(this,"bodyText");this.name="ServerParseError",this.response=r.response,this.statusCode=r.response.status,this.bodyText=r.bodyText,Lv(this),Object.setPrototypeOf(this,y0.prototype)}static is(n){return Dv(n,"ServerParseError")}}const Pv=Symbol();function xO(t){return"extensions"in t?v0.is(t.extensions[Pv]):!1}function q6(t){return N$(t)?t:typeof t=="string"?new Error(t,{cause:t}):new B6(t)}var un;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error",t[t.streaming=9]="streaming"})(un||(un={}));const{assign:wO}=Object,Dh={loading:!0,networkStatus:un.loading,data:void 0,dataState:"empty",partial:!0},$6={loading:!1,networkStatus:un.ready,data:void 0,dataState:"empty",partial:!0};kV=Symbol.observable;class W6{constructor({queryManager:e,options:n,transformedQuery:r=e.transform(n.query)}){Ae(this,"options");Ae(this,"queryName");Ae(this,"variablesUnknown",!1);Ae(this,"_lastWrite");Ae(this,"unsubscribeFromCache");Ae(this,"input");Ae(this,"subject");Ae(this,"isTornDown");Ae(this,"queryManager");Ae(this,"subscriptions",new Set);Ae(this,"waitForNetworkResult");Ae(this,"lastQuery");Ae(this,"linkSubscription");Ae(this,"pollingInfo");Ae(this,"subscribe");Ae(this,"pipe");Ae(this,kV);Ae(this,"@@observable");Ae(this,"stableLastResult");Ae(this,"didWarnCacheOnlyPolling",!1);Ae(this,"dirty",!1);Ae(this,"notifyTimeout");Ae(this,"activeOperations",new Set);Ae(this,"operator",_6(e=>{const{query:n,variables:r,meta:i}=e;if(e.source==="setResult")return{query:n,variables:r,result:e.value,meta:i};if(e.kind==="C"||!Iv(e,this))return;let s;const l=this.subject.getValue();if(e.source==="cache"){if(s=e.value,s.networkStatus===un.ready&&s.partial&&(!this.options.returnPartialData||l.result.networkStatus===un.error)&&this.options.fetchPolicy!=="cache-only")return}else if(e.source==="network")this.waitForNetworkResult&&(this.waitForNetworkResult=!1,this.resubscribeCache()),s=e.kind==="E"?{...Iv(l,e)?l.result:{data:void 0,dataState:"empty",partial:!0},error:e.error,networkStatus:un.error,loading:!1}:e.value,e.kind==="E"&&s.dataState==="streaming"&&(s.dataState="complete"),s.error&&(i.shouldEmit=1);else if(e.source==="newNetworkStatus"){const u=Iv(l,e)?l.result:this.getInitialResult(i.fetchPolicy),{resetError:d}=e.value,h=d?void 0:u.error,m=h?un.error:un.ready;s={...u,error:h,networkStatus:m}}return wn(s),s.error||delete s.error,s.networkStatus=this.calculateNetworkStatus(s.networkStatus),s.loading=d0(s.networkStatus),s=this.maskResult(s),l.result.data!==void 0&&s.data!==l.result.data&&Yn(s.data,l.result.data)&&(s.data=l.result.data),{query:n,variables:r,result:s,meta:i}}));this.queryManager=e,this.waitForNetworkResult=n.fetchPolicy==="network-only",this.isTornDown=!1,this.subscribeToMore=this.subscribeToMore.bind(this),this.maskResult=this.maskResult.bind(this);const{watchQuery:{fetchPolicy:i="cache-first"}={}}=e.defaultOptions,{fetchPolicy:s=i,initialFetchPolicy:l=s==="standby"?i:s}=n;n[x6]&&(wn(s==="standby",82),this.variablesUnknown=!0),this.lastQuery=r,this.options={...n,initialFetchPolicy:l,fetchPolicy:s,variables:this.getVariablesWithDefaults(n.variables)},this.initializeObservablesQueue(),this["@@observable"]=()=>this,Symbol.observable&&(this[Symbol.observable]=()=>this);const u=uu(this.query);this.queryName=u&&u.name&&u.name.value}get query(){return this.lastQuery}get variables(){return this.options.variables}get networkStatus(){return this.subject.getValue().result.networkStatus}get cache(){return this.queryManager.cache}initializeObservablesQueue(){this.subject=new RB({query:this.query,variables:this.variables,result:Dh,meta:{}});const e=this.subject.pipe(Ev({subscribe:()=>{this.subject.observed||(this.reobserve(),setTimeout(()=>this.updatePolling()))},unsubscribe:()=>{this.subject.observed||this.tearDownQuery()}}),_6(({query:n,variables:r,result:i,meta:s},l)=>{const{shouldEmit:u}=s;if(i===Dh&&(l.previous=void 0,l.previousVariables=void 0),this.options.fetchPolicy==="standby"||u===2)return;if(u===1)return m();const{previous:d,previousVariables:h}=l;if(d){const g=this.queryManager.getDocumentInfo(n),y=this.queryManager.dataMasking,b=y?g.nonReactiveQuery:n;if((y||g.hasNonreactiveDirective?xk(b,d,i,r):Yn(d,i))&&Yn(h,r))return}if(u===3&&(!this.options.notifyOnNetworkStatusChange||Yn(d,i)))return;return m();function m(){return l.previous=i,l.previousVariables=r,i}},()=>({})));this.pipe=e.pipe.bind(e),this.subscribe=e.subscribe.bind(e),this.input=new Sh,this.input.complete=()=>{},this.input.pipe(this.operator).subscribe(this.subject)}getCacheDiff({optimistic:e=!0}={}){return this.cache.diff({query:this.query,variables:this.variables,returnPartialData:!0,optimistic:e})}getInitialResult(e){let n=e||this.options.fetchPolicy;this.queryManager.prioritizeCacheValues&&(n==="network-only"||n==="cache-and-network")&&(n="cache-first");const r=()=>{const i=this.getCacheDiff(),s=this.options.returnPartialData||i.complete?i.result??void 0:void 0;return this.maskResult({data:s,dataState:i.complete?"complete":s===void 0?"empty":"partial",loading:!i.complete,networkStatus:i.complete?un.ready:un.loading,partial:!i.complete})};switch(n){case"cache-only":return{...r(),loading:!1,networkStatus:un.ready};case"cache-first":return r();case"cache-and-network":return{...r(),loading:!0,networkStatus:un.loading};case"standby":return $6;default:return Dh}}resubscribeCache(){var d;const{variables:e,fetchPolicy:n}=this.options,r=this.query,i=n==="standby"||n==="no-cache"||this.waitForNetworkResult,s=!Iv({query:r,variables:e},this.unsubscribeFromCache)&&!this.waitForNetworkResult;if((i||s)&&((d=this.unsubscribeFromCache)==null||d.call(this)),i||!s)return;const l={query:r,variables:e,optimistic:!0,watcher:this,callback:h=>{const m=this.queryManager.getDocumentInfo(r);if((m.hasClientExports||m.hasForcedResolvers)&&(l.lastDiff=void 0),l.lastOwnDiff===h)return;const{result:g}=this.subject.getValue();!h.complete&&(g.error||g===Dh||g===$6)||Yn(g.data,h.result)||this.scheduleNotify()}},u=this.cache.watch(l);this.unsubscribeFromCache=Object.assign(()=>{this.unsubscribeFromCache=void 0,u()},{query:r,variables:e})}getCurrentResult(){const{result:e}=this.subject.getValue();let n=e.networkStatus===un.error||this.hasObservers()||this.options.fetchPolicy==="no-cache"?e:this.getInitialResult();return n===Dh&&(n=this.getInitialResult()),Yn(this.stableLastResult,n)||(this.stableLastResult=n),this.stableLastResult}refetch(e){const{fetchPolicy:n}=this.options,r={pollInterval:0};return n==="no-cache"?r.fetchPolicy="no-cache":r.fetchPolicy="network-only",e&&!Yn(this.variables,e)&&(r.variables=this.options.variables=this.getVariablesWithDefaults({...this.variables,...e})),this._lastWrite=void 0,this._reobserve(r,{newNetworkStatus:un.refetch})}fetchMore({query:e,variables:n,context:r,errorPolicy:i,updateQuery:s}){wn(this.options.fetchPolicy!=="cache-only",84,_h(this.query,"(anonymous)"));const l={...Yo(this.options,{errorPolicy:"none"},{query:e,context:r,errorPolicy:i}),variables:e?n:{...this.variables,...n},fetchPolicy:"no-cache",notifyOnNetworkStatusChange:this.options.notifyOnNetworkStatusChange};l.query=this.transformDocument(l.query),this.lastQuery=e?this.transformDocument(this.options.query):l.query;let u=!1;const d=this.options.fetchPolicy!=="no-cache";d||wn(s,85);const{finalize:h,pushNotification:m}=this.pushOperation(un.fetchMore);m({source:"newNetworkStatus",kind:"N",value:{}},{shouldEmit:3});const{promise:g,operator:y}=TO(),{observable:b}=this.queryManager.fetchObservableWithInfo(l,{networkStatus:un.fetchMore,exposeExtensions:!0}),C=b.pipe(y,mk(w=>w.kind==="N"&&w.source==="network")).subscribe({next:w=>{u=!1;const _=w.value,R=_[Tk];if(Gk(w.value.networkStatus)&&h(),d){const k=this.getCacheDiff();this.cache.batch({update:L=>{s?L.updateQuery({query:this.query,variables:this.variables,returnPartialData:!0,optimistic:!1,extensions:R},N=>s(N,{fetchMoreResult:_.data,variables:l.variables})):L.writeQuery({query:l.query,variables:l.variables,data:_.data,extensions:R})},onWatchUpdated:(L,N)=>{if(L.watcher===this&&!Yn(N.result,k.result)){u=!0;const A=this.getCurrentResult();d0(_.networkStatus)&&m({kind:"N",source:"network",value:{...A,networkStatus:_.networkStatus===un.error?un.ready:_.networkStatus,loading:!1,data:N.result,dataState:_.dataState==="streaming"?"streaming":"complete"}})}}})}else{const k=this.getCurrentResult(),L=s(k.data,{fetchMoreResult:_.data,variables:l.variables});m({kind:"N",value:{...k,networkStatus:un.ready,loading:!1,data:L,dataState:k.dataState==="streaming"?"streaming":"complete"},source:"network"})}}});return C6(g.then(w=>Av(this.maskResult(w))).finally(()=>{if(C.unsubscribe(),h(),d&&!u){const w=this.getCurrentResult();w.dataState==="streaming"?m({kind:"N",source:"network",value:{...w,dataState:"complete",networkStatus:un.ready}}):m({kind:"N",source:"newNetworkStatus",value:{}},{shouldEmit:1})}}))}subscribeToMore(e){const n=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:r=>{const{updateQuery:i,onError:s}=e,{error:l}=r;if(l){s?s(l):wn.error(86,l);return}i&&this.updateQuery((u,d)=>i(u,{subscriptionData:r,...d}))}});return this.subscriptions.add(n),()=>{this.subscriptions.delete(n)&&n.unsubscribe()}}applyOptions(e){const n=Yo(this.options,e||{});wO(this.options,n),this.updatePolling()}async setVariables(e){return e=this.getVariablesWithDefaults(e),Yn(this.variables,e)?Av(this.getCurrentResult()):(this.options.variables=e,this.hasObservers()?this._reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},{newNetworkStatus:un.setVariables}):Av(this.getCurrentResult()))}updateQuery(e){const{queryManager:n}=this,{result:r,complete:i}=this.getCacheDiff({optimistic:!1}),s=e(r,{variables:this.variables,complete:!!i,previousData:r});s&&(this.cache.writeQuery({query:this.options.query,data:s,variables:this.variables}),n.broadcastQueries())}startPolling(e){this.options.pollInterval=e,this.updatePolling()}stopPolling(){this.options.pollInterval=0,this.updatePolling()}applyNextFetchPolicy(e,n){if(n.nextFetchPolicy){const{fetchPolicy:r="cache-first",initialFetchPolicy:i=r}=n;r==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy.call(n,r,{reason:e,options:n,observable:this,initialFetchPolicy:i}):e==="variables-changed"?n.fetchPolicy=i:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy}fetch(e,n,r,i){const s=this.options.fetchPolicy;e.context??(e.context={});let l=!1;const u=()=>{l=!0},d=_=>new Qr(R=>{try{return _.subscribe({next(k){l=!0,R.next(k)},error:k=>R.error(k),complete:()=>R.complete()})}finally{l||(b.override=n,this.input.next({kind:"N",source:"newNetworkStatus",value:{resetError:!0},query:g,variables:y,meta:{shouldEmit:3,fetchPolicy:s}}))}});let{observable:h,fromLink:m}=this.queryManager.fetchObservableWithInfo(e,{networkStatus:n,query:r,onCacheHit:u,fetchQueryOperator:d,observableQuery:this});const{query:g,variables:y}=this,b={abort:()=>{w.unsubscribe()},query:g,variables:y};this.activeOperations.add(b);let C=n==un.refetch||n==un.setVariables;h=h.pipe(i,Sv());const w=h.pipe(Ev({next:_=>{_.source==="newNetworkStatus"||_.kind==="N"&&_.value.loading?b.override=n:delete b.override},finalize:()=>this.activeOperations.delete(b)})).subscribe({next:_=>{const R={};C&&_.kind==="N"&&"loading"in _.value&&!_.value.loading&&(C=!1,R.shouldEmit=1),this.input.next({..._,query:g,variables:y,meta:R})}});return{fromLink:m,subscription:w,observable:h}}updatePolling(){if(this.queryManager.ssrMode)return;const{pollingInfo:e,options:{fetchPolicy:n,pollInterval:r}}=this,i=()=>{const{options:d}=this;return!d.pollInterval||!this.hasObservers()||d.fetchPolicy==="cache-only"||d.fetchPolicy==="standby"};if(i()){this.cancelPolling();return}if((e==null?void 0:e.interval)===r)return;const s=e||(this.pollingInfo={});s.interval=r;const l=()=>{var d,h;if(i())return this.cancelPolling();this.pollingInfo&&(!d0(this.networkStatus)&&!((h=(d=this.options).skipPollAttempt)!=null&&h.call(d))?this._reobserve({fetchPolicy:this.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},{newNetworkStatus:un.poll}).then(u,u):u())},u=()=>{const d=this.pollingInfo;d&&(clearTimeout(d.timeout),d.timeout=setTimeout(l,d.interval))};u()}cancelPolling(){this.pollingInfo&&(clearTimeout(this.pollingInfo.timeout),delete this.pollingInfo)}reobserve(e){return this._reobserve(e)}_reobserve(e,n){this.isTornDown=!1;let{newNetworkStatus:r}=n||{};this.queryManager.obsQueries.add(this);const i=r===un.refetch||r===un.poll,s=this.variables,l=this.options.fetchPolicy,u=Yo(this.options,e||{});this.variablesUnknown&&(this.variablesUnknown=u.fetchPolicy==="standby");const d=i?u:wO(this.options,u),h=this.transformDocument(d.query);this.lastQuery=h,e&&"variables"in e&&(d.variables=this.getVariablesWithDefaults(e.variables)),i||(this.updatePolling(),e&&e.variables&&!Yn(e.variables,s)&&d.fetchPolicy!=="standby"&&(d.fetchPolicy===l||typeof d.nextFetchPolicy=="function")&&(this.applyNextFetchPolicy("variables-changed",d),r===void 0&&(r=un.setVariables)));const m=this.networkStatus;r||(r=un.loading,m!==un.loading&&(e!=null&&e.variables)&&!Yn(e.variables,s)&&(r=un.setVariables),d.fetchPolicy==="standby"&&(r=un.ready)),d.fetchPolicy==="standby"&&this.cancelPolling(),this.resubscribeCache();const{promise:g,operator:y}=TO(d.fetchPolicy==="standby"?{data:void 0}:void 0),{subscription:b,observable:C,fromLink:w}=this.fetch(d,r,h,y);!i&&(w||!this.linkSubscription)&&(this.linkSubscription&&this.linkSubscription.unsubscribe(),this.linkSubscription=b);const _=Object.assign(C6(g.then(R=>Av(this.maskResult(R))).finally(()=>{!this.hasObservers()&&this.activeOperations.size===0&&this.tearDownQuery()})),{retain:()=>{const R=C.subscribe({}),k=()=>R.unsubscribe();return g.then(k,k),_}});return _}hasObservers(){return this.subject.observed}stop(){this.subject.complete(),this.initializeObservablesQueue(),this.tearDownQuery()}tearDownQuery(){var e;this.isTornDown||(this.resetNotifications(),(e=this.unsubscribeFromCache)==null||e.call(this),this.linkSubscription&&(this.linkSubscription.unsubscribe(),delete this.linkSubscription),this.stopPolling(),this.subscriptions.forEach(n=>n.unsubscribe()),this.subscriptions.clear(),this.queryManager.obsQueries.delete(this),this.isTornDown=!0,this.abortActiveOperations(),this._lastWrite=void 0)}transformDocument(e){return this.queryManager.transform(e)}maskResult(e){const n=this.queryManager.maskOperation({document:this.query,data:e.data,fetchPolicy:this.options.fetchPolicy,cause:this});return n===e.data?e:{...e,data:n}}resetNotifications(){this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0),this.dirty=!1}scheduleNotify(){this.dirty||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(()=>this.notify(!0),0)))}notify(e=!1){if(!e){const r=this.queryManager.getDocumentInfo(this.query);if(r.hasClientExports||r.hasForcedResolvers)return}const{dirty:n}=this;if(this.resetNotifications(),n&&(this.options.fetchPolicy==="cache-only"||this.options.fetchPolicy==="cache-and-network"||!this.activeOperations.size)){const r=this.getCacheDiff();Yn(r.result,this.getCacheDiff({optimistic:!1}).result)?this.reobserveCacheFirst():this.input.next({kind:"N",value:{data:r.result,dataState:r.complete?"complete":r.result?"partial":"empty",networkStatus:un.ready,loading:!1,error:void 0,partial:!r.complete},source:"cache",query:this.query,variables:this.variables,meta:{}})}}pushOperation(e){let n=!1;const{query:r,variables:i}=this,s=()=>{this.activeOperations.delete(l)},l={override:e,abort:()=>{n=!0,s()},query:r,variables:i};return this.activeOperations.add(l),{finalize:s,pushNotification:(u,d)=>{n||this.input.next({...u,query:r,variables:i,meta:{...d}})}}}calculateNetworkStatus(e){if(e===un.streaming)return e;const n=Array.from(this.activeOperations.values()).reverse().find(r=>Iv(r,this)&&r.override!==void 0);return(n==null?void 0:n.override)??e}abortActiveOperations(){this.activeOperations.forEach(e=>e.abort())}reset(){const e=this.options.fetchPolicy==="cache-only";this.setResult(e?$6:Dh,{shouldEmit:e?1:2}),this.abortActiveOperations()}setResult(e,n){this.input.next({source:"setResult",kind:"N",value:e,query:this.query,variables:this.variables,meta:{...n}})}reobserveCacheFirst(){const{fetchPolicy:e,nextFetchPolicy:n}=this.options;e==="cache-and-network"||e==="network-only"?this.reobserve({fetchPolicy:"cache-first",nextFetchPolicy(r,i){return this.nextFetchPolicy=n,typeof this.nextFetchPolicy=="function"?this.nextFetchPolicy(r,i):e}}):this.reobserve()}getVariablesWithDefaults(e){return this.queryManager.getVariables(this.query,e)}}function Iv(t,e){return!!(t&&e&&t.query===e.query&&Yn(t.variables,e.variables))}function TO(t){let e=t,n,r;const i=new Promise((l,u)=>{n=l,r=u}),s=Ev({next(l){if(l.kind==="E")return r(l.error);l.kind==="N"&&l.source!=="newNetworkStatus"&&!l.value.loading&&(e=l.value)},finalize:()=>{if(e)n(e);else{const l="The operation was aborted.",u="AbortError";r(typeof DOMException<"u"?new DOMException(l,u):Object.assign(new Error(l),{name:u}))}}});return{promise:i,operator:s}}const AO={},Lh=new WeakMap;function G6(t,e){const n=t[e];typeof n=="function"&&(t[e]=function(){return Lh.set(t,(Lh.get(t)+1)%1e15),n.apply(this,arguments)})}const RO=new WeakMap;class Y6{constructor(e,n){Ae(this,"lastRequestId",1);Ae(this,"cache");Ae(this,"queryManager");Ae(this,"id");Ae(this,"observableQuery");Ae(this,"incremental");Ae(this,"_lastWrite");const r=this.cache=e.cache,i=(RO.get(e)||0)+1;RO.set(e,i),this.id=i+"",this.observableQuery=n,this.queryManager=e,Lh.has(r)||(Lh.set(r,0),G6(r,"evict"),G6(r,"modify"),G6(r,"reset"))}get lastWrite(){return(this.observableQuery||this)._lastWrite}set lastWrite(e){(this.observableQuery||this)._lastWrite=e}resetLastWrite(){this.lastWrite=void 0}shouldWrite(e,n){var i,s;const{lastWrite:r}=this;return!(r&&r.dmCount===Lh.get(this.cache)&&Yn(n,r.variables)&&Yn(e.data,r.result.data)&&((i=e.extensions)==null?void 0:i[ic])===((s=r.result.extensions)==null?void 0:s[ic]))}get hasNext(){return this.incremental?this.incremental.hasNext:!1}maybeHandleIncrementalResult(e,n,r){const{incrementalHandler:i}=this.queryManager;return i.isIncrementalResult(n)?(this.incremental||(this.incremental=i.startRequest({query:r})),this.incremental.handle(e,n)):n}markQueryResult(e,{document:n,variables:r,errorPolicy:i,cacheWriteBehavior:s}){var m;const l={query:n,variables:r,returnPartialData:!0,optimistic:!0};(m=this.observableQuery)==null||m.resetNotifications();const u=s===0,d=u?void 0:this.cache.diff(l);let h=this.maybeHandleIncrementalResult(d==null?void 0:d.result,e,n);return u||(K6(h,i)?this.cache.batch({onWatchUpdated:(g,y)=>{g.watcher===this.observableQuery&&(g.lastOwnDiff=y)},update:g=>{if(this.shouldWrite(h,r))g.writeQuery({query:n,data:h.data,variables:r,overwrite:s===1,extensions:h.extensions}),this.lastWrite={result:h,variables:r,dmCount:Lh.get(this.cache)};else if(d&&d.complete){h={...h,data:d.result};return}const y=g.diff(l);y.complete&&(h={...h,data:y.result})}}):this.lastWrite=void 0),h}markMutationResult(e,n,r=this.cache){const i=[],s=n.cacheWriteBehavior===0;let l=this.maybeHandleIncrementalResult(s?void 0:r.diff({id:"ROOT_MUTATION",query:this.queryManager.getDocumentInfo(n.document).asQuery,variables:n.variables,optimistic:!1,returnPartialData:!0}).result,e,n.document);if(n.errorPolicy==="ignore"&&(l={...l,errors:[]}),wh(l)&&n.errorPolicy==="none")return Promise.resolve(l);const u=()=>({...l,dataState:this.hasNext?"streaming":"complete"});if(!s&&K6(l,n.errorPolicy)){i.push({result:l.data,dataId:"ROOT_MUTATION",query:n.document,variables:n.variables,extensions:l.extensions});const{updateQueries:h}=n;h&&this.queryManager.getObservableQueries("all").forEach(m=>{const g=m&&m.queryName;if(!g||!Object.hasOwnProperty.call(h,g))return;const y=h[g],{query:b,variables:C}=m,{result:w,complete:_}=m.getCacheDiff({optimistic:!1});if(_&&w){const R=y(w,{mutationResult:u(),queryName:b&&_h(b)||void 0,queryVariables:C});R&&i.push({result:R,dataId:"ROOT_QUERY",query:b,variables:C})}})}let d=n.refetchQueries;if(typeof d=="function"&&(d=d(u())),i.length>0||(d||"").length>0||n.update||n.onQueryUpdated||n.removeOptimistic){const h=[];if(this.queryManager.refetchQueries({updateCache:m=>{s||i.forEach(y=>m.write(y));const{update:g}=n;if(g){if(!s){const y=m.diff({id:"ROOT_MUTATION",query:this.queryManager.getDocumentInfo(n.document).asQuery,variables:n.variables,optimistic:!1,returnPartialData:!0});y.complete&&(l={...l,data:y.result})}this.hasNext||g(m,l,{context:n.context,variables:n.variables})}!s&&!n.keepRootFields&&!this.hasNext&&m.modify({id:"ROOT_MUTATION",fields(y,{fieldName:b,DELETE:C}){return b==="__typename"?y:C}})},include:d,optimistic:!1,removeOptimistic:n.removeOptimistic,onQueryUpdated:n.onQueryUpdated||null}).forEach(m=>h.push(m)),n.awaitRefetchQueries||n.onQueryUpdated)return Promise.all(h).then(()=>l)}return Promise.resolve(l)}markMutationOptimistic(e,n){const r=typeof e=="function"?e(n.variables,{IGNORE:AO}):e;return r===AO?!1:(this.cache.recordOptimisticTransaction(i=>{try{this.markMutationResult({data:r},n,i)}catch(s){wn.error(s)}},this.id),!0)}markSubscriptionResult(e,{document:n,variables:r,errorPolicy:i,cacheWriteBehavior:s}){s!==0&&(K6(e,i)&&this.cache.write({query:n,result:e.data,dataId:"ROOT_SUBSCRIPTION",variables:r,extensions:e.extensions}),this.queryManager.broadcastQueries())}}function K6(t,e="none"){const n=e==="ignore"||e==="all";let r=!wh(t);return!r&&n&&t.data&&(r=!0),r}class L${constructor(e){Ae(this,"defaultOptions");Ae(this,"client");Ae(this,"clientOptions");Ae(this,"assumeImmutableResults");Ae(this,"documentTransform");Ae(this,"ssrMode");Ae(this,"defaultContext");Ae(this,"dataMasking");Ae(this,"incrementalHandler");Ae(this,"localState");Ae(this,"queryDeduplication");Ae(this,"prioritizeCacheValues",!1);Ae(this,"onBroadcast");Ae(this,"mutationStore");Ae(this,"obsQueries",new Set);Ae(this,"fetchCancelFns",new Map);Ae(this,"transformCache",new y6(lu["queryManager.getDocumentInfo"]||2e3));Ae(this,"requestIdCounter",1);Ae(this,"inFlightLinkObservables",new El(!1));Ae(this,"noCacheWarningsByCause",new WeakSet);const n=new fu(i=>this.cache.transformDocument(i),{cache:!1});this.client=e.client,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientOptions=e.clientOptions,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults,this.dataMasking=e.dataMasking,this.localState=e.localState,this.incrementalHandler=e.incrementalHandler;const r=e.documentTransform;this.documentTransform=r?n.concat(r).concat(n):n,this.defaultContext=e.defaultContext||{},(this.onBroadcast=e.onBroadcast)&&(this.mutationStore={})}get link(){return this.client.link}get cache(){return this.client.cache}stop(){this.obsQueries.forEach(e=>e.stop()),this.cancelPendingFetches(ds(89))}cancelPendingFetches(e){this.fetchCancelFns.forEach(n=>n(e)),this.fetchCancelFns.clear()}async mutate({mutation:e,variables:n,optimisticResponse:r,updateQueries:i,refetchQueries:s=[],awaitRefetchQueries:l=!1,update:u,onQueryUpdated:d,fetchPolicy:h,errorPolicy:m,keepRootFields:g,context:y}){const b=new Y6(this);e=this.cache.transformForLink(this.transform(e));const{hasClientExports:C}=this.getDocumentInfo(e);n=this.getVariables(e,n),C&&(n=await this.localState.getExportedVariables({client:this.client,document:e,variables:n,context:y}));const w=this.mutationStore&&(this.mutationStore[b.id]={mutation:e,variables:n,loading:!0,error:null}),_=r&&b.markMutationOptimistic(r,{document:e,variables:n,cacheWriteBehavior:h==="no-cache"?0:2,errorPolicy:m,context:y,updateQueries:i,update:u,keepRootFields:g});return this.broadcastQueries(),new Promise((R,k)=>{const L={};return this.getObservableFromLink(e,{...y,optimisticResponse:_?r:void 0},n,h,{},!1).observable.pipe(kO(),Eh(N=>{const A={...N};return Pf(b.markMutationResult(A,{document:e,variables:n,cacheWriteBehavior:h==="no-cache"?0:2,errorPolicy:m,context:y,update:u,updateQueries:i,awaitRefetchQueries:l,refetchQueries:s,removeOptimistic:_?b.id:void 0,onQueryUpdated:d,keepRootFields:g}))})).pipe(nc(N=>{if(wh(N)&&m==="none")throw new du(Q6(N));return w&&(w.loading=!1,w.error=null),N})).subscribe({next:N=>{if(this.broadcastQueries(),!b.hasNext){const A={data:this.maskOperation({document:e,data:N.data,fetchPolicy:h,cause:L})};wh(N)&&(A.error=new du(N)),Object.keys(N.extensions||{}).length&&(A.extensions=N.extensions),R(A)}},error:N=>{if(w&&(w.loading=!1,w.error=N),_&&this.cache.removeOptimistic(b.id),this.broadcastQueries(),m==="ignore")return R({data:void 0});if(m==="all")return R({data:void 0,error:N});k(N)}})})}fetchQuery(e,n){return rc(e.query,Df.QUERY),(async()=>tq(this.fetchObservableWithInfo(e,{networkStatus:n}).observable.pipe(_6(r=>{switch(r.kind){case"E":throw r.error;case"N":if(r.source!=="newNetworkStatus")return Av(r.value)}})),{defaultValue:{data:void 0}}))()}transform(e){return this.documentTransform.transformDocument(e)}getDocumentInfo(e){const{transformCache:n}=this;if(!n.has(e)){const i=uu(e),s={hasClientExports:Th(["client","export"],e,!0),hasForcedResolvers:Mq(e),hasNonreactiveDirective:Th(["nonreactive"],e),hasIncrementalDirective:Th(["defer"],e),nonReactiveQuery:P$(e),clientQuery:Th(["client"],e)?e:null,serverQuery:Pq([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"},{name:"unmask"}],e),operationType:i==null?void 0:i.operation,defaultVars:b6(i),asQuery:{...e,definitions:e.definitions.map(l=>l.kind==="OperationDefinition"&&l.operation!=="query"?{...l,operation:"query"}:l)}};n.set(e,s)}const r=n.get(e);if(r.violation)throw r.violation;return r}getVariables(e,n){const r=this.getDocumentInfo(e).defaultVars,i=Object.entries(n??{}).map(([s,l])=>[s,l===void 0?r[s]:l]);return{...r,...Object.fromEntries(i)}}watchQuery(e){rc(e.query,Df.QUERY);const n=this.transform(e.query);return e={...e,variables:this.getVariables(n,e.variables)},typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!0),new W6({queryManager:this,options:e,transformedQuery:n})}query(e){const n=this.transform(e.query);return this.fetchQuery({...e,query:n}).then(r=>({...r,data:this.maskOperation({document:n,data:r==null?void 0:r.data,fetchPolicy:e.fetchPolicy})}))}generateRequestId(){return this.requestIdCounter++}clearStore(e={discardWatches:!0}){return this.cancelPendingFetches(ds(91)),this.obsQueries.forEach(n=>{n.reset()}),this.mutationStore&&(this.mutationStore={}),this.cache.reset(e)}getObservableQueries(e="active"){const n=new Set,r=new Map,i=new Map,s=new Set;return Array.isArray(e)&&e.forEach(l=>{if(typeof l=="string")r.set(l,l),i.set(l,!1);else if(Dq(l)){const u=jf(this.transform(l));r.set(u,_h(l)),i.set(u,!1)}else Ga(l)&&l.query&&s.add(l)}),this.obsQueries.forEach(l=>{const u=jf(this.transform(l.options.query));if(e==="all"){n.add(l);return}const{queryName:d,options:{fetchPolicy:h}}=l;e==="active"&&h==="standby"||(e==="active"||d&&i.has(d)||u&&i.has(u))&&(n.add(l),d&&i.set(d,!0),u&&i.set(u,!0))}),s.size&&s.forEach(l=>{const u=new W6({queryManager:this,options:{...Ff(this.defaultOptions.watchQuery,l),fetchPolicy:"network-only"}});n.add(u)}),n}refetchObservableQueries(e=!1){const n=[];return this.getObservableQueries(e?"all":"active").forEach(r=>{const{fetchPolicy:i}=r.options;(e||i!=="standby")&&i!=="cache-only"&&n.push(r.refetch())}),this.broadcastQueries(),Promise.all(n)}startGraphQLSubscription(e){let{query:n,variables:r}=e;const{fetchPolicy:i="cache-first",errorPolicy:s="none",context:l={},extensions:u={}}=e;rc(n,Df.SUBSCRIPTION),n=this.transform(n),r=this.getVariables(n,r);let d;const h=(this.getDocumentInfo(n).hasClientExports?Pf(this.localState.getExportedVariables({client:this.client,document:n,variables:r,context:l})):If(r)).pipe(Eh(m=>{const{observable:g,restart:y}=this.getObservableFromLink(n,l,m,i,u),b=new Y6(this);return d=y,g.pipe(nc(C=>{b.markSubscriptionResult(C,{document:n,variables:m,errorPolicy:s,cacheWriteBehavior:i==="no-cache"?0:2});const w={data:C.data??void 0};return wh(C)?w.error=new du(C):xO(C)&&(w.error=C.extensions[Pv],delete C.extensions[Pv]),C.extensions&&Object.keys(C.extensions).length&&(w.extensions=C.extensions),w.error&&s==="none"&&(w.data=void 0),s==="ignore"&&delete w.error,w}),i0(C=>If(s==="ignore"?{data:void 0}:{data:void 0,error:C})),mk(C=>!!(C.data||C.error)))}));return Object.assign(h,{restart:()=>d==null?void 0:d()})}broadcastQueries(){this.onBroadcast&&this.onBroadcast(),this.obsQueries.forEach(e=>e.notify())}getObservableFromLink(e,n,r,i,s,l=(n==null?void 0:n.queryDeduplication)??this.queryDeduplication){let u={};const{serverQuery:d,clientQuery:h,operationType:m,hasIncrementalDirective:g}=this.getDocumentInfo(e),y=_h(e),b={client:this.client};if(d){const{inFlightLinkObservables:C,link:w}=this;try{let R=function(k){return new Qr(L=>{function N(){return k.subscribe({next:L.next.bind(L),complete:L.complete.bind(L),error:L.error.bind(L)})}let A=N();return u.restart||(u.restart=()=>{A.unsubscribe(),A=N()}),()=>{A.unsubscribe(),u.restart=void 0}})};const _=this.incrementalHandler.prepareRequest({query:d,variables:r,context:{...this.defaultContext,...n,queryDeduplication:l},extensions:s});if(n=_.context,l){const k=jf(d),L=cu(r);u=C.lookup(k,L),u.observable||(u.observable=O6(w,_,b).pipe(R,uq(()=>{C.peek(k,L)===u&&C.remove(k,L)}),m===Df.SUBSCRIPTION?Sv():h6({refCount:!0})))}else u.observable=O6(w,_,b).pipe(R)}catch(_){u.observable=hk(()=>_)}}else u.observable=If({data:{}});if(h){const{operation:C}=uu(e);wn(!g,96,C[0].toUpperCase()+C.slice(1),y??"(anonymous)"),u.observable=u.observable.pipe(Eh(w=>Pf(this.localState.execute({client:this.client,document:h,remoteResult:w,context:n,variables:r,fetchPolicy:i}))))}return{restart:()=>{var C;return(C=u.restart)==null?void 0:C.call(u)},observable:u.observable.pipe(i0(C=>{throw C=q6(C),D$(C),C}))}}getResultsFromLink(e,{queryInfo:n,cacheWriteBehavior:r,observableQuery:i,exposeExtensions:s}){const l=n.lastRequestId=this.generateRequestId(),{errorPolicy:u}=e,d=this.cache.transformForLink(e.query);return this.getObservableFromLink(d,e.context,e.variables,e.fetchPolicy).observable.pipe(nc(h=>{const m=n.markQueryResult(h,{...e,document:d,cacheWriteBehavior:r}),g=wh(m);if(g&&u==="none")throw n.resetLastWrite(),i==null||i.resetNotifications(),new du(Q6(m));const y={data:m.data,...n.hasNext?{loading:!0,networkStatus:un.streaming,dataState:"streaming",partial:!0}:{dataState:m.data?"complete":"empty",loading:!1,networkStatus:un.ready,partial:!m.data}};return s&&"extensions"in m&&(y[Tk]=m.extensions),g&&(u==="none"&&(y.data=void 0,y.dataState="empty"),u!=="ignore"&&(y.error=new du(Q6(m)),y.dataState!=="streaming"&&(y.networkStatus=un.error))),y}),i0(h=>{if(l>=n.lastRequestId&&u==="none")throw n.resetLastWrite(),i==null||i.resetNotifications(),h;const m={data:void 0,dataState:"empty",loading:!1,networkStatus:un.ready,partial:!0};return u!=="ignore"&&(m.error=h,m.networkStatus=un.error),If(m)}))}fetchObservableWithInfo(e,{networkStatus:n=un.loading,query:r=e.query,fetchQueryOperator:i=d=>d,onCacheHit:s=()=>{},observableQuery:l,exposeExtensions:u}){const d=this.getVariables(r,e.variables);let{fetchPolicy:h="cache-first",errorPolicy:m="none",returnPartialData:g=!1,notifyOnNetworkStatusChange:y=!0,context:b={}}=e;this.prioritizeCacheValues&&(h==="network-only"||h==="cache-and-network")&&(h="cache-first");const C=Object.assign({},e,{query:r,variables:d,fetchPolicy:h,errorPolicy:m,returnPartialData:g,notifyOnNetworkStatusChange:y,context:b}),w=new Y6(this,l),_=A=>{C.variables=A;const P=h==="no-cache"?0:n===un.refetch&&C.refetchWritePolicy!=="merge"?1:2,F=this.fetchQueryByPolicy(C,{queryInfo:w,cacheWriteBehavior:P,onCacheHit:s,observableQuery:l,exposeExtensions:u});return F.observable=F.observable.pipe(i),C.fetchPolicy!=="standby"&&(l==null||l.applyNextFetchPolicy("after-fetch",e)),F},R=()=>{this.fetchCancelFns.delete(w.id)};this.fetchCancelFns.set(w.id,A=>{k.next({kind:"E",error:A,source:"network"})});const k=new Sh;let L,N;if(this.getDocumentInfo(C.query).hasClientExports)L=Pf(this.localState.getExportedVariables({client:this.client,document:C.query,variables:C.variables,context:C.context})).pipe(Eh(A=>_(A).observable)),N=!0;else{const A=_(C.variables);N=A.fromLink,L=A.observable}return{observable:new Qr(A=>{A.add(R),L.subscribe(A),k.subscribe(A)}).pipe(Sv()),fromLink:N}}refetchQueries({updateCache:e,include:n,optimistic:r=!1,removeOptimistic:i=r?_R("refetchQueries"):void 0,onQueryUpdated:s}){const l=new Map;n&&this.getObservableQueries(n).forEach(d=>{if(d.options.fetchPolicy==="cache-only"||d.variablesUnknown)return;const h=d.getCurrentResult();l.set(d,{oq:d,lastDiff:{result:h==null?void 0:h.data,complete:!(h!=null&&h.partial)}})});const u=new Map;if(e){const d=new Set;this.cache.batch({update:e,optimistic:r&&i||!1,removeOptimistic:i,onWatchUpdated(h,m,g){const y=h.watcher;if(y instanceof W6&&!d.has(y)){if(d.add(y),s){l.delete(y);let b=s(y,m,g);return b===!0&&(b=y.refetch().retain()),b!==!1&&u.set(y,b),b}s!==null&&y.options.fetchPolicy!=="cache-only"&&l.set(y,{oq:y,lastDiff:g,diff:m})}}})}return l.size&&l.forEach(({oq:d,lastDiff:h,diff:m})=>{let g;s&&(m||(m=d.getCacheDiff()),g=s(d,m,h)),(!s||g===!0)&&(g=d.refetch().retain()),g!==!1&&u.set(d,g)}),i&&this.cache.removeOptimistic(i),u}maskOperation(e){const{document:n,data:r}=e;return this.dataMasking?b$(r,n,this.cache):r}maskFragment(e){const{data:n,fragment:r,fragmentName:i}=e;return this.dataMasking?y$(n,r,this.cache,i):n}fetchQueryByPolicy({query:e,variables:n,fetchPolicy:r,errorPolicy:i,returnPartialData:s,context:l},{cacheWriteBehavior:u,onCacheHit:d,queryInfo:h,observableQuery:m,exposeExtensions:g}){const y=()=>this.cache.diff({query:e,variables:n,returnPartialData:!0,optimistic:!0}),b=(w,_)=>{const R=w.result,k=N=>(!w.complete&&!s&&(N=void 0),{data:N,dataState:w.complete?"complete":N?"partial":"empty",loading:d0(_),networkStatus:_,partial:!w.complete}),L=N=>If({kind:"N",value:k(N),source:"cache"});return(w.complete||s)&&this.getDocumentInfo(e).hasForcedResolvers?(d(),Pf(this.localState.execute({client:this.client,document:e,remoteResult:R?{data:R}:void 0,context:l,variables:n,onlyRunForcedResolvers:!0,returnPartialData:!0,fetchPolicy:r}).then(N=>({kind:"N",value:k(N.data||void 0),source:"cache"})))):i==="none"&&_===un.refetch&&w.missing?L(void 0):L(R||void 0)},C=()=>this.getResultsFromLink({query:e,variables:n,context:l,fetchPolicy:r,errorPolicy:i},{cacheWriteBehavior:u,queryInfo:h,observableQuery:m,exposeExtensions:g}).pipe(kO(),cq(),nc(w=>({...w,source:"network"})));switch(r){default:case"cache-first":{const w=y();return w.complete?{fromLink:!1,observable:b(w,un.ready)}:s?{fromLink:!0,observable:f6(b(w,un.loading),C())}:{fromLink:!0,observable:C()}}case"cache-and-network":{const w=y();return w.complete||s?{fromLink:!0,observable:f6(b(w,un.loading),C())}:{fromLink:!0,observable:C()}}case"cache-only":return{fromLink:!1,observable:f6(b(y(),un.ready))};case"network-only":return{fromLink:!0,observable:C()};case"no-cache":return{fromLink:!0,observable:C()};case"standby":return{fromLink:!1,observable:bv}}}}function kO(){let t=!1;return Ev({next(){t=!0},complete(){wn(t,100)}})}function P$(t){return Sl(t,{FragmentSpread:e=>{var n;if(!((n=e.directives)!=null&&n.some(r=>r.name.value==="unmask")))return{...e,directives:[...e.directives||[],{kind:ur.DIRECTIVE,name:{kind:ur.NAME,value:"nonreactive"}}]}}})}function Q6(t){var i;if(((i=t.extensions)==null?void 0:i[ic])==null)return t;const{extensions:{[ic]:e,...n},...r}=t;return Object.keys(n).length>0&&(r.extensions=n),r}class I${constructor(e){Ae(this,"link");Ae(this,"cache");Ae(this,"disableNetworkFetches");Ae(this,"version");Ae(this,"queryDeduplication");Ae(this,"defaultOptions");Ae(this,"devtoolsConfig");Ae(this,"refetchEventManager");Ae(this,"queryManager");Ae(this,"devToolsHookCb");Ae(this,"resetStoreCallbacks",[]);Ae(this,"clearStoreCallbacks",[]);Ae(this,"query",e=>(this.defaultOptions.query&&(e=Ff(this.defaultOptions.query,e)),this.queryManager.query(e)));Ae(this,"mutate",e=>{const n=Ff(Yo({fetchPolicy:"network-only",errorPolicy:"none"},this.defaultOptions.mutate),e);return rc(n.mutation,Df.MUTATION),this.queryManager.mutate(n)});Ae(this,"reFetchObservableQueries");Ae(this,"maskedFragmentTransform",new fu(jq));var R;const{cache:n,documentTransform:r,ssrMode:i=!1,ssrForceFetchDelay:s=0,queryDeduplication:l=!0,defaultOptions:u,defaultContext:d,assumeImmutableResults:h=n.assumeImmutableResults,localState:m,devtools:g,dataMasking:y,link:b,incrementalHandler:C=new t$,experiments:w=[],refetchEventManager:_}=e;this.link=b,this.cache=n,this.queryDeduplication=l,this.defaultOptions=u||{},this.devtoolsConfig={...g,enabled:(g==null?void 0:g.enabled)??ER},this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.refetchObservableQueries=this.refetchObservableQueries.bind(this),this.version=G2,this.queryManager=new L$({client:this,defaultOptions:this.defaultOptions,defaultContext:d,documentTransform:r,queryDeduplication:l,ssrMode:i,dataMasking:!!y,clientOptions:e,incrementalHandler:C,assumeImmutableResults:h,onBroadcast:this.devtoolsConfig.enabled?()=>{this.devToolsHookCb&&this.devToolsHookCb()}:void 0,localState:m}),this.prioritizeCacheValues=i||s>0,s&&setTimeout(()=>{this.prioritizeCacheValues=!1},s),this.devtoolsConfig.enabled&&this.connectToDevTools(),w.forEach(k=>k.call(this,e)),this.refetchEventManager=_,(R=this.refetchEventManager)==null||R.connect(this)}set prioritizeCacheValues(e){this.queryManager.prioritizeCacheValues=e}get prioritizeCacheValues(){return this.queryManager.prioritizeCacheValues}connectToDevTools(){if(typeof window>"u")return;const e=window,n=Symbol.for("apollo.devtools");(e[n]=e[n]||[]).push(this),e.__APOLLO_CLIENT__=this}get documentTransform(){return this.queryManager.documentTransform}get localState(){return this.queryManager.localState}set localState(e){this.queryManager.localState=e}stop(){var e;this.queryManager.stop(),(e=this.refetchEventManager)==null||e.disconnect(this)}watchQuery(e){const{refetchOn:n}=e;if(this.defaultOptions.watchQuery){const r=this.defaultOptions.watchQuery.refetchOn;let i;n&&typeof n=="object"&&(typeof r=="object"?i={...r,...n}:r!=null&&(i=s=>{const l=n[s.source]??r;return typeof l=="function"?l(s):l})),e=Ff(this.defaultOptions.watchQuery,e),i&&(e.refetchOn=i)}return this.queryManager.watchQuery(e)}subscribe(e){const n={},r=this.queryManager.startGraphQLSubscription(e),i=r.pipe(nc(s=>({...s,data:this.queryManager.maskOperation({document:e.query,data:s.data,fetchPolicy:e.fetchPolicy,cause:n})})));return Object.assign(i,{restart:r.restart})}readQuery(e,n=!!e.optimistic){return this.cache.readQuery({...e,query:this.transform(e.query)},n)}watchFragment(e){const n=this.queryManager.dataMasking;return this.cache.watchFragment({...e,fragment:this.transform(e.fragment,n)})}readFragment(e,n=!!e.optimistic){return this.cache.readFragment({...e,fragment:this.transform(e.fragment)},n)}writeQuery(e){const n=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),n}writeFragment(e){const n=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),n}__actionHookForDevTools(e){this.devToolsHookCb=e}__requestRaw(e){return O6(this.link,e,{client:this})}resetStore(){return Promise.resolve().then(()=>this.queryManager.clearStore({discardWatches:!1})).then(()=>Promise.all(this.resetStoreCallbacks.map(e=>e()))).then(()=>this.refetchObservableQueries())}clearStore(){return Promise.resolve().then(()=>this.queryManager.clearStore({discardWatches:!0})).then(()=>Promise.all(this.clearStoreCallbacks.map(e=>e())))}onResetStore(e){return this.resetStoreCallbacks.push(e),()=>{this.resetStoreCallbacks=this.resetStoreCallbacks.filter(n=>n!==e)}}onClearStore(e){return this.clearStoreCallbacks.push(e),()=>{this.clearStoreCallbacks=this.clearStoreCallbacks.filter(n=>n!==e)}}refetchObservableQueries(e){return this.queryManager.refetchObservableQueries(e)}refetchQueries(e){const n=this.queryManager.refetchQueries(e),r=[],i=[];n.forEach((l,u)=>{r.push(u),i.push(l)});const s=Promise.all(i);return s.queries=r,s.results=i,s.catch(l=>{}),s}getObservableQueries(e="active"){return this.queryManager.getObservableQueries(e)}extract(e){return this.cache.extract(e)}restore(e){return this.cache.restore(e)}setLink(e){this.link=e}get defaultContext(){return this.queryManager.defaultContext}transform(e,n=!1){const r=this.queryManager.transform(e);return n?this.maskedFragmentTransform.transformDocument(r):r}}const{hasOwnProperty:OO}=Object.prototype;function F$(t){return Ga(t)&&"payload"in t}async function*j$(t){var y;const e=new TextDecoder("utf-8"),n=(y=t.headers)==null?void 0:y.get("content-type"),r=n==null?void 0:n.match(/;\s*boundary=(?:'([^']+)'|"([^"]+)"|([^"'].+?))\s*(?:;|$)/i),i=`\r
243
243
  --`+(r?r[1]??r[2]??r[3]??"-":"-");let s="";wn(t.body&&typeof t.body.getReader=="function",62);const u=t.body.getReader();let d=!1,h=!1,m;const g=()=>h&&s[0]=="-"&&s[1]=="-";try{for(;!d;){({value:m,done:d}=await u.read());const b=typeof m=="string"?m:e.decode(m),C=s.length-i.length+1;s+=b;let w=s.indexOf(i,C);for(;w>-1&&!g();){h=!0;let _;[_,s]=[s.slice(0,w),s.slice(w+i.length)];const R=_.indexOf(`\r
244
244
  \r
245
245
  `),L=U$(_.slice(0,R))["content-type"];if(L&&L.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");const N=_.slice(R);N&&(yield N),w=s.indexOf(i)}if(g())return}throw new Error("premature end of multipart body")}finally{u.cancel()}}async function V$(t,e){for await(const n of j$(t)){const r=NO(t,n);if(Object.keys(r).length!=0)if(F$(r)){if(Object.keys(r).length===1&&r.payload===null)return;let i={...r.payload};"errors"in r&&(i.extensions={...i.extensions,[Pv]:new v0(r.errors??[])}),e(i)}else e(r)}}function U$(t){const e={};return t.split(`
@@ -1093,7 +1093,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1093
1093
  `),u=l===-1?-1:s.indexOf(`
1094
1094
  `,l+1),d=u===-1?"":s.slice(u+1);String(r.stack).endsWith(d)||(r.stack+=`
1095
1095
  `+s)}}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Hf(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&j0.assertOptions(r,{silentJSONParsing:Qa.transitional(Qa.boolean),forcedJSONParsing:Qa.transitional(Qa.boolean),clarifyTimeoutError:Qa.transitional(Qa.boolean),legacyInterceptorReqResOrdering:Qa.transitional(Qa.boolean),advertiseZstdAcceptEncoding:Qa.transitional(Qa.boolean),validateStatusUndefinedResolves:Qa.transitional(Qa.boolean)},!1),i!=null&&(pe.isFunction(i)?n.paramsSerializer={serialize:i}:j0.assertOptions(i,{encode:Qa.function,serialize:Qa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),j0.assertOptions(n,{baseUrl:Qa.spelling("baseURL"),withXsrfToken:Qa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=s&&pe.merge(s.common,s[n.method]);s&&pe.forEach(["delete","get","head","post","put","patch","query","common"],C=>{delete s[C]}),n.headers=Ka.concat(l,s);const u=[];let d=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;d=d&&w.synchronous;const _=n.transitional||M_;_&&_.legacyInterceptorReqResOrdering?u.unshift(w.fulfilled,w.rejected):u.push(w.fulfilled,w.rejected)});const h=[];this.interceptors.response.forEach(function(w){h.push(w.fulfilled,w.rejected)});let m,g=0,y;if(!d){const C=[mM.bind(this),void 0];for(C.unshift(...u),C.push(...h),y=C.length,m=Promise.resolve(n);g<y;)m=m.then(C[g++],C[g++]);return m}y=u.length;let b=n;for(;g<y;){const C=u[g++],w=u[g++];try{b=C(b)}catch(_){w.call(this,_);break}}try{m=mM.call(this,b)}catch(C){return Promise.reject(C)}for(g=0,y=h.length;g<y;)m=m.then(h[g++],h[g++]);return m}getUri(e){e=Hf(this.defaults,e);const n=aM(e.baseURL,e.url,e.allowAbsoluteUrls,e);return KN(n,e.params,e.paramsSerializer)}};pe.forEach(["delete","get","head","options"],function(e){Bf.prototype[e]=function(n,r){return this.request(Hf(r||{},{method:e,url:n,data:r&&pe.hasOwnProp(r,"data")?r.data:void 0}))}}),pe.forEach(["post","put","patch","query"],function(e){function n(r){return function(s,l,u){return this.request(Hf(u||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:l}))}}Bf.prototype[e]=n(),e!=="query"&&(Bf.prototype[e+"Form"]=n(!0))});let zK=class IH{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const l=new Promise(u=>{r.subscribe(u),s=u}).then(i);return l.cancel=function(){r.unsubscribe(s)},l},e(function(s,l,u){r.reason||(r.reason=new Qv(s,l,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new IH(function(i){e=i}),cancel:e}}};function HK(t){return function(n){return t.apply(null,n)}}function BK(t){return pe.isObject(t)&&t.isAxiosError===!0}const V_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(V_).forEach(([t,e])=>{V_[e]=t});function gM(t){const e=new Bf(t),n=MN(Bf.prototype.request,e);return pe.extend(n,Bf.prototype,e,{allOwnKeys:!0}),pe.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return gM(Hf(t,i))},n}const ci=gM(Kv);ci.Axios=Bf,ci.CanceledError=Qv,ci.CancelToken=zK,ci.isCancel=eM,ci.VERSION=I_,ci.toFormData=D0,ci.AxiosError=yt,ci.Cancel=ci.CanceledError,ci.all=function(e){return Promise.all(e)},ci.spread=HK,ci.isAxiosError=BK,ci.mergeConfig=Hf,ci.AxiosHeaders=Ka,ci.formToJSON=t=>XN(pe.isHTMLForm(t)?new FormData(t):t),ci.getAdapter=pM.getAdapter,ci.HttpStatusCode=V_,ci.default=ci;const{Axios:Upe,AxiosError:zpe,CanceledError:Hpe,isCancel:Bpe,CancelToken:qpe,VERSION:$pe,all:Wpe,Cancel:Gpe,isAxiosError:Ype,spread:Kpe,toFormData:Qpe,AxiosHeaders:Zpe,HttpStatusCode:Jpe,formToJSON:Xpe,getAdapter:eme,mergeConfig:tme,create:nme}=ci,qK=()=>ci.create({baseURL:A0(),headers:{Authorization:S_()}});function $K(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];qf(e[0])&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const yM={};function U_(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];qf(e[0])&&yM[e[0]]||(qf(e[0])&&(yM[e[0]]=new Date),$K(...e))}const bM=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},SM=(t,e,n)=>{t.loadNamespaces(e,bM(t,n))},EM=(t,e,n,r)=>{qf(n)&&(n=[n]),n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,bM(t,r))},WK=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const l=(u,d)=>{const h=e.services.backendConnector.state[`${u}|${d}`];return h===-1||h===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!l(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||l(r,t)&&(!i||l(s,t)))},GK=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(U_("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(i,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!s(i.isLanguageChangingTo,t))return!1}}):WK(t,e,n)},qf=t=>typeof t=="string",YK=t=>typeof t=="object"&&t!==null,KK=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,QK={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},ZK=t=>QK[t];let z_={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:t=>t.replace(KK,ZK)};const JK=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};z_={...z_,...t}},XK=()=>z_;let CM;const eQ=t=>{CM=t},tQ=()=>CM,nQ={type:"3rdParty",init(t){JK(t.options.react),eQ(t)}},rQ=D.createContext();class iQ{constructor(){Ae(this,"getUsedNamespaces",()=>Object.keys(this.usedNamespaces));this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}}const aQ=(t,e)=>{const n=D.useRef();return D.useEffect(()=>{n.current=t},[t,e]),n.current},_M=(t,e,n,r)=>t.getFixedT(e,n,r),oQ=(t,e,n,r)=>D.useCallback(_M(t,e,n,r),[t,e,n,r]),sQ=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:r,defaultNS:i}=D.useContext(rQ)||{},s=n||r||tQ();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new iQ),!s){U_("You will need to pass in an i18next instance by using initReactI18next");const N=(P,F)=>qf(F)?F:YK(F)&&qf(F.defaultValue)?F.defaultValue:Array.isArray(P)?P[P.length-1]:P,A=[N,{},!1];return A.t=N,A.i18n={},A.ready=!1,A}s.options.react&&s.options.react.wait!==void 0&&U_("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const l={...XK(),...s.options.react,...e},{useSuspense:u,keyPrefix:d}=l;let h=t||i||s.options&&s.options.defaultNS;h=qf(h)?[h]:h||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(h);const m=(s.isInitialized||s.initializedStoreOnce)&&h.every(N=>GK(N,s,l)),g=oQ(s,e.lng||null,l.nsMode==="fallback"?h:h[0],d),y=()=>g,b=()=>_M(s,e.lng||null,l.nsMode==="fallback"?h:h[0],d),[C,w]=D.useState(y);let _=h.join();e.lng&&(_=`${e.lng}${_}`);const R=aQ(_),k=D.useRef(!0);D.useEffect(()=>{const{bindI18n:N,bindI18nStore:A}=l;k.current=!0,!m&&!u&&(e.lng?EM(s,e.lng,h,()=>{k.current&&w(b)}):SM(s,h,()=>{k.current&&w(b)})),m&&R&&R!==_&&k.current&&w(b);const P=()=>{k.current&&w(b)};return N&&s&&s.on(N,P),A&&s&&s.store.on(A,P),()=>{k.current=!1,N&&s&&N.split(" ").forEach(F=>s.off(F,P)),A&&s&&A.split(" ").forEach(F=>s.store.off(F,P))}},[s,_]),D.useEffect(()=>{k.current&&m&&w(y)},[s,d,m]);const L=[C,s,m];if(L.t=C,L.i18n=s,L.ready=m,m||!m&&!u)return L;throw new Promise(N=>{e.lng?EM(s,e.lng,h,()=>N()):SM(s,h,()=>N())})},lQ=new eG(t=>({headers:{...t.headers,Authorization:S_()}}));class uQ extends oa{constructor(e){super((n,r)=>new Qr(i=>{let s,l,u;try{s=r(n).subscribe({next:d=>{const h=n.client.queryManager.incrementalHandler,m=h.isIncrementalResult(d)?h.extractErrors(d):d.errors;m?u=e({error:new du(d,m),result:d,operation:n,forward:r}):xO(d)&&(u=e({error:d.extensions[Pv],result:d,operation:n,forward:r})),l=u==null?void 0:u.subscribe(i),l||i.next(d)},error:d=>{u=e({operation:n,error:q6(d),forward:r}),l=u==null?void 0:u.subscribe(i),l||i.error(d)},complete:()=>{u||i.complete()}})}catch(d){e({error:q6(d),operation:n,forward:r}),i.error(d)}return()=>{s&&s.unsubscribe(),l&&l.unsubscribe()}}))}}const cQ=new uQ(({graphQLErrors:t,networkError:e,forward:n,operation:r})=>(e&&ii("error","Something went wrong! Please try again.","top-right"),t!=null&&t.length&&t.forEach(({message:i})=>{ii("error",i||"An error occurred","top-right")}),n(r))),fQ=t=>new eW({uri:`${t}/graphql`});function dQ(t){return Ga(t)&&"code"in t&&"reason"in t}function hQ(t){var e;return Ga(t)&&((e=t.target)==null?void 0:e.readyState)===WebSocket.CLOSED}class pQ extends oa{constructor(n){super();Ae(this,"client");this.client=n}request(n){return new Qr(r=>{const{query:i,variables:s,operationName:l,extensions:u}=n;return this.client.subscribe({variables:s,operationName:l,extensions:u,query:jf(i)},{next:r.next.bind(r),complete:r.complete.bind(r),error:d=>{if(d instanceof Error)return r.error(d);const h=dQ(d);return h||hQ(d)?r.error(new Error(`Socket closed${h?` with event ${d.code}`:""}${h?` ${d.reason}`:""}`)):r.error(new du({errors:Array.isArray(d)?d:[d]}))}})})}}function Oo(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function $f(t){return Oo(t)==="object"}function mQ(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function xM(t,e){return t.length<124?t:e}const vQ="graphql-transport-ws";var Qo;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(Qo||(Qo={}));var wi;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(wi||(wi={}));function wM(t){if(!$f(t))throw new Error(`Message is expected to be an object, but got ${Oo(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${Oo(t.type)}`);switch(t.type){case wi.ConnectionInit:case wi.ConnectionAck:case wi.Ping:case wi.Pong:{if(t.payload!=null&&!$f(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case wi.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Oo(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!$f(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Oo(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${Oo(t.payload.query)}`);if(t.payload.variables!=null&&!$f(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${Oo(t.payload.variables)}`);if(t.payload.operationName!=null&&Oo(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${Oo(t.payload.operationName)}`);if(t.payload.extensions!=null&&!$f(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${Oo(t.payload.extensions)}`);break}case wi.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Oo(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!$f(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Oo(t.payload)}`);break}case wi.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Oo(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!mQ(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case wi.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Oo(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function gQ(t,e){return wM(typeof t=="string"?JSON.parse(t,e):t)}function Zv(t,e){return wM(t),JSON.stringify(t,e)}var qh=function(t){return this instanceof qh?(this.v=t,this):new qh(t)},yQ=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",l),i[Symbol.asyncIterator]=function(){return this},i;function l(b){return function(C){return Promise.resolve(C).then(b,g)}}function u(b,C){r[b]&&(i[b]=function(w){return new Promise(function(_,R){s.push([b,w,_,R])>1||d(b,w)})},C&&(i[b]=C(i[b])))}function d(b,C){try{h(r[b](C))}catch(w){y(s[0][3],w)}}function h(b){b.value instanceof qh?Promise.resolve(b.value.v).then(m,g):y(s[0][2],b)}function m(b){d("next",b)}function g(b){d("throw",b)}function y(b,C){b(C),s.shift(),s.length&&d(s[0][0],s[0][1])}};function bQ(t){const{url:e,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:l=0,disablePong:u,connectionAckWaitTimeout:d=0,retryAttempts:h=5,retryWait:m=async function(G){let Z=1e3;for(let J=0;J<G;J++)Z*=2;await new Promise(J=>setTimeout(J,Z+Math.floor(Math.random()*2700+300)))},shouldRetry:g=H_,isFatalConnectionProblem:y,on:b,webSocketImpl:C,generateID:w=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,G=>{const Z=Math.random()*16|0;return(G=="x"?Z:Z&3|8).toString(16)})},jsonMessageReplacer:_,jsonMessageReviver:R}=t;let k;if(C){if(!EQ(C))throw new Error("Invalid WebSocket implementation provided");k=C}else typeof WebSocket<"u"?k=WebSocket:typeof global<"u"?k=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(k=window.WebSocket||window.MozWebSocket);if(!k)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const L=k,N=(()=>{const H=(()=>{const Z={};return{on(J,le){return Z[J]=le,()=>{delete Z[J]}},emit(J){var le;"id"in J&&((le=Z[J.id])===null||le===void 0||le.call(Z,J))}}})(),G={connecting:b!=null&&b.connecting?[b.connecting]:[],opened:b!=null&&b.opened?[b.opened]:[],connected:b!=null&&b.connected?[b.connected]:[],ping:b!=null&&b.ping?[b.ping]:[],pong:b!=null&&b.pong?[b.pong]:[],message:b!=null&&b.message?[H.emit,b.message]:[H.emit],closed:b!=null&&b.closed?[b.closed]:[],error:b!=null&&b.error?[b.error]:[]};return{onMessage:H.on,on(Z,J){const le=G[Z];return le.push(J),()=>{le.splice(le.indexOf(J),1)}},emit(Z,...J){for(const le of[...G[Z]])le(...J)}}})();function A(H){const G=[N.on("error",Z=>{G.forEach(J=>J()),H(Z)}),N.on("closed",Z=>{G.forEach(J=>J()),H(Z)})]}let P,F=0,U,$=!1,K=0,te=!1;async function X(){clearTimeout(U);const[H,G]=await(P??(P=new Promise((le,re)=>(async()=>{if($){if(await m(K),!F)return P=void 0,re({code:1e3,reason:"All Subscriptions Gone"});K++}N.emit("connecting",$);const ie=new L(typeof e=="function"?await e():e,vQ);let ce,ge;function ye(){isFinite(l)&&l>0&&(clearTimeout(ge),ge=setTimeout(()=>{ie.readyState===L.OPEN&&(ie.send(Zv({type:wi.Ping})),N.emit("ping",!1,void 0))},l))}A(Se=>{P=void 0,clearTimeout(ce),clearTimeout(ge),re(Se),Se instanceof TM&&(ie.close(4499,"Terminated"),ie.onerror=null,ie.onclose=null)}),ie.onerror=Se=>N.emit("error",Se),ie.onclose=Se=>N.emit("closed",Se),ie.onopen=async()=>{try{N.emit("opened",ie);const Se=typeof n=="function"?await n():n;if(ie.readyState!==L.OPEN)return;ie.send(Zv(Se?{type:wi.ConnectionInit,payload:Se}:{type:wi.ConnectionInit},_)),isFinite(d)&&d>0&&(ce=setTimeout(()=>{ie.close(Qo.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},d)),ye()}catch(Se){N.emit("error",Se),ie.close(Qo.InternalClientError,xM(Se instanceof Error?Se.message:new Error(Se).message,"Internal client error"))}};let Re=!1;ie.onmessage=({data:Se})=>{try{const we=gQ(Se,R);if(N.emit("message",we),we.type==="ping"||we.type==="pong"){N.emit(we.type,!0,we.payload),we.type==="pong"?ye():u||(ie.send(Zv(we.payload?{type:wi.Pong,payload:we.payload}:{type:wi.Pong})),N.emit("pong",!1,we.payload));return}if(Re)return;if(we.type!==wi.ConnectionAck)throw new Error(`First message cannot be of type ${we.type}`);clearTimeout(ce),Re=!0,N.emit("connected",ie,we.payload,$),$=!1,K=0,le([ie,new Promise(($e,Ge)=>A(Ge))])}catch(we){ie.onmessage=null,N.emit("error",we),ie.close(Qo.BadResponse,xM(we instanceof Error?we.message:new Error(we).message,"Bad response"))}}})())));H.readyState===L.CLOSING&&await G;let Z=()=>{};const J=new Promise(le=>Z=le);return[H,Z,Promise.race([J.then(()=>{if(!F){const le=()=>H.close(1e3,"Normal Closure");isFinite(s)&&s>0?U=setTimeout(()=>{H.readyState===L.OPEN&&le()},s):le()}}),G])]}function ne(H){if(H_(H)&&(SQ(H.code)||[Qo.InternalServerError,Qo.InternalClientError,Qo.BadRequest,Qo.BadResponse,Qo.Unauthorized,Qo.SubprotocolNotAcceptable,Qo.SubscriberAlreadyExists,Qo.TooManyInitialisationRequests].includes(H.code)))throw H;if(te)return!1;if(H_(H)&&H.code===1e3)return F>0;if(!h||K>=h||!g(H)||y!=null&&y(H))throw H;return $=!0}r||(async()=>{for(F++;;)try{const[,,H]=await X();await H}catch(H){try{if(!ne(H))return}catch(G){return i==null?void 0:i(G)}}})();function Y(H,G){const Z=w(H);let J=!1,le=!1,re=()=>{F--,J=!0};return(async()=>{for(F++;;)try{const[ie,ce,ge]=await X();if(J)return ce();const ye=N.onMessage(Z,Re=>{switch(Re.type){case wi.Next:{G.next(Re.payload);return}case wi.Error:{le=!0,J=!0,G.error(Re.payload),re();return}case wi.Complete:{J=!0,re();return}}});ie.send(Zv({id:Z,type:wi.Subscribe,payload:H},_)),re=()=>{!J&&ie.readyState===L.OPEN&&ie.send(Zv({id:Z,type:wi.Complete},_)),F--,J=!0,ce()},await ge.finally(ye);return}catch(ie){if(!ne(ie))return}})().then(()=>{le||G.complete()}).catch(ie=>{G.error(ie)}),()=>{J||re()}}return{on:N.on,subscribe:Y,iterate(H){const G=[],Z={done:!1,error:null,resolve:()=>{}},J=Y(H,{next(re){G.push(re),Z.resolve()},error(re){Z.done=!0,Z.error=re,Z.resolve()},complete(){Z.done=!0,Z.resolve()}}),le=(function(){return yQ(this,arguments,function*(){for(;;){for(G.length||(yield qh(new Promise(ce=>Z.resolve=ce)));G.length;)yield yield qh(G.shift());if(Z.error)throw Z.error;if(Z.done)return yield qh(void 0)}})})();return le.throw=async re=>(Z.done||(Z.done=!0,Z.error=re,Z.resolve()),{done:!0,value:void 0}),le.return=async()=>(J(),{done:!0,value:void 0}),le},async dispose(){if(te=!0,P){const[H]=await P;H.close(1e3,"Normal Closure")}},terminate(){P&&N.emit("closed",new TM)}}}class TM extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function H_(t){return $f(t)&&"code"in t&&"reason"in t}function SQ(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}function EQ(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}const CQ=t=>new pQ(bQ({connectionParams:()=>({Authorization:S_()}),url:`${t==null?void 0:t.replace("http","ws")}/graphql`,keepAlive:6e4})),B_=t=>new I$({link:oa.from([lQ,cQ,oa.split(({query:e})=>{const n=S6(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},CQ(t),fQ(t))]),cache:new O$});B_();const _Q=t=>{const[e,n]=D.useState(typeof window<"u"&&window.matchMedia(t).matches);return D.useLayoutEffect(()=>{const r=window.matchMedia(t),i=s=>{n(s.matches)};return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e},AM=(t,e)=>{const n=D.useRef(null);return D.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),(...i)=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{t(...i)},e)}};var xQ=D.useLayoutEffect;function wQ(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function TQ(){const t=wQ();if(t.__xstate__)return t.__xstate__}const AQ=t=>{if(typeof window>"u")return;const e=TQ();e&&e.register(t)};class RM{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){const n={value:e,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush()}flush(){for(;this._current;){const e=this._current;this._process(e.value),this._current=e.next}this._last=null}}const kM=".",RQ="",OM="",kQ="#",OQ="*",NM="xstate.init",NQ="xstate.error",V0="xstate.stop";function MQ(t,e){return{type:`xstate.after.${t}.${e}`}}function q_(t,e){return{type:`xstate.done.state.${t}`,output:e}}function DQ(t,e){return{type:`xstate.done.actor.${t}`,output:e,actorId:t}}function MM(t,e){return{type:`xstate.error.actor.${t}`,error:e,actorId:t}}function DM(t){return{type:NM,input:t}}function xl(t){setTimeout(()=>{throw t})}const LQ=typeof Symbol=="function"&&Symbol.observable||"@@observable";function LM(t,e){const n=PM(t),r=PM(e);return typeof r=="string"?typeof n=="string"?r===n:!1:typeof n=="string"?n in r:Object.keys(n).every(i=>i in r?LM(n[i],r[i]):!1)}function $_(t){if(jM(t))return t;const e=[];let n="";for(let r=0;r<t.length;r++){switch(t.charCodeAt(r)){case 92:n+=t[r+1],r++;continue;case 46:e.push(n),n="";continue}n+=t[r]}return e.push(n),e}function PM(t){if(gZ(t))return t.value;if(typeof t!="string")return t;const e=$_(t);return PQ(e)}function PQ(t){if(t.length===1)return t[0];const e={};let n=e;for(let r=0;r<t.length-1;r++)if(r===t.length-2)n[t[r]]=t[r+1];else{const i=n;n={},i[t[r]]=n}return e}function IM(t,e){const n={},r=Object.keys(t);for(let i=0;i<r.length;i++){const s=r[i];n[s]=e(t[s],s,t,i)}return n}function FM(t){return jM(t)?t:[t]}function sc(t){return t===void 0?[]:FM(t)}function W_(t,e,n,r){return typeof t=="function"?t({context:e,event:n,self:r}):t}function jM(t){return Array.isArray(t)}function IQ(t){return t.type.startsWith("xstate.error.actor")}function $h(t){return FM(t).map(e=>typeof e>"u"||typeof e=="string"?{target:e}:e)}function VM(t){if(!(t===void 0||t===RQ))return sc(t)}function U0(t,e,n){var s,l,u;const r=typeof t=="object",i=r?t:void 0;return{next:(s=r?t.next:t)==null?void 0:s.bind(i),error:(l=r?t.error:e)==null?void 0:l.bind(i),complete:(u=r?t.complete:n)==null?void 0:u.bind(i)}}function UM(t,e){return`${e}.${t}`}function G_(t,e){const n=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return t.implementations.actors[e];const[,r,i]=n,l=t.getStateNodeById(i).config.invoke;return(Array.isArray(l)?l[r]:l).src}function FQ(t,e){if(e===t||e===OQ)return!0;if(!e.endsWith(".*"))return!1;const n=e.split("."),r=t.split(".");for(let i=0;i<n.length;i++){const s=n[i],l=r[i];if(s==="*")return i===n.length-1;if(s!==l)return!1}return!0}function zM(t,e){return`${t.sessionId}.${e}`}let jQ=0;function VQ(t,e){const n=new Map,r=new Map,i=new WeakMap,s=new Set,l={},{clock:u,logger:d}=e,h={schedule:(y,b,C,w,_=Math.random().toString(36).slice(2))=>{const R={source:y,target:b,event:C,delay:w,id:_,startedAt:Date.now()},k=zM(y,_);g._snapshot._scheduledEvents[k]=R;const L=u.setTimeout(()=>{delete l[k],delete g._snapshot._scheduledEvents[k],g._relay(y,b,C)},w);l[k]=L},cancel:(y,b)=>{const C=zM(y,b),w=l[C];delete l[C],delete g._snapshot._scheduledEvents[C],w!==void 0&&u.clearTimeout(w)},cancelAll:y=>{for(const b in g._snapshot._scheduledEvents){const C=g._snapshot._scheduledEvents[b];C.source===y&&h.cancel(y,C.id)}}},m=y=>{if(!s.size)return;const b={...y,rootId:t.sessionId};s.forEach(C=>{var w;return(w=C.next)==null?void 0:w.call(C,b)})},g={_snapshot:{_scheduledEvents:((e==null?void 0:e.snapshot)&&e.snapshot.scheduler)??{}},_bookId:()=>`x:${jQ++}`,_register:(y,b)=>(n.set(y,b),y),_unregister:y=>{n.delete(y.sessionId);const b=i.get(y);b!==void 0&&(r.delete(b),i.delete(y))},get:y=>r.get(y),getAll:()=>Object.fromEntries(r.entries()),_set:(y,b)=>{const C=r.get(y);if(C&&C!==b)throw new Error(`Actor with system ID '${y}' already exists.`);r.set(y,b),i.set(b,y)},inspect:y=>{const b=U0(y);return s.add(b),{unsubscribe(){s.delete(b)}}},_sendInspectionEvent:m,_relay:(y,b,C)=>{g._sendInspectionEvent({type:"@xstate.event",sourceRef:y,actorRef:b,event:C}),b._send(C)},scheduler:h,getSnapshot:()=>({_scheduledEvents:{...g._snapshot._scheduledEvents}}),start:()=>{const y=g._snapshot._scheduledEvents;g._snapshot._scheduledEvents={};for(const b in y){const{source:C,target:w,event:_,delay:R,id:k}=y[b];h.schedule(C,w,_,R,k)}},_clock:u,_logger:d};return g}let Y_=!1;const K_=1;let No=(function(t){return t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped",t})({});const UQ={clock:{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},logger:console.log.bind(console),devTools:!1};class zQ{constructor(e,n){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new RM(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=No.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];const r={...UQ,...n},{clock:i,logger:s,parent:l,syncSnapshot:u,id:d,systemId:h,inspect:m}=r;this.system=l?l.system:VQ(this,{clock:i,logger:s}),m&&!l&&this.system.inspect(U0(m)),this.sessionId=this.system._bookId(),this.id=d??this.sessionId,this.logger=(n==null?void 0:n.logger)??this.system._logger,this.clock=(n==null?void 0:n.clock)??this.system._clock,this._parent=l,this._syncSnapshot=u,this.options=r,this.src=r.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:g=>{this._deferred.push(g)},system:this.system,stopChild:g=>{if(g._parent!==this)throw new Error(`Cannot stop child actor ${g.id} of ${this.id} because it is not a child`);g._stop()},emit:g=>{const y=this.eventListeners.get(g.type),b=this.eventListeners.get("*");if(!y&&!b)return;const C=[...y?y.values():[],...b?b.values():[]];for(const w of C)try{w(g)}catch(_){xl(_)}},actionExecutor:g=>{const y=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:g.type,params:g.params}}),!g.exec)return;const b=Y_;try{Y_=!0,g.exec(g.info,g.params)}finally{Y_=b}};this._processingStatus===No.Running?y():this._deferred.push(y)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),h&&(this.systemId=h,this.system._set(h,this)),this._initState((n==null?void 0:n.snapshot)??(n==null?void 0:n.state)),h&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(e){var n;try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,(n=this.options)==null?void 0:n.input)}catch(r){this._snapshot={status:"error",output:void 0,error:r}}}update(e,n){var i,s;this._snapshot=e;let r;for(;r=this._deferred.shift();)try{r()}catch(l){this._deferred.length=0,this._snapshot={...e,status:"error",error:l}}switch(this._snapshot.status){case"active":for(const l of this.observers)try{(i=l.next)==null||i.call(l,e)}catch(u){xl(u)}break;case"done":for(const l of this.observers)try{(s=l.next)==null||s.call(l,e)}catch(u){xl(u)}this._stopProcedure(),this._complete(),this._doneEvent=DQ(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:e})}subscribe(e,n,r){var s;const i=U0(e,n,r);if(this._processingStatus!==No.Stopped)this.observers.add(i);else switch(this._snapshot.status){case"done":try{(s=i.complete)==null||s.call(i)}catch(l){xl(l)}break;case"error":{const l=this._snapshot.error;if(!i.error)xl(l);else try{i.error(l)}catch(u){xl(u)}break}}return{unsubscribe:()=>{this.observers.delete(i)}}}on(e,n){let r=this.eventListeners.get(e);r||(r=new Set,this.eventListeners.set(e,r));const i=n.bind(void 0);return r.add(i),{unsubscribe:()=>{r.delete(i)}}}select(e,n=Object.is){return{subscribe:r=>{const i=U0(r),s=this.getSnapshot();let l=e(s);return this.subscribe(u=>{var h;const d=e(u);n(l,d)||(l=d,(h=i.next)==null||h.call(i,d))})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===No.Running)return this;this._syncSnapshot&&this.subscribe({next:r=>{r.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:r})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=No.Running;const e=DM(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(r){return this._snapshot={...this._snapshot,status:"error",error:r},this._error(r),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let n,r;try{n=this.logic.transition(this._snapshot,e,this._actorScope)}catch(i){r={err:i}}if(r){const{err:i}=r;this._snapshot={...this._snapshot,status:"error",error:i},this._error(i);return}this.update(n,e),e.type===V0&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===No.Stopped?this:(this.mailbox.clear(),this._processingStatus===No.NotStarted?(this._processingStatus=No.Stopped,this):(this.mailbox.enqueue({type:V0}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){var e;for(const n of this.observers)try{(e=n.complete)==null||e.call(n)}catch(r){xl(r)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||xl(e),this.eventListeners.clear();return}let n=!1;for(const r of this.observers){const i=r.error;n||(n=!i);try{i==null||i(e)}catch(s){xl(s)}}this.observers.clear(),this.eventListeners.clear(),n&&xl(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,MM(this.id,e))}_stopProcedure(){return this._processingStatus!==No.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new RM(this._process.bind(this)),this._processingStatus=No.Stopped,this.system._unregister(this),this)}_send(e){this._processingStatus!==No.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){const{devTools:e}=this.options;e&&(typeof e=="function"?e:AQ)(this)}toJSON(){return{xstate$$type:K_,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[LQ](){return this}getSnapshot(){return this._snapshot}}function Wh(t,...[e]){return new zQ(t,e)}function HQ(t,e,n,r,{sendId:i}){const s=typeof i=="function"?i(n,r):i;return[e,{sendId:s},void 0]}function BQ(t,e){t.defer(()=>{t.system.scheduler.cancel(t.self,e.sendId)})}function Q_(t){function e(n,r){}return e.type="xstate.cancel",e.sendId=t,e.resolve=HQ,e.execute=BQ,e}function qQ(t,e,n,r,{id:i,systemId:s,src:l,input:u,syncSnapshot:d}){const h=typeof l=="string"?G_(e.machine,l):l,m=typeof i=="function"?i(n):i;let g,y;return h&&(y=typeof u=="function"?u({context:e.context,event:n.event,self:t.self}):u,g=Wh(h,{id:m,src:l,parent:t.self,syncSnapshot:d,systemId:s,input:y})),[Gf(e,{children:{...e.children,[m]:g}}),{id:i,systemId:s,actorRef:g,src:l,input:y},void 0]}function $Q(t,{actorRef:e}){e&&t.defer(()=>{e._processingStatus!==No.Stopped&&e.start()})}function Z_(...[t,{id:e,systemId:n,input:r,syncSnapshot:i=!1}={}]){function s(l,u){}return s.type="xstate.spawnChild",s.id=e,s.systemId=n,s.src=t,s.input=r,s.syncSnapshot=i,s.resolve=qQ,s.execute=$Q,s}function WQ(t,e,n,r,{actorRef:i}){const s=typeof i=="function"?i(n,r):i,l=typeof s=="string"?e.children[s]:s;let u=e.children;return l&&(u={...u},delete u[l.id]),[Gf(e,{children:u}),l,void 0]}function HM(t,e){const n=e.getSnapshot();if(n&&"children"in n)for(const r of Object.values(n.children))HM(t,r);t.system._unregister(e)}function GQ(t,e){if(e){if(HM(t,e),e._processingStatus!==No.Running){t.stopChild(e);return}t.defer(()=>{t.stopChild(e)})}}function z0(t){function e(n,r){}return e.type="xstate.stopChild",e.actorRef=t,e.resolve=WQ,e.execute=GQ,e}function YQ(t,{context:e,event:n},{guards:r}){return r.every(i=>Jv(i,e,n,t))}function KQ(t){function e(n,r){return!1}return e.check=YQ,e.guards=t,e}function Jv(t,e,n,r){const{machine:i}=r,s=typeof t=="function",l=s?t:i.implementations.guards[typeof t=="string"?t:t.type];if(!s&&!l)throw new Error(`Guard '${typeof t=="string"?t:t.type}' is not implemented.'.`);if(typeof l!="function")return Jv(l,e,n,r);const u={context:e,event:n},d=s||typeof t=="string"?void 0:"params"in t?typeof t.params=="function"?t.params({context:e,event:n}):t.params:void 0;return"check"in l?l.check(r,u,l):l(u,d)}function J_(t){return t.type==="atomic"||t.type==="final"}function Gh(t){return Object.values(t.states).filter(e=>e.type!=="history")}function Xv(t,e){const n=[];if(e===t)return n;let r=t.parent;for(;r&&r!==e;)n.push(r),r=r.parent;return n}function H0(t){const e=new Set(t),n=qM(e);for(const r of e)if(r.type==="compound"&&(!n.get(r)||!n.get(r).length))GM(r).forEach(i=>e.add(i));else if(r.type==="parallel"){for(const i of Gh(r))if(i.type!=="history"&&!e.has(i)){const s=GM(i);for(const l of s)e.add(l)}}for(const r of e){let i=r.parent;for(;i;)e.add(i),i=i.parent}return e}function BM(t,e){const n=e.get(t);if(!n)return{};if(t.type==="compound"){const i=n[0];if(i){if(J_(i))return i.key}else return{}}const r={};for(const i of n)r[i.key]=BM(i,e);return r}function qM(t){const e=new Map;for(const n of t)e.has(n)||e.set(n,[]),n.parent&&(e.has(n.parent)||e.set(n.parent,[]),e.get(n.parent).push(n));return e}function $M(t,e){const n=H0(e);return BM(t,qM(n))}function X_(t,e){return e.type==="compound"?Gh(e).some(n=>n.type==="final"&&t.has(n)):e.type==="parallel"?Gh(e).every(n=>X_(t,n)):e.type==="final"}const B0=t=>t[0]===kQ;function QQ(t,e){const n=t.transitions.get(e),r=[...t.transitions.keys()].filter(i=>i!==e&&FQ(e,i)).sort((i,s)=>s.length-i.length).flatMap(i=>t.transitions.get(i));return n?[...n,...r]:r}function ZQ(t){const e=t.config.after;if(!e)return[];const n=i=>{const s=MQ(i,t.id),l=s.type;return t.entry.push(ox(s,{id:l,delay:i})),t.exit.push(Q_(l)),l};return Object.keys(e).flatMap(i=>{const s=e[i],l=typeof s=="string"?{target:s}:s,u=Number.isNaN(+i)?i:+i,d=n(u);return sc(l).map(h=>({...h,event:d,delay:u}))}).map(i=>{const{delay:s}=i;return{...lc(t,i.event,i),delay:s}})}function lc(t,e,n){const r=VM(n.target),i=n.reenter??!1,s=tZ(t,r),l={...n,actions:sc(n.actions),guard:n.guard,target:s,source:t,reenter:i,eventType:e,toJSON:()=>({...l,source:`#${t.id}`,target:s?s.map(u=>`#${u.id}`):void 0})};return l}function JQ(t){const e=new Map;if(t.config.on)for(const n of Object.keys(t.config.on)){if(n===OM)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const r=t.config.on[n];e.set(n,$h(r).map(i=>lc(t,n,i)))}if(t.config.onDone){const n=`xstate.done.state.${t.id}`;e.set(n,$h(t.config.onDone).map(r=>lc(t,n,r)))}for(const n of t.invoke){if(n.onDone){const r=`xstate.done.actor.${n.id}`;e.set(r,$h(n.onDone).map(i=>lc(t,r,i)))}if(n.onError){const r=`xstate.error.actor.${n.id}`;e.set(r,$h(n.onError).map(i=>lc(t,r,i)))}if(n.onSnapshot){const r=`xstate.snapshot.${n.id}`;e.set(r,$h(n.onSnapshot).map(i=>lc(t,r,i)))}}for(const n of t.after){let r=e.get(n.eventType);r||(r=[],e.set(n.eventType,r)),r.push(n)}return e}function XQ(t){const e=[],n=r=>{Object.values(r).forEach(i=>{if(i.config.route&&i.config.id){const s=i.config.id,l=i.config.route.guard,u=({event:h})=>h.to===`#${s}`,d={...i.config.route,guard:l?KQ([u,l]):u,target:`#${s}`};e.push(lc(t,"xstate.route",d))}i.states&&n(i.states)})};n(t.states),e.length>0&&t.transitions.set("xstate.route",e)}function eZ(t,e){const n=typeof e=="string"?t.states[e]:e?t.states[e.target]:void 0;if(!n&&e)throw new Error(`Initial state node "${e}" not found on parent state node #${t.id}`);const r={source:t,actions:!e||typeof e=="string"?[]:sc(e.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${t.id}`,target:n?[`#${n.id}`]:[]})};return r}function tZ(t,e){if(e!==void 0)return e.map(n=>{if(typeof n!="string")return n;if(B0(n))return t.machine.getStateNodeById(n);const r=n[0]===kM;if(r&&!t.parent)return q0(t,n.slice(1));const i=r?t.key+n:n;if(t.parent)try{return q0(t.parent,i)}catch(s){throw new Error(`Invalid transition definition for state node '${t.id}':
1096
- ${s.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function WM(t){const e=VM(t.config.target);return e?{target:e.map(n=>typeof n=="string"?q0(t.parent,n):n)}:t.parent.initial}function Wf(t){return t.type==="history"}function GM(t){const e=YM(t);for(const n of e)for(const r of Xv(n,t))e.add(r);return e}function YM(t){const e=new Set;function n(r){if(!e.has(r)){if(e.add(r),r.type==="compound")n(r.initial.target[0]);else if(r.type==="parallel")for(const i of Gh(r))n(i)}}return n(t),e}function Yh(t,e){if(B0(e))return t.machine.getStateNodeById(e);if(!t.states)throw new Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);const n=t.states[e];if(!n)throw new Error(`Child state '${e}' does not exist on '${t.id}'`);return n}function q0(t,e){if(typeof e=="string"&&B0(e))try{return t.machine.getStateNodeById(e)}catch{}const n=$_(e).slice();let r=t;for(;n.length;){const i=n.shift();if(!i.length)break;r=Yh(r,i)}return r}function $0(t,e){if(typeof e=="string"){const i=t.states[e];if(!i)throw new Error(`State '${e}' does not exist on '${t.id}'`);return[t,i]}const n=Object.keys(e),r=n.map(i=>Yh(t,i)).filter(Boolean);return[t.machine.root,t].concat(r,n.reduce((i,s)=>{const l=Yh(t,s);if(!l)return i;const u=$0(l,e[s]);return i.concat(u)},[]))}function nZ(t,e,n,r){const s=Yh(t,e).next(n,r);return!s||!s.length?t.next(n,r):s}function rZ(t,e,n,r){const i=Object.keys(e),s=Yh(t,i[0]),l=ex(s,e[i[0]],n,r);return!l||!l.length?t.next(n,r):l}function iZ(t,e,n,r){const i=[];for(const s of Object.keys(e)){const l=e[s];if(!l)continue;const u=Yh(t,s),d=ex(u,l,n,r);d&&i.push(...d)}return i.length?i:t.next(n,r)}function ex(t,e,n,r){return typeof e=="string"?nZ(t,e,n,r):Object.keys(e).length===1?rZ(t,e,n,r):iZ(t,e,n,r)}function aZ(t){return Object.keys(t.states).map(e=>t.states[e]).filter(e=>e.type==="history")}function uc(t,e){let n=t;for(;n.parent&&n.parent!==e;)n=n.parent;return n.parent===e}function oZ(t,e){const n=new Set(t),r=new Set(e);for(const i of n)if(r.has(i))return!0;for(const i of r)if(n.has(i))return!0;return!1}function KM(t,e,n){const r=new Set;for(const i of t){let s=!1;const l=new Set;for(const u of r)if(oZ(nx([i],e,n),nx([u],e,n)))if(uc(i.source,u.source))l.add(u);else{s=!0;break}if(!s){for(const u of l)r.delete(u);r.add(i)}}return Array.from(r)}function sZ(t){const[e,...n]=t;for(const r of Xv(e,void 0))if(n.every(i=>uc(i,r)))return r}function tx(t,e){if(!t.target)return[];const n=new Set;for(const r of t.target)if(Wf(r))if(e[r.id])for(const i of e[r.id])n.add(i);else for(const i of tx(WM(r),e))n.add(i);else n.add(r);return[...n]}function QM(t,e){const n=tx(t,e);if(!n)return;if(!t.reenter&&n.every(i=>i===t.source||uc(i,t.source)))return t.source;const r=sZ(n.concat(t.source));if(r)return r;if(!t.reenter)return t.source.machine.root}function nx(t,e,n){var i;const r=new Set;for(const s of t)if((i=s.target)!=null&&i.length){const l=QM(s,n);s.reenter&&s.source===l&&r.add(l);for(const u of e)uc(u,l)&&r.add(u)}return[...r]}function lZ(t,e){if(t.length!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function uZ(t,e,n,r,i){return rx([{target:[...YM(t)],source:t,reenter:!0,actions:[],eventType:null,toJSON:null}],e,n,r,!0,i)}function rx(t,e,n,r,i,s){const l=[];if(!t.length)return[e,l];const u=n.actionExecutor;n.actionExecutor=d=>{l.push(d),u(d)};try{const d=new Set(e._nodes);let h=e.historyValue;const m=KM(t,d,h);let g=e;i||([g,h]=hZ(g,r,n,m,d,h,s,n.actionExecutor)),g=Qh(g,r,n,m.flatMap(b=>b.actions),s,void 0),g=fZ(g,r,n,m,d,s,h,i);const y=[...d];g.status==="done"&&(g=Qh(g,r,n,y.sort((b,C)=>C.order-b.order).flatMap(b=>b.exit),s,void 0));try{return h===e.historyValue&&lZ(e._nodes,d)?[g,l]:[Gf(g,{_nodes:y,historyValue:h}),l]}catch(b){throw b}}finally{n.actionExecutor=u}}function cZ(t,e,n,r,i){if(r.output===void 0)return;const s=q_(i.id,i.output!==void 0&&i.parent?W_(i.output,t.context,e,n.self):void 0);return W_(r.output,t.context,s,n.self)}function fZ(t,e,n,r,i,s,l,u){let d=t;const h=new Set,m=new Set;dZ(r,l,m,h),u&&m.add(t.machine.root);const g=new Set;for(const y of[...h].sort((b,C)=>b.order-C.order)){i.add(y);const b=[];b.push(...y.entry);for(const C of y.invoke)b.push(Z_(C.src,{...C,syncSnapshot:!!C.onSnapshot}));if(m.has(y)){const C=y.initial.actions;b.push(...C)}if(d=Qh(d,e,n,b,s,y.invoke.map(C=>C.id)),y.type==="final"){const C=y.parent;let w=(C==null?void 0:C.type)==="parallel"?C:C==null?void 0:C.parent,_=w||y;for((C==null?void 0:C.type)==="compound"&&s.push(q_(C.id,y.output!==void 0?W_(y.output,d.context,e,n.self):void 0));(w==null?void 0:w.type)==="parallel"&&!g.has(w)&&X_(i,w);)g.add(w),s.push(q_(w.id)),_=w,w=w.parent;if(w)continue;d=Gf(d,{status:"done",output:cZ(d,e,n,d.machine.root,_)})}}return d}function dZ(t,e,n,r){for(const i of t){const s=QM(i,e);for(const u of i.target||[])!Wf(u)&&(i.source!==u||i.source!==s||i.reenter)&&(r.add(u),n.add(u)),Kh(u,e,n,r);const l=tx(i,e);for(const u of l){const d=Xv(u,s);(s==null?void 0:s.type)==="parallel"&&d.push(s),ZM(r,e,n,d,!i.source.parent&&i.reenter?void 0:s)}}}function Kh(t,e,n,r){var i;if(Wf(t))if(e[t.id]){const s=e[t.id];for(const l of s)r.add(l),Kh(l,e,n,r);for(const l of s)ix(l,t.parent,r,e,n)}else{const s=WM(t);for(const l of s.target)r.add(l),s===((i=t.parent)==null?void 0:i.initial)&&n.add(t.parent),Kh(l,e,n,r);for(const l of s.target)ix(l,t.parent,r,e,n)}else if(t.type==="compound"){const[s]=t.initial.target;Wf(s)||(r.add(s),n.add(s)),Kh(s,e,n,r),ix(s,t,r,e,n)}else if(t.type==="parallel")for(const s of Gh(t).filter(l=>!Wf(l)))[...r].some(l=>uc(l,s))||(Wf(s)||(r.add(s),n.add(s)),Kh(s,e,n,r))}function ZM(t,e,n,r,i){for(const s of r)if((!i||uc(s,i))&&t.add(s),s.type==="parallel")for(const l of Gh(s).filter(u=>!Wf(u)))[...t].some(u=>uc(u,l))||(t.add(l),Kh(l,e,n,t))}function ix(t,e,n,r,i){ZM(n,r,i,Xv(t,e))}function hZ(t,e,n,r,i,s,l,u){let d=t;const h=nx(r,i,s);h.sort((g,y)=>y.order-g.order);let m;for(const g of h)for(const y of aZ(g)){let b;y.history==="deep"?b=C=>J_(C)&&uc(C,g):b=C=>C.parent===g,m??(m={...s}),m[y.id]=Array.from(i).filter(b)}for(const g of h)d=Qh(d,e,n,[...g.exit,...g.invoke.map(y=>z0(y.id))],l,void 0),i.delete(g);return[d,m||s]}function pZ(t,e){return t.implementations.actions[e]}function JM(t,e,n,r,i,s){const{machine:l}=t;let u=t;for(const d of r){const h=typeof d=="function",m=h?d:pZ(l,typeof d=="string"?d:d.type),g={context:u.context,event:e,self:n.self,system:n.system},y=h||typeof d=="string"?void 0:"params"in d?typeof d.params=="function"?d.params({context:u.context,event:e}):d.params:void 0;if(!m||!("resolve"in m)){n.actionExecutor({type:typeof d=="string"?d:typeof d=="object"?d.type:d.name||"(anonymous)",info:g,params:y,exec:m});continue}const b=m,[C,w,_]=b.resolve(n,u,g,y,m,i);u=C,"retryResolve"in b&&(s==null||s.push([b,w])),"execute"in b&&n.actionExecutor({type:b.type,info:g,params:w,exec:b.execute.bind(null,n,w)}),_&&(u=JM(u,e,n,_,i,s))}return u}function Qh(t,e,n,r,i,s){const l=s?[]:void 0,u=JM(t,e,n,r,{internalQueue:i,deferredActorIds:s},l);return l==null||l.forEach(([d,h])=>{d.retryResolve(n,u,h)}),u}function ax(t,e,n,r){var g;let i=t;const s=[];function l(y,b,C){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:b,snapshot:y[0],_transitions:C}),s.push(y)}if(e.type===V0)return i=Gf(XM(i,e,n),{status:"stopped"}),l([i,[]],e,[]),{snapshot:i,microsteps:s};let u=e;if(u.type!==NM){const y=u,b=IQ(y),C=eD(y,i);if(b&&!C.length)return i=Gf(t,{status:"error",error:y.error}),l([i,[]],y,[]),{snapshot:i,microsteps:s};const w=rx(C,t,n,u,!1,r);i=w[0],l(w,y,C)}let d=!0;const h=((g=t.machine.options)==null?void 0:g.maxIterations)??1/0;let m=0;for(;i.status==="active";){if(m++,m>h)throw new Error(`Infinite loop detected: the machine has processed more than ${h} microsteps without reaching a stable state. This usually happens when there's a cycle of transitions (e.g., eventless transitions or raised events causing state A -> B -> C -> A).`);let y=d?mZ(i,u):[];const b=y.length?i:void 0;if(!y.length){if(!r.length)break;u=r.shift(),y=eD(u,i)}const C=rx(y,i,n,u,!1,r);i=C[0],d=i!==b,l(C,u,y)}return i.status!=="active"&&XM(i,u,n),{snapshot:i,microsteps:s}}function XM(t,e,n){return Qh(t,e,n,Object.values(t.children).map(r=>z0(r)),[],void 0)}function eD(t,e){return e.machine.getTransitionData(e,t)}function mZ(t,e){const n=new Set,r=t._nodes.filter(J_);for(const i of r)e:for(const s of[i].concat(Xv(i,void 0)))if(s.always){for(const l of s.always)if(l.guard===void 0||Jv(l.guard,t.context,e,t)){n.add(l);break e}}return KM(Array.from(n),new Set(t._nodes),t.historyValue)}function vZ(t,e){const n=H0($0(t,e));return $M(t,[...n])}function gZ(t){return!!t&&typeof t=="object"&&"machine"in t&&"value"in t}const yZ=function(e){return LM(e,this.value)},bZ=function(e){return this.tags.has(e)},SZ=function(e){const n=this.machine.getTransitionData(this,e);return!!(n!=null&&n.length)&&n.some(r=>r.target!==void 0||r.actions.length)},EZ=function(){const{_nodes:e,tags:n,machine:r,getMeta:i,toJSON:s,can:l,hasTag:u,matches:d,...h}=this;return{...h,tags:Array.from(n)}},CZ=function(){return this._nodes.reduce((e,n)=>(n.meta!==void 0&&(e[n.id]=n.meta),e),{})};function W0(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:$M(e.root,t._nodes),tags:new Set(t._nodes.flatMap(n=>n.tags)),children:t.children,historyValue:t.historyValue||{},matches:yZ,hasTag:bZ,can:SZ,getMeta:CZ,toJSON:EZ}}function Gf(t,e={}){return W0({...t,...e},t.machine)}function _Z(t){if(typeof t!="object"||t===null)return{};const e={};for(const n in t){const r=t[n];Array.isArray(r)&&(e[n]=r.map(i=>({id:i.id})))}return e}function xZ(t,e){const{_nodes:n,tags:r,machine:i,children:s,context:l,can:u,hasTag:d,matches:h,getMeta:m,toJSON:g,...y}=t,b={};for(const w in s){const _=s[w];b[w]={snapshot:_.getPersistedSnapshot(e),src:_.src,systemId:_.systemId,syncSnapshot:_._syncSnapshot}}return{...y,context:tD(l),children:b,historyValue:_Z(y.historyValue)}}function tD(t){let e;for(const n in t){const r=t[n];if(r&&typeof r=="object")if("sessionId"in r&&"send"in r&&"ref"in r)e??(e=Array.isArray(t)?t.slice():{...t}),e[n]={xstate$$type:K_,id:r.id};else{const i=tD(r);i!==r&&(e??(e=Array.isArray(t)?t.slice():{...t}),e[n]=i)}}return e??t}function wZ(t,e,n,r,{event:i,id:s,delay:l},{internalQueue:u}){const d=e.machine.implementations.delays;if(typeof i=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);const h=typeof i=="function"?i(n,r):i;let m;if(typeof l=="string"){const g=d&&d[l];m=typeof g=="function"?g(n,r):g}else m=typeof l=="function"?l(n,r):l;return typeof m!="number"&&u.push(h),[e,{event:h,id:s,delay:m},void 0]}function TZ(t,e){const{event:n,delay:r,id:i}=e;if(typeof r=="number"){t.defer(()=>{const s=t.self;t.system.scheduler.schedule(s,s,n,r,i)});return}}function ox(t,e){function n(r,i){}return n.type="xstate.raise",n.event=t,n.id=e==null?void 0:e.id,n.delay=e==null?void 0:e.delay,n.resolve=wZ,n.execute=TZ,n}const nD="xstate.promise.resolve",rD="xstate.promise.reject",e1=new WeakMap;function t1(t){return{config:t,transition:(n,r,i)=>{var s;if(n.status!=="active")return n;switch(r.type){case nD:{const l=r.data;return{...n,status:"done",output:l,input:void 0}}case rD:return{...n,status:"error",error:r.data,input:void 0};case V0:return(s=e1.get(i.self))==null||s.abort(),e1.delete(i.self),{...n,status:"stopped",input:void 0};default:return n}},start:(n,{self:r,system:i,emit:s})=>{if(n.status!=="active")return;const l=new AbortController;e1.set(r,l),Promise.resolve(t({input:n.input,system:i,self:r,signal:l.signal,emit:s})).then(d=>{r.getSnapshot().status==="active"&&(e1.delete(r),i._relay(r,r,{type:nD,data:d}))},d=>{r.getSnapshot().status==="active"&&(e1.delete(r),i._relay(r,r,{type:rD,data:d}))})},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,input:r}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}function AZ(t,{machine:e,context:n},r,i){const s=(l,u)=>{if(typeof l=="string"){const d=G_(e,l);if(!d)throw new Error(`Actor logic '${l}' not implemented in machine '${e.id}'`);const h=Wh(d,{id:u==null?void 0:u.id,parent:t.self,syncSnapshot:u==null?void 0:u.syncSnapshot,input:typeof(u==null?void 0:u.input)=="function"?u.input({context:n,event:r,self:t.self}):u==null?void 0:u.input,src:l,systemId:u==null?void 0:u.systemId});return i[h.id]=h,h}else return Wh(l,{id:u==null?void 0:u.id,parent:t.self,syncSnapshot:u==null?void 0:u.syncSnapshot,input:u==null?void 0:u.input,src:l,systemId:u==null?void 0:u.systemId})};return(l,u)=>{const d=s(l,u);return i[d.id]=d,t.defer(()=>{d._processingStatus!==No.Stopped&&d.start()}),d}}function RZ(t,e,n,r,{assignment:i}){if(!e.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const s={},l={context:e.context,event:n.event,spawn:AZ(t,e,n.event,s),self:t.self,system:t.system};let u={};if(typeof i=="function")u=i(l,r);else for(const h of Object.keys(i)){const m=i[h];u[h]=typeof m=="function"?m(l,r):m}const d=Object.assign({},e.context,u);return[Gf(e,{context:d,children:Object.keys(s).length?{...e.children,...s}:e.children}),void 0,void 0]}function on(t){function e(n,r){}return e.type="xstate.assign",e.assignment=t,e.resolve=RZ,e}const iD=new WeakMap;function Zh(t,e,n){let r=iD.get(t);return r?e in r||(r[e]=n()):(r={[e]:n()},iD.set(t,r)),r[e]}const kZ={},n1=t=>typeof t=="string"?{type:t}:typeof t=="function"?"resolve"in t?{type:t.type}:{type:t.name}:t;class G0{constructor(e,n){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(kM),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?IM(this.config.states,(r,i)=>new G0(r,{_parent:this,_key:i,_machine:this.machine})):kZ,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=sc(this.config.entry).slice(),this.exit=sc(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=sc(e.tags).slice()}_initialize(){this.transitions=JQ(this),this.config.always&&(this.always=$h(this.config.always).map(e=>lc(this,OM,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(n1),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(n1),eventType:null})}:void 0,history:this.history,states:IM(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(n1)})),entry:this.entry.map(n1),exit:this.exit.map(n1),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Zh(this,"invoke",()=>sc(this.config.invoke).map((e,n)=>{const{src:r,systemId:i}=e,s=e.id??UM(this.id,n),l=typeof r=="string"?r:`xstate.invoke.${UM(this.id,n)}`;return{...e,src:l,id:s,systemId:i,toJSON(){const{onDone:u,onError:d,...h}=e;return{...h,type:"xstate.invoke",src:l,id:s}}}}))}get on(){return Zh(this,"on",()=>[...this.transitions].flatMap(([n,r])=>r.map(i=>[n,i])).reduce((n,[r,i])=>(n[r]=n[r]||[],n[r].push(i),n),{}))}get after(){return Zh(this,"delayedTransitions",()=>ZQ(this))}get initial(){return Zh(this,"initial",()=>eZ(this,this.config.initial))}next(e,n){const r=n.type,i=[];let s;const l=Zh(this,`candidates-${r}`,()=>QQ(this,r));for(const u of l){const{guard:d}=u,h=e.context;let m=!1;try{m=!d||Jv(d,h,n,e)}catch(g){const y=typeof d=="string"?d:typeof d=="object"?d.type:void 0;throw new Error(`Unable to evaluate guard ${y?`'${y}' `:""}in transition for event '${r}' in state node '${this.id}':
1096
+ ${s.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function WM(t){const e=VM(t.config.target);return e?{target:e.map(n=>typeof n=="string"?q0(t.parent,n):n)}:t.parent.type==="parallel"?{target:[t.parent]}:t.parent.initial}function Wf(t){return t.type==="history"}function GM(t){const e=YM(t);for(const n of e)for(const r of Xv(n,t))e.add(r);return e}function YM(t){const e=new Set;function n(r){if(!e.has(r)){if(e.add(r),r.type==="compound")n(r.initial.target[0]);else if(r.type==="parallel")for(const i of Gh(r))n(i)}}return n(t),e}function Yh(t,e){if(B0(e))return t.machine.getStateNodeById(e);if(!t.states)throw new Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);const n=t.states[e];if(!n)throw new Error(`Child state '${e}' does not exist on '${t.id}'`);return n}function q0(t,e){if(typeof e=="string"&&B0(e))try{return t.machine.getStateNodeById(e)}catch{}const n=$_(e).slice();let r=t;for(;n.length;){const i=n.shift();if(!i.length)break;r=Yh(r,i)}return r}function $0(t,e){if(typeof e=="string"){const i=t.states[e];if(!i)throw new Error(`State '${e}' does not exist on '${t.id}'`);return[t,i]}const n=Object.keys(e),r=n.map(i=>Yh(t,i)).filter(Boolean);return[t.machine.root,t].concat(r,n.reduce((i,s)=>{const l=Yh(t,s);if(!l)return i;const u=$0(l,e[s]);return i.concat(u)},[]))}function nZ(t,e,n,r){const s=Yh(t,e).next(n,r);return!s||!s.length?t.next(n,r):s}function rZ(t,e,n,r){const i=Object.keys(e),s=Yh(t,i[0]),l=ex(s,e[i[0]],n,r);return!l||!l.length?t.next(n,r):l}function iZ(t,e,n,r){const i=[];for(const s of Object.keys(e)){const l=e[s];if(!l)continue;const u=Yh(t,s),d=ex(u,l,n,r);d&&i.push(...d)}return i.length?i:t.next(n,r)}function ex(t,e,n,r){return typeof e=="string"?nZ(t,e,n,r):Object.keys(e).length===1?rZ(t,e,n,r):iZ(t,e,n,r)}function aZ(t){return Object.keys(t.states).map(e=>t.states[e]).filter(e=>e.type==="history")}function uc(t,e){let n=t;for(;n.parent&&n.parent!==e;)n=n.parent;return n.parent===e}function oZ(t,e){const n=new Set(t),r=new Set(e);for(const i of n)if(r.has(i))return!0;for(const i of r)if(n.has(i))return!0;return!1}function KM(t,e,n){const r=new Set;for(const i of t){let s=!1;const l=new Set;for(const u of r)if(oZ(nx([i],e,n),nx([u],e,n)))if(uc(i.source,u.source))l.add(u);else{s=!0;break}if(!s){for(const u of l)r.delete(u);r.add(i)}}return Array.from(r)}function sZ(t){const[e,...n]=t;for(const r of Xv(e,void 0))if(n.every(i=>uc(i,r)))return r}function tx(t,e){if(!t.target)return[];const n=new Set;for(const r of t.target)if(Wf(r))if(e[r.id])for(const i of e[r.id])n.add(i);else for(const i of tx(WM(r),e))n.add(i);else n.add(r);return[...n]}function QM(t,e){const n=tx(t,e);if(!n)return;if(!t.reenter&&n.every(i=>i===t.source||uc(i,t.source)))return t.source;const r=sZ(n.concat(t.source));if(r)return r;if(!t.reenter)return t.source.machine.root}function nx(t,e,n){var i;const r=new Set;for(const s of t)if((i=s.target)!=null&&i.length){const l=QM(s,n);s.reenter&&s.source===l&&r.add(l);for(const u of e)uc(u,l)&&r.add(u)}return[...r]}function lZ(t,e){if(t.length!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function uZ(t,e,n,r,i){return rx([{target:[...YM(t)],source:t,reenter:!0,actions:[],eventType:null,toJSON:null}],e,n,r,!0,i)}function rx(t,e,n,r,i,s){const l=[];if(!t.length)return[e,l];const u=n.actionExecutor;n.actionExecutor=d=>{l.push(d),u(d)};try{const d=new Set(e._nodes);let h=e.historyValue;const m=KM(t,d,h);let g=e;i||([g,h]=hZ(g,r,n,m,d,h,s,n.actionExecutor)),g=Qh(g,r,n,m.flatMap(b=>b.actions),s,void 0),g=fZ(g,r,n,m,d,s,h,i);const y=[...d];g.status==="done"&&(g=Qh(g,r,n,y.sort((b,C)=>C.order-b.order).flatMap(b=>b.exit),s,void 0));try{return h===e.historyValue&&lZ(e._nodes,d)?[g,l]:[Gf(g,{_nodes:y,historyValue:h}),l]}catch(b){throw b}}finally{n.actionExecutor=u}}function cZ(t,e,n,r,i){if(r.output===void 0)return;const s=q_(i.id,i.output!==void 0&&i.parent?W_(i.output,t.context,e,n.self):void 0);return W_(r.output,t.context,s,n.self)}function fZ(t,e,n,r,i,s,l,u){let d=t;const h=new Set,m=new Set;dZ(r,l,m,h),u&&m.add(t.machine.root);const g=new Set;for(const y of[...h].sort((b,C)=>b.order-C.order)){i.add(y);const b=[];b.push(...y.entry);for(const C of y.invoke)b.push(Z_(C.src,{...C,syncSnapshot:!!C.onSnapshot}));if(m.has(y)){const C=y.initial.actions;b.push(...C)}if(d=Qh(d,e,n,b,s,y.invoke.map(C=>C.id)),y.type==="final"){const C=y.parent;let w=(C==null?void 0:C.type)==="parallel"?C:C==null?void 0:C.parent,_=w||y;for((C==null?void 0:C.type)==="compound"&&s.push(q_(C.id,y.output!==void 0?W_(y.output,d.context,e,n.self):void 0));(w==null?void 0:w.type)==="parallel"&&!g.has(w)&&X_(i,w);)g.add(w),s.push(q_(w.id)),_=w,w=w.parent;if(w)continue;d=Gf(d,{status:"done",output:cZ(d,e,n,d.machine.root,_)})}}return d}function dZ(t,e,n,r){for(const i of t){const s=QM(i,e);for(const u of i.target||[])!Wf(u)&&(i.source!==u||i.source!==s||i.reenter)&&(r.add(u),n.add(u)),Kh(u,e,n,r);const l=tx(i,e);for(const u of l){const d=Xv(u,s);(s==null?void 0:s.type)==="parallel"&&d.push(s),ZM(r,e,n,d,!i.source.parent&&i.reenter?void 0:s)}}}function Kh(t,e,n,r){var i;if(Wf(t))if(e[t.id]){const s=e[t.id];for(const l of s)r.add(l),Kh(l,e,n,r);for(const l of s)ix(l,t.parent,r,e,n)}else{const s=WM(t);for(const l of s.target)r.add(l),s===((i=t.parent)==null?void 0:i.initial)&&n.add(t.parent),Kh(l,e,n,r);for(const l of s.target)ix(l,t.parent,r,e,n)}else if(t.type==="compound"){const[s]=t.initial.target;Wf(s)||(r.add(s),n.add(s)),Kh(s,e,n,r),ix(s,t,r,e,n)}else if(t.type==="parallel")for(const s of Gh(t).filter(l=>!Wf(l)))[...r].some(l=>uc(l,s))||(Wf(s)||(r.add(s),n.add(s)),Kh(s,e,n,r))}function ZM(t,e,n,r,i){for(const s of r)if((!i||uc(s,i))&&t.add(s),s.type==="parallel")for(const l of Gh(s).filter(u=>!Wf(u)))[...t].some(u=>uc(u,l))||(t.add(l),Kh(l,e,n,t))}function ix(t,e,n,r,i){ZM(n,r,i,Xv(t,e))}function hZ(t,e,n,r,i,s,l,u){let d=t;const h=nx(r,i,s);h.sort((g,y)=>y.order-g.order);let m;for(const g of h)for(const y of aZ(g)){let b;y.history==="deep"?b=C=>J_(C)&&uc(C,g):b=C=>C.parent===g,m??(m={...s}),m[y.id]=Array.from(i).filter(b)}for(const g of h)d=Qh(d,e,n,[...g.exit,...g.invoke.map(y=>z0(y.id))],l,void 0),i.delete(g);return[d,m||s]}function pZ(t,e){return t.implementations.actions[e]}function JM(t,e,n,r,i,s){const{machine:l}=t;let u=t;for(const d of r){const h=typeof d=="function",m=h?d:pZ(l,typeof d=="string"?d:d.type),g={context:u.context,event:e,self:n.self,system:n.system},y=h||typeof d=="string"?void 0:"params"in d?typeof d.params=="function"?d.params({context:u.context,event:e}):d.params:void 0;if(!m||!("resolve"in m)){n.actionExecutor({type:typeof d=="string"?d:typeof d=="object"?d.type:d.name||"(anonymous)",info:g,params:y,exec:m});continue}const b=m,[C,w,_]=b.resolve(n,u,g,y,m,i);u=C,"retryResolve"in b&&(s==null||s.push([b,w])),"execute"in b&&n.actionExecutor({type:b.type,info:g,params:w,exec:b.execute.bind(null,n,w)}),_&&(u=JM(u,e,n,_,i,s))}return u}function Qh(t,e,n,r,i,s){const l=s?[]:void 0,u=JM(t,e,n,r,{internalQueue:i,deferredActorIds:s},l);return l==null||l.forEach(([d,h])=>{d.retryResolve(n,u,h)}),u}function ax(t,e,n,r){var g;let i=t;const s=[];function l(y,b,C){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:b,snapshot:y[0],_transitions:C}),s.push(y)}if(e.type===V0)return i=Gf(XM(i,e,n),{status:"stopped"}),l([i,[]],e,[]),{snapshot:i,microsteps:s};let u=e;if(u.type!==NM){const y=u,b=IQ(y),C=eD(y,i);if(b&&!C.length)return i=Gf(t,{status:"error",error:y.error}),l([i,[]],y,[]),{snapshot:i,microsteps:s};const w=rx(C,t,n,u,!1,r);i=w[0],l(w,y,C)}let d=!0;const h=((g=t.machine.options)==null?void 0:g.maxIterations)??1/0;let m=0;for(;i.status==="active";){if(m++,m>h)throw new Error(`Infinite loop detected: the machine has processed more than ${h} microsteps without reaching a stable state. This usually happens when there's a cycle of transitions (e.g., eventless transitions or raised events causing state A -> B -> C -> A).`);let y=d?mZ(i,u):[];const b=y.length?i:void 0;if(!y.length){if(!r.length)break;u=r.shift(),y=eD(u,i)}const C=rx(y,i,n,u,!1,r);i=C[0],d=i!==b,l(C,u,y)}return i.status!=="active"&&XM(i,u,n),{snapshot:i,microsteps:s}}function XM(t,e,n){return Qh(t,e,n,Object.values(t.children).map(r=>z0(r)),[],void 0)}function eD(t,e){return e.machine.getTransitionData(e,t)}function mZ(t,e){const n=new Set,r=t._nodes.filter(J_);for(const i of r)e:for(const s of[i].concat(Xv(i,void 0)))if(s.always){for(const l of s.always)if(l.guard===void 0||Jv(l.guard,t.context,e,t)){n.add(l);break e}}return KM(Array.from(n),new Set(t._nodes),t.historyValue)}function vZ(t,e){const n=H0($0(t,e));return $M(t,[...n])}function gZ(t){return!!t&&typeof t=="object"&&"machine"in t&&"value"in t}const yZ=function(e){return LM(e,this.value)},bZ=function(e){return this.tags.has(e)},SZ=function(e){const n=this.machine.getTransitionData(this,e);return!!(n!=null&&n.length)&&n.some(r=>r.target!==void 0||r.actions.length)},EZ=function(){const{_nodes:e,tags:n,machine:r,getMeta:i,toJSON:s,can:l,hasTag:u,matches:d,...h}=this;return{...h,tags:Array.from(n)}},CZ=function(){return this._nodes.reduce((e,n)=>(n.meta!==void 0&&(e[n.id]=n.meta),e),{})};function W0(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:$M(e.root,t._nodes),tags:new Set(t._nodes.flatMap(n=>n.tags)),children:t.children,historyValue:t.historyValue||{},matches:yZ,hasTag:bZ,can:SZ,getMeta:CZ,toJSON:EZ}}function Gf(t,e={}){return W0({...t,...e},t.machine)}function _Z(t){if(typeof t!="object"||t===null)return{};const e={};for(const n in t){const r=t[n];Array.isArray(r)&&(e[n]=r.map(i=>({id:i.id})))}return e}function xZ(t,e){const{_nodes:n,tags:r,machine:i,children:s,context:l,can:u,hasTag:d,matches:h,getMeta:m,toJSON:g,...y}=t,b={};for(const w in s){const _=s[w];b[w]={snapshot:_.getPersistedSnapshot(e),src:_.src,systemId:_.systemId,syncSnapshot:_._syncSnapshot}}return{...y,context:tD(l),children:b,historyValue:_Z(y.historyValue)}}function tD(t){let e;for(const n in t){const r=t[n];if(r&&typeof r=="object")if("sessionId"in r&&"send"in r&&"ref"in r)e??(e=Array.isArray(t)?t.slice():{...t}),e[n]={xstate$$type:K_,id:r.id};else{const i=tD(r);i!==r&&(e??(e=Array.isArray(t)?t.slice():{...t}),e[n]=i)}}return e??t}function wZ(t,e,n,r,{event:i,id:s,delay:l},{internalQueue:u}){const d=e.machine.implementations.delays;if(typeof i=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);const h=typeof i=="function"?i(n,r):i;let m;if(typeof l=="string"){const g=d&&d[l];m=typeof g=="function"?g(n,r):g}else m=typeof l=="function"?l(n,r):l;return typeof m!="number"&&u.push(h),[e,{event:h,id:s,delay:m},void 0]}function TZ(t,e){const{event:n,delay:r,id:i}=e;if(typeof r=="number"){t.defer(()=>{const s=t.self;t.system.scheduler.schedule(s,s,n,r,i)});return}}function ox(t,e){function n(r,i){}return n.type="xstate.raise",n.event=t,n.id=e==null?void 0:e.id,n.delay=e==null?void 0:e.delay,n.resolve=wZ,n.execute=TZ,n}const nD="xstate.promise.resolve",rD="xstate.promise.reject",e1=new WeakMap;function t1(t){return{config:t,transition:(n,r,i)=>{var s;if(n.status!=="active")return n;switch(r.type){case nD:{const l=r.data;return{...n,status:"done",output:l,input:void 0}}case rD:return{...n,status:"error",error:r.data,input:void 0};case V0:return(s=e1.get(i.self))==null||s.abort(),e1.delete(i.self),{...n,status:"stopped",input:void 0};default:return n}},start:(n,{self:r,system:i,emit:s})=>{if(n.status!=="active")return;const l=new AbortController;e1.set(r,l),Promise.resolve(t({input:n.input,system:i,self:r,signal:l.signal,emit:s})).then(d=>{r.getSnapshot().status==="active"&&(e1.delete(r),i._relay(r,r,{type:nD,data:d}))},d=>{r.getSnapshot().status==="active"&&(e1.delete(r),i._relay(r,r,{type:rD,data:d}))})},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,input:r}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}function AZ(t,{machine:e,context:n},r,i){const s=(l,u)=>{if(typeof l=="string"){const d=G_(e,l);if(!d)throw new Error(`Actor logic '${l}' not implemented in machine '${e.id}'`);const h=Wh(d,{id:u==null?void 0:u.id,parent:t.self,syncSnapshot:u==null?void 0:u.syncSnapshot,input:typeof(u==null?void 0:u.input)=="function"?u.input({context:n,event:r,self:t.self}):u==null?void 0:u.input,src:l,systemId:u==null?void 0:u.systemId});return i[h.id]=h,h}else return Wh(l,{id:u==null?void 0:u.id,parent:t.self,syncSnapshot:u==null?void 0:u.syncSnapshot,input:u==null?void 0:u.input,src:l,systemId:u==null?void 0:u.systemId})};return(l,u)=>{const d=s(l,u);return i[d.id]=d,t.defer(()=>{d._processingStatus!==No.Stopped&&d.start()}),d}}function RZ(t,e,n,r,{assignment:i}){if(!e.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const s={},l={context:e.context,event:n.event,spawn:AZ(t,e,n.event,s),self:t.self,system:t.system};let u={};if(typeof i=="function")u=i(l,r);else for(const h of Object.keys(i)){const m=i[h];u[h]=typeof m=="function"?m(l,r):m}const d=Object.assign({},e.context,u);return[Gf(e,{context:d,children:Object.keys(s).length?{...e.children,...s}:e.children}),void 0,void 0]}function on(t){function e(n,r){}return e.type="xstate.assign",e.assignment=t,e.resolve=RZ,e}const iD=new WeakMap;function Zh(t,e,n){let r=iD.get(t);return r?e in r||(r[e]=n()):(r={[e]:n()},iD.set(t,r)),r[e]}const kZ={},n1=t=>typeof t=="string"?{type:t}:typeof t=="function"?"resolve"in t?{type:t.type}:{type:t.name}:t;class G0{constructor(e,n){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(kM),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?IM(this.config.states,(r,i)=>new G0(r,{_parent:this,_key:i,_machine:this.machine})):kZ,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=sc(this.config.entry).slice(),this.exit=sc(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=sc(e.tags).slice()}_initialize(){this.transitions=JQ(this),this.config.always&&(this.always=$h(this.config.always).map(e=>lc(this,OM,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(n1),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(n1),eventType:null})}:void 0,history:this.history,states:IM(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(n1)})),entry:this.entry.map(n1),exit:this.exit.map(n1),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Zh(this,"invoke",()=>sc(this.config.invoke).map((e,n)=>{const{src:r,systemId:i}=e,s=e.id??UM(this.id,n),l=typeof r=="string"?r:`xstate.invoke.${UM(this.id,n)}`;return{...e,src:l,id:s,systemId:i,toJSON(){const{onDone:u,onError:d,...h}=e;return{...h,type:"xstate.invoke",src:l,id:s}}}}))}get on(){return Zh(this,"on",()=>[...this.transitions].flatMap(([n,r])=>r.map(i=>[n,i])).reduce((n,[r,i])=>(n[r]=n[r]||[],n[r].push(i),n),{}))}get after(){return Zh(this,"delayedTransitions",()=>ZQ(this))}get initial(){return Zh(this,"initial",()=>eZ(this,this.config.initial))}next(e,n){const r=n.type,i=[];let s;const l=Zh(this,`candidates-${r}`,()=>QQ(this,r));for(const u of l){const{guard:d}=u,h=e.context;let m=!1;try{m=!d||Jv(d,h,n,e)}catch(g){const y=typeof d=="string"?d:typeof d=="object"?d.type:void 0;throw new Error(`Unable to evaluate guard ${y?`'${y}' `:""}in transition for event '${r}' in state node '${this.id}':
1097
1097
  ${g.message}`)}if(m){i.push(...u.actions),s=u;break}}return s?[s]:void 0}get events(){return Zh(this,"events",()=>{const{states:e}=this,n=new Set(this.ownEvents);if(e)for(const r of Object.keys(e)){const i=e[r];if(i.states)for(const s of i.events)n.add(`${s}`)}return Array.from(n)})}get ownEvents(){const e=Object.keys(Object.fromEntries(this.transitions)),n=new Set(e.filter(r=>this.transitions.get(r).some(i=>!(!i.target&&!i.actions.length&&!i.reenter))));return Array.from(n)}}const OZ="#";class sx{constructor(e,n){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.options=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:(n==null?void 0:n.actors)??{},actions:(n==null?void 0:n.actions)??{},delays:(n==null?void 0:n.delays)??{},guards:(n==null?void 0:n.guards)??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.options={maxIterations:1/0,...this.config.options},this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new G0(e,{_key:this.id,_machine:this}),this.root._initialize(),XQ(this.root),this.states=this.root.states,this.events=this.root.events}provide(e){const{actions:n,guards:r,actors:i,delays:s}=this.implementations;return new sx(this.config,{actions:{...n,...e.actions},guards:{...r,...e.guards},actors:{...i,...e.actors},delays:{...s,...e.delays}})}resolveState(e){const n=vZ(this.root,e.value),r=H0($0(this.root,n));return W0({_nodes:[...r],context:e.context||{},children:{},status:X_(r,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,n,r){return ax(e,n,r,[]).snapshot}microstep(e,n,r){return ax(e,n,r,[]).microsteps.map(([i])=>i)}getTransitionData(e,n){return ex(this.root,e.value,e,n)||[]}_getPreInitialState(e,n,r){const{context:i}=this.config,s=W0({context:typeof i!="function"&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return typeof i=="function"?Qh(s,n,e,[on(({spawn:u,event:d,self:h})=>i({spawn:u,input:d.input,self:h}))],r,void 0):s}getInitialSnapshot(e,n){const r=DM(n),i=[],s=this._getPreInitialState(e,r,i),[l]=uZ(this.root,s,e,r,i),{snapshot:u}=ax(l,r,e,i);return u}start(e){Object.values(e.children).forEach(n=>{n.getSnapshot().status==="active"&&n.start()})}getStateNodeById(e){const n=$_(e),r=n.slice(1),i=B0(n[0])?n[0].slice(OZ.length):n[0],s=this.idMap.get(i);if(!s)throw new Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);return q0(s,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,n){return xZ(e,n)}restoreSnapshot(e,n){const r={},i=e.children;Object.keys(i).forEach(g=>{const y=i[g],b=y.snapshot,C=y.src,w=typeof C=="string"?G_(this,C):C;if(!w)return;const _=Wh(w,{id:g,parent:n.self,syncSnapshot:y.syncSnapshot,snapshot:b,src:C,systemId:y.systemId});r[g]=_});function s(g,y){if(y instanceof G0)return y;try{return g.machine.getStateNodeById(y.id)}catch{}}function l(g,y){if(!y||typeof y!="object")return{};const b={};for(const C in y){const w=y[C];for(const _ of w){const R=s(g,_);R&&(b[C]??(b[C]=[]),b[C].push(R))}}return b}const u=l(this.root,e.historyValue),d=W0({...e,children:r,_nodes:Array.from(H0($0(this.root,e.value))),historyValue:u},this),h=new Set;function m(g,y){if(!h.has(g)){h.add(g);for(const b in g){const C=g[b];if(C&&typeof C=="object"){if("xstate$$type"in C&&C.xstate$$type===K_){g[b]=y[C.id];continue}m(C,y)}}}}return m(d.context,r),d}}function NZ(t,e,n,r,{event:i}){const s=typeof i=="function"?i(n,r):i;return[e,{event:s},void 0]}function MZ(t,{event:e}){t.defer(()=>t.emit(e))}function aD(t){function e(n,r){}return e.type="xstate.emit",e.event=t,e.resolve=NZ,e.execute=MZ,e}let lx=(function(t){return t.Parent="#_parent",t.Internal="#_internal",t})({});function DZ(t,e,n,r,{to:i,event:s,id:l,delay:u},d){var C;const h=e.machine.implementations.delays;if(typeof s=="string")throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${s}" }) instead`);const m=typeof s=="function"?s(n,r):s;let g;if(typeof u=="string"){const w=h&&h[u];g=typeof w=="function"?w(n,r):w}else g=typeof u=="function"?u(n,r):u;const y=typeof i=="function"?i(n,r):i;let b;if(typeof y=="string"){if(y===lx.Parent?b=t.self._parent:y===lx.Internal?b=t.self:y.startsWith("#_")?b=e.children[y.slice(2)]:b=(C=d.deferredActorIds)!=null&&C.includes(y)?y:e.children[y],!b)throw new Error(`Unable to send event to actor '${y}' from machine '${e.machine.id}'.`)}else b=y||t.self;return[e,{to:b,targetId:typeof y=="string"?y:void 0,event:m,id:l,delay:g},void 0]}function LZ(t,e,n){typeof n.to=="string"&&(n.to=e.children[n.to])}function PZ(t,e){t.defer(()=>{const{to:n,event:r,delay:i,id:s}=e;if(typeof i=="number"){t.system.scheduler.schedule(t.self,n,r,i,s);return}t.system._relay(t.self,n,r.type===NQ?MM(t.self.id,r.data):r)})}function ux(t,e,n){function r(i,s){}return r.type="xstate.sendTo",r.to=t,r.event=e,r.id=n==null?void 0:n.id,r.delay=n==null?void 0:n.delay,r.resolve=DZ,r.retryResolve=LZ,r.execute=PZ,r}function IZ(t,e){return ux(lx.Parent,t,e)}function FZ(t,e,n,r,{collect:i}){const s=[],l=function(d){s.push(d)};return l.assign=(...u)=>{s.push(on(...u))},l.cancel=(...u)=>{s.push(Q_(...u))},l.raise=(...u)=>{s.push(ox(...u))},l.sendTo=(...u)=>{s.push(ux(...u))},l.sendParent=(...u)=>{s.push(IZ(...u))},l.spawnChild=(...u)=>{s.push(Z_(...u))},l.stopChild=(...u)=>{s.push(z0(...u))},l.emit=(...u)=>{s.push(aD(...u))},i({context:n.context,event:n.event,enqueue:l,check:u=>Jv(u,e.context,n.event,e),self:t.self,system:t.system},r),[e,void 0,s]}function jZ(t){function e(n,r){}return e.type="xstate.enqueueActions",e.collect=t,e.resolve=FZ,e}function VZ(t,e,n,r,{value:i,label:s}){return[e,{value:typeof i=="function"?i(n,r):i,label:s},void 0]}function UZ({logger:t},{value:e,label:n}){n?t(n,e):t(e)}function zZ(t=({context:n,event:r})=>({context:n,event:r}),e){function n(r,i){}return n.type="xstate.log",n.value=t,n.label=e,n.resolve=VZ,n.execute=UZ,n}function HZ(t,e){return new sx(t,e)}function cx({schemas:t,actors:e,actions:n,guards:r,delays:i}){return{assign:on,sendTo:ux,raise:ox,log:zZ,cancel:Q_,stopChild:z0,enqueueActions:jZ,emit:aD,spawnChild:Z_,createStateConfig:s=>s,createAction:s=>s,createMachine:s=>HZ({...s,schemas:t},{actors:e,actions:n,guards:r,delays:i}),extend:s=>cx({schemas:t,actors:e,actions:{...n,...s.actions},guards:{...r,...s.guards},delays:{...i,...s.delays}})}}var fx={exports:{}},dx={exports:{}},hx={},oD;function BZ(){if(oD)return hx;oD=1;/**
1098
1098
  * @license React
1099
1099
  * use-sync-external-store-shim.development.js
@@ -1817,7 +1817,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1817
1817
  <p className="ed-text-border-regular ed-whitespace-pre-line">${e}</p>
1818
1818
  </div>
1819
1819
  ${r}
1820
- </div>`},xV={ANGRY:T.jsx(Ite,{}),SAD:T.jsx(Vte,{}),NEUTRAL:T.jsx(Fte,{}),HAPPY:T.jsx(jte,{}),LOVE:T.jsx(Ute,{})},oce="data:image/png;base64,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",sce=({surveyData:t,onClose:e,onSubmit:n,isSubmitting:r=!1})=>{var te;const[i,s]=D.useState(!1),[l,u]=D.useState(null),[d,h]=D.useState(null),[m,g]=D.useState(""),y=(t==null?void 0:t.title)||"How was your support experience?",b=(t==null?void 0:t.description)||"",C=(t==null?void 0:t.is_description_enabled)||!1,w=(t==null?void 0:t.active_rating_type)||"numeric",_=(t==null?void 0:t.is_optional_question_enabled)||!1,R=(t==null?void 0:t.is_open_ended_question_enabled)||!1,k=(t==null?void 0:t.optional_question_title)||"We're sorry to hear that. Could you share what didn't go well?",L=(t==null?void 0:t.optional_question_options)||[],N=(t==null?void 0:t.open_ended_question_title)||"Share your thoughts on the support you received",A=((te=t==null?void 0:t.rating_types)==null?void 0:te.filter(X=>X.rating_type===w).sort((X,ne)=>ne.score-X.score))||[],P=X=>{u(X)},F=X=>{h(ne=>ne===X?null:X)},U=async()=>{if(!l||!n)return;const X={satisfaction_rating_type_id:l.id,optional_question_responses:d?[typeof d=="string"?d:d.label]:null,open_ended_question_response:(m==null?void 0:m.trim())||null};try{if(await n(X)===!1){ii("error","We could not submit your feedback. Please try again.","top-left");return}s(!0)}catch{ii("error","We could not submit your feedback. Please try again.","top-left")}},$=()=>{e&&e()},K=()=>w==="numeric"?T.jsx("div",{className:"ed-flex ed-gap-2 ed-flex-wrap ed-justify-between",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:"ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-flex-1",children:[T.jsx("div",{className:Ei("ed-w-10 ed-h-10 ed-flex ed-items-center ed-justify-center ed-rounded ed-text-14 ed-border ed-transition-colors",ne?"ed-bg-brand-light ed-text-brand ed-border-brand":"ed-bg-gray ed-text-border-dark ed-border-[#8F99AD]"),children:X.numeric_value}),T.jsx("span",{className:Ei("ed-text-10 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="emoji"?T.jsx("div",{className:"ed-flex ed-justify-between ed-gap-3 ",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:Ei("ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-min-w-[60px]"),children:[T.jsx("div",{className:Ei("ed-text-24 ed-flex ed-justify-center ed-items-center hover:ed-scale-110 ed-size-10 ed-transition-transform",ne?"ed-border ed-rounded-md ed-bg-brand-light ed-border-brand":"ed-text-border-dark"),children:xV[X.emoji]&&xV[X.emoji]}),T.jsx("span",{className:Ei("ed-text-12 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="custom_text"?T.jsx("div",{className:"ed-flex ed-flex-col ed-gap-3 ed-w-full ed-max-w-[280px] ed-mx-auto",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsx("button",{type:"button",onClick:()=>P(X),className:Ei("ed-w-full ed-py-3 ed-px-4 ed-border ed-border-regular hover:ed-border-brand hover:ed-bg-white-light ed-rounded-[20px] ed-text-14 ed-font-medium ed-text-border-dark ed-transition-all",ne?"ed-border-brand ed-bg-brand-light":"ed-border-regular ed-bg-white"),children:X.label},X.id)})}):null;return i?T.jsxs("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center ed-text-center ed-px-4 ed-py-8 ed-pt-16 ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsx("h3",{className:"ed-text-18 ed-font-semibold ed-text-border-dark ed-px-9",children:"Thank you for sharing your experience with us."}),T.jsx("div",{className:"ed-w-40 ed-h-auto ed-my-12",children:T.jsx(Mo,{src:oce,width:600,height:451,className:"ed-h-[140px] ed-w-fit",alt:"Thank you"})})]}):T.jsxs("div",{className:"ed-border-border-light ed-bg-white ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsxs("div",{className:"ed-px-5 ed-py-4 ed-pb-6",children:[T.jsx("h3",{className:"ed-text-16 ed-font-semibold ed-text-border-dark ed-mb-3 ed-text-center ed-pr-6",children:y}),C&&b&&T.jsx("p",{className:"ed-text-14 ed-text-border-regular ed-mb-4 ed-text-center",children:b}),T.jsx("div",{className:"ed-py-2",children:K()}),l&&l.score<=2&&_&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-medium ed-text-border-dark ed-mb-4 ed-text-center",children:k}),T.jsx("div",{className:"ed-flex ed-flex-wrap ed-gap-2 ed-justify-center",children:L.map((X,ne)=>T.jsx("button",{type:"button",onClick:()=>F(X),className:Ei("ed-py-1.5 ed-px-4 ed-rounded-[7px] ed-text-12 ed-font-semibold ed-border ed-transition-all",d===X?"ed-bg-border-dark ed-text-white ed-border-border-dark":"ed-bg-white ed-text-border-dark ed-border-regular hover:ed-border-border-dark"),children:typeof X=="string"?X:X==null?void 0:X.label},`optional-option-${X.label+ne}`))})]}),l&&R&&(!(l.score<=2&&_)||d)&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-semibold ed-text-dark ed-mb-1",children:N}),T.jsx("textarea",{placeholder:"Write here",value:m,onChange:X=>g(X.target.value),rows:4,className:"ed-w-full ed-px-4 ed-py-3 ed-border ed-border-border-light ed-rounded-[5px] ed-text-14 ed-text-border-dark placeholder:ed-text-border-regular focus:ed-outline-none focus:ed-border-brand ed-resize-none"})]}),l&&T.jsx("div",{className:"ed-mt-5 ed-flex ed-justify-center ed-mb-2",children:T.jsx(Zf,{title:"Submit",callBack:U,loader:r,disabled:r,loaderText:"Submitting..."})})]})]})},lce=({orgBrandSetting:t={},userData:e={},currentConversationID:n,setCurrentConversationID:r})=>{var Je,Ke,ht,At,ct;const{conversationData:i,initialStatesData:s,conversationState:l,inputFieldState:u,setInputFieldState:d,isAIThinking:h,setIsAIThinking:m,handleUpdateConversationActivityAnalytics:g,send:y}=Jh(),{sendMessage:b}=Nx(),{satisfaction_setting:C}=t||{},w=C==null?void 0:C.satisfaction_survey,[_,R]=D.useState(!0),k=D.useRef(null),L=D.useRef(null),N=D.useRef(!1),A=Ko.get("easydesk_chat_widget_conversation_id"),{brand:P}=t,[F,U]=D.useState(null),[$,K]=D.useState(!1),[te,X]=D.useState([]),ne=n||A,[Y]=Ph(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),[H,{loading:G}]=hu(rce,{errorPolicy:"all",fetchPolicy:"no-cache"}),Z=async ke=>{var He,nt;try{const Dt=ace({title:ke==null?void 0:ke.title,message:ke==null?void 0:ke.message,files:ke.conversation_activity_files}),et=await b({is_customer_reply:!0,message:Dt,conversation_id:ne});if(et!=null&&et.id){d(Jt=>({...Jt,ticket_title:ke==null?void 0:ke.ticket_title,ticket_activity:ke==null?void 0:ke.ticket_activity,conversation_activity_files:ke==null?void 0:ke.conversation_activity_files}));const Rt=wS(jr.ticket.success,{ticket_id:(ke==null?void 0:ke.ticketId)||"N/A",customer_email:((He=i==null?void 0:i.contact)==null?void 0:He.person_email)||(u==null?void 0:u.contact_person_email)||"your email"});await b({is_auto_response:!0,message:Rt,conversation_status:"closed",current_stage:"closed"},!0),y({type:In.UPDATE_CONVERSATION_STATUS,status:"closed"})}}catch(Dt){const{message:et,response:Rt}=Dt;ii("error",((nt=Rt==null?void 0:Rt.data)==null?void 0:nt.message)||et,"top-left")}},J=async()=>{try{await b({conversation_id:ne,message:jr.ai.thanksFeedback,is_auto_response:!0,current_stage:"followup_feedback"})}catch(ke){console.error("Error creating follow-up message:",ke)}},le=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling initial no click:",He)}},re=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling intermediate yes click:",He)}},ie=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling intermediate no click:",He)}},ce=async()=>{try{await b({conversation_id:ne,message:jr.followUp.withAainAI,is_auto_response:!0,current_stage:"ai_available"})}catch(ke){console.error("Error restarting conversation:",ke)}},ge=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling follow-up no click:",He)}},ye=async ke=>{try{await b({conversation_id:ne,message:ke.message,is_customer_reply:ke.is_customer_reply,channel_id:ke.channel_id,current_stage:"agent_chat"}),X([]),await b({conversation_id:ne,message:jr.followUp.afterChannelSelection,is_auto_response:!0,is_customer_reply:!1,current_stage:"agent_chat"})}catch(He){console.error("Error selecting channel:",He)}},Re=async ke=>{var He;try{const nt={conversation_id:ne,satisfaction_rating_type_id:ke.satisfaction_rating_type_id,optional_question_responses:ke.optional_question_responses||null,open_ended_question_response:ke.open_ended_question_response||null},{data:Dt}=await H({variables:{inputData:nt}});return!!((He=Dt==null?void 0:Dt.createASatisfactionRating)!=null&&He.id)}catch(nt){return console.error("Error submitting survey:",nt),ii("error","Failed to submit feedback. Please try again.","top-left"),!1}},Se=()=>{y({type:In.RELOAD_CONVERSATION_DATA}),R(!1)},we=()=>{y({type:In.CONVERSATION_CLOSED}),d(s.inputFieldState),U(!1),Ko.remove("easydesk_chat_widget_conversation_id")},$e=((Je=l==null?void 0:l.metaData)==null?void 0:Je.filtered_rows)&&Ot.size(l==null?void 0:l.messages)<((Ke=l==null?void 0:l.metaData)==null?void 0:Ke.filtered_rows),{loadMoreMessages:Ge}=Nx(),We=Ge;D.useEffect(()=>{if(!L.current||N.current)return;const He=setTimeout(()=>{const nt=L.current;nt&&requestAnimationFrame(()=>{nt.scrollTop=nt.scrollHeight})},100);return()=>clearTimeout(He)},[Ot.size(l==null?void 0:l.messages)]),D.useEffect(()=>{if(ne&&L.current){const ke=setTimeout(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight)},300);return()=>clearTimeout(ke)}},[ne]),D.useEffect(()=>{ne&&(k.current=null)},[ne]);const Me=(i==null?void 0:i.is_spam)||["closed","resolved"].includes(i==null?void 0:i.status),fe=(()=>{if((i==null?void 0:i.status)!=="resolved"||i!=null&&i.has_customer_feedback||!C||!w||!C.is_satisfaction_rating_enabled)return!1;const ke=i==null?void 0:i.type;return!(ke==="ticket"&&!C.is_ticket_feedback_active||ke==="chat"&&!C.is_chat_feedback_active)})(),Ze=()=>{var He;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1];return((He=ke==null?void 0:ke.metadata)==null?void 0:He.current_stage)==="agent_chat"||(i==null?void 0:i.assignee)},Ue=()=>{if(h)return!0;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1],He=ke==null?void 0:ke.metadata;return!He||ke!=null&&ke.is_customer_reply?!1:!!(He.current_stage&&!["agent_chat","ai_available","try_another_question"].includes(He.current_stage)||He.has_results===!0||He.has_results===!1)};return D.useEffect(()=>{let ke=[];const He=Ot.debounce(async()=>{await g({seen_activity_ids:ke}),ke=[]},1e3),nt=new IntersectionObserver(et=>{et.forEach(Rt=>{if(Rt.isIntersecting){const Jt=Rt.target.getAttribute("data-message-id");Jt&&ke.push(Jt)}}),Ot.size(ke)&&He()},{threshold:1}),Dt=document.querySelectorAll(".ed-message");return Dt.forEach(et=>nt.observe(et)),()=>{He.cancel(),Dt.forEach(et=>nt.unobserve(et))}},[l==null?void 0:l.messages]),T.jsxs("div",{children:[T.jsx("div",{ref:L,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto ed-no-scrollbar",style:{scrollBehavior:"smooth"},children:T.jsx(Yw,{dataLength:Ot.size(l==null?void 0:l.messages),hasMore:$e,scrollableTarget:"activities-scroll-target",inverse:!0,next:()=>{N.current=!0,We(),setTimeout(()=>{N.current=!1},500)},children:T.jsxs("div",{className:"ed-flex-1 ed-space-y-3",children:[Ot.size(l==null?void 0:l.messages)?T.jsxs("div",{children:[(i==null?void 0:i.type)==="ticket"&&T.jsxs("div",{className:"ed-bg-gray-light ed-p-2 ed-rounded",children:[T.jsxs("p",{className:"ed-text-regular ed-font-normal ed-text-14",children:["ID",i==null?void 0:i.serial]}),T.jsx("h5",{className:"ed-text-dark ed-font-normal ed-text-14",children:i==null?void 0:i.title})]}),(ht=l==null?void 0:l.messages)==null?void 0:ht.map(ke=>T.jsx("div",{className:"single-message ed-px-5 ed-pt-3 ed-animate-fadeInUp",children:["reply","file"].includes(ke==null?void 0:ke.type)?T.jsx(bV,{activityMessage:ke,brand:P,isInitiatedWithAi:i==null?void 0:i.is_initiated_with_ai},ke==null?void 0:ke.id):T.jsx(Jle,{log:ke==null?void 0:ke.log},ke==null?void 0:ke.id)},ke==null?void 0:ke.id))]}):T.jsx(nue,{onSubmit:ke=>{d(He=>({...He,contact_person_name:ke==null?void 0:ke.contact_person_name,contact_person_email:ke==null?void 0:ke.contact_person_email}))},orgBrandSetting:t,setSelectedConversationId:r,userData:e}),!h&&(l==null?void 0:l.messages)&&Ot.size(l.messages)>0&&(()=>{const ke=l.messages[l.messages.length-1],{metadata:He}=ke||{};if(He&&!(ke!=null&&ke.is_customer_reply)){const{current_stage:nt}=He;if(!nt&&He.has_results===!0)return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="initial_feedback")return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="followup_feedback")return T.jsx(OS,{type:"followup",sendMessage:b,conversationId:ne,onYes:ce,onNo:ge});if(nt==="intermediate_help")return T.jsx(OS,{type:"intermediate",sendMessage:b,conversationId:ne,onYes:re,onNo:ie});if(nt==="need_help")return T.jsx(CV,{type:"need_help",sendMessage:b,conversationId:ne,showChatButton:$,setIsAIThinking:m,onChannelSelection:ye});if(!He.has_results&&!nt&&!(i!=null&&i.assignee))return T.jsx(CV,{type:"no_results",sendMessage:b,conversationId:ne,setIsAIThinking:m,onChannelSelection:ye});if(nt==="select_channel")return T.jsx(tce,{channels:te,onSubmit:ye});if(nt==="create_a_support_ticket")return T.jsx(BP,{from:"message",isAuthenticated:!0,onSubmit:Z,reqId:null,userData:u,metadata:He})}return null})(),(((At=l==null?void 0:l.writing_realtime_status)==null?void 0:At.is_writing_reply)||h)&&T.jsx("div",{className:"single-message ed-px-5",children:T.jsx(bV,{brand:P,activityMessage:{user:(ct=l==null?void 0:l.writing_realtime_status)==null?void 0:ct.author,is_customer_reply:!1,is_ai_response:h,created_at:Date.now()},isReplying:!0})})]})})}),fe&&_&&T.jsx("div",{className:"ed-flex-1 ed-rounded-t-xl ed-overflow-y-auto ed-no-scrollbar ed-max-h-full ed-absolute ed-bottom-0 ed-left-0 ed-bg-white ed-shadow-[0_-4px_50px_rgba(0,0,0,0.2)] ed-z-[999]",children:T.jsx(sce,{surveyData:w,onSubmit:Re,isSubmitting:G,onClose:Se})}),((i==null?void 0:i.type)==="ticket"||!Me&&Ot.size(l==null?void 0:l.messages)>=3&&!F&&!Ue()&&F!=="CONVERSATION_ENDED")&&T.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-pt-1 ed--mx-5 ed-px-6",children:T.jsx(ece,{conversationData:i,conversationId:ne,handleCreateMessage:b,onAIThinkingChange:m,isAIThinking:h,useAITemplate:!Ze()})}),(i==null?void 0:i.type)!=="ticket"&&(F&&F!=="CONVERSATION_ENDED"||Me)&&T.jsx("div",{className:"ed-py-2 ed-px-5 ed-bg-white ed-text-gray-500 ed-sticky ed-bottom-0 ed-left-0",children:T.jsxs("p",{className:"ed-text-center ed-text-sm",children:["Your chat has ended. ",T.jsx("br",{}),"To start a new chat, ",T.jsx("button",{type:"button",className:"ed-underline ed-text-blue-600 ed-text-sm",onClick:we,children:"click here"})]})})]})},uce=({item:t,onSelect:e,userData:n})=>{const{id:r,type:i,status:s,last_conversation_activity:l,organization_brand:u,assignee:d}=t||{},{handleUpdateConversationActivityAnalytics:h}=mu(),{message:m,user:g,created_at:y,analytics:b}=l||{},{status:C}=(b==null?void 0:b[0])||{},{setting:w,name:_}=u||{},{first_name:R,last_name:k,email:L,avatar_file:N}=(d==null?void 0:d.user)||{},A=D.useMemo(()=>R0(R,k,L)||_||"Unknown User",[R,k,L,_]),P=N||(w==null?void 0:w.icon),F=(n==null?void 0:n.id)===(g==null?void 0:g.id),U=ne=>F?"ed-text-border-dark":ne?"ed-text-border-dark ed-font-medium":"ed-text-border-dark ed-font-semibold",$=async()=>{C!=="seen"&&await h({seen_activity_ids:[l==null?void 0:l.id]}),e(r)},K=D.useMemo(()=>$ue[s],[s]),te=F&&C==="seen",X=D.useMemo(()=>Wue(m),[m]);return T.jsxs("div",{role:"button",tabIndex:0,onClick:$,className:"ed-flex ed-items-center ed-gap-2.5 ed-border-b ed-py-5 ed-px-5 hover:ed-bg-light/40 ed-cursor-pointer ed-custom-wrapper hover:ed-bg-white-light",children:[T.jsx("div",{className:"ed-size-12 ed-flex ed-items-center ed-justify-center",children:T.jsx(Mo,{alt:A,path:P==null?void 0:P.key,defaultImageName:_l(L||_),className:"ed-size-10 ed-object-cover ed-rounded-full",defaultUserNameTextSize:"ed-text-12",defaultImageClasses:"ed-size-10 ed-object-cover ed-rounded-full"})}),T.jsxs("div",{className:"ed-w-full ed-flex ed-justify-between ed-items-center",children:[T.jsxs("div",{className:"ed-flex ed-flex-col ed-gap-0.5",children:[T.jsx("p",{className:`ed-font-medium ed-text-12 ed-line-clamp-1 ed-text-border-dark ${U(te)}`,children:m?X:"[Attachment]"}),T.jsxs("div",{className:"ed-flex ed-items-center ed-gap-1",children:[T.jsx(CS,{content:T.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:i==="chat"?"Chat":"Ticket"}),children:i==="chat"?T.jsx(BL,{}):T.jsx(HL,{})}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:`ed-text-12 ${U(te)}`,children:__(A,20)}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:"ed-text-12 ed-text-brand",children:que(y)})]})]}),T.jsxs("div",{className:"ed-flex ed-gap-2 ed-items-center",children:[(t==null?void 0:t.unread_count)>0?T.jsx("span",{className:"ed-bg-brand ed-px-1 ed-rounded-full ed-text-white ed-text-10 ed-font-semibold ed-min-w-4 ed-text-center",children:t.unread_count}):!F&&C!=="seen"&&T.jsx("div",{className:"ed-size-1 ed-rounded-full ed-bg-red"}),T.jsx("span",{className:"ed-custom-children",children:T.jsx(vu,{className:"ed-size-4 ed-text-regular"})})]}),["open","resolved"].includes(s)&&T.jsx("span",{className:`ed-text-12 ed-px-3 ed-py-1 ${K==null?void 0:K.className}`,children:K==null?void 0:K.label})]})]})},cce="easydesk_chat_widget_conversation_id",fce=({setCurrentConversationID:t,userData:e})=>{const n=D.useRef(null),{setIsChatHistory:r,conversationsData:i,metaData:s,loadingStates:l,setOptionData:u,optionData:d}=mu(),{send:h,initialStatesData:m,setConversationState:g}=Jh(),y=async()=>{h({type:In.CONVERSATION_CLOSED}),Ko.remove(cce),t(null),g(m.conversationState),r(!1)},b=w=>{w&&(t(w),r(!1))};D.useEffect(()=>{const w=setTimeout(()=>{var k;const _=(k=n.current)==null?void 0:k.querySelectorAll(".single-message-container"),R=_==null?void 0:_[Ot.size(_)-1];R==null||R.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(w)},[Ot.size(i)]);const C=(s==null?void 0:s.total_rows)>Ot.size(i);return T.jsxs("div",{children:[T.jsx("div",{className:"ed-h-[500px] ed-overflow-y-auto ed-no-scrollbar",id:"conversations-scroll-target",children:T.jsx(Yw,{dataLength:Ot.size(i),hasMore:C,loader:l!=null&&l.fetchMoreLoading?T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsx(lp,{})}):"",scrollableTarget:"conversations-scroll-target",next:()=>{u({...d,offset:d.offset+d.limit})},children:i==null?void 0:i.map(w=>T.jsx(uce,{item:w,onSelect:b,userData:e},w.id))})}),T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsxs("button",{onClick:y,type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5 ed-bottom-28 ed-absolute hover:ed-opacity-90 focus:ed-outline-none",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"}),T.jsx(vu,{size:16})]})})]})},dce=()=>{const{setIsChatHistory:t}=mu();return T.jsx("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center",children:T.jsxs("div",{className:"ed-bottom-32 ed-absolute ed-flex ed-flex-col ed-items-center",children:[T.jsx(Pte,{}),T.jsxs("button",{onClick:()=>t(e=>!e),type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"})," ",T.jsx(vu,{})]})]})})},hce=({orgBrandSetting:t,setIsPopupOpen:e,userData:n})=>{const{conversationsData:r,loadingStates:i,getConversationsForPortal:s,isChatHistory:l,setIsChatHistory:u,setCurrentConversationID:d,currentConversationID:h}=mu(),m=D.useMemo(()=>l?Ot.size(r)?T.jsx(fce,{data:r,userData:n,setCurrentConversationID:d}):T.jsx(dce,{}):T.jsx(lce,{orgBrandSetting:t,setIsPopupOpen:e,userData:n,currentConversationID:h,setCurrentConversationID:d,refreshConversations:s}),[r,n,h,l,t,u,e]);return i!=null&&i.initialLoading?T.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:T.jsx(lp,{})}):T.jsx("div",{children:m})};var RT={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_ARTICLES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"ArticleQueryInputType"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getArticles"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:193}};RT.loc.source={body:`query GET_ARTICLES($queryData: ArticleQueryInputType, $optionData: OptionDataType) {
1820
+ </div>`},xV={ANGRY:T.jsx(Ite,{}),SAD:T.jsx(Vte,{}),NEUTRAL:T.jsx(Fte,{}),HAPPY:T.jsx(jte,{}),LOVE:T.jsx(Ute,{})},oce="data:image/png;base64,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",sce=({surveyData:t,onClose:e,onSubmit:n,isSubmitting:r=!1})=>{var te;const[i,s]=D.useState(!1),[l,u]=D.useState(null),[d,h]=D.useState(null),[m,g]=D.useState(""),y=(t==null?void 0:t.title)||"How was your support experience?",b=(t==null?void 0:t.description)||"",C=(t==null?void 0:t.is_description_enabled)||!1,w=(t==null?void 0:t.active_rating_type)||"numeric",_=(t==null?void 0:t.is_optional_question_enabled)||!1,R=(t==null?void 0:t.is_open_ended_question_enabled)||!1,k=(t==null?void 0:t.optional_question_title)||"We're sorry to hear that. Could you share what didn't go well?",L=(t==null?void 0:t.optional_question_options)||[],N=(t==null?void 0:t.open_ended_question_title)||"Share your thoughts on the support you received",A=((te=t==null?void 0:t.rating_types)==null?void 0:te.filter(X=>X.rating_type===w).sort((X,ne)=>ne.score-X.score))||[],P=X=>{u(X)},F=X=>{h(ne=>ne===X?null:X)},U=async()=>{if(!l||!n)return;const X={satisfaction_rating_type_id:l.id,optional_question_responses:d?[typeof d=="string"?d:d.label]:null,open_ended_question_response:(m==null?void 0:m.trim())||null};try{if(await n(X)===!1){ii("error","We could not submit your feedback. Please try again.","top-left");return}s(!0)}catch{ii("error","We could not submit your feedback. Please try again.","top-left")}},$=()=>{e&&e()},K=()=>w==="numeric"?T.jsx("div",{className:"ed-flex ed-gap-2 ed-flex-wrap ed-justify-between",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:"ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-flex-1",children:[T.jsx("div",{className:Ei("ed-w-10 ed-h-10 ed-flex ed-items-center ed-justify-center ed-rounded ed-text-14 ed-border ed-transition-colors",ne?"ed-bg-brand-light ed-text-brand ed-border-brand":"ed-bg-gray ed-text-border-dark ed-border-[#8F99AD]"),children:X.numeric_value}),T.jsx("span",{className:Ei("ed-text-10 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="emoji"?T.jsx("div",{className:"ed-flex ed-justify-between ed-gap-3 ",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsxs("button",{type:"button",onClick:()=>P(X),className:Ei("ed-flex ed-flex-col ed-items-center ed-gap-2 ed-group ed-min-w-[60px]"),children:[T.jsx("div",{className:Ei("ed-text-24 ed-flex ed-justify-center ed-items-center hover:ed-scale-110 ed-size-10 ed-transition-transform",ne?"ed-border ed-rounded-md ed-bg-brand-light ed-border-brand":"ed-text-border-dark"),children:xV[X.emoji]&&xV[X.emoji]}),T.jsx("span",{className:Ei("ed-text-12 ed-font-medium group-hover:ed-text-brand ed-transition-colors",ne?"ed-text-brand":"ed-text-border-dark"),children:X.label})]},X.id)})}):w==="custom_text"?T.jsx("div",{className:"ed-flex ed-flex-col ed-gap-3 ed-w-full ed-max-w-[280px] ed-mx-auto",children:A.map(X=>{const ne=(l==null?void 0:l.id)===X.id;return T.jsx("button",{type:"button",onClick:()=>P(X),className:Ei("ed-w-full ed-py-3 ed-px-4 ed-border ed-border-regular hover:ed-border-brand hover:ed-bg-white-light ed-rounded-[20px] ed-text-14 ed-font-medium ed-text-border-dark ed-transition-all",ne?"ed-border-brand ed-bg-brand-light":"ed-border-regular ed-bg-white"),children:X.label},X.id)})}):null;return i?T.jsxs("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center ed-text-center ed-px-4 ed-py-8 ed-pt-16 ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsx("h3",{className:"ed-text-18 ed-font-semibold ed-text-border-dark ed-px-9",children:"Thank you for sharing your experience with us."}),T.jsx("div",{className:"ed-w-40 ed-h-auto ed-my-12",children:T.jsx(Mo,{src:oce,width:600,height:451,className:"ed-h-[140px] ed-w-fit",alt:"Thank you"})})]}):T.jsxs("div",{className:"ed-border-border-light ed-bg-white ed-relative",children:[T.jsx("button",{type:"button",onClick:$,className:"ed-absolute ed-top-3 ed-right-3 ed-text-border-regular hover:ed-text-border-dark ed-transition-colors ed-z-10",children:T.jsx(ps,{size:20})}),T.jsxs("div",{className:"ed-px-5 ed-py-4 ed-pb-6",children:[T.jsx("h3",{className:"ed-text-16 ed-font-semibold ed-text-border-dark ed-mb-3 ed-text-center ed-pr-6",children:y}),C&&b&&T.jsx("p",{className:"ed-text-14 ed-text-border-regular ed-mb-4 ed-text-center",children:b}),T.jsx("div",{className:"ed-py-2",children:K()}),l&&l.score<=2&&_&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-medium ed-text-border-dark ed-mb-4 ed-text-center",children:k}),T.jsx("div",{className:"ed-flex ed-flex-wrap ed-gap-2 ed-justify-center",children:L.map((X,ne)=>T.jsx("button",{type:"button",onClick:()=>F(X),className:Ei("ed-py-1.5 ed-px-4 ed-rounded-[7px] ed-text-12 ed-font-semibold ed-border ed-transition-all",d===X?"ed-bg-border-dark ed-text-white ed-border-border-dark":"ed-bg-white ed-text-border-dark ed-border-regular hover:ed-border-border-dark"),children:typeof X=="string"?X:X==null?void 0:X.label},`optional-option-${X.label+ne}`))})]}),l&&R&&(!(l.score<=2&&_)||d)&&T.jsxs("div",{className:"ed-mt-6 ed-pt-6 ed-border-t ed-border-gray",children:[T.jsx("p",{className:"ed-text-14 ed-font-semibold ed-text-dark ed-mb-1",children:N}),T.jsx("textarea",{placeholder:"Write here",value:m,onChange:X=>g(X.target.value),rows:4,className:"ed-w-full ed-px-4 ed-py-3 ed-border ed-border-border-light ed-rounded-[5px] ed-text-14 ed-text-border-dark placeholder:ed-text-border-regular focus:ed-outline-none focus:ed-border-brand ed-resize-none"})]}),l&&T.jsx("div",{className:"ed-mt-5 ed-flex ed-justify-center ed-mb-2",children:T.jsx(Zf,{title:"Submit",callBack:U,loader:r,disabled:r,loaderText:"Submitting..."})})]})]})},lce=({orgBrandSetting:t={},userData:e={},currentConversationID:n,setCurrentConversationID:r})=>{var Je,Ke,ht,At,ct;const{conversationData:i,initialStatesData:s,conversationState:l,inputFieldState:u,setInputFieldState:d,isAIThinking:h,setIsAIThinking:m,handleUpdateConversationActivityAnalytics:g,send:y}=Jh(),{sendMessage:b}=Nx(),{satisfaction_setting:C}=t||{},w=C==null?void 0:C.satisfaction_survey,[_,R]=D.useState(!0),k=D.useRef(null),L=D.useRef(null),N=D.useRef(!1),A=Ko.get("easydesk_chat_widget_conversation_id"),{brand:P}=t,[F,U]=D.useState(null),[$,K]=D.useState(!1),[te,X]=D.useState([]),ne=n||A,[Y]=Ph(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),[H,{loading:G}]=hu(rce,{errorPolicy:"all",fetchPolicy:"no-cache"}),Z=async ke=>{var He,nt;try{const Dt=ace({title:ke==null?void 0:ke.title,message:ke==null?void 0:ke.message,files:ke.conversation_activity_files}),et=await b({is_customer_reply:!0,message:Dt,conversation_id:ne});if(et!=null&&et.id){d(Jt=>({...Jt,ticket_title:ke==null?void 0:ke.ticket_title,ticket_activity:ke==null?void 0:ke.ticket_activity,conversation_activity_files:ke==null?void 0:ke.conversation_activity_files}));const Rt=wS(jr.ticket.success,{ticket_id:(ke==null?void 0:ke.ticketId)||"N/A",customer_email:((He=i==null?void 0:i.contact)==null?void 0:He.person_email)||(u==null?void 0:u.contact_person_email)||"your email"});await b({is_auto_response:!0,message:Rt,conversation_status:"closed",current_stage:"closed"},!0),y({type:In.UPDATE_CONVERSATION_STATUS,status:"closed"})}}catch(Dt){const{message:et,response:Rt}=Dt;ii("error",((nt=Rt==null?void 0:Rt.data)==null?void 0:nt.message)||et,"top-left")}},J=async()=>{try{await b({conversation_id:ne,message:jr.ai.thanksFeedback,is_auto_response:!0,current_stage:"followup_feedback"})}catch(ke){console.error("Error creating follow-up message:",ke)}},le=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling initial no click:",He)}},re=async()=>{var ke;try{const{data:He}=await Y({variables:{queryData:{is_live_chat_enabled:!0}}}),nt=Ot.size((ke=He==null?void 0:He.getChannelsForPortal)==null?void 0:ke.data)>0&&!(t!=null&&t.is_off_hour);K(nt),await b({conversation_id:ne,message:jr.ai.needMoreHelp,is_auto_response:!0,current_stage:"need_help"})}catch(He){console.error("Error handling intermediate yes click:",He)}},ie=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling intermediate no click:",He)}},ce=async()=>{try{await b({conversation_id:ne,message:jr.followUp.withAainAI,is_auto_response:!0,current_stage:"ai_available"})}catch(ke){console.error("Error restarting conversation:",ke)}},ge=async()=>{var ke;try{const He=((ke=i==null?void 0:i.contact)==null?void 0:ke.person_name)||"there",nt=wS(jr.ai.goodbye,{name:He});await b({conversation_id:ne,message:nt,is_auto_response:!0,conversation_status:"resolved",current_stage:"closed"}),y({type:In.UPDATE_CONVERSATION_STATUS,status:"resolved"}),U("CONVERSATION_ENDED")}catch(He){console.error("Error handling follow-up no click:",He)}},ye=async ke=>{try{await b({conversation_id:ne,message:ke.message,is_customer_reply:ke.is_customer_reply,channel_id:ke.channel_id,current_stage:"agent_chat"}),X([]),await b({conversation_id:ne,message:jr.followUp.afterChannelSelection,is_auto_response:!0,is_customer_reply:!1,current_stage:"agent_chat"})}catch(He){console.error("Error selecting channel:",He)}},Re=async ke=>{var He;try{const nt={conversation_id:ne,satisfaction_rating_type_id:ke.satisfaction_rating_type_id,optional_question_responses:ke.optional_question_responses||null,open_ended_question_response:ke.open_ended_question_response||null},{data:Dt}=await H({variables:{inputData:nt}});return!!((He=Dt==null?void 0:Dt.createASatisfactionRating)!=null&&He.id)}catch(nt){return console.error("Error submitting survey:",nt),ii("error","Failed to submit feedback. Please try again.","top-left"),!1}},Se=()=>{y({type:In.RELOAD_CONVERSATION_DATA}),R(!1)},we=()=>{y({type:In.CONVERSATION_CLOSED}),d(s.inputFieldState),U(!1),Ko.remove("easydesk_chat_widget_conversation_id")},$e=((Je=l==null?void 0:l.metaData)==null?void 0:Je.filtered_rows)&&Ot.size(l==null?void 0:l.messages)<((Ke=l==null?void 0:l.metaData)==null?void 0:Ke.filtered_rows),{loadMoreMessages:Ge}=Nx(),We=Ge;D.useEffect(()=>{if(!L.current||N.current)return;const He=setTimeout(()=>{const nt=L.current;nt&&requestAnimationFrame(()=>{nt.scrollTop=nt.scrollHeight})},100);return()=>clearTimeout(He)},[Ot.size(l==null?void 0:l.messages)]),D.useEffect(()=>{if(ne&&L.current){const ke=setTimeout(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight)},300);return()=>clearTimeout(ke)}},[ne]),D.useEffect(()=>{ne&&(k.current=null)},[ne]);const Me=(i==null?void 0:i.is_spam)||["closed","resolved"].includes(i==null?void 0:i.status),fe=(()=>{if((i==null?void 0:i.status)!=="resolved"||i!=null&&i.has_customer_feedback||!C||!w||!C.is_satisfaction_rating_enabled)return!1;const ke=i==null?void 0:i.type;return!(ke==="ticket"&&!C.is_ticket_feedback_active||ke==="chat"&&!C.is_chat_feedback_active)})(),Ze=()=>{var He;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1];return((He=ke==null?void 0:ke.metadata)==null?void 0:He.current_stage)==="agent_chat"||(i==null?void 0:i.assignee)},Ue=()=>{if(h)return!0;if(!(l!=null&&l.messages)||Ot.size(l.messages)===0)return!1;const ke=l.messages[l.messages.length-1],He=ke==null?void 0:ke.metadata;return!He||ke!=null&&ke.is_customer_reply?!1:!!(He.current_stage&&!["agent_chat","ai_available","try_another_question"].includes(He.current_stage)||He.has_results===!0||He.has_results===!1)};return D.useEffect(()=>{let ke=[];const He=Ot.debounce(async()=>{await g({seen_activity_ids:ke}),ke=[]},1e3),nt=new IntersectionObserver(et=>{et.forEach(Rt=>{if(Rt.isIntersecting){const Jt=Rt.target.getAttribute("data-message-id");Jt&&ke.push(Jt)}}),Ot.size(ke)&&He()},{threshold:1}),Dt=document.querySelectorAll(".ed-message");return Dt.forEach(et=>nt.observe(et)),()=>{He.cancel(),Dt.forEach(et=>nt.unobserve(et))}},[l==null?void 0:l.messages]),T.jsxs("div",{children:[T.jsx("div",{ref:L,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto ed-no-scrollbar",style:{scrollBehavior:"smooth"},children:T.jsx(Yw,{dataLength:Ot.size(l==null?void 0:l.messages),hasMore:$e,scrollableTarget:"activities-scroll-target",inverse:!0,next:()=>{N.current=!0,We(),setTimeout(()=>{N.current=!1},500)},children:T.jsxs("div",{className:"ed-flex-1 ed-space-y-3",children:[Ot.size(l==null?void 0:l.messages)?T.jsxs("div",{children:[(i==null?void 0:i.type)==="ticket"&&T.jsxs("div",{className:"ed-bg-gray-light ed-p-2 ed-rounded",children:[T.jsxs("p",{className:"ed-text-regular ed-font-normal ed-text-14",children:["ID",i==null?void 0:i.serial]}),T.jsx("h5",{className:"ed-text-dark ed-font-normal ed-text-14",children:i==null?void 0:i.title})]}),(ht=l==null?void 0:l.messages)==null?void 0:ht.map(ke=>T.jsx("div",{className:"single-message ed-px-5 ed-pt-3 ed-animate-fadeInUp",children:["reply","file"].includes(ke==null?void 0:ke.type)?T.jsx(bV,{activityMessage:ke,brand:P,isInitiatedWithAi:i==null?void 0:i.is_initiated_with_ai},ke==null?void 0:ke.id):T.jsx(Jle,{log:ke==null?void 0:ke.log},ke==null?void 0:ke.id)},ke==null?void 0:ke.id))]}):T.jsx(nue,{onSubmit:ke=>{d(He=>({...He,contact_person_name:ke==null?void 0:ke.contact_person_name,contact_person_email:ke==null?void 0:ke.contact_person_email}))},orgBrandSetting:t,setSelectedConversationId:r,userData:e}),!h&&(l==null?void 0:l.messages)&&Ot.size(l.messages)>0&&(()=>{const ke=l.messages[l.messages.length-1],{metadata:He}=ke||{};if(He&&!(ke!=null&&ke.is_customer_reply)){const{current_stage:nt}=He;if(!nt&&He.has_results===!0)return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="initial_feedback")return T.jsx(OS,{type:"initial",sendMessage:b,conversationId:ne,onYes:J,onNo:le});if(nt==="followup_feedback")return T.jsx(OS,{type:"followup",sendMessage:b,conversationId:ne,onYes:ce,onNo:ge});if(nt==="intermediate_help")return T.jsx(OS,{type:"intermediate",sendMessage:b,conversationId:ne,onYes:re,onNo:ie});if(nt==="need_help")return T.jsx(CV,{type:"need_help",sendMessage:b,conversationId:ne,showChatButton:$,setIsAIThinking:m,onChannelSelection:ye});if(!He.has_results&&!nt&&!(i!=null&&i.assignee))return T.jsx(CV,{type:"no_results",sendMessage:b,conversationId:ne,setIsAIThinking:m,onChannelSelection:ye});if(nt==="select_channel")return T.jsx(tce,{channels:te,onSubmit:ye});if(nt==="create_a_support_ticket")return T.jsx(BP,{from:"message",isAuthenticated:!0,onSubmit:Z,reqId:null,userData:u,metadata:He})}return null})(),(((At=l==null?void 0:l.writing_realtime_status)==null?void 0:At.is_writing_reply)||h)&&T.jsx("div",{className:"single-message ed-px-5",children:T.jsx(bV,{brand:P,activityMessage:{user:(ct=l==null?void 0:l.writing_realtime_status)==null?void 0:ct.author,is_customer_reply:!1,is_ai_response:h,created_at:Date.now()},isReplying:!0})})]})})}),fe&&_&&T.jsx("div",{className:"ed-flex-1 ed-rounded-t-xl ed-overflow-y-auto ed-no-scrollbar ed-max-h-full ed-absolute ed-bottom-0 ed-w-full ed-left-0 ed-bg-white ed-shadow-[0_-4px_50px_rgba(0,0,0,0.2)] ed-z-[999]",children:T.jsx(sce,{surveyData:w,onSubmit:Re,isSubmitting:G,onClose:Se})}),((i==null?void 0:i.type)==="ticket"||!Me&&Ot.size(l==null?void 0:l.messages)>=3&&!F&&!Ue()&&F!=="CONVERSATION_ENDED")&&T.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-pt-1 ed--mx-5 ed-px-6",children:T.jsx(ece,{conversationData:i,conversationId:ne,handleCreateMessage:b,onAIThinkingChange:m,isAIThinking:h,useAITemplate:!Ze()})}),(i==null?void 0:i.type)!=="ticket"&&(F&&F!=="CONVERSATION_ENDED"||Me)&&T.jsx("div",{className:"ed-py-2 ed-px-5 ed-bg-white ed-text-gray-500 ed-sticky ed-bottom-0 ed-left-0",children:T.jsxs("p",{className:"ed-text-center ed-text-sm",children:["Your chat has ended. ",T.jsx("br",{}),"To start a new chat, ",T.jsx("button",{type:"button",className:"ed-underline ed-text-blue-600 ed-text-sm",onClick:we,children:"click here"})]})})]})},uce=({item:t,onSelect:e,userData:n})=>{const{id:r,type:i,status:s,last_conversation_activity:l,organization_brand:u,assignee:d}=t||{},{handleUpdateConversationActivityAnalytics:h}=mu(),{message:m,user:g,created_at:y,analytics:b}=l||{},{status:C}=(b==null?void 0:b[0])||{},{setting:w,name:_}=u||{},{first_name:R,last_name:k,email:L,avatar_file:N}=(d==null?void 0:d.user)||{},A=D.useMemo(()=>R0(R,k,L)||_||"Unknown User",[R,k,L,_]),P=N||(w==null?void 0:w.icon),F=(n==null?void 0:n.id)===(g==null?void 0:g.id),U=ne=>F?"ed-text-border-dark":ne?"ed-text-border-dark ed-font-medium":"ed-text-border-dark ed-font-semibold",$=async()=>{C!=="seen"&&await h({seen_activity_ids:[l==null?void 0:l.id]}),e(r)},K=D.useMemo(()=>$ue[s],[s]),te=F&&C==="seen",X=D.useMemo(()=>Wue(m),[m]);return T.jsxs("div",{role:"button",tabIndex:0,onClick:$,className:"ed-flex ed-items-center ed-gap-2.5 ed-border-b ed-py-5 ed-px-5 hover:ed-bg-light/40 ed-cursor-pointer ed-custom-wrapper hover:ed-bg-white-light",children:[T.jsx("div",{className:"ed-size-12 ed-flex ed-items-center ed-justify-center",children:T.jsx(Mo,{alt:A,path:P==null?void 0:P.key,defaultImageName:_l(L||_),className:"ed-size-10 ed-object-cover ed-rounded-full",defaultUserNameTextSize:"ed-text-12",defaultImageClasses:"ed-size-10 ed-object-cover ed-rounded-full"})}),T.jsxs("div",{className:"ed-w-full ed-flex ed-justify-between ed-items-center",children:[T.jsxs("div",{className:"ed-flex ed-flex-col ed-gap-0.5",children:[T.jsx("p",{className:`ed-font-medium ed-text-12 ed-line-clamp-1 ed-text-border-dark ${U(te)}`,children:m?X:"[Attachment]"}),T.jsxs("div",{className:"ed-flex ed-items-center ed-gap-1",children:[T.jsx(CS,{content:T.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:i==="chat"?"Chat":"Ticket"}),children:i==="chat"?T.jsx(BL,{}):T.jsx(HL,{})}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:`ed-text-12 ${U(te)}`,children:__(A,20)}),T.jsx("span",{className:"ed-size-1.5 ed-rounded-full ed-bg-border"}),T.jsx("p",{className:"ed-text-12 ed-text-brand",children:que(y)})]})]}),T.jsxs("div",{className:"ed-flex ed-gap-2 ed-items-center",children:[(t==null?void 0:t.unread_count)>0?T.jsx("span",{className:"ed-bg-brand ed-px-1 ed-rounded-full ed-text-white ed-text-10 ed-font-semibold ed-min-w-4 ed-text-center",children:t.unread_count}):!F&&C!=="seen"&&T.jsx("div",{className:"ed-size-1 ed-rounded-full ed-bg-red"}),T.jsx("span",{className:"ed-custom-children",children:T.jsx(vu,{className:"ed-size-4 ed-text-regular"})})]}),["open","resolved"].includes(s)&&T.jsx("span",{className:`ed-text-12 ed-px-3 ed-py-1 ${K==null?void 0:K.className}`,children:K==null?void 0:K.label})]})]})},cce="easydesk_chat_widget_conversation_id",fce=({setCurrentConversationID:t,userData:e})=>{const n=D.useRef(null),{setIsChatHistory:r,conversationsData:i,metaData:s,loadingStates:l,setOptionData:u,optionData:d}=mu(),{send:h,initialStatesData:m,setConversationState:g}=Jh(),y=async()=>{h({type:In.CONVERSATION_CLOSED}),Ko.remove(cce),t(null),g(m.conversationState),r(!1)},b=w=>{w&&(t(w),r(!1))};D.useEffect(()=>{const w=setTimeout(()=>{var k;const _=(k=n.current)==null?void 0:k.querySelectorAll(".single-message-container"),R=_==null?void 0:_[Ot.size(_)-1];R==null||R.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(w)},[Ot.size(i)]);const C=(s==null?void 0:s.total_rows)>Ot.size(i);return T.jsxs("div",{children:[T.jsx("div",{className:"ed-h-[500px] ed-overflow-y-auto ed-no-scrollbar",id:"conversations-scroll-target",children:T.jsx(Yw,{dataLength:Ot.size(i),hasMore:C,loader:l!=null&&l.fetchMoreLoading?T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsx(lp,{})}):"",scrollableTarget:"conversations-scroll-target",next:()=>{u({...d,offset:d.offset+d.limit})},children:i==null?void 0:i.map(w=>T.jsx(uce,{item:w,onSelect:b,userData:e},w.id))})}),T.jsx("div",{className:"ed-flex ed-items-center ed-justify-center",children:T.jsxs("button",{onClick:y,type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5 ed-bottom-28 ed-absolute hover:ed-opacity-90 focus:ed-outline-none",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"}),T.jsx(vu,{size:16})]})})]})},dce=()=>{const{setIsChatHistory:t}=mu();return T.jsx("div",{className:"ed-flex ed-flex-col ed-items-center ed-justify-center",children:T.jsxs("div",{className:"ed-bottom-32 ed-absolute ed-flex ed-flex-col ed-items-center",children:[T.jsx(Pte,{}),T.jsxs("button",{onClick:()=>t(e=>!e),type:"button",className:"ed-bg-brand ed-flex ed-text-white ed-items-center ed-px-6 ed-py-3 ed-rounded-lg ed-gap-2.5 ed-w-min ed-flex-nowrap ed-mt-5",children:[T.jsx("span",{className:"ed-whitespace-nowrap",children:"Send us a message"})," ",T.jsx(vu,{})]})]})})},hce=({orgBrandSetting:t,setIsPopupOpen:e,userData:n})=>{const{conversationsData:r,loadingStates:i,getConversationsForPortal:s,isChatHistory:l,setIsChatHistory:u,setCurrentConversationID:d,currentConversationID:h}=mu(),m=D.useMemo(()=>l?Ot.size(r)?T.jsx(fce,{data:r,userData:n,setCurrentConversationID:d}):T.jsx(dce,{}):T.jsx(lce,{orgBrandSetting:t,setIsPopupOpen:e,userData:n,currentConversationID:h,setCurrentConversationID:d,refreshConversations:s}),[r,n,h,l,t,u,e]);return i!=null&&i.initialLoading?T.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:T.jsx(lp,{})}):T.jsx("div",{children:m})};var RT={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_ARTICLES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"ArticleQueryInputType"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getArticles"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:193}};RT.loc.source={body:`query GET_ARTICLES($queryData: ArticleQueryInputType, $optionData: OptionDataType) {
1821
1821
  getArticles(queryData: $queryData, optionData: $optionData) {
1822
1822
  data {
1823
1823
  id
@@ -1825,7 +1825,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1825
1825
  }
1826
1826
  }
1827
1827
  }
1828
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};function MS(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(r){MS(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){MS(r,e)}),t.definitions&&t.definitions.forEach(function(r){MS(r,e)})}var kT={};(function(){RT.definitions.forEach(function(e){if(e.name){var n=new Set;MS(e,n),kT[e.name.value]=n}})})();function wV(t,e){for(var n=0;n<t.definitions.length;n++){var r=t.definitions[n];if(r.name&&r.name.value==e)return r}}function pce(t,e){var n={kind:t.kind,definitions:[wV(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=kT[e]||new Set,i=new Set,s=new Set;for(r.forEach(function(u){s.add(u)});s.size>0;){var l=s;s=new Set,l.forEach(function(u){if(!i.has(u)){i.add(u);var d=kT[u]||new Set;d.forEach(function(h){s.add(h)})}})}return i.forEach(function(u){var d=wV(t,u);d&&n.definitions.push(d)}),n}const mce=pce(RT,"GET_ARTICLES"),vce=t=>{const{userData:e,widgetIntent:n,isPopupOpen:r,setIsPopupOpen:i,isMobileScreen:s,setThemeColor:l}=t||{},{activeTab:u,setActiveTab:d,orgBrandSetting:h,setOrgBrandSetting:m,setCurrentConversationID:g,messageListUnreadCount:y}=mu(),{unreadMessages:b}=Jh(),C=y||Ot.size(b),[w,_]=D.useState(""),[R,k]=D.useState(null),[L,N]=D.useState(null),[A,P]=D.useState(!1),[F,U]=D.useState([]),[$,K]=D.useState(!1),[te,X]=D.useState(!1),[ne,Y]=D.useState(!1),[H,G]=D.useState(!1),Z=new URLSearchParams(window.location.search).get("intent");D.useEffect(()=>{const Me=Z||n;Me?Me==="chat"?(Y(!0),G(!1),d("messages"),i(!0)):Me==="kb"&&(G(!0),Y(!1),d("knowledge_base"),i(!0)):(Y(!1),G(!1),i(!1))},[n,Z]);const[J,{loading:le}]=Ph(mce,{errorPolicy:"all",fetchPolicy:"no-cache"}),{loading:re,data:ie}=Ih(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),ce=async Me=>{var Ue;const{data:fe,error:Ze}=await J(Me);fe!=null&&fe.getArticles&&U(((Ue=fe==null?void 0:fe.getArticles)==null?void 0:Ue.data)||[]),Ze&&console.error(Ze)};D.useEffect(()=>{var Me;ie!=null&&ie.getChannelsForPortal&&X(Ot.size((Me=ie==null?void 0:ie.getChannelsForPortal)==null?void 0:Me.data)>0)},[ie]);const ge=AM(Me=>{ce({variables:{queryData:{search_keyword:Me}}})},500),ye=Me=>{_(Me),ge(Me)},Re=async()=>{K(!0);try{const Me=await aJ();if(Me){const{font:fe,is_knowledge_base_enabled:Ze,theme_color:Ue}=Me;m(Me),l(Ue),gJ(fe),C>0&&te?d("messages"):Ze&&!te||Ze&&te?d("knowledge_base"):!Ze&&te&&d("messages"),K(!1)}}catch(Me){console.error(Me),K(!1)}},Se=()=>{const Me=document.getElementById("ed-widget");i(!r),r&&(e!=null&&e.isAuthenticated)&&g(null),_(""),k(null),N(null),P(!1),Re(),n&&Me&&Me.removeAttribute("ed-widget-intent"),Y(!1),G(!1)};D.useEffect(()=>{Re()},[]),D.useEffect(()=>{if(!h)return;const{is_knowledge_base_enabled:Me}=h;te&&ne?(d("messages"),i(!0)):Me&&H&&(d("knowledge_base"),i(!0))},[h,te,ne]);const we=()=>u==="knowledge_base"?T.jsx(Mne,{loading:le,articleId:L,isAuthenticated:e==null?void 0:e.isAuthenticated,selectedCategory:R,setArticleId:N,setSelectedCategory:k,orgBrandSetting:h,isMobileScreen:s}):u==="messages"?T.jsx(hce,{orgBrandSetting:h,setIsPopupOpen:i,userData:e}):null,{brand:$e,is_knowledge_base_enabled:Ge}=h||{},We=Me=>{d(Me),_(""),k(null),N(null),P(!1)};return!Ge&&!te?null:T.jsxs("div",{children:[te||Ge?T.jsx(Kle,{isPopupOpen:r,handlePopupTrigger:Se,orgBrandSetting:h,isAuthenticated:e==null?void 0:e.isAuthenticated,isMobileScreen:s}):null,T.jsx("div",{className:Ei("ed-fixed ed-flex ed-items-center ed-justify-center ed-z-[9999998]",s?"ed-bottom-0":"ed-bottom-16 ed-p-4 -ed-right-4",r?"ed-block":"ed-hidden"),children:T.jsx("div",{className:Ei("ed-right-0 ed-bg-white ed-shadow-lg ed-p-1 ed-overflow-hidden ed-transition-all ed-duration-300 ed-ease-in-out ed-flex ed-flex-col",s?"":"ed-rounded-[10px]",r?Ei("ed-opacity-100",s?"ed-w-screen ed-h-dvh":"ed-w-[400px] ed-max-h-[704px] ed-h-[calc(90vh-20px)]"):"ed-opacity-0 ed-max-h-0 ed-h-0 ed-w-0 ed-pointer-events-none"),children:r&&T.jsxs(T.Fragment,{children:[T.jsx(Zle,{searchedText:w,selectedCategory:R,setSearchedText:_,setArticleId:N,setSelectedCategory:k,setIsPopupOpen:i,handleSearch:ye,setArticlesData:U,brandInfo:$e,activeTab:u,userData:e,isMobileScreen:s}),T.jsx("div",{className:Ei("ed-flex-1 ed-overflow-y-auto ed-no-scrollbar ed-root-scrollbar",u==="knowledge_base"?"ed-pb-5":""),children:w?T.jsx("div",{className:"ed-h-full",children:Ot.size(F)?T.jsx(Cee,{articlesData:F,setArticleId:N,setSearchedText:_,setArticlesData:U}):T.jsx(Dne,{setIsCreateNewTicketClicked:P})}):T.jsx("div",{className:Ei("ed-space-y-4",u==="knowledge_base"?"ed-py-1":""),children:we()})}),T.jsx(Qle,{activeTab:u,handleTabChange:We,orgBrandSetting:h,hasLiveChat:te,isMobileScreen:s}),A&&T.jsx(Rte,{setIsCreateNewTicketClicked:P,setSearchedText:_,searchedText:w,isAuthenticated:e==null?void 0:e.isAuthenticated})]})})})]})},gce=[".ed-scope",".ed-","--ed-",".ed-tiptap"],yce="ed-widget-bundle-style",bce=()=>{var t;return(t=document.body)==null?void 0:t.classList.contains("ed-scope")},OT=t=>(t==null?void 0:t.tagName)==="STYLE"&&t.getAttribute("id")===yce,Sce=t=>{OT(t)&&t.getAttribute("data-ed-parent-style-disabled")!=="true"&&(t.setAttribute("media","not all"),t.setAttribute("data-ed-parent-style-disabled","true"))},Ece=(t,e)=>{if(!t)return!1;if(OT(t))return!0;if(t.tagName==="LINK")return e&&t.rel==="stylesheet"&&!!t.href;if(t.tagName!=="STYLE")return!1;if(e)return!0;const n=t.textContent||"";return gce.some(r=>n.includes(r))},TV=t=>{if(!(t!=null&&t.head))return;const e=bce();t.head.querySelectorAll('[data-ed-iframe-style-clone="true"]').forEach(n=>n.remove()),document.querySelectorAll('style, link[rel="stylesheet"]').forEach(n=>{if(!Ece(n,e))return;const r=n.cloneNode(!0);r.setAttribute("data-ed-iframe-style-clone","true"),OT(n)&&(r.removeAttribute("media"),r.removeAttribute("data-ed-parent-style-disabled"),e||Sce(n)),t.head.appendChild(r)})},Cce=({children:t,dimensions:e,position:n,themeColor:r})=>{const i=D.useRef(null),[s,l]=D.useState(null),[u,d]=D.useState(null);return D.useEffect(()=>{var w;const h=i.current;if(!h)return()=>{};const m=h.contentDocument||((w=h.contentWindow)==null?void 0:w.document);if(!m)return()=>{};const g=m.createElement("meta");g.name="viewport",g.content=`width=${window.innerWidth}, initial-scale=1.0`,m.head.appendChild(g);const y=()=>{const _=m.querySelector('meta[name="viewport"]');_&&(_.content=`width=${window.innerWidth}, initial-scale=1.0`)};window.addEventListener("resize",y);const b=m.createElement("style");b.textContent=`
1828
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};function MS(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(r){MS(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){MS(r,e)}),t.definitions&&t.definitions.forEach(function(r){MS(r,e)})}var kT={};(function(){RT.definitions.forEach(function(e){if(e.name){var n=new Set;MS(e,n),kT[e.name.value]=n}})})();function wV(t,e){for(var n=0;n<t.definitions.length;n++){var r=t.definitions[n];if(r.name&&r.name.value==e)return r}}function pce(t,e){var n={kind:t.kind,definitions:[wV(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=kT[e]||new Set,i=new Set,s=new Set;for(r.forEach(function(u){s.add(u)});s.size>0;){var l=s;s=new Set,l.forEach(function(u){if(!i.has(u)){i.add(u);var d=kT[u]||new Set;d.forEach(function(h){s.add(h)})}})}return i.forEach(function(u){var d=wV(t,u);d&&n.definitions.push(d)}),n}const mce=pce(RT,"GET_ARTICLES"),vce=t=>{const{userData:e,widgetIntent:n,isPopupOpen:r,setIsPopupOpen:i,isMobileScreen:s,setThemeColor:l}=t||{},{activeTab:u,setActiveTab:d,orgBrandSetting:h,setOrgBrandSetting:m,setCurrentConversationID:g,messageListUnreadCount:y}=mu(),{unreadMessages:b}=Jh(),C=y||Ot.size(b),[w,_]=D.useState(""),[R,k]=D.useState(null),[L,N]=D.useState(null),[A,P]=D.useState(!1),[F,U]=D.useState([]),[$,K]=D.useState(!1),[te,X]=D.useState(!1),[ne,Y]=D.useState(!1),[H,G]=D.useState(!1),Z=new URLSearchParams(window.location.search).get("intent");D.useEffect(()=>{const Me=Z||n;Me?Me==="chat"?(Y(!0),G(!1),d("messages"),i(!0)):Me==="kb"&&(G(!0),Y(!1),d("knowledge_base"),i(!0)):(Y(!1),G(!1),i(!1))},[n,Z]);const[J,{loading:le}]=Ph(mce,{errorPolicy:"all",fetchPolicy:"no-cache"}),{loading:re,data:ie}=Ih(j1,{errorPolicy:"all",fetchPolicy:"no-cache"}),ce=async Me=>{var Ue;const{data:fe,error:Ze}=await J(Me);fe!=null&&fe.getArticles&&U(((Ue=fe==null?void 0:fe.getArticles)==null?void 0:Ue.data)||[]),Ze&&console.error(Ze)};D.useEffect(()=>{var Me;ie!=null&&ie.getChannelsForPortal&&X(Ot.size((Me=ie==null?void 0:ie.getChannelsForPortal)==null?void 0:Me.data)>0)},[ie]);const ge=AM(Me=>{ce({variables:{queryData:{search_keyword:Me}}})},500),ye=Me=>{_(Me),ge(Me)},Re=async()=>{K(!0);try{const Me=await aJ();if(Me){const{font:fe,is_knowledge_base_enabled:Ze,theme_color:Ue}=Me;m(Me),l(Ue),gJ(fe),C>0&&te?d("messages"):Ze&&!te||Ze&&te?d("knowledge_base"):!Ze&&te&&d("messages"),K(!1)}}catch(Me){console.error(Me),K(!1)}},Se=()=>{const Me=document.getElementById("ed-widget");i(!r),r&&(e!=null&&e.isAuthenticated)&&g(null),_(""),k(null),N(null),P(!1),Re(),n&&Me&&Me.removeAttribute("ed-widget-intent"),Y(!1),G(!1)};D.useEffect(()=>{Re()},[]),D.useEffect(()=>{if(!h)return;const{is_knowledge_base_enabled:Me}=h;te&&ne?(d("messages"),i(!0)):Me&&H&&(d("knowledge_base"),i(!0))},[h,te,ne]);const we=()=>u==="knowledge_base"?T.jsx(Mne,{loading:le,articleId:L,isAuthenticated:e==null?void 0:e.isAuthenticated,selectedCategory:R,setArticleId:N,setSelectedCategory:k,orgBrandSetting:h,isMobileScreen:s}):u==="messages"?T.jsx(hce,{orgBrandSetting:h,setIsPopupOpen:i,userData:e}):null,{brand:$e,is_knowledge_base_enabled:Ge}=h||{},We=Me=>{d(Me),_(""),k(null),N(null),P(!1)};return!Ge&&!te?null:T.jsxs("div",{children:[te||Ge?T.jsx(Kle,{isPopupOpen:r,handlePopupTrigger:Se,orgBrandSetting:h,isAuthenticated:e==null?void 0:e.isAuthenticated,isMobileScreen:s}):null,T.jsx("div",{className:Ei("ed-fixed ed-flex ed-items-center ed-justify-center ed-z-[9999998]",s?"ed-bottom-0":"ed-bottom-16 ed-p-4 -ed-right-4",r?"ed-block":"ed-hidden"),children:T.jsx("div",{className:Ei("ed-right-0 ed-bg-white ed-shadow-lg ed-p-1 ed-overflow-hidden ed-transition-all ed-duration-300 ed-ease-in-out ed-flex ed-flex-col ed-relative",s?"":"ed-rounded-[10px]",r?Ei("ed-opacity-100",s?"ed-w-screen ed-h-dvh":"ed-w-[400px] ed-max-h-[704px] ed-h-[calc(90vh-20px)]"):"ed-opacity-0 ed-max-h-0 ed-h-0 ed-w-0 ed-pointer-events-none"),children:r&&T.jsxs(T.Fragment,{children:[T.jsx(Zle,{searchedText:w,selectedCategory:R,setSearchedText:_,setArticleId:N,setSelectedCategory:k,setIsPopupOpen:i,handleSearch:ye,setArticlesData:U,brandInfo:$e,activeTab:u,userData:e,isMobileScreen:s}),T.jsx("div",{className:Ei("ed-flex-1 ed-overflow-y-auto ed-no-scrollbar ed-root-scrollbar",u==="knowledge_base"?"ed-pb-5":""),children:w?T.jsx("div",{className:"ed-h-full",children:Ot.size(F)?T.jsx(Cee,{articlesData:F,setArticleId:N,setSearchedText:_,setArticlesData:U}):T.jsx(Dne,{setIsCreateNewTicketClicked:P})}):T.jsx("div",{className:Ei("ed-space-y-4",u==="knowledge_base"?"ed-py-1":""),children:we()})}),T.jsx(Qle,{activeTab:u,handleTabChange:We,orgBrandSetting:h,hasLiveChat:te,isMobileScreen:s}),A&&T.jsx(Rte,{setIsCreateNewTicketClicked:P,setSearchedText:_,searchedText:w,isAuthenticated:e==null?void 0:e.isAuthenticated})]})})})]})},gce=[".ed-scope",".ed-","--ed-",".ed-tiptap"],yce="ed-widget-bundle-style",bce=()=>{var t;return(t=document.body)==null?void 0:t.classList.contains("ed-scope")},OT=t=>(t==null?void 0:t.tagName)==="STYLE"&&t.getAttribute("id")===yce,Sce=t=>{OT(t)&&t.getAttribute("data-ed-parent-style-disabled")!=="true"&&(t.setAttribute("media","not all"),t.setAttribute("data-ed-parent-style-disabled","true"))},Ece=(t,e)=>{if(!t)return!1;if(OT(t))return!0;if(t.tagName==="LINK")return e&&t.rel==="stylesheet"&&!!t.href;if(t.tagName!=="STYLE")return!1;if(e)return!0;const n=t.textContent||"";return gce.some(r=>n.includes(r))},TV=t=>{if(!(t!=null&&t.head))return;const e=bce();t.head.querySelectorAll('[data-ed-iframe-style-clone="true"]').forEach(n=>n.remove()),document.querySelectorAll('style, link[rel="stylesheet"]').forEach(n=>{if(!Ece(n,e))return;const r=n.cloneNode(!0);r.setAttribute("data-ed-iframe-style-clone","true"),OT(n)&&(r.removeAttribute("media"),r.removeAttribute("data-ed-parent-style-disabled"),e||Sce(n)),t.head.appendChild(r)})},Cce=({children:t,dimensions:e,position:n,themeColor:r})=>{const i=D.useRef(null),[s,l]=D.useState(null),[u,d]=D.useState(null);return D.useEffect(()=>{var w;const h=i.current;if(!h)return()=>{};const m=h.contentDocument||((w=h.contentWindow)==null?void 0:w.document);if(!m)return()=>{};const g=m.createElement("meta");g.name="viewport",g.content=`width=${window.innerWidth}, initial-scale=1.0`,m.head.appendChild(g);const y=()=>{const _=m.querySelector('meta[name="viewport"]');_&&(_.content=`width=${window.innerWidth}, initial-scale=1.0`)};window.addEventListener("resize",y);const b=m.createElement("style");b.textContent=`
1829
1829
  html, body {
1830
1830
  margin: 0;
1831
1831
  padding: 0;