!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).ChatWidget=t(e.React,e.ReactDOM)}(this,function(e,t){"use strict";function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const r=n(e);var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s,a={exports:{}},c={};function u(){if(s)return c;s=1;var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var s,c={},u=null,l=null;for(s in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(l=t.ref),t)o.call(t,s)&&!a.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===c[s]&&(c[s]=t[s]);return{$$typeof:n,type:e,key:u,ref:l,props:c,_owner:i.current}}return c.Fragment=r,c.jsx=u,c.jsxs=u,c}var l,d,f={};function p(){return l||(l=1,"production"!=={}.NODE_ENV&&function(){var t,n=e,r=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y=Symbol.iterator,v=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=1&&l>=0&&a[u]!==c[l];)l--;for(;u>=1&&l>=0;u--,l--)if(a[u]!==c[l]){if(1!==u||1!==l)do{if(u--,--l<0||a[u]!==c[l]){var d="\n"+a[u].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),"function"==typeof e&&N.set(e,d),d}}while(u>=1&&l>=0);break}}}finally{P=!1,D.current=o,function(){if(0===--R){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:k}),info:A({},e,{value:w}),warn:A({},e,{value:x}),error:A({},e,{value:E}),group:A({},e,{value:T}),groupCollapsed:A({},e,{value:C}),groupEnd:A({},e,{value:I})})}R<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var f=e?e.displayName||e.name:"",p=f?L(f):"";return"function"==typeof e&&N.set(e,p),p}function B(e,t,n){if(null==e)return"";if("function"==typeof e)return F(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return L(e);switch(e){case d:return L("Suspense");case p:return L("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case l:return F(e.render,!1);case h:return B(e.type);case m:var o=e,i=o._payload,s=o._init;try{return B(s(i))}catch(a){}}return""}N=new j;var z=Object.prototype.hasOwnProperty,U={},$=v.ReactDebugCurrentFrame;function V(e){if(e){var t=B(e.type);$.setExtraStackFrame(t)}else $.setExtraStackFrame(null)}var q=Array.isArray;function W(e){return q(e)}function H(e){if(function(){try{return!1}catch(e){return!0}}())return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),function(e){return""+e}(e)}var K,Y,G=v.ReactCurrentOwner,J={key:!0,ref:!0,__self:!0,__source:!0};var X,Q=v.ReactCurrentOwner,Z=v.ReactDebugCurrentFrame;function ee(e){if(e){var t=B(e.type);Z.setExtraStackFrame(t)}else Z.setExtraStackFrame(null)}function te(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function ne(){if(Q.current){var e=S(Q.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}X=!1;var re={};function oe(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=ne();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!re[n]){re[n]=!0;var r="";e&&e._owner&&e._owner!==Q.current&&(r=" It was passed a child from "+S(e._owner.type)+"."),ee(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),ee(null)}}}function ie(e,t){if("object"==typeof e)if(W(e))for(var n=0;n",w=" Did you accidentally export a JSX literal instead of a component?"):k=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,w)}var x=function(e,t,n,o,i){var s,a={},c=null,u=null;for(s in void 0!==n&&(H(n),c=""+n),function(e){if(z.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(H(t.key),c=""+t.key),function(e){if(z.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(u=t.ref),t)z.call(t,s)&&!J.hasOwnProperty(s)&&(a[s]=t[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)void 0===a[s]&&(a[s]=l[s])}if(c||u){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;c&&function(e,t){var n=function(){K||(K=!0,_("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(a,d),u&&function(e,t){var n=function(){Y||(Y=!0,_("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(a,d)}return function(e,t,n,o,i,s,a){var c={$$typeof:r,type:e,key:t,ref:n,props:a,_owner:s,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}(e,c,u,i,o,G.current,a)}(e,n,o,y,v);if(null==x)return x;if(b){var E=n.children;if(void 0!==E)if(f)if(W(E)){for(var T=0;T0?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}";se[C+A]||(_('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',A,C,I.length>0?"{"+I.join(": ..., ")+": ...}":"{}",C),se[C+A]=!0)}return e===i?function(e){for(var t=Object.keys(e.props),n=0;nthis.map(e))):R(t)}}}class C extends E{constructor(e){super(),x(this,"state","hasError"),x(this,"contents",void 0),this.contents=e}getValue(){throw this.contents}toPromise(){return Promise.reject(this.contents)}valueMaybe(){}promiseMaybe(){}errorMaybe(){return this.contents}errorOrThrow(){return this.contents}map(e){return this}}class I extends E{constructor(e){super(),x(this,"state","loading"),x(this,"contents",void 0),this.contents=e}getValue(){throw this.contents}toPromise(){return this.contents}valueMaybe(){}promiseMaybe(){return this.contents}promiseOrThrow(){return this.contents}errorMaybe(){}map(e){return M(this.contents.then(t=>{const n=e(t);if(L(n)){const e=n;switch(e.state){case"hasValue":case"loading":return e.contents;case"hasError":throw e.contents}}return n}).catch(t=>{if(k(t))return t.then(()=>this.map(e).contents);throw t}))}}function A(e){return Object.freeze(new T(e))}function R(e){return Object.freeze(new C(e))}function M(e){return Object.freeze(new I(e))}function O(){return Object.freeze(new I(new Promise(()=>{})))}function D(e){const t=function(e){return e.every(e=>"hasValue"===e.state)?A(e.map(e=>e.contents)):e.some(e=>"hasError"===e.state)?R(w(e.find(e=>"hasError"===e.state),"Invalid loadable passed to loadableAll").contents):M(Promise.all(e.map(e=>e.contents)))}((Array.isArray(e)?e:Object.getOwnPropertyNames(e).map(t=>e[t])).map(e=>L(e)?e:k(e)?M(e):A(e)));return Array.isArray(e)?t:t.map(t=>Object.getOwnPropertyNames(e).reduce((e,n,r)=>({...e,[n]:t[r]}),{}))}function L(e){return e instanceof E}const N={of:e=>k(e)?M(e):L(e)?e:A(e),error:e=>R(e),loading:()=>O(),all:D,isLoadable:L};var P={loadableWithValue:A,loadableWithError:R,loadableWithPromise:M,loadableLoading:O,loadableAll:D,isLoadable:L,RecoilLoadable:N},j=P.loadableWithValue,F=P.loadableWithError,B=P.loadableWithPromise,z=P.loadableLoading,U=P.loadableAll,$=P.isLoadable,V=P.RecoilLoadable,q=Object.freeze({__proto__:null,loadableWithValue:j,loadableWithError:F,loadableWithPromise:B,loadableLoading:z,loadableAll:U,isLoadable:$,RecoilLoadable:V});const W={RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED:!0,RECOIL_GKS_ENABLED:new Set(["recoil_hamt_2020","recoil_sync_external_store","recoil_suppress_rerender_in_callback","recoil_memory_managament_2020"])};var H;"undefined"!=typeof process&&null!=(null===(H=process)||void 0===H?void 0:H.env)&&(function(e){var t,n;const r=null===(t=b[e])||void 0===t||null===(n=t.toLowerCase())||void 0===n?void 0:n.trim();if(null!=r&&""!==r){if(!["true","false"].includes(r))throw S(`process.env.${e} value must be 'true', 'false', or empty: ${r}`);o="true"===r,W.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=o}var o}("RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED"),function(){var e;const t=null===(e=b.RECOIL_GKS_ENABLED)||void 0===e?void 0:e.trim();null!=t&&""!==t&&t.split(/\s*,\s*|\s+/).forEach(e=>{W.RECOIL_GKS_ENABLED.add(e)})}());var K=W;function Y(e){return K.RECOIL_GKS_ENABLED.has(e)}Y.setPass=e=>{K.RECOIL_GKS_ENABLED.add(e)},Y.setFail=e=>{K.RECOIL_GKS_ENABLED.delete(e)},Y.clear=()=>{K.RECOIL_GKS_ENABLED.clear()};var G,J,X,Q=Y;const Z=null!==(G=e.createMutableSource)&&void 0!==G?G:e.unstable_createMutableSource,ee=null!==(J=e.useMutableSource)&&void 0!==J?J:e.unstable_useMutableSource,te=null!==(X=e.useSyncExternalStore)&&void 0!==X?X:e.unstable_useSyncExternalStore;let ne=!1;var re={createMutableSource:Z,useMutableSource:ee,useSyncExternalStore:te,currentRendererSupportsUseSyncExternalStore:function(){var t;const{ReactCurrentDispatcher:n,ReactCurrentOwner:r}=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,o=null!=(null!==(t=null==n?void 0:n.current)&&void 0!==t?t:r.currentDispatcher).useSyncExternalStore;return!te||o||ne||(ne=!0),o},reactMode:function(){return Q("recoil_transition_support")?{mode:"TRANSITION_SUPPORT",early:!0,concurrent:!0}:Q("recoil_sync_external_store")&&null!=te?{mode:"SYNC_EXTERNAL_STORE",early:!0,concurrent:!1}:Q("recoil_mutable_source")&&null!=ee&&"undefined"!=typeof window&&!window.$disableRecoilValueMutableSource_TEMP_HACK_DO_NOT_USE?Q("recoil_suppress_rerender_in_callback")?{mode:"MUTABLE_SOURCE",early:!0,concurrent:!0}:{mode:"MUTABLE_SOURCE",early:!1,concurrent:!1}:Q("recoil_suppress_rerender_in_callback")?{mode:"LEGACY",early:!0,concurrent:!1}:{mode:"LEGACY",early:!1,concurrent:!1}}};class oe{constructor(e){x(this,"key",void 0),this.key=e}toJSON(){return{key:this.key}}}class ie extends oe{}class se extends oe{}var ae={AbstractRecoilValue:oe,RecoilState:ie,RecoilValueReadOnly:se,isRecoilValue:function(e){return e instanceof ie||e instanceof se}},ce=ae.AbstractRecoilValue,ue=ae.RecoilState,le=ae.RecoilValueReadOnly,de=ae.isRecoilValue,fe=Object.freeze({__proto__:null,AbstractRecoilValue:ce,RecoilState:ue,RecoilValueReadOnly:le,isRecoilValue:de}),pe=function(e,...t){let n=0;return e.replace(/%s/g,()=>String(t[n++]))},he=function(e,...t){if("production"!==b.NODE_ENV){const n=pe.call(null,e,...t);new Error(n).name="Expectation Violation"}},me=function(e,t){return function*(){let n=0;for(const r of e)yield t(r,n++)}()};class ge{}const ye=new ge,ve=new Map,_e=new Map;class be extends Error{}const Se=new Map;function ke(e){return Se.get(e)}var we,xe,Ee={recoilValues:_e,registerNode:function(e){var t;K.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED&&(t=e.key,ve.has(t)&&"production"!==b.NODE_ENV&&he(`Duplicate atom key "${t}". This is a FATAL ERROR in\n production. But it is safe to ignore this warning if it occurred because of\n hot module replacement.`,"recoil")),ve.set(e.key,e);const n=null==e.set?new fe.RecoilValueReadOnly(e.key):new fe.RecoilState(e.key);return _e.set(e.key,n),n},getNode:function(e){const t=ve.get(e);if(null==t)throw new be(`Missing definition for RecoilValue: "${e}""`);return t},getNodeMaybe:function(e){return ve.get(e)},deleteNodeConfigIfPossible:function(e){var t;if(!Q("recoil_memory_managament_2020"))return;const n=ve.get(e);var r;null!=n&&null!==(t=n.shouldDeleteConfigOnRelease)&&void 0!==t&&t.call(n)&&(ve.delete(e),null===(r=ke(e))||void 0===r||r(),Se.delete(e))},setConfigDeletionHandler:function(e,t){Q("recoil_memory_managament_2020")&&(void 0===t?Se.delete(e):Se.set(e,t))},getConfigDeletionHandler:ke,recoilValuesForKeys:function(e){return me(e,e=>w(_e.get(e)))},DefaultValue:ge,DEFAULT_VALUE:ye},Te=function(e,t){t()},Ce=(we=function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n={},r=Math.pow(2,5),o=r-1,i=r/2,s=r/4,a={},c=function(e){return function(){return e}},u=n.hash=function(e){var n=void 0===e?"undefined":t(e);if("number"===n)return e;"string"!==n&&(e+="");for(var r=0,o=0,i=e.length;o>>e&o},d=function(e){return 1<>1&1431655765))+(n>>2&858993459))+(n>>4)&252645135,127&(n+=n>>8)+(n>>16);var n},p=function(e,t,n,r){var o=r;if(!e){var i=r.length;o=new Array(i);for(var s=0;s1?v(e,this.hash,c):c[0]}var u=r();return u===a?this:(++s.value,S(e,n,this.hash,this,o,y(e,o,i,u)))},E=function(e,t,n,r,o,s,a){var c=this.mask,u=this.children,y=l(n,o),v=d(y),S=f(c,v),w=c&v,x=w?u[S]:m,E=x._modify(e,t,n+5,r,o,s,a);if(x===E)return this;var T,C=k(e,this),I=c,A=void 0;if(w&&g(E)){if(!(I&=~v))return m;if(u.length<=2&&((T=u[1^S])===m||1===T.type||2===T.type))return u[1^S];A=h(C,S,u)}else if(w||g(E))A=p(C,S,E,u);else{if(u.length>=i)return function(e,t,n,r,o){for(var i=[],s=r,a=0,c=0;s;++c)1&s&&(i[c]=o[a++]),s>>>=1;return i[t]=n,b(e,a+1,i)}(e,y,E,c,u);I|=v,A=function(e,t,n,r){var o=r.length;if(e){for(var i=o;i>=t;)r[i--]=r[i];return r[t]=n,r}for(var s=0,a=0,c=new Array(o+1);s{n.set(r,t(e,r))}),n};function Ne(e,t,n,r){const{nodeDeps:o,nodeToNodeSubscriptions:i}=n,s=o.get(e);if(s&&r&&s!==r.nodeDeps.get(e))return;o.set(e,t);const a=null==s?t:De(t,s);for(const c of a)i.has(c)||i.set(c,new Set),w(i.get(c)).add(e);if(s){const n=De(s,t);for(const t of n){if(!i.has(t))return;const n=w(i.get(t));n.delete(e),0===n.size&&i.delete(t)}}}var Pe={cloneGraph:function(e){return{nodeDeps:Le(e.nodeDeps,e=>new Set(e)),nodeToNodeSubscriptions:Le(e.nodeToNodeSubscriptions,e=>new Set(e))}},graph:function(){return{nodeDeps:new Map,nodeToNodeSubscriptions:new Map}},saveDepsToStore:function(e,t,n,r){var o,i,s,a;const c=n.getState();r!==c.currentTree.version&&r!==(null===(o=c.nextTree)||void 0===o?void 0:o.version)&&(null===(i=c.previousTree)||void 0===i||i.version);const u=n.getGraph(r);if(Ne(e,t,u),r===(null===(s=c.previousTree)||void 0===s?void 0:s.version)&&Ne(e,t,n.getGraph(c.currentTree.version),u),r===(null===(a=c.previousTree)||void 0===a?void 0:a.version)||r===c.currentTree.version){var l;const r=null===(l=c.nextTree)||void 0===l?void 0:l.version;void 0!==r&&Ne(e,t,n.getGraph(r),u)}}};let je=0,Fe=0,Be=0;var ze={getNextTreeStateVersion:()=>je++,getNextStoreID:()=>Fe++,getNextComponentID:()=>Be++};const{persistentMap:Ue}=Oe,{graph:$e}=Pe,{getNextTreeStateVersion:Ve}=ze;var qe={makeEmptyStoreState:function(){const e=function(){const e=Ve();return{version:e,stateID:e,transactionMetadata:{},dirtyAtoms:new Set,atomValues:Ue(),nonvalidatedAtoms:Ue()}}();return{currentTree:e,nextTree:null,previousTree:null,commitDepth:0,knownAtoms:new Set,knownSelectors:new Set,transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(e.version,$e()),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map}},getNextTreeStateVersion:Ve},We={RetentionZone:class{}},He={setByAddingToSet:function(e,t){const n=new Set(e);return n.add(t),n}},Ke=function*(e,t){let n=0;for(const r of e)t(r,n++)&&(yield r)},Ye=function(e,t){return new Proxy(e,{get:(e,n)=>(!(n in e)&&n in t&&(e[n]=t[n]()),e[n]),ownKeys:e=>Object.keys(e)})};const{getNode:Ge,getNodeMaybe:Je,recoilValuesForKeys:Xe}=Ee,{RetentionZone:Qe}=We,{setByAddingToSet:Ze}=He,et=Object.freeze(new Set);class tt extends Error{}function nt(e,t,n,r){const o=e.getState();if(o.nodeCleanupFunctions.has(n))return;const i=Ge(n),s=function(e,t,n){if(!Q("recoil_memory_managament_2020"))return()=>{};const{nodesRetainedByZone:r}=e.getState().retention;function o(e){let n=r.get(e);n||r.set(e,n=new Set),n.add(t)}if(n instanceof Qe)o(n);else if(Array.isArray(n))for(const i of n)o(i);return()=>{if(!Q("recoil_memory_managament_2020"))return;const{retention:r}=e.getState();function o(e){const n=r.nodesRetainedByZone.get(e);null==n||n.delete(t),n&&0===n.size&&r.nodesRetainedByZone.delete(e)}if(n instanceof Qe)o(n);else if(Array.isArray(n))for(const e of n)o(e)}}(e,n,i.retainedBy),a=i.init(e,t,r);o.nodeCleanupFunctions.set(n,()=>{a(),s()})}function rt(e,t,n){return Ge(n).peek(e,t)}function ot(e,t,n){const r=new Set,o=Array.from(n),i=e.getGraph(t.version);for(let a=o.pop();a;a=o.pop()){var s;r.add(a);const e=null!==(s=i.nodeToNodeSubscriptions.get(a))&&void 0!==s?s:et;for(const t of e)r.has(t)||o.push(t)}return r}var it={getNodeLoadable:function(e,t,n){return nt(e,t,n,"get"),Ge(n).get(e,t)},peekNodeLoadable:rt,setNodeValue:function(e,t,n,r){const o=Ge(n);if(null==o.set)throw new tt(`Attempt to set read-only RecoilValue: ${n}`);const i=o.set;return nt(e,t,n,"set"),i(e,t,r)},initializeNode:function(e,t,n){nt(e,e.getState().currentTree,t,n)},cleanUpNode:function(e,t){var n;const r=e.getState();null===(n=r.nodeCleanupFunctions.get(t))||void 0===n||n(),r.nodeCleanupFunctions.delete(t)},setUnvalidatedAtomValue_DEPRECATED:function(e,t,n){var r;const o=Je(t);return null==o||null===(r=o.invalidate)||void 0===r||r.call(o,e),{...e,atomValues:e.atomValues.clone().delete(t),nonvalidatedAtoms:e.nonvalidatedAtoms.clone().set(t,n),dirtyAtoms:Ze(e.dirtyAtoms,t)}},peekNodeInfo:function(e,t,n){const r=e.getState(),o=e.getGraph(t.version),i=Ge(n).nodeType;return Ye({type:i},{loadable:()=>rt(e,t,n),isActive:()=>r.knownAtoms.has(n)||r.knownSelectors.has(n),isSet:()=>"selector"!==i&&t.atomValues.has(n),isModified:()=>t.dirtyAtoms.has(n),deps:()=>{var e;return Xe(null!==(e=o.nodeDeps.get(n))&&void 0!==e?e:[])},subscribers:()=>{var o,i;return{nodes:Xe(Ke(ot(e,t,new Set([n])),e=>e!==n)),components:me(null!==(o=null===(i=r.nodeToComponentSubscriptions.get(n))||void 0===i?void 0:i.values())&&void 0!==o?o:[],([e])=>({name:e}))}}})},getDownstreamNodes:ot};let st=null;var at={setInvalidateMemoizedSnapshot:function(e){st=e},invalidateMemoizedSnapshot:function(){var e;null===(e=st)||void 0===e||e()}};const{getDownstreamNodes:ct,getNodeLoadable:ut,setNodeValue:lt}=it,{getNextComponentID:dt}=ze,{getNode:ft,getNodeMaybe:pt}=Ee,{DefaultValue:ht}=Ee,{reactMode:mt}=re,{AbstractRecoilValue:gt}=fe,{invalidateMemoizedSnapshot:yt}=at;function vt(e,t,n){if("set"===n.type){const{recoilValue:r,valueOrUpdater:o}=n,i=function(e,t,{key:n},r){if("function"==typeof r){const o=ut(e,t,n);if("loading"===o.state){const e=`Tried to set atom or selector "${n}" using an updater function while the current state is pending, this is not currently supported.`;throw S(e)}if("hasError"===o.state)throw o.contents;return r(o.contents)}return r}(e,t,r,o),s=lt(e,t,r.key,i);for(const[e,n]of s.entries())_t(t,e,n)}else if("setLoadable"===n.type){const{recoilValue:{key:e},loadable:r}=n;_t(t,e,r)}else if("markModified"===n.type){const{recoilValue:{key:e}}=n;t.dirtyAtoms.add(e)}else if("setUnvalidated"===n.type){var r;const{recoilValue:{key:e},unvalidatedValue:o}=n,i=pt(e);null==i||null===(r=i.invalidate)||void 0===r||r.call(i,t),t.atomValues.delete(e),t.nonvalidatedAtoms.set(e,o),t.dirtyAtoms.add(e)}else n.type}function _t(e,t,n){"hasValue"===n.state&&n.contents instanceof ht?e.atomValues.delete(t):e.atomValues.set(t,n),e.dirtyAtoms.add(t),e.nonvalidatedAtoms.delete(t)}function bt(e,t){e.replaceState(n=>{const r=wt(n);for(const o of t)vt(e,r,o);return xt(e,r),yt(),r})}function St(e,t){if(kt.length){const n=kt[kt.length-1];let r=n.get(e);r||n.set(e,r=[]),r.push(t)}else bt(e,[t])}const kt=[];function wt(e){return{...e,atomValues:e.atomValues.clone(),nonvalidatedAtoms:e.nonvalidatedAtoms.clone(),dirtyAtoms:new Set(e.dirtyAtoms)}}function xt(e,t){const n=ct(e,t,t.dirtyAtoms);for(const i of n){var r,o;null===(r=pt(i))||void 0===r||null===(o=r.invalidate)||void 0===o||o.call(r,t)}}function Et(e,t,n){St(e,{type:"set",recoilValue:t,valueOrUpdater:n})}var Tt={AbstractRecoilValue:gt,getRecoilValueAsLoadable:function(e,{key:t},n=e.getState().currentTree){var r,o;const i=e.getState();n.version!==i.currentTree.version&&n.version!==(null===(r=i.nextTree)||void 0===r?void 0:r.version)&&(n.version,null===(o=i.previousTree)||void 0===o||o.version);const s=ut(e,n,t);return"loading"===s.state&&s.contents.catch(()=>{}),s},setRecoilValue:Et,setRecoilValueLoadable:function(e,t,n){if(n instanceof ht)return Et(e,t,n);St(e,{type:"setLoadable",recoilValue:t,loadable:n})},markRecoilValueModified:function(e,t){St(e,{type:"markModified",recoilValue:t})},setUnvalidatedRecoilValue:function(e,t,n){St(e,{type:"setUnvalidated",recoilValue:t,unvalidatedValue:n})},subscribeToRecoilValue:function(e,{key:t},n,r=null){const o=dt(),i=e.getState();i.nodeToComponentSubscriptions.has(t)||i.nodeToComponentSubscriptions.set(t,new Map),w(i.nodeToComponentSubscriptions.get(t)).set(o,[null!=r?r:"",n]);const s=mt();if(s.early&&("LEGACY"===s.mode||"MUTABLE_SOURCE"===s.mode)){const r=e.getState().nextTree;r&&r.dirtyAtoms.has(t)&&n(r)}return{release:()=>{const n=e.getState(),r=n.nodeToComponentSubscriptions.get(t);void 0!==r&&r.has(o)&&(r.delete(o),0===r.size&&n.nodeToComponentSubscriptions.delete(t))}}},applyAtomValueWrites:function(e,t){const n=e.clone();return t.forEach((e,t)=>{"hasValue"===e.state&&e.contents instanceof ht?n.delete(t):n.set(t,e)}),n},batchStart:function(){const e=new Map;return kt.push(e),()=>{for(const[t,n]of e)bt(t,n);kt.pop()}},writeLoadableToTreeState:_t,invalidateDownstreams:xt,copyTreeState:wt,refreshRecoilValue:function(e,t){var n;const{currentTree:r}=e.getState(),o=ft(t.key);null===(n=o.clearCache)||void 0===n||n.call(o,e,r)}},Ct=function(e,t,n){const r=e.entries();let o=r.next();for(;!o.done;){const i=o.value;if(t.call(n,i[1],i[0],e))return!0;o=r.next()}return!1};const{cleanUpNode:It}=it,{deleteNodeConfigIfPossible:At,getNode:Rt}=Ee,{RetentionZone:Mt}=We,Ot=new Set;function Dt(e,t){const n=e.getState(),r=n.currentTree;if(n.nextTree)return;const o=new Set;for(const s of t)if(s instanceof Mt)for(const e of Nt(n,s))o.add(e);else o.add(s);const i=function(e,t){const n=e.getState(),r=n.currentTree,o=e.getGraph(r.version),i=new Set,s=new Set;return function t(a){const c=new Set,u=function(e,t,n,r,o){const i=e.getGraph(t.version),s=[],a=new Set;for(;n.size>0;)c(w(n.values().next().value));return s;function c(e){if(r.has(e)||o.has(e))return void n.delete(e);if(a.has(e))return;const t=i.nodeToNodeSubscriptions.get(e);if(t)for(const n of t)c(n);a.add(e),n.delete(e),s.push(e)}}(e,r,a,i,s);for(const e of u){var l;if("recoilRoot"===Rt(e).retainedBy){s.add(e);continue}if((null!==(l=n.retention.referenceCounts.get(e))&&void 0!==l?l:0)>0){s.add(e);continue}if(Pt(e).some(e=>n.retention.referenceCounts.get(e))){s.add(e);continue}const t=o.nodeToNodeSubscriptions.get(e);t&&Ct(t,e=>s.has(e))?s.add(e):(i.add(e),c.add(e))}const d=new Set;for(const e of c)for(const t of null!==(f=o.nodeDeps.get(e))&&void 0!==f?f:Ot){var f;i.has(t)||d.add(t)}d.size&&t(d)}(t),i}(e,o);for(const s of i)Lt(e,r,s)}function Lt(e,t,n){if(!Q("recoil_memory_managament_2020"))return;It(e,n);const r=e.getState();r.knownAtoms.delete(n),r.knownSelectors.delete(n),r.nodeTransactionSubscriptions.delete(n),r.retention.referenceCounts.delete(n);const o=Pt(n);for(const c of o){var i;null===(i=r.retention.nodesRetainedByZone.get(c))||void 0===i||i.delete(n)}t.atomValues.delete(n),t.dirtyAtoms.delete(n),t.nonvalidatedAtoms.delete(n);const s=r.graphsByVersion.get(t.version);if(s){const e=s.nodeDeps.get(n);if(void 0!==e){s.nodeDeps.delete(n);for(const t of e){var a;null===(a=s.nodeToNodeSubscriptions.get(t))||void 0===a||a.delete(n)}}s.nodeToNodeSubscriptions.delete(n)}At(n)}function Nt(e,t){var n;return null!==(n=e.retention.nodesRetainedByZone.get(t))&&void 0!==n?n:Ot}function Pt(e){const t=Rt(e).retainedBy;return void 0===t||"components"===t||"recoilRoot"===t?[]:t instanceof Mt?[t]:t}var jt={SUSPENSE_TIMEOUT_MS:12e4,updateRetainCount:function(e,t,n){var r;if(!Q("recoil_memory_managament_2020"))return;const o=e.getState().retention.referenceCounts,i=(null!==(r=o.get(t))&&void 0!==r?r:0)+n;0===i?function(e,t){if(!Q("recoil_memory_managament_2020"))return;e.getState().retention.referenceCounts.delete(t),function(e,t){const n=e.getState();n.nextTree?n.retention.retainablesToCheckForRelease.add(t):Dt(e,new Set([t]))}(e,t)}(e,t):o.set(t,i)},releaseScheduledRetainablesNow:function(e){if(!Q("recoil_memory_managament_2020"))return;const t=e.getState();Dt(e,t.retention.retainablesToCheckForRelease),t.retention.retainablesToCheckForRelease.clear()},retainedByOptionWithDefault:function(e){return void 0===e?"recoilRoot":e}};const{unstable_batchedUpdates:Ft}=t;var Bt={unstable_batchedUpdates:Ft};const{unstable_batchedUpdates:zt}=Bt;var Ut={unstable_batchedUpdates:zt};const{batchStart:$t}=Tt,{unstable_batchedUpdates:Vt}=Ut;let qt=Vt||(e=>e());var Wt={batchUpdates:e=>{qt(()=>{let t=()=>{};try{t=$t(),e()}finally{t()}})}},Ht=function*(e){for(const t of e)for(const e of t)yield e};const Kt="undefined"==typeof Window||"undefined"==typeof window,Yt="undefined"!=typeof navigator&&"ReactNative"===navigator.product;var Gt={isSSR:Kt,isReactNative:Yt,isWindow:e=>!Kt&&(e===window||e instanceof Window)};const{batchUpdates:Jt}=Wt,{initializeNode:Xt,peekNodeInfo:Qt}=it,{graph:Zt}=Pe,{getNextStoreID:en}=ze,{DEFAULT_VALUE:tn,recoilValues:nn,recoilValuesForKeys:rn}=Ee,{AbstractRecoilValue:on,getRecoilValueAsLoadable:sn,setRecoilValue:an,setUnvalidatedRecoilValue:cn}=Tt,{updateRetainCount:un}=jt,{setInvalidateMemoizedSnapshot:ln}=at,{getNextTreeStateVersion:dn,makeEmptyStoreState:fn}=qe,{isSSR:pn}=Gt,{memoizeOneWithArgsHashAndInvalidation:hn}={memoizeOneWithArgsHashAndInvalidation:function(e,t){let n,r;return[(...o)=>{const i=t(...o);return n===i||(n=i,r=e(...o)),r},()=>{n=null}]}};class mn{constructor(e,t){x(this,"_store",void 0),x(this,"_refCount",1),x(this,"getLoadable",e=>(this.checkRefCount_INTERNAL(),sn(this._store,e))),x(this,"getPromise",e=>(this.checkRefCount_INTERNAL(),this.getLoadable(e).toPromise())),x(this,"getNodes_UNSTABLE",e=>{if(this.checkRefCount_INTERNAL(),!0===(null==e?void 0:e.isModified)){if(!1===(null==e?void 0:e.isInitialized))return[];const t=this._store.getState().currentTree;return rn(t.dirtyAtoms)}const t=this._store.getState().knownAtoms,n=this._store.getState().knownSelectors;return null==(null==e?void 0:e.isInitialized)?nn.values():!0===e.isInitialized?rn(Ht([t,n])):Ke(nn.values(),({key:e})=>!t.has(e)&&!n.has(e))}),x(this,"getInfo_UNSTABLE",({key:e})=>(this.checkRefCount_INTERNAL(),Qt(this._store,this._store.getState().currentTree,e))),x(this,"map",e=>{this.checkRefCount_INTERNAL();const t=new _n(this,Jt);return e(t),t}),x(this,"asyncMap",async e=>{this.checkRefCount_INTERNAL();const t=new _n(this,Jt);return t.retain(),await e(t),t.autoRelease_INTERNAL(),t}),this._store={storeID:en(),parentStoreID:t,getState:()=>e,replaceState:t=>{e.currentTree=t(e.currentTree)},getGraph:t=>{const n=e.graphsByVersion;if(n.has(t))return w(n.get(t));const r=Zt();return n.set(t,r),r},subscribeToTransactions:()=>({release:()=>{}}),addTransactionMetadata:()=>{throw S("Cannot subscribe to Snapshots")}};for(const n of this._store.getState().knownAtoms)Xt(this._store,n,"get"),un(this._store,n,1);this.autoRelease_INTERNAL()}retain(){if(this._refCount<=0&&"production"!==b.NODE_ENV)throw S("Snapshot has already been released.");this._refCount++;let e=!1;return()=>{e||(e=!0,this._release())}}autoRelease_INTERNAL(){pn||window.setTimeout(()=>this._release(),10)}_release(){if(this._refCount--,0===this._refCount){if(this._store.getState().nodeCleanupFunctions.forEach(e=>e()),this._store.getState().nodeCleanupFunctions.clear(),!Q("recoil_memory_managament_2020"))return}else this._refCount}isRetained(){return this._refCount>0}checkRefCount_INTERNAL(){Q("recoil_memory_managament_2020")&&this._refCount}getStore_INTERNAL(){return this.checkRefCount_INTERNAL(),this._store}getID(){return this.checkRefCount_INTERNAL(),this._store.getState().currentTree.stateID}getStoreID(){return this.checkRefCount_INTERNAL(),this._store.storeID}}function gn(e,t,n=!1){const r=e.getState(),o=n?dn():t.version;return{currentTree:{version:n?o:t.version,stateID:n?o:t.stateID,transactionMetadata:{...t.transactionMetadata},dirtyAtoms:new Set(t.dirtyAtoms),atomValues:t.atomValues.clone(),nonvalidatedAtoms:t.nonvalidatedAtoms.clone()},commitDepth:0,nextTree:null,previousTree:null,knownAtoms:new Set(r.knownAtoms),knownSelectors:new Set(r.knownSelectors),transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(o,e.getGraph(t.version)),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map(me(r.nodeCleanupFunctions.entries(),([e])=>[e,()=>{}]))}}const[yn,vn]=hn((e,t)=>{var n;const r=e.getState(),o="latest"===t?null!==(n=r.nextTree)&&void 0!==n?n:r.currentTree:w(r.previousTree);return new mn(gn(e,o),e.storeID)},(e,t)=>{var n,r;return String(t)+String(e.storeID)+String(null===(n=e.getState().nextTree)||void 0===n?void 0:n.version)+String(e.getState().currentTree.version)+String(null===(r=e.getState().previousTree)||void 0===r?void 0:r.version)});ln(vn);class _n extends mn{constructor(e,t){super(gn(e.getStore_INTERNAL(),e.getStore_INTERNAL().getState().currentTree,!0),e.getStoreID()),x(this,"_batch",void 0),x(this,"set",(e,t)=>{this.checkRefCount_INTERNAL();const n=this.getStore_INTERNAL();this._batch(()=>{un(n,e.key,1),an(this.getStore_INTERNAL(),e,t)})}),x(this,"reset",e=>{this.checkRefCount_INTERNAL();const t=this.getStore_INTERNAL();this._batch(()=>{un(t,e.key,1),an(this.getStore_INTERNAL(),e,tn)})}),x(this,"setUnvalidatedAtomValues_DEPRECATED",e=>{this.checkRefCount_INTERNAL();const t=this.getStore_INTERNAL();Jt(()=>{for(const[n,r]of e.entries())un(t,n,1),cn(t,new on(n),r)})}),this._batch=t}}var bn={Snapshot:mn,MutableSnapshot:_n,freshSnapshot:function(e){const t=new mn(fn());return null!=e?t.map(e):t},cloneSnapshot:function(e,t="latest"){const n=yn(e,t);return n.isRetained()?n:(vn(),yn(e,t))}},Sn=bn.Snapshot,kn=bn.MutableSnapshot,wn=bn.freshSnapshot,xn=bn.cloneSnapshot,En=Object.freeze({__proto__:null,Snapshot:Sn,MutableSnapshot:kn,freshSnapshot:wn,cloneSnapshot:xn}),Tn=function(...e){const t=new Set;for(const n of e)for(const e of n)t.add(e);return t};const{useRef:Cn}=e;var In=function(e){const t=Cn(e);return t.current===e&&"function"==typeof e&&(t.current=e()),t};const{getNextTreeStateVersion:An,makeEmptyStoreState:Rn}=qe,{cleanUpNode:Mn,getDownstreamNodes:On,initializeNode:Dn,setNodeValue:Ln,setUnvalidatedAtomValue_DEPRECATED:Nn}=it,{graph:Pn}=Pe,{cloneGraph:jn}=Pe,{getNextStoreID:Fn}=ze,{createMutableSource:Bn,reactMode:zn}=re,{applyAtomValueWrites:Un}=Tt,{releaseScheduledRetainablesNow:$n}=jt,{freshSnapshot:Vn}=En,{useCallback:qn,useContext:Wn,useEffect:Hn,useMemo:Kn,useRef:Yn,useState:Gn}=e;function Jn(){throw S("This component must be used inside a component.")}const Xn=Object.freeze({storeID:Fn(),getState:Jn,replaceState:Jn,getGraph:Jn,subscribeToTransactions:Jn,addTransactionMetadata:Jn});let Qn=!1;function Zn(e){if(Qn)throw S("An atom update was triggered within the execution of a state updater function. State updater functions provided to Recoil must be pure functions.");const t=e.getState();if(null===t.nextTree){Q("recoil_memory_managament_2020")&&Q("recoil_release_on_cascading_update_killswitch_2021")&&t.commitDepth>0&&$n(e);const n=t.currentTree.version,r=An();t.nextTree={...t.currentTree,version:r,stateID:r,dirtyAtoms:new Set,transactionMetadata:{}},t.graphsByVersion.set(r,jn(w(t.graphsByVersion.get(n))))}}const er=e.createContext({current:Xn}),tr=()=>Wn(er),nr=e.createContext(null);function rr(e,t,n){const r=On(e,n,n.dirtyAtoms);for(const o of r){const e=t.nodeToComponentSubscriptions.get(o);if(e)for(const[t,[r,o]]of e)o(n)}}function or({setNotifyBatcherOfChange:e}){const t=tr(),[,n]=Gn([]);return e(()=>n({})),Hn(()=>(e(()=>n({})),()=>{e(()=>{})}),[e]),Hn(()=>{Te("Batcher",()=>{!function(e){const t=e.getState();t.commitDepth++;try{const{nextTree:n}=t;if(null==n)return;t.previousTree=t.currentTree,t.currentTree=n,t.nextTree=null,function(e){const t=e.getState(),n=t.currentTree,r=n.dirtyAtoms;if(r.size){for(const[n,o]of t.nodeTransactionSubscriptions)if(r.has(n))for(const[t,r]of o)r(e);for(const[n,r]of t.transactionSubscriptions)r(e);(!zn().early||t.suspendedComponentResolvers.size>0)&&(rr(e,t,n),t.suspendedComponentResolvers.forEach(e=>e()),t.suspendedComponentResolvers.clear())}t.queuedComponentCallbacks_DEPRECATED.forEach(e=>e(n)),t.queuedComponentCallbacks_DEPRECATED.splice(0,t.queuedComponentCallbacks_DEPRECATED.length)}(e),null!=t.previousTree&&t.graphsByVersion.delete(t.previousTree.version),t.previousTree=null,Q("recoil_memory_managament_2020")&&null==n&&$n(e)}finally{t.commitDepth--}}(t.current)})}),null}"production"!==b.NODE_ENV&&("undefined"==typeof window||window.$recoilDebugStates||(window.$recoilDebugStates=[]));let ir=0;function sr({initializeState_DEPRECATED:t,initializeState:n,store_INTERNAL:r,children:o}){let i;const s=e=>{const t=i.current.graphsByVersion;if(t.has(e))return w(t.get(e));const n=Pn();return t.set(e,n),n},a=(e,t)=>{if(null==t){const{transactionSubscriptions:t}=f.current.getState(),n=ir++;return t.set(n,e),{release:()=>{t.delete(n)}}}{const{nodeTransactionSubscriptions:n}=f.current.getState();n.has(t)||n.set(t,new Map);const r=ir++;return w(n.get(t)).set(r,e),{release:()=>{const e=n.get(t);e&&(e.delete(r),0===e.size&&n.delete(t))}}}},c=e=>{Zn(f.current);for(const t of Object.keys(e))w(f.current.getState().nextTree).transactionMetadata[t]=e[t]},u=e=>{Zn(f.current);const t=w(i.current.nextTree);let n;try{Qn=!0,n=e(t)}finally{Qn=!1}n!==t&&("production"!==b.NODE_ENV&&"undefined"!=typeof window&&window.$recoilDebugStates.push(n),i.current.nextTree=n,zn().early&&rr(f.current,i.current,n),w(l.current)())},l=Yn(null),d=qn(e=>{l.current=e},[l]),f=In(()=>null!=r?r:{storeID:Fn(),getState:()=>i.current,replaceState:u,getGraph:s,subscribeToTransactions:a,addTransactionMetadata:c});null!=r&&(f.current=r),i=In(()=>null!=t?function(e,t){const n=Rn();return t({set:(t,r)=>{const o=n.currentTree,i=Ln(e,o,t.key,r),s=new Set(i.keys()),a=o.nonvalidatedAtoms.clone();for(const e of s)a.delete(e);n.currentTree={...o,dirtyAtoms:Tn(o.dirtyAtoms,s),atomValues:Un(o.atomValues,i),nonvalidatedAtoms:a}},setUnvalidatedAtomValues:e=>{e.forEach((e,t)=>{n.currentTree=Nn(n.currentTree,t,e)})}}),n}(f.current,t):null!=n?function(e){const t=Vn(e),n=t.getStore_INTERNAL().getState();return t.retain(),n.nodeCleanupFunctions.forEach(e=>e()),n.nodeCleanupFunctions.clear(),n}(n):Rn());const p=Kn(()=>null==Bn?void 0:Bn(i,()=>i.current.currentTree.version),[i]);return Hn(()=>{const e=f.current;for(const t of new Set(e.getState().knownAtoms))Dn(e,t,"get");return()=>{for(const t of e.getState().knownAtoms)Mn(e,t)}},[f]),e.createElement(er.Provider,{value:f},e.createElement(nr.Provider,{value:p},e.createElement(or,{setNotifyBatcherOfChange:d}),o))}var ar={RecoilRoot:function(t){const{override:n,...r}=t,o=tr();return!1===n&&o.current!==Xn?t.children:e.createElement(sr,r)},useStoreRef:tr,useRecoilMutableSource:function(){const e=Wn(nr);return null==e&&he("Attempted to use a Recoil hook outside of a . must be an ancestor of any component that uses Recoil hooks."),e}};const{useEffect:cr,useRef:ur}=e;const{useStoreRef:lr}=ar,{SUSPENSE_TIMEOUT_MS:dr}=jt,{updateRetainCount:fr}=jt,{RetentionZone:pr}=We,{useEffect:hr,useRef:mr}=e,{isSSR:gr}=Gt;var yr=function(e){if(Q("recoil_memory_managament_2020"))return function(e){const t=(Array.isArray(e)?e:[e]).map(e=>e instanceof pr?e:e.key),n=lr();hr(()=>{if(!Q("recoil_memory_managament_2020"))return;const e=n.current;if(r.current&&!gr)window.clearTimeout(r.current),r.current=null;else for(const n of t)fr(e,n,1);return()=>{for(const n of t)fr(e,n,-1)}},[n,...t]);const r=mr(),o=function(e){const t=ur();return cr(()=>{t.current=e}),t.current}(t);if(!(gr||void 0!==o&&function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0,r=e.length;n{r.current=null;for(const n of t)fr(e,n,-1)},dr)}}(e)};const{DEFAULT_VALUE:vr}=Ee,{currentRendererSupportsUseSyncExternalStore:_r,reactMode:br,useMutableSource:Sr,useSyncExternalStore:kr}=re,{useRecoilMutableSource:wr,useStoreRef:xr}=ar,{isRecoilValue:Er}=fe,{getRecoilValueAsLoadable:Tr,setRecoilValue:Cr,subscribeToRecoilValue:Ir}=Tt,{useCallback:Ar,useEffect:Rr,useMemo:Mr,useRef:Or,useState:Dr}=e,{isSSR:Lr}=Gt;function Nr(e,t){if(!Er(e))throw S(`Invalid argument to ${t}: expected an atom or selector but got ${String(e)}`)}function Pr(e){const t=xr(),n="",r=Ar(()=>{var n;const r=t.current,o=r.getState(),i=br().early&&null!==(n=o.nextTree)&&void 0!==n?n:o.currentTree;return{loadable:Tr(r,e,i),key:e.key}},[t,e]),o=Ar(e=>{let t;return()=>{var n,r;const o=e();return null!==(n=t)&&void 0!==n&&n.loadable.is(o.loadable)&&(null===(r=t)||void 0===r?void 0:r.key)===o.key?t:(t=o,o)}},[]),i=Mr(()=>o(r),[r,o]),s=Ar(r=>{const o=t.current;return Ir(o,e,r,n).release},[t,e,n]);return kr(s,i,i).loadable}function jr(e){const t=xr(),n=Ar(()=>{var n;const r=t.current,o=r.getState(),i=br().early&&null!==(n=o.nextTree)&&void 0!==n?n:o.currentTree;return Tr(r,e,i)},[t,e]),r=Ar(()=>n(),[n]),o="",i=Ar((r,i)=>{const s=t.current;return Ir(s,e,()=>{if(!Q("recoil_suppress_rerender_in_callback"))return i();const e=n();c.current.is(e)||i(),c.current=e},o).release},[t,e,o,n]),s=wr();if(null==s)throw S("Recoil hooks must be used in components contained within a component.");const a=Sr(s,r,i),c=Or(a);return Rr(()=>{c.current=a}),a}function Fr(e){const t=xr(),n="",r=Ar(()=>{var n;const r=t.current,o=r.getState(),i=br().early&&null!==(n=o.nextTree)&&void 0!==n?n:o.currentTree;return Tr(r,e,i)},[t,e]),o=Ar(()=>({loadable:r(),key:e.key}),[r,e.key]),i=Ar(e=>{const t=o();return e.loadable.is(t.loadable)&&e.key===t.key?e:t},[o]);Rr(()=>{const r=Ir(t.current,e,e=>{a(i)},n);return a(i),r.release},[n,e,t,i]);const[s,a]=Dr(o);return s.key!==e.key?o().loadable:s.loadable}function Br(e){const t=xr(),[,n]=Dr([]),r="",o=Ar(()=>{var n;const r=t.current,o=r.getState(),i=br().early&&null!==(n=o.nextTree)&&void 0!==n?n:o.currentTree;return Tr(r,e,i)},[t,e]),i=o(),s=Or(i);return Rr(()=>{s.current=i}),Rr(()=>{const i=t.current,a=i.getState(),c=Ir(i,e,e=>{var t;if(!Q("recoil_suppress_rerender_in_callback"))return n([]);const r=o();null!==(t=s.current)&&void 0!==t&&t.is(r)||n(r),s.current=r},r);if(a.nextTree)i.getState().queuedComponentCallbacks_DEPRECATED.push(()=>{s.current=null,n([])});else{var u;if(!Q("recoil_suppress_rerender_in_callback"))return n([]);const e=o();null!==(u=s.current)&&void 0!==u&&u.is(e)||n(e),s.current=e}return c.release},[r,o,e,t]),i}function zr(e){"production"!==b.NODE_ENV&&Nr(e,"useRecoilValue");const t=xr(),n=function(e){return"production"!==b.NODE_ENV&&Nr(e,"useRecoilValueLoadable"),Q("recoil_memory_managament_2020")&&yr(e),{TRANSITION_SUPPORT:Fr,SYNC_EXTERNAL_STORE:_r()?Pr:Fr,MUTABLE_SOURCE:jr,LEGACY:Br}[br().mode](e)}(e);return function(e,t,n){if("hasValue"===e.state)return e.contents;if("loading"===e.state)throw new Promise(t=>{const r=n.current.getState().suspendedComponentResolvers;r.add(t),Lr&&k(e.contents)&&e.contents.finally(()=>{r.delete(t)})});throw"hasError"===e.state?e.contents:S(`Invalid value of loadable atom "${t.key}"`)}(n,e,t)}function Ur(e){"production"!==b.NODE_ENV&&Nr(e,"useSetRecoilState");const t=xr();return Ar(n=>{Cr(t.current,e,n)},[t,e])}var $r={useRecoilState:function(e){return"production"!==b.NODE_ENV&&Nr(e,"useRecoilState"),[zr(e),Ur(e)]},useRecoilValue:zr,useResetRecoilState:function(e){"production"!==b.NODE_ENV&&Nr(e,"useResetRecoilState");const t=xr();return Ar(()=>{Cr(t.current,e,vr)},[t,e])},useSetRecoilState:Ur};const{batchUpdates:Vr}=Wt,{DEFAULT_VALUE:qr,getNode:Wr}=Ee,{AbstractRecoilValue:Hr,setRecoilValueLoadable:Kr}=Tt;var Yr={gotoSnapshot:function(e,t){var n;const r=e.getState(),o=null!==(n=r.nextTree)&&void 0!==n?n:r.currentTree,i=t.getStore_INTERNAL().getState().currentTree;Vr(()=>{const n=new Set;for(const e of[o.atomValues.keys(),i.atomValues.keys()])for(const t of e){var r,s;(null===(r=o.atomValues.get(t))||void 0===r?void 0:r.contents)!==(null===(s=i.atomValues.get(t))||void 0===s?void 0:s.contents)&&Wr(t).shouldRestoreFromSnapshots&&n.add(t)}n.forEach(t=>{Kr(e,new Hr(t),i.atomValues.has(t)?w(i.atomValues.get(t)):qr)}),e.replaceState(e=>({...e,stateID:t.getID()}))})}};const{loadableWithValue:Gr}=q,{initializeNode:Jr}=it,{DEFAULT_VALUE:Xr,getNode:Qr}=Ee,{copyTreeState:Zr,getRecoilValueAsLoadable:eo,invalidateDownstreams:to,writeLoadableToTreeState:no}=Tt;function ro(e){return"atom"===Qr(e.key).nodeType}class oo{constructor(e,t){x(this,"_store",void 0),x(this,"_treeState",void 0),x(this,"_changes",void 0),x(this,"get",e=>{if(this._changes.has(e.key))return this._changes.get(e.key);if(!ro(e))throw S("Reading selectors within atomicUpdate is not supported");const t=eo(this._store,e,this._treeState);if("hasValue"===t.state)return t.contents;throw"hasError"===t.state?t.contents:S(`Expected Recoil atom ${e.key} to have a value, but it is in a loading state.`)}),x(this,"set",(e,t)=>{if(!ro(e))throw S("Setting selectors within atomicUpdate is not supported");if("function"==typeof t){const n=this.get(e);this._changes.set(e.key,t(n))}else Jr(this._store,e.key,"set"),this._changes.set(e.key,t)}),x(this,"reset",e=>{this.set(e,Xr)}),this._store=e,this._treeState=t,this._changes=new Map}newTreeState_INTERNAL(){if(0===this._changes.size)return this._treeState;const e=Zr(this._treeState);for(const[t,n]of this._changes)no(e,t,Gr(n));return to(this._store,e),e}}var io=function(e){return t=>{e.replaceState(n=>{const r=new oo(e,n);return t(r),r.newTreeState_INTERNAL()})}},so=Object.freeze({__proto__:null,atomicUpdater:io}),ao=function(e,t){if(!e)throw new Error(t)};const{atomicUpdater:co}=so,{batchUpdates:uo}=Wt,{DEFAULT_VALUE:lo}=Ee,{refreshRecoilValue:fo,setRecoilValue:po}=Tt,{cloneSnapshot:ho}=En,{gotoSnapshot:mo}=Yr;class go{}const yo=new go;var vo={recoilCallback:function(e,t,n,r){let o,i=yo;var s;return uo(()=>{const s="useRecoilCallback() expects a function that returns a function: it accepts a function of the type (RecoilInterface) => (Args) => ReturnType and returns a callback function (Args) => ReturnType, where RecoilInterface is an object {snapshot, set, ...} and Args and ReturnType are the argument and return types of the callback you want to create. Please see the docs at recoiljs.org for details.";if("function"!=typeof t)throw S(s);const a=Ye({...null!=r?r:{},set:(t,n)=>po(e,t,n),reset:t=>po(e,t,lo),refresh:t=>fo(e,t),gotoSnapshot:t=>mo(e,t),transact_UNSTABLE:t=>co(e)(t)},{snapshot:()=>{const t=ho(e);return o=t.retain(),t}}),c=t(a);if("function"!=typeof c)throw S(s);i=c(...n)}),i instanceof go&&("production"!==b.NODE_ENV?ao(!1,"batchUpdates should return immediately"):ao(!1)),k(i)?i=i.finally(()=>{var e;null===(e=o)||void 0===e||e()}):null===(s=o)||void 0===s||s(),i}},_o=Object.freeze({__proto__:null,WrappedValue:class{constructor(e){x(this,"value",void 0),this.value=e}}});class bo extends Error{}var So=Object.freeze({__proto__:null,TreeCache:class{constructor(e){var t,n,r;x(this,"_name",void 0),x(this,"_numLeafs",void 0),x(this,"_root",void 0),x(this,"_onHit",void 0),x(this,"_onSet",void 0),x(this,"_mapNodeValue",void 0),this._name=null==e?void 0:e.name,this._numLeafs=0,this._root=null,this._onHit=null!==(t=null==e?void 0:e.onHit)&&void 0!==t?t:()=>{},this._onSet=null!==(n=null==e?void 0:e.onSet)&&void 0!==n?n:()=>{},this._mapNodeValue=null!==(r=null==e?void 0:e.mapNodeValue)&&void 0!==r?r:e=>e}size(){return this._numLeafs}root(){return this._root}get(e,t){var n;return null===(n=this.getLeafNode(e,t))||void 0===n?void 0:n.value}getLeafNode(e,t){if(null==this._root)return;let n=this._root;for(;n;){if(null==t||t.onNodeVisit(n),"leaf"===n.type)return this._onHit(n),n;const r=this._mapNodeValue(e(n.nodeKey));n=n.branches.get(r)}}set(e,t,n){const r=()=>{var r,o,i,s;let a,c;for(const[t,h]of e){var u,l,d;const e=this._root;if("leaf"===(null==e?void 0:e.type))throw this.invalidCacheError();const r=a;if(a=r?r.branches.get(c):e,a=null!==(u=a)&&void 0!==u?u:{type:"branch",nodeKey:t,parent:r,branches:new Map,branchKey:c},"branch"!==a.type||a.nodeKey!==t)throw this.invalidCacheError();null==r||r.branches.set(c,a),null==n||null===(l=n.onNodeVisit)||void 0===l||l.call(n,a),c=this._mapNodeValue(h),this._root=null!==(d=this._root)&&void 0!==d?d:a}const f=a?null===(r=a)||void 0===r?void 0:r.branches.get(c):this._root;if(null!=f&&("leaf"!==f.type||f.branchKey!==c))throw this.invalidCacheError();const p={type:"leaf",value:t,parent:a,branchKey:c};null===(o=a)||void 0===o||o.branches.set(c,p),this._root=null!==(i=this._root)&&void 0!==i?i:p,this._numLeafs++,this._onSet(p),null==n||null===(s=n.onNodeVisit)||void 0===s||s.call(n,p)};try{r()}catch(o){if(!(o instanceof bo))throw o;this.clear(),r()}}delete(e){const t=this.root();if(!t)return!1;if(e===t)return this._root=null,this._numLeafs=0,!0;let n=e.parent,r=e.branchKey;for(;n;){var o;if(n.branches.delete(r),n===t)return 0===n.branches.size?(this._root=null,this._numLeafs=0):this._numLeafs--,!0;if(n.branches.size>0)break;r=null===(o=n)||void 0===o?void 0:o.branchKey,n=n.parent}for(;n!==t;n=n.parent)if(null==n)return!1;return this._numLeafs--,!0}clear(){this._numLeafs=0,this._root=null}invalidCacheError(){throw null!=this._name&&this._name,new bo}}}),ko=Object.freeze({__proto__:null,LRUCache:class{constructor(e){var t;x(this,"_maxSize",void 0),x(this,"_size",void 0),x(this,"_head",void 0),x(this,"_tail",void 0),x(this,"_map",void 0),x(this,"_keyMapper",void 0),this._maxSize=e.maxSize,this._size=0,this._head=null,this._tail=null,this._map=new Map,this._keyMapper=null!==(t=e.mapKey)&&void 0!==t?t:e=>e}head(){return this._head}tail(){return this._tail}size(){return this._size}maxSize(){return this._maxSize}has(e){return this._map.has(this._keyMapper(e))}get(e){const t=this._keyMapper(e),n=this._map.get(t);if(n)return this.set(e,n.value),n.value}set(e,t){const n=this._keyMapper(e);this._map.get(n)&&this.delete(e);const r=this.head(),o={key:e,right:r,left:null,value:t};r?r.left=o:this._tail=o,this._map.set(n,o),this._head=o,this._size++,this._maybeDeleteLRU()}_maybeDeleteLRU(){this.size()>this.maxSize()&&this.deleteLru()}deleteLru(){const e=this.tail();e&&this.delete(e.key)}delete(e){const t=this._keyMapper(e);if(!this._size||!this._map.has(t))return;const n=w(this._map.get(t)),r=n.right,o=n.left;r&&(r.left=n.left),o&&(o.right=n.right),n===this.head()&&(this._head=r),n===this.tail()&&(this._tail=o),this._map.delete(t),this._size--}clear(){this._size=0,this._head=null,this._tail=null,this._map=new Map}}});const{LRUCache:wo}=ko,{TreeCache:xo}=So;var Eo=function({name:e,maxSize:t,mapNodeValue:n=e=>e}){const r=new wo({maxSize:t}),o=new xo({name:e,mapNodeValue:n,onHit:e=>{r.set(e,!0)},onSet:e=>{const n=r.tail();r.set(e,!0),n&&o.size()>t&&o.delete(n.key)}});return o};function To(e,t,n){if("string"==typeof e&&!e.includes('"')&&!e.includes("\\"))return`"${e}"`;switch(typeof e){case"undefined":return"";case"boolean":return e?"true":"false";case"number":case"symbol":return String(e);case"string":return JSON.stringify(e);case"function":if(!0!==(null==t?void 0:t.allowFunctions))throw S("Attempt to serialize function in a Recoil cache key");return`__FUNCTION(${e.name})__`}if(null===e)return"null";var r;if("object"!=typeof e)return null!==(r=JSON.stringify(e))&&void 0!==r?r:"";if(k(e))return"__PROMISE__";if(Array.isArray(e))return`[${e.map((e,n)=>To(e,t,n.toString()))}]`;if("function"==typeof e.toJSON)return To(e.toJSON(n),t,n);if(e instanceof Map){const r={};for(const[n,o]of e)r["string"==typeof n?n:To(n,t)]=o;return To(r,t,n)}return e instanceof Set?To(Array.from(e).sort((e,n)=>To(e,t).localeCompare(To(n,t))),t,n):void 0!==Symbol&&null!=e[Symbol.iterator]&&"function"==typeof e[Symbol.iterator]?To(Array.from(e),t,n):`{${Object.keys(e).filter(t=>void 0!==e[t]).sort().map(n=>`${To(n,t)}:${To(e[n],t,n)}`).join(",")}}`}var Co=function(e,t={allowFunctions:!1}){if("production"!==b.NODE_ENV&&"undefined"!=typeof window){window.performance&&window.performance.now();const n=To(e,t);return window.performance&&window.performance.now(),n}return To(e,t)};const{TreeCache:Io}=So,Ao={equality:"reference",eviction:"keep-all",maxSize:1/0};const{isReactNative:Ro,isWindow:Mo}=Gt;var Oo=function e(t){if("object"==typeof t&&!function(e){if(null===e||"object"!=typeof e)return!0;switch(typeof e.$$typeof){case"symbol":case"number":return!0}return null!=e["@@__IMMUTABLE_ITERABLE__@@"]||null!=e["@@__IMMUTABLE_KEYED__@@"]||null!=e["@@__IMMUTABLE_INDEXED__@@"]||null!=e["@@__IMMUTABLE_ORDERED__@@"]||null!=e["@@__IMMUTABLE_RECORD__@@"]||!!function(e){var t,n;if("undefined"==typeof window)return!1;const r=null!==(n=(null!=e?null!==(t=e.ownerDocument)&&void 0!==t?t:e:document).defaultView)&&void 0!==n?n:window;return!(null==e||!("function"==typeof r.Node?e instanceof r.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}(e)||!!k(e)||e instanceof Error||!!ArrayBuffer.isView(e)||!(Ro||!Mo(e))}(t)){Object.freeze(t);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const r=t[n];"object"!=typeof r||null==r||Object.isFrozen(r)||e(r)}Object.seal(t)}};const{isLoadable:Do,loadableWithError:Lo,loadableWithPromise:No,loadableWithValue:Po}=q,{WrappedValue:jo}=_o,{getNodeLoadable:Fo,peekNodeLoadable:Bo,setNodeValue:zo}=it,{saveDepsToStore:Uo}=Pe,{DEFAULT_VALUE:$o,getConfigDeletionHandler:Vo,getNode:qo,registerNode:Wo}=Ee,{isRecoilValue:Ho}=fe,{markRecoilValueModified:Ko}=Tt,{retainedByOptionWithDefault:Yo}=jt,{recoilCallback:Go}=vo;class Jo{}const Xo=new Jo,Qo=[],Zo=new Map,ei=(()=>{let e=0;return()=>e++})();function ti(e){let t=null;const{key:n,get:r,cachePolicy_UNSTABLE:o}=e,i=null!=e.set?e.set:void 0;if("production"!==b.NODE_ENV){if("string"!=typeof n)throw S("A key option with a unique string value must be provided when creating a selector.");if("function"!=typeof r)throw S("Selectors must specify a get callback option to get the selector value.")}const s=new Set,a=function({equality:e=Ao.equality,eviction:t=Ao.eviction,maxSize:n=Ao.maxSize}=Ao,r){const o=function(e){switch(e){case"reference":return e=>e;case"value":return e=>Co(e)}throw S(`Unrecognized equality policy ${e}`)}(e);return function(e,t,n,r){switch(e){case"keep-all":return new Io({name:r,mapNodeValue:n});case"lru":return Eo({name:r,maxSize:w(t),mapNodeValue:n});case"most-recent":return Eo({name:r,maxSize:1,mapNodeValue:n})}throw S(`Unrecognized eviction policy ${e}`)}(t,n,o,r)}(null!=o?o:{equality:"reference",eviction:"keep-all"},n),c=Yo(e.retainedBy_UNSTABLE),u=new Map;let l=0;function d(){return!Q("recoil_memory_managament_2020")||l>0}function f(e){return e.getState().knownSelectors.add(n),l++,()=>{l--}}function p(){return void 0!==Vo(n)&&!d()}function h(e,t,n,r,o){R(t,r,o),m(e,n)}function m(e,t){A(e,t)&&I(e),g(t,!0)}function g(e,n){const r=Zo.get(e);if(null!=r){for(const e of r)Ko(e,w(t));n&&Zo.delete(e)}}function y(e,t){let n=Zo.get(t);null==n&&Zo.set(t,n=new Set),n.add(e)}function v(e,t,n,r,o,i){return t.then(r=>{if(!d())throw I(e),Xo;null!=i.loadingDepKey&&i.loadingDepPromise===t?n.atomValues.set(i.loadingDepKey,Po(r)):e.getState().knownSelectors.forEach(e=>{n.atomValues.delete(e)});const s=E(e,n);if(s&&"loading"!==s.state){if((A(e,o)||null==C(e))&&m(e,o),"hasValue"===s.state)return s.contents;throw s.contents}if(!A(e,o)){const t=T(e,n);if(null!=t)return t.loadingLoadable.contents}const[a,c]=x(e,n,o);if("loading"!==a.state&&h(e,n,o,a,c),"hasError"===a.state)throw a.contents;return a.contents}).catch(t=>{if(t instanceof Jo)throw Xo;if(!d())throw I(e),Xo;const i=Lo(t);throw h(e,n,o,i,r),t})}function _(e,t,r,o){var i,a,c,u,l,d,f;(A(e,o)||t.version===(null===(i=e.getState())||void 0===i||null===(a=i.currentTree)||void 0===a?void 0:a.version)||t.version===(null===(c=e.getState())||void 0===c||null===(u=c.nextTree)||void 0===u?void 0:u.version))&&Uo(n,r,e,null!==(l=null===(d=e.getState())||void 0===d||null===(f=d.nextTree)||void 0===f?void 0:f.version)&&void 0!==l?l:e.getState().currentTree.version);for(const n of r)s.add(n)}function x(e,n,o){let i=!0,s=!0;const a=()=>{s=!1};let c,u,l=!1;const f={loadingDepKey:null,loadingDepPromise:null},p=new Map;function m({key:t}){const r=Fo(e,n,t);switch(p.set(t,r),i||(_(e,n,new Set(p.keys()),o),function(e,t){A(e,t)&&(w(C(e)).stateVersions.clear(),g(t,!1))}(e,o)),r.state){case"hasValue":return r.contents;case"hasError":throw r.contents;case"loading":throw f.loadingDepKey=t,f.loadingDepPromise=r.contents,r.contents}throw S("Invalid Loadable state")}const y=n=>(...r)=>{if(s)throw S("Callbacks from getCallback() should only be called asynchronously after the selector is evalutated. It can be used for selectors to return objects with callbacks that can work with Recoil state without a subscription.");return null==t&&("production"!==b.NODE_ENV?ao(!1,"Recoil Value can never be null"):ao(!1)),Go(e,n,r,{node:t})};try{c=r({get:m,getCallback:y}),c=Ho(c)?m(c):c,Do(c)&&("hasError"===c.state&&(l=!0),c=c.contents),k(c)?c=function(e,t,n,r,o,i){return t.then(t=>{if(!d())throw I(e),Xo;const i=Po(t);return h(e,n,o,i,r),t}).catch(t=>{if(!d())throw I(e),Xo;if(k(t))return v(e,t,n,r,o,i);const s=Lo(t);throw h(e,n,o,s,r),t})}(e,c,n,p,o,f).finally(a):a(),c=c instanceof jo?c.value:c}catch(x){c=x,k(c)?c=v(e,c,n,p,o,f).finally(a):(l=!0,a())}return u=l?Lo(c):k(c)?No(c):Po(c),i=!1,function(e,t,n){if(A(e,t)){const t=C(e);null!=t&&(t.depValuesDiscoveredSoFarDuringAsyncWork=n)}}(e,o,p),_(e,n,new Set(p.keys()),o),[u,p]}function E(e,t){let r=t.atomValues.get(n);if(null!=r)return r;const o=new Set;try{r=a.get(n=>("string"!=typeof n&&("production"!==b.NODE_ENV?ao(!1,"Cache nodeKey is type string"):ao(!1)),Fo(e,t,n).contents),{onNodeVisit:e=>{"branch"===e.type&&e.nodeKey!==n&&o.add(e.nodeKey)}})}catch(s){throw S(`Problem with cache lookup for selector "${n}": ${s.message}`)}var i;return r&&(t.atomValues.set(n,r),_(e,t,o,null===(i=C(e))||void 0===i?void 0:i.executionID)),r}function T(e,t){const n=Ht([u.has(e)?[w(u.get(e))]:[],me(Ke(u,([t])=>t!==e),([,e])=>e)]);function r(n){for(const[r,o]of n)if(!Fo(e,t,r).is(o))return!0;return!1}for(const o of n){if(o.stateVersions.get(t.version)||!r(o.depValuesDiscoveredSoFarDuringAsyncWork))return o.stateVersions.set(t.version,!0),o;o.stateVersions.set(t.version,!1)}}function C(e){return u.get(e)}function I(e){u.delete(e)}function A(e,t){var n;return t===(null===(n=C(e))||void 0===n?void 0:n.executionID)}function R(t,r,o){"production"!==b.NODE_ENV&&"loading"!==r.state&&!1===Boolean(e.dangerouslyAllowMutability)&&Oo(r.contents),t.atomValues.set(n,r);try{a.set(function(e){return Array.from(e.entries()).map(([e,t])=>[e,t.contents])}(o),r)}catch(i){throw S(`Problem with setting cache for selector "${n}": ${i.message}`)}}function M(e,t){const r=t.atomValues.get(n);return null!=r?r:a.get(n=>{var r;return"string"!=typeof n&&("production"!==b.NODE_ENV?ao(!1,"Cache nodeKey is type string"):ao(!1)),null===(r=Bo(e,t,n))||void 0===r?void 0:r.contents})}function O(e,t){return function(){if(Qo.includes(n)){const e=`Recoil selector has circular dependencies: ${Qo.slice(Qo.indexOf(n)).join(" → ")}`;return Lo(S(e))}Qo.push(n);try{return function(e,t){const n=E(e,t);if(null!=n)return I(e),n;const r=T(e,t);var o;if(null!=r)return"loading"===(null===(o=r.loadingLoadable)||void 0===o?void 0:o.state)&&y(e,r.executionID),r.loadingLoadable;const i=ei(),[s,a]=x(e,t,i);return"loading"===s.state?(function(e,t,n,r,o){u.set(e,{depValuesDiscoveredSoFarDuringAsyncWork:r,executionID:t,loadingLoadable:n,stateVersions:new Map([[o.version,!0]])})}(e,i,s,a,t),y(e,i)):(I(e),R(t,s,a)),s}(e,t)}finally{Qo.pop()}}()}function D(e){e.atomValues.delete(n)}function L(e,n){null==t&&("production"!==b.NODE_ENV?ao(!1,"Recoil Value can never be null"):ao(!1));for(const t of s){var r;const o=qo(t);null===(r=o.clearCache)||void 0===r||r.call(o,e,n)}s.clear(),D(n),a.clear(),Ko(e,t)}return t=Wo(null!=i?{key:n,nodeType:"selector",peek:M,get:O,set:(e,t,r)=>{let o=!1;const s=new Map;function a({key:r}){if(o)throw S("Recoil: Async selector sets are not currently supported.");const i=Fo(e,t,r);if("hasValue"===i.state)return i.contents;if("loading"===i.state){const e=`Getting value of asynchronous atom or selector "${r}" in a pending state while setting selector "${n}" is not yet supported.`;throw S(e)}throw i.contents}function c(n,r){if(o){const e="Recoil: Async selector sets are not currently supported.";throw S(e)}const i="function"==typeof r?r(a(n)):r;zo(e,t,n.key,i).forEach((e,t)=>s.set(t,e))}const u=i({set:c,get:a,reset:function(e){c(e,$o)}},r);if(void 0!==u)throw k(u)?S("Recoil: Async selector sets are not currently supported."):S("Recoil: selector set should be a void function.");return o=!0,s},init:f,invalidate:D,clearCache:L,shouldDeleteConfigOnRelease:p,dangerouslyAllowMutability:e.dangerouslyAllowMutability,shouldRestoreFromSnapshots:!1,retainedBy:c}:{key:n,nodeType:"selector",peek:M,get:O,init:f,invalidate:D,clearCache:L,shouldDeleteConfigOnRelease:p,dangerouslyAllowMutability:e.dangerouslyAllowMutability,shouldRestoreFromSnapshots:!1,retainedBy:c})}ti.value=e=>new jo(e);var ni=ti;const{isLoadable:ri,loadableWithError:oi,loadableWithPromise:ii,loadableWithValue:si}=q,{WrappedValue:ai}=_o,{peekNodeInfo:ci}=it,{DEFAULT_VALUE:ui,DefaultValue:li,getConfigDeletionHandler:di,registerNode:fi,setConfigDeletionHandler:pi}=Ee,{isRecoilValue:hi}=fe,{getRecoilValueAsLoadable:mi,markRecoilValueModified:gi,setRecoilValue:yi,setRecoilValueLoadable:vi}=Tt,{retainedByOptionWithDefault:_i}=jt,bi=e=>e instanceof ai?e.value:e;function Si(e){if("production"!==b.NODE_ENV&&"string"!=typeof e.key)throw S("A key option with a unique string value must be provided when creating an atom.");const{...t}=e,n="default"in e?e.default:new Promise(()=>{});return hi(n)?function(e){const t=Si({...e,default:ui,persistence_UNSTABLE:void 0===e.persistence_UNSTABLE?void 0:{...e.persistence_UNSTABLE,validator:t=>t instanceof li?t:w(e.persistence_UNSTABLE).validator(t,ui)},effects:e.effects,effects_UNSTABLE:e.effects_UNSTABLE}),n=ni({key:`${e.key}__withFallback`,get:({get:n})=>{const r=n(t);return r instanceof li?e.default:r},set:({set:e},n)=>e(t,n),cachePolicy_UNSTABLE:{eviction:"most-recent"},dangerouslyAllowMutability:e.dangerouslyAllowMutability});return pi(n.key,di(e.key)),n}({...t,default:n}):function(e){const{key:t,persistence_UNSTABLE:n}=e,r=_i(e.retainedBy_UNSTABLE);let o=0;function i(e){return ii(e.then(e=>(a=si(e),e)).catch(e=>{throw a=oi(e),e}))}let s,a=k(e.default)?i(e.default):ri(e.default)?"loading"===e.default.state?i(e.default.contents):e.default:si(bi(e.default));u(a.contents);const c=new Map;function u(t){return"production"!==b.NODE_ENV&&!0!==e.dangerouslyAllowMutability?k(t)?t.then(e=>(Oo(e),e)):(Oo(t),t):t}function l(e,n){var r,o;return null!==(r=null!==(o=n.atomValues.get(t))&&void 0!==o?o:s)&&void 0!==r?r:a}const d=fi({key:t,nodeType:"atom",peek:l,get:function(e,r){if(r.atomValues.has(t))return w(r.atomValues.get(t));if(r.nonvalidatedAtoms.has(t)){if(null!=s)return s;if(null==n)return he(`Tried to restore a persisted value for atom ${t} but it has no persistence settings.`),a;const e=r.nonvalidatedAtoms.get(t),o=n.validator(e,ui),i=o instanceof li?a:si(o);return s=i,s}return a},set:function(e,n,r){if(n.atomValues.has(t)){const e=w(n.atomValues.get(t));if("hasValue"===e.state&&r===e.contents)return new Map}else if(!n.nonvalidatedAtoms.has(t)&&r instanceof li)return new Map;return u(r),s=void 0,(new Map).set(t,si(r))},init:function(n,r,i){var s;if(o++,n.getState().knownAtoms.add(t),"loading"===a.state){const e=()=>{var e;(null!==(e=n.getState().nextTree)&&void 0!==e?e:n.getState().currentTree).atomValues.has(t)||gi(n,d)};a.contents.finally(e)}const f=null!==(s=e.effects)&&void 0!==s?s:e.effects_UNSTABLE;if(null!=f){let e=function(e){if(y&&e.key===t){const e=g;return e instanceof li?l(0,r):k(e)?ii(e.then(e=>e instanceof li?a.toPromise():e)):si(e)}return mi(n,e)},o=function(t){return e(t).toPromise()},s=function(r){var o;const i=ci(n,null!==(o=n.getState().nextTree)&&void 0!==o?o:n.getState().currentTree,r.key);return!y||r.key!==t||g instanceof li?i:{...i,isSet:!0,loadable:e(r)}},g=ui,y=!0,v=!1,_=null;const b=t=>r=>{if(y){const n=e(d),o="hasValue"===n.state?n.contents:ui;g="function"==typeof r?r(o):r,k(g)&&(g=g.then(e=>(_={effect:t,value:e},e)))}else{if(k(r))throw S("Setting atoms to async values is not implemented.");"function"!=typeof r&&(_={effect:t,value:bi(r)}),yi(n,d,"function"==typeof r?e=>{const n=bi(r(e));return _={effect:t,value:n},n}:bi(r))}},w=e=>()=>b(e)(ui),x=e=>r=>{var o;const{release:i}=n.subscribeToTransactions(n=>{var o;let{currentTree:i,previousTree:s}=n.getState();s||(s=i);const c=null!==(o=i.atomValues.get(t))&&void 0!==o?o:a;if("hasValue"===c.state){var u,l,d,f;const n=c.contents,o=null!==(u=s.atomValues.get(t))&&void 0!==u?u:a,p="hasValue"===o.state?o.contents:ui;(null===(l=_)||void 0===l?void 0:l.effect)!==e||(null===(d=_)||void 0===d?void 0:d.value)!==n?r(n,p,!i.atomValues.has(t)):(null===(f=_)||void 0===f?void 0:f.effect)===e&&(_=null)}},t);c.set(n,[...null!==(o=c.get(n))&&void 0!==o?o:[],i])};for(const t of f)try{const r=t({node:d,storeID:n.storeID,parentStoreID_UNSTABLE:n.parentStoreID,trigger:i,setSelf:b(t),resetSelf:w(t),onSet:x(t),getPromise:o,getLoadable:e,getInfo_UNSTABLE:s});var p;null!=r&&c.set(n,[...null!==(p=c.get(n))&&void 0!==p?p:[],r])}catch(m){g=m,v=!0}if(y=!1,!(g instanceof li)){var h;const e=v?oi(g):k(g)?ii(function(e,n){const r=n.then(n=>{var o,i;return(null===(i=(null!==(o=e.getState().nextTree)&&void 0!==o?o:e.getState().currentTree).atomValues.get(t))||void 0===i?void 0:i.contents)===r&&yi(e,d,n),n}).catch(n=>{var o,i;throw(null===(i=(null!==(o=e.getState().nextTree)&&void 0!==o?o:e.getState().currentTree).atomValues.get(t))||void 0===i?void 0:i.contents)===r&&vi(e,d,oi(n)),n});return r}(n,g)):si(bi(g));u(e.contents),r.atomValues.set(t,e),null===(h=n.getState().nextTree)||void 0===h||h.atomValues.set(t,e)}}return()=>{var e;o--,null===(e=c.get(n))||void 0===e||e.forEach(e=>e()),c.delete(n)}},invalidate:function(){s=void 0},shouldDeleteConfigOnRelease:function(){return void 0!==di(t)&&o<=0},dangerouslyAllowMutability:e.dangerouslyAllowMutability,persistence_UNSTABLE:e.persistence_UNSTABLE?{type:e.persistence_UNSTABLE.type,backButton:e.persistence_UNSTABLE.backButton}:void 0,shouldRestoreFromSnapshots:!0,retainedBy:r});return d}({...t,default:n})}Si.value=e=>new ai(e);var ki=Si,wi=Object.freeze({__proto__:null,MapCache:class{constructor(e){var t;x(this,"_map",void 0),x(this,"_keyMapper",void 0),this._map=new Map,this._keyMapper=null!==(t=null==e?void 0:e.mapKey)&&void 0!==t?t:e=>e}size(){return this._map.size}has(e){return this._map.has(this._keyMapper(e))}get(e){return this._map.get(this._keyMapper(e))}set(e,t){this._map.set(this._keyMapper(e),t)}delete(e){this._map.delete(this._keyMapper(e))}clear(){this._map.clear()}}});const{LRUCache:xi}=ko,{MapCache:Ei}=wi,Ti={equality:"reference",eviction:"none",maxSize:1/0};const{setConfigDeletionHandler:Ci}=Ee;let Ii=0;var Ai=function(e){var t,n;const r=function({equality:e=Ti.equality,eviction:t=Ti.eviction,maxSize:n=Ti.maxSize}=Ti){const r=function(e){switch(e){case"reference":return e=>e;case"value":return e=>Co(e)}throw S(`Unrecognized equality policy ${e}`)}(e);return function(e,t,n){switch(e){case"keep-all":return new Ei({mapKey:n});case"lru":return new xi({mapKey:n,maxSize:w(t)});case"most-recent":return new xi({mapKey:n,maxSize:1})}throw S(`Unrecognized eviction policy ${e}`)}(t,n,r)}({equality:null!==(t=null===(n=e.cachePolicyForParams_UNSTABLE)||void 0===n?void 0:n.equality)&&void 0!==t?t:"value",eviction:"keep-all"});return t=>{var n;let o;try{o=r.get(t)}catch(l){throw S(`Problem with cache lookup for selector ${e.key}: ${l.message}`)}if(null!=o)return o;const i=`${e.key}__selectorFamily/${null!==(n=Co(t,{allowFunctions:!0}))&&void 0!==n?n:"void"}/${Ii++}`,s=n=>e.get(t)(n),a=e.cachePolicy_UNSTABLE,c="function"==typeof e.retainedBy_UNSTABLE?e.retainedBy_UNSTABLE(t):e.retainedBy_UNSTABLE;let u;if(null!=e.set){const n=e.set;u=ni({key:i,get:s,set:(e,r)=>n(t)(e,r),cachePolicy_UNSTABLE:a,dangerouslyAllowMutability:e.dangerouslyAllowMutability,retainedBy_UNSTABLE:c})}else u=ni({key:i,get:s,cachePolicy_UNSTABLE:a,dangerouslyAllowMutability:e.dangerouslyAllowMutability,retainedBy_UNSTABLE:c});return r.set(t,u),Ci(u.key,()=>{r.delete(t)}),u}};Ai({key:"__constant",get:e=>()=>e,cachePolicyForParams_UNSTABLE:{equality:"reference"}}),Ai({key:"__error",get:e=>()=>{throw S(e)},cachePolicyForParams_UNSTABLE:{equality:"reference"}});const{loadableWithError:Ri,loadableWithPromise:Mi,loadableWithValue:Oi}=q;function Di(e,t){const n=Array(t.length).fill(void 0),r=Array(t.length).fill(void 0);for(const[i,s]of t.entries())try{n[i]=e(s)}catch(o){r[i]=o}return[n,r]}function Li(e){return null!=e&&!k(e)}function Ni(e){return Array.isArray(e)?e:Object.getOwnPropertyNames(e).map(t=>e[t])}function Pi(e,t){return Array.isArray(e)?t:Object.getOwnPropertyNames(e).reduce((e,n,r)=>({...e,[n]:t[r]}),{})}function ji(e,t,n){return Pi(e,n.map((e,n)=>null==e?Oi(t[n]):k(e)?Mi(e):Ri(e)))}Ai({key:"__waitForNone",get:e=>({get:t})=>{const n=Ni(e),[r,o]=Di(t,n);return ji(e,r,o)},dangerouslyAllowMutability:!0}),Ai({key:"__waitForAny",get:e=>({get:t})=>{const n=Ni(e),[r,o]=Di(t,n);return o.some(e=>!k(e))?ji(e,r,o):new Promise(t=>{for(const[n,i]of o.entries())k(i)&&i.then(i=>{r[n]=i,o[n]=void 0,t(ji(e,r,o))}).catch(i=>{o[n]=i,t(ji(e,r,o))})})},dangerouslyAllowMutability:!0}),Ai({key:"__waitForAll",get:e=>({get:t})=>{const n=Ni(e),[r,o]=Di(t,n);if(o.every(e=>null==e))return Pi(e,r);const i=o.find(Li);if(null!=i)throw i;return Promise.all(o).then(t=>{return Pi(e,(n=r,t.map((e,t)=>void 0===e?n[t]:e)));var n})},dangerouslyAllowMutability:!0}),Ai({key:"__waitForAllSettled",get:e=>({get:t})=>{const n=Ni(e),[r,o]=Di(t,n);return o.every(e=>!k(e))?ji(e,r,o):Promise.all(o.map((e,t)=>k(e)?e.then(e=>{r[t]=e,o[t]=void 0}).catch(e=>{r[t]=void 0,o[t]=e}):null)).then(()=>ji(e,r,o))},dangerouslyAllowMutability:!0}),Ai({key:"__noWait",get:e=>({get:t})=>{try{return ni.value(Oi(t(e)))}catch(n){return ni.value(k(n)?Mi(n):Ri(n))}},dangerouslyAllowMutability:!0});const{DefaultValue:Fi}=Ee,{RecoilRoot:Bi}=ar,{useRecoilState:zi,useRecoilValue:Ui,useResetRecoilState:$i,useSetRecoilState:Vi}=$r;var qi,Wi={DefaultValue:Fi,RecoilRoot:Bi,atom:ki,selector:ni,useRecoilValue:Ui,useRecoilState:zi,useSetRecoilState:Vi,useResetRecoilState:$i},Hi=Wi.DefaultValue,Ki=Wi.RecoilRoot,Yi=Wi.atom,Gi=Wi.selector,Ji=Wi.useRecoilValue,Xi=Wi.useRecoilState,Qi=Wi.useSetRecoilState,Zi=Wi.useResetRecoilState,es={exports:{}},ts=es.exports;function ns(){return qi||(qi=1,function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",s="__lodash_placeholder__",a=32,c=128,u=1/0,l=9007199254740991,d=NaN,f=4294967295,p=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",256]],h="[object Arguments]",m="[object Array]",g="[object Boolean]",y="[object Date]",v="[object Error]",_="[object Function]",b="[object GeneratorFunction]",S="[object Map]",k="[object Number]",w="[object Object]",x="[object Promise]",E="[object RegExp]",T="[object Set]",C="[object String]",I="[object Symbol]",A="[object WeakMap]",R="[object ArrayBuffer]",M="[object DataView]",O="[object Float32Array]",D="[object Float64Array]",L="[object Int8Array]",N="[object Int16Array]",P="[object Int32Array]",j="[object Uint8Array]",F="[object Uint8ClampedArray]",B="[object Uint16Array]",z="[object Uint32Array]",U=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,V=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,H=RegExp(q.source),K=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ie=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ae=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,le=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,he=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,be="\\ud800-\\udfff",Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",we="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",Ee="\\ufe0e\\ufe0f",Te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="["+be+"]",Ie="["+Te+"]",Ae="["+Se+"]",Re="\\d+",Me="["+ke+"]",Oe="["+we+"]",De="[^"+be+Te+Re+ke+we+xe+"]",Le="\\ud83c[\\udffb-\\udfff]",Ne="[^"+be+"]",Pe="(?:\\ud83c[\\udde6-\\uddff]){2}",je="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+xe+"]",Be="\\u200d",ze="(?:"+Oe+"|"+De+")",Ue="(?:"+Fe+"|"+De+")",$e="(?:['’](?:d|ll|m|re|s|t|ve))?",Ve="(?:['’](?:D|LL|M|RE|S|T|VE))?",qe="(?:"+Ae+"|"+Le+")?",We="["+Ee+"]?",He=We+qe+"(?:"+Be+"(?:"+[Ne,Pe,je].join("|")+")"+We+qe+")*",Ke="(?:"+[Me,Pe,je].join("|")+")"+He,Ye="(?:"+[Ne+Ae+"?",Ae,Pe,je,Ce].join("|")+")",Ge=RegExp("['’]","g"),Je=RegExp(Ae,"g"),Xe=RegExp(Le+"(?="+Le+")|"+Ye+He,"g"),Qe=RegExp([Fe+"?"+Oe+"+"+$e+"(?="+[Ie,Fe,"$"].join("|")+")",Ue+"+"+Ve+"(?="+[Ie,Fe+ze,"$"].join("|")+")",Fe+"?"+ze+"+"+$e,Fe+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Re,Ke].join("|"),"g"),Ze=RegExp("["+Be+be+Se+Ee+"]"),et=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],nt=-1,rt={};rt[O]=rt[D]=rt[L]=rt[N]=rt[P]=rt[j]=rt[F]=rt[B]=rt[z]=!0,rt[h]=rt[m]=rt[R]=rt[g]=rt[M]=rt[y]=rt[v]=rt[_]=rt[S]=rt[k]=rt[w]=rt[E]=rt[T]=rt[C]=rt[A]=!1;var ot={};ot[h]=ot[m]=ot[R]=ot[M]=ot[g]=ot[y]=ot[O]=ot[D]=ot[L]=ot[N]=ot[P]=ot[S]=ot[k]=ot[w]=ot[E]=ot[T]=ot[C]=ot[I]=ot[j]=ot[F]=ot[B]=ot[z]=!0,ot[v]=ot[_]=ot[A]=!1;var it={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,at=parseInt,ct="object"==typeof o&&o&&o.Object===Object&&o,ut="object"==typeof self&&self&&self.Object===Object&&self,lt=ct||ut||Function("return this")(),dt=t&&!t.nodeType&&t,ft=dt&&e&&!e.nodeType&&e,pt=ft&&ft.exports===dt,ht=pt&&ct.process,mt=function(){try{return ft&&ft.require&&ft.require("util").types||ht&&ht.binding&&ht.binding("util")}catch(e){}}(),gt=mt&&mt.isArrayBuffer,yt=mt&&mt.isDate,vt=mt&&mt.isMap,_t=mt&&mt.isRegExp,bt=mt&&mt.isSet,St=mt&&mt.isTypedArray;function kt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function wt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o-1}function At(e,t,n){for(var r=-1,o=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&Ft(t,e[n],0)>-1;);return n}var Zt=Vt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),en=Vt({"&":"&","<":"<",">":">",'"':""","'":"'"});function tn(e){return"\\"+it[e]}function nn(e){return Ze.test(e)}function rn(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function on(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n",""":'"',"'":"'"}),fn=function e(t){var o,re=(t=null==t?lt:fn.defaults(lt.Object(),t,fn.pick(lt,tt))).Array,be=t.Date,Se=t.Error,ke=t.Function,we=t.Math,xe=t.Object,Ee=t.RegExp,Te=t.String,Ce=t.TypeError,Ie=re.prototype,Ae=ke.prototype,Re=xe.prototype,Me=t["__core-js_shared__"],Oe=Ae.toString,De=Re.hasOwnProperty,Le=0,Ne=(o=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"",Pe=Re.toString,je=Oe.call(xe),Fe=lt._,Be=Ee("^"+Oe.call(De).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ze=pt?t.Buffer:n,Ue=t.Symbol,$e=t.Uint8Array,Ve=ze?ze.allocUnsafe:n,qe=on(xe.getPrototypeOf,xe),We=xe.create,He=Re.propertyIsEnumerable,Ke=Ie.splice,Ye=Ue?Ue.isConcatSpreadable:n,Xe=Ue?Ue.iterator:n,Ze=Ue?Ue.toStringTag:n,it=function(){try{var e=ci(xe,"defineProperty");return e({},"",{}),e}catch(t){}}(),ct=t.clearTimeout!==lt.clearTimeout&&t.clearTimeout,ut=be&&be.now!==lt.Date.now&&be.now,dt=t.setTimeout!==lt.setTimeout&&t.setTimeout,ft=we.ceil,ht=we.floor,mt=xe.getOwnPropertySymbols,Nt=ze?ze.isBuffer:n,Vt=t.isFinite,pn=Ie.join,hn=on(xe.keys,xe),mn=we.max,gn=we.min,yn=be.now,vn=t.parseInt,_n=we.random,bn=Ie.reverse,Sn=ci(t,"DataView"),kn=ci(t,"Map"),wn=ci(t,"Promise"),xn=ci(t,"Set"),En=ci(t,"WeakMap"),Tn=ci(xe,"create"),Cn=En&&new En,In={},An=ji(Sn),Rn=ji(kn),Mn=ji(wn),On=ji(xn),Dn=ji(En),Ln=Ue?Ue.prototype:n,Nn=Ln?Ln.valueOf:n,Pn=Ln?Ln.toString:n;function jn(e){if(ea(e)&&!Vs(e)&&!(e instanceof Un)){if(e instanceof zn)return e;if(De.call(e,"__wrapped__"))return Fi(e)}return new zn(e)}var Fn=function(){function e(){}return function(t){if(!Zs(t))return{};if(We)return We(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Bn(){}function zn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ir(e,t,r,o,i,s){var a,c=1&t,u=2&t,l=4&t;if(r&&(a=i?r(e,o,i,s):r(e)),a!==n)return a;if(!Zs(e))return e;var d=Vs(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&De.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return To(e,a)}else{var f=di(e),p=f==_||f==b;if(Ks(e))return bo(e,c);if(f==w||f==h||p&&!i){if(a=u||p?{}:pi(e),!c)return u?function(e,t){return Co(e,li(e),t)}(e,function(e,t){return e&&Co(t,Ma(t),e)}(a,e)):function(e,t){return Co(e,ui(e),t)}(e,tr(a,e))}else{if(!ot[f])return i?e:{};a=function(e,t,n){var r,o=e.constructor;switch(t){case R:return So(e);case g:case y:return new o(+e);case M:return function(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case O:case D:case L:case N:case P:case j:case F:case B:case z:return ko(e,n);case S:return new o;case k:case C:return new o(e);case E:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new o;case I:return r=e,Nn?xe(Nn.call(r)):{}}}(e,f,c)}}s||(s=new Hn);var m=s.get(e);if(m)return m;s.set(e,a),ia(e)?e.forEach(function(n){a.add(ir(n,t,r,n,e,s))}):ta(e)&&e.forEach(function(n,o){a.set(o,ir(n,t,r,o,e,s))});var v=d?n:(l?u?ti:ei:u?Ma:Ra)(e);return xt(v||e,function(n,o){v&&(n=e[o=n]),Qn(a,o,ir(n,t,r,o,e,s))}),a}function sr(e,t,r){var o=r.length;if(null==e)return!o;for(e=xe(e);o--;){var i=r[o],s=t[i],a=e[i];if(a===n&&!(i in e)||!s(a))return!1}return!0}function ar(e,t,o){if("function"!=typeof e)throw new Ce(r);return Ci(function(){e.apply(n,o)},t)}function cr(e,t,n,r){var o=-1,i=It,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;n&&(t=Rt(t,Yt(n))),r?(i=At,s=!1):t.length>=200&&(i=Jt,s=!1,t=new Wn(t));e:for(;++o-1},Vn.prototype.set=function(e,t){var n=this.__data__,r=Zn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(kn||Vn),string:new $n}},qn.prototype.delete=function(e){var t=si(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return si(this,e).get(e)},qn.prototype.has=function(e){return si(this,e).has(e)},qn.prototype.set=function(e,t){var n=si(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,i),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Hn.prototype.clear=function(){this.__data__=new Vn,this.size=0},Hn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Hn.prototype.get=function(e){return this.__data__.get(e)},Hn.prototype.has=function(e){return this.__data__.has(e)},Hn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Vn){var r=n.__data__;if(!kn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var ur=Ro(yr),lr=Ro(vr,!0);function dr(e,t){var n=!0;return ur(e,function(e,r,o){return n=!!t(e,r,o)}),n}function fr(e,t,r){for(var o=-1,i=e.length;++o0&&n(a)?t>1?hr(a,t-1,n,r,o):Mt(o,a):r||(o[o.length]=a)}return o}var mr=Mo(),gr=Mo(!0);function yr(e,t){return e&&mr(e,t,Ra)}function vr(e,t){return e&&gr(e,t,Ra)}function _r(e,t){return Ct(t,function(t){return Js(e[t])})}function br(e,t){for(var r=0,o=(t=go(t,e)).length;null!=e&&rt}function xr(e,t){return null!=e&&De.call(e,t)}function Er(e,t){return null!=e&&t in xe(e)}function Tr(e,t,r){for(var o=r?At:It,i=e[0].length,s=e.length,a=s,c=re(s),u=1/0,l=[];a--;){var d=e[a];a&&t&&(d=Rt(d,Yt(t))),u=gn(d.length,u),c[a]=!r&&(t||i>=120&&d.length>=120)?new Wn(a&&d):n}d=e[0];var f=-1,p=c[0];e:for(;++f=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)});t--;)e[t]=e[t].value;return e}(Nr(e,function(e,n,o){return{criteria:Rt(t,function(t){return t(e)}),index:++r,value:e}}))}function Ur(e,t,n){for(var r=-1,o=t.length,i={};++r-1;)a!==e&&Ke.call(a,c,1),Ke.call(e,c,1);return e}function Vr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;mi(o)?Ke.call(e,o,1):ao(e,o)}}return e}function qr(e,t){return e+ht(_n()*(t-e+1))}function Wr(e,t){var n="";if(!e||t<1||t>l)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Hr(e,t){return Ii(wi(e,t,nc),e+"")}function Kr(e){return Yn(Ba(e))}function Yr(e,t){var n=Ba(e);return Mi(n,or(t,0,n.length))}function Gr(e,t,r,o){if(!Zs(e))return e;for(var i=-1,s=(t=go(t,e)).length,a=s-1,c=e;null!=c&&++io?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=re(o);++r>>1,s=e[i];null!==s&&!aa(s)&&(n?s<=t:s=200){var u=t?null:Ho(e);if(u)return an(u);s=!1,o=Jt,c=new Wn}else c=t?[]:a;e:for(;++r=o?e:Zr(e,t,r)}var _o=ct||function(e){return lt.clearTimeout(e)};function bo(e,t){if(t)return e.slice();var n=e.length,r=Ve?Ve(n):new e.constructor(n);return e.copy(r),r}function So(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function ko(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function wo(e,t){if(e!==t){var r=e!==n,o=null===e,i=e==e,s=aa(e),a=t!==n,c=null===t,u=t==t,l=aa(t);if(!c&&!l&&!s&&e>t||s&&a&&u&&!c&&!l||o&&a&&u||!r&&u||!i)return 1;if(!o&&!s&&!l&&e1?r[i-1]:n,a=i>2?r[2]:n;for(s=e.length>3&&"function"==typeof s?(i--,s):n,a&&gi(r[0],r[1],a)&&(s=i<3?n:s,i=1),t=xe(t);++o-1?i[s?t[a]:a]:n}}function Po(e){return Zo(function(t){var o=t.length,i=o,s=zn.prototype.thru;for(e&&t.reverse();i--;){var a=t[i];if("function"!=typeof a)throw new Ce(r);if(s&&!c&&"wrapper"==ri(a))var c=new zn([],!0)}for(i=c?i:o;++i1&&_.reverse(),f&&lc))return!1;var l=s.get(e),d=s.get(t);if(l&&d)return l==t&&d==e;var f=-1,p=!0,h=2&r?new Wn:n;for(s.set(e,t),s.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return xt(p,function(n){var r="_."+n[0];t&n[1]&&!It(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ie);return t?t[1].split(se):[]}(r),n)))}function Ri(e){var t=0,r=0;return function(){var o=yn(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Mi(e,t){var r=-1,o=e.length,i=o-1;for(t=t===n?o:t;++r1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,os(e,r)});function ds(e){var t=jn(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ps=Zo(function(e){var t=e.length,r=t?e[0]:0,o=this.__wrapped__,i=function(t){return rr(t,e)};return!(t>1||this.__actions__.length)&&o instanceof Un&&mi(r)?((o=o.slice(r,+r+(t?1:0))).__actions__.push({func:fs,args:[i],thisArg:n}),new zn(o,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e})):this.thru(i)}),hs=Io(function(e,t,n){De.call(e,n)?++e[n]:nr(e,n,1)}),ms=No($i),gs=No(Vi);function ys(e,t){return(Vs(e)?xt:ur)(e,ii(t,3))}function vs(e,t){return(Vs(e)?Et:lr)(e,ii(t,3))}var _s=Io(function(e,t,n){De.call(e,n)?e[n].push(t):nr(e,n,[t])}),bs=Hr(function(e,t,n){var r=-1,o="function"==typeof t,i=Ws(e)?re(e.length):[];return ur(e,function(e){i[++r]=o?kt(t,e,n):Cr(e,t,n)}),i}),Ss=Io(function(e,t,n){nr(e,n,t)});function ks(e,t){return(Vs(e)?Rt:Nr)(e,ii(t,3))}var ws=Io(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),xs=Hr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&gi(e,t[0],t[1])?t=[]:n>2&&gi(t[0],t[1],t[2])&&(t=[t[0]]),zr(e,hr(t,1),[])}),Es=ut||function(){return lt.Date.now()};function Ts(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Yo(e,c,n,n,n,n,t)}function Cs(e,t){var o;if("function"!=typeof t)throw new Ce(r);return e=pa(e),function(){return--e>0&&(o=t.apply(this,arguments)),e<=1&&(t=n),o}}var Is=Hr(function(e,t,n){var r=1;if(n.length){var o=sn(n,oi(Is));r|=a}return Yo(e,r,t,n,o)}),As=Hr(function(e,t,n){var r=3;if(n.length){var o=sn(n,oi(As));r|=a}return Yo(t,r,e,n,o)});function Rs(e,t,o){var i,s,a,c,u,l,d=0,f=!1,p=!1,h=!0;if("function"!=typeof e)throw new Ce(r);function m(t){var r=i,o=s;return i=s=n,d=t,c=e.apply(o,r)}function g(e){var r=e-l;return l===n||r>=t||r<0||p&&e-d>=a}function y(){var e=Es();if(g(e))return v(e);u=Ci(y,function(e){var n=t-(e-l);return p?gn(n,a-(e-d)):n}(e))}function v(e){return u=n,h&&i?m(e):(i=s=n,c)}function _(){var e=Es(),r=g(e);if(i=arguments,s=this,l=e,r){if(u===n)return function(e){return d=e,u=Ci(y,t),f?m(e):c}(l);if(p)return _o(u),u=Ci(y,t),m(l)}return u===n&&(u=Ci(y,t)),c}return t=ma(t)||0,Zs(o)&&(f=!!o.leading,a=(p="maxWait"in o)?mn(ma(o.maxWait)||0,t):a,h="trailing"in o?!!o.trailing:h),_.cancel=function(){u!==n&&_o(u),d=0,i=l=s=u=n},_.flush=function(){return u===n?c:v(Es())},_}var Ms=Hr(function(e,t){return ar(e,1,t)}),Os=Hr(function(e,t,n){return ar(e,ma(t)||0,n)});function Ds(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ce(r);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Ds.Cache||qn),n}function Ls(e){if("function"!=typeof e)throw new Ce(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ds.Cache=qn;var Ns=yo(function(e,t){var n=(t=1==t.length&&Vs(t[0])?Rt(t[0],Yt(ii())):Rt(hr(t,1),Yt(ii()))).length;return Hr(function(r){for(var o=-1,i=gn(r.length,n);++o=t}),$s=Ir(function(){return arguments}())?Ir:function(e){return ea(e)&&De.call(e,"callee")&&!He.call(e,"callee")},Vs=re.isArray,qs=gt?Yt(gt):function(e){return ea(e)&&kr(e)==R};function Ws(e){return null!=e&&Qs(e.length)&&!Js(e)}function Hs(e){return ea(e)&&Ws(e)}var Ks=Nt||mc,Ys=yt?Yt(yt):function(e){return ea(e)&&kr(e)==y};function Gs(e){if(!ea(e))return!1;var t=kr(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ra(e)}function Js(e){if(!Zs(e))return!1;var t=kr(e);return t==_||t==b||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xs(e){return"number"==typeof e&&e==pa(e)}function Qs(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=l}function Zs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ea(e){return null!=e&&"object"==typeof e}var ta=vt?Yt(vt):function(e){return ea(e)&&di(e)==S};function na(e){return"number"==typeof e||ea(e)&&kr(e)==k}function ra(e){if(!ea(e)||kr(e)!=w)return!1;var t=qe(e);if(null===t)return!0;var n=De.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==je}var oa=_t?Yt(_t):function(e){return ea(e)&&kr(e)==E},ia=bt?Yt(bt):function(e){return ea(e)&&di(e)==T};function sa(e){return"string"==typeof e||!Vs(e)&&ea(e)&&kr(e)==C}function aa(e){return"symbol"==typeof e||ea(e)&&kr(e)==I}var ca=St?Yt(St):function(e){return ea(e)&&Qs(e.length)&&!!rt[kr(e)]},ua=Vo(Lr),la=Vo(function(e,t){return e<=t});function da(e){if(!e)return[];if(Ws(e))return sa(e)?un(e):To(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=di(e);return(t==S?rn:t==T?an:Ba)(e)}function fa(e){return e?(e=ma(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function pa(e){var t=fa(e),n=t%1;return t==t?n?t-n:t:0}function ha(e){return e?or(pa(e),0,f):0}function ma(e){if("number"==typeof e)return e;if(aa(e))return d;if(Zs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Zs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=pe.test(e);return n||me.test(e)?at(e.slice(2),n?2:8):fe.test(e)?d:+e}function ga(e){return Co(e,Ma(e))}function ya(e){return null==e?"":io(e)}var va=Ao(function(e,t){if(bi(t)||Ws(t))Co(t,Ra(t),e);else for(var n in t)De.call(t,n)&&Qn(e,n,t[n])}),_a=Ao(function(e,t){Co(t,Ma(t),e)}),ba=Ao(function(e,t,n,r){Co(t,Ma(t),e,r)}),Sa=Ao(function(e,t,n,r){Co(t,Ra(t),e,r)}),ka=Zo(rr),wa=Hr(function(e,t){e=xe(e);var r=-1,o=t.length,i=o>2?t[2]:n;for(i&&gi(t[0],t[1],i)&&(o=1);++r1),t}),Co(e,ti(e),n),r&&(n=ir(n,7,Xo));for(var o=t.length;o--;)ao(n,t[o]);return n}),Na=Zo(function(e,t){return null==e?{}:function(e,t){return Ur(e,t,function(t,n){return Ta(e,n)})}(e,t)});function Pa(e,t){if(null==e)return{};var n=Rt(ti(e),function(e){return[e]});return t=ii(t),Ur(e,n,function(e,n){return t(e,n[0])})}var ja=Ko(Ra),Fa=Ko(Ma);function Ba(e){return null==e?[]:Gt(e,Ra(e))}var za=Do(function(e,t,n){return t=t.toLowerCase(),e+(n?Ua(t):t)});function Ua(e){return Ga(ya(e).toLowerCase())}function $a(e){return(e=ya(e))&&e.replace(ye,Zt).replace(Je,"")}var Va=Do(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),qa=Do(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Wa=Oo("toLowerCase"),Ha=Do(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Ka=Do(function(e,t,n){return e+(n?" ":"")+Ga(t)}),Ya=Do(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ga=Oo("toUpperCase");function Ja(e,t,r){return e=ya(e),(t=r?n:t)===n?function(e){return et.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(ae)||[]}(e):e.match(t)||[]}var Xa=Hr(function(e,t){try{return kt(e,n,t)}catch(r){return Gs(r)?r:new Se(r)}}),Qa=Zo(function(e,t){return xt(t,function(t){t=Pi(t),nr(e,t,Is(e[t],e))}),e});function Za(e){return function(){return e}}var ec=Po(),tc=Po(!0);function nc(e){return e}function rc(e){return Or("function"==typeof e?e:ir(e,1))}var oc=Hr(function(e,t){return function(n){return Cr(n,e,t)}}),ic=Hr(function(e,t){return function(n){return Cr(e,n,t)}});function sc(e,t,n){var r=Ra(t),o=_r(t,r);null!=n||Zs(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=_r(t,Ra(t)));var i=!(Zs(n)&&"chain"in n&&!n.chain),s=Js(e);return xt(o,function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=To(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Mt([this.value()],arguments))})}),e}function ac(){}var cc=zo(Rt),uc=zo(Tt),lc=zo(Lt);function dc(e){return yi(e)?$t(Pi(e)):function(e){return function(t){return br(t,e)}}(e)}var fc=$o(),pc=$o(!0);function hc(){return[]}function mc(){return!1}var gc,yc=Bo(function(e,t){return e+t},0),vc=Wo("ceil"),_c=Bo(function(e,t){return e/t},1),bc=Wo("floor"),Sc=Bo(function(e,t){return e*t},1),kc=Wo("round"),wc=Bo(function(e,t){return e-t},0);return jn.after=function(e,t){if("function"!=typeof t)throw new Ce(r);return e=pa(e),function(){if(--e<1)return t.apply(this,arguments)}},jn.ary=Ts,jn.assign=va,jn.assignIn=_a,jn.assignInWith=ba,jn.assignWith=Sa,jn.at=ka,jn.before=Cs,jn.bind=Is,jn.bindAll=Qa,jn.bindKey=As,jn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Vs(e)?e:[e]},jn.chain=ds,jn.chunk=function(e,t,r){t=(r?gi(e,t,r):t===n)?1:mn(pa(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var i=0,s=0,a=re(ft(o/t));ii?0:i+r),(o=o===n||o>i?i:pa(o))<0&&(o+=i),o=r>o?0:ha(o);r>>0)?(e=ya(e))&&("string"==typeof t||null!=t&&!oa(t))&&!(t=io(t))&&nn(e)?vo(un(e),0,r):e.split(t,r):[]},jn.spread=function(e,t){if("function"!=typeof e)throw new Ce(r);return t=null==t?0:mn(pa(t),0),Hr(function(n){var r=n[t],o=vo(n,0,t);return r&&Mt(o,r),kt(e,this,o)})},jn.tail=function(e){var t=null==e?0:e.length;return t?Zr(e,1,t):[]},jn.take=function(e,t,r){return e&&e.length?Zr(e,0,(t=r||t===n?1:pa(t))<0?0:t):[]},jn.takeRight=function(e,t,r){var o=null==e?0:e.length;return o?Zr(e,(t=o-(t=r||t===n?1:pa(t)))<0?0:t,o):[]},jn.takeRightWhile=function(e,t){return e&&e.length?uo(e,ii(t,3),!1,!0):[]},jn.takeWhile=function(e,t){return e&&e.length?uo(e,ii(t,3)):[]},jn.tap=function(e,t){return t(e),e},jn.throttle=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new Ce(r);return Zs(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),Rs(e,t,{leading:o,maxWait:t,trailing:i})},jn.thru=fs,jn.toArray=da,jn.toPairs=ja,jn.toPairsIn=Fa,jn.toPath=function(e){return Vs(e)?Rt(e,Pi):aa(e)?[e]:To(Ni(ya(e)))},jn.toPlainObject=ga,jn.transform=function(e,t,n){var r=Vs(e),o=r||Ks(e)||ca(e);if(t=ii(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:Zs(e)&&Js(i)?Fn(qe(e)):{}}return(o?xt:yr)(e,function(e,r,o){return t(n,e,r,o)}),n},jn.unary=function(e){return Ts(e,1)},jn.union=es,jn.unionBy=ts,jn.unionWith=ns,jn.uniq=function(e){return e&&e.length?so(e):[]},jn.uniqBy=function(e,t){return e&&e.length?so(e,ii(t,2)):[]},jn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?so(e,n,t):[]},jn.unset=function(e,t){return null==e||ao(e,t)},jn.unzip=rs,jn.unzipWith=os,jn.update=function(e,t,n){return null==e?e:co(e,t,mo(n))},jn.updateWith=function(e,t,r,o){return o="function"==typeof o?o:n,null==e?e:co(e,t,mo(r),o)},jn.values=Ba,jn.valuesIn=function(e){return null==e?[]:Gt(e,Ma(e))},jn.without=is,jn.words=Ja,jn.wrap=function(e,t){return Ps(mo(t),e)},jn.xor=ss,jn.xorBy=as,jn.xorWith=cs,jn.zip=us,jn.zipObject=function(e,t){return po(e||[],t||[],Qn)},jn.zipObjectDeep=function(e,t){return po(e||[],t||[],Gr)},jn.zipWith=ls,jn.entries=ja,jn.entriesIn=Fa,jn.extend=_a,jn.extendWith=ba,sc(jn,jn),jn.add=yc,jn.attempt=Xa,jn.camelCase=za,jn.capitalize=Ua,jn.ceil=vc,jn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=ma(r))==r?r:0),t!==n&&(t=(t=ma(t))==t?t:0),or(ma(e),t,r)},jn.clone=function(e){return ir(e,4)},jn.cloneDeep=function(e){return ir(e,5)},jn.cloneDeepWith=function(e,t){return ir(e,5,t="function"==typeof t?t:n)},jn.cloneWith=function(e,t){return ir(e,4,t="function"==typeof t?t:n)},jn.conformsTo=function(e,t){return null==t||sr(e,t,Ra(t))},jn.deburr=$a,jn.defaultTo=function(e,t){return null==e||e!=e?t:e},jn.divide=_c,jn.endsWith=function(e,t,r){e=ya(e),t=io(t);var o=e.length,i=r=r===n?o:or(pa(r),0,o);return(r-=t.length)>=0&&e.slice(r,i)==t},jn.eq=Bs,jn.escape=function(e){return(e=ya(e))&&K.test(e)?e.replace(W,en):e},jn.escapeRegExp=function(e){return(e=ya(e))&&te.test(e)?e.replace(ee,"\\$&"):e},jn.every=function(e,t,r){var o=Vs(e)?Tt:dr;return r&&gi(e,t,r)&&(t=n),o(e,ii(t,3))},jn.find=ms,jn.findIndex=$i,jn.findKey=function(e,t){return Pt(e,ii(t,3),yr)},jn.findLast=gs,jn.findLastIndex=Vi,jn.findLastKey=function(e,t){return Pt(e,ii(t,3),vr)},jn.floor=bc,jn.forEach=ys,jn.forEachRight=vs,jn.forIn=function(e,t){return null==e?e:mr(e,ii(t,3),Ma)},jn.forInRight=function(e,t){return null==e?e:gr(e,ii(t,3),Ma)},jn.forOwn=function(e,t){return e&&yr(e,ii(t,3))},jn.forOwnRight=function(e,t){return e&&vr(e,ii(t,3))},jn.get=Ea,jn.gt=zs,jn.gte=Us,jn.has=function(e,t){return null!=e&&fi(e,t,xr)},jn.hasIn=Ta,jn.head=Wi,jn.identity=nc,jn.includes=function(e,t,n,r){e=Ws(e)?e:Ba(e),n=n&&!r?pa(n):0;var o=e.length;return n<0&&(n=mn(o+n,0)),sa(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Ft(e,t,n)>-1},jn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:pa(n);return o<0&&(o=mn(r+o,0)),Ft(e,t,o)},jn.inRange=function(e,t,r){return t=fa(t),r===n?(r=t,t=0):r=fa(r),function(e,t,n){return e>=gn(t,n)&&e=-9007199254740991&&e<=l},jn.isSet=ia,jn.isString=sa,jn.isSymbol=aa,jn.isTypedArray=ca,jn.isUndefined=function(e){return e===n},jn.isWeakMap=function(e){return ea(e)&&di(e)==A},jn.isWeakSet=function(e){return ea(e)&&"[object WeakSet]"==kr(e)},jn.join=function(e,t){return null==e?"":pn.call(e,t)},jn.kebabCase=Va,jn.last=Gi,jn.lastIndexOf=function(e,t,r){var o=null==e?0:e.length;if(!o)return-1;var i=o;return r!==n&&(i=(i=pa(r))<0?mn(o+i,0):gn(i,o-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):jt(e,zt,i,!0)},jn.lowerCase=qa,jn.lowerFirst=Wa,jn.lt=ua,jn.lte=la,jn.max=function(e){return e&&e.length?fr(e,nc,wr):n},jn.maxBy=function(e,t){return e&&e.length?fr(e,ii(t,2),wr):n},jn.mean=function(e){return Ut(e,nc)},jn.meanBy=function(e,t){return Ut(e,ii(t,2))},jn.min=function(e){return e&&e.length?fr(e,nc,Lr):n},jn.minBy=function(e,t){return e&&e.length?fr(e,ii(t,2),Lr):n},jn.stubArray=hc,jn.stubFalse=mc,jn.stubObject=function(){return{}},jn.stubString=function(){return""},jn.stubTrue=function(){return!0},jn.multiply=Sc,jn.nth=function(e,t){return e&&e.length?Br(e,pa(t)):n},jn.noConflict=function(){return lt._===this&&(lt._=Fe),this},jn.noop=ac,jn.now=Es,jn.pad=function(e,t,n){e=ya(e);var r=(t=pa(t))?cn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Uo(ht(o),n)+e+Uo(ft(o),n)},jn.padEnd=function(e,t,n){e=ya(e);var r=(t=pa(t))?cn(e):0;return t&&rt){var o=e;e=t,t=o}if(r||e%1||t%1){var i=_n();return gn(e+i*(t-e+st("1e-"+((i+"").length-1))),t)}return qr(e,t)},jn.reduce=function(e,t,n){var r=Vs(e)?Ot:qt,o=arguments.length<3;return r(e,ii(t,4),n,o,ur)},jn.reduceRight=function(e,t,n){var r=Vs(e)?Dt:qt,o=arguments.length<3;return r(e,ii(t,4),n,o,lr)},jn.repeat=function(e,t,r){return t=(r?gi(e,t,r):t===n)?1:pa(t),Wr(ya(e),t)},jn.replace=function(){var e=arguments,t=ya(e[0]);return e.length<3?t:t.replace(e[1],e[2])},jn.result=function(e,t,r){var o=-1,i=(t=go(t,e)).length;for(i||(i=1,e=n);++ol)return[];var n=f,r=gn(e,f);t=ii(t),e-=f;for(var o=Ht(r,t);++n=s)return e;var c=r-cn(o);if(c<1)return o;var u=a?vo(a,0,c).join(""):e.slice(0,c);if(i===n)return u+o;if(a&&(c+=u.length-c),oa(i)){if(e.slice(c).search(i)){var l,d=u;for(i.global||(i=Ee(i.source,ya(de.exec(i))+"g")),i.lastIndex=0;l=i.exec(d);)var f=l.index;u=u.slice(0,f===n?c:f)}}else if(e.indexOf(io(i),c)!=c){var p=u.lastIndexOf(i);p>-1&&(u=u.slice(0,p))}return u+o},jn.unescape=function(e){return(e=ya(e))&&H.test(e)?e.replace(q,dn):e},jn.uniqueId=function(e){var t=++Le;return ya(e)+t},jn.upperCase=Ya,jn.upperFirst=Ga,jn.each=ys,jn.eachRight=vs,jn.first=Wi,sc(jn,(gc={},yr(jn,function(e,t){De.call(jn.prototype,t)||(gc[t]=e)}),gc),{chain:!1}),jn.VERSION="4.17.21",xt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){jn[e].placeholder=jn}),xt(["drop","take"],function(e,t){Un.prototype[e]=function(r){r=r===n?1:mn(pa(r),0);var o=this.__filtered__&&!t?new Un(this):this.clone();return o.__filtered__?o.__takeCount__=gn(r,o.__takeCount__):o.__views__.push({size:gn(r,f),type:e+(o.__dir__<0?"Right":"")}),o},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),xt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ii(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),xt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}}),xt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}}),Un.prototype.compact=function(){return this.filter(nc)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Hr(function(e,t){return"function"==typeof e?new Un(this):this.map(function(n){return Cr(n,e,t)})}),Un.prototype.reject=function(e){return this.filter(Ls(ii(e)))},Un.prototype.slice=function(e,t){e=pa(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Un(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=pa(t))<0?r.dropRight(-t):r.take(t-e)),r)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(f)},yr(Un.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),i=jn[o?"take"+("last"==t?"Right":""):t],s=o||/^find/.test(t);i&&(jn.prototype[t]=function(){var t=this.__wrapped__,a=o?[1]:arguments,c=t instanceof Un,u=a[0],l=c||Vs(t),d=function(e){var t=i.apply(jn,Mt([e],a));return o&&f?t[0]:t};l&&r&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,p=!!this.__actions__.length,h=s&&!f,m=c&&!p;if(!s&&l){t=m?t:new Un(this);var g=e.apply(t,a);return g.__actions__.push({func:fs,args:[d],thisArg:n}),new zn(g,f)}return h&&m?e.apply(this,a):(g=this.thru(d),h?o?g.value()[0]:g.value():g)})}),xt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Ie[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);jn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Vs(o)?o:[],e)}return this[n](function(n){return t.apply(Vs(n)?n:[],e)})}}),yr(Un.prototype,function(e,t){var n=jn[t];if(n){var r=n.name+"";De.call(In,r)||(In[r]=[]),In[r].push({name:t,func:n})}}),In[jo(n,2).name]=[{name:"wrapper",func:n}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=To(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=To(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=To(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Vs(e),r=t<0,o=n?e.length:0,i=function(e,t,n){for(var r=-1,o=n.length;++r=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},jn.prototype.plant=function(e){for(var t,r=this;r instanceof Bn;){var o=Fi(r);o.__index__=0,o.__values__=n,t?i.__wrapped__=o:t=o;var i=o;r=r.__wrapped__}return i.__wrapped__=e,t},jn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:fs,args:[Zi],thisArg:n}),new zn(t,this.__chain__)}return this.thru(Zi)},jn.prototype.toJSON=jn.prototype.valueOf=jn.prototype.value=function(){return lo(this.__wrapped__,this.__actions__)},jn.prototype.first=jn.prototype.head,Xe&&(jn.prototype[Xe]=function(){return this}),jn}();ft?((ft.exports=fn)._=fn,dt._=fn):lt._=fn}).call(ts)}(es,es.exports)),es.exports}var rs=ns();let os;const is=new Uint8Array(16);function ss(){if(!os&&(os="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!os))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return os(is)}const as=[];for(let LE=0;LE<256;++LE)as.push((LE+256).toString(16).slice(1));const cs={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function us(e,t,n){if(cs.randomUUID&&!e)return cs.randomUUID();const r=(e=e||{}).random||(e.rng||ss)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return as[e[t+0]]+as[e[t+1]]+as[e[t+2]]+as[e[t+3]]+"-"+as[e[t+4]]+as[e[t+5]]+"-"+as[e[t+6]]+as[e[t+7]]+"-"+as[e[t+8]]+as[e[t+9]]+"-"+as[e[t+10]]+as[e[t+11]]+as[e[t+12]]+as[e[t+13]]+as[e[t+14]]+as[e[t+15]]}(r)}const ls=Object.create(null);ls.open="0",ls.close="1",ls.ping="2",ls.pong="3",ls.message="4",ls.upgrade="5",ls.noop="6";const ds=Object.create(null);Object.keys(ls).forEach(e=>{ds[ls[e]]=e});const fs={type:"error",data:"parser error"},ps="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),hs="function"==typeof ArrayBuffer,ms=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,gs=({type:e,data:t},n,r)=>ps&&t instanceof Blob?n?r(t):ys(t,r):hs&&(t instanceof ArrayBuffer||ms(t))?n?r(t):ys(new Blob([t]),r):r(ls[e]+(t||"")),ys=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function vs(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let _s;const bs="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let LE=0;LE<64;LE++)bs["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(LE)]=LE;const Ss="function"==typeof ArrayBuffer,ks=(e,t)=>{if("string"!=typeof e)return{type:"message",data:xs(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:ws(e.substring(1),t)}:ds[n]?e.length>1?{type:ds[n],data:e.substring(1)}:{type:ds[n]}:fs},ws=(e,t)=>{if(Ss){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const u=new ArrayBuffer(s),l=new Uint8Array(u);for(t=0;t>4,l[c++]=(15&r)<<4|o>>2,l[c++]=(3&o)<<6|63&i;return u})(e);return xs(n,t)}return{base64:!0,data:e}},xs=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Es=String.fromCharCode(30);let Ts;function Cs(e){return e.reduce((e,t)=>e+t.length,0)}function Is(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const Os=Rs.setTimeout,Ds=Rs.clearTimeout;function Ls(e,t){t.useNativeTimers?(e.setTimeoutFn=Os.bind(Rs),e.clearTimeoutFn=Ds.bind(Rs)):(e.setTimeoutFn=Rs.setTimeout.bind(Rs),e.clearTimeoutFn=Rs.clearTimeout.bind(Rs))}function Ns(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}class Ps extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class js extends As{constructor(e){super(),this.writable=!1,Ls(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new Ps(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=ks(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}const Fs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split("");let Bs,zs=0;function Us(e){let t="";do{t=Fs[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function $s(){const e=Us(+new Date);return e!==Bs?(zs=0,Bs=e):e+"."+Us(zs++)}let Vs=!1;try{Vs="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(DE){}const qs=Vs;function Ws(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||qs))return new XMLHttpRequest}catch(n){}if(!t)try{return new(Rs[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(n){}}function Hs(){}const Ks=null!=new Ws({xdomain:!1}).responseType;let Ys=class e extends As{constructor(e,t){super(),Ls(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var t;const n=Ms(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new Ws(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(o){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(o){}try{r.setRequestHeader("Accept","*/*")}catch(o){}null===(t=this.opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(r)),4===r.readyState&&(200===r.status||1223===r.status?this.onLoad():this.setTimeoutFn(()=>{this.onError("number"==typeof r.status?r.status:0)},0))},r.send(this.data)}catch(o){return void this.setTimeoutFn(()=>{this.onError(o)},0)}"undefined"!=typeof document&&(this.index=e.requestsCount++,e.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Hs,t)try{this.xhr.abort()}catch(n){}"undefined"!=typeof document&&delete e.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};function Gs(){for(let e in Ys.requests)Ys.requests.hasOwnProperty(e)&&Ys.requests[e].abort()}Ys.requestsCount=0,Ys.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",Gs):"function"==typeof addEventListener&&addEventListener("onpagehide"in Rs?"pagehide":"unload",Gs,!1));const Js="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Xs=Rs.WebSocket||Rs.MozWebSocket,Qs="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),Zs={websocket:class extends js{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=Qs?{}:Ms(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=Qs?new Xs(e,t,n):t?new Xs(e,t):new Xs(e)}catch(DE){return this.emitReserved("error",DE)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(t){}r&&Js(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=$s()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Xs}},webtransport:class extends js{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=function(e,t){Ts||(Ts=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(Cs(n)<1)break;const e=Is(n,1);i=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(Cs(n)<2)break;const e=Is(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(Cs(n)<8)break;const e=Is(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(fs);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(Cs(n)e){a.enqueue(fs);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=new TransformStream({transform(e,t){!function(e,t){ps&&e.data instanceof Blob?e.data.arrayBuffer().then(vs).then(t):hs&&(e.data instanceof ArrayBuffer||ms(e.data))?t(vs(e.data)):gs(e,!1,e=>{_s||(_s=new TextEncoder),t(_s.encode(e))})}(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}});r.readable.pipeTo(e.writable),this.writer=r.writable.getWriter();const o=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this.writer.write(i).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t{r&&Js(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends js{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}const t=e&&e.forceBase64;this.supportsBinary=Ks&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(Es),r=[];for(let o=0;o{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach((e,i)=>{gs(e,!1,e=>{r[i]=e,++o===n&&t(r.join(Es))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=$s()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Ys(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}},ea=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ta=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function na(e){if(e.length>2e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=ea.exec(e||""),i={},s=14;for(;s--;)i[ta[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,i.query),i}let ra=class e extends As{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=na(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=na(t.host).host),Ls(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,o=n.length;r{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Zs[e](n)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(n){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",e=>this.onClose("transport close",e))}probe(t){let n=this.createTransport(t),r=!1;e.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",t=>{if(!r)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;e.priorWebsocketSuccess="websocket"===n.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(l(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=n.name,this.emitReserved("upgradeError",e)}}))};function i(){r||(r=!0,l(),n.close(),n=null)}const s=e=>{const t=new Error("probe error: "+e);t.transport=n.name,i(),this.emitReserved("upgradeError",t)};function a(){s("transport closed")}function c(){s("socket closed")}function u(e){n&&e.name!==n.name&&i()}const l=()=>{n.removeListener("open",o),n.removeListener("error",s),n.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};n.once("open",o),n.once("error",s),n.once("close",a),this.once("close",c),this.once("upgrading",u),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||sa&&e instanceof Blob||aa&&e instanceof File}function ua(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t=0&&e.num{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(o),t.apply(this,[null,...e])}}emitWithAck(e,...t){const n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise((r,o)=>{t.push((e,t)=>n?e?o(e):r(t):r(e)),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ma.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ma.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ma.EVENT:case ma.BINARY_EVENT:this.onevent(e);break;case ma.ACK:case ma.BINARY_ACK:this.onack(e);break;case ma.DISCONNECT:this.ondisconnect();break;case ma.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:ma.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ma.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}xa.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},xa.prototype.reset=function(){this.attempts=0},xa.prototype.setMin=function(e){this.ms=e},xa.prototype.setMax=function(e){this.max=e},xa.prototype.setJitter=function(e){this.jitter=e};class Ea extends As{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,Ls(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new xa({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||ba;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ra(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Sa(t,"open",function(){n.onopen(),e&&e()}),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Sa(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),o(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Sa(e,"ping",this.onping.bind(this)),Sa(e,"data",this.ondata.bind(this)),Sa(e,"error",this.onerror.bind(this)),Sa(e,"close",this.onclose.bind(this)),Sa(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Js(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new wa(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;ne()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ta={};function Ca(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=na(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=Ta[o]&&i in Ta[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new Ea(r,t):(Ta[o]||(Ta[o]=new Ea(r,t)),a=Ta[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(Ca,{Manager:Ea,Socket:wa,io:Ca,connect:Ca});var Ia=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],Aa=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Ra=[],Ma=[];for(let LE=1;LE<=8;LE++)for(let e=0;eRa[t]>Oa[0]&&Ra[t]Ra[t]>Oa[0]&&Ra[t]=0;n--)if(o>e[n]){t[n]=Math.max(t[n],i);break}}s=t,a="voice"===r?Da:Ra,c="voice"===r?La:Ma}else s=Array.from(n),a=s.map((e,t)=>l*t),c=a.map(e=>`${e.toFixed(2)} Hz`);let d=s.map(e=>Math.max(0,Math.min((e-o)/(i-o),1)));return{values:new Float32Array(d),frequencies:a,labels:c}}constructor(e,t=null){if(this.fftResults=[],t){let{length:n,sampleRate:r}=t,o=new OfflineAudioContext({length:n,sampleRate:r}),i=o.createBufferSource();i.buffer=t;let s=o.createAnalyser();s.fftSize=8192,s.smoothingTimeConstant=.1,i.connect(s);let a=1/60,c=n/r,u=e=>{let t=a*e;t{let t=new Float32Array(s.frequencyBinCount);s.getFloatFrequencyData(t),this.fftResults.push(t),u(e+1)}),1===e?o.startRendering():o.resume()};i.start(0),u(1),this.audio=e,this.context=o,this.analyser=s,this.sampleRate=r,this.audioBuffer=t}else{let t=new AudioContext,n=t.createMediaElementSource(e),r=t.createAnalyser();r.fftSize=8192,r.smoothingTimeConstant=.1,n.connect(r),r.connect(t.destination),this.audio=e,this.context=t,this.analyser=r,this.sampleRate=this.context.sampleRate,this.audioBuffer=null}}getFrequencies(t="frequency",n=-100,r=-30){let o=null;if(this.audioBuffer&&this.fftResults.length){let e=this.audio.currentTime/this.audio.duration,t=Math.min(e*this.fftResults.length|0,this.fftResults.length-1);o=this.fftResults[t]}return e.getFrequencies(this.analyser,this.sampleRate,o,t,n,r)}async resumeIfSuspended(){return"suspended"===this.context.state&&await this.context.resume(),!0}};globalThis.AudioAnalysis=Na;var Pa=class{static floatTo16BitPCM(e){let t=new ArrayBuffer(2*e.length),n=new DataView(t),r=0;for(let o=0;o>8]),new Uint8Array([t,t>>8,t>>16,t>>24])][e]}pack(e,t){if(!t?.bitsPerSample)throw new Error('Missing "bitsPerSample"');if(!t?.channels)throw new Error('Missing "channels"');if(!t?.data)throw new Error('Missing "data"');let{bitsPerSample:n,channels:r,data:o}=t,i=["RIFF",this._packData(1,52),"WAVE","fmt ",this._packData(1,16),this._packData(0,1),this._packData(0,r.length),this._packData(1,e),this._packData(1,e*r.length*n/8),this._packData(0,r.length*n/8),this._packData(0,n),"data",this._packData(1,r[0].length*r.length*n/8),o],s=new Blob(i,{type:"audio/mpeg"});return{blob:s,url:URL.createObjectURL(s),channelCount:r.length,sampleRate:e,duration:o.byteLength/(r.length*e*2)}}};globalThis.WavPacker=Pa;var ja=new Blob(["\nclass AudioProcessor extends AudioWorkletProcessor {\n\n constructor() {\n super();\n this.port.onmessage = this.receive.bind(this);\n this.initialize();\n }\n\n initialize() {\n this.foundAudio = false;\n this.recording = false;\n this.chunks = [];\n }\n\n /**\n * Concatenates sampled chunks into channels\n * Format is chunk[Left[], Right[]]\n */\n readChannelData(chunks, channel = -1, maxChannels = 9) {\n let channelLimit;\n if (channel !== -1) {\n if (chunks[0] && chunks[0].length - 1 < channel) {\n throw new Error(\n `Channel ${channel} out of range: max ${chunks[0].length}`\n );\n }\n channelLimit = channel + 1;\n } else {\n channel = 0;\n channelLimit = Math.min(chunks[0] ? chunks[0].length : 1, maxChannels);\n }\n const channels = [];\n for (let n = channel; n < channelLimit; n++) {\n const length = chunks.reduce((sum, chunk) => {\n return sum + chunk[n].length;\n }, 0);\n const buffers = chunks.map((chunk) => chunk[n]);\n const result = new Float32Array(length);\n let offset = 0;\n for (let i = 0; i < buffers.length; i++) {\n result.set(buffers[i], offset);\n offset += buffers[i].length;\n }\n channels[n] = result;\n }\n return channels;\n }\n\n /**\n * Combines parallel audio data into correct format,\n * channels[Left[], Right[]] to float32Array[LRLRLRLR...]\n */\n formatAudioData(channels) {\n if (channels.length === 1) {\n // Simple case is only one channel\n const float32Array = channels[0].slice();\n const meanValues = channels[0].slice();\n return { float32Array, meanValues };\n } else {\n const float32Array = new Float32Array(\n channels[0].length * channels.length\n );\n const meanValues = new Float32Array(channels[0].length);\n for (let i = 0; i < channels[0].length; i++) {\n const offset = i * channels.length;\n let meanValue = 0;\n for (let n = 0; n < channels.length; n++) {\n float32Array[offset + n] = channels[n][i];\n meanValue += channels[n][i];\n }\n meanValues[i] = meanValue / channels.length;\n }\n return { float32Array, meanValues };\n }\n }\n\n /**\n * Converts 32-bit float data to 16-bit integers\n */\n floatTo16BitPCM(float32Array) {\n const buffer = new ArrayBuffer(float32Array.length * 2);\n const view = new DataView(buffer);\n let offset = 0;\n for (let i = 0; i < float32Array.length; i++, offset += 2) {\n let s = Math.max(-1, Math.min(1, float32Array[i]));\n view.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7fff, true);\n }\n return buffer;\n }\n\n /**\n * Retrieves the most recent amplitude values from the audio stream\n * @param {number} channel\n */\n getValues(channel = -1) {\n const channels = this.readChannelData(this.chunks, channel);\n const { meanValues } = this.formatAudioData(channels);\n return { meanValues, channels };\n }\n\n /**\n * Exports chunks as an audio/wav file\n */\n export() {\n const channels = this.readChannelData(this.chunks);\n const { float32Array, meanValues } = this.formatAudioData(channels);\n const audioData = this.floatTo16BitPCM(float32Array);\n return {\n meanValues: meanValues,\n audio: {\n bitsPerSample: 16,\n channels: channels,\n data: audioData,\n },\n };\n }\n\n receive(e) {\n const { event, id } = e.data;\n let receiptData = {};\n switch (event) {\n case 'start':\n this.recording = true;\n break;\n case 'stop':\n this.recording = false;\n break;\n case 'clear':\n this.initialize();\n break;\n case 'export':\n receiptData = this.export();\n break;\n case 'read':\n receiptData = this.getValues();\n break;\n default:\n break;\n }\n // Always send back receipt\n this.port.postMessage({ event: 'receipt', id, data: receiptData });\n }\n\n sendChunk(chunk) {\n const channels = this.readChannelData([chunk]);\n const { float32Array, meanValues } = this.formatAudioData(channels);\n const rawAudioData = this.floatTo16BitPCM(float32Array);\n const monoAudioData = this.floatTo16BitPCM(meanValues);\n this.port.postMessage({\n event: 'chunk',\n data: {\n mono: monoAudioData,\n raw: rawAudioData,\n },\n });\n }\n\n process(inputList, outputList, parameters) {\n // Copy input to output (e.g. speakers)\n // Note that this creates choppy sounds with Mac products\n const sourceLimit = Math.min(inputList.length, outputList.length);\n for (let inputNum = 0; inputNum < sourceLimit; inputNum++) {\n const input = inputList[inputNum];\n const output = outputList[inputNum];\n const channelCount = Math.min(input.length, output.length);\n for (let channelNum = 0; channelNum < channelCount; channelNum++) {\n input[channelNum].forEach((sample, i) => {\n output[channelNum][i] = sample;\n });\n }\n }\n const inputs = inputList[0];\n // There's latency at the beginning of a stream before recording starts\n // Make sure we actually receive audio data before we start storing chunks\n let sliceIndex = 0;\n if (!this.foundAudio) {\n for (const channel of inputs) {\n sliceIndex = 0; // reset for each channel\n if (this.foundAudio) {\n break;\n }\n if (channel) {\n for (const value of channel) {\n if (value !== 0) {\n // find only one non-zero entry in any channel\n this.foundAudio = true;\n break;\n } else {\n sliceIndex++;\n }\n }\n }\n }\n }\n if (inputs && inputs[0] && this.foundAudio && this.recording) {\n // We need to copy the TypedArray, because the `process`\n // internals will reuse the same buffer to hold each input\n const chunk = inputs.map((input) => input.slice(sliceIndex));\n this.chunks.push(chunk);\n this.sendChunk(chunk);\n }\n return true;\n }\n}\n\nregisterProcessor('audio_processor', AudioProcessor);\n"],{type:"application/javascript"}),Fa=URL.createObjectURL(ja),Ba=class{constructor({sampleRate:e=24e3,outputToSpeakers:t=!1,debug:n=!1}={}){this.scriptSrc=Fa,this.sampleRate=e,this.outputToSpeakers=t,this.debug=!!n,this._deviceChangeCallback=null,this._devices=[],this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}static async decode(e,t=24e3,n=-1){let r,o,i=new AudioContext({sampleRate:t});if(e instanceof Blob){if(-1!==n)throw new Error('Can not specify "fromSampleRate" when reading from Blob');o=e,r=await o.arrayBuffer()}else if(e instanceof ArrayBuffer){if(-1!==n)throw new Error('Can not specify "fromSampleRate" when reading from ArrayBuffer');r=e,o=new Blob([r],{type:"audio/wav"})}else{let t,i;if(e instanceof Int16Array){i=e,t=new Float32Array(e.length);for(let n=0;n');t=new Float32Array(e)}if(-1===n)throw new Error('Must specify "fromSampleRate" when reading from Float32Array, In16Array or Array');if(n<3e3)throw new Error('Minimum "fromSampleRate" is 3000 (3kHz)');i||(i=Pa.floatTo16BitPCM(t));let s={bitsPerSample:16,channels:[t],data:i};o=(new Pa).pack(n,s).blob,r=await o.arrayBuffer()}let s=await i.decodeAudioData(r),a=s.getChannelData(0);return{blob:o,url:URL.createObjectURL(o),values:a,audioBuffer:s}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,t={},n=null){if(!(n=n||this.processor))throw new Error("Can not send events without recording first");let r={event:e,id:this._lastEventId++,data:t};n.port.postMessage(r);let o=(new Date).valueOf();for(;!this.eventReceipts[r.id];){if((new Date).valueOf()-o>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(e=>setTimeout(()=>e(!0),1))}let i=this.eventReceipts[r.id];return delete this.eventReceipts[r.id],i}listenForDeviceChange(e){if(null===e&&this._deviceChangeCallback)navigator.mediaDevices.removeEventListener("devicechange",this._deviceChangeCallback),this._deviceChangeCallback=null;else if(null!==e){let t=0,n=[],r=e=>e.map(e=>e.deviceId).sort().join(","),o=async()=>{let o=++t,i=await this.listDevices();o===t&&r(n)!==r(i)&&(n=i,e(i.slice()))};navigator.mediaDevices.addEventListener("devicechange",o),o(),this._deviceChangeCallback=o}return!0}async requestPermission(){let e=await navigator.permissions.query({name:"microphone"});if("denied"===e.state)window.alert("You must grant microphone access to use this feature.");else if("prompt"===e.state)try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop())}catch{window.alert("You must grant microphone access to use this feature.")}return!0}async listDevices(){if(!navigator.mediaDevices||!("enumerateDevices"in navigator.mediaDevices))throw new Error("Could not request user devices");await this.requestPermission();let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>"audioinput"===e.kind),t=e.findIndex(e=>"default"===e.deviceId),n=[];if(-1!==t){let r=e.splice(t,1)[0],o=e.findIndex(e=>e.groupId===r.groupId);-1!==o&&(r=e.splice(o,1)[0]),r.default=!0,n.push(r)}return n.concat(e)}async begin(e){if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!navigator.mediaDevices||!("getUserMedia"in navigator.mediaDevices))throw new Error("Could not request user media");try{let t={audio:!0};e&&(t.audio={deviceId:{exact:e}}),this.stream=await navigator.mediaDevices.getUserMedia(t)}catch{throw new Error("Could not start media stream")}let t=new AudioContext({sampleRate:this.sampleRate}),n=t.createMediaStreamSource(this.stream);try{await t.audioWorklet.addModule(this.scriptSrc)}catch(s){throw new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}let r=new AudioWorkletNode(t,"audio_processor");r.port.onmessage=e=>{let{event:t,id:n,data:r}=e.data;if("receipt"===t)this.eventReceipts[n]=r;else if("chunk"===t)if(this._chunkProcessorSize){let e=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:Pa.mergeBuffers(e.raw,r.raw),mono:Pa.mergeBuffers(e.mono,r.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(r)};let o=n.connect(r),i=t.createAnalyser();return i.fftSize=8192,i.smoothingTimeConstant=.1,o.connect(i),this.outputToSpeakers&&i.connect(t.destination),this.source=n,this.node=o,this.analyser=i,this.processor=r,!0}getFrequencies(e="frequency",t=-100,n=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return Na.getFrequencies(this.analyser,this.sampleRate,null,e,t,n)}async pause(){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!this.recording)throw new Error("Already paused: please call .record() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},t=8192){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(this.recording)throw new Error("Already recording: please call .pause() first");if("function"!=typeof e)throw new Error("chunkProcessor must be a function");return this._chunkProcessor=e,this._chunkProcessorSize=t,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");let t=await this._event("export");return(new Pa).pack(this.sampleRate,t.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");let e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.stream.getTracks().forEach(e=>e.stop()),this.log("Exporting ...");let t=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,(new Pa).pack(this.sampleRate,t.audio)}async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}};globalThis.WavRecorder=Ba;var za=new Blob(["\nclass StreamProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.hasStarted = false;\n this.hasInterrupted = false;\n this.outputBuffers = [];\n this.bufferLength = 128;\n this.write = { buffer: new Float32Array(this.bufferLength), trackId: null };\n this.writeOffset = 0;\n this.trackSampleOffsets = {};\n this.port.onmessage = (event) => {\n if (event.data) {\n const payload = event.data;\n if (payload.event === 'write') {\n const int16Array = payload.buffer;\n const float32Array = new Float32Array(int16Array.length);\n for (let i = 0; i < int16Array.length; i++) {\n float32Array[i] = int16Array[i] / 0x8000; // Convert Int16 to Float32\n }\n this.writeData(float32Array, payload.trackId);\n } else if (\n payload.event === 'offset' ||\n payload.event === 'interrupt'\n ) {\n const requestId = payload.requestId;\n const trackId = this.write.trackId;\n const offset = this.trackSampleOffsets[trackId] || 0;\n this.port.postMessage({\n event: 'offset',\n requestId,\n trackId,\n offset,\n });\n if (payload.event === 'interrupt') {\n this.hasInterrupted = true;\n }\n } else {\n throw new Error(`Unhandled event \"${payload.event}\"`);\n }\n }\n };\n }\n\n writeData(float32Array, trackId = null) {\n let { buffer } = this.write;\n let offset = this.writeOffset;\n for (let i = 0; i < float32Array.length; i++) {\n buffer[offset++] = float32Array[i];\n if (offset >= buffer.length) {\n this.outputBuffers.push(this.write);\n this.write = { buffer: new Float32Array(this.bufferLength), trackId };\n buffer = this.write.buffer;\n offset = 0;\n }\n }\n this.writeOffset = offset;\n return true;\n }\n\n process(inputs, outputs, parameters) {\n const output = outputs[0];\n const outputChannelData = output[0];\n const outputBuffers = this.outputBuffers;\n if (this.hasInterrupted) {\n this.port.postMessage({ event: 'stop' });\n return false;\n } else if (outputBuffers.length) {\n this.hasStarted = true;\n const { buffer, trackId } = outputBuffers.shift();\n for (let i = 0; i < outputChannelData.length; i++) {\n outputChannelData[i] = buffer[i] || 0;\n }\n if (trackId) {\n this.trackSampleOffsets[trackId] =\n this.trackSampleOffsets[trackId] || 0;\n this.trackSampleOffsets[trackId] += buffer.length;\n }\n return true;\n } else if (this.hasStarted) {\n this.port.postMessage({ event: 'stop' });\n return false;\n } else {\n return true;\n }\n }\n}\n\nregisterProcessor('stream_processor', StreamProcessor);\n"],{type:"application/javascript"}),Ua=URL.createObjectURL(za),$a=class{constructor({sampleRate:e=24e3,onStop:t}={}){this.scriptSrc=Ua,this.onStop=t,this.sampleRate=e,this.context=null,this.stream=null,this.analyser=null,this.trackSampleOffsets={},this.interruptedTrackIds={}}async connect(){this.context=new AudioContext({sampleRate:this.sampleRate}),"suspended"===this.context.state&&await this.context.resume();try{await this.context.audioWorklet.addModule(this.scriptSrc)}catch(Qy){throw new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}let e=this.context.createAnalyser();return e.fftSize=8192,e.smoothingTimeConstant=.1,this.analyser=e,!0}getFrequencies(e="frequency",t=-100,n=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return Na.getFrequencies(this.analyser,this.sampleRate,null,e,t,n)}_start(){let e=new AudioWorkletNode(this.context,"stream_processor");return e.connect(this.context.destination),e.port.onmessage=t=>{let{event:n}=t.data;if("stop"===n)this.onStop?.(),e.disconnect(),this.stream=null;else if("offset"===n){let{requestId:e,trackId:n,offset:r}=t.data,o=r/this.sampleRate;this.trackSampleOffsets[e]={trackId:n,offset:r,currentTime:o}}},this.analyser.disconnect(),e.connect(this.analyser),this.stream=e,!0}add16BitPCM(e,t="default"){if("string"!=typeof t)throw new Error("trackId must be a string");if(this.interruptedTrackIds[t])return;let n;if(this.stream||this._start(),e instanceof Int16Array)n=e;else{if(!(e instanceof ArrayBuffer))throw new Error("argument must be Int16Array or ArrayBuffer");n=new Int16Array(e)}return this.stream.port.postMessage({event:"write",buffer:n,trackId:t}),n}async getTrackSampleOffset(e=!1){if(!this.stream)return null;let t,n=crypto.randomUUID();for(this.stream.port.postMessage({event:e?"interrupt":"offset",requestId:n});!t;)t=this.trackSampleOffsets[n],await new Promise(e=>setTimeout(()=>e(),1));let{trackId:r}=t;return e&&r&&(this.interruptedTrackIds[r]=!0),t}async interrupt(){return this.getTrackSampleOffset(!0)}};globalThis.WavStreamPlayer=$a;var Va=Yi({key:"ThreadIdToResume",default:void 0}),qa=Yi({key:"ChatProfile",default:void 0}),Wa=Yi({key:"SessionId",default:us()}),Ha=Gi({key:"SessionIdSelector",get:({get:e})=>e(Wa),set:({set:e},t)=>e(Wa,t instanceof Hi?us():t)}),Ka=Yi({key:"Session",dangerouslyAllowMutability:!0,default:void 0}),Ya=Yi({key:"Actions",default:[]}),Ga=Yi({key:"Messages",dangerouslyAllowMutability:!0,default:[]}),Ja=Yi({key:"TokenCount",default:0}),Xa=Yi({key:"Loading",default:!1}),Qa=Yi({key:"AskUser",default:void 0}),Za=Yi({key:"WavRecorder",dangerouslyAllowMutability:!0,default:new Ba}),ec=Yi({key:"WavStreamPlayer",dangerouslyAllowMutability:!0,default:new $a}),tc=Yi({key:"AudioConnection",default:"off"}),nc=Yi({key:"isAiSpeaking",default:!1}),rc=Yi({key:"CallFn",default:void 0}),oc=Yi({key:"ChatSettings",default:[]}),ic=Gi({key:"ChatSettingsValue/Default",get:({get:e})=>e(oc).reduce((e,t)=>(e[t.id]=t.initial,e),{})}),sc=Yi({key:"ChatSettingsValue",default:ic}),ac=Yi({key:"DisplayElements",default:[]}),cc=Yi({key:"TasklistElements",default:[]}),uc=Yi({key:"FirstUserInteraction",default:void 0});Yi({key:"User",default:void 0}),Yi({key:"ChainlitConfig",default:void 0}),Yi({key:"AuthConfig",default:void 0}),Yi({key:"ThreadHistory",default:{threads:void 0,currentThreadId:void 0,timeGroupedThreads:void 0,pageInfo:void 0},effects:[({setSelf:e,onSet:t})=>{t((t,n)=>{let r=t?.timeGroupedThreads;t?.threads&&!rs.isEqual(t.threads,n?.timeGroupedThreads)&&(r=(e=>{let t={},n=new Date,r=new Date;r.setDate(n.getDate()-1);let o=new Date;o.setDate(n.getDate()-7);let i=new Date;return i.setDate(n.getDate()-30),e.forEach(e=>{let s,a=new Date(e.createdAt),c=a.toDateString()===n.toDateString(),u=a.toDateString()===r.toDateString();s=c?"Today":u?"Yesterday":a>=o?"Previous 7 days":a>=i?"Previous 30 days":a.toLocaleString("default",{month:"long",year:"numeric"}).split(" ").slice(0,1).join(" "),t[s]||(t[s]=[]),t[s].push(e)}),t})(t.threads)),e({...t,timeGroupedThreads:r})})}]});var lc=Yi({key:"SideView",default:void 0}),dc=Yi({key:"CurrentThreadId",default:void 0}),fc=(e,t)=>gc(e,t.id)?yc(e,t.id,t):"parentId"in t&&t.parentId?hc(e,t.parentId,t):"indent"in t&&t.indent&&t.indent>0?pc(e,t.indent,t):[...e,t],pc=(e,t,n,r=0)=>{let o=[...e];if(0===o.length)return[...o,n];{let e=o.length-1,i=o[e];return i.steps=i.steps||[],r+1===t?(i.steps=[...i.steps,n],o[e]={...i},o):(i.steps=pc(i.steps,t,n,r+1),o[e]={...i},o)}},hc=(e,t,n)=>{let r=[...e];for(let o=0;o{for(let n of e){if(rs.isEqual(n.id,t))return n;if(n.steps&&n.steps.length>0){let e=mc(n.steps,t);if(e)return e}}},gc=(e,t)=>void 0!==mc(e,t),yc=(e,t,n)=>{let r=[...e];for(let o=0;o{let n=[...e];for(let r=0;r{let i=[...e];for(let s=0;s{let s=new FormData;s.append("file",e),r.open("POST",this.buildEndpoint(`/project/file?session_id=${n}`),!0),r.upload.onprogress=function(e){if(e.lengthComputable){let n=e.loaded/e.total*100;t(n)}},r.onload=function(){if(200===r.status){let e=JSON.parse(r.responseText);o(e)}else i("Upload failed")},r.onerror=function(){i("Upload error")},r.send(s)});return{xhr:r,promise:o}}async callAction(e,t){return(await this.post("/project/action",{sessionId:t,action:e})).json()}async updateElement(e,t){return(await this.put("/project/element",{sessionId:t,element:e})).json()}async deleteElement(e,t){return(await this.delete("/project/element",{sessionId:t,element:e})).json()}getElementUrl(e,t){let n=`?session_id=${t}`;return this.buildEndpoint(`/project/file/${e}${n}`)}getLogoEndpoint(e){return this.buildEndpoint(`/logo?theme=${e}`)}getOAuthEndpoint(e){return this.buildEndpoint(`/auth/oauth/${e}`)}},wc=e.createContext(new kc("http://localhost:8000","webapp")),xc=()=>{let t=e.useContext(wc),n=Ji(Ka),r=Ji(Qa),o=Ji(Ha),i=Zi(oc),s=Zi(Ha),a=Zi(sc),c=Qi(uc),u=Qi(Xa),l=Qi(Ga),d=Qi(ac),f=Qi(cc),p=Qi(Ya),h=Qi(Ja),m=Qi(Va),g=Qi(lc),y=Qi(dc),v=e.useCallback(()=>{n?.socket.emit("clear_session"),n?.socket.disconnect(),m(void 0),s(),c(void 0),l([]),d([]),f([]),p([]),h(0),i(),a(),g(void 0),y(void 0)},[n]),_=e.useCallback((e,t=[])=>{e.id||(e.id=us()),e.createdAt||(e.createdAt=(new Date).toISOString()),l(t=>fc(t,e)),n?.socket.emit("client_message",{message:e,fileReferences:t})},[n?.socket]),b=e.useCallback(e=>{n?.socket.emit("edit_message",{message:e})},[n?.socket]),S=e.useCallback(e=>{n?.socket.emit("window_message",e)},[n?.socket]),k=e.useCallback(()=>{n?.socket.emit("audio_start")},[n?.socket]),w=e.useCallback((e,t,r,o)=>{n?.socket.emit("audio_chunk",{isStart:e,mimeType:t,elapsedTime:r,data:o})},[n?.socket]),x=e.useCallback(()=>{n?.socket.emit("audio_end")},[n?.socket]),E=e.useCallback(e=>{r&&(r.parentId&&(e.parentId=r.parentId),l(t=>fc(t,e)),r.callback(e))},[r]),T=e.useCallback(e=>{n?.socket.emit("chat_settings_change",e)},[n?.socket]),C=e.useCallback(()=>{l(e=>e.map(e=>(e.streaming=!1,e))),u(!1),n?.socket.emit("stop")},[n?.socket]);return{uploadFile:e.useCallback((e,n)=>t.uploadFile(e,n,o),[o]),clear:v,replyMessage:E,sendMessage:_,editMessage:b,windowMessage:S,startAudioStream:k,sendAudioChunk:w,endAudioStream:x,stopTask:C,setIdToResume:m,updateChatSettings:T}};const Ec="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Tc=globalThis,Cc="10.21.0";function Ic(){return Ac(Tc),Tc}function Ac(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Cc,t[Cc]=t[Cc]||{}}function Rc(e,t,n=Tc){const r=n.__SENTRY__=n.__SENTRY__||{},o=r[Cc]=r[Cc]||{};return o[e]||(o[e]=t())}const Mc=["debug","info","warn","error","log","assert","trace"],Oc={};function Dc(e){if(!("console"in Tc))return e();const t=Tc.console,n={},r=Object.keys(Oc);r.forEach(e=>{const r=Oc[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Lc(){return Pc().enabled}function Nc(e,...t){Ec&&Lc()&&Dc(()=>{Tc.console[e](`Sentry Logger [${e}]:`,...t)})}function Pc(){return Ec?Rc("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const jc={enable:function(){Pc().enabled=!0},disable:function(){Pc().enabled=!1},isEnabled:Lc,log:function(...e){Nc("log",...e)},warn:function(...e){Nc("warn",...e)},error:function(...e){Nc("error",...e)}},Fc="?",Bc=/\(error: (.*)\)/,zc=/captureMessage|captureException/;function Uc(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{const o=[],i=e.split("\n");for(let s=n;s1024&&(e=e.slice(0,1024));const n=Bc.test(e)?e.replace(Bc,"$1"):e;if(!n.match(/\S*Error: /)){for(const e of t){const t=e(n);if(t){o.push(t);break}}if(o.length>=50+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test($c(t).function||"")&&t.pop(),t.reverse(),zc.test($c(t).function||"")&&(t.pop(),zc.test($c(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||$c(t).filename,function:e.function||Fc}))}(o.slice(r))}}function $c(e){return e[e.length-1]||{}}const Vc="";function qc(e){try{return e&&"function"==typeof e&&e.name||Vc}catch{return Vc}}function Wc(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}const Hc={},Kc={};function Yc(e,t){Hc[e]=Hc[e]||[],Hc[e].push(t)}function Gc(e,t){if(!Kc[e]){Kc[e]=!0;try{t()}catch(n){Ec&&jc.error(`Error while instrumenting ${e}`,n)}}}function Jc(e,t){const n=e&&Hc[e];if(n)for(const o of n)try{o(t)}catch(r){Ec&&jc.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${qc(o)}\nError:`,r)}}let Xc=null;function Qc(e){const t="error";Yc(t,e),Gc(t,Zc)}function Zc(){Xc=Tc.onerror,Tc.onerror=function(e,t,n,r,o){return Jc("error",{column:r,error:o,line:n,msg:e,url:t}),!!Xc&&Xc.apply(this,arguments)},Tc.onerror.__SENTRY_INSTRUMENTED__=!0}let eu=null;function tu(e){const t="unhandledrejection";Yc(t,e),Gc(t,nu)}function nu(){eu=Tc.onunhandledrejection,Tc.onunhandledrejection=function(e){return Jc("unhandledrejection",e),!eu||eu.apply(this,arguments)},Tc.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const ru=Object.prototype.toString;function ou(e){switch(ru.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return hu(e,Error)}}function iu(e,t){return ru.call(e)===`[object ${t}]`}function su(e){return iu(e,"ErrorEvent")}function au(e){return iu(e,"DOMError")}function cu(e){return iu(e,"String")}function uu(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function lu(e){return null===e||uu(e)||"object"!=typeof e&&"function"!=typeof e}function du(e){return iu(e,"Object")}function fu(e){return"undefined"!=typeof Event&&hu(e,Event)}function pu(e){return Boolean(e?.then&&"function"==typeof e.then)}function hu(e,t){try{return e instanceof t}catch{return!1}}function mu(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function gu(e){return"undefined"!=typeof Request&&hu(e,Request)}const yu=Tc;function vu(e,t={}){if(!e)return"";try{let n=e;const r=5,o=[];let i=0,s=0;const a=" > ",c=a.length;let u;const l=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&i++1&&s+o.length*c+u.length>=d));)o.push(u),s+=u.length,n=n.parentNode;return o.reverse().join(a)}catch{return""}}function _u(e,t){const n=e,r=[];if(!n?.tagName)return"";if(yu.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const o=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(o?.length)o.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&cu(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}const i=["aria-label","type","name","title","alt"];for(const s of i){const e=n.getAttribute(s);e&&r.push(`[${s}="${e}"]`)}return r.join("")}function bu(){try{return yu.document.location.href}catch{return""}}function Su(e){if(!yu.HTMLElement)return null;let t=e;for(let n=0;n<5;n++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function ku(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function wu(e,t){if(!Array.isArray(e))return"";const n=[];for(let r=0;rxu(e,t,n))}function Tu(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const o=n(r);"function"==typeof o&&Iu(o,r);try{e[t]=o}catch{Ec&&jc.log(`Failed to replace method "${t}" in object`,e)}}function Cu(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Ec&&jc.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Iu(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Cu(e,"__sentry_original__",t)}catch{}}function Au(e){return e.__sentry_original__}function Ru(e){if(ou(e))return{message:e.message,name:e.name,stack:e.stack,...Ou(e)};if(fu(e)){const t={type:e.type,target:Mu(e.target),currentTarget:Mu(e.currentTarget),...Ou(e)};return"undefined"!=typeof CustomEvent&&hu(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Mu(e){try{return"undefined"!=typeof Element&&hu(e,Element)?vu(e):Object.prototype.toString.call(e)}catch{return""}}function Ou(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}let Du,Lu,Nu;function Pu(e=function(){const e=Tc;return e.crypto||e.msCrypto}()){try{if(e?.randomUUID)return e.randomUUID().replace(/-/g,"")}catch{}return Du||(Du="10000000100040008000100000000000"),Du.replace(/[018]/g,e=>(e^(16*Math.random()&15)>>e/4).toString(16))}function ju(e){return e.exception?.values?.[0]}function Fu(e){const{message:t,event_id:n}=e;if(t)return t;const r=ju(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"":n||""}function Bu(e,t,n){const r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function zu(e,t){const n=ju(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r?.data,...t.data};n.mechanism.data=e}}function Uu(e){if(function(e){try{return e.__sentry_captured__}catch{}}(e))return!0;try{Cu(e,"__sentry_captured__",!0)}catch{}return!1}function $u(){return Date.now()/1e3}function Vu(){return(Lu??(Lu=function(){const{performance:e}=Tc;if(!e?.now||!e.timeOrigin)return $u;const t=e.timeOrigin;return()=>(t+e.now())/1e3}()))()}function qu(){return Nu||(Nu=function(){const{performance:e}=Tc;if(!e?.now)return[void 0,"none"];const t=36e5,n=e.now(),r=Date.now(),o=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,i=o=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Hu(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&0===Object.keys(t).length)return e;const r={...e};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Hu(r[o],t[o],n-1));return r}function Ku(){return Pu()}function Yu(){return Pu().substring(16)}const Gu="_sentrySpan";function Ju(e,t){t?Cu(e,Gu,t):delete e[Gu]}function Xu(e){return e[Gu]}class Qu{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ku(),sampleRand:Math.random()}}clone(){const e=new Qu;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Ju(e,Xu(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Wu(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof Qu?t.getScopeData():du(t)?e:void 0,{tags:r,extra:o,user:i,contexts:s,level:a,fingerprint:c=[],propagationContext:u}=n||{};return this._tags={...this._tags,...r},this._extra={...this._extra,...o},this._contexts={...this._contexts,...s},i&&Object.keys(i).length&&(this._user=i),a&&(this._level=a),c.length&&(this._fingerprint=c),u&&(this._propagationContext=u),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,Ju(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ku(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:$u(),...e,message:e.message?ku(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Xu(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Hu(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t?.event_id||Pu();if(!this._client)return Ec&&jc.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||Pu();if(!this._client)return Ec&&jc.warn("No client configured on scope - will not capture message!"),r;const o=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureEvent(e,t){const n=t?.event_id||Pu();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Ec&&jc.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}class Zu{constructor(e,t){let n,r;n=e||new Qu,r=t||new Qu,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(r){throw this._popScope(),r}return pu(n)?n.then(e=>(this._popScope(),e),e=>{throw this._popScope(),e}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1||!this._stack.pop())}}function el(){const e=Ac(Ic());return e.stack=e.stack||new Zu(Rc("defaultCurrentScope",()=>new Qu),Rc("defaultIsolationScope",()=>new Qu))}function tl(e){return el().withScope(e)}function nl(e,t){const n=el();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function rl(e){return el().withScope(()=>e(el().getIsolationScope()))}function ol(e){const t=Ac(e);return t.acs?t.acs:{withIsolationScope:rl,withScope:tl,withSetScope:nl,withSetIsolationScope:(e,t)=>rl(t),getCurrentScope:()=>el().getScope(),getIsolationScope:()=>el().getIsolationScope()}}function il(){return ol(Ic()).getCurrentScope()}function sl(){return ol(Ic()).getIsolationScope()}function al(...e){const t=ol(Ic());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function cl(){return il().getClient()}function ul(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:o}=t,i={trace_id:n,span_id:o||Yu()};return r&&(i.parent_span_id=r),i}const ll="sentry.source",dl="sentry.sample_rate",fl="sentry.previous_trace_sample_rate",pl="sentry.op",hl="sentry.origin",ml="sentry.idle_span_finish_reason",gl="sentry.measurement_unit",yl="sentry.measurement_value",vl="sentry.custom_span_name",_l="sentry.profile_id",bl="sentry.exclusive_time",Sl="sentry.link.type";function kl(e,t){e.setAttribute("http.response.status_code",t);const n=function(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"unknown_error"}}(t);"unknown_error"!==n.message&&e.setStatus(n)}const wl="_sentryScope",xl="_sentryIsolationScope";function El(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function Tl(e){const t=e;return{scope:t[wl],isolationScope:El(t[xl])}}const Cl="sentry-",Il=/^sentry-/;function Al(e){const t=function(e){if(e&&(cu(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=Rl(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Rl(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.match(Il)&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}function Rl(e){return e.split(",").map(e=>{const t=e.indexOf("=");return-1===t?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const Ml=/^o(\d+)\./,Ol=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Dl(e,t=!1){const{host:n,path:r,pass:o,port:i,projectId:s,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r?`${r}/`:r}${s}`}function Ll(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Nl(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(Ml);return t?.[1]}(n)),r}function Pl(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}const jl=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Fl(e=Ku(),t=Yu(),n){let r="";return void 0!==n&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function Bl(e=Ku(),t=Yu(),n){return`00-${e}-${t}-${n?"01":"00"}`}let zl=!1;function Ul(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:o,parent_span_id:i,status:s,origin:a,links:c}=Hl(e);return{parent_span_id:i,span_id:t,trace_id:n,data:r,op:o,status:s,origin:a,links:c}}function $l(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),o=r?t:Hl(e).parent_span_id,i=Tl(e).scope;return{parent_span_id:o,span_id:r?i?.getPropagationContext().propagationSpanId||Yu():t,trace_id:n}}function Vl(e){return e&&e.length>0?e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:o})=>({span_id:e,trace_id:t,sampled:1===n,attributes:o,...r})):void 0}function ql(e){return"number"==typeof e?Wl(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Wl(e.getTime()):Vu()}function Wl(e){return e>9999999999?e/1e3:e}function Hl(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:o,name:i,endTime:s,status:a,links:c}=e;return{span_id:t,trace_id:n,data:r,description:i,parent_span_id:"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0,start_timestamp:ql(o),timestamp:ql(s)||void 0,status:Yl(a),op:r[pl],origin:r[hl],links:Vl(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Kl(e){const{traceFlags:t}=e.spanContext();return 1===t}function Yl(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}const Gl="_sentryChildSpans",Jl="_sentryRootSpan";function Xl(e,t){const n=e[Jl]||e;Cu(t,Jl,n),e[Gl]?e[Gl].add(t):Cu(e,Gl,new Set([t]))}function Ql(e){const t=new Set;return function e(n){if(!t.has(n)&&Kl(n)){t.add(n);const r=n[Gl]?Array.from(n[Gl]):[];for(const t of r)e(t)}}(e),Array.from(t)}function Zl(e){return e[Jl]||e}function ed(){const e=ol(Ic());return e.getActiveSpan?e.getActiveSpan():Xu(il())}function td(){zl||(Dc(()=>{}),zl=!0)}let nd=!1;function rd(e){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=e||cl()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}function od(e){jc.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function id(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(ad(n)){if(xu(e.description,n))return Ec&&od(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||xu(e.description,n.name),r=!n.op||e.op&&xu(e.op,n.op);if(t&&r)return Ec&&od(e),!0}return!1}function sd(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const o of e)o.parent_span_id===r&&(o.parent_span_id=n)}function ad(e){return"string"==typeof e||e instanceof RegExp}const cd="production",ud="_frozenDsc";function ld(e,t){Cu(e,ud,t)}function dd(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},o={environment:n.environment||cd,release:n.release,public_key:r,trace_id:e,org_id:Nl(t)};return t.emit("createDsc",o),o}function fd(e,t){const n=t.getPropagationContext();return n.dsc||dd(n.traceId,e)}function pd(e){const t=cl();if(!t)return{};const n=Zl(e),r=Hl(n),o=r.data,i=n.spanContext().traceState,s=i?.get("sentry.sample_rate")??o[dl]??o[fl];function a(e){return"number"!=typeof s&&"string"!=typeof s||(e.sample_rate=`${s}`),e}const c=n[ud];if(c)return a(c);const u=i?.get("sentry.dsc"),l=u&&Al(u);if(l)return a(l);const d=dd(e.spanContext().traceId,t),f=o[ll],p=r.description;return"url"!==f&&p&&(d.transaction=p),rd()&&(d.sampled=String(Kl(n)),d.sample_rand=i?.get("sentry.sample_rand")??Tl(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}class hd{constructor(e={}){this._traceId=e.traceId||Ku(),this._spanId=e.spanId||Yu()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:0}}end(e){}setAttribute(e,t){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}recordException(e,t){}}function md(e,t=100,n=1/0){try{return yd("",e,t,n)}catch(DE){return{ERROR:`**non-serializable** (${DE})`}}}function gd(e,t=3,n=102400){const r=md(e,t);return o=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(o))>n?gd(e,t-1,n):r;var o}function yd(e,t,n=1/0,r=1/0,o=function(){const e=new WeakSet;return[function(t){return!!e.has(t)||(e.add(t),!1)},function(t){e.delete(t)}]}()){const[i,s]=o;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const a=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(mu(t))return"[VueViewModel]";if(du(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${qc(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(DE){return`**non-serializable** (${DE})`}var n}(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;const c="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===c)return a.replace("object ","");if(i(t))return"[Circular ~]";const u=t;if(u&&"function"==typeof u.toJSON)try{return yd("",u.toJSON(),c-1,r,o)}catch{}const l=Array.isArray(t)?[]:{};let d=0;const f=Ru(t);for(const p in f){if(!Object.prototype.hasOwnProperty.call(f,p))continue;if(d>=r){l[p]="[MaxProperties ~]";break}const e=f[p];l[p]=yd(p,e,c-1,r,o),d++}return s(t),l}function vd(e,t=[]){return[e,t]}function _d(e,t){const[n,r]=e;return[n,[...r,t]]}function bd(e,t){const n=e[1];for(const r of n)if(t(r,r[0].type))return!0;return!1}function Sd(e){const t=Ac(Tc);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function kd(e){const[t,n]=e;let r=JSON.stringify(t);function o(e){"string"==typeof r?r="string"==typeof e?r+e:[Sd(r),e]:r.push("string"==typeof e?Sd(e):e)}for(const i of n){const[e,t]=i;if(o(`\n${JSON.stringify(e)}\n`),"string"==typeof t||t instanceof Uint8Array)o(t);else{let e;try{e=JSON.stringify(t)}catch{e=JSON.stringify(md(t))}o(e)}}return"string"==typeof r?r:function(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}(r)}function wd(e){return[{type:"span"},e]}function xd(e){const t="string"==typeof e.data?Sd(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Ed={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function Td(e){return Ed[e]}function Cd(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function Id(e,t,n,r){const o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Dl(r)},...o&&{trace:o}}}function Ad(e){if(!e||0===e.length)return;const t={};return e.forEach(e=>{const n=e.attributes||{},r=n[gl],o=n[yl];"string"==typeof r&&"number"==typeof o&&(t[e.name]={value:o,unit:r})}),t}class Rd{constructor(e={}){this._traceId=e.traceId||Ku(),this._spanId=e.spanId||Yu(),this._startTime=e.startTimestamp||Vu(),this._links=e.links,this._attributes={},this.setAttributes({[hl]:"manual",[pl]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,t){}spanContext(){const{_spanId:e,_traceId:t,_sampled:n}=this;return{spanId:e,traceId:t,traceFlags:n?1:0}}setAttribute(e,t){return void 0===t?delete this._attributes[e]:this._attributes[e]=t,this}setAttributes(e){return Object.keys(e).forEach(t=>this.setAttribute(t,e[t])),this}updateStartTime(e){this._startTime=ql(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(ll,"custom"),this}end(e){this._endTime||(this._endTime=ql(e),function(e){if(!Ec)return;const{description:t="< unknown name >",op:n="< unknown op >"}=Hl(e),{spanId:r}=e.spanContext(),o=`[Tracing] Finishing "${n}" ${Zl(e)===e?"root ":""}span "${t}" with ID ${r}`;jc.log(o)}(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[pl],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Yl(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[hl],profile_id:this._attributes[_l],exclusive_time:this._attributes[bl],measurements:Ad(this._events),is_segment:this._isStandaloneSpan&&Zl(this)===this||void 0,segment_id:this._isStandaloneSpan?Zl(this).spanContext().spanId:void 0,links:Vl(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,t,n){Ec&&jc.log("[Tracing] Adding an event to span:",e);const r=Md(t)?t:n||Vu(),o=Md(t)?{}:t||{},i={name:e,time:ql(r),attributes:o};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=cl();if(e&&e.emit("spanEnd",this),!this._isStandaloneSpan&&this!==Zl(this))return;if(this._isStandaloneSpan)return void(this._sampled?function(e){const t=cl();if(!t)return;const n=e[1];n&&0!==n.length?t.sendEnvelope(e):t.recordDroppedEvent("before_send","span")}(function(e,t){const n=pd(e[0]),r=t?.getDsn(),o=t?.getOptions().tunnel,i={sent_at:(new Date).toISOString(),...(s=n,!!s.trace_id&&!!s.public_key&&{trace:n}),...!!o&&r&&{dsn:Dl(r)}};var s;const{beforeSendSpan:a,ignoreSpans:c}=t?.getOptions()||{},u=c?.length?e.filter(e=>!id(Hl(e),c)):e,l=e.length-u.length;l&&t?.recordDroppedEvent("before_send","span",l);const d=a?e=>{const t=Hl(e);return a(t)||(td(),t)}:Hl,f=[];for(const p of u){const e=d(p);e&&f.push(wd(e))}return vd(i,f)}([this],e)):(Ec&&jc.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span")));const t=this._convertSpanToTransaction();t&&(Tl(this).scope||il()).captureEvent(t)}_convertSpanToTransaction(){if(!Od(Hl(this)))return;this._name||(Ec&&jc.warn("Transaction has no name, falling back to ``."),this._name="");const{scope:e,isolationScope:t}=Tl(this),n=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(!0!==this._sampled)return;const r=Ql(this).filter(e=>e!==this&&!function(e){return e instanceof Rd&&e.isStandaloneSpan()}(e)).map(e=>Hl(e)).filter(Od),o=this._attributes[ll];delete this._attributes[vl],r.forEach(e=>{delete e.data[vl]});const i={contexts:{trace:Ul(this)},spans:r.length>1e3?r.sort((e,t)=>e.start_timestamp-t.start_timestamp).slice(0,1e3):r,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:t,dynamicSamplingContext:pd(this)},request:n,...o&&{transaction_info:{source:o}}},s=Ad(this._events);return s&&Object.keys(s).length&&(Ec&&jc.log("[Measurements] Adding measurements to transaction event",JSON.stringify(s,void 0,2)),i.measurements=s),i}}function Md(e){return e&&"number"==typeof e||e instanceof Date||Array.isArray(e)}function Od(e){return!!(e.start_timestamp&&e.timestamp&&e.span_id&&e.trace_id)}const Dd="__SENTRY_SUPPRESS_TRACING__";function Ld(e,t){const n=Bd();if(n.startSpan)return n.startSpan(e,t);const r=Fd(e),{forceTransaction:o,parentSpan:i,scope:s}=e,a=s?.clone();return al(a,()=>{const n=void 0!==(s=i)?e=>Pd(s,e):e=>e();var s;return n(()=>{const n=il(),s=Ud(n,i),a=e.onlyIfParent&&!s?new hd:jd({parentSpan:s,spanArguments:r,forceTransaction:o,scope:n});return Ju(n,a),function(e,t,n=()=>{},r=()=>{}){let o;try{o=e()}catch(i){throw t(i),n(),i}return function(e,t,n,r){return pu(e)?e.then(e=>(n(),r(e),e),e=>{throw t(e),n(),e}):(n(),r(e),e)}(o,t,n,r)}(()=>t(a),()=>{const{status:e}=Hl(a);!a.isRecording()||e&&"ok"!==e||a.setStatus({code:2,message:"internal_error"})},()=>{a.end()})})})}function Nd(e){const t=Bd();if(t.startInactiveSpan)return t.startInactiveSpan(e);const n=Fd(e),{forceTransaction:r,parentSpan:o}=e;return(e.scope?t=>al(e.scope,t):void 0!==o?e=>Pd(o,e):e=>e())(()=>{const t=il(),i=Ud(t,o);return e.onlyIfParent&&!i?new hd:jd({parentSpan:i,spanArguments:n,forceTransaction:r,scope:t})})}function Pd(e,t){const n=Bd();return n.withActiveSpan?n.withActiveSpan(e,t):al(n=>(Ju(n,e||void 0),t(n)))}function jd({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){if(!rd()){const r=new hd;return!n&&e||ld(r,{sampled:"false",sample_rate:"0",transaction:t.name,...pd(r)}),r}const o=sl();let i;if(e&&!n)i=function(e,t,n){const{spanId:r,traceId:o}=e.spanContext(),i=!t.getScopeData().sdkProcessingMetadata[Dd]&&Kl(e),s=i?new Rd({...n,parentSpanId:r,traceId:o,sampled:i}):new hd({traceId:o});Xl(e,s);const a=cl();return a&&(a.emit("spanStart",s),n.endTimestamp&&a.emit("spanEnd",s)),s}(e,r,t),Xl(e,i);else if(e){const n=pd(e),{traceId:o,spanId:s}=e.spanContext(),a=Kl(e);i=zd({traceId:o,parentSpanId:s,...t},r,a),ld(i,n)}else{const{traceId:e,dsc:n,parentSpanId:s,sampled:a}={...o.getPropagationContext(),...r.getPropagationContext()};i=zd({traceId:e,parentSpanId:s,...t},r,a),n&&ld(i,n)}return function(e){if(!Ec)return;const{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Hl(e),{spanId:o}=e.spanContext(),i=Kl(e),s=Zl(e),a=s===e,c=`[Tracing] Starting ${i?"sampled":"unsampled"} ${a?"root ":""}span`,u=[`op: ${n}`,`name: ${t}`,`ID: ${o}`];if(r&&u.push(`parent ID: ${r}`),!a){const{op:e,description:t}=Hl(s);u.push(`root ID: ${s.spanContext().spanId}`),e&&u.push(`root op: ${e}`),t&&u.push(`root description: ${t}`)}jc.log(`${c}\n ${u.join("\n ")}`)}(i),function(e,t,n){e&&(Cu(e,xl,function(e){try{const t=Tc.WeakRef;if("function"==typeof t)return new t(e)}catch{}return e}(n)),Cu(e,wl,t))}(i,r,o),i}function Fd(e){const t={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){const n={...t};return n.startTimestamp=ql(e.startTime),delete n.startTime,n}return t}function Bd(){return ol(Ic())}function zd(e,t,n){const r=cl(),o=r?.getOptions()||{},{name:i=""}=e,s={spanAttributes:{...e.attributes},spanName:i,parentSampled:n};r?.emit("beforeSampling",s,{decision:!1});const a=s.parentSampled??n,c=s.spanAttributes,u=t.getPropagationContext(),[l,d,f]=t.getScopeData().sdkProcessingMetadata[Dd]?[!1]:function(e,t,n){if(!rd(e))return[!1];let r,o;"function"==typeof e.tracesSampler?(o=e.tracesSampler({...t,inheritOrSampleWith:e=>"number"==typeof t.parentSampleRate?t.parentSampleRate:"boolean"==typeof t.parentSampled?Number(t.parentSampled):e}),r=!0):void 0!==t.parentSampled?o=t.parentSampled:void 0!==e.tracesSampleRate&&(o=e.tracesSampleRate,r=!0);const i=Pl(o);if(void 0===i)return Ec&&jc.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!i)return Ec&&jc.log("[Tracing] Discarding transaction because "+("function"==typeof e.tracesSampler?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0")),[!1,i,r];const s=n{!o&&0===n.size&&s&&(i="idleTimeout",g.end(e))},c)}function _(e){r=setTimeout(()=>{!o&&s&&(i="heartbeatFailed",g.end(e))},l)}function b(e){o=!0,n.clear(),a.forEach(e=>e()),Ju(h,m);const t=Hl(g),{start_timestamp:r}=t;if(!r)return;t.data[ml]||g.setAttribute(ml,i),jc.log(`[Tracing] Idle span "${t.op}" finished`);const s=Ql(g).filter(e=>e!==g);let l=0;s.forEach(t=>{t.isRecording()&&(t.setStatus({code:2,message:"cancelled"}),t.end(e),Ec&&jc.log("[Tracing] Cancelling span since span ended early",JSON.stringify(t,void 0,2)));const n=Hl(t),{timestamp:r=0,start_timestamp:o=0}=n,i=o<=e,s=r-o<=(u+c)/1e3;if(Ec){const e=JSON.stringify(t,void 0,2);i?s||jc.log("[Tracing] Discarding span since it finished after idle span final timeout",e):jc.log("[Tracing] Discarding span since it happened after idle span was finished",e)}s&&i||(function(e,t){e[Gl]&&e[Gl].delete(t)}(g,t),l++)}),l>0&&g.setAttribute("sentry.idle_span_discarded_spans",l)}return g.end=new Proxy(g.end,{apply(e,t,n){if(d&&d(g),t instanceof hd)return;const[r,...o]=n,i=ql(r||Vu()),s=Ql(g).filter(e=>e!==g),a=Hl(g);if(!s.length||!f)return b(i),Reflect.apply(e,t,[i,...o]);const c=p.getOptions().ignoreSpans,l=s?.reduce((e,t)=>{const n=Hl(t);return n.timestamp?c&&id(n,c)?e:e?Math.max(e,n.timestamp):n.timestamp:e},void 0),h=a.start_timestamp,m=Math.min(h?h+u/1e3:1/0,Math.max(h||-1/0,Math.min(i,l||1/0)));return b(m),Reflect.apply(e,t,[m,...o])}}),a.push(p.on("spanStart",e=>{var t;o||e===g||Hl(e).timestamp||e instanceof Rd&&e.isStandaloneSpan()||Ql(g).includes(e)&&(t=e.spanContext().spanId,y(),n.set(t,!0),_(Vu()+l/1e3))})),a.push(p.on("spanEnd",e=>{var t;o||(t=e.spanContext().spanId,n.has(t)&&n.delete(t),0===n.size&&v(Vu()+c/1e3))})),a.push(p.on("idleSpanEnableAutoFinish",e=>{e===g&&(s=!0,v(),n.size&&_())})),t.disableAutoFinish||v(),setTimeout(()=>{o||(g.setStatus({code:2,message:"deadline_exceeded"}),i="finalTimeout",g.end())},u),g}function qd(e){return new Hd(t=>{t(e)})}function Wd(e){return new Hd((t,n)=>{n(e)})}class Hd{constructor(e){this._state=0,this._handlers=[],this._runExecutor(e)}then(e,t){return new Hd((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(o){r(o)}else n(t)},e=>{if(t)try{n(t(e))}catch(o){r(o)}else r(e)}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(e){return new Hd((t,n)=>{let r,o;return this.then(t=>{o=!1,r=t,e&&e()},t=>{o=!0,r=t,e&&e()}).then(()=>{o?n(r):t(r)})})}_executeHandlers(){if(0===this._state)return;const e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(1===this._state&&e[1](this._value),2===this._state&&e[2](this._value),e[0]=!0)})}_runExecutor(e){const t=(e,t)=>{0===this._state&&(pu(t)?t.then(n,r):(this._state=e,this._value=t,this._executeHandlers()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(o){r(o)}}}function Kd(e,t,n,r=0){try{const o=Yd(t,n,e,r);return pu(o)?o:qd(o)}catch(o){return Wd(o)}}function Yd(e,t,n,r){const o=n[r];if(!e||!o)return e;const i=o({...e},t);return Ec&&null===i&&jc.log(`Event processor "${o.id||"?"}" dropped event`),pu(i)?i.then(e=>Yd(e,t,n,r+1)):Yd(i,t,n,r+1)}function Gd(e,t){const{extra:n,tags:r,user:o,contexts:i,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:d,propagationContext:f,transactionName:p,span:h}=t;Jd(e,"extra",n),Jd(e,"tags",r),Jd(e,"user",o),Jd(e,"contexts",i),e.sdkProcessingMetadata=Hu(e.sdkProcessingMetadata,a,2),s&&(e.level=s),p&&(e.transactionName=p),h&&(e.span=h),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),l.length&&(e.eventProcessors=[...e.eventProcessors,...l]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...f}}function Jd(e,t,n){e[t]=Hu(e[t],n,1)}let Xd,Qd,Zd,ef;function tf(e,t,n,r,o,i){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Pu(),timestamp:t.timestamp||$u()},u=n.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:n,release:r,dist:o,maxValueLength:i=250}=t;e.environment=e.environment||n||cd,!e.release&&r&&(e.release=r),!e.dist&&o&&(e.dist=o);const s=e.request;s?.url&&(s.url=ku(s.url,i))}(c,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(c,u),o&&o.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=Tc._sentryDebugIds,n=Tc._debugIds;if(!t&&!n)return{};const r=t?Object.keys(t):[],o=n?Object.keys(n):[];if(ef&&r.length===Qd&&o.length===Zd)return ef;Qd=r.length,Zd=o.length,ef={},Xd||(Xd={});const i=(t,n)=>{for(const r of t){const t=n[r],o=Xd?.[r];if(o&&ef&&t)ef[o[0]]=t,Xd&&(Xd[r]=[o[0],t]);else if(t){const n=e(r);for(let e=n.length-1;e>=0;e--){const o=n[e],i=o?.filename;if(i&&ef&&Xd){ef[i]=t,Xd[r]=[i,t];break}}}}};return t&&i(r,t),n&&i(o,n),ef}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}(c,e.stackParser);const l=function(e,t){if(!t)return e;const n=e?e.clone():new Qu;return n.update(t),n}(r,n.captureContext);n.mechanism&&zu(c,n.mechanism);const d=o?o.getEventProcessors():[],f=Rc("globalScope",()=>new Qu).getScopeData();i&&Gd(f,i.getScopeData()),l&&Gd(f,l.getScopeData());const p=[...n.attachments||[],...f.attachments];return p.length&&(n.attachments=p),function(e,t){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=t;!function(e,t){const{extra:n,tags:r,user:o,contexts:i,level:s,transactionName:a}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(o).length&&(e.user={...o,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),s&&(e.level=s),a&&"transaction"!==e.type&&(e.transaction=a)}(e,t),r&&function(e,t){e.contexts={trace:$l(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:pd(t),...e.sdkProcessingMetadata};const n=Hl(Zl(t)).description;n&&!e.transaction&&"transaction"===e.type&&(e.transaction=n)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,o),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,i)}(c,f),Kd([...d,...f.eventProcessors],c,n).then(e=>(e&&function(e){const t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})})}(e),"number"==typeof s&&s>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:md(e.data,t,n)}}))},...e.user&&{user:md(e.user,t,n)},...e.contexts&&{contexts:md(e.contexts,t,n)},...e.extra&&{extra:md(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=md(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:md(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=md(e.contexts.flags,3,n)),r}(e,s,a):e))}const nf=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function rf(e,t){return il().captureException(e,function(e){if(e)return function(e){return e instanceof Qu||"function"==typeof e}(e)||function(e){return Object.keys(e).some(e=>nf.includes(e))}(e)?{captureContext:e}:e}(t))}function of(e,t){return il().captureEvent(e,t)}function sf(e,t){sl().setContext(e,t)}function af(e){const t=sl(),n=il(),{userAgent:r}=Tc.navigator||{},o=function(e){const t=Vu(),n={sid:Pu(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(n)};return e&&Wu(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),i=t.getSession();return"ok"===i?.status&&Wu(i,{status:"exited"}),cf(),t.setSession(o),o}function cf(){const e=sl(),t=il().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),Wu(e,t)}(t),uf(),e.setSession()}function uf(){const e=sl(),t=cl(),n=e.getSession();n&&t&&t.captureSession(n)}function lf(e=!1){e?cf():uf()}const df=[];function ff(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach(e=>{e.isDefaultInstance=!0}),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return function(e){const t={};return e.forEach(e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}(r)}function pf(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function hf(e,t,n){if(n[t.name])Ec&&jc.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===df.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),df.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,r)=>n(t,r,e))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}Ec&&jc.log(`Integration installed: ${t.name}`)}}function mf(e,t){const n=t??function(e){return gf().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=Dl(r)),vd(o,[(i=e,[{type:"log",item_count:i.length,content_type:"application/vnd.sentry.items.log+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());gf().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function gf(){return Rc("clientToLogBufferMap",()=>new WeakMap)}function yf(e,t){const n=t??function(e){return vf().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=Dl(r)),vd(o,[(i=e,[{type:"trace_metric",item_count:i.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());vf().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function vf(){return Rc("clientToMetricBufferMap",()=>new WeakMap)}function _f(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}const bf="Not capturing exception because it's already been captured.",Sf="Discarded session because of missing or non-string release",kf=Symbol.for("SentryInternalError"),wf=Symbol.for("SentryDoNotSendEventError");function xf(e){return{message:e,[kf]:!0}}function Ef(e){return{message:e,[wf]:!0}}function Tf(e){return!!e&&"object"==typeof e&&kf in e}function Cf(e){return!!e&&"object"==typeof e&&wf in e}function If(e,t,n,r,o){let i,s=0;e.on(n,()=>{s=0,clearTimeout(i)}),e.on(t,t=>{s+=r(t),s>=8e5?o(e):(clearTimeout(i),i=setTimeout(()=>{o(e)},5e3))}),e.on("flush",()=>{o(e)})}class Af{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=function(e){const t="string"==typeof e?function(e){const t=Ol.exec(e);if(!t)return void Dc(()=>{});const[n,r,o="",i="",s="",a=""]=t.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const e=u.match(/^\d+/);e&&(u=e[0])}return Ll({host:i,pass:o,path:c,projectId:u,port:s,protocol:n,publicKey:r})}(e):Ll(e);if(t&&function(e){if(!Ec)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(jc.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(jc.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(jc.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(jc.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Ec&&jc.warn("No DSN provided, client will not send events."),this._dsn){const o=(t=this._dsn,n=e.tunnel,r=e._metadata?e._metadata.sdk:void 0,n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${function(e,t){const n={sentry_version:"7"};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(t,r)}`);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:o})}var t,n,r;this._options.enableLogs&&If(this,"afterCaptureLog","flushLogs",Df,mf),this._options._experiments?.enableMetrics&&If(this,"afterCaptureMetric","flushMetrics",Of,yf)}captureException(e,t,n){const r=Pu();if(Uu(e))return Ec&&jc.log(bf),r;const o={event_id:r,...t};return this._process(this.eventFromException(e,o).then(e=>this._captureEvent(e,o,n))),o.event_id}captureMessage(e,t,n,r){const o={event_id:Pu(),...n},i=uu(e)?e:String(e),s=lu(e)?this.eventFromMessage(i,t,o):this.eventFromException(e,o);return this._process(s.then(e=>this._captureEvent(e,o,r))),o.event_id}captureEvent(e,t,n){const r=Pu();if(t?.originalException&&Uu(t.originalException))return Ec&&jc.log(bf),r;const o={event_id:r,...t},i=e.sdkProcessingMetadata||{},s=i.capturedSpanScope,a=i.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,s||n,a)),o.event_id}captureSession(e){this.sendSession(e),Wu(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){const t=this._transport;if(!t)return!0;this.emit("flush");const n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];hf(this,e,this._integrations),t||pf(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const o=Cd(n),i=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const s=Id(e,o,r,t);return delete e.sdkProcessingMetadata,vd(s,[[{type:i},e]])}(e,this._dsn,this._options._metadata,this._options.tunnel);for(const r of t.attachments||[])n=_d(n,xd(r));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=cd}=this._options;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Ec&&jc.warn(Sf));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Ec&&jc.warn(Sf));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const o=Cd(n);return vd({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&t&&{dsn:Dl(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){const r=`${e}:${t}`;Ec&&jc.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){const n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(t){return Ec&&jc.error("Error while sending envelope:",t),{}}return Ec&&jc.error("Transport disabled"),{}}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach(t=>{t&&hf(e,t,n)}),n}(this,e),pf(this,e)}_updateSessionFromEvent(e,t){let n="fatal"===t.level,r=!1;const o=t.exception?.values;if(o){r=!0;for(const e of o){const t=e.mechanism;if(!1===t?.handled){n=!0;break}}}const i="ok"===e.status;(i&&0===e.errors||i&&n)&&(Wu(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||tsetTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r){const o=this.getOptions(),i=Object.keys(this._integrations);return!t.integrations&&i?.length&&(t.integrations=i),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),tf(o,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:ul(n),...e.contexts};const r=fd(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}_captureEvent(e,t={},n=il(),r=sl()){return Ec&&Rf(e)&&jc.log(`Captured error event \`${_f(e)[0]||""}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{Ec&&(Cf(e)?jc.log(e.message):Tf(e)?jc.warn(e.message):jc.warn(e))})}_processEvent(e,t,n,r){const o=this.getOptions(),{sampleRate:i}=o,s=Mf(e),a=Rf(e),c=e.type||"error",u=`before send for type \`${c}\``,l=void 0===i?void 0:Pl(i);if(a&&"number"==typeof l&&Math.random()>l)return this.recordDroppedEvent("sample_rate","error"),Wd(Ef(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));const d="replay_event"===c?"replay":c;return this._prepareEvent(e,t,n,r).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",d),Ef("An event processor returned `null`, will not send event.");if(t.data&&!0===t.data.__sentry__)return e;const n=function(e,t,n,r){const{beforeSend:o,beforeSendTransaction:i,beforeSendSpan:s,ignoreSpans:a}=t;let c=n;if(Rf(c)&&o)return o(c,r);if(Mf(c)){if(s||a){const t=function(e){const{trace_id:t,parent_span_id:n,span_id:r,status:o,origin:i,data:s,op:a}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:s?.[_l],exclusive_time:s?.[bl],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&id(t,a))return null;if(s){const e=s(t);e?c=Hu(n,{type:"transaction",timestamp:(u=e).timestamp,start_timestamp:u.start_timestamp,transaction:u.description,contexts:{trace:{trace_id:u.trace_id,span_id:u.span_id,parent_span_id:u.parent_span_id,op:u.op,status:u.status,origin:u.origin,data:{...u.data,...u.profile_id&&{[_l]:u.profile_id},...u.exclusive_time&&{[bl]:u.exclusive_time}}}},measurements:u.measurements}):td()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&id(e,a))sd(n,e);else if(s){const n=s(e);n?t.push(n):(td(),t.push(e))}else t.push(e);const r=c.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),c.spans=t}}if(i){if(c.spans){const e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return i(c,r)}}var u;return c}(this,o,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(pu(e))return e.then(e=>{if(!du(e)&&null!==e)throw xf(n);return e},e=>{throw xf(`${t} rejected with ${e}`)});if(!du(e)&&null!==e)throw xf(n);return e}(n,u)}).then(o=>{if(null===o){if(this.recordDroppedEvent("before_send",d),s){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw Ef(`${u} returned \`null\`, will not send event.`)}const i=n.getSession()||r.getSession();if(a&&i&&this._updateSessionFromEvent(i,o),s){const e=(o.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(o.spans?o.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=o.transaction_info;if(s&&c&&o.transaction!==e.transaction){const e="custom";o.transaction_info={...c,source:e}}return this.sendEvent(o,t),o}).then(null,e=>{if(Cf(e)||Tf(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:e}),xf(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}_process(e){this._numProcessing++,e.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}_flushOutcomes(){Ec&&jc.log("Flushing outcomes...");const e=this._clearOutcomes();if(0===e.length)return void(Ec&&jc.log("No outcomes to send"));if(!this._dsn)return void(Ec&&jc.log("No dsn provided, will not send outcomes"));Ec&&jc.log("Sending outcomes:",e);const t=(n=e,vd((r=this._options.tunnel&&Dl(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:$u(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Rf(e){return void 0===e.type}function Mf(e){return"transaction"===e.type}function Of(e){let t=0;return e.name&&(t+=2*e.name.length),"string"==typeof e.value?t+=2*e.value.length:t+=8,t+Lf(e.attributes)}function Df(e){let t=0;return e.message&&(t+=2*e.message.length),t+Lf(e.attributes)}function Lf(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Nf(e[0]):lu(e)?t+=Nf(e):t+=100}),t}function Nf(e){return"string"==typeof e?2*e.length:"number"==typeof e?8:"boolean"==typeof e?4:0}const Pf=Symbol.for("SentryBufferFullError");function jf(e,t,n=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>n}function Ff(e,{statusCode:t,headers:n},r=Date.now()){const o={...e},i=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(i)for(const a of i.trim().split(",")){const[e,t,,,n]=a.split(":",5),i=parseInt(e,10),s=1e3*(isNaN(i)?60:i);if(t)for(const a of t.split(";"))"metric_bucket"===a&&n&&!n.split(";").includes("custom")||(o[a]=r+s);else o.all=r+s}else s?o.all=r+function(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(s,r):429===t&&(o.all=r+6e4);return o}function Bf(e){return"isRelative"in e}function zf(e,t){const n=e.indexOf("://")<=0&&0!==e.indexOf("//"),r=n?"thismessage:/":void 0;try{if("canParse"in URL&&!URL.canParse(e,r))return;const t=new URL(e,r);return n?{isRelative:n,pathname:t.pathname,search:t.search,hash:t.hash}:t}catch{}}function Uf(e){if(Bf(e))return e.pathname;const t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function $f(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function Vf(e){return"/"===e[e.length-1]?e.slice(0,-1):e}function qf(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}function Wf(e,t,n=[t],r="npm"){const o=e._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${t}`,packages:n.map(e=>({name:`${r}:@sentry/${e}`,version:Cc})),version:Cc}),e._metadata=o}function Hf(e={}){const t=e.client||cl();if(!function(){const e=cl();return!1!==e?.getOptions().enabled&&!!e?.getTransport()}()||!t)return{};const n=ol(Ic());if(n.getTraceData)return n.getTraceData(e);const r=e.scope||il(),o=e.span||ed(),i=o?function(e){const{traceId:t,spanId:n}=e.spanContext();return Fl(t,n,Kl(e))}(o):function(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Fl(t,r,n)}(r),s=function(e){if(e)return function(e){if(0!==Object.keys(e).length)return Object.entries(e).reduce((e,[t,n],r)=>{const o=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`,i=0===r?o:`${e},${o}`;return i.length>8192?(Ec&&jc.warn(`Not adding key: ${t} with val: ${n} to baggage header due to exceeding baggage size limits.`),e):i},"")}(Object.entries(e).reduce((e,[t,n])=>(n&&(e[`${Cl}${t}`]=n),e),{}))}(o?pd(o):fd(t,r));if(!jl.test(i))return jc.warn("Invalid sentry-trace data. Cannot generate trace data"),{};const a={"sentry-trace":i,baggage:s};if(e.propagateTraceparent){const e=o?function(e){const{traceId:t,spanId:n}=e.spanContext();return Bl(t,n,Kl(e))}(o):function(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Bl(t,r,n)}(r);e&&(a.traceparent=e)}return a}const Kf=100;function Yf(e,t){const n=cl(),r=sl();if(!n)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:i=Kf}=n.getOptions();if(i<=0)return;const s={timestamp:$u(),...e},a=o?Dc(()=>o(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,i))}let Gf;const Jf=new WeakMap,Xf=()=>({name:"FunctionToString",setupOnce(){Gf=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Au(this),n=Jf.has(cl())&&void 0!==t?t:this;return Gf.apply(n,e)}}catch{}},setup(e){Jf.set(e,!0)}}),Qf=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Zf=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=tp(e,r)},processEvent(n,r,o){if(!t){const n=o.getOptions();t=tp(e,n)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1;const n=e.transaction;return!!n&&Eu(n,t)}(e,t.ignoreTransactions))return Ec&&jc.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Fu(e)}`),!0}else{if(function(e,t){return!!t?.length&&_f(e).some(e=>Eu(e,t))}(e,t.ignoreErrors))return Ec&&jc.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Fu(e)}`),!0;if(function(e){return!!e.exception?.values?.length&&(!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&"Error"!==e.type||e.value))}(e))return Ec&&jc.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Fu(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=np(e);return!!n&&Eu(n,t)}(e,t.denyUrls))return Ec&&jc.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Fu(e)}.\nUrl: ${np(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=np(e);return!n||Eu(n,t)}(e,t.allowUrls))return Ec&&jc.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Fu(e)}.\nUrl: ${np(e)}`),!0}return!1}(n,t)?null:n}}},ep=(e={})=>({...Zf(e),name:"InboundFilters"});function tp(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Qf],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function np(e){try{const t=[...e.exception?.values??[]].reverse().find(e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length),n=t?.stacktrace?.frames;return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&""!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return Ec&&jc.error(`Cannot extract url for event ${Fu(e)}`),null}}function rp(e,t,n,r,o,i){if(!o.exception?.values||!i||!hu(i.originalException,Error))return;const s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=op(e,t,r,i.originalException,n,o.exception.values,s,0))}function op(e,t,n,r,o,i,s,a){if(i.length>=n+1)return i;let c=[...i];if(hu(r[o],Error)){ip(s,a);const i=e(t,r[o]),u=c.length;sp(i,o,u,a),c=op(e,t,n,r[o],o,[i,...c],i,u)}return Array.isArray(r.errors)&&r.errors.forEach((r,i)=>{if(hu(r,Error)){ip(s,a);const u=e(t,r),l=c.length;sp(u,`errors[${i}]`,l,a),c=op(e,t,n,r,o,[u,...c],u,l)}}),c}function ip(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function sp(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function ap(){"console"in Tc&&Mc.forEach(function(e){e in Tc.console&&Tu(Tc.console,e,function(t){return Oc[e]=t,function(...t){Jc("console",{args:t,level:e});const n=Oc[e];n?.apply(Tc.console,t)}})})}function cp(e){return"warn"===e?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const up=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const n=e.message,r=t.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!dp(e,t)&&!!lp(e,t))))}(e,t)||!!function(e,t){const n=fp(t),r=fp(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!dp(e,t)&&!!lp(e,t)))}(e,t))}(t,e))return Ec&&jc.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function lp(e,t){let n=Wc(e),r=Wc(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let o=0;oe.trim().startsWith(Cl))}function hp(e,t,n,r){const o={url:e,type:"fetch","http.method":n,[hl]:r,[pl]:"http.client"};return t&&(Bf(t)||(o["http.url"]=t.href,o["server.address"]=t.host),t.search&&(o["http.query"]=t.search),t.hash&&(o["http.fragment"]=t.hash)),o}function mp(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const gp=Tc;function yp(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function vp(e,t){const n="fetch";Yc(n,e),Gc(n,()=>_p(void 0,t))}function _p(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in gp))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(yp(gp.fetch))return!0;let e=!1;const t=gp.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=yp(n.contentWindow.fetch)),t.head.removeChild(n)}catch(DE){Ec&&jc.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",DE)}return e}()||Tu(Tc,"fetch",function(t){return function(...n){const r=new Error,{method:o,url:i}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:kp(t),method:Sp(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:kp(t),method:Sp(t,"method")?String(t.method).toUpperCase():"GET"}}(n),s={args:n,fetchData:{method:o,url:i},startTimestamp:1e3*Vu(),virtualError:r,headers:wp(n)};return e||Jc("fetch",{...s}),t.apply(Tc,n).then(async t=>(e?e(t):Jc("fetch",{...s,endTimestamp:1e3*Vu(),response:t}),t),e=>{if(Jc("fetch",{...s,endTimestamp:1e3*Vu(),error:e}),ou(e)&&void 0===e.stack&&(e.stack=r.stack,Cu(e,"framesToPop",1)),e instanceof TypeError&&("Failed to fetch"===e.message||"Load failed"===e.message||"NetworkError when attempting to fetch resource."===e.message))try{const t=new URL(s.fetchData.url);e.message=`${e.message} (${t.host})`}catch{}throw e})}})}function bp(e){let t;try{t=e.clone()}catch{return}!async function(e,t){if(e?.body){const n=e.body,r=n.getReader(),o=setTimeout(()=>{n.cancel().then(null,()=>{})},9e4);let i=!0;for(;i;){let e;try{e=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:o}=await r.read();clearTimeout(e),o&&(t(),i=!1)}catch{i=!1}finally{clearTimeout(e)}}clearTimeout(o),r.releaseLock(),n.cancel().then(null,()=>{})}}(t,()=>{Jc("fetch-body-resolved",{endTimestamp:1e3*Vu(),response:e})})}function Sp(e,t){return!!e&&"object"==typeof e&&!!e[t]}function kp(e){return"string"==typeof e?e:e?Sp(e,"url")?e.url:e.toString?e.toString():"":""}function wp(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if(gu(t))return new Headers(t.headers)}catch{}}function xp(){return"undefined"!=typeof window&&(!(("undefined"==typeof __SENTRY_BROWSER_BUNDLE__||!__SENTRY_BROWSER_BUNDLE__)&&"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0))||function(){const e=Tc.process;return"renderer"===e?.type}())}const Ep=Tc;let Tp=0;function Cp(){return Tp>0}function Ip(e,t={}){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return"function"==typeof t?t:e;if(Au(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>Ip(e,t));return e.apply(this,r)}catch(r){throw Tp++,setTimeout(()=>{Tp--}),al(e=>{e.addEventProcessor(e=>(t.mechanism&&(Bu(e,void 0),zu(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),rf(r)}),r}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Iu(n,e),Cu(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function Ap(){const e=bu(),{referrer:t}=Ep.document||{},{userAgent:n}=Ep.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}function Rp(e,t){const n=Op(e,t),r={type:Np(t),value:Pp(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Mp(e,t){return{exception:{values:[Rp(e,t)]}}}function Op(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&Dp.test(e.message)?1:0}(t),o=function(e){return"number"==typeof e.framesToPop?e.framesToPop:0}(t);try{return e(n,r,o)}catch{}return[]}const Dp=/Minified React error #\d+;/i;function Lp(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function Np(e){const t=e?.name;return!t&&Lp(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function Pp(e){const t=e?.message;return Lp(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function jp(e,t,n,r,o){let i;if(su(t)&&t.error)return Mp(e,t.error);if(au(t)||iu(t,"DOMException")){const o=t;if("stack"in t)i=Mp(e,t);else{const t=o.name||(au(o)?"DOMError":"DOMException"),s=o.message?`${t}: ${o.message}`:t;i=Fp(e,s,n,r),Bu(i,s)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}return ou(t)?Mp(e,t):du(t)||fu(t)?(i=function(e,t,n,r){const o=cl(),i=o?.getOptions().normalizeDepth,s=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}(t),a={__serialized__:gd(t,i)};if(s)return{exception:{values:[Rp(e,s)]},extra:a};const c={exception:{values:[{type:fu(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Bp(t,{isUnhandledRejection:r})}]},extra:a};if(n){const t=Op(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,o),zu(i,{synthetic:!0}),i):(i=Fp(e,t,n,r),Bu(i,`${t}`),zu(i,{synthetic:!0}),i)}function Fp(e,t,n,r){const o={};if(r&&n){const r=Op(e,n);r.length&&(o.exception={values:[{value:t,stacktrace:{frames:r}}]}),zu(o,{synthetic:!0})}if(uu(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return o.logentry={message:e,params:n},o}return o.message=t,o}function Bp(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(Ru(e));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=t)return ku(r,t);for(let o=n.length;o>0;o--){const e=n.slice(0,o).join(", ");if(!(e.length>t))return o===n.length?e:ku(e,t)}return""}(e),r=t?"promise rejection":"exception";return su(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:fu(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class zp extends Af{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:Ep.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;Wf(t,"browser",["browser"],Ep.SENTRY_SDK_SOURCE||"npm"),t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:t.sendDefaultPii?"auto":"never",...t._metadata.sdk.settings}),super(t);const{sendDefaultPii:r,sendClientReports:o,enableLogs:i,_experiments:s}=this._options;Ep.document&&(o||i||s?.enableMetrics)&&Ep.document.addEventListener("visibilitychange",()=>{"hidden"===Ep.document.visibilityState&&(o&&this._flushOutcomes(),i&&mf(this),s?.enableMetrics&&yf(this))}),r&&this.on("beforeSendSession",qf)}eventFromException(e,t){return function(e,t,n,r){const o=jp(e,t,n?.syntheticException||void 0,r);return zu(o),o.level="error",n?.event_id&&(o.event_id=n.event_id),qd(o)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,o){const i=Fp(e,t,r?.syntheticException||void 0,o);return i.level=n,r?.event_id&&(i.event_id=r.event_id),qd(i)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n,r)}}const Up="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,$p=Tc,Vp=(e,t,n,r)=>{let o,i;return s=>{t.value>=0&&(s||r)&&(i=t.value-(o??0),(i||void 0===o)&&(o=t.value,t.delta=i,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},qp=(e=!0)=>{const t=$p.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart{const e=qp();return e?.activationStart??0},Hp=(e,t=-1)=>{const n=qp();let r="navigate";return n&&($p.document?.prerendering||Wp()>0?r="prerender":$p.document?.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},Kp=new WeakMap;function Yp(e,t){return Kp.get(e)||Kp.set(e,new t),Kp.get(e)}class Gp{constructor(){Gp.prototype.__init.call(this),Gp.prototype.__init2.call(this)}__init(){this._sessionValue=0}__init2(){this._sessionEntries=[]}_processEntry(e){if(e.hadRecentInput)return;const t=this._sessionEntries[0],n=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this._sessionValue+=e.value,this._sessionEntries.push(e)):(this._sessionValue=e.value,this._sessionEntries=[e]),this._onAfterProcessingUnexpectedShift?.(e)}}const Jp=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Xp=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Qp=-1;const Zp=e=>{"hidden"===$p.document.visibilityState&&Qp>-1&&(Qp="visibilitychange"===e.type?e.timeStamp:0,eh())},eh=()=>{removeEventListener("visibilitychange",Zp,!0),removeEventListener("prerenderingchange",Zp,!0)},th=()=>{if($p.document&&Qp<0){const e=Wp(),t=$p.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;Qp=t??("hidden"!==$p.document?.visibilityState||$p.document?.prerendering?1/0:0),addEventListener("visibilitychange",Zp,!0),addEventListener("prerenderingchange",Zp,!0)}return{get firstHiddenTime(){return Qp}}},nh=e=>{$p.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},rh=[1800,3e3],oh=[.1,.25];let ih=0,sh=1/0,ah=0;const ch=e=>{e.forEach(e=>{e.interactionId&&(sh=Math.min(sh,e.interactionId),ah=Math.max(ah,e.interactionId),ih=ah?(ah-sh)/7+1:0)})};let uh;const lh=()=>uh?ih:performance.interactionCount||0;let dh=0;class fh{constructor(){fh.prototype.__init.call(this),fh.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){dh=lh(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const e=Math.min(this._longestInteractionList.length-1,Math.floor((lh()-dh)/50));return this._longestInteractionList[e]}_processEntry(e){if(this._onBeforeProcessingEntry?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this._longestInteractionList.at(-1);let n=this._longestInteractionMap.get(e.interactionId);if(n||this._longestInteractionList.length<10||e.duration>t._latency){if(n?e.duration>n._latency?(n.entries=[e],n._latency=e.duration):e.duration===n._latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],_latency:e.duration},this._longestInteractionMap.set(n.id,n),this._longestInteractionList.push(n)),this._longestInteractionList.sort((e,t)=>t._latency-e._latency),this._longestInteractionList.length>10){const e=this._longestInteractionList.splice(10);for(const t of e)this._longestInteractionMap.delete(t.id)}this._onAfterProcessingINPCandidate?.(n)}}}const ph=e=>{const t=t=>{"pagehide"!==t.type&&"hidden"!==$p.document?.visibilityState||e(t)};$p.document&&(addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0))},hh=e=>{const t=$p.requestIdleCallback||$p.setTimeout;"hidden"===$p.document?.visibilityState?e():(t(e=Xp(e)),ph(e))},mh=[200,500];class gh{_processEntry(e){this._onBeforeProcessingEntry?.(e)}}const yh=[2500,4e3],vh=[800,1800],_h=e=>{$p.document?.prerendering?nh(()=>_h(e)):"complete"!==$p.document?.readyState?addEventListener("load",()=>_h(e),!0):setTimeout(e)},bh={},Sh={};let kh,wh,xh,Eh;function Th(e,t=!1){return Nh("cls",e,Mh,kh,t)}function Ch(e,t=!1){return Nh("lcp",e,Oh,wh,t)}function Ih(e){return Nh("inp",e,Lh,Eh)}function Ah(e,t){return Ph(e,t),Sh[e]||(function(e){const t={};"event"===e&&(t.durationThreshold=0),Jp(e,t=>{Rh(e,{entries:t})},t)}(e),Sh[e]=!0),jh(e,t)}function Rh(e,t){const n=bh[e];if(n?.length)for(const o of n)try{o(t)}catch(r){Up&&jc.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${qc(o)}\nError:`,r)}}function Mh(){return((e,t={})=>{((e,t={})=>{nh(()=>{const n=th(),r=Hp("FCP");let o;const i=Jp("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(i.disconnect(),t.startTime{const n=Hp("CLS",0);let r;const o=Yp(t,Gp),i=e=>{for(const t of e)o._processEntry(t);o._sessionValue>n.value&&(n.value=o._sessionValue,n.entries=o._sessionEntries,r())},s=Jp("layout-shift",i);s&&(r=Vp(e,n,oh,t.reportAllChanges),$p.document?.addEventListener("visibilitychange",()=>{"hidden"===$p.document?.visibilityState&&(i(s.takeRecords()),r(!0))}),$p?.setTimeout?.(r))}))})(e=>{Rh("cls",{metric:e}),kh=e},{reportAllChanges:!0})}function Oh(){return((e,t={})=>{nh(()=>{const n=th(),r=Hp("LCP");let o;const i=Yp(t,gh),s=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)i._processEntry(t),t.startTime{s(a.takeRecords()),a.disconnect(),o(!0)});for(const e of["keydown","click","visibilitychange"])$p.document&&addEventListener(e,()=>hh(n),{capture:!0,once:!0})}})})(e=>{Rh("lcp",{metric:e}),wh=e},{reportAllChanges:!0})}function Dh(){return((e,t={})=>{const n=Hp("TTFB"),r=Vp(e,n,vh,t.reportAllChanges);_h(()=>{const e=qp();e&&(n.value=Math.max(e.responseStart-Wp(),0),n.entries=[e],r(!0))})})(e=>{Rh("ttfb",{metric:e}),xh=e})}function Lh(){return((e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&nh(()=>{"interactionCount"in performance||uh||(uh=Jp("event",ch,{type:"event",buffered:!0,durationThreshold:0}));const n=Hp("INP");let r;const o=Yp(t,fh),i=e=>{hh(()=>{for(const n of e)o._processEntry(n);const t=o._estimateP98LongestInteraction();t&&t._latency!==n.value&&(n.value=t._latency,n.entries=t.entries,r())})},s=Jp("event",i,{durationThreshold:t.durationThreshold??40});r=Vp(e,n,mh,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),ph(()=>{i(s.takeRecords()),r(!0)}))})})(e=>{Rh("inp",{metric:e}),Eh=e})}function Nh(e,t,n,r,o=!1){let i;return Ph(e,t),Sh[e]||(i=n(),Sh[e]=!0),r&&t({metric:r}),jh(e,t,o?i:void 0)}function Ph(e,t){bh[e]=bh[e]||[],bh[e].push(t)}function jh(e,t,n){return()=>{n&&n();const r=bh[e];if(!r)return;const o=r.indexOf(t);-1!==o&&r.splice(o,1)}}function Fh(e){return"number"==typeof e&&isFinite(e)}function Bh(e,t,n,{...r}){const o=Hl(e).start_timestamp;return o&&o>t&&"function"==typeof e.updateStartTime&&e.updateStartTime(t),Pd(e,()=>{const e=Nd({startTime:t,...r});return e&&e.end(n),e})}function zh(e){const t=cl();if(!t)return;const{name:n,transaction:r,attributes:o,startTime:i}=e,{release:s,environment:a,sendDefaultPii:c}=t.getOptions(),u=t.getIntegrationByName("Replay"),l=u?.getReplayId(),d=il(),f=d.getUser(),p=void 0!==f?f.email||f.id||f.ip_address:void 0;let h;try{h=d.getScopeData().contexts.profile.profile_id}catch{}return Nd({name:n,attributes:{release:s,environment:a,user:p||void 0,profile_id:h||void 0,replay_id:l||void 0,transaction:r,"user_agent.original":$p.navigator?.userAgent,"client.address":c?"{{auto}}":void 0,...o},startTime:i,experimental:{standalone:!0}})}function Uh(){return $p.addEventListener&&$p.performance}function $h(e){return e/1e3}function Vh(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function qh(e,t){let n,r=!1;function o(e){!r&&n&&t(e,n),r=!0}ph(()=>{o("pagehide")});const i=e.on("beforeStartNavigationSpan",(e,t)=>{t?.isRedirect||(o("navigation"),i(),s())}),s=e.on("afterStartPageLoadSpan",e=>{n=e.spanContext().spanId,s()})}function Wh(e){return e?((qu()||performance.timeOrigin)+e)/1e3:e}function Hh(e){const t={};if(null!=e.nextHopProtocol){const{name:n,version:r}=function(e){let t="unknown",n="unknown",r="";for(const o of e){if("/"===o){[t,n]=e.split("/");break}if(!isNaN(Number(o))){t="h"===r?"http":r,n=e.split(r)[1];break}r+=o}return r===e&&(t=r),{name:t,version:n}}(e.nextHopProtocol);t["network.protocol.version"]=r,t["network.protocol.name"]=n}return qu()||Uh()?.timeOrigin?(n={...t,"http.request.redirect_start":Wh(e.redirectStart),"http.request.redirect_end":Wh(e.redirectEnd),"http.request.worker_start":Wh(e.workerStart),"http.request.fetch_start":Wh(e.fetchStart),"http.request.domain_lookup_start":Wh(e.domainLookupStart),"http.request.domain_lookup_end":Wh(e.domainLookupEnd),"http.request.connect_start":Wh(e.connectStart),"http.request.secure_connection_start":Wh(e.secureConnectionStart),"http.request.connection_end":Wh(e.connectEnd),"http.request.request_start":Wh(e.requestStart),"http.request.response_start":Wh(e.responseStart),"http.request.response_end":Wh(e.responseEnd),"http.request.time_to_first_byte":null!=e.responseStart?e.responseStart/1e3:void 0},Object.fromEntries(Object.entries(n).filter(([,e])=>null!=e))):t;var n}let Kh,Yh,Gh=0,Jh={};function Xh({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const r=Uh();if(r&&qu()){r.mark&&$p.performance.mark("sentry-tracing-init");const o=t?function(e){let t,n=0;if(!Vh("largest-contentful-paint"))return;const r=Ch(({metric:e})=>{const r=e.entries[e.entries.length-1];r&&(n=e.value,t=r)},!0);qh(e,(e,o)=>{!function(e,t,n,r){Up&&jc.log(`Sending LCP span (${e})`);const o=$h((qu()||0)+(t?.startTime||0)),i=il().getScopeData().transactionName,s=t?vu(t.element):"Largest contentful paint",a={[hl]:"auto.http.browser.lcp",[pl]:"ui.webvital.lcp",[bl]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t&&(t.element&&(a["lcp.element"]=vu(t.element)),t.id&&(a["lcp.id"]=t.id),t.url&&(a["lcp.url"]=t.url.trim().slice(0,200)),null!=t.loadTime&&(a["lcp.loadTime"]=t.loadTime),null!=t.renderTime&&(a["lcp.renderTime"]=t.renderTime),null!=t.size&&(a["lcp.size"]=t.size));const c=zh({name:s,transaction:i,attributes:a,startTime:o});c&&(c.addEvent("lcp",{[gl]:"millisecond",[yl]:e}),c.end(o))}(n,t,o,e),r()})}(n):Ch(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(Jh.lcp={value:e.value,unit:"millisecond"},Kh=t)},!0),i=Nh("ttfb",({metric:e})=>{e.entries[e.entries.length-1]&&(Jh.ttfb={value:e.value,unit:"millisecond"})},Dh,xh),s=e?function(e){let t,n=0;if(!Vh("layout-shift"))return;const r=Th(({metric:e})=>{const r=e.entries[e.entries.length-1];r&&(n=e.value,t=r)},!0);qh(e,(e,o)=>{!function(e,t,n,r){Up&&jc.log(`Sending CLS span (${e})`);const o=t?$h((qu()||0)+t.startTime):Vu(),i=il().getScopeData().transactionName,s=t?vu(t.sources[0]?.node):"Layout shift",a={[hl]:"auto.http.browser.cls",[pl]:"ui.webvital.cls",[bl]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t?.sources&&t.sources.forEach((e,t)=>{a[`cls.source.${t+1}`]=vu(e.node)});const c=zh({name:s,transaction:i,attributes:a,startTime:o});c&&(c.addEvent("cls",{[gl]:"",[yl]:e}),c.end(o))}(n,t,o,e),r()})}(n):Th(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(Jh.cls={value:e.value,unit:""},Yh=t)},!0);return()=>{o?.(),i(),s?.()}}return()=>{}}function Qh(e,t,n,r,o=n){const i=function(e){return"secureConnection"===e?"connectEnd":"fetch"===e?"domainLookupStart":`${e}End`}(n),s=t[i],a=t[`${n}Start`];a&&s&&Bh(e,r+$h(a),r+$h(s),{op:`browser.${o}`,name:t.name,attributes:{[hl]:"auto.ui.browser.metrics",..."redirect"===n&&null!=t.redirectCount?{"http.redirect_count":t.redirectCount}:{}}})}const Zh=({entries:e})=>{const t=ed(),n=t?Zl(t):void 0,r=n?Hl(n).description:il().getScopeData().transactionName;e.forEach(e=>{const t=e;if(!t.identifier)return;const n=t.name,o=t.renderTime,i=t.loadTime,[s,a]=i?[$h(i),"load-time"]:o?[$h(o),"render-time"]:[Vu(),"entry-emission"],c="image-paint"===n?$h(Math.max(0,(o??0)-(i??0))):0,u={[hl]:"auto.ui.browser.elementtiming",[pl]:"ui.elementtiming",[ll]:"component","sentry.span_start_time_source":a,"sentry.transaction_name":r,"element.id":t.id,"element.type":t.element?.tagName?.toLowerCase()||"unknown","element.size":t.naturalWidth&&t.naturalHeight?`${t.naturalWidth}x${t.naturalHeight}`:void 0,"element.render_time":o,"element.load_time":i,"element.url":t.url||void 0,"element.identifier":t.identifier,"element.paint_type":n};Ld({name:`element[${t.identifier}]`,attributes:u,startTime:s,onlyIfParent:!0},e=>{e.end(s+c)})})};let em,tm,nm,rm;function om(e){Yc("dom",e),Gc("dom",im)}function im(){if(!$p.document)return;const e=Jc.bind(null,"dom"),t=sm(e,!0);$p.document.addEventListener("click",t,!1),$p.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=$p,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Tu(r,"addEventListener",function(t){return function(n,r,o){if("click"===n||"keypress"==n)try{const r=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},i=r[n]=r[n]||{refCount:0};if(!i.handler){const r=sm(e);i.handler=r,t.call(this,n,r,o)}i.refCount++}catch{}return t.call(this,n,r,o)}}),Tu(r,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this.__sentry_instrumentation_handlers__||{},o=n[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function sm(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;Cu(n,"_sentryCaptured",!0),r&&!r._sentryId&&Cu(r,"_sentryId",Pu());const o="keypress"===n.type?"input":n.type;(function(e){if(e.type!==tm)return!1;try{if(!e.target||e.target._sentryId!==nm)return!1}catch{}return!0})(n)||(e({event:n,name:o,global:t}),tm=n.type,nm=r?r._sentryId:void 0),clearTimeout(em),em=$p.setTimeout(()=>{nm=void 0,tm=void 0},1e3)}}function am(e){const t="history";Yc(t,e),Gc(t,cm)}function cm(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=rm,o=function(e){try{return new URL(e,$p.location.origin).toString()}catch{return e}}(String(n));if(rm=o,r===o)return e.apply(this,t);Jc("history",{from:r,to:o})}return e.apply(this,t)}}$p.addEventListener("popstate",()=>{const e=$p.location.href,t=rm;rm=e,t!==e&&Jc("history",{from:t,to:e})}),"history"in gp&&gp.history&&(Tu($p.history,"pushState",e),Tu($p.history,"replaceState",e))}const um={};function lm(e){const t=um[e];if(t)return t;let n=$p[e];if(yp(n))return um[e]=n.bind($p);const r=$p.document;if(r&&"function"==typeof r.createElement)try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const o=t.contentWindow;o?.[e]&&(n=o[e]),r.head.removeChild(t)}catch(o){Up&&jc.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,o)}return n?um[e]=n.bind($p):n}function dm(...e){return lm("setTimeout")(...e)}const fm="__sentry_xhr_v3__";function pm(e){Yc("xhr",e),Gc("xhr",hm)}function hm(){if(!$p.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,o=1e3*Vu(),i=cu(n[0])?n[0].toUpperCase():void 0,s=function(e){if(cu(e))return e;try{return e.toString()}catch{}}(n[1]);if(!i||!s)return e.apply(t,n);t[fm]={method:i,url:s,request_headers:{}},"POST"===i&&s.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const a=()=>{const e=t[fm];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}Jc("xhr",{endTimestamp:1e3*Vu(),startTimestamp:o,xhr:t,virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(a(),e.apply(t,n))}):t.addEventListener("readystatechange",a),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,o]=n,i=t[fm];return i&&cu(r)&&cu(o)&&(i.request_headers[r.toLowerCase()]=o),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[fm];return r?(void 0!==n[0]&&(r.body=n[0]),Jc("xhr",{startTimestamp:1e3*Vu(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function mm(e){return new URLSearchParams(e).toString()}function gm(e,t=jc){try{if("string"==typeof e)return[e];if(e instanceof URLSearchParams)return[e.toString()];if(e instanceof FormData)return[mm(e)];if(!e)return[void 0]}catch(n){return Up&&t.error(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return Up&&t.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function ym(e=[]){if(2===e.length&&"object"==typeof e[1])return e[1].body}function vm(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return Up&&jc.error(n,"Failed to get xhr response headers",e),{}}return t?t.split("\r\n").reduce((e,t)=>{const[n,r]=t.split(": ");return r&&(e[n.toLowerCase()]=r),e},{}):{}}const _m=[],bm=new Map;const Sm={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"},km=({metric:e})=>{if(null==e.value)return;const t=$h(e.value);if(t>60)return;const n=e.entries.find(t=>t.duration===e.value&&Sm[t.name]);if(!n)return;const{interactionId:r}=n,o=Sm[n.name],i=$h(qu()+n.startTime),s=ed(),a=s?Zl(s):void 0,c=(null!=r?bm.get(r):void 0)||a,u=c?Hl(c).description:il().getScopeData().transactionName,l=zh({name:vu(n.target),transaction:u,attributes:{[hl]:"auto.http.browser.inp",[pl]:`ui.interaction.${o}`,[bl]:n.duration},startTime:i});l&&(l.addEvent("inp",{[gl]:"millisecond",[yl]:e.value}),l.end(i+t))};function wm(e,t=lm("fetch")){let n=0,r=0;return function(e,t,n=function(e=100){const t=new Set;function n(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(r){if(!(t.sizen(o),()=>n(o)),o},drain:function(e){if(!t.size)return qd(!0);const n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;const r=[n,new Promise(t=>setTimeout(()=>t(!1),e))];return Promise.race(r)}}}(e.bufferSize||64)){let r={};return{send:function(o){const i=[];if(bd(o,(t,n)=>{const o=Td(n);jf(r,o)?e.recordDroppedEvent("ratelimit_backoff",o):i.push(t)}),0===i.length)return Promise.resolve({});const s=vd(o[0],i),a=t=>{bd(s,(n,r)=>{e.recordDroppedEvent(t,Td(r))})};return n.add(()=>t({body:kd(s)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Ec&&jc.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Ff(r,e),e),e=>{throw a("network_error"),Ec&&jc.error("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Pf)return Ec&&jc.error("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}(e,async function(o){const i=o.body.length;n+=i,r++;const s={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,s);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(a){throw um.fetch=void 0,a}finally{n-=i,r--}})}function xm(e,t,n,r){const o={filename:e,function:""===t?Fc:t,in_app:!0};return void 0!==n&&(o.lineno=n),void 0!==r&&(o.colno=r),o}const Em=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Tm=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Cm=/\((\S*)(?::(\d+))(?::(\d+))\)/,Im=/at (.+?) ?\(data:(.+?),/,Am=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rm=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Mm=Uc([30,e=>{const t=e.match(Im);if(t)return{filename:``,function:t[1]};const n=Em.exec(e);if(n){const[,e,t,r]=n;return xm(e,Fc,+t,+r)}const r=Tm.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=Cm.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=Om(r[1]||Fc,r[2]);return xm(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=Am.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Rm.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Fc;return[n,e]=Om(n,e),xm(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Om=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Fc,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Dm="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Lm=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){t.console&&function(e){const t="console";Yc(t,e),Gc(t,ap)}(function(e){return function(t){if(cl()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:cp(t.level),message:wu(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${wu(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Yf(n,{input:t.args,level:t.level})}}(e)),t.dom&&om(function(e,t){return function(n){if(cl()!==e)return;let r,o,i="object"==typeof t?t.serializeAttribute:void 0,s="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;s&&s>1024&&(Dm&&jc.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof i&&(i=[i]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=vu(t,{keyAttrs:i,maxStringLength:s}),o=Su(t)}catch{r=""}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};o&&(a.data={"ui.component_name":o}),Yf(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom)),t.xhr&&pm(function(e){return function(t){if(cl()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,o=t.xhr[fm];if(!n||!r||!o)return;const{method:i,url:s,status_code:a,body:c}=o,u={method:i,url:s,status_code:a},l={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:u,type:"http",level:mp(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,l),Yf(d,l)}}(e)),t.fetch&&vp(function(e){return function(t){if(cl()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){const o=t.fetchData,i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:o,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",s,i),Yf(s,i)}else{const o=t.response,i={...t.fetchData,status_code:o?.status},s={input:t.args,response:o,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:i,type:"http",level:mp(i.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),Yf(a,s)}}}(e)),t.history&&am(function(e){return function(t){if(cl()!==e)return;let n=t.from,r=t.to;const o=$f(Ep.location.href);let i=n?$f(n):void 0;const s=$f(r);i?.path||(i=o),o.protocol===s.protocol&&o.host===s.host&&(r=s.relative),o.protocol===i.protocol&&o.host===i.host&&(n=i.relative),Yf({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){cl()===e&&Yf({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Fu(t)},{event:t})}}(e))}}},Nm=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Pm=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Tu(Ep,"setTimeout",jm),t.setInterval&&Tu(Ep,"setInterval",jm),t.requestAnimationFrame&&Tu(Ep,"requestAnimationFrame",Fm),t.XMLHttpRequest&&"XMLHttpRequest"in Ep&&Tu(XMLHttpRequest.prototype,"send",Bm);const e=t.eventTarget;e&&(Array.isArray(e)?e:Nm).forEach(e=>function(e,t){const n=Ep,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Tu(r,"addEventListener",function(n){return function(r,o,i){try{"function"==typeof o.handleEvent&&(o.handleEvent=Ip(o.handleEvent,{mechanism:{data:{handler:qc(o),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,o),n.apply(this,[r,Ip(o,{mechanism:{data:{handler:qc(o),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),i])}}),Tu(r,"removeEventListener",function(e){return function(t,n,r){try{const o=n.__sentry_wrapped__;o&&e.call(this,t,o,r)}catch{}return e.call(this,t,n,r)}}))}(e,t))}}};function jm(e){return function(...t){const n=t[0];return t[0]=Ip(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${qc(e)}`}}),e.apply(this,t)}}function Fm(e){return function(t){return e.apply(this,[Ip(t,{mechanism:{data:{handler:qc(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function Bm(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&Tu(n,e,function(t){const n={mechanism:{data:{handler:qc(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Au(t);return r&&(n.mechanism.data.handler=qc(r)),Ip(t,n)})}),e.apply(this,t)}}const zm=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){Qc(t=>{const{stackParser:n,attachStacktrace:r}=$m();if(cl()!==e||Cp())return;const{msg:o,url:i,line:s,column:a,error:c}=t,u=function(e,t,n,r){const o=e.exception=e.exception||{},i=o.values=o.values||[],s=i[0]=i[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],u=r,l=n,d=function(e){if(cu(e)&&0!==e.length){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/);return``}return e.slice(0,1024)}}(t)??bu();return 0===c.length&&c.push({colno:u,filename:d,function:Fc,in_app:!0,lineno:l}),e}(jp(n,c||o,void 0,r,!1),i,s,a);u.level="error",of(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}(e),Um("onerror")),t.onunhandledrejection&&(function(e){tu(t=>{const{stackParser:n,attachStacktrace:r}=$m();if(cl()!==e||Cp())return;const o=function(e){if(lu(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),i=lu(o)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(o)}`}]}}:jp(n,o,void 0,r,!0);i.level="error",of(i,{originalException:o,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}(e),Um("onunhandledrejection"))}}};function Um(e){Dm&&jc.log(`Global Handler attached: ${e}`)}function $m(){const e=cl();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const Vm=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,o){rp(Rp,o.getOptions().stackParser,n,t,e,r)}}};const qm=Tc,Wm="sentryReplaySession",Hm="Unable to send Replay",Km=15e4,Ym=5e3,Gm=2e7;var Jm=Object.defineProperty,Xm=(e,t,n)=>((e,t,n)=>t in e?Jm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Qm=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Qm||{});function Zm(e){const t=e?.host;return Boolean(t?.shadowRoot===e)}function eg(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function tg(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,ng).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t):null}catch(n){return null}var t}function ng(e){let t;if(function(e){return"styleSheet"in e}(e))try{t=tg(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(n){}else if(function(e){return"selectorText"in e}(e)){let t=e.cssText;const n=e.selectorText.includes(":"),r="string"==typeof e.style.all&&e.style.all;if(r&&(t=function(e){let t="";for(let n=0;nthis.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function og({maskInputOptions:e,tagName:t,type:n}){return"OPTION"===t&&(t="SELECT"),Boolean(e[t.toLowerCase()]||n&&e[n]||"password"===n||"INPUT"===t&&!n&&e.text)}function ig({isMasked:e,element:t,value:n,maskInputFn:r}){let o=n||"";return e?(r&&(o=r(o,t)),"*".repeat(o.length)):o}function sg(e){return e.toLowerCase()}function ag(e){return e.toUpperCase()}const cg="__rrweb_original__";function ug(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?sg(t):null}function lg(e,t,n){return"INPUT"!==t||"radio"!==n&&"checkbox"!==n?e.value:e.getAttribute("value")||""}function dg(e,t){let n;try{n=new URL(e,window.location.href)}catch(DE){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return r?.[1]??null}const fg={};function pg(e){const t=fg[e];if(t)return t;const n=window.document;let r=window[e];if(n&&"function"==typeof n.createElement)try{const t=n.createElement("iframe");t.hidden=!0,n.head.appendChild(t);const o=t.contentWindow;o&&o[e]&&(r=o[e]),n.head.removeChild(t)}catch(o){}return fg[e]=r.bind(window)}function hg(...e){return pg("setTimeout")(...e)}function mg(...e){return pg("clearTimeout")(...e)}function gg(e){try{return e.contentDocument}catch(t){}}let yg=1;const vg=new RegExp("[^a-z0-9-_:]");function _g(){return yg++}let bg,Sg;const kg=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,wg=/^(?:[a-z+]+:)?\/\//i,xg=/^www\..*/i,Eg=/^(data:)([^,]*),(.*)/i;function Tg(e,t){return(e||"").replace(kg,(e,n,r,o,i,s)=>{const a=r||i||s,c=n||o||"";if(!a)return e;if(wg.test(a)||xg.test(a))return`url(${c}${a}${c})`;if(Eg.test(a))return`url(${c}${a}${c})`;if("/"===a[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${c})`;const u=t.split("/"),l=a.split("/");u.pop();for(const t of l)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${c}${u.join("/")}${c})`})}const Cg=/^[^ \t\n\r\u000c]+/,Ig=/^[, \t\n\r\u000c]+/,Ag=new WeakMap;function Rg(e,t){return t&&""!==t.trim()?Mg(e,t):t}function Mg(e,t){let n=Ag.get(e);if(n||(n=e.createElement("a"),Ag.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function Og(e,t,n,r,o,i){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?Rg(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}const o=[];for(;r(Ig),!(n>=t.length);){let i=r(Cg);if(","===i.slice(-1))i=Rg(e,i.substring(0,i.length-1)),o.push(i);else{let r="";i=Rg(e,i);let s=!1;for(;;){const e=t.charAt(n);if(""===e){o.push((i+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,o.push((i+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n?Tg(r,Mg(e)):"object"===t&&"data"===n?Rg(e,r):"function"==typeof i?i(n,r,o):r:Rg(e,r):r}function Dg(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function Lg(e,t,n=1/0,r=0){return e?e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:Lg(e.parentNode,t,n,r+1):-1}function Ng(e,t){return n=>{const r=n;if(null===r)return!1;try{if(e)if("string"==typeof e){if(r.matches(`.${e}`))return!0}else if(function(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}(r,e))return!0;return!(!t||!r.matches(t))}catch{return!1}}}function Pg(e,t,n,r,o,i){try{const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===s)return!1;if("INPUT"===s.tagName){const e=s.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(e))return!0}let a=-1,c=-1;if(i){if(c=Lg(s,Ng(r,o)),c<0)return!0;a=Lg(s,Ng(t,n),c>=0?c:1/0)}else{if(a=Lg(s,Ng(t,n)),a<0)return!1;c=Lg(s,Ng(r,o),a>=0?a:1/0)}return a>=0?!(c>=0)||a<=c:!(c>=0||!i)}catch(s){}return!!i}function jg(e){return null==e?"":e.toLowerCase()}function Fg(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,unblockSelector:s,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:f=!1,inlineStylesheet:p=!0,maskInputOptions:h={},maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:_={},inlineImages:b=!1,recordCanvas:S=!1,onSerialize:k,onIframeLoad:w,iframeLoadTimeout:x=5e3,onBlockedImageLoad:E,onStylesheetLoad:T,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:A=!1}=t;let{preserveWhiteSpace:R=!0}=t;const M=function(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,unblockSelector:s,maskAllText:a,maskAttributeFn:c,maskTextClass:u,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:f,inlineStylesheet:p,maskInputOptions:h={},maskTextFn:m,maskInputFn:g,dataURLOptions:y={},inlineImages:v,recordCanvas:_,keepIframeSrcFn:b,newlyAddedElement:S=!1}=t,k=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Qm.Document,childNodes:[],compatMode:e.compatMode}:{type:Qm.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Qm.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:k};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:o,unblockSelector:i,inlineStylesheet:s,maskInputOptions:a={},maskAttributeFn:c,maskInputFn:u,dataURLOptions:l={},inlineImages:d,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:h=!1,rootId:m,maskTextClass:g,unmaskTextClass:y,maskTextSelector:v,unmaskTextSelector:_}=t,b=function(e,t,n,r){try{if(r&&e.matches(r))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(o){}return!1}(e,r,o,i),S=function(e){if(e instanceof HTMLFormElement)return"form";const t=sg(e.tagName);return vg.test(t)?"div":t}(e);let k={};const w=e.attributes.length;for(let C=0;Ct.href===e.href);let r=null;t&&(r=tg(t)),r&&(k.rel=null,k.href=null,k.crossorigin=null,k._cssText=Tg(r,t.href))}if("style"===S&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=tg(e.sheet);t&&(k._cssText=Tg(t,Mg(n)))}if("input"===S||"textarea"===S||"select"===S||"option"===S){const t=e,n=ug(t),r=lg(t,ag(S),n),o=t.checked;if("submit"!==n&&"button"!==n&&r){const e=Pg(t,g,v,y,_,og({type:n,tagName:ag(S),maskInputOptions:a}));k.value=ig({isMasked:e,element:t,value:r,maskInputFn:u})}o&&(k.checked=o)}if("option"===S&&(e.selected&&!a.select?k.selected=!0:delete k.selected),"canvas"===S&&f)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n0!==e))return!1}return!0})(e)||(k.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){const t=e.toDataURL(l.type,l.quality),r=n.createElement("canvas");r.width=e.width,r.height=e.height,t!==r.toDataURL(l.type,l.quality)&&(k.rr_dataURL=t)}if("img"===S&&d){bg||(bg=n.createElement("canvas"),Sg=bg.getContext("2d"));const t=e,r=(t.currentSrc||t.getAttribute("src"),t.crossOrigin),o=()=>{t.removeEventListener("load",o);try{bg.width=t.naturalWidth,bg.height=t.naturalHeight,Sg.drawImage(t,0,0),k.rr_dataURL=bg.toDataURL(l.type,l.quality)}catch(DE){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o))}"anonymous"===t.crossOrigin&&(r?k.crossOrigin=r:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"!==S&&"video"!==S||(k.rr_mediaState=e.paused?"paused":"played",k.rr_mediaCurrentTime=e.currentTime),h||(e.scrollLeft&&(k.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(k.rr_scrollTop=e.scrollTop)),b){const{width:t,height:n}=e.getBoundingClientRect();k={class:k.class,rr_width:`${t}px`,rr_height:`${n}px`}}let x;"iframe"!==S||p(k.src)||(b||gg(e)||(k.rr_src=k.src),delete k.src);try{customElements.get(S)&&(x=!0)}catch(T){}return{type:Qm.Element,tagName:S,attributes:k,childNodes:[],isSVG:(E=e,Boolean("svg"===E.tagName||E.ownerSVGElement)||void 0),needBlock:b,rootId:m,isCustom:x};var E}(e,{doc:n,blockClass:o,blockSelector:i,unblockSelector:s,inlineStylesheet:p,maskAttributeFn:c,maskInputOptions:h,maskInputFn:g,dataURLOptions:y,inlineImages:v,recordCanvas:_,keepIframeSrcFn:b,newlyAddedElement:S,rootId:k,maskTextClass:u,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:f});case e.TEXT_NODE:return function(e,t){const{maskAllText:n,maskTextClass:r,unmaskTextClass:o,maskTextSelector:i,unmaskTextSelector:s,maskTextFn:a,maskInputOptions:c,maskInputFn:u,rootId:l}=t,d=e.parentNode&&e.parentNode.tagName;let f=e.textContent;const p="STYLE"===d||void 0,h="SCRIPT"===d||void 0,m="TEXTAREA"===d||void 0;if(p&&f){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(f=tg(e.parentNode.sheet))}catch(DE){}f=Tg(f,Mg(t.doc))}h&&(f="SCRIPT_PLACEHOLDER");const g=Pg(e,r,i,o,s,n);return p||h||m||!f||!g||(f=a?a(f,e.parentElement):f.replace(/[\S]/g,"*")),m&&f&&(c.textarea||g)&&(f=u?u(f,e.parentNode):f.replace(/[\S]/g,"*")),"OPTION"===d&&f&&(f=ig({isMasked:Pg(e,r,i,o,s,og({type:null,tagName:d,maskInputOptions:c})),element:e,value:f,maskInputFn:u})),{type:Qm.Text,textContent:f||"",isStyle:p,rootId:l}}(e,{doc:n,maskAllText:a,maskTextClass:u,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:f,maskTextFn:m,maskInputOptions:h,maskInputFn:g,rootId:k});case e.CDATA_SECTION_NODE:return{type:Qm.CDATA,textContent:"",rootId:k};case e.COMMENT_NODE:return{type:Qm.Comment,textContent:e.textContent||"",rootId:k};default:return!1}}(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskAllText:a,unblockSelector:s,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,dataURLOptions:_,inlineImages:b,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:A});if(!M)return null;let O;O=r.hasNode(e)?r.getId(e):!function(e,t){if(t.comment&&e.type===Qm.Comment)return!0;if(e.type===Qm.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===dg(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(jg(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===jg(e.attributes.name)||"icon"===jg(e.attributes.rel)||"apple-touch-icon"===jg(e.attributes.rel)||"shortcut icon"===jg(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&jg(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(jg(e.attributes.property).match(/^(og|twitter|fb):/)||jg(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===jg(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===jg(e.attributes.name)||"googlebot"===jg(e.attributes.name)||"bingbot"===jg(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===jg(e.attributes.name)||"generator"===jg(e.attributes.name)||"framework"===jg(e.attributes.name)||"publisher"===jg(e.attributes.name)||"progid"===jg(e.attributes.name)||jg(e.attributes.property).match(/^article:/)||jg(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===jg(e.attributes.name)||"yandex-verification"===jg(e.attributes.name)||"csrf-token"===jg(e.attributes.name)||"p:domain_verify"===jg(e.attributes.name)||"verify-v1"===jg(e.attributes.name)||"verification"===jg(e.attributes.name)||"shopify-checkout-api-token"===jg(e.attributes.name)))return!0}}return!1}(M,v)&&(R||M.type!==Qm.Text||M.isStyle||M.textContent.replace(/^\s+|\s+$/gm,"").length)?_g():-2;const D=Object.assign(M,{id:O});if(r.add(e,D),-2===O)return null;k&&k(e);let L=!f;if(D.type===Qm.Element){L=L&&!D.needBlock;const t=e.shadowRoot;t&&eg(t)&&(D.isShadowHost=!0)}if((D.type===Qm.Document||D.type===Qm.Element)&&L){v.headWhitespace&&D.type===Qm.Element&&"head"===D.tagName&&(R=!1);const t={doc:n,mirror:r,blockClass:o,blockSelector:i,maskAllText:a,unblockSelector:s,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:f,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:_,inlineImages:b,recordCanvas:S,preserveWhiteSpace:R,onSerialize:k,onIframeLoad:w,iframeLoadTimeout:x,onBlockedImageLoad:E,onStylesheetLoad:T,stylesheetLoadTimeout:C,keepIframeSrcFn:I},A=e.childNodes?Array.from(e.childNodes):[];for(const e of A){const n=Fg(e,t);n&&D.childNodes.push(n)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const r=Fg(n,t);r&&(eg(e.shadowRoot)&&(r.isShadow=!0),D.childNodes.push(r))}}if(e.parentNode&&Zm(e.parentNode)&&eg(e.parentNode)&&(D.isShadow=!0),D.type!==Qm.Element||"iframe"!==D.tagName||D.needBlock||function(e,t,n){const r=e.contentWindow;if(!r)return;let o,i=!1;try{o=r.document.readyState}catch(a){return}if("complete"!==o){const r=hg(()=>{i||(t(),i=!0)},n);return void e.addEventListener("load",()=>{mg(r),i=!0,t()})}const s="about:blank";if(r.location.href!==s||e.src===s||""===e.src)return hg(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{const t=gg(e);if(t&&w){const n=Fg(t,{doc:t,mirror:r,blockClass:o,blockSelector:i,unblockSelector:s,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:_,inlineImages:b,recordCanvas:S,preserveWhiteSpace:R,onSerialize:k,onIframeLoad:w,iframeLoadTimeout:x,onStylesheetLoad:T,stylesheetLoadTimeout:C,keepIframeSrcFn:I});n&&w(e,n)}},x),D.type===Qm.Element&&"img"===D.tagName&&!e.complete&&D.needBlock){const t=e,n=()=>{if(t.isConnected&&!t.complete&&E)try{const e=t.getBoundingClientRect();e.width>0&&e.height>0&&E(t,D,e)}catch(e){}t.removeEventListener("load",n)};t.isConnected&&t.addEventListener("load",n)}return D.type===Qm.Element&&"link"===D.tagName&&"string"==typeof D.attributes.rel&&("stylesheet"===D.attributes.rel||"preload"===D.attributes.rel&&"string"==typeof D.attributes.href&&"css"===dg(D.attributes.href))&&function(e,t,n){let r,o=!1;try{r=e.sheet}catch(s){return}if(r)return;const i=hg(()=>{o||(t(),o=!0)},n);e.addEventListener("load",()=>{mg(i),o=!0,t()})}(e,()=>{if(T){const t=Fg(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,unblockSelector:s,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:l,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:_,inlineImages:b,recordCanvas:S,preserveWhiteSpace:R,onSerialize:k,onIframeLoad:w,iframeLoadTimeout:x,onStylesheetLoad:T,stylesheetLoadTimeout:C,keepIframeSrcFn:I});t&&T(e,t)}},C),D.type===Qm.Element&&delete D.needBlock,D}function Bg(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}let zg={map:{},getId:()=>-1,getNode:()=>null,removeNodeFromMap(){},has:()=>!1,reset(){}};function Ug(e,t,n={}){let r=null,o=0;return function(...i){const s=Date.now();o||!1!==n.leading||(o=s);const a=t-(s-o),c=this;a<=0||a>t?(r&&(function(...e){sy("clearTimeout")(...e)}(r),r=null),o=s,e.apply(c,i)):r||!1===n.trailing||(r=ay(()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,i)},a))}}function $g(e,t,n,r,o=window){const i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){ay(()=>{n.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>$g(e,t,i||{},!0)}function Vg(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(zg=new Proxy(zg,{get:(e,t,n)=>Reflect.get(e,t,n)}));let qg=Date.now;function Wg(e){const t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:t?.documentElement.scrollLeft||t?.body?.parentElement?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:t?.documentElement.scrollTop||t?.body?.parentElement?.scrollTop||t?.body?.scrollTop||0}}function Hg(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Kg(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Yg(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch(t){return null}}function Gg(e,t,n,r,o){if(!e)return!1;const i=Yg(e);if(!i)return!1;const s=Ng(t,n);if(!o){const e=r&&i.matches(r);return s(i)&&!e}const a=Lg(i,s);let c=-1;return!(a<0)&&(r&&(c=Lg(i,Ng(null,r))),a>-1&&c<0||a(new Date).getTime());class ny{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function ry(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function oy(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||function(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=ry(n);)n=t;return n}(e);return t.contains(n)}(e))}const iy={};function sy(e){const t=iy[e];if(t)return t;const n=window.document;let r=window[e];if(n&&"function"==typeof n.createElement)try{const t=n.createElement("iframe");t.hidden=!0,n.head.appendChild(t);const o=t.contentWindow;o&&o[e]&&(r=o[e]),n.head.removeChild(t)}catch(o){}return iy[e]=r.bind(window)}function ay(...e){return sy("setTimeout")(...e)}var cy=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(cy||{}),uy=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(uy||{}),ly=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ly||{}),dy=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(dy||{}),fy=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(fy||{});function py(e){try{return e.contentDocument}catch(t){}}function hy(e){return"__ln"in e}class my{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n`${e}@${t}`;class yy{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new my,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!oy(o))return;const i=Zm(o.parentNode)?this.mirror.getId(ry(o)):this.mirror.getId(o.parentNode),s=r(o);if(-1===i||-1===s)return n.addNode(o);const a=Fg(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Zg(e,this.mirror)&&!Gg(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(e),ey(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ty(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{Gg(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(e,t),e.contentWindow&&this.canvasManager.addWindow(e.contentWindow),this.shadowDomManager.observeAttachShadow(e))},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},onBlockedImageLoad:(e,t,{width:n,height:r})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:{style:{width:`${n}px`,height:`${r}px`}}}]})}});a&&(e.push({parentId:i,nextId:s,node:a}),t.add(a.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)_y(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||o(a);for(const a of this.addedSet)by(this.droppedSet,a)||_y(this.removes,a,this.mirror)?by(this.movedSet,a)?o(a):this.droppedSet.add(a):o(a);let i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=r(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),o(e.value)}const s={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!Jg(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;Gg(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||t===e.oldValue||this.texts.push({value:Pg(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&t?this.maskTextFn?this.maskTextFn(t,Yg(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,o=e.target.getAttribute(r);if("value"===r){const t=ug(n),r=n.tagName;o=lg(n,r,t);const i=og({maskInputOptions:this.maskInputOptions,tagName:r,type:t});o=ig({isMasked:Pg(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,i),element:n,value:o,maskInputFn:this.maskInputFn})}if(Gg(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||o===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(o)){if(py(n))return;r="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!Dg(n.tagName,r)&&(i.attributes[r]=Og(this.doc,sg(n.tagName),sg(r),o,n,this.maskAttributeFn),"style"===r)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),o=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?t:[t,o]:i._unchangedStyles[e]=[t,o]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}break}case"childList":if(Gg(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=Zm(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Gg(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||Jg(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(vy(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Xg(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[gy(n,r)]?vy(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!Zm(e.target)||!eg(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Jg(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[gy(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Gg(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes&&e.childNodes.forEach(e=>this.genAdds(e)),ty(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function vy(e,t){e.delete(t),t.childNodes?.forEach(t=>vy(e,t))}function _y(e,t,n){return 0!==e.length&&function(e,t,n){let r=t.parentNode;for(;r;){const t=n.getId(r);if(e.some(e=>e.id===t))return!0;r=r.parentNode}return!1}(e,t,n)}function by(e,t){return 0!==e.size&&Sy(e,t)}function Sy(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Sy(e,n))}let ky;const wy=e=>ky?(...t)=>{try{return e(...t)}catch(n){if(ky&&!0===ky(n))return()=>{};throw n}}:e,xy=[];function Ey(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Ty(e,t){const n=new yy;xy.push(n),n.init(e);let r=window.MutationObserver||window.__rrMutationObserver;const o=window?.Zone?.__symbol__?.("MutationObserver");o&&window[o]&&(r=window[o]);const i=new r(wy(t=>{e.onMutation&&!1===e.onMutation(t)||n.processMutations.bind(n)(t)}));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Cy({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,sampling:s}){return Bg("scroll",wy(Ug(wy(s=>{const a=Ey(s);if(!a||Gg(a,r,o,i,!0))return;const c=n.getId(a);if(a===t&&t.defaultView){const n=Wg(t.defaultView);e({id:c,x:n.left,y:n.top})}else e({id:c,x:a.scrollLeft,y:a.scrollTop})}),s.scroll||100)),t)}const Iy=["INPUT","TEXTAREA","SELECT"],Ay=new WeakMap;function Ry({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,ignoreClass:s,ignoreSelector:a,maskInputOptions:c,maskInputFn:u,sampling:l,userTriggeredOnInput:d,maskTextClass:f,unmaskTextClass:p,maskTextSelector:h,unmaskTextSelector:m}){function g(e){let n=Ey(e);const l=e.isTrusted,g=n&&ag(n.tagName);if("OPTION"===g&&(n=n.parentElement),!n||!g||Iy.indexOf(g)<0||Gg(n,r,o,i,!0))return;const v=n;if(v.classList.contains(s)||a&&v.matches(a))return;const _=ug(n);let b=lg(v,g,_),S=!1;const k=og({maskInputOptions:c,tagName:g,type:_}),w=Pg(n,f,h,p,m,k);"radio"!==_&&"checkbox"!==_||(S=n.checked),b=ig({isMasked:w,element:n,value:b,maskInputFn:u}),y(n,d?{text:b,isChecked:S,userTriggered:l}:{text:b,isChecked:S});const x=n.name;"radio"===_&&x&&S&&t.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(e=>{if(e!==n){const t=ig({isMasked:w,element:e,value:lg(e,g,_),maskInputFn:u});y(e,d?{text:t,isChecked:!S,userTriggered:!1}:{text:t,isChecked:!S})}})}function y(t,r){const o=Ay.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){Ay.set(t,r);const o=n.getId(t);wy(e)({...r,id:o})}}const v=("last"===l.input?["change"]:["input","change"]).map(e=>Bg(e,wy(g),t)),_=t.defaultView;if(!_)return()=>{v.forEach(e=>e())};const b=_.Object.getOwnPropertyDescriptor(_.HTMLInputElement.prototype,"value"),S=[[_.HTMLInputElement.prototype,"value"],[_.HTMLInputElement.prototype,"checked"],[_.HTMLSelectElement.prototype,"value"],[_.HTMLTextAreaElement.prototype,"value"],[_.HTMLSelectElement.prototype,"selectedIndex"],[_.HTMLOptionElement.prototype,"selected"]];return b&&b.set&&v.push(...S.map(e=>$g(e[0],e[1],{set(){wy(g)({target:this,isTrusted:!1})}},!1,_))),wy(()=>{v.forEach(e=>e())})}function My(e){return function(e,t){if(Ny("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Ny("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Ny("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Ny("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Oy(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function Dy({mirror:e,stylesheetManager:t},n){let r=null;r="#document"===n.nodeName?e.getId(n):e.getId(n.host);const o="#document"===n.nodeName?n.defaultView?.Document:n.ownerDocument?.defaultView?.ShadowRoot,i=o?.prototype?Object.getOwnPropertyDescriptor(o?.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&i?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return i.get?.call(this)},set(e){const n=i.set?.call(this,e);if(null!==r&&-1!==r)try{t.adoptStyleSheets(e,r)}catch(o){}return n}}),wy(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})})):()=>{}}function Ly(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;e.recordDOM&&(r=Ty(e,e.doc));const o=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=Ug(wy(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),i),u=wy(Ug(wy(e=>{const t=Ey(e),{clientX:n,clientY:o}=Qg(e)?e.changedTouches[0]:e;s||(s=qg()),a.push({x:n,y:o,id:r.getId(t),timeOffset:qg()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?uy.Drag:e instanceof MouseEvent?uy.MouseMove:uy.TouchMove)}),o,{trailing:!1})),l=[Bg("mousemove",u,n),Bg("touchmove",u,n),Bg("drag",u,n)];return wy(()=>{l.forEach(e=>e())})}(e),i=function({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const a=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,c=[];let u=null;return Object.keys(ly).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e]).forEach(s=>{let a=sg(s);const l=(t=>s=>{const a=Ey(s);if(Gg(a,r,o,i,!0))return;let c=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":c=dy.Mouse;break;case"touch":c=dy.Touch;break;case"pen":c=dy.Pen}c===dy.Touch&&(ly[t]===ly.MouseDown?l="TouchStart":ly[t]===ly.MouseUp&&(l="TouchEnd"))}else Qg(s)&&(c=dy.Touch);null!==c?(u=c,(l.startsWith("Touch")&&c===dy.Touch||l.startsWith("Mouse")&&c===dy.Mouse)&&(c=null)):ly[t]===ly.Click&&(c=u,u=null);const d=Qg(s)?s.changedTouches[0]:s;if(!d)return;const f=n.getId(a),{clientX:p,clientY:h}=d;wy(e)({type:ly[l],id:f,x:p,y:h,...null!==c&&{pointerType:c}})})(s);if(window.PointerEvent)switch(ly[s]){case ly.MouseDown:case ly.MouseUp:a=a.replace("mouse","pointer");break;case ly.TouchStart:case ly.TouchEnd:return}c.push(Bg(a,l,t))}),wy(()=>{c.forEach(e=>e())})}(e),s=Cy(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Bg("resize",wy(Ug(wy(()=>{const t=Hg(),o=Kg();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)}),200)),t)}(e,{win:n}),c=Ry(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,unblockSelector:r,mirror:o,sampling:i,doc:s}){const a=wy(s=>Ug(wy(i=>{const a=Ey(i);if(!a||Gg(a,t,n,r,!0))return;const{currentTime:c,volume:u,muted:l,playbackRate:d}=a;e({type:s,id:o.getId(a),currentTime:c,volume:u,muted:l,playbackRate:d})}),i.media||500)),c=[Bg("play",a(fy.Play),s),Bg("pause",a(fy.Pause),s),Bg("seeked",a(fy.Seeked),s),Bg("volumechange",a(fy.VolumeChange),s),Bg("ratechange",a(fy.RateChange),s)];return wy(()=>{c.forEach(e=>e())})}(e);let l=()=>{},d=()=>{},f=()=>{},p=()=>{};e.recordDOM&&(l=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:wy((r,o,i)=>{const[s,a]=i,{id:c,styleId:u}=Oy(o,t,n.styleMirror);return(c&&-1!==c||u&&-1!==u)&&e({id:c,styleId:u,adds:[{rule:s,index:a}]}),r.apply(o,i)})});const i=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:wy((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Oy(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:s}]}),r.apply(o,i)})}),r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:wy((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Oy(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:s}),r.apply(o,i)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:wy((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Oy(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:s}),r.apply(o,i)})}));const c={};Py("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(Py("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),Py("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),Py("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(c).forEach(([r,o])=>{u[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(u[r].insertRule,{apply:wy((r,o,i)=>{const[s,a]=i,{id:c,styleId:u}=Oy(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||u&&-1!==u)&&e({id:c,styleId:u,adds:[{rule:s,index:[...My(o),a||0]}]}),r.apply(o,i)})}),o.prototype.deleteRule=new Proxy(u[r].deleteRule,{apply:wy((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Oy(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...My(o),s]}]}),r.apply(o,i)})})}),wy(()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=i,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:n}),d=Dy(e,e.doc),f=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:wy((o,s,a)=>{const[c,u,l]=a;if(n.has(c))return i.apply(s,[c,u,l]);const{id:d,styleId:f}=Oy(s.parentRule?.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||f&&-1!==f)&&e({id:d,styleId:f,set:{property:c,value:u,priority:l},index:My(s.parentRule)}),o.apply(s,a)})});const s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:wy((o,i,a)=>{const[c]=a;if(n.has(c))return s.apply(i,[c]);const{id:u,styleId:l}=Oy(i.parentRule?.parentStyleSheet,t,r.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,remove:{property:c},index:My(i.parentRule)}),o.apply(i,a)})}),wy(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,i=n.FontFace;n.FontFace=function(e,t,n){const r=new i(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const s=Vg(t.fonts,"add",function(t){return function(n){return ay(wy(()=>{const t=o.get(n);t&&(e(t),o.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=i}),r.push(s),wy(()=>{r.forEach(e=>e())})}(e)));const h=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,selectionCb:s}=e;let a=!0;const c=wy(()=>{const e=t.getSelection();if(!e||a&&e?.isCollapsed)return;a=e.isCollapsed||!1;const c=[],u=e.rangeCount||0;for(let t=0;t{}}(e),g=[];for(const y of e.plugins)g.push(y.observer(y.callback,n,y.options));return wy(()=>{xy.forEach(e=>e.reset()),r?.disconnect(),o(),i(),s(),a(),c(),u(),l(),d(),f(),p(),h(),m(),g.forEach(e=>e())})}function Ny(e){return void 0!==window[e]}function Py(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class jy{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let s=o.get(t);return s||(s=this.generateIdFn(),o.set(t,s),i.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;return r.get(t)||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Fy{constructor(){this.crossOriginIframeMirror=new jy(_g),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class By{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new jy(_g),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new jy(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&e.contentWindow?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(e);const n=py(e);n&&n.adoptedStyleSheets&&n.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(n.adoptedStyleSheets,this.mirror.getId(n))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case cy.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:cy.IncrementalSnapshot,data:{source:uy.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case cy.Meta:case cy.Load:case cy.DomContentLoaded:return!1;case cy.Plugin:return t;case cy.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case cy.IncrementalSnapshot:switch(t.data.source){case uy.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case uy.Drag:case uy.TouchMove:case uy.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case uy.ViewportResize:return!1;case uy.MediaInteraction:case uy.MouseInteraction:case uy.Scroll:case uy.CanvasMutation:case uy.Input:return this.replaceIds(t.data,e,["id"]),t;case uy.StyleSheetRule:case uy.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case uy.Font:return t;case uy.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case uy.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),t.data.styles?.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===Qm.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class zy{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class Uy{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!eg(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);const n=Ty({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Cy({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),ay(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Dy({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){const t=py(e),n=function(e){try{return e.contentWindow}catch(t){}}(e);t&&n&&this.patchAttachShadow(n.Element,t)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Vg(e.prototype,"attachShadow",function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&oy(this)&&n.addShadowRoot(this.shadowRoot,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}for(var $y="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Vy=0;Vy<64;Vy++)$y["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(Vy)]=Vy;class qy{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class Wy{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new ny,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const o of e){let e;this.styleMirror.has(o)?e=this.styleMirror.getId(o):(e=this.styleMirror.add(o),r.push({styleId:e,rules:Array.from(o.rules||CSSRule,(e,t)=>({rule:ng(e),index:t}))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Hy{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,function(...e){sy("requestAnimationFrame")(...e)}(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let Ky,Yy;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(DE){}const Gy=new rg;function Jy(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:i=null,unblockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskAllText:u=!1,maskTextClass:l="rr-mask",unmaskTextClass:d=null,maskTextSelector:f=null,unmaskTextSelector:p=null,inlineStylesheet:h=!0,maskAllInputs:m,maskInputOptions:g,slimDOMOptions:y,maskAttributeFn:v,maskInputFn:_,maskTextFn:b,maxCanvasSize:S=null,packFn:k,sampling:w={},dataURLOptions:x={},mousemoveWait:E,recordDOM:T=!0,recordCanvas:C=!1,recordCrossOriginIframes:I=!1,recordAfter:A=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:M=!1,inlineImages:O=!1,plugins:D,keepIframeSrcFn:L=()=>!1,ignoreCSSAttributes:N=new Set([]),errorHandler:P,onMutation:j,getCanvasManager:F}=e;ky=P;const B=!I||window.parent===window;let z=!1;if(!B)try{window.parent.document&&(z=!1)}catch(te){z=!0}if(B&&!t)throw new Error("emit function is required");if(!B&&!z)return()=>{};void 0!==E&&void 0===w.mousemove&&(w.mousemove=E),Gy.reset();const U=!0===m?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:void 0!==g?g:{},$=!0===y||"all"===y?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===y,headMetaDescKeywords:"all"===y}:y||{};let V;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let q=0;const W=e=>{for(const t of D||[])t.eventProcessor&&(e=t.eventProcessor(e));return k&&!z&&(e=k(e)),e};Ky=(e,o)=>{const i=e;if(i.timestamp=qg(),!xy[0]?.isFrozen()||i.type===cy.FullSnapshot||i.type===cy.IncrementalSnapshot&&i.data.source===uy.Mutation||xy.forEach(e=>e.unfreeze()),B)t?.(W(i),o);else if(z){const e={type:"rrweb",event:W(i),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,"*")}if(i.type===cy.FullSnapshot)V=i,q=0;else if(i.type===cy.IncrementalSnapshot){if(i.data.source===uy.Mutation&&i.data.isAttachIframe)return;q++;const e=r&&q>=r,t=n&&V&&i.timestamp-V.timestamp>n;(e||t)&&ee(!0)}};const H=e=>{Ky({type:cy.IncrementalSnapshot,data:{source:uy.Mutation,...e}})},K=e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.Scroll,...e}}),Y=e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.CanvasMutation,...e}}),G=new Wy({mutationCb:H,adoptedStyleSheetCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.AdoptedStyleSheet,...e}})}),J="boolean"==typeof __RRWEB_EXCLUDE_IFRAME__&&__RRWEB_EXCLUDE_IFRAME__?new Fy:new By({mirror:Gy,mutationCb:H,stylesheetManager:G,recordCrossOriginIframes:I,wrappedEmit:Ky});for(const re of D||[])re.getMirror&&re.getMirror({nodeMirror:Gy,crossOriginIframeMirror:J.crossOriginIframeMirror,crossOriginIframeStyleMirror:J.crossOriginIframeStyleMirror});const X=new Hy,Q=function(e,t){try{return e?e(t):new qy}catch{return new qy}}(F,{mirror:Gy,win:window,mutationCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.CanvasMutation,...e}}),recordCanvas:C,blockClass:o,blockSelector:i,unblockSelector:s,maxCanvasSize:S,sampling:w.canvas,dataURLOptions:x,errorHandler:P}),Z="boolean"==typeof __RRWEB_EXCLUDE_SHADOW_DOM__&&__RRWEB_EXCLUDE_SHADOW_DOM__?new zy:new Uy({mutationCb:H,scrollCb:K,bypassOptions:{onMutation:j,blockClass:o,blockSelector:i,unblockSelector:s,maskAllText:u,maskTextClass:l,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:h,maskInputOptions:U,dataURLOptions:x,maskAttributeFn:v,maskTextFn:b,maskInputFn:_,recordCanvas:C,inlineImages:O,sampling:w,slimDOMOptions:$,iframeManager:J,stylesheetManager:G,canvasManager:Q,keepIframeSrcFn:L,processedNodeManager:X},mirror:Gy}),ee=(e=!1)=>{if(!T)return;Ky({type:cy.Meta,data:{href:window.location.href,width:Kg(),height:Hg()}},e),G.reset(),Z.init(),xy.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new rg,blockClass:r="rr-block",blockSelector:o=null,unblockSelector:i=null,maskAllText:s=!1,maskTextClass:a="rr-mask",unmaskTextClass:c=null,maskTextSelector:u=null,unmaskTextSelector:l=null,inlineStylesheet:d=!0,inlineImages:f=!1,recordCanvas:p=!1,maskAllInputs:h=!1,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOM:v=!1,dataURLOptions:_,preserveWhiteSpace:b,onSerialize:S,onIframeLoad:k,iframeLoadTimeout:w,onBlockedImageLoad:x,onStylesheetLoad:E,stylesheetLoadTimeout:T,keepIframeSrcFn:C=()=>!1}=t||{};return Fg(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,maskAllText:s,maskTextClass:a,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===h?{}:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:!0===v||"all"===v?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===v,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===v?{}:v,dataURLOptions:_,inlineImages:f,recordCanvas:p,preserveWhiteSpace:b,onSerialize:S,onIframeLoad:k,iframeLoadTimeout:w,onBlockedImageLoad:x,onStylesheetLoad:E,stylesheetLoadTimeout:T,keepIframeSrcFn:C,newlyAddedElement:!1})}(document,{mirror:Gy,blockClass:o,blockSelector:i,unblockSelector:s,maskAllText:u,maskTextClass:l,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:h,maskAllInputs:U,maskAttributeFn:v,maskInputFn:_,maskTextFn:b,slimDOM:$,dataURLOptions:x,recordCanvas:C,inlineImages:O,onSerialize:e=>{Zg(e,Gy)&&J.addIframe(e),ey(e,Gy)&&G.trackLinkElement(e),ty(e)&&Z.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{J.attachIframe(e,t),e.contentWindow&&Q.addWindow(e.contentWindow),Z.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{G.attachLinkElement(e,t)},onBlockedImageLoad:(e,t,{width:n,height:r})=>{H({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:{style:{width:`${n}px`,height:`${r}px`}}}]})},keepIframeSrcFn:L});t&&(Ky({type:cy.FullSnapshot,data:{node:t,initialOffset:Wg(window)}}),xy.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&G.adoptStyleSheets(document.adoptedStyleSheets,Gy.getId(document)))};Yy=ee;try{const e=[],t=e=>wy(Ly)({onMutation:j,mutationCb:H,mousemoveCb:(e,t)=>Ky({type:cy.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.MouseInteraction,...e}}),scrollCb:K,viewportResizeCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.ViewportResize,...e}}),inputCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.Input,...e}}),mediaInteractionCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.MediaInteraction,...e}}),styleSheetRuleCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.StyleSheetRule,...e}}),styleDeclarationCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.StyleDeclaration,...e}}),canvasMutationCb:Y,fontCb:e=>Ky({type:cy.IncrementalSnapshot,data:{source:uy.Font,...e}}),selectionCb:e=>{Ky({type:cy.IncrementalSnapshot,data:{source:uy.Selection,...e}})},customElementCb:e=>{Ky({type:cy.IncrementalSnapshot,data:{source:uy.CustomElement,...e}})},blockClass:o,ignoreClass:a,ignoreSelector:c,maskAllText:u,maskTextClass:l,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:p,maskInputOptions:U,inlineStylesheet:h,sampling:w,recordDOM:T,recordCanvas:C,inlineImages:O,userTriggeredOnInput:R,collectFonts:M,doc:e,maskAttributeFn:v,maskInputFn:_,maskTextFn:b,keepIframeSrcFn:L,blockSelector:i,unblockSelector:s,slimDOMOptions:$,dataURLOptions:x,mirror:Gy,iframeManager:J,stylesheetManager:G,shadowDomManager:Z,processedNodeManager:X,canvasManager:Q,ignoreCSSAttributes:N,plugins:D?.filter(e=>e.observer)?.map(e=>({observer:e.observer,options:e.options,callback:t=>Ky({type:cy.Plugin,data:{plugin:e.name,payload:t}})}))||[]},{});J.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(r){}});const n=()=>{ee(),e.push(t(document))};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Bg("DOMContentLoaded",()=>{Ky({type:cy.DomContentLoaded,data:{}}),"DOMContentLoaded"===A&&n()})),e.push(Bg("load",()=>{Ky({type:cy.Load,data:{}}),"load"===A&&n()},window))),()=>{e.forEach(e=>e()),X.destroy(),Yy=void 0,ky=void 0}}catch(ne){}}var Xy,Qy;function Zy(e){return e>9999999999?e:1e3*e}function ev(e){return e>9999999999?e/1e3:e}function tv(e,t){"sentry.transaction"!==t.category&&(["ui.click","ui.input"].includes(t.category)?e.triggerUserActivity():e.checkAndHandleExpiredSession(),e.addUpdate(()=>(e.throttledAddEvent({type:cy.Custom,timestamp:1e3*(t.timestamp||0),data:{tag:"breadcrumb",payload:md(t,10,1e3)}}),"console"===t.category)))}function nv(e){return e.closest("button,a")||e}function rv(e){const t=ov(e);return t&&t instanceof Element?nv(t):t}function ov(e){return function(e){return"object"==typeof e&&!!e&&"target"in e}(e)?e.target:e}let iv;Jy.mirror=Gy,Jy.takeFullSnapshot=function(e){if(!Yy)throw new Error("please take full snapshot after start recording");Yy(e)},(Qy=Xy||(Xy={}))[Qy.NotStarted=0]="NotStarted",Qy[Qy.Running=1]="Running",Qy[Qy.Stopped=2]="Stopped";const sv=new Set([uy.Mutation,uy.StyleSheetRule,uy.StyleDeclaration,uy.AdoptedStyleSheet,uy.CanvasMutation,uy.Selection,uy.MediaInteraction]);class av{constructor(e,t,n=tv){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=t.timeout/1e3,this._threshold=t.threshold/1e3,this._scrollTimeout=t.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=t.ignoreSelector,this._addBreadcrumbEvent=n}addListeners(){const e=(t=()=>{this._lastMutation=uv()},iv||(iv=[],Tu(qm,"open",function(e){return function(...t){if(iv)try{iv.forEach(e=>e())}catch{}return e.apply(qm,t)}})),iv.push(t),()=>{const e=iv?iv.indexOf(t):-1;e>-1&&iv.splice(e,1)});var t;this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,t){if(function(e,t){return!cv.includes(e.tagName)||("INPUT"===e.tagName&&!["submit","button"].includes(e.getAttribute("type")||"")||(!("A"!==e.tagName||!(e.hasAttribute("download")||e.hasAttribute("target")&&"_self"!==e.getAttribute("target")))||!(!t||!e.matches(t))))}(t,this._ignoreSelector)||!function(e){return!(!e.data||"number"!=typeof e.data.nodeId||!e.timestamp)}(e))return;const n={timestamp:ev(e.timestamp),clickBreadcrumb:e,clickCount:0,node:t};this._clicks.some(e=>e.node===n.node&&Math.abs(e.timestamp-n.timestamp)<1)||(this._clicks.push(n),1===this._clicks.length&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=ev(e)}registerScroll(e=Date.now()){this._lastScroll=ev(e)}registerClick(e){const t=nv(e);this._handleMultiClick(t)}_handleMultiClick(e){this._getClicks(e).forEach(e=>{e.clickCount++})}_getClicks(e){return this._clicks.filter(t=>t.node===e)}_checkClicks(){const e=[],t=uv();this._clicks.forEach(n=>{!n.mutationAfter&&this._lastMutation&&(n.mutationAfter=n.timestamp<=this._lastMutation?this._lastMutation-n.timestamp:void 0),!n.scrollAfter&&this._lastScroll&&(n.scrollAfter=n.timestamp<=this._lastScroll?this._lastScroll-n.timestamp:void 0),n.timestamp+this._timeout<=t&&e.push(n)});for(const n of e){const e=this._clicks.indexOf(n);e>-1&&(this._generateBreadcrumbs(n),this._clicks.splice(e,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){const t=this._replay,n=e.scrollAfter&&e.scrollAfter<=this._scrollTimeout,r=e.mutationAfter&&e.mutationAfter<=this._threshold,o=!n&&!r,{clickCount:i,clickBreadcrumb:s}=e;if(o){const n=1e3*Math.min(e.mutationAfter||this._timeout,this._timeout),r=n<1e3*this._timeout?"mutation":"timeout",o={type:"default",message:s.message,timestamp:s.timestamp,category:"ui.slowClickDetected",data:{...s.data,url:qm.location.href,route:t.getCurrentRoute(),timeAfterClickMs:n,endReason:r,clickCount:i||1}};return void this._addBreadcrumbEvent(t,o)}if(i>1){const e={type:"default",message:s.message,timestamp:s.timestamp,category:"ui.multiClick",data:{...s.data,url:qm.location.href,route:t.getCurrentRoute(),clickCount:i,metric:!0}};this._addBreadcrumbEvent(t,e)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=dm(()=>this._checkClicks(),1e3)}}const cv=["A","BUTTON","INPUT"];function uv(){return Date.now()/1e3}function lv(e){return{timestamp:Date.now()/1e3,type:"default",...e}}var dv=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(dv||{});const fv=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function pv(e){const t={};!e["data-sentry-component"]&&e["data-sentry-element"]&&(e["data-sentry-component"]=e["data-sentry-element"]);for(const n in e)if(fv.has(n)){let r=n;"data-testid"!==n&&"data-test-id"!==n||(r="testId"),t[r]=e[n]}return t}function hv(e,t){const n=Jy.mirror.getId(e),r=n&&Jy.mirror.getNode(n),o=r&&Jy.mirror.getMeta(r),i=o&&function(e){return e.type===dv.Element}(o)?o:null;return{message:t,data:i?{nodeId:n,node:{id:n,tagName:i.tagName,textContent:Array.from(i.childNodes).map(e=>e.type===dv.Text&&e.textContent).filter(Boolean).map(e=>e.trim()).join(""),attributes:pv(i.attributes)}}:{}}}const mv={resource:function(e){const{entryType:t,initiatorType:n,name:r,responseEnd:o,startTime:i,decodedBodySize:s,encodedBodySize:a,responseStatus:c,transferSize:u}=e;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${t}.${n}`,start:vv(i),end:vv(o),name:r,data:{size:u,statusCode:c,decodedBodySize:s,encodedBodySize:a}}},paint:function(e){const{duration:t,entryType:n,name:r,startTime:o}=e,i=vv(o);return{type:n,name:r,start:i,end:i+t,data:void 0}},navigation:function(e){const{entryType:t,name:n,decodedBodySize:r,duration:o,domComplete:i,encodedBodySize:s,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,domInteractive:u,loadEventStart:l,loadEventEnd:d,redirectCount:f,startTime:p,transferSize:h,type:m}=e;return 0===o?null:{type:`${t}.${m}`,start:vv(p),end:vv(i),name:n,data:{size:h,decodedBodySize:r,encodedBodySize:s,duration:o,domInteractive:u,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,loadEventStart:l,loadEventEnd:d,domComplete:i,redirectCount:f}}}};function gv(e,t){return({metric:n})=>{t.replayPerformanceEntries.push(e(n))}}function yv(e){const t=mv[e.entryType];return t?t(e):null}function vv(e){return((qu()||qm.performance.timeOrigin)+e)/1e3}function _v(e){const t=e.entries[e.entries.length-1];return wv(e,"largest-contentful-paint",t?.element?[t.element]:void 0)}function bv(e){return void 0!==e.sources}function Sv(e){const t=[],n=[];for(const r of e.entries)if(bv(r)){const e=[];for(const t of r.sources)if(t.node){n.push(t.node);const r=Jy.mirror.getId(t.node);r&&e.push(r)}t.push({value:r.value,nodeIds:e.length?e:void 0})}return wv(e,"cumulative-layout-shift",n,t)}function kv(e){const t=e.entries[e.entries.length-1];return wv(e,"interaction-to-next-paint",t?.target?[t.target]:void 0)}function wv(e,t,n,r){const o=e.value,i=e.rating,s=vv(o);return{type:"web-vital",name:t,start:s,end:s,data:{value:o,size:o,rating:i,nodeIds:n?n.map(e=>Jy.mirror.getId(e)):void 0,attributions:r}}}const xv="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Ev=["log","warn","error"],Tv="[Replay] ";function Cv(e,t="info"){Yf({category:"console",data:{logger:"replay"},level:t,message:`${Tv}${e}`},{level:t})}const Iv=function(){let e=!1,t=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:n=>{e=!!n.captureExceptions,t=!!n.traceInternals}};return xv?(Ev.forEach(e=>{n[e]=(...n)=>{jc[e](Tv,...n),t&&Cv(n.join(""),cp(e))}}),n.exception=(r,...o)=>{o.length&&n.error&&n.error(...o),jc.error(Tv,r),e?rf(r,{mechanism:{handled:!0,type:"auto.function.replay.debug"}}):t&&Cv(r,"error")},n.infoTick=(...e)=>{jc.log(Tv,...e),t&&setTimeout(()=>Cv(e[0]),0)}):Ev.forEach(e=>{n[e]=()=>{}}),n}();class Av extends Error{constructor(){super("Event buffer exceeded maximum size of 20000000.")}}class Rv{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(e){const t=JSON.stringify(e).length;if(this._totalSize+=t,this._totalSize>Gm)throw new Av;this.events.push(e)}finish(){return new Promise(e=>{const t=this.events;this.clear(),e(JSON.stringify(t))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const e=this.events.map(e=>e.timestamp).sort()[0];return e?Zy(e):null}}class Mv{constructor(e){this._worker=e,this._id=0}ensureReady(){return this._ensureReadyPromise||(this._ensureReadyPromise=new Promise((e,t)=>{this._worker.addEventListener("message",({data:n})=>{n.success?e():t()},{once:!0}),this._worker.addEventListener("error",e=>{t(e)},{once:!0})})),this._ensureReadyPromise}destroy(){xv&&Iv.log("Destroying compression worker"),this._worker.terminate()}postMessage(e,t){const n=this._getAndIncrementId();return new Promise((r,o)=>{const i=({data:t})=>{const s=t;if(s.method===e&&s.id===n){if(this._worker.removeEventListener("message",i),!s.success)return xv&&Iv.error("Error in compression worker: ",s.response),void o(new Error("Error in compression worker"));r(s.response)}};this._worker.addEventListener("message",i),this._worker.postMessage({id:n,method:e,arg:t})})}_getAndIncrementId(){return this._id++}}class Ov{constructor(e){this._worker=new Mv(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){const t=Zy(e.timestamp);(!this._earliestTimestamp||tGm?Promise.reject(new Av):this._sendEventToWorker(n)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{xv&&Iv.exception(e,'Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}async _finishRequest(){const e=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e}}class Dv{constructor(e){this._fallback=new Rv,this._compression=new Ov(e),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}set waitForCheckout(e){this._used.waitForCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(e){return void(xv&&Iv.exception(e,"Failed to load the compression worker, falling back to simple buffer"))}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:t,waitForCheckout:n}=this._fallback,r=[];for(const i of e)r.push(this._compression.addEvent(i));this._compression.hasCheckout=t,this._compression.waitForCheckout=n,this._used=this._compression;try{await Promise.all(r),this._fallback.clear()}catch(o){xv&&Iv.exception(o,"Failed to add events when switching buffers.")}}}function Lv(){try{return"sessionStorage"in qm&&!!qm.sessionStorage}catch{return!1}}function Nv(e){return void 0!==e&&Math.random()e.getContext().initialTimestamp+e.getOptions().maxReplayDuration&&(xv&&Iv.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),1))}function Hv(e){return!e.type}function Kv(e){return"transaction"===e.type}function Yv(e){return"feedback"===e.type}function Gv(e){return!!e.category}function Jv(){const e=il().getPropagationContext().dsc;e&&delete e.replay_id;const t=ed();t&&delete pd(t).replay_id}function Xv(e,t){return t.map(({type:t,start:n,end:r,name:o,data:i})=>{const s=e.throttledAddEvent({type:cy.Custom,timestamp:n,data:{tag:"performanceSpan",payload:{op:t,description:o,startTimestamp:n,endTimestamp:r,data:i}}});return"string"==typeof s?Promise.resolve(null):s})}function Qv(e,t){e.isEnabled()&&null!==t&&(function(e,t){return(!xv||!e.getOptions()._experiments.traceInternals)&&function(e,t){const n=t?.getDsn(),r=t?.getOptions().tunnel;return function(e,t){const n=zf(e);return!(!n||Bf(n))&&!!t&&n.host.includes(t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}(e,n)||function(e,t){return!!t&&Vf(e)===Vf(t)}(e,r)}(t,cl())}(e,t.name)||e.addUpdate(()=>(Xv(e,[t]),!0)))}function Zv(e){if(!e)return;const t=new TextEncoder;try{if("string"==typeof e)return t.encode(e).length;if(e instanceof URLSearchParams)return t.encode(e.toString()).length;if(e instanceof FormData){const n=mm(e);return t.encode(n).length}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength}catch{}}function e_(e){if(!e)return;const t=parseInt(e,10);return isNaN(t)?void 0:t}function t_(e,t){if(!e)return{headers:{},size:void 0,_meta:{warnings:[t]}};const n={...e._meta},r=n.warnings||[];return n.warnings=[...r,t],e._meta=n,e}function n_(e,t){if(!t)return null;const{startTimestamp:n,endTimestamp:r,url:o,method:i,statusCode:s,request:a,response:c}=t;return{type:e,start:n/1e3,end:r/1e3,name:o,data:{method:i,statusCode:s,request:a,response:c}}}function r_(e){return{headers:{},size:e,_meta:{warnings:["URL_SKIPPED"]}}}function o_(e,t,n){if(!t&&0===Object.keys(e).length)return;if(!t)return{headers:e};if(!n)return{headers:e,size:t};const r={headers:e,size:t},{body:o,warnings:i}=function(e){if(!e||"string"!=typeof e)return{body:e};const t=e.length>Km,n=function(e){const t=e[0],n=e[e.length-1];return"["===t&&"]"===n||"{"===t&&"}"===n}(e);if(t){const t=e.slice(0,Km);return n?{body:t,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${t}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(e)}}catch{}return{body:e}}(n);return r.body=o,i?.length&&(r._meta={warnings:i}),r}function i_(e,t){return Object.entries(e).reduce((n,[r,o])=>{const i=r.toLowerCase();return t.includes(i)&&e[r]&&(n[i]=o),n},{})}function s_(e,t){const n=function(e,t=qm.document.baseURI){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith(qm.location.origin))return e;const n=new URL(e,t);if(n.origin!==new URL(t).origin)return e;const r=n.href;return!e.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}(e);return Eu(n,t)}function a_(e,t){const n={};return t.forEach(t=>{e.get(t)&&(n[t]=e.get(t))}),n}function c_(e,t){if(!e)return{};const n=e.headers;return n?n instanceof Headers?a_(n,t):Array.isArray(n)?{}:i_(n,t):{}}function u_(e){const t=cl();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:o,networkRequestHeaders:i,networkResponseHeaders:s}=e.getOptions(),a={replay:e,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:o,networkRequestHeaders:i,networkResponseHeaders:s};t&&t.on("beforeAddBreadcrumb",(e,t)=>function(e,t,n){if(t.data)try{(function(e){return"xhr"===e.category})(t)&&function(e){return e?.xhr}(n)&&(function(e,t){const{xhr:n,input:r}=t;if(!n)return;const o=Zv(r),i=n.getResponseHeader("content-length")?e_(n.getResponseHeader("content-length")):function(e,t){try{return Zv("json"===t&&e&&"object"==typeof e?JSON.stringify(e):e)}catch{return}}(n.response,n.responseType);void 0!==o&&(e.data.request_body_size=o),void 0!==i&&(e.data.response_body_size=i)}(t,n),async function(e,t,n){try{const r=function(e,t,n){const r=Date.now(),{startTimestamp:o=r,endTimestamp:i=r,input:s,xhr:a}=t,{url:c,method:u,status_code:l=0,request_body_size:d,response_body_size:f}=e.data;if(!c)return null;if(!a||!s_(c,n.networkDetailAllowUrls)||s_(c,n.networkDetailDenyUrls))return{startTimestamp:o,endTimestamp:i,url:c,method:u,statusCode:l,request:r_(d),response:r_(f)};const p=a[fm],h=p?i_(p.request_headers,n.networkRequestHeaders):{},m=i_(vm(a),n.networkResponseHeaders),[g,y]=n.networkCaptureBodies?gm(s,Iv):[void 0],[v,_]=n.networkCaptureBodies?function(e){const t=[];try{return[e.responseText]}catch(n){t.push(n)}try{return function(e,t){try{if("string"==typeof e)return[e];if(e instanceof Document)return[e.body.outerHTML];if("json"===t&&e&&"object"==typeof e)return[JSON.stringify(e)];if(!e)return[void 0]}catch(n){return xv&&Iv.exception(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return xv&&Iv.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}(e.response,e.responseType)}catch(n){t.push(n)}return xv&&Iv.warn("Failed to get xhr response body",...t),[void 0]}(a):[void 0],b=o_(h,d,g),S=o_(m,f,v);return{startTimestamp:o,endTimestamp:i,url:c,method:u,statusCode:l,request:y?t_(b,y):b,response:_?t_(S,_):S}}(e,t,n),o=n_("resource.xhr",r);Qv(n.replay,o)}catch(r){xv&&Iv.exception(r,"Failed to capture xhr breadcrumb")}}(t,n,e)),function(e){return"fetch"===e.category}(t)&&function(e){return e?.response}(n)&&(function(e,t){const{input:n,response:r}=t,o=Zv(n?ym(n):void 0),i=r?e_(r.headers.get("content-length")):void 0;void 0!==o&&(e.data.request_body_size=o),void 0!==i&&(e.data.response_body_size=i)}(t,n),async function(e,t,n){try{const r=await async function(e,t,n){const r=Date.now(),{startTimestamp:o=r,endTimestamp:i=r}=t,{url:s,method:a,status_code:c=0,request_body_size:u,response_body_size:l}=e.data,d=s_(s,n.networkDetailAllowUrls)&&!s_(s,n.networkDetailDenyUrls),f=d?function({networkCaptureBodies:e,networkRequestHeaders:t},n,r){const o=n?(s=t,1===(i=n).length&&"string"!=typeof i[0]?c_(i[0],s):2===i.length?c_(i[1],s):{}):{};var i,s;if(!e)return o_(o,r,void 0);const a=ym(n),[c,u]=gm(a,Iv),l=o_(o,r,c);return u?t_(l,u):l}(n,t.input,u):r_(u),p=await async function(e,{networkCaptureBodies:t,networkResponseHeaders:n},r,o){if(!e&&void 0!==o)return r_(o);const i=r?a_(r.headers,n):{};if(!r||!t&&void 0!==o)return o_(i,o,void 0);const[s,a]=await async function(e){const t=function(e){try{return e.clone()}catch(t){xv&&Iv.exception(t,"Failed to clone response body")}}(e);if(!t)return[void 0,"BODY_PARSE_ERROR"];try{const e=await function(e){return new Promise((t,n)=>{const r=dm(()=>n(new Error("Timeout while trying to read response body")),500);(async function(e){return await e.text()})(e).then(e=>t(e),e=>n(e)).finally(()=>clearTimeout(r))})}(t);return[e]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(xv&&Iv.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(xv&&Iv.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}(r),c=function(e,{networkCaptureBodies:t,responseBodySize:n,captureDetails:r,headers:o}){try{const i=e?.length&&void 0===n?Zv(e):n;return r?o_(o,i,t?e:void 0):r_(i)}catch(i){return xv&&Iv.exception(i,"Failed to serialize response body"),o_(o,n,void 0)}}(s,{networkCaptureBodies:t,responseBodySize:o,captureDetails:e,headers:i});return a?t_(c,a):c}(d,n,t.response,l);return{startTimestamp:o,endTimestamp:i,url:s,method:a,statusCode:c,request:f,response:p}}(e,t,n),o=n_("resource.fetch",r);Qv(n.replay,o)}catch(r){xv&&Iv.exception(r,"Failed to capture fetch breadcrumb")}}(t,n,e))}catch(r){xv&&Iv.exception(r,"Error when enriching network breadcrumb")}}(a,e,t))}catch{}}function l_(e){const t=cl();om((e=>t=>{if(!e.isEnabled())return;const n=function(e){const{target:t,message:n}=function(e){const t="click"===e.name;let n,r=null;try{r=t?rv(e.event):ov(e.event),n=vu(r,{maxStringLength:200})||""}catch{n=""}return{target:r,message:n}}(e);return lv({category:`ui.${e.name}`,...hv(t,n)})}(t);if(!n)return;const r="click"===t.name,o=r?t.event:void 0;var i,s,a;!(r&&e.clickDetector&&o?.target)||o.altKey||o.metaKey||o.ctrlKey||o.shiftKey||(i=e.clickDetector,s=n,a=rv(t.event),i.handleClick(s,a)),tv(e,n)})(e)),am(function(e){return t=>{if(!e.isEnabled())return;const n=function(e){const{from:t,to:n}=e,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:t}}}(t);null!==n&&(e.getContext().urls.push(n.name),e.triggerUserActivity(),e.addUpdate(()=>(Xv(e,[n]),!1)))}}(e)),function(e){const t=cl();t&&t.on("beforeAddBreadcrumb",t=>function(e,t){if(!e.isEnabled()||!Gv(t))return;const n=function(e){return!Gv(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui.")?null:"console"===e.category?function(e){const t=e.data?.arguments;if(!Array.isArray(t)||0===t.length)return lv(e);let n=!1;const r=t.map(e=>{if(!e)return e;if("string"==typeof e)return e.length>Ym?(n=!0,`${e.slice(0,Ym)}…`):e;if("object"==typeof e)try{const t=md(e,7);return JSON.stringify(t).length>Ym?(n=!0,`${JSON.stringify(t,null,2).slice(0,Ym)}…`):t}catch{}return e});return lv({...e,data:{...e.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}(e):lv(e)}(t);n&&tv(e,n)}(e,t))}(e),u_(e);const n=function(e){return Object.assign((t,n)=>{if(!e.isEnabled()||e.isPaused())return t;if(function(e){return"replay_event"===e.type}(t))return delete t.breadcrumbs,t;if(!Hv(t)&&!Kv(t)&&!Yv(t))return t;if(!e.checkAndHandleExpiredSession())return Jv(),t;if(Yv(t))return e.flush(),t.contexts.feedback.replay_id=e.getSessionId(),function(e,t){e.triggerUserActivity(),e.addUpdate(()=>!t.timestamp||(e.throttledAddEvent({type:cy.Custom,timestamp:1e3*t.timestamp,data:{tag:"breadcrumb",payload:{timestamp:t.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:t.event_id}}}}),!1))}(e,t),t;if(function(e,t){return!(e.type||!e.exception?.values?.length||!t.originalException?.__rrweb__)}(t,n)&&!e.getOptions()._experiments.captureExceptions)return xv&&Iv.log("Ignoring error from rrweb internals",t),null;const r=function(e,t){return"buffer"===e.recordingMode&&t.message!==Hm&&!(!t.exception||t.type)&&Nv(e.getOptions().errorSampleRate)}(e,t);return(r||"session"===e.recordingMode)&&(t.tags={...t.tags,replayId:e.getSessionId()}),t},{id:"Replay"})}(e);var r;r=n,sl().addEventProcessor(r),t&&(t.on("beforeSendEvent",function(e){return t=>{e.isEnabled()&&Hv(t)&&function(e,t){const n=t.exception?.values?.[0]?.value;"string"==typeof n&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))&&tv(e,lv({category:"replay.hydrate-error",data:{url:bu()}}))}(e,t)}}(e)),t.on("afterSendEvent",function(e){return(t,n)=>{if(!e.isEnabled()||!Hv(t)&&!Kv(t))return;const r=n.statusCode;!r||r<200||r>=300||(Kv(t)?function(e,t){const n=e.getContext();t.contexts?.trace?.trace_id&&n.traceIds.size<100&&n.traceIds.add(t.contexts.trace.trace_id)}(e,t):function(e,t){const n=e.getContext();if(t.event_id&&n.errorIds.size<100&&n.errorIds.add(t.event_id),"buffer"!==e.recordingMode||!t.tags||!t.tags.replayId)return;const{beforeErrorSampling:r}=e.getOptions();("function"!=typeof r||r(t))&&dm(async()=>{try{await e.sendBufferedReplayOrFlush()}catch(DE){e.handleException(DE)}})}(e,t))}}(e)),t.on("createDsc",t=>{const n=e.getSessionId();n&&e.isEnabled()&&"session"===e.recordingMode&&e.checkAndHandleExpiredSession()&&(t.replay_id=n)}),t.on("spanStart",t=>{e.lastActiveSpan=t}),t.on("spanEnd",t=>{e.lastActiveSpan=t}),t.on("beforeSendFeedback",async(t,n)=>{const r=e.getSessionId();n?.includeReplay&&e.isEnabled()&&r&&t.contexts?.feedback&&("api"===t.contexts.feedback.source&&await e.sendBufferedReplayOrFlush(),t.contexts.feedback.replay_id=r)}),t.on("openFeedbackWidget",async()=>{await e.sendBufferedReplayOrFlush()}))}function d_(e){const{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}=e,o=Date.now()/1e3;return{type:"memory",name:"memory",start:o,end:o,data:{memory:{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}}}}const f_=Tc.navigator;function p_(e){let t=!1;return(n,r)=>{if(!e.checkAndHandleExpiredSession())return void(xv&&Iv.warn("Received replay event after session expired."));const o=r||!t;t=!0,e.clickDetector&&function(e,t){try{if(!function(e){return 3===e.type}(t))return;const{source:n}=t.data;if(sv.has(n)&&e.registerMutation(t.timestamp),n===uy.Scroll&&e.registerScroll(t.timestamp),function(e){return e.data.source===uy.MouseInteraction}(t)){const{type:n,id:r}=t.data,o=Jy.mirror.getNode(r);o instanceof HTMLElement&&n===ly.Click&&e.registerClick(o)}}catch{}}(e.clickDetector,n),e.addUpdate(()=>{if("buffer"===e.recordingMode&&o&&e.setInitialState(),!Vv(e,n,o))return!0;if(!o)return!1;const t=e.session;if(function(e,t){t&&e.session&&0===e.session.segmentId&&Vv(e,function(e){const t=e.getOptions();return{type:cy.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:e.isRecordingCanvas(),sessionSampleRate:t.sessionSampleRate,errorSampleRate:t.errorSampleRate,useCompressionOption:t.useCompression,blockAllMedia:t.blockAllMedia,maskAllText:t.maskAllText,maskAllInputs:t.maskAllInputs,useCompression:!!e.eventBuffer&&"worker"===e.eventBuffer.type,networkDetailHasUrls:t.networkDetailAllowUrls.length>0,networkCaptureBodies:t.networkCaptureBodies,networkRequestHasHeaders:t.networkRequestHeaders.length>0,networkResponseHasHeaders:t.networkResponseHeaders.length>0}}}}(e),!1)}(e,o),"buffer"===e.recordingMode&&t&&e.eventBuffer){const n=e.eventBuffer.getEarliestTimestamp();n&&(xv&&Iv.log(`Updating session start time to earliest event in buffer to ${new Date(n)}`),t.started=n,e.getOptions().stickySession&&Pv(t))}return t?.previousSessionId||"session"===e.recordingMode&&e.flush(),!0})}}class h_ extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class m_ extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}async function g_(e,t={count:0,interval:5e3}){const{recordingData:n,onError:r}=e;if(n.length)try{return await async function({recordingData:e,replayId:t,segmentId:n,eventContext:r,timestamp:o,session:i}){const s=function({recordingData:e,headers:t}){let n;const r=`${JSON.stringify(t)}\n`;if("string"==typeof e)n=`${r}${e}`;else{const t=(new TextEncoder).encode(r);n=new Uint8Array(t.length+e.length),n.set(t),n.set(e,t.length)}return n}({recordingData:e,headers:{segment_id:n}}),{urls:a,errorIds:c,traceIds:u,initialTimestamp:l}=r,d=cl(),f=il(),p=d?.getTransport(),h=d?.getDsn();if(!(d&&p&&h&&i.sampled))return Promise.resolve({});const m={type:"replay_event",replay_start_timestamp:l/1e3,timestamp:o/1e3,error_ids:c,trace_ids:u,urls:a,replay_id:t,segment_id:n,replay_type:i.sampled},g=await async function({client:e,scope:t,replayId:n,event:r}){const o={event_id:n,integrations:"object"!=typeof e._integrations||null===e._integrations||Array.isArray(e._integrations)?void 0:Object.keys(e._integrations)};e.emit("preprocessEvent",r,o);const i=await tf(e.getOptions(),r,o,t,e,sl());if(!i)return null;e.emit("postprocessEvent",i,o),i.platform=i.platform||"javascript";const s=e.getSdkMetadata(),{name:a,version:c,settings:u}=s?.sdk||{};return i.sdk={...i.sdk,name:a||"sentry.javascript.unknown",version:c||"0.0.0",settings:u},i}({scope:f,client:d,replayId:t,event:m});if(!g)return d.recordDroppedEvent("event_processor","replay"),xv&&Iv.log("An event processor returned `null`, will not send event."),Promise.resolve({});delete g.sdkProcessingMetadata;const y=function(e,t,n,r){return vd(Id(e,Cd(e),r,n),[[{type:"replay_event"},e],[{type:"replay_recording",length:"string"==typeof t?(new TextEncoder).encode(t).length:t.length},t]])}(g,s,h,d.getOptions().tunnel);let v;try{v=await p.send(y)}catch(DE){const t=new Error(Hm);try{t.cause=DE}catch{}throw t}if("number"==typeof v.statusCode&&(v.statusCode<200||v.statusCode>=300))throw new h_(v.statusCode);const _=Ff({},v);if(jf(_,"replay"))throw new m_(_);return v}(e),!0}catch(DE){if(DE instanceof h_||DE instanceof m_)throw DE;if(sf("Replays",{_retryCount:t.count}),r&&r(DE),t.count>=3){const e=new Error(`${Hm} - max retries exceeded`);try{e.cause=DE}catch{}throw e}return t.interval*=++t.count,new Promise((n,r)=>{dm(async()=>{try{await g_(e,t),n(!0)}catch(o){r(o)}},t.interval)})}}const y_="__THROTTLED";class v_{constructor({options:e,recordingOptions:t}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:3e5,sessionIdleExpire:9e5},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=t,this._options=e,this._debouncedFlush=function(e,t,n){return function(e,t,n){let r,o,i;const s=n?.maxWait?Math.max(n.maxWait,t):0,a=n?.setTimeoutImpl||setTimeout;function c(){return u(),r=e(),r}function u(){void 0!==o&&clearTimeout(o),void 0!==i&&clearTimeout(i),o=i=void 0}function l(){return o&&clearTimeout(o),o=a(c,t),s&&void 0===i&&(i=a(c,s)),r}return l.cancel=u,l.flush=function(){return void 0!==o||void 0!==i?c():r},l}(e,t,{...n,setTimeoutImpl:dm})}(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=function(e,t,n){const r=new Map;let o=!1;return(...i)=>{const s=Math.floor(Date.now()/1e3);if((e=>{const t=e-n;r.forEach((e,n)=>{ne+t,0)>=t){const e=o;return o=!0,e?"__SKIPPED":y_}o=!1;const a=r.get(s)||0;return r.set(s,a+1),e(...i)}}((e,t)=>function(e,t,n){return Wv(e,t)?qv(e,t,n):Promise.resolve(null)}(this,e,t),300,5);const{slowClickTimeout:n,slowClickIgnoreSelectors:r}=this.getOptions(),o=n?{threshold:Math.min(3e3,n),timeout:n,scrollTimeout:300,ignoreSelector:r?r.join(","):""}:void 0;if(o&&(this.clickDetector=new av(this,o)),xv){const t=e._experiments;Iv.setConfig({captureExceptions:!!t.captureExceptions,traceInternals:!!t.traceInternals})}this._handleVisibilityChange=()=>{"visible"===qm.document.visibilityState?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{const e=lv({category:"ui.blur"});this._doChangeToBackgroundTasks(e)},this._handleWindowFocus=()=>{const e=lv({category:"ui.focus"});this._doChangeToForegroundTasks(e)},this._handleKeyboardEvent=e=>{!function(e,t){if(!e.isEnabled())return;e.updateUserActivity();const n=function(e){const{metaKey:t,shiftKey:n,ctrlKey:r,altKey:o,key:i,target:s}=e;if(!s||function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable}(s)||!i)return null;const a=t||r||o,c=1===i.length;if(!a&&c)return null;const u=vu(s,{maxStringLength:200})||"";return lv({category:"ui.keyDown",message:u,data:{...hv(s,u).data,metaKey:t,shiftKey:n,ctrlKey:r,altKey:o,key:i}})}(t);n&&tv(e,n)}(this,e)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return Boolean(this._canvas)}getOptions(){return this._options}handleException(e){xv&&Iv.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){const{errorSampleRate:t,sessionSampleRate:n}=this._options,r=t<=0&&n<=0;this._requiresManualStart=r,r||(this._initializeSessionForSampling(e),this.session?!1!==this.session.sampled&&(this.recordingMode="buffer"===this.session.sampled&&0===this.session.segmentId?"buffer":"session",xv&&Iv.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording()):xv&&Iv.exception(new Error("Unable to initialize and create session")))}start(){if(this._isEnabled&&"session"===this.recordingMode)return void(xv&&Iv.log("Recording is already in progress"));if(this._isEnabled&&"buffer"===this.recordingMode)return void(xv&&Iv.log("Buffering is in progress, call `flush()` to save the replay"));xv&&Iv.infoTick("Starting replay in session mode"),this._updateUserActivity();const e=$v({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this.recordingMode="session",this._initializeRecording()}startBuffering(){if(this._isEnabled)return void(xv&&Iv.log("Buffering is in progress, call `flush()` to save the replay"));xv&&Iv.infoTick("Starting replay in buffer mode");const e=$v({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const e=this._canvas;this._stopRecording=Jy({...this._recordingOptions,..."buffer"===this.recordingMode?{checkoutEveryNms:6e4}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:p_(this),.../iPhone|iPad|iPod/i.test(f_?.userAgent??"")||/Macintosh/i.test(f_?.userAgent??"")&&f_?.maxTouchPoints&&f_?.maxTouchPoints>1?{sampling:{mousemove:!1}}:{},onMutation:this._onMutationHandler.bind(this),...e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}})}catch(DE){this.handleException(DE)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(DE){return this.handleException(DE),!1}}async stop({forceFlush:e=!1,reason:t}={}){if(this._isEnabled){this._isEnabled=!1,this.recordingMode="buffer";try{xv&&Iv.log("Stopping Replay"+(t?` triggered by ${t}`:"")),Jv(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),this.eventBuffer?.destroy(),this.eventBuffer=null,n=this,function(){if(Lv())try{qm.sessionStorage.removeItem(Wm)}catch{}}(),n.session=void 0}catch(DE){this.handleException(DE)}}var n}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),xv&&Iv.log("Pausing replay"))}resume(){this._isPaused&&this._checkSession()&&(this._isPaused=!1,this.startRecording(),xv&&Iv.log("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if("session"===this.recordingMode)return this.flushImmediate();const t=Date.now();xv&&Iv.log("Converting buffer to session"),await this.flushImmediate();const n=this.stopRecording();e&&n&&"session"!==this.recordingMode&&(this.recordingMode="session",this.session&&(this._updateUserActivity(t),this._updateSessionActivity(t),this._maybeSaveSession()),this.startRecording())}addUpdate(e){const t=e();"buffer"!==this.recordingMode&&this._isEnabled&&!0!==t&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),this._stopRecording)this.checkAndHandleExpiredSession(),this._updateSessionActivity();else{if(!this._checkSession())return;this.resume()}}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return"buffer"===this.recordingMode?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(e){if(!e||!1!==this.session?.sampled)return this.session?.id}checkAndHandleExpiredSession(){if(!(this._lastActivity&&Bv(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&"session"===this.session.sampled))return!!this._checkSession();this.pause()}setInitialState(){const e=`${qm.location.pathname}${qm.location.hash}${qm.location.search}`,t=`${qm.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=t,this._context.initialTimestamp=Date.now(),this._context.urls.push(t)}throttledAddEvent(e,t){const n=this._throttledAddEvent(e,t);if(n===y_){const e=lv({category:"replay.throttled"});this.addUpdate(()=>!Vv(this,{type:5,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e,metric:!0}}))}return n}getCurrentRoute(){const e=this.lastActiveSpan||ed(),t=e&&Zl(e),n=(t&&Hl(t).data||{})[ll];if(t&&n&&["route","custom"].includes(n))return Hl(t).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=function({useCompression:e,workerUrl:t}){if(e&&window.Worker){const e=function(e){try{const t=e||("undefined"!=typeof __SENTRY_EXCLUDE_REPLAY_WORKER__&&__SENTRY_EXCLUDE_REPLAY_WORKER__?"":function(){const e=new Blob(['var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,s=0,a=new n(r);s>f]=l}else for(o=new n(i),s=0;s>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;sd&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<e))break;w+=m-(1<>=y;w>0;){var M=o[s].s;p[M]=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s4&&!H[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=w,P=p,Q=y,R=g;for(B=0;B255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<7e3||q>24576)&&(N>423||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;Pnt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,s=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),a=s.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(s,n),O(s,a-8,r.d()),O(s,a-4,e),s}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){j.prototype.flush.call(this)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(G)return G.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),s=0,a=function(t){i[s++]=t},o=0;oi.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n{this._deflatedData.push(t)},this.stream=new J((t,n)=>{this.deflate.push(t,n)}),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}}),postMessage({id:void 0,method:"init",success:!0,response:void 0});']);return URL.createObjectURL(e)}());if(!t)return;xv&&Iv.log("Using compression worker"+(e?` from ${e}`:""));const n=new Worker(t);return new Dv(n)}catch(t){xv&&Iv.exception(t,"Failed to create compression worker")}}(t);if(e)return e}return xv&&Iv.log("Using simple buffer"),new Rv}({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(e){const t=this._options.errorSampleRate>0,n=$v({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:t});this.session=n}_checkSession(){if(!this.session)return!1;const e=this.session;return!Uv(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})||(this._refreshSession(e),!1)}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(e.id))}_addListeners(){try{qm.document.addEventListener("visibilitychange",this._handleVisibilityChange),qm.addEventListener("blur",this._handleWindowBlur),qm.addEventListener("focus",this._handleWindowFocus),qm.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(l_(this),this._hasInitializedCoreListeners=!0)}catch(DE){this.handleException(DE)}this._performanceCleanupCallback=function(e){function t(t){e.performanceEntries.includes(t)||e.performanceEntries.push(t)}function n({entries:e}){e.forEach(t)}const r=[];return["navigation","paint","resource"].forEach(e=>{r.push(Ah(e,n))}),r.push(Ch(gv(_v,e)),Th(gv(Sv,e)),Ih(gv(kv,e))),()=>{r.forEach(e=>e())}}(this)}_removeListeners(){try{qm.document.removeEventListener("visibilitychange",this._handleVisibilityChange),qm.removeEventListener("blur",this._handleWindowBlur),qm.removeEventListener("focus",this._handleWindowFocus),qm.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(DE){this.handleException(DE)}}_doChangeToBackgroundTasks(e){this.session&&(zv(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(e&&this._createCustomBreadcrumb(e),this.conditionalFlush()))}_doChangeToForegroundTasks(e){this.session&&(this.checkAndHandleExpiredSession()?e&&this._createCustomBreadcrumb(e):xv&&Iv.log("Document has become active, but session has expired"))}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:cy.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=(t=this.performanceEntries,t.map(yv).filter(Boolean)).concat(this.replayPerformanceEntries);var t;if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const t=this._context.initialTimestamp/1e3;e=e.filter(e=>e.start>=t)}return Promise.all(Xv(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:t}=this;if(!e||!t||this._requiresManualStart)return;if(e.segmentId)return;const n=t.getEarliestTimestamp();n&&nthis._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const n=this._popEventContext(),r=this.session.segmentId++;this._maybeSaveSession();const o=await this.eventBuffer.finish();await g_({replayId:e,recordingData:o,segmentId:r,eventContext:n,session:this.session,timestamp:t,onError:e=>this.handleException(e)})}catch(DE){this.handleException(DE),this.stop({reason:"sendReplay"});const t=cl();if(t){const n=DE instanceof m_?"ratelimit_backoff":"send_error";t.recordDroppedEvent(n,"replay")}}}else xv&&Iv.error("No session or eventBuffer found to flush.")}async _flush({force:e=!1}={}){if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession())return void(xv&&Iv.error("Attempting to finish replay event after session expired."));if(!this.session)return;const t=this.session.started,n=Date.now()-t;this._debouncedFlush.cancel();const r=nthis._options.maxReplayDuration+5e3;if(r||o)return xv&&Iv.log(`Session duration (${Math.floor(n/1e3)}s) is too ${r?"short":"long"}, not sending replay.`),void(r&&this._debouncedFlush());const i=this.eventBuffer;i&&0===this.session.segmentId&&!i.hasCheckout&&xv&&Iv.log("Flushing initial segment without checkout.");const s=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(DE){this.handleException(DE)}finally{this._flushLock=void 0,s&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&Pv(this.session)}_onMutationHandler(e){const{ignoreMutations:t}=this._options._experiments;if(t?.length&&e.some(e=>{const n=function(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}(e.target),r=t.join(",");return n?.matches(r)}))return!1;const n=e.length,r=this._options.mutationLimit,o=r&&n>r;if(n>this._options.mutationBreadcrumbLimit||o){const e=lv({category:"replay.mutations",data:{count:n,limit:o}});this._createCustomBreadcrumb(e)}return!o||(this.stop({reason:"mutationLimit",forceFlush:"session"===this.recordingMode}),!1)}}function __(e,t){return[...e,...t].join(",")}const b_='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',S_=["content-length","content-type","accept"];let k_=!1;class w_{constructor({flushMinDelay:e=5e3,flushMaxDelay:t=5500,minReplayDuration:n=4999,maxReplayDuration:r=36e5,stickySession:o=!0,useCompression:i=!0,workerUrl:s,_experiments:a={},maskAllText:c=!0,maskAllInputs:u=!0,blockAllMedia:l=!0,mutationBreadcrumbLimit:d=750,mutationLimit:f=1e4,slowClickTimeout:p=7e3,slowClickIgnoreSelectors:h=[],networkDetailAllowUrls:m=[],networkDetailDenyUrls:g=[],networkCaptureBodies:y=!0,networkRequestHeaders:v=[],networkResponseHeaders:_=[],mask:b=[],maskAttributes:S=["title","placeholder","aria-label"],unmask:k=[],block:w=[],unblock:x=[],ignore:E=[],maskFn:T,beforeAddRecordingEvent:C,beforeErrorSampling:I,onError:A}={}){this.name="Replay";const R=function({mask:e,unmask:t,block:n,unblock:r,ignore:o}){return{maskTextSelector:__(e,[".sentry-mask","[data-sentry-mask]"]),unmaskTextSelector:__(t,[]),blockSelector:__(n,[".sentry-block","[data-sentry-block]","base","iframe[srcdoc]:not([src])"]),unblockSelector:__(r,[]),ignoreSelector:__(o,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}({mask:b,unmask:k,block:w,unblock:x,ignore:E});if(this._recordingOptions={maskAllInputs:u,maskAllText:c,maskInputOptions:{password:!0},maskTextFn:T,maskInputFn:T,maskAttributeFn:(e,t,n)=>function({el:e,key:t,maskAttributes:n,maskAllText:r,privacyOptions:o,value:i}){return r?o.unmaskTextSelector&&e.matches(o.unmaskTextSelector)?i:n.includes(t)||"value"===t&&"INPUT"===e.tagName&&["submit","button"].includes(e.getAttribute("type")||"")?i.replace(/[\S]/g,"*"):i:i}({maskAttributes:S,maskAllText:c,privacyOptions:R,key:e,value:t,el:n}),...R,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:e=>{try{e.__rrweb__=!0}catch{}},recordCrossOriginIframes:Boolean(a.recordCrossOriginIframes)},this._initialOptions={flushMinDelay:e,flushMaxDelay:t,minReplayDuration:Math.min(n,15e3),maxReplayDuration:Math.min(r,36e5),stickySession:o,useCompression:i,workerUrl:s,blockAllMedia:l,maskAllInputs:u,maskAllText:c,mutationBreadcrumbLimit:d,mutationLimit:f,slowClickTimeout:p,slowClickIgnoreSelectors:h,networkDetailAllowUrls:m,networkDetailDenyUrls:g,networkCaptureBodies:y,networkRequestHeaders:x_(v),networkResponseHeaders:x_(_),beforeAddRecordingEvent:C,beforeErrorSampling:I,onError:A,_experiments:a},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${b_}`:b_),this._isInitialized&&xp())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return k_}set _isInitialized(e){k_=e}afterAllSetup(e){xp()&&!this._replay&&(this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:"session"===this._replay.recordingMode}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(e){if(this._replay?.isEnabled())return this._replay.getSessionId(e)}getRecordingMode(){if(this._replay?.isEnabled())return this._replay.recordingMode}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){const t=function(e,t){const n=t.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...e},o=Pl(n.replaysSessionSampleRate),i=Pl(n.replaysOnErrorSampleRate);return null==o&&null==i&&Dc(()=>{}),null!=o&&(r.sessionSampleRate=o),null!=i&&(r.errorSampleRate=i),r}(this._initialOptions,e);this._replay=new v_({options:t,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{const t=e.getIntegrationByName("ReplayCanvas");if(!t)return;this._replay._canvas=t.getOptions()}catch{}}}function x_(e){return[...S_,...e.map(e=>e.toLowerCase())]}function E_(e){try{return new URL(e,Ep.location.origin).href}catch{return}}function T_(e){try{return new Headers(e)}catch{return}}const C_=new WeakMap,I_=new Map,A_={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function R_(e,t){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:o,shouldCreateSpanForRequest:i,enableHTTPTimings:s,tracePropagationTargets:a,onRequestSpanStart:c,onRequestSpanEnd:u}={...A_,...t},l="function"==typeof i?i:e=>!0,d=e=>function(e,t){const n=bu();if(n){let r,o;try{r=new URL(e,n),o=new URL(n).origin}catch{return!1}const i=r.origin===o;return t?Eu(r.toString(),t)||i&&Eu(r.pathname,t):i}{const n=!!e.match(/^\/(?!\/)/);return t?Eu(e,t):n}}(e,a),f={},p=e.getOptions().propagateTraceparent;n&&(e.addEventProcessor(e=>("transaction"===e.type&&e.spans&&e.spans.forEach(e=>{if("http.client"===e.op){const t=I_.get(e.span_id);t&&(e.timestamp=t/1e3,I_.delete(e.span_id))}}),e)),o&&function(){const e="fetch-body-resolved";Yc(e,e=>{if(e.response){const t=C_.get(e.response);t&&e.endTimestamp&&I_.set(t,e.endTimestamp)}}),Gc(e,()=>_p(bp))}(),vp(e=>{const t=function(e,t,n,r,o){if(!e.fetchData)return;const{method:i,url:s}=e.fetchData,a=rd()&&t(s);if(e.endTimestamp&&a){const t=e.fetchData.__span;if(!t)return;const n=r[t];return void(n&&(function(e,t){if(t.response){kl(e,t.response.status);const n=t.response?.headers?.get("content-length");if(n){const t=parseInt(n);t>0&&e.setAttribute("http.response_content_length",t)}}else t.error&&e.setStatus({code:2,message:"internal_error"});e.end()}(n,e),function(e,t,n){const r="object"==typeof n&&null!==n?n.onRequestSpanEnd:void 0;r?.(e,{headers:t.response?.headers,error:t.error})}(n,e,o),delete r[t]))}const{spanOrigin:c="auto.http.browser",propagateTraceparent:u=!1}="object"==typeof o?o:{spanOrigin:o},l=!!ed(),d=a&&l?Nd(function(e,t,n){const r=zf(e);return{name:r?`${t} ${Uf(r)}`:t,attributes:hp(e,r,t,n)}}(s,i,c)):new hd;if(e.fetchData.__span=d.spanContext().spanId,r[d.spanContext().spanId]=d,n(e.fetchData.url)){const t=e.args[0],n=e.args[1]||{},r=function(e,t,n,r){const o=Hf({span:n,propagateTraceparent:r}),i=o["sentry-trace"],s=o.baggage,a=o.traceparent;if(!i)return;const c=t.headers||(gu(e)?e.headers:void 0);if(c){if(function(e){return"undefined"!=typeof Headers&&hu(e,Headers)}(c)){const e=new Headers(c);if(e.get("sentry-trace")||e.set("sentry-trace",i),r&&a&&!e.get("traceparent")&&e.set("traceparent",a),s){const t=e.get("baggage");t?pp(t)||e.set("baggage",`${t},${s}`):e.set("baggage",s)}return e}if(Array.isArray(c)){const e=[...c];c.find(e=>"sentry-trace"===e[0])||e.push(["sentry-trace",i]),r&&a&&!c.find(e=>"traceparent"===e[0])&&e.push(["traceparent",a]);const t=c.find(e=>"baggage"===e[0]&&pp(e[1]));return s&&!t&&e.push(["baggage",s]),e}{const e="sentry-trace"in c?c["sentry-trace"]:void 0,t="traceparent"in c?c.traceparent:void 0,n="baggage"in c?c.baggage:void 0,o=n?Array.isArray(n)?[...n]:[n]:[],u=n&&(Array.isArray(n)?n.find(e=>pp(e)):pp(n));s&&!u&&o.push(s);const l={...c,"sentry-trace":e??i,baggage:o.length>0?o.join(","):void 0};return r&&a&&!t&&(l.traceparent=a),l}}return{...o}}(t,n,rd()&&l?d:void 0,u);r&&(e.args[1]=n,n.headers=r)}const f=cl();if(f){const t={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};f.emit("beforeOutgoingRequestSpan",d,t)}return d}(e,l,d,f,{propagateTraceparent:p,onRequestSpanEnd:u});if(e.response&&e.fetchData.__span&&C_.set(e.response,e.fetchData.__span),t){const n=E_(e.fetchData.url),r=n?$f(n).host:void 0;t.setAttributes({"http.url":n,"server.address":r}),s&&M_(t),c?.(t,{headers:e.headers})}})),r&&pm(e=>{const t=function(e,t,n,r,o,i){const s=e.xhr,a=s?.[fm];if(!s||s.__sentry_own_request__||!a)return;const{url:c,method:u}=a,l=rd()&&t(c);if(e.endTimestamp&&l){const t=s.__sentry_xhr_span_id__;if(!t)return;const n=r[t];return void(n&&void 0!==a.status_code&&(kl(n,a.status_code),n.end(),i?.(n,{headers:T_(vm(s)),error:e.error}),delete r[t]))}const d=E_(c),f=$f(d||c),p=c.split(/[?#]/,1)[0],h=!!ed(),m=l&&h?Nd({name:`${u} ${p}`,attributes:{url:c,type:"xhr","http.method":u,"http.url":d,"server.address":f?.host,[hl]:"auto.http.browser",[pl]:"http.client",...f?.search&&{"http.query":f?.search},...f?.hash&&{"http.fragment":f?.hash}}}):new hd;s.__sentry_xhr_span_id__=m.spanContext().spanId,r[s.__sentry_xhr_span_id__]=m,n(c)&&function(e,t,n){const{"sentry-trace":r,baggage:o,traceparent:i}=Hf({span:t,propagateTraceparent:n});r&&function(e,t,n,r){const o=e.__sentry_xhr_v3__?.request_headers;if(!o?.["sentry-trace"]&&e.setRequestHeader)try{if(e.setRequestHeader("sentry-trace",t),r&&!o?.traceparent&&e.setRequestHeader("traceparent",r),n){const t=o?.baggage;t&&t.split(",").some(e=>e.trim().startsWith("sentry-"))||e.setRequestHeader("baggage",n)}}catch{}}(e,r,o,i)}(s,rd()&&h?m:void 0,o);const g=cl();return g&&g.emit("beforeOutgoingRequestSpan",m,e),m}(e,l,d,f,p,u);t&&(s&&M_(t),c?.(t,{headers:T_(e.xhr.__sentry_xhr_v3__?.request_headers)}))})}function M_(e){const{url:t}=Hl(e).data;if(!t||"string"!=typeof t)return;const n=Ah("resource",({entries:r})=>{r.forEach(r=>{(function(e){return"resource"===e.entryType&&"initiatorType"in e&&"string"==typeof e.nextHopProtocol&&("fetch"===e.initiatorType||"xmlhttprequest"===e.initiatorType)})(r)&&r.name.endsWith(t)&&(e.setAttributes(Hh(r)),setTimeout(n))})})}const O_="sentry_previous_trace";function D_(e){return 1===e.traceFlags}const L_={...$d,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,enableElementTiming:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...A_},N_=(e={})=>{const t={name:void 0,source:void 0},n=Ep.document,{enableInp:r,enableElementTiming:o,enableLongTask:i,enableLongAnimationFrame:s,_experiments:{enableInteractions:a,enableStandaloneClsSpans:c,enableStandaloneLcpSpans:u},beforeStartSpan:l,idleTimeout:d,finalTimeout:f,childSpanTimeout:p,markBackgroundSpan:h,traceFetch:m,traceXHR:g,trackFetchStreamPerformance:y,shouldCreateSpanForRequest:v,enableHTTPTimings:_,ignoreResourceSpans:b,ignorePerformanceApiSpans:S,instrumentPageLoad:k,instrumentNavigation:w,detectRedirects:x,linkPreviousTrace:E,consistentTraceSampling:T,enableReportPageLoaded:C,onRequestSpanStart:I,onRequestSpanEnd:A}={...L_,...e};let R,M,O;function D(e,r,o=!0){const i="pageload"===r.op,s=r.name,a=l?l(r):r,h=a.attributes||{};if(s!==a.name&&(h[ll]="custom",a.attributes=h),!o){const e=$u();return void Nd({...a,startTime:e}).end(e)}t.name=a.name,t.source=h[ll];const m=Vd(a,{idleTimeout:d,finalTimeout:f,childSpanTimeout:p,disableAutoFinish:i,beforeSpanEnd:t=>{R?.(),function(e,t){const n=Uh(),r=qu();if(!n?.getEntries||!r)return;const o=$h(r),i=n.getEntries(),{op:s,start_timestamp:a}=Hl(e);i.slice(Gh).forEach(n=>{const r=$h(n.startTime),i=$h(Math.max(0,n.duration));if(!("navigation"===s&&a&&o+r{Qh(e,t,r,n)}),Qh(e,t,"secureConnection",n,"TLS/SSL"),Qh(e,t,"fetch",n,"cache"),Qh(e,t,"domainLookup",n,"DNS"),function(e,t,n){const r=n+$h(t.requestStart),o=n+$h(t.responseEnd),i=n+$h(t.responseStart);t.responseEnd&&(Bh(e,r,o,{op:"browser.request",name:t.name,attributes:{[hl]:"auto.ui.browser.metrics"}}),Bh(e,i,o,{op:"browser.response",name:t.name,attributes:{[hl]:"auto.ui.browser.metrics"}}))}(e,t,n)}(e,n,o);break;case"mark":case"paint":case"measure":{!function(e,t,n,r,o,i){if(function(e){if("measure"===e?.entryType)try{return"Components ⚛"===e.detail.devtools.track}catch{return}}(t))return;if(["mark","measure"].includes(t.entryType)&&Eu(t.name,i))return;const s=qp(!1),a=$h(s?s.requestStart:0),c=o+Math.max(n,a),u=o+n,l=u+r,d={[hl]:"auto.resource.browser.metrics"};c!==u&&(d["sentry.browser.measure_happened_before_request"]=!0,d["sentry.browser.measure_start_time"]=c),function(e,t){try{const n=t.detail;if(!n)return;if("object"==typeof n){for(const[t,r]of Object.entries(n))if(r&&lu(r))e[`sentry.browser.measure.detail.${t}`]=r;else if(void 0!==r)try{e[`sentry.browser.measure.detail.${t}`]=JSON.stringify(r)}catch{}return}if(lu(n))return void(e["sentry.browser.measure.detail"]=n);try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}(d,t),c<=l&&Bh(e,c,l,{name:t.name,op:t.entryType,attributes:d})}(e,n,r,i,o,t.ignorePerformanceApiSpans);const s=th(),a=n.startTime{const o=e[n];null!=o&&("number"==typeof o&&o<2147483647||"string"==typeof o)&&(t[r]=o)})}(t,c);const l={...c,...Hh(t)},d=i+r;Bh(e,d,d+o,{name:n.replace($p.location.origin,""),op:a,attributes:l})}(e,n,n.name,r,i,o,t.ignoreResourceSpans)}}),Gh=Math.max(i.length-1,0),function(e){const t=$p.navigator;if(!t)return;const n=t.connection;n&&(n.effectiveType&&e.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&e.setAttribute("connectionType",n.type),Fh(n.rtt)&&(Jh["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Fh(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Fh(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}(e),"pageload"===s&&(function(e){const t=qp(!1);if(!t)return;const{responseStart:n,requestStart:r}=t;r<=n&&(e["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}(Jh),t.recordClsOnPageloadSpan||delete Jh.cls,t.recordLcpOnPageloadSpan||delete Jh.lcp,Object.entries(Jh).forEach(([e,t])=>{!function(e,t,n,r=ed()){const o=r&&Zl(r);o&&(Ec&&jc.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),o.addEvent(e,{[yl]:t,[gl]:n}))}(e,t.value,t.unit)}),e.setAttribute("performance.timeOrigin",o),e.setAttribute("performance.activationStart",Wp()),function(e,t){Kh&&t.recordLcpOnPageloadSpan&&(Kh.element&&e.setAttribute("lcp.element",vu(Kh.element)),Kh.id&&e.setAttribute("lcp.id",Kh.id),Kh.url&&e.setAttribute("lcp.url",Kh.url.trim().slice(0,200)),null!=Kh.loadTime&&e.setAttribute("lcp.loadTime",Kh.loadTime),null!=Kh.renderTime&&e.setAttribute("lcp.renderTime",Kh.renderTime),e.setAttribute("lcp.size",Kh.size)),Yh?.sources&&t.recordClsOnPageloadSpan&&Yh.sources.forEach((t,n)=>e.setAttribute(`cls.source.${n+1}`,vu(t.node)))}(e,t)),Kh=void 0,Yh=void 0,Jh={}}(t,{recordClsOnPageloadSpan:!c,recordLcpOnPageloadSpan:!u,ignoreResourceSpans:b,ignorePerformanceApiSpans:S}),B_(e,void 0);const n=il(),r=n.getPropagationContext();n.setPropagationContext({...r,traceId:m.spanContext().traceId,sampled:Kl(m),dsc:pd(t)}),i&&(O=void 0)},trimIdleSpanEndTimestamp:!C});function g(){n&&["interactive","complete"].includes(n.readyState)&&e.emit("idleSpanEnableAutoFinish",m)}i&&C&&(O=m),B_(e,m),i&&!C&&n&&(n.addEventListener("readystatechange",()=>{g()}),g())}return{name:"BrowserTracing",setup(e){if(function(){function e(){const e=ed(),t=e&&Zl(e);if(t){const e="internal_error";Ec&&jc.log(`[Tracing] Root span: ${e} -> Global error occurred`),t.setStatus({code:2,message:e})}}nd||(e.tag="sentry_tracingErrorCallback",nd=!0,Qc(e),tu(e))}(),R=Xh({recordClsStandaloneSpans:c||!1,recordLcpStandaloneSpans:u||!1,client:e}),r&&function(){if(Uh()&&qu()){const e=Ih(km);return()=>{e()}}}(),o&&Uh()&&qu()&&Ah("element",Zh),s&&Tc.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?new PerformanceObserver(e=>{const t=ed();if(t)for(const n of e.getEntries()){if(!n.scripts[0])continue;const e=$h(qu()+n.startTime),{start_timestamp:r,op:o}=Hl(t);if("navigation"===o&&r&&e{const t=ed();if(!t)return;const{op:n,start_timestamp:r}=Hl(t);for(const o of e){const e=$h(qu()+o.startTime),i=$h(o.duration);"navigation"===n&&r&&e{const t=ed();if(t)for(const n of e)if("click"===n.name){const e=$h(qu()+n.startTime),r=$h(n.duration),o={name:vu(n.target),op:`ui.interaction.${n.name}`,startTime:e,attributes:{[hl]:"auto.ui.browser.metrics"}},i=Su(n.target);i&&(o.attributes["ui.component_name"]=i),Bh(t,e,e+r,o)}}),x&&n){const e=()=>{M=Vu()};addEventListener("click",e,{capture:!0}),addEventListener("keydown",e,{capture:!0,passive:!0})}function t(){const t=F_(e);t&&!Hl(t).timestamp&&(Dm&&jc.log(`[Tracing] Finishing current active span with op: ${Hl(t).op}`),t.setAttribute(ml,"cancelled"),t.end())}e.on("startNavigationSpan",(n,r)=>{if(cl()!==e)return;if(r?.isRedirect)return Dm&&jc.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),void D(e,{op:"navigation.redirect",...n},!1);M=void 0,t(),sl().setPropagationContext({traceId:Ku(),sampleRand:Math.random(),propagationSpanId:rd()?void 0:Yu()});const o=il();o.setPropagationContext({traceId:Ku(),sampleRand:Math.random(),propagationSpanId:rd()?void 0:Yu()}),o.setSDKProcessingMetadata({normalizedRequest:void 0}),D(e,{op:"navigation",...n,parentSpan:null,forceTransaction:!0})}),e.on("startPageLoadSpan",(n,r={})=>{if(cl()!==e)return;t();const o=function(e,t){const n=function(e){if(!e)return;const t=e.match(jl);if(!t)return;let n;return"1"===t[3]?n=!0:"0"===t[3]&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}(e),r=Al(t);if(!n?.traceId)return{traceId:Ku(),sampleRand:Math.random()};const o=function(e,t){const n=Pl(t?.sample_rand);if(void 0!==n)return n;const r=Pl(t?.sample_rate);return r&&void 0!==e?.parentSampled?e.parentSampled?Math.random()*r:r+Math.random()*(1-r):Math.random()}(n,r);r&&(r.sample_rand=o.toString());const{traceId:i,parentSpanId:s,parentSampled:a}=n;return{traceId:i,parentSpanId:s,sampled:a,dsc:r||{},sampleRand:o}}(r.sentryTrace||P_("sentry-trace"),r.baggage||P_("baggage")),i=il();i.setPropagationContext(o),rd()||(i.getPropagationContext().propagationSpanId=Yu()),i.setSDKProcessingMetadata({normalizedRequest:Ap()}),D(e,{op:"pageload",...n})}),e.on("endPageloadSpan",()=>{C&&O&&(O.setAttribute(ml,"reportPageLoaded"),O.end())})},afterAllSetup(e){let n=bu();if("off"!==E&&function(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const r="session-storage"===t;let o=r?function(){try{const e=Ep.sessionStorage?.getItem(O_);return JSON.parse(e)}catch{return}}():void 0;e.on("spanStart",e=>{if(Zl(e)!==e)return;const t=il().getPropagationContext();o=function(e,t,n){const r=Hl(t),o={spanContext:t.spanContext(),startTimestamp:r.start_timestamp,sampleRate:function(){try{return Number(n.dsc?.sample_rate)??Number(r.data?.[dl])}catch{return 0}}(),sampleRand:n.sampleRand};if(!e)return o;const i=e.spanContext;return i.traceId===r.trace_id?e:(Date.now()/1e3-e.startTimestamp<=3600&&(Dm&&jc.log(`Adding previous_trace ${i} link to span ${{op:r.op,...t.spanContext()}}`),t.addLink({context:i,attributes:{[Sl]:"previous_trace"}}),t.setAttribute("sentry.previous_trace",`${i.traceId}-${i.spanId}-${D_(i)?1:0}`)),o)}(o,e,t),r&&function(e){try{Ep.sessionStorage.setItem(O_,JSON.stringify(e))}catch(t){Dm&&jc.warn("Could not store previous trace in sessionStorage",t)}}(o)});let i=!0;n&&e.on("beforeSampling",e=>{if(!o)return;const t=il(),n=t.getPropagationContext();i&&n.parentSpanId?i=!1:(t.setPropagationContext({...n,dsc:{...n.dsc,sample_rate:String(o.sampleRate),sampled:String(D_(o.spanContext))},sampleRand:o.sampleRand}),e.parentSampled=D_(o.spanContext),e.parentSampleRate=o.sampleRate,e.spanAttributes={...e.spanAttributes,[fl]:o.sampleRate})})}(e,{linkPreviousTrace:E,consistentTraceSampling:T}),Ep.location){if(k){const t=qu();!function(e,t){e.emit("startPageLoadSpan",t,void 0),il().setTransactionName(t.name);const n=F_(e);n&&e.emit("afterStartPageLoadSpan",n)}(e,{name:Ep.location.pathname,startTime:t?t/1e3:void 0,attributes:{[ll]:"url",[hl]:"auto.pageload.browser"}})}w&&am(({to:t,from:r})=>{if(void 0===r&&-1!==n?.indexOf(t))return void(n=void 0);n=void 0;const o=zf(t),i=F_(e),s=i&&x&&function(e,t){const n=Hl(e),r=$u();return!(r-n.start_timestamp>z_)&&!(t&&r-t<=z_)}(i,M);!function(e,t,n){const{url:r,isRedirect:o}=n||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:o}),e.emit("startNavigationSpan",t,{isRedirect:o});const i=il();i.setTransactionName(t.name),r&&!o&&i.setSDKProcessingMetadata({normalizedRequest:{...Ap(),url:r}}),F_(e)}(e,{name:o?.pathname||Ep.location.pathname,attributes:{[ll]:"url",[hl]:"auto.navigation.browser"}},{url:t,isRedirect:s})})}h&&(Ep.document?Ep.document.addEventListener("visibilitychange",()=>{const e=ed();if(!e)return;const t=Zl(e);if(Ep.document.hidden&&t){const e="cancelled",{op:n,status:r}=Hl(t);Dm&&jc.log(`[Tracing] Transaction: ${e} -> since tab moved to the background, op: ${n}`),r||t.setStatus({code:2,message:e}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):Dm&&jc.warn("[Tracing] Could not set up background tab detection due to lack of global document")),a&&function(e,t,n,r,o){let i;Ep.document&&addEventListener("click",()=>{const s="ui.action.click",a=F_(e);if(a){const e=Hl(a).op;if(["navigation","pageload"].includes(e))return void(Dm&&jc.warn(`[Tracing] Did not create ${s} span because a pageload or navigation span is in progress.`))}i&&(i.setAttribute(ml,"interactionInterrupted"),i.end(),i=void 0),o.name?i=Vd({name:o.name,op:s,attributes:{[ll]:o.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:r}):Dm&&jc.warn(`[Tracing] Did not create ${s} transaction because _latestRouteName is missing.`)},{capture:!0})}(e,d,f,p,t),r&&function(){const e=({entries:e})=>{const t=ed(),n=t&&Zl(t);e.forEach(e=>{if(!function(e){return"duration"in e}(e)||!n)return;const t=e.interactionId;if(null!=t&&!bm.has(t)){if(_m.length>10){const e=_m.shift();bm.delete(e)}_m.push(t),bm.set(t,n)}})};Ah("event",e),Ah("first-input",e)}(),R_(e,{traceFetch:m,traceXHR:g,trackFetchStreamPerformance:y,tracePropagationTargets:e.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:v,enableHTTPTimings:_,onRequestSpanStart:I,onRequestSpanEnd:A})}}};function P_(e){const t=Ep.document,n=t?.querySelector(`meta[name=${e}]`);return n?.getAttribute("content")||void 0}const j_="_sentry_idleSpan";function F_(e){return e[j_]}function B_(e,t){Cu(e,j_,t)}const z_=1.5;function U_(t){const n={...t};return Wf(n,"react"),sf("react",{version:e.version}),function(e={}){const t=!e.skipBrowserExtensionCheck&&!!function(){if(void 0===Ep.window)return!1;const e=Ep;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=bu();return!(Ep===Ep.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(e=>n.startsWith(`${e}://`)))}()&&(Dm&&Dc(()=>{}),!0),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||Mm,Array.isArray(r)?Uc(...r):r),integrations:ff({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[ep(),Xf(),Pm(),Lm(),zm(),Vm(),up(),{name:"HttpContext",preprocessEvent(e){if(!Ep.navigator&&!Ep.location&&!Ep.document)return;const t=Ap(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}},{name:"BrowserSession",setupOnce(){void 0!==Ep.document?(af({ignoreDuration:!0}),lf(),am(({from:e,to:t})=>{void 0!==e&&e!==t&&(af({ignoreDuration:!0}),lf())})):Dm&&jc.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:e.defaultIntegrations}),transport:e.transport||wm};var r;return function(e,t){!0===t.debug&&(Ec?jc.enable():Dc(()=>{})),il().update(t.initialScope);const n=new e(t);return function(e){il().setClient(e)}(n),n.init(),n}(zp,n)}(n)}function $_(e,t="info",n){!function(e,t){const n={captureContext:t};il().captureMessage(e,undefined,n)}(e,{level:t,extra:n})}function V_(e,t){sf(e,t)}var q_=(e=>(e.WIDGET_LOADED="widget_loaded",e.WIDGET_OPENED="widget_opened",e.WIDGET_CLOSED="widget_closed",e.WIDGET_MINIMIZED="widget_minimized",e.WIDGET_MAXIMIZED="widget_maximized",e.MESSAGE_SENT="message_sent",e.MESSAGE_RECEIVED="message_received",e.MESSAGE_ERROR="message_error",e.SESSION_STARTED="session_started",e.SESSION_ENDED="session_ended",e.SESSION_TIMEOUT="session_timeout",e.LANGUAGE_SELECTED="language_selected",e.LANGUAGE_CHANGED="language_changed",e.ERROR_OCCURRED="error_occurred",e.CONNECTION_ERROR="connection_error",e.API_ERROR="api_error",e.PERFORMANCE_METRIC="performance_metric",e.BUTTON_CLICKED="button_clicked",e.INPUT_FOCUSED="input_focused",e.FILE_UPLOADED="file_uploaded",e.CONVERSATION_COMPLETED="conversation_completed",e.FEEDBACK_SUBMITTED="feedback_submitted",e))(q_||{});const W_=new class{config;eventQueue=[];flushTimer=null;sessionId;sessionStartTime;eventCount=0;constructor(){this.config={enabled:!1,debug:!1,endpoint:void 0,batchSize:parseInt("10",10),flushInterval:parseInt("30000",10)},this.sessionId=this.generateSessionId(),this.sessionStartTime=Date.now(),this.config.enabled&&(this.startFlushTimer(),this.setupUnloadHandler())}generateSessionId(){return`${Date.now()}-${Math.random().toString(36).substring(2,15)}`}startFlushTimer(){this.flushTimer&&clearInterval(this.flushTimer),this.flushTimer=setInterval(()=>{this.flush()},this.config.flushInterval)}setupUnloadHandler(){window.addEventListener("beforeunload",()=>{this.flush()}),document.addEventListener("visibilitychange",()=>{document.hidden&&this.flush()})}track(e,t={}){if(!this.config.enabled)return;const n={event:e,metadata:{...t,sessionId:this.sessionId,sessionDuration:Date.now()-this.sessionStartTime,eventNumber:++this.eventCount,userAgent:navigator.userAgent,screenWidth:window.screen.width,screenHeight:window.screen.height,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},timestamp:Date.now()};this.eventQueue.push(n),function(e,t,n="info",r){Yf({message:e,category:"analytics",level:n,data:r,timestamp:Date.now()/1e3})}(`Analytics: ${e}`,0,"info",t),this.config.debug,this.eventQueue.length>=(this.config.batchSize||10)&&this.flush()}trackTiming(e,t,n={}){this.track(e,{...n,duration:t,category:"timing"})}trackError(e,t={}){const n=e instanceof Error?e.message:e;this.track("error_occurred",{...t,error:n,category:"error"})}trackPerformance(e){this.track("performance_metric",{...e,category:"performance"})}startTiming(e){const t=performance.now();return()=>{const n=performance.now()-t;this.trackTiming(e,n)}}async flush(){if(0===this.eventQueue.length)return;const e=[...this.eventQueue];if(this.eventQueue=[],!this.config.endpoint)return this.config.debug,void $_(`Analytics events: ${e.length} events`,"info",{eventCount:e.length,events:e.map(e=>e.event)});try{const t=await fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:e,sessionId:this.sessionId,timestamp:Date.now()}),keepalive:!0});if(!t.ok)throw new Error(`Analytics flush failed: ${t.status}`);this.config.debug}catch(t){this.eventQueue.unshift(...e)}}async flushAll(){return this.flush()}getSessionInfo(){return{sessionId:this.sessionId,duration:Date.now()-this.sessionStartTime,eventCount:this.eventCount}}resetSession(){this.sessionId=this.generateSessionId(),this.sessionStartTime=Date.now(),this.eventCount=0}destroy(){this.flushTimer&&clearInterval(this.flushTimer),this.flush()}},H_=(e,t)=>W_.track(e,t);class K_ extends e.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({errorInfo:t}),V_("react-error-boundary",{componentStack:t.componentStack,errorBoundary:"ChatWidget"}),function(e,t){rf(e,{extra:t})}(e,{componentStack:t.componentStack,errorBoundary:!0}),((e,t)=>{W_.trackError(e,t)})(e,{category:"react-error-boundary",componentStack:t.componentStack?.slice(0,200)}),this.props.onError?.(e,t)}componentDidUpdate(e){this.state.hasError&&this.props.resetKeys&&e.resetKeys&&!this.areResetKeysEqual(e.resetKeys,this.props.resetKeys)&&this.handleReset()}areResetKeysEqual(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:g.jsxs("div",{role:"alert","aria-live":"assertive",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"32px",textAlign:"center",backgroundColor:"#FEF2F2",borderRadius:"12px",border:"1px solid #FCA5A5"},children:[g.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},"aria-hidden":"true",children:"⚠️"}),g.jsx("h2",{style:{fontSize:"20px",fontWeight:"600",color:"#991B1B",marginBottom:"12px"},children:"Si è verificato un errore"}),g.jsx("p",{style:{fontSize:"15px",color:"#7F1D1D",marginBottom:"24px",lineHeight:"1.6"},children:"Non siamo riusciti a caricare il chatbot. Per favore, riprova."}),g.jsx("button",{onClick:this.handleReset,style:{backgroundColor:"#DC2626",color:"#fff",padding:"12px 24px",border:"none",borderRadius:"10px",cursor:"pointer",fontSize:"15px",fontWeight:"600",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#B91C1C",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#DC2626",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:"Riprova"})]}):this.props.children}}const Y_=({variant:e="message",count:t=1})=>{const n=Array.from({length:t},(e,t)=>t);return"chat"===e?g.jsxs("div",{className:"skeleton-chat-container",role:"status","aria-live":"polite","aria-label":"Caricamento chat in corso",style:{padding:"24px 20px",display:"flex",flexDirection:"column",gap:"16px",height:"100%"},children:[[1,2,3].map(e=>g.jsx("div",{style:{display:"flex",justifyContent:e%2==0?"flex-end":"flex-start",marginBottom:"16px"},children:g.jsx("div",{className:"skeleton-pulse",style:{width:60+10*e+"%",maxWidth:"85%",height:"80px",borderRadius:"16px",backgroundColor:"#E5E7EB"}})},e)),g.jsx("span",{className:"sr-only",children:"Caricamento messaggi della chat..."})]}):"action"===e?g.jsxs("div",{className:"skeleton-actions",role:"status","aria-live":"polite",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"16px"},children:[[1,2,3].map(e=>g.jsx("div",{className:"skeleton-pulse",style:{width:80+20*e+"px",height:"44px",borderRadius:"24px",backgroundColor:"#E5E7EB"}},e)),g.jsx("span",{className:"sr-only",children:"Caricamento opzioni..."})]}):g.jsxs("div",{role:"status","aria-live":"polite",children:[n.map(e=>g.jsx("div",{style:{display:"flex",justifyContent:e%2==0?"flex-end":"flex-start",marginBottom:"16px"},children:g.jsx("div",{className:"skeleton-pulse",style:{width:65+5*e+"%",maxWidth:"85%",height:"60px",borderRadius:"16px",backgroundColor:"#E5E7EB"}})},e)),g.jsx("span",{className:"sr-only",children:"Caricamento messaggio..."})]})},G_=e.lazy(()=>Promise.resolve().then(()=>OE).then(e=>({default:e.ChatbotPlayground}))),J_=()=>{const[t,n]=e.useState(!1),[r,o]=e.useState(!1),[i,s]=e.useState(!1),{clear:a}=xc(),c=e.useRef(null),u=e.useRef(null),l=e.useRef(null),d=()=>{i?o(!0):n(!1)},f=()=>{o(!1)};return e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(r?f():t&&d())};return(t||r)&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[t,r,i]),e.useEffect(()=>{r&&u.current&&u.current.focus()},[r]),e.useEffect(()=>{if(!r)return;const e=e=>{if("Tab"!==e.key)return;const t=document.querySelector('[role="dialog"][aria-modal="true"]');if(!t)return;const n=t.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),r=Array.from(n);if(0===r.length)return;const o=r[0],i=r[r.length-1];e.shiftKey&&document.activeElement===o?(e.preventDefault(),i.focus()):e.shiftKey||document.activeElement!==i||(e.preventDefault(),o.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]),e.useEffect(()=>(document.body.style.overflow=r?"hidden":"",()=>{document.body.style.overflow=""}),[r]),g.jsxs("div",{children:[t&&g.jsx("a",{href:"#chat-messages",className:"skip-link",style:{position:"fixed",top:"-40px",left:"20px",background:"#3B82F6",color:"white",padding:"8px 16px",borderRadius:"4px",zIndex:1e4,textDecoration:"none",fontWeight:"600",fontSize:"14px"},children:"Vai ai messaggi della chat"}),g.jsx("button",{ref:l,onClick:()=>{t?d():(n(!0),s(!1))},"aria-label":t?"Chiudi chat":"Apri chat","aria-expanded":t,"aria-controls":"chat-widget","aria-haspopup":"dialog",style:{position:"fixed",bottom:"24px",right:"24px",width:"64px",height:"64px",borderRadius:"50%",backgroundColor:"#3B82F6",color:"#fff",border:"none",cursor:"pointer",fontSize:"28px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 10px 25px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(0, 0, 0, 0.1)",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)",zIndex:1e3},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.05)",e.currentTarget.style.boxShadow="0 15px 35px rgba(59, 130, 246, 0.5), 0 6px 15px rgba(0, 0, 0, 0.15)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)",e.currentTarget.style.boxShadow="0 10px 25px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(0, 0, 0, 0.1)"},onMouseDown:e=>{e.currentTarget.style.transform="scale(0.95)"},onMouseUp:e=>{e.currentTarget.style.transform="scale(1.05)"},children:g.jsx("span",{"aria-hidden":"true",children:t?"✕":"💬"})}),t&&g.jsx("div",{ref:c,id:"chat-widget",role:"dialog","aria-modal":"false","aria-label":"Assistente chat Lando",className:"chat-widget-container",style:{position:"fixed",bottom:"100px",right:"24px",width:"min(420px, calc(100vw - 48px))",height:"min(640px, calc(100vh - 200px))",maxHeight:"min(640px, calc(100vh - 200px))",backgroundColor:"#ffffff",borderRadius:"20px",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05)",overflow:"hidden",zIndex:999,display:"flex",flexDirection:"column",animation:"slideUp 300ms cubic-bezier(0.4, 0, 0.2, 1)"},children:g.jsx(K_,{children:g.jsx(e.Suspense,{fallback:g.jsx(Y_,{variant:"chat"}),children:g.jsx(G_,{onLanguageSelected:()=>s(!0)})})})}),r&&g.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-description",className:"modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:2e3,animation:"fadeIn 200ms cubic-bezier(0.4, 0, 0.2, 1)",padding:"24px",boxSizing:"border-box"},onClick:f,children:g.jsxs("div",{className:"modal-content",style:{backgroundColor:"#fff",padding:"32px",borderRadius:"16px",maxWidth:"400px",width:"100%",textAlign:"center",boxSizing:"border-box",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",animation:"scaleIn 200ms cubic-bezier(0.4, 0, 0.2, 1)",margin:"0 auto"},onClick:e=>e.stopPropagation(),children:[g.jsx("h2",{id:"modal-title",style:{marginBottom:"8px",fontSize:"18px",lineHeight:"1.4",color:"#1F2937",fontWeight:"600"},children:"Conferma chiusura"}),g.jsx("p",{id:"modal-description",style:{marginBottom:"28px",fontSize:"15px",lineHeight:"1.6",color:"#6B7280"},children:"Sei sicuro di voler cancellare la chat e chiudere il chatbot?"}),g.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"12px",flexWrap:"wrap"},children:[g.jsx("button",{ref:u,onClick:()=>{a(),n(!1),o(!1),setTimeout(()=>l.current?.focus(),100)},"aria-label":"Conferma e cancella la chat",style:{backgroundColor:"#EF4444",color:"#fff",padding:"12px 24px",border:"none",borderRadius:"10px",cursor:"pointer",fontSize:"15px",fontWeight:"600",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",minWidth:"100px"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#DC2626",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#EF4444",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseDown:e=>{e.currentTarget.style.transform="scale(0.98)"},onMouseUp:e=>{e.currentTarget.style.transform="translateY(-1px)"},children:"Sì, cancella"}),g.jsx("button",{onClick:f,"aria-label":"Annulla e torna alla chat",style:{backgroundColor:"#F3F4F6",color:"#374151",padding:"12px 24px",border:"none",borderRadius:"10px",cursor:"pointer",fontSize:"15px",fontWeight:"600",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",minWidth:"100px"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#E5E7EB",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#F3F4F6",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseDown:e=>{e.currentTarget.style.transform="scale(0.98)"},onMouseUp:e=>{e.currentTarget.style.transform="translateY(-1px)"},children:"Annulla"})]})]})})]})},X_={};function Q_(){const{connect:t}=(()=>{let t=e.useContext(wc),n=Ji(Ha),[r,o]=Xi(Ka),i=Qi(nc),s=Qi(tc),a=Zi(sc),c=Qi(uc),u=Qi(Xa),l=Ji(ec),d=Ji(Za),f=Qi(Ga),p=Qi(Qa),h=Qi(rc),m=Qi(ac),g=Qi(cc),y=Qi(Ya),v=Qi(oc),_=Qi(Ja),[b,S]=Xi(qa),k=Ji(Va),[w,x]=Xi(dc);e.useEffect(()=>{r?.socket&&(r.socket.auth.threadId=w||"")},[w]);let E=e.useCallback(({transports:e,userEnv:r})=>{let{protocol:w,host:E,pathname:T}=new URL(t.httpEndpoint),C=Ca(`${w}//${E}`,{path:T&&"/"!==T?`${T}/ws/socket.io`:"/ws/socket.io",withCredentials:!0,transports:e,auth:{clientType:t.type,sessionId:n,threadId:k||"",userEnv:JSON.stringify(r),chatProfile:b?encodeURIComponent(b):""}});o(e=>(e?.socket?.removeAllListeners(),e?.socket?.close(),{socket:C})),C.on("connect",()=>{C.emit("connection_successful"),o(e=>({...e,error:!1}))}),C.on("connect_error",e=>{o(e=>({...e,error:!0}))}),C.on("task_start",()=>{u(!0)}),C.on("task_end",()=>{u(!1)}),C.on("reload",()=>{C.emit("clear_session"),window.location.reload()}),C.on("audio_connection",async e=>{if("on"===e){let e=!0,t=Date.now(),n="pcm16";await d.begin(),await l.connect(),await d.record(async r=>{let o=Date.now()-t;C.emit("audio_chunk",{isStart:e,mimeType:n,elapsedTime:o,data:r.mono}),e=!1}),l.onStop=()=>i(!1)}else await d.end(),await l.interrupt();s(e)}),C.on("audio_chunk",e=>{l.add16BitPCM(e.data,e.track),i(!0)}),C.on("audio_interrupt",()=>{l.interrupt()}),C.on("resume_thread",e=>{let t=[];for(let r of e.steps)t=fc(t,r);e.metadata?.chat_profile&&S(e.metadata?.chat_profile),f(t);let n=e.elements||[];g(n.filter(e=>"tasklist"===e.type)),m(n.filter(e=>-1===["avatar","tasklist"].indexOf(e.type)))}),C.on("new_message",e=>{f(t=>fc(t,e))}),C.on("first_interaction",e=>{c(e.interaction),x(e.thread_id)}),C.on("update_message",e=>{f(t=>yc(t,e.id,e))}),C.on("delete_message",e=>{f(t=>vc(t,e.id))}),C.on("stream_start",e=>{f(t=>fc(t,e))}),C.on("stream_token",({id:e,token:t,isSequence:n,isInput:r})=>{f(o=>_c(o,e,t,n,r))}),C.on("ask",({msg:e,spec:t},n)=>{p({spec:t,callback:n,parentId:e.parentId}),f(t=>fc(t,e)),u(!1)}),C.on("ask_timeout",()=>{p(void 0),u(!1)}),C.on("clear_ask",()=>{p(void 0)}),C.on("call_fn",({name:e,args:t},n)=>{h({name:e,args:t,callback:n})}),C.on("clear_call_fn",()=>{h(void 0)}),C.on("call_fn_timeout",()=>{h(void 0)}),C.on("chat_settings",e=>{v(e),a()}),C.on("element",e=>{!e.url&&e.chainlitKey&&(e.url=t.getElementUrl(e.chainlitKey,n)),"tasklist"===e.type?g(t=>{let n=t.findIndex(t=>t.id===e.id);return-1===n?[...t,e]:[...t.slice(0,n),e,...t.slice(n+1)]}):m(t=>{let n=t.findIndex(t=>t.id===e.id);return-1===n?[...t,e]:[...t.slice(0,n),e,...t.slice(n+1)]})}),C.on("remove_element",e=>{m(t=>t.filter(t=>t.id!==e.id)),g(t=>t.filter(t=>t.id!==e.id))}),C.on("action",e=>{y(t=>[...t,e])}),C.on("remove_action",e=>{y(t=>{let n=t.findIndex(t=>t.id===e.id);return-1===n?t:[...t.slice(0,n),...t.slice(n+1)]})}),C.on("token_usage",e=>{_(t=>t+e)}),C.on("window_message",e=>{window.parent&&window.parent.postMessage(e,"*")})},[o,n,b]);return{connect:e.useCallback(rs.debounce(E,200),[E]),disconnect:e.useCallback(()=>{r?.socket&&(r.socket.removeAllListeners(),r.socket.close())},[r]),session:r,sessionId:n,chatProfile:b,idToResume:k,setChatProfile:S}})(),n=Ji(Ka);return e.useEffect(()=>{n?.socket.connected||fetch("https://chatbot.incentivimpresa.it/chainlit/custom-auth",{credentials:"include"}).then(()=>{t({userEnv:X_})})},[t]),g.jsx(J_,{})}let Z_=-1;const eb=e=>{addEventListener("pageshow",t=>{t.persisted&&(Z_=t.timeStamp,e(t))},!0)},tb=(e,t,n,r)=>{let o,i;return s=>{var a,c;t.value>=0&&(s||r)&&(i=t.value-(o??0),(i||void 0===o)&&(o=t.value,t.delta=i,t.rating=(a=t.value)>(c=n)[1]?"poor":a>c[0]?"needs-improvement":"good",e(t)))}},nb=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},rb=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart{const e=rb();return e?.activationStart??0},ib=(e,t=-1)=>{const n=rb();let r="navigate";return Z_>=0?r="back-forward-cache":n&&(document.prerendering||ob()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},sb=new WeakMap;function ab(e,t){return sb.get(e)||sb.set(e,new t),sb.get(e)}class cb{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const ub=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},lb=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let db=-1;const fb=new Set,pb=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,hb=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of fb)e();isFinite(db)||(db="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",hb,!0))}},mb=()=>{if(db<0){const e=ob(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;db=t??pb(),addEventListener("visibilitychange",hb,!0),addEventListener("prerenderingchange",hb,!0),eb(()=>{setTimeout(()=>{db=pb()})})}return{get firstHiddenTime(){return db},onHidden(e){fb.add(e)}}},gb=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},yb=[1800,3e3],vb=(e,t={})=>{gb(()=>{const n=mb();let r,o=ib("FCP");const i=ub("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(i.disconnect(),t.startTime{o=ib("FCP"),r=tb(e,o,yb,t.reportAllChanges),nb(()=>{o.value=performance.now()-n.timeStamp,r(!0)})}))})},_b=[.1,.25];let bb=0,Sb=1/0,kb=0;const wb=e=>{for(const t of e)t.interactionId&&(Sb=Math.min(Sb,t.interactionId),kb=Math.max(kb,t.interactionId),bb=kb?(kb-Sb)/7+1:0)};let xb;const Eb=()=>xb?bb:performance.interactionCount??0;let Tb=0;class Cb{u=[];l=new Map;m;p;v(){Tb=Eb(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((Eb()-Tb)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const Ib=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=lb(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},Ab=[200,500];class Rb{m;h(e){this.m?.(e)}}const Mb=[2500,4e3],Ob=[800,1800],Db=e=>{document.prerendering?gb(()=>Db(e)):"complete"!==document.readyState?addEventListener("load",()=>Db(e),!0):setTimeout(e)},Lb={LCP:{good:2500,needsImprovement:4e3},FID:{good:100,needsImprovement:300},CLS:{good:.1,needsImprovement:.25},FCP:{good:1800,needsImprovement:3e3},INP:{good:200,needsImprovement:500},TTFB:{good:800,needsImprovement:1800}};function Nb(e){const t=function(e,t){const n=Lb[e];return n?t<=n.good?"good":t<=n.needsImprovement?"needs-improvement":"poor":"good"}(e.name,e.value),n=function(e){return"CLS"===e.name?e.value.toFixed(3):Math.round(e.value).toString()}(e);var r;r={value:e.value,delta:e.delta},W_.trackPerformance(r),"poor"===t&&$_(`Poor Web Vital: ${e.name} = ${n}${"CLS"===e.name?"":"ms"}`,"warning",{metric:e.name,value:e.value,rating:t,threshold:Lb[e.name]}),V_("web-vitals",{[e.name]:{value:e.value,rating:t,id:e.id,navigationType:e.navigationType}})}const Pb=new kc("https://chatbot.incentivimpresa.it/chainlit","webapp");!function(){const e={dsn:"",environment:"development",release:"chat-widget@0.0.0",enabled:!1,tracesSampleRate:parseFloat("0.1"),replaysSessionSampleRate:parseFloat("0.1"),replaysOnErrorSampleRate:parseFloat("1.0")};var t;if(e.enabled&&e.dsn)try{U_({dsn:e.dsn,environment:e.environment,release:e.release,integrations:[N_({traceFetch:!0,traceXHR:!0,enableInp:!0}),(t={maskAllText:!0,blockAllMedia:!0,maskAllInputs:!0},new w_(t)),Lm({console:!0,dom:!0,fetch:!0,history:!0,xhr:!0})],tracesSampleRate:e.tracesSampleRate,replaysSessionSampleRate:e.replaysSessionSampleRate,replaysOnErrorSampleRate:e.replaysOnErrorSampleRate,beforeSend(e,t){if(e.exception?.values?.[0]?.stacktrace?.frames?.some(e=>e.filename?.includes("chrome-extension://")||e.filename?.includes("moz-extension://")))return null;const n=t.originalException;return n instanceof Error&&n.message.includes("NetworkError")?null:(e.user&&(delete e.user.ip_address,delete e.user.email),e)},ignoreErrors:["top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","atomicFindClose","NetworkError","Failed to fetch","Load failed","ChunkLoadError"],denyUrls:[/extensions\//i,/^chrome:\/\//i,/^moz-extension:\/\//i,/graph\.facebook\.com/i,/connect\.facebook\.net/i,/platform\.twitter\.com/i]})}catch(n){}}(),function(){try{((e,t={})=>{const n=mb();vb(lb(()=>{let r,o=ib("CLS",0);const i=ab(t,cb),s=e=>{for(const t of e)i.h(t);i.i>o.value&&(o.value=i.i,o.entries=i.o,r())},a=ub("layout-shift",s);a&&(r=tb(e,o,_b,t.reportAllChanges),n.onHidden(()=>{s(a.takeRecords()),r(!0)}),eb(()=>{i.i=0,o=ib("CLS",0),r=tb(e,o,_b,t.reportAllChanges),nb(()=>r())}),setTimeout(r))}))})(Nb),vb(Nb),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=mb();gb(()=>{"interactionCount"in performance||xb||(xb=ub("event",wb,{type:"event",buffered:!0,durationThreshold:0}));let r,o=ib("INP");const i=ab(t,Cb),s=e=>{Ib(()=>{for(const n of e)i.h(n);const t=i.L();t&&t.P!==o.value&&(o.value=t.P,o.entries=t.entries,r())})},a=ub("event",s,{durationThreshold:t.durationThreshold??40});r=tb(e,o,Ab,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{s(a.takeRecords()),r(!0)}),eb(()=>{i.v(),o=ib("INP"),r=tb(e,o,Ab,t.reportAllChanges)}))})})(Nb),((e,t={})=>{gb(()=>{const n=mb();let r,o=ib("LCP");const i=ab(t,Rb),s=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)i.h(t),t.startTime{s(a.takeRecords()),a.disconnect(),r(!0)}),i=e=>{e.isTrusted&&(Ib(n),removeEventListener(e.type,i,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,i,{capture:!0});eb(n=>{o=ib("LCP"),r=tb(e,o,Mb,t.reportAllChanges),nb(()=>{o.value=performance.now()-n.timeStamp,r(!0)})})}})})(Nb),((e,t={})=>{let n=ib("TTFB"),r=tb(e,n,Ob,t.reportAllChanges);Db(()=>{const o=rb();o&&(n.value=Math.max(o.responseStart-ob(),0),n.entries=[o],r(!0),eb(()=>{n=ib("TTFB",0),r=tb(e,n,Ob,t.reportAllChanges),r(!0)}))})})(Nb)}catch(e){}}();const jb={init:({selector:t="body",userId:n}={})=>{try{H_(q_.WIDGET_LOADED),n&&function(e,t){var n;n={id:e,...t},sl().setUser(n)}(n);const r=document.createElement("div");r.id="chat-widget-host",document.querySelector(t)?.appendChild(r);const o=r.attachShadow({mode:"open"}),i=document.createElement("div");i.id="chat-widget-root",o.appendChild(i);const s=document.currentScript,a=s?.src||"",c=`${a.substring(0,a.lastIndexOf("/"))}/chat-widget.css`,u=document.createElement("style");fetch(c).then(e=>{if(!e.ok)throw new Error(`CSS fetch failed: ${e.status} ${e.statusText}`);return e.text()}).then(e=>{u.textContent=e,o.appendChild(u)}).catch(e=>{H_(q_.ERROR_OCCURRED,{error:"CSS loading failed",errorMessage:e.message})}),_.createRoot(i).render(g.jsx(e.StrictMode,{children:g.jsx(K_,{children:g.jsx(wc.Provider,{value:Pb,children:g.jsx(Ki,{children:g.jsx(Q_,{})})})})}))}catch(r){throw H_(q_.ERROR_OCCURRED,{error:"Widget initialization failed",errorMessage:r instanceof Error?r.message:String(r)}),r}}};function Fb(){return Fb=Object.assign?Object.assign.bind():function(e){for(var t=1;te.forEach(e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t))}window.ChatWidget=jb;const zb=e.forwardRef((t,n)=>{const{children:r,...o}=t,i=e.Children.toArray(r),s=i.find(Vb);if(s){const t=s.props.children,r=i.map(n=>n===s?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n);return e.createElement(Ub,Fb({},o,{ref:n}),e.isValidElement(t)?e.cloneElement(t,void 0,r):null)}return e.createElement(Ub,Fb({},o,{ref:n}),r)});zb.displayName="Slot";const Ub=e.forwardRef((t,n)=>{const{children:r,...o}=t;return e.isValidElement(r)?e.cloneElement(r,{...qb(o,r.props),ref:n?Bb(n,r.ref):r.ref}):e.Children.count(r)>1?e.Children.only(null):null});Ub.displayName="SlotClone";const $b=({children:t})=>e.createElement(e.Fragment,null,t);function Vb(t){return e.isValidElement(t)&&t.type===$b}function qb(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Wb(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t"boolean"==typeof e?"".concat(e):0===e?"0":e,Kb=function(){for(var e,t,n=0,r="";n{var t;if(null==(null==Jb?void 0:Jb.variants))return Kb(Gb,null==e?void 0:e.class,null==e?void 0:e.className);const{variants:n,defaultVariants:r}=Jb,o=Object.keys(n).map(t=>{const o=null==e?void 0:e[t],i=null==r?void 0:r[t];if(null===o)return null;const s=Hb(o)||Hb(i);return n[t][s]}),i=e&&Object.entries(e).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),s=null==Jb||null===(t=Jb.compoundVariants)||void 0===t?void 0:t.reduce((e,t)=>{let{class:n,className:o,...s}=t;return Object.entries(s).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...r,...i}[t]):{...r,...i}[t]===n})?[...e,n,o]:e},[]);return Kb(Gb,o,s,null==e?void 0:e.class,null==e?void 0:e.className)});var Gb,Jb;const Xb=r.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?zb:"button";return g.jsx(s,{className:Yb({variant:t,size:n,className:e})+(e?` ${e}`:""),ref:i,...o})});function Qb({checked:e,onCheckedChange:t}){return g.jsx("input",{type:"checkbox",className:"form-checkbox h-5 w-5 text-blue-600",checked:e,onChange:e=>t(e.target.checked)})}Xb.displayName="Button";const Zb=r.forwardRef(({className:e,type:t,...n},r)=>g.jsx("input",{type:t,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 "+e,ref:r,...n}));Zb.displayName="Input";const eS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nS={};function rS(e,t){return(nS.jsx?tS:eS).test(e)}const oS=/[ \t\n\f\r]/g;function iS(e){return""===e.replace(oS,"")}class sS{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function aS(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new sS(n,r,t)}function cS(e){return e.toLowerCase()}sS.prototype.normal={},sS.prototype.property={},sS.prototype.space=void 0;class uS{constructor(e,t){this.attribute=t,this.property=e}}uS.prototype.attribute="",uS.prototype.booleanish=!1,uS.prototype.boolean=!1,uS.prototype.commaOrSpaceSeparated=!1,uS.prototype.commaSeparated=!1,uS.prototype.defined=!1,uS.prototype.mustUseProperty=!1,uS.prototype.number=!1,uS.prototype.overloadedBoolean=!1,uS.prototype.property="",uS.prototype.spaceSeparated=!1,uS.prototype.space=void 0;let lS=0;const dS=vS(),fS=vS(),pS=vS(),hS=vS(),mS=vS(),gS=vS(),yS=vS();function vS(){return 2**++lS}const _S=Object.freeze(Object.defineProperty({__proto__:null,boolean:dS,booleanish:fS,commaOrSpaceSeparated:yS,commaSeparated:gS,number:hS,overloadedBoolean:pS,spaceSeparated:mS},Symbol.toStringTag,{value:"Module"})),bS=Object.keys(_S);class SS extends uS{constructor(e,t,n,r){let o=-1;if(super(e,t),kS(this,"space",r),"number"==typeof n)for(;++o"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function ES(e,t){return t in e?e[t]:t}function TS(e,t){return ES(e,t.toLowerCase())}const CS=wS({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gS,acceptCharset:mS,accessKey:mS,action:null,allow:null,allowFullScreen:dS,allowPaymentRequest:dS,allowUserMedia:dS,alt:null,as:null,async:dS,autoCapitalize:null,autoComplete:mS,autoFocus:dS,autoPlay:dS,blocking:mS,capture:null,charSet:null,checked:dS,cite:null,className:mS,cols:hS,colSpan:null,content:null,contentEditable:fS,controls:dS,controlsList:mS,coords:hS|gS,crossOrigin:null,data:null,dateTime:null,decoding:null,default:dS,defer:dS,dir:null,dirName:null,disabled:dS,download:pS,draggable:fS,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:dS,formTarget:null,headers:mS,height:hS,hidden:pS,high:hS,href:null,hrefLang:null,htmlFor:mS,httpEquiv:mS,id:null,imageSizes:null,imageSrcSet:null,inert:dS,inputMode:null,integrity:null,is:null,isMap:dS,itemId:null,itemProp:mS,itemRef:mS,itemScope:dS,itemType:mS,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:dS,low:hS,manifest:null,max:null,maxLength:hS,media:null,method:null,min:null,minLength:hS,multiple:dS,muted:dS,name:null,nonce:null,noModule:dS,noValidate:dS,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:dS,optimum:hS,pattern:null,ping:mS,placeholder:null,playsInline:dS,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:dS,referrerPolicy:null,rel:mS,required:dS,reversed:dS,rows:hS,rowSpan:hS,sandbox:mS,scope:null,scoped:dS,seamless:dS,selected:dS,shadowRootClonable:dS,shadowRootDelegatesFocus:dS,shadowRootMode:null,shape:null,size:hS,sizes:null,slot:null,span:hS,spellCheck:fS,src:null,srcDoc:null,srcLang:null,srcSet:null,start:hS,step:null,style:null,tabIndex:hS,target:null,title:null,translate:null,type:null,typeMustMatch:dS,useMap:null,value:fS,width:hS,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mS,axis:null,background:null,bgColor:null,border:hS,borderColor:null,bottomMargin:hS,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:dS,declare:dS,event:null,face:null,frame:null,frameBorder:null,hSpace:hS,leftMargin:hS,link:null,longDesc:null,lowSrc:null,marginHeight:hS,marginWidth:hS,noResize:dS,noHref:dS,noShade:dS,noWrap:dS,object:null,profile:null,prompt:null,rev:null,rightMargin:hS,rules:null,scheme:null,scrolling:fS,standby:null,summary:null,text:null,topMargin:hS,valueType:null,version:null,vAlign:null,vLink:null,vSpace:hS,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:dS,disableRemotePlayback:dS,prefix:null,property:null,results:hS,security:null,unselectable:null},space:"html",transform:TS}),IS=wS({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:yS,accentHeight:hS,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:hS,amplitude:hS,arabicForm:null,ascent:hS,attributeName:null,attributeType:null,azimuth:hS,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:hS,by:null,calcMode:null,capHeight:hS,className:mS,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:hS,diffuseConstant:hS,direction:null,display:null,dur:null,divisor:hS,dominantBaseline:null,download:dS,dx:null,dy:null,edgeMode:null,editable:null,elevation:hS,enableBackground:null,end:null,event:null,exponent:hS,externalResourcesRequired:null,fill:null,fillOpacity:hS,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:gS,g2:gS,glyphName:gS,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:hS,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:hS,horizOriginX:hS,horizOriginY:hS,id:null,ideographic:hS,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:hS,k:hS,k1:hS,k2:hS,k3:hS,k4:hS,kernelMatrix:yS,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:hS,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:hS,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:hS,overlineThickness:hS,paintOrder:null,panose1:null,path:null,pathLength:hS,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:mS,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:hS,pointsAtY:hS,pointsAtZ:hS,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:yS,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:yS,rev:yS,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:yS,requiredFeatures:yS,requiredFonts:yS,requiredFormats:yS,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:hS,specularExponent:hS,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:hS,strikethroughThickness:hS,string:null,stroke:null,strokeDashArray:yS,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:hS,strokeOpacity:hS,strokeWidth:null,style:null,surfaceScale:hS,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:yS,tabIndex:hS,tableValues:null,target:null,targetX:hS,targetY:hS,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:yS,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:hS,underlineThickness:hS,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:hS,values:null,vAlphabetic:hS,vMathematical:hS,vectorEffect:null,vHanging:hS,vIdeographic:hS,version:null,vertAdvY:hS,vertOriginX:hS,vertOriginY:hS,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:hS,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ES}),AS=wS({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),RS=wS({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:TS}),MS=wS({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),OS={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},DS=/[A-Z]/g,LS=/-[a-z]/g,NS=/^data[-\w.:]+$/i;function PS(e){return"-"+e.toLowerCase()}function jS(e){return e.charAt(1).toUpperCase()}const FS=aS([xS,CS,AS,RS,MS],"html"),BS=aS([xS,IS,AS,RS,MS],"svg");var zS,US,$S,VS={};function qS(){if(US)return zS;US=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,a=/^\s+|\s+$/g,c="";function u(e){return e?e.replace(a,c):c}return zS=function(a,l){if("string"!=typeof a)throw new TypeError("First argument must be a string");if(!a)return[];l=l||{};var d=1,f=1;function p(e){var n=e.match(t);n&&(d+=n.length);var r=e.lastIndexOf("\n");f=~r?e.length-r:f+e.length}function h(){var e={line:d,column:f};return function(t){return t.position=new m(e),v(),t}}function m(e){this.start=e,this.end={line:d,column:f},this.source=l.source}function g(e){var t=new Error(l.source+":"+d+":"+f+": "+e);if(t.reason=e,t.filename=l.source,t.line=d,t.column=f,t.source=a,!l.silent)throw t}function y(e){var t=e.exec(a);if(t){var n=t[0];return p(n),a=a.slice(n.length),t}}function v(){y(n)}function _(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var e=h();if("/"==a.charAt(0)&&"*"==a.charAt(1)){for(var t=2;c!=a.charAt(t)&&("*"!=a.charAt(t)||"/"!=a.charAt(t+1));)++t;if(t+=2,c===a.charAt(t-1))return g("End of comment missing");var n=a.slice(2,t-2);return f+=2,p(n),a=a.slice(t),f+=2,e({type:"comment",comment:n})}}function S(){var t=h(),n=y(r);if(n){if(b(),!y(o))return g("property missing ':'");var a=y(i),l=t({type:"declaration",property:u(n[0].replace(e,c)),value:a?u(a[0].replace(e,c)):c});return y(s),l}}return m.prototype.content=a,v(),function(){var e,t=[];for(_(t);e=S();)!1!==e&&(t.push(e),_(t));return t}()}}function WS(){if($S)return VS;$S=1;var e=VS&&VS.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(VS,"__esModule",{value:!0}),VS.default=function(e,n){var r=null;if(!e||"string"!=typeof e)return r;var o=(0,t.default)(e),i="function"==typeof n;return o.forEach(function(e){if("declaration"===e.type){var t=e.property,o=e.value;i?n(t,o,e):o&&((r=r||{})[t]=o)}}),r};var t=e(qS());return VS}var HS,KS,YS,GS={};function JS(){if(HS)return GS;HS=1,Object.defineProperty(GS,"__esModule",{value:!0}),GS.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(e,t){return t.toUpperCase()},s=function(e,t){return"".concat(t,"-")};return GS.camelCase=function(a,c){return void 0===c&&(c={}),function(t){return!t||n.test(t)||e.test(t)}(a)?a:(a=a.toLowerCase(),(a=c.reactCompat?a.replace(o,s):a.replace(r,s)).replace(t,i))},GS}function XS(){if(YS)return KS;YS=1;var e=(KS&&KS.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(WS()),t=JS();function n(n,r){var o={};return n&&"string"==typeof n?((0,e.default)(n,function(e,n){e&&n&&(o[(0,t.camelCase)(e,r)]=n)}),o):o}return n.default=n,KS=n}const QS=i(XS()),ZS=tk("end"),ek=tk("start");function tk(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function nk(e){return e&&"object"==typeof e?"position"in e||"type"in e?ok(e.position):"start"in e||"end"in e?ok(e):"line"in e||"column"in e?rk(e):"":""}function rk(e){return ik(e&&e.line)+":"+ik(e&&e.column)}function ok(e){return rk(e&&e.start)+"-"+rk(e&&e.end)}function ik(e){return e&&"number"==typeof e?e:1}class sk extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",o={},i=!1;if(t&&(o="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!o.cause&&e&&(i=!0,r=e.message,o.cause=e),!o.ruleId&&!o.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?o.ruleId=n:(o.source=n.slice(0,e),o.ruleId=n.slice(e+1))}if(!o.place&&o.ancestors&&o.ancestors){const e=o.ancestors[o.ancestors.length-1];e&&(o.place=e.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.message=r,this.line=s?s.line:void 0,this.name=nk(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=i&&o.cause&&"string"==typeof o.cause.stack?o.cause.stack:""}}sk.prototype.file="",sk.prototype.name="",sk.prototype.reason="",sk.prototype.message="",sk.prototype.stack="",sk.prototype.column=void 0,sk.prototype.line=void 0,sk.prototype.ancestors=void 0,sk.prototype.cause=void 0,sk.prototype.fatal=void 0,sk.prototype.place=void 0,sk.prototype.ruleId=void 0,sk.prototype.source=void 0;const ak={}.hasOwnProperty,ck=new Map,uk=/[A-Z]/g,lk=new Set(["table","tbody","thead","tfoot","tr"]),dk=new Set(["td","th"]),fk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pk(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let o=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(o=BS,e.schema=o),e.ancestors.push(t);const i=vk(e,t.tagName,!1),s=function(e,t){const n={};let r,o;for(o in t.properties)if("children"!==o&&ak.call(t.properties,o)){const i=yk(e,o,t.properties[o]);if(i){const[o,s]=i;e.tableCellAlignToStyle&&"align"===o&&"string"==typeof s&&dk.has(t.tagName)?r=s:n[o]=s}}return r&&((n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),n}(e,t);let a=gk(e,t);return lk.has(t.tagName)&&(a=a.filter(function(e){return"string"!=typeof e||!("object"==typeof(t=e)?"text"===t.type&&iS(t.value):iS(t));var t})),hk(e,s,i,t),mk(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return e.evaluater.evaluateExpression(n.expression)}_k(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let o=r;"svg"===t.name&&"html"===r.space&&(o=BS,e.schema=o),e.ancestors.push(t);const i=null===t.name?e.Fragment:vk(e,t.name,!0),s=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0].expression.properties[0];Object.assign(n,e.evaluater.evaluateExpression(t.argument))}else _k(e,t.position);else{const o=r.name;let i;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];i=e.evaluater.evaluateExpression(t.expression)}else _k(e,t.position);else i=null===r.value||r.value;n[o]=i}return n}(e,t),a=gk(e,t);return hk(e,s,i,t),mk(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_k(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return mk(r,gk(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function hk(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function mk(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function gk(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:ck;for(;++r4&&"data"===n.slice(0,4)&&NS.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(LS,jS);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!LS.test(e)){let n=e.replace(DS,PS);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=SS}return new o(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e){const t={};return(""===e[e.length-1]?[...e,""]:e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return QS(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const t=n,r=new sk("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=fk+"#cannot-parse-style-attribute",r}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)ak.call(e,n)&&(t[bk(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?OS[r.property]||r.property:r.attribute,n]}}function vk(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,o=-1;for(;++oo?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s0?(Ik(e,e.length,0,t),e):t}const Rk={}.hasOwnProperty;function Mk(e,t){let n;for(n in t){const r=(Rk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let i;if(o)for(i in o){Rk.call(r,i)||(r[i]=[]);const e=o[i];Ok(r[i],Array.isArray(e)?e:e?[e]:[])}}}function Ok(e,t){let n=-1;const r=[];for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function Lk(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Nk=Kk(/[A-Za-z]/),Pk=Kk(/[\dA-Za-z]/),jk=Kk(/[#-'*+\--9=?A-Z^-~]/);function Fk(e){return null!==e&&(e<32||127===e)}const Bk=Kk(/\d/),zk=Kk(/[\dA-Fa-f]/),Uk=Kk(/[!-/:-@[-`{-~]/);function $k(e){return null!==e&&e<-2}function Vk(e){return null!==e&&(e<0||32===e)}function qk(e){return-2===e||-1===e||32===e}const Wk=Kk(new RegExp("\\p{P}|\\p{S}","u")),Hk=Kk(/\s/);function Kk(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function Yk(e){const t=[];let n=-1,r=0,o=0;for(;++n55295&&i<57344){const t=e.charCodeAt(n+1);i<56320&&t>56319&&t<57344?(s=String.fromCharCode(i,t),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Gk(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return function(r){return qk(r)?(e.enter(n),s(r)):t(r)};function s(r){return qk(r)&&i++i))return;const n=t.events.length;let o,a,c=n;for(;c--;)if("exit"===t.events[c][0]&&"chunkFlow"===t.events[c][1].type){if(o){a=t.events[c][1].end;break}o=!0}for(y(s),e=n;er;){const r=n[o];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}},Qk={tokenize:function(e,t,n){return Gk(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Zk(e){return null===e||Vk(e)||Hk(e)?1:Wk(e)?2:void 0}function ew(e,t,n){const r=[];let o=-1;for(;++o1&&e[l][1].end.offset-e[l][1].start.offset>1?2:1;const d={...e[n][1].end},f={...e[l][1].start};nw(d,-a),nw(f,a),i={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[l][1].start},end:f},o={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[l][1].start}},r={type:a>1?"strong":"emphasis",start:{...i.start},end:{...s.end}},e[n][1].end={...i.start},e[l][1].start={...s.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=Ak(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=Ak(c,[["enter",r,t],["enter",i,t],["exit",i,t],["enter",o,t]]),c=Ak(c,ew(t.parser.constructs.insideSpan.null,e.slice(n+1,l),t)),c=Ak(c,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[l][1].end.offset-e[l][1].start.offset?(u=2,c=Ak(c,[["enter",e[l][1],t],["exit",e[l][1],t]])):u=0,Ik(e,n-1,l-n+3,c),l=n+c.length-u-2;break}for(l=-1;++l=a?(e.exit("codeFencedFenceSequence"),qk(t)?Gk(e,l,"whitespace")(t):l(t)):n(t)}function l(r){return null===r||$k(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let i,s=0,a=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,i=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(t)}(t)};function c(t){return t===i?(a++,e.consume(t),c):a<3?n(t):(e.exit("codeFencedFenceSequence"),qk(t)?Gk(e,u,"whitespace")(t):u(t))}function u(n){return null===n||$k(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(cw,p,v)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),l(n))}function l(t){return null===t||$k(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(t)):qk(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Gk(e,d,"whitespace")(t)):96===t&&t===i?n(t):(e.consume(t),l)}function d(t){return null===t||$k(t)?u(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(t))}function f(t){return null===t||$k(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(t)):96===t&&t===i?n(t):(e.consume(t),f)}function p(t){return e.attempt(o,v,h)(t)}function h(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),m}function m(t){return s>0&&qk(t)?Gk(e,g,"linePrefix",s+1)(t):g(t)}function g(t){return null===t||$k(t)?e.check(cw,p,v)(t):(e.enter("codeFlowValue"),y(t))}function y(t){return null===t||$k(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),y)}function v(n){return e.exit("codeFenced"),t(n)}}},lw={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),Gk(e,o,"linePrefix",5)(t)};function o(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?i(e):n(e)}function i(t){return null===t?a(t):$k(t)?e.attempt(dw,i,a)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||$k(t)?(e.exit("codeFlowValue"),i(t)):(e.consume(t),s)}function a(n){return e.exit("codeIndented"),t(n)}}},dw={partial:!0,tokenize:function(e,t,n){const r=this;return o;function o(t){return r.parser.lazy[r.now().line]?n(t):$k(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):Gk(e,i,"linePrefix",5)(t)}function i(e){const i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):$k(e)?o(e):n(e)}}},fw={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,o=3;if(!("lineEnding"!==e[o][1].type&&"space"!==e[o][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=o;++t=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&hw(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),hw(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),hw(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}};function _w(e,t,n,r,o,i,s,a,c){const u=c||Number.POSITIVE_INFINITY;let l=0;return function(t){return 60===t?(e.enter(r),e.enter(o),e.enter(i),e.consume(t),e.exit(i),d):null===t||32===t||41===t||Fk(t)?n(t):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),h(t))};function d(n){return 62===n?(e.enter(i),e.consume(n),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(n))}function f(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||$k(t)?n(t):(e.consume(t),92===t?p:f)}function p(t){return 60===t||62===t||92===t?(e.consume(t),f):f(t)}function h(o){return l||null!==o&&41!==o&&!Vk(o)?l999||null===d||91===d||93===d&&!a||94===d&&!c&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):93===d?(e.exit(i),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):$k(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),l(d))}function l(t){return null===t||91===t||93===t||$k(t)||c++>999?(e.exit("chunkString"),u(t)):(e.consume(t),a||(a=!qk(t)),92===t?d:l)}function d(t){return 91===t||92===t||93===t?(e.consume(t),c++,l):l(t)}}function Sw(e,t,n,r,o,i){let s;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(o),e.consume(t),e.exit(o),s=40===t?41:t,a):n(t)};function a(n){return n===s?(e.enter(o),e.consume(n),e.exit(o),e.exit(r),t):(e.enter(i),c(n))}function c(t){return t===s?(e.exit(i),a(s)):null===t?n(t):$k(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Gk(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===s||null===t||$k(t)?(e.exit("chunkString"),c(t)):(e.consume(t),92===t?l:u)}function l(t){return t===s||92===t?(e.consume(t),u):u(t)}}function kw(e,t){let n;return function r(o){return $k(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):qk(o)?Gk(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const ww={name:"definition",tokenize:function(e,t,n){const r=this;let o;return function(t){return e.enter("definition"),function(t){return bw.call(r,e,i,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function i(t){return o=Lk(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return Vk(t)?kw(e,a)(t):a(t)}function a(t){return _w(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function c(t){return e.attempt(xw,u,u)(t)}function u(t){return qk(t)?Gk(e,l,"whitespace")(t):l(t)}function l(i){return null===i||$k(i)?(e.exit("definition"),r.parser.defined.push(o),t(i)):n(i)}}},xw={partial:!0,tokenize:function(e,t,n){return function(t){return Vk(t)?kw(e,r)(t):n(t)};function r(t){return Sw(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return qk(t)?Gk(e,i,"whitespace")(t):i(t)}function i(e){return null===e||$k(e)?t(e):n(e)}}},Ew={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return $k(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},Tw={name:"headingAtx",resolve:function(e,t){let n,r,o=e.length-2,i=3;return"whitespace"===e[i][1].type&&(i+=2),o-2>i&&"whitespace"===e[o][1].type&&(o-=2),"atxHeadingSequence"===e[o][1].type&&(i===o-1||o-4>i&&"whitespace"===e[o-2][1].type)&&(o-=i+1===o?2:4),o>i&&(n={type:"atxHeadingText",start:e[i][1].start,end:e[o][1].end},r={type:"chunkText",start:e[i][1].start,end:e[o][1].end,contentType:"text"},Ik(e,i,o-i+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),o(t)}(t)};function o(t){return 35===t&&r++<6?(e.consume(t),o):null===t||Vk(t)?(e.exit("atxHeadingSequence"),i(t)):n(t)}function i(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||$k(n)?(e.exit("atxHeading"),t(n)):qk(n)?Gk(e,i,"whitespace")(n):(e.enter("atxHeadingText"),a(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),i(t))}function a(t){return null===t||35===t||Vk(t)?(e.exit("atxHeadingText"),i(t)):(e.consume(t),a)}}},Cw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Iw=["pre","script","style","textarea"],Aw={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){const r=this;let o,i,s,a,c;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),u}(t)};function u(a){return 33===a?(e.consume(a),l):47===a?(e.consume(a),i=!0,p):63===a?(e.consume(a),o=3,r.interrupt?t:L):Nk(a)?(e.consume(a),s=String.fromCharCode(a),h):n(a)}function l(i){return 45===i?(e.consume(i),o=2,d):91===i?(e.consume(i),o=5,a=0,f):Nk(i)?(e.consume(i),o=4,r.interrupt?t:L):n(i)}function d(o){return 45===o?(e.consume(o),r.interrupt?t:L):n(o)}function f(o){return o==="CDATA[".charCodeAt(a++)?(e.consume(o),6===a?r.interrupt?t:T:f):n(o)}function p(t){return Nk(t)?(e.consume(t),s=String.fromCharCode(t),h):n(t)}function h(a){if(null===a||47===a||62===a||Vk(a)){const c=47===a,u=s.toLowerCase();return c||i||!Iw.includes(u)?Cw.includes(s.toLowerCase())?(o=6,c?(e.consume(a),m):r.interrupt?t(a):T(a)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(a):i?g(a):y(a)):(o=1,r.interrupt?t(a):T(a))}return 45===a||Pk(a)?(e.consume(a),s+=String.fromCharCode(a),h):n(a)}function m(o){return 62===o?(e.consume(o),r.interrupt?t:T):n(o)}function g(t){return qk(t)?(e.consume(t),g):x(t)}function y(t){return 47===t?(e.consume(t),x):58===t||95===t||Nk(t)?(e.consume(t),v):qk(t)?(e.consume(t),y):x(t)}function v(t){return 45===t||46===t||58===t||95===t||Pk(t)?(e.consume(t),v):_(t)}function _(t){return 61===t?(e.consume(t),b):qk(t)?(e.consume(t),_):y(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),c=t,S):qk(t)?(e.consume(t),b):k(t)}function S(t){return t===c?(e.consume(t),c=null,w):null===t||$k(t)?n(t):(e.consume(t),S)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||Vk(t)?_(t):(e.consume(t),k)}function w(e){return 47===e||62===e||qk(e)?y(e):n(e)}function x(t){return 62===t?(e.consume(t),E):n(t)}function E(t){return null===t||$k(t)?T(t):qk(t)?(e.consume(t),E):n(t)}function T(t){return 45===t&&2===o?(e.consume(t),R):60===t&&1===o?(e.consume(t),M):62===t&&4===o?(e.consume(t),N):63===t&&3===o?(e.consume(t),L):93===t&&5===o?(e.consume(t),D):!$k(t)||6!==o&&7!==o?null===t||$k(t)?(e.exit("htmlFlowData"),C(t)):(e.consume(t),T):(e.exit("htmlFlowData"),e.check(Rw,P,C)(t))}function C(t){return e.check(Mw,I,P)(t)}function I(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return null===t||$k(t)?C(t):(e.enter("htmlFlowData"),T(t))}function R(t){return 45===t?(e.consume(t),L):T(t)}function M(t){return 47===t?(e.consume(t),s="",O):T(t)}function O(t){if(62===t){const n=s.toLowerCase();return Iw.includes(n)?(e.consume(t),N):T(t)}return Nk(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),O):T(t)}function D(t){return 93===t?(e.consume(t),L):T(t)}function L(t){return 62===t?(e.consume(t),N):45===t&&2===o?(e.consume(t),L):T(t)}function N(t){return null===t||$k(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),N)}function P(n){return e.exit("htmlFlow"),t(n)}}},Rw={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(ow,t,n)}}},Mw={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return $k(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):n(t)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},Ow={name:"htmlText",tokenize:function(e,t,n){const r=this;let o,i,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),c):47===t?(e.consume(t),b):63===t?(e.consume(t),v):Nk(t)?(e.consume(t),w):n(t)}function c(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,p):Nk(t)?(e.consume(t),y):n(t)}function u(t){return 45===t?(e.consume(t),f):n(t)}function l(t){return null===t?n(t):45===t?(e.consume(t),d):$k(t)?(s=l,O(t)):(e.consume(t),l)}function d(t){return 45===t?(e.consume(t),f):l(t)}function f(e){return 62===e?M(e):45===e?d(e):l(e)}function p(t){return t==="CDATA[".charCodeAt(i++)?(e.consume(t),6===i?h:p):n(t)}function h(t){return null===t?n(t):93===t?(e.consume(t),m):$k(t)?(s=h,O(t)):(e.consume(t),h)}function m(t){return 93===t?(e.consume(t),g):h(t)}function g(t){return 62===t?M(t):93===t?(e.consume(t),g):h(t)}function y(t){return null===t||62===t?M(t):$k(t)?(s=y,O(t)):(e.consume(t),y)}function v(t){return null===t?n(t):63===t?(e.consume(t),_):$k(t)?(s=v,O(t)):(e.consume(t),v)}function _(e){return 62===e?M(e):v(e)}function b(t){return Nk(t)?(e.consume(t),S):n(t)}function S(t){return 45===t||Pk(t)?(e.consume(t),S):k(t)}function k(t){return $k(t)?(s=k,O(t)):qk(t)?(e.consume(t),k):M(t)}function w(t){return 45===t||Pk(t)?(e.consume(t),w):47===t||62===t||Vk(t)?x(t):n(t)}function x(t){return 47===t?(e.consume(t),M):58===t||95===t||Nk(t)?(e.consume(t),E):$k(t)?(s=x,O(t)):qk(t)?(e.consume(t),x):M(t)}function E(t){return 45===t||46===t||58===t||95===t||Pk(t)?(e.consume(t),E):T(t)}function T(t){return 61===t?(e.consume(t),C):$k(t)?(s=T,O(t)):qk(t)?(e.consume(t),T):x(t)}function C(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),o=t,I):$k(t)?(s=C,O(t)):qk(t)?(e.consume(t),C):(e.consume(t),A)}function I(t){return t===o?(e.consume(t),o=void 0,R):null===t?n(t):$k(t)?(s=I,O(t)):(e.consume(t),I)}function A(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||Vk(t)?x(t):(e.consume(t),A)}function R(e){return 47===e||62===e||Vk(e)?x(e):n(e)}function M(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function O(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),D}function D(t){return qk(t)?Gk(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):L(t)}function L(t){return e.enter("htmlTextData"),s(t)}}},Dw={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t=3&&(null===i||$k(i))?(e.exit("thematicBreak"),t(i)):n(i)}function s(t){return t===r?(e.consume(t),o++,s):(e.exit("thematicBreakSequence"),qk(t)?Gk(e,i,"whitespace")(t):i(t))}}},Uw={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ow,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Gk(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!qk(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Vw,t,o)(n))});function o(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Gk(e,e.attempt(Uw,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,s=0;return function(t){const o=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||t===r.containerState.marker:Bk(t)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(zw,n,c)(t):c(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return n(t)};function a(t){return Bk(t)&&++s<10?(e.consume(t),a):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),c(t)):n(t)}function c(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(ow,r.interrupt?n:u,e.attempt($w,d,l))}function u(e){return r.containerState.initialBlankLine=!0,i++,d(e)}function l(t){return qk(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},$w={partial:!0,tokenize:function(e,t,n){const r=this;return Gk(e,function(e){const o=r.events[r.events.length-1];return!qk(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Vw={partial:!0,tokenize:function(e,t,n){const r=this;return Gk(e,function(e){const o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},qw={name:"setextUnderline",resolveTo:function(e,t){let n,r,o,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){n=i;break}"paragraph"===e[i][1].type&&(r=i)}else"content"===e[i][1].type&&e.splice(i,1),o||"definition"!==e[i][1].type||(o=i);const s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",s,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end={...e[o][1].end}):e[n][1]=s,e.push(["exit",s,t]),e},tokenize:function(e,t,n){const r=this;let o;return function(t){let s,a=r.events.length;for(;a--;)if("lineEnding"!==r.events[a][1].type&&"linePrefix"!==r.events[a][1].type&&"content"!==r.events[a][1].type){s="paragraph"===r.events[a][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!s?n(t):(e.enter("setextHeadingLine"),o=t,function(t){return e.enter("setextHeadingLineSequence"),i(t)}(t))};function i(t){return t===o?(e.consume(t),i):(e.exit("setextHeadingLineSequence"),qk(t)?Gk(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||$k(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}},Ww={tokenize:function(e){const t=this,n=e.attempt(ow,function(r){if(null!==r)return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n;e.consume(r)},e.attempt(this.parser.constructs.flowInitial,r,Gk(e,e.attempt(this.parser.constructs.flow,r,e.attempt(yw,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}},Hw={resolveAll:Jw()},Kw=Gw("string"),Yw=Gw("text");function Gw(e){return{resolveAll:Jw("text"===e?Xw:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],o=t.attempt(r,i,s);return i;function i(e){return c(e)?o(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return c(e)?(t.exit("data"),o(e)):(t.consume(e),a)}function c(e){if(null===e)return!0;const t=r[e];let o=-1;if(t)for(;++o-1){const e=s[0];"string"==typeof e?s[0]=e.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}(s,e)}function f(){const{_bufferIndex:e,_index:t,line:n,column:o,offset:i}=r;return{_bufferIndex:e,_index:t,line:n,column:o,offset:i}}function p(e){l=l(e)}function h(e,t){t.restore()}function m(e,t){return function(n,o,i){let s,l,d,p;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(h=n,function(e){const t=null!==e&&h[e],n=null!==e&&h.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});var h;function m(e){return s=e,l=0,0===e.length?i:g(e[l])}function g(e){return function(n){return p=function(){const e=f(),t=u.previous,n=u.currentConstruct,o=u.events.length,i=Array.from(a);return{from:o,restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=o,a=i,y()}}}(),d=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name)?_():e.tokenize.call(t?Object.assign(Object.create(u),t):u,c,v,_)(n)}}function v(t){return e(d,p),o}function _(e){return p.restore(),++l0){const e=a.tokenStack[a.tokenStack.length-1];(e[1]||mx).call(a,void 0,e[0])}for(o.position={start:fx(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:fx(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d1:t}function _x(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(bx(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(bx(t.slice(o),o>0,!1)),i.join("")}function bx(e,t,n){let r=0,o=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(o-1);for(;9===t||32===t;)o--,t=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}const Sx={blockquote:function(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=Yk(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);void 0===a?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yx(e,t);const o={src:Yk(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)},image:function(e,t){const n={src:Yk(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yx(e,t);const o={href:Yk(r.url||"")};null!==r.title&&void 0!==r.title&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},link:function(e,t){const n={href:Yk(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){const r=e.all(t),o=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},i=ek(t.children[1]),s=ZS(t.children[t.children.length-1]);i&&s&&(r.position={start:i,end:s}),o.push(r)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,o=0===(r?r.indexOf(t):1)?"th":"td",i=n&&"table"===n.type?n.align:void 0,s=i?i.length:t.children.length;let a=-1;const c=[];for(;++a((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=o=>{if(e.has(o))return e.get(o);const[i,s]=t[o];switch(i){case 0:case-1:return n(s,o);case 1:{const e=n([],o);for(const t of s)e.push(r(t));return e}case 2:{const e=n({},o);for(const[t,n]of s)e[r(t)]=r(n);return e}case 3:return n(new Date(s),o);case 4:{const{source:e,flags:t}=s;return n(new RegExp(e,t),o)}case 5:{const e=n(new Map,o);for(const[t,n]of s)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,o);for(const t of s)e.add(r(t));return e}case 7:{const{name:e,message:t}=s;return n(new wx[e](t),o)}case 8:return n(BigInt(s),o);case"BigInt":return n(Object(BigInt(s)),o)}return n(new wx[i](s),o)};return r})(new Map,e)(0),Ex="",{toString:Tx}={},{keys:Cx}=Object,Ix=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=Tx.call(e).slice(8,-1);switch(n){case"Array":return[1,Ex];case"Object":return[2,Ex];case"Date":return[3,Ex];case"RegExp":return[4,Ex];case"Map":return[5,Ex];case"Set":return[6,Ex]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Ax=([e,t])=>0===e&&("function"===t||"symbol"===t),Rx=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const o=(e,t)=>{const o=r.push(e)-1;return n.set(t,o),o},i=r=>{if(n.has(r))return n.get(r);let[s,a]=Ix(r);switch(s){case 0:{let t=r;switch(a){case"bigint":s=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);t=null;break;case"undefined":return o([-1],r)}return o([s,t],r)}case 1:{if(a)return o([a,[...r]],r);const e=[],t=o([s,e],r);for(const n of r)e.push(i(n));return t}case 2:{if(a)switch(a){case"BigInt":return o([a,r.toString()],r);case"Boolean":case"Number":case"String":return o([a,r.valueOf()],r)}if(t&&"toJSON"in r)return i(r.toJSON());const n=[],c=o([s,n],r);for(const t of Cx(r))!e&&Ax(Ix(r[t]))||n.push([i(t),i(r[t])]);return c}case 3:return o([s,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return o([s,{source:e,flags:t}],r)}case 5:{const t=[],n=o([s,t],r);for(const[o,s]of r)(e||!Ax(Ix(o))&&!Ax(Ix(s)))&&t.push([i(o),i(s)]);return n}case 6:{const t=[],n=o([s,t],r);for(const o of r)!e&&Ax(Ix(o))||t.push(i(o));return n}}const{message:c}=r;return o([s,{name:a,message:c}],r)};return i})(!(t||n),!!t,new Map,r)(e),r},Mx="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?xx(Rx(e,t)):structuredClone(e):(e,t)=>xx(Rx(e,t));function Ox(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Dx(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const Lx=function(e){if(null==e)return Px;if("function"==typeof e)return Nx(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n":"")+")"})}return l;function l(){let u,l,d,f=jx;if((!t||i(o,a,c[c.length-1]||void 0))&&(f=function(e){return Array.isArray(e)?e:"number"==typeof e?[!0,e]:null==e?jx:[e]}(n(o,c)),f[0]===Fx))return f;if("children"in o&&o.children){const t=o;if(t.children&&"skip"!==f[0])for(l=(r?t.children.length:-1)+s,d=c.concat(t);l>-1&&l0&&n.push({type:"text",value:"\n"}),n}function Hx(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function Kx(e,t){const n=function(e,t){const n=t||Ux,r=new Map,o=new Map,i=new Map,s={...Sx,...n.handlers},a={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(c,l);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(l>1?"-"+l:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(c,l),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const p=i[i.length-1];if(p&&"element"===p.type&&"p"===p.tagName){const e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...d)}else i.push(...d);const h={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(i,!0)};e.patch(o,h),a.push(h)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Mx(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:"\n"},o),i}function Yx(e,t){return e&&"run"in e?async function(n,r){const o=Kx(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Kx(n,{file:r,...e||t})}}function Gx(e){if(e)throw e}var Jx,Xx;function Qx(){if(Xx)return Jx;Xx=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},i=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,o=e.call(n,"constructor"),i=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!o&&!i)return!1;for(r in n);return void 0===r||e.call(n,r)},s=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},a=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Jx=function e(){var t,n,r,c,u,l,d=arguments[0],f=1,p=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});fe.length){for(;i--;)if(47===e.codePointAt(i)){if(n){r=i+1;break}}else o<0&&(n=!0,o=i+1);return o<0?"":e.slice(r,o)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(47===e.codePointAt(i)){if(n){r=i+1;break}}else s<0&&(n=!0,s=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(o=i):(a=-1,o=s));return r===o?o=s:o<0&&(o=e.length),e.slice(r,o)},nE=function(e){if(sE(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},rE=function(e){sE(e);let t,n=e.length,r=-1,o=0,i=-1,s=0;for(;n--;){const a=e.codePointAt(n);if(47!==a)r<0&&(t=!0,r=n+1),46===a?i<0?i=n:1!==s&&(s=1):i>-1&&(s=-1);else if(t){o=n+1;break}}return i<0||r<0||0===s||1===s&&i===r-1&&i===o+1?"":e.slice(i,r)},oE=function(...e){let t,n=-1;for(;++n2){if(r=o.lastIndexOf("/"),r!==o.length-1){r<0?(o="",i=0):(o=o.slice(0,r),i=o.length-1-o.lastIndexOf("/")),s=c,a=0;continue}}else if(o.length>0){o="",i=0,s=c,a=0;continue}t&&(o=o.length>0?o+"/..":"..",i=2)}else o.length>0?o+="/"+e.slice(s+1,c):o=e.slice(s+1,c),i=c-s-1;s=c,a=0}else 46===n&&a>-1?a++:a=-1}return o}(e,!t);return 0!==n.length||t||(n="."),n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},iE="/";function sE(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const aE=function(){return"/"};function cE(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}const uE=["history","path","basename","stem","extname","dirname"];class lE{constructor(e){let t;t=e?cE(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":aE(),this.data={},this.history=[],this.messages=[];let n,r=-1;for(;++rt.length;let a;s&&t.push(r);try{a=e.apply(this,t)}catch(i){if(s&&n)throw i;return r(i)}s||(a&&a.then&&"function"==typeof a.then?a.then(o,r):a instanceof Error?r(a):o(a))};function r(e,...r){n||(n=!0,t(e,...r))}function o(e){r(null,e)}}(a,o)(...s):r(null,...s)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){const e=new gE;let t=-1;for(;++t0){let[r,...i]=t;const s=n[o][1];eE(s)&&eE(r)&&(r=Zx(!0,s,r)),n[o]=[e,r,...i]}}}}const yE=(new gE).freeze();function vE(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function _E(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function bE(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function SE(e){if(!eE(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function kE(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function wE(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new lE(e)}const xE=[],EE={allowDangerousHtml:!0},TE=/^(https?|ircs?|mailto|xmpp)$/i,CE=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function IE(e){const t=function(e){const t=e.rehypePlugins||xE,n=e.remarkPlugins||xE,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...EE}:EE;return yE().use(gx).use(n).use(Yx,r).use(t)}(e),n=function(e){const t=e.children||"",n=new lE;return"string"==typeof t&&(n.value=t),n}(e);return function(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||AE;for(const u of CE);return Bx(e,function(e,t,o){if("raw"===e.type&&o&&"number"==typeof t)return s?o.children.splice(t,1):o.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in kk)if(Object.hasOwn(kk,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=kk[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=c(String(n||""),t,e))}}if("element"===e.type){let s=n?!n.includes(e.tagName):!!i&&i.includes(e.tagName);if(!s&&r&&"number"==typeof t&&(s=!r(e,t,o)),s&&o&&"number"==typeof t)return a&&e.children?o.children.splice(t,1,...e.children):o.children.splice(t,1),t}}),function(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return function(n,r,o,i){const s=Array.isArray(o.children),a=ek(n);return t(r,o,i,s,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");o=t.jsx,i=t.jsxs,r=function(e,t,n,r){const s=Array.isArray(n.children)?i:o;return r?s(t,n,r):s(t,n)}}var o,i;const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?BS:FS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},a=pk(s,e,void 0);return a&&"string"!=typeof a?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}(e,{Fragment:g.Fragment,components:o,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0})}(t.runSync(t.parse(n),n),e)}function AE(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return-1===t||-1!==o&&t>o||-1!==n&&t>n||-1!==r&&t>r||TE.test(e.slice(0,t))?e:""}const RE={en:{message_placeholder:"Type your message...",send_button:"Send",sending_button:"Sending...",continue_button:"Continue",confirm_button:"Confirm",loading:"Loading...",please_select:"Please select:",privacy_notice:"By using the chat, you confirm that you have read and accepted our ",rate_limit_error:"Too many messages. Please wait a moment before sending another message.",unsafe_input_error:"Your message contains invalid characters. Please try again."},it:{message_placeholder:"Scrivi il tuo messaggio...",send_button:"Invia",sending_button:"Invio in corso...",continue_button:"Continuare",confirm_button:"Conferma",loading:"Caricamento...",please_select:"Seleziona:",privacy_notice:"Utilizzando la chat, confermi di aver letto e accettato la nostra ",rate_limit_error:"Troppi messaggi. Attendi un momento prima di inviare un altro messaggio.",unsafe_input_error:"Il tuo messaggio contiene caratteri non validi. Riprova."}},ME=e.memo(function({onLanguageSelected:t}){const{askUser:n,actions:r}=(()=>{let e=Ji(Xa),t=Ji(ac),n=Ji(cc),r=Ji(Ya),o=Ji(Ka),i=Ji(Qa),s=Ji(rc),a=Ji(oc),c=Ji(sc),u=Ji(ic),l=o?.socket.connected&&!o?.error;return{actions:r,askUser:i,callFn:s,chatSettingsDefaultValue:u,chatSettingsInputs:a,chatSettingsValue:c,connected:l,disabled:!l||e||"file"===i?.spec.type||"action"===i?.spec.type,elements:t,error:o?.error,loading:e,tasklists:n}})(),{messages:o}=(()=>{let e=Ji(Ga),t=Ji(uc);return{threadId:Ji(dc),messages:e,firstInteraction:t}})(),{sendMessage:i}=xc(),[s,a]=e.useState(""),[c,u]=e.useState(!1),[l,d]=e.useState(!1),[f,p]=e.useState(!1),[h,m]=e.useState(null),y=e.useRef(null),[v,_]=e.useState(!1),[b,S]=e.useState(!0),k=e.useRef(null),w=e.useMemo(()=>function e(t){return t.reduce((t,n)=>(t.push(n),n.steps&&t.push(...e(n.steps)),t),[])}(o),[o]),{t:x,changeLanguage:E}=function(t="en"){const[n,r]=e.useState(t);return{t:e=>RE[n][e]||e,changeLanguage:e=>{r(e)},language:n}}("en"),[T,C]=e.useState(!0),I=r.some(e=>e.name?.startsWith("multi_select_")),A=e.useRef(null),[R,M]=e.useState([]);e.useEffect(()=>{const e=y.current;if(!e)return;const t=()=>{const{scrollTop:t,scrollHeight:n,clientHeight:r}=e;S(t+r>=n-20),_(!0),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{_(!1)},150)};return e.addEventListener("scroll",t,{passive:!0}),()=>{e.removeEventListener("scroll",t),k.current&&clearTimeout(k.current)}},[]),e.useEffect(()=>{const e=y.current;if(e&&(b||!v)){const t=setTimeout(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},50);return()=>clearTimeout(t)}},[o,b,v]);const O=e.useMemo(()=>{for(let e=w.length-1;e>=0;e--){const t=w[e];if("on_message"!==t.name&&"on_chat_start"!==t.name&&t.output?.trim()&&t.language)return t.language.toLowerCase().slice(0,2)}return null},[w]);e.useEffect(()=>{O&&(E(O),t())},[O]),e.useEffect(()=>{c&&n&&u(!1)},[c,n]),e.useEffect(()=>{if(f)d(!1);else if(!n&&!c&&o.length>0){const e=w[w.length-1];e&&"user"!==e.name?d(!0):d(!1)}else n&&d(!1)},[n,c,o,w,f]),e.useEffect(()=>{if(o.length>0&&w.length>0){const e=w[w.length-1];e&&"user"!==e.name&&f&&p(!1)}},[o,w,f]);const D=w[w.length-1],L=D&&"user"!==D.name&&!D.waitForAnswer;e.useEffect(()=>{if(!y.current)return;const e=y.current;if(L){const t=requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight});return()=>{cancelAnimationFrame(t)}}},[o,L]);const N=e.memo(function({onClose:e}){return g.jsxs("div",{style:{background:"#F0F9FF",border:"1px solid #BFDBFE",padding:"12px 16px",borderRadius:"12px",marginBottom:"12px",fontSize:"13px",color:"#1E3A8A",maxWidth:"90%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"12px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",lineHeight:"1.5"},children:[g.jsxs("span",{style:{flex:1,textAlign:"left"},children:[x("privacy_notice")," ",g.jsx("a",{href:"https://www.incentivimpresa.it/centro-privacy/informativa-sulla-privacy/",target:"_blank",rel:"noopener noreferrer",style:{color:"#2563EB",textDecoration:"underline",fontWeight:"500"},children:"privacy policy"}),"."]}),g.jsx("button",{onClick:e,style:{background:"transparent",border:"none",fontSize:"18px",cursor:"pointer",color:"#6B7280",lineHeight:"1",padding:"4px",borderRadius:"4px",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)"},"aria-label":"Chiudi",onMouseEnter:e=>{e.currentTarget.style.background="#DBEAFE",e.currentTarget.style.color="#1F2937"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="#6B7280"},children:"✕"})]})}),P=e.memo(()=>g.jsxs("div",{className:"flex items-center justify-center space-x-2 text-blue-500 dark:text-blue-500 text-5xl font-bold",children:[g.jsx("span",{className:"animate-bounce",children:"."}),g.jsx("span",{className:"animate-bounce delay-200",children:"."}),g.jsx("span",{className:"animate-bounce delay-400",children:"."})]}));return g.jsxs("div",{className:"flex flex-col bg-white container mx-auto relative h-full",style:{padding:"0",height:"100%",display:"flex",flexDirection:"column"},children:[g.jsxs("div",{ref:y,className:"flex-1 space-y-4",style:{overflow:"auto",scrollBehavior:"smooth",flex:1,padding:"24px 20px 120px 20px"},children:[w.map((e,t)=>{if("on_message"===e.name||"on_chat_start"===e.name||!e.output?.trim())return null;const n=e.output.startsWith("**Selected:**");return!(n&&e.output.includes(x("continue_button")))&&g.jsxs("div",{style:{display:"flex",marginLeft:"auto",justifyContent:n||"user"==e.name?"flex-end":"flex-start",marginBottom:"16px"},children:[g.jsx("div",{className:`p-4 rounded-xl shadow ${"user"===e.name?"bg-blue-100 dark:bg-blue-900 text-blue-900 dark:text-blue-100":"bg-white dark:bg-gray-700 text-gray-800 dark:text-gray-100"} ${n||"user"==e.name?"inline-block":""}`,style:{padding:n||"user"==e.name?"12px 18px":"16px 20px",borderRadius:"16px",marginBottom:"0",background:n||"user"==e.name?"#3B82F6":"#F9FAFB",border:n||"user"==e.name?"none":"1px solid #E5E7EB",display:"user"==e.name?"flex":"inline-block",color:n||"user"==e.name?"#fff":"#1F2937",alignItems:"center",gap:"10px",maxWidth:"85%",boxShadow:n||"user"==e.name?"0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -2px rgba(59, 130, 246, 0.1)":"0 1px 2px 0 rgba(0, 0, 0, 0.05)",fontSize:"15px",lineHeight:"1.6"},children:n?g.jsx("div",{className:"flex flex-wrap gap-2 items-center",style:{display:"flex",alignItems:"center",gap:"13px",margin:"10px"},children:e.output.replace(/\*\*Selected:\*\*/g,"").split("*").map((e,t)=>g.jsx("div",{className:"bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium",children:e.trim()},t))}):g.jsx(g.Fragment,{children:g.jsx("p",{className:"whitespace-pre-wrap",style:{margin:"0"},children:g.jsx(IE,{children:e.output})})})}),t===w.length-1&&g.jsx("div",{ref:A})]},e.id)}),l&&g.jsx(P,{}),n&&"action"===n.spec?.type&&g.jsxs("div",{className:"space-y-3",style:{marginTop:"16px"},children:[g.jsx("h4",{className:"text-lg font-semibold text-gray-700 dark:text-gray-200",style:{margin:"0 0 12px 0",fontSize:"15px",fontWeight:"600",color:"#374151"},children:x("please_select")}),I?g.jsx("div",{className:"space-y-2",children:r.map((e,t)=>g.jsxs(g.Fragment,{children:["multi_select_done"!=e.name&&g.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"6px"},children:[g.jsx(Qb,{checked:R.includes(e.label),onCheckedChange:()=>{M(t=>((e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t])(t,e.label))}}),g.jsx("label",{className:"text-sm",children:e.label})]},e.id),"multi_select_done"===e.name&&t===r.length-1&&g.jsx("div",{className:"flex flex-wrap gap-3",children:g.jsx(Xb,{style:{background:h===e.id?"#2563EB":"#3B82F6",padding:"10px 24px",border:"0px",marginRight:"0",marginBottom:"0",borderRadius:"10px",color:"#fff",cursor:"pointer",marginTop:"12px",fontSize:"15px",fontWeight:"600",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)"},onClick:()=>{u(!0),n.callback({name:"multi_select_done",label:R.join(", "),id:e.id,forId:e.forId,payload:{option:R.join(", "),action:"done"},onClick:()=>{},tooltip:"Complete selection"})},onMouseEnter:()=>m(e.id),onMouseLeave:()=>m(null),disabled:c,className:"rounded-full px-4 py-2 text-sm",children:x("confirm_button")},e.id)})]}))}):g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px"},children:r.map(e=>g.jsx(Xb,{style:{background:h===e.id?"#3B82F6":"#F3F4F6",padding:"10px 20px",border:h===e.id?"none":"1px solid #E5E7EB",marginRight:"0",marginBottom:"0",borderRadius:"24px",color:h===e.id?"#ffffff":"#374151",cursor:"pointer",fontSize:"14px",fontWeight:"500",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)",boxShadow:h===e.id?"0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -2px rgba(59, 130, 246, 0.1)":"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseEnter:()=>m(e.id),onMouseLeave:()=>m(null),onClick:()=>{"start_over"===e.name&&M([]),u(!0),n.callback(e)},disabled:c,className:"rounded-full px-4 py-2 text-sm chatbox-btn",children:e.label},e.id))})]})]}),g.jsxs("div",{className:"fixed bottom-4 left-0 right-0",style:{position:"absolute",bottom:"20px",width:"calc(100% - 40px)",left:"20px",right:"20px"},children:[T&&g.jsx("div",{className:"fixed bottom-[88px] left-0 right-0 flex justify-center px-4",children:g.jsx(N,{onClose:()=>C(!1)})}),g.jsxs("div",{className:"flex items-center gap-2 rounded-2xl shadow-lg container mx-auto bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700",style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"#fff",padding:"8px 8px 8px 16px",borderRadius:"16px",border:"1px solid #E5E7EB",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",gap:"8px"},children:[g.jsx(Zb,{style:{flex:"1 1 auto",padding:"10px 12px",height:"44px",background:"transparent",border:"none",boxSizing:"border-box",borderRadius:"12px",fontSize:"15px",color:"#1F2937",width:"100%"},placeholder:x("message_placeholder"),value:s,onChange:e=>a(e.target.value),onKeyUp:e=>{"Enter"!==e.key||!s.trim()||n&&"action"===n.spec?.type||(i({name:"user",type:"user_message",output:s},[]),a(""),p(!0),_(!1),S(!0))},className:"flex-1 rounded-full px-5 py-3 bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 transition-all duration-200 shadow-inner",disabled:c||n&&"action"===n.spec?.type}),g.jsx(Xb,{style:{background:c||!s.trim()||n&&"action"===n.spec?.type?"#D1D5DB":"send"===h?"#2563EB":"#3B82F6",color:"#fff",padding:"0 20px",border:"0",height:"44px",fontWeight:"600",minWidth:"80px",boxSizing:"border-box",borderRadius:"12px",cursor:c||!s.trim()||n&&"action"===n.spec?.type?"not-allowed":"pointer",fontSize:"15px",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)",boxShadow:c||!s.trim()||n&&"action"===n.spec?.type?"none":"0 1px 2px 0 rgba(0, 0, 0, 0.05)",flexShrink:0},onClick:()=>{s.trim()&&(i({name:"user",type:"user_message",output:s},[]),a(""),p(!0),_(!1),S(!0))},onMouseEnter:()=>m("send"),onMouseLeave:()=>m(null),className:"rounded-full bg-black hover:bg-blue-600 text-white px-5 py-3 transition-all duration-200 shadow-md",disabled:c||!s.trim()||n&&"action"===n.spec?.type,children:x("send_button")})]})]})]})}),OE=Object.freeze(Object.defineProperty({__proto__:null,ChatbotPlayground:ME},Symbol.toStringTag,{value:"Module"}));return jb});