@xapp/chat-widget 1.105.2 → 1.105.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.es.js +128 -167
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +128 -167
- package/dist/index.js.map +1 -1
- package/dist/xapp-chat-widget.css +1 -1
- package/dist/xapp-chat-widget.js +1 -1
- package/dist/xapp-chat-widget.js.map +1 -1
- package/package.json +7 -7
package/dist/xapp-chat-widget.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var XAppChatWidget=function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?a(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(i,s)}u((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(6===s[0]&&o.label<a[1]){o.label=a[1],a=s;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function a(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(){const e="prod";try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env: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={exports:{}},u={},l=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function d(e,t,n){var r=null;if(void 0!==n&&(r=""+n),void 0!==t.key&&(r=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return t=n.ref,{$$typeof:l,type:e,key:r,ref:void 0!==t?t:null,props:n}}u.Fragment=c,u.jsx=d,u.jsxs=d,s.exports=u;var f=s.exports,p={exports:{}},h={},v={exports:{}},m={};!function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<a(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,i=o>>>1;r<i;){var s=2*(r+1)-1,u=e[s],l=s+1,c=e[l];if(0>a(u,n))l<o&&0>a(c,u)?(e[r]=c,e[l]=n,r=l):(e[r]=u,e[s]=n,r=s);else{if(!(l<o&&0>a(c,n)))break e;e[r]=c,e[l]=n,r=l}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var u=[],l=[],c=1,d=null,f=3,p=!1,h=!1,v=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var a=n(l);null!==a;){if(null===a.callback)r(l);else{if(!(a.startTime<=e))break;r(l),a.sortIndex=a.expirationTime,t(u,a)}a=n(l)}}function w(e){if(v=!1,x(e),!h)if(null!==n(u))h=!0,S||(S=!0,k());else{var t=n(l);null!==t&&E(w,t.startTime-e)}}var k,S=!1,_=-1,O=5,C=-1;function P(){return!!m||!(e.unstable_now()-C<O)}function T(){if(m=!1,S){var t=e.unstable_now();C=t;var a=!0;try{e:{h=!1,v&&(v=!1,y(_),_=-1),p=!0;var o=f;try{t:{for(x(t),d=n(u);null!==d&&!(d.expirationTime>t&&P());){var i=d.callback;if("function"==typeof i){d.callback=null,f=d.priorityLevel;var s=i(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof s){d.callback=s,x(t),a=!0;break t}d===n(u)&&r(u),x(t)}else r(u);d=n(u)}if(null!==d)a=!0;else{var c=n(l);null!==c&&E(w,c.startTime-t),a=!1}}break e}finally{d=null,f=o,p=!1}a=void 0}}finally{a?k():S=!1}}}if("function"==typeof b)k=function(){b(T)};else if("undefined"!=typeof MessageChannel){var j=new MessageChannel,M=j.port2;j.port1.onmessage=T,k=function(){M.postMessage(null)}}else k=function(){g(T,0)};function E(t,n){_=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){m=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,a,o){var i=e.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return r={id:c++,callback:a,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>i?(r.sortIndex=o,t(l,r),null===n(u)&&r===n(l)&&(v?(y(_),_=-1):v=!0,E(w,o-i))):(r.sortIndex=s,t(u,r),h||p||(h=!0,S||(S=!0,k()))),r},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(m),v.exports=m;var g=v.exports,y={exports:{}},b={},x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),C=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),j=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),N=Symbol.iterator;var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,R={};function A(e,t,n){this.props=e,this.context=t,this.refs=R,this.updater=n||I}function L(){}function U(e,t,n){this.props=e,this.context=t,this.refs=R,this.updater=n||I}A.prototype.isReactComponent={},A.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},A.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},L.prototype=A.prototype;var z=U.prototype=new L;z.constructor=U,D(z,A.prototype),z.isPureReactComponent=!0;var F=Array.isArray;function B(){}var W={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function q(e,t,n){var r=n.ref;return{$$typeof:x,type:e,key:t,ref:void 0!==r?r:null,props:n}}function Y(e){return"object"==typeof e&&null!==e&&e.$$typeof===x}var V=/\/+/g;function Q(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function $(e,t,n,r,a){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var i,s,u=!1;if(null===e)u=!0;else switch(o){case"bigint":case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case x:case w:u=!0;break;case M:return $((u=e._init)(e._payload),t,n,r,a)}}if(u)return a=a(e),u=""===r?"."+Q(e,0):r,F(a)?(n="",null!=u&&(n=u.replace(V,"$&/")+"/"),$(a,t,n,"",function(e){return e})):null!=a&&(Y(a)&&(i=a,s=n+(null==a.key||e&&e.key===a.key?"":(""+a.key).replace(V,"$&/")+"/")+u,a=q(i.type,s,i.props)),t.push(a)),1;u=0;var l,c=""===r?".":r+":";if(F(e))for(var d=0;d<e.length;d++)u+=$(r=e[d],t,n,o=c+Q(r,d),a);else if("function"==typeof(d=null===(l=e)||"object"!=typeof l?null:"function"==typeof(l=N&&l[N]||l["@@iterator"])?l:null))for(e=d.call(e),d=0;!(r=e.next()).done;)u+=$(r=r.value,t,n,o=c+Q(r,d++),a);else if("object"===o){if("function"==typeof e.then)return $(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(B,B):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,n,r,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return u}function K(e,t,n){if(null==e)return e;var r=[],a=0;return $(e,r,"","",function(e){return t.call(n,e,a++)}),r}function J(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var G="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},X={map:K,forEach:function(e,t,n){K(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return K(e,function(){t++}),t},toArray:function(e){return K(e,function(e){return e})||[]},only:function(e){if(!Y(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};b.Activity=E,b.Children=X,b.Component=A,b.Fragment=k,b.Profiler=_,b.PureComponent=U,b.StrictMode=S,b.Suspense=T,b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,b.__COMPILER_RUNTIME={__proto__:null,c:function(e){return W.H.useMemoCache(e)}},b.cache=function(e){return function(){return e.apply(null,arguments)}},b.cacheSignal=function(){return null},b.cloneElement=function(e,t,n){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var r=D({},e.props),a=e.key;if(null!=t)for(o in void 0!==t.key&&(a=""+t.key),t)!H.call(t,o)||"key"===o||"__self"===o||"__source"===o||"ref"===o&&void 0===t.ref||(r[o]=t[o]);var o=arguments.length-2;if(1===o)r.children=n;else if(1<o){for(var i=Array(o),s=0;s<o;s++)i[s]=arguments[s+2];r.children=i}return q(e.type,a,r)},b.createContext=function(e){return(e={$$typeof:C,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:O,_context:e},e},b.createElement=function(e,t,n){var r,a={},o=null;if(null!=t)for(r in void 0!==t.key&&(o=""+t.key),t)H.call(t,r)&&"key"!==r&&"__self"!==r&&"__source"!==r&&(a[r]=t[r]);var i=arguments.length-2;if(1===i)a.children=n;else if(1<i){for(var s=Array(i),u=0;u<i;u++)s[u]=arguments[u+2];a.children=s}if(e&&e.defaultProps)for(r in i=e.defaultProps)void 0===a[r]&&(a[r]=i[r]);return q(e,o,a)},b.createRef=function(){return{current:null}},b.forwardRef=function(e){return{$$typeof:P,render:e}},b.isValidElement=Y,b.lazy=function(e){return{$$typeof:M,_payload:{_status:-1,_result:e},_init:J}},b.memo=function(e,t){return{$$typeof:j,type:e,compare:void 0===t?null:t}},b.startTransition=function(e){var t=W.T,n={};W.T=n;try{var r=e(),a=W.S;null!==a&&a(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(B,G)}catch(e){G(e)}finally{null!==t&&null!==n.types&&(t.types=n.types),W.T=t}},b.unstable_useCacheRefresh=function(){return W.H.useCacheRefresh()},b.use=function(e){return W.H.use(e)},b.useActionState=function(e,t,n){return W.H.useActionState(e,t,n)},b.useCallback=function(e,t){return W.H.useCallback(e,t)},b.useContext=function(e){return W.H.useContext(e)},b.useDebugValue=function(){},b.useDeferredValue=function(e,t){return W.H.useDeferredValue(e,t)},b.useEffect=function(e,t){return W.H.useEffect(e,t)},b.useEffectEvent=function(e){return W.H.useEffectEvent(e)},b.useId=function(){return W.H.useId()},b.useImperativeHandle=function(e,t,n){return W.H.useImperativeHandle(e,t,n)},b.useInsertionEffect=function(e,t){return W.H.useInsertionEffect(e,t)},b.useLayoutEffect=function(e,t){return W.H.useLayoutEffect(e,t)},b.useMemo=function(e,t){return W.H.useMemo(e,t)},b.useOptimistic=function(e,t){return W.H.useOptimistic(e,t)},b.useReducer=function(e,t,n){return W.H.useReducer(e,t,n)},b.useRef=function(e){return W.H.useRef(e)},b.useState=function(e){return W.H.useState(e)},b.useSyncExternalStore=function(e,t,n){return W.H.useSyncExternalStore(e,t,n)},b.useTransition=function(){return W.H.useTransition()},b.version="19.2.5",y.exports=b;var Z=y.exports,ee=i(Z),te={exports:{}},ne={},re=Z;function ae(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function oe(){}var ie={d:{f:oe,r:function(){throw Error(ae(522))},D:oe,C:oe,L:oe,m:oe,X:oe,S:oe,M:oe},p:0,findDOMNode:null},se=Symbol.for("react.portal");var ue=re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function le(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}ne.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ie,ne.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(ae(299));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:se,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},ne.flushSync=function(e){var t=ue.T,n=ie.p;try{if(ue.T=null,ie.p=2,e)return e()}finally{ue.T=t,ie.p=n,ie.d.f()}},ne.preconnect=function(e,t){"string"==typeof e&&(t?t="string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:t=null,ie.d.C(e,t))},ne.prefetchDNS=function(e){"string"==typeof e&&ie.d.D(e)},ne.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var n=t.as,r=le(n,t.crossOrigin),a="string"==typeof t.integrity?t.integrity:void 0,o="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===n?ie.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):"script"===n&&ie.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},ne.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var n=le(t.as,t.crossOrigin);ie.d.M(e,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&ie.d.M(e)},ne.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var n=t.as,r=le(n,t.crossOrigin);ie.d.L(e,n,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},ne.preloadModule=function(e,t){if("string"==typeof e)if(t){var n=le(t.as,t.crossOrigin);ie.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else ie.d.m(e)},ne.requestFormReset=function(e){ie.d.r(e)},ne.unstable_batchedUpdates=function(e,t){return e(t)},ne.useFormState=function(e,t,n){return ue.H.useFormState(e,t,n)},ne.useFormStatus=function(){return ue.H.useHostTransitionStatus()},ne.version="19.2.5",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),te.exports=ne;var ce=te.exports,de=g,fe=Z,pe=ce;function he(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function ve(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function me(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function ge(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function ye(e){if(31===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function be(e){if(me(e)!==e)throw Error(he(188))}function xe(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=xe(e)))return t;e=e.sibling}return null}var we=Object.assign,ke=Symbol.for("react.element"),Se=Symbol.for("react.transitional.element"),_e=Symbol.for("react.portal"),Oe=Symbol.for("react.fragment"),Ce=Symbol.for("react.strict_mode"),Pe=Symbol.for("react.profiler"),Te=Symbol.for("react.consumer"),je=Symbol.for("react.context"),Me=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),Ne=Symbol.for("react.suspense_list"),Ie=Symbol.for("react.memo"),De=Symbol.for("react.lazy"),Re=Symbol.for("react.activity"),Ae=Symbol.for("react.memo_cache_sentinel"),Le=Symbol.iterator;function Ue(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Le&&e[Le]||e["@@iterator"])?e:null}var ze=Symbol.for("react.client.reference");function Fe(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===ze?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case Oe:return"Fragment";case Pe:return"Profiler";case Ce:return"StrictMode";case Ee:return"Suspense";case Ne:return"SuspenseList";case Re:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case _e:return"Portal";case je:return e.displayName||"Context";case Te:return(e._context.displayName||"Context")+".Consumer";case Me:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case Ie:return null!==(t=e.displayName||null)?t:Fe(e.type)||"Memo";case De:t=e._payload,e=e._init;try{return Fe(e(t))}catch(e){}}return null}var Be=Array.isArray,We=fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,He=pe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,qe={pending:!1,data:null,method:null,action:null},Ye=[],Ve=-1;function Qe(e){return{current:e}}function $e(e){0>Ve||(e.current=Ye[Ve],Ye[Ve]=null,Ve--)}function Ke(e,t){Ve++,Ye[Ve]=e.current,e.current=t}var Je,Ge,Xe=Qe(null),Ze=Qe(null),et=Qe(null),tt=Qe(null);function nt(e,t){switch(Ke(et,t),Ke(Ze,e),Ke(Xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Cf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=Pf(t=Cf(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$e(Xe),Ke(Xe,e)}function rt(){$e(Xe),$e(Ze),$e(et)}function at(e){null!==e.memoizedState&&Ke(tt,e);var t=Xe.current,n=Pf(t,e.type);t!==n&&(Ke(Ze,e),Ke(Xe,n))}function ot(e){Ze.current===e&&($e(Xe),$e(Ze)),tt.current===e&&($e(tt),bp._currentValue=qe)}function it(e){if(void 0===Je)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Je=t&&t[1]||"",Ge=-1<e.stack.indexOf("\n at")?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+Je+e+Ge}var st=!1;function ut(e,t){if(!e||st)return"";st=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&r&&"string"==typeof e.stack)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=r.DetermineComponentFrameRoot(),i=o[0],s=o[1];if(i&&s){var u=i.split("\n"),l=s.split("\n");for(a=r=0;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;for(;a<l.length&&!l[a].includes("DetermineComponentFrameRoot");)a++;if(r===u.length||a===l.length)for(r=u.length-1,a=l.length-1;1<=r&&0<=a&&u[r]!==l[a];)a--;for(;1<=r&&0<=a;r--,a--)if(u[r]!==l[a]){if(1!==r||1!==a)do{if(r--,0>--a||u[r]!==l[a]){var c="\n"+u[r].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=r&&0<=a);break}}}finally{st=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?it(n):""}function lt(e,t){switch(e.tag){case 26:case 27:case 5:return it(e.type);case 16:return it("Lazy");case 13:return e.child!==t&&null!==t?it("Suspense Fallback"):it("Suspense");case 19:return it("SuspenseList");case 0:case 15:return ut(e.type,!1);case 11:return ut(e.type.render,!1);case 1:return ut(e.type,!0);case 31:return it("Activity");default:return""}}function ct(e){try{var t="",n=null;do{t+=lt(e,n),n=e,e=e.return}while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var dt=Object.prototype.hasOwnProperty,ft=de.unstable_scheduleCallback,pt=de.unstable_cancelCallback,ht=de.unstable_shouldYield,vt=de.unstable_requestPaint,mt=de.unstable_now,gt=de.unstable_getCurrentPriorityLevel,yt=de.unstable_ImmediatePriority,bt=de.unstable_UserBlockingPriority,xt=de.unstable_NormalPriority,wt=de.unstable_LowPriority,kt=de.unstable_IdlePriority,St=de.log,_t=de.unstable_setDisableYieldValue,Ot=null,Ct=null;function Pt(e){if("function"==typeof St&&_t(e),Ct&&"function"==typeof Ct.setStrictMode)try{Ct.setStrictMode(Ot,e)}catch(e){}}var Tt=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(jt(e)/Mt|0)|0},jt=Math.log,Mt=Math.LN2;var Et=256,Nt=262144,It=4194304;function Dt(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Rt(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var a=0,o=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var s=134217727&r;return 0!==s?0!==(r=s&~o)?a=Dt(r):0!==(i&=s)?a=Dt(i):n||0!==(n=s&~e)&&(a=Dt(n)):0!==(s=r&~o)?a=Dt(s):0!==i?a=Dt(i):n||0!==(n=r&~e)&&(a=Dt(n)),0===a?0:0!==t&&t!==a&&0===(t&o)&&((o=a&-a)>=(n=t&-t)||32===o&&4194048&n)?t:a}function At(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Lt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function Ut(){var e=It;return!(62914560&(It<<=1))&&(It=4194304),e}function zt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ft(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Bt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Tt(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|261930&n}function Wt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function Ht(e,t){var n=t&-t;return 0!==((n=42&n?1:qt(n))&(e.suspendedLanes|t))?0:n}function qt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Yt(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function Vt(){var e=He.p;return 0!==e?e:void 0===(e=window.event)?32:Rp(e.type)}function Qt(e,t){var n=He.p;try{return He.p=e,t()}finally{He.p=n}}var $t=Math.random().toString(36).slice(2),Kt="__reactFiber$"+$t,Jt="__reactProps$"+$t,Gt="__reactContainer$"+$t,Xt="__reactEvents$"+$t,Zt="__reactListeners$"+$t,en="__reactHandles$"+$t,tn="__reactResources$"+$t,nn="__reactMarker$"+$t;function rn(e){delete e[Kt],delete e[Jt],delete e[Xt],delete e[Zt],delete e[en]}function an(e){var t=e[Kt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gt]||n[Kt]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Yf(e);null!==e;){if(n=e[Kt])return n;e=Yf(e)}return t}n=(e=n).parentNode}return null}function on(e){if(e=e[Kt]||e[Gt]){var t=e.tag;if(5===t||6===t||13===t||31===t||26===t||27===t||3===t)return e}return null}function sn(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(he(33))}function un(e){var t=e[tn];return t||(t=e[tn]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ln(e){e[nn]=!0}var cn=new Set,dn={};function fn(e,t){pn(e,t),pn(e+"Capture",t)}function pn(e,t){for(dn[e]=t,e=0;e<t.length;e++)cn.add(t[e])}var hn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),vn={},mn={};function gn(e,t,n){if(a=t,dt.call(mn,a)||!dt.call(vn,a)&&(hn.test(a)?mn[a]=!0:(vn[a]=!0,0)))if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var r=t.toLowerCase().slice(0,5);if("data-"!==r&&"aria-"!==r)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}var a}function yn(e,t,n){if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function bn(e,t,n,r){if(null===r)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+r)}}function xn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function wn(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function kn(e){if(!e._valueTracker){var t=wn(e)?"checked":"value";e._valueTracker=function(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==r&&"function"==typeof r.get&&"function"==typeof r.set){var a=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){n=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e,t,""+e[t])}}function Sn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=wn(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function _n(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var On=/[\n"\\]/g;function Cn(e){return e.replace(On,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Pn(e,t,n,r,a,o,i,s){e.name="",null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i?e.type=i:e.removeAttribute("type"),null!=t?"number"===i?(0===t&&""===e.value||e.value!=t)&&(e.value=""+xn(t)):e.value!==""+xn(t)&&(e.value=""+xn(t)):"submit"!==i&&"reset"!==i||e.removeAttribute("value"),null!=t?jn(e,i,xn(t)):null!=n?jn(e,i,xn(n)):null!=r&&e.removeAttribute("value"),null==a&&null!=o&&(e.defaultChecked=!!o),null!=a&&(e.checked=a&&"function"!=typeof a&&"symbol"!=typeof a),null!=s&&"function"!=typeof s&&"symbol"!=typeof s&&"boolean"!=typeof s?e.name=""+xn(s):e.removeAttribute("name")}function Tn(e,t,n,r,a,o,i,s){if(null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.type=o),null!=t||null!=n){if(("submit"===o||"reset"===o)&&null==t)return void kn(e);n=null!=n?""+xn(n):"",t=null!=t?""+xn(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:a)&&"symbol"!=typeof r&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.name=i),kn(e)}function jn(e,t,n){"number"===t&&_n(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Mn(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+xn(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function En(e,t,n){null==t||((t=""+xn(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+xn(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function Nn(e,t,n,r){if(null==t){if(null!=r){if(null!=n)throw Error(he(92));if(Be(r)){if(1<r.length)throw Error(he(93));r=r[0]}n=r}null==n&&(n=""),t=n}n=xn(t),e.defaultValue=n,(r=e.textContent)===n&&""!==r&&null!==r&&(e.value=r),kn(e)}function In(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var Dn=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Rn(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||Dn.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function An(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(he(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Rn(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Rn(e,o,t[o])}function Ln(e){if(-1===e.indexOf("-"))return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Un=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),zn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Fn(e){return zn.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bn(){}var Wn=null;function Hn(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var qn=null,Yn=null;function Vn(e){var t=on(e);if(t&&(e=t.stateNode)){var n=e[Jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Pn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Cn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Jt]||null;if(!a)throw Error(he(90));Pn(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)(r=n[t]).form===e.form&&Sn(r)}break e;case"textarea":En(e,n.value,n.defaultValue);break e;case"select":null!=(t=n.value)&&Mn(e,!!n.multiple,t,!1)}}}var Qn=!1;function $n(e,t,n){if(Qn)return e(t,n);Qn=!0;try{return e(t)}finally{if(Qn=!1,(null!==qn||null!==Yn)&&(sd(),qn&&(t=qn,e=Yn,Yn=qn=null,Vn(t),e)))for(t=0;t<e.length;t++)Vn(e[t])}}function Kn(e,t){var n=e.stateNode;if(null===n)return null;var r=n[Jt]||null;if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(he(231,t,typeof n));return n}var Jn=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Gn=!1;if(Jn)try{var Xn={};Object.defineProperty(Xn,"passive",{get:function(){Gn=!0}}),window.addEventListener("test",Xn,Xn),window.removeEventListener("test",Xn,Xn)}catch(e){Gn=!1}var Zn=null,er=null,tr=null;function nr(){if(tr)return tr;var e,t,n=er,r=n.length,a="value"in Zn?Zn.value:Zn.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===a[o-t];t++);return tr=a.slice(e,1<t?1-t:void 0)}function rr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function ar(){return!0}function or(){return!1}function ir(e){function t(t,n,r,a,o){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(a):a[i]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?ar:or,this.isPropagationStopped=or,this}return we(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=ar)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ar)},persist:function(){},isPersistent:ar}),t}var sr,ur,lr,cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dr=ir(cr),fr=we({},cr,{view:0,detail:0}),pr=ir(fr),hr=we({},fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Or,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==lr&&(lr&&"mousemove"===e.type?(sr=e.screenX-lr.screenX,ur=e.screenY-lr.screenY):ur=sr=0,lr=e),sr)},movementY:function(e){return"movementY"in e?e.movementY:ur}}),vr=ir(hr),mr=ir(we({},hr,{dataTransfer:0})),gr=ir(we({},fr,{relatedTarget:0})),yr=ir(we({},cr,{animationName:0,elapsedTime:0,pseudoElement:0})),br=ir(we({},cr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),xr=ir(we({},cr,{data:0})),wr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kr={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Sr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _r(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Sr[e])&&!!t[e]}function Or(){return _r}var Cr=ir(we({},fr,{key:function(e){if(e.key){var t=wr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=rr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?kr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Or,charCode:function(e){return"keypress"===e.type?rr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?rr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),Pr=ir(we({},hr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Tr=ir(we({},fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Or})),jr=ir(we({},cr,{propertyName:0,elapsedTime:0,pseudoElement:0})),Mr=ir(we({},hr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Er=ir(we({},cr,{newState:0,oldState:0})),Nr=[9,13,27,32],Ir=Jn&&"CompositionEvent"in window,Dr=null;Jn&&"documentMode"in document&&(Dr=document.documentMode);var Rr=Jn&&"TextEvent"in window&&!Dr,Ar=Jn&&(!Ir||Dr&&8<Dr&&11>=Dr),Lr=String.fromCharCode(32),Ur=!1;function zr(e,t){switch(e){case"keyup":return-1!==Nr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Br=!1;var Wr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Wr[e.type]:"textarea"===t}function qr(e,t,n,r){qn?Yn?Yn.push(r):Yn=[r]:qn=r,0<(t=ff(t,"onChange")).length&&(n=new dr("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Yr=null,Vr=null;function Qr(e){rf(e,0)}function $r(e){if(Sn(sn(e)))return e}function Kr(e,t){if("change"===e)return t}var Jr=!1;if(Jn){var Gr;if(Jn){var Xr="oninput"in document;if(!Xr){var Zr=document.createElement("div");Zr.setAttribute("oninput","return;"),Xr="function"==typeof Zr.oninput}Gr=Xr}else Gr=!1;Jr=Gr&&(!document.documentMode||9<document.documentMode)}function ea(){Yr&&(Yr.detachEvent("onpropertychange",ta),Vr=Yr=null)}function ta(e){if("value"===e.propertyName&&$r(Vr)){var t=[];qr(t,Vr,e,Hn(e)),$n(Qr,t)}}function na(e,t,n){"focusin"===e?(ea(),Vr=n,(Yr=t).attachEvent("onpropertychange",ta)):"focusout"===e&&ea()}function ra(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return $r(Vr)}function aa(e,t){if("click"===e)return $r(t)}function oa(e,t){if("input"===e||"change"===e)return $r(t)}var ia="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function sa(e,t){if(ia(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!dt.call(t,a)||!ia(e[a],t[a]))return!1}return!0}function ua(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function la(e,t){var n,r=ua(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ua(r)}}function ca(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ca(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function da(e){for(var t=_n((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=_n((e=t.contentWindow).document)}return t}function fa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var pa=Jn&&"documentMode"in document&&11>=document.documentMode,ha=null,va=null,ma=null,ga=!1;function ya(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;ga||null==ha||ha!==_n(r)||("selectionStart"in(r=ha)&&fa(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},ma&&sa(ma,r)||(ma=r,0<(r=ff(va,"onSelect")).length&&(t=new dr("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ha)))}function ba(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var xa={animationend:ba("Animation","AnimationEnd"),animationiteration:ba("Animation","AnimationIteration"),animationstart:ba("Animation","AnimationStart"),transitionrun:ba("Transition","TransitionRun"),transitionstart:ba("Transition","TransitionStart"),transitioncancel:ba("Transition","TransitionCancel"),transitionend:ba("Transition","TransitionEnd")},wa={},ka={};function Sa(e){if(wa[e])return wa[e];if(!xa[e])return e;var t,n=xa[e];for(t in n)if(n.hasOwnProperty(t)&&t in ka)return wa[e]=n[t];return e}Jn&&(ka=document.createElement("div").style,"AnimationEvent"in window||(delete xa.animationend.animation,delete xa.animationiteration.animation,delete xa.animationstart.animation),"TransitionEvent"in window||delete xa.transitionend.transition);var _a=Sa("animationend"),Oa=Sa("animationiteration"),Ca=Sa("animationstart"),Pa=Sa("transitionrun"),Ta=Sa("transitionstart"),ja=Sa("transitioncancel"),Ma=Sa("transitionend"),Ea=new Map,Na="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ia(e,t){Ea.set(e,t),fn(t,[e])}Na.push("scrollEnd");var Da="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},Ra=[],Aa=0,La=0;function Ua(){for(var e=Aa,t=La=Aa=0;t<e;){var n=Ra[t];Ra[t++]=null;var r=Ra[t];Ra[t++]=null;var a=Ra[t];Ra[t++]=null;var o=Ra[t];if(Ra[t++]=null,null!==r&&null!==a){var i=r.pending;null===i?a.next=a:(a.next=i.next,i.next=a),r.pending=a}0!==o&&Wa(n,a,o)}}function za(e,t,n,r){Ra[Aa++]=e,Ra[Aa++]=t,Ra[Aa++]=n,Ra[Aa++]=r,La|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function Fa(e,t,n,r){return za(e,t,n,r),Ha(e)}function Ba(e,t){return za(e,null,null,t),Ha(e)}function Wa(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var a=!1,o=e.return;null!==o;)o.childLanes|=n,null!==(r=o.alternate)&&(r.childLanes|=n),22===o.tag&&(null===(e=o.stateNode)||1&e._visibility||(a=!0)),e=o,o=o.return;return 3===e.tag?(o=e.stateNode,a&&null!==t&&(a=31-Tt(n),null===(r=(e=o.hiddenUpdates)[a])?e[a]=[t]:r.push(t),t.lane=536870912|n),o):null}function Ha(e){if(50<Xc)throw Xc=0,Zc=null,Error(he(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var qa={};function Ya(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Va(e,t,n,r){return new Ya(e,t,n,r)}function Qa(e){return!(!(e=e.prototype)||!e.isReactComponent)}function $a(e,t){var n=e.alternate;return null===n?((n=Va(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=65011712&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Ka(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ja(e,t,n,r,a,o){var i=0;if(r=e,"function"==typeof e)Qa(e)&&(i=1);else if("string"==typeof e)i=function(e,t,n){if(1===n||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,n,Xe.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case Re:return(e=Va(31,n,t,a)).elementType=Re,e.lanes=o,e;case Oe:return Ga(n.children,a,o,t);case Ce:i=8,a|=24;break;case Pe:return(e=Va(12,n,t,2|a)).elementType=Pe,e.lanes=o,e;case Ee:return(e=Va(13,n,t,a)).elementType=Ee,e.lanes=o,e;case Ne:return(e=Va(19,n,t,a)).elementType=Ne,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case je:i=10;break e;case Te:i=9;break e;case Me:i=11;break e;case Ie:i=14;break e;case De:i=16,r=null;break e}i=29,n=Error(he(130,null===e?"null":typeof e,"")),r=null}return(t=Va(i,n,t,a)).elementType=e,t.type=r,t.lanes=o,t}function Ga(e,t,n,r){return(e=Va(7,e,r,t)).lanes=n,e}function Xa(e,t,n){return(e=Va(6,e,null,t)).lanes=n,e}function Za(e){var t=Va(18,null,null,0);return t.stateNode=e,t}function eo(e,t,n){return(t=Va(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var to=new WeakMap;function no(e,t){if("object"==typeof e&&null!==e){var n=to.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ct(t)},to.set(e,t),t)}return{value:e,source:t,stack:ct(t)}}var ro=[],ao=0,oo=null,io=0,so=[],uo=0,lo=null,co=1,fo="";function po(e,t){ro[ao++]=io,ro[ao++]=oo,oo=e,io=t}function ho(e,t,n){so[uo++]=co,so[uo++]=fo,so[uo++]=lo,lo=e;var r=co;e=fo;var a=32-Tt(r)-1;r&=~(1<<a),n+=1;var o=32-Tt(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,co=1<<32-Tt(t)+a|n<<a|r,fo=o+e}else co=1<<o|n<<a|r,fo=e}function vo(e){null!==e.return&&(po(e,1),ho(e,1,0))}function mo(e){for(;e===oo;)oo=ro[--ao],ro[ao]=null,io=ro[--ao],ro[ao]=null;for(;e===lo;)lo=so[--uo],so[uo]=null,fo=so[--uo],so[uo]=null,co=so[--uo],so[uo]=null}function go(e,t){so[uo++]=co,so[uo++]=fo,so[uo++]=lo,co=t.id,fo=t.overflow,lo=e}var yo=null,bo=null,xo=!1,wo=null,ko=!1,So=Error(he(519));function _o(e){throw Mo(no(Error(he(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),So}function Oo(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Kt]=e,t[Jt]=r,n){case"dialog":af("cancel",t),af("close",t);break;case"iframe":case"object":case"embed":af("load",t);break;case"video":case"audio":for(n=0;n<tf.length;n++)af(tf[n],t);break;case"source":af("error",t);break;case"img":case"image":case"link":af("error",t),af("load",t);break;case"details":af("toggle",t);break;case"input":af("invalid",t),Tn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":af("invalid",t);break;case"textarea":af("invalid",t),Nn(t,r.value,r.defaultValue,r.children)}"string"!=typeof(n=r.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===r.suppressHydrationWarning||yf(t.textContent,n)?(null!=r.popover&&(af("beforetoggle",t),af("toggle",t)),null!=r.onScroll&&af("scroll",t),null!=r.onScrollEnd&&af("scrollend",t),null!=r.onClick&&(t.onclick=Bn),t=!0):t=!1,t||_o(e,!0)}function Co(e){for(yo=e.return;yo;)switch(yo.tag){case 5:case 31:case 13:return void(ko=!1);case 27:case 3:return void(ko=!0);default:yo=yo.return}}function Po(e){if(e!==yo)return!1;if(!xo)return Co(e),xo=!0,!1;var t,n=e.tag;if((t=3!==n&&27!==n)&&((t=5===n)&&(t=!("form"!==(t=e.type)&&"button"!==t)||Tf(e.type,e.memoizedProps)),t=!t),t&&bo&&_o(e),Co(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(he(317));bo=qf(e)}else if(31===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(he(317));bo=qf(e)}else 27===n?(n=bo,Rf(e.type)?(e=Hf,Hf=null,bo=e):bo=n):bo=yo?Wf(e.stateNode.nextSibling):null;return!0}function To(){bo=yo=null,xo=!1}function jo(){var e=wo;return null!==e&&(null===Uc?Uc=e:Uc.push.apply(Uc,e),wo=null),e}function Mo(e){null===wo?wo=[e]:wo.push(e)}var Eo=Qe(null),No=null,Io=null;function Do(e,t,n){Ke(Eo,t._currentValue),t._currentValue=n}function Ro(e){e._currentValue=Eo.current,$e(Eo)}function Ao(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Lo(e,t,n,r){var a=e.child;for(null!==a&&(a.return=e);null!==a;){var o=a.dependencies;if(null!==o){var i=a.child;o=o.firstContext;e:for(;null!==o;){var s=o;o=a;for(var u=0;u<t.length;u++)if(s.context===t[u]){o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),Ao(o.return,n,e),r||(i=null);break e}o=s.next}}else if(18===a.tag){if(null===(i=a.return))throw Error(he(341));i.lanes|=n,null!==(o=i.alternate)&&(o.lanes|=n),Ao(i,n,e),i=null}else i=a.child;if(null!==i)i.return=a;else for(i=a;null!==i;){if(i===e){i=null;break}if(null!==(a=i.sibling)){a.return=i.return,i=a;break}i=i.return}a=i}}function Uo(e,t,n,r){e=null;for(var a=t,o=!1;null!==a;){if(!o)if(524288&a.flags)o=!0;else if(262144&a.flags)break;if(10===a.tag){var i=a.alternate;if(null===i)throw Error(he(387));if(null!==(i=i.memoizedProps)){var s=a.type;ia(a.pendingProps.value,i.value)||(null!==e?e.push(s):e=[s])}}else if(a===tt.current){if(null===(i=a.alternate))throw Error(he(387));i.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(null!==e?e.push(bp):e=[bp])}a=a.return}null!==e&&Lo(t,e,n,r),t.flags|=262144}function zo(e){for(e=e.firstContext;null!==e;){if(!ia(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fo(e){No=e,Io=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Bo(e){return Ho(No,e)}function Wo(e,t){return null===No&&Fo(e),Ho(e,t)}function Ho(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===Io){if(null===e)throw Error(he(308));Io=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Io=Io.next=t;return n}var qo="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Yo=de.unstable_scheduleCallback,Vo=de.unstable_NormalPriority,Qo={$$typeof:je,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $o(){return{controller:new qo,data:new Map,refCount:0}}function Ko(e){e.refCount--,0===e.refCount&&Yo(Vo,function(){e.controller.abort()})}var Jo=null,Go=0,Xo=0,Zo=null;function ei(){if(0===--Go&&null!==Jo){null!==Zo&&(Zo.status="fulfilled");var e=Jo;Jo=null,Xo=0,Zo=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var ti=We.S;We.S=function(e,t){Bc=mt(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===Jo){var n=Jo=[];Go=0,Xo=Jd(),Zo={status:"pending",value:void 0,then:function(e){n.push(e)}}}Go++,t.then(ei,ei)}(0,t),null!==ti&&ti(e,t)};var ni=Qe(null);function ri(){var e=ni.current;return null!==e?e:kc.pooledCache}function ai(e,t){Ke(ni,null===t?ni.current:t.pool)}function oi(){var e=ri();return null===e?null:{parent:Qo._currentValue,pool:e}}var ii=Error(he(460)),si=Error(he(474)),ui=Error(he(542)),li={then:function(){}};function ci(e){return"fulfilled"===(e=e.status)||"rejected"===e}function di(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(Bn,Bn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw vi(e=t.reason),e;default:if("string"==typeof t.status)t.then(Bn,Bn);else{if(null!==(e=kc)&&100<e.shellSuspendCounter)throw Error(he(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw vi(e=t.reason),e}throw pi=t,ii}}function fi(e){try{return(0,e._init)(e._payload)}catch(e){if(null!==e&&"object"==typeof e&&"function"==typeof e.then)throw pi=e,ii;throw e}}var pi=null;function hi(){if(null===pi)throw Error(he(459));var e=pi;return pi=null,e}function vi(e){if(e===ii||e===ui)throw Error(he(483))}var mi=null,gi=0;function yi(e){var t=gi;return gi+=1,null===mi&&(mi=[]),di(mi,e,t)}function bi(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function xi(e,t){if(t.$$typeof===ke)throw Error(he(525));throw e=Object.prototype.toString.call(t),Error(he(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function wi(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function a(e,t){return(e=$a(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=67108866,n):r:(t.flags|=67108866,n):(t.flags|=1048576,n)}function i(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Xa(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function u(e,t,n,r){var o=n.type;return o===Oe?c(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===De&&fi(o)===t.type)?(bi(t=a(t,n.props),n),t.return=e,t):(bi(t=Ja(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function l(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=eo(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function c(e,t,n,r,o){return null===t||7!==t.tag?((t=Ga(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Xa(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case Se:return bi(n=Ja(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case _e:return(t=eo(t,e.mode,n)).return=e,t;case De:return d(e,t=fi(t),n)}if(Be(t)||Ue(t))return(t=Ga(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return d(e,yi(t),n);if(t.$$typeof===je)return d(e,Wo(e,t),n);xi(e,t)}return null}function f(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case Se:return n.key===a?u(e,t,n,r):null;case _e:return n.key===a?l(e,t,n,r):null;case De:return f(e,t,n=fi(n),r)}if(Be(n)||Ue(n))return null!==a?null:c(e,t,n,r,null);if("function"==typeof n.then)return f(e,t,yi(n),r);if(n.$$typeof===je)return f(e,t,Wo(e,n),r);xi(e,n)}return null}function p(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case Se:return u(t,e=e.get(null===r.key?n:r.key)||null,r,a);case _e:return l(t,e=e.get(null===r.key?n:r.key)||null,r,a);case De:return p(e,t,n,r=fi(r),a)}if(Be(r)||Ue(r))return c(t,e=e.get(n)||null,r,a,null);if("function"==typeof r.then)return p(e,t,n,yi(r),a);if(r.$$typeof===je)return p(e,t,n,Wo(t,r),a);xi(t,r)}return null}function h(s,u,l,c){if("object"==typeof l&&null!==l&&l.type===Oe&&null===l.key&&(l=l.props.children),"object"==typeof l&&null!==l){switch(l.$$typeof){case Se:e:{for(var v=l.key;null!==u;){if(u.key===v){if((v=l.type)===Oe){if(7===u.tag){n(s,u.sibling),(c=a(u,l.props.children)).return=s,s=c;break e}}else if(u.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===De&&fi(v)===u.type){n(s,u.sibling),bi(c=a(u,l.props),l),c.return=s,s=c;break e}n(s,u);break}t(s,u),u=u.sibling}l.type===Oe?((c=Ga(l.props.children,s.mode,c,l.key)).return=s,s=c):(bi(c=Ja(l.type,l.key,l.props,null,s.mode,c),l),c.return=s,s=c)}return i(s);case _e:e:{for(v=l.key;null!==u;){if(u.key===v){if(4===u.tag&&u.stateNode.containerInfo===l.containerInfo&&u.stateNode.implementation===l.implementation){n(s,u.sibling),(c=a(u,l.children||[])).return=s,s=c;break e}n(s,u);break}t(s,u),u=u.sibling}(c=eo(l,s.mode,c)).return=s,s=c}return i(s);case De:return h(s,u,l=fi(l),c)}if(Be(l))return function(a,i,s,u){for(var l=null,c=null,h=i,v=i=0,m=null;null!==h&&v<s.length;v++){h.index>v?(m=h,h=null):m=h.sibling;var g=f(a,h,s[v],u);if(null===g){null===h&&(h=m);break}e&&h&&null===g.alternate&&t(a,h),i=o(g,i,v),null===c?l=g:c.sibling=g,c=g,h=m}if(v===s.length)return n(a,h),xo&&po(a,v),l;if(null===h){for(;v<s.length;v++)null!==(h=d(a,s[v],u))&&(i=o(h,i,v),null===c?l=h:c.sibling=h,c=h);return xo&&po(a,v),l}for(h=r(h);v<s.length;v++)null!==(m=p(h,a,v,s[v],u))&&(e&&null!==m.alternate&&h.delete(null===m.key?v:m.key),i=o(m,i,v),null===c?l=m:c.sibling=m,c=m);return e&&h.forEach(function(e){return t(a,e)}),xo&&po(a,v),l}(s,u,l,c);if(Ue(l)){if("function"!=typeof(v=Ue(l)))throw Error(he(150));return function(a,i,s,u){if(null==s)throw Error(he(151));for(var l=null,c=null,h=i,v=i=0,m=null,g=s.next();null!==h&&!g.done;v++,g=s.next()){h.index>v?(m=h,h=null):m=h.sibling;var y=f(a,h,g.value,u);if(null===y){null===h&&(h=m);break}e&&h&&null===y.alternate&&t(a,h),i=o(y,i,v),null===c?l=y:c.sibling=y,c=y,h=m}if(g.done)return n(a,h),xo&&po(a,v),l;if(null===h){for(;!g.done;v++,g=s.next())null!==(g=d(a,g.value,u))&&(i=o(g,i,v),null===c?l=g:c.sibling=g,c=g);return xo&&po(a,v),l}for(h=r(h);!g.done;v++,g=s.next())null!==(g=p(h,a,v,g.value,u))&&(e&&null!==g.alternate&&h.delete(null===g.key?v:g.key),i=o(g,i,v),null===c?l=g:c.sibling=g,c=g);return e&&h.forEach(function(e){return t(a,e)}),xo&&po(a,v),l}(s,u,l=v.call(l),c)}if("function"==typeof l.then)return h(s,u,yi(l),c);if(l.$$typeof===je)return h(s,u,Wo(s,l),c);xi(s,l)}return"string"==typeof l&&""!==l||"number"==typeof l||"bigint"==typeof l?(l=""+l,null!==u&&6===u.tag?(n(s,u.sibling),(c=a(u,l)).return=s,s=c):(n(s,u),(c=Xa(l,s.mode,c)).return=s,s=c),i(s)):n(s,u)}return function(e,t,n,r){try{gi=0;var a=h(e,t,n,r);return mi=null,a}catch(t){if(t===ii||t===ui)throw t;var o=Va(29,t,null,e.mode);return o.lanes=r,o.return=e,o}}}var ki=wi(!0),Si=wi(!1),_i=!1;function Oi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ci(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Pi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ti(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&wc){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=Ha(e),Wa(e,null,n),t}return za(e,r,t,n),Ha(e)}function ji(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Wt(e,n)}}function Mi(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===o?a=o=i:o=o.next=i,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ei=!1;function Ni(){if(Ei){if(null!==Zo)throw Zo}}function Ii(e,t,n,r){Ei=!1;var a=e.updateQueue;_i=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,s=a.shared.pending;if(null!==s){a.shared.pending=null;var u=s,l=u.next;u.next=null,null===i?o=l:i.next=l,i=u;var c=e.alternate;null!==c&&((s=(c=c.updateQueue).lastBaseUpdate)!==i&&(null===s?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=u))}if(null!==o){var d=a.baseState;for(i=0,c=l=u=null,s=o;;){var f=-536870913&s.lane,p=f!==s.lane;if(p?(_c&f)===f:(r&f)===f){0!==f&&f===Xo&&(Ei=!0),null!==c&&(c=c.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var h=e,v=s;f=t;var m=n;switch(v.tag){case 1:if("function"==typeof(h=v.payload)){d=h.call(m,d,f);break e}d=h;break e;case 3:h.flags=-65537&h.flags|128;case 0:if(null==(f="function"==typeof(h=v.payload)?h.call(m,d,f):h))break e;d=we({},d,f);break e;case 2:_i=!0}}null!==(f=s.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=a.callbacks)?a.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===c?(l=c=p,u=d):c=c.next=p,i|=f;if(null===(s=s.next)){if(null===(s=a.shared.pending))break;s=(p=s).next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}null===c&&(u=d),a.baseState=u,a.firstBaseUpdate=l,a.lastBaseUpdate=c,null===o&&(a.shared.lanes=0),Nc|=i,e.lanes=i,e.memoizedState=d}}function Di(e,t){if("function"!=typeof e)throw Error(he(191,e));e.call(t)}function Ri(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)Di(n[e],t)}var Ai=Qe(null),Li=Qe(0);function Ui(e,t){Ke(Li,e=Mc),Ke(Ai,t),Mc=e|t.baseLanes}function zi(){Ke(Li,Mc),Ke(Ai,Ai.current)}function Fi(){Mc=Li.current,$e(Ai),$e(Li)}var Bi=Qe(null),Wi=null;function Hi(e){var t=e.alternate;Ke($i,1&$i.current),Ke(Bi,e),null===Wi&&(null===t||null!==Ai.current||null!==t.memoizedState)&&(Wi=e)}function qi(e){Ke($i,$i.current),Ke(Bi,e),null===Wi&&(Wi=e)}function Yi(e){22===e.tag?(Ke($i,$i.current),Ke(Bi,e),null===Wi&&(Wi=e)):Vi()}function Vi(){Ke($i,$i.current),Ke(Bi,Bi.current)}function Qi(e){$e(Bi),Wi===e&&(Wi=null),$e($i)}var $i=Qe(0);function Ki(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||Ff(n)||Bf(n)))return t}else if(19!==t.tag||"forwards"!==t.memoizedProps.revealOrder&&"backwards"!==t.memoizedProps.revealOrder&&"unstable_legacy-backwards"!==t.memoizedProps.revealOrder&&"together"!==t.memoizedProps.revealOrder){if(null!==t.child){t.child.return=t,t=t.child;continue}}else if(128&t.flags)return t;if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ji=0,Gi=null,Xi=null,Zi=null,es=!1,ts=!1,ns=!1,rs=0,as=0,os=null,is=0;function ss(){throw Error(he(321))}function us(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ia(e[n],t[n]))return!1;return!0}function ls(e,t,n,r,a,o){return Ji=o,Gi=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,We.H=null===e||null===e.memoizedState?_u:Ou,ns=!1,o=n(r,a),ns=!1,ts&&(o=ds(t,n,r,a)),cs(e),o}function cs(e){We.H=Su;var t=null!==Xi&&null!==Xi.next;if(Ji=0,Zi=Xi=Gi=null,es=!1,as=0,os=null,t)throw Error(he(300));null===e||Bu||null!==(e=e.dependencies)&&zo(e)&&(Bu=!0)}function ds(e,t,n,r){Gi=e;var a=0;do{if(ts&&(os=null),as=0,ts=!1,25<=a)throw Error(he(301));if(a+=1,Zi=Xi=null,null!=e.updateQueue){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,null!=o.memoCache&&(o.memoCache.index=0)}We.H=Cu,o=t(n,r)}while(ts);return o}function fs(){var e=We.H,t=e.useState()[0];return t="function"==typeof t.then?ys(t):t,e=e.useState()[0],(null!==Xi?Xi.memoizedState:null)!==e&&(Gi.flags|=1024),t}function ps(){var e=0!==rs;return rs=0,e}function hs(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function vs(e){if(es){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}es=!1}Ji=0,Zi=Xi=Gi=null,ts=!1,as=rs=0,os=null}function ms(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Zi?Gi.memoizedState=Zi=e:Zi=Zi.next=e,Zi}function gs(){if(null===Xi){var e=Gi.alternate;e=null!==e?e.memoizedState:null}else e=Xi.next;var t=null===Zi?Gi.memoizedState:Zi.next;if(null!==t)Zi=t,Xi=e;else{if(null===e){if(null===Gi.alternate)throw Error(he(467));throw Error(he(310))}e={memoizedState:(Xi=e).memoizedState,baseState:Xi.baseState,baseQueue:Xi.baseQueue,queue:Xi.queue,next:null},null===Zi?Gi.memoizedState=Zi=e:Zi=Zi.next=e}return Zi}function ys(e){var t=as;return as+=1,null===os&&(os=[]),e=di(os,e,t),t=Gi,null===(null===Zi?t.memoizedState:Zi.next)&&(t=t.alternate,We.H=null===t||null===t.memoizedState?_u:Ou),e}function bs(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return ys(e);if(e.$$typeof===je)return Bo(e)}throw Error(he(438,String(e)))}function xs(e){var t=null,n=Gi.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=Gi.alternate;null!==r&&(null!==(r=r.updateQueue)&&(null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===n&&(n={lastEffect:null,events:null,stores:null,memoCache:null},Gi.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=Ae;return t.index++,n}function ws(e,t){return"function"==typeof t?t(e):t}function ks(e){return Ss(gs(),Xi,e)}function Ss(e,t,n){var r=e.queue;if(null===r)throw Error(he(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(null!==o){if(null!==a){var i=a.next;a.next=o.next,o.next=i}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,null===a)e.memoizedState=o;else{var s=i=null,u=null,l=t=a.next,c=!1;do{var d=-536870913&l.lane;if(d!==l.lane?(_c&d)===d:(Ji&d)===d){var f=l.revertLane;if(0===f)null!==u&&(u=u.next={lane:0,revertLane:0,gesture:null,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),d===Xo&&(c=!0);else{if((Ji&f)===f){l=l.next,f===Xo&&(c=!0);continue}d={lane:0,revertLane:l.revertLane,gesture:null,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null},null===u?(s=u=d,i=o):u=u.next=d,Gi.lanes|=f,Nc|=f}d=l.action,ns&&n(o,d),o=l.hasEagerState?l.eagerState:n(o,d)}else f={lane:d,revertLane:l.revertLane,gesture:l.gesture,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null},null===u?(s=u=f,i=o):u=u.next=f,Gi.lanes|=d,Nc|=d;l=l.next}while(null!==l&&l!==t);if(null===u?i=o:u.next=s,!ia(o,e.memoizedState)&&(Bu=!0,c&&null!==(n=Zo)))throw n;e.memoizedState=o,e.baseState=i,e.baseQueue=u,r.lastRenderedState=o}return null===a&&(r.lanes=0),[e.memoizedState,r.dispatch]}function _s(e){var t=gs(),n=t.queue;if(null===n)throw Error(he(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(null!==a){n.pending=null;var i=a=a.next;do{o=e(o,i.action),i=i.next}while(i!==a);ia(o,t.memoizedState)||(Bu=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Os(e,t,n){var r=Gi,a=gs(),o=xo;if(o){if(void 0===n)throw Error(he(407));n=n()}else n=t();var i=!ia((Xi||a).memoizedState,n);if(i&&(a.memoizedState=n,Bu=!0),a=a.queue,Js(Ts.bind(null,r,a,e),[e]),a.getSnapshot!==t||i||null!==Zi&&1&Zi.memoizedState.tag){if(r.flags|=2048,Ys(9,{destroy:void 0},Ps.bind(null,r,a,n,t),null),null===kc)throw Error(he(349));o||127&Ji||Cs(r,t,n)}return n}function Cs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Gi.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Gi.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Ps(e,t,n,r){t.value=n,t.getSnapshot=r,js(t)&&Ms(e)}function Ts(e,t,n){return n(function(){js(t)&&Ms(e)})}function js(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ia(e,n)}catch(e){return!0}}function Ms(e){var t=Ba(e,2);null!==t&&nd(t,e,2)}function Es(e){var t=ms();if("function"==typeof e){var n=e;if(e=n(),ns){Pt(!0);try{n()}finally{Pt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:e},t}function Ns(e,t,n,r){return e.baseState=n,Ss(e,Xi,"function"==typeof r?r:ws)}function Is(e,t,n,r,a){if(xu(e))throw Error(he(485));if(null!==(e=t.action)){var o={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};null!==We.T?n(!0):o.isTransition=!1,r(o),null===(n=t.pending)?(o.next=t.pending=o,Ds(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ds(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var o=We.T,i={};We.T=i;try{var s=n(a,r),u=We.S;null!==u&&u(i,s),Rs(e,t,s)}catch(n){Ls(e,t,n)}finally{null!==o&&null!==i.types&&(o.types=i.types),We.T=o}}else try{Rs(e,t,o=n(a,r))}catch(n){Ls(e,t,n)}}function Rs(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){As(e,t,n)},function(n){return Ls(e,t,n)}):As(e,t,n)}function As(e,t,n){t.status="fulfilled",t.value=n,Us(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,Ds(e,n)))}function Ls(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do{t.status="rejected",t.reason=n,Us(t),t=t.next}while(t!==r)}e.action=null}function Us(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function zs(e,t){return t}function Fs(e,t){if(xo){var n=kc.formState;if(null!==n){e:{var r=Gi;if(xo){if(bo){t:{for(var a=bo,o=ko;8!==a.nodeType;){if(!o){a=null;break t}if(null===(a=Wf(a.nextSibling))){a=null;break t}}a="F!"===(o=a.data)||"F"===o?a:null}if(a){bo=Wf(a.nextSibling),r="F!"===a.data;break e}}_o(r)}r=!1}r&&(t=n[0])}}return(n=ms()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:t},n.queue=r,n=gu.bind(null,Gi,r),r.dispatch=n,r=Es(!1),o=bu.bind(null,Gi,!1,r.queue),a={state:t,dispatch:null,action:e,pending:null},(r=ms()).queue=a,n=Is.bind(null,Gi,a,o,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function Bs(e){return Ws(gs(),Xi,e)}function Ws(e,t,n){if(t=Ss(e,t,zs)[0],e=ks(ws)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=ys(t)}catch(e){if(e===ii)throw ui;throw e}else r=t;var a=(t=gs()).queue,o=a.dispatch;return n!==t.memoizedState&&(Gi.flags|=2048,Ys(9,{destroy:void 0},Hs.bind(null,a,n),null)),[r,o,e]}function Hs(e,t){e.action=t}function qs(e){var t=gs(),n=Xi;if(null!==n)return Ws(t,n,e);gs(),t=t.memoizedState;var r=(n=gs()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ys(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=Gi.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Gi.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Vs(){return gs().memoizedState}function Qs(e,t,n,r){var a=ms();Gi.flags|=e,a.memoizedState=Ys(1|t,{destroy:void 0},n,void 0===r?null:r)}function $s(e,t,n,r){var a=gs();r=void 0===r?null:r;var o=a.memoizedState.inst;null!==Xi&&null!==r&&us(r,Xi.memoizedState.deps)?a.memoizedState=Ys(t,o,n,r):(Gi.flags|=e,a.memoizedState=Ys(1|t,o,n,r))}function Ks(e,t){Qs(8390656,8,e,t)}function Js(e,t){$s(2048,8,e,t)}function Gs(e){var t=gs().memoizedState;return function(e){Gi.flags|=4;var t=Gi.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Gi.updateQueue=t,t.events=[e];else{var n=t.events;null===n?t.events=[e]:n.push(e)}}({ref:t,nextImpl:e}),function(){if(2&wc)throw Error(he(440));return t.impl.apply(void 0,arguments)}}function Xs(e,t){return $s(4,2,e,t)}function Zs(e,t){return $s(4,4,e,t)}function eu(e,t){if("function"==typeof t){e=e();var n=t(e);return function(){"function"==typeof n?n():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function tu(e,t,n){n=null!=n?n.concat([e]):null,$s(4,4,eu.bind(null,t,e),n)}function nu(){}function ru(e,t){var n=gs();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&us(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function au(e,t){var n=gs();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&us(t,r[1]))return r[0];if(r=e(),ns){Pt(!0);try{e()}finally{Pt(!1)}}return n.memoizedState=[r,t],r}function ou(e,t,n){return void 0===n||1073741824&Ji&&!(261930&_c)?e.memoizedState=t:(e.memoizedState=n,e=td(),Gi.lanes|=e,Nc|=e,n)}function iu(e,t,n,r){return ia(n,t)?n:null!==Ai.current?(e=ou(e,n,r),ia(e,t)||(Bu=!0),e):42&Ji&&(!(1073741824&Ji)||261930&_c)?(e=td(),Gi.lanes|=e,Nc|=e,t):(Bu=!0,e.memoizedState=n)}function su(e,t,n,r,a){var o=He.p;He.p=0!==o&&8>o?o:8;var i,s,u,l=We.T,c={};We.T=c,bu(e,!1,t,n);try{var d=a(),f=We.S;if(null!==f&&f(c,d),null!==d&&"object"==typeof d&&"function"==typeof d.then){var p=(i=r,s=[],u={status:"pending",value:null,reason:null,then:function(e){s.push(e)}},d.then(function(){u.status="fulfilled",u.value=i;for(var e=0;e<s.length;e++)(0,s[e])(i)},function(e){for(u.status="rejected",u.reason=e,e=0;e<s.length;e++)(0,s[e])(void 0)}),u);yu(e,t,p,ed())}else yu(e,t,r,ed())}catch(n){yu(e,t,{then:function(){},status:"rejected",reason:n},ed())}finally{He.p=o,null!==l&&null!==c.types&&(l.types=c.types),We.T=l}}function uu(){}function lu(e,t,n,r){if(5!==e.tag)throw Error(he(476));var a=cu(e).queue;su(e,a,t,qe,null===n?uu:function(){return du(e),n(r)})}function cu(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:qe,baseState:qe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:qe},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function du(e){var t=cu(e);null===t.next&&(t=e.alternate.memoizedState),yu(e,t.next.queue,{},ed())}function fu(){return Bo(bp)}function pu(){return gs().memoizedState}function hu(){return gs().memoizedState}function vu(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=ed(),r=Ti(t,e=Pi(n),n);return null!==r&&(nd(r,t,n),ji(r,t,n)),t={cache:$o()},void(e.payload=t)}t=t.return}}function mu(e,t,n){var r=ed();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},xu(e)?wu(t,n):null!==(n=Fa(e,t,n,r))&&(nd(n,e,r),ku(n,t,r))}function gu(e,t,n){yu(e,t,n,ed())}function yu(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(xu(e))wu(t,a);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var i=t.lastRenderedState,s=o(i,n);if(a.hasEagerState=!0,a.eagerState=s,ia(s,i))return za(e,t,a,0),null===kc&&Ua(),!1}catch(e){}if(null!==(n=Fa(e,t,a,r)))return nd(n,e,r),ku(n,t,r),!0}return!1}function bu(e,t,n,r){if(r={lane:2,revertLane:Jd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},xu(e)){if(t)throw Error(he(479))}else null!==(t=Fa(e,n,r,2))&&nd(t,e,2)}function xu(e){var t=e.alternate;return e===Gi||null!==t&&t===Gi}function wu(e,t){ts=es=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ku(e,t,n){if(4194048&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,Wt(e,n)}}var Su={readContext:Bo,use:bs,useCallback:ss,useContext:ss,useEffect:ss,useImperativeHandle:ss,useLayoutEffect:ss,useInsertionEffect:ss,useMemo:ss,useReducer:ss,useRef:ss,useState:ss,useDebugValue:ss,useDeferredValue:ss,useTransition:ss,useSyncExternalStore:ss,useId:ss,useHostTransitionStatus:ss,useFormState:ss,useActionState:ss,useOptimistic:ss,useMemoCache:ss,useCacheRefresh:ss};Su.useEffectEvent=ss;var _u={readContext:Bo,use:bs,useCallback:function(e,t){return ms().memoizedState=[e,void 0===t?null:t],e},useContext:Bo,useEffect:Ks,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,Qs(4194308,4,eu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qs(4194308,4,e,t)},useInsertionEffect:function(e,t){Qs(4,2,e,t)},useMemo:function(e,t){var n=ms();t=void 0===t?null:t;var r=e();if(ns){Pt(!0);try{e()}finally{Pt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ms();if(void 0!==n){var a=n(t);if(ns){Pt(!0);try{n(t)}finally{Pt(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=mu.bind(null,Gi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ms().memoizedState=e},useState:function(e){var t=(e=Es(e)).queue,n=gu.bind(null,Gi,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:nu,useDeferredValue:function(e,t){return ou(ms(),e,t)},useTransition:function(){var e=Es(!1);return e=su.bind(null,Gi,e.queue,!0,!1),ms().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Gi,a=ms();if(xo){if(void 0===n)throw Error(he(407));n=n()}else{if(n=t(),null===kc)throw Error(he(349));127&_c||Cs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ks(Ts.bind(null,r,o,e),[e]),r.flags|=2048,Ys(9,{destroy:void 0},Ps.bind(null,r,o,n,t),null),n},useId:function(){var e=ms(),t=kc.identifierPrefix;if(xo){var n=fo;t="_"+t+"R_"+(n=(co&~(1<<32-Tt(co)-1)).toString(32)+n),0<(n=rs++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=is++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:fu,useFormState:Fs,useActionState:Fs,useOptimistic:function(e){var t=ms();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=bu.bind(null,Gi,!0,n),n.dispatch=t,[e,t]},useMemoCache:xs,useCacheRefresh:function(){return ms().memoizedState=vu.bind(null,Gi)},useEffectEvent:function(e){var t=ms(),n={impl:e};return t.memoizedState=n,function(){if(2&wc)throw Error(he(440));return n.impl.apply(void 0,arguments)}}},Ou={readContext:Bo,use:bs,useCallback:ru,useContext:Bo,useEffect:Js,useImperativeHandle:tu,useInsertionEffect:Xs,useLayoutEffect:Zs,useMemo:au,useReducer:ks,useRef:Vs,useState:function(){return ks(ws)},useDebugValue:nu,useDeferredValue:function(e,t){return iu(gs(),Xi.memoizedState,e,t)},useTransition:function(){var e=ks(ws)[0],t=gs().memoizedState;return["boolean"==typeof e?e:ys(e),t]},useSyncExternalStore:Os,useId:pu,useHostTransitionStatus:fu,useFormState:Bs,useActionState:Bs,useOptimistic:function(e,t){return Ns(gs(),0,e,t)},useMemoCache:xs,useCacheRefresh:hu};Ou.useEffectEvent=Gs;var Cu={readContext:Bo,use:bs,useCallback:ru,useContext:Bo,useEffect:Js,useImperativeHandle:tu,useInsertionEffect:Xs,useLayoutEffect:Zs,useMemo:au,useReducer:_s,useRef:Vs,useState:function(){return _s(ws)},useDebugValue:nu,useDeferredValue:function(e,t){var n=gs();return null===Xi?ou(n,e,t):iu(n,Xi.memoizedState,e,t)},useTransition:function(){var e=_s(ws)[0],t=gs().memoizedState;return["boolean"==typeof e?e:ys(e),t]},useSyncExternalStore:Os,useId:pu,useHostTransitionStatus:fu,useFormState:qs,useActionState:qs,useOptimistic:function(e,t){var n=gs();return null!==Xi?Ns(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:xs,useCacheRefresh:hu};function Pu(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:we({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}Cu.useEffectEvent=Gs;var Tu={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ed(),a=Pi(r);a.payload=t,null!=n&&(a.callback=n),null!==(t=Ti(e,a,r))&&(nd(t,e,r),ji(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ed(),a=Pi(r);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=Ti(e,a,r))&&(nd(t,e,r),ji(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ed(),r=Pi(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=Ti(e,r,n))&&(nd(t,e,n),ji(t,e,n))}};function ju(e,t,n,r,a,o,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,i):!t.prototype||!t.prototype.isPureReactComponent||(!sa(n,r)||!sa(a,o))}function Mu(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Tu.enqueueReplaceState(t,t.state,null)}function Eu(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=we({},n)),e)void 0===n[a]&&(n[a]=e[a]);return n}function Nu(e){Da(e)}function Iu(e){console.error(e)}function Du(e){Da(e)}function Ru(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Au(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Lu(e,t,n){return(n=Pi(n)).tag=3,n.payload={element:null},n.callback=function(){Ru(e,t)},n}function Uu(e){return(e=Pi(e)).tag=3,e}function zu(e,t,n,r){var a=n.type.getDerivedStateFromError;if("function"==typeof a){var o=r.value;e.payload=function(){return a(o)},e.callback=function(){Au(t,n,r)}}var i=n.stateNode;null!==i&&"function"==typeof i.componentDidCatch&&(e.callback=function(){Au(t,n,r),"function"!=typeof a&&(null===qc?qc=new Set([this]):qc.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Fu=Error(he(461)),Bu=!1;function Wu(e,t,n,r){t.child=null===e?Si(t,null,n,r):ki(t,e.child,n,r)}function Hu(e,t,n,r,a){n=n.render;var o=t.ref;if("ref"in r){var i={};for(var s in r)"ref"!==s&&(i[s]=r[s])}else i=r;return Fo(t),r=ls(e,t,n,i,o,a),s=ps(),null===e||Bu?(xo&&s&&vo(t),t.flags|=1,Wu(e,t,r,a),t.child):(hs(e,t,a),fl(e,t,a))}function qu(e,t,n,r,a){if(null===e){var o=n.type;return"function"!=typeof o||Qa(o)||void 0!==o.defaultProps||null!==n.compare?((e=Ja(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Yu(e,t,o,r,a))}if(o=e.child,!pl(e,a)){var i=o.memoizedProps;if((n=null!==(n=n.compare)?n:sa)(i,r)&&e.ref===t.ref)return fl(e,t,a)}return t.flags|=1,(e=$a(o,r)).ref=t.ref,e.return=t,t.child=e}function Yu(e,t,n,r,a){if(null!==e){var o=e.memoizedProps;if(sa(o,r)&&e.ref===t.ref){if(Bu=!1,t.pendingProps=r=o,!pl(e,a))return t.lanes=e.lanes,fl(e,t,a);131072&e.flags&&(Bu=!0)}}return Xu(e,t,n,r,a)}function Vu(e,t,n,r){var a=r.children,o=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===r.mode){if(128&t.flags){if(o=null!==o?o.baseLanes|n:n,null!==e){for(r=t.child=e.child,a=0;null!==r;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~o}else r=0,t.child=null;return $u(e,t,o,n,r)}if(!(536870912&n))return r=t.lanes=536870912,$u(e,t,null!==o?o.baseLanes|n:n,n,r);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&ai(0,null!==o?o.cachePool:null),null!==o?Ui(t,o):zi(),Yi(t)}else null!==o?(ai(0,o.cachePool),Ui(t,o),Vi(),t.memoizedState=null):(null!==e&&ai(0,null),zi(),Vi());return Wu(e,t,a,n),t.child}function Qu(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function $u(e,t,n,r,a){var o=ri();return o=null===o?null:{parent:Qo._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},null!==e&&ai(0,null),zi(),Yi(t),null!==e&&Uo(e,t,r,!0),t.childLanes=a,null}function Ku(e,t){return(t=sl({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Ju(e,t,n){return ki(t,e.child,null,n),(e=Ku(t,t.pendingProps)).flags|=2,Qi(t),t.memoizedState=null,e}function Gu(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(he(284));null!==e&&e.ref===n||(t.flags|=4194816)}}function Xu(e,t,n,r,a){return Fo(t),n=ls(e,t,n,r,void 0,a),r=ps(),null===e||Bu?(xo&&r&&vo(t),t.flags|=1,Wu(e,t,n,a),t.child):(hs(e,t,a),fl(e,t,a))}function Zu(e,t,n,r,a,o){return Fo(t),t.updateQueue=null,n=ds(t,r,n,a),cs(e),r=ps(),null===e||Bu?(xo&&r&&vo(t),t.flags|=1,Wu(e,t,n,o),t.child):(hs(e,t,o),fl(e,t,o))}function el(e,t,n,r,a){if(Fo(t),null===t.stateNode){var o=qa,i=n.contextType;"object"==typeof i&&null!==i&&(o=Bo(i)),o=new n(r,o),t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,o.updater=Tu,t.stateNode=o,o._reactInternals=t,(o=t.stateNode).props=r,o.state=t.memoizedState,o.refs={},Oi(t),i=n.contextType,o.context="object"==typeof i&&null!==i?Bo(i):qa,o.state=t.memoizedState,"function"==typeof(i=n.getDerivedStateFromProps)&&(Pu(t,n,i,r),o.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(i=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),i!==o.state&&Tu.enqueueReplaceState(o,o.state,null),Ii(t,r,o,a),Ni(),o.state=t.memoizedState),"function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){o=t.stateNode;var s=t.memoizedProps,u=Eu(n,s);o.props=u;var l=o.context,c=n.contextType;i=qa,"object"==typeof c&&null!==c&&(i=Bo(c));var d=n.getDerivedStateFromProps;c="function"==typeof d||"function"==typeof o.getSnapshotBeforeUpdate,s=t.pendingProps!==s,c||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s||l!==i)&&Mu(t,o,r,i),_i=!1;var f=t.memoizedState;o.state=f,Ii(t,r,o,a),Ni(),l=t.memoizedState,s||f!==l||_i?("function"==typeof d&&(Pu(t,n,d,r),l=t.memoizedState),(u=_i||ju(t,n,u,r,f,l,i))?(c||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=i,r=u):("function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Ci(e,t),c=Eu(n,i=t.memoizedProps),o.props=c,d=t.pendingProps,f=o.context,l=n.contextType,u=qa,"object"==typeof l&&null!==l&&(u=Bo(l)),(l="function"==typeof(s=n.getDerivedStateFromProps)||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(i!==d||f!==u)&&Mu(t,o,r,u),_i=!1,f=t.memoizedState,o.state=f,Ii(t,r,o,a),Ni();var p=t.memoizedState;i!==d||f!==p||_i||null!==e&&null!==e.dependencies&&zo(e.dependencies)?("function"==typeof s&&(Pu(t,n,s,r),p=t.memoizedState),(c=_i||ju(t,n,c,r,f,p,u)||null!==e&&null!==e.dependencies&&zo(e.dependencies))?(l||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,p,u),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,p,u)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||i===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||i===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),o.props=r,o.state=p,o.context=u,r=c):("function"!=typeof o.componentDidUpdate||i===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||i===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Gu(e,t),r=!!(128&t.flags),o||r?(o=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:o.render(),t.flags|=1,null!==e&&r?(t.child=ki(t,e.child,null,a),t.child=ki(t,null,n,a)):Wu(e,t,n,a),t.memoizedState=o.state,e=t.child):e=fl(e,t,a),e}function tl(e,t,n,r){return To(),t.flags|=256,Wu(e,t,n,r),t.child}var nl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rl(e){return{baseLanes:e,cachePool:oi()}}function al(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=Rc),e}function ol(e,t,n){var r,a=t.pendingProps,o=!1,i=!!(128&t.flags);if((r=i)||(r=(null===e||null!==e.memoizedState)&&!!(2&$i.current)),r&&(o=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(xo){if(o?Hi(t):Vi(),(e=bo)?null!==(e=null!==(e=zf(e,ko))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==lo?{id:co,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},(n=Za(e)).return=t,t.child=n,yo=t,bo=null):e=null,null===e)throw _o(t);return Bf(e)?t.lanes=32:t.lanes=536870912,null}var s=a.children;return a=a.fallback,o?(Vi(),s=sl({mode:"hidden",children:s},o=t.mode),a=Ga(a,o,n,null),s.return=t,a.return=t,s.sibling=a,t.child=s,(a=t.child).memoizedState=rl(n),a.childLanes=al(e,r,n),t.memoizedState=nl,Qu(null,a)):(Hi(t),il(t,s))}var u=e.memoizedState;if(null!==u&&null!==(s=u.dehydrated)){if(i)256&t.flags?(Hi(t),t.flags&=-257,t=ul(e,t,n)):null!==t.memoizedState?(Vi(),t.child=e.child,t.flags|=128,t=null):(Vi(),s=a.fallback,o=t.mode,a=sl({mode:"visible",children:a.children},o),(s=Ga(s,o,n,null)).flags|=2,a.return=t,s.return=t,a.sibling=s,t.child=a,ki(t,e.child,null,n),(a=t.child).memoizedState=rl(n),a.childLanes=al(e,r,n),t.memoizedState=nl,t=Qu(null,a));else if(Hi(t),Bf(s)){if(r=s.nextSibling&&s.nextSibling.dataset)var l=r.dgst;r=l,(a=Error(he(419))).stack="",a.digest=r,Mo({value:a,source:null,stack:null}),t=ul(e,t,n)}else if(Bu||Uo(e,t,n,!1),r=0!==(n&e.childLanes),Bu||r){if(null!==(r=kc)&&(0!==(a=Ht(r,n))&&a!==u.retryLane))throw u.retryLane=a,Ba(e,a),nd(r,e,a),Fu;Ff(s)||hd(),t=ul(e,t,n)}else Ff(s)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,bo=Wf(s.nextSibling),yo=t,xo=!0,wo=null,ko=!1,null!==e&&go(t,e),(t=il(t,a.children)).flags|=4096);return t}return o?(Vi(),s=a.fallback,o=t.mode,l=(u=e.child).sibling,(a=$a(u,{mode:"hidden",children:a.children})).subtreeFlags=65011712&u.subtreeFlags,null!==l?s=$a(l,s):(s=Ga(s,o,n,null)).flags|=2,s.return=t,a.return=t,a.sibling=s,t.child=a,Qu(null,a),a=t.child,null===(s=e.child.memoizedState)?s=rl(n):(null!==(o=s.cachePool)?(u=Qo._currentValue,o=o.parent!==u?{parent:u,pool:u}:o):o=oi(),s={baseLanes:s.baseLanes|n,cachePool:o}),a.memoizedState=s,a.childLanes=al(e,r,n),t.memoizedState=nl,Qu(e.child,a)):(Hi(t),e=(n=e.child).sibling,(n=$a(n,{mode:"visible",children:a.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function il(e,t){return(t=sl({mode:"visible",children:t},e.mode)).return=e,e.child=t}function sl(e,t){return(e=Va(22,e,null,t)).lanes=0,e}function ul(e,t,n){return ki(t,e.child,null,n),(e=il(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function ll(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Ao(e.return,t,n)}function cl(e,t,n,r,a,o){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a,i.treeForkCount=o)}function dl(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;r=r.children;var i=$i.current,s=!!(2&i);if(s?(i=1&i|2,t.flags|=128):i&=1,Ke($i,i),Wu(e,t,r,n),r=xo?io:0,!s&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&ll(e,n,t);else if(19===e.tag)ll(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===Ki(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),cl(t,!1,a,n,o,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===Ki(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}cl(t,!0,n,null,o,r);break;case"together":cl(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function fl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Nc|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(Uo(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(he(153));if(null!==t.child){for(n=$a(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=$a(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function pl(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!zo(e))}function hl(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Bu=!0;else{if(!(pl(e,n)||128&t.flags))return Bu=!1,function(e,t,n){switch(t.tag){case 3:nt(t,t.stateNode.containerInfo),Do(0,Qo,e.memoizedState.cache),To();break;case 27:case 5:at(t);break;case 4:nt(t,t.stateNode.containerInfo);break;case 10:Do(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,qi(t),null;break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(Hi(t),t.flags|=128,null):0!==(n&t.child.childLanes)?ol(e,t,n):(Hi(t),null!==(e=fl(e,t,n))?e.sibling:null);Hi(t);break;case 19:var a=!!(128&e.flags);if((r=0!==(n&t.childLanes))||(Uo(e,t,n,!1),r=0!==(n&t.childLanes)),a){if(r)return dl(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),Ke($i,$i.current),r)break;return null;case 22:return t.lanes=0,Vu(e,t,n,t.pendingProps);case 24:Do(0,Qo,e.memoizedState.cache)}return fl(e,t,n)}(e,t,n);Bu=!!(131072&e.flags)}else Bu=!1,xo&&1048576&t.flags&&ho(t,io,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=fi(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var a=e.$$typeof;if(a===Me){t.tag=11,t=Hu(null,t,e,r,n);break e}if(a===Ie){t.tag=14,t=qu(null,t,e,r,n);break e}}throw t=Fe(e)||e,Error(he(306,t,""))}Qa(e)?(r=Eu(e,r),t.tag=1,t=el(null,t,e,r,n)):(t.tag=0,t=Xu(null,t,e,r,n))}return t;case 0:return Xu(e,t,t.type,t.pendingProps,n);case 1:return el(e,t,r=t.type,a=Eu(r,t.pendingProps),n);case 3:e:{if(nt(t,t.stateNode.containerInfo),null===e)throw Error(he(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ci(e,t),Ii(t,r,null,n);var i=t.memoizedState;if(r=i.cache,Do(0,Qo,r),r!==o.cache&&Lo(t,[Qo],n,!0),Ni(),r=i.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=tl(e,t,r,n);break e}if(r!==a){Mo(a=no(Error(he(424)),t)),t=tl(e,t,r,n);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(bo=Wf(e.firstChild),yo=t,xo=!0,wo=null,ko=!0,n=Si(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(To(),r===a){t=fl(e,t,n);break e}Wu(e,t,r,n)}t=t.child}return t;case 26:return Gu(e,t),null===e?(n=ep(t.type,null,t.pendingProps,null))?t.memoizedState=n:xo||(n=t.type,e=t.pendingProps,(r=Of(et.current).createElement(n))[Kt]=t,r[Jt]=e,wf(r,n,e),ln(r),t.stateNode=r):t.memoizedState=ep(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return at(t),null===e&&xo&&(r=t.stateNode=Vf(t.type,t.pendingProps,et.current),yo=t,ko=!0,a=bo,Rf(t.type)?(Hf=a,bo=Wf(r.firstChild)):bo=a),Wu(e,t,t.pendingProps.children,n),Gu(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&xo&&((a=r=bo)&&(null!==(r=function(e,t,n,r){for(;1===e.nodeType;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[nn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(o=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(o!==a.rel||e.getAttribute("href")!==(null==a.href||""===a.href?null:a.href)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin)||e.getAttribute("title")!==(null==a.title?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((o=e.getAttribute("src"))!==(null==a.src?null:a.src)||e.getAttribute("type")!==(null==a.type?null:a.type)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var o=null==a.name?null:""+a.name;if("hidden"===a.type&&e.getAttribute("name")===o)return e}if(null===(e=Wf(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,ko))?(t.stateNode=r,yo=t,bo=Wf(r.firstChild),ko=!1,a=!0):a=!1),a||_o(t)),at(t),a=t.type,o=t.pendingProps,i=null!==e?e.memoizedProps:null,r=o.children,Tf(a,o)?r=null:null!==i&&Tf(a,i)&&(t.flags|=32),null!==t.memoizedState&&(a=ls(e,t,fs,null,null,n),bp._currentValue=a),Gu(e,t),Wu(e,t,r,n),t.child;case 6:return null===e&&xo&&((e=n=bo)&&(null!==(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n)return null;if(null===(e=Wf(e.nextSibling)))return null}return e}(n,t.pendingProps,ko))?(t.stateNode=n,yo=t,bo=null,e=!0):e=!1),e||_o(t)),null;case 13:return ol(e,t,n);case 4:return nt(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=ki(t,null,r,n):Wu(e,t,r,n),t.child;case 11:return Hu(e,t,t.type,t.pendingProps,n);case 7:return Wu(e,t,t.pendingProps,n),t.child;case 8:case 12:return Wu(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Do(0,t.type,r.value),Wu(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Fo(t),r=r(a=Bo(a)),t.flags|=1,Wu(e,t,r,n),t.child;case 14:return qu(e,t,t.type,t.pendingProps,n);case 15:return Yu(e,t,t.type,t.pendingProps,n);case 19:return dl(e,t,n);case 31:return function(e,t,n){var r=t.pendingProps,a=!!(128&t.flags);if(t.flags&=-129,null===e){if(xo){if("hidden"===r.mode)return e=Ku(t,r),t.lanes=536870912,Qu(null,e);if(qi(t),(e=bo)?null!==(e=null!==(e=zf(e,ko))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==lo?{id:co,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},(n=Za(e)).return=t,t.child=n,yo=t,bo=null):e=null,null===e)throw _o(t);return t.lanes=536870912,null}return Ku(t,r)}var o=e.memoizedState;if(null!==o){var i=o.dehydrated;if(qi(t),a)if(256&t.flags)t.flags&=-257,t=Ju(e,t,n);else{if(null===t.memoizedState)throw Error(he(558));t.child=e.child,t.flags|=128,t=null}else if(Bu||Uo(e,t,n,!1),a=0!==(n&e.childLanes),Bu||a){if(null!==(r=kc)&&0!==(i=Ht(r,n))&&i!==o.retryLane)throw o.retryLane=i,Ba(e,i),nd(r,e,i),Fu;hd(),t=Ju(e,t,n)}else e=o.treeContext,bo=Wf(i.nextSibling),yo=t,xo=!0,wo=null,ko=!1,null!==e&&go(t,e),(t=Ku(t,r)).flags|=4096;return t}return(e=$a(e.child,{mode:r.mode,children:r.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,n);case 22:return Vu(e,t,n,t.pendingProps);case 24:return Fo(t),r=Bo(Qo),null===e?(null===(a=ri())&&(a=kc,o=$o(),a.pooledCache=o,o.refCount++,null!==o&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Oi(t),Do(0,Qo,a)):(0!==(e.lanes&n)&&(Ci(e,t),Ii(t,null,null,n),Ni()),a=e.memoizedState,o=t.memoizedState,a.parent!==r?(a={parent:r,cache:r},t.memoizedState=a,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=a),Do(0,Qo,r)):(r=o.cache,Do(0,Qo,r),r!==a.cache&&Lo(t,[Qo],n,!0))),Wu(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(he(156,t.tag))}function vl(e){e.flags|=4}function ml(e,t,n,r,a){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&a)===a)if(e.stateNode.complete)e.flags|=8192;else{if(!dd())throw pi=li,si;e.flags|=8192}}else e.flags&=-16777217}function gl(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!pp(t)){if(!dd())throw pi=li,si;e.flags|=8192}}function yl(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Ut():536870912,e.lanes|=t,Ac|=t)}function bl(e,t){if(!xo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function xl(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=65011712&a.subtreeFlags,r|=65011712&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function wl(e,t,n){var r=t.pendingProps;switch(mo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return xl(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ro(Qo),rt(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(Po(t)?vl(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,jo())),xl(t),null;case 26:var a=t.type,o=t.memoizedState;return null===e?(vl(t),null!==o?(xl(t),gl(t,o)):(xl(t),ml(t,a,0,0,n))):o?o!==e.memoizedState?(vl(t),xl(t),gl(t,o)):(xl(t),t.flags&=-16777217):((e=e.memoizedProps)!==r&&vl(t),xl(t),ml(t,a,0,0,n)),null;case 27:if(ot(t),n=et.current,a=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&vl(t);else{if(!r){if(null===t.stateNode)throw Error(he(166));return xl(t),null}e=Xe.current,Po(t)?Oo(t):(e=Vf(a,r,n),t.stateNode=e,vl(t))}return xl(t),null;case 5:if(ot(t),a=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&vl(t);else{if(!r){if(null===t.stateNode)throw Error(he(166));return xl(t),null}if(o=Xe.current,Po(t))Oo(t);else{var i=Of(et.current);switch(o){case 1:o=i.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:o=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":o=i.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":o=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":(o=i.createElement("div")).innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o="string"==typeof r.is?i.createElement("select",{is:r.is}):i.createElement("select"),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o="string"==typeof r.is?i.createElement(a,{is:r.is}):i.createElement(a)}}o[Kt]=t,o[Jt]=r;e:for(i=t.child;null!==i;){if(5===i.tag||6===i.tag)o.appendChild(i.stateNode);else if(4!==i.tag&&27!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;null===i.sibling;){if(null===i.return||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=o;e:switch(wf(o,a,r),a){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&vl(t)}}return xl(t),ml(t,t.type,null===e||e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&vl(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(he(166));if(e=et.current,Po(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(a=yo))switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Kt]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||yf(e.nodeValue,n)))||_o(t,!0)}else(e=Of(e).createTextNode(r))[Kt]=t,t.stateNode=e}return xl(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(r=Po(t),null!==n){if(null===e){if(!r)throw Error(he(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(he(557));e[Kt]=t}else To(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;xl(t),e=!1}else n=jo(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(Qi(t),t):(Qi(t),null);if(128&t.flags)throw Error(he(558))}return xl(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(a=Po(t),null!==r&&null!==r.dehydrated){if(null===e){if(!a)throw Error(he(318));if(!(a=null!==(a=t.memoizedState)?a.dehydrated:null))throw Error(he(317));a[Kt]=t}else To(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;xl(t),a=!1}else a=jo(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return 256&t.flags?(Qi(t),t):(Qi(t),null)}return Qi(t),128&t.flags?(t.lanes=n,t):(n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(a=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(a=r.alternate.memoizedState.cachePool.pool),o=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),yl(t,t.updateQueue),xl(t),null);case 4:return rt(),null===e&&uf(t.stateNode.containerInfo),xl(t),null;case 10:return Ro(t.type),xl(t),null;case 19:if($e($i),null===(r=t.memoizedState))return xl(t),null;if(a=!!(128&t.flags),null===(o=r.rendering))if(a)bl(r,!1);else{if(0!==Ec||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=Ki(e))){for(t.flags|=128,bl(r,!1),e=o.updateQueue,t.updateQueue=e,yl(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)Ka(n,e),n=n.sibling;return Ke($i,1&$i.current|2),xo&&po(t,r.treeForkCount),t.child}e=e.sibling}null!==r.tail&&mt()>Wc&&(t.flags|=128,a=!0,bl(r,!1),t.lanes=4194304)}else{if(!a)if(null!==(e=Ki(o))){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,yl(t,e),bl(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!xo)return xl(t),null}else 2*mt()-r.renderingStartTime>Wc&&536870912!==n&&(t.flags|=128,a=!0,bl(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=r.last)?e.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=mt(),e.sibling=null,n=$i.current,Ke($i,a?1&n|2:1&n),xo&&po(t,r.treeForkCount),e):(xl(t),null);case 22:case 23:return Qi(t),Fi(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&n)&&!(128&t.flags)&&(xl(t),6&t.subtreeFlags&&(t.flags|=8192)):xl(t),null!==(n=t.updateQueue)&&yl(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&$e(ni),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ro(Qo),xl(t),null;case 25:case 30:return null}throw Error(he(156,t.tag))}function kl(e,t){switch(mo(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ro(Qo),rt(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return ot(t),null;case 31:if(null!==t.memoizedState){if(Qi(t),null===t.alternate)throw Error(he(340));To()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Qi(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(he(340));To()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return $e($i),null;case 4:return rt(),null;case 10:return Ro(t.type),null;case 22:case 23:return Qi(t),Fi(),null!==e&&$e(ni),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return Ro(Qo),null;default:return null}}function Sl(e,t){switch(mo(t),t.tag){case 3:Ro(Qo),rt();break;case 26:case 27:case 5:ot(t);break;case 4:rt();break;case 31:null!==t.memoizedState&&Qi(t);break;case 13:Qi(t);break;case 19:$e($i);break;case 10:Ro(t.type);break;case 22:case 23:Qi(t),Fi(),null!==e&&$e(ni);break;case 24:Ro(Qo)}}function _l(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var o=n.create,i=n.inst;r=o(),i.destroy=r}n=n.next}while(n!==a)}}catch(e){Ed(t,t.return,e)}}function Ol(e,t,n){try{var r=t.updateQueue,a=null!==r?r.lastEffect:null;if(null!==a){var o=a.next;r=o;do{if((r.tag&e)===e){var i=r.inst,s=i.destroy;if(void 0!==s){i.destroy=void 0,a=t;var u=n,l=s;try{l()}catch(e){Ed(a,u,e)}}}r=r.next}while(r!==o)}}catch(e){Ed(t,t.return,e)}}function Cl(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{Ri(t,n)}catch(t){Ed(e,e.return,t)}}}function Pl(e,t,n){n.props=Eu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ed(e,t,n)}}function Tl(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(n){Ed(e,t,n)}}function jl(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){Ed(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){Ed(e,t,n)}else n.current=null}function Ml(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ed(e,e.return,t)}}function El(e,t,n){try{var r=e.stateNode;!function(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,o=null,i=null,s=null,u=null,l=null,c=null;for(p in n){var d=n[p];if(n.hasOwnProperty(p)&&null!=d)switch(p){case"checked":case"value":break;case"defaultValue":u=d;default:r.hasOwnProperty(p)||bf(e,t,p,null,r,d)}}for(var f in r){var p=r[f];if(d=n[f],r.hasOwnProperty(f)&&(null!=p||null!=d))switch(f){case"type":o=p;break;case"name":a=p;break;case"checked":l=p;break;case"defaultChecked":c=p;break;case"value":i=p;break;case"defaultValue":s=p;break;case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(he(137,t));break;default:p!==d&&bf(e,t,f,p,r,d)}}return void Pn(e,i,s,u,l,c,o,a);case"select":for(o in p=i=s=f=null,n)if(u=n[o],n.hasOwnProperty(o)&&null!=u)switch(o){case"value":break;case"multiple":p=u;default:r.hasOwnProperty(o)||bf(e,t,o,null,r,u)}for(a in r)if(o=r[a],u=n[a],r.hasOwnProperty(a)&&(null!=o||null!=u))switch(a){case"value":f=o;break;case"defaultValue":s=o;break;case"multiple":i=o;default:o!==u&&bf(e,t,a,o,r,u)}return t=s,n=i,r=p,void(null!=f?Mn(e,!!n,f,!1):!!r!=!!n&&(null!=t?Mn(e,!!n,t,!0):Mn(e,!!n,n?[]:"",!1)));case"textarea":for(s in p=f=null,n)if(a=n[s],n.hasOwnProperty(s)&&null!=a&&!r.hasOwnProperty(s))switch(s){case"value":case"children":break;default:bf(e,t,s,null,r,a)}for(i in r)if(a=r[i],o=n[i],r.hasOwnProperty(i)&&(null!=a||null!=o))switch(i){case"value":f=a;break;case"defaultValue":p=a;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=a)throw Error(he(91));break;default:a!==o&&bf(e,t,i,a,r,o)}return void En(e,f,p);case"option":for(var h in n)if(f=n[h],n.hasOwnProperty(h)&&null!=f&&!r.hasOwnProperty(h))if("selected"===h)e.selected=!1;else bf(e,t,h,null,r,f);for(u in r)if(f=r[u],p=n[u],r.hasOwnProperty(u)&&f!==p&&(null!=f||null!=p))if("selected"===u)e.selected=f&&"function"!=typeof f&&"symbol"!=typeof f;else bf(e,t,u,f,r,p);return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var v in n)f=n[v],n.hasOwnProperty(v)&&null!=f&&!r.hasOwnProperty(v)&&bf(e,t,v,null,r,f);for(l in r)if(f=r[l],p=n[l],r.hasOwnProperty(l)&&f!==p&&(null!=f||null!=p))switch(l){case"children":case"dangerouslySetInnerHTML":if(null!=f)throw Error(he(137,t));break;default:bf(e,t,l,f,r,p)}return;default:if(Ln(t)){for(var m in n)f=n[m],n.hasOwnProperty(m)&&void 0!==f&&!r.hasOwnProperty(m)&&xf(e,t,m,void 0,r,f);for(c in r)f=r[c],p=n[c],!r.hasOwnProperty(c)||f===p||void 0===f&&void 0===p||xf(e,t,c,f,r,p);return}}for(var g in n)f=n[g],n.hasOwnProperty(g)&&null!=f&&!r.hasOwnProperty(g)&&bf(e,t,g,null,r,f);for(d in r)f=r[d],p=n[d],!r.hasOwnProperty(d)||f===p||null==f&&null==p||bf(e,t,d,f,r,p)}(r,e.type,n,t),r[Jt]=t}catch(t){Ed(e,e.return,t)}}function Nl(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&Rf(e.type)||4===e.tag}function Il(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Nl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&Rf(e.type))continue e;if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Dl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?(9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).insertBefore(e,t):((t=9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Bn));else if(4!==r&&(27===r&&Rf(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(Dl(e,t,n),e=e.sibling;null!==e;)Dl(e,t,n),e=e.sibling}function Rl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&Rf(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(Rl(e,t,n),e=e.sibling;null!==e;)Rl(e,t,n),e=e.sibling}function Al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);wf(t,r,n),t[Kt]=e,t[Jt]=n}catch(t){Ed(e,e.return,t)}}var Ll=!1,Ul=!1,zl=!1,Fl="function"==typeof WeakSet?WeakSet:Set,Bl=null;function Wl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:nc(e,n),4&r&&_l(5,n);break;case 1:if(nc(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){Ed(n,n.return,e)}else{var a=Eu(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ed(n,n.return,e)}}64&r&&Cl(n),512&r&&Tl(n,n.return);break;case 3:if(nc(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{Ri(e,t)}catch(e){Ed(n,n.return,e)}}break;case 27:null===t&&4&r&&Al(n);case 26:case 5:nc(e,n),null===t&&4&r&&Ml(n),512&r&&Tl(n,n.return);break;case 12:nc(e,n);break;case 31:nc(e,n),4&r&&$l(e,n);break;case 13:nc(e,n),4&r&&Kl(e,n),64&r&&(null!==(e=n.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=Rd.bind(null,n))));break;case 22:if(!(r=null!==n.memoizedState||Ll)){t=null!==t&&null!==t.memoizedState||Ul,a=Ll;var o=Ul;Ll=r,(Ul=t)&&!o?ac(e,n,!!(8772&n.subtreeFlags)):nc(e,n),Ll=a,Ul=o}break;case 30:break;default:nc(e,n)}}function Hl(e){var t=e.alternate;null!==t&&(e.alternate=null,Hl(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&rn(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ql=null,Yl=!1;function Vl(e,t,n){for(n=n.child;null!==n;)Ql(e,t,n),n=n.sibling}function Ql(e,t,n){if(Ct&&"function"==typeof Ct.onCommitFiberUnmount)try{Ct.onCommitFiberUnmount(Ot,n)}catch(e){}switch(n.tag){case 26:Ul||jl(n,t),Vl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:Ul||jl(n,t);var r=ql,a=Yl;Rf(n.type)&&(ql=n.stateNode,Yl=!1),Vl(e,t,n),Qf(n.stateNode),ql=r,Yl=a;break;case 5:Ul||jl(n,t);case 6:if(r=ql,a=Yl,ql=null,Vl(e,t,n),Yl=a,null!==(ql=r))if(Yl)try{(9===ql.nodeType?ql.body:"HTML"===ql.nodeName?ql.ownerDocument.body:ql).removeChild(n.stateNode)}catch(e){Ed(n,t,e)}else try{ql.removeChild(n.stateNode)}catch(e){Ed(n,t,e)}break;case 18:null!==ql&&(Yl?(Af(9===(e=ql).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Zp(e)):Af(ql,n.stateNode));break;case 4:r=ql,a=Yl,ql=n.stateNode.containerInfo,Yl=!0,Vl(e,t,n),ql=r,Yl=a;break;case 0:case 11:case 14:case 15:Ol(2,n,t),Ul||Ol(4,n,t),Vl(e,t,n);break;case 1:Ul||(jl(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&Pl(n,t,r)),Vl(e,t,n);break;case 21:Vl(e,t,n);break;case 22:Ul=(r=Ul)||null!==n.memoizedState,Vl(e,t,n),Ul=r;break;default:Vl(e,t,n)}}function $l(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Zp(e)}catch(e){Ed(t,t.return,e)}}}function Kl(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Zp(e)}catch(e){Ed(t,t.return,e)}}function Jl(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Fl),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Fl),t;default:throw Error(he(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ad.bind(null,e,t);t.then(r,r)}})}function Gl(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var a=n[r],o=e,i=t,s=i;e:for(;null!==s;){switch(s.tag){case 27:if(Rf(s.type)){ql=s.stateNode,Yl=!1;break e}break;case 5:ql=s.stateNode,Yl=!1;break e;case 3:case 4:ql=s.stateNode.containerInfo,Yl=!0;break e}s=s.return}if(null===ql)throw Error(he(160));Ql(o,i,a),ql=null,Yl=!1,null!==(o=a.alternate)&&(o.return=null),a.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)Zl(t,e),t=t.sibling}var Xl=null;function Zl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Gl(t,e),ec(e),4&r&&(Ol(3,e,e.return),_l(3,e),Ol(5,e,e.return));break;case 1:Gl(t,e),ec(e),512&r&&(Ul||null===n||jl(n,n.return)),64&r&&Ll&&(null!==(e=e.updateQueue)&&(null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r))));break;case 26:var a=Xl;if(Gl(t,e),ec(e),512&r&&(Ul||null===n||jl(n,n.return)),4&r){var o=null!==n?n.memoizedState:null;if(r=e.memoizedState,null===n)if(null===r)if(null===e.stateNode){e:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(r){case"title":(!(o=a.getElementsByTagName("title")[0])||o[nn]||o[Kt]||"http://www.w3.org/2000/svg"===o.namespaceURI||o.hasAttribute("itemprop"))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector("head > title"))),wf(o,r,n),o[Kt]=e,ln(o),r=o;break e;case"link":var i=dp("link","href",a).get(r+(n.href||""));if(i)for(var s=0;s<i.length;s++)if((o=i[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&o.getAttribute("rel")===(null==n.rel?null:n.rel)&&o.getAttribute("title")===(null==n.title?null:n.title)&&o.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){i.splice(s,1);break t}wf(o=a.createElement(r),r,n),a.head.appendChild(o);break;case"meta":if(i=dp("meta","content",a).get(r+(n.content||"")))for(s=0;s<i.length;s++)if((o=i[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&o.getAttribute("name")===(null==n.name?null:n.name)&&o.getAttribute("property")===(null==n.property?null:n.property)&&o.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&o.getAttribute("charset")===(null==n.charSet?null:n.charSet)){i.splice(s,1);break t}wf(o=a.createElement(r),r,n),a.head.appendChild(o);break;default:throw Error(he(468,r))}o[Kt]=e,ln(o),r=o}e.stateNode=r}else fp(a,e.type,e.stateNode);else e.stateNode=ip(a,r,e.memoizedProps);else o!==r?(null===o?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):o.count--,null===r?fp(a,e.type,e.stateNode):ip(a,r,e.memoizedProps)):null===r&&null!==e.stateNode&&El(e,e.memoizedProps,n.memoizedProps)}break;case 27:Gl(t,e),ec(e),512&r&&(Ul||null===n||jl(n,n.return)),null!==n&&4&r&&El(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Gl(t,e),ec(e),512&r&&(Ul||null===n||jl(n,n.return)),32&e.flags){a=e.stateNode;try{In(a,"")}catch(t){Ed(e,e.return,t)}}4&r&&null!=e.stateNode&&El(e,a=e.memoizedProps,null!==n?n.memoizedProps:a),1024&r&&(zl=!0);break;case 6:if(Gl(t,e),ec(e),4&r){if(null===e.stateNode)throw Error(he(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ed(e,e.return,t)}}break;case 3:if(cp=null,a=Xl,Xl=Jf(t.containerInfo),Gl(t,e),Xl=a,ec(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Zp(t.containerInfo)}catch(t){Ed(e,e.return,t)}zl&&(zl=!1,tc(e));break;case 4:r=Xl,Xl=Jf(e.stateNode.containerInfo),Gl(t,e),ec(e),Xl=r;break;case 12:default:Gl(t,e),ec(e);break;case 31:case 19:Gl(t,e),ec(e),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Jl(e,r)));break;case 13:Gl(t,e),ec(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Fc=mt()),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Jl(e,r)));break;case 22:a=null!==e.memoizedState;var u=null!==n&&null!==n.memoizedState,l=Ll,c=Ul;if(Ll=l||a,Ul=c||u,Gl(t,e),Ul=c,Ll=l,ec(e),8192&r)e:for(t=e.stateNode,t._visibility=a?-2&t._visibility:1|t._visibility,a&&(null===n||u||Ll||Ul||rc(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){u=n=t;try{if(o=u.stateNode,a)"function"==typeof(i=o.style).setProperty?i.setProperty("display","none","important"):i.display="none";else{s=u.stateNode;var d=u.memoizedProps.style,f=null!=d&&d.hasOwnProperty("display")?d.display:null;s.style.display=null==f||"boolean"==typeof f?"":(""+f).trim()}}catch(e){Ed(u,u.return,e)}}}else if(6===t.tag){if(null===n){u=t;try{u.stateNode.nodeValue=a?"":u.memoizedProps}catch(e){Ed(u,u.return,e)}}}else if(18===t.tag){if(null===n){u=t;try{var p=u.stateNode;a?Lf(p,!0):Lf(u.stateNode,!1)}catch(e){Ed(u,u.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}4&r&&(null!==(r=e.updateQueue)&&(null!==(n=r.retryQueue)&&(r.retryQueue=null,Jl(e,n))));case 30:case 21:}}function ec(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(Nl(r)){n=r;break}r=r.return}if(null==n)throw Error(he(160));switch(n.tag){case 27:var a=n.stateNode;Rl(e,Il(e),a);break;case 5:var o=n.stateNode;32&n.flags&&(In(o,""),n.flags&=-33),Rl(e,Il(e),o);break;case 3:case 4:var i=n.stateNode.containerInfo;Dl(e,Il(e),i);break;default:throw Error(he(161))}}catch(t){Ed(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function tc(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;tc(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function nc(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Wl(e,t.alternate,t),t=t.sibling}function rc(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ol(4,t,t.return),rc(t);break;case 1:jl(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&Pl(t,t.return,n),rc(t);break;case 27:Qf(t.stateNode);case 26:case 5:jl(t,t.return),rc(t);break;case 22:null===t.memoizedState&&rc(t);break;default:rc(t)}e=e.sibling}}function ac(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var r=t.alternate,a=e,o=t,i=o.flags;switch(o.tag){case 0:case 11:case 15:ac(a,o,n),_l(4,o);break;case 1:if(ac(a,o,n),"function"==typeof(a=(r=o).stateNode).componentDidMount)try{a.componentDidMount()}catch(e){Ed(r,r.return,e)}if(null!==(a=(r=o).updateQueue)){var s=r.stateNode;try{var u=a.shared.hiddenCallbacks;if(null!==u)for(a.shared.hiddenCallbacks=null,a=0;a<u.length;a++)Di(u[a],s)}catch(e){Ed(r,r.return,e)}}n&&64&i&&Cl(o),Tl(o,o.return);break;case 27:Al(o);case 26:case 5:ac(a,o,n),n&&null===r&&4&i&&Ml(o),Tl(o,o.return);break;case 12:ac(a,o,n);break;case 31:ac(a,o,n),n&&4&i&&$l(a,o);break;case 13:ac(a,o,n),n&&4&i&&Kl(a,o);break;case 22:null===o.memoizedState&&ac(a,o,n),Tl(o,o.return);break;case 30:break;default:ac(a,o,n)}t=t.sibling}}function oc(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&Ko(n))}function ic(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Ko(e))}function sc(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)uc(e,t,n,r),t=t.sibling}function uc(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:sc(e,t,n,r),2048&a&&_l(9,t);break;case 1:case 31:case 13:default:sc(e,t,n,r);break;case 3:sc(e,t,n,r),2048&a&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Ko(e)));break;case 12:if(2048&a){sc(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,i=o.id,s=o.onPostCommit;"function"==typeof s&&s(i,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){Ed(t,t.return,e)}}else sc(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,i=t.alternate,null!==t.memoizedState?2&o._visibility?sc(e,t,n,r):cc(e,t):2&o._visibility?sc(e,t,n,r):(o._visibility|=2,lc(e,t,n,r,!!(10256&t.subtreeFlags)||!1)),2048&a&&oc(i,t);break;case 24:sc(e,t,n,r),2048&a&&ic(t.alternate,t)}}function lc(e,t,n,r,a){for(a=a&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var o=e,i=t,s=n,u=r,l=i.flags;switch(i.tag){case 0:case 11:case 15:lc(o,i,s,u,a),_l(8,i);break;case 23:break;case 22:var c=i.stateNode;null!==i.memoizedState?2&c._visibility?lc(o,i,s,u,a):cc(o,i):(c._visibility|=2,lc(o,i,s,u,a)),a&&2048&l&&oc(i.alternate,i);break;case 24:lc(o,i,s,u,a),a&&2048&l&&ic(i.alternate,i);break;default:lc(o,i,s,u,a)}t=t.sibling}}function cc(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:cc(n,r),2048&a&&oc(r.alternate,r);break;case 24:cc(n,r),2048&a&&ic(r.alternate,r);break;default:cc(n,r)}t=t.sibling}}var dc=8192;function fc(e,t,n){if(e.subtreeFlags&dc)for(e=e.child;null!==e;)pc(e,t,n),e=e.sibling}function pc(e,t,n){switch(e.tag){case 26:fc(e,t,n),e.flags&dc&&null!==e.memoizedState&&function(e,t,n,r){if(!("stylesheet"!==n.type||"string"==typeof r.media&&!1===matchMedia(r.media).matches||4&n.state.loading)){if(null===n.instance){var a=tp(r.href),o=t.querySelector(np(a));if(o)return null!==(t=o._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=vp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,void ln(o);o=t.ownerDocument||t,r=rp(r),(a=$f.get(a))&&up(r,a),ln(o=o.createElement("link"));var i=o;i._p=new Promise(function(e,t){i.onload=e,i.onerror=t}),wf(o,"link",r),n.instance=o}null===e.stylesheets&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(3&n.state.loading)&&(e.count++,n=vp.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}(n,Xl,e.memoizedState,e.memoizedProps);break;case 5:default:fc(e,t,n);break;case 3:case 4:var r=Xl;Xl=Jf(e.stateNode.containerInfo),fc(e,t,n),Xl=r;break;case 22:null===e.memoizedState&&(null!==(r=e.alternate)&&null!==r.memoizedState?(r=dc,dc=16777216,fc(e,t,n),dc=r):fc(e,t,n))}}function hc(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function vc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Bl=r,yc(r,e)}hc(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)mc(e),e=e.sibling}function mc(e){switch(e.tag){case 0:case 11:case 15:vc(e),2048&e.flags&&Ol(9,e,e.return);break;case 3:case 12:default:vc(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,gc(e)):vc(e)}}function gc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Bl=r,yc(r,e)}hc(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:Ol(8,t,t.return),gc(t);break;case 22:2&(n=t.stateNode)._visibility&&(n._visibility&=-3,gc(t));break;default:gc(t)}e=e.sibling}}function yc(e,t){for(;null!==Bl;){var n=Bl;switch(n.tag){case 0:case 11:case 15:Ol(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:Ko(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,Bl=r;else e:for(n=e;null!==Bl;){var a=(r=Bl).sibling,o=r.return;if(Hl(r),r===n){Bl=null;break e}if(null!==a){a.return=o,Bl=a;break e}Bl=o}}}var bc={getCacheForType:function(e){var t=Bo(Qo),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Bo(Qo).controller.signal}},xc="function"==typeof WeakMap?WeakMap:Map,wc=0,kc=null,Sc=null,_c=0,Oc=0,Cc=null,Pc=!1,Tc=!1,jc=!1,Mc=0,Ec=0,Nc=0,Ic=0,Dc=0,Rc=0,Ac=0,Lc=null,Uc=null,zc=!1,Fc=0,Bc=0,Wc=1/0,Hc=null,qc=null,Yc=0,Vc=null,Qc=null,$c=0,Kc=0,Jc=null,Gc=null,Xc=0,Zc=null;function ed(){return 2&wc&&0!==_c?_c&-_c:null!==We.T?Jd():Vt()}function td(){if(0===Rc)if(536870912&_c&&!xo)Rc=536870912;else{var e=Nt;!(3932160&(Nt<<=1))&&(Nt=262144),Rc=e}return null!==(e=Bi.current)&&(e.flags|=32),Rc}function nd(e,t,n){(e!==kc||2!==Oc&&9!==Oc)&&null===e.cancelPendingCommit||(ld(e,0),id(e,_c,Rc,!1)),Ft(e,n),2&wc&&e===kc||(e===kc&&(!(2&wc)&&(Ic|=n),4===Ec&&id(e,_c,Rc,!1)),Hd(e))}function rd(e,t,n){if(6&wc)throw Error(he(327));for(var r=!n&&!(127&t)&&0===(t&e.expiredLanes)||At(e,t),a=r?function(e,t){var n=wc;wc|=2;var r=fd(),a=pd();kc!==e||_c!==t?(Hc=null,Wc=mt()+500,ld(e,t)):Tc=At(e,t);e:for(;;)try{if(0!==Oc&&null!==Sc){t=Sc;var o=Cc;t:switch(Oc){case 1:Oc=0,Cc=null,xd(e,t,o,1);break;case 2:case 9:if(ci(o)){Oc=0,Cc=null,bd(t);break}t=function(){2!==Oc&&9!==Oc||kc!==e||(Oc=7),Hd(e)},o.then(t,t);break e;case 3:Oc=7;break e;case 4:Oc=5;break e;case 7:ci(o)?(Oc=0,Cc=null,bd(t)):(Oc=0,Cc=null,xd(e,t,o,7));break;case 5:var i=null;switch(Sc.tag){case 26:i=Sc.memoizedState;case 5:case 27:var s=Sc;if(i?pp(i):s.stateNode.complete){Oc=0,Cc=null;var u=s.sibling;if(null!==u)Sc=u;else{var l=s.return;null!==l?(Sc=l,wd(l)):Sc=null}break t}}Oc=0,Cc=null,xd(e,t,o,5);break;case 6:Oc=0,Cc=null,xd(e,t,o,6);break;case 8:ud(),Ec=6;break e;default:throw Error(he(462))}}gd();break}catch(t){cd(e,t)}return Io=No=null,We.H=r,We.A=a,wc=n,null!==Sc?0:(kc=null,_c=0,Ua(),Ec)}(e,t):vd(e,t,!0),o=r;;){if(0===a){Tc&&!r&&id(e,t,0,!1);break}if(n=e.current.alternate,!o||od(n)){if(2===a){if(o=t,e.errorRecoveryDisabledLanes&o)var i=0;else i=0!==(i=-536870913&e.pendingLanes)?i:536870912&i?536870912:0;if(0!==i){t=i;e:{var s=e;a=Lc;var u=s.current.memoizedState.isDehydrated;if(u&&(ld(s,i).flags|=256),2!==(i=vd(s,i,!1))){if(jc&&!u){s.errorRecoveryDisabledLanes|=o,Ic|=o,a=4;break e}o=Uc,Uc=a,null!==o&&(null===Uc?Uc=o:Uc.push.apply(Uc,o))}a=i}if(o=!1,2!==a)continue}}if(1===a){ld(e,0),id(e,t,0,!0);break}e:{switch(r=e,o=a){case 0:case 1:throw Error(he(345));case 4:if((4194048&t)!==t)break;case 6:id(r,t,Rc,!Pc);break e;case 2:Uc=null;break;case 3:case 5:break;default:throw Error(he(329))}if((62914560&t)===t&&10<(a=Fc+300-mt())){if(id(r,t,Rc,!Pc),0!==Rt(r,0,!0))break e;$c=t,r.timeoutHandle=Mf(ad.bind(null,r,n,Uc,Hc,zc,t,Rc,Ic,Ac,Pc,o,"Throttled",-0,0),a)}else ad(r,n,Uc,Hc,zc,t,Rc,Ic,Ac,Pc,o,null,-0,0)}break}a=vd(e,t,!1),o=!1}Hd(e)}function ad(e,t,n,r,a,o,i,s,u,l,c,d,f,p){if(e.timeoutHandle=-1,8192&(d=t.subtreeFlags)||!(16785408&~d)){pc(t,o,d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bn});var h=(62914560&o)===o?Fc-mt():(4194048&o)===o?Bc-mt():0;if(null!==(h=function(e,t){return e.stylesheets&&0===e.count&&gp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&gp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===hp&&(hp=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var a=n[r],o=a.transferSize,i=a.initiatorType,s=a.duration;if(o&&s&&kf(i)){for(i=0,s=a.responseEnd,r+=1;r<n.length;r++){var u=n[r],l=u.startTime;if(l>s)break;var c=u.transferSize,d=u.initiatorType;c&&kf(d)&&(i+=c*((u=u.responseEnd)<s?1:(s-l)/(u-l)))}if(--r,t+=8*(o+i)/(a.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var a=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&gp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>hp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}(d,h)))return $c=o,e.cancelPendingCommit=h(Sd.bind(null,e,t,o,n,r,a,i,s,u,c,d,null,f,p)),void id(e,o,i,!l)}Sd(e,t,o,n,r,a,i,s,u)}function od(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&(null!==(n=t.updateQueue)&&null!==(n=n.stores)))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!ia(o(),a))return!1}catch(e){return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function id(e,t,n,r){t&=~Dc,t&=~Ic,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var o=31-Tt(a),i=1<<o;r[o]=-1,a&=~i}0!==n&&Bt(e,n,t)}function sd(){return!!(6&wc)||(qd(0),!1)}function ud(){if(null!==Sc){if(0===Oc)var e=Sc.return;else Io=No=null,vs(e=Sc),mi=null,gi=0,e=Sc;for(;null!==e;)Sl(e.alternate,e),e=e.return;Sc=null}}function ld(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,Ef(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),$c=0,ud(),kc=e,Sc=n=$a(e.current,null),_c=t,Oc=0,Cc=null,Pc=!1,Tc=At(e,t),jc=!1,Ac=Rc=Dc=Ic=Nc=Ec=0,Uc=Lc=null,zc=!1,8&t&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var a=31-Tt(r),o=1<<a;t|=e[a],r&=~o}return Mc=t,Ua(),n}function cd(e,t){Gi=null,We.H=Su,t===ii||t===ui?(t=hi(),Oc=3):t===si?(t=hi(),Oc=4):Oc=t===Fu?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,Cc=t,null===Sc&&(Ec=1,Ru(e,no(t,e.current)))}function dd(){var e=Bi.current;return null===e||((4194048&_c)===_c?null===Wi:!!((62914560&_c)===_c||536870912&_c)&&e===Wi)}function fd(){var e=We.H;return We.H=Su,null===e?Su:e}function pd(){var e=We.A;return We.A=bc,e}function hd(){Ec=4,Pc||(4194048&_c)!==_c&&null!==Bi.current||(Tc=!0),!(134217727&Nc)&&!(134217727&Ic)||null===kc||id(kc,_c,Rc,!1)}function vd(e,t,n){var r=wc;wc|=2;var a=fd(),o=pd();kc===e&&_c===t||(Hc=null,ld(e,t)),t=!1;var i=Ec;e:for(;;)try{if(0!==Oc&&null!==Sc){var s=Sc,u=Cc;switch(Oc){case 8:ud(),i=6;break e;case 3:case 2:case 9:case 6:null===Bi.current&&(t=!0);var l=Oc;if(Oc=0,Cc=null,xd(e,s,u,l),n&&Tc){i=0;break e}break;default:l=Oc,Oc=0,Cc=null,xd(e,s,u,l)}}md(),i=Ec;break}catch(t){cd(e,t)}return t&&e.shellSuspendCounter++,Io=No=null,wc=r,We.H=a,We.A=o,null===Sc&&(kc=null,_c=0,Ua()),i}function md(){for(;null!==Sc;)yd(Sc)}function gd(){for(;null!==Sc&&!ht();)yd(Sc)}function yd(e){var t=hl(e.alternate,e,Mc);e.memoizedProps=e.pendingProps,null===t?wd(e):Sc=t}function bd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Zu(n,t,t.pendingProps,t.type,void 0,_c);break;case 11:t=Zu(n,t,t.pendingProps,t.type.render,t.ref,_c);break;case 5:vs(t);default:Sl(n,t),t=hl(n,t=Sc=Ka(t,Mc),Mc)}e.memoizedProps=e.pendingProps,null===t?wd(e):Sc=t}function xd(e,t,n,r){Io=No=null,vs(t),mi=null,gi=0;var a=t.return;try{if(function(e,t,n,r,a){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Uo(t,n,a,!0),null!==(n=Bi.current)){switch(n.tag){case 31:case 13:return null===Wi?hd():null===n.alternate&&0===Ec&&(Ec=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===li?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([r]):t.add(r),Nd(e,r,a)),!1;case 22:return n.flags|=65536,r===li?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([r]):n.add(r),Nd(e,r,a)),!1}throw Error(he(435,n.tag))}return Nd(e,r,a),hd(),!1}if(xo)return null!==(t=Bi.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==So&&Mo(no(e=Error(he(422),{cause:r}),n))):(r!==So&&Mo(no(t=Error(he(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,a&=-a,e.lanes|=a,r=no(r,n),Mi(e,a=Lu(e.stateNode,r,a)),4!==Ec&&(Ec=2)),!1;var o=Error(he(520),{cause:r});if(o=no(o,n),null===Lc?Lc=[o]:Lc.push(o),4!==Ec&&(Ec=2),null===t)return!0;r=no(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,Mi(n,e=Lu(n.stateNode,r,e)),!1;case 1:if(t=n.type,o=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===o||"function"!=typeof o.componentDidCatch||null!==qc&&qc.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,zu(a=Uu(a),e,n,r),Mi(n,a),!1}n=n.return}while(null!==n);return!1}(e,a,t,n,_c))return Ec=1,Ru(e,no(n,e.current)),void(Sc=null)}catch(t){if(null!==a)throw Sc=a,t;return Ec=1,Ru(e,no(n,e.current)),void(Sc=null)}32768&t.flags?(xo||1===r?e=!0:Tc||536870912&_c?e=!1:(Pc=e=!0,(2===r||9===r||3===r||6===r)&&(null!==(r=Bi.current)&&13===r.tag&&(r.flags|=16384))),kd(t,e)):wd(t)}function wd(e){var t=e;do{if(32768&t.flags)return void kd(t,Pc);e=t.return;var n=wl(t.alternate,t,Mc);if(null!==n)return void(Sc=n);if(null!==(t=t.sibling))return void(Sc=t);Sc=t=e}while(null!==t);0===Ec&&(Ec=5)}function kd(e,t){do{var n=kl(e.alternate,e);if(null!==n)return n.flags&=32767,void(Sc=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(Sc=e);Sc=e=n}while(null!==e);Ec=6,Sc=null}function Sd(e,t,n,r,a,o,i,s,u){e.cancelPendingCommit=null;do{Td()}while(0!==Yc);if(6&wc)throw Error(he(327));if(null!==t){if(t===e.current)throw Error(he(177));if(o=t.lanes|t.childLanes,function(e,t,n,r,a,o){var i=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,u=e.expirationTimes,l=e.hiddenUpdates;for(n=i&~n;0<n;){var c=31-Tt(n),d=1<<c;s[c]=0,u[c]=-1;var f=l[c];if(null!==f)for(l[c]=null,c=0;c<f.length;c++){var p=f[c];null!==p&&(p.lane&=-536870913)}n&=~d}0!==r&&Bt(e,r,0),0!==o&&0===a&&0!==e.tag&&(e.suspendedLanes|=o&~(i&~t))}(e,n,o|=La,i,s,u),e===kc&&(Sc=kc=null,_c=0),Qc=t,Vc=e,$c=n,Kc=o,Jc=a,Gc=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,ft(xt,function(){return jd(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=We.T,We.T=null,a=He.p,He.p=2,i=wc,wc|=4;try{!function(e,t){if(e=e.containerInfo,Sf=Tp,fa(e=da(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(e){n=null;break e}var i=0,s=-1,u=-1,l=0,c=0,d=e,f=null;t:for(;;){for(var p;d!==n||0!==a&&3!==d.nodeType||(s=i+a),d!==o||0!==r&&3!==d.nodeType||(u=i+r),3===d.nodeType&&(i+=d.nodeValue.length),null!==(p=d.firstChild);)f=d,d=p;for(;;){if(d===e)break t;if(f===n&&++l===a&&(s=i),f===o&&++c===r&&(u=i),null!==(p=d.nextSibling))break;f=(d=f).parentNode}d=p}n=-1===s||-1===u?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(_f={focusedElem:e,selectionRange:n},Tp=!1,Bl=t;null!==Bl;)if(e=(t=Bl).child,1028&t.subtreeFlags&&null!==e)e.return=t,Bl=e;else for(;null!==Bl;){switch(o=(t=Bl).alternate,e=t.flags,t.tag){case 0:if(4&e&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(n=0;n<e.length;n++)(a=e[n]).ref.impl=a.nextImpl;break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==o){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Eu(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ed(n,n.return,e)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))Uf(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Uf(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(he(163))}if(null!==(e=t.sibling)){e.return=t.return,Bl=e;break}Bl=t.return}}(e,t)}finally{wc=i,He.p=a,We.T=r}}Yc=1,_d(),Od(),Cd()}}function _d(){if(1===Yc){Yc=0;var e=Vc,t=Qc,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=We.T,We.T=null;var r=He.p;He.p=2;var a=wc;wc|=4;try{Zl(t,e);var o=_f,i=da(e.containerInfo),s=o.focusedElem,u=o.selectionRange;if(i!==s&&s&&s.ownerDocument&&ca(s.ownerDocument.documentElement,s)){if(null!==u&&fa(s)){var l=u.start,c=u.end;if(void 0===c&&(c=l),"selectionStart"in s)s.selectionStart=l,s.selectionEnd=Math.min(c,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),h=s.textContent.length,v=Math.min(u.start,h),m=void 0===u.end?v:Math.min(u.end,h);!p.extend&&v>m&&(i=m,m=v,v=i);var g=la(s,v),y=la(s,m);if(g&&y&&(1!==p.rangeCount||p.anchorNode!==g.node||p.anchorOffset!==g.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var b=d.createRange();b.setStart(g.node,g.offset),p.removeAllRanges(),v>m?(p.addRange(b),p.extend(y.node,y.offset)):(b.setEnd(y.node,y.offset),p.addRange(b))}}}}for(d=[],p=s;p=p.parentNode;)1===p.nodeType&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof s.focus&&s.focus(),s=0;s<d.length;s++){var x=d[s];x.element.scrollLeft=x.left,x.element.scrollTop=x.top}}Tp=!!Sf,_f=Sf=null}finally{wc=a,He.p=r,We.T=n}}e.current=t,Yc=2}}function Od(){if(2===Yc){Yc=0;var e=Vc,t=Qc,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=We.T,We.T=null;var r=He.p;He.p=2;var a=wc;wc|=4;try{Wl(e,t.alternate,t)}finally{wc=a,He.p=r,We.T=n}}Yc=3}}function Cd(){if(4===Yc||3===Yc){Yc=0,vt();var e=Vc,t=Qc,n=$c,r=Gc;10256&t.subtreeFlags||10256&t.flags?Yc=5:(Yc=0,Qc=Vc=null,Pd(e,e.pendingLanes));var a=e.pendingLanes;if(0===a&&(qc=null),Yt(n),t=t.stateNode,Ct&&"function"==typeof Ct.onCommitFiberRoot)try{Ct.onCommitFiberRoot(Ot,t,void 0,!(128&~t.current.flags))}catch(e){}if(null!==r){t=We.T,a=He.p,He.p=2,We.T=null;try{for(var o=e.onRecoverableError,i=0;i<r.length;i++){var s=r[i];o(s.value,{componentStack:s.stack})}}finally{We.T=t,He.p=a}}3&$c&&Td(),Hd(e),a=e.pendingLanes,261930&n&&42&a?e===Zc?Xc++:(Xc=0,Zc=e):Xc=0,qd(0)}}function Pd(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,Ko(t)))}function Td(){return _d(),Od(),Cd(),jd()}function jd(){if(5!==Yc)return!1;var e=Vc,t=Kc;Kc=0;var n=Yt($c),r=We.T,a=He.p;try{He.p=32>n?32:n,We.T=null,n=Jc,Jc=null;var o=Vc,i=$c;if(Yc=0,Qc=Vc=null,$c=0,6&wc)throw Error(he(331));var s=wc;if(wc|=4,mc(o.current),uc(o,o.current,i,n),wc=s,qd(0,!1),Ct&&"function"==typeof Ct.onPostCommitFiberRoot)try{Ct.onPostCommitFiberRoot(Ot,o)}catch(e){}return!0}finally{He.p=a,We.T=r,Pd(e,t)}}function Md(e,t,n){t=no(n,t),null!==(e=Ti(e,t=Lu(e.stateNode,t,2),2))&&(Ft(e,2),Hd(e))}function Ed(e,t,n){if(3===e.tag)Md(e,e,n);else for(;null!==t;){if(3===t.tag){Md(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===qc||!qc.has(r))){e=no(n,e),null!==(r=Ti(t,n=Uu(2),2))&&(zu(n,r,t,e),Ft(r,2),Hd(r));break}}t=t.return}}function Nd(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new xc;var a=new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=new Set,r.set(t,a));a.has(n)||(jc=!0,a.add(n),e=Id.bind(null,e,t,n),t.then(e,e))}function Id(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,kc===e&&(_c&n)===n&&(4===Ec||3===Ec&&(62914560&_c)===_c&&300>mt()-Fc?!(2&wc)&&ld(e,0):Dc|=n,Ac===_c&&(Ac=0)),Hd(e)}function Dd(e,t){0===t&&(t=Ut()),null!==(e=Ba(e,t))&&(Ft(e,t),Hd(e))}function Rd(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Dd(e,n)}function Ad(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(he(314))}null!==r&&r.delete(t),Dd(e,n)}var Ld=null,Ud=null,zd=!1,Fd=!1,Bd=!1,Wd=0;function Hd(e){e!==Ud&&null===e.next&&(null===Ud?Ld=Ud=e:Ud=Ud.next=e),Fd=!0,zd||(zd=!0,If(function(){6&wc?ft(yt,Yd):Vd()}))}function qd(e,t){if(!Bd&&Fd){Bd=!0;do{for(var n=!1,r=Ld;null!==r;){if(0!==e){var a=r.pendingLanes;if(0===a)var o=0;else{var i=r.suspendedLanes,s=r.pingedLanes;o=(1<<31-Tt(42|e)+1)-1,o=201326741&(o&=a&~(i&~s))?201326741&o|1:o?2|o:0}0!==o&&(n=!0,Kd(r,o))}else o=_c,!(3&(o=Rt(r,r===kc?o:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||At(r,o)||(n=!0,Kd(r,o));r=r.next}}while(n);Bd=!1}}function Yd(){Vd()}function Vd(){Fd=zd=!1;var e=0;0!==Wd&&function(){var e=window.event;if(e&&"popstate"===e.type)return e!==jf&&(jf=e,!0);return jf=null,!1}()&&(e=Wd);for(var t=mt(),n=null,r=Ld;null!==r;){var a=r.next,o=Qd(r,t);0===o?(r.next=null,null===n?Ld=a:n.next=a,null===a&&(Ud=n)):(n=r,(0!==e||3&o)&&(Fd=!0)),r=a}0!==Yc&&5!==Yc||qd(e),0!==Wd&&(Wd=0)}function Qd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=-62914561&e.pendingLanes;0<o;){var i=31-Tt(o),s=1<<i,u=a[i];-1===u?0!==(s&n)&&0===(s&r)||(a[i]=Lt(s,t)):u<=t&&(e.expiredLanes|=s),o&=~s}if(n=_c,n=Rt(e,e===(t=kc)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),r=e.callbackNode,0===n||e===t&&(2===Oc||9===Oc)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&pt(r),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||At(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&pt(r),Yt(n)){case 2:case 8:n=bt;break;case 32:default:n=xt;break;case 268435456:n=kt}return r=$d.bind(null,e),n=ft(n,r),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&pt(r),e.callbackPriority=2,e.callbackNode=null,2}function $d(e,t){if(0!==Yc&&5!==Yc)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Td()&&e.callbackNode!==n)return null;var r=_c;return 0===(r=Rt(e,e===kc?r:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(rd(e,r,t),Qd(e,mt()),null!=e.callbackNode&&e.callbackNode===n?$d.bind(null,e):null)}function Kd(e,t){if(Td())return null;rd(e,t,!0)}function Jd(){if(0===Wd){var e=Xo;0===e&&(e=Et,!(261888&(Et<<=1))&&(Et=256)),Wd=e}return Wd}function Gd(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:Fn(""+e)}function Xd(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}for(var Zd=0;Zd<Na.length;Zd++){var ef=Na[Zd];Ia(ef.toLowerCase(),"on"+(ef[0].toUpperCase()+ef.slice(1)))}Ia(_a,"onAnimationEnd"),Ia(Oa,"onAnimationIteration"),Ia(Ca,"onAnimationStart"),Ia("dblclick","onDoubleClick"),Ia("focusin","onFocus"),Ia("focusout","onBlur"),Ia(Pa,"onTransitionRun"),Ia(Ta,"onTransitionStart"),Ia(ja,"onTransitionCancel"),Ia(Ma,"onTransitionEnd"),pn("onMouseEnter",["mouseout","mouseover"]),pn("onMouseLeave",["mouseout","mouseover"]),pn("onPointerEnter",["pointerout","pointerover"]),pn("onPointerLeave",["pointerout","pointerover"]),fn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fn("onBeforeInput",["compositionend","keypress","textInput","paste"]),fn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),nf=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tf));function rf(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],u=s.instance,l=s.currentTarget;if(s=s.listener,u!==o&&a.isPropagationStopped())break e;o=s,a.currentTarget=l;try{o(a)}catch(e){Da(e)}a.currentTarget=null,o=u}else for(i=0;i<r.length;i++){if(u=(s=r[i]).instance,l=s.currentTarget,s=s.listener,u!==o&&a.isPropagationStopped())break e;o=s,a.currentTarget=l;try{o(a)}catch(e){Da(e)}a.currentTarget=null,o=u}}}}function af(e,t){var n=t[Xt];void 0===n&&(n=t[Xt]=new Set);var r=e+"__bubble";n.has(r)||(lf(t,e,2,!1),n.add(r))}function of(e,t,n){var r=0;t&&(r|=4),lf(n,e,r,t)}var sf="_reactListening"+Math.random().toString(36).slice(2);function uf(e){if(!e[sf]){e[sf]=!0,cn.forEach(function(t){"selectionchange"!==t&&(nf.has(t)||of(t,!1,e),of(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[sf]||(t[sf]=!0,of("selectionchange",!1,t))}}function lf(e,t,n,r){switch(Rp(t)){case 2:var a=jp;break;case 8:a=Mp;break;default:a=Ep}n=a.bind(null,t,n,e),a=void 0,!Gn||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function cf(e,t,n,r,a){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var s=r.stateNode.containerInfo;if(s===a)break;if(4===i)for(i=r.return;null!==i;){var u=i.tag;if((3===u||4===u)&&i.stateNode.containerInfo===a)return;i=i.return}for(;null!==s;){if(null===(i=an(s)))return;if(5===(u=i.tag)||6===u||26===u||27===u){r=o=i;continue e}s=s.parentNode}}r=r.return}$n(function(){var r=o,a=Hn(n),i=[];e:{var s=Ea.get(e);if(void 0!==s){var u=dr,l=e;switch(e){case"keypress":if(0===rr(n))break e;case"keydown":case"keyup":u=Cr;break;case"focusin":l="focus",u=gr;break;case"focusout":l="blur",u=gr;break;case"beforeblur":case"afterblur":u=gr;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":u=vr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":u=mr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":u=Tr;break;case _a:case Oa:case Ca:u=yr;break;case Ma:u=jr;break;case"scroll":case"scrollend":u=pr;break;case"wheel":u=Mr;break;case"copy":case"cut":case"paste":u=br;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":u=Pr;break;case"toggle":case"beforetoggle":u=Er}var c=!!(4&t),d=!c&&("scroll"===e||"scrollend"===e),f=c?null!==s?s+"Capture":null:s;c=[];for(var p,h=r;null!==h;){var v=h;if(p=v.stateNode,5!==(v=v.tag)&&26!==v&&27!==v||null===p||null===f||null!=(v=Kn(h,f))&&c.push(df(h,v,p)),d)break;h=h.return}0<c.length&&(s=new u(s,l,null,n,a),i.push({event:s,listeners:c}))}}if(!(7&t)){if(u="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===Wn||!(l=n.relatedTarget||n.fromElement)||!an(l)&&!l[Gt])&&(u||s)&&(s=a.window===a?a:(s=a.ownerDocument)?s.defaultView||s.parentWindow:window,u?(u=r,null!==(l=(l=n.relatedTarget||n.toElement)?an(l):null)&&(d=me(l),c=l.tag,l!==d||5!==c&&27!==c&&6!==c)&&(l=null)):(u=null,l=r),u!==l)){if(c=vr,v="onMouseLeave",f="onMouseEnter",h="mouse","pointerout"!==e&&"pointerover"!==e||(c=Pr,v="onPointerLeave",f="onPointerEnter",h="pointer"),d=null==u?s:sn(u),p=null==l?s:sn(l),(s=new c(v,h+"leave",u,n,a)).target=d,s.relatedTarget=p,v=null,an(a)===r&&((c=new c(f,h+"enter",l,n,a)).target=p,c.relatedTarget=d,v=c),d=v,u&&l)e:{for(c=pf,h=l,p=0,v=f=u;v;v=c(v))p++;v=0;for(var m=h;m;m=c(m))v++;for(;0<p-v;)f=c(f),p--;for(;0<v-p;)h=c(h),v--;for(;p--;){if(f===h||null!==h&&f===h.alternate){c=f;break e}f=c(f),h=c(h)}c=null}else c=null;null!==u&&hf(i,s,u,c,!1),null!==l&&null!==d&&hf(i,d,l,c,!0)}if("select"===(u=(s=r?sn(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===u&&"file"===s.type)var g=Kr;else if(Hr(s))if(Jr)g=oa;else{g=ra;var y=na}else!(u=s.nodeName)||"input"!==u.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?r&&Ln(r.elementType)&&(g=Kr):g=aa;switch(g&&(g=g(e,r))?qr(i,g,n,a):(y&&y(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&jn(s,"number",s.value)),y=r?sn(r):window,e){case"focusin":(Hr(y)||"true"===y.contentEditable)&&(ha=y,va=r,ma=null);break;case"focusout":ma=va=ha=null;break;case"mousedown":ga=!0;break;case"contextmenu":case"mouseup":case"dragend":ga=!1,ya(i,n,a);break;case"selectionchange":if(pa)break;case"keydown":case"keyup":ya(i,n,a)}var b;if(Ir)e:{switch(e){case"compositionstart":var x="onCompositionStart";break e;case"compositionend":x="onCompositionEnd";break e;case"compositionupdate":x="onCompositionUpdate";break e}x=void 0}else Br?zr(e,n)&&(x="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(x="onCompositionStart");x&&(Ar&&"ko"!==n.locale&&(Br||"onCompositionStart"!==x?"onCompositionEnd"===x&&Br&&(b=nr()):(er="value"in(Zn=a)?Zn.value:Zn.textContent,Br=!0)),0<(y=ff(r,x)).length&&(x=new xr(x,e,null,n,a),i.push({event:x,listeners:y}),b?x.data=b:null!==(b=Fr(n))&&(x.data=b))),(b=Rr?function(e,t){switch(e){case"compositionend":return Fr(t);case"keypress":return 32!==t.which?null:(Ur=!0,Lr);case"textInput":return(e=t.data)===Lr&&Ur?null:e;default:return null}}(e,n):function(e,t){if(Br)return"compositionend"===e||!Ir&&zr(e,t)?(e=nr(),tr=er=Zn=null,Br=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ar&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(x=ff(r,"onBeforeInput")).length&&(y=new xr("onBeforeInput","beforeinput",null,n,a),i.push({event:y,listeners:x}),y.data=b)),function(e,t,n,r,a){if("submit"===t&&n&&n.stateNode===a){var o=Gd((a[Jt]||null).action),i=r.submitter;i&&null!==(t=(t=i[Jt]||null)?Gd(t.formAction):i.getAttribute("formAction"))&&(o=t,i=null);var s=new dr("action","action",null,r,a);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(0!==Wd){var e=i?Xd(a,i):new FormData(a);lu(n,{pending:!0,data:e,method:a.method,action:o},null,e)}}else"function"==typeof o&&(s.preventDefault(),e=i?Xd(a,i):new FormData(a),lu(n,{pending:!0,data:e,method:a.method,action:o},o,e))},currentTarget:a}]})}}(i,e,r,n,a)}rf(i,t)})}function df(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ff(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;if(5!==(a=a.tag)&&26!==a&&27!==a||null===o||(null!=(a=Kn(e,n))&&r.unshift(df(e,a,o)),null!=(a=Kn(e,t))&&r.push(df(e,a,o))),3===e.tag)return r;e=e.return}return[]}function pf(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function hf(e,t,n,r,a){for(var o=t._reactName,i=[];null!==n&&n!==r;){var s=n,u=s.alternate,l=s.stateNode;if(s=s.tag,null!==u&&u===r)break;5!==s&&26!==s&&27!==s||null===l||(u=l,a?null!=(l=Kn(n,o))&&i.unshift(df(n,l,u)):a||null!=(l=Kn(n,o))&&i.push(df(n,l,u))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}var vf=/\r\n?/g,mf=/\u0000|\uFFFD/g;function gf(e){return("string"==typeof e?e:""+e).replace(vf,"\n").replace(mf,"")}function yf(e,t){return t=gf(t),gf(e)===t}function bf(e,t,n,r,a,o){switch(n){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||In(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&In(e,""+r);break;case"className":yn(e,"class",r);break;case"tabIndex":yn(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":yn(e,n,r);break;case"style":An(e,r,o);break;case"data":if("object"!==t){yn(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Fn(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if("function"==typeof r){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}if("function"==typeof o&&("formAction"===n?("input"!==t&&bf(e,t,"name",a.name,a,null),bf(e,t,"formEncType",a.formEncType,a,null),bf(e,t,"formMethod",a.formMethod,a,null),bf(e,t,"formTarget",a.formTarget,a,null)):(bf(e,t,"encType",a.encType,a,null),bf(e,t,"method",a.method,a,null),bf(e,t,"target",a.target,a,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Fn(""+r),e.setAttribute(n,r);break;case"onClick":null!=r&&(e.onclick=Bn);break;case"onScroll":null!=r&&af("scroll",e);break;case"onScrollEnd":null!=r&&af("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(he(61));if(null!=(n=r.__html)){if(null!=a.children)throw Error(he(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}n=Fn(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===r?e.setAttribute(n,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":af("beforetoggle",e),af("toggle",e),gn(e,"popover",r);break;case"xlinkActuate":bn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":bn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":bn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":bn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":bn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":bn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":bn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":bn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":bn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":gn(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&gn(e,n=Un.get(n)||n,r)}}function xf(e,t,n,r,a,o){switch(n){case"style":An(e,r,o);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(he(61));if(null!=(n=r.__html)){if(null!=a.children)throw Error(he(60));e.innerHTML=n}}break;case"children":"string"==typeof r?In(e,r):("number"==typeof r||"bigint"==typeof r)&&In(e,""+r);break;case"onScroll":null!=r&&af("scroll",e);break;case"onScrollEnd":null!=r&&af("scrollend",e);break;case"onClick":null!=r&&(e.onclick=Bn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:dn.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),"function"==typeof(o=null!=(o=e[Jt]||null)?o[n]:null)&&e.removeEventListener(t,o,a),"function"!=typeof r)?n in e?e[n]=r:!0===r?e.setAttribute(n,""):gn(e,n,r):("function"!=typeof o&&null!==o&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a)))}}function wf(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":af("error",e),af("load",e);var r,a=!1,o=!1;for(r in n)if(n.hasOwnProperty(r)){var i=n[r];if(null!=i)switch(r){case"src":a=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(he(137,t));default:bf(e,t,r,i,n,null)}}return o&&bf(e,t,"srcSet",n.srcSet,n,null),void(a&&bf(e,t,"src",n.src,n,null));case"input":af("invalid",e);var s=r=i=o=null,u=null,l=null;for(a in n)if(n.hasOwnProperty(a)){var c=n[a];if(null!=c)switch(a){case"name":o=c;break;case"type":i=c;break;case"checked":u=c;break;case"defaultChecked":l=c;break;case"value":r=c;break;case"defaultValue":s=c;break;case"children":case"dangerouslySetInnerHTML":if(null!=c)throw Error(he(137,t));break;default:bf(e,t,a,c,n,null)}}return void Tn(e,r,s,u,l,i,o,!1);case"select":for(o in af("invalid",e),a=i=r=null,n)if(n.hasOwnProperty(o)&&null!=(s=n[o]))switch(o){case"value":r=s;break;case"defaultValue":i=s;break;case"multiple":a=s;default:bf(e,t,o,s,n,null)}return t=r,n=i,e.multiple=!!a,void(null!=t?Mn(e,!!a,t,!1):null!=n&&Mn(e,!!a,n,!0));case"textarea":for(i in af("invalid",e),r=o=a=null,n)if(n.hasOwnProperty(i)&&null!=(s=n[i]))switch(i){case"value":a=s;break;case"defaultValue":o=s;break;case"children":r=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(he(91));break;default:bf(e,t,i,s,n,null)}return void Nn(e,a,o,r);case"option":for(u in n)if(n.hasOwnProperty(u)&&null!=(a=n[u]))if("selected"===u)e.selected=a&&"function"!=typeof a&&"symbol"!=typeof a;else bf(e,t,u,a,n,null);return;case"dialog":af("beforetoggle",e),af("toggle",e),af("cancel",e),af("close",e);break;case"iframe":case"object":af("load",e);break;case"video":case"audio":for(a=0;a<tf.length;a++)af(tf[a],e);break;case"image":af("error",e),af("load",e);break;case"details":af("toggle",e);break;case"embed":case"source":case"link":af("error",e),af("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(l in n)if(n.hasOwnProperty(l)&&null!=(a=n[l]))switch(l){case"children":case"dangerouslySetInnerHTML":throw Error(he(137,t));default:bf(e,t,l,a,n,null)}return;default:if(Ln(t)){for(c in n)n.hasOwnProperty(c)&&(void 0!==(a=n[c])&&xf(e,t,c,a,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(null!=(a=n[s])&&bf(e,t,s,a,n,null))}function kf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var Sf=null,_f=null;function Of(e){return 9===e.nodeType?e:e.ownerDocument}function Cf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Pf(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function Tf(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var jf=null;var Mf="function"==typeof setTimeout?setTimeout:void 0,Ef="function"==typeof clearTimeout?clearTimeout:void 0,Nf="function"==typeof Promise?Promise:void 0,If="function"==typeof queueMicrotask?queueMicrotask:void 0!==Nf?function(e){return Nf.resolve(null).then(e).catch(Df)}:Mf;function Df(e){setTimeout(function(){throw e})}function Rf(e){return"head"===e}function Af(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)||"/&"===n){if(0===r)return e.removeChild(a),void Zp(t);r--}else if("$"===n||"$?"===n||"$~"===n||"$!"===n||"&"===n)r++;else if("html"===n)Qf(e.ownerDocument.documentElement);else if("head"===n){Qf(n=e.ownerDocument.head);for(var o=n.firstChild;o;){var i=o.nextSibling,s=o.nodeName;o[nn]||"SCRIPT"===s||"STYLE"===s||"LINK"===s&&"stylesheet"===o.rel.toLowerCase()||n.removeChild(o),o=i}}else"body"===n&&Qf(e.ownerDocument.body);n=a}while(n);Zp(t)}function Lf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(1===n.nodeType?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",""===n.getAttribute("style")&&n.removeAttribute("style")):3===n.nodeType&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===e)break;e--}else"$"!==n&&"$?"!==n&&"$~"!==n&&"$!"!==n||e++;n=r}while(n)}function Uf(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Uf(n),rn(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function zf(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=Wf(e.nextSibling)))return null}return e}function Ff(e){return"$?"===e.data||"$~"===e.data}function Bf(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function Wf(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"$~"===t||"&"===t||"F!"===t||"F"===t)break;if("/$"===t||"/&"===t)return null}}return e}var Hf=null;function qf(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n||"/&"===n){if(0===t)return Wf(e.nextSibling);t--}else"$"!==n&&"$!"!==n&&"$?"!==n&&"$~"!==n&&"&"!==n||t++}e=e.nextSibling}return null}function Yf(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n||"$~"===n||"&"===n){if(0===t)return e;t--}else"/$"!==n&&"/&"!==n||t++}e=e.previousSibling}return null}function Vf(e,t,n){switch(t=Of(n),e){case"html":if(!(e=t.documentElement))throw Error(he(452));return e;case"head":if(!(e=t.head))throw Error(he(453));return e;case"body":if(!(e=t.body))throw Error(he(454));return e;default:throw Error(he(451))}}function Qf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);rn(e)}var $f=new Map,Kf=new Set;function Jf(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Gf=He.d;He.d={f:function(){var e=Gf.f(),t=sd();return e||t},r:function(e){var t=on(e);null!==t&&5===t.tag&&"form"===t.type?du(t):Gf.r(e)},D:function(e){Gf.D(e),Zf("dns-prefetch",e,null)},C:function(e,t){Gf.C(e,t),Zf("preconnect",e,t)},L:function(e,t,n){Gf.L(e,t,n);var r=Xf;if(r&&e&&t){var a='link[rel="preload"][as="'+Cn(t)+'"]';"image"===t&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Cn(n.imageSrcSet)+'"]',"string"==typeof n.imageSizes&&(a+='[imagesizes="'+Cn(n.imageSizes)+'"]')):a+='[href="'+Cn(e)+'"]';var o=a;switch(t){case"style":o=tp(e);break;case"script":o=ap(e)}$f.has(o)||(e=we({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),$f.set(o,e),null!==r.querySelector(a)||"style"===t&&r.querySelector(np(o))||"script"===t&&r.querySelector(op(o))||(wf(t=r.createElement("link"),"link",e),ln(t),r.head.appendChild(t)))}},m:function(e,t){Gf.m(e,t);var n=Xf;if(n&&e){var r=t&&"string"==typeof t.as?t.as:"script",a='link[rel="modulepreload"][as="'+Cn(r)+'"][href="'+Cn(e)+'"]',o=a;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=ap(e)}if(!$f.has(o)&&(e=we({rel:"modulepreload",href:e},t),$f.set(o,e),null===n.querySelector(a))){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(op(o)))return}wf(r=n.createElement("link"),"link",e),ln(r),n.head.appendChild(r)}}},X:function(e,t){Gf.X(e,t);var n=Xf;if(n&&e){var r=un(n).hoistableScripts,a=ap(e),o=r.get(a);o||((o=n.querySelector(op(a)))||(e=we({src:e,async:!0},t),(t=$f.get(a))&&lp(e,t),ln(o=n.createElement("script")),wf(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(a,o))}},S:function(e,t,n){Gf.S(e,t,n);var r=Xf;if(r&&e){var a=un(r).hoistableStyles,o=tp(e);t=t||"default";var i=a.get(o);if(!i){var s={loading:0,preload:null};if(i=r.querySelector(np(o)))s.loading=5;else{e=we({rel:"stylesheet",href:e,"data-precedence":t},n),(n=$f.get(o))&&up(e,n);var u=i=r.createElement("link");ln(u),wf(u,"link",e),u._p=new Promise(function(e,t){u.onload=e,u.onerror=t}),u.addEventListener("load",function(){s.loading|=1}),u.addEventListener("error",function(){s.loading|=2}),s.loading|=4,sp(i,t,r)}i={type:"stylesheet",instance:i,count:1,state:s},a.set(o,i)}}},M:function(e,t){Gf.M(e,t);var n=Xf;if(n&&e){var r=un(n).hoistableScripts,a=ap(e),o=r.get(a);o||((o=n.querySelector(op(a)))||(e=we({src:e,async:!0,type:"module"},t),(t=$f.get(a))&&lp(e,t),ln(o=n.createElement("script")),wf(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(a,o))}}};var Xf="undefined"==typeof document?null:document;function Zf(e,t,n){var r=Xf;if(r&&"string"==typeof t&&t){var a=Cn(t);a='link[rel="'+e+'"][href="'+a+'"]',"string"==typeof n&&(a+='[crossorigin="'+n+'"]'),Kf.has(a)||(Kf.add(a),e={rel:e,crossOrigin:n,href:t},null===r.querySelector(a)&&(wf(t=r.createElement("link"),"link",e),ln(t),r.head.appendChild(t)))}}function ep(e,t,n,r){var a,o,i,s,u=(u=et.current)?Jf(u):null;if(!u)throw Error(he(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=tp(n.href),(r=(n=un(u).hoistableStyles).get(t))||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=tp(n.href);var l=un(u).hoistableStyles,c=l.get(e);if(c||(u=u.ownerDocument||u,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(e,c),(l=u.querySelector(np(e)))&&!l._p&&(c.instance=l,c.state.loading=5),$f.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},$f.set(e,n),l||(a=u,o=e,i=n,s=c.state,a.querySelector('link[rel="preload"][as="style"]['+o+"]")?s.loading=1:(o=a.createElement("link"),s.preload=o,o.addEventListener("load",function(){return s.loading|=1}),o.addEventListener("error",function(){return s.loading|=2}),wf(o,"link",i),ln(o),a.head.appendChild(o))))),t&&null===r)throw Error(he(528,""));return c}if(t&&null!==r)throw Error(he(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=ap(n),(r=(n=un(u).hoistableScripts).get(t))||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(he(444,e))}}function tp(e){return'href="'+Cn(e)+'"'}function np(e){return'link[rel="stylesheet"]['+e+"]"}function rp(e){return we({},e,{"data-precedence":e.precedence,precedence:null})}function ap(e){return'[src="'+Cn(e)+'"]'}function op(e){return"script[async]"+e}function ip(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Cn(n.href)+'"]');if(r)return t.instance=r,ln(r),r;var a=we({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return ln(r=(e.ownerDocument||e).createElement("style")),wf(r,"style",a),sp(r,n.precedence,e),t.instance=r;case"stylesheet":a=tp(n.href);var o=e.querySelector(np(a));if(o)return t.state.loading|=4,t.instance=o,ln(o),o;r=rp(n),(a=$f.get(a))&&up(r,a),ln(o=(e.ownerDocument||e).createElement("link"));var i=o;return i._p=new Promise(function(e,t){i.onload=e,i.onerror=t}),wf(o,"link",r),t.state.loading|=4,sp(o,n.precedence,e),t.instance=o;case"script":return o=ap(n.src),(a=e.querySelector(op(o)))?(t.instance=a,ln(a),a):(r=n,(a=$f.get(o))&&lp(r=we({},n),a),ln(a=(e=e.ownerDocument||e).createElement("script")),wf(a,"link",r),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(he(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,sp(r,n.precedence,e));return t.instance}function sp(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=r.length?r[r.length-1]:null,o=a,i=0;i<r.length;i++){var s=r[i];if(s.dataset.precedence===t)o=s;else if(o!==a)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function up(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function lp(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var cp=null;function dp(e,t,n){if(null===cp){var r=new Map,a=cp=new Map;a.set(n,r)}else(r=(a=cp).get(n))||(r=new Map,a.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var o=n[a];if(!(o[nn]||o[Kt]||"link"===e&&"stylesheet"===o.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==o.namespaceURI){var i=o.getAttribute(t)||"";i=e+i;var s=r.get(i);s?s.push(o):r.set(i,[o])}}return r}function fp(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function pp(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var hp=0;function vp(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)gp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var mp=null;function gp(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,mp=new Map,t.forEach(yp,e),mp=null,vp.call(e))}function yp(e,t){if(!(4&t.state.loading)){var n=mp.get(e);if(n)var r=n.get(null);else{n=new Map,mp.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<a.length;o++){var i=a[o];"LINK"!==i.nodeName&&"not all"===i.getAttribute("media")||(n.set(i.dataset.precedence,i),r=i)}r&&n.set(null,r)}i=(a=t.instance).getAttribute("data-precedence"),(o=n.get(i)||r)===r&&n.set(null,a),n.set(i,a),this.count++,r=vp.bind(this),a.addEventListener("load",r),a.addEventListener("error",r),o?o.parentNode.insertBefore(a,o.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(a,e.firstChild),t.state.loading|=4}}var bp={$$typeof:je,Provider:null,Consumer:null,_currentValue:qe,_currentValue2:qe,_threadCount:0};function xp(e,t,n,r,a,o,i,s,u){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zt(0),this.hiddenUpdates=zt(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=o,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=u,this.incompleteTransitions=new Map}function wp(e,t,n,r,a,o,i,s,u,l,c,d){return e=new xp(e,t,n,i,u,l,c,d,s),t=1,!0===o&&(t|=24),o=Va(3,null,null,t),e.current=o,o.stateNode=e,(t=$o()).refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},Oi(o),e}function kp(e){return e?e=qa:qa}function Sp(e,t,n,r,a,o){a=kp(a),null===r.context?r.context=a:r.pendingContext=a,(r=Pi(t)).payload={element:n},null!==(o=void 0===o?null:o)&&(r.callback=o),null!==(n=Ti(e,r,t))&&(nd(n,0,t),ji(n,e,t))}function _p(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Op(e,t){_p(e,t),(e=e.alternate)&&_p(e,t)}function Cp(e){if(13===e.tag||31===e.tag){var t=Ba(e,67108864);null!==t&&nd(t,0,67108864),Op(e,67108864)}}function Pp(e){if(13===e.tag||31===e.tag){var t=ed(),n=Ba(e,t=qt(t));null!==n&&nd(n,0,t),Op(e,t)}}var Tp=!0;function jp(e,t,n,r){var a=We.T;We.T=null;var o=He.p;try{He.p=2,Ep(e,t,n,r)}finally{He.p=o,We.T=a}}function Mp(e,t,n,r){var a=We.T;We.T=null;var o=He.p;try{He.p=8,Ep(e,t,n,r)}finally{He.p=o,We.T=a}}function Ep(e,t,n,r){if(Tp){var a=Np(r);if(null===a)cf(e,t,r,Ip,n),qp(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return Lp=Yp(Lp,e,t,n,r,a),!0;case"dragenter":return Up=Yp(Up,e,t,n,r,a),!0;case"mouseover":return zp=Yp(zp,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return Fp.set(o,Yp(Fp.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,Bp.set(o,Yp(Bp.get(o)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(qp(e,r),4&t&&-1<Hp.indexOf(e)){for(;null!==a;){var o=on(a);if(null!==o)switch(o.tag){case 3:if((o=o.stateNode).current.memoizedState.isDehydrated){var i=Dt(o.pendingLanes);if(0!==i){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;i;){var u=1<<31-Tt(i);s.entanglements[1]|=u,i&=~u}Hd(o),!(6&wc)&&(Wc=mt()+500,qd(0))}}break;case 31:case 13:null!==(s=Ba(o,2))&&nd(s,0,2),sd(),Op(o,2)}if(null===(o=Np(r))&&cf(e,t,r,Ip,n),o===a)break;a=o}null!==a&&r.stopPropagation()}else cf(e,t,r,null,n)}}function Np(e){return Dp(e=Hn(e))}var Ip=null;function Dp(e){if(Ip=null,null!==(e=an(e))){var t=me(e);if(null===t)e=null;else{var n=t.tag;if(13===n){if(null!==(e=ge(t)))return e;e=null}else if(31===n){if(null!==(e=ye(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ip=e,null}function Rp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(gt()){case yt:return 2;case bt:return 8;case xt:case wt:return 32;case kt:return 268435456;default:return 32}default:return 32}}var Ap=!1,Lp=null,Up=null,zp=null,Fp=new Map,Bp=new Map,Wp=[],Hp="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function qp(e,t){switch(e){case"focusin":case"focusout":Lp=null;break;case"dragenter":case"dragleave":Up=null;break;case"mouseover":case"mouseout":zp=null;break;case"pointerover":case"pointerout":Fp.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bp.delete(t.pointerId)}}function Yp(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},null!==t&&(null!==(t=on(t))&&Cp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function Vp(e){var t=an(e.target);if(null!==t){var n=me(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=ge(n)))return e.blockedOn=t,void Qt(e.priority,function(){Pp(n)})}else if(31===t){if(null!==(t=ye(n)))return e.blockedOn=t,void Qt(e.priority,function(){Pp(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Qp(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Np(e.nativeEvent);if(null!==n)return null!==(t=on(n))&&Cp(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);Wn=r,n.target.dispatchEvent(r),Wn=null,t.shift()}return!0}function $p(e,t,n){Qp(e)&&n.delete(t)}function Kp(){Ap=!1,null!==Lp&&Qp(Lp)&&(Lp=null),null!==Up&&Qp(Up)&&(Up=null),null!==zp&&Qp(zp)&&(zp=null),Fp.forEach($p),Bp.forEach($p)}function Jp(e,t){e.blockedOn===t&&(e.blockedOn=null,Ap||(Ap=!0,de.unstable_scheduleCallback(de.unstable_NormalPriority,Kp)))}var Gp=null;function Xp(e){Gp!==e&&(Gp=e,de.unstable_scheduleCallback(de.unstable_NormalPriority,function(){Gp===e&&(Gp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],a=e[t+2];if("function"!=typeof r){if(null===Dp(r||n))continue;break}var o=on(n);null!==o&&(e.splice(t,3),t-=3,lu(o,{pending:!0,data:a,method:n.method,action:r},r,a))}}))}function Zp(e){function t(t){return Jp(t,e)}null!==Lp&&Jp(Lp,e),null!==Up&&Jp(Up,e),null!==zp&&Jp(zp,e),Fp.forEach(t),Bp.forEach(t);for(var n=0;n<Wp.length;n++){var r=Wp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Wp.length&&null===(n=Wp[0]).blockedOn;)Vp(n),null===n.blockedOn&&Wp.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(r=0;r<n.length;r+=3){var a=n[r],o=n[r+1],i=a[Jt]||null;if("function"==typeof o)i||Xp(n);else if(i){var s=null;if(o&&o.hasAttribute("formAction")){if(a=o,i=o[Jt]||null)s=i.formAction;else if(null!==Dp(a))continue}else s=i.action;"function"==typeof s?n[r+1]=s:(n.splice(r,3),r-=3),Xp(n)}}}function eh(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return a=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==a&&(a(),a=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&null!=e.url&&navigation.navigate(e.url,{state:e.getState(),info:"react-transition",history:"replace"})}}if("object"==typeof navigation){var r=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),null!==a&&(a(),a=null)}}}function th(e){this._internalRoot=e}function nh(e){this._internalRoot=e}nh.prototype.render=th.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(he(409));Sp(t.current,ed(),e,t,null,null)},nh.prototype.unmount=th.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Sp(e.current,2,null,e,null,null),sd(),t[Gt]=null}},nh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Wp.length&&0!==t&&t<Wp[n].priority;n++);Wp.splice(n,0,e),0===n&&Vp(e)}};var rh=fe.version;if("19.2.5"!==rh)throw Error(he(527,rh,"19.2.5"));He.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(he(188));throw e=Object.keys(e).join(","),Error(he(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=me(e)))throw Error(he(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return be(a),e;if(o===r)return be(a),t;o=o.sibling}throw Error(he(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,s=a.child;s;){if(s===n){i=!0,n=a,r=o;break}if(s===r){i=!0,r=a,n=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===n){i=!0,n=o,r=a;break}if(s===r){i=!0,r=o,n=a;break}s=s.sibling}if(!i)throw Error(he(189))}}if(n.alternate!==r)throw Error(he(190))}if(3!==n.tag)throw Error(he(188));return n.stateNode.current===n?e:t}(t),e=null===(e=null!==e?xe(e):null)?null:e.stateNode};var ah={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:We,reconcilerVersion:"19.2.5"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var oh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oh.isDisabled&&oh.supportsFiber)try{Ot=oh.inject(ah),Ct=oh}catch(Gh){}}h.createRoot=function(e,t){if(!ve(e))throw Error(he(299));var n=!1,r="",a=Nu,o=Iu,i=Du;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onUncaughtError&&(a=t.onUncaughtError),void 0!==t.onCaughtError&&(o=t.onCaughtError),void 0!==t.onRecoverableError&&(i=t.onRecoverableError)),t=wp(e,1,!1,null,0,n,r,null,a,o,i,eh),e[Gt]=t.current,uf(e),new th(t)},h.hydrateRoot=function(e,t,n){if(!ve(e))throw Error(he(299));var r=!1,a="",o=Nu,i=Iu,s=Du,u=null;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(a=n.identifierPrefix),void 0!==n.onUncaughtError&&(o=n.onUncaughtError),void 0!==n.onCaughtError&&(i=n.onCaughtError),void 0!==n.onRecoverableError&&(s=n.onRecoverableError),void 0!==n.formState&&(u=n.formState)),(t=wp(e,1,!0,t,0,r,a,u,o,i,s,eh)).context=kp(null),n=t.current,(a=Pi(r=qt(r=ed()))).callback=null,Ti(n,a,r),n=r,t.current.lanes=n,Ft(t,n),Hd(t),e[Gt]=t.current,uf(e),new nh(t)},h.version="19.2.5",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),p.exports=h;var ih=p.exports,sh={exports:{}},uh={},lh=Z;var ch="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},dh=lh.useSyncExternalStore,fh=lh.useRef,ph=lh.useEffect,hh=lh.useMemo,vh=lh.useDebugValue;uh.useSyncExternalStoreWithSelector=function(e,t,n,r,a){var o=fh(null);if(null===o.current){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=hh(function(){function e(e){if(!u){if(u=!0,o=e,e=r(e),void 0!==a&&i.hasValue){var t=i.value;if(a(t,e))return s=t}return s=e}if(t=s,ch(o,e))return t;var n=r(e);return void 0!==a&&a(t,n)?(o=e,t):(o=e,s=n)}var o,s,u=!1,l=void 0===n?null:n;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,n,r,a]);var s=dh(e,o[0],o[1]);return ph(function(){i.hasValue=!0,i.value=s},[s]),vh(s),s},sh.exports=uh;var mh=sh.exports;var gh={notify(){},get:()=>[]};var yh=(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),bh=(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),xh=(()=>yh||bh?Z.useLayoutEffect:Z.useEffect)(),wh=Symbol.for("react-redux-context"),kh="undefined"!=typeof globalThis?globalThis:{};function Sh(){if(!Z.createContext)return{};const e=kh[wh]??=new Map;let t=e.get(Z.createContext);return t||(t=Z.createContext(null),e.set(Z.createContext,t)),t}var _h=Sh();var Oh=function(e){const{children:t,context:n,serverState:r,store:a}=e,o=Z.useMemo(()=>{const e=function(e){let t,n=gh,r=0,a=!1;function o(){u.onStateChange&&u.onStateChange()}function i(){r++,t||(t=e.subscribe(o),n=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const a=t={callback:n,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){r&&null!==e&&(r=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}())}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=gh)}const u={addNestedSub:function(e){i();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:o,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,i())},tryUnsubscribe:function(){a&&(a=!1,s())},getListeners:()=>n};return u}(a);return{store:a,subscription:e,getServerState:r?()=>r:void 0}},[a,r]),i=Z.useMemo(()=>a.getState(),[a]);xh(()=>{const{subscription:e}=o;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),i!==a.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[o,i]);const s=n||_h;return Z.createElement(s.Provider,{value:o},t)};function Ch(e=_h){return function(){return Z.useContext(e)}}var Ph=Ch();function Th(e=_h){const t=e===_h?Ph:Ch(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var jh=Th();function Mh(e=_h){const t=e===_h?jh:Th(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Eh=Mh(),Nh=(e,t)=>e===t;function Ih(e=_h){const t=e===_h?Ph:Ch(e),n=(e,n={})=>{const{equalityFn:r=Nh}="function"==typeof n?{equalityFn:n}:n,a=t(),{store:o,subscription:i,getServerState:s}=a;Z.useRef(!0);const u=Z.useCallback({[e.name]:t=>e(t)}[e.name],[e]),l=mh.useSyncExternalStoreWithSelector(i.addNestedSub,o.getState,s||o.getState,u,r);return Z.useDebugValue(l),l};return Object.assign(n,{withTypes:()=>n}),n}var Dh=Ih();
|
|
2
|
-
/*! Copyright (c) 2021, XAPPmedia */function Rh(e){return!!e&&e.startsWith("agent:")}var Ah=function(){this.retries=5,this.timeout=1e3,this.log=!1},Lh=function(){function e(e){e&&(this.options=Object.assign(new Ah,e))}return e.prototype.fetch=function(e,t){return n(this,void 0,void 0,function(){var n,a,o,i;return r(this,function(r){switch(r.label){case 0:t||(t=this.options),r.label=1;case 1:return r.trys.push([1,3,,5]),n=new AbortController,a=setTimeout(function(){n.abort()},t.timeout),[4,e(n.signal)];case 2:return o=r.sent(),clearTimeout(a),[2,o];case 3:if(i=r.sent(),1===t.retries||t.retries<1)throw i;return[4,this.fetch(e,{timeout:t.timeout,retries:t.retries-1})];case 4:return[2,r.sent()];case 5:return[2]}})})},e}();var Uh="xapp-form-js",zh="https://form.xapp.ai/xapp-form-widget.js";function Fh(e){return"".concat(zh,"?key=").concat(encodeURIComponent(e))}function Bh(e){if(document.getElementById(Uh))return!0;if(e)for(var t=Fh(e),n=document.querySelectorAll("script[src]"),r=0;r<n.length;r++){var a=n[r].getAttribute("src");if(a&&(a===t||a.startsWith(zh)))return!0}return!1}function Wh(e){return new Promise(function(t,n){var r=document.createElement("script");r.id=Uh,r.src=Fh(e),r.async=!0,r.onload=function(){t()},r.onerror=function(){n(new Error("Failed to load form-widget script: ".concat(r.src)))},document.head.appendChild(r)})}function Hh(e){return n(this,arguments,void 0,function(e,t,n){var a,o,i;return void 0===t&&(t=3),void 0===n&&(n=1e3),r(this,function(r){switch(r.label){case 0:if(Bh(e))return[2];o=0,r.label=1;case 1:if(!(o<=t))return[3,8];r.label=2;case 2:return r.trys.push([2,6,,7]),o>0?((u=document.getElementById(Uh))&&u.remove(),console.log("[chat-widget] Retrying form-widget script load (attempt ".concat(o+1,"/").concat(t+1,")")),[4,(s=n,new Promise(function(e){return setTimeout(e,s)}))]):[3,4];case 3:r.sent(),r.label=4;case 4:return[4,Wh(e)];case 5:return r.sent(),[2];case 6:return i=r.sent(),a=i,o===t&&console.error("[chat-widget] Failed to load form-widget script after all retries:",i),[3,7];case 7:return o++,[3,1];case 8:throw a||new Error("Failed to load form-widget script")}var s,u})})}function qh(){var e;return"function"==typeof(null===(e=window.xafwControl)||void 0===e?void 0:e.openForm)}function Yh(e){return!!qh()&&(window.xafwControl.openForm(e),!0)}function Vh(e,t,n){return void 0===t&&(t=20),void 0===n&&(n=100),new Promise(function(r){if(Yh(e))r(!0);else var a=0,o=setInterval(function(){if(a++,Yh(e))return clearInterval(o),void r(!0);a>=t&&(clearInterval(o),console.warn("[chat-widget] Form widget not ready after waiting"),r(!1))},n)})}var Qh="xaLogLevel",$h=localStorage.getItem(Qh);function Kh(){return(new Date).toISOString()+" ::"}function Jh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"debug"===window.xaLogLevel&&console.log.apply(console,a([Kh()],e,!1))}function Gh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,a([Kh()],e,!1))}Object.getOwnPropertyDescriptor(window,"xaLogLevel")||Object.defineProperty(window,"xaLogLevel",{get:function(){return this._xaLogLevel},set:function(e){this._xaLogLevel=e,e?localStorage.setItem(Qh,e):localStorage.removeItem(Qh)},configurable:!0,enumerable:!0}),$h&&(window.xaLogLevel=$h),"undefined"!=typeof window&&(window.xapp=window.xapp||{},window.xapp.setLogLevel=function(e){"off"===e?(window.xaLogLevel=null,console.log("Log level set to: off (logs disabled)")):(window.xaLogLevel=e,console.log("Log level set to: ".concat(e)))},window.xapp.getLogLevel=function(){return window.xaLogLevel||"off"});function Xh(){var e=null===document||void 0===document?void 0:document.getElementById("xapp-js"),t=function(e){if(!e)return{path:e};var t=e.lastIndexOf("/"),n="";t>=0&&(n=e.substr(0,t));var r=new URL(e),a=r.hostname;a.endsWith("nitrocdn.com")&&(n="https://widget.xapp.ai");var o=new URLSearchParams(r.search),i=o.get("key");return{path:n,key:i}}(null==e?void 0:e.src);return t}var Zh=process.env.SERVER_URL;process.env.ACCOUNT_KEY;var ev="48",tv="ScheduleButton";var nv=Z.createContext(null);function rv(){var e=Z.useContext(nv);return null==e?void 0:e.env}function av(e){return(null==e?void 0:e.connection)?e.connection:{serverUrl:null==e?void 0:e.serverUrl,accountKey:null==e?void 0:e.accountKey,type:(null==e?void 0:e.direct)?"direct":"websocket"}}function ov(e,t){var n=av(e),r=n.accountKey,a=n.serverUrl,o=n.type,i=n.timeout,s=n.backgroundSleepDelay,u=n.mcp,l=null==e?void 0:e.channelId;return Z.useMemo(function(){return{accountKey:r,serverUrl:a,timeout:i,type:o,nonce:t,backgroundSleepDelay:s,mcp:iv(u,l)}},[r,a,i,o,t,s,u,l])}function iv(e,n){var r;return e?t(t({},e),{channelId:null!==(r=e.channelId)&&void 0!==r?r:n}):e}function sv(e){return e?av(e):{}}var uv=function(e){var t=e.label,n=e.disable,r=e.type,a=e.addClass,o=e.onClick;return f.jsx("button",{disabled:n,type:r,className:"action-button ".concat(a),onClick:function(e){e.stopPropagation(),o&&o(t)},children:t})},lv=Z.memo(function(e){var t=e.button,n=e.onClick,r=Z.useCallback(function(){n(t)},[t,n]);return f.jsx(uv,{onClick:r,addClass:"button-card",label:t.label})}),cv=Z.memo(function(e){return f.jsx("div",{className:"buttons-container "+(e.className||""),children:e.buttons.map(function(t,n){return f.jsx(lv,{button:t,onClick:e.onClick},n)})})}),dv=function(e){var t=e.imageUrl.replace(/'/g,"%27"),n=f.jsx("div",{className:"chat-card-img__content",style:{backgroundImage:"url(".concat(t,")")}});return e.imageActionUrl?f.jsx("a",{href:e.imageActionUrl,"aria-label":"read more",target:"_blank",rel:"noopener noreferrer",className:"chat-card-img",children:n}):f.jsx("div",{className:"chat-card-img",children:n})},fv=function(e){var t,n,r,a,o=e.card;return o.imageUrl&&(r=f.jsx("div",{className:"chat-card-container__img",children:f.jsx(dv,{imageUrl:o.imageUrl,imageActionUrl:o.imageActionUrl})})),o.title&&(n=f.jsx("div",{className:"chat-card-title",children:f.jsx("span",{children:o.title})})),o.content&&(a=f.jsx("div",{className:"chat-card-sub-title",children:f.jsx("span",{children:o.content})})),f.jsxs("div",{className:"chat-card-container",children:[r,n,a,!!(null===(t=o.buttons)||void 0===t?void 0:t.length)&&f.jsx(cv,{buttons:o.buttons,onClick:e.onButtonClick})]})},pv=function(e){var t,n,r,a,o,i,s={},u=e.entity,l=Z.useContext(nv),c=null==u?void 0:u.avatarPath;if(!c){var d=function(e){var t=(null==e?void 0:e.initials)||"?",n=(null==e?void 0:e.size)||40,r=(null==e?void 0:e.backgroundColor)||"#007bff",a=(null==e?void 0:e.textColor)||"#ffffff";return Z.useMemo(function(){return function(e,t,n,r){var a=document.createElement("canvas");a.width=t,a.height=t;var o=a.getContext("2d");o.fillStyle=n,o.fillRect(0,0,t,t),o.fillStyle=r,o.font="".concat(t/2,"px Arial"),o.textAlign="center",o.textBaseline="middle",o.fillText(e,t/2,t/2);var i=new Image;return i.src=a.toDataURL(),i}(t,n,r,a)},[t,n,r,a])}({initials:(null==u?void 0:u.displayName)?u.displayName.slice(0,2):"?",backgroundColor:null===(n=null===(t=null==l?void 0:l.env)||void 0===t?void 0:t.theme)||void 0===n?void 0:n.primaryColor,size:36});c=d.src}var p=u&&Rh(u.nick);p?(s.backgroundImage="url('".concat(c,"')"),s.backgroundColor="none"):i=f.jsx("svg",{width:"16",height:"19",viewBox:"0 0 16 19",style:{margin:"0 auto",display:"block"},children:f.jsx("path",{d:"M11.5 5c0-1.933-1.567-3.5-3.5-3.5S4.5 3.067 4.5 5 6.067 8.5 8 8.5s3.5-1.567 3.5-3.5zM3 5c0-2.76 2.24-5 5-5s5 2.24 5 5-2.24 5-5 5-5-2.24-5-5zM1.955 17.294c.21-.642.504-1.285.898-1.88C3.963 13.74 5.615 12.75 8 12.75c2.385 0 4.038.99 5.147 2.664.394.595.69 1.238.898 1.88.124.382.19.672.214.822.063.41.447.69.856.625.41-.063.69-.447.625-.856-.034-.225-.118-.59-.27-1.053-.247-.763-.598-1.527-1.073-2.244C13.024 12.51 10.917 11.25 8 11.25c-2.916 0-5.024 1.26-6.397 3.336-.475.717-.826 1.48-1.074 2.245-.152.463-.236.83-.27 1.054-.065.41.215.793.624.857.41.065.793-.215.857-.624.025-.15.09-.44.215-.822z",fill:"#FFF",fillRule:"evenodd"})});var h=!!s.backgroundImage||!!i,v=(null===(o=null===(a=null===(r=null==l?void 0:l.env)||void 0===r?void 0:r.connection)||void 0===a?void 0:a.mcp)||void 0===o?void 0:o.showAiBadge)&&(null==u?void 0:u.isAI);return f.jsxs("div",{className:"avatar ".concat(p?"avatar--agent":"avatar--visitor"," ").concat(h?"":"avatar--empty"),style:s,title:u?u.display_name:"Agent",children:[i,v&&f.jsx("span",{className:"avatar__ai-badge",children:"AI"})]})};function hv(e){return f.jsx("div",{className:"xappw-chat-msg-part__avatar",children:f.jsx(pv,{entity:e})})}var vv=function(e){var t,n=null!==(t=e.avatarPosition)&&void 0!==t?t:"left",r="xappw-chat-msg-part"+("below"===n?" xappw-chat-msg-part--avatar-below":"")+("bottom"===n?" xappw-chat-msg-part--avatar-bottom":"")+(e.fullWidth?" xappw-chat-msg-part--full-width":"")+(e.isStreaming?" xappw-chat-msg-part--streaming":""),a=e.user,o=e.hideUserInfo&&"bottom"===n;return f.jsx("div",{className:r,children:"left"===n?f.jsxs(f.Fragment,{children:[e.showAvatar&&hv(a),e.children]}):f.jsxs(f.Fragment,{children:[e.children,e.showAvatar&&!o&&f.jsxs("div",{className:"xappw-chat-msg-part__avatar-wrapper",children:[hv(a),(null==a?void 0:a.displayName)&&f.jsx("div",{className:"xappw-chat-msg-part__avatar-name",children:a.displayName})]})]})})};function mv(e,t,n){return{type:"synthetic",detail:{type:"write_msg",user:t,msg:e,timestamp:void 0!==n?n:+new Date}}}function gv(e,n){return function(r){return function(a,o){var i=o().attributes;i=t(t({},i),{currentUrl:window.location.href});var s=n||{},u=s.token,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(s,["token"]);i=t(t({},i),l);var c=o().visitor,d=+new Date;a(mv({text:u?"".concat(e," (from the list)"):e},c,d)),r.sendChatMsg({text:e,token:u,attributes:i},function(e){e&&Jh("Error sending message",e)})}}}function yv(e){return function(t){return function(){t.sendTyping(e)}}}function bv(e,t){return function(n){return function(){n.setVisitorInfo(e,t,function(e){e&&Jh(e)})}}}function xv(e){return{type:"account_status",detail:{status:e,timestamp:+new Date}}}function wv(e){return{type:"connection_update",detail:{status:e,timestamp:+new Date}}}function kv(e){return{type:"ws_button_display",detail:{id:e.id,text:e.text,pressBehavior:e.pressBehavior,isPressed:e.isPressed,isDismissing:e.isDismissing,timestamp:+new Date}}}function Sv(e){throw new Error("Unknown kind "+e)}var _v=function(){return Eh()},Ov=function(){function e(e){this.inner=e}return e.prototype.bargeOut=function(e){Jh("CLIENT: bargeOut"),this.inner.bargeOut(e)},e.prototype.bargeIn=function(e,t){Jh("CLIENT: bargeIn: ".concat(e)),this.inner.bargeIn(e,t)},e.prototype.init=function(e){this.inner.init(e)},e.prototype.sendOfflineMsg=function(e,t){Jh("CLIENT: sendOfflineMsg: ".concat(JSON.stringify(e))),this.inner.sendOfflineMsg(e,t)},e.prototype.sendChatMsg=function(e,t){Jh("CLIENT: sendChatMsg: ".concat(JSON.stringify(e))),this.inner.sendChatMsg(e,t)},e.prototype.sendChatMsgRequest=function(e,t){Jh("CLIENT: sendChatMsgRequest: ".concat(JSON.stringify(e))),this.inner.sendChatMsgRequest(e,t)},e.prototype.sendTyping=function(e){Jh("CLIENT: sendTyping: ".concat(JSON.stringify(e))),this.inner.sendTyping(e)},e.prototype.setVisitorInfo=function(e,t,n){Jh("CLIENT: setVisitorInfo: ".concat(JSON.stringify(e)," session id: ").concat(t)),this.inner.setVisitorInfo(e,t,n)},e.prototype.sendChatRating=function(e){Jh("CLIENT: sendChatRating: ".concat(JSON.stringify(e))),this.inner.sendChatRating(e)},e.prototype.sendFile=function(e,t){Jh("CLIENT: sendFile: ".concat(JSON.stringify(e))),this.inner.sendFile(e,t)},e.prototype.markAsRead=function(){Jh("CLIENT: markAsRead:"),this.inner.markAsRead()},e.prototype.flush=function(){Jh("CLIENT: flush:"),this.inner.flush()},e.prototype.dispose=function(){Jh("CLIENT: dispose:"),this.inner.dispose()},e.prototype.sleep=function(){Jh("CLIENT: sleep:"),this.inner.sleep()},e.prototype.wakeup=function(){Jh("CLIENT: wakeup:"),this.inner.wakeup()},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return Jh("CLIENT: sendButtonPressed: ".concat(e)),this.inner.sendButtonPressed?[2,this.inner.sendButtonPressed(e)]:[2]})})},e.prototype.notifyDisconnecting=function(){Jh("CLIENT: notifyDisconnecting:"),this.inner.notifyDisconnecting&&this.inner.notifyDisconnecting()},e}(),Cv=f,Pv=Z;var Tv=function(e){var t=e.format,n=e.text;return Cv.jsx("span",{"data-rich-text-type":"bold",className:"xapp-search-rich-text-bold-span",children:n.substring(t.start,t.end)})},jv=function(e){var t=e.format,n=e.text,r=e.readOnly,a=e.onClick,o=t.text||n.substring(t.start,t.end),i=Pv.useState(o),s=i[0],u=i[1],l=Pv.useCallback(function(e){u(e.target.value)},[]),c=Pv.useCallback(function(e){a&&(!1===a(t)&&(e.preventDefault(),e.stopPropagation()))},[a,t]);return r?Cv.jsx("span",{className:"xapp-search-rich-text-input-span xapp-search-rich-text-input-span--readonly",onClick:c,children:o}):Cv.jsx("input",{type:"text",value:s,className:"xapp-search-rich-text-input-span","data-rich-text-type":"inputText",onChange:l,onClick:c,readOnly:r})},Mv=function(e){var t=e.format,n=e.text;return Cv.jsx("span",{"data-rich-text-type":"normal",className:"xapp-search-rich-text-normal-span",children:n.substring(t.start,t.end)})},Ev=function(e){var t=e.format,n=e.text,r=e.readOnly,a=e.onClick,o=t.type;switch(o){case"normal":return Cv.jsx(Mv,{text:n,format:t,readOnly:r});case"bold":return Cv.jsx(Tv,{text:n,format:t,readOnly:r});case"inputText":return Cv.jsx(jv,{text:n,format:t,readOnly:r,onClick:a});default:!function(e){throw new Error("Unknown kind "+e)}(o)}};function Nv(e){var t=e.childNodes,n=[],r="";return t.forEach(function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e,a="INPUT"===t.tagName?t.value:t.innerText,o=t.dataset.richTextType;n.push({type:o,start:r.length,end:r.length+a.length}),r+=a}e.nodeType===Node.TEXT_NODE&&((a=e.nodeValue)&&(n.push({type:"normal",start:r.length,end:r.length+a.length}),r+=a))}),function(e){for(var t=e.text,n=[],r=0,a=e.formats;r<a.length;r++){var o=a[r],i=o.type;switch(i){case"normal":continue;case"inputText":n.push(o);break;case"bold":if(n.length>0){var s=n[n.length-1];s.type===i&&s.end===o.start&&(n.pop(),n.push({type:i,start:s.start,end:o.end}))}else n.push(o)}}return{text:t,formats:n}}({text:r,formats:n})}var Iv=function(e){var t=e.value,n=e.className,r=e.readOnly,a=e.onInput,o=e.onChange,i=e.onSpanClick,s=t.formats,u=t.text,l=Pv.useMemo(function(){return function(e,t){for(var n=[],r=0,a=0,o=e;a<o.length;a++){var i=o[a],s=i.start,u=i.end,l=i.type,c=i.text;r<s&&n.push({type:"normal",start:r,end:s}),n.push({type:l,start:s,end:u,text:c}),r=u}return r<t&&n.push({type:"normal",start:r,end:t}),n}(s,u.length)},[s,u.length]),c=Pv.useCallback(function(e){var t=Nv(e.currentTarget);a&&a(t)},[a]),d=Pv.useCallback(function(e){var t=e.currentTarget,n=Nv(t);!function(e){for(var t,n=[],r=e.childNodes,a=0;a<r.length;a++)(null==(s=r.item(a))?void 0:s.nodeType)===Node.TEXT_NODE&&n.push(s);for(var o=0,i=n;o<i.length;o++){var s=i[o];try{null===(t=s.parentElement)||void 0===t||t.removeChild(s)}catch(e){}}}(t),o&&o(n)},[o]);return Cv.jsx("div",{id:e.id,className:"xapp-search-rich-text ".concat(n||""),contentEditable:!r,suppressContentEditableWarning:!0,onInput:c,onBlur:d,onKeyDown:e.onKeyDown,children:l.map(function(e,t){return Cv.jsx(Ev,{format:e,text:u,readOnly:r,onClick:i},t)})})},Dv=function(e){return Cv.jsx("div",{className:"xappw-suggestions-group-heading",children:e.label})};var Rv=function(e){var t=e.data,n=e.current,r=e.actions,a=e.onClick,o=e.onHover,i=e.onSpanClick,s=Pv.useCallback(function(){a(t)},[t,a]),u=Pv.useCallback(function(){o&&o(t)},[t,o]),l=Pv.useCallback(function(e){if(i)return i(t,e)},[i,t]),c=Pv.useRef(null);return Pv.useEffect(function(){var e=c.current;if(n&&e){var t=function(e){for(var t=e;t&&!t.classList.contains("xapp-search-result__suggestions");)t=t.parentElement;return t||void 0}(e);if(t){var r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(r.top,a.top);Math.min(r.bottom,a.bottom)-o<.99*a.height&&e.scrollIntoView({behavior:"smooth"})}}},[n]),Cv.jsxs("div",{ref:c,className:"xappw-suggestions-item ".concat(n?"xappw-suggestions-item--current":""),onClick:s,onMouseEnter:u,children:[Cv.jsx(Iv,{value:t,className:"xappw-suggestions-item__texts",readOnly:!0,onSpanClick:l}),r&&Cv.jsx("div",{className:"xappw-suggestions-item__actions",children:Cv.jsx(r,{data:t,current:n})})]})},Av=function(e){var t=e.group,n=e.currentIndex,r=e.itemActions,a=t.heading,o=t.items;return Cv.jsxs("div",{className:"xappw-suggestions-group",children:[Cv.jsx("div",{className:"xappw-suggestions-group__heading",children:Cv.jsx(Dv,{label:a})}),Cv.jsx("div",{className:"xappw-suggestions-group__items",children:o.map(function(t,a){return Cv.jsx(Rv,{data:t,current:n===a,actions:r,onClick:e.onItemClick,onHover:e.onItemHover,onSpanClick:e.onSpanClick},a)})})]})};function Lv(e){return e.reduce(function(e,t){return e+t.items.length},0)}var Uv=function(){return Uv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Uv.apply(this,arguments)};function zv(e,t,n,r){return new(n||(n=Promise))(function(t,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function i(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){e.done?t(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(o,i)}s((r=r.apply(e,[])).next())})}function Fv(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(6===s[0]&&o.label<a[1]){o.label=a[1],a=s;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function Bv(e,t,n){for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Wv=["FAQ","INTENT","HISTORICAL"].reduce(function(e,t,n){return e[t]=n,e},{});function Hv(e,t){return Bv([],e).sort(function(e,n){return function(e,t,n){return n*(Wv[t.type]-Wv[e.type])}(e,n,t)})}function qv(e){var t=Object.keys(e)[0],n=e[t];if(!n)throw new Error;return{type:t,start:n.start,end:n.end}}function Yv(e){switch(e){case"FAQ":return"FAQs";case"INTENT":case"HISTORICAL":return"Suggestions";default:return e}}var Vv={};function Qv(){}var $v=Bv(Bv([],["utm_source","utm_medium","utm_campaign","utm_term","utm_content"]),["gclid","gbraid","wbraid","msclkid","fbclid"]),Kv="xa_tracking_";var Jv="data-xapp-scroll-lock",Gv="data-xapp-scroll-lock-restore",Xv=["position","top","left","right","width","overflow"];function Zv(e){var t=Number(e.getAttribute(Jv));return Number.isFinite(t)&&t>0?t:0}function em(){if("undefined"==typeof document||"undefined"==typeof window)return function(){};var e=document.body;if(0===Zv(e)){var t=function(e){var t=Xv.reduce(function(t,n){return t[n]=e.style.getPropertyValue(n),t},{});return{scrollY:window.scrollY||window.pageYOffset||0,inlineStyles:t}}(e);e.setAttribute(Gv,JSON.stringify(t)),e.style.position="fixed",e.style.top="-".concat(t.scrollY,"px"),e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden"}e.setAttribute(Jv,String(Zv(e)+1));var n=!1;return function(){if(!n){n=!0;var t=Zv(e)-1;if(t>0)e.setAttribute(Jv,String(t));else if(!(t<0)){e.removeAttribute(Jv);var r=function(e){var t=e.getAttribute(Gv);e.removeAttribute(Gv);try{var n=JSON.parse(t||"");if(n&&"number"==typeof n.scrollY&&n.inlineStyles)return n}catch(e){}return{scrollY:0,inlineStyles:{}}}(e),a=r.scrollY,o=r.inlineStyles;Xv.forEach(function(t){o[t]?e.style.setProperty(t,o[t]):e.style.removeProperty(t)}),e.style.length||e.removeAttribute("style"),window.scrollTo(0,a)}}}}var tm="--xapp-viewport-height",nm="--xapp-viewport-offset-top",rm="--xapp-keyboard-inset",am="data-xapp-viewport-subscribers";function om(e){var t=Number(e.getAttribute(am));return Number.isFinite(t)&&t>0?t:0}function im(e){var t="undefined"==typeof window?void 0:window.visualViewport;if(t){var n=t.height,r=t.offsetTop;if(n>0){var a=window.innerHeight||n,o=Math.max(0,a-n),i=o>=120?o:0;e.style.setProperty(tm,"".concat(Math.round(n),"px")),e.style.setProperty(nm,"".concat(Math.round(r),"px")),e.style.setProperty(rm,"".concat(Math.round(i),"px"))}}}function sm(){if("undefined"==typeof document)return function(){};var e=document.documentElement;e.setAttribute(am,String(om(e)+1)),im(e);var t,n="undefined"==typeof window?void 0:window.visualViewport,r=function(){void 0===t&&(t=window.requestAnimationFrame(function(){t=void 0,im(e)}))};null==n||n.addEventListener("resize",r),null==n||n.addEventListener("scroll",r);var a=!1;return function(){if(!a){a=!0,null==n||n.removeEventListener("resize",r),null==n||n.removeEventListener("scroll",r),void 0!==t&&(window.cancelAnimationFrame(t),t=void 0);var o=om(e)-1;o>0?e.setAttribute(am,String(o)):(e.removeAttribute(am),function(e){e.style.removeProperty(tm),e.style.removeProperty(nm),e.style.removeProperty(rm)}(e))}}}var um=function(e){var t=e.icon;return Cv.jsx("div",{tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"xapp-search-icon-button ".concat(e.className||""),onClick:e.onClick,children:Cv.jsx("div",{className:"xapp-search-icon-button__content",children:Cv.jsx(t,{})})})},lm=function(e){var t=e.id,n=e.value,r=e.type,a=e.autoFocus,o=e.spellCheck,i=e.tabIndex,s=e.maxLength,u=e.enterKeyHint,l=e.onChange,c=e.onInput,d=e.onKeyDown,f=e.onSearch,p=n.formats.some(function(e){return"inputText"===e.type}),h=u||("search"===r?"search":"send"),v=Pv.useCallback(function(e){l&&l({text:e.target.value,formats:[]})},[l]),m=Pv.useCallback(function(e){l&&l(e)},[l]),g=Pv.useCallback(function(e){c&&c({text:e.target.value,formats:[]})},[c]),y=Pv.useCallback(function(e){c&&c(e)},[c]),b=Pv.useCallback(function(e){d&&d(e)},[d]),x=Pv.useRef(null),w=x.current;return Pv.useEffect(function(){if(w&&f){var e=function(e){var t=e.target;t&&f({text:t.value,formats:[]})};return w.addEventListener("search",e),function(){w.removeEventListener("search",e)}}},[w,f]),Cv.jsx("div",{className:"xappw-rich-input ".concat(e.className),children:p?Cv.jsx(Iv,{id:t,value:n,onChange:m,onInput:y,onKeyDown:b,className:"xappw-rich-input__input ".concat(e.className,"__input")}):Cv.jsx("input",{id:t,ref:x,type:r,value:n.text,autoComplete:"off",enterKeyHint:h,autoFocus:a,placeholder:e.placeholder,spellCheck:o,tabIndex:i?Number(i):0,maxLength:s,className:"xappw-rich-input__input ".concat(e.className,"__input"),onFocus:e.onFocus,onChange:v,onInput:g,onKeyDown:b})})},cm=function(e){var t=e.suggestions,n=e.itemActions,r=e.className,a=Pv.useMemo(function(){return t?Lv(t):0},[t])>=0?e.index:NaN,o=0;return Cv.jsx("div",{className:"xappw-suggestions-list ".concat(r||""),children:null==t?void 0:t.map(function(t,r){var i=Cv.jsx(Av,{group:t,currentIndex:a-o,itemActions:n,onItemClick:e.onItemClick,onItemHover:e.onItemHover,onSpanClick:e.onSpanClick},r);return o+=t.items.length,i})})},dm=function(e){return function(){try{return"1"===sessionStorage.getItem("xa_test")}catch(e){return!1}}()&&(e.xaTest=!0,delete e.rwg_token),e},fm=function(e,t){if(t>=0)for(var n=0,r=e;n<r.length;n++)for(var a=0,o=r[n].items;a<o.length;a++){var i=o[a];if(t<=0)return i;t--}},pm=function(e){void 0===e&&(e=window.location.href);var t,n=function(e){var t;try{t=new URL(e)}catch(e){return{}}var n={};return $v.forEach(function(e){var r=t.searchParams.get(e);r&&function(e){return e.length<=255&&!/[<>"'\x00-\x1f]/.test(e)}(r)&&(n[e]=r)}),n}(e);return Object.keys(n).length>0&&function(e,t){void 0===t&&(t=30);var n=Date.now()+24*t*60*60*1e3;Object.entries(e).forEach(function(e){var t=e[0],r=e[1];if(r)try{localStorage.setItem("".concat(Kv).concat(t),JSON.stringify({value:r,expires:n}))}catch(e){}})}(n),Uv(Uv({},(t={},$v.forEach(function(e){var n,r="".concat(Kv).concat(e);try{n=localStorage.getItem(r)}catch(e){return}if(n)try{var a=JSON.parse(n);a&&a.expires>Date.now()&&"string"==typeof a.value?t[e]=a.value:localStorage.removeItem(r)}catch(e){localStorage.removeItem(r)}}),t)),n)},hm=Lv,vm=function(e,t){if(void 0===t&&(t=1),e)return Hv(e.suggestions,t).reduce(function(e,t){var n,r,a={text:(n=t).suggestion,content:n.answer,formats:(r=n.format,r.map(qv)),type:n.type};if(e.length){var o=e[e.length-1];if(o.heading===Yv(t.type))return o.items.push(a),e}return e.push({heading:Yv(t.type),items:[a]}),e},[])},mm=function(e){if(e)try{var t=new URL(e);return t.origin+t.pathname}catch(e){return}},gm=function(e){void 0===e&&(e=!0),Pv.useEffect(function(){if(e)return em()},[e])},ym=function(e){var t=e.url,n=e.context,r=e.query,a=Pv.useMemo(function(){if(t){var e=new URLSearchParams;return e.append("size","5"),e.append("queryText",r),(null==n?void 0:n.length)&&e.append("activeContexts",n.join(",")),function(e,t){var n=new URL(e).searchParams;t.forEach(function(e,t){n.append(t,e)});var r=new URL(e);return r.search=n.toString(),r}(t,e)}},[r,n,t]),o=function(e,t){void 0===t&&(t=Vv);var n=Pv.useState({state:"paused"}),r=n[0],a=n[1],o=t.pause;return Pv.useEffect(function(){if(o)return a({state:"paused"}),Qv;var t=new AbortController,n=t.signal,r=!0;return function(){zv(this,0,void 0,function(){var t,o,i;return Fv(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,5]),a({state:"fetching"}),[4,fetch(e,{signal:n})];case 1:return t=s.sent(),r?[4,t.json()]:[3,3];case 2:o=s.sent(),t.ok?a({state:"success",data:o}):a({state:"error",error:o}),s.label=3;case 3:return[3,5];case 4:if("AbortError"===(i=s.sent()).name)return a({state:"paused"}),[2];throw i;case 5:return[2]}})})}(),function(){r=!1,t.abort()}},[e,o]),r}(a?"".concat(a.toString()):"",{pause:!r||!t});return o},bm=function(e){void 0===e&&(e=!0),Pv.useEffect(function(){if(e)return sm()},[e])},xm=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-65xx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})},wm={},km={},Sm={};function _m(){return{data:"",event:"",id:"",retry:void 0}}function Om(e){var t=Number(null==e?void 0:e.statusCode);return!(Number.isFinite(t)&&t>=100&&t<=599)}function Cm(e){var t=e.items,n=[{retry:0,delay:10,text:""}];if(Array.isArray(t)&&t.length>0)for(var r=0;r<t.length;r++)n.push({retry:r+1,delay:t[r].delay,text:t[r].text});return n}function Pm(e){return{type:"session_id",detail:{sessionId:e,timestamp:(new Date).getTime()}}}Object.defineProperty(Sm,"__esModule",{value:!0}),Sm.getMessages=Sm.getLines=Sm.getBytes=void 0,Sm.getBytes=async function(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)},Sm.getLines=function(e){let t,n,r,a=!1;return function(o){void 0===t?(t=o,n=0,r=-1):t=function(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(t,o);const i=t.length;let s=0;for(;n<i;){a&&(10===t[n]&&(s=++n),a=!1);let o=-1;for(;n<i&&-1===o;++n)switch(t[n]){case 58:-1===r&&(r=n-s);break;case 13:a=!0;case 10:o=n}if(-1===o)break;e(t.subarray(s,o),r),s=n,r=-1}s===i?t=void 0:0!==s&&(t=t.subarray(s),n-=s)}},Sm.getMessages=function(e,t,n){let r=_m();const a=new TextDecoder;return function(o,i){if(0===o.length)null==n||n(r),r=_m();else if(i>0){const n=a.decode(o.subarray(0,i)),s=i+(32===o[i+1]?2:1),u=a.decode(o.subarray(s));switch(n){case"data":r.data=r.data?r.data+"\n"+u:u;break;case"event":r.event=u;break;case"id":e(r.id=u);break;case"retry":const n=parseInt(u,10);isNaN(n)||t(r.retry=n)}}}},function(e){var t=o&&o.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.fetchEventSource=e.EventStreamContentType=void 0;const n=Sm;e.EventStreamContentType="text/event-stream";const r="last-event-id";function a(t){const n=t.headers.get("content-type");if(!(null==n?void 0:n.startsWith(e.EventStreamContentType)))throw new Error(`Expected content-type to be ${e.EventStreamContentType}, Actual: ${n}`)}e.fetchEventSource=function(o,i){var{signal:s,headers:u,onopen:l,onmessage:c,onclose:d,onerror:f,openWhenHidden:p,fetch:h}=i,v=t(i,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((t,i)=>{const m=Object.assign({},u);let g;function y(){g.abort(),document.hidden||_()}m.accept||(m.accept=e.EventStreamContentType),p||document.addEventListener("visibilitychange",y);let b=1e3,x=0;function w(){document.removeEventListener("visibilitychange",y),window.clearTimeout(x),g.abort()}null==s||s.addEventListener("abort",()=>{w(),t()});const k=null!=h?h:window.fetch,S=null!=l?l:a;async function _(){var e;g=new AbortController;try{const e=await k(o,Object.assign(Object.assign({},v),{headers:m,signal:g.signal}));await S(e),await n.getBytes(e.body,n.getLines(n.getMessages(e=>{e?m[r]=e:delete m[r]},e=>{b=e},c))),null==d||d(),w(),t()}catch(t){if(!g.signal.aborted)try{const n=null!==(e=null==f?void 0:f(t))&&void 0!==e?e:b;window.clearTimeout(x),x=window.setTimeout(_,n)}catch(e){w(),i(e)}}}_()})}}(km),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EventStreamContentType=e.fetchEventSource=void 0;var t=km;Object.defineProperty(e,"fetchEventSource",{enumerable:!0,get:function(){return t.fetchEventSource}}),Object.defineProperty(e,"EventStreamContentType",{enumerable:!0,get:function(){return t.EventStreamContentType}})}(wm);var Tm=[{retry:0,delay:0,text:""},{retry:1,delay:3,text:"Having trouble connecting. Retrying in ${sec} seconds..."},{retry:2,delay:5,text:"Still having trouble. Retrying in ${sec} seconds..."},{retry:0,delay:0,text:"Unable to connect to the assistant. Please try again later."}],jm="xapp_mcp_userId",Mm="xapp_mcp_sessionId";function Em(e,t){if("undefined"!=typeof window&&window.localStorage)try{e&&localStorage.setItem(jm,e),t&&localStorage.setItem(Mm,t)}catch(e){}}function Nm(e){if("undefined"!=typeof window&&window.localStorage)try{localStorage.removeItem(Mm),e&&function(e){if("undefined"==typeof window||!window.sessionStorage)return;try{sessionStorage.removeItem("xapp_mcp_lastSeq_".concat(e))}catch(e){}}(e)}catch(e){}}function Im(){if("undefined"!=typeof window){var e=pm(window.location.href);return Object.keys(e).length>0?e:void 0}}function Dm(e){var t,n=function(e){void 0===e&&(e=new Date);var t=-e.getTimezoneOffset(),n=t>=0?"+":"-",r=function(e){return String(Math.abs(e)).padStart(2,"0")},a=Math.floor(Math.abs(t)/60),o=Math.abs(t)%60;return"".concat(e.getFullYear(),"-").concat(r(e.getMonth()+1),"-").concat(r(e.getDate()))+"T".concat(r(e.getHours()),":").concat(r(e.getMinutes()),":").concat(r(e.getSeconds()))+"".concat(n).concat(r(a),":").concat(r(o))}();if(e&&Object.keys(e).length>0)return Jh("[getPageContext] Using override: ".concat(JSON.stringify(e))),{url:e.url,path:e.path,title:e.title,referrer:e.referrer,attribution:null!==(t=e.attribution)&&void 0!==t?t:Im(),localTime:n};if("undefined"==typeof window)return{localTime:n};var r=window.location.origin+window.location.pathname,a=mm(document.referrer);return{url:r,path:window.location.pathname,title:document.title||void 0,referrer:a,attribution:Im(),localTime:n}}var Rm=function(){function e(e,t){var n;if(this._userId="",this._sessionId="",this._accessToken="",this._debugMode=!1,this._attributes={},this.streamBuffer="",this.isInitializingSession=!1,this.isValidatingSession=!1,this.conversationOnScreen=!1,this.currentToolCalls=[],this.isReplaying=!1,this.isSleeping=!1,this.isRequestingReplay=!1,this.needsReplayOnWakeup=!1,this.userIdIsServerAssigned=!1,this.sentMessageCount=0,this.config=e,this.options=t,this.configurableMessages=null==t?void 0:t.configurableMessages,this.isNewSession=!1,this._debugMode=null!==(n=e.debugMode)&&void 0!==n&&n,this.hooks=null==t?void 0:t.hooks,"business_owner"===(e.mode||"homeowner")&&!e.authToken)throw new Error("authToken is required for business_owner mode");var r=function(){if("undefined"==typeof window||!window.localStorage)return{};try{return{userId:localStorage.getItem(jm)||void 0,sessionId:localStorage.getItem(Mm)||void 0}}catch(e){return{}}}();r.userId&&(this._userId=r.userId,this.userIdIsServerAssigned=!0,Jh("[MCPChat] Loaded stored userId: ".concat(this._userId))),r.sessionId&&(this._sessionId=r.sessionId,Jh("[MCPChat] Loaded stored sessionId: ".concat(this._sessionId))),e.sessionId&&(this._sessionId=e.sessionId),this._sessionId&&(this.lastSeq=function(e){if("undefined"!=typeof window&&window.sessionStorage)try{var t=sessionStorage.getItem("xapp_mcp_lastSeq_".concat(e));return t?parseInt(t,10):void 0}catch(e){return}}(this._sessionId),void 0!==this.lastSeq&&Jh("[MCPChat] Loaded stored lastSeq: ".concat(this.lastSeq)))}return e.prototype.init=function(e){this.dispatch=e,this.sessionStartTime=Date.now();var t=this.config.mode||"homeowner";Jh("MCPChat initialized with mode: ".concat(t)),"business_owner"!==t||this.config.serverUrl.startsWith("https://")||Gh("WARNING: Using non-HTTPS URL with authentication tokens. This is insecure in production."),this.setConnectionStatus("online"),this.setAccountStatus("online"),this.userJoined(this.getBot(void 0))},e.prototype.validateSession=function(){return n(this,void 0,void 0,function(){var e,n;return r(this,function(r){switch(r.label){case 0:e=this.getEndpoint(),Jh("Validating existing session at ".concat(e,", sessionId: ").concat(this._sessionId)),this.isValidatingSession=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload(t({resumeSession:!0},this.conversationOnScreen&&{continueConversation:!0})))];case 2:return r.sent(),Jh("Session validation complete"),[3,5];case 3:return n=r.sent(),Gh("Failed to validate session: ".concat(n)),Nm(this._sessionId),this._sessionId="",this.lastSeq=void 0,this.initializeNewSession(),[3,5];case 4:return this.isValidatingSession=!1,[7];case 5:return[2]}})})},e.prototype.buildRequestPayload=function(e){return void 0===e&&(e={}),t(t({userId:this._userId||void 0,sessionId:this._sessionId||void 0,fingerprint:this.config.disableFingerprinting?void 0:"undefined"==typeof window?{}:{userAgent:navigator.userAgent,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenResolution:"".concat(window.screen.width,"x").concat(window.screen.height),platform:(n=navigator.userAgentData,(null==n?void 0:n.platform)?n.platform:navigator.platform||void 0),colorDepth:window.screen.colorDepth,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0},pageContext:Dm(this.config.pageContextOverride),channelId:this.config.channelId||void 0,clientTime:(new Date).toISOString(),lastSeq:this.lastSeq},this._debugMode&&{debug:!0}),e);var n},e.prototype.initializeNewSession=function(){return n(this,void 0,void 0,function(){var e,t,n,a,o=this;return r(this,function(r){switch(r.label){case 0:if(this._debugMode=null!==(a=this.config.debugMode)&&void 0!==a&&a,this.isInitializingSession)return Jh("New session initialization already in progress, skipping"),[2];e=this.getEndpoint(),Jh("Initializing new session at ".concat(e)),this.isInitializingSession=!0,this.sessionInitPromise=new Promise(function(e){o.resolveSessionInit=e}),this.typing(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload({newSession:!0,generateGreeting:!0}))];case 2:return r.sent(),[3,5];case 3:return t=r.sent(),n=null==t?void 0:t.statusCode,Gh("Failed to initialize new session: ".concat(t,", statusCode: ").concat(n)),this.stopTyping(),Om(t)&&this.setConnectionStatus("offline"),this.sendFailureMessage(0,0,this.getErrorMessage(t,n)),[3,5];case 4:return this.isInitializingSession=!1,this.resolveSessionInit&&(this.resolveSessionInit(),this.resolveSessionInit=void 0),this.sessionInitPromise=void 0,[7];case 5:return[2]}})})},e.prototype.setConnectionStatus=function(e){Jh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(wv(e))},e.prototype.setAccountStatus=function(e){Jh("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(xv(e))},e.prototype.getEndpointPaths=function(){return"business_owner"===(this.config.mode||"homeowner")?["/api/chat/stream","/api/chat/close"]:["/chat/stream","/chat/close"]},e.prototype.getBaseUrl=function(){for(var e=this.config.serverUrl.replace(/\/+$/,""),t=0,n=this.getEndpointPaths();t<n.length;t++){var r=n[t];if(e.endsWith(r))return e.slice(0,-r.length)}return e},e.prototype.getEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[0])},e.prototype.getCloseEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[1])},e.prototype.sendNewMessage=function(e,t){Jh("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t||this.getBot(void 0),msg:e,timestamp:+new Date}})},e.prototype.userJoined=function(e){Jh("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:e,timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:this.getBot(void 0),failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.getRetryConfig=function(){var e,t;return(null===(t=null===(e=this.configurableMessages)||void 0===e?void 0:e.items)||void 0===t?void 0:t.length)>0?Cm(this.configurableMessages):Tm},e.prototype.delay=function(e){return new Promise(function(t){return setTimeout(t,1e3*e)})},e.prototype.getErrorMessage=function(e,t){if(401===t)return"Authentication failed. Please check your credentials.";if(403===t)return"Access denied. You don't have permission to access this resource.";if(t&&t>=500)return"The server is experiencing issues. Please try again later.";if(404===t)return"Service not found. Please check your configuration.";if(e instanceof TypeError&&(e.message.includes("fetch")||e.message.includes("network")))return"Unable to connect to the server. Please check your internet connection.";if(e instanceof Error){var n=e.message.toLowerCase();if(n.includes("failed to fetch")||n.includes("network")||n.includes("econnrefused"))return"Unable to reach the server. Please try again later."}return"Something went wrong. Please try again."},e.prototype.dispatchStreamStart=function(e,t){var n=this.getBot(t),r=+new Date;Jh("[dispatchStreamStart] Stream started: ".concat(e,", timestamp: ").concat(r)),this.dispatch({type:"chat",detail:{type:"chat.stream.start",user:n,messageId:e,timestamp:r}})},e.prototype.dispatchStreamChunk=function(e,t,n){this.dispatch({type:"chat",detail:{type:"chat.stream.chunk",user:this.getBot(n),messageId:e,text:t,timestamp:+new Date}})},e.prototype.dispatchStreamEnd=function(e,n,r){void 0===r&&(r={});var a=r.toolCalls,o=r.user,i=r.preserveChips;Jh("Stream ended: ".concat(e)),this.dispatch({type:"chat",detail:t(t({type:"chat.stream.end",user:this.getBot(o),messageId:e,msg:n,toolCalls:a},i&&{preserveChips:i}),{timestamp:+new Date})})},e.prototype.dispatchStreamAbort=function(e){Jh("[dispatchStreamAbort] Stream aborted: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.abort",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchStreamResume=function(e){Jh("[dispatchStreamResume] Stream resumed: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.resume",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchToolStart=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_start",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,hidden:e.hidden,toolInput:e.toolInput,timestamp:+new Date}})},e.prototype.dispatchToolEnd=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_end",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,toolInput:e.toolInput,hidden:e.hidden,toolResult:e.toolResult,toolError:e.toolError,timestamp:+new Date}})},e.prototype.startStreamThrottle=function(e){var t=this;this.streamBuffer="",this.streamingMessageIdForThrottle=e,this.streamThrottleTimer&&clearInterval(this.streamThrottleTimer),this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.streamThrottleTimer=setInterval(function(){if(t.streamBuffer.length>0&&t.streamingMessageIdForThrottle){var e=Math.min(3,t.streamBuffer.length),n=t.streamBuffer.slice(0,e);t.streamBuffer=t.streamBuffer.slice(e),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,n)}},30),this.visibilityHandler=function(){"visible"===document.visibilityState?(Jh("[Visibility] Tab became visible, buffer length: ".concat(t.streamBuffer.length,", messageId: ").concat(t.streamingMessageIdForThrottle)),t.streamBuffer.length>0&&t.streamingMessageIdForThrottle&&(Jh("[Visibility] Flushing ".concat(t.streamBuffer.length," chars to UI")),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,t.streamBuffer),t.streamBuffer="")):Jh("[Visibility] Tab hidden")},document.addEventListener("visibilitychange",this.visibilityHandler)},e.prototype.bufferStreamText=function(e){this.streamBuffer+=e},e.prototype.flushStreamBufferSync=function(){this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="")},e.prototype.flushStreamBuffer=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:return this.streamBuffer.length>0&&this.streamingMessageIdForThrottle?"hidden"!==document.visibilityState?[3,1]:(Jh("[flushStreamBuffer] Tab hidden, dispatching remaining ".concat(this.streamBuffer.length," chars immediately")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="",[3,5]):[3,5];case 1:e=0,t=100,n.label=2;case 2:return this.streamBuffer.length>0&&e<t?[4,new Promise(function(e){return setTimeout(e,30)})]:[3,4];case 3:return n.sent(),e++,[3,2];case 4:this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(Jh("[flushStreamBuffer] Timeout waiting for buffer, dispatching remaining ".concat(this.streamBuffer.length," chars")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),n.label=5;case 5:return this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamingMessageIdForThrottle=void 0,[2]}})})},e.prototype.stopStreamThrottle=function(){this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamBuffer="",this.streamingMessageIdForThrottle=void 0},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeOut is not supported in MCP mode")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeIn is not supported in MCP mode")})})},e.prototype.ensureAgentNick=function(e){return e?e.startsWith("agent:")?e:"agent:".concat(e):"agent:robot"},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;if(!e){var a=r||{nick:"agent:robot",displayName:"Assistant"};return t(t({},a),{nick:this.ensureAgentNick(a.nick),isAI:!0})}return e.displayName&&e.nick&&e.avatarPath?t(t({},e),{nick:this.ensureAgentNick(e.nick),isAI:!0}):t(t({},e),{nick:this.ensureAgentNick(e.nick||(null==r?void 0:r.nick)),displayName:e.displayName||(null==r?void 0:r.displayName)||"Assistant",avatarPath:e.avatarPath||(null==r?void 0:r.avatarPath),isAI:!0})},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.postMessage(e)];case 1:return r.sent(),t(),[3,3];case 2:return n=r.sent(),t(n),[3,3];case 3:return[2]}})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,a,o,i,s,u,l,c,d,f,p,h,v,m;return r(this,function(r){switch(r.label){case 0:return(null===(v=null===(h=e.msg)||void 0===h?void 0:h.text)||void 0===v?void 0:v.trim())||""?this.isInitializingSession&&this.sessionInitPromise?(Jh("Waiting for session initialization to complete before sending message..."),t=new Promise(function(e){return setTimeout(function(){return e("timeout")},1e4)}),[4,Promise.race([this.sessionInitPromise,t])]):[3,2]:(Jh("Ignoring empty message"),[2]);case 1:if("timeout"===r.sent()||this.isInitializingSession)return Gh("Session initialization timed out"),this.sendFailureMessage(0,0,"Chat is not ready. Please try again."),[2];r.label=2;case 2:n=this.getRetryConfig(),a=(null===(m=e.msg)||void 0===m?void 0:m.text)||"",o=!1,i=0,r.label=3;case 3:if(!(i<n.length))return[3,14];s=i===n.length-1,u=n[i],Jh("MCP attempt ".concat(i+1,"/").concat(n.length," for message: ").concat(a)),this.typing(),r.label=4;case 4:return r.trys.push([4,6,,13]),[4,this.attemptSSERequest(e)];case 5:return r.sent(),o=!0,[3,14];case 6:return l=r.sent(),this.stopTyping(),c=null==l?void 0:l.statusCode,Gh("MCP attempt ".concat(i+1," failed: ").concat(l,", statusCode: ").concat(c)),Jh("[postMessage] Error details:",{error:l,statusCode:c,messageText:a,sessionId:this._sessionId}),c&&c>=400&&c<500?(Jh("Client error ".concat(c,", not retrying")),f=this.getErrorMessage(l,c),this.sendFailureMessage(0,0,f),[2]):(Om(l)&&this.setConnectionStatus("offline"),s?(d=null==l?void 0:l.statusCode,f=u.text||this.getErrorMessage(l,d),this.sendFailureMessage(0,0,f),[3,12]):[3,7]);case 7:return i>0||u.text?(p=n[i+1])&&p.delay>0?(this.sendFailureMessage(p.retry,p.delay,p.text),[4,this.delay(p.delay)]):[3,9]:[3,10];case 8:r.sent(),r.label=9;case 9:return[3,12];case 10:return(p=n[i+1])&&p.delay>0?[4,this.delay(p.delay)]:[3,12];case 11:r.sent(),r.label=12;case 12:return[3,13];case 13:return i++,[3,3];case 14:return o?this.sentMessageCount++:Jh("All MCP retry attempts exhausted"),[2]}})})},e.prototype.attemptSSERequest=function(e){return n(this,void 0,void 0,function(){var n,a,o,i;return r(this,function(r){return"/debug"===(n=(null===(i=e.msg)||void 0===i?void 0:i.text)||"").trim().toLowerCase()?(this._debugMode=!this._debugMode,a=this._debugMode?"Debug mode enabled":"Debug mode disabled",Jh("[attemptSSERequest] ".concat(a)),o="debug-".concat(Date.now()),this.dispatch({type:"chat",detail:{type:"chat.stream.end",user:this.getBot(void 0),messageId:o,msg:{text:a},timestamp:+new Date}}),[2]):(Jh('[attemptSSERequest] Sending message: "'.concat(n,'", userId: ').concat(this._userId,", sessionId: ").concat(this._sessionId)),[2,this.performSSERequest(this.buildRequestPayload(t({message:n},this.conversationOnScreen&&{continueConversation:!0})))])})})},e.prototype.performSSERequest=function(e){return n(this,void 0,void 0,function(){var o,i,s,u,l,c,d,f,p=this;return r(this,function(h){return o=this.getEndpoint(),Jh("SSE request to ".concat(o,": ").concat(JSON.stringify(e))),this.abortController&&(this.abortController.abort(),this.abortController=void 0),this.abortController=new AbortController,i=xm(),this.currentMessageId=i,s=i,l=[],c=!1,[2,new Promise(function(h,v){wm.fetchEventSource(o,{method:"POST",headers:t({"Content-Type":"application/json"},"business_owner"===(p.config.mode||"homeowner")&&p.config.authToken?{Authorization:"Bearer ".concat(p.config.authToken)}:{}),body:JSON.stringify(e),signal:p.abortController.signal,openWhenHidden:!0,onopen:function(e){return n(p,void 0,void 0,function(){var t;return r(this,function(n){if(d=e.status,!e.ok)throw(t=new Error("HTTP error! status: ".concat(e.status))).statusCode=e.status,t;return Jh("SSE connection opened"),this.setConnectionStatus("online"),[2]})})},onmessage:function(e){var t;if(p.currentMessageId===i){Jh("SSE event: ".concat(e.event,", data: ").concat(e.data));var n=e.event||"message",r={};try{r=JSON.parse(e.data)}catch(e){return void Jh("Failed to parse SSE data: ".concat(e))}switch(void 0!==r.seq&&null!==r.seq&&(p.lastSeq=r.seq,p._sessionId&&function(e,t){if("undefined"!=typeof window&&window.sessionStorage)try{sessionStorage.setItem("xapp_mcp_lastSeq_".concat(e),String(t))}catch(e){}}(p._sessionId,r.seq)),n){case"connected":Jh("[SSE] Connected event received, messageId: ".concat(i,", isReturningUser: ").concat(r.isReturningUser,", isReplay: ").concat(r.isReplay)),p.conversationOnScreen=!0,r.isReplay&&(p.isReplaying=!0),r.user&&(u=r.user),(r.userId||r.sessionId)&&(r.userId&&(p._userId=r.userId,p.userIdIsServerAssigned=!0),r.sessionId&&(p._sessionId=r.sessionId,p.dispatch(Pm(p._sessionId))),Em(r.userId,r.sessionId),Jh("[SSE] Identity from connected - userId: ".concat(r.userId,", sessionId: ").concat(r.sessionId))),p.currentToolCalls=[],p.stopTyping(),r.isReplay?p.dispatchStreamResume(s):p.dispatchStreamStart(s,u),p.startStreamThrottle(s);break;case"session_resumed":Jh("[SSE] Session resumed, sessionId: ".concat(r.sessionId,", hasHistory: ").concat(r.hasHistory)),p.conversationOnScreen=!0,r.userId&&(p._userId=r.userId,p.userIdIsServerAssigned=!0),r.sessionId&&(p._sessionId=r.sessionId,p.dispatch(Pm(p._sessionId))),Em(r.userId,r.sessionId),p.stopTyping();break;case"session_expired":Jh("[SSE] Session expired: ".concat(r.reason||"Session not found")),p.conversationOnScreen=!1,Nm(p._sessionId),p._sessionId="",p.lastSeq=void 0,p.stopTyping(),p.stopStreamThrottle(),p.isValidatingSession=!1,p.initializeNewSession(),h();break;case"message_start":Jh("[SSE] message_start — splitting bubble, user: ".concat(null===(t=r.user)||void 0===t?void 0:t.displayName)),p.flushStreamBufferSync(),p.dispatchStreamEnd(s,{text:l.join("")},{toolCalls:p.config.debugMode||p._debugMode?a([],p.currentToolCalls,!0):void 0,user:u,preserveChips:!0}),p.currentToolCalls=[],s=xm(),l=[],u=r.user,p.dispatchStreamStart(s,u),p.startStreamThrottle(s);break;case"text":r.text&&(Jh("[SSE] Text chunk received (".concat(r.text.length," chars), chunks in this bubble: ").concat(l.length+1,", isReplay: ").concat(r.isReplay)),l.push(r.text),r.isReplay||p.isSleeping?p.dispatchStreamChunk(s,r.text,u):p.bufferStreamText(r.text));break;case"tool_start":if(Jh("Tool execution started: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName){var o={name:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,input:r.toolInput,startTime:Date.now(),isExecuting:!0};p.currentToolCalls.push(o),p.dispatchToolStart({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput})}break;case"tool_end":if(Jh("Tool execution ended: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName)(o=p.currentToolCalls.find(function(e){return r.toolCallId?e.toolCallId===r.toolCallId:e.name===r.toolName&&e.isExecuting}))&&(o.result=r.toolResult,o.error=r.toolError,o.label=r.label,o.hidden=r.hidden,o.endTime=r.toolBatchDurationMs&&null!=o.startTime?o.startTime+r.toolBatchDurationMs:Date.now(),o.isExecuting=!1,r.toolInput&&(o.input=r.toolInput)),"toggle_debug"===r.toolName&&(p._debugMode=!p._debugMode),p.dispatchToolEnd({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput,toolResult:r.toolResult,toolError:r.toolError});break;case"done":if(p.stopTyping(),r.response){r.response.sessionId&&(p._sessionId=r.response.sessionId,p.dispatch(Pm(p._sessionId)),Em(void 0,r.response.sessionId));var d=l.join("");Jh("[SSE] Done event received. Chunks in this bubble: ".concat(l.length,", accumulated text length: ").concat(d.length)),Jh("[SSE] First 100 chars of accumulated: ".concat(d.substring(0,100)));var f=r.response.suggestions,m=null==f?void 0:f.map(function(e){return{label:e.title,actionUrl:e.url||""}});(null==m?void 0:m.length)&&Jh("[SSE] Suggestions: ".concat(m.length," items"));var g=r.response.sources;(null==g?void 0:g.length)&&Jh("[SSE] Sources: ".concat(g.length," items"));var y={text:d||(s!==i?"":r.response.response)||"",options:m,sources:g,displays:r.response.displays},b=p.config.debugMode||p._debugMode?a([],p.currentToolCalls,!0):void 0;p.flushStreamBuffer().then(function(){p.dispatchStreamEnd(s,y,{toolCalls:b,user:u}),p.currentToolCalls=[],h()})}else p.stopStreamThrottle(),h();break;case"replay_complete":p.isReplaying=!1,Jh("[SSE] Replay complete: replayed ".concat(r.replayedCount," events, currentSeq: ").concat(r.currentSeq));break;case"replay_partial":p.isReplaying=!1,Jh("[SSE] Replay partial: some events unavailable, oldestAvailableSeq: ".concat(r.oldestAvailableSeq));break;case"error":c=!0,p.stopTyping(),p.stopStreamThrottle(),Gh("SSE error: ".concat(r.error)),v(new Error(r.error||"Server error during processing"))}}else Jh("[SSE] Ignoring stale event for messageId: ".concat(i,", current: ").concat(p.currentMessageId))},onerror:function(e){if(p.currentMessageId===i&&!c){c=!0,p.isReplaying=!1,p.isSleeping?(Jh("[MCPChat] SSE error during sleep - will request replay on wakeup"),p.needsReplayOnWakeup=!0,p.streamingMessageIdForThrottle&&p.dispatchStreamAbort(s),p.stopStreamThrottle()):p.stopStreamThrottle(),f=e instanceof Error?e:new Error(String(e));var t=(null==e?void 0:e.statusCode)||d;t&&(f.statusCode=t),Gh("SSE connection error: ".concat(e))}throw e}}).catch(function(e){if(p.stopStreamThrottle(),c||p.currentMessageId!==i)v(f||e);else{var t=(null==e?void 0:e.statusCode)||d,n=e instanceof Error?e:new Error(String(e));t&&(n.statusCode=t),v(n)}})})]})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes),this.conversationOnScreen=!0===e.hasConversation;var a=new URL(window.location.href);(null==a?void 0:a.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href,this._accessToken=this.visitorInfo.accessToken,this.startSession(n),this._sessionId?this.validateSession():this.initializeNewSession(),this.isInitializingSession&&this.typing(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t(new Error("File upload not supported in MCP mode"))},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){this.stopStreamThrottle(),this.abortController&&(this.abortController.abort(),this.abortController=void 0)},e.prototype.sleep=function(){this.isSleeping=!0,this.streamingMessageIdForThrottle?(this.needsReplayOnWakeup=!1,Jh("[MCPChat] sleep() - stream in progress, keeping SSE connection alive"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0)):(this.stopStreamThrottle(),this.isReplaying=!1,this.abortController&&(this.abortController.abort(),this.abortController=void 0))},e.prototype.wakeup=function(){if(this.isSleeping=!1,this.streamingMessageIdForThrottle&&this.abortController)Jh("[MCPChat] wakeup() - stream still in progress, restarting throttle"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.startStreamThrottle(this.streamingMessageIdForThrottle);else if(this.needsReplayOnWakeup){if(this.needsReplayOnWakeup=!1,void 0!==this.lastSeq&&this._sessionId)return Jh("[MCPChat] wakeup() - connection lost during sleep, requesting replay"),void this.requestReplay();Gh("[MCPChat] wakeup() - cannot replay, missing lastSeq (".concat(this.lastSeq,") or sessionId (").concat(this._sessionId,")"))}this._sessionId&&(Jh("[MCPChat] Wakeup - session exists, lastSeq: ".concat(this.lastSeq)),this.setConnectionStatus("online"))},e.prototype.requestReplay=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:if(this.isRequestingReplay)return Jh("[MCPChat] Replay already in progress, skipping"),[2];this.isRequestingReplay=!0,this.typing(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload())];case 2:return n.sent(),Jh("[MCPChat] Replay request completed"),[3,5];case 3:return e=n.sent(),t=null==e?void 0:e.statusCode,Gh("[MCPChat] Replay request failed: ".concat(e,", statusCode: ").concat(t)),Om(e)&&this.setConnectionStatus("offline"),[3,5];case 4:return this.stopTyping(),this.isRequestingReplay=!1,[7];case 5:return[2]}})})},e.prototype.notifyDisconnecting=function(e){if(void 0===e&&(e="close_tab"),this._sessionId){var t=this.getCloseEndpoint(),n=JSON.stringify({sessionId:this._sessionId,userId:this._userId||void 0,reason:e,messageCount:this.sentMessageCount,durationMs:void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:0});if(Jh("[MCPChat] notifyDisconnecting: reason=".concat(e,", endpoint=").concat(t)),"widget_close"===e&&"undefined"!=typeof fetch){var r={"Content-Type":"application/json"};return this.config.authToken&&(r.Authorization="Bearer ".concat(this.config.authToken)),void fetch(t,{method:"POST",headers:r,body:n,keepalive:!0})}if("undefined"!=typeof navigator&&navigator.sendBeacon){var a=new Blob([n],{type:"application/json"});navigator.sendBeacon(t,a)}}},e.prototype.startSession=function(e){this.userIdIsServerAssigned?Jh("[startSession] Preserving server-assigned userId: ".concat(this._userId)):this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="mcp-widget-user-".concat(this.visitorInfo.email):this._userId||(this._userId="mcp-widget-user-".concat(xm())),e?(this._sessionId=e,Jh("Using provided session id: ".concat(this._sessionId))):""===e?(this._sessionId="mcp-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))):!this._sessionId&&this.config.sessionId?(this._sessionId=this.config.sessionId,Jh("Using config session id: ".concat(this._sessionId))):this._sessionId?Jh("Keeping existing session id: ".concat(this._sessionId)):(this._sessionId="mcp-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();function Am(e){if(e)return"string"==typeof e?{displayText:e}:e}function Lm(e,n){var r,a,o,i,s,u,l,c,d;if(void 0===n&&(n=(new Date).getTime()),!e)return u;var f=Am(e.outputSpeech),p=Am(e.reprompt);return f&&(l=f.displayText,c=f.html),"TRANSFER_CALL"===e.system?u={type:"handOff",timestamp:n,handoffMessage:l,handoffTarget:null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.transferPhoneNumber,endSession:!1,user:void 0}:(null===(a=e.system)||void 0===a?void 0:a.startsWith("PERMISSION_"))?u=function(e,t){var n,r=function(e){switch(e){case"PERMISSION_EMAIL":return"EMAIL";case"PERMISSION_LOCATION_PRECISE":return"LOCATION_PRECISE";default:throw new Error("Unsupported permission: ".concat(e))}}(e.system),a=Am(e.outputSpeech),o=e.data.permissionPrimerAccepted,i=e.data.permissionDenied;return{type:"permissionRequest",timestamp:t,msg:{text:null!==(n=null==a?void 0:a.displayText)&&void 0!==n?n:"".concat(e.data.permissionRequestTTSContext),permissionRequest:{time:t,type:r,approve:"object"==typeof o?Lm({outputSpeech:o}).msg:void 0,deny:"object"==typeof i?Lm({outputSpeech:i}).msg:void 0}},endSession:!1,user:void 0}}(e,n):(d=!p||!(p.displayText||p.ssml),u={type:"msg",timestamp:n,msg:{displays:e.displays,context:null===(i=null===(o=e.context)||void 0===o?void 0:o.active)||void 0===i?void 0:i.map(function(e){return e.name})},endSession:d,user:void 0},l&&!c&&(u.msg=t(t({},u.msg),{text:l})),c&&(u.msg=t(t({},u.msg),{html:c})),(null===(s=null==f?void 0:f.suggestions)||void 0===s?void 0:s.length)&&(u.msg.options=f.suggestions.map(function(e){return"string"==typeof e?e:{label:e.title,actionUrl:e.url}}))),u}var Um=function(){function e(e,t){this._userId="",this._sessionId="",this._accessToken="",this._attributes={},this.config=e,this.options=t,this.configurableMessages=t.configurableMessages,this.isNewSession=!1,this.hooks=t.hooks}return e.prototype.init=function(e){this.dispatch=e,Jh("got init auth: ".concat(this.config.key)),this.setConnectionStatus("online"),this.setAccountStatus("online")},e.prototype.setConnectionStatus=function(e){Jh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(wv(e))},e.prototype.setAccountStatus=function(e){Jh("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(xv(e))},e.prototype.sendNewMessage=function(e){Jh("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t(t({},e.user),{nick:"agent:robot"}),msg:e.msg,timestamp:+new Date}})},e.prototype.userJoined=function(e){Jh("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:t(t({},e.user),{nick:"agent:robot"}),timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:"agent:robot"},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;return e?e.displayName&&e.nick&&e.avatarPath?e:t(t({},e),{nick:e.nick||r.nick||"Bot",displayName:e.displayName||r.displayName||"Bot",avatarPath:e.avatarPath||r.avatarPath}):r},e.prototype.sendChatMsgRequest=function(e,a){return n(this,void 0,void 0,function(){var n,o;return r(this,function(r){switch(r.label){case 0:return[4,this.postMessage(e)];case 1:return n=r.sent(),(null===(o=n.user)||void 0===o?void 0:o.displayName)||(n=t(t({},n),{user:this.getBot(n.user)})),this.sendNewMessage(n),a(),[2]}})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes);var a=new URL(window.location.href);(null==a?void 0:a.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href;var o=mm(document.referrer);o&&(this._attributes.referrer=o),this._accessToken=this.visitorInfo.accessToken,this.userJoined({user:this.getBot(void 0),token:""}),this.startSession(n),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var a,o,i,s,u,l,c,d,f,p,h,v,m,g,y,b,x,w,k,S,_,O,C,P,T,j,M,E,N,I,D,R=this;return r(this,function(A){switch(A.label){case 0:o=this._userId,i=this._sessionId,s=this._accessToken,u=function(e,n){for(var r=e||{},a=t({},n),o=0,i=Object.entries(r);o<i.length;o++){var s=i[o],u=s[0],l=s[1];void 0!==l&&(a[u]=l)}return a}(this._attributes,pm()),(l=localStorage.getItem("xa_rwg_token"))&&(u.rwg_token=l),(c=localStorage.getItem("xa_merchant_id"))&&(u.merchant_id=c),(d=localStorage.getItem("xa_environment"))&&(u.environment=d),(f=localStorage.getItem("xa_enablePreferredTime"))&&(u.enablePreferredTime=f),(p=localStorage.getItem("xa_service"))&&(u.service=p),(h=localStorage.getItem("xa_origin"))&&(u.origin=h),dm(u),u.currentTime=(new Date).toISOString(),v=(new Date).getTime(),this.isNewSession&&!(null===(M=null==e?void 0:e.msg)||void 0===M?void 0:M.text)?a={type:"LAUNCH_REQUEST",rawQuery:null===(E=null==e?void 0:e.msg)||void 0===E?void 0:E.text,sessionId:i,userId:o,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}:(m=null===(N=e.msg)||void 0===N?void 0:N.permissionRequest)?(e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})}),g=v-m.time>3e5,y=null===(I=e.msg.text)||void 0===I?void 0:I.toLowerCase(),b=!g,x={id:this._userId},g||("EMAIL"===m.type&&(w=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(y),b=w,x.email=this.visitorInfo.email,x.name=this.visitorInfo.displayName,this.visitorInfo.email=y),"LOCATION_PRECISE"===m.type&&(b=!!e.msg.location,x.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)),a={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,granted:b,userProfile:x,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}):a="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:this._sessionId,userId:this._userId,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u},Jh("Visitor says: ".concat(JSON.stringify(a,void 0,2))),k=Cm(this.configurableMessages),_=!1,O=function(e){S=e,_=!0},C=function(e,t){return n(R,void 0,void 0,function(){var n,a,o;return r(this,function(r){return n=k[e].retry,a=k[e].delay,o=k[e].text,Gh("POST failed: ".concat(t)),this.sendFailureMessage(n,a,o),S={errorText:""},[2,new Promise(function(e){setTimeout(e,1e3*a)})]})})},P=1,A.label=1;case 1:return P<k.length?(T=this.config.timeout||22e3,Jh("POST attempt ".concat(P," with timeout ").concat(T)),this.typing(),[4,new Lh({retries:1,timeout:T}).fetch(function(e){return function(e,t,a,o){return n(this,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return n=JSON.stringify(e),Jh("URL: ".concat(t)),Jh("BODY: ".concat(n)),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a)},body:n,mode:"cors",signal:o})];case 1:if(!(i=r.sent()).ok)throw new Error("Status ".concat(i.status,", Text: ").concat(i.statusText));return[2,i.json()]}})})}(a,R.config.url,R.config.key,e)}).then(O).catch(C.bind(this,P))]):[3,4];case 2:if(A.sent(),_)return[3,4];A.label=3;case 3:return P++,[3,1];case 4:return Jh("Bot says: ".concat(JSON.stringify(S,void 0,2))),this.isNewSession=!1,j=Lm(S),!(null==S?void 0:S.hasOwnProperty("errorText"))&&S||((j={type:"userLeft",timestamp:v,msg:{},user:void 0,endSession:!0}).msg={text:(null==S?void 0:S.hasOwnProperty("errorText"))?S.errorText:"The assistant is not responding right now. Please close the widget and open it again."}),"function"==typeof(null===(D=this.hooks)||void 0===D?void 0:D.onResponse)&&this.hooks.onResponse(S),this.stopTyping(),[2,j]}})})},e.prototype.startSession=function(e){this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat(xm()),e?(this._sessionId=e,Jh("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();var zm=function(){function e(){}return e.prototype.init=function(){},e.prototype.sendOfflineMsg=function(){},e.prototype.sendChatMsg=function(){},e.prototype.sendChatMsgRequest=function(){},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(){},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(){},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.bargeOut=function(){},e.prototype.bargeIn=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e}();function Fm(e,n,r,a,o,i,s){var u,l,c,d,f,p,h=(new Date).getTime();if(r&&!(null===(u=null==e?void 0:e.msg)||void 0===u?void 0:u.text))p={type:"LAUNCH_REQUEST",rawQuery:null===(l=null==e?void 0:e.msg)||void 0===l?void 0:l.text,sessionId:a,userId:n,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i};else{var v=null===(c=e.msg)||void 0===c?void 0:c.permissionRequest;if(v){e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})});var m=h-v.time>3e5,g=null===(d=e.msg.text)||void 0===d?void 0:d.toLowerCase(),y=!m,b={id:n};if(!m){if("EMAIL"===v.type){var x=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(g);y=x,b.email=s.email,b.name=s.displayName,this.visitorInfo.email=g}"LOCATION_PRECISE"===v.type&&(y=!!e.msg.location,b.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)}p={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:a,userId:n,isNewSession:!1,granted:y,userProfile:b,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}}else p="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:a,userId:n,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:a,userId:n,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:a,userId:n,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}}return(null===(f=e.msg)||void 0===f?void 0:f.attributes)&&(p.attributes=t(t({},p.attributes),e.msg.attributes)),p}var Bm="router",Wm={deviceId:"Router",userId:Bm,displayName:"XAPP Server"},Hm=function(){function e(e,t){var n,r,a,o,i;this.isDisposed=!1,this._userId="",this._sessionId="",this.accessToken="",this.attributes={},this.routerAttributes={},this.isAdmin=!1,this.urlAttributes={},this.handlers={},this.sleepTimeoutId=null,this.receivedMessageIds=new Set,this.MESSAGE_DEDUP_CACHE_SIZE=1e3,this.config=e,this.options=t;var s=new URL(this.config.url);this.appId=s.searchParams.get("appId");var u=new URL(window.location.href);if(this.isAdmin="true"===u.searchParams.get("isAdmin"),this.appId)this.serverUrl=this.config.url,this.urlAttributes.path=null===(n=s.pathname)||void 0===n?void 0:n.split("/");else{this.serverUrl="".concat(s.origin);var l=null===(r=s.pathname)||void 0===r?void 0:r.split("/");l&&l.length>1&&(this.serverUrl="".concat(this.serverUrl,"/").concat(l[1]),this.urlAttributes.path=l.slice(1))}Jh("WS url: ".concat(this.serverUrl," isAdmin: ").concat(this.isAdmin," attributes: ").concat(JSON.stringify(this.attributes)," appId: ").concat(this.appId)),this.configurableMessages=Cm(t.configurableMessages),this.noOfServerErrors=0,this.SLEEP_DELAY_MS=null!==(i=null===(o=null===(a=null==t?void 0:t.env)||void 0===a?void 0:a.connection)||void 0===o?void 0:o.backgroundSleepDelay)&&void 0!==i?i:6e4,Jh("Background sleep delay set to ".concat(this.SLEEP_DELAY_MS,"ms"))}return e.prototype.init=function(e){var n,r,a=this;this.dispatch=e,Jh("INIT called - setting initial accountStatus to OFFLINE"),this.setAccountStatus("offline"),this.handlers["connection update"]=function(e,t,n,r){Jh("Connection update received. Session created: ".concat(e.sessionCreated," Error: ").concat(e.errorMessage||"")),e.sessionCreated?(a.sessionCreated=!0,a.setConnectionStatus("online")):(Gh("SERVER: something is wrong. Going offline."),a.dispatch(xv("offline")),a.dispatch(wv("offline")))},this.handlers["account status"]=function(t,n,r,a){e({type:"account_status",detail:{status:"online",timestamp:r||(new Date).getTime()}})},this.handlers.failure=function(e,t,n,r){Gh("SERVER: something's failed: type: ".concat(e.type," tries: ").concat(e.tries," error: ").concat(e.error));var o=a.configurableMessages[e.tries],i=o.retry,s=o.delay,u=o.text;a.sendFailureMessage(i,e.delay||s,u,t)},this.handlers["new message"]=function(e,n,r,o,i){var s,u;if(i){if(i.length>256)return void Jh("Rejecting message with oversized messageId (".concat(i.length," chars)"));if(a.receivedMessageIds.has(i))return void Jh("Deduplicating message with id: ".concat(i));if(a.receivedMessageIds.add(i),a.receivedMessageIds.size>a.MESSAGE_DEDUP_CACHE_SIZE)for(var l=Math.floor(.1*a.MESSAGE_DEDUP_CACHE_SIZE),c=a.receivedMessageIds.values(),d=0;d<l;d++){var f=c.next().value;f&&a.receivedMessageIds.delete(f)}}if("Bot"===n.deviceId){var p=e;o&&"object"==typeof o&&Object.keys(o).length>0&&(a.routerAttributes=t({},o),Jh("Extracted router attributes: ".concat(JSON.stringify(a.routerAttributes)))),"function"==typeof(null===(s=a.options.hooks)||void 0===s?void 0:s.onResponse)&&a.options.hooks.onResponse(p),a.isNewSession&&(a.isNewSession=!1,Jh("Session initialized after receiving first bot response")),u=Lm(p)}else"Widget"===n.deviceId?u=function(e,t){if(void 0===t&&(t=(new Date).getTime()),e)return{type:"msg",timestamp:t,msg:{text:e.rawQuery},endSession:!1,user:void 0}}(e):Gh("Unknown sender device Id: ".concat(n.deviceId));a.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:n.displayName||n.email||n.userId,nick:qm(n),avatarPath:n.avatarPath},msg:u.msg,timestamp:r||(new Date).getTime()}})},this.handlers["user joined"]=function(e,t,n,r){var o,i,s=qm(t);Jh('Received "user joined" event - deviceId: '.concat(t.deviceId,", userId: ").concat(t.userId,", displayName: ").concat(t.displayName,", nick: ").concat(s)),Jh("Dispatching chat.memberjoin for ".concat(t.displayName||"Unknown"));var u=e;a.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:t.avatarPath||(null===(i=null===(o=a.options)||void 0===o?void 0:o.bot)||void 0===i?void 0:i.avatarPath),displayName:t.displayName,nick:s},timestamp:n||(new Date).getTime(),showDivider:null==u?void 0:u.showDivider,message:null==u?void 0:u.message,hideUserInfo:null==u?void 0:u.hideUserInfo}}),Jh("chat.memberjoin dispatched for nick: ".concat(s))},this.handlers["user left"]=function(e,t,n,r){var o=e;a.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{avatarPath:t.avatarPath,displayName:t.displayName,nick:qm(t)},timestamp:n||(new Date).getTime(),showDivider:null==o?void 0:o.showDivider,message:null==o?void 0:o.message}})},this.handlers.typing=function(e,t,n,r){a.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:qm(t)},typing:!0,timestamp:n||(new Date).getTime()}})},this.handlers["stop typing"]=function(e,t,n,r){a.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:qm(t)},typing:!1,timestamp:n||(new Date).getTime()}})},this.handlers.disconnect=function(){Jh("DISCONNECT event received from server"),Gh("SERVER: requested disconnect"),a.dispatch(xv("offline")),a.dispatch(wv("offline"))},this.handlers.reconnect=function(){a.dispatch(xv("online")),a.dispatch(wv("online"))},this.handlers["reconnect failed"]=function(e){Gh("SERVER: says re-connect failed"),a.dispatch(xv("offline")),a.dispatch(wv("offline"))},this.handlers["reconnect error"]=function(e){Gh("SERVER: says there was an error while re-connecting"),a.dispatch(xv("offline"))},this.handlers["display button"]=function(e,t,n,r){Jh('Received "display button" event - id: '.concat(e.id,", text: ").concat(e.text,", pressBehavior: ").concat(e.pressBehavior)),a.dispatch(kv({id:e.id,text:e.text,pressBehavior:e.pressBehavior||"none"}))},this.handlers["dismiss button"]=function(e,t,n,r){Jh('Received "dismiss button" event - id: '.concat(e.id)),a.dispatch(kv({id:e.id,text:"",pressBehavior:"none",isDismissing:!0})),setTimeout(function(){a.dispatch({type:"ws_button_dismiss",detail:{id:e.id,timestamp:+new Date}})},300)},this.handlers["system-message"]=function(e,t,n,r){Jh('Received "system-message" event - id: '.concat(e.id,", message: ").concat(e.message,", dismissId: ").concat(e.dismissId)),e.dismissId&&a.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:qm(t)},id:e.dismissId,timestamp:n||(new Date).getTime()}}),a.dispatch({type:"chat",detail:{type:"chat.systemmessage",user:{displayName:t.displayName||"System",nick:qm(t)},id:e.id,message:e.message,dismissId:e.dismissId,timestamp:n||(new Date).getTime()}})},this.handlers["system-message-dismiss"]=function(e,t,n,r){Jh('Received "system-message-dismiss" event - id: '.concat(e.id)),a.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:qm(t)},id:e.id,timestamp:n||(new Date).getTime()}})},this.handlers["missed messages"]=function(e,t,n,r){var o,i=e;Jh('Received "missed messages" event with '.concat((null===(o=null==i?void 0:i.messages)||void 0===o?void 0:o.length)||0," messages")),(null==i?void 0:i.messages)&&Array.isArray(i.messages)&&i.messages.forEach(function(e){Jh("Processing missed message: event=".concat(e.event,", messageId=").concat(e.messageId));var t=a.handlers[e.event];t&&"missed messages"!==e.event?t(e.data,e.sender,e.timeMs,e.attributes,e.messageId):Jh("No handler for missed message event: ".concat(e.event))})},this.handlers["request missed messages"]=function(){Jh("Request missed messages handler (no-op on client side)")},this.handlers["user backgrounded"]=function(){Jh("User backgrounded handler (no-op on client side)")},this.handlers["user foregrounded"]=function(){Jh("User foregrounded handler (no-op on client side)")},this.handlers["user disconnecting"]=function(){Jh("User disconnecting handler (no-op on client side)")},this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:null===(r=null===(n=this.options)||void 0===n?void 0:n.bot)||void 0===r?void 0:r.avatarPath,displayName:Wm.displayName,nick:qm(Wm)},timestamp:(new Date).getTime()}}),this.setAccountStatus("online"),this.setConnectionStatus("online")},e.prototype.autoReconnect=function(e){var t=this;0===this.noOfServerErrors&&this.setConnectionStatus("pending");var n=this.setAccountStatus.bind(this),r=this.setConnectionStatus.bind(this);function a(){var t=setInterval(function(){var o=e();o?(Jh("Re-created WS connection"),o.onopen=function(){Jh("Re-opened WS connection"),n("online"),r("online"),o.onclose=function(){Jh("WebSocket ONCLOSE event - connection closed unexpectedly"),Jh("Closed WS connection (onclosed was called)"),a()},clearInterval(t)}):clearInterval(t)},5e3)}Jh("Creating WS connection");var o=e();o&&(o.onclose=function(){Jh("WebSocket ONCLOSE event (initial) - connection closed"),Jh("Closed WS connection (onclosed was called)"),a()},this.ws.onopen=function(){Jh("WebSocket ONOPEN event - connection established"),Jh("Opened WS connection (onopen was called)"),t.setAccountStatus("online"),t.setConnectionStatus("online")})},e.prototype.wsClose=function(){this.ws&&(Jh("wsClose() - Closing WebSocket (readyState: ".concat(this.ws.readyState,")")),this.ws.onclose=null,this.ws.onerror=null,this.ws.onopen=null,this.ws.onmessage=null,this.ws.close())},e.prototype.wsCreate=function(e){var t=this;if(!this.isDisposed){Jh('Trying to re-connect. Reason: "'.concat(e,'"'));var n=new URL(this.serverUrl);if(n.searchParams.set("userId",this._userId),n.searchParams.set("isAdmin","".concat(this.isAdmin)),n.searchParams.set("createWsReason",e),this.ws&&this.ws.readyState!==WebSocket.CLOSED&&this.ws.readyState!==WebSocket.CLOSING){var r=this.ws.readyState;Jh("Forced WS close. State: ".concat(r));try{this.wsClose()}catch(e){e("Failed to close WS (ready state: ".concat(r,"): ").concat(e))}}return this.ws=new WebSocket(n.toString()),this.ws.onerror=function(e){var r;Gh("Error in WS connection. Url: ".concat(n.toString()," Type: ").concat(e?e.type:"?"," Ready State: ").concat(null===(r=t.ws)||void 0===r?void 0:r.readyState))},this.ws.onmessage=function(e){Jh("ROUTER says: ".concat(e.data));var n=JSON.parse(e.data);t.handlers[n.event]?t.handlers[n.event](n.data,n.sender,n.timeMs,n.attributes,n.messageId):Gh("Unknown router message event: ".concat(n.event))},this.ws}Jh("Stopping reconnect for disposed router connector")},e.prototype.checkConnection=function(){var e;return(null===(e=this.ws)||void 0===e?void 0:e.readyState)===WebSocket.OPEN},e.prototype.emit=function(e,t){return n(this,void 0,void 0,function(){var n,a,o=this;return r(this,function(r){switch(r.label){case 0:return n={event:e,data:t,sender:this.visitorInfo,sessionId:this._sessionId,timeMs:(new Date).getTime()},this.routerAttributes&&Object.keys(this.routerAttributes).length>0&&(n.attributes=this.routerAttributes,Jh("Adding router attributes to outgoing payload: ".concat(JSON.stringify(this.routerAttributes)))),a=JSON.stringify(n),Jh("Widget says: ".concat(a)),this.ws||this.autoReconnect(this.wsCreate.bind(this,"emitNoWs")),[4,Ym(this.checkConnection.bind(this),1e3,1e4,"connection").then(function(e){e>0&&Jh("Connection is ready in ".concat(e," ms")),o.ws.send(a),o.noOfServerErrors=0}).catch(function(e){Gh("Connection wait timed out in ".concat(e," ms (show error)")),o.setConnectionStatus("online")})];case 1:return r.sent(),[2]}})})},e.prototype.setAccountStatus=function(e){Jh("setAccountStatus: ".concat(e)),Jh("SERVER account_status: ".concat(JSON.stringify(e))),this.dispatch(xv(e))},e.prototype.setConnectionStatus=function(e){Jh("setConnectionStatus: ".concat(e)),Jh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(wv(e))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.sendFailureMessage=function(e,t,n,r){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:qm(r)},typing:!1,timestamp:+new Date}}),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:qm(r)},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendDisconnectMessage=function(){this.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:"Server",nick:qm(Wm),avatarPath:Wm.avatarPath},msg:{text:0===this.noOfServerErrors?"I cannot connect to the server. Please try later.":"Nope. Still no luck. I still cannot connect to the server. Please don't give up."},timestamp:(new Date).getTime()}}),this.noOfServerErrors++},e.prototype.checkSession=function(){return this.sessionCreated},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n=this;return r(this,function(r){switch(r.label){case 0:return this.checkSession()||this.setConnectionStatus("pending"),[4,Ym(this.checkSession.bind(this),1e3,1e4,"session creation").then(function(t){t>0&&Jh("Session creation is ready in ".concat(t," ms")),n.postMessage(e)}).catch(function(e){Gh("Session creation wait timed out in ".concat(e," ms")),n.setConnectionStatus("online"),n.sendDisconnectMessage()})];case 1:return r.sent(),this.setConnectionStatus("online"),t(),[2]}})})},e.prototype.sendTyping=function(e){},e.prototype.setVisitorInfo=function(e,n,r){Jh("Visitor Info Message = ".concat(JSON.stringify(e))),this.visitorInfo={deviceId:"Widget",userId:e.userId,displayName:e.displayName||e.name,email:e.email,isAdmin:this.isAdmin,urlAttributes:this.urlAttributes},this.attributes=t(t(t({},e.attributes),this.attributes),{currentUrl:window.location.href}),this.accessToken=e.accessToken,this.startSession(n),this.postVisitorInfo(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){Jh("DISPOSE called - cleaning up connection"),this.isDisposed=!0,this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.ws&&this.wsClose(),Jh("Closed web socket (dispose)")},e.prototype.sleep=function(){var e=this;Jh("SLEEP called - scheduling delayed close"),this.checkConnection()&&(Jh("SLEEP - Notifying router of user backgrounded"),this.emit("user backgrounded")),this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.sleepTimeoutId=window.setTimeout(function(){e.ws&&e.wsClose(),Jh("SLEEP - closed web socket after ".concat(e.SLEEP_DELAY_MS,"ms delay")),e.sleepTimeoutId=null},this.SLEEP_DELAY_MS),Jh("SLEEP - WebSocket will close in ".concat(this.SLEEP_DELAY_MS,"ms if not woken up"))},e.prototype.wakeup=function(){var e=this;if(Jh("WAKEUP called - userId:",this._userId),this.sleepTimeoutId)return clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null,Jh("WAKEUP - Cancelled pending sleep, keeping WebSocket open"),void(this.checkConnection()&&(Jh("WAKEUP - Notifying router of user foregrounded"),this.emit("user foregrounded")));this.isDisposed=!1,this._userId?(Jh("WAKEUP - Setting accountStatus and connectionStatus to ONLINE"),this.setAccountStatus("online"),this.setConnectionStatus("online"),Jh("Waking up - setting status to online"),Jh("WAKEUP - Calling autoReconnect"),this.autoReconnect(this.wsCreate.bind(this,"wakeup")),Ym(this.checkConnection.bind(this),100,5e3,"wakeup-connection").then(function(){Jh("WAKEUP - Notifying router of user foregrounded (after reconnect)"),e.emit("user foregrounded"),e.requestMissedMessages()}).catch(function(){Jh("WAKEUP - Connection not ready after 5s, skipping missed messages request")})):Jh("WAKEUP - No userId, returning early")},e.prototype.requestMissedMessages=function(){Jh("Requesting missed messages from server"),this.emit("request missed messages")},e.prototype.notifyDisconnecting=function(){if(this.checkConnection()){Jh("Notifying router of user disconnecting");var e=JSON.stringify({event:"user disconnecting",data:{reason:"tab_close"},sender:this.visitorInfo,sessionId:this._sessionId,timeMs:Date.now()});try{this.ws.send(e)}catch(e){Jh("Failed to send disconnect notification:",e)}}},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){return this.emit("barge out"),[2]})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(t){return this.visitorInfo.displayName=e,this.emit("barge in"),[2]})})},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return Jh('Sending "button pressed" event - id: '.concat(e)),t={id:e},this.emit("button pressed",t),[2]})})},e.prototype.postVisitorInfo=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return this.sessionCreated=!1,this.emit("user joined"),[2]})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,a,o,i,s,u,l,c,d,f;return r(this,function(r){return t=this._userId,n=this._sessionId,a=this.accessToken,o=this.attributes||{},(i=localStorage.getItem("xa_rwg_token"))&&(o.rwg_token=i),(s=localStorage.getItem("xa_merchant_id"))&&(o.merchant_id=s),(u=localStorage.getItem("xa_environment"))&&(o.environment=u),(l=localStorage.getItem("xa_enablePreferredTime"))&&(o.enablePreferredTime=l),(c=localStorage.getItem("xa_service"))&&(o.service=c),(d=localStorage.getItem("xa_origin"))&&(o.origin=d),dm(o),o.currentTime=(new Date).toISOString(),f=Fm(e,t,this.isNewSession,n,a,o,this.visitorInfo),this.emit("new message",f),[2]})})},e.prototype.startSession=function(e){this.visitorInfo.userId?this._userId="".concat(this.visitorInfo.userId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat(xm());var t=new URL(window.location.href).searchParams.get("sessionId");t?(this._sessionId=t,this.dispatch(Pm(this._sessionId)),Jh("Using enforced session id: ".concat(this._sessionId))):e?(this._sessionId=e,Jh("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0,Jh("Started session: ".concat(this._sessionId))},e}();function qm(e){return"Bot"===e.deviceId?"agent:bot:".concat(e.userId):"agent:widget:".concat(e.userId)}function Ym(e,t,n,r){var a=0,o=function(i,s){a>=n?s(a):e()?i(a):(a+=t,r&&Jh("Still waiting for ".concat(r," (").concat(a," ms)")),setTimeout(function(e){return o(i,s)},t))};return new Promise(o)}const Vm=Object.create(null);Vm.open="0",Vm.close="1",Vm.ping="2",Vm.pong="3",Vm.message="4",Vm.upgrade="5",Vm.noop="6";const Qm=Object.create(null);Object.keys(Vm).forEach(e=>{Qm[Vm[e]]=e});const $m={type:"error",data:"parser error"},Km="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Jm="function"==typeof ArrayBuffer,Gm=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Xm=({type:e,data:t},n,r)=>Km&&t instanceof Blob?n?r(t):Zm(t,r):Jm&&(t instanceof ArrayBuffer||Gm(t))?n?r(t):Zm(new Blob([t]),r):r(Vm[e]+(t||"")),Zm=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function eg(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let tg;const ng="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rg="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)rg[ng.charCodeAt(e)]=e;const ag="function"==typeof ArrayBuffer,og=(e,t)=>{if("string"!=typeof e)return{type:"message",data:sg(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:ig(e.substring(1),t)};return Qm[n]?e.length>1?{type:Qm[n],data:e.substring(1)}:{type:Qm[n]}:$m},ig=(e,t)=>{if(ag){const n=(e=>{let t,n,r,a,o,i=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const l=new ArrayBuffer(i),c=new Uint8Array(l);for(t=0;t<s;t+=4)n=rg[e.charCodeAt(t)],r=rg[e.charCodeAt(t+1)],a=rg[e.charCodeAt(t+2)],o=rg[e.charCodeAt(t+3)],c[u++]=n<<2|r>>4,c[u++]=(15&r)<<4|a>>2,c[u++]=(3&a)<<6|63&o;return l})(e);return sg(n,t)}return{base64:!0,data:e}},sg=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,ug=String.fromCharCode(30);function lg(){return new TransformStream({transform(e,t){!function(e,t){Km&&e.data instanceof Blob?e.data.arrayBuffer().then(eg).then(t):Jm&&(e.data instanceof ArrayBuffer||Gm(e.data))?t(eg(e.data)):Xm(e,!1,e=>{tg||(tg=new TextEncoder),t(tg.encode(e))})}(e,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const e=new DataView(a.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{a=new Uint8Array(9);const e=new DataView(a.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let cg;function dg(e){return e.reduce((e,t)=>e+t.length,0)}function fg(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let a=0;a<t;a++)n[a]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}var pg=hg;function hg(e){if(e)return function(e){for(var t in hg.prototype)e[t]=hg.prototype[t];return e}(e)}hg.prototype.on=hg.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},hg.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},hg.prototype.off=hg.prototype.removeListener=hg.prototype.removeAllListeners=hg.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var a=0;a<r.length;a++)if((n=r[a])===t||n.fn===t){r.splice(a,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},hg.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var a=(n=n.slice(0)).length;r<a;++r)n[r].apply(this,t)}return this},hg.prototype.emitReserved=hg.prototype.emit,hg.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},hg.prototype.hasListeners=function(e){return!!this.listeners(e).length};const vg="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),mg="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function gg(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const yg=mg.setTimeout,bg=mg.clearTimeout;function xg(e,t){t.useNativeTimers?(e.setTimeoutFn=yg.bind(mg),e.clearTimeoutFn=bg.bind(mg)):(e.setTimeoutFn=mg.setTimeout.bind(mg),e.clearTimeoutFn=mg.clearTimeout.bind(mg))}function wg(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,a=e.length;r<a;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function kg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class Sg extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class _g extends pg{constructor(e){super(),this.writable=!1,xg(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new Sg(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=og(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:""}}class Og extends _g{constructor(){super(...arguments),this._polling=!1}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(ug),r=[];for(let e=0;e<n.length;e++){const a=og(n[e],t);if(r.push(a),"error"===a.type)break}return r})(e,this.socket.binaryType).forEach(e=>{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 a=0;e.forEach((e,o)=>{Xm(e,!1,e=>{r[o]=e,++a===n&&t(r.join(ug))})})})(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]=kg()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let Cg=!1;try{Cg="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Gh){}const Pg=Cg;function Tg(){}class jg extends Og{constructor(e){if(super(e),"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}}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}}class Mg extends pg{constructor(e,t,n){super(),this.createRequest=e,xg(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=gg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=Mg.requestsCount++,Mg.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=Tg,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Mg.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()}}if(Mg.requestsCount=0,Mg.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Eg);else if("function"==typeof addEventListener){addEventListener("onpagehide"in mg?"pagehide":"unload",Eg,!1)}function Eg(){for(let e in Mg.requests)Mg.requests.hasOwnProperty(e)&&Mg.requests[e].abort()}const Ng=function(){const e=Ig({xdomain:!1});return e&&null!==e.responseType}();function Ig(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Pg))return new XMLHttpRequest}catch(e){}if(!t)try{return new(mg[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Dg="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Rg extends _g{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Dg?{}:gg(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=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}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<e.length;t++){const n=e[t],r=t===e.length-1;Xm(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&vg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},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]=kg()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ag=mg.WebSocket||mg.MozWebSocket;const Lg={websocket:class extends Rg{createSocket(e,t,n){return Dg?new Ag(e,t,n):t?new Ag(e,t):new Ag(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends _g{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}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){cg||(cg=new TextDecoder);const n=[];let r=0,a=-1,o=!1;return new TransformStream({transform(i,s){for(n.push(i);;){if(0===r){if(dg(n)<1)break;const e=fg(n,1);o=!(128&~e[0]),a=127&e[0],r=a<126?3:126===a?1:2}else if(1===r){if(dg(n)<2)break;const e=fg(n,2);a=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(dg(n)<8)break;const e=fg(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue($m);break}a=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(dg(n)<a)break;const e=fg(n,a);s.enqueue(og(o?e:cg.decode(e),t)),r=0}if(0===a||a>e){s.enqueue($m);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=lg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const a=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),a())}).catch(e=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&vg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends jg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Ng&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Mg(Ig,this.uri(),e)}}},Ug=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,zg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Fg(e){if(e.length>8e3)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 a=Ug.exec(e||""),o={},i=14;for(;i--;)o[zg[i]]=a[i]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const Bg="function"==typeof addEventListener&&"function"==typeof removeEventListener,Wg=[];Bg&&addEventListener("offline",()=>{Wg.forEach(e=>e())},!1);class Hg extends pg{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Fg(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Fg(t.host).host);xg(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=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),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 e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),Bg&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{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"})},Wg.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),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 this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Hg.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);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))}onOpen(){this.readyState="open",Hg.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=wg(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,vg(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}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 a={type:e,data:t,options:n};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),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(e){if(Hg.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Bg&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Wg.indexOf(this._offlineEventListener);-1!==e&&Wg.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Hg.protocol=4;class qg extends Hg{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Hg.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Hg.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function a(){n||(n=!0,l(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,a(),this.emitReserved("upgradeError",n)};function i(){o("transport closed")}function s(){o("socket closed")}function u(e){t&&e.name!==t.name&&a()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",i),this.off("close",s),this.off("upgrading",u)};t.once("open",r),t.once("error",o),t.once("close",i),this.once("close",s),this.once("upgrading",u),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Yg=class extends qg{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>Lg[e]).filter(e=>!!e)),super(e,n)}};const Vg="function"==typeof ArrayBuffer,Qg=Object.prototype.toString,$g="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Qg.call(Blob),Kg="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Qg.call(File);function Jg(e){return Vg&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||$g&&e instanceof Blob||Kg&&e instanceof File}function Gg(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Gg(e[t]))return!0;return!1}if(Jg(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Gg(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Gg(e[t]))return!0;return!1}function Xg(e){const t=[],n=e.data,r=e;return r.data=Zg(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Zg(e,t){if(!e)return e;if(Jg(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Zg(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Zg(e[r],t));return n}return e}function ey(e,t){return e.data=ty(e.data,t),delete e.attachments,e}function ty(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=ty(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ty(e[n],t));return e}const ny=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ry;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(ry||(ry={}));function ay(e){return"[object Object]"===Object.prototype.toString.call(e)}class oy extends pg{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===ry.BINARY_EVENT;n||t.type===ry.BINARY_ACK?(t.type=n?ry.EVENT:ry.ACK,this.reconstructor=new iy(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Jg(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===ry[n.type])throw new Error("unknown packet type "+n.type);if(n.type===ry.BINARY_EVENT||n.type===ry.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const a=e.substring(r,t);if(a!=Number(a)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(a)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!oy.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case ry.CONNECT:return ay(t);case ry.DISCONNECT:return void 0===t;case ry.CONNECT_ERROR:return"string"==typeof t||ay(t);case ry.EVENT:case ry.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===ny.indexOf(t[0]));case ry.ACK:case ry.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class iy{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=ey(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var sy=Object.freeze({__proto__:null,Decoder:oy,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==ry.EVENT&&e.type!==ry.ACK||!Gg(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===ry.EVENT?ry.BINARY_EVENT:ry.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==ry.BINARY_EVENT&&e.type!==ry.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Xg(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return ry}});function uy(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ly=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class cy extends pg{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[uy(e,"open",this.onopen.bind(this)),uy(e,"packet",this.onpacket.bind(this)),uy(e,"error",this.onerror.bind(this)),uy(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,a;if(ly.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:ry.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const i=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(a=this.io.engine)||void 0===a?void 0:a._hasPingExpired());return this.flags.volatile&&!i||(s?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(a),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const a=(e,t)=>e?r(e):n(t);a.withError=!0,t.push(a),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)=>{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:ry.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),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ry.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 ry.EVENT:case ry.BINARY_EVENT:this.onevent(e);break;case ry.ACK:case ry.BINARY_ACK:this.onack(e);break;case ry.DISCONNECT:this.ondisconnect();break;case ry.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:ry.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}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:ry.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;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function dy(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}dy.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)},dy.prototype.reset=function(){this.attempts=0},dy.prototype.setMin=function(e){this.ms=e},dy.prototype.setMax=function(e){this.max=e},dy.prototype.setJitter=function(e){this.jitter=e};class fy extends pg{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,xg(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 dy({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||sy;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,e||(this.skipReconnect=!0),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 Yg(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=uy(t,"open",function(){n.onopen(),e&&e()}),a=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=uy(t,"error",a);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),a(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(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(uy(e,"ping",this.onping.bind(this)),uy(e,"data",this.ondata.bind(this)),uy(e,"error",this.onerror.bind(this)),uy(e,"close",this.onclose.bind(this)),uy(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){vg(()=>{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 cy(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),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 py={};function hy(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=Fg(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 a=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,a=n.id,o=n.path,i=py[a]&&o in py[a].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?s=new fy(r,t):(py[a]||(py[a]=new fy(r,t)),s=py[a]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(hy,{Manager:fy,Socket:cy,io:hy,connect:hy});var vy=function(){function e(e,t){this.config=e,this.token=t.token}return e.prototype.init=function(e){var t=this;Jh("[StentorServerChat] Creating new socket connection to ".concat(this.config.url)),this.socket=hy(this.config.url,{transports:["websocket"],reconnection:!0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:5}),this.dispatch=e,this.socket.on("connect",function(){Jh("[StentorServerChat] Socket CONNECTED - ID: ".concat(t.socket.id))}),this.socket.on("account_status",function(n){Jh("SERVER: account_status: ".concat(JSON.stringify(n))),t.token||(t.token=xm(),e({type:"receiveToken",detail:{token:t.token,timestamp:+new Date,type:"receiveToken",user:void 0}}),Jh("CLIENT: created token: ".concat(t.token))),t.socket.emit("connection update",t.token),e({type:"account_status",detail:{status:"online",timestamp:+new Date}})}),this.socket.on("new message",function(e){Jh("SERVER: new message: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:e.username,nick:"agent:robot"},msg:e.message,timestamp:+new Date}})}),this.socket.on("user joined",function(e){Jh("SERVER: user joined: ".concat(JSON.stringify(e))),t.visitorInfo.token=e.token,t.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{displayName:e.username,nick:e.nick||"agent:robot",avatarPath:e.avatarPath},timestamp:+new Date}})}),this.socket.on("user left",function(e){Jh("SERVER: user left: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{displayName:e.username,nick:"agent:robot"},timestamp:+new Date}})}),this.socket.on("typing",function(e){Jh("SERVER: typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})}),this.socket.on("stop typing",function(e){Jh("SERVER: stop typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})}),this.socket.on("disconnect",function(e){var n="string"==typeof e?e:String(e||"unknown");Jh("[StentorServerChat] Socket DISCONNECTED - Reason: ".concat(n)),Jh("SERVER: disconnect"),t.dispatch(xv("offline")),t.dispatch(wv("offline"))}),this.socket.on("reconnect",function(){Jh("SERVER: reconnect"),t.dispatch(xv("online")),t.dispatch(wv("online"))}),this.socket.on("reconnect_failed",function(e){Jh("SERVER: reconnect_failed",e),t.dispatch(xv("offline")),t.dispatch(wv("offline"))}),this.socket.on("reconnect_error",function(e){Jh("SERVER: reconnect_error",e),t.dispatch(xv("offline"))}),this.dispatch(wv("pending"))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendChatMsgRequest=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendTyping=function(e){this.socket.emit(e?"typing":"stop typing")},e.prototype.setVisitorInfo=function(e,t,n){this.visitorInfo=e,this.socket.emit("add user",e),n()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){var e;Jh("[StentorServerChat] dispose() called - manually disconnecting socket"),null===(e=this.socket)||void 0===e||e.disconnect()},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e}();function my(e,t){return new Ov(function(e,t){var n,r,a,o,i,s;switch(e.type){case"direct":return new Um({url:e.serverUrl,key:e.accountKey,timeout:e.timeout},t);case"websocket":return new vy({url:e.serverUrl},t);case"websocketraw":return new Hm({url:e.serverUrl},t);case"mcp":return new Rm({serverUrl:e.serverUrl,mode:null===(n=e.mcp)||void 0===n?void 0:n.mode,authToken:null===(r=e.mcp)||void 0===r?void 0:r.authToken,debugMode:null===(a=e.mcp)||void 0===a?void 0:a.debugMode,pageContextOverride:null===(o=e.mcp)||void 0===o?void 0:o.pageContextOverride,showAiBadge:null===(i=e.mcp)||void 0===i?void 0:i.showAiBadge,channelId:null===(s=e.mcp)||void 0===s?void 0:s.channelId},t);case"local":return new zm;default:throw Sv(e.type)}}(e,t))}var gy=Z.createContext(null);function yy(){var e=_v(),t=Z.useContext(gy);return Z.useCallback(function(n){n?t&&e(n(t)):console.warn("react bug? Someone invokes with null")},[e,t])}function by(){var e=yy();return Z.useCallback(function(t,n){e(gv(t,n))},[e])}var xy={type:"newWindow"};function wy(e){return{type:"visual_status",detail:{status:e,timestamp:(new Date).getTime()}}}var ky="xa_chat",Sy="resume",_y="Continue your conversation";function Oy(e){return!!(null==e?void 0:e.some(function(e){return"chat.msg"===e.type}))}function Cy(e,n){var r=n.arrivedViaChatLink;if(!n.hasConversation||!(null==e?void 0:e.message)&&!r)return e;var a=r?{delay:0}:{},o=null==e?void 0:e.mobile;return t(t(t(t({},e),{message:_y}),a),o&&{mobile:t(t(t({},o),("string"==typeof o.message||r)&&{message:_y}),a)})}var Py="(max-width: 640px), (max-height: 480px) and (pointer: coarse)";function Ty(e,t,n,r,a){var o,i,s;if(void 0===a&&(void 0===s&&(s=window),a="function"==typeof s.matchMedia&&s.matchMedia(Py).matches),!t||!n)throw new Error("OpenUrl: No dispatch and/or visual.");if(e!==tv){try{var u=new URL(e),l=new URLSearchParams(u.search);l.has("utm_source")||l.append("utm_source","xapp"),u.search=l.toString(),e=u.toString()}catch(e){}var c=r.type;switch(c){case"newWindow":n.opened&&t(wy({opened:!1})),window.open(e,"callout-option","toolbar=0,status=0,width=".concat(r.width||1e3,",height=").concat(r.height||700));break;case"newTab":n.opened&&t(wy({opened:!1})),window.open(e,"_blank");break;case"sameWindow":a?t(wy({opened:!1})):n.opened||t(wy({opened:!0})),window.open(function(e,t){try{var n=new URL(e);return n.origin!==t||n.searchParams.get(ky)===Sy?e:(n.searchParams.set(ky,Sy),n.toString())}catch(t){return e}}(e,window.location.origin),"_self");break;default:Sv(c)}}else{var d=null===(o=window.xafwControl)||void 0===o?void 0:o.openForm;if(!d)return void Gh("Cannot find toggleForm! Update form widget!");var f=!1,p=null===(i=window.xafwControl)||void 0===i?void 0:i.formStatus;p?f=p().active:Gh("Cannot find formStatus! Update form widget!"),f||(d(),n.opened&&t(wy({opened:!1})))}}function jy(){var e=rv();return Z.useCallback(function(t,n,r,a){a||(a=(null==e?void 0:e.urls)?function(e,t){if(t.policies)for(var n=0,r=t.policies;n<r.length;n++){var a=r[n];try{if(new RegExp(a.pattern,"gi").test(e))return a.behavior}catch(e){}}return t.defaultBehavior||xy}(t,e.urls):xy),Ty(t,n,r,a)},[e])}function My(){var e=jy(),t=_v(),n=Dh(function(e){return e.visuals}),r=by();return Z.useCallback(function(a){a.actionUrl?e(a.actionUrl,t,n):r(a.label)},[t,r,e,n])}var Ey=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return function(e){var t=e;return{content:e.content,imageUrl:e.smallImageUrl||t.imageUrl,title:e.title,imageActionUrl:null==e?void 0:e.imageActionUrl,buttons:e.buttons?e.buttons.map(function(e){return{actionUrl:e.openUrlAction||e.url,label:e.title}}):void 0}}(t)},[t]),a=n.user,o=My();return f.jsx(vv,{showAvatar:!0,user:a,children:f.jsx("div",{className:"chat-msg",children:f.jsx(fv,{card:r,onButtonClick:o})})})};function Ny(e){return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function Iy(e){var t,n=Z.useState(e.getArray()),r=n[0],a=n[1],o=(t=Z.useRef(!1),Z.useEffect(function(){return t.current=!0,function(){t.current=!1}},[]),Z.useCallback(function(){return t.current},[]));return Z.useEffect(function(){var t=e.subscribe(function(e){o()&&a(e)});return function(){t.unsubscribe()}},[o,e]),r}var Dy=[];function Ry(e){var t=e.get()||Dy,n=Array.isArray(t)?function(e){var t=e||[],n=[];function r(){for(var e=0,r=n;e<r.length;e++)(0,r[e])(t)}return{getArray:function(){return t},push:function(e){t=a(a([],t,!0),[e],!1),r()},unshift:function(e){t=a([e],t,!0),r()},subscribe:function(e){return n.push(e),{unsubscribe:function(){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}}}(t):t;return n!==t&&e.set(n),Iy(n)}var Ay=function(e,t){return{get:function(){return e[t]},set:function(n){return e[t]=n}}}(globalThis,"xappMsgMiddlewares");function Ly(){return function(e){var t=Ry(e);return Z.useMemo(function(){return Ny(t)},[t])}(Ay)}function Uy(e){return e.hasOwnProperty("label")}function zy(e){return e.url||e.imageActionUrl}var Fy=function(e){var t=_v(),n=Dh(function(e){return e.visuals}),r=e.url,a=e.className,o=e.onOpen,i=Z.useCallback(function(){o&&o(r,t,n)},[r,o]);return r?f.jsx("div",{onClick:i,className:a,children:e.children}):f.jsx("div",{onClick:e.onClick,className:a,children:e.children})},By=function(e){var t,n=e.item,r=e.onButtonClick,a=e.onExecute,o=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),i=Z.useCallback(function(){var e;1===(null===(e=n.buttons)||void 0===e?void 0:e.length)?r(n.buttons[0]):a(n.title,n.token)},[n,a,r]),s="xappw-chat-action-item ".concat(o?"xappw-chat-action-item--action":""," ").concat(e.className);return f.jsx(Fy,{className:s,url:zy(n),onClick:i,onOpen:e.onOpenUrl,children:e.children})},Wy=function(e){var t,n=e.item,r=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),a=zy(n);if(n.imageUrl){var o=r?null:n.imageActionUrl;return f.jsx("div",{className:e.className,children:f.jsx(dv,{imageUrl:n.imageUrl,imageActionUrl:!a&&o})})}return e.emptyImageVisible?f.jsx("div",{className:e.className}):f.jsx(f.Fragment,{})},Hy=function(e){var t,n=e.item;return f.jsx(By,{className:"chat-list-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"chat-list-item",children:[f.jsx(Wy,{item:n,className:"chat-list-item__img",emptyImageVisible:e.emptyImageVisible}),n.title&&f.jsx("div",{className:"chat-list-item__title",children:f.jsx("span",{children:n.title})}),n.subTitle&&f.jsx("div",{className:"chat-list-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(cv,{className:"chat-list-item__actions",buttons:n.buttons,onClick:e.onButtonClick})]})})};var qy=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M 2.5 -15 L -2.5 0 L 2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})};var Yy=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M -2.5 -15 L 2.5 0 L -2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})},Vy=function(e){var t=Z.useRef(null),n=Z.useState(0),r=n[0],a=n[1];function o(e){var n,o,i=t.current;if(i){var s=i.getElementsByClassName("xappw-carousel-items__item"),u=s.length,l=r;1===e?r<u-1&&l++:r>0&&l--;for(var c=0,d=0;d<s.length&&d!==l;d++)c+=null!==(o=null===(n=s.item(d))||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:0;i.scrollLeft=c,a(l)}}var i=1===e.list.items.length,s=e.list.items.some(function(e){return e.imageUrl}),u=e.list.items.map(function(t,n){return f.jsx("div",{className:"xappw-carousel-items__item",children:f.jsx(Hy,{item:t,emptyImageVisible:s,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsxs("div",{className:"xappw-carousel",children:[!i&&f.jsx("div",{className:"xappw-carousel__prev",children:f.jsx(qy,{onClick:function(){return o(-1)}})}),f.jsx("div",{ref:t,className:"xappw-carousel-items ".concat(i?"xappw-carousel-items--one-item":""),children:u}),!i&&f.jsx("div",{className:"xappw-carousel__next",children:f.jsx(Yy,{onClick:function(){return o(1)}})})]})};var Qy=function(e){var t=e.url,n=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:e.className,onClick:n,children:f.jsxs("svg",{viewBox:"0 0 20 20",children:[f.jsx("path",{d:"M17 17H3V3h5V1H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-2z"}),f.jsx("path",{d:"M19 1h-8l3.29 3.29-5.73 5.73 1.42 1.42 5.73-5.73L19 9V1z"})]})})};function $y(e,t){for(var n=-1,r=0,a=t;r<a.length;r++){var o=a[r],i=e.indexOf(o);i>=0&&(n<0||n>=0&&i<n)&&(n=i)}return n}var Ky=[":","/"],Jy=["/"],Gy=["?","#"],Xy=["#"],Zy=[function(e){var t=e.indexOf("://");return t<0?t:t+3},function(e){return $y(e,Ky)},function(e){return":"!==e.charAt(0)?-1:$y(e,Jy)},function(e){var t=$y(e,Gy);return t>=0?t:e.length},function(e){return $y(e,Xy)}];var eb="/...";function tb(e,t){if(e.length<t)return e;var n=function(e){for(var t=[],n=e,r=0,a=Zy;r<a.length;r++){var o=a[r],i=Math.max(0,o(n,e)),s=n.substring(0,i);t.push(s),n=n.substring(i)}return n&&t.push(n),t}(e);function r(){return n.join("")}function a(){return r().length>t}function o(e){a()&&(n[e]="")}if(":80"===n[2]&&"http://"===n[0]&&o(2),":443"===n[2]&&"https://"===n[0]&&o(2),o(5),o(4),o(2),o(0),a()){var i=n[3],s=r().length-i.length,u=t-s;if(u<0)n[3]="";else if(u<i.length){var l=i.length-u+4;n[3]=eb+i.substring(l)}}return r()}var nb=function(e){var t=e.url,n=e.className,r=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:n,onClick:r,children:tb(t,40)})},rb=function(e){var t,n=e.item,r=e.layout||"normal",a=n.url||n.imageActionUrl;return f.jsx(By,{className:"xappw-vlist-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"xappw-vlist-item xappw-vlist-item--".concat(r),children:[f.jsxs("div",{className:"xappw-vlist-item__description",children:[n.title&&f.jsx("div",{className:"xappw-vlist-item__title",children:f.jsx("span",{children:n.title})}),a&&!n.hideUrl&&f.jsxs("div",{className:"xappw-vlist-item__link-row",children:[f.jsx(nb,{url:a,className:"xappw-vlist-item__link"}),f.jsx(Qy,{url:a,className:"xappw-vlist-item__external-link"})]}),n.subTitle&&f.jsx("div",{className:"xappw-vlist-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(cv,{buttons:n.buttons,onClick:e.onButtonClick})]}),f.jsx("div",{className:"xappw-vlist-item__side",children:f.jsx(Wy,{item:n,className:"xappw-vlist-item__img",emptyImageVisible:e.emptyImageVisible})})]})})},ab=function(e){var t=e.list,n=Z.useRef(null),r=t.items.some(function(e){return e.imageUrl}),a=!t.items.some(function(e){var t;return e.subTitle||(null===(t=e.buttons)||void 0===t?void 0:t.length)}),o=t.items.map(function(t,n){return f.jsx("div",{className:"xappw-vlist-container__item",children:f.jsx(rb,{item:t,layout:a?"titles":"normal",emptyImageVisible:r,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsx("div",{className:"xappw-vlist",children:f.jsxs("div",{ref:n,className:"xappw-vlist-container",children:[e.list.title&&f.jsx("div",{className:"xappw-vlist__header",children:e.list.title}),o]})})},ob=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(ob.name));var r=Z.useMemo(function(){return function(e){return{type:e.type,title:e.title,items:e.items.map(function(e){var t,n,r={title:e.title,subTitle:e.description,token:e.token,url:e.url,hideUrl:e.hideUrl,imageUrl:(null===(t=e.image)||void 0===t?void 0:t.url)||e.imageUrl,imageActionUrl:null===(n=e.image)||void 0===n?void 0:n.imageActionUrl},a=e.buttons;return a&&a.length>0&&(r.buttons=a.map(function(e){return{actionUrl:e.openUrlAction,label:e.title}})),r})}}(t)},[t]),a=by(),o=Z.useCallback(function(e,t,n){a(t,{token:n,action:"click",ui:e})},[a]),i=My(),s=n.user;return f.jsxs(vv,{showAvatar:!1,user:s,fullWidth:!0,children:["CAROUSEL"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--fullwidth chat-msg--no-ava",children:f.jsx(Vy,{list:r,onExecute:o.bind(null,"carousel"),onButtonClick:i,onOpenUrl:n.openUrl})}),"LIST"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(ab,{list:r,onExecute:o.bind(null,"list"),onButtonClick:i,onOpenUrl:n.openUrl})})]})},ib=function(){},sb=function(){function e(e){this.cache={},this.template=e}return e.prototype.resolve=function(e){var t,n,r;if(e){var a=this.cache,o=e.nick,i=a[o];return i||(i={user:e,send:null!==(t=this.template.send)&&void 0!==t?t:ib,write:null!==(n=this.template.write)&&void 0!==n?n:ib,openUrl:null!==(r=this.template.openUrl)&&void 0!==r?r:ib},a[o]=i),i}},e}(),ub=function(){return f.jsx(f.Fragment,{})},lb=function(e){var n=e.items,r=e.checked,a=e.onChange,o=Z.useCallback(function(e){var n,o=e.target.value;a(t(t({},r),((n={})[o]=!r[o],n)))},[r,a]);return f.jsx("ul",{className:"xappw-multiselect",children:null==n?void 0:n.map(function(e){return f.jsx("li",{children:f.jsxs("label",{children:[f.jsx("input",{type:"checkbox",checked:r[e.id]||!1,onChange:o,value:e.id}),f.jsx("span",{children:e.title})]})},e.id)})})};var cb=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return t.items},[t]),a=n.user,o=Z.useState({}),i=o[0],s=o[1],u=Z.useCallback(function(){n.send({type:"custom",payload:JSON.stringify({type:"OPTION_SELECT_REQUEST",intentId:"OptionSelect",selected:Object.keys(i).map(function(e){return{id:e}})})})},[n,i]);return f.jsx(vv,{showAvatar:!0,user:a,children:f.jsx("div",{className:"chat-msg",children:f.jsxs("div",{children:[f.jsx(lb,{items:r,checked:i,onChange:s}),f.jsx(uv,{label:"Submit",onClick:u})]})})})},db=function(e){var t=e.table;return f.jsxs("div",{className:"xappw-table",children:[t.title&&f.jsx("div",{className:"xappw-table__header",children:t.title}),f.jsx("div",{className:"xappw-table__container",children:f.jsxs("table",{children:[f.jsx("thead",{children:f.jsx("tr",{children:t.headers.map(function(e,t){return f.jsx("th",{scope:"col",children:e},"".concat(e,"-").concat(t))})})}),f.jsx("tbody",{children:t.rows.map(function(e,t){return f.jsx("tr",{children:e.map(function(e,t){return f.jsx("td",{children:e},t)})},t)})})]})})]})},fb=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(fb.name));return f.jsx(vv,{showAvatar:!1,user:n.user,fullWidth:!0,children:f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(db,{table:t})})})},pb=Ny([function(e){return function(t){var n,r=t.msg,a=t.ctx;return!(n=r)||"LIST"!==n.type&&"CAROUSEL"!==n.type?e(t):f.jsx(ob,{msg:r,ctx:a})}},function(e){return function(t){var n,r=t.msg,a=t.ctx;return(n=r)&&"CARD"===n.type?f.jsx(Ey,{msg:r,ctx:a}):e(t)}},function(e){return function(t){var n=t.msg,r=t.ctx;return"MultiSelect"===n.type?f.jsx(cb,{msg:n,ctx:r}):e(t)}},function(e){return function(t){var n,r=t.msg,a=t.ctx;return(n=r)&&"TABLE"===n.type&&Array.isArray(n.headers)&&Array.isArray(n.rows)?f.jsx(fb,{msg:r,ctx:a}):e(t)}}]);function hb(){var e,t=(e=Ly(),Z.useMemo(function(){return Ny([e,pb])},[e]));return Z.useMemo(function(){return t(ub)},[t])}var vb=pb(ub);function mb(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var gb=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),yb=()=>Math.random().toString(36).substring(7).split("").join("."),bb={INIT:`@@redux/INIT${yb()}`,REPLACE:`@@redux/REPLACE${yb()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yb()}`};function xb(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function wb(e,t,n){if("function"!=typeof e)throw new Error(mb(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(mb(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(mb(1));return n(wb)(e,t)}let r=e,a=t,o=new Map,i=o,s=0,u=!1;function l(){i===o&&(i=new Map,o.forEach((e,t)=>{i.set(t,e)}))}function c(){if(u)throw new Error(mb(3));return a}function d(e){if("function"!=typeof e)throw new Error(mb(4));if(u)throw new Error(mb(5));let t=!0;l();const n=s++;return i.set(n,e),function(){if(t){if(u)throw new Error(mb(6));t=!1,l(),i.delete(n),o=null}}}function f(e){if(!xb(e))throw new Error(mb(7));if(void 0===e.type)throw new Error(mb(8));if("string"!=typeof e.type)throw new Error(mb(17));if(u)throw new Error(mb(9));try{u=!0,a=r(a,e)}finally{u=!1}return(o=i).forEach(e=>{e()}),e}f({type:bb.INIT});return{dispatch:f,subscribe:d,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(mb(10));r=e,f({type:bb.REPLACE})},[gb]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(mb(11));function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[gb](){return this}}}}}function kb(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const a=t[r];"function"==typeof e[a]&&(n[a]=e[a])}const r=Object.keys(n);let a;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:bb.INIT}))throw new Error(mb(12));if(void 0===n(void 0,{type:bb.PROBE_UNKNOWN_ACTION()}))throw new Error(mb(13))})}(n)}catch(e){a=e}return function(e={},t){if(a)throw a;let o=!1;const i={};for(let a=0;a<r.length;a++){const s=r[a],u=n[s],l=e[s],c=u(l,t);if(void 0===c)throw t&&t.type,new Error(mb(14));i[s]=c,o=o||c!==l}return o=o||r.length!==Object.keys(e).length,o?i:e}}function Sb(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function _b(e){return({dispatch:t,getState:n})=>r=>a=>"function"==typeof a?a(t,n,e):r(a)}var Ob=_b(),Cb=_b,Pb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Sb:Sb.apply(null,arguments)},Tb=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};var jb=e=>t=>{setTimeout(t,e)},Mb=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let a=!0,o=!1,i=!1;const s=new Set,u="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(l=window.requestAnimationFrame,c=100,e=>{let t=!1;const n=()=>{t||(t=!0,cancelAnimationFrame(r),clearTimeout(a),e())},r=l(n),a=setTimeout(n,c)}):jb(10):"callback"===e.type?e.queueNotification:jb(e.timeout);var l,c;const d=()=>{i=!1,o&&(o=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>a&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return a=!e?.meta?.RTK_autoBatch,o=!a,o&&(i||(i=!0,u(d))),r.dispatch(e)}finally{a=!0}}})};function Eb(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:a=!0}=e??{};let o=new Tb;return t&&("boolean"==typeof t?o.push(Ob):o.push(Cb(t.extraArgument))),o},{reducer:n,middleware:r,devTools:a=!0,duplicateMiddlewareCheck:o=!0,preloadedState:i,enhancers:s}=e||{};let u;if("function"==typeof n)u=n;else{if(!xb(n))throw new Error(`Minified Redux Toolkit error #${l=1}; visit https://redux-toolkit.js.org/Errors?code=${l} for the full message or use the non-minified dev environment for full errors. `);u=kb(n)}var l;let c;c="function"==typeof r?r(t):t();let d=Sb;a&&(d=Pb({trace:!1,..."object"==typeof a&&a}));const f=function(...e){return t=>(n,r)=>{const a=t(n,r);let o=()=>{throw new Error(mb(15))};const i={getState:a.getState,dispatch:(e,...t)=>o(e,...t)},s=e.map(e=>e(i));return o=Sb(...s)(a.dispatch),{...a,dispatch:o}}}(...c),p=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Tb(e);return n&&r.push(Mb("object"==typeof n?n:void 0)),r})(f);return wb(u,i,d(..."function"==typeof s?s(p):p()))}var Nb=function(){function e(e,t){this.innerStorage=e,this.key=t}return e.prototype.get=function(){return function(e){try{if(e)return JSON.parse(e)}catch(e){}}(this.innerStorage.getItem(this.key))},e.prototype.set=function(e){try{this.innerStorage.setItem(this.key,JSON.stringify(e))}catch(e){!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r={};r[e]||(r[e]=!0,Jh.apply(void 0,t))}("storage","Unable to store redux state")}},e}();function Ib(){return xm()}var Db={displayName:"Visitor",nick:"visitor:",typing:!1};function Rb(e,n){var r;e||(e={}),e.userId=e.userId?e.userId:Ib(),e.visitorId=e.userId;var a=!1;if("undefined"!=typeof window){var o=null===(r=window.localStorage)||void 0===r?void 0:r.getItem("xaErrorOverlay");"enabled"===o?a=!0:"disabled"===o?a=!1:((null==n?void 0:n.enableErrorOverlay)||void 0!==globalThis.__DEV__&&globalThis.__DEV__)&&(a=!0)}return t({connection:{connectionStatus:"offline",token:null,greetingRequested:!1},accountStatus:"offline",departments:{},visitor:Db,agents:{},chats:[],lastTimestamp:0,lastRatingRequestTimestamp:0,hasRating:!1,isChatting:!1,queuePosition:0,failureMsg:null,visitorId:Ib(),chips:[],sessionExpiration:"24h",visuals:{},debugMode:a},e)}var Ab=Rb(),Lb=function(){function e(){this.valuesMap=new Map}return e.prototype.getItem=function(e){var t=String(e);return this.valuesMap.has(e)?String(this.valuesMap.get(t)):null},e.prototype.setItem=function(e,t){this.valuesMap.set(String(e),String(t))},e.prototype.removeItem=function(e){this.valuesMap.delete(e)},e.prototype.clear=function(){this.valuesMap.clear()},e.prototype.key=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'key' on 'Storage': 1 argument required, but only 0 present.");return Array.from(this.valuesMap.keys())[e]},Object.defineProperty(e.prototype,"length",{get:function(){return this.valuesMap.size},enumerable:!1,configurable:!0}),e}();function Ub(e){return"chat.msg"===e.type}function zb(e,t){return function(e,t,n){if(!e.length)return e.push(t),e;if(1===e.length)return 0===(l=n(t,e[0]))?(t===e[0]||e.push(t),e):(l<0?e.unshift(t):e.push(t),e);for(var r=0,a=e.length-1;a-r>0;){var o=e[r],i=e[a],s=n(t,o);if(0===s)return t===o||e.splice(r+1,0,t),e;if(s<0)return e.splice(r,0,t),e;var u=n(t,i);if(0===u)return t===i||e.splice(a+1,0,t),e;if(u>0)return e.splice(a+1,0,t),e;if(a-r<=1)break;var l,c=Math.floor((r+a)/2),d=e[c];if(0===(l=n(d,t))&&t===d)return e;l<=0?r=c:l>0&&(a=c)}return e.splice(r+1,0,t),e}(a([],e,!0),t,function(e,t){return e.timestamp-t.timestamp})}function Fb(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(Ub(n)&&n.isStreaming)return t}return-1}function Bb(e,t){e.chats=zb(e.chats,t),"chat.msg"===t.type&&(e.activeContexts=t.msg.context)}function Wb(e,n){var r,o,i,s,u,l,c,d,f,p,h,v,m,g,y,b,x,w,k,S,_;if(void 0===e&&(e=Ab),Jh("action",n),"reset"===n.type)return function(e){var n;void 0===e&&(e=Ab);var r=Rb({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration}),a="online"===e.connection.connectionStatus,o=null===(n=e.visuals)||void 0===n?void 0:n.opened;return t(t({},r),{connection:t(t({},r.connection),{greetingRequested:!1,nonce:xm(),connectionStatus:a?"online":r.connection.connectionStatus}),accountStatus:a?"online":r.accountStatus,visitor:e.visitor,visitorId:e.visitorId,visuals:{opened:o,hasInteracted:!1}})}(e);switch(n.type){case"connection_update":case"receiveToken":case"sendGreeting":var O=function(e,n){switch(n.type){case"connection_update":return t(t({},e),{connectionStatus:n.detail.status});case"receiveToken":return t(t({},e),{token:n.detail.token});case"sendGreeting":return t(t({},e),{greetingRequested:!0})}return e}(e.connection,n);return e.connection!==O&&(e=t(t({},e),{lastTimestamp:null===(u=n.detail)||void 0===u?void 0:u.timestamp,connection:O})),e;case"account_status":return t(t({},e),{lastTimestamp:null===(l=n.detail)||void 0===l?void 0:l.timestamp,accountStatus:n.detail.status});case"session_id":return t(t({},e),{lastTimestamp:null===(c=n.detail)||void 0===c?void 0:c.timestamp,sessionId:n.detail.sessionId});case"visual_status":return t(t({},e),{lastTimestamp:null===(d=n.detail)||void 0===d?void 0:d.timestamp,visuals:t(t(t(t(t({},e.visuals||{}),void 0!==n.detail.status.drawer&&{drawer:n.detail.status.drawer}),void 0!==n.detail.status.opened&&{opened:n.detail.status.opened}),void 0!==n.detail.status.visible&&{visible:n.detail.status.visible}),void 0!==n.detail.status.hasInteracted&&{hasInteracted:n.detail.status.hasInteracted})});case"toggle_debug_mode":var C=!e.debugMode;return"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlay",C?"enabled":"disabled"),t(t({},e),{debugMode:C});case"ws_button_display":return t(t({},e),{lastTimestamp:null===(f=n.detail)||void 0===f?void 0:f.timestamp,wsButton:{id:n.detail.id,text:n.detail.text||(null===(p=e.wsButton)||void 0===p?void 0:p.text)||"",pressBehavior:n.detail.pressBehavior,isPressed:null!==(h=n.detail.isPressed)&&void 0!==h&&h,isDismissing:null!==(v=n.detail.isDismissing)&&void 0!==v&&v}});case"ws_button_dismiss":return(null===(m=e.wsButton)||void 0===m?void 0:m.id)===n.detail.id?t(t({},e),{lastTimestamp:null===(g=n.detail)||void 0===g?void 0:g.timestamp,wsButton:void 0}):e;case"department_update":return t(t({},e),{lastTimestamp:null===(y=n.detail)||void 0===y?void 0:y.timestamp,departments:t(t({},e.departments),(r={},r[n.detail.id]=t({},n.detail),r))});case"visitor_update":return t(t({},e),{lastTimestamp:null===(b=n.detail)||void 0===b?void 0:b.timestamp,visitor:t(t({},e.visitor),n.detail)});case"agent_update":var P=e.agents[n.detail.nick];return t(t({},e),{lastTimestamp:null===(x=n.detail)||void 0===x?void 0:x.timestamp,agents:t(t({},e.agents),(o={},o[n.detail.nick]=t(t({},P),{user:t(t({},P.user),n.detail),typing:(P||{typing:!1}).typing}),o))});case"chat":var T=t(t({},e),{lastTimestamp:null===(w=n.detail)||void 0===w?void 0:w.timestamp});switch(n.detail.type){case"chat.memberjoin":return function(e,n){var r=t({},e.agents),a=e.agents[n.user.nick];if(r[n.user.nick]=t(t({},a),{user:t(t({},n.user),{displayName:n.user.displayName||"Agent"}),joined:!0,typing:!1,hideUserInfo:n.hideUserInfo}),Rh(n.user.nick)){var o=n.showDivider||n.message;return(null==a?void 0:a.joined)&&!o?Jh('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already joined. NOT adding duplicate join message to chat.")):Jh(o?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining with special visuals (divider or custom message). Adding join message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:(null==a?void 0:a.joined)&&!o?e.chats:zb(e.chats,n),agents:r})}return Jh('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:zb(e.chats,n),agents:r})}(e,n.detail);case"chat.memberleave":return function(e,n){var r=t({},e.agents),a=e.agents[n.user.nick];r[n.user.nick]=t(t({},a),{joined:!1,typing:!1});var o=Object.values(r).filter(function(e){return e.joined}).length>0;if(Rh(n.user.nick)){var i=n.showDivider||n.message;return(null==a?void 0:a.joined)?Jh(i?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving with special visuals (divider or custom message). Adding leave message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")):Jh('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already left. NOT adding duplicate leave message to chat.")),t(t({},e),{isChatting:o,chats:(null==a?void 0:a.joined)?zb(e.chats,n):e.chats,agents:r})}return Jh('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")),t(t({},e),{isChatting:o,chats:zb(e.chats,n),agents:r})}(e,n.detail);case"chat.systemmessage":return Bb(T,n.detail),T;case"chat.systemmessagedismiss":var j=n.detail.id;return t(t({},T),{chats:T.chats.filter(function(e){return!function(e){return"chat.systemmessage"===e.type}(e)||e.id!==j})});case"chat.queue.position":return T.queuePosition=n.detail.queuePosition,T;case"chat.request.rating":return Bb(T,n.detail),t(t({},T),{lastRatingRequestTimestamp:n.detail.timestamp});case"chat.rating":return Bb(T,n.detail),t(t({},T),{hasRating:!!n.detail.newRating});case"chat.file":case"chat.msg":Bb(T,n.detail);var M=n.detail,E="chat.msg"===M.type?M.msg:null;return T.chips=(null===(k=null==E?void 0:E.options)||void 0===k?void 0:k.length)?E.options:[],T;case"chat.failureMsg":var N,I=T.agents[n.detail.user.nick],D=n.detail.failureMsg.retry,R=T;if(1!==D){N=T.chats.filter(function(e){return"chat.failureMsg"===e.type&&e.failureMsg.retry<D})[0];var A=T.chats.filter(function(e){return e!==N});R=t(t({},T),{chats:A})}return Bb(R,n.detail),t(t({},R),{agents:t(t({},R.agents),(i={},i[n.detail.user.nick]=t(t({},I),{typing:!1,requestFailed:!0}),i)),failureMsg:n.detail.failureMsg});case"chat.typing":var L=e.agents[n.detail.user.nick];return t(t({},e),{lastTimestamp:null===(S=n.detail)||void 0===S?void 0:S.timestamp,agents:t(t({},e.agents),(s={},s[n.detail.user.nick]=t(t({},L),{typing:n.detail.typing}),s))});case"chat.stream.start":var U=T.chats.map(function(e){return Ub(e)&&e.isStreaming?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e}),z=zb(U,{type:"chat.msg",user:n.detail.user,timestamp:n.detail.timestamp,msg:{text:""},isStreaming:!0});return t(t({},T),{chats:z,streamingMessageId:n.detail.messageId});case"chat.stream.chunk":var F=n.detail;if(e.streamingMessageId===F.messageId){var B=Fb(e.chats);if(B>=0){var W=F.text;return t(t({},e),{lastTimestamp:null==F?void 0:F.timestamp,chats:e.chats.map(function(e,n){var r;return n===B&&Ub(e)?t(t({},e),{msg:t(t({},e.msg),{text:((null===(r=e.msg)||void 0===r?void 0:r.text)||"")+W})}):e})})}}return e;case"chat.stream.tool_start":Jh("Tool execution started: ".concat(n.detail.toolName));var H=n.detail;if(e.streamingMessageId===H.messageId){var q=Fb(e.chats);if(q>=0)return t(t({},e),{lastTimestamp:H.timestamp,chats:e.chats.map(function(e,n){if(n===q&&Ub(e)){var r=e.toolCalls||[];return t(t({},e),{toolCalls:a(a([],r,!0),[{name:H.toolName,toolCallId:H.toolCallId,displayName:H.displayName,label:H.label,hidden:H.hidden,input:H.toolInput,startTime:H.timestamp,isExecuting:!0}],!1)})}return e})})}return e;case"chat.stream.tool_end":Jh("Tool execution ended: ".concat(n.detail.toolName));var Y=n.detail;if(e.streamingMessageId===Y.messageId){var V=Fb(e.chats);if(V>=0)return t(t({},e),{lastTimestamp:Y.timestamp,chats:e.chats.map(function(e,n){var r;if(n===V&&Ub(e)){var a=null===(r=e.toolCalls)||void 0===r?void 0:r.map(function(e){var n,r;return(Y.toolCallId?e.toolCallId===Y.toolCallId:e.name===Y.toolName&&e.isExecuting)?t(t({},e),{displayName:Y.displayName||e.displayName,label:Y.label,hidden:null!==(n=Y.hidden)&&void 0!==n?n:e.hidden,input:null!==(r=Y.toolInput)&&void 0!==r?r:e.input,result:Y.toolResult,error:Y.toolError,endTime:Y.timestamp,isExecuting:!1}):e});return t(t({},e),{toolCalls:a})}return e})})}return e;case"chat.stream.end":var Q=n.detail;if(e.streamingMessageId===Q.messageId){var $=Fb(e.chats),K=$>=0?e.chats[$]:void 0;if($>=0&&K&&Ub(K)){var J=Q.msg,G=Q.toolCalls||K.toolCalls,X=Q.preserveChips?e.chips:(null===(_=null==J?void 0:J.options)||void 0===_?void 0:_.length)?J.options:[];return t(t({},e),{lastTimestamp:null==Q?void 0:Q.timestamp,streamingMessageId:void 0,chips:X,chats:e.chats.map(function(e,n){return n===$&&Ub(e)?t(t({},e),{msg:J,isStreaming:!1,wasStreamed:!0,toolCalls:G}):e})})}}return e;case"chat.stream.abort":var Z=n.detail;if(e.streamingMessageId===Z.messageId){var ee=Fb(e.chats);if(ee>=0)return t(t({},e),{lastTimestamp:Z.timestamp,streamingMessageId:void 0,chats:e.chats.map(function(e,n){return n===ee&&Ub(e)?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e})})}return e;case"chat.stream.resume":var te=n.detail;if(e.streamingMessageId)return e;for(var ne=-1,re=e.chats.length-1;re>=0;re--){var ae=e.chats[re];if(Ub(ae)&&ae.wasStreamed&&!ae.isStreaming){ne=re;break}}return ne>=0?t(t({},e),{lastTimestamp:te.timestamp,streamingMessageId:te.messageId,chats:e.chats.map(function(e,n){return n===ne&&Ub(e)?t(t({},e),{isStreaming:!0,wasStreamed:!1}):e})}):e;default:return e}default:return Jh("Unhandled redux action: ",n.type),e}}function Hb(e,t){if(void 0===e&&(e=Ab),"synthetic"===t.type){Jh("synthetic action",t);var n=function(e,t){var n;void 0===e&&(e=Ab);var r=((null===(n=t.detail)||void 0===n?void 0:n.timestamp)||+new Date)+1;switch(t.detail.type){case"write_msg":return{type:"chat",detail:{type:"chat.msg",user:t.detail.user,timestamp:r,msg:t.detail.msg}};case"visitor.send.file":return{type:"chat",detail:{type:"chat.file",user:{displayName:e.visitor.displayName,nick:"visitor:"},timestamp:r,attachment:t.detail.attachment}};default:throw new Error("Unknown synthetic action. Detail type: ".concat(t.detail.type))}}(e,t);return Wb(e,n)}return Wb(e,t)}var qb="AdminAccessTimes";function Yb(e,n){var r;n||(n="undefined"!=typeof window?localStorage:new Lb);var a,o=e.connection,i=null===(r=new URL(window.location.href).searchParams)||void 0===r?void 0:r.get("sessionId"),s=(new Date).getTime();if(i){var u=n.getItem(qb),l=u?JSON.parse(u):{};if(l[i])Jh("ChatStore: reusing session: ".concat(i)),l[i].lastAccessMs=s,a=l[i].dataStorageKey;else{if(Object.keys(l).length>=20){var c=function(e){for(var t,n=Number.MAX_VALUE,r=0,a=Object.keys(e);r<a.length;r++){var o=a[r];e[o].lastAccessMs<n&&(t=o,n=e[o].lastAccessMs)}return t}(l);Jh("ChatStore: evicting session: ".concat(c)),n.removeItem(l[c].dataStorageKey),l[c]=void 0}a=Vb(o,i),l[i]={lastAccessMs:s,dataStorageKey:a}}n.setItem(qb,JSON.stringify(l))}else a=Vb(o);var d=function(e,n,r){var a,o=null!==(a=e.get())&&void 0!==a?a:n;return o&&o.visuals&&(o=t(t({},o),{visuals:t(t({},o.visuals),{hasInteracted:void 0,visible:void 0})})),function(t,n){void 0===t&&(t=o);var a=r(t,n);return e.set(a),a}}(new Nb(n,a),Rb({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration},{enableErrorOverlay:e.enableErrorOverlay}),Hb);return Eb({reducer:d,middleware:function(e){return e({thunk:!0})},devTools:!1})}function Vb(e,t){var n="xappchat.".concat(e.serverUrl);return t?e.accountKey?"".concat(n,".").concat(e.accountKey,".").concat(t):"".concat(n,".").concat(t):e.accountKey?"".concat(n,".").concat(e.accountKey):n}function Qb(e,t,n,r){return void 0===r&&(r=Date.now()),!!t&&(r-t>=1e3*function(e){var t=e.match(/(\d+)([dhms]?)/);if(!t)return Gh("Invalid time string: ".concat(e)),0;var n=parseInt(t[1]);switch(t[2]){case"d":return 24*n*60*60;case"h":return 60*n*60;case"m":return 60*n;default:return n}}(e||"4h")&&(a=r,o=new Date(t),i=new Date(a),!(o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate())));var a,o,i}function $b(e){void 0===e&&(e=!1);var t=Z.useState(function(){return!e&&function(e){void 0===e&&(e=window);try{return new URL(e.location.href).searchParams.get(ky)===Sy}catch(e){return!1}}()})[0];return Z.useEffect(function(){t&&function(e){void 0===e&&(e=window);try{var t=new URL(e.location.href);if(!t.searchParams.has(ky))return;t.searchParams.delete(ky),e.history.replaceState(e.history.state,"",t.toString())}catch(e){}}()},[t]),t}function Kb(e){Z.useEffect(function(){if(e){var t=function(e){for(var t="es-",n=0;n<e.length;n++)t+=Jb(e.charAt(n));return t}(e);if(!document.getElementById(t)){var n=document.createElement("script");n.id=t,n.src=e,n.crossOrigin="anonymous",document.head.appendChild(n)}}},[e])}function Jb(e){return e>="0"&&e<="9"||e>="a"&&e<="z"||e>="A"&&e<="Z"?e:"_".concat(e.charCodeAt(0),"_")}var Gb="data-xapp-form-page";function Xb(){return!("undefined"==typeof document||!document.body)&&"true"===document.body.getAttribute(Gb)}function Zb(){var e=Z.useState(Xb),t=e[0],n=e[1];return Z.useEffect(function(){if("undefined"!=typeof document&&document.body&&(n(Xb()),"undefined"!=typeof MutationObserver)){var e=new MutationObserver(function(){n(Xb())});return e.observe(document.body,{attributes:!0,attributeFilter:[Gb]}),function(){return e.disconnect()}}},[]),t}function ex(e){var n,r,a,o,i,s,u=(a=yy(),o=Dh(function(e){return e.visitorId||e.userId}),i=Dh(function(e){return e.accessToken}),s=Dh(function(e){return e.attributes}),Z.useMemo(function(){return{dispatch:a,visitorId:o,accessToken:i,userId:o,attributes:s}},[a,o,i,s])),l=Z.useRef(null),c=Z.useContext(nv),d=null!==(r=null===(n=null==c?void 0:c.env)||void 0===n?void 0:n.isAdmin)&&void 0!==r&&r,f=Dh(function(e){return e.sessionId}),p=Dh(function(e){return Oy(e.chats)});Z.useEffect(function(){if(e&&l.current!==u&&(l.current=u,u.visitorId)){if(u.dispatch(bv({name:"Visitor",visitorId:u.visitorId,userId:u.userId,accessToken:u.accessToken,attributes:t(t({},u.attributes),{currentUrl:window.location.href}),hasConversation:p},f)),!d){var n=setTimeout(function(){var e,t=(void 0===e&&(e=!1),function(t){return function(n,r){e||r().connection.greetingRequested||(Jh("sending greeting"),t.sendChatMsg({text:void 0,attributes:{isGreeting:!0}},function(e){e&&Jh("Error sending message"),n({type:"sendGreeting",detail:void 0})}))}});u.dispatch(t)},1e3);return function(){clearTimeout(n)}}Jh("Admin widget. Not sending greeting.")}},[u,e,d])}var tx={},nx={};Object.defineProperty(nx,"__esModule",{value:!0}),nx.isActionBarChatButton=function(e){return"chat"===e.type},nx.isActionBarFormButton=function(e){return"form"===e.type},nx.isActionBarScheduleButton=function(e){return"schedule"===e.type},nx.isActionBarPhoneButton=function(e){return"phone"===e.type},nx.isActionBarUrlButton=function(e){return"url"===e.type},nx.isActionBarEmailButton=function(e){return"email"===e.type},nx.isActionBarHelpButton=function(e){return"help"===e.type},nx.isActionBarPaymentButton=function(e){return"payment"===e.type};var rx={},ax={};function ox(e,t=2){return(new Array(t).join("0")+e).slice(-t)}function ix(e){const t=null==e?void 0:e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/);if(t)return{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10),a:parseFloat(t[4])};const n=null==e?void 0:e.match(/^rgb?\((\d+),\s*(\d+),\s*(\d+)\)$/);return n?{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10)}:null}function sx(e,t,n){return.299*e+.587*t+.114*n>186}function ux(e,t){if(!e)return;let n=0===e.indexOf("#")?e.slice(1):e;if(3===n.length&&(n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]),6!==n.length)throw new Error("Invalid HEX color.");const r=parseInt(n.slice(0,2),16),a=parseInt(n.slice(2,4),16),o=parseInt(n.slice(4,6),16);return t?sx(r,a,o)?"#000000":"#FFFFFF":`#${ox((255-r).toString(16))}${ox((255-a).toString(16))}${ox((255-o).toString(16))}`}function lx(e,t){const n=ix(e);if(!n)return e;const{r:r,g:a,b:o}=n;return t?sx(r,a,o)?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)":`rgba(${255-r}, ${255-a}, ${255-o}, 1)`}function cx(e){if(!e)return!1;if(e.startsWith("#")){const t=e.slice(1);return(3===t.length||6===t.length)&&/^[0-9a-f]+$/i.test(t)}return null!==ix(e)}
|
|
2
|
+
/*! Copyright (c) 2021, XAPPmedia */function Rh(e){return!!e&&e.startsWith("agent:")}var Ah=function(){this.retries=5,this.timeout=1e3,this.log=!1},Lh=function(){function e(e){e&&(this.options=Object.assign(new Ah,e))}return e.prototype.fetch=function(e,t){return n(this,void 0,void 0,function(){var n,a,o,i;return r(this,function(r){switch(r.label){case 0:t||(t=this.options),r.label=1;case 1:return r.trys.push([1,3,,5]),n=new AbortController,a=setTimeout(function(){n.abort()},t.timeout),[4,e(n.signal)];case 2:return o=r.sent(),clearTimeout(a),[2,o];case 3:if(i=r.sent(),1===t.retries||t.retries<1)throw i;return[4,this.fetch(e,{timeout:t.timeout,retries:t.retries-1})];case 4:return[2,r.sent()];case 5:return[2]}})})},e}();var Uh="xapp-form-js",zh="https://form.xapp.ai/xapp-form-widget.js";function Fh(e){return"".concat(zh,"?key=").concat(encodeURIComponent(e))}function Bh(e){if(document.getElementById(Uh))return!0;if(e)for(var t=Fh(e),n=document.querySelectorAll("script[src]"),r=0;r<n.length;r++){var a=n[r].getAttribute("src");if(a&&(a===t||a.startsWith(zh)))return!0}return!1}function Wh(e){return new Promise(function(t,n){var r=document.createElement("script");r.id=Uh,r.src=Fh(e),r.async=!0,r.onload=function(){t()},r.onerror=function(){n(new Error("Failed to load form-widget script: ".concat(r.src)))},document.head.appendChild(r)})}function Hh(e){return n(this,arguments,void 0,function(e,t,n){var a,o,i;return void 0===t&&(t=3),void 0===n&&(n=1e3),r(this,function(r){switch(r.label){case 0:if(Bh(e))return[2];o=0,r.label=1;case 1:if(!(o<=t))return[3,8];r.label=2;case 2:return r.trys.push([2,6,,7]),o>0?((u=document.getElementById(Uh))&&u.remove(),console.log("[chat-widget] Retrying form-widget script load (attempt ".concat(o+1,"/").concat(t+1,")")),[4,(s=n,new Promise(function(e){return setTimeout(e,s)}))]):[3,4];case 3:r.sent(),r.label=4;case 4:return[4,Wh(e)];case 5:return r.sent(),[2];case 6:return i=r.sent(),a=i,o===t&&console.error("[chat-widget] Failed to load form-widget script after all retries:",i),[3,7];case 7:return o++,[3,1];case 8:throw a||new Error("Failed to load form-widget script")}var s,u})})}function qh(){var e;return"function"==typeof(null===(e=window.xafwControl)||void 0===e?void 0:e.openForm)}function Yh(e){return!!qh()&&(window.xafwControl.openForm(e),!0)}function Vh(e,t,n){return void 0===t&&(t=20),void 0===n&&(n=100),new Promise(function(r){if(Yh(e))r(!0);else var a=0,o=setInterval(function(){if(a++,Yh(e))return clearInterval(o),void r(!0);a>=t&&(clearInterval(o),console.warn("[chat-widget] Form widget not ready after waiting"),r(!1))},n)})}var Qh="xaLogLevel",$h=localStorage.getItem(Qh);function Kh(){return(new Date).toISOString()+" ::"}function Jh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"debug"===window.xaLogLevel&&console.log.apply(console,a([Kh()],e,!1))}function Gh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,a([Kh()],e,!1))}Object.getOwnPropertyDescriptor(window,"xaLogLevel")||Object.defineProperty(window,"xaLogLevel",{get:function(){return this._xaLogLevel},set:function(e){this._xaLogLevel=e,e?localStorage.setItem(Qh,e):localStorage.removeItem(Qh)},configurable:!0,enumerable:!0}),$h&&(window.xaLogLevel=$h),"undefined"!=typeof window&&(window.xapp=window.xapp||{},window.xapp.setLogLevel=function(e){"off"===e?(window.xaLogLevel=null,console.log("Log level set to: off (logs disabled)")):(window.xaLogLevel=e,console.log("Log level set to: ".concat(e)))},window.xapp.getLogLevel=function(){return window.xaLogLevel||"off"});function Xh(){var e=null===document||void 0===document?void 0:document.getElementById("xapp-js"),t=function(e){if(!e)return{path:e};var t=e.lastIndexOf("/"),n="";t>=0&&(n=e.substr(0,t));var r=new URL(e),a=r.hostname;a.endsWith("nitrocdn.com")&&(n="https://widget.xapp.ai");var o=new URLSearchParams(r.search),i=o.get("key");return{path:n,key:i}}(null==e?void 0:e.src);return t}var Zh=process.env.SERVER_URL;process.env.ACCOUNT_KEY;var ev="48",tv="ScheduleButton";var nv=Z.createContext(null);function rv(){var e=Z.useContext(nv);return null==e?void 0:e.env}function av(e){return(null==e?void 0:e.connection)?e.connection:{serverUrl:null==e?void 0:e.serverUrl,accountKey:null==e?void 0:e.accountKey,type:(null==e?void 0:e.direct)?"direct":"websocket"}}function ov(e,t){var n=av(e),r=n.accountKey,a=n.serverUrl,o=n.type,i=n.timeout,s=n.backgroundSleepDelay,u=n.mcp,l=null==e?void 0:e.channelId;return Z.useMemo(function(){return{accountKey:r,serverUrl:a,timeout:i,type:o,nonce:t,backgroundSleepDelay:s,mcp:iv(u,l)}},[r,a,i,o,t,s,u,l])}function iv(e,n){var r;return e?t(t({},e),{channelId:null!==(r=e.channelId)&&void 0!==r?r:n}):e}function sv(e){return e?av(e):{}}var uv=function(e){var t=e.label,n=e.disable,r=e.type,a=e.addClass,o=e.onClick;return f.jsx("button",{disabled:n,type:r,className:"action-button ".concat(a),onClick:function(e){e.stopPropagation(),o&&o(t)},children:t})},lv=Z.memo(function(e){var t=e.button,n=e.onClick,r=Z.useCallback(function(){n(t)},[t,n]);return f.jsx(uv,{onClick:r,addClass:"button-card",label:t.label})}),cv=Z.memo(function(e){return f.jsx("div",{className:"buttons-container "+(e.className||""),children:e.buttons.map(function(t,n){return f.jsx(lv,{button:t,onClick:e.onClick},n)})})}),dv=function(e){var t=e.imageUrl.replace(/'/g,"%27"),n=f.jsx("div",{className:"chat-card-img__content",style:{backgroundImage:"url(".concat(t,")")}});return e.imageActionUrl?f.jsx("a",{href:e.imageActionUrl,"aria-label":"read more",target:"_blank",rel:"noopener noreferrer",className:"chat-card-img",children:n}):f.jsx("div",{className:"chat-card-img",children:n})},fv=function(e){var t,n,r,a,o=e.card;return o.imageUrl&&(r=f.jsx("div",{className:"chat-card-container__img",children:f.jsx(dv,{imageUrl:o.imageUrl,imageActionUrl:o.imageActionUrl})})),o.title&&(n=f.jsx("div",{className:"chat-card-title",children:f.jsx("span",{children:o.title})})),o.content&&(a=f.jsx("div",{className:"chat-card-sub-title",children:f.jsx("span",{children:o.content})})),f.jsxs("div",{className:"chat-card-container",children:[r,n,a,!!(null===(t=o.buttons)||void 0===t?void 0:t.length)&&f.jsx(cv,{buttons:o.buttons,onClick:e.onButtonClick})]})},pv=function(e){var t,n,r,a,o,i,s={},u=e.entity,l=Z.useContext(nv),c=null==u?void 0:u.avatarPath;if(!c){var d=function(e){var t=(null==e?void 0:e.initials)||"?",n=(null==e?void 0:e.size)||40,r=(null==e?void 0:e.backgroundColor)||"#007bff",a=(null==e?void 0:e.textColor)||"#ffffff";return Z.useMemo(function(){return function(e,t,n,r){var a=document.createElement("canvas");a.width=t,a.height=t;var o=a.getContext("2d");o.fillStyle=n,o.fillRect(0,0,t,t),o.fillStyle=r,o.font="".concat(t/2,"px Arial"),o.textAlign="center",o.textBaseline="middle",o.fillText(e,t/2,t/2);var i=new Image;return i.src=a.toDataURL(),i}(t,n,r,a)},[t,n,r,a])}({initials:(null==u?void 0:u.displayName)?u.displayName.slice(0,2):"?",backgroundColor:null===(n=null===(t=null==l?void 0:l.env)||void 0===t?void 0:t.theme)||void 0===n?void 0:n.primaryColor,size:36});c=d.src}var p=u&&Rh(u.nick);p?(s.backgroundImage="url('".concat(c,"')"),s.backgroundColor="none"):i=f.jsx("svg",{width:"16",height:"19",viewBox:"0 0 16 19",style:{margin:"0 auto",display:"block"},children:f.jsx("path",{d:"M11.5 5c0-1.933-1.567-3.5-3.5-3.5S4.5 3.067 4.5 5 6.067 8.5 8 8.5s3.5-1.567 3.5-3.5zM3 5c0-2.76 2.24-5 5-5s5 2.24 5 5-2.24 5-5 5-5-2.24-5-5zM1.955 17.294c.21-.642.504-1.285.898-1.88C3.963 13.74 5.615 12.75 8 12.75c2.385 0 4.038.99 5.147 2.664.394.595.69 1.238.898 1.88.124.382.19.672.214.822.063.41.447.69.856.625.41-.063.69-.447.625-.856-.034-.225-.118-.59-.27-1.053-.247-.763-.598-1.527-1.073-2.244C13.024 12.51 10.917 11.25 8 11.25c-2.916 0-5.024 1.26-6.397 3.336-.475.717-.826 1.48-1.074 2.245-.152.463-.236.83-.27 1.054-.065.41.215.793.624.857.41.065.793-.215.857-.624.025-.15.09-.44.215-.822z",fill:"#FFF",fillRule:"evenodd"})});var h=!!s.backgroundImage||!!i,v=(null===(o=null===(a=null===(r=null==l?void 0:l.env)||void 0===r?void 0:r.connection)||void 0===a?void 0:a.mcp)||void 0===o?void 0:o.showAiBadge)&&(null==u?void 0:u.isAI);return f.jsxs("div",{className:"avatar ".concat(p?"avatar--agent":"avatar--visitor"," ").concat(h?"":"avatar--empty"),style:s,title:u?u.display_name:"Agent",children:[i,v&&f.jsx("span",{className:"avatar__ai-badge",children:"AI"})]})};function hv(e){return f.jsx("div",{className:"xappw-chat-msg-part__avatar",children:f.jsx(pv,{entity:e})})}var vv=function(e){var t,n=null!==(t=e.avatarPosition)&&void 0!==t?t:"left",r="xappw-chat-msg-part"+("below"===n?" xappw-chat-msg-part--avatar-below":"")+("bottom"===n?" xappw-chat-msg-part--avatar-bottom":"")+(e.fullWidth?" xappw-chat-msg-part--full-width":"")+(e.isStreaming?" xappw-chat-msg-part--streaming":""),a=e.user,o=e.hideUserInfo&&"bottom"===n;return f.jsx("div",{className:r,children:"left"===n?f.jsxs(f.Fragment,{children:[e.showAvatar&&hv(a),e.children]}):f.jsxs(f.Fragment,{children:[e.children,e.showAvatar&&!o&&f.jsxs("div",{className:"xappw-chat-msg-part__avatar-wrapper",children:[hv(a),(null==a?void 0:a.displayName)&&f.jsx("div",{className:"xappw-chat-msg-part__avatar-name",children:a.displayName})]})]})})};function mv(e,t,n){return{type:"synthetic",detail:{type:"write_msg",user:t,msg:e,timestamp:void 0!==n?n:+new Date}}}function gv(e,n){return function(r){return function(a,o){var i=o().attributes;i=t(t({},i),{currentUrl:window.location.href});var s=n||{},u=s.token,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(s,["token"]);i=t(t({},i),l);var c=o().visitor,d=+new Date;a(mv({text:u?"".concat(e," (from the list)"):e},c,d)),r.sendChatMsg({text:e,token:u,attributes:i},function(e){e&&Jh("Error sending message",e)})}}}function yv(e){return function(t){return function(){t.sendTyping(e)}}}function bv(e,t){return function(n){return function(){n.setVisitorInfo(e,t,function(e){e&&Jh(e)})}}}function xv(e){return{type:"account_status",detail:{status:e,timestamp:+new Date}}}function wv(e){return{type:"connection_update",detail:{status:e,timestamp:+new Date}}}function kv(e){return{type:"ws_button_display",detail:{id:e.id,text:e.text,pressBehavior:e.pressBehavior,isPressed:e.isPressed,isDismissing:e.isDismissing,timestamp:+new Date}}}function Sv(e){throw new Error("Unknown kind "+e)}var _v=function(){return Eh()},Ov=function(){function e(e){this.inner=e}return e.prototype.bargeOut=function(e){Jh("CLIENT: bargeOut"),this.inner.bargeOut(e)},e.prototype.bargeIn=function(e,t){Jh("CLIENT: bargeIn: ".concat(e)),this.inner.bargeIn(e,t)},e.prototype.init=function(e){this.inner.init(e)},e.prototype.sendOfflineMsg=function(e,t){Jh("CLIENT: sendOfflineMsg: ".concat(JSON.stringify(e))),this.inner.sendOfflineMsg(e,t)},e.prototype.sendChatMsg=function(e,t){Jh("CLIENT: sendChatMsg: ".concat(JSON.stringify(e))),this.inner.sendChatMsg(e,t)},e.prototype.sendChatMsgRequest=function(e,t){Jh("CLIENT: sendChatMsgRequest: ".concat(JSON.stringify(e))),this.inner.sendChatMsgRequest(e,t)},e.prototype.sendTyping=function(e){Jh("CLIENT: sendTyping: ".concat(JSON.stringify(e))),this.inner.sendTyping(e)},e.prototype.setVisitorInfo=function(e,t,n){Jh("CLIENT: setVisitorInfo: ".concat(JSON.stringify(e)," session id: ").concat(t)),this.inner.setVisitorInfo(e,t,n)},e.prototype.sendChatRating=function(e){Jh("CLIENT: sendChatRating: ".concat(JSON.stringify(e))),this.inner.sendChatRating(e)},e.prototype.sendFile=function(e,t){Jh("CLIENT: sendFile: ".concat(JSON.stringify(e))),this.inner.sendFile(e,t)},e.prototype.markAsRead=function(){Jh("CLIENT: markAsRead:"),this.inner.markAsRead()},e.prototype.flush=function(){Jh("CLIENT: flush:"),this.inner.flush()},e.prototype.dispose=function(){Jh("CLIENT: dispose:"),this.inner.dispose()},e.prototype.sleep=function(){Jh("CLIENT: sleep:"),this.inner.sleep()},e.prototype.wakeup=function(){Jh("CLIENT: wakeup:"),this.inner.wakeup()},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return Jh("CLIENT: sendButtonPressed: ".concat(e)),this.inner.sendButtonPressed?[2,this.inner.sendButtonPressed(e)]:[2]})})},e.prototype.notifyDisconnecting=function(){Jh("CLIENT: notifyDisconnecting:"),this.inner.notifyDisconnecting&&this.inner.notifyDisconnecting()},e}(),Cv=f,Pv=Z;var Tv=function(e){var t=e.format,n=e.text;return Cv.jsx("span",{"data-rich-text-type":"bold",className:"xapp-search-rich-text-bold-span",children:n.substring(t.start,t.end)})},jv=function(e){var t=e.format,n=e.text,r=e.readOnly,a=e.onClick,o=t.text||n.substring(t.start,t.end),i=Pv.useState(o),s=i[0],u=i[1],l=Pv.useCallback(function(e){u(e.target.value)},[]),c=Pv.useCallback(function(e){a&&(!1===a(t)&&(e.preventDefault(),e.stopPropagation()))},[a,t]);return r?Cv.jsx("span",{className:"xapp-search-rich-text-input-span xapp-search-rich-text-input-span--readonly",onClick:c,children:o}):Cv.jsx("input",{type:"text",value:s,className:"xapp-search-rich-text-input-span","data-rich-text-type":"inputText",onChange:l,onClick:c,readOnly:r})},Mv=function(e){var t=e.format,n=e.text;return Cv.jsx("span",{"data-rich-text-type":"normal",className:"xapp-search-rich-text-normal-span",children:n.substring(t.start,t.end)})},Ev=function(e){var t=e.format,n=e.text,r=e.readOnly,a=e.onClick,o=t.type;switch(o){case"normal":return Cv.jsx(Mv,{text:n,format:t,readOnly:r});case"bold":return Cv.jsx(Tv,{text:n,format:t,readOnly:r});case"inputText":return Cv.jsx(jv,{text:n,format:t,readOnly:r,onClick:a});default:!function(e){throw new Error("Unknown kind "+e)}(o)}};function Nv(e){var t=e.childNodes,n=[],r="";return t.forEach(function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e,a="INPUT"===t.tagName?t.value:t.innerText,o=t.dataset.richTextType;n.push({type:o,start:r.length,end:r.length+a.length}),r+=a}e.nodeType===Node.TEXT_NODE&&((a=e.nodeValue)&&(n.push({type:"normal",start:r.length,end:r.length+a.length}),r+=a))}),function(e){for(var t=e.text,n=[],r=0,a=e.formats;r<a.length;r++){var o=a[r],i=o.type;switch(i){case"normal":continue;case"inputText":n.push(o);break;case"bold":if(n.length>0){var s=n[n.length-1];s.type===i&&s.end===o.start&&(n.pop(),n.push({type:i,start:s.start,end:o.end}))}else n.push(o)}}return{text:t,formats:n}}({text:r,formats:n})}var Iv=function(e){var t=e.value,n=e.className,r=e.readOnly,a=e.onInput,o=e.onChange,i=e.onSpanClick,s=t.formats,u=t.text,l=Pv.useMemo(function(){return function(e,t){for(var n=[],r=0,a=0,o=e;a<o.length;a++){var i=o[a],s=i.start,u=i.end,l=i.type,c=i.text;r<s&&n.push({type:"normal",start:r,end:s}),n.push({type:l,start:s,end:u,text:c}),r=u}return r<t&&n.push({type:"normal",start:r,end:t}),n}(s,u.length)},[s,u.length]),c=Pv.useCallback(function(e){var t=Nv(e.currentTarget);a&&a(t)},[a]),d=Pv.useCallback(function(e){var t=e.currentTarget,n=Nv(t);!function(e){for(var t,n=[],r=e.childNodes,a=0;a<r.length;a++)(null==(s=r.item(a))?void 0:s.nodeType)===Node.TEXT_NODE&&n.push(s);for(var o=0,i=n;o<i.length;o++){var s=i[o];try{null===(t=s.parentElement)||void 0===t||t.removeChild(s)}catch(e){}}}(t),o&&o(n)},[o]);return Cv.jsx("div",{id:e.id,className:"xapp-search-rich-text ".concat(n||""),contentEditable:!r,suppressContentEditableWarning:!0,onInput:c,onBlur:d,onKeyDown:e.onKeyDown,children:l.map(function(e,t){return Cv.jsx(Ev,{format:e,text:u,readOnly:r,onClick:i},t)})})},Dv=function(e){return Cv.jsx("div",{className:"xappw-suggestions-group-heading",children:e.label})};var Rv=function(e){var t=e.data,n=e.current,r=e.actions,a=e.onClick,o=e.onHover,i=e.onSpanClick,s=Pv.useCallback(function(){a(t)},[t,a]),u=Pv.useCallback(function(){o&&o(t)},[t,o]),l=Pv.useCallback(function(e){if(i)return i(t,e)},[i,t]),c=Pv.useRef(null);return Pv.useEffect(function(){var e=c.current;if(n&&e){var t=function(e){for(var t=e;t&&!t.classList.contains("xapp-search-result__suggestions");)t=t.parentElement;return t||void 0}(e);if(t){var r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(r.top,a.top);Math.min(r.bottom,a.bottom)-o<.99*a.height&&e.scrollIntoView({behavior:"smooth"})}}},[n]),Cv.jsxs("div",{ref:c,className:"xappw-suggestions-item ".concat(n?"xappw-suggestions-item--current":""),onClick:s,onMouseEnter:u,children:[Cv.jsx(Iv,{value:t,className:"xappw-suggestions-item__texts",readOnly:!0,onSpanClick:l}),r&&Cv.jsx("div",{className:"xappw-suggestions-item__actions",children:Cv.jsx(r,{data:t,current:n})})]})},Av=function(e){var t=e.group,n=e.currentIndex,r=e.itemActions,a=t.heading,o=t.items;return Cv.jsxs("div",{className:"xappw-suggestions-group",children:[Cv.jsx("div",{className:"xappw-suggestions-group__heading",children:Cv.jsx(Dv,{label:a})}),Cv.jsx("div",{className:"xappw-suggestions-group__items",children:o.map(function(t,a){return Cv.jsx(Rv,{data:t,current:n===a,actions:r,onClick:e.onItemClick,onHover:e.onItemHover,onSpanClick:e.onSpanClick},a)})})]})};function Lv(e){return e.reduce(function(e,t){return e+t.items.length},0)}var Uv=function(){return Uv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Uv.apply(this,arguments)};function zv(e,t,n,r){return new(n||(n=Promise))(function(t,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function i(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){e.done?t(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(o,i)}s((r=r.apply(e,[])).next())})}function Fv(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(6===s[0]&&o.label<a[1]){o.label=a[1],a=s;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function Bv(e,t,n){for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Wv=["FAQ","INTENT","HISTORICAL"].reduce(function(e,t,n){return e[t]=n,e},{});function Hv(e,t){return Bv([],e).sort(function(e,n){return function(e,t,n){return n*(Wv[t.type]-Wv[e.type])}(e,n,t)})}function qv(e){var t=Object.keys(e)[0],n=e[t];if(!n)throw new Error;return{type:t,start:n.start,end:n.end}}function Yv(e){switch(e){case"FAQ":return"FAQs";case"INTENT":case"HISTORICAL":return"Suggestions";default:return e}}var Vv={};function Qv(){}var $v=Bv(Bv([],["utm_source","utm_medium","utm_campaign","utm_term","utm_content"]),["gclid","gbraid","wbraid","msclkid","fbclid"]),Kv="xa_tracking_";var Jv="data-xapp-scroll-lock",Gv="data-xapp-scroll-lock-restore",Xv=["position","top","left","right","width","overflow"];function Zv(e){var t=Number(e.getAttribute(Jv));return Number.isFinite(t)&&t>0?t:0}function em(){if("undefined"==typeof document||"undefined"==typeof window)return function(){};var e=document.body;if(0===Zv(e)){var t=function(e){var t=Xv.reduce(function(t,n){return t[n]=e.style.getPropertyValue(n),t},{});return{scrollY:window.scrollY||window.pageYOffset||0,inlineStyles:t}}(e);e.setAttribute(Gv,JSON.stringify(t)),e.style.position="fixed",e.style.top="-".concat(t.scrollY,"px"),e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden"}e.setAttribute(Jv,String(Zv(e)+1));var n=!1;return function(){if(!n){n=!0;var t=Zv(e)-1;if(t>0)e.setAttribute(Jv,String(t));else if(!(t<0)){e.removeAttribute(Jv);var r=function(e){var t=e.getAttribute(Gv);e.removeAttribute(Gv);try{var n=JSON.parse(t||"");if(n&&"number"==typeof n.scrollY&&n.inlineStyles)return n}catch(e){}return{scrollY:0,inlineStyles:{}}}(e),a=r.scrollY,o=r.inlineStyles;Xv.forEach(function(t){o[t]?e.style.setProperty(t,o[t]):e.style.removeProperty(t)}),e.style.length||e.removeAttribute("style"),window.scrollTo(0,a)}}}}var tm="--xapp-viewport-height",nm="--xapp-viewport-offset-top",rm="--xapp-keyboard-inset",am="data-xapp-viewport-subscribers";function om(e){var t=Number(e.getAttribute(am));return Number.isFinite(t)&&t>0?t:0}function im(e){var t="undefined"==typeof window?void 0:window.visualViewport;if(t){var n=t.height,r=t.offsetTop;if(n>0){var a=window.innerHeight||n,o=Math.max(0,a-n),i=o>=120?o:0;e.style.setProperty(tm,"".concat(Math.round(n),"px")),e.style.setProperty(nm,"".concat(Math.round(r),"px")),e.style.setProperty(rm,"".concat(Math.round(i),"px"))}}}function sm(){if("undefined"==typeof document)return function(){};var e=document.documentElement;e.setAttribute(am,String(om(e)+1)),im(e);var t,n="undefined"==typeof window?void 0:window.visualViewport,r=function(){void 0===t&&(t=window.requestAnimationFrame(function(){t=void 0,im(e)}))};null==n||n.addEventListener("resize",r),null==n||n.addEventListener("scroll",r);var a=!1;return function(){if(!a){a=!0,null==n||n.removeEventListener("resize",r),null==n||n.removeEventListener("scroll",r),void 0!==t&&(window.cancelAnimationFrame(t),t=void 0);var o=om(e)-1;o>0?e.setAttribute(am,String(o)):(e.removeAttribute(am),function(e){e.style.removeProperty(tm),e.style.removeProperty(nm),e.style.removeProperty(rm)}(e))}}}var um=function(e){var t=e.icon;return Cv.jsx("div",{tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"xapp-search-icon-button ".concat(e.className||""),onClick:e.onClick,children:Cv.jsx("div",{className:"xapp-search-icon-button__content",children:Cv.jsx(t,{})})})},lm=function(e){var t=e.id,n=e.value,r=e.type,a=e.autoFocus,o=e.spellCheck,i=e.tabIndex,s=e.maxLength,u=e.enterKeyHint,l=e.onChange,c=e.onInput,d=e.onKeyDown,f=e.onSearch,p=n.formats.some(function(e){return"inputText"===e.type}),h=u||("search"===r?"search":"send"),v=Pv.useCallback(function(e){l&&l({text:e.target.value,formats:[]})},[l]),m=Pv.useCallback(function(e){l&&l(e)},[l]),g=Pv.useCallback(function(e){c&&c({text:e.target.value,formats:[]})},[c]),y=Pv.useCallback(function(e){c&&c(e)},[c]),b=Pv.useCallback(function(e){d&&d(e)},[d]),x=Pv.useRef(null),w=x.current;return Pv.useEffect(function(){if(w&&f){var e=function(e){var t=e.target;t&&f({text:t.value,formats:[]})};return w.addEventListener("search",e),function(){w.removeEventListener("search",e)}}},[w,f]),Cv.jsx("div",{className:"xappw-rich-input ".concat(e.className),children:p?Cv.jsx(Iv,{id:t,value:n,onChange:m,onInput:y,onKeyDown:b,className:"xappw-rich-input__input ".concat(e.className,"__input")}):Cv.jsx("input",{id:t,ref:x,type:r,value:n.text,autoComplete:"off",enterKeyHint:h,autoFocus:a,placeholder:e.placeholder,spellCheck:o,tabIndex:i?Number(i):0,maxLength:s,className:"xappw-rich-input__input ".concat(e.className,"__input"),onFocus:e.onFocus,onChange:v,onInput:g,onKeyDown:b})})},cm=function(e){var t=e.suggestions,n=e.itemActions,r=e.className,a=Pv.useMemo(function(){return t?Lv(t):0},[t])>=0?e.index:NaN,o=0;return Cv.jsx("div",{className:"xappw-suggestions-list ".concat(r||""),children:null==t?void 0:t.map(function(t,r){var i=Cv.jsx(Av,{group:t,currentIndex:a-o,itemActions:n,onItemClick:e.onItemClick,onItemHover:e.onItemHover,onSpanClick:e.onSpanClick},r);return o+=t.items.length,i})})},dm=function(e){return function(){try{return"1"===sessionStorage.getItem("xa_test")}catch(e){return!1}}()&&(e.xaTest=!0,delete e.rwg_token),e},fm=function(e,t){if(t>=0)for(var n=0,r=e;n<r.length;n++)for(var a=0,o=r[n].items;a<o.length;a++){var i=o[a];if(t<=0)return i;t--}},pm=function(e){void 0===e&&(e=window.location.href);var t,n=function(e){var t;try{t=new URL(e)}catch(e){return{}}var n={};return $v.forEach(function(e){var r=t.searchParams.get(e);r&&function(e){return e.length<=255&&!/[<>"'\x00-\x1f]/.test(e)}(r)&&(n[e]=r)}),n}(e);return Object.keys(n).length>0&&function(e,t){void 0===t&&(t=30);var n=Date.now()+24*t*60*60*1e3;Object.entries(e).forEach(function(e){var t=e[0],r=e[1];if(r)try{localStorage.setItem("".concat(Kv).concat(t),JSON.stringify({value:r,expires:n}))}catch(e){}})}(n),Uv(Uv({},(t={},$v.forEach(function(e){var n,r="".concat(Kv).concat(e);try{n=localStorage.getItem(r)}catch(e){return}if(n)try{var a=JSON.parse(n);a&&a.expires>Date.now()&&"string"==typeof a.value?t[e]=a.value:localStorage.removeItem(r)}catch(e){localStorage.removeItem(r)}}),t)),n)},hm=Lv,vm=function(e,t){if(void 0===t&&(t=1),e)return Hv(e.suggestions,t).reduce(function(e,t){var n,r,a={text:(n=t).suggestion,content:n.answer,formats:(r=n.format,r.map(qv)),type:n.type};if(e.length){var o=e[e.length-1];if(o.heading===Yv(t.type))return o.items.push(a),e}return e.push({heading:Yv(t.type),items:[a]}),e},[])},mm=function(e){if(e)try{var t=new URL(e);return t.origin+t.pathname}catch(e){return}},gm=function(e){void 0===e&&(e=!0),Pv.useEffect(function(){if(e)return em()},[e])},ym=function(e){var t=e.url,n=e.context,r=e.query,a=Pv.useMemo(function(){if(t){var e=new URLSearchParams;return e.append("size","5"),e.append("queryText",r),(null==n?void 0:n.length)&&e.append("activeContexts",n.join(",")),function(e,t){var n=new URL(e).searchParams;t.forEach(function(e,t){n.append(t,e)});var r=new URL(e);return r.search=n.toString(),r}(t,e)}},[r,n,t]),o=function(e,t){void 0===t&&(t=Vv);var n=Pv.useState({state:"paused"}),r=n[0],a=n[1],o=t.pause;return Pv.useEffect(function(){if(o)return a({state:"paused"}),Qv;var t=new AbortController,n=t.signal,r=!0;return function(){zv(this,0,void 0,function(){var t,o,i;return Fv(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,5]),a({state:"fetching"}),[4,fetch(e,{signal:n})];case 1:return t=s.sent(),r?[4,t.json()]:[3,3];case 2:o=s.sent(),t.ok?a({state:"success",data:o}):a({state:"error",error:o}),s.label=3;case 3:return[3,5];case 4:if("AbortError"===(i=s.sent()).name)return a({state:"paused"}),[2];throw i;case 5:return[2]}})})}(),function(){r=!1,t.abort()}},[e,o]),r}(a?"".concat(a.toString()):"",{pause:!r||!t});return o},bm=function(e){void 0===e&&(e=!0),Pv.useEffect(function(){if(e)return sm()},[e])},xm=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-65xx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})},wm={},km={},Sm={};function _m(){return{data:"",event:"",id:"",retry:void 0}}function Om(e){var t=Number(null==e?void 0:e.statusCode);return!(Number.isFinite(t)&&t>=100&&t<=599)}function Cm(e){var t=e.items,n=[{retry:0,delay:10,text:""}];if(Array.isArray(t)&&t.length>0)for(var r=0;r<t.length;r++)n.push({retry:r+1,delay:t[r].delay,text:t[r].text});return n}function Pm(e){return{type:"session_id",detail:{sessionId:e,timestamp:(new Date).getTime()}}}Object.defineProperty(Sm,"__esModule",{value:!0}),Sm.getMessages=Sm.getLines=Sm.getBytes=void 0,Sm.getBytes=async function(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)},Sm.getLines=function(e){let t,n,r,a=!1;return function(o){void 0===t?(t=o,n=0,r=-1):t=function(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(t,o);const i=t.length;let s=0;for(;n<i;){a&&(10===t[n]&&(s=++n),a=!1);let o=-1;for(;n<i&&-1===o;++n)switch(t[n]){case 58:-1===r&&(r=n-s);break;case 13:a=!0;case 10:o=n}if(-1===o)break;e(t.subarray(s,o),r),s=n,r=-1}s===i?t=void 0:0!==s&&(t=t.subarray(s),n-=s)}},Sm.getMessages=function(e,t,n){let r=_m();const a=new TextDecoder;return function(o,i){if(0===o.length)null==n||n(r),r=_m();else if(i>0){const n=a.decode(o.subarray(0,i)),s=i+(32===o[i+1]?2:1),u=a.decode(o.subarray(s));switch(n){case"data":r.data=r.data?r.data+"\n"+u:u;break;case"event":r.event=u;break;case"id":e(r.id=u);break;case"retry":const n=parseInt(u,10);isNaN(n)||t(r.retry=n)}}}},function(e){var t=o&&o.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.fetchEventSource=e.EventStreamContentType=void 0;const n=Sm;e.EventStreamContentType="text/event-stream";const r="last-event-id";function a(t){const n=t.headers.get("content-type");if(!(null==n?void 0:n.startsWith(e.EventStreamContentType)))throw new Error(`Expected content-type to be ${e.EventStreamContentType}, Actual: ${n}`)}e.fetchEventSource=function(o,i){var{signal:s,headers:u,onopen:l,onmessage:c,onclose:d,onerror:f,openWhenHidden:p,fetch:h}=i,v=t(i,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((t,i)=>{const m=Object.assign({},u);let g;function y(){g.abort(),document.hidden||_()}m.accept||(m.accept=e.EventStreamContentType),p||document.addEventListener("visibilitychange",y);let b=1e3,x=0;function w(){document.removeEventListener("visibilitychange",y),window.clearTimeout(x),g.abort()}null==s||s.addEventListener("abort",()=>{w(),t()});const k=null!=h?h:window.fetch,S=null!=l?l:a;async function _(){var e;g=new AbortController;try{const e=await k(o,Object.assign(Object.assign({},v),{headers:m,signal:g.signal}));await S(e),await n.getBytes(e.body,n.getLines(n.getMessages(e=>{e?m[r]=e:delete m[r]},e=>{b=e},c))),null==d||d(),w(),t()}catch(t){if(!g.signal.aborted)try{const n=null!==(e=null==f?void 0:f(t))&&void 0!==e?e:b;window.clearTimeout(x),x=window.setTimeout(_,n)}catch(e){w(),i(e)}}}_()})}}(km),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EventStreamContentType=e.fetchEventSource=void 0;var t=km;Object.defineProperty(e,"fetchEventSource",{enumerable:!0,get:function(){return t.fetchEventSource}}),Object.defineProperty(e,"EventStreamContentType",{enumerable:!0,get:function(){return t.EventStreamContentType}})}(wm);var Tm=[{retry:0,delay:0,text:""},{retry:1,delay:3,text:"Having trouble connecting. Retrying in ${sec} seconds..."},{retry:2,delay:5,text:"Still having trouble. Retrying in ${sec} seconds..."},{retry:0,delay:0,text:"Unable to connect to the assistant. Please try again later."}],jm="xapp_mcp_userId",Mm="xapp_mcp_sessionId";function Em(e,t){if("undefined"!=typeof window&&window.localStorage)try{e&&localStorage.setItem(jm,e),t&&localStorage.setItem(Mm,t)}catch(e){}}function Nm(e){if("undefined"!=typeof window&&window.localStorage)try{localStorage.removeItem(Mm),e&&function(e){if("undefined"==typeof window||!window.sessionStorage)return;try{sessionStorage.removeItem("xapp_mcp_lastSeq_".concat(e))}catch(e){}}(e)}catch(e){}}function Im(){if("undefined"!=typeof window){var e=pm(window.location.href);return Object.keys(e).length>0?e:void 0}}function Dm(e){var t,n=function(e){void 0===e&&(e=new Date);var t=-e.getTimezoneOffset(),n=t>=0?"+":"-",r=function(e){return String(Math.abs(e)).padStart(2,"0")},a=Math.floor(Math.abs(t)/60),o=Math.abs(t)%60;return"".concat(e.getFullYear(),"-").concat(r(e.getMonth()+1),"-").concat(r(e.getDate()))+"T".concat(r(e.getHours()),":").concat(r(e.getMinutes()),":").concat(r(e.getSeconds()))+"".concat(n).concat(r(a),":").concat(r(o))}();if(e&&Object.keys(e).length>0)return Jh("[getPageContext] Using override: ".concat(JSON.stringify(e))),{url:e.url,path:e.path,title:e.title,referrer:e.referrer,attribution:null!==(t=e.attribution)&&void 0!==t?t:Im(),localTime:n};if("undefined"==typeof window)return{localTime:n};var r=window.location.origin+window.location.pathname,a=mm(document.referrer);return{url:r,path:window.location.pathname,title:document.title||void 0,referrer:a,attribution:Im(),localTime:n}}var Rm=function(){function e(e,t){var n;if(this._userId="",this._sessionId="",this._accessToken="",this._debugMode=!1,this._attributes={},this.streamBuffer="",this.isInitializingSession=!1,this.isValidatingSession=!1,this.conversationOnScreen=!1,this.currentToolCalls=[],this.isReplaying=!1,this.isSleeping=!1,this.isRequestingReplay=!1,this.needsReplayOnWakeup=!1,this.userIdIsServerAssigned=!1,this.sentMessageCount=0,this.config=e,this.options=t,this.configurableMessages=null==t?void 0:t.configurableMessages,this.isNewSession=!1,this._debugMode=null!==(n=e.debugMode)&&void 0!==n&&n,this.hooks=null==t?void 0:t.hooks,"business_owner"===(e.mode||"homeowner")&&!e.authToken)throw new Error("authToken is required for business_owner mode");var r=function(){if("undefined"==typeof window||!window.localStorage)return{};try{return{userId:localStorage.getItem(jm)||void 0,sessionId:localStorage.getItem(Mm)||void 0}}catch(e){return{}}}();r.userId&&(this._userId=r.userId,this.userIdIsServerAssigned=!0,Jh("[MCPChat] Loaded stored userId: ".concat(this._userId))),r.sessionId&&(this._sessionId=r.sessionId,Jh("[MCPChat] Loaded stored sessionId: ".concat(this._sessionId))),e.sessionId&&(this._sessionId=e.sessionId),this._sessionId&&(this.lastSeq=function(e){if("undefined"!=typeof window&&window.sessionStorage)try{var t=sessionStorage.getItem("xapp_mcp_lastSeq_".concat(e));return t?parseInt(t,10):void 0}catch(e){return}}(this._sessionId),void 0!==this.lastSeq&&Jh("[MCPChat] Loaded stored lastSeq: ".concat(this.lastSeq)))}return e.prototype.init=function(e){this.dispatch=e,this.sessionStartTime=Date.now();var t=this.config.mode||"homeowner";Jh("MCPChat initialized with mode: ".concat(t)),"business_owner"!==t||this.config.serverUrl.startsWith("https://")||Gh("WARNING: Using non-HTTPS URL with authentication tokens. This is insecure in production."),this.setConnectionStatus("online"),this.setAccountStatus("online"),this.userJoined(this.getBot(void 0))},e.prototype.validateSession=function(){return n(this,void 0,void 0,function(){var e,n;return r(this,function(r){switch(r.label){case 0:e=this.getEndpoint(),Jh("Validating existing session at ".concat(e,", sessionId: ").concat(this._sessionId)),this.isValidatingSession=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload(t({resumeSession:!0},this.conversationOnScreen&&{continueConversation:!0})))];case 2:return r.sent(),Jh("Session validation complete"),[3,5];case 3:return n=r.sent(),Gh("Failed to validate session: ".concat(n)),Nm(this._sessionId),this._sessionId="",this.lastSeq=void 0,this.initializeNewSession(),[3,5];case 4:return this.isValidatingSession=!1,[7];case 5:return[2]}})})},e.prototype.buildRequestPayload=function(e){return void 0===e&&(e={}),t(t({userId:this._userId||void 0,sessionId:this._sessionId||void 0,fingerprint:this.config.disableFingerprinting?void 0:"undefined"==typeof window?{}:{userAgent:navigator.userAgent,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenResolution:"".concat(window.screen.width,"x").concat(window.screen.height),platform:(n=navigator.userAgentData,(null==n?void 0:n.platform)?n.platform:navigator.platform||void 0),colorDepth:window.screen.colorDepth,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0},pageContext:Dm(this.config.pageContextOverride),channelId:this.config.channelId||void 0,clientTime:(new Date).toISOString(),lastSeq:this.lastSeq},this._debugMode&&{debug:!0}),e);var n},e.prototype.initializeNewSession=function(){return n(this,void 0,void 0,function(){var e,t,n,a,o=this;return r(this,function(r){switch(r.label){case 0:if(this._debugMode=null!==(a=this.config.debugMode)&&void 0!==a&&a,this.isInitializingSession)return Jh("New session initialization already in progress, skipping"),[2];e=this.getEndpoint(),Jh("Initializing new session at ".concat(e)),this.isInitializingSession=!0,this.sessionInitPromise=new Promise(function(e){o.resolveSessionInit=e}),this.typing(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload({newSession:!0,generateGreeting:!0}))];case 2:return r.sent(),[3,5];case 3:return t=r.sent(),n=null==t?void 0:t.statusCode,Gh("Failed to initialize new session: ".concat(t,", statusCode: ").concat(n)),this.stopTyping(),Om(t)&&this.setConnectionStatus("offline"),this.sendFailureMessage(0,0,this.getErrorMessage(t,n)),[3,5];case 4:return this.isInitializingSession=!1,this.resolveSessionInit&&(this.resolveSessionInit(),this.resolveSessionInit=void 0),this.sessionInitPromise=void 0,[7];case 5:return[2]}})})},e.prototype.setConnectionStatus=function(e){Jh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(wv(e))},e.prototype.setAccountStatus=function(e){Jh("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(xv(e))},e.prototype.getEndpointPaths=function(){return"business_owner"===(this.config.mode||"homeowner")?["/api/chat/stream","/api/chat/close"]:["/chat/stream","/chat/close"]},e.prototype.getBaseUrl=function(){for(var e=this.config.serverUrl.replace(/\/+$/,""),t=0,n=this.getEndpointPaths();t<n.length;t++){var r=n[t];if(e.endsWith(r))return e.slice(0,-r.length)}return e},e.prototype.getEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[0])},e.prototype.getCloseEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[1])},e.prototype.sendNewMessage=function(e,t){Jh("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t||this.getBot(void 0),msg:e,timestamp:+new Date}})},e.prototype.userJoined=function(e){Jh("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:e,timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:this.getBot(void 0),failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.getRetryConfig=function(){var e,t;return(null===(t=null===(e=this.configurableMessages)||void 0===e?void 0:e.items)||void 0===t?void 0:t.length)>0?Cm(this.configurableMessages):Tm},e.prototype.delay=function(e){return new Promise(function(t){return setTimeout(t,1e3*e)})},e.prototype.getErrorMessage=function(e,t){if(401===t)return"Authentication failed. Please check your credentials.";if(403===t)return"Access denied. You don't have permission to access this resource.";if(t&&t>=500)return"The server is experiencing issues. Please try again later.";if(404===t)return"Service not found. Please check your configuration.";if(e instanceof TypeError&&(e.message.includes("fetch")||e.message.includes("network")))return"Unable to connect to the server. Please check your internet connection.";if(e instanceof Error){var n=e.message.toLowerCase();if(n.includes("failed to fetch")||n.includes("network")||n.includes("econnrefused"))return"Unable to reach the server. Please try again later."}return"Something went wrong. Please try again."},e.prototype.dispatchStreamStart=function(e,t){var n=this.getBot(t),r=+new Date;Jh("[dispatchStreamStart] Stream started: ".concat(e,", timestamp: ").concat(r)),this.dispatch({type:"chat",detail:{type:"chat.stream.start",user:n,messageId:e,timestamp:r}})},e.prototype.dispatchStreamChunk=function(e,t,n){this.dispatch({type:"chat",detail:{type:"chat.stream.chunk",user:this.getBot(n),messageId:e,text:t,timestamp:+new Date}})},e.prototype.dispatchStreamEnd=function(e,n,r){void 0===r&&(r={});var a=r.toolCalls,o=r.user,i=r.preserveChips;Jh("Stream ended: ".concat(e)),this.dispatch({type:"chat",detail:t(t({type:"chat.stream.end",user:this.getBot(o),messageId:e,msg:n,toolCalls:a},i&&{preserveChips:i}),{timestamp:+new Date})})},e.prototype.dispatchStreamAbort=function(e){Jh("[dispatchStreamAbort] Stream aborted: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.abort",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchStreamResume=function(e){Jh("[dispatchStreamResume] Stream resumed: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.resume",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchToolStart=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_start",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,hidden:e.hidden,toolInput:e.toolInput,timestamp:+new Date}})},e.prototype.dispatchToolEnd=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_end",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,toolInput:e.toolInput,hidden:e.hidden,toolResult:e.toolResult,toolError:e.toolError,timestamp:+new Date}})},e.prototype.startStreamThrottle=function(e){var t=this;this.streamBuffer="",this.streamingMessageIdForThrottle=e,this.streamThrottleTimer&&clearInterval(this.streamThrottleTimer),this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.streamThrottleTimer=setInterval(function(){if(t.streamBuffer.length>0&&t.streamingMessageIdForThrottle){var e=Math.min(3,t.streamBuffer.length),n=t.streamBuffer.slice(0,e);t.streamBuffer=t.streamBuffer.slice(e),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,n)}},30),this.visibilityHandler=function(){"visible"===document.visibilityState?(Jh("[Visibility] Tab became visible, buffer length: ".concat(t.streamBuffer.length,", messageId: ").concat(t.streamingMessageIdForThrottle)),t.streamBuffer.length>0&&t.streamingMessageIdForThrottle&&(Jh("[Visibility] Flushing ".concat(t.streamBuffer.length," chars to UI")),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,t.streamBuffer),t.streamBuffer="")):Jh("[Visibility] Tab hidden")},document.addEventListener("visibilitychange",this.visibilityHandler)},e.prototype.bufferStreamText=function(e){this.streamBuffer+=e},e.prototype.flushStreamBufferSync=function(){this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="")},e.prototype.flushStreamBuffer=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:return this.streamBuffer.length>0&&this.streamingMessageIdForThrottle?"hidden"!==document.visibilityState?[3,1]:(Jh("[flushStreamBuffer] Tab hidden, dispatching remaining ".concat(this.streamBuffer.length," chars immediately")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="",[3,5]):[3,5];case 1:e=0,t=100,n.label=2;case 2:return this.streamBuffer.length>0&&e<t?[4,new Promise(function(e){return setTimeout(e,30)})]:[3,4];case 3:return n.sent(),e++,[3,2];case 4:this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(Jh("[flushStreamBuffer] Timeout waiting for buffer, dispatching remaining ".concat(this.streamBuffer.length," chars")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),n.label=5;case 5:return this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamingMessageIdForThrottle=void 0,[2]}})})},e.prototype.stopStreamThrottle=function(){this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamBuffer="",this.streamingMessageIdForThrottle=void 0},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeOut is not supported in MCP mode")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeIn is not supported in MCP mode")})})},e.prototype.ensureAgentNick=function(e){return e?e.startsWith("agent:")?e:"agent:".concat(e):"agent:robot"},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;if(!e){var a=r||{nick:"agent:robot",displayName:"Assistant"};return t(t({},a),{nick:this.ensureAgentNick(a.nick),isAI:!0})}return e.displayName&&e.nick&&e.avatarPath?t(t({},e),{nick:this.ensureAgentNick(e.nick),isAI:!0}):t(t({},e),{nick:this.ensureAgentNick(e.nick||(null==r?void 0:r.nick)),displayName:e.displayName||(null==r?void 0:r.displayName)||"Assistant",avatarPath:e.avatarPath||(null==r?void 0:r.avatarPath),isAI:!0})},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.postMessage(e)];case 1:return r.sent(),t(),[3,3];case 2:return n=r.sent(),t(n),[3,3];case 3:return[2]}})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,a,o,i,s,u,l,c,d,f,p,h,v,m;return r(this,function(r){switch(r.label){case 0:return(null===(v=null===(h=e.msg)||void 0===h?void 0:h.text)||void 0===v?void 0:v.trim())||""?this.isInitializingSession&&this.sessionInitPromise?(Jh("Waiting for session initialization to complete before sending message..."),t=new Promise(function(e){return setTimeout(function(){return e("timeout")},1e4)}),[4,Promise.race([this.sessionInitPromise,t])]):[3,2]:(Jh("Ignoring empty message"),[2]);case 1:if("timeout"===r.sent()||this.isInitializingSession)return Gh("Session initialization timed out"),this.sendFailureMessage(0,0,"Chat is not ready. Please try again."),[2];r.label=2;case 2:n=this.getRetryConfig(),a=(null===(m=e.msg)||void 0===m?void 0:m.text)||"",o=!1,i=0,r.label=3;case 3:if(!(i<n.length))return[3,14];s=i===n.length-1,u=n[i],Jh("MCP attempt ".concat(i+1,"/").concat(n.length," for message: ").concat(a)),this.typing(),r.label=4;case 4:return r.trys.push([4,6,,13]),[4,this.attemptSSERequest(e)];case 5:return r.sent(),o=!0,[3,14];case 6:return l=r.sent(),this.stopTyping(),c=null==l?void 0:l.statusCode,Gh("MCP attempt ".concat(i+1," failed: ").concat(l,", statusCode: ").concat(c)),Jh("[postMessage] Error details:",{error:l,statusCode:c,messageText:a,sessionId:this._sessionId}),c&&c>=400&&c<500?(Jh("Client error ".concat(c,", not retrying")),f=this.getErrorMessage(l,c),this.sendFailureMessage(0,0,f),[2]):(Om(l)&&this.setConnectionStatus("offline"),s?(d=null==l?void 0:l.statusCode,f=u.text||this.getErrorMessage(l,d),this.sendFailureMessage(0,0,f),[3,12]):[3,7]);case 7:return i>0||u.text?(p=n[i+1])&&p.delay>0?(this.sendFailureMessage(p.retry,p.delay,p.text),[4,this.delay(p.delay)]):[3,9]:[3,10];case 8:r.sent(),r.label=9;case 9:return[3,12];case 10:return(p=n[i+1])&&p.delay>0?[4,this.delay(p.delay)]:[3,12];case 11:r.sent(),r.label=12;case 12:return[3,13];case 13:return i++,[3,3];case 14:return o?this.sentMessageCount++:Jh("All MCP retry attempts exhausted"),[2]}})})},e.prototype.attemptSSERequest=function(e){return n(this,void 0,void 0,function(){var n,a,o,i;return r(this,function(r){return"/debug"===(n=(null===(i=e.msg)||void 0===i?void 0:i.text)||"").trim().toLowerCase()?(this._debugMode=!this._debugMode,a=this._debugMode?"Debug mode enabled":"Debug mode disabled",Jh("[attemptSSERequest] ".concat(a)),o="debug-".concat(Date.now()),this.dispatch({type:"chat",detail:{type:"chat.stream.end",user:this.getBot(void 0),messageId:o,msg:{text:a},timestamp:+new Date}}),[2]):(Jh('[attemptSSERequest] Sending message: "'.concat(n,'", userId: ').concat(this._userId,", sessionId: ").concat(this._sessionId)),[2,this.performSSERequest(this.buildRequestPayload(t({message:n},this.conversationOnScreen&&{continueConversation:!0})))])})})},e.prototype.performSSERequest=function(e){return n(this,void 0,void 0,function(){var o,i,s,u,l,c,d,f,p=this;return r(this,function(h){return o=this.getEndpoint(),Jh("SSE request to ".concat(o,": ").concat(JSON.stringify(e))),this.abortController&&(this.abortController.abort(),this.abortController=void 0),this.abortController=new AbortController,i=xm(),this.currentMessageId=i,s=i,l=[],c=!1,[2,new Promise(function(h,v){wm.fetchEventSource(o,{method:"POST",headers:t({"Content-Type":"application/json"},"business_owner"===(p.config.mode||"homeowner")&&p.config.authToken?{Authorization:"Bearer ".concat(p.config.authToken)}:{}),body:JSON.stringify(e),signal:p.abortController.signal,openWhenHidden:!0,onopen:function(e){return n(p,void 0,void 0,function(){var t;return r(this,function(n){if(d=e.status,!e.ok)throw(t=new Error("HTTP error! status: ".concat(e.status))).statusCode=e.status,t;return Jh("SSE connection opened"),this.setConnectionStatus("online"),[2]})})},onmessage:function(e){var t;if(p.currentMessageId===i){Jh("SSE event: ".concat(e.event,", data: ").concat(e.data));var n=e.event||"message",r={};try{r=JSON.parse(e.data)}catch(e){return void Jh("Failed to parse SSE data: ".concat(e))}switch(void 0!==r.seq&&null!==r.seq&&(p.lastSeq=r.seq,p._sessionId&&function(e,t){if("undefined"!=typeof window&&window.sessionStorage)try{sessionStorage.setItem("xapp_mcp_lastSeq_".concat(e),String(t))}catch(e){}}(p._sessionId,r.seq)),n){case"connected":Jh("[SSE] Connected event received, messageId: ".concat(i,", isReturningUser: ").concat(r.isReturningUser,", isReplay: ").concat(r.isReplay)),p.conversationOnScreen=!0,r.isReplay&&(p.isReplaying=!0),r.user&&(u=r.user),(r.userId||r.sessionId)&&(r.userId&&(p._userId=r.userId,p.userIdIsServerAssigned=!0),r.sessionId&&(p._sessionId=r.sessionId,p.dispatch(Pm(p._sessionId))),Em(r.userId,r.sessionId),Jh("[SSE] Identity from connected - userId: ".concat(r.userId,", sessionId: ").concat(r.sessionId))),p.currentToolCalls=[],p.stopTyping(),r.isReplay?p.dispatchStreamResume(s):p.dispatchStreamStart(s,u),p.startStreamThrottle(s);break;case"session_resumed":Jh("[SSE] Session resumed, sessionId: ".concat(r.sessionId,", hasHistory: ").concat(r.hasHistory)),p.conversationOnScreen=!0,r.userId&&(p._userId=r.userId,p.userIdIsServerAssigned=!0),r.sessionId&&(p._sessionId=r.sessionId,p.dispatch(Pm(p._sessionId))),Em(r.userId,r.sessionId),p.stopTyping();break;case"session_expired":Jh("[SSE] Session expired: ".concat(r.reason||"Session not found")),p.conversationOnScreen=!1,Nm(p._sessionId),p._sessionId="",p.lastSeq=void 0,p.stopTyping(),p.stopStreamThrottle(),p.isValidatingSession=!1,p.initializeNewSession(),h();break;case"message_start":Jh("[SSE] message_start — splitting bubble, user: ".concat(null===(t=r.user)||void 0===t?void 0:t.displayName)),p.flushStreamBufferSync(),p.dispatchStreamEnd(s,{text:l.join("")},{toolCalls:p.config.debugMode||p._debugMode?a([],p.currentToolCalls,!0):void 0,user:u,preserveChips:!0}),p.currentToolCalls=[],s=xm(),l=[],u=r.user,p.dispatchStreamStart(s,u),p.startStreamThrottle(s);break;case"text":r.text&&(Jh("[SSE] Text chunk received (".concat(r.text.length," chars), chunks in this bubble: ").concat(l.length+1,", isReplay: ").concat(r.isReplay)),l.push(r.text),r.isReplay||p.isSleeping?p.dispatchStreamChunk(s,r.text,u):p.bufferStreamText(r.text));break;case"tool_start":if(Jh("Tool execution started: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName){var o={name:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,input:r.toolInput,startTime:Date.now(),isExecuting:!0};p.currentToolCalls.push(o),p.dispatchToolStart({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput})}break;case"tool_end":if(Jh("Tool execution ended: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName)(o=p.currentToolCalls.find(function(e){return r.toolCallId?e.toolCallId===r.toolCallId:e.name===r.toolName&&e.isExecuting}))&&(o.result=r.toolResult,o.error=r.toolError,o.label=r.label,o.hidden=r.hidden,o.endTime=r.toolBatchDurationMs&&null!=o.startTime?o.startTime+r.toolBatchDurationMs:Date.now(),o.isExecuting=!1,r.toolInput&&(o.input=r.toolInput)),"toggle_debug"===r.toolName&&(p._debugMode=!p._debugMode),p.dispatchToolEnd({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput,toolResult:r.toolResult,toolError:r.toolError});break;case"done":if(p.stopTyping(),r.response){r.response.sessionId&&(p._sessionId=r.response.sessionId,p.dispatch(Pm(p._sessionId)),Em(void 0,r.response.sessionId));var d=l.join("");Jh("[SSE] Done event received. Chunks in this bubble: ".concat(l.length,", accumulated text length: ").concat(d.length)),Jh("[SSE] First 100 chars of accumulated: ".concat(d.substring(0,100)));var f=r.response.suggestions,m=null==f?void 0:f.map(function(e){return{label:e.title,actionUrl:e.url||""}});(null==m?void 0:m.length)&&Jh("[SSE] Suggestions: ".concat(m.length," items"));var g=r.response.sources;(null==g?void 0:g.length)&&Jh("[SSE] Sources: ".concat(g.length," items"));var y={text:d||(s!==i?"":r.response.response)||"",options:m,sources:g,displays:r.response.displays},b=p.config.debugMode||p._debugMode?a([],p.currentToolCalls,!0):void 0;p.flushStreamBuffer().then(function(){p.dispatchStreamEnd(s,y,{toolCalls:b,user:u}),p.currentToolCalls=[],h()})}else p.stopStreamThrottle(),h();break;case"replay_complete":p.isReplaying=!1,Jh("[SSE] Replay complete: replayed ".concat(r.replayedCount," events, currentSeq: ").concat(r.currentSeq));break;case"replay_partial":p.isReplaying=!1,Jh("[SSE] Replay partial: some events unavailable, oldestAvailableSeq: ".concat(r.oldestAvailableSeq));break;case"error":c=!0,p.stopTyping(),p.stopStreamThrottle(),Gh("SSE error: ".concat(r.error)),v(new Error(r.error||"Server error during processing"))}}else Jh("[SSE] Ignoring stale event for messageId: ".concat(i,", current: ").concat(p.currentMessageId))},onerror:function(e){if(p.currentMessageId===i&&!c){c=!0,p.isReplaying=!1,p.isSleeping?(Jh("[MCPChat] SSE error during sleep - will request replay on wakeup"),p.needsReplayOnWakeup=!0,p.streamingMessageIdForThrottle&&p.dispatchStreamAbort(s),p.stopStreamThrottle()):p.stopStreamThrottle(),f=e instanceof Error?e:new Error(String(e));var t=(null==e?void 0:e.statusCode)||d;t&&(f.statusCode=t),Gh("SSE connection error: ".concat(e))}throw e}}).catch(function(e){if(p.stopStreamThrottle(),c||p.currentMessageId!==i)v(f||e);else{var t=(null==e?void 0:e.statusCode)||d,n=e instanceof Error?e:new Error(String(e));t&&(n.statusCode=t),v(n)}})})]})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes),this.conversationOnScreen=!0===e.hasConversation;var a=new URL(window.location.href);(null==a?void 0:a.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href,this._accessToken=this.visitorInfo.accessToken,this.startSession(n),this._sessionId?this.validateSession():this.initializeNewSession(),this.isInitializingSession&&this.typing(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t(new Error("File upload not supported in MCP mode"))},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){this.stopStreamThrottle(),this.abortController&&(this.abortController.abort(),this.abortController=void 0)},e.prototype.sleep=function(){this.isSleeping=!0,this.streamingMessageIdForThrottle?(this.needsReplayOnWakeup=!1,Jh("[MCPChat] sleep() - stream in progress, keeping SSE connection alive"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0)):(this.stopStreamThrottle(),this.isReplaying=!1,this.abortController&&(this.abortController.abort(),this.abortController=void 0))},e.prototype.wakeup=function(){if(this.isSleeping=!1,this.streamingMessageIdForThrottle&&this.abortController)Jh("[MCPChat] wakeup() - stream still in progress, restarting throttle"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.startStreamThrottle(this.streamingMessageIdForThrottle);else if(this.needsReplayOnWakeup){if(this.needsReplayOnWakeup=!1,void 0!==this.lastSeq&&this._sessionId)return Jh("[MCPChat] wakeup() - connection lost during sleep, requesting replay"),void this.requestReplay();Gh("[MCPChat] wakeup() - cannot replay, missing lastSeq (".concat(this.lastSeq,") or sessionId (").concat(this._sessionId,")"))}this._sessionId&&(Jh("[MCPChat] Wakeup - session exists, lastSeq: ".concat(this.lastSeq)),this.setConnectionStatus("online"))},e.prototype.requestReplay=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:if(this.isRequestingReplay)return Jh("[MCPChat] Replay already in progress, skipping"),[2];this.isRequestingReplay=!0,this.typing(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload())];case 2:return n.sent(),Jh("[MCPChat] Replay request completed"),[3,5];case 3:return e=n.sent(),t=null==e?void 0:e.statusCode,Gh("[MCPChat] Replay request failed: ".concat(e,", statusCode: ").concat(t)),Om(e)&&this.setConnectionStatus("offline"),[3,5];case 4:return this.stopTyping(),this.isRequestingReplay=!1,[7];case 5:return[2]}})})},e.prototype.notifyDisconnecting=function(e){if(void 0===e&&(e="close_tab"),this._sessionId){var t=this.getCloseEndpoint(),n=JSON.stringify({sessionId:this._sessionId,userId:this._userId||void 0,reason:e,messageCount:this.sentMessageCount,durationMs:void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:0});if(Jh("[MCPChat] notifyDisconnecting: reason=".concat(e,", endpoint=").concat(t)),"widget_close"===e&&"undefined"!=typeof fetch){var r={"Content-Type":"application/json"};return this.config.authToken&&(r.Authorization="Bearer ".concat(this.config.authToken)),void fetch(t,{method:"POST",headers:r,body:n,keepalive:!0})}if("undefined"!=typeof navigator&&navigator.sendBeacon){var a=new Blob([n],{type:"application/json"});navigator.sendBeacon(t,a)}}},e.prototype.startSession=function(e){this.userIdIsServerAssigned?Jh("[startSession] Preserving server-assigned userId: ".concat(this._userId)):this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="mcp-widget-user-".concat(this.visitorInfo.email):this._userId||(this._userId="mcp-widget-user-".concat(xm())),e?(this._sessionId=e,Jh("Using provided session id: ".concat(this._sessionId))):""===e?(this._sessionId="mcp-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))):!this._sessionId&&this.config.sessionId?(this._sessionId=this.config.sessionId,Jh("Using config session id: ".concat(this._sessionId))):this._sessionId?Jh("Keeping existing session id: ".concat(this._sessionId)):(this._sessionId="mcp-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();function Am(e){if(e)return"string"==typeof e?{displayText:e}:e}function Lm(e,n){var r,a,o,i,s,u,l,c,d;if(void 0===n&&(n=(new Date).getTime()),!e)return u;var f=Am(e.outputSpeech),p=Am(e.reprompt);return f&&(l=f.displayText,c=f.html),"TRANSFER_CALL"===e.system?u={type:"handOff",timestamp:n,handoffMessage:l,handoffTarget:null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.transferPhoneNumber,endSession:!1,user:void 0}:(null===(a=e.system)||void 0===a?void 0:a.startsWith("PERMISSION_"))?u=function(e,t){var n,r=function(e){switch(e){case"PERMISSION_EMAIL":return"EMAIL";case"PERMISSION_LOCATION_PRECISE":return"LOCATION_PRECISE";default:throw new Error("Unsupported permission: ".concat(e))}}(e.system),a=Am(e.outputSpeech),o=e.data.permissionPrimerAccepted,i=e.data.permissionDenied;return{type:"permissionRequest",timestamp:t,msg:{text:null!==(n=null==a?void 0:a.displayText)&&void 0!==n?n:"".concat(e.data.permissionRequestTTSContext),permissionRequest:{time:t,type:r,approve:"object"==typeof o?Lm({outputSpeech:o}).msg:void 0,deny:"object"==typeof i?Lm({outputSpeech:i}).msg:void 0}},endSession:!1,user:void 0}}(e,n):(d=!p||!(p.displayText||p.ssml),u={type:"msg",timestamp:n,msg:{displays:e.displays,context:null===(i=null===(o=e.context)||void 0===o?void 0:o.active)||void 0===i?void 0:i.map(function(e){return e.name})},endSession:d,user:void 0},l&&!c&&(u.msg=t(t({},u.msg),{text:l})),c&&(u.msg=t(t({},u.msg),{html:c})),(null===(s=null==f?void 0:f.suggestions)||void 0===s?void 0:s.length)&&(u.msg.options=f.suggestions.map(function(e){return"string"==typeof e?e:{label:e.title,actionUrl:e.url}}))),u}var Um=function(){function e(e,t){this._userId="",this._sessionId="",this._accessToken="",this._attributes={},this.config=e,this.options=t,this.configurableMessages=t.configurableMessages,this.isNewSession=!1,this.hooks=t.hooks}return e.prototype.init=function(e){this.dispatch=e,Jh("got init auth: ".concat(this.config.key)),this.setConnectionStatus("online"),this.setAccountStatus("online")},e.prototype.setConnectionStatus=function(e){Jh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(wv(e))},e.prototype.setAccountStatus=function(e){Jh("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(xv(e))},e.prototype.sendNewMessage=function(e){Jh("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t(t({},e.user),{nick:"agent:robot"}),msg:e.msg,timestamp:+new Date}})},e.prototype.userJoined=function(e){Jh("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:t(t({},e.user),{nick:"agent:robot"}),timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:"agent:robot"},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;return e?e.displayName&&e.nick&&e.avatarPath?e:t(t({},e),{nick:e.nick||r.nick||"Bot",displayName:e.displayName||r.displayName||"Bot",avatarPath:e.avatarPath||r.avatarPath}):r},e.prototype.sendChatMsgRequest=function(e,a){return n(this,void 0,void 0,function(){var n,o;return r(this,function(r){switch(r.label){case 0:return[4,this.postMessage(e)];case 1:return n=r.sent(),(null===(o=n.user)||void 0===o?void 0:o.displayName)||(n=t(t({},n),{user:this.getBot(n.user)})),this.sendNewMessage(n),a(),[2]}})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes);var a=new URL(window.location.href);(null==a?void 0:a.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href;var o=mm(document.referrer);o&&(this._attributes.referrer=o),this._accessToken=this.visitorInfo.accessToken,this.userJoined({user:this.getBot(void 0),token:""}),this.startSession(n),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var a,o,i,s,u,l,c,d,f,p,h,v,m,g,y,b,x,w,k,S,_,O,C,P,T,j,M,E,N,I,D,R=this;return r(this,function(A){switch(A.label){case 0:o=this._userId,i=this._sessionId,s=this._accessToken,u=function(e,n){for(var r=e||{},a=t({},n),o=0,i=Object.entries(r);o<i.length;o++){var s=i[o],u=s[0],l=s[1];void 0!==l&&(a[u]=l)}return a}(this._attributes,pm()),(l=localStorage.getItem("xa_rwg_token"))&&(u.rwg_token=l),(c=localStorage.getItem("xa_merchant_id"))&&(u.merchant_id=c),(d=localStorage.getItem("xa_environment"))&&(u.environment=d),(f=localStorage.getItem("xa_enablePreferredTime"))&&(u.enablePreferredTime=f),(p=localStorage.getItem("xa_service"))&&(u.service=p),(h=localStorage.getItem("xa_origin"))&&(u.origin=h),dm(u),u.currentTime=(new Date).toISOString(),v=(new Date).getTime(),this.isNewSession&&!(null===(M=null==e?void 0:e.msg)||void 0===M?void 0:M.text)?a={type:"LAUNCH_REQUEST",rawQuery:null===(E=null==e?void 0:e.msg)||void 0===E?void 0:E.text,sessionId:i,userId:o,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}:(m=null===(N=e.msg)||void 0===N?void 0:N.permissionRequest)?(e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})}),g=v-m.time>3e5,y=null===(I=e.msg.text)||void 0===I?void 0:I.toLowerCase(),b=!g,x={id:this._userId},g||("EMAIL"===m.type&&(w=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(y),b=w,x.email=this.visitorInfo.email,x.name=this.visitorInfo.displayName,this.visitorInfo.email=y),"LOCATION_PRECISE"===m.type&&(b=!!e.msg.location,x.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)),a={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,granted:b,userProfile:x,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}):a="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:this._sessionId,userId:this._userId,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:u},Jh("Visitor says: ".concat(JSON.stringify(a,void 0,2))),k=Cm(this.configurableMessages),_=!1,O=function(e){S=e,_=!0},C=function(e,t){return n(R,void 0,void 0,function(){var n,a,o;return r(this,function(r){return n=k[e].retry,a=k[e].delay,o=k[e].text,Gh("POST failed: ".concat(t)),this.sendFailureMessage(n,a,o),S={errorText:""},[2,new Promise(function(e){setTimeout(e,1e3*a)})]})})},P=1,A.label=1;case 1:return P<k.length?(T=this.config.timeout||22e3,Jh("POST attempt ".concat(P," with timeout ").concat(T)),this.typing(),[4,new Lh({retries:1,timeout:T}).fetch(function(e){return function(e,t,a,o){return n(this,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return n=JSON.stringify(e),Jh("URL: ".concat(t)),Jh("BODY: ".concat(n)),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a)},body:n,mode:"cors",signal:o})];case 1:if(!(i=r.sent()).ok)throw new Error("Status ".concat(i.status,", Text: ").concat(i.statusText));return[2,i.json()]}})})}(a,R.config.url,R.config.key,e)}).then(O).catch(C.bind(this,P))]):[3,4];case 2:if(A.sent(),_)return[3,4];A.label=3;case 3:return P++,[3,1];case 4:return Jh("Bot says: ".concat(JSON.stringify(S,void 0,2))),this.isNewSession=!1,j=Lm(S),!(null==S?void 0:S.hasOwnProperty("errorText"))&&S||((j={type:"userLeft",timestamp:v,msg:{},user:void 0,endSession:!0}).msg={text:(null==S?void 0:S.hasOwnProperty("errorText"))?S.errorText:"The assistant is not responding right now. Please close the widget and open it again."}),"function"==typeof(null===(D=this.hooks)||void 0===D?void 0:D.onResponse)&&this.hooks.onResponse(S),this.stopTyping(),[2,j]}})})},e.prototype.startSession=function(e){this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat(xm()),e?(this._sessionId=e,Jh("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();var zm=function(){function e(){}return e.prototype.init=function(){},e.prototype.sendOfflineMsg=function(){},e.prototype.sendChatMsg=function(){},e.prototype.sendChatMsgRequest=function(){},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(){},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(){},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.bargeOut=function(){},e.prototype.bargeIn=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e}();function Fm(e,n,r,a,o,i,s){var u,l,c,d,f,p,h=(new Date).getTime();if(r&&!(null===(u=null==e?void 0:e.msg)||void 0===u?void 0:u.text))p={type:"LAUNCH_REQUEST",rawQuery:null===(l=null==e?void 0:e.msg)||void 0===l?void 0:l.text,sessionId:a,userId:n,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i};else{var v=null===(c=e.msg)||void 0===c?void 0:c.permissionRequest;if(v){e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})});var m=h-v.time>3e5,g=null===(d=e.msg.text)||void 0===d?void 0:d.toLowerCase(),y=!m,b={id:n};if(!m){if("EMAIL"===v.type){var x=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(g);y=x,b.email=s.email,b.name=s.displayName,this.visitorInfo.email=g}"LOCATION_PRECISE"===v.type&&(y=!!e.msg.location,b.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)}p={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:a,userId:n,isNewSession:!1,granted:y,userProfile:b,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}}else p="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:a,userId:n,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:a,userId:n,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:a,userId:n,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:i}}return(null===(f=e.msg)||void 0===f?void 0:f.attributes)&&(p.attributes=t(t({},p.attributes),e.msg.attributes)),p}var Bm="router",Wm={deviceId:"Router",userId:Bm,displayName:"XAPP Server"},Hm=function(){function e(e,t){var n,r,a,o,i;this.isDisposed=!1,this._userId="",this._sessionId="",this.accessToken="",this.attributes={},this.routerAttributes={},this.isAdmin=!1,this.urlAttributes={},this.handlers={},this.sleepTimeoutId=null,this.receivedMessageIds=new Set,this.MESSAGE_DEDUP_CACHE_SIZE=1e3,this.config=e,this.options=t;var s=new URL(this.config.url);this.appId=s.searchParams.get("appId");var u=new URL(window.location.href);if(this.isAdmin="true"===u.searchParams.get("isAdmin"),this.appId)this.serverUrl=this.config.url,this.urlAttributes.path=null===(n=s.pathname)||void 0===n?void 0:n.split("/");else{this.serverUrl="".concat(s.origin);var l=null===(r=s.pathname)||void 0===r?void 0:r.split("/");l&&l.length>1&&(this.serverUrl="".concat(this.serverUrl,"/").concat(l[1]),this.urlAttributes.path=l.slice(1))}Jh("WS url: ".concat(this.serverUrl," isAdmin: ").concat(this.isAdmin," attributes: ").concat(JSON.stringify(this.attributes)," appId: ").concat(this.appId)),this.configurableMessages=Cm(t.configurableMessages),this.noOfServerErrors=0,this.SLEEP_DELAY_MS=null!==(i=null===(o=null===(a=null==t?void 0:t.env)||void 0===a?void 0:a.connection)||void 0===o?void 0:o.backgroundSleepDelay)&&void 0!==i?i:6e4,Jh("Background sleep delay set to ".concat(this.SLEEP_DELAY_MS,"ms"))}return e.prototype.init=function(e){var n,r,a=this;this.dispatch=e,Jh("INIT called - setting initial accountStatus to OFFLINE"),this.setAccountStatus("offline"),this.handlers["connection update"]=function(e,t,n,r){Jh("Connection update received. Session created: ".concat(e.sessionCreated," Error: ").concat(e.errorMessage||"")),e.sessionCreated?(a.sessionCreated=!0,a.setConnectionStatus("online")):(Gh("SERVER: something is wrong. Going offline."),a.dispatch(xv("offline")),a.dispatch(wv("offline")))},this.handlers["account status"]=function(t,n,r,a){e({type:"account_status",detail:{status:"online",timestamp:r||(new Date).getTime()}})},this.handlers.failure=function(e,t,n,r){Gh("SERVER: something's failed: type: ".concat(e.type," tries: ").concat(e.tries," error: ").concat(e.error));var o=a.configurableMessages[e.tries],i=o.retry,s=o.delay,u=o.text;a.sendFailureMessage(i,e.delay||s,u,t)},this.handlers["new message"]=function(e,n,r,o,i){var s,u;if(i){if(i.length>256)return void Jh("Rejecting message with oversized messageId (".concat(i.length," chars)"));if(a.receivedMessageIds.has(i))return void Jh("Deduplicating message with id: ".concat(i));if(a.receivedMessageIds.add(i),a.receivedMessageIds.size>a.MESSAGE_DEDUP_CACHE_SIZE)for(var l=Math.floor(.1*a.MESSAGE_DEDUP_CACHE_SIZE),c=a.receivedMessageIds.values(),d=0;d<l;d++){var f=c.next().value;f&&a.receivedMessageIds.delete(f)}}if("Bot"===n.deviceId){var p=e;o&&"object"==typeof o&&Object.keys(o).length>0&&(a.routerAttributes=t({},o),Jh("Extracted router attributes: ".concat(JSON.stringify(a.routerAttributes)))),"function"==typeof(null===(s=a.options.hooks)||void 0===s?void 0:s.onResponse)&&a.options.hooks.onResponse(p),a.isNewSession&&(a.isNewSession=!1,Jh("Session initialized after receiving first bot response")),u=Lm(p)}else"Widget"===n.deviceId?u=function(e,t){if(void 0===t&&(t=(new Date).getTime()),e)return{type:"msg",timestamp:t,msg:{text:e.rawQuery},endSession:!1,user:void 0}}(e):Gh("Unknown sender device Id: ".concat(n.deviceId));a.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:n.displayName||n.email||n.userId,nick:qm(n),avatarPath:n.avatarPath},msg:u.msg,timestamp:r||(new Date).getTime()}})},this.handlers["user joined"]=function(e,t,n,r){var o,i,s=qm(t);Jh('Received "user joined" event - deviceId: '.concat(t.deviceId,", userId: ").concat(t.userId,", displayName: ").concat(t.displayName,", nick: ").concat(s)),Jh("Dispatching chat.memberjoin for ".concat(t.displayName||"Unknown"));var u=e;a.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:t.avatarPath||(null===(i=null===(o=a.options)||void 0===o?void 0:o.bot)||void 0===i?void 0:i.avatarPath),displayName:t.displayName,nick:s},timestamp:n||(new Date).getTime(),showDivider:null==u?void 0:u.showDivider,message:null==u?void 0:u.message,hideUserInfo:null==u?void 0:u.hideUserInfo}}),Jh("chat.memberjoin dispatched for nick: ".concat(s))},this.handlers["user left"]=function(e,t,n,r){var o=e;a.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{avatarPath:t.avatarPath,displayName:t.displayName,nick:qm(t)},timestamp:n||(new Date).getTime(),showDivider:null==o?void 0:o.showDivider,message:null==o?void 0:o.message}})},this.handlers.typing=function(e,t,n,r){a.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:qm(t)},typing:!0,timestamp:n||(new Date).getTime()}})},this.handlers["stop typing"]=function(e,t,n,r){a.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:qm(t)},typing:!1,timestamp:n||(new Date).getTime()}})},this.handlers.disconnect=function(){Jh("DISCONNECT event received from server"),Gh("SERVER: requested disconnect"),a.dispatch(xv("offline")),a.dispatch(wv("offline"))},this.handlers.reconnect=function(){a.dispatch(xv("online")),a.dispatch(wv("online"))},this.handlers["reconnect failed"]=function(e){Gh("SERVER: says re-connect failed"),a.dispatch(xv("offline")),a.dispatch(wv("offline"))},this.handlers["reconnect error"]=function(e){Gh("SERVER: says there was an error while re-connecting"),a.dispatch(xv("offline"))},this.handlers["display button"]=function(e,t,n,r){Jh('Received "display button" event - id: '.concat(e.id,", text: ").concat(e.text,", pressBehavior: ").concat(e.pressBehavior)),a.dispatch(kv({id:e.id,text:e.text,pressBehavior:e.pressBehavior||"none"}))},this.handlers["dismiss button"]=function(e,t,n,r){Jh('Received "dismiss button" event - id: '.concat(e.id)),a.dispatch(kv({id:e.id,text:"",pressBehavior:"none",isDismissing:!0})),setTimeout(function(){a.dispatch({type:"ws_button_dismiss",detail:{id:e.id,timestamp:+new Date}})},300)},this.handlers["system-message"]=function(e,t,n,r){Jh('Received "system-message" event - id: '.concat(e.id,", message: ").concat(e.message,", dismissId: ").concat(e.dismissId)),e.dismissId&&a.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:qm(t)},id:e.dismissId,timestamp:n||(new Date).getTime()}}),a.dispatch({type:"chat",detail:{type:"chat.systemmessage",user:{displayName:t.displayName||"System",nick:qm(t)},id:e.id,message:e.message,dismissId:e.dismissId,timestamp:n||(new Date).getTime()}})},this.handlers["system-message-dismiss"]=function(e,t,n,r){Jh('Received "system-message-dismiss" event - id: '.concat(e.id)),a.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:qm(t)},id:e.id,timestamp:n||(new Date).getTime()}})},this.handlers["missed messages"]=function(e,t,n,r){var o,i=e;Jh('Received "missed messages" event with '.concat((null===(o=null==i?void 0:i.messages)||void 0===o?void 0:o.length)||0," messages")),(null==i?void 0:i.messages)&&Array.isArray(i.messages)&&i.messages.forEach(function(e){Jh("Processing missed message: event=".concat(e.event,", messageId=").concat(e.messageId));var t=a.handlers[e.event];t&&"missed messages"!==e.event?t(e.data,e.sender,e.timeMs,e.attributes,e.messageId):Jh("No handler for missed message event: ".concat(e.event))})},this.handlers["request missed messages"]=function(){Jh("Request missed messages handler (no-op on client side)")},this.handlers["user backgrounded"]=function(){Jh("User backgrounded handler (no-op on client side)")},this.handlers["user foregrounded"]=function(){Jh("User foregrounded handler (no-op on client side)")},this.handlers["user disconnecting"]=function(){Jh("User disconnecting handler (no-op on client side)")},this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:null===(r=null===(n=this.options)||void 0===n?void 0:n.bot)||void 0===r?void 0:r.avatarPath,displayName:Wm.displayName,nick:qm(Wm)},timestamp:(new Date).getTime()}}),this.setAccountStatus("online"),this.setConnectionStatus("online")},e.prototype.autoReconnect=function(e){var t=this;0===this.noOfServerErrors&&this.setConnectionStatus("pending");var n=this.setAccountStatus.bind(this),r=this.setConnectionStatus.bind(this);function a(){var t=setInterval(function(){var o=e();o?(Jh("Re-created WS connection"),o.onopen=function(){Jh("Re-opened WS connection"),n("online"),r("online"),o.onclose=function(){Jh("WebSocket ONCLOSE event - connection closed unexpectedly"),Jh("Closed WS connection (onclosed was called)"),a()},clearInterval(t)}):clearInterval(t)},5e3)}Jh("Creating WS connection");var o=e();o&&(o.onclose=function(){Jh("WebSocket ONCLOSE event (initial) - connection closed"),Jh("Closed WS connection (onclosed was called)"),a()},this.ws.onopen=function(){Jh("WebSocket ONOPEN event - connection established"),Jh("Opened WS connection (onopen was called)"),t.setAccountStatus("online"),t.setConnectionStatus("online")})},e.prototype.wsClose=function(){this.ws&&(Jh("wsClose() - Closing WebSocket (readyState: ".concat(this.ws.readyState,")")),this.ws.onclose=null,this.ws.onerror=null,this.ws.onopen=null,this.ws.onmessage=null,this.ws.close())},e.prototype.wsCreate=function(e){var t=this;if(!this.isDisposed){Jh('Trying to re-connect. Reason: "'.concat(e,'"'));var n=new URL(this.serverUrl);if(n.searchParams.set("userId",this._userId),n.searchParams.set("isAdmin","".concat(this.isAdmin)),n.searchParams.set("createWsReason",e),this.ws&&this.ws.readyState!==WebSocket.CLOSED&&this.ws.readyState!==WebSocket.CLOSING){var r=this.ws.readyState;Jh("Forced WS close. State: ".concat(r));try{this.wsClose()}catch(e){e("Failed to close WS (ready state: ".concat(r,"): ").concat(e))}}return this.ws=new WebSocket(n.toString()),this.ws.onerror=function(e){var r;Gh("Error in WS connection. Url: ".concat(n.toString()," Type: ").concat(e?e.type:"?"," Ready State: ").concat(null===(r=t.ws)||void 0===r?void 0:r.readyState))},this.ws.onmessage=function(e){Jh("ROUTER says: ".concat(e.data));var n=JSON.parse(e.data);t.handlers[n.event]?t.handlers[n.event](n.data,n.sender,n.timeMs,n.attributes,n.messageId):Gh("Unknown router message event: ".concat(n.event))},this.ws}Jh("Stopping reconnect for disposed router connector")},e.prototype.checkConnection=function(){var e;return(null===(e=this.ws)||void 0===e?void 0:e.readyState)===WebSocket.OPEN},e.prototype.emit=function(e,t){return n(this,void 0,void 0,function(){var n,a,o=this;return r(this,function(r){switch(r.label){case 0:return n={event:e,data:t,sender:this.visitorInfo,sessionId:this._sessionId,timeMs:(new Date).getTime()},this.routerAttributes&&Object.keys(this.routerAttributes).length>0&&(n.attributes=this.routerAttributes,Jh("Adding router attributes to outgoing payload: ".concat(JSON.stringify(this.routerAttributes)))),a=JSON.stringify(n),Jh("Widget says: ".concat(a)),this.ws||this.autoReconnect(this.wsCreate.bind(this,"emitNoWs")),[4,Ym(this.checkConnection.bind(this),1e3,1e4,"connection").then(function(e){e>0&&Jh("Connection is ready in ".concat(e," ms")),o.ws.send(a),o.noOfServerErrors=0}).catch(function(e){Gh("Connection wait timed out in ".concat(e," ms (show error)")),o.setConnectionStatus("online")})];case 1:return r.sent(),[2]}})})},e.prototype.setAccountStatus=function(e){Jh("setAccountStatus: ".concat(e)),Jh("SERVER account_status: ".concat(JSON.stringify(e))),this.dispatch(xv(e))},e.prototype.setConnectionStatus=function(e){Jh("setConnectionStatus: ".concat(e)),Jh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(wv(e))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.sendFailureMessage=function(e,t,n,r){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:qm(r)},typing:!1,timestamp:+new Date}}),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:qm(r)},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendDisconnectMessage=function(){this.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:"Server",nick:qm(Wm),avatarPath:Wm.avatarPath},msg:{text:0===this.noOfServerErrors?"I cannot connect to the server. Please try later.":"Nope. Still no luck. I still cannot connect to the server. Please don't give up."},timestamp:(new Date).getTime()}}),this.noOfServerErrors++},e.prototype.checkSession=function(){return this.sessionCreated},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n=this;return r(this,function(r){switch(r.label){case 0:return this.checkSession()||this.setConnectionStatus("pending"),[4,Ym(this.checkSession.bind(this),1e3,1e4,"session creation").then(function(t){t>0&&Jh("Session creation is ready in ".concat(t," ms")),n.postMessage(e)}).catch(function(e){Gh("Session creation wait timed out in ".concat(e," ms")),n.setConnectionStatus("online"),n.sendDisconnectMessage()})];case 1:return r.sent(),this.setConnectionStatus("online"),t(),[2]}})})},e.prototype.sendTyping=function(e){},e.prototype.setVisitorInfo=function(e,n,r){Jh("Visitor Info Message = ".concat(JSON.stringify(e))),this.visitorInfo={deviceId:"Widget",userId:e.userId,displayName:e.displayName||e.name,email:e.email,isAdmin:this.isAdmin,urlAttributes:this.urlAttributes},this.attributes=t(t(t({},e.attributes),this.attributes),{currentUrl:window.location.href}),this.accessToken=e.accessToken,this.startSession(n),this.postVisitorInfo(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){Jh("DISPOSE called - cleaning up connection"),this.isDisposed=!0,this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.ws&&this.wsClose(),Jh("Closed web socket (dispose)")},e.prototype.sleep=function(){var e=this;Jh("SLEEP called - scheduling delayed close"),this.checkConnection()&&(Jh("SLEEP - Notifying router of user backgrounded"),this.emit("user backgrounded")),this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.sleepTimeoutId=window.setTimeout(function(){e.ws&&e.wsClose(),Jh("SLEEP - closed web socket after ".concat(e.SLEEP_DELAY_MS,"ms delay")),e.sleepTimeoutId=null},this.SLEEP_DELAY_MS),Jh("SLEEP - WebSocket will close in ".concat(this.SLEEP_DELAY_MS,"ms if not woken up"))},e.prototype.wakeup=function(){var e=this;if(Jh("WAKEUP called - userId:",this._userId),this.sleepTimeoutId)return clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null,Jh("WAKEUP - Cancelled pending sleep, keeping WebSocket open"),void(this.checkConnection()&&(Jh("WAKEUP - Notifying router of user foregrounded"),this.emit("user foregrounded")));this.isDisposed=!1,this._userId?(Jh("WAKEUP - Setting accountStatus and connectionStatus to ONLINE"),this.setAccountStatus("online"),this.setConnectionStatus("online"),Jh("Waking up - setting status to online"),Jh("WAKEUP - Calling autoReconnect"),this.autoReconnect(this.wsCreate.bind(this,"wakeup")),Ym(this.checkConnection.bind(this),100,5e3,"wakeup-connection").then(function(){Jh("WAKEUP - Notifying router of user foregrounded (after reconnect)"),e.emit("user foregrounded"),e.requestMissedMessages()}).catch(function(){Jh("WAKEUP - Connection not ready after 5s, skipping missed messages request")})):Jh("WAKEUP - No userId, returning early")},e.prototype.requestMissedMessages=function(){Jh("Requesting missed messages from server"),this.emit("request missed messages")},e.prototype.notifyDisconnecting=function(){if(this.checkConnection()){Jh("Notifying router of user disconnecting");var e=JSON.stringify({event:"user disconnecting",data:{reason:"tab_close"},sender:this.visitorInfo,sessionId:this._sessionId,timeMs:Date.now()});try{this.ws.send(e)}catch(e){Jh("Failed to send disconnect notification:",e)}}},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){return this.emit("barge out"),[2]})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(t){return this.visitorInfo.displayName=e,this.emit("barge in"),[2]})})},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return Jh('Sending "button pressed" event - id: '.concat(e)),t={id:e},this.emit("button pressed",t),[2]})})},e.prototype.postVisitorInfo=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return this.sessionCreated=!1,this.emit("user joined"),[2]})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,a,o,i,s,u,l,c,d,f;return r(this,function(r){return t=this._userId,n=this._sessionId,a=this.accessToken,o=this.attributes||{},(i=localStorage.getItem("xa_rwg_token"))&&(o.rwg_token=i),(s=localStorage.getItem("xa_merchant_id"))&&(o.merchant_id=s),(u=localStorage.getItem("xa_environment"))&&(o.environment=u),(l=localStorage.getItem("xa_enablePreferredTime"))&&(o.enablePreferredTime=l),(c=localStorage.getItem("xa_service"))&&(o.service=c),(d=localStorage.getItem("xa_origin"))&&(o.origin=d),dm(o),o.currentTime=(new Date).toISOString(),f=Fm(e,t,this.isNewSession,n,a,o,this.visitorInfo),this.emit("new message",f),[2]})})},e.prototype.startSession=function(e){this.visitorInfo.userId?this._userId="".concat(this.visitorInfo.userId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat(xm());var t=new URL(window.location.href).searchParams.get("sessionId");t?(this._sessionId=t,this.dispatch(Pm(this._sessionId)),Jh("Using enforced session id: ".concat(this._sessionId))):e?(this._sessionId=e,Jh("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat(xm()),this.dispatch(Pm(this._sessionId)),Jh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0,Jh("Started session: ".concat(this._sessionId))},e}();function qm(e){return"Bot"===e.deviceId?"agent:bot:".concat(e.userId):"agent:widget:".concat(e.userId)}function Ym(e,t,n,r){var a=0,o=function(i,s){a>=n?s(a):e()?i(a):(a+=t,r&&Jh("Still waiting for ".concat(r," (").concat(a," ms)")),setTimeout(function(e){return o(i,s)},t))};return new Promise(o)}const Vm=Object.create(null);Vm.open="0",Vm.close="1",Vm.ping="2",Vm.pong="3",Vm.message="4",Vm.upgrade="5",Vm.noop="6";const Qm=Object.create(null);Object.keys(Vm).forEach(e=>{Qm[Vm[e]]=e});const $m={type:"error",data:"parser error"},Km="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Jm="function"==typeof ArrayBuffer,Gm=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Xm=({type:e,data:t},n,r)=>Km&&t instanceof Blob?n?r(t):Zm(t,r):Jm&&(t instanceof ArrayBuffer||Gm(t))?n?r(t):Zm(new Blob([t]),r):r(Vm[e]+(t||"")),Zm=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function eg(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let tg;const ng="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rg="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)rg[ng.charCodeAt(e)]=e;const ag="function"==typeof ArrayBuffer,og=(e,t)=>{if("string"!=typeof e)return{type:"message",data:sg(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:ig(e.substring(1),t)};return Qm[n]?e.length>1?{type:Qm[n],data:e.substring(1)}:{type:Qm[n]}:$m},ig=(e,t)=>{if(ag){const n=(e=>{let t,n,r,a,o,i=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const l=new ArrayBuffer(i),c=new Uint8Array(l);for(t=0;t<s;t+=4)n=rg[e.charCodeAt(t)],r=rg[e.charCodeAt(t+1)],a=rg[e.charCodeAt(t+2)],o=rg[e.charCodeAt(t+3)],c[u++]=n<<2|r>>4,c[u++]=(15&r)<<4|a>>2,c[u++]=(3&a)<<6|63&o;return l})(e);return sg(n,t)}return{base64:!0,data:e}},sg=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,ug=String.fromCharCode(30);function lg(){return new TransformStream({transform(e,t){!function(e,t){Km&&e.data instanceof Blob?e.data.arrayBuffer().then(eg).then(t):Jm&&(e.data instanceof ArrayBuffer||Gm(e.data))?t(eg(e.data)):Xm(e,!1,e=>{tg||(tg=new TextEncoder),t(tg.encode(e))})}(e,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const e=new DataView(a.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{a=new Uint8Array(9);const e=new DataView(a.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let cg;function dg(e){return e.reduce((e,t)=>e+t.length,0)}function fg(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let a=0;a<t;a++)n[a]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}var pg=hg;function hg(e){if(e)return function(e){for(var t in hg.prototype)e[t]=hg.prototype[t];return e}(e)}hg.prototype.on=hg.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},hg.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},hg.prototype.off=hg.prototype.removeListener=hg.prototype.removeAllListeners=hg.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var a=0;a<r.length;a++)if((n=r[a])===t||n.fn===t){r.splice(a,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},hg.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var a=(n=n.slice(0)).length;r<a;++r)n[r].apply(this,t)}return this},hg.prototype.emitReserved=hg.prototype.emit,hg.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},hg.prototype.hasListeners=function(e){return!!this.listeners(e).length};const vg="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),mg="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function gg(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const yg=mg.setTimeout,bg=mg.clearTimeout;function xg(e,t){t.useNativeTimers?(e.setTimeoutFn=yg.bind(mg),e.clearTimeoutFn=bg.bind(mg)):(e.setTimeoutFn=mg.setTimeout.bind(mg),e.clearTimeoutFn=mg.clearTimeout.bind(mg))}function wg(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,a=e.length;r<a;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function kg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class Sg extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class _g extends pg{constructor(e){super(),this.writable=!1,xg(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new Sg(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=og(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:""}}class Og extends _g{constructor(){super(...arguments),this._polling=!1}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(ug),r=[];for(let e=0;e<n.length;e++){const a=og(n[e],t);if(r.push(a),"error"===a.type)break}return r})(e,this.socket.binaryType).forEach(e=>{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 a=0;e.forEach((e,o)=>{Xm(e,!1,e=>{r[o]=e,++a===n&&t(r.join(ug))})})})(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]=kg()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let Cg=!1;try{Cg="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Gh){}const Pg=Cg;function Tg(){}class jg extends Og{constructor(e){if(super(e),"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}}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}}class Mg extends pg{constructor(e,t,n){super(),this.createRequest=e,xg(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=gg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=Mg.requestsCount++,Mg.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=Tg,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Mg.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()}}if(Mg.requestsCount=0,Mg.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Eg);else if("function"==typeof addEventListener){addEventListener("onpagehide"in mg?"pagehide":"unload",Eg,!1)}function Eg(){for(let e in Mg.requests)Mg.requests.hasOwnProperty(e)&&Mg.requests[e].abort()}const Ng=function(){const e=Ig({xdomain:!1});return e&&null!==e.responseType}();function Ig(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Pg))return new XMLHttpRequest}catch(e){}if(!t)try{return new(mg[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Dg="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Rg extends _g{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Dg?{}:gg(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=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}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<e.length;t++){const n=e[t],r=t===e.length-1;Xm(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&vg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},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]=kg()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ag=mg.WebSocket||mg.MozWebSocket;const Lg={websocket:class extends Rg{createSocket(e,t,n){return Dg?new Ag(e,t,n):t?new Ag(e,t):new Ag(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends _g{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}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){cg||(cg=new TextDecoder);const n=[];let r=0,a=-1,o=!1;return new TransformStream({transform(i,s){for(n.push(i);;){if(0===r){if(dg(n)<1)break;const e=fg(n,1);o=!(128&~e[0]),a=127&e[0],r=a<126?3:126===a?1:2}else if(1===r){if(dg(n)<2)break;const e=fg(n,2);a=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(dg(n)<8)break;const e=fg(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue($m);break}a=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(dg(n)<a)break;const e=fg(n,a);s.enqueue(og(o?e:cg.decode(e),t)),r=0}if(0===a||a>e){s.enqueue($m);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=lg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const a=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),a())}).catch(e=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&vg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends jg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Ng&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Mg(Ig,this.uri(),e)}}},Ug=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,zg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Fg(e){if(e.length>8e3)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 a=Ug.exec(e||""),o={},i=14;for(;i--;)o[zg[i]]=a[i]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const Bg="function"==typeof addEventListener&&"function"==typeof removeEventListener,Wg=[];Bg&&addEventListener("offline",()=>{Wg.forEach(e=>e())},!1);class Hg extends pg{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Fg(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Fg(t.host).host);xg(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=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),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 e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),Bg&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{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"})},Wg.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),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 this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Hg.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);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))}onOpen(){this.readyState="open",Hg.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=wg(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,vg(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}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 a={type:e,data:t,options:n};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),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(e){if(Hg.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Bg&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Wg.indexOf(this._offlineEventListener);-1!==e&&Wg.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Hg.protocol=4;class qg extends Hg{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Hg.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Hg.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function a(){n||(n=!0,l(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,a(),this.emitReserved("upgradeError",n)};function i(){o("transport closed")}function s(){o("socket closed")}function u(e){t&&e.name!==t.name&&a()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",i),this.off("close",s),this.off("upgrading",u)};t.once("open",r),t.once("error",o),t.once("close",i),this.once("close",s),this.once("upgrading",u),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Yg=class extends qg{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>Lg[e]).filter(e=>!!e)),super(e,n)}};const Vg="function"==typeof ArrayBuffer,Qg=Object.prototype.toString,$g="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Qg.call(Blob),Kg="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Qg.call(File);function Jg(e){return Vg&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||$g&&e instanceof Blob||Kg&&e instanceof File}function Gg(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Gg(e[t]))return!0;return!1}if(Jg(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Gg(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Gg(e[t]))return!0;return!1}function Xg(e){const t=[],n=e.data,r=e;return r.data=Zg(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Zg(e,t){if(!e)return e;if(Jg(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Zg(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Zg(e[r],t));return n}return e}function ey(e,t){return e.data=ty(e.data,t),delete e.attachments,e}function ty(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=ty(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ty(e[n],t));return e}const ny=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ry;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(ry||(ry={}));function ay(e){return"[object Object]"===Object.prototype.toString.call(e)}class oy extends pg{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===ry.BINARY_EVENT;n||t.type===ry.BINARY_ACK?(t.type=n?ry.EVENT:ry.ACK,this.reconstructor=new iy(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Jg(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===ry[n.type])throw new Error("unknown packet type "+n.type);if(n.type===ry.BINARY_EVENT||n.type===ry.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const a=e.substring(r,t);if(a!=Number(a)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(a)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!oy.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case ry.CONNECT:return ay(t);case ry.DISCONNECT:return void 0===t;case ry.CONNECT_ERROR:return"string"==typeof t||ay(t);case ry.EVENT:case ry.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===ny.indexOf(t[0]));case ry.ACK:case ry.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class iy{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=ey(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var sy=Object.freeze({__proto__:null,Decoder:oy,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==ry.EVENT&&e.type!==ry.ACK||!Gg(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===ry.EVENT?ry.BINARY_EVENT:ry.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==ry.BINARY_EVENT&&e.type!==ry.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Xg(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return ry}});function uy(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ly=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class cy extends pg{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[uy(e,"open",this.onopen.bind(this)),uy(e,"packet",this.onpacket.bind(this)),uy(e,"error",this.onerror.bind(this)),uy(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,a;if(ly.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:ry.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const i=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(a=this.io.engine)||void 0===a?void 0:a._hasPingExpired());return this.flags.volatile&&!i||(s?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(a),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const a=(e,t)=>e?r(e):n(t);a.withError=!0,t.push(a),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)=>{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:ry.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),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ry.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 ry.EVENT:case ry.BINARY_EVENT:this.onevent(e);break;case ry.ACK:case ry.BINARY_ACK:this.onack(e);break;case ry.DISCONNECT:this.ondisconnect();break;case ry.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:ry.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}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:ry.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;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function dy(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}dy.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)},dy.prototype.reset=function(){this.attempts=0},dy.prototype.setMin=function(e){this.ms=e},dy.prototype.setMax=function(e){this.max=e},dy.prototype.setJitter=function(e){this.jitter=e};class fy extends pg{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,xg(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 dy({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||sy;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,e||(this.skipReconnect=!0),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 Yg(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=uy(t,"open",function(){n.onopen(),e&&e()}),a=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=uy(t,"error",a);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),a(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(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(uy(e,"ping",this.onping.bind(this)),uy(e,"data",this.ondata.bind(this)),uy(e,"error",this.onerror.bind(this)),uy(e,"close",this.onclose.bind(this)),uy(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){vg(()=>{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 cy(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),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 py={};function hy(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=Fg(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 a=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,a=n.id,o=n.path,i=py[a]&&o in py[a].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?s=new fy(r,t):(py[a]||(py[a]=new fy(r,t)),s=py[a]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(hy,{Manager:fy,Socket:cy,io:hy,connect:hy});var vy=function(){function e(e,t){this.config=e,this.token=t.token}return e.prototype.init=function(e){var t=this;Jh("[StentorServerChat] Creating new socket connection to ".concat(this.config.url)),this.socket=hy(this.config.url,{transports:["websocket"],reconnection:!0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:5}),this.dispatch=e,this.socket.on("connect",function(){Jh("[StentorServerChat] Socket CONNECTED - ID: ".concat(t.socket.id))}),this.socket.on("account_status",function(n){Jh("SERVER: account_status: ".concat(JSON.stringify(n))),t.token||(t.token=xm(),e({type:"receiveToken",detail:{token:t.token,timestamp:+new Date,type:"receiveToken",user:void 0}}),Jh("CLIENT: created token: ".concat(t.token))),t.socket.emit("connection update",t.token),e({type:"account_status",detail:{status:"online",timestamp:+new Date}})}),this.socket.on("new message",function(e){Jh("SERVER: new message: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:e.username,nick:"agent:robot"},msg:e.message,timestamp:+new Date}})}),this.socket.on("user joined",function(e){Jh("SERVER: user joined: ".concat(JSON.stringify(e))),t.visitorInfo.token=e.token,t.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{displayName:e.username,nick:e.nick||"agent:robot",avatarPath:e.avatarPath},timestamp:+new Date}})}),this.socket.on("user left",function(e){Jh("SERVER: user left: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{displayName:e.username,nick:"agent:robot"},timestamp:+new Date}})}),this.socket.on("typing",function(e){Jh("SERVER: typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})}),this.socket.on("stop typing",function(e){Jh("SERVER: stop typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})}),this.socket.on("disconnect",function(e){var n="string"==typeof e?e:String(e||"unknown");Jh("[StentorServerChat] Socket DISCONNECTED - Reason: ".concat(n)),Jh("SERVER: disconnect"),t.dispatch(xv("offline")),t.dispatch(wv("offline"))}),this.socket.on("reconnect",function(){Jh("SERVER: reconnect"),t.dispatch(xv("online")),t.dispatch(wv("online"))}),this.socket.on("reconnect_failed",function(e){Jh("SERVER: reconnect_failed",e),t.dispatch(xv("offline")),t.dispatch(wv("offline"))}),this.socket.on("reconnect_error",function(e){Jh("SERVER: reconnect_error",e),t.dispatch(xv("offline"))}),this.dispatch(wv("pending"))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendChatMsgRequest=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendTyping=function(e){this.socket.emit(e?"typing":"stop typing")},e.prototype.setVisitorInfo=function(e,t,n){this.visitorInfo=e,this.socket.emit("add user",e),n()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){var e;Jh("[StentorServerChat] dispose() called - manually disconnecting socket"),null===(e=this.socket)||void 0===e||e.disconnect()},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e}();function my(e,t){return new Ov(function(e,t){var n,r,a,o,i,s;switch(e.type){case"direct":return new Um({url:e.serverUrl,key:e.accountKey,timeout:e.timeout},t);case"websocket":return new vy({url:e.serverUrl},t);case"websocketraw":return new Hm({url:e.serverUrl},t);case"mcp":return new Rm({serverUrl:e.serverUrl,mode:null===(n=e.mcp)||void 0===n?void 0:n.mode,authToken:null===(r=e.mcp)||void 0===r?void 0:r.authToken,debugMode:null===(a=e.mcp)||void 0===a?void 0:a.debugMode,pageContextOverride:null===(o=e.mcp)||void 0===o?void 0:o.pageContextOverride,showAiBadge:null===(i=e.mcp)||void 0===i?void 0:i.showAiBadge,channelId:null===(s=e.mcp)||void 0===s?void 0:s.channelId},t);case"local":return new zm;default:throw Sv(e.type)}}(e,t))}var gy=Z.createContext(null);function yy(){var e=_v(),t=Z.useContext(gy);return Z.useCallback(function(n){n?t&&e(n(t)):console.warn("react bug? Someone invokes with null")},[e,t])}function by(){var e=yy();return Z.useCallback(function(t,n){e(gv(t,n))},[e])}var xy={type:"newWindow"};function wy(e){return{type:"visual_status",detail:{status:e,timestamp:(new Date).getTime()}}}var ky="xa_chat",Sy="resume",_y="Continue your conversation";function Oy(e){return!!(null==e?void 0:e.some(function(e){return"chat.msg"===e.type}))}function Cy(e,n){var r=n.arrivedViaChatLink;if(!n.hasConversation||!(null==e?void 0:e.message)&&!r)return e;var a=r?{delay:0}:{},o=null==e?void 0:e.mobile;return t(t(t(t({},e),{message:_y}),a),o&&{mobile:t(t(t({},o),("string"==typeof o.message||r)&&{message:_y}),a)})}var Py="(max-width: 640px), (max-height: 480px) and (pointer: coarse)";function Ty(e,t,n,r,a){var o,i,s;if(void 0===a&&(void 0===s&&(s=window),a="function"==typeof s.matchMedia&&s.matchMedia(Py).matches),!t||!n)throw new Error("OpenUrl: No dispatch and/or visual.");if(e!==tv){try{var u=new URL(e),l=new URLSearchParams(u.search);l.has("utm_source")||l.append("utm_source","xapp"),u.search=l.toString(),e=u.toString()}catch(e){}var c=r.type;switch(c){case"newWindow":n.opened&&t(wy({opened:!1})),window.open(e,"callout-option","toolbar=0,status=0,width=".concat(r.width||1e3,",height=").concat(r.height||700));break;case"newTab":n.opened&&t(wy({opened:!1})),window.open(e,"_blank");break;case"sameWindow":a?t(wy({opened:!1})):n.opened||t(wy({opened:!0})),window.open(function(e,t){try{var n=new URL(e);return n.origin!==t||n.searchParams.get(ky)===Sy?e:(n.searchParams.set(ky,Sy),n.toString())}catch(t){return e}}(e,window.location.origin),"_self");break;default:Sv(c)}}else{var d=null===(o=window.xafwControl)||void 0===o?void 0:o.openForm;if(!d)return void Gh("Cannot find toggleForm! Update form widget!");var f=!1,p=null===(i=window.xafwControl)||void 0===i?void 0:i.formStatus;p?f=p().active:Gh("Cannot find formStatus! Update form widget!"),f||(d(),n.opened&&t(wy({opened:!1})))}}function jy(){var e=rv();return Z.useCallback(function(t,n,r,a){a||(a=(null==e?void 0:e.urls)?function(e,t){if(t.policies)for(var n=0,r=t.policies;n<r.length;n++){var a=r[n];try{if(new RegExp(a.pattern,"gi").test(e))return a.behavior}catch(e){}}return t.defaultBehavior||xy}(t,e.urls):xy),Ty(t,n,r,a)},[e])}function My(){var e=jy(),t=_v(),n=Dh(function(e){return e.visuals}),r=by();return Z.useCallback(function(a){a.actionUrl?e(a.actionUrl,t,n):r(a.label)},[t,r,e,n])}var Ey=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return function(e){var t=e;return{content:e.content,imageUrl:e.smallImageUrl||t.imageUrl,title:e.title,imageActionUrl:null==e?void 0:e.imageActionUrl,buttons:e.buttons?e.buttons.map(function(e){return{actionUrl:e.openUrlAction||e.url,label:e.title}}):void 0}}(t)},[t]),a=n.user,o=My();return f.jsx(vv,{showAvatar:!0,user:a,children:f.jsx("div",{className:"chat-msg",children:f.jsx(fv,{card:r,onButtonClick:o})})})};function Ny(e){return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function Iy(e){var t,n=Z.useState(e.getArray()),r=n[0],a=n[1],o=(t=Z.useRef(!1),Z.useEffect(function(){return t.current=!0,function(){t.current=!1}},[]),Z.useCallback(function(){return t.current},[]));return Z.useEffect(function(){var t=e.subscribe(function(e){o()&&a(e)});return function(){t.unsubscribe()}},[o,e]),r}var Dy=[];function Ry(e){var t=e.get()||Dy,n=Array.isArray(t)?function(e){var t=e||[],n=[];function r(){for(var e=0,r=n;e<r.length;e++)(0,r[e])(t)}return{getArray:function(){return t},push:function(e){t=a(a([],t,!0),[e],!1),r()},unshift:function(e){t=a([e],t,!0),r()},subscribe:function(e){return n.push(e),{unsubscribe:function(){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}}}(t):t;return n!==t&&e.set(n),Iy(n)}var Ay=function(e,t){return{get:function(){return e[t]},set:function(n){return e[t]=n}}}(globalThis,"xappMsgMiddlewares");function Ly(){return function(e){var t=Ry(e);return Z.useMemo(function(){return Ny(t)},[t])}(Ay)}function Uy(e){return e.hasOwnProperty("label")}function zy(e){return e.url||e.imageActionUrl}var Fy=function(e){var t=_v(),n=Dh(function(e){return e.visuals}),r=e.url,a=e.className,o=e.onOpen,i=Z.useCallback(function(){o&&o(r,t,n)},[r,o]);return r?f.jsx("div",{onClick:i,className:a,children:e.children}):f.jsx("div",{onClick:e.onClick,className:a,children:e.children})},By=function(e){var t,n=e.item,r=e.onButtonClick,a=e.onExecute,o=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),i=Z.useCallback(function(){var e;1===(null===(e=n.buttons)||void 0===e?void 0:e.length)?r(n.buttons[0]):a(n.title,n.token)},[n,a,r]),s="xappw-chat-action-item ".concat(o?"xappw-chat-action-item--action":""," ").concat(e.className);return f.jsx(Fy,{className:s,url:zy(n),onClick:i,onOpen:e.onOpenUrl,children:e.children})},Wy=function(e){var t,n=e.item,r=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),a=zy(n);if(n.imageUrl){var o=r?null:n.imageActionUrl;return f.jsx("div",{className:e.className,children:f.jsx(dv,{imageUrl:n.imageUrl,imageActionUrl:!a&&o})})}return e.emptyImageVisible?f.jsx("div",{className:e.className}):f.jsx(f.Fragment,{})},Hy=function(e){var t,n=e.item;return f.jsx(By,{className:"chat-list-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"chat-list-item",children:[f.jsx(Wy,{item:n,className:"chat-list-item__img",emptyImageVisible:e.emptyImageVisible}),n.title&&f.jsx("div",{className:"chat-list-item__title",children:f.jsx("span",{children:n.title})}),n.subTitle&&f.jsx("div",{className:"chat-list-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(cv,{className:"chat-list-item__actions",buttons:n.buttons,onClick:e.onButtonClick})]})})};var qy=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M 2.5 -15 L -2.5 0 L 2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})};var Yy=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M -2.5 -15 L 2.5 0 L -2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})},Vy=function(e){var t=Z.useRef(null),n=Z.useState(0),r=n[0],a=n[1];function o(e){var n,o,i=t.current;if(i){var s=i.getElementsByClassName("xappw-carousel-items__item"),u=s.length,l=r;1===e?r<u-1&&l++:r>0&&l--;for(var c=0,d=0;d<s.length&&d!==l;d++)c+=null!==(o=null===(n=s.item(d))||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:0;i.scrollLeft=c,a(l)}}var i=1===e.list.items.length,s=e.list.items.some(function(e){return e.imageUrl}),u=e.list.items.map(function(t,n){return f.jsx("div",{className:"xappw-carousel-items__item",children:f.jsx(Hy,{item:t,emptyImageVisible:s,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsxs("div",{className:"xappw-carousel",children:[!i&&f.jsx("div",{className:"xappw-carousel__prev",children:f.jsx(qy,{onClick:function(){return o(-1)}})}),f.jsx("div",{ref:t,className:"xappw-carousel-items ".concat(i?"xappw-carousel-items--one-item":""),children:u}),!i&&f.jsx("div",{className:"xappw-carousel__next",children:f.jsx(Yy,{onClick:function(){return o(1)}})})]})};var Qy=function(e){var t=e.url,n=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:e.className,onClick:n,children:f.jsxs("svg",{viewBox:"0 0 20 20",children:[f.jsx("path",{d:"M17 17H3V3h5V1H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-2z"}),f.jsx("path",{d:"M19 1h-8l3.29 3.29-5.73 5.73 1.42 1.42 5.73-5.73L19 9V1z"})]})})};function $y(e,t){for(var n=-1,r=0,a=t;r<a.length;r++){var o=a[r],i=e.indexOf(o);i>=0&&(n<0||n>=0&&i<n)&&(n=i)}return n}var Ky=[":","/"],Jy=["/"],Gy=["?","#"],Xy=["#"],Zy=[function(e){var t=e.indexOf("://");return t<0?t:t+3},function(e){return $y(e,Ky)},function(e){return":"!==e.charAt(0)?-1:$y(e,Jy)},function(e){var t=$y(e,Gy);return t>=0?t:e.length},function(e){return $y(e,Xy)}];var eb="/...";function tb(e,t){if(e.length<t)return e;var n=function(e){for(var t=[],n=e,r=0,a=Zy;r<a.length;r++){var o=a[r],i=Math.max(0,o(n,e)),s=n.substring(0,i);t.push(s),n=n.substring(i)}return n&&t.push(n),t}(e);function r(){return n.join("")}function a(){return r().length>t}function o(e){a()&&(n[e]="")}if(":80"===n[2]&&"http://"===n[0]&&o(2),":443"===n[2]&&"https://"===n[0]&&o(2),o(5),o(4),o(2),o(0),a()){var i=n[3],s=r().length-i.length,u=t-s;if(u<0)n[3]="";else if(u<i.length){var l=i.length-u+4;n[3]=eb+i.substring(l)}}return r()}var nb=function(e){var t=e.url,n=e.className,r=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:n,onClick:r,children:tb(t,40)})},rb=function(e){var t,n=e.item,r=e.layout||"normal",a=n.url||n.imageActionUrl;return f.jsx(By,{className:"xappw-vlist-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"xappw-vlist-item xappw-vlist-item--".concat(r),children:[f.jsxs("div",{className:"xappw-vlist-item__description",children:[n.title&&f.jsx("div",{className:"xappw-vlist-item__title",children:f.jsx("span",{children:n.title})}),a&&!n.hideUrl&&f.jsxs("div",{className:"xappw-vlist-item__link-row",children:[f.jsx(nb,{url:a,className:"xappw-vlist-item__link"}),f.jsx(Qy,{url:a,className:"xappw-vlist-item__external-link"})]}),n.subTitle&&f.jsx("div",{className:"xappw-vlist-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(cv,{buttons:n.buttons,onClick:e.onButtonClick})]}),f.jsx("div",{className:"xappw-vlist-item__side",children:f.jsx(Wy,{item:n,className:"xappw-vlist-item__img",emptyImageVisible:e.emptyImageVisible})})]})})},ab=function(e){var t=e.list,n=Z.useRef(null),r=t.items.some(function(e){return e.imageUrl}),a=!t.items.some(function(e){var t;return e.subTitle||(null===(t=e.buttons)||void 0===t?void 0:t.length)}),o=t.items.map(function(t,n){return f.jsx("div",{className:"xappw-vlist-container__item",children:f.jsx(rb,{item:t,layout:a?"titles":"normal",emptyImageVisible:r,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsx("div",{className:"xappw-vlist",children:f.jsxs("div",{ref:n,className:"xappw-vlist-container",children:[e.list.title&&f.jsx("div",{className:"xappw-vlist__header",children:e.list.title}),o]})})},ob=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(ob.name));var r=Z.useMemo(function(){return function(e){return{type:e.type,title:e.title,items:e.items.map(function(e){var t,n,r={title:e.title,subTitle:e.description,token:e.token,url:e.url,hideUrl:e.hideUrl,imageUrl:(null===(t=e.image)||void 0===t?void 0:t.url)||e.imageUrl,imageActionUrl:null===(n=e.image)||void 0===n?void 0:n.imageActionUrl},a=e.buttons;return a&&a.length>0&&(r.buttons=a.map(function(e){return{actionUrl:e.openUrlAction,label:e.title}})),r})}}(t)},[t]),a=by(),o=Z.useCallback(function(e,t,n){a(t,{token:n,action:"click",ui:e})},[a]),i=My(),s=n.user;return f.jsxs(vv,{showAvatar:!1,user:s,fullWidth:!0,children:["CAROUSEL"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--fullwidth chat-msg--no-ava",children:f.jsx(Vy,{list:r,onExecute:o.bind(null,"carousel"),onButtonClick:i,onOpenUrl:n.openUrl})}),"LIST"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(ab,{list:r,onExecute:o.bind(null,"list"),onButtonClick:i,onOpenUrl:n.openUrl})})]})},ib=function(){},sb=function(){function e(e){this.cache={},this.template=e}return e.prototype.resolve=function(e){var t,n,r;if(e){var a=this.cache,o=e.nick,i=a[o];return i||(i={user:e,send:null!==(t=this.template.send)&&void 0!==t?t:ib,write:null!==(n=this.template.write)&&void 0!==n?n:ib,openUrl:null!==(r=this.template.openUrl)&&void 0!==r?r:ib},a[o]=i),i}},e}(),ub=function(){return f.jsx(f.Fragment,{})},lb=function(e){var n=e.items,r=e.checked,a=e.onChange,o=Z.useCallback(function(e){var n,o=e.target.value;a(t(t({},r),((n={})[o]=!r[o],n)))},[r,a]);return f.jsx("ul",{className:"xappw-multiselect",children:null==n?void 0:n.map(function(e){return f.jsx("li",{children:f.jsxs("label",{children:[f.jsx("input",{type:"checkbox",checked:r[e.id]||!1,onChange:o,value:e.id}),f.jsx("span",{children:e.title})]})},e.id)})})};var cb=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return t.items},[t]),a=n.user,o=Z.useState({}),i=o[0],s=o[1],u=Z.useCallback(function(){n.send({type:"custom",payload:JSON.stringify({type:"OPTION_SELECT_REQUEST",intentId:"OptionSelect",selected:Object.keys(i).map(function(e){return{id:e}})})})},[n,i]);return f.jsx(vv,{showAvatar:!0,user:a,children:f.jsx("div",{className:"chat-msg",children:f.jsxs("div",{children:[f.jsx(lb,{items:r,checked:i,onChange:s}),f.jsx(uv,{label:"Submit",onClick:u})]})})})},db=function(e){var t=e.table;return f.jsxs("div",{className:"xappw-table",children:[t.title&&f.jsx("div",{className:"xappw-table__header",children:t.title}),f.jsx("div",{className:"xappw-table__container",children:f.jsxs("table",{children:[f.jsx("thead",{children:f.jsx("tr",{children:t.headers.map(function(e,t){return f.jsx("th",{scope:"col",children:e},"".concat(e,"-").concat(t))})})}),f.jsx("tbody",{children:t.rows.map(function(e,t){return f.jsx("tr",{children:e.map(function(e,t){return f.jsx("td",{children:e},t)})},t)})})]})})]})},fb=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(fb.name));return f.jsx(vv,{showAvatar:!1,user:n.user,fullWidth:!0,children:f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(db,{table:t})})})},pb=Ny([function(e){return function(t){var n,r=t.msg,a=t.ctx;return!(n=r)||"LIST"!==n.type&&"CAROUSEL"!==n.type?e(t):f.jsx(ob,{msg:r,ctx:a})}},function(e){return function(t){var n,r=t.msg,a=t.ctx;return(n=r)&&"CARD"===n.type?f.jsx(Ey,{msg:r,ctx:a}):e(t)}},function(e){return function(t){var n=t.msg,r=t.ctx;return"MultiSelect"===n.type?f.jsx(cb,{msg:n,ctx:r}):e(t)}},function(e){return function(t){var n,r=t.msg,a=t.ctx;return(n=r)&&"TABLE"===n.type&&Array.isArray(n.headers)&&Array.isArray(n.rows)?f.jsx(fb,{msg:r,ctx:a}):e(t)}}]);function hb(){var e,t=(e=Ly(),Z.useMemo(function(){return Ny([e,pb])},[e]));return Z.useMemo(function(){return t(ub)},[t])}var vb=pb(ub);function mb(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var gb=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),yb=()=>Math.random().toString(36).substring(7).split("").join("."),bb={INIT:`@@redux/INIT${yb()}`,REPLACE:`@@redux/REPLACE${yb()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yb()}`};function xb(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function wb(e,t,n){if("function"!=typeof e)throw new Error(mb(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(mb(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(mb(1));return n(wb)(e,t)}let r=e,a=t,o=new Map,i=o,s=0,u=!1;function l(){i===o&&(i=new Map,o.forEach((e,t)=>{i.set(t,e)}))}function c(){if(u)throw new Error(mb(3));return a}function d(e){if("function"!=typeof e)throw new Error(mb(4));if(u)throw new Error(mb(5));let t=!0;l();const n=s++;return i.set(n,e),function(){if(t){if(u)throw new Error(mb(6));t=!1,l(),i.delete(n),o=null}}}function f(e){if(!xb(e))throw new Error(mb(7));if(void 0===e.type)throw new Error(mb(8));if("string"!=typeof e.type)throw new Error(mb(17));if(u)throw new Error(mb(9));try{u=!0,a=r(a,e)}finally{u=!1}return(o=i).forEach(e=>{e()}),e}f({type:bb.INIT});return{dispatch:f,subscribe:d,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(mb(10));r=e,f({type:bb.REPLACE})},[gb]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(mb(11));function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[gb](){return this}}}}}function kb(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const a=t[r];"function"==typeof e[a]&&(n[a]=e[a])}const r=Object.keys(n);let a;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:bb.INIT}))throw new Error(mb(12));if(void 0===n(void 0,{type:bb.PROBE_UNKNOWN_ACTION()}))throw new Error(mb(13))})}(n)}catch(e){a=e}return function(e={},t){if(a)throw a;let o=!1;const i={};for(let a=0;a<r.length;a++){const s=r[a],u=n[s],l=e[s],c=u(l,t);if(void 0===c)throw t&&t.type,new Error(mb(14));i[s]=c,o=o||c!==l}return o=o||r.length!==Object.keys(e).length,o?i:e}}function Sb(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function _b(e){return({dispatch:t,getState:n})=>r=>a=>"function"==typeof a?a(t,n,e):r(a)}var Ob=_b(),Cb=_b;const Pb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Sb:Sb.apply(null,arguments)};var Tb=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};const jb=e=>t=>{setTimeout(t,e)},Mb=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let a=!0,o=!1,i=!1;const s=new Set,u="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(l=window.requestAnimationFrame,c=100,e=>{let t,n,r=!1;const a=()=>{r||(r=!0,cancelAnimationFrame(t),clearTimeout(n),e())};t=l(a),n=setTimeout(a,c)}):jb(10):"callback"===e.type?e.queueNotification:jb(e.timeout);var l,c;const d=()=>{i=!1,o&&(o=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>a&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return a=!e?.meta?.RTK_autoBatch,o=!a,o&&(i||(i=!0,u(d))),r.dispatch(e)}finally{a=!0}}})};function Eb(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:a=!0}=e??{};let o=new Tb;return t&&("boolean"==typeof t?o.push(Ob):o.push(Cb(t.extraArgument))),o},{reducer:n,middleware:r,devTools:a=!0,duplicateMiddlewareCheck:o=!0,preloadedState:i,enhancers:s}=e||{};let u;if("function"==typeof n)u=n;else{if(!xb(n))throw new Error(`Minified Redux Toolkit error #${l=1}; visit https://redux-toolkit.js.org/Errors?code=${l} for the full message or use the non-minified dev environment for full errors. `);u=kb(n)}var l;let c;c="function"==typeof r?r(t):t();let d=Sb;a&&(d=Pb({trace:!1,..."object"==typeof a&&a}));const f=function(...e){return t=>(n,r)=>{const a=t(n,r);let o=()=>{throw new Error(mb(15))};const i={getState:a.getState,dispatch:(e,...t)=>o(e,...t)},s=e.map(e=>e(i));return o=Sb(...s)(a.dispatch),{...a,dispatch:o}}}(...c),p=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Tb(e);return n&&r.push(Mb("object"==typeof n?n:void 0)),r})(f);return wb(u,i,d(..."function"==typeof s?s(p):p()))}var Nb=function(){function e(e,t){this.innerStorage=e,this.key=t}return e.prototype.get=function(){return function(e){try{if(e)return JSON.parse(e)}catch(e){}}(this.innerStorage.getItem(this.key))},e.prototype.set=function(e){try{this.innerStorage.setItem(this.key,JSON.stringify(e))}catch(e){!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r={};r[e]||(r[e]=!0,Jh.apply(void 0,t))}("storage","Unable to store redux state")}},e}();function Ib(){return xm()}var Db={displayName:"Visitor",nick:"visitor:",typing:!1};function Rb(e,n){var r;e||(e={}),e.userId=e.userId?e.userId:Ib(),e.visitorId=e.userId;var a=!1;if("undefined"!=typeof window){var o=null===(r=window.localStorage)||void 0===r?void 0:r.getItem("xaErrorOverlay");"enabled"===o?a=!0:"disabled"===o?a=!1:((null==n?void 0:n.enableErrorOverlay)||void 0!==globalThis.__DEV__&&globalThis.__DEV__)&&(a=!0)}return t({connection:{connectionStatus:"offline",token:null,greetingRequested:!1},accountStatus:"offline",departments:{},visitor:Db,agents:{},chats:[],lastTimestamp:0,lastRatingRequestTimestamp:0,hasRating:!1,isChatting:!1,queuePosition:0,failureMsg:null,visitorId:Ib(),chips:[],sessionExpiration:"24h",visuals:{},debugMode:a},e)}var Ab=Rb(),Lb=function(){function e(){this.valuesMap=new Map}return e.prototype.getItem=function(e){var t=String(e);return this.valuesMap.has(e)?String(this.valuesMap.get(t)):null},e.prototype.setItem=function(e,t){this.valuesMap.set(String(e),String(t))},e.prototype.removeItem=function(e){this.valuesMap.delete(e)},e.prototype.clear=function(){this.valuesMap.clear()},e.prototype.key=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'key' on 'Storage': 1 argument required, but only 0 present.");return Array.from(this.valuesMap.keys())[e]},Object.defineProperty(e.prototype,"length",{get:function(){return this.valuesMap.size},enumerable:!1,configurable:!0}),e}();function Ub(e){return"chat.msg"===e.type}function zb(e,t){return function(e,t,n){if(!e.length)return e.push(t),e;if(1===e.length)return 0===(l=n(t,e[0]))?(t===e[0]||e.push(t),e):(l<0?e.unshift(t):e.push(t),e);for(var r=0,a=e.length-1;a-r>0;){var o=e[r],i=e[a],s=n(t,o);if(0===s)return t===o||e.splice(r+1,0,t),e;if(s<0)return e.splice(r,0,t),e;var u=n(t,i);if(0===u)return t===i||e.splice(a+1,0,t),e;if(u>0)return e.splice(a+1,0,t),e;if(a-r<=1)break;var l,c=Math.floor((r+a)/2),d=e[c];if(0===(l=n(d,t))&&t===d)return e;l<=0?r=c:l>0&&(a=c)}return e.splice(r+1,0,t),e}(a([],e,!0),t,function(e,t){return e.timestamp-t.timestamp})}function Fb(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(Ub(n)&&n.isStreaming)return t}return-1}function Bb(e,t){e.chats=zb(e.chats,t),"chat.msg"===t.type&&(e.activeContexts=t.msg.context)}function Wb(e,n){var r,o,i,s,u,l,c,d,f,p,h,v,m,g,y,b,x,w,k,S,_;if(void 0===e&&(e=Ab),Jh("action",n),"reset"===n.type)return function(e){var n;void 0===e&&(e=Ab);var r=Rb({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration}),a="online"===e.connection.connectionStatus,o=null===(n=e.visuals)||void 0===n?void 0:n.opened;return t(t({},r),{connection:t(t({},r.connection),{greetingRequested:!1,nonce:xm(),connectionStatus:a?"online":r.connection.connectionStatus}),accountStatus:a?"online":r.accountStatus,visitor:e.visitor,visitorId:e.visitorId,visuals:{opened:o,hasInteracted:!1}})}(e);switch(n.type){case"connection_update":case"receiveToken":case"sendGreeting":var O=function(e,n){switch(n.type){case"connection_update":return t(t({},e),{connectionStatus:n.detail.status});case"receiveToken":return t(t({},e),{token:n.detail.token});case"sendGreeting":return t(t({},e),{greetingRequested:!0})}return e}(e.connection,n);return e.connection!==O&&(e=t(t({},e),{lastTimestamp:null===(u=n.detail)||void 0===u?void 0:u.timestamp,connection:O})),e;case"account_status":return t(t({},e),{lastTimestamp:null===(l=n.detail)||void 0===l?void 0:l.timestamp,accountStatus:n.detail.status});case"session_id":return t(t({},e),{lastTimestamp:null===(c=n.detail)||void 0===c?void 0:c.timestamp,sessionId:n.detail.sessionId});case"visual_status":return t(t({},e),{lastTimestamp:null===(d=n.detail)||void 0===d?void 0:d.timestamp,visuals:t(t(t(t(t({},e.visuals||{}),void 0!==n.detail.status.drawer&&{drawer:n.detail.status.drawer}),void 0!==n.detail.status.opened&&{opened:n.detail.status.opened}),void 0!==n.detail.status.visible&&{visible:n.detail.status.visible}),void 0!==n.detail.status.hasInteracted&&{hasInteracted:n.detail.status.hasInteracted})});case"toggle_debug_mode":var C=!e.debugMode;return"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlay",C?"enabled":"disabled"),t(t({},e),{debugMode:C});case"ws_button_display":return t(t({},e),{lastTimestamp:null===(f=n.detail)||void 0===f?void 0:f.timestamp,wsButton:{id:n.detail.id,text:n.detail.text||(null===(p=e.wsButton)||void 0===p?void 0:p.text)||"",pressBehavior:n.detail.pressBehavior,isPressed:null!==(h=n.detail.isPressed)&&void 0!==h&&h,isDismissing:null!==(v=n.detail.isDismissing)&&void 0!==v&&v}});case"ws_button_dismiss":return(null===(m=e.wsButton)||void 0===m?void 0:m.id)===n.detail.id?t(t({},e),{lastTimestamp:null===(g=n.detail)||void 0===g?void 0:g.timestamp,wsButton:void 0}):e;case"department_update":return t(t({},e),{lastTimestamp:null===(y=n.detail)||void 0===y?void 0:y.timestamp,departments:t(t({},e.departments),(r={},r[n.detail.id]=t({},n.detail),r))});case"visitor_update":return t(t({},e),{lastTimestamp:null===(b=n.detail)||void 0===b?void 0:b.timestamp,visitor:t(t({},e.visitor),n.detail)});case"agent_update":var P=e.agents[n.detail.nick];return t(t({},e),{lastTimestamp:null===(x=n.detail)||void 0===x?void 0:x.timestamp,agents:t(t({},e.agents),(o={},o[n.detail.nick]=t(t({},P),{user:t(t({},P.user),n.detail),typing:(P||{typing:!1}).typing}),o))});case"chat":var T=t(t({},e),{lastTimestamp:null===(w=n.detail)||void 0===w?void 0:w.timestamp});switch(n.detail.type){case"chat.memberjoin":return function(e,n){var r=t({},e.agents),a=e.agents[n.user.nick];if(r[n.user.nick]=t(t({},a),{user:t(t({},n.user),{displayName:n.user.displayName||"Agent"}),joined:!0,typing:!1,hideUserInfo:n.hideUserInfo}),Rh(n.user.nick)){var o=n.showDivider||n.message;return(null==a?void 0:a.joined)&&!o?Jh('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already joined. NOT adding duplicate join message to chat.")):Jh(o?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining with special visuals (divider or custom message). Adding join message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:(null==a?void 0:a.joined)&&!o?e.chats:zb(e.chats,n),agents:r})}return Jh('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:zb(e.chats,n),agents:r})}(e,n.detail);case"chat.memberleave":return function(e,n){var r=t({},e.agents),a=e.agents[n.user.nick];r[n.user.nick]=t(t({},a),{joined:!1,typing:!1});var o=Object.values(r).filter(function(e){return e.joined}).length>0;if(Rh(n.user.nick)){var i=n.showDivider||n.message;return(null==a?void 0:a.joined)?Jh(i?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving with special visuals (divider or custom message). Adding leave message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")):Jh('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already left. NOT adding duplicate leave message to chat.")),t(t({},e),{isChatting:o,chats:(null==a?void 0:a.joined)?zb(e.chats,n):e.chats,agents:r})}return Jh('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")),t(t({},e),{isChatting:o,chats:zb(e.chats,n),agents:r})}(e,n.detail);case"chat.systemmessage":return Bb(T,n.detail),T;case"chat.systemmessagedismiss":var j=n.detail.id;return t(t({},T),{chats:T.chats.filter(function(e){return!function(e){return"chat.systemmessage"===e.type}(e)||e.id!==j})});case"chat.queue.position":return T.queuePosition=n.detail.queuePosition,T;case"chat.request.rating":return Bb(T,n.detail),t(t({},T),{lastRatingRequestTimestamp:n.detail.timestamp});case"chat.rating":return Bb(T,n.detail),t(t({},T),{hasRating:!!n.detail.newRating});case"chat.file":case"chat.msg":Bb(T,n.detail);var M=n.detail,E="chat.msg"===M.type?M.msg:null;return T.chips=(null===(k=null==E?void 0:E.options)||void 0===k?void 0:k.length)?E.options:[],T;case"chat.failureMsg":var N,I=T.agents[n.detail.user.nick],D=n.detail.failureMsg.retry,R=T;if(1!==D){N=T.chats.filter(function(e){return"chat.failureMsg"===e.type&&e.failureMsg.retry<D})[0];var A=T.chats.filter(function(e){return e!==N});R=t(t({},T),{chats:A})}return Bb(R,n.detail),t(t({},R),{agents:t(t({},R.agents),(i={},i[n.detail.user.nick]=t(t({},I),{typing:!1,requestFailed:!0}),i)),failureMsg:n.detail.failureMsg});case"chat.typing":var L=e.agents[n.detail.user.nick];return t(t({},e),{lastTimestamp:null===(S=n.detail)||void 0===S?void 0:S.timestamp,agents:t(t({},e.agents),(s={},s[n.detail.user.nick]=t(t({},L),{typing:n.detail.typing}),s))});case"chat.stream.start":var U=T.chats.map(function(e){return Ub(e)&&e.isStreaming?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e}),z=zb(U,{type:"chat.msg",user:n.detail.user,timestamp:n.detail.timestamp,msg:{text:""},isStreaming:!0});return t(t({},T),{chats:z,streamingMessageId:n.detail.messageId});case"chat.stream.chunk":var F=n.detail;if(e.streamingMessageId===F.messageId){var B=Fb(e.chats);if(B>=0){var W=F.text;return t(t({},e),{lastTimestamp:null==F?void 0:F.timestamp,chats:e.chats.map(function(e,n){var r;return n===B&&Ub(e)?t(t({},e),{msg:t(t({},e.msg),{text:((null===(r=e.msg)||void 0===r?void 0:r.text)||"")+W})}):e})})}}return e;case"chat.stream.tool_start":Jh("Tool execution started: ".concat(n.detail.toolName));var H=n.detail;if(e.streamingMessageId===H.messageId){var q=Fb(e.chats);if(q>=0)return t(t({},e),{lastTimestamp:H.timestamp,chats:e.chats.map(function(e,n){if(n===q&&Ub(e)){var r=e.toolCalls||[];return t(t({},e),{toolCalls:a(a([],r,!0),[{name:H.toolName,toolCallId:H.toolCallId,displayName:H.displayName,label:H.label,hidden:H.hidden,input:H.toolInput,startTime:H.timestamp,isExecuting:!0}],!1)})}return e})})}return e;case"chat.stream.tool_end":Jh("Tool execution ended: ".concat(n.detail.toolName));var Y=n.detail;if(e.streamingMessageId===Y.messageId){var V=Fb(e.chats);if(V>=0)return t(t({},e),{lastTimestamp:Y.timestamp,chats:e.chats.map(function(e,n){var r;if(n===V&&Ub(e)){var a=null===(r=e.toolCalls)||void 0===r?void 0:r.map(function(e){var n,r;return(Y.toolCallId?e.toolCallId===Y.toolCallId:e.name===Y.toolName&&e.isExecuting)?t(t({},e),{displayName:Y.displayName||e.displayName,label:Y.label,hidden:null!==(n=Y.hidden)&&void 0!==n?n:e.hidden,input:null!==(r=Y.toolInput)&&void 0!==r?r:e.input,result:Y.toolResult,error:Y.toolError,endTime:Y.timestamp,isExecuting:!1}):e});return t(t({},e),{toolCalls:a})}return e})})}return e;case"chat.stream.end":var Q=n.detail;if(e.streamingMessageId===Q.messageId){var $=Fb(e.chats),K=$>=0?e.chats[$]:void 0;if($>=0&&K&&Ub(K)){var J=Q.msg,G=Q.toolCalls||K.toolCalls,X=Q.preserveChips?e.chips:(null===(_=null==J?void 0:J.options)||void 0===_?void 0:_.length)?J.options:[];return t(t({},e),{lastTimestamp:null==Q?void 0:Q.timestamp,streamingMessageId:void 0,chips:X,chats:e.chats.map(function(e,n){return n===$&&Ub(e)?t(t({},e),{msg:J,isStreaming:!1,wasStreamed:!0,toolCalls:G}):e})})}}return e;case"chat.stream.abort":var Z=n.detail;if(e.streamingMessageId===Z.messageId){var ee=Fb(e.chats);if(ee>=0)return t(t({},e),{lastTimestamp:Z.timestamp,streamingMessageId:void 0,chats:e.chats.map(function(e,n){return n===ee&&Ub(e)?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e})})}return e;case"chat.stream.resume":var te=n.detail;if(e.streamingMessageId)return e;for(var ne=-1,re=e.chats.length-1;re>=0;re--){var ae=e.chats[re];if(Ub(ae)&&ae.wasStreamed&&!ae.isStreaming){ne=re;break}}return ne>=0?t(t({},e),{lastTimestamp:te.timestamp,streamingMessageId:te.messageId,chats:e.chats.map(function(e,n){return n===ne&&Ub(e)?t(t({},e),{isStreaming:!0,wasStreamed:!1}):e})}):e;default:return e}default:return Jh("Unhandled redux action: ",n.type),e}}function Hb(e,t){if(void 0===e&&(e=Ab),"synthetic"===t.type){Jh("synthetic action",t);var n=function(e,t){var n;void 0===e&&(e=Ab);var r=((null===(n=t.detail)||void 0===n?void 0:n.timestamp)||+new Date)+1;switch(t.detail.type){case"write_msg":return{type:"chat",detail:{type:"chat.msg",user:t.detail.user,timestamp:r,msg:t.detail.msg}};case"visitor.send.file":return{type:"chat",detail:{type:"chat.file",user:{displayName:e.visitor.displayName,nick:"visitor:"},timestamp:r,attachment:t.detail.attachment}};default:throw new Error("Unknown synthetic action. Detail type: ".concat(t.detail.type))}}(e,t);return Wb(e,n)}return Wb(e,t)}var qb="AdminAccessTimes";function Yb(e,n){var r;n||(n="undefined"!=typeof window?localStorage:new Lb);var a,o=e.connection,i=null===(r=new URL(window.location.href).searchParams)||void 0===r?void 0:r.get("sessionId"),s=(new Date).getTime();if(i){var u=n.getItem(qb),l=u?JSON.parse(u):{};if(l[i])Jh("ChatStore: reusing session: ".concat(i)),l[i].lastAccessMs=s,a=l[i].dataStorageKey;else{if(Object.keys(l).length>=20){var c=function(e){for(var t,n=Number.MAX_VALUE,r=0,a=Object.keys(e);r<a.length;r++){var o=a[r];e[o].lastAccessMs<n&&(t=o,n=e[o].lastAccessMs)}return t}(l);Jh("ChatStore: evicting session: ".concat(c)),n.removeItem(l[c].dataStorageKey),l[c]=void 0}a=Vb(o,i),l[i]={lastAccessMs:s,dataStorageKey:a}}n.setItem(qb,JSON.stringify(l))}else a=Vb(o);var d=function(e,n,r){var a,o=null!==(a=e.get())&&void 0!==a?a:n;return o&&o.visuals&&(o=t(t({},o),{visuals:t(t({},o.visuals),{hasInteracted:void 0,visible:void 0})})),function(t,n){void 0===t&&(t=o);var a=r(t,n);return e.set(a),a}}(new Nb(n,a),Rb({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration},{enableErrorOverlay:e.enableErrorOverlay}),Hb);return Eb({reducer:d,middleware:function(e){return e({thunk:!0})},devTools:!1})}function Vb(e,t){var n="xappchat.".concat(e.serverUrl);return t?e.accountKey?"".concat(n,".").concat(e.accountKey,".").concat(t):"".concat(n,".").concat(t):e.accountKey?"".concat(n,".").concat(e.accountKey):n}function Qb(e,t,n,r){return void 0===r&&(r=Date.now()),!!t&&(r-t>=1e3*function(e){var t=e.match(/(\d+)([dhms]?)/);if(!t)return Gh("Invalid time string: ".concat(e)),0;var n=parseInt(t[1]);switch(t[2]){case"d":return 24*n*60*60;case"h":return 60*n*60;case"m":return 60*n;default:return n}}(e||"4h")&&(a=r,o=new Date(t),i=new Date(a),!(o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate())));var a,o,i}function $b(e){void 0===e&&(e=!1);var t=Z.useState(function(){return!e&&function(e){void 0===e&&(e=window);try{return new URL(e.location.href).searchParams.get(ky)===Sy}catch(e){return!1}}()})[0];return Z.useEffect(function(){t&&function(e){void 0===e&&(e=window);try{var t=new URL(e.location.href);if(!t.searchParams.has(ky))return;t.searchParams.delete(ky),e.history.replaceState(e.history.state,"",t.toString())}catch(e){}}()},[t]),t}function Kb(e){Z.useEffect(function(){if(e){var t=function(e){for(var t="es-",n=0;n<e.length;n++)t+=Jb(e.charAt(n));return t}(e);if(!document.getElementById(t)){var n=document.createElement("script");n.id=t,n.src=e,n.crossOrigin="anonymous",document.head.appendChild(n)}}},[e])}function Jb(e){return e>="0"&&e<="9"||e>="a"&&e<="z"||e>="A"&&e<="Z"?e:"_".concat(e.charCodeAt(0),"_")}var Gb="data-xapp-form-page";function Xb(){return!("undefined"==typeof document||!document.body)&&"true"===document.body.getAttribute(Gb)}function Zb(){var e=Z.useState(Xb),t=e[0],n=e[1];return Z.useEffect(function(){if("undefined"!=typeof document&&document.body&&(n(Xb()),"undefined"!=typeof MutationObserver)){var e=new MutationObserver(function(){n(Xb())});return e.observe(document.body,{attributes:!0,attributeFilter:[Gb]}),function(){return e.disconnect()}}},[]),t}function ex(e){var n,r,a,o,i,s,u=(a=yy(),o=Dh(function(e){return e.visitorId||e.userId}),i=Dh(function(e){return e.accessToken}),s=Dh(function(e){return e.attributes}),Z.useMemo(function(){return{dispatch:a,visitorId:o,accessToken:i,userId:o,attributes:s}},[a,o,i,s])),l=Z.useRef(null),c=Z.useContext(nv),d=null!==(r=null===(n=null==c?void 0:c.env)||void 0===n?void 0:n.isAdmin)&&void 0!==r&&r,f=Dh(function(e){return e.sessionId}),p=Dh(function(e){return Oy(e.chats)});Z.useEffect(function(){if(e&&l.current!==u&&(l.current=u,u.visitorId)){if(u.dispatch(bv({name:"Visitor",visitorId:u.visitorId,userId:u.userId,accessToken:u.accessToken,attributes:t(t({},u.attributes),{currentUrl:window.location.href}),hasConversation:p},f)),!d){var n=setTimeout(function(){var e,t=(void 0===e&&(e=!1),function(t){return function(n,r){e||r().connection.greetingRequested||(Jh("sending greeting"),t.sendChatMsg({text:void 0,attributes:{isGreeting:!0}},function(e){e&&Jh("Error sending message"),n({type:"sendGreeting",detail:void 0})}))}});u.dispatch(t)},1e3);return function(){clearTimeout(n)}}Jh("Admin widget. Not sending greeting.")}},[u,e,d])}var tx={},nx={};Object.defineProperty(nx,"__esModule",{value:!0}),nx.isActionBarChatButton=function(e){return"chat"===e.type},nx.isActionBarFormButton=function(e){return"form"===e.type},nx.isActionBarScheduleButton=function(e){return"schedule"===e.type},nx.isActionBarPhoneButton=function(e){return"phone"===e.type},nx.isActionBarUrlButton=function(e){return"url"===e.type},nx.isActionBarEmailButton=function(e){return"email"===e.type},nx.isActionBarHelpButton=function(e){return"help"===e.type},nx.isActionBarPaymentButton=function(e){return"payment"===e.type};var rx={},ax={};function ox(e,t=2){return(new Array(t).join("0")+e).slice(-t)}function ix(e){const t=null==e?void 0:e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/);if(t)return{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10),a:parseFloat(t[4])};const n=null==e?void 0:e.match(/^rgb?\((\d+),\s*(\d+),\s*(\d+)\)$/);return n?{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10)}:null}function sx(e,t,n){return.299*e+.587*t+.114*n>186}function ux(e,t){if(!e)return;let n=0===e.indexOf("#")?e.slice(1):e;if(3===n.length&&(n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]),6!==n.length)throw new Error("Invalid HEX color.");const r=parseInt(n.slice(0,2),16),a=parseInt(n.slice(2,4),16),o=parseInt(n.slice(4,6),16);return t?sx(r,a,o)?"#000000":"#FFFFFF":`#${ox((255-r).toString(16))}${ox((255-a).toString(16))}${ox((255-o).toString(16))}`}function lx(e,t){const n=ix(e);if(!n)return e;const{r:r,g:a,b:o}=n;return t?sx(r,a,o)?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)":`rgba(${255-r}, ${255-a}, ${255-o}, 1)`}function cx(e){if(!e)return!1;if(e.startsWith("#")){const t=e.slice(1);return(3===t.length||6===t.length)&&/^[0-9a-f]+$/i.test(t)}return null!==ix(e)}
|
|
3
3
|
/*! Copyright (c) 2026, XAPP AI */
|
|
4
4
|
Object.defineProperty(ax,"__esModule",{value:!0}),ax.parseRgb=ix,ax.invertColorHEX=ux,ax.invertColorRgb=lx,ax.invertColor=function(e,t){if(!e)return;return e.startsWith("#")?ux(e,t):lx(e,t)},ax.isSupportedColor=cx,ax.usableColorOr=function(e,t){return cx(e)?e:t},ax.readableTextOn=function(e){if(!cx(e))return"#000000";const t=e.startsWith("#")?function(e){let t=e.slice(1);3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);if(6!==t.length)return null;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}(e):ix(e);if(!t)return"#000000";return sx(t.r,t.g,t.b)?"#000000":"#FFFFFF"},ax.darkenColor=function(e,t){if(!e)return e;let n,r,a,o,i;try{if(e.startsWith("#")){const t=e.match(/\w\w/g);t&&([n,r,a]=t.map(e=>parseInt(e,16)))}else if(e.startsWith("rgb")){const t=ix(e);t&&({r:n,g:r,b:a,a:o}=t)}if(void 0===n||void 0===r||void 0===a)return console.error(`Unsupported color format: ${e}`),e;if(void 0!==o){const e=.3*n+.59*r+.11*a;let s=e*(1-t/100);s=Math.max(0,Math.min(255,s));const u=s/(e||1);n=Math.round(n*u),r=Math.round(r*u),a=Math.round(a*u),o+=t/100,o=Math.max(0,Math.min(1,o)),i=`rgba(${n}, ${r}, ${a}, ${o})`}else t>0?(n=Math.max(0,n-t),r=Math.max(0,r-t),a=Math.max(0,a-t)):(t=Math.abs(t),n=Math.min(255,n+t),r=Math.min(255,r+t),a=Math.min(255,a+t)),i=`#${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}catch(t){console.error(`Unsupported color format: ${e} - Error: ${t}`)}return i},Object.defineProperty(rx,"__esModule",{value:!0}),rx.buildChatWidgetChannel=function(e){var t;const{appId:n,apiUrl:r,mcpUrl:a,formWidgetKey:o,phoneNumber:i}=e,s=null===(t=e.businessName)||void 0===t?void 0:t.trim(),u=(0,dx.usableColorOr)(e.primaryColor,fx);return Object.assign(Object.assign({type:"chat-widget",connection:{type:"mcp",serverUrl:`${a}/${n}`,mcp:{mode:"homeowner"}},theme:hx(u,e.secondaryColor),actionBar:px({apiUrl:r,formWidgetKey:o,phoneNumber:i})},o?{formWidgetKey:o}:{}),s?{botName:s}:{})},rx.buildChatTheme=hx;const dx=ax,fx="#1AA7DC";function px(e){const{apiUrl:t,formWidgetKey:n,phoneNumber:r}=e,a=[];return n&&a.push({id:"book",type:"schedule",label:"Book",formConfig:{api:{url:t,key:n}}}),r&&a.push({id:"call",type:"phone",label:"Call",phoneNumber:r}),a.push({id:"chat",type:"chat",label:"Chat"}),{enabled:!0,position:"right",buttons:a}}function hx(e,t){const n="RobotoRegular";return t||(t=(0,dx.readableTextOn)(e)),{zIndex:"10000",border:{color:e,radius:"10px"},carousel:{button:{color:e},subtitle:{color:"#979797",fontFamily:n,fontSize:"12px",fontStyle:"normal",fontWeight:"normal"},title:{color:"#000",fontFamily:n,fontSize:"14px",fontStyle:"normal",fontWeight:"bold"}},chatButton:{background:e,margin:{bottom:"10px",left:"10px",right:"10px",top:"10px"}},content:{background:"#ffffff"},cta:{background:"#e1e2e1",text:{color:"#333333",fontFamily:n,fontSize:"14px"}},footer:{background:e,border:{color:e,radius:"0px",width:"0px"},branding:{text:{color:"#ffffff",fontFamily:n,fontSize:"14px",fontWeight:"normal",fontStyle:"normal"}}},header:{background:e,avatarBackground:"transparent",border:{color:e,radius:"0px",width:"0px"},text:{color:t,fontFamily:n,fontSize:"16px",fontWeight:"normal",fontStyle:"normal"},subtitle:{color:t,fontFamily:n,fontSize:"10px",fontWeight:"normal",fontStyle:"normal"}},input:{background:"#ffffff",border:{radius:"20px"},text:{color:"#000000",fontFamily:n,fontSize:"14px"},placeholder:{color:"#e1e2e1",fontFamily:n,fontSize:"14px",fontWeight:"normal",fontStyle:"normal"}},textTypingStatus:{text:{color:"#bfbfbf",fontFamily:n,fontSize:"14px",fontWeight:"normal",fontStyle:"normal"}},menu:{item:{height:"24px",text:{fontSize:"14px"}}},menuButton:{color:"#ffffff"},messages:{maxWidth:"400px",mine:{bubbleColor:"#f2f2f2",text:{color:"#454545",fontFamily:n,fontSize:"18px",fontStyle:"normal",fontWeight:"normal"}},others:{bubbleColor:"#e1e2e1",text:{color:"#262726",fontFamily:n,fontSize:"18px",fontStyle:"normal",fontWeight:"normal"}},padding:{bottom:"0px",left:"20px",right:"16px",top:"16px"}},refreshButton:{color:t},minimizeButton:{color:t},cancelButton:{color:t},primaryColor:e,sendButton:{color:"#505050",width:"20px"},size:{width:"500px",height:"700px"}}}var vx={};Object.defineProperty(vx,"__esModule",{value:!0});var mx={};Object.defineProperty(mx,"__esModule",{value:!0}),mx.CHAT_WIDGET_CHANNEL=void 0,mx.CHAT_WIDGET_CHANNEL="chat-widget";var gx={};
|
|
5
5
|
/*! Copyright (c) 2021, XAPPmedia */Object.defineProperty(gx,"__esModule",{value:!0});var yx={};Object.defineProperty(yx,"__esModule",{value:!0});var bx={};Object.defineProperty(bx,"__esModule",{value:!0});var xx={};Object.defineProperty(xx,"__esModule",{value:!0});var wx={};Object.defineProperty(wx,"__esModule",{value:!0}),wx.isStaticImageMenuItem=function(e){return!!e&&!!e.imageUrl},wx.isStaticTextMenuItem=function(e){return!!e&&!!e.body},wx.isStandardMenuItem=function(e){return!!e&&!!e.label},wx.isOpenURLMenuItem=function(e){return!!e&&!!e.url},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=o&&o.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),
|