@seamly/web-ui 23.0.6-alpha.1 → 23.0.6-alpha.2
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/build/dist/lib/index.debug.js +16 -12
- package/build/dist/lib/index.debug.js.map +1 -1
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.map +1 -1
- package/build/dist/lib/index.js +16 -12
- package/build/dist/lib/index.js.map +1 -1
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.map +1 -1
- package/build/dist/lib/standalone.js +16 -12
- package/build/dist/lib/standalone.js.map +1 -1
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.map +1 -1
- package/build/dist/lib/style-guide.js +16 -12
- package/build/dist/lib/style-guide.js.map +1 -1
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/style-guide.min.js.map +1 -1
- package/build/dist/lib/utils.js +16 -12
- package/build/dist/lib/utils.js.map +1 -1
- package/build/dist/lib/utils.min.js +1 -1
- package/build/dist/lib/utils.min.js.map +1 -1
- package/package.json +3 -2
- package/src/javascripts/api/index.ts +14 -10
- package/src/javascripts/lib/external-api/index.js +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={2086:e=>{e.exports=function(e){var t={},n=[];(e=e||this).on=function(n,r,s){return(t[n]=t[n]||[]).push([r,s]),e},e.off=function(r,s){r||(t={});for(var o=t[r]||n,i=o.length=s?o.length:0;i--;)s==o[i][0]&&o.splice(i,1);return e},e.emit=function(r){for(var s,o=t[r]||n,i=o.length>0?o.slice(0,o.length):o,a=0;s=i[a++];)s[0].apply(s[1],n.slice.call(arguments,1));return e}}},7402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>f,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>c,StrictMode:()=>te,Suspense:()=>b,SuspenseList:()=>_,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>X,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>q,createPortal:()=>j,createRef:()=>r.createRef,default:()=>le,findDOMNode:()=>Z,flushSync:()=>ee,forwardRef:()=>p,hydrate:()=>L,isElement:()=>ie,isFragment:()=>K,isMemo:()=>J,isValidElement:()=>G,lazy:()=>w,memo:()=>l,render:()=>O,startTransition:()=>ne,unmountComponentAtNode:()=>Y,unstable_batchedUpdates:()=>Q,useDeferredValue:()=>re,useInsertionEffect:()=>oe,useSyncExternalStore:()=>ae,useTransition:()=>se,version:()=>W});var r=n(8785),s=n(1162),o={};for(const e in s)["default","Component","Fragment","createContext","createElement","createRef","Children","PureComponent","StrictMode","Suspense","SuspenseList","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","cloneElement","createFactory","createPortal","findDOMNode","flushSync","forwardRef","hydrate","isElement","isFragment","isMemo","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(o[e]=()=>s[e]);function i(e,t){for(var n in t)e[n]=t[n];return e}function a(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function c(e,t){this.props=e,this.context=t}function l(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:a(this.props,e)}function s(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return s.displayName="Memo("+(e.displayName||e.name)+")",s.prototype.isReactComponent=!0,s.__f=!0,s}n.d(t,o),(c.prototype=new r.Component).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return a(this.props,e)||a(this.state,t)};var u=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),u&&u(e)};var d="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function p(e){function t(t){var n=i({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=d,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var h=function(e,t){return null==e?null:(0,r.toChildArray)((0,r.toChildArray)(e).map(t))},f={map:h,forEach:h,count:function(e){return e?(0,r.toChildArray)(e).length:0},only:function(e){var t=(0,r.toChildArray)(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:r.toChildArray},m=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var s,o=t;o=o.__;)if((s=o.__c)&&s.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),s.__c(e,t);m(e,t,n,r)};var y=r.options.unmount;function v(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=i({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return v(e,t,n)}))),e}function g(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return g(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function b(){this.__u=0,this.t=null,this.__b=null}function x(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function w(e){var t,n,s;function o(o){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){s=e})),s)throw s;if(!n)throw t;return(0,r.createElement)(n,o)}return o.displayName="Lazy",o.__f=!0,o}function _(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),y&&y(e)},(b.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var s=x(r.__v),o=!1,i=function(){o||(o=!0,n.__R=null,s?s(a):a())};n.__R=i;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=g(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},b.prototype.componentWillUnmount=function(){this.t=[]},b.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),s=this.__v.__k[0].__c;this.__v.__k[0]=v(this.__b,n,s.__O=s.__P)}this.__b=null}var o=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return o&&(o.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),o]};var C=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function E(e){return this.getChildContext=function(){return e.context},e.children}function S(e){var t=this,n=e.i;t.componentWillUnmount=function(){(0,r.render)(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),(0,r.render)((0,r.createElement)(E,{context:t.context},e.__v),t.l)}function j(e,t){var n=(0,r.createElement)(S,{__v:e,i:t});return n.containerInfo=t,n}(_.prototype=new r.Component).__a=function(e){var t=this,n=x(t.__v),r=t.o.get(e);return r[0]++,function(s){var o=function(){t.props.revealOrder?(r.push(s),C(t,e,r)):s()};n?n(o):o()}},_.prototype.render=function(e){this.u=null,this.o=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},_.prototype.componentDidUpdate=_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){C(e,n,t)}))};var T="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,k=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,N=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,A=/[A-Z0-9]/g,R="undefined"!=typeof document,I=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function O(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function L(e,t,n){return(0,r.hydrate)(e,t),"function"==typeof n&&n(),e?e.__c:null}r.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(r.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var M=r.options.event;function P(){}function D(){return this.cancelBubble}function U(){return this.defaultPrevented}r.options.event=function(e){return M&&(e=M(e)),e.persist=P,e.isPropagationStopped=D,e.isDefaultPrevented=U,e.nativeEvent=e};var F,B={enumerable:!1,configurable:!0,get:function(){return this.class}},z=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,s={};for(var o in t){var i=t[o];if(!("value"===o&&"defaultValue"in t&&null==i||R&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var a=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===i?i="":"translate"===a&&"no"===i?i=!1:"ondoubleclick"===a?o="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||I(t.type)?"onfocus"===a?o="onfocusin":"onblur"===a?o="onfocusout":N.test(o)?o=a:-1===n.indexOf("-")&&k.test(o)?o=o.replace(A,"-$&").toLowerCase():null===i&&(i=void 0):a=o="oninput","oninput"===a&&s[o=a]&&(o="oninputCapture"),s[o]=i}}"select"==n&&s.multiple&&Array.isArray(s.value)&&(s.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=s.value.indexOf(e.props.value)}))),"select"==n&&null!=s.defaultValue&&(s.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=s.multiple?-1!=s.defaultValue.indexOf(e.props.value):s.defaultValue==e.props.value}))),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",B)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(e),e.$$typeof=T,z&&z(e)};var $=r.options.__r;r.options.__r=function(e){$&&$(e),F=e.__c};var H=r.options.diffed;r.options.diffed=function(e){H&&H(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),F=null};var V={ReactCurrentDispatcher:{current:{readContext:function(e){return F.__n[e.__c].props.value},useCallback:s.useCallback,useContext:s.useContext,useDebugValue:s.useDebugValue,useDeferredValue:re,useEffect:s.useEffect,useId:s.useId,useImperativeHandle:s.useImperativeHandle,useInsertionEffect:oe,useLayoutEffect:s.useLayoutEffect,useMemo:s.useMemo,useReducer:s.useReducer,useRef:s.useRef,useState:s.useState,useSyncExternalStore:ae,useTransition:se}}},W="17.0.2";function q(e){return r.createElement.bind(null,e)}function G(e){return!!e&&e.$$typeof===T}function K(e){return G(e)&&e.type===r.Fragment}function J(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function X(e){return G(e)?r.cloneElement.apply(null,arguments):e}function Y(e){return!!e.__k&&((0,r.render)(null,e),!0)}function Z(e){return e&&(e.base||1===e.nodeType&&e)||null}var Q=function(e,t){return e(t)},ee=function(e,t){return e(t)},te=r.Fragment;function ne(e){e()}function re(e){return e}function se(){return[!1,ne]}var oe=s.useLayoutEffect,ie=G;function ae(e,t){var n=t(),r=(0,s.useState)({h:{__:n,v:t}}),o=r[0].h,i=r[1];return(0,s.useLayoutEffect)((function(){o.__=n,o.v=t,ce(o)&&i({h:o})}),[e,n,t]),(0,s.useEffect)((function(){return ce(o)&&i({h:o}),e((function(){ce(o)&&i({h:o})}))}),[e]),n}function ce(e){var t,n,r=e.v,s=e.__;try{var o=r();return!((t=s)===(n=o)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var le={useState:s.useState,useId:s.useId,useReducer:s.useReducer,useEffect:s.useEffect,useLayoutEffect:s.useLayoutEffect,useInsertionEffect:oe,useTransition:se,useDeferredValue:re,useSyncExternalStore:ae,startTransition:ne,useRef:s.useRef,useImperativeHandle:s.useImperativeHandle,useMemo:s.useMemo,useCallback:s.useCallback,useContext:s.useContext,useDebugValue:s.useDebugValue,version:"17.0.2",Children:f,render:O,hydrate:L,unmountComponentAtNode:Y,createPortal:j,createElement:r.createElement,createContext:r.createContext,createFactory:q,cloneElement:X,createRef:r.createRef,Fragment:r.Fragment,isValidElement:G,isElement:ie,isFragment:K,isMemo:J,findDOMNode:Z,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:ee,unstable_batchedUpdates:Q,StrictMode:te,Suspense:b,SuspenseList:_,lazy:w,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:V}},7154:(e,t,n)=>{"use strict";var r=n(7402),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useSyncExternalStore,i=r.useRef,a=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=i(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=c((function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return i=t}return i=e}if(t=i,s(o,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(o=e,i=n)}var o,i,a=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,u]);var h=o(e,d[0],d[1]);return a((function(){p.hasValue=!0,p.value=h}),[h]),l(h),h}},8418:(e,t,n)=>{"use strict";e.exports=n(7154)},8785:e=>{"use strict";e.exports=require("preact")},1162:e=>{"use strict";e.exports=require("preact/hooks")},9497:(e,t,n)=>{"use strict";n(8107);var r=n(7015);e.exports=r("Array","at")},9306:(e,t,n)=>{"use strict";var r=n(4901),s=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(s(e)+" is not a function")}},3506:(e,t,n)=>{"use strict";var r=n(3925),s=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o("Can't set "+s(e)+" as a prototype")}},7080:(e,t,n)=>{"use strict";var r=n(4402).has;e.exports=function(e){return r(e),e}},6469:(e,t,n)=>{"use strict";var r=n(8227),s=n(2360),o=n(4913).f,i=r("unscopables"),a=Array.prototype;void 0===a[i]&&o(a,i,{configurable:!0,value:s(null)}),e.exports=function(e){a[i][e]=!0}},679:(e,t,n)=>{"use strict";var r=n(1625),s=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new s("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),s=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(s(e)+" is not an object")}},9617:(e,t,n)=>{"use strict";var r=n(5397),s=n(5610),o=n(6198),i=function(e){return function(t,n,i){var a=r(t),c=o(a);if(0===c)return!e&&-1;var l,u=s(i,c);if(e&&n!=n){for(;c>u;)if((l=a[u++])!=l)return!0}else for(;c>u;u++)if((e||u in a)&&a[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},4527:(e,t,n)=>{"use strict";var r=n(3724),s=n(4376),o=TypeError,i=Object.getOwnPropertyDescriptor,a=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=a?function(e,t){if(s(e)&&!i(e,"length").writable)throw new o("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},4576:(e,t,n)=>{"use strict";var r=n(9504),s=r({}.toString),o=r("".slice);e.exports=function(e){return o(s(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),s=n(4901),o=n(4576),i=n(8227)("toStringTag"),a=Object,c="Arguments"===o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=a(e),i))?n:c?o(t):"Object"===(r=o(t))&&s(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),s=n(5031),o=n(7347),i=n(4913);e.exports=function(e,t,n){for(var a=s(t),c=i.f,l=o.f,u=0;u<a.length;u++){var d=a[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},6699:(e,t,n)=>{"use strict";var r=n(3724),s=n(4913),o=n(6980);e.exports=r?function(e,t,n){return s.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6840:(e,t,n)=>{"use strict";var r=n(4901),s=n(4913),o=n(283),i=n(9433);e.exports=function(e,t,n,a){a||(a={});var c=a.enumerable,l=void 0!==a.name?a.name:t;if(r(n)&&o(n,l,a),a.global)c?e[t]=n:i(t,n);else{try{a.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:s.f(e,t,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return e}},9433:(e,t,n)=>{"use strict";var r=n(4475),s=Object.defineProperty;e.exports=function(e,t){try{s(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,n)=>{"use strict";var r=n(4475),s=n(34),o=r.document,i=s(o)&&s(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},6837:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},5002:e=>{"use strict";e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},9392:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7388:(e,t,n)=>{"use strict";var r,s,o=n(4475),i=n(9392),a=o.process,c=o.Deno,l=a&&a.versions||c&&c.version,u=l&&l.v8;u&&(s=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!s&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(s=+r[1]),e.exports=s},7015:(e,t,n)=>{"use strict";var r=n(4475),s=n(9504);e.exports=function(e,t){return s(r[e].prototype[t])}},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(e,t,n)=>{"use strict";var r=n(9504),s=Error,o=r("".replace),i=String(new s("zxcasd").stack),a=/\n\s*at [^:]*:[^\n]*/,c=a.test(i);e.exports=function(e,t){if(c&&"string"==typeof e&&!s.prepareStackTrace)for(;t--;)e=o(e,a,"");return e}},6518:(e,t,n)=>{"use strict";var r=n(4475),s=n(7347).f,o=n(6699),i=n(6840),a=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n,u,d,p,h,f=e.target,m=e.global,y=e.stat;if(n=m?r:y?r[f]||a(f,{}):r[f]&&r[f].prototype)for(u in t){if(p=t[u],d=e.dontCallGetSet?(h=s(n,u))&&h.value:n[u],!l(m?u:f+(y?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&o(p,"sham",!0),i(n,u,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,n)=>{"use strict";var r=n(616),s=Function.prototype.call;e.exports=r?s.bind(s):function(){return s.apply(s,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),s=n(9297),o=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,a=s(o,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&i(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},6706:(e,t,n)=>{"use strict";var r=n(9504),s=n(9306);e.exports=function(e,t,n){try{return r(s(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},9504:(e,t,n)=>{"use strict";var r=n(616),s=Function.prototype,o=s.call,i=r&&s.bind.bind(o,o);e.exports=r?i:function(e){return function(){return o.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4475),s=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],s(n)?n:void 0):r[e]&&r[e][t];var n}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},5966:(e,t,n)=>{"use strict";var r=n(9306),s=n(4117);e.exports=function(e,t){var n=e[t];return s(n)?void 0:r(n)}},3789:(e,t,n)=>{"use strict";var r=n(9306),s=n(8551),o=n(9565),i=n(1291),a=n(1767),c="Invalid size",l=RangeError,u=TypeError,d=Math.max,p=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};p.prototype={getIterator:function(){return a(s(o(this.keys,this.set)))},includes:function(e){return o(this.has,this.set,e)}},e.exports=function(e){s(e);var t=+e.size;if(t!=t)throw new u(c);var n=i(t);if(n<0)throw new l(c);return new p(e,n)}},4475:function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,n)=>{"use strict";var r=n(9504),s=n(8981),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(s(e),t)}},421:e=>{"use strict";e.exports={}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},5917:(e,t,n)=>{"use strict";var r=n(3724),s=n(9039),o=n(4055);e.exports=!r&&!s((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),s=n(9039),o=n(4576),i=Object,a=r("".split);e.exports=s((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?a(e,""):i(e)}:i},3167:(e,t,n)=>{"use strict";var r=n(4901),s=n(34),o=n(2967);e.exports=function(e,t,n){var i,a;return o&&r(i=t.constructor)&&i!==n&&s(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),s=n(4901),o=n(7629),i=r(Function.toString);s(o.inspectSource)||(o.inspectSource=function(e){return i(e)}),e.exports=o.inspectSource},1181:(e,t,n)=>{"use strict";var r,s,o,i=n(8622),a=n(4475),c=n(34),l=n(6699),u=n(9297),d=n(7629),p=n(6119),h=n(421),f="Object already initialized",m=a.TypeError,y=a.WeakMap;if(i||d.state){var v=d.state||(d.state=new y);v.get=v.get,v.has=v.has,v.set=v.set,r=function(e,t){if(v.has(e))throw new m(f);return t.facade=e,v.set(e,t),t},s=function(e){return v.get(e)||{}},o=function(e){return v.has(e)}}else{var g=p("state");h[g]=!0,r=function(e,t){if(u(e,g))throw new m(f);return t.facade=e,l(e,g,t),t},s=function(e){return u(e,g)?e[g]:{}},o=function(e){return u(e,g)}}e.exports={set:r,get:s,has:o,enforce:function(e){return o(e)?s(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=s(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},4376:(e,t,n)=>{"use strict";var r=n(4576);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},2796:(e,t,n)=>{"use strict";var r=n(9039),s=n(4901),o=/#|\.prototype\./,i=function(e,t){var n=c[a(e)];return n===u||n!==l&&(s(t)?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},3925:(e,t,n)=>{"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},6395:e=>{"use strict";e.exports=!1},757:(e,t,n)=>{"use strict";var r=n(7751),s=n(4901),o=n(1625),i=n(7040),a=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return s(t)&&o(t.prototype,a(e))}},507:(e,t,n)=>{"use strict";var r=n(9565);e.exports=function(e,t,n){for(var s,o,i=n?e:e.iterator,a=e.next;!(s=r(a,i)).done;)if(void 0!==(o=t(s.value)))return o}},9539:(e,t,n)=>{"use strict";var r=n(9565),s=n(8551),o=n(5966);e.exports=function(e,t,n){var i,a;s(e);try{if(!(i=o(e,"return"))){if("throw"===t)throw n;return n}i=r(i,e)}catch(e){a=!0,i=e}if("throw"===t)throw n;if(a)throw i;return s(i),n}},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},283:(e,t,n)=>{"use strict";var r=n(9504),s=n(9039),o=n(4901),i=n(9297),a=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,p=u.get,h=String,f=Object.defineProperty,m=r("".slice),y=r("".replace),v=r([].join),g=a&&!s((function(){return 8!==f((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=e.exports=function(e,t,n){"Symbol("===m(h(t),0,7)&&(t="["+y(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!i(e,"name")||c&&e.name!==t)&&(a?f(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&i(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?a&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return i(r,"source")||(r.source=v(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return o(this)&&p(this).source||l(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},2603:(e,t,n)=>{"use strict";var r=n(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},2360:(e,t,n)=>{"use strict";var r,s=n(8551),o=n(6801),i=n(8727),a=n(421),c=n(397),l=n(4055),u=n(6119),d="prototype",p="script",h=u("IE_PROTO"),f=function(){},m=function(e){return"<"+p+">"+e+"</"+p+">"},y=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;v="undefined"!=typeof document?document.domain&&r?y(r):(t=l("iframe"),n="java"+p+":",t.style.display="none",c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):y(r);for(var s=i.length;s--;)delete v[d][i[s]];return v()};a[h]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(f[d]=s(e),n=new f,f[d]=null,n[h]=e):n=v(),void 0===t?n:o.f(n,t)}},6801:(e,t,n)=>{"use strict";var r=n(3724),s=n(8686),o=n(4913),i=n(8551),a=n(5397),c=n(1072);t.f=r&&!s?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=c(t),l=s.length,u=0;l>u;)o.f(e,n=s[u++],r[n]);return e}},4913:(e,t,n)=>{"use strict";var r=n(3724),s=n(5917),o=n(8686),i=n(8551),a=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",h="writable";t.f=r?o?function(e,t,n){if(i(e),t=a(t),i(n),"function"==typeof e&&"prototype"===t&&"value"in n&&h in n&&!n[h]){var r=u(e,t);r&&r[h]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(i(e),t=a(t),i(n),s)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),s=n(9565),o=n(8773),i=n(6980),a=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=a(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return i(!s(o.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),s=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,s)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),s=n(9297),o=n(5397),i=n(9617).indexOf,a=n(421),c=r([].push);e.exports=function(e,t){var n,r=o(e),l=0,u=[];for(n in r)!s(a,n)&&s(r,n)&&c(u,n);for(;t.length>l;)s(r,n=t[l++])&&(~i(u,n)||c(u,n));return u}},1072:(e,t,n)=>{"use strict";var r=n(1828),s=n(8727);e.exports=Object.keys||function(e){return r(e,s)}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,s=r&&!n.call({1:2},1);t.f=s?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),s=n(34),o=n(7750),i=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return o(n),i(r),s(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),s=n(4901),o=n(34),i=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&s(n=e.toString)&&!o(a=r(n,e)))return a;if(s(n=e.valueOf)&&!o(a=r(n,e)))return a;if("string"!==t&&s(n=e.toString)&&!o(a=r(n,e)))return a;throw new i("Can't convert object to primitive value")}},5031:(e,t,n)=>{"use strict";var r=n(7751),s=n(9504),o=n(8480),i=n(3717),a=n(8551),c=s([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?c(t,n(e)):t}},7750:(e,t,n)=>{"use strict";var r=n(4117),s=TypeError;e.exports=function(e){if(r(e))throw new s("Can't call method on "+e);return e}},9286:(e,t,n)=>{"use strict";var r=n(4402),s=n(8469),o=r.Set,i=r.add;e.exports=function(e){var t=new o;return s(e,(function(e){i(t,e)})),t}},3440:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402),o=n(9286),i=n(5170),a=n(3789),c=n(8469),l=n(507),u=s.has,d=s.remove;e.exports=function(e){var t=r(this),n=a(e),s=o(t);return i(t)<=n.size?c(t,(function(e){n.includes(e)&&d(s,e)})):l(n.getIterator(),(function(e){u(t,e)&&d(s,e)})),s}},4402:(e,t,n)=>{"use strict";var r=n(9504),s=Set.prototype;e.exports={Set,add:r(s.add),has:r(s.has),remove:r(s.delete),proto:s}},8750:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402),o=n(5170),i=n(3789),a=n(8469),c=n(507),l=s.Set,u=s.add,d=s.has;e.exports=function(e){var t=r(this),n=i(e),s=new l;return o(t)>n.size?c(n.getIterator(),(function(e){d(t,e)&&u(s,e)})):a(t,(function(e){n.includes(e)&&u(s,e)})),s}},4449:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402).has,o=n(5170),i=n(3789),a=n(8469),c=n(507),l=n(9539);e.exports=function(e){var t=r(this),n=i(e);if(o(t)<=n.size)return!1!==a(t,(function(e){if(n.includes(e))return!1}),!0);var u=n.getIterator();return!1!==c(u,(function(e){if(s(t,e))return l(u,"normal",!1)}))}},3838:(e,t,n)=>{"use strict";var r=n(7080),s=n(5170),o=n(8469),i=n(3789);e.exports=function(e){var t=r(this),n=i(e);return!(s(t)>n.size)&&!1!==o(t,(function(e){if(!n.includes(e))return!1}),!0)}},8527:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402).has,o=n(5170),i=n(3789),a=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=i(e);if(o(t)<n.size)return!1;var l=n.getIterator();return!1!==a(l,(function(e){if(!s(t,e))return c(l,"normal",!1)}))}},8469:(e,t,n)=>{"use strict";var r=n(9504),s=n(507),o=n(4402),i=o.Set,a=o.proto,c=r(a.forEach),l=r(a.keys),u=l(new i).next;e.exports=function(e,t,n){return n?s({iterator:l(e),next:u},t):c(e,t)}},4916:(e,t,n)=>{"use strict";var r=n(7751),s=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};e.exports=function(e){var t=r("Set");try{(new t)[e](s(0));try{return(new t)[e](s(-1)),!1}catch(e){return!0}}catch(e){return!1}}},5170:(e,t,n)=>{"use strict";var r=n(6706),s=n(4402);e.exports=r(s.proto,"size","get")||function(e){return e.size}},3650:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402),o=n(9286),i=n(3789),a=n(507),c=s.add,l=s.has,u=s.remove;e.exports=function(e){var t=r(this),n=i(e).getIterator(),s=o(t);return a(n,(function(e){l(t,e)?u(s,e):c(s,e)})),s}},4204:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402).add,o=n(9286),i=n(3789),a=n(507);e.exports=function(e){var t=r(this),n=i(e).getIterator(),c=o(t);return a(n,(function(e){s(c,e)})),c}},6119:(e,t,n)=>{"use strict";var r=n(5745),s=n(3392),o=r("keys");e.exports=function(e){return o[e]||(o[e]=s(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),s=n(4475),o=n(9433),i="__core-js_shared__",a=e.exports=s[i]||o(i,{});(a.versions||(a.versions=[])).push({version:"3.37.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},4495:(e,t,n)=>{"use strict";var r=n(7388),s=n(9039),o=n(4475).String;e.exports=!!Object.getOwnPropertySymbols&&!s((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:(e,t,n)=>{"use strict";var r=n(1291),s=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?s(n+t,0):o(n,t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),s=n(7750);e.exports=function(e){return r(s(e))}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},8014:(e,t,n)=>{"use strict";var r=n(1291),s=Math.min;e.exports=function(e){var t=r(e);return t>0?s(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),s=Object;e.exports=function(e){return s(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),s=n(34),o=n(757),i=n(5966),a=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!s(e)||o(e))return e;var n,c=i(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!s(n)||o(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},6969:(e,t,n)=>{"use strict";var r=n(2777),s=n(757);e.exports=function(e){var t=r(e,"string");return s(t)?t:t+""}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},655:(e,t,n)=>{"use strict";var r=n(6955),s=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return s(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,n)=>{"use strict";var r=n(9504),s=0,o=Math.random(),i=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++s+o,36)}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,n)=>{"use strict";var r=n(3724),s=n(9039);e.exports=r&&s((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:(e,t,n)=>{"use strict";var r=n(4475),s=n(4901),o=r.WeakMap;e.exports=s(o)&&/native code/.test(String(o))},8227:(e,t,n)=>{"use strict";var r=n(4475),s=n(5745),o=n(9297),i=n(3392),a=n(4495),c=n(7040),l=r.Symbol,u=s("wks"),d=c?l.for||l:l&&l.withoutSetter||i;e.exports=function(e){return o(u,e)||(u[e]=a&&o(l,e)?l[e]:d("Symbol."+e)),u[e]}},8107:(e,t,n)=>{"use strict";var r=n(6518),s=n(8981),o=n(6198),i=n(1291),a=n(6469);r({target:"Array",proto:!0},{at:function(e){var t=s(this),n=o(t),r=i(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}}),a("at")},4114:(e,t,n)=>{"use strict";var r=n(6518),s=n(8981),o=n(6198),i=n(4527),a=n(6837);r({target:"Array",proto:!0,arity:1,forced:n(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=s(this),n=o(t),r=arguments.length;a(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return i(t,n),n}})},7642:(e,t,n)=>{"use strict";var r=n(6518),s=n(3440);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("difference")},{difference:s})},8004:(e,t,n)=>{"use strict";var r=n(6518),s=n(9039),o=n(8750);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("intersection")||s((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:o})},3853:(e,t,n)=>{"use strict";var r=n(6518),s=n(4449);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isDisjointFrom")},{isDisjointFrom:s})},5876:(e,t,n)=>{"use strict";var r=n(6518),s=n(3838);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSubsetOf")},{isSubsetOf:s})},2475:(e,t,n)=>{"use strict";var r=n(6518),s=n(8527);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSupersetOf")},{isSupersetOf:s})},5024:(e,t,n)=>{"use strict";var r=n(6518),s=n(3650);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("symmetricDifference")},{symmetricDifference:s})},1698:(e,t,n)=>{"use strict";var r=n(6518),s=n(4204);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("union")},{union:s})},3375:(e,t,n)=>{"use strict";n(7642)},9225:(e,t,n)=>{"use strict";n(8004)},3972:(e,t,n)=>{"use strict";n(3853)},9209:(e,t,n)=>{"use strict";n(5876)},5714:(e,t,n)=>{"use strict";n(2475)},7561:(e,t,n)=>{"use strict";n(5024)},6197:(e,t,n)=>{"use strict";n(1698)},4979:(e,t,n)=>{"use strict";var r=n(6518),s=n(4475),o=n(7751),i=n(6980),a=n(4913).f,c=n(9297),l=n(679),u=n(3167),d=n(2603),p=n(5002),h=n(6193),f=n(3724),m=n(6395),y="DOMException",v=o("Error"),g=o(y),b=function(){l(this,x);var e=arguments.length,t=d(e<1?void 0:arguments[0]),n=d(e<2?void 0:arguments[1],"Error"),r=new g(t,n),s=new v(t);return s.name=y,a(r,"stack",i(1,h(s.stack,1))),u(r,this,b),r},x=b.prototype=g.prototype,w="stack"in new v(y),_="stack"in new g(1,2),C=g&&f&&Object.getOwnPropertyDescriptor(s,y),E=!(!C||C.writable&&C.configurable),S=w&&!E&&!_;r({global:!0,constructor:!0,forced:m||S},{DOMException:S?b:g});var j=o(y),T=j.prototype;if(T.constructor!==j)for(var k in m||a(T,"constructor",i(1,j)),p)if(c(p,k)){var N=p[k],A=N.s;c(j,A)||a(j,A,i(6,N.c))}}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var s=r.length-1;s>-1&&(!e||!/^http(s?):/.test(e));)e=r[s--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var r={};(()=>{"use strict";n.r(r),n.d(r,{API:()=>we,AgentInfo:()=>kl,Chat:()=>vc,ChatFrame:()=>ll,ComponentFilter:()=>Ca,Conversation:()=>cc,Engine:()=>Cl,EntryContainer:()=>il,EventParticipant:()=>hi,ExternalApi:()=>jl,Header:()=>Nl,Icon:()=>gi,Interrupt:()=>cl,MessageContainer:()=>fi,SeamlyActivityMonitor:()=>Ea,SeamlyApiContext:()=>So,SeamlyEventBusContext:()=>jo,SeamlyFileUpload:()=>Ta,SeamlyGeneralError:()=>c,SeamlyLiveRegionContext:()=>To,SeamlyOfflineError:()=>_r,SeamlyStoreProvider:()=>Dn,Text:()=>ga,TextEntry:()=>Zc,Upload:()=>sl,View:()=>wl,calculateVisibility:()=>bn,className:()=>Zo,default:()=>Al,eventTypes:()=>T,randomId:()=>m,useChoicePrompt:()=>Ti,useEvents:()=>Jn,useGeneratedId:()=>di,useI18n:()=>wo,useSeamlyActions:()=>Tl,useSeamlyChat:()=>Do,useSeamlyCommands:()=>Io,useSeamlyConfig:()=>Hn,useSeamlyEventStream:()=>pi,useSeamlyIdleDetachCountdown:()=>li,useSeamlyMessageContainerClassNames:()=>ei,useSeamlyOptions:()=>oi,useSeamlyVisibility:()=>_o,useTranslatedEventData:()=>Ko,useTranslations:()=>Go,useTranslationsContainer:()=>Jo,visibilityStates:()=>vn}),n(9497),n(4114);var e=n(2086),t=n.n(e),s=n(8785);class o extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.status=t?.status}}class i extends Error{action="";langKey="";constructor(e,...t){if(super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Object.getPrototypeOf(this)),this.originalError=e,e?.payload&&(this.originalEvent=e,this.originalError=e.payload.error,this.message=`Event of type ${e.payload.type} encountered`),!this.message&&e?.message){const t=function(e){try{return JSON.parse(e).error}catch(t){return e}}(e.message);this.message=t}e?.error&&(this.originalError=e.error)}}class a extends i{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class c extends i{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class l extends i{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class u extends i{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const d="cvco",p="seamly-client-participant",h=50,f=300;function m(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function y(e){const t=`cvco.${e}`;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let n;do{n=sessionStorage.getItem(e[0])}while(e.shift()&&!n);return n?JSON.parse(n):{}},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const v=(e,t)=>{let n;return function(...r){let s=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,s||e.apply(this,r),s=!1}),t),t=>{s=!0,t&&e.apply(this,r)}}},g=e=>Math.ceil(e/1e3),b=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},x=(e,t=2)=>{if(0===e)return"0 Bytes";const n=t<0?0:t,r=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/1024**r).toFixed(n))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]}`},w={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},_={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},C=e=>e.code?_[e.code]:w[e.keyCode],E=e=>{e&&e.focus()},S=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function j(e){return"object"==typeof e}const T={info:"info",message:"message",participant:"participant",system:"system"},k="text",N="text",A="upload",R="received",I="read",O="custom",L="typing",M="read",P="detach_service",D="dismiss",U="set_topic",F="click_cta",B="translation_proposal",z=B,$="window_api",H="assertive",V="polite",W={new_topic:"newTopic",new_translation:"newTranslation"},q="uploads",G="navigate";n(3375),n(9225),n(3972),n(9209),n(5714),n(7561),n(6197),n(4979);var K=e=>"function"==typeof e?e:function(){return e},J="undefined"!=typeof self?self:null,X="undefined"!=typeof window?window:null,Y=J||X||Y,Z="closed",Q="errored",ee="joined",te="joining",ne="leaving",re="phx_close",se="phx_error",oe="phx_reply",ie="phx_leave",ae="websocket",ce=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},le=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}},ue=class{constructor(e,t,n){this.state=Z,this.topic=e,this.params=K(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ce(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new le((()=>{this.socket.isConnected()&&this.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((()=>this.rejoinTimer.reset()))),this.stateChangeRefs.push(this.socket.onOpen((()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()}))),this.joinPush.receive("ok",(()=>{this.state=ee,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Z,this.socket.remove(this)})),this.onError((e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new ce(this,ie,K({}),this.timeout).send(),this.state=Q,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(oe,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(re,e)}onError(e){return this.on(se,(t=>e(t)))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter((n=>!(n.event===e&&(void 0===t||t===n.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new ce(this,e,(function(){return t}),n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ne;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(re,"leave")},n=new ce(this,ie,K({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return!(this.topic!==e||r&&r!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=te,this.joinPush.resend(e))}trigger(e,t,n,r){let s=this.onMessage(e,t,n,r);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter((t=>t.event===e));for(let e=0;e<o.length;e++)o[e].callback(s,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Z}isErrored(){return this.state===Q}isJoined(){return this.state===ee}isJoining(){return this.state===te}isLeaving(){return this.state===ne}},de=class{static request(e,t,n,r,s,o,i){if(Y.XDomainRequest){let n=new Y.XDomainRequest;return this.xdomainRequest(n,e,t,r,s,o,i)}{let a=new Y.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,s,o,i)}}static xdomainRequest(e,t,n,r,s,o,i){return e.timeout=s,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);i&&i(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,s,o,i,a){return e.open(t,n,!0),e.timeout=o,e.setRequestHeader("Content-Type",r),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(4===e.readyState&&a){let t=this.parseJSON(e.responseText);a(t)}},i&&(e.ontimeout=i),e.send(s),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let s=t?`${t}[${r}]`:r,o=e[r];"object"==typeof o?n.push(this.serialize(o,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(o))}return n.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},pe=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,setTimeout((()=>this.poll()),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ae),"$1/longpoll")}endpointURL(){return de.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return 1===this.readyState||0===this.readyState}poll(){this.ajax("GET","application/json",null,(()=>this.ontimeout()),(e=>{if(e){var{status:t,token:n,messages:r}=e;this.token=n}else t=0;switch(t){case 200:r.forEach((e=>{setTimeout((()=>this.onmessage({data:e})),0)})),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){"string"!=typeof e&&(e=(e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout((()=>{this.batchSend(this.currentBatch),this.currentBatch=null}),0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join("\n"),(()=>this.onerror("timeout")),(e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))}))}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=3;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,s){let o;o=de.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(o),r()}),(e=>{this.reqs.delete(o),this.isActive()&&s(e)})),this.reqs.add(o)}},he={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,s,o,i]=JSON.parse(e);return t({join_ref:n,ref:r,topic:s,event:o,payload:i})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:s,payload:o}=e,i=this.META_LENGTH+t.length+n.length+s.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+i),c=new DataView(a),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,t.length),c.setUint8(l++,n.length),c.setUint8(l++,s.length),c.setUint8(l++,r.length),Array.from(t,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(n,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(s,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(a.byteLength+o.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(o),a.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=t.getUint8(3),i=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(i,i+r));i+=r;let c=n.decode(e.slice(i,i+s));i+=s;let l=n.decode(e.slice(i,i+o));return i+=o,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(i,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=t.getUint8(3),i=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(a,a+r));a+=r;let l=n.decode(e.slice(a,a+s));a+=s;let u=n.decode(e.slice(a,a+o));a+=o;let d=n.decode(e.slice(a,a+i));a+=i;let p=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:oe,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=this.HEADER_LENGTH+2,i=n.decode(e.slice(o,o+r));o+=r;let a=n.decode(e.slice(o,o+s));return o+=s,{join_ref:null,ref:null,topic:i,event:a,payload:e.slice(o,e.byteLength)}}},fe=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||1e4,this.transport=t.transport||Y.WebSocket||pe,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Y.sessionStorage,this.establishedConnections=0,this.defaultEncoder=he.encode.bind(he),this.defaultDecoder=he.decode.bind(he),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==pe?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;X&&X.addEventListener&&(X.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),X.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=K(t.params||{}),this.endPoint=`${e}/${ae}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new le((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return pe}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=de.appendParams(de.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=K(e)),this.conn||(this.longPollFallbackMs&&this.transport!==pe?this.connectWithFallback(pe,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage((s=>{s.ref===t&&(this.off([r]),e(Date.now()-n))}));return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n,r=!1,s=!0,o=t=>{this.log("transport",`falling back to ${e.name}...`,t),this.off([void 0,n]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),n=this.onError((e=>{this.log("transport","error",e),s&&!r&&(clearTimeout(this.fallbackTimer),o(e))})),this.onOpen((()=>{if(r=!0,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping((e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)}))})),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((([,e])=>e()))}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown((()=>this.reconnectTimer.scheduleTimeout()),1e3,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()}))}))}waitForBufferDone(e,t=1){5!==t&&this.conn&&this.conn.bufferedAmount?setTimeout((()=>{this.waitForBufferDone(e,t+1)}),150*t):e()}waitForSocketClosed(e,t=1){5!==t&&this.conn&&3!==this.conn.readyState?setTimeout((()=>{this.waitForSocketClosed(e,t+1)}),150*t):e()}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((([,t])=>t(e)))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,r])=>{r(e,t,n)})),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(se)}))}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((t=>t!==e))}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((([t])=>-1===e.indexOf(t)))}channel(e,t={}){let n=new ue(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:s,join_ref:o}=e;this.log("push",`${t} ${n} (${o}, ${s})`,r)}this.isConnected()?this.encode(e,(e=>this.conn.send(e))):this.sendBuffer.push((()=>this.encode(e,(e=>this.conn.send(e)))))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:n,payload:r,ref:s,join_ref:o}=e;s&&s===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${s&&"("+s+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const i=this.channels[e];i.isMember(t,n,r,o)&&i.trigger(n,r,s,o)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,n]=this.stateChangeCallbacks.message[t];n(e)}}))}leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t.isJoined()||t.isJoining())));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};const me=()=>null,ye=new Set;class ve{#e=[];async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:s,params:o}=(e=>{const t=e.indexOf("?");return t<0?{url:e,params:{}}:{url:e.slice(0,t),params:e.slice(t+1).split("&").reduce((function(e,t){const[n,r]=t.split("=");return{...e,[n]:decodeURIComponent(r)}}),{})}})(this.url);this.socket=new fe(s,{params:{...o,v:"3"},reconnectAfterMs:e=>{const t=2**e*250;return Math.min(t,1e4)}}),this.socket.onError((e=>{me("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{me("[SOCKET]OPEN")})),this.socket.onClose((()=>{me("[SOCKET]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"socket_closed"})})),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName}),this.start(),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&this.#t({connected:!0,ready:!0,currentState:"attach_channel_succeeded"})})),this.channel.onClose((()=>{me("[CHANNEL]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{me("[CHANNEL][ERROR]",e),this.#t({connected:!1,ready:!1,currentState:"channel_erred"})})),this.#n("ack","ui","error","participant","message","service_data","system","info","sync")}start(){this.channel?.join().receive("ok",(()=>{me("[CHANNEL][JOIN] OK"),this.#t({connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{me("[CHANNEL][JOIN] ERROR",e),this.#t({connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{me("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){this.channel?.leave().receive("ok",(()=>{this.socket?.disconnect(),me("[CHANNEL][LEAVE] OK"),this.#e=[]}))}#n(...e){e.forEach((e=>{this.channel?.on(e,(t=>{me("[RECEIVE]",e,t)}))}))}onConnection(e){this.#e.push(e)}#t(e){this.#e=this.#e.filter((t=>!t(e))),ye.forEach((e=>e()))}pushToChannel(e,t,n=1e4){this.channel?.push(e,t,n)}static subscribe(e){return ye.add(e),()=>ye.delete(e)}}const ge=()=>null,be=async(e,t)=>{const n=new URL(e);n.searchParams.set("v","3");const r=await fetch(n.href,{mode:"cors",...t});if(!r.ok)throw new o(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function xe(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return null;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return null;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:null}class we{#r;#s;#o;#i="window";#a;conversation=new ve;constructor({layoutMode:e,namespace:t,config:n,context:r}){this.store=function(e,t){const n=t(e),r=n.get()||{};return{get:e=>void 0===e?r:r[e],set:(e,t)=>(r[e]=t,n.set(r),t),delete(e){const t=this.get(e);return delete r[e],n.set(r),t}}}(`${t}.connection${r?.userLocale?`.${r.userLocale}`:""}`,n.storageProvider||y),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},this.#a={...n,sendEnvironment:n.sendEnvironment??!0,context:{...r,channelName:r?.channelName||"web"}},this.#r=!1,this.connected=!1,this.configReady=!1,this.#s=n.externalId,e&&(this.#i=e),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}#c(){return this.store.get("accessToken")}#l(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}#u(e){this.store.set("conversationUrl",e)}hasConversation(){return!!this.getConversationUrl()}#d(){return this.store.get("channelTopic")||this.store.get("channelName")}#p(e){this.store.set("channelTopic",e)}#h=e=>e||this.locale;clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}#f(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}#m({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>(e[t]=n,e)),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversation?.disconnect&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}async#y(){if(!this.hasConversation())try{"function"==typeof this.#a?.getConversationAuthToken&&(this.#o=await this.#a.getConversationAuthToken());const e=await be(`${this.#f("http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#o?void 0:this.#s,token:this.#o})}),t=await e.json(),{conversation:n}=t,r={...n};return delete r.accessToken,delete r.channelTopic,this.#l(n.accessToken),this.#p(n.channelTopic),this.#m(t),this.URLS.conversation&&this.#u(this.URLS.conversation),this.locale=n.translation?.locale,this.userResponded=n.userResponded,r}catch(e){if(e.status>=500)throw new c(e);if(400===e.status)throw new u(e);if(404===e.status)throw new a(e);throw e}}async getConfig(){try{const e=await be(`${this.#f("http")}/client/${this.connectionInfo.apiKey}/configs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:{...this.#a.context,environment:!0===this.#a.sendEnvironment?this.getEnvironment():this.#a.sendEnvironment}})}),t=await e.json();return this.#m(t),this.configReady=!0,t.config}catch(e){if(404===e.status)throw new a(e);if(e.status>=500)throw new c(e);throw e}}async getConversation(){if(!this.hasConversation())return null;try{const e=await be(`${this.#f("http")}${this.URLS.history}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),t=await e.json();this.#m(t);const{messages:n,participants:r,activeServiceSessionId:s,activeServiceSettings:o,serviceData:i,ui:a,translation:c}=t.history;return{events:n.map((([e,t])=>({type:e,payload:{...t,type:"participant"===e?e:t.type}}))),participants:r,activeServiceSessionId:s,activeServiceSettings:o,serviceData:i,resumeConversationPrompt:!!a&&Boolean(a.resumeConversationPrompt),translationProposal:a.translationProposal,translation:c}}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw new o(e)}}async connect(){this.connected=!1;const e=await this.#y();return this.conversation.connect(`${this.#f("ws")}${this.URLS.socket}`,this.#a.context.channelName,this.#d(),this.#c()),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,this.#r=t})),e}uploadFile(e,t,n,r){const s=new FormData;s.append("upload",e);const o=new XMLHttpRequest;return o.open("POST",`${this.#f("http")}${this.URLS.uploads}`),o.setRequestHeader("Authorization",`Bearer ${this.#c()}`),o.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},o.onloadend=()=>{if(0!==o.status)if(200!==o.status&&201!==o.status||!n){if(!r)throw new Error(o.response);try{r(JSON.parse(o.response))}catch(e){r(o.response)}}else try{n(JSON.parse(o.response))}catch(e){n(o.response)}},o.send(s),o}async getConversationIntitialState(){try{const n=await be(`${this.#f("http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),r=await n.json();return this.#m(r),this.userResponded=r.conversation.userResponded,e=r.conversation,t=["accessToken","channelTopic"],Object.keys(e).reduce(((n,r)=>(t.includes(r)||(n[r]=e[r]),n)),{})}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw e}var e,t}async getTranslations(e){try{if(!this.URLS.translations)throw new a;const t=this.#h(e);if(!t)throw new c;const n=`${this.#f("http")}${this.URLS.translations}`.replace("{version}",String(4)).replace("{locale}",t),r=await be(n,{method:"GET"});return(await r.json()).translations}catch(e){if(e.status>=500)throw new c(e);throw new o(e)}}send(e,t=void 0,n=!0){!this.connected||n&&!this.#r?this.conversation?.onConnection((({connected:r,ready:s})=>(this.connected=r,this.#r=s,!!(n?s:r)&&(this.send(e,t,n),!0)))):(ge("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:s}=t;return s||(s=m()),{type:n,body:r,transactionId:s}}(e,t),1e4))}sendContext(e){const{contentLocale:t,source:n,userLocale:r,variables:s,environment:o}=e,i={};if(o&&(i.environment=o),t){if("string"!=typeof t)throw new Error("Content locale must be a string");i.contentLocale=t}if(n){if("string"!=typeof n)throw new Error("Source must be a string");i.source=n}if(r){if("string"!=typeof r)throw new Error("User locale must be a string");i.userLocale=r,this.#v(i,r)}if(s){if("object"!=typeof s)throw new Error("Variables must be an object");i.variables=s}0===Object.keys(i).length&&i.constructor===Object||this.send("context",i,!1)}#v(e,t){e.source||t==this.#a.context?.userLocale||(e.source=$)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#i,clientVersion:"23.0.6-alpha.1",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:xe(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}var _e=Symbol.for("immer-nothing"),Ce=Symbol.for("immer-draftable"),Ee=Symbol.for("immer-state");function Se(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var je=Object.getPrototypeOf;function Te(e){return!!e&&!!e[Ee]}function ke(e){return!!e&&(Ae(e)||Array.isArray(e)||!!e[Ce]||!!e.constructor?.[Ce]||Me(e)||Pe(e))}var Ne=Object.prototype.constructor.toString();function Ae(e){if(!e||"object"!=typeof e)return!1;const t=je(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Ne}function Re(e,t){0===Ie(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Ie(e){const t=e[Ee];return t?t.type_:Array.isArray(e)?1:Me(e)?2:Pe(e)?3:0}function Oe(e,t){return 2===Ie(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Le(e,t,n){const r=Ie(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Me(e){return e instanceof Map}function Pe(e){return e instanceof Set}function De(e){return e.copy_||e.base_}function Ue(e,t){if(Me(e))return new Map(e);if(Pe(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ae(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Ee];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const s=n[r],o=t[s];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(je(e),t)}{const t=je(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function Fe(e,t=!1){return ze(e)||Te(e)||!ke(e)||(Ie(e)>1&&(e.set=e.add=e.clear=e.delete=Be),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Fe(t,!0)))),e}function Be(){Se(2)}function ze(e){return Object.isFrozen(e)}var $e,He={};function Ve(e){const t=He[e];return t||Se(0),t}function We(){return $e}function qe(e,t){t&&(Ve("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ge(e){Ke(e),e.drafts_.forEach(Xe),e.drafts_=null}function Ke(e){e===$e&&($e=e.parent_)}function Je(e){return $e={drafts_:[],parent_:$e,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xe(e){const t=e[Ee];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ee].modified_&&(Ge(t),Se(4)),ke(e)&&(e=Ze(t,e),t.parent_||et(t,e)),t.patches_&&Ve("Patches").generateReplacementPatches_(n[Ee].base_,e,t.patches_,t.inversePatches_)):e=Ze(t,n,[]),Ge(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_e?e:void 0}function Ze(e,t,n){if(ze(t))return t;const r=t[Ee];if(!r)return Re(t,((s,o)=>Qe(e,r,t,s,o,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return et(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let s=t,o=!1;3===r.type_&&(s=new Set(t),t.clear(),o=!0),Re(s,((s,i)=>Qe(e,r,t,s,i,n,o))),et(e,t,!1),n&&e.patches_&&Ve("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Qe(e,t,n,r,s,o,i){if(Te(s)){const i=Ze(e,s,o&&t&&3!==t.type_&&!Oe(t.assigned_,r)?o.concat(r):void 0);if(Le(n,r,i),!Te(i))return;e.canAutoFreeze_=!1}else i&&n.add(s);if(ke(s)&&!ze(s)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ze(e,s),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||et(e,s)}}function et(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Fe(t,n)}var tt={get(e,t){if(t===Ee)return e;const n=De(e);if(!Oe(n,t))return function(e,t,n){const r=st(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!ke(r)?r:r===rt(e.base_,t)?(it(e),e.copy_[t]=at(r,e)):r},has:(e,t)=>t in De(e),ownKeys:e=>Reflect.ownKeys(De(e)),set(e,t,n){const r=st(De(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=rt(De(e),t),i=r?.[Ee];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((s=n)===(o=r)?0!==s||1/s==1/o:s!=s&&o!=o)&&(void 0!==n||Oe(e.base_,t)))return!0;it(e),ot(e)}var s,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==rt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,it(e),ot(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=De(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Se(11)},getPrototypeOf:e=>je(e.base_),setPrototypeOf(){Se(12)}},nt={};function rt(e,t){const n=e[Ee];return(n?De(n):e)[t]}function st(e,t){if(!(t in e))return;let n=je(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=je(n)}}function ot(e){e.modified_||(e.modified_=!0,e.parent_&&ot(e.parent_))}function it(e){e.copy_||(e.copy_=Ue(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function at(e,t){const n=Me(e)?Ve("MapSet").proxyMap_(e,t):Pe(e)?Ve("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:We(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,o=tt;n&&(s=[r],o=nt);const{revoke:i,proxy:a}=Proxy.revocable(s,o);return r.draft_=a,r.revoke_=i,a}(e,t);return(t?t.scope_:We()).drafts_.push(n),n}function ct(e){return Te(e)||Se(10),lt(e)}function lt(e){if(!ke(e)||ze(e))return e;const t=e[Ee];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ue(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ue(e,!0);return Re(n,((e,t)=>{Le(n,e,lt(t))})),t&&(t.finalized_=!1),n}Re(tt,((e,t)=>{nt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),nt.deleteProperty=function(e,t){return nt.set.call(this,e,t,void 0)},nt.set=function(e,t,n){return tt.set.call(this,e[0],t,n,e[0])};var ut=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...s){return r.produce(e,(e=>t.call(this,e,...s)))}}let r;if("function"!=typeof t&&Se(6),void 0!==n&&"function"!=typeof n&&Se(7),ke(e)){const s=Je(this),o=at(e,void 0);let i=!0;try{r=t(o),i=!1}finally{i?Ge(s):Ke(s)}return qe(s,n),Ye(r,s)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===_e&&(r=void 0),this.autoFreeze_&&Fe(r,!0),n){const t=[],s=[];Ve("Patches").generateReplacementPatches_(e,r,t,s),n(t,s)}return r}Se(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ke(e)||Se(8),Te(e)&&(e=ct(e));const t=Je(this),n=at(e,void 0);return n[Ee].isManual_=!0,Ke(t),n}finishDraft(e,t){const n=e&&e[Ee];n&&n.isManual_||Se(9);const{scope_:r}=n;return qe(r,t),Ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Ve("Patches").applyPatches_;return Te(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},dt=ut.produce;ut.produceWithPatches.bind(ut),ut.setAutoFreeze.bind(ut),ut.setUseStrictShallowCopy.bind(ut),ut.applyPatches.bind(ut),ut.createDraft.bind(ut),ut.finishDraft.bind(ut);var pt=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var ht="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},ft=0,mt=1;function yt(){return{s:ft,v:void 0,o:null,p:null}}function vt(e,t={}){let n=yt();const{resultEqualityCheck:r}=t;let s,o=0;function i(){let t=n;const{length:i}=arguments;for(let e=0,n=i;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===mt)c=t.v;else if(c=e.apply(null,arguments),o++,r){const e=s?.deref?.()??s;null!=e&&r(e,c)&&(c=e,0!==o&&o--),s="object"==typeof c&&null!==c||"function"==typeof c?new ht(c):c}return a.s=mt,a.v=c,c}return i.clearCache=()=>{n=yt(),i.resetResultsCount()},i.resultsCount=()=>o,i.resetResultsCount=()=>{o=0},i}function gt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,s=0,o={},i=e.pop();"object"==typeof i&&(o=i,i=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(i,`createSelector expects an output function after the inputs, but received: [${typeof i}]`);const a={...n,...o},{memoize:c,memoizeOptions:l=[],argsMemoize:u=vt,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,h=pt(l),f=pt(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=c((function(){return r++,i.apply(null,arguments)}),...h),v=u((function(){s++;const e=function(e,t){const n=[],{length:r}=e;for(let s=0;s<r;s++)n.push(e[s].apply(null,t));return n}(m,arguments);return t=y.apply(null,e),t}),...f);return Object.assign(v,{resultFunc:i,memoizedResultFunc:y,dependencies:m,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var bt=gt(vt),xt=Object.assign(((e,t=bt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>xt});function wt(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 _t=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Ct=()=>Math.random().toString(36).substring(7).split("").join("."),Et={INIT:`@@redux/INIT${Ct()}`,REPLACE:`@@redux/REPLACE${Ct()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ct()}`};function St(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 jt(e,t,n){if("function"!=typeof e)throw new Error(wt(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(wt(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(wt(1));return n(jt)(e,t)}let r=e,s=t,o=new Map,i=o,a=0,c=!1;function l(){i===o&&(i=new Map,o.forEach(((e,t)=>{i.set(t,e)})))}function u(){if(c)throw new Error(wt(3));return s}function d(e){if("function"!=typeof e)throw new Error(wt(4));if(c)throw new Error(wt(5));let t=!0;l();const n=a++;return i.set(n,e),function(){if(t){if(c)throw new Error(wt(6));t=!1,l(),i.delete(n),o=null}}}function p(e){if(!St(e))throw new Error(wt(7));if(void 0===e.type)throw new Error(wt(8));if("string"!=typeof e.type)throw new Error(wt(17));if(c)throw new Error(wt(9));try{c=!0,s=r(s,e)}finally{c=!1}return(o=i).forEach((e=>{e()})),e}return p({type:Et.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(wt(10));r=e,p({type:Et.REPLACE})},[_t]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(wt(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[_t](){return this}}}}}function Tt(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const s=t[r];"function"==typeof e[s]&&(n[s]=e[s])}const r=Object.keys(n);let s;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Et.INIT}))throw new Error(wt(12));if(void 0===n(void 0,{type:Et.PROBE_UNKNOWN_ACTION()}))throw new Error(wt(13))}))}(n)}catch(e){s=e}return function(e={},t){if(s)throw s;let o=!1;const i={};for(let s=0;s<r.length;s++){const a=r[s],c=n[a],l=e[a],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(wt(14));i[a]=u,o=o||u!==l}return o=o||r.length!==Object.keys(e).length,o?i:e}}function kt(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Nt(e){return({dispatch:t,getState:n})=>r=>s=>"function"==typeof s?s(t,n,e):r(s)}var At=Nt(),Rt=Nt,It=(((...e)=>{const t=gt(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(Te(e)?ct(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(vt),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?kt:kt.apply(null,arguments)}),Ot=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Lt(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(dn(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return St(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Mt=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))}};function Pt(e){return ke(e)?dt(e,(()=>{})):e}function Dt(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error(dn(10));const r=n.insert(t,e);return e.set(t,r),r}var Ut=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:s=!0}=e??{};let o=new Mt;return t&&("boolean"==typeof t?o.push(At):o.push(Rt(t.extraArgument))),o},Ft=e=>t=>{setTimeout(t,e)},Bt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ft(10),zt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Mt(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let s=!0,o=!1,i=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?Bt:"callback"===e.type?e.queueNotification:Ft(e.timeout),l=()=>{i=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>s&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return s=!e?.meta?.RTK_autoBatch,o=!s,o&&(i||(i=!0,c(l))),r.dispatch(e)}finally{s=!0}}})})("object"==typeof n?n:void 0)),r},$t=!0;function Ht(e){const t={},n=[];let r;const s={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(dn(28));if(r in t)throw new Error(dn(29));return t[r]=n,s},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),s),addDefaultCase:e=>(r=e,s)};return e(s),[t,n,r]}var Vt=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Wt(...e){return t=>e.some((e=>((e,t)=>Ot(e)?e.match(t):e(t))(e,t)))}var qt=["name","message","stack","code"],Gt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Kt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Jt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of qt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Xt=(()=>{function e(e,t,n){const r=Lt(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),s=Lt(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=Lt(e+"/rejected",((e,t,r,s,o)=>({payload:s,error:(n&&n.serializeError||Jt)(e||"Rejected"),meta:{...o||{},arg:r,requestId:t,rejectedWithValue:!!s,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(i,a,c)=>{const l=n?.idGenerator?n.idGenerator(e):Vt(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let o=n?.condition?.(e,{getState:a,extra:c});if(null!==(m=o)&&"object"==typeof m&&"function"==typeof m.then&&(o=await o),!1===o||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const y=new Promise(((e,t)=>{d=()=>{t({name:"AbortError",message:p||"Aborted"})},u.signal.addEventListener("abort",d)}));i(s(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:c}))),f=await Promise.race([y,Promise.resolve(t(e,{dispatch:i,getState:a,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Gt(e,t),fulfillWithValue:(e,t)=>new Kt(e,t)})).then((t=>{if(t instanceof Gt)throw t;return t instanceof Kt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof Gt?o(null,l,e,t.payload,t.meta):o(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&o.match(f)&&f.meta.condition||i(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(Yt)})}}),{pending:s,rejected:o,fulfilled:r,settled:Wt(o,r),typePrefix:e})}return e.withTypes=()=>e,e})();function Yt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Zt=Symbol.for("rtk-slice-createasyncthunk");function Qt(e,t){return`${e}/${t}`}function en({creators:e}={}){const t=e?.asyncThunk?.[Zt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(dn(11));const s=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(s),i={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(dn(12));if(n in i.sliceCaseReducersByType)throw new Error(dn(13));return i.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(i.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(i.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(i.sliceCaseReducersByName[e]=t,a)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Ht(e.extraReducers):[e.extraReducers],s={...t,...i.sliceCaseReducersByType};return function(e,t){let o,[a,c,l]=Ht((e=>{for(let t in s)e.addCase(t,s[t]);for(let t of i.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}));if("function"==typeof e)o=()=>Pt(e());else{const t=Pt(e);o=()=>t}function u(e=o(),t){let n=[a[t.type],...c.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===n.filter((e=>!!e)).length&&(n=[l]),n.reduce(((e,n)=>{if(n){if(Te(e)){const r=n(e,t);return void 0===r?e:r}if(ke(e))return dt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(dn(9))}return r}}return e}),e)}return u.getInitialState=o,u}(e.initialState)}o.forEach((r=>{const o=s[r],i={reducerName:r,type:Qt(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},r,s){let o,i;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(dn(17));o=r.reducer,i=r.prepare}else o=r;s.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,i?Lt(e,i):Lt(e))}(i,o,a):function({type:e,reducerName:t},n,r,s){if(!s)throw new Error(dn(18));const{payloadCreator:o,fulfilled:i,pending:a,rejected:c,settled:l,options:u}=n,d=s(e,o,u);r.exposeAction(t,d),i&&r.addCase(d.fulfilled,i),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:i||rn,pending:a||rn,rejected:c||rn,settled:l||rn})}(i,o,a,t)}));const l=e=>e,u=new Map;let d;function p(e,t){return d||(d=c()),d(e,t)}function h(){return d||(d=c()),d.getInitialState()}function f(t,n=!1){function r(e){let r=e[t];return void 0===r&&n&&(r=h()),r}function s(t=l){const r=Dt(u,n,{insert:()=>new WeakMap});return Dt(r,t,{insert:()=>{const r={};for(const[s,o]of Object.entries(e.selectors??{}))r[s]=tn(o,t,h,n);return r}})}return{reducerPath:t,getSelectors:s,get selectors(){return s(r)},selectSlice:r}}const m={name:n,reducer:p,actions:i.actionCreators,caseReducers:i.sliceCaseReducersByName,getInitialState:h,...f(r),injectInto(e,{reducerPath:t,...n}={}){const s=t??r;return e.inject({reducerPath:s,reducer:p},n),{...m,...f(s,!0)}}};return m}}function tn(e,t,n,r){function s(s,...o){let i=t(s);return void 0===i&&r&&(i=n()),e(i,...o)}return s.unwrapped=e,s}var nn=en();function rn(){}var{assign:sn}=Object,on="listenerMiddleware",an=e=>{let{type:t,actionCreator:n,matcher:r,predicate:s,effect:o}=e;if(t)s=Lt(t).match;else if(n)t=n.type,s=n.match;else if(r)s=r;else if(!s)throw new Error(dn(21));return((e,t)=>{if("function"!=typeof e)throw new Error(dn(32))})(o),{predicate:s,type:t,effect:o}},cn=Object.assign((e=>{const{type:t,predicate:n,effect:r}=an(e);return{id:Vt(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(dn(22))}}}),{withTypes:()=>cn}),ln=Object.assign(Lt(`${on}/add`),{withTypes:()=>ln}),un=(Lt(`${on}/removeAll`),Object.assign(Lt(`${on}/remove`),{withTypes:()=>un}));function dn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");class pn extends i{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const hn=Xt("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,defaultLocale:r,preChat:s,agentParticipant:o,userParticipant:i,startChatIcon:a}=await t.getConfig(),c=n?.context?.userLocale||r,l=n?.context?.contentLocale||r,{connectWhenInView:u}=n;return{features:e,defaultLocale:r,preChat:s,agentParticipant:o,userParticipant:i,startChatIcon:a,defaultUserLocale:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})),fn=Xt("resetConfig",(async(e,{extra:{config:t}})=>t)),mn=bt((({app:e})=>e),(({userHasResponded:e})=>e)),yn="visibility",vn={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},gn=bt((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?vn.open:vn.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),bn=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:s,layoutMode:o,hideOnNoUserResponse:i}=r,{visible:a}=s||{};if("app"===o&&!t)return vn.open;if("window"===o&&i&&n!==vn.open)return e?n||t||vn.open:vn.hidden;if("inline"===o&&e&&!n)return t||vn.open;const c=vn.minimized;return n||t||a||c};var xn=n(7402),wn=n(8418),_n=xn.default,Cn=Symbol.for("react-redux-context"),En="undefined"!=typeof globalThis?globalThis:{};function Sn(){if(!_n.createContext)return{};const e=En[Cn]??(En[Cn]=new Map);let t=e.get(_n.createContext);return t||(t=_n.createContext(null),e.set(_n.createContext,t)),t}var jn=Sn();function Tn(e=jn){return function(){return _n.useContext(e)}}var kn=Tn(),Nn=()=>{throw new Error("uSES not initialized!")},An=(e,t)=>e===t;function Rn(e=jn){const t=e===jn?kn:Tn(e),n=(e,n={})=>{const{equalityFn:r=An,devModeChecks:s={}}="function"==typeof n?{equalityFn:n}:n,{store:o,subscription:i,getServerState:a,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(_n.useRef(!0),_n.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,s.stabilityCheck])),d=Nn(i.addNestedSub,o.getState,a||o.getState,u,r);return _n.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var In=Rn();Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen"),Symbol.for("react.client.reference");var On={notify(){},get:()=>[]};var Ln=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Mn="undefined"!=typeof navigator&&"ReactNative"===navigator.product,Pn=Ln||Mn?_n.useLayoutEffect:_n.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var Dn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:s="once",identityFunctionCheck:o="once"}){const i=_n.useMemo((()=>{const t=function(e,t){let n,r=On,s=0,o=!1;function i(){l.onStateChange&&l.onStateChange()}function a(){s++,n||(n=t?t.addNestedSub(i):e.subscribe(i),r=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 s=t={callback:n,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){r&&null!==e&&(r=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}())}function c(){s--,n&&0===s&&(n(),n=void 0,r.clear(),r=On)}const l={addNestedSub:function(e){a();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:i,isSubscribed:function(){return o},trySubscribe:function(){o||(o=!0,a())},tryUnsubscribe:function(){o&&(o=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:s,identityFunctionCheck:o}}),[e,r,s,o]),a=_n.useMemo((()=>e.getState()),[e]);Pn((()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),a!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[i,a]);const c=t||jn;return _n.createElement(c.Provider,{value:i},n)};function Un(e=jn){const t=e===jn?kn:Tn(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Fn=Un();function Bn(e=jn){const t=e===jn?Fn:Un(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var zn,$n=Bn();zn=wn.useSyncExternalStoreWithSelector,Nn=zn,xn.useSyncExternalStore;const Hn=()=>In(gn);function Vn(){const{startChatIcon:e}=Hn();return e}const Wn=({state:e})=>e,qn=()=>In(Wn),Gn=bt(Wn,gn,mn,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const s={type:"service_data",payload:t.suggestion};return[...e,s]})),Kn=bt(Gn,gn,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,s)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const o=s[n-1];if(!t?.occurredAt||!o.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const i=g(t.occurredAt-o.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:i}}})):e})),Jn=()=>In(Kn),Xn=(bt(Kn,(e=>e.map((e=>e.payload.id)))),()=>qn().isLoading),Yn=()=>qn().unreadEvents,Zn=()=>qn().skiplinkTargetId,Qn=()=>qn().serviceInfo,er=bt(Kn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),tr=()=>{const{participants:e,currentAgent:t}=qn().participantInfo;return t?e[t]:null},nr=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=qn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},rr=()=>{const{layoutMode:e}=Hn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},sr=bt((({visibility:e})=>e),(e=>e.visibility)),or=bt((({visibility:e})=>e),(e=>e.showInlineView)),ir=[vn.open,vn.minimized,vn.hidden],ar=Xt("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const s=t(),o=sr(s),i=mn(s),a=n.hasConversation(),c=gn(s),{visibilityCallback:l=bn,layoutMode:u}=c,{unreadEvents:d}=Wn(s),p=l({hasResponded:i,previousVisibility:o,requestedVisibility:e,config:c});if(p&&!ir.includes(p))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),null;if(o===p)return null;const h=n.store.get(yn);return n.store.set(yn,{...h||{},[u]:e}),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:i,unreadMessageCount:d}),p})),cr=Xt("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:s}=gn(n()),o=r.store.get(yn)?.[s]||vn.initialize;return t(ar(o)),o})),lr=Xt("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{let s=n?.context?.contentLocale,o=n?.context?.userLocale;const i=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=await t.getConversationIntitialState();return s=e.context?.contentLocale||s,o=e.context?.userLocale||o,t.sendContext({...e.context,environment:i}),{initialState:e,contentLocale:s,userLocale:o,config:n}}return n?.context?.topic&&t.send("action",{type:U,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext({...n.context,environment:i}),{initialState:void 0,contentLocale:s,userLocale:o,config:n}}catch(e){if(e instanceof l){const e=new l;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new pn;return r({name:t.name,message:t.message,langKey:t.langKey})}})),ur=((e,t,n)=>{const{wait:r=300,maxWait:s=0,leading:o=!1}=n??{};let i,a=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,i&&(i(!0),i=void 0)};return Xt(e,t,{condition:()=>{const e=o&&!a;return a&&clearTimeout(a),a=setTimeout((()=>{l(),a=null}),r),!!e||(i&&(i(!1),i=void 0),s&&!c&&(c=setTimeout(l,s)),new Promise((e=>{i=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(fn()),await t(hn()),await t(lr()),t(cr())}),{wait:2e3,leading:!0}),dr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],pr=(e,t)=>{const{messages:n,...r}=(s=t,dr.reduce(((e,t)=>(t in s&&(e[t]=s[t]),e)),{}));var s;let o=e;return Object.keys(r).length>0&&(o={...o,...r}),n&&(o={...o,messages:{...o.messages,...n}}),o},hr=nn({name:"config",initialState:{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}},api:{domain:"",key:"",secure:!0,sendEnvironment:!0},context:{},notificationAudioURL:void 0,hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showSuggestions:!0,preChat:{enterDelay:1e3,exitAfter:4e3},continueChat:{enterDelay:0,exitAfter:2e3},customComponents:{},defaults:{visible:null},preChatEvents:[],parentElement:void 0,layoutMode:"window"},reducers:{setConfig:(e,{payload:t})=>pr(e,t),updateConfig:(e,{payload:t})=>pr(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(fn.fulfilled,(e=>e)).addCase(hn.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:s,defaultUserLocale:o,defaultContentLocale:i}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.userLocale=o,e.context.contentLocale=i,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=s}))}}),{setConfig:fr,updateConfig:mr,setPreChatEvents:yr}=hr.actions,vr=hr.reducer,gr={userHasResponded:!1},br=nn({name:"app",initialState:gr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>gr)).addCase(lr.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:xr}=br.actions,wr=br.reducer;class _r extends i{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const Cr={SeamlyGeneralError:c,SeamlyConfigurationError:a,SeamlySessionExpiredError:l,SeamlyOfflineError:_r,SeamlyUnauthorizedError:u,SeamlyUnavailableError:pn},Er=Lt("catch-error",(e=>({payload:e}))),Sr={controls:{}},jr={touched:!1},Tr={controls:jr},kr=nn({name:"forms",initialState:Tr,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...Sr,persistData:t}:{...Sr,persistData:t};e[n]=r},deregisterForm:(e,{payload:{formId:t}})=>(e[t]?.persistData||delete e[t],e),registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:jr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const s={...r.controls};return delete s[t],{...e,[n]:{...r,controls:s}}},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{e[t]?.controls&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{e[t]?.controls[n]&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(ur.pending,(()=>Tr))}}),{registerForm:Nr,deregisterForm:Ar,registerControl:Rr,deregisterControl:Ir,updateControlValue:Or,updateControlTouched:Lr}=kr.actions,Mr=kr.reducer,Pr=Xt("setLocale",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return{translations:await t.getTranslations(e),userLocale:e}}catch(e){return n(e)}}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),Dr={translations:{"errors.configError.message":"We are sorry this happened, please retry at a later time.","errors.configError.srText":"A chat configuration error occurred. Our apologies, please retry at a later time.","errors.configError.title":"Chat configuration error.","errors.general.buttonText":"Restart chat","errors.general.message":"Do you want to start a new chat session?","errors.general.srText":"Something went wrong with the chat session. You can restart the chat.","errors.general.title":"Something went wrong","errors.seamlyOffline.message":"There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.","errors.seamlyOffline.srText":"The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.","errors.seamlyOffline.title":"Connection issues","errors.seamlyUnavailable.buttonText":"Try again","errors.seamlyUnavailable.message":"The server could not be reached. Try again in a little while.","errors.seamlyUnavailable.srText":"The chat server could not be reached. Try again in a little while.","errors.seamlyUnavailable.title":"Server unavailable"},isLoading:!1,initialLocale:void 0,userLocale:void 0},Ur=nn({name:"app",initialState:Dr,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Dr)).addCase(hn.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(Pr.pending,(e=>{e.isLoading=!0})).addCase(Pr.rejected,(e=>{e.isLoading=!1})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t?.translations&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>{if(!t.translations)return e;const r=t.translations[n];return e[n]=r,e}),{}))}))}}),{setInitialLocale:Fr,setTranslations:Br}=Ur.actions,zr=Ur.reducer,$r=Xt("getConversation",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return t.getConversation()}catch(e){return n({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError})}}),{condition(e,{getState:t}){const{state:{events:n}}=t(),r=n[n.length-1],s=e?.lastEvent?.id;return r&&s!==r.payload.id}}),Hr={error:void 0},Vr=nn({name:"interrupt",initialState:Hr,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>Hr},extraReducers:e=>{e.addCase(hn.pending,(()=>Hr)).addMatcher(Wt(lr.rejected,hn.rejected,Pr.rejected,ar.rejected,cr.rejected,$r.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Wr,clearInterrupt:qr}=Vr.actions,Gr=Vr.reducer,Kr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],Jr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===T.message&&!t.fromClient||e===T.info&&t.type===k,Xr=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),Yr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:s,name:o,introduction:i}=t.participant,a=n[r],c={...n,[r]:a?{...a,...s?{avatar:s}:{},...o?{name:o}:{},...i?{introduction:i}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Zr=(e,t)=>{const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{},{blockAutoEntrySwitch:r}=e,s=t?.payload?.actions||{},o=t?.payload?.translatedActions||{};if(!n)return{...e,optionsOverride:{},actions:s,translatedActions:o};const{type:i,options:a}=n;let c=e.active;return r||i===e.userSelected||(c=i),{...e,active:c,optionsOverride:{...e.optionsOverride||{},...i?{[i]:a}:{}},actions:s,translatedActions:o}},Qr={events:[],isLastEventFromClient:!1,initialState:{userResponded:!1},unreadEvents:0,userHasResponded:!1,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1,remaining:void 0,wasStopped:void 0,count:void 0,timer:void 0},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:"",proactiveMessages:!1},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:m(),optionsButtonId:m(),headerCollapseButtonId:m(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:N,active:N,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{},actions:{},translatedActions:{}},seamlyContainerElement:null},es=nn({name:"store",initialState:Qr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,s=e.options.features.hasOwnProperty(q);let o={...e.options};if(s&&(n===T.message||n===T.participant)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;o={...o,features:{...o.features,uploads:{enabled:o.features.uploads?.enabled||!1,...o.features?.uploads||{},enabledFromEntry:e===A}}}}const i=Jr(t.payload);if(e.events.find((e=>e.payload.id===r.id)))return;const a=Zr(e.entryMeta,t.payload);e.entryMeta=s||a.active!==A?a:{...e.entryMeta},e.options=o,i&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?I:R)),t.payload.payload.key=m(),e.events.push(t.payload),r.fromClient&&(e.isLastEventFromClient=r.fromClient)},ackEvent:(e,{payload:{payload:t}})=>{if(!t.transactionId)return void console.warn("ACK received without transaction ID.");const n=e.events.find((e=>e.payload.transactionId===t.transactionId&&(!t.type||e.type===t.type))),{id:r,occurredAt:s}=t;n&&(n.payload.id=r,n.payload.occurredAt=s,e.events=Xr(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(e.payload.id&&-1!==t.indexOf(e.payload.id)&&(e.payload={...e.payload,..."service_data"!==e.type&&e.payload.messageStatus===R&&{messageStatus:I}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:s,serviceData:o,resumeConversationPrompt:i}})=>{const a=((e,t)=>{const n=e.filter((e=>"message"===e.type&&!e.payload.optimisticallyInjected&&!t.some((t=>t.payload.id===e.payload.id)))),r=t.filter((e=>!("participant"===e.type&&!e.payload.participant?.introduction))).reverse();return Xr([...r,...n])})(e.events,t),c={...e.participantInfo.participants,...n},l=a.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let u=null;l&&("message"===l.type&&(u=l.payload.participant),"participant"===l.type&&(u=l.payload.participant?.id));const{entry:d}=s,p=d?.options?.upload,h=Zr({...e.entryMeta,...d,active:d?.default||k,options:{...d?.options?d.options:{}}},a[a.length-1]);let f={...e.options.features};const m=f.hasOwnProperty(q);if(m&&"message"===l?.type){const{payload:e}=l,t=e?.entry?.type||{};f={...f,uploads:{enabled:!(!p||!p?.enabled),enabledFromEntry:t===A}}}e.unreadEvents=a.filter((e=>"message"===e.type&&e.payload.messageStatus===R)).length,e.events=a.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...u?Yr(e.participantInfo,{participant:c[u]}):{},participants:c},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,activeServiceSessionId:r,proactiveMessages:s?.proactiveMessages?.enabled||!1},e.serviceData={...e.serviceData,...o},e.options={...e.options,features:f},e.entryMeta=m||h.active!==A?h:{...e.entryMeta},e.resumeConversationPrompt=i||!1,u&&(e.headerTitles.subTitle=c[u].name)},resetHistoryLoadedFlag:e=>{e.historyLoaded=!1},setIsLoading:(e,{payload:t})=>{e.isLoading=t},initIdleDetachCountdown:(e,{payload:t})=>{const{delaySeconds:n,delayTime:r}=t;e.idleDetachCountdown={hasCountdown:!0,isActive:!0,wasStopped:!1,count:n,remaining:n,timer:r}},decrementIdleDetachCountdownCounter:e=>{const{idleDetachCountdown:t}=e,{remaining:n=0}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=b(r)},stopIdleDetachCountdownCounter:e=>{e.idleDetachCountdown.isActive=!1,e.idleDetachCountdown.wasStopped=!0},clearIdleDetachCountdown:e=>{e.idleDetachCountdown.hasCountdown=!1,e.idleDetachCountdown.isActive=!1},initResumeConversationPrompt:e=>{e.resumeConversationPrompt=!0},clearResumeConversationPrompt:e=>{e.resumeConversationPrompt=!1},setParticipant:(e,{payload:t})=>{e.participantInfo=Yr(e.participantInfo,{participant:t.participant,fromClient:t.fromClient})},setActiveService:(e,{payload:t})=>{e.serviceInfo.activeServiceSessionId!==t&&(e.serviceInfo.activeServiceSessionId=t)},setHeaderTitle:(e,{payload:t})=>{e.headerTitles.title=t},setHeaderSubTitle:(e,{payload:t})=>{e.headerTitles.subTitle=t},setInitialState:(e,{payload:t})=>{e.initialState=t,e.unreadEvents=Qr.unreadEvents},setServiceDataItem:(e,{payload:t})=>{e.serviceData[t.type]=t},setFeatures:(e,{payload:t})=>{t.features&&(e.options.features=t.features)},setFeatureEnabledState:(e,{payload:t})=>{e.options.features.hasOwnProperty(t.key)&&(e.options.features[t.key].enabled=t.enabled)},clearFeatures:e=>{e.options.features={webNotifications:e.options.features.webNotifications}},showOption:(e,{payload:t})=>{e.options.panelActive=!0,e.options.optionActive=t},hideOption:e=>{e.options.panelActive=!1,e.options.optionActive=""},setUserSelectedOptions:(e,{payload:t})=>{e.options.userSelectedOptions=t},setUserSelectedOption:(e,{payload:t})=>{const{option:n,value:r}=t;e.options.userSelectedOptions[n]=r},setBlockAutoEntrySwitch:(e,{payload:t})=>{e.entryMeta.blockAutoEntrySwitch=t},setServiceEntryMetadata:(e,{payload:t})=>{e.entryMeta.active=t.default,e.entryMeta.options=t.options||{},e.entryMeta.optionsOverride={},e.entryMeta.actions={},e.entryMeta.translatedActions={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},clearAbortTransaction:e=>{e.entryMeta.actions={},e.entryMeta.translatedActions={}},registerUpload:(e,{payload:t})=>{e.currentUploads.push({id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle})},setUploadProgress:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}:e))},startProcessingImage:(e,{payload:t})=>{e.processingFileUploads.push(t)},doneProcessingImage:(e,{payload:t})=>{e.processingFileUploads=e.processingFileUploads.filter((e=>e!==t))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,error:t.errorText,progress:0,uploading:!1,uploadHandle:null}:e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?{...e,complete:!0}:e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t},setProactiveMessages:(e,{payload:t})=>{e.serviceInfo.proactiveMessages=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Qr)).addCase(lr.pending,(e=>{e.isLoading=!0})).addCase(hn.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name,t.features&&(e.options.features=t.features)})).addCase(lr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Wt(us,ds),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:ts,addEvent:ns,clearAllUploads:rs,clearEvents:ss,clearFeatures:os,clearIdleDetachCountdown:is,clearResumeConversationPrompt:as,decrementIdleDetachCountdownCounter:cs,hideOption:ls,initIdleDetachCountdown:us,initResumeConversationPrompt:ds,registerUpload:ps,resetHistoryLoadedFlag:hs,setActiveEntryType:fs,setActiveService:ms,setBlockAutoEntrySwitch:ys,setEventsRead:vs,setFeatureEnabledState:gs,setFeatures:bs,setHeaderSubTitle:xs,setHeaderTitle:ws,setHistory:_s,setInitialState:Cs,setIsLoading:Es,setLoadedImageEventIds:Ss,setParticipant:js,setSeamlyContainerElement:Ts,setServiceDataItem:ks,setServiceEntryMetadata:Ns,clearAbortTransaction:As,setUploadComplete:Rs,setUploadError:Is,setUploadProgress:Os,startProcessingImage:Ls,doneProcessingImage:Ms,setUserEntryType:Ps,setUserSelectedOption:Ds,setUserSelectedOptions:Us,showOption:Fs,stopIdleDetachCountdownCounter:Bs,setProactiveMessages:zs}=es.actions,$s=es.reducer,Hs={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Vt(),translatedEventGroups:{},translationProposal:null},Vs=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},s,o)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return o.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,s]]=Object.entries(n);return{lastGroupId:e.filter((e=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:s}},Ws=nn({name:"translation",initialState:Hs,reducers:{enableTranslation:(e,{payload:t})=>{e.isActive=!0,e.currentLocale=t},disableTranslation:e=>{e.isActive=!1,e.currentLocale=void 0},enableEventsTranslation:(e,{payload:{events:t,id:n}})=>{delete e.translatedEventGroups[n];const{lastGroupId:r}=Vs(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:s,eventIds:o}=Vs(t,n);e.lastGroupId=r,e.translatedEventGroups[s]=o},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Hs)).addCase(hn.fulfilled,((e,{payload:t})=>{const n=t?.features?.translation;n?.languages&&(e.isAvailable=!0===n.enabled,e.languages=[...n.languages].sort(((e,n)=>e.locale===t.defaultUserLocale?-1:n.locale===t.defaultUserLocale?1:e.nativeName?.localeCompare(n.nativeName||"",void 0,{sensitivity:"base"})||0)))})).addCase(_s,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(ns,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:qs,disableTranslation:Gs,enableEventsTranslation:Ks,disableEventsTranslation:Js,setTranslationProposalPrompt:Xs,disableTranslationProposalPrompt:Ys}=Ws.actions,Zs=Ws.reducer,Qs=({dispatch:e})=>t=>n=>{const r=t(n);if(_s.match(n)&&n.payload?.translation?.enabled)return e(qs(n.payload.translation.locale)),e(Pr(n.payload.translation.locale)),r;if(hn.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(Pr(n.payload.defaultUserLocale)),r;if(lr.fulfilled.match(n))return n.payload.userLocale&&e(Pr(n.payload.userLocale)),r;if(ns.match(n)&&"info"===n.payload.type&&n.payload.payload.body&&"subtype"in n.payload.payload.body&&"new_translation"===n.payload.payload.body.subtype){const{body:t}=n.payload.payload;if(t.translationLocale&&t.translationEnabled)return e(Pr(t.translationLocale)),r}return r},eo=nn({name:"visibility",initialState:{visibility:vn.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(ar.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(hn.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:to}=eo.actions,no=Tt({state:$s,app:wr,config:vr,i18n:zr,translations:Zs,visibility:eo.reducer,forms:Mr,interrupt:Gr});function ro({initialState:e,api:t,eventBus:n,config:r}){const s=function(e){const t=Ut(),{reducer:n,middleware:r,devTools:s=!0,preloadedState:o,enhancers:i}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!St(n))throw new Error(dn(1));a=Tt(n)}if(!$t&&r&&"function"!=typeof r)throw new Error(dn(2));if("function"==typeof r){if(c=r(t),!$t&&!Array.isArray(c))throw new Error(dn(3))}else c=t();if(!$t&&c.some((e=>"function"!=typeof e)))throw new Error(dn(4));let l=kt;s&&(l=It({trace:!$t,..."object"==typeof s&&s}));const u=function(...e){return t=>(n,r)=>{const s=t(n,r);let o=()=>{throw new Error(wt(15))};const i={getState:s.getState,dispatch:(e,...t)=>o(e,...t)},a=e.map((e=>e(i)));return o=kt(...a)(s.dispatch),{...s,dispatch:o}}}(...c),d=zt(u);if(!$t&&i&&"function"!=typeof i)throw new Error(dn(5));let p="function"==typeof i?i(d):d();if(!$t&&!Array.isArray(p))throw new Error(dn(6));if(!$t&&p.some((e=>"function"!=typeof e)))throw new Error(dn(7));return $t||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),jt(a,o,l(...p))}({reducer:no,preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat(function({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:s,api:o,layoutMode:a}=gn(t()),{error:c,type:l}=n,u=Cr[c?.name]?new Cr[c.name](c):new i(c);r?.(u,{namespace:s,api:o,layoutMode:a,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{try{return t.payload?.originalEvent?.payload?n({error:t.payload,type:t.payload?.originalEvent?.payload?.type}):t.payload?.originalError&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}({api:t}),function({api:e}){return()=>t=>n=>{const{payload:r,type:s}=n;if(s===Wr.type){if(!Kr.includes(r.name))throw new c(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}({api:t}),function({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case Us.toString():e.store.set("options",n.payload);break;case Ds.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Qs)});return s}const so=$n;var oo=n(1162);function io(e=""){const t=e=>/\s/.test(e),n=[],r={};let s=0,o=null,i=!1,a=0;for(;a<e.length;){if(i&&(t(e[a])||"{"===e[a]))i=!1,o=e.slice(s,a),"{"===e[a]&&a--;else if(!i&&!t(e[a])){const t="{"===e[a];if(o&&t){const t=ao(e,a);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[o]=e.slice(a+1,t),a=t,o=null}else o&&(n.push(o),o=null),i=!0,s=a}a++}return i&&(o=e.slice(s)),o&&n.push(o),{args:n,cases:r}}function ao(e,t){let n=0;for(let r=t+1;r<e.length;r++){let t=e.charAt(r);if("}"===t){if(0===n)return r;n--}else"{"===t&&n++}return-1}function co(e){return lo(e.slice(1,-1),",",3)}function lo(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let s=e.indexOf(t);if(-1===s)return r.push(e),r;let o=e.substring(0,s).trim(),i=e.substring(s+t.length+1).trim();return r.push(o),lo(i,t,n-1,r)}let uo,po=0;const ho="other";function fo(e,t){let n=0,r="",s=0;const o={};for(;n<e.length;){if("#"!==e[n]||s)r+=e[n];else{let e="__hashToken"+po++;r+=`{${e}, number}`,o[e]=t}"{"===e[n]?s++:"}"===e[n]&&s--,n++}return{caseBody:r,numberValues:o}}const mo="other",yo=bt((({i18n:e})=>e),(({translations:e})=>e)),vo=bt((({i18n:e})=>e),(({initialLocale:e})=>e)),go=bt((({i18n:e})=>e),(({userLocale:e})=>e)),bo=bt((({i18n:e})=>e),(({isLoading:e})=>e)),xo=new class{constructor(e,t={}){this.locale=e,this.typeHandlers=t}format=function(e){const t={};return function(...n){let r=n.length?n.map((e=>null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e))).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,r))return t[r];let s=e(...n);return t[r]=s,s}}(((e,t={})=>this.process(e,t).flat(1/0).join("")));process(e,t={}){if(!e)return[];let n=e.indexOf("{");if(-1!==n){let r=ao(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let s=e.substring(n,r+1);if(s){let o=[],i=e.substring(0,n);i&&o.push(i);let[a,c,l]=co(s),u=t[a];null==u&&(u="");let d=c&&this.typeHandlers[c];o.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&o.push(this.process(p,t)),o}}}return[e]}}("en-GB",{plural:function(e,t,n,r,s){const{args:o,cases:i}=io(t);let a=parseInt(e);o.forEach((e=>{e.startsWith("offset:")&&(a-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==uo&&uo.resolvedOptions().locale===n||(uo=new Intl.PluralRules(n));const e=uo.select(a);e!==ho&&c.push(e)}1===a&&c.push("one"),c.push(`=${a}`,ho);for(let e=0;e<c.length;e++){const t=c[e];if(t in i){const{caseBody:e,numberValues:n}=fo(i[t],a);return s(e,{...r,...n})}}return e},select:function(e,t,n,r,s){const{cases:o}=io(t);return e in o?s(o[e],r):mo in o?s(o[mo],r):e}});function wo(){const e=In(yo),t=In(go),n=In(vo),r=In(bo);return{t:(0,oo.useCallback)(((n,s={})=>{if(!e)return"";const o=e[n];return o?xo.format(o,s):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const _o=()=>{const e=so(),t=In(sr),n=!!t&&t!==vn.hidden,r=t===vn.open,s=t===vn.minimized,o=(0,oo.useCallback)((t=>e(ar(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:s,visible:t,setVisibility:o,openChat:()=>{o(vn.open)},closeChat:()=>{o(vn.minimized)}}},Co=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,s.createRef)()})=>{const[r,o]=(0,oo.useState)(null),i=!!r?.isIntersecting||!t,a=i&&e,c=([e])=>o(e);return(0,oo.useEffect)((()=>{const e=n?.current;if(!window.IntersectionObserver||a||!e||!t)return()=>{};const r=new IntersectionObserver(c,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,a]),{isVisible:i,containerRef:n}},Eo=()=>In(mn),So=(0,s.createContext)(null),jo=(0,s.createContext)(null),To=(0,s.createContext)(null),ko=()=>{const e=(0,oo.useContext)(jo);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},No=()=>{const e=(0,oo.useContext)(So);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},Ao=()=>No().store,Ro=()=>{const e=No();return(0,oo.useCallback)((()=>e.hasConversation()),[e])},Io=()=>{const e=No(),t=so(),n=ko(),r=Eo(),s=Ro(),{visible:o,setVisibility:i}=_o(),a=Yn(),c=(0,oo.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,oo.useCallback)((()=>{c("ui.beforeStart",{visibility:o,hasConversation:s(),hasResponded:r,unreadMessageCount:a}),e.send("start"),c("ui.start",{visibility:o,hasConversation:s(),hasResponded:r,unreadMessageCount:a})}),[e,c,s,r,a,o]),u=(0,oo.useCallback)((async()=>{await t(ur())}),[t]),d=(0,oo.useCallback)((e=>({type:e,id:m(),transactionId:m(),participant:p,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,oo.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,oo.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const s={...h(n),...r};e.send("message",s),c("message",s),t(ns({type:"message",payload:{...s,optimisticallyInjected:!0}}))}),[e,t,c,h]),y=(0,oo.useCallback)(((e,n=m())=>{t(ns({type:"message",payload:{...h(e),transactionId:n}}))}),[t,h]),v=(0,oo.useCallback)(((e,n,r,s,o,i,a)=>{t(ns({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:p,fromClient:!0,occurredAt:r,body:{contentType:s,filename:o,filesize:i,url:a}}}))}),[t]),g=(0,oo.useCallback)(((e,n=m())=>{t(ns({type:"info",payload:{body:{subtype:e},fromClient:!1,fromHistory:!0,id:m(),transactionId:n,type:"divider"}}))}),[t]),b=(0,oo.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==L&&n!==M&&c(`action.${n}`,t)}),[e,c]),x=(0,oo.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,oo.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(Cs(e)),e.userResponded&&(t(xr(e.userResponded)),i(vn.open)))})).catch((e=>{t(Wr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,i]);return{connect:w,start:l,sendMessage:f,sendAction:b,sendContext:x,reset:u,emitEvent:c,addMessageBubble:y,addUploadBubble:v,addDivider:g,apiConnected:e.connected,apiConfigReady:e.configReady}},Oo=()=>{const e=(()=>{const e=(0,oo.useContext)(To);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,oo.useCallback)((t=>{t&&e({ariaLive:V,messageText:t})}),[e]),sendAssertive:(0,oo.useCallback)((t=>{t&&e({ariaLive:H,messageText:t})}),[e])}},Lo=bt((({interrupt:e})=>e),(({error:e})=>e)),Mo=bt(Lo,(e=>Boolean(e)));function Po(){const{t:e}=wo(),t=In(Lo);return{hasError:In(Mo),meta:(0,oo.useMemo)((()=>{if(!t)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0,action:void 0};const{langKey:n,action:r}=t,s=e(`${n}.title`),o=e(`${n}.message`),i=e(`${n}.srText`),a=r?e(`${n}.buttonText`):null;return{...n?{title:s,message:o,srText:i}:{},...r?{action:r}:{},...r&&n?{buttonText:a}:{},originalError:t}}),[t,e]),error:t}}const Do=()=>{const{t:e}=wo(),{isInline:t,isWindow:n,isApp:r}=rr(),{isOpen:s,isVisible:o}=_o(),i=In(or),{start:a,connect:l,apiConfigReady:u,apiConnected:d}=Io(),p=(0,oo.useRef)(!1),{sendAssertive:h}=Oo();!function(){const{meta:{originalError:e,action:t}}=Po(),n=so(),{reset:r}=Io(),s="SeamlySessionExpiredError"===e?.name,o=(0,oo.useRef)(0),i=(0,oo.useRef)(null);(0,oo.useEffect)((()=>{if(s&&"reset"===t){if(o.current>=10){i.current=setTimeout((()=>{o.current=0}),1e4);const e=new c;return n(Wr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}o.current+=1,r()}return()=>{i.current&&clearTimeout(i.current)}}),[t,r,s,n])}(),(0,oo.useEffect)((()=>{o&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[o,h,e]),(0,oo.useEffect)((()=>{o&&h(e(s?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[s,o,h,e]),(0,oo.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,oo.useCallback)((async()=>{d||(p.current=!0,await l()),(r||s||o&&t)&&a()}),[d,l,r,t,s,o,a]);(0,oo.useEffect)((()=>{!u||p.current||n&&!s||!(!t||o&&i)||f()}),[u,f,t,s,o,n,i])},Uo=require("preact/compat"),Fo=require("preact/jsx-runtime"),Bo=({children:e})=>(Do(),(0,Fo.jsx)(Fo.Fragment,{children:e})),zo=(0,s.createContext)(null),$o=(e=0)=>new Promise((t=>{setTimeout(t,e)})),Ho=()=>{const{seamlyContainerElement:e}=qn(),t=so();return[e,(0,oo.useCallback)((e=>{t(Ts(e))}),[t])]},Vo=e=>(0,oo.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await $o(180);const e="string"==typeof t?document.getElementById(t):t;E(e)}))}),[e]),Wo=()=>{const e=Zn();return Vo(e)},qo=e=>bt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function Go(){const{sendContext:e}=Io(),t=so(),n=Hn(),r=(0,oo.useCallback)(((t,n)=>{e({userLocale:t,source:n})}),[e]),s=(0,oo.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(Gs())}),[n.context?.contentLocale,t,e]),{languages:o,isActive:i,isAvailable:a,currentLocale:c}=In((({translations:e})=>e));return{languages:o,isActive:i,isAvailable:a,currentLocale:c,enableTranslations:r,disableTranslations:s}}const Ko=e=>{const t=In(qo(e));if(!e?.payload)return{body:void 0,hasTranslation:!1,isTranslated:!1,locale:""};const n=e.payload?.translatedBody&&"data"in e.payload.translatedBody?e.payload?.translatedBody.data:e.payload.translatedBody,{translation:r,body:s}={body:e.payload?.body,translation:e.payload?.translation},o=!!n;return{body:t&&o?n:s,hasTranslation:o,isTranslated:t&&o,locale:r?.locale}};function Jo(){const e=In((({translations:e})=>e.containerId));return{id:e,focusContainer:Vo(e)}}function Xo(e){const{languages:t}=Go();return(0,oo.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const Yo=()=>{const{isActive:e,languages:t}=Go(),n=so(),{sendAction:r}=Io(),{translationProposal:s}=In((e=>e.translations)),{enableTranslations:o}=Go(),{isOpen:i}=_o(),{userLocale:a}=wo(),c=s?.proposedLocale,l=Xo(c),u=(0,oo.useMemo)((()=>null!==s&&!e&&i&&a!==c&&t.some((e=>e.locale===c))),[s,e,i,a,c,t]);return{activateTranslationProposal:()=>{o(s?.proposedLocale,z)},dismissTranslationProposal:()=>{r({type:D,body:{type:B}}),n(Ys())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:s}},Zo=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e?.split(" "))).flat().filter((e=>e&&e.length)).map((e=>e&&e.indexOf(d)>-1?e:[d,e].join("-"))).join(" "),Qo=()=>Hn().appContainerClassNames,ei=e=>{const{fromClient:t}=e.payload,n=["message"];return"info"===e.type?n.push("message--source-info"):t?n.push("message--source-user"):n.push("message--source-agent"),n},ti=()=>{const e=No();return(0,Uo.useSyncExternalStore)(ve.subscribe,(()=>e.conversation))},ni=(0,s.createContext)(null),ri=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=qn(),{allowedMimeTypes:s,maxSize:o}=n.upload||{},{enabled:i,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...s?{allowedMimeTypes:s}:{},...o?{maxSize:o}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||i,allowedMimeTypes:c,maxSize:l}},si=()=>{const{currentUploads:e}=qn(),t=so(),n=(()=>{const e=(0,oo.useContext)(ni);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,oo.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,oo.useCallback)((()=>{t(rs())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},oi=()=>{const{t:e}=wo(),{options:t}=qn(),{panelActive:n,optionActive:r,userSelectedOptions:s,features:o}=t,{extraMenuItem:i,sendTranscript:a}=o,c={extraMenuItem:i,sendTranscript:a},l=t=>"extraMenuItem"===t?"Extra menu item":e(`options.${t}.menuTitle`),u=Object.keys(c).filter((e=>c[e])).map((e=>({name:e,title:l(e),available:c[e].enabled}))),d=i||a,p=so(),{get:h,set:f}=Ao();return{allowOptionSelection:d,userSelectedOptions:s,features:o,menuOptions:u,initUserSelectedOptions:(0,oo.useCallback)((()=>{const e=h("options")||{};p(Us(e))}),[h,p]),setUserSelectedOptions:(0,oo.useCallback)((e=>{p(Us(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,oo.useCallback)(((e,t)=>{const n=h("options")||{};"object"==typeof n&&f("options",{...n,[e]:t}),p(Ds({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(Fs(e))},hideOption:()=>{p(ls())},panelActive:n,optionActive:r}},ii=()=>{const{optionsButtonId:e}=qn();return{id:e,focusButton:Vo(e)}},ai=(0,s.createContext)(null),ci=()=>{const e=(0,oo.useContext)(ai);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},li=()=>{const e=so(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:s,timer:o,wasStopped:i}}=qn(),{isOpen:a}=_o(),{emitEvent:c,sendAction:l}=Io(),{t:u}=wo(),{sendAssertive:d,sendPolite:p}=Oo(),h=(0,oo.useCallback)((e=>{a&&d(e)}),[a,d]),f=(0,oo.useCallback)((e=>{a&&p(e)}),[a,p]),m=(0,oo.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=b(n);e(us({delaySeconds:n,delayTime:r})),c("idleTimer.start"),h(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,h,u]),y=(0,oo.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:P}),h(u("idleDetachWarning.notifyTransferText"))),i||c("idleTimer.stop"),e(is()))}),[e,c,t,l,h,u,i]),v=(0,oo.useCallback)((()=>{if(!s||s<=0)return;const t=s-1;t%10==0&&h(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",b(t))}`),e(cs())}),[e,s,h,u]),g=(0,oo.useCallback)((()=>{n&&(e(Bs()),s&&(c("idleTimer.stop"),f(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,s,f,u]);return{hasCountdown:t,isActive:n,count:r,remaining:s,timer:o,wasStopped:i,initCountdown:m,endCountdown:y,decrementCountdown:v,stopCountdown:g}},ui=()=>{const e=so(),t=qn().resumeConversationPrompt,{sendAction:n}=Io(),{t:r}=wo(),{sendAssertive:s}=Oo();return{continueChat:()=>{n({type:D,body:{type:"resume_conversation_prompt"}}),e(as())},hasPrompt:t,restartChat:()=>{s(r("resumeConversationPrompt.srNotifyRestartText")),n({type:P}),e(as())}}},di=()=>{const[e]=(0,oo.useState)((()=>m()));return e},pi=(e,t)=>{const n=ti();(0,oo.useEffect)((()=>{if(n.channel){const{channel:r}=n;r.onMessage=(n,r)=>(t&&!t({type:n,payload:r})||e({type:n,payload:r}),r)}}),[e,t,n])},hi=({eventPayload:e})=>{const{t}=wo(),{fromClient:n,participant:r}=e,s=(e=>qn().participantInfo.participants[e])(r)||{},{messages:o}=Hn(),i=n?t("participants.user.name"):s&&s.name,{showAvatar:a,showName:c}=o&&o[n?"user":"agent"]||{};if(!a&&!c)return null;const l=[];return a&&i&&s.avatar&&l.push((0,Fo.jsx)("span",{className:Zo("message__avatar"),children:(0,Fo.jsx)("img",{src:s.avatar,className:Zo("avatar"),alt:""})})),c&&i&&l.push((0,Fo.jsx)("span",{className:Zo("message__author-name"),children:i})),l.length>0?(0,Fo.jsx)("div",{className:Zo("message__author"),children:l}):null},fi=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:s,bodyProps:o={},info:i,...a})=>{const c=ei(t),{hasTranslation:l,isTranslated:u,locale:d}=Ko(t);return n&&c.push(`message--type-${n}`),r&&("string"==typeof r&&(r=r.split(" ").filter((e=>e.length))),r.forEach((e=>{c.push(`message--${e}`)}))),u&&c.push("message--is-translated"),l&&c.push("message--has-translation"),u&&(o={...o,lang:d}),(0,Fo.jsx)(Fo.Fragment,{children:(0,Fo.jsxs)("div",{className:Zo(c),...a,children:[e&&(0,Fo.jsx)(hi,{eventPayload:t.payload}),(0,Fo.jsx)("div",{className:Zo("message__body"),...o,children:s}),i&&(0,Fo.jsx)("div",{"aria-hidden":"true",className:Zo("message__info"),children:i})]})})},mi=({id:e,action:t,buttonText:n,description:r,hasFocus:s,image:o,title:i,isCarouselItem:a})=>{const c=(0,oo.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=Io(),p=di(),h=(0,oo.useRef)(!1),f=t?.type===G?"a":"button",m=(0,oo.useCallback)((()=>d("action.click_card",{type:F,originMessage:e,action:t})),[d,e,t]),y=(0,oo.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:U,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),v=(0,oo.useMemo)((()=>t?.type===G?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,oo.useEffect)((()=>{a&&(s&&h.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),h.current=!0}),[s,a]),(0,Fo.jsxs)("div",{className:Zo("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[o?(0,Fo.jsx)("img",{className:Zo("card__image"),src:o,alt:""}):null,(0,Fo.jsxs)("div",{className:Zo("card__content"),id:e,children:[i&&(0,Fo.jsx)("h2",{className:Zo("card__title"),children:i}),r&&(0,Fo.jsx)("div",{className:Zo("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,Fo.jsx)(f,{tabIndex:a&&!s?-1:void 0,className:Zo("button","button--primary"),"aria-describedby":p,...v,children:n})]})]})};function yi({item:e,items:t,index:n,isActive:r}){const{t:s}=wo();return(0,Fo.jsx)("div",{className:Zo("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":s("carousel.slide.label",{index:n+1,total:t.length}),children:(0,Fo.jsx)(mi,{...e,isCarouselItem:!0,hasFocus:r})})}const vi={send:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>'},balloon:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>'},newTopic:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>'},newTranslation:{16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>'},avatar:{32:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">\n<path fill="#4A48C1" d="M10,14.8c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S11.1,14.8,10,14.8z M15.9,14.8c1.1,0,2-0.9,2-2s-0.9-2-2-2\n\ts-2,0.9-2,2S14.8,14.8,15.9,14.8z M21.8,10.8c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S22.9,10.8,21.8,10.8z M21.3,18.1H10.7\n\tC11.7,23.9,20.2,23.9,21.3,18.1z"/>\n</svg>\n'},chevronDown:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>'},chevronRight:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>'},close:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>'},enlarge:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>'},options:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>'},file:{32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>'},upload:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>'},download:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>'},error:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>'},arrowLeft:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n'},arrowRight:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},check:{16:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="16px"\n height="16px"\n x="0px"\n y="0px"\n viewBox="0 0 16 16"\n>\n <path\n fill="currentColor"\n d="M11.6,4.3l-5,5L4.9,7.5C4.4,7,3.7,7,3.2,7.5l0,0C2.8,8,2.8,8.7,3.2,9.2l1.7,1.7l0,0l0.8,0.8\n\tc0.5,0.5,1.2,0.5,1.7,0l0.8-0.8l5-5c0.5-0.5,0.5-1.2,0-1.7l0,0C12.8,3.8,12.1,3.8,11.6,4.3z"\n />\n</svg>\n',32:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="32px"\n height="32px"\n x="0px"\n y="0px"\n viewBox="0 0 32 32"\n>\n <path\n fill="currentColor"\n d="M22.9,9.3l-9.3,9.3l-3.2-3.2c-0.9-0.9-2.3-0.9-3.2,0l0,0c-0.9,0.9-0.9,2.3,0,3.2l3.2,3.2l0,0l1.6,1.6\n\tc0.9,0.9,2.3,0.9,3.2,0l1.6-1.6l9.3-9.3c0.9-0.9,0.9-2.3,0-3.2l0,0C25.2,8.4,23.7,8.4,22.9,9.3z"\n />\n</svg>\n'}},gi=({name:e,size:t="32",className:n,alt:r})=>(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("div",{"aria-hidden":"true",className:n||Zo("icon"),dangerouslySetInnerHTML:{__html:vi[e][t]}}),r&&(0,Fo.jsx)("span",{className:Zo("visually-hidden"),children:r})]});function bi({items:e,currentIndex:t,onChange:n,children:r}){const{t:s}=wo(),o=e.length;return(0,Fo.jsxs)("div",{className:Zo("carousel-controls"),children:[(0,Fo.jsx)("button",{className:Zo("button","button--previous"),"aria-label":s("carousel.controls.previous"),onClick:()=>{n((t-1+o)%o)},children:(0,Fo.jsx)(gi,{name:"arrowLeft",size:"16",alt:""})}),r,(0,Fo.jsx)("button",{className:Zo("button","button--next"),"aria-label":s("carousel.controls.next"),onClick:()=>{n((t+1)%o)},children:(0,Fo.jsx)(gi,{name:"arrowRight",size:"16",alt:""})})]})}function xi({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:s}){const o=e.length,i=(0,oo.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),s=Math.min(o-1,Math.max(0,r));s!==t&&n(s)}),[o,t,n]);return(0,Fo.jsx)("div",{className:Zo("carousel-pagination__wrapper"),role:"group",children:(0,Fo.jsx)("ul",{className:Zo("carousel-pagination"),children:e.map(((e,n)=>{const o=t===n;return(0,Fo.jsx)("li",{className:Zo("carousel-pagination__item",o?"is-active":void 0),children:(0,Fo.jsx)("button",{className:Zo("carousel-pagination__button"),type:"button",onClick:i,"data-item":n,"aria-disabled":o?"true":void 0,"aria-label":s(e,n)})},r(e,n,"pagination-item-"))}))})})}const wi=(e,t,n)=>`${n}${t}`,_i=e=>e.label,Ci=({target:e})=>{e.scrollLeft=0};function Ei({currentIndex:e=0,onChange:t=(()=>{}),getItemKey:n=wi,getItemLabel:r=_i,items:o}){const i=di(),a=o.length,[c,l]=(0,oo.useState)(Number(e||0));(0,oo.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,oo.useRef)([]);u.current=(0,oo.useMemo)((()=>Array(a).fill(1).map((()=>(0,s.createRef)()))),[a]);const d=(0,oo.useRef)(!0),p=(0,oo.useRef)(null);return p.current=t,(0,oo.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,Fo.jsxs)("div",{className:Zo("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,Fo.jsx)("div",{className:Zo("carousel__slides-wrapper"),onScroll:Ci,children:(0,Fo.jsx)("div",{id:i,className:Zo("carousel__slides"),style:{width:100*a+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:o.map(((e,t)=>{const r=c===t;return(0,Fo.jsx)("div",{ref:u.current[t],className:Zo("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,Fo.jsx)(yi,{item:e,items:o,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,Fo.jsx)("div",{className:Zo("carousel__controls"),children:(0,Fo.jsx)(bi,{currentIndex:c,items:o,onChange:l,children:(0,Fo.jsx)("div",{className:Zo("carousel__pagination"),children:(0,Fo.jsx)(xi,{currentIndex:c,items:o,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const Si=(e,t,n="")=>`${n}${e.title}:${t}`,ji=e=>e.title,Ti=e=>{const{payload:t}=e,[n,r]=(0,oo.useState)(!1),{sendAction:s,addMessageBubble:o,addDivider:i}=Io(),{activeServiceSessionId:a}=Qn(),c=In(er),{body:l}=Ko(e),{service:u}=t,d=(0,oo.useMemo)((()=>{if("choice_prompt"===e.payload.type)return{...e,payload:{...e.payload,body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&{...e.payload.translatedBody,data:e.payload.translatedBody?.prompt}}}}),[e]),p=l?.chooseAgain&&a===u?.serviceSessionId&&t.id!==c;return(0,oo.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:d,showOptions:n,chooseAgain:p,onChoiceClickHandler:e=>{const n=m();p&&i("new_topic",n),o(e.text,n),s({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:p},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}},ki=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Ni=({id:e,categories:t=[],question:n,onClick:r,hasIcon:s})=>{const o=(0,oo.useMemo)((()=>["suggestions__item",...t.map(ki)]),[t]),i=(0,oo.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,Fo.jsx)("li",{className:Zo(o),children:(0,Fo.jsxs)("button",{type:"button",onClick:i,className:Zo("button","button--primary"),children:[s&&(0,Fo.jsx)(gi,{name:"chevronRight",size:"8",alt:""}),n]})})},Ai=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,Fo.jsx)("ul",{className:Zo("suggestions__list",e||""),children:t.map((e=>(0,Fo.jsx)(Ni,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),Ri=e=>{const{sendAction:t}=Io();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}},Ii=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:s,iconSize:o,iconClassName:i,dividerType:a,title:c,description:l})=>{const u=Boolean(s||n);return(0,Fo.jsxs)("div",{className:Zo("divider",a&&`divider--type-${a}`,t),children:[u&&(0,Fo.jsx)("span",{className:Zo("divider__graphic"),children:s?(0,Fo.jsx)(gi,{name:s,size:o,className:i,alt:""}):(0,Fo.jsx)("img",{src:n,className:Zo({icon:"icon"===r,avatar:"avatar"===r},i)})}),(0,Fo.jsxs)("div",{className:Zo("divider__body"),children:[c?(0,Fo.jsx)("h2",{className:Zo("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,Fo.jsx)("p",{className:Zo("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},Oi={[W.new_topic]:"new-topic"},Li={default:({event:e})=>{const{t}=wo(),{subtype:n}=e.payload.body,r=Oi[W[n]];return W[n]?(0,Fo.jsx)(Ii,{dividerType:r,iconName:W[n],title:t(`dividerKeys.${W[n]}`)}):null},[W.new_translation]:({event:e})=>{const{t}=wo(),n=Jn(),{body:{translationEnabled:r,text:s,title:o},id:i}=e.payload,a=In((e=>e.translations.translatedEventGroups)),c=so(),l=(0,oo.useCallback)((()=>{a[i]?c(Ks({events:n,id:i})):c(Js({events:n,id:i}))}),[c,n,i,a]);return(0,Fo.jsx)(Ii,{iconName:"newTranslation",dividerType:"new-translation",title:o,description:s,children:r?(0,Fo.jsx)(Fo.Fragment,{children:(0,Fo.jsx)("button",{className:Zo("button","button--secondary"),onClick:l,children:t(a[i]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},Mi={month:"long",day:"numeric",year:"numeric"},Pi={hour:"numeric",minute:"numeric"},Di=({event:e})=>{const t=(()=>{const[e,t]=(0,oo.useReducer)((e=>e+1),0);return(0,oo.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:s,srText:o}=(e=>{const{t}=wo(),n=Hn(),r=n?.context?.userLocale??[],s=new Date(e),o=new Date,i=new Date(o);i.setHours(24,0,0,0);const a=i.valueOf()-o.valueOf(),c=s.toString(),l=new Intl.DateTimeFormat(r,Pi).format(s);let u=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),s=864e5;return r>=n+s?e:r>n?"today":r>n-s?"yesterday":e})(s,o);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,Mi).format(s)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:a}})(g(e.payload.timeIndicator));return(0,oo.useEffect)((()=>{const e=setTimeout((()=>{t()}),s);return()=>{clearTimeout(e)}}),[t,s]),(0,Fo.jsxs)(Ii,{dividerType:"time-indicator",children:[(0,Fo.jsxs)("h2",{className:Zo("divider__time"),"aria-hidden":"true",children:[(0,Fo.jsx)("span",{className:Zo("divider__time--date"),children:n}),(0,Fo.jsx)("span",{className:Zo("divider__time--time"),children:r})]}),(0,Fo.jsx)("p",{className:Zo("visually-hidden"),children:o})]})};var Ui=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Fi=Ui.join(","),Bi="undefined"==typeof Element,zi=Bi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,$i=!Bi&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Hi=function e(t,n){var r;void 0===n&&(n=!0);var s=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===s||"true"===s||n&&t&&e(t.parentNode)},Vi=function(e,t,n){if(Hi(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Fi));return t&&zi.call(e,Fi)&&r.unshift(e),r.filter(n)},Wi=function e(t,n,r){for(var s=[],o=Array.from(t);o.length;){var i=o.shift();if(!Hi(i,!1))if("SLOT"===i.tagName){var a=i.assignedElements(),c=e(a.length?a:i.children,!0,r);r.flatten?s.push.apply(s,c):s.push({scopeParent:i,candidates:c})}else{zi.call(i,Fi)&&r.filter(i)&&(n||!t.includes(i))&&s.push(i);var l=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),u=!Hi(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(l&&u){var d=e(!0===l?i.children:l.children,!0,r);r.flatten?s.push.apply(s,d):s.push({scopeParent:i,candidates:d})}else o.unshift.apply(o,i.children)}}return s},qi=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Gi=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!qi(e)?0:e.tabIndex},Ki=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ji=function(e){return"INPUT"===e.tagName},Xi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Yi=function(e,t){return!(t.disabled||Hi(t)||function(e){return Ji(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var s=zi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(zi.call(s,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Xi(e)}else{if("function"==typeof r){for(var o=e;e;){var i=e.parentElement,a=$i(e);if(i&&!i.shadowRoot&&!0===r(i))return Xi(e);e=e.assignedSlot?e.assignedSlot:i||a===e.ownerDocument?i:a.host}e=o}if(function(e){var t,n,r,s,o=e&&$i(e),i=null===(t=o)||void 0===t?void 0:t.host,a=!1;if(o&&o!==e)for(a=!!(null!==(n=i)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(i)||null!=e&&null!==(s=e.ownerDocument)&&void 0!==s&&s.contains(e));!a&&i;){var c,l,u;a=!(null===(l=i=null===(c=o=$i(i))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(i))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!zi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Zi=function(e,t){return!(function(e){return function(e){return Ji(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||$i(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var s=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!s||s===e}(e)}(t)||Gi(t)<0||!Yi(e,t))},Qi=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ea=function e(t){var n=[],r=[];return t.forEach((function(t,s){var o=!!t.scopeParent,i=o?t.scopeParent:t,a=function(e,t){var n=Gi(e);return n<0&&t&&!qi(e)?0:n}(i,o),c=o?e(t.candidates):i;0===a?o?n.push.apply(n,c):n.push(i):r.push({documentOrder:s,tabIndex:a,item:t,isScope:o,content:c})})),r.sort(Ki).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ta=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==zi.call(e,Fi)&&Zi(t,e)},na=Ui.concat("iframe").join(","),ra=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==zi.call(e,na)&&Yi(t,e)};function sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function oa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sa(Object(n),!0).forEach((function(t){var r,s,o;r=e,s=t,o=n[t],s=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(s),s in r?Object.defineProperty(r,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[s]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ia=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},aa=function(e){return ia(e)&&!e.shiftKey},ca=function(e){return ia(e)&&e.shiftKey},la=function(e){return setTimeout(e,0)},ua=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},da=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e.apply(void 0,n):e},pa=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},ha=[],fa=function(e,t){var n,r=(null==t?void 0:t.document)||document,s=(null==t?void 0:t.trapStack)||ha,o=oa({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:aa,isKeyBackward:ca},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},a=function(e,t,n){return e&&void 0!==e[t]?e[t]:o[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return i.containerGroups.findIndex((function(t){var r=t.container,s=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||s.find((function(t){return t===e}))}))},l=function(e){var t=o[e];if("function"==typeof t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];t=t.apply(void 0,s)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var a=t;if("string"==typeof t&&!(a=r.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return a},u=function(){var e=l("initialFocus");if(!1===e)return!1;if(void 0===e||!ra(e,o.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(i.containerGroups=i.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Wi([e],t.includeContainer,{filter:Zi.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Qi}):Vi(e,t.includeContainer,Zi.bind(null,t)),ea(n)}(e,o.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?Wi([e],t.includeContainer,{filter:Yi.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Vi(e,t.includeContainer,Yi.bind(null,t))}(e,o.tabbableOptions),r=t.length>0?t[0]:void 0,s=t.length>0?t[t.length-1]:void 0,i=n.find((function(e){return ta(e)})),a=n.slice().reverse().find((function(e){return ta(e)})),c=!!t.find((function(e){return Gi(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:s,firstDomTabbableNode:i,lastDomTabbableNode:a,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=t.indexOf(e);return s<0?r?n.slice(n.indexOf(e)+1).find((function(e){return ta(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return ta(e)})):t[s+(r?1:-1)]}}})),i.tabbableGroups=i.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),i.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find((function(e){return e.posTabIndexesFound}))&&i.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},h=function e(t){!1!==t&&t!==p(document)&&(t&&t.focus?(t.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(u()))},f=function(e){var t=l("setReturnFocus",e);return t||!1!==t&&e},m=function(e){var t=e.target,n=e.event,r=e.isBackward,s=void 0!==r&&r;t=t||pa(n),d();var a=null;if(i.tabbableGroups.length>0){var u=c(t,n),p=u>=0?i.containerGroups[u]:void 0;if(u<0)a=s?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(s){var h=ua(i.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||ra(t,o.tabbableOptions)&&!ta(t,o.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?i.tabbableGroups.length-1:h-1,m=i.tabbableGroups[f];a=Gi(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else ia(n)||(a=p.nextTabbableNode(t,!1))}else{var y=ua(i.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||ra(t,o.tabbableOptions)&&!ta(t,o.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var v=y===i.tabbableGroups.length-1?0:y+1,g=i.tabbableGroups[v];a=Gi(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else ia(n)||(a=p.nextTabbableNode(t))}}else a=l("fallbackFocus");return a},y=function(e){var t=pa(e);c(t,e)>=0||(da(o.clickOutsideDeactivates,e)?n.deactivate({returnFocus:o.returnFocusOnDeactivate}):da(o.allowOutsideClick,e)||e.preventDefault())},v=function(e){var t=pa(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(i.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var s=!0;if(i.mostRecentlyFocusedNode)if(Gi(i.mostRecentlyFocusedNode)>0){var a=c(i.mostRecentlyFocusedNode),l=i.containerGroups[a].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===i.mostRecentlyFocusedNode}));d>=0&&(o.isKeyForward(i.recentNavEvent)?d+1<l.length&&(r=l[d+1],s=!1):d-1>=0&&(r=l[d-1],s=!1))}}else i.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return Gi(e)>0}))}))||(s=!1);else s=!1;s&&(r=m({target:i.mostRecentlyFocusedNode,isBackward:o.isKeyBackward(i.recentNavEvent)})),h(r||i.mostRecentlyFocusedNode||u())}i.recentNavEvent=void 0},g=function(e){if(("Escape"===(null==(t=e)?void 0:t.key)||"Esc"===(null==t?void 0:t.key)||27===(null==t?void 0:t.keyCode))&&!1!==da(o.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(o.isKeyForward(e)||o.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(ia(e)&&e.preventDefault(),h(n))}(e,o.isKeyBackward(e))},b=function(e){var t=pa(e);c(t,e)>=0||da(o.clickOutsideDeactivates,e)||da(o.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},x=function(){if(i.active)return function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var r=e.indexOf(t);-1===r||e.splice(r,1),e.push(t)}(s,n),i.delayInitialFocusTimer=o.delayInitialFocus?la((function(){h(u())})):h(u()),r.addEventListener("focusin",v,!0),r.addEventListener("mousedown",y,{capture:!0,passive:!1}),r.addEventListener("touchstart",y,{capture:!0,passive:!1}),r.addEventListener("click",b,{capture:!0,passive:!1}),r.addEventListener("keydown",g,{capture:!0,passive:!1}),n},w=function(){if(i.active)return r.removeEventListener("focusin",v,!0),r.removeEventListener("mousedown",y,!0),r.removeEventListener("touchstart",y,!0),r.removeEventListener("click",b,!0),r.removeEventListener("keydown",g,!0),n},_="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===i.mostRecentlyFocusedNode}))}))&&h(u())})):void 0,C=function(){_&&(_.disconnect(),i.active&&!i.paused&&i.containers.map((function(e){_.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return i.active},get paused(){return i.paused},activate:function(e){if(i.active)return this;var t=a(e,"onActivate"),n=a(e,"onPostActivate"),s=a(e,"checkCanFocusTrap");s||d(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var o=function(){s&&d(),x(),C(),null==n||n()};return s?(s(i.containers.concat()).then(o,o),this):(o(),this)},deactivate:function(e){if(!i.active)return this;var t=oa({onDeactivate:o.onDeactivate,onPostDeactivate:o.onPostDeactivate,checkCanReturnFocus:o.checkCanReturnFocus},e);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,w(),i.active=!1,i.paused=!1,C(),function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}(s,n);var r=a(t,"onDeactivate"),c=a(t,"onPostDeactivate"),l=a(t,"checkCanReturnFocus"),u=a(t,"returnFocus","returnFocusOnDeactivate");null==r||r();var d=function(){la((function(){u&&h(f(i.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(f(i.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){if(i.paused||!i.active)return this;var t=a(e,"onPause"),n=a(e,"onPostPause");return i.paused=!0,null==t||t(),w(),C(),null==n||n(),this},unpause:function(e){if(!i.paused||!i.active)return this;var t=a(e,"onUnpause"),n=a(e,"onPostUnpause");return i.paused=!1,null==t||t(),d(),x(),C(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),i.active&&d(),C(),this}},n.updateContainerElements(e),n};const ma=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":o})=>{const i=di(),a=(0,oo.useRef)(null),c=(0,oo.useRef)(null),[l,u]=(0,oo.useState)(!1);return(0,oo.useEffect)((()=>(l&&a.current&&(c.current=fa(a.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,oo.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((n=>{const r=n.getAttribute("aria-hidden");null!==r&&"false"!==r||(null!==r&&e.push(r),t.push(n),n.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,n)=>{const r=e[n];null===r?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r)}))}})();return()=>{e()}}),[l]),(0,oo.useEffect)((()=>{l&&a.current&&a.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,oo.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",i),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),r&&t.setAttribute("aria-label",r),o&&t.setAttribute("aria-labelledby",o),e.appendChild(t),a.current=t,u(!0),()=>{a.current&&(e.removeChild(a.current),a.current=null)}}),[r,o,i]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>a.current&&(0,s.render)(e,a.current)}):a.current&&(0,s.render)((0,s.toChildArray)(e).filter(j).map((e=>(e.props={...e.props,onClose:t},e))),a.current)},ya=({url:e,description:t,onClose:n})=>{const r=Hn(),s=ci(),o=Qo(),i=(0,oo.useRef)(null),{t:a}=wo(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof o?c.push(...o):c.push(...o(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,Fo.jsx)(ma,{onClose:n,"aria-label":a("lightbox.heading"),fallBackFocusRef:i,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,Fo.jsx)("div",{className:Zo(c),onClick:u,style:d,children:(0,Fo.jsxs)("div",{className:Zo("modal__float"),tabIndex:-1,onMouseDown:s,onKeyDown:s,onTouchStart:s,onMouseMove:s,onWheel:s,onPointerDown:s,onPointerMove:s,ref:i,children:[(0,Fo.jsx)("div",{className:Zo("modal__inner"),onClick:l,children:(0,Fo.jsx)("img",{className:Zo("modal__image"),src:e,alt:t})}),(0,Fo.jsxs)("button",{type:"button",className:Zo("modal__close"),onClick:n,children:[(0,Fo.jsx)(gi,{name:"close",size:"16",alt:""}),a("lightbox.closeLabel")]})]})}))(n))})},va=({description:e,url:t})=>{const{t:n}=wo(),[r,s]=(0,oo.useState)(!1);return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsxs)("button",{type:"button",className:Zo("modal__enlarge"),onClick:()=>{s(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,Fo.jsx)(gi,{name:"enlarge",size:"32",alt:""})]}),r&&(0,Fo.jsx)(ya,{url:t,description:e,onClose:()=>{s(!1)}})]})},ga=({event:e,...t})=>{const{body:n}=Ko(e),r=Ri(e.payload.id),s=(0,oo.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,Fo.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,Fo.jsx)(fi,{type:"text",event:e,onClick:r,...t,...s})},ba="PROCESSING_IMAGE",xa=({img:e,filename:t})=>{const{t:n}=wo(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,Fo.jsx)(Fo.Fragment,{children:(0,Fo.jsxs)("span",{className:Zo(["download","download--preview"]),children:[(0,Fo.jsx)("img",{src:e,alt:r}),(0,Fo.jsx)("span",{"aria-hidden":"true",className:Zo("file-download"),children:t})]})})},wa=({children:e,url:t,target:n})=>t?(0,Fo.jsx)("a",{href:t,download:!0,target:n,className:Zo(["download","download-link"]),children:e}):(0,Fo.jsx)("span",{className:Zo("download"),children:e}),_a={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=wo(),o=di(),{body:i,subEvent:a,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=Ti(e);return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,s.toChildArray)(t).filter(j).map((e=>(e.props={...e.props,event:a,descriptorId:o,showTranslationToggle:!1},e))),l&&(0,Fo.jsxs)("button",{type:"button",className:Zo("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":o,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,Fo.jsx)(gi,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,Fo.jsx)(fi,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,Fo.jsx)("ul",{className:Zo("choice-prompt","choice-prompt--many"),children:i?.choices?.map((e=>(0,Fo.jsx)("li",{className:Zo("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:ga,image:({event:e,descriptorId:t,...n})=>{const{body:r}=Ko(e),[s,o]=(0,oo.useState)(!1),i=so();return(0,Fo.jsxs)(fi,{event:e,type:"image",...n,children:[(0,Fo.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{i(Ss(e.payload.id)),o(!0)}}),r?.isZoomable&&s&&(0,Fo.jsx)(va,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=Ko(e),s=Ri(n.id);return(0,Fo.jsx)(fi,{type:"splash",event:e,onClick:s,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=Ko(e);return ei(e).push("message--type-video"),(0,Fo.jsxs)(fi,{event:e,type:"video",...n,children:[(0,Fo.jsx)("div",{id:t,className:Zo("visually-hidden"),children:r?.description}),(0,Fo.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=wo(),{body:r}=Ko(e),{fromClient:s,id:o}=e.payload,{filename:i,url:a}=r,c=(e=>{const{processingFileUploads:t}=In((({state:e})=>e));return(0,oo.useMemo)((()=>{if(t.some((t=>t===e)))return ba;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(o),l=(0,oo.useMemo)((()=>n(a?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:i})),[a,i,n]);return(0,Fo.jsx)(fi,{event:e,type:"upload",...t,children:c&&c!==ba?(0,Fo.jsx)(xa,{img:c,filename:i}):(0,Fo.jsxs)(wa,{url:a,target:s?void 0:"_blank",children:[(0,Fo.jsx)(gi,{name:"download",size:"16",alt:l}),(0,Fo.jsx)("span",{"aria-hidden":"true",className:Zo("file-download"),children:i})]})})},cta:({event:e})=>{const{body:t}=Ko(e),n=Ri(e.payload.id),{emitEvent:r}=Io(),s=di(),o=(0,oo.useCallback)((()=>r(`action.${F}`,{type:F,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,Fo.jsxs)(fi,{type:"cta",event:e,children:[(0,Fo.jsx)("div",{className:Zo("cta__content"),id:s,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,Fo.jsx)("a",{className:Zo("button","button--primary"),"aria-describedby":s,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:o,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=Ko(e),n=t.cards;return(0,Fo.jsx)(fi,{event:e,modifiers:"type-carousel",children:(0,Fo.jsx)(Ei,{items:n,getItemKey:Si,getItemLabel:ji})})},card:({event:e})=>{const{body:t}=Ko(e),n=di();return(0,Fo.jsx)(fi,{type:"card",event:e,children:(0,Fo.jsx)(mi,{id:n,...t})})}},info:{text:ga,divider:({event:e,...t})=>{const n=Li[W[e.payload.body.subtype]]||Li.default;return(0,Fo.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=wo(),{body:r}=Ko(e);return(0,Fo.jsx)(fi,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:Di},participant:{participant:({event:e})=>{const{participant:t}=e.payload,{body:n}=(e=>{const{translatedBody:t,translation:n,body:r}={body:e.payload?.participant?.introduction,translatedBody:e.payload?.participant?.translatedIntroduction,translation:e.payload?.participant?.translation},s=!!t,o=In(qo(e));return{body:o&&s?t:r,hasTranslation:s,isTranslated:o&&s,locale:n?.locale}})(e);return n?(0,Fo.jsx)(Ii,{graphicSrc:t?.avatar,graphicType:t?.avatar?"avatar":void 0,iconName:t?.avatar?void 0:"balloon",dividerType:"participant",title:n}):null}},service_data:{suggestion:({event:e,...t})=>{const[n,r]=(0,oo.useState)(!0),s=so(),o=Eo(),{sendAction:i,addMessageBubble:a}=Io(),{suggestions:c,payload:l}=(e=>{const{payload:t}=e,{body:n}=Ko(e);return{suggestions:n,payload:t}})(e),{showSuggestions:u}=Hn(),d=Jn(),{t:p}=wo(),h=p("suggestions.headingText"),f=p("suggestions.footerText"),m=(0,oo.useMemo)((()=>d.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[d]),y=(0,oo.useCallback)((({id:e,question:t})=>{r(!1),s(xr(!0)),i({type:O,originMessage:l.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),a(t)}),[s,i,l.id,a]);return n&&!o&&m&&u?(0,Fo.jsxs)("div",{className:Zo("suggestions","suggestions--conversation"),children:[h&&(0,Fo.jsx)("p",{className:Zo("suggestions__heading"),children:h}),(0,Fo.jsxs)(fi,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,Fo.jsx)(Ai,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:c}),f&&(0,Fo.jsx)("p",{className:Zo("suggestions__footer"),children:f})]})]}):null}}},Ca=({children:e})=>{const{customComponents:t}=Hn(),n=(0,oo.useMemo)((()=>Object.keys(_a).reduce(((e,n)=>(e[n]={..._a[n],...t?t[n]:{}},e)),{fallback:ga})),[t]);return(0,Fo.jsx)(zo.Provider,{value:n,children:e})},Ea=({children:e})=>{const{isMinimized:t}=_o(),n=(0,oo.useRef)(0),{sendAction:r}=Io(),{hasCountdown:s,isActive:o,stopCountdown:i}=li(),a=(0,oo.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),a=()=>{r({type:"interactivity_update"}),n.current=e};s&&o&&(a(),i()),e-n.current>15e3&&a()}),[r,s,o,i,t]);return(0,Fo.jsx)("div",{className:Zo("activity-monitor"),tabIndex:-1,onMouseDown:a,onKeyUp:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,children:(0,Fo.jsx)(ai.Provider,{value:a,children:e})})},Sa=["text","choice_prompt","image","video"],ja=()=>{const e=ti(),t=(0,oo.useRef)(),n=(0,oo.useRef)(),r=so(),s=ko(),o=(0,oo.useRef)(null),{initCountdown:i,endCountdown:a}=li(),{emitEvent:u}=Io();return(0,oo.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new _r(e);r(Wr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(ss())})),t.onOpen((()=>{r(qr())}))}}),[e,r]),(0,oo.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new c;return r(Wr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,oo.useEffect)((()=>{const t=e=>{if("participant"!==e.type)return;const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:s}=t;!n&&"string"!=typeof s&&s?.name&&r(xs(s.name)),r(js({participant:s,fromClient:n})),"string"!=typeof s&&s.introduction&&r(ns(e))};e.onConnection((({connected:n})=>{const{channel:o}=e;return!(!n||!o||(o.onMessage=(e,n)=>{const o={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(Es(n.state.loading)),n.type){case"idle_detach_countdown":i(n.body.duration);break;case"idle_detach_countdown_elapsed":a(void 0,!0);break;case"resume_conversation_prompt":r(ds());break;case"translation_proposal":r(Xs(n.body));break;case"user_first_response":r(xr(!0)),s.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(Pr(n.userLocale));break;case"message":switch(t(n),n.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":n.service&&n.service.serviceSessionId&&r(ms(n.service.serviceSessionId)),r(ns(o))}break;case"participant":t(o);break;case"service_data":n.persist&&r(ks(n));break;case"ack":r(ts(o));break;case"system":if("service_changed"===n.type){const{serviceSettings:e,...t}=n,{entry:s,proactiveMessages:o}=e,{upload:i}=s.options;r(gs({key:q,enabled:!(!i||!i.enabled)})),r(zs(o.enabled||!1)),r(Ns(s)),n.serviceSessionId&&r(ms(n.serviceSessionId)),u("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(ns(o));break;case"error":switch(n.type){case"find_conversation_erred":const e=new l(o);r(Wr({name:e.name,action:e.action,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError}));break;case"conversation_erred":case"attach_channel_erred":const t=new c(o);r(Wr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError,action:t.action}))}}return n},1))}))}),[e,r,u,a,s,i]),(0,oo.useEffect)((()=>{e.onConnection((({connected:t})=>{const{channel:r}=e;return!(!t||!r||(n.current&&r.off("message",n.current),n.current=r.on("message",(e=>Sa.includes(e.type)?(e.id!==o.current&&s.emit("message",e),o.current=e.id,e):e)),0))}))}),[e,s]),(0,oo.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.channel?.off("sync",t.current),t.current=e.channel?.on("sync",(async e=>{try{const t=await r($r(e)).unwrap();if(!t)return;r(_s(t))}catch(e){}})),!0)))}),[e,r]),null},Ta=({children:e})=>{const{t}=wo(),n=so(),r=No(),{addUploadBubble:s}=Io(),o=(0,oo.useCallback)((async(e,t)=>{n(Ls(t));const r=await(e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>"string"==typeof r.result?t(r.result):void 0,r.onerror=e=>n(e)})))(e),s=new Image;s.src=r,await s.decode();const o=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,s]=(e=>{const{height:t,width:n}=e;return n>t&&n>600?[600,600*t/n]:t>600?[600*n/t,600]:[n,t]})(e);return t.width=r,t.height=s,n?.drawImage(e,0,0,r,s),t.toDataURL()})(s);try{sessionStorage.setItem(`image-${t}`,o)}catch(e){}finally{n(Ms(t))}}),[n]),i=(0,oo.useCallback)((e=>{const i=m(),a=r.uploadFile(e,(e=>{n(Os({fileId:i,progress:Math.ceil(e)}))}),(async t=>{const{id:r,transactionId:a,occurredAt:c,body:{contentType:l,filename:u,filesize:d,url:p}}=t;n(Rs(i)),s(r,a,c,l,u,d,p),await o(e,r)}),(e=>{let r;switch(e?.error||""){case"file_uploads_are_disabled":r=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":r=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":r=t("fileUpload.errors.wrongType");break;case"virus_found":r=t("fileUpload.errors.virusFound");break;default:r=t("fileUpload.errors.general")}n(Is({fileId:i,errorText:r}))}));n(ps({fileId:i,fileName:e.name,uploadHandle:a}))}),[o,s,r,n,t]);return(0,Fo.jsx)(ni.Provider,{value:i,children:e})},ka=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=li();return((e,t)=>{const n=(0,oo.useRef)(e);(0,oo.useEffect)((()=>{n.current=e}),[e]),(0,oo.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},Na=()=>{const{initUserSelectedOptions:e}=oi(),t=(0,oo.useRef)(!1),n=Hn();return(0,oo.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function Aa(e,t,n=[]){const r=ko(),s=(0,oo.useRef)(t);(0,oo.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>s.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const Ra=()=>{const e=Hn(),{sendMessage:t,sendContext:n,sendAction:r}=Io(),s=so(),{setVisibility:o,visible:i}=_o(),a=(0,oo.useRef)(i),c=ko(),l=No(),u=Yn(),d=(0,oo.useRef)(null),h=(0,oo.useRef)(null),{isInline:f,isResolving:m}=rr(),y=In(Mo),v=(()=>{const{get:e}=Ao();return e?e("conversationUrl"):null})(),g=(0,oo.useRef)(null),b=ci(),{enableTranslations:x,disableTranslations:w}=Go();return(0,oo.useEffect)((()=>{a.current=i}),[i]),Aa("askText",(e=>{t({body:e})}),[l.send]),Aa("setVariables",(e=>{n({variables:e})}),[l.send]),Aa("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),Aa("setVisibility",(e=>{Object.values(vn).includes(e)?(b(),o(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),Aa("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),Aa("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&s(mr({showSuggestions:!1})),e&&t?r({type:U,body:{name:e,fallbackMessage:t,participant:n?p:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),Aa("setContext",(e=>{n(e)}),[l.send]),Aa("setTranslation",(({enabled:e,locale:t})=>{e?x(t,$):w()}),[l.send]),(0,oo.useEffect)((()=>{m||y||(g.current&&g.current!==v&&c.emit("unreadMessageCount",u),i===vn.open&&i!==h.current&&0!==d.current&&c.emit("unreadMessageCount",0),i!==vn.open&&u!==d.current&&c.emit("unreadMessageCount",u),h.current=i,d.current=u,"string"==typeof v&&(g.current=v))}),[u,i,c,f,m,y,v]),null},Ia=({children:e})=>{const t=ko(),n=(0,oo.useRef)(null),[r,s]=(0,oo.useState)(),o=(0,oo.useRef)(!0),i=(0,oo.useCallback)((e=>{o.current&&(s(e),t.emit("aria-live",e))}),[s,t]);return(0,oo.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{i({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,i]),(0,oo.useEffect)((()=>()=>{o.current=!1}),[]),(0,Fo.jsxs)(To.Provider,{value:i,children:[e,(0,Fo.jsxs)("div",{className:Zo("app__live-container"),children:[(0,Fo.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Zo("visually-hidden"),children:r?.ariaLive===H?r?.messageText:null}),(0,Fo.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Zo("visually-hidden"),children:r?.ariaLive===V?r?.messageText:null})]})]})},Oa=()=>{const{t:e}=wo(),t=Jn(),n=(0,oo.useRef)(0),r=(0,oo.useRef)(0),s=qn().historyLoaded,{sendPolite:o}=Oo(),{isOpen:i}=_o(),a=(0,oo.useRef)(null),c=(0,oo.useRef)(null),l=(0,oo.useMemo)((()=>v((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(o(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[o,e]);return(0,oo.useEffect)((()=>{t.length>n.current&&(i&&(c.current=l(t)),n.current=t.length)}),[t,l,i]),(0,oo.useEffect)((()=>{a.current&&!i&&c.current&&(c.current(!0),c.current=null)}),[i]),(0,oo.useEffect)((()=>{s&&setTimeout((()=>{o(e("window.srTexts.onHistoryLoad"))}),500)}),[s,e,o]),null},La=()=>{const{t:e}=wo(),{isOpen:t,isVisible:n}=_o(),r=Yn(),{sendPolite:s}=Oo(),o=(0,oo.useMemo)((()=>v(s,2e3)),[s]),i=(0,oo.useRef)(null),a=(0,oo.useRef)(null);return(0,oo.useEffect)((()=>{i.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=o(e("message.srTextUnreadCount",{unreadCount:r}))),i.current=n}),[r,t,n,o,e]),null},Ma=({store:e,children:t,eventBus:n,api:r})=>((0,oo.useErrorBoundary)((t=>{console.error(t),e.dispatch(Er(t))})),(0,Fo.jsx)(Dn,{store:e,children:(0,Fo.jsx)(jo.Provider,{value:n,children:(0,Fo.jsx)(So.Provider,{value:r,children:(0,Fo.jsx)(Ia,{children:(0,Fo.jsx)(Bo,{children:(0,Fo.jsxs)(Ca,{children:[(0,Fo.jsx)(Na,{}),(0,Fo.jsx)(ja,{}),(0,Fo.jsx)(La,{}),(0,Fo.jsx)(Oa,{}),(0,Fo.jsx)(ka,{}),(0,Fo.jsxs)(Ea,{children:[(0,Fo.jsx)(Ra,{}),(0,Fo.jsx)(Ta,{children:t})]})]})})})})})})),Pa=bt(Kn,(e=>e.filter((e=>Jr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===R)))),Da=bt([Pa],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),Ua=bt(Pa,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),Fa=bt((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),Ba=()=>{const{t:e}=wo(),{showDisclaimer:t}=Hn();return t?(0,Fo.jsxs)("div",{className:Zo("disclaimer"),tabIndex:0,children:[(0,Fo.jsx)("h2",{className:Zo("disclaimer__title"),children:e("disclaimer.title")}),(0,Fo.jsx)("div",{className:Zo("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},za=bt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),$a=bt(za,(e=>e?.controls||{})),Ha=bt($a,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Va=bt([$a,(e,{name:t})=>t],((e,t)=>e[t]?.value)),Wa=bt([$a,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),qa=(0,s.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:Ga,Consumer:Ka}=qa,Ja=qa;function Xa(){return(0,oo.useContext)(Ja)}function Ya(e){const t=so(),{formId:n,updateControlValue:r,updateControlTouched:s,errors:o}=Xa(),i=!!In((e=>za(e,{formId:n}))),a=In((t=>Va(t,{formId:n,name:e}))),c=In((t=>Wa(t,{formId:n,name:e}))),l=o?.[e],u=!l;(0,oo.useEffect)((()=>{i&&t(Rr({formId:n,name:e}))}),[i,n,e,t]),(0,oo.useLayoutEffect)((()=>()=>{t(Ir({formId:n,name:e}))}),[i,n,e,t]);const d=(0,oo.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,oo.useCallback)((()=>{s(e,!0)}),[s,e]);return[(0,oo.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:a})),[e,d,p,a]),(0,oo.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function Za(e){const{t}=wo(),{sendAssertive:n}=Oo(),{hasLimit:r,limit:s}=nr(),o=(0,oo.useMemo)((()=>v(n,f)),[n]),i=(0,oo.useMemo)((()=>v(((e,n)=>{e&&o(t("input.srCharacterLimitText",{limit:n}))}),f)),[o,t]),[{value:a}]=Ya(e),c=s&&r&&a?s-a.length:s,l=!(!r||!c)&&c<=h,u=!(!r||!c)&&c<0;return(0,oo.useEffect)((()=>{i(l,c)}),[l,c,i]),{hasCharacterLimit:r,characterLimit:s,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Qa=e=>{const{hasCharacterLimit:t,characterLimit:n}=Za(e),{entryMeta:{optionsOverride:{text:r}}}=qn(),{t:s}=wo();return{placeholder:(0,oo.useMemo)((()=>s("input.inputPlaceholder",{hasLimit:t,text:r?.placeholder||s("input.inputPlaceholderText"),limit:t?n:null})),[s,t,n,r?.placeholder]),label:(0,oo.useMemo)((()=>s("input.inputLabel",{hasLimit:!r?.label&&t,text:r?.label||s("input.inputLabelText"),limit:!r?.label&&t?n:null})),[s,t,n,r?.label]),labelClass:(0,oo.useMemo)((()=>r?.label?"label":"visually-hidden"),[r?.label])}};function ec(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=so(),{entryMeta:{actions:t,translatedActions:n}}=qn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(As())}}})(),n=No();return e?(0,Fo.jsx)("li",{className:Zo(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,Fo.jsx)("button",{className:Zo(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:U,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const tc=(0,s.createContext)(null),nc=()=>{const e=(0,oo.useContext)(tc);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},rc=tc,sc=e=>{const t=(()=>{const e=(0,oo.useContext)(zo);if(!e)throw new Error("useComponentContext has to be used within <ComponentContext.Provider>");return e})(),n=t[e.type];let r=n[e.payload.type],s=null;return"choice_prompt"===e.payload.type&&(s=n[e.payload.body.prompt.type]),"participant"===e.type&&(r=n[e.type]),r&&"function"!=typeof r&&(r=r[e.payload.body.type]),[r||t?.fallback,s]},oc=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=nc(),{sendAction:s}=Io(),o=e.payload.id?n[e.payload.id]:void 0,{containerRef:i,isVisible:a}=Co({containerRef:o,freezeOnceVisible:!0}),c=so(),[l,u]=sc(e);if((0,Uo.useEffect)((()=>{if(a&&r?.includes(e.payload.id)){const t=r.reduce(((t,n)=>e?.payload?.id&&n&&!t.includes(e.payload.id)?t.concat(n):t),[]);c(vs(t)),s({type:M,events:t})}}),[c,e.payload.id,a,s,r]),!l)return null;const d=["conversation__item"];return"info"===e.type?d.push("conversation__item--source-info"):e.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),t&&d.push("conversation__item--new-participant"),(0,Fo.jsxs)("li",{className:Zo(d),ref:i,children:[e.payload.timeIndicator&&(0,Fo.jsx)(Di,{event:e}),(0,Fo.jsx)(l,{event:e,children:(0,Fo.jsx)(u,{event:e})})]})},ic=()=>{const{id:e}=tr()||{};return(0,Fo.jsx)("li",{className:Zo("conversation__item","conversation__item--source-agent"),children:(0,Fo.jsxs)("div",{className:Zo("message","message--source-agent","message--type-loading"),children:[(0,Fo.jsx)(hi,{eventPayload:{fromClient:!1,participant:e}}),(0,Fo.jsx)("div",{className:Zo("message__body"),children:(0,Fo.jsxs)("span",{className:Zo("loader"),children:[(0,Fo.jsx)("span",{className:Zo("loader__part","one")}),(0,Fo.jsx)("span",{className:Zo("loader__part","two")}),(0,Fo.jsx)("span",{className:Zo("loader__part","three")}),(0,Fo.jsx)("span",{className:Zo("loader__part","four")})]})})]})})},ac=()=>{const e=Jn();let t;return(0,Fo.jsx)(Fo.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let s=!1;if("participant"!==n&&"service_data"!==n){const{participant:n,fromClient:o}=r,i=o?"seamly-client-participant":n;"info"!==e.type&&t!==i&&(s=!0),t=i}return(0,Fo.jsx)(oc,{event:e,newParticipant:s},e.payload.key||e.payload.id)}))})},cc=()=>{const{t:e}=wo(),t=Xn(),n=((e,t=20)=>{const[n,r]=(0,oo.useState)(e),s=(0,oo.useRef)(null);return(0,oo.useEffect)((()=>(s.current=setTimeout((()=>r(e)),t),()=>{s.current&&clearTimeout(s.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=_o(),s=Zn(),o=Wo();return(0,Fo.jsxs)(Fo.Fragment,{children:[r&&(0,Fo.jsx)("a",{className:Zo("skip-link"),href:`#${s}`,onClick:e=>{e.preventDefault(),o()},children:e("skiplinkText")}),(0,Fo.jsx)("div",{className:Zo("chat__body"),children:(0,Fo.jsxs)("div",{className:Zo("conversation__container"),children:[(0,Fo.jsx)(Ba,{}),(0,Fo.jsxs)("ol",{className:Zo("conversation"),children:[(0,Fo.jsx)(Ca,{children:(0,Fo.jsx)(ac,{})}),n?(0,Fo.jsx)(ic,{}):null,(0,Fo.jsx)(ec,{})]})]})})]})};function lc(e,t){const n=(0,oo.useRef)(null),r=(0,oo.useRef)(e);return(0,oo.useEffect)((()=>{r.current=e}),[e]),(0,oo.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const uc={visible:Zo("transition--visible"),in:Zo("transition--in"),visuallyHidden:Zo("visually-hidden")},dc=Object.values(uc),pc=e=>{const t=(0,oo.useRef)(null);t.current=e;const n="function"==typeof e;return(0,oo.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},hc={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},fc=({children:e,isActive:t,timeout:n=300,transitionStartState:r=hc.notRendered,onInTransitionComplete:o=(()=>{}),onOutTransitionComplete:i=(()=>{}),exitAfter:a,enterDelay:c=0})=>{const l=(0,oo.useRef)(!1),u=(0,oo.useRef)(null),d=(0,oo.useRef)(null),p=r===hc.visuallyHidden,[h,f]=(0,oo.useState)((()=>p?[uc.visuallyHidden]:[])),[m,y]=(0,oo.useState)((()=>0===c)),v=(0,oo.useMemo)((()=>a?a+c:a),[c,a]);lc((()=>y(!1)),t?v:void 0),lc((()=>y(!0)),t?c:void 0);const g=(0,oo.useMemo)((()=>m&&t),[t,m]),b=pc(o),x=pc(i),w="notRendered"!==r||h.length>0;return(0,oo.useEffect)((()=>(l.current&&!g&&(f([uc.visible]),u.current=setTimeout((()=>{f([...p?[uc.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&g&&(f([uc.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{f([uc.visible,uc.in]),b&&(u.current=setTimeout((()=>{b()}),n))}))}))),l.current=g,()=>{u.current&&clearTimeout(u.current),d.current&&cancelAnimationFrame(d.current)})),[p,b,x,n,g]),(0,Fo.jsx)(Fo.Fragment,{children:w&&(0,s.toChildArray)(e).filter(j).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!dc.includes(e)));return(0,s.cloneElement)(e,{className:[...n,...h].join(" ")})}))})},mc=({isAside:e=!1})=>{const{isInline:t}=rr(),{t:n}=wo(),{sendAction:r,addMessageBubble:s}=Io(),{isOpen:o,setVisibility:i}=_o(),{showSuggestions:a}=Hn(),c=di(),l=Wo(),u=(0,oo.useRef)(null),{sendPolite:d}=Oo(),p=In(Mo),{hasCountdown:h,endCountdown:f}=li(),{hasPrompt:m,continueChat:y}=ui(),v=Eo(),g=qn().serviceData.suggestion;const{body:b}=Ko({payload:g,type:"service_data"}),x=(0,oo.useMemo)((()=>p?[]:Array.isArray(b)?b:b?.data),[b,p]),w=(0,oo.useRef)(),_=(0,oo.useRef)(!1),C=(0,oo.useRef)(),E=!!x?.length,j=t?(v||o)&&!e:v,T=(0,oo.useRef)(j),k=E&&!j&&a,N=E?x:C.current;C.current=N;const A=(0,oo.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Zo(t)}),[e]),R=(0,oo.useCallback)((({id:e,question:t})=>{h&&f(!0),m&&y(),r({type:O,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),s(t),o||i(vn.open),l()}),[s,y,f,l,h,m,g,r,i,o]);(0,oo.useEffect)((()=>{if(w.current!==x&&!j){if(E){const e=_.current?n("suggestions.srUpdatedText"):n("suggestions.srAvailableText");setTimeout((()=>{d(e)}),30)}else _.current&&d(n("suggestions.srUnavailableText"));w.current=x}!T.current&&j?(S(u.current,l),d(n("suggestions.srUnavailableText"))):!E&&_.current&&S(u.current,l),_.current=E,T.current=j}),[x,E,j,l,d,n]);const I=n("suggestions.headingText"),L=n("suggestions.footerText"),M=I?"section":"div";return(0,Fo.jsx)(fc,{isActive:!!k,transitionStartState:hc.notRendered,children:(0,Fo.jsxs)(M,{className:A,"aria-labelledby":I?c:void 0,ref:u,children:[I&&(0,Fo.jsx)("p",{id:c,className:Zo("suggestions__heading"),children:I}),!!N&&(0,Fo.jsx)(Ai,{suggestions:N,onClickSuggestion:R}),L&&!o&&(0,Fo.jsx)("p",{className:Zo("suggestions__footer"),children:L})]})})},yc=(0,Uo.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:s,setVisibility:o}=_o(),{namespace:i,layoutMode:a}=Hn(),{isInline:c}=rr(),l=Qo(),u=Eo(),{t:d}=wo(),p=["chat",`chat--layout-${a}`,`namespace--${i}`,t];return"function"!=typeof l&&p.push(...l),r||"app"===a||p.push("chat--collapsed"),u&&p.push("chat--user-responded"),s&&(0,Fo.jsxs)("section",{className:Zo(p),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&o(vn.minimized)},tabIndex:-1,ref:n,"aria-label":d("chat.srLabel"),children:[(0,Fo.jsx)("div",{className:Zo("chat-wrapper"),children:e}),"inline"===a&&r&&(0,Fo.jsx)(mc,{isAside:!0})]})})),vc=yc,gc=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:s,id:o})=>{const i=di();return(0,Fo.jsxs)("section",{tabIndex:-1,id:o,"aria-labelledby":n?i:void 0,className:Zo("chat-status",n?void 0:"chat-status--condensed"),children:[(0,Fo.jsxs)("div",{className:Zo("chat-status__body"),children:[n?(0,Fo.jsx)("h2",{className:Zo("chat-status__title"),id:i,children:n}):null,e]}),"function"==typeof t&&(0,Fo.jsxs)("button",{type:"button",onClick:t,className:Zo("button","button--tertiary","chat-status__close"),children:[r||(0,Fo.jsx)(gi,{name:"close",size:"16",alt:""}),s&&(0,Fo.jsx)("span",{className:Zo("visually-hidden"),children:s})]})]})},bc=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,Fo.jsxs)("button",{type:"button",onClick:e,className:Zo("button","button--primary","chat-status__button"),children:[(0,Fo.jsx)(gi,{name:t,size:"16",alt:""}),n,r&&(0,Fo.jsx)("span",{className:Zo("visually-hidden"),children:r})]});function xc(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=Yo(),{id:s}=Jo();return e&&t?(0,Fo.jsx)(gc,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:s,title:t.titleLabel,children:(0,Fo.jsx)(bc,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function wc(){const e=In(Mo),{isActive:t}=Go();return e||t?null:(0,Fo.jsx)(xc,{})}const _c=({label:e,checked:t,description:n,onChange:r,id:s,itemClassName:o})=>(0,Fo.jsxs)("li",{className:Zo([o||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:s,children:[(0,Fo.jsx)(gi,{name:"check",size:"16",alt:""}),e," ",n&&(0,Fo.jsxs)("span",{children:["(",n,")"]})]}),Cc=({onChange:e,describedById:t})=>{const{context:n}=Hn(),r=(0,Uo.useMemo)((()=>n?.contentLocale),[n?.contentLocale]),{t:s}=wo(),{languages:o,currentLocale:i,enableTranslations:a,disableTranslations:c}=Go(),l=Wo(),u=t=>()=>{t===i||r===t?c():a(t,"translation_choice"),e(),l()},{primaryLanguages:d,remainingLanguages:p}=(0,Uo.useMemo)((()=>o.reduce(((e,t)=>{const n=t.locale===r,s=((e,t,n)=>t===e.locale||!t&&n)(t,i,n);t.locale!==r&&e.remainingLanguages.push({...t,checked:s,isOriginal:n});const o=e.remainingLanguages.findIndex((e=>e.locale===i));return(n||s&&o>4)&&e.primaryLanguages.push({...t,checked:s,isOriginal:n}),e}),{primaryLanguages:[],remainingLanguages:[]})),[i,r,o]);return(0,Fo.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Zo("translation-options"),children:[d.map((({locale:e,nativeName:t,checked:n,isOriginal:r},o)=>(0,Fo.jsx)(_c,{id:e,label:t,checked:n,description:r?s("translations.settings.original"):void 0,onChange:u(e),itemClassName:Zo({"translation-options__item--original":r,"translation-options__item--selected":n&&0!==o})},e))),p.map((({locale:e,nativeName:t,checked:n,isOriginal:r})=>(0,Fo.jsx)(_c,{id:e,label:t,checked:n,description:r?s("translations.settings.original"):void 0,onChange:u(e)},e)))]})},Ec=({className:e,children:t,onCancel:n,headingText:r,description:s,descriptionId:o,cancelButtonText:i,cancelButtonRef:a,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=di(),{hideOption:d}=oi(),{focusButton:p}=ii(),h=(0,oo.useCallback)((()=>{d(),c||p()}),[c,p,d]),f=(0,oo.useCallback)((()=>{n&&n(),h()}),[h,n]),m=(e=>{const t=(0,oo.useRef)(null);return(0,oo.useEffect)((()=>{const n=n=>{t.current&&n.target instanceof HTMLElement&&!t.current.contains(n.target)&&(n.preventDefault(),n.stopPropagation(),e())};return document.addEventListener("click",n,!0),document.addEventListener("touchstart",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("touchstart",n,!0)}}),[e,t]),t})(f);return(0,oo.useEffect)((()=>{E(m.current)}),[m]),(0,Fo.jsx)("section",{className:Zo("options",{"options--right":"right"===l.horizontal,"options--left":"left"===l.horizontal,"options--top":"top"===l.vertical,"options--bottom":"bottom"===l.vertical},e||""),"aria-labelledby":u,tabIndex:-1,ref:m,children:(0,Fo.jsxs)("div",{className:Zo("options__body"),children:[(0,Fo.jsx)("h2",{id:u,className:Zo("options__title"),children:r}),(0,Fo.jsxs)("button",{type:"button",onClick:f,"aria-describedby":u,className:Zo("button","options__close"),ref:e=>{a&&(a.current=e)},children:[(0,Fo.jsx)(gi,{name:"close",size:"16",alt:""}),(0,Fo.jsx)("span",{children:i})]}),s?(0,Fo.jsx)("p",{className:Zo("options__description"),id:o,children:s}):null,(0,Fo.jsx)("div",{className:Zo("options__wrapper"),children:t})]})})},Sc=function({onClose:e,position:t}){const{t:n}=wo(),r=di();return(0,Fo.jsx)(Ec,{onCancel:e,headingText:n("translations.menu.title"),cancelButtonText:n("translations.settings.cancelButtonText"),description:n("translations.menu.description"),descriptionId:r,position:t,disableButtonFocusing:!0,children:(0,Fo.jsx)(Cc,{describedById:r,onChange:e})})};function jc({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,s]=(0,oo.useState)(!1),o=(0,oo.useRef)(null),i=di();return(0,Fo.jsxs)("div",{className:Zo("translations__container"),onKeyDown:e=>{r&&C(e)===_.Escape&&(s(!1),E(o.current))},children:[(0,Fo.jsx)(fc,{transitionStartState:hc.notRendered,isActive:r,children:(0,Fo.jsx)("div",{className:Zo("options__dialog"),role:"dialog",children:(0,Fo.jsx)(Sc,{onClose:()=>{s(!1)},position:t})})}),(0,Fo.jsx)("button",{type:"button",className:Zo(["button","chat__options__button",...n]),id:i,onClick:()=>{s(!r)},onKeyDown:e=>{C(e)===_.ArrowDown&&(s(!0),e.preventDefault())},ref:o,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const Tc=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:s,validationSchema:o={},...i})=>{const a=so(),c=In((e=>Ha(e,{formId:t}))),[l,u]=(0,oo.useState)(!1),[d,p]=(0,oo.useState)({}),{isValid:h,errors:f}=function(e,t){const n=(0,oo.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const s=Array.isArray(r)?r:[r];for(let r=0;r<s?.length;r++)if(!s[r].fn(e[n],s[r].compareValue)){t[n]=s[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,o),m=(0,oo.useMemo)((()=>({...f,...d})),[f,d]);(0,oo.useLayoutEffect)((()=>{a(Nr({formId:t,persistData:n}))}),[t,n,a]),(0,oo.useEffect)((()=>()=>{a(Ar({formId:t}))}),[t,n,a]);const y=(0,oo.useCallback)(((e,n)=>{a(Or({formId:t,name:e,value:n}))}),[t,a]),v=(0,oo.useCallback)(((e,n)=>{a(Lr({formId:t,name:e,touched:n}))}),[a,t]),g=(0,oo.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,oo.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&h&&(a(xr(!0)),s(c,{updateControlValue:y,setError:g}))}),[h,a,s,c,y,g]);(0,oo.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,oo.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:o,updateControlValue:y,updateControlTouched:v})),[t,c,m,l,b,o,y,v]);return t?s?(0,Fo.jsx)(Ga,{...i,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},kc=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),Nc=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},Ac=e=>!!e?.length,Rc=e=>{const t=e&&e.trim();return!(!t||!t.match(/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i))},Ic=e=>!!e,Oc=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:s,isSubmitted:o}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Xa();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),i=["form"];return!t&&o&&(i.push("form--submitted"),s?i.push("form--valid"):i.push("form--invalid")),(0,Fo.jsx)("form",{onSubmit:r,className:Zo([...i,e]),...n})};function Lc({id:e,error:t}){const[n,r]=(0,oo.useState)(!1);return(0,oo.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,Fo.jsx)("div",{className:Zo("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,Fo.jsxs)("span",{id:e,className:Zo("error__message"),children:[(0,Fo.jsx)(gi,{name:"error",size:"16",alt:""}),t]})})}const Mc=({contentHint:e,id:t,labelText:n,labelClass:r,validity:s,errorText:o,children:i})=>(0,Fo.jsxs)(Fo.Fragment,{children:[e&&(0,Fo.jsx)("span",{id:`${t}-content-hint`,className:Zo("input__content-hint"),children:e}),(0,Fo.jsx)(Lc,{id:`${t}-error`,error:!s&&o}),(0,Fo.jsxs)("div",{className:Zo("form-control__wrapper"),children:[(0,Fo.jsx)("label",{htmlFor:t,className:Zo(r),children:n}),i]})]}),Pc=function({id:e,name:t,type:n,labelText:r,labelClass:s,contentHint:o=null,"aria-invalid":i,"aria-describedby":a,...c}){const{isSubmitted:l}=Xa(),[u,{error:d}]=Ya(t),p=l&&d,h=[];return a&&h.push(a),o&&h.push(`${e}-content-hint`),p&&h.push(`${e}-error`),(0,Fo.jsx)(Mc,{id:e,contentHint:o,validity:!p,errorText:d,labelText:r,labelClass:s,children:(0,Fo.jsx)("input",{...u,...c,id:e,type:n,"aria-invalid":i||p?"true":"false","aria-describedby":h.join(" ")||void 0,name:t})})};function Dc({controlName:e,describedById:t}){const{t:n}=wo();return(0,Fo.jsxs)(Oc,{noValidate:"true",className:Zo("options__form"),children:[(0,Fo.jsx)(Pc,{id:"email-id",name:e,type:"email",className:Zo("transcript__input"),"aria-describedby":t,labelClass:Zo("label"),labelText:n("options.sendTranscript.label")}),(0,Fo.jsx)("div",{className:Zo("options__actions"),children:(0,Fo.jsx)("button",{type:"submit",className:Zo("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const Uc="email",Fc={sendTranscript:()=>{const[e,t]=(0,oo.useState)(void 0),{hideOption:n}=oi(),{focusButton:r}=ii(),{t:s}=wo(),o=di(),{sendAction:i}=Io(),a=(0,oo.useMemo)((()=>({[Uc]:[kc(Ic,s("options.sendTranscript.noEmailText")),kc(Rc,s("options.sendTranscript.invalidEmailText"))]})),[s]),c=(0,oo.useCallback)((e=>{const t=e[Uc].trim();i({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[i,n,r]),l=(0,oo.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,Fo.jsx)(Ec,{className:e,headingText:s("options.sendTranscript.title"),cancelButtonText:s("options.cancelButtonText"),description:s("options.sendTranscript.description"),descriptionId:o,position:{vertical:"top",horizontal:"right"},children:(0,Fo.jsx)(Tc,{formId:"sendTranscript",onSubmit:c,validationSchema:a,onError:l,children:(0,Fo.jsx)(Dc,{controlName:Uc,describedById:o})})})}},Bc=()=>{const{optionActive:e}=oi(),t=(0,oo.useRef)(),n=Fc[t.current??e];return e&&(t.current=e),n?(0,Fo.jsx)(n,{}):null},zc=()=>{const{t:e}=wo(),{menuOptions:t,showOption:n,panelActive:r,hideOption:s}=oi(),{id:o}=ii(),i=(0,oo.useRef)(null),[a,c]=(0,oo.useState)(!1),l=(0,oo.useRef)(null),u=t.length,d=(0,oo.useRef)([]),p=(0,oo.useRef)(!1),h=u>1,f=t[0],m=(0,oo.useMemo)((()=>f?.name?.trim().replace(/\s+/g,"")),[f]);return(0,oo.useEffect)((()=>()=>{i.current&&clearTimeout(i.current)}),[]),(0,oo.useEffect)((()=>{a&&!p.current&&requestAnimationFrame((async()=>{await $o(60);const e=t.findIndex((e=>e.available)),n=-1===e?0:e;d.current&&E(d.current[n])})),p.current=a}),[a,t]),u?(0,Fo.jsxs)("div",{className:Zo("options__container"),onKeyDown:e=>{a&&(C(e)===_.Escape&&(c(!1),E(l.current)),C(e)===_.Home&&(d.current&&E(d.current[0]),e.preventDefault()),C(e)===_.End&&(d.current&&E(d.current[u-1]),e.preventDefault()))},onFocusOut:()=>{h&&(i.current=setTimeout((()=>{c(!1)}),200))},onFocusIn:()=>{i.current&&clearTimeout(i.current)},children:[(0,Fo.jsx)(fc,{transitionStartState:hc.notRendered,isActive:r,children:(0,Fo.jsx)("div",{className:Zo("options__dialog"),children:(0,Fo.jsx)(Bc,{})})}),h&&(0,Fo.jsx)(fc,{isActive:a,transitionStartState:hc.notRendered,children:(0,Fo.jsx)("ul",{className:Zo(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":o,children:t.map((({name:r,title:s,available:o},i)=>(0,Fo.jsx)("li",{className:Zo("options__menu__item"),role:"menuitem","data-testid":r,children:(0,Fo.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[i]=e)},className:Zo(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(C(e)===_.ArrowDown){const n=Math.min(u-1,t+1);d.current&&E(d.current[t===n?0:n]),e.preventDefault()}if(C(e)===_.ArrowUp){const n=Math.max(0,t-1);d.current&&E(d.current[t===n?u-1:n]),e.preventDefault()}})(e,i),onKeyPress:e=>((e,n)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let s=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===s&&(s=t)})),-1!==s&&d.current&&E(d.current[s])})(e,i),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,o),"aria-disabled":!o,children:[(0,Fo.jsxs)("span",{className:Zo("button__text"),children:[s,!o&&" "]}),o?null:(0,Fo.jsx)("span",{className:Zo("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,Fo.jsxs)("button",{type:"button",className:Zo(["button","button--secondary","chat__options__button",...!h&&m?[`chat__options__button--${m}`]:[]]),id:o,onClick:()=>{r&&s(),h?c((e=>!e)):f.available&&!r&&n(f.name)},onKeyDown:h?e=>{C(e)===_.ArrowDown&&(c(!0),e.preventDefault())}:void 0,ref:l,"aria-haspopup":!!h&&"menu","aria-expanded":!!h&&a,"aria-disabled":!h&&!f.available,children:[h?(0,Fo.jsx)(gi,{name:"options",size:"32",alt:""}):null,(0,Fo.jsx)("span",{className:Zo("button__text"),children:h?e("options.openButtonText"):`${f.title}${f.available?"":" "}`}),h||f.available?null:(0,Fo.jsx)("span",{className:Zo("button__state"),children:e("options.unavailableText")})]})]}):null};function $c(){const{menuOptions:e,allowOptionSelection:t}=oi(),{isAvailable:n}=Go(),r=In(Mo),{t:s,userLocale:o}=wo(),i=Xo(o);if(!n&&(!t||!e.length)||r)return null;const a=s("translations.settings.openButtonText",{hasLanguage:!!i,language:i});return(0,Fo.jsxs)("div",{className:Zo("chat__options"),children:[n&&(0,Fo.jsx)("div",{className:Zo("chat__options-item","chat__options-item--left"),children:(0,Fo.jsxs)(jc,{classNames:["button--secondary"],children:[(0,Fo.jsx)(gi,{alt:a,name:"newTranslation",size:"16"}),(0,Fo.jsx)("span",{className:Zo("button__text"),children:a})]})}),t&&(0,Fo.jsx)("div",{className:Zo("chat__options-item","chat__options-item--right"),children:(0,Fo.jsx)(zc,{})})]})}const Hc=()=>{const{scrollToRef:e,unreadIds:t}=nc(),{isMinimized:n}=_o(),{t:r}=wo();return(0,Fo.jsx)(fc,{isActive:!!t.length&&!n,children:(0,Fo.jsx)("div",{className:Zo("unread-messages"),children:(0,Fo.jsxs)("button",{type:"button",className:Zo("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,Fo.jsx)(gi,{name:"chevronDown",size:"32",alt:""})]})})})},Vc=({children:e})=>{const t=Jn(),n=(0,oo.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,s.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:o,containerRef:i,unreadIds:a}=(e=>{const t=(0,oo.useRef)(null),[n,r]=(0,oo.useState)(!0),s=In(Ua),o=Jn(),i=Xn(),{isOpen:a}=_o(),c=qn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=In((({state:e})=>e));(0,oo.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:s}=e,o=Math.abs(t-n-s)>10;r(!o)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,oo.useCallback)((()=>{requestAnimationFrame((async()=>{await $o(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,oo.useEffect)((()=>{u&&d()}),[u,d]),(0,oo.useEffect)((()=>{n&&d()}),[n,s,o,i,a,c,l,d]),{containerRef:t,unreadIds:s,scrollToRef:()=>{const n=s.at(0);if(void 0!==n){const r=e[n]?.current;t.current?.scrollTo({top:r?.offsetTop,behavior:"auto",left:0})}},scrollToBottom:d}})(n);return(0,Fo.jsx)(rc.Provider,{value:{eventRefs:n,unreadIds:a,scrollToRef:r,scrollToBottom:o,containerRef:i},children:(0,Fo.jsxs)("div",{className:Zo("chat__container"),children:[(0,Fo.jsx)("div",{className:Zo("chat__container__scroll-area"),ref:i,children:e}),(0,Fo.jsx)(Hc,{})]})})},Wc=({baseClassName:e,children:t,title:n})=>{const r=Zn(),s=di();return(0,Fo.jsxs)("section",{id:r,className:Zo(e),"aria-describedby":s,tabIndex:-1,children:[(0,Fo.jsx)("h2",{className:Zo(`${e}__title`),id:s,children:n}),t]})},qc=()=>{const{t:e}=wo(),t=Wo(),n=ci(),{emitEvent:r}=Io(),{isActive:s,remaining:o,timer:i,endCountdown:a}=li(),c=!!o&&o>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,Fo.jsx)(Wc,{baseClassName:"idle",title:l,children:c&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("div",{className:Zo("idle__count-container"),children:s&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("span",{className:Zo("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,Fo.jsx)("span",{className:Zo("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",i)})]})}),(0,Fo.jsxs)("div",{className:Zo("idle__options"),children:[(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{n(),a(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{a(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},Gc=()=>{const{t:e}=wo(),t=ci(),{name:n}=tr()||{},{continueChat:r,restartChat:s}=ui();return(0,Fo.jsx)(Wc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,Fo.jsxs)("div",{className:Zo("prompt__options"),children:[(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:s,children:e("resumeConversationPrompt.detachButton")})]})})},Kc=()=>{const{sendAction:e}=Io(),{features:t}=oi(),{typingPeekahead:n}=t||{},r=(0,oo.useRef)(null),s=(0,oo.useRef)(null),o=(0,oo.useRef)(!1),i=(0,oo.useRef)(null);(0,oo.useEffect)((()=>()=>{i.current&&clearInterval(i.current),r.current&&clearTimeout(r.current),s.current&&clearTimeout(s.current)}),[]);const a=(t,r)=>{e({type:L,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(o.current=!0,i.current||(a(!0,e.target.value),i.current=setInterval((()=>{!o.current&&i.current?(clearInterval(i.current),i.current=null):n&&n.enabled&&a(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),s.current&&clearTimeout(s.current),r.current=setTimeout((()=>{o.current=!1}),300),s.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}},Jc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:s}=qn().entryMeta,o=so(),i=n||t||e,a=s[i]||r[i]||{},c=(0,oo.useCallback)((e=>{o(ys(e))}),[o]),l=(0,oo.useCallback)((e=>{o(fs(e))}),[o]),u=(0,oo.useCallback)((e=>{o(Ps(e))}),[o]),d=(0,oo.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:i,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Xc({controlName:e,skipLinkId:t}){const{t:n}=wo(),{sendAssertive:r}=Oo(),{emitEvent:s}=Io(),o=Kc(),{setBlockAutoEntrySwitch:i}=Jc(),{placeholder:a,label:c,labelClass:l}=Qa(e),{hasCharacterLimit:u,reachedCharacterWarning:d,reachedCharacterLimit:p,remainingChars:h}=Za(e),[{value:f}]=Ya(e),m=!!f,y=(0,oo.useCallback)((()=>{d&&r(n("input.srCharacterLimitText",{limit:h})),s("ui.inputFocus")}),[n,r,d,h,s]);return(0,oo.useLayoutEffect)((()=>(i(m),()=>{i(!1)})),[i,m]),(0,Fo.jsxs)(Oc,{className:Zo("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,Fo.jsxs)("div",{className:Zo(["input--text__container",...d&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,Fo.jsx)(Pc,{id:t,type:"text",name:e,className:Zo("input__text"),autocomplete:"off",placeholder:a,labelText:c,labelClass:Zo(l),"aria-invalid":!!u&&p,onKeyUp:o,onFocus:y}),(0,Fo.jsx)("div",{className:Zo("character-count"),children:d&&(0,Fo.jsx)("span",{children:h})})]}),(0,Fo.jsx)("button",{className:Zo("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!m||p,children:(0,Fo.jsx)(gi,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const Yc="textMessageEntry";function Zc({...e}){const{isOpen:t,setVisibility:n}=_o(),r=Zn(),s=Wo(),{sendMessage:o}=Io(),i=(0,oo.useCallback)(((e,{updateControlValue:r})=>{o({body:e[Yc]}),r(Yc,""),s(),t||n(vn.open)}),[o,s,t,n]);return(0,Fo.jsx)(Tc,{...e,formId:"textEntry",persistData:!0,onSubmit:i,children:(0,Fo.jsx)(Xc,{controlName:Yc,skipLinkId:r})})}const Qc=()=>{const{t:e}=wo(),{currentUploads:t}=si();return(0,Fo.jsx)("div",{className:Zo("progress"),children:t.map((({id:t,name:n,progress:r,uploading:s,error:o})=>(0,Fo.jsxs)("div",{className:Zo("progress_container"),children:[(0,Fo.jsxs)("div",{className:Zo("progress__text"),children:[(0,Fo.jsx)("span",{className:Zo("progress__text--file-name"),children:n}),(0,Fo.jsx)("span",{className:Zo("progress__text--percentage"),children:`${r}%`})]}),(0,Fo.jsx)(Lc,{error:o,id:"progress-error"}),(0,Fo.jsx)("progress",{className:Zo("progress__bar"),role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-label":e("fileUpload.srProgressLabel",{fileName:n}),max:"100","aria-valuenow":r,value:r,"aria-busy":s,children:`${r}%`})]},t)))})};function el({id:e,name:t,labelText:n,contentHint:r,outputText:s,accept:o}){const{isSubmitted:i}=Xa(),[a,c]=(0,oo.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=Ya(t),p=di(),h=di(),f=di(),m=i&&d,y=[f];r&&y.push(h),m&&y.push(p);const v=(0,oo.useCallback)((()=>{c(!0)}),[c]),g=(0,oo.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,oo.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,Fo.jsxs)("div",{className:Zo("upload__container"),children:[r&&(0,Fo.jsx)("span",{className:Zo("upload__content-hint"),id:h,children:r}),(0,Fo.jsx)(Lc,{id:p,error:m&&d}),(0,Fo.jsx)("div",{className:Zo(["file-upload",...a?["focus-within"]:[]]),children:(0,Fo.jsxs)("label",{htmlFor:e,className:Zo("upload__label"),children:[(0,Fo.jsx)(gi,{name:"upload",size:"32",alt:""}),(0,Fo.jsxs)("div",{children:[(0,Fo.jsx)("span",{className:Zo(["upload__label--text"]),children:n}),(0,Fo.jsx)("input",{id:e,className:Zo("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:o||null,onFocus:v,onBlur:g}),(0,Fo.jsx)("span",{className:Zo("upload__output"),"aria-hidden":"true",id:f,children:s})]})]})})]})}const tl=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:s,isComplete:o,onClickCancel:i})=>{const{t:a}=wo(),[{value:c}]=Ya(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,Fo.jsxs)(Oc,{className:Zo("upload-form"),children:[(0,Fo.jsx)(el,{name:t,id:e,accept:n,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,Fo.jsxs)("div",{className:Zo("upload__button-container"),children:[(0,Fo.jsx)("button",{id:s||!o?e:void 0,type:"button",onClick:i,className:Zo("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,Fo.jsx)("button",{className:Zo("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})},nl="fileListForm",rl="fileList",sl=()=>{const{t:e}=wo(),{sendPolite:t,sendAssertive:n}=Oo(),r=Zn(),s=Wo(),{serviceAllowsUploads:o,allowedMimeTypes:i,maxSize:a}=ri(),c=(0,oo.useRef)(null),l=(0,oo.useRef)(o),{cancelEntrySelection:u}=Jc(),{uploadFile:d,clearUploads:p,isUploading:h,isComplete:f}=si(),{uploadHandle:m,hasServerError:y,progress:v}=((e,t)=>{const n=In((n=>Va(n,{formId:e,name:t}))),{currentUploads:r}=si(),s=n&&n.length>0;let o=null,i=!1,a=0;if(r&&r.length>0){const e=r[0];o=e.uploadHandle,i=!!e.error,a=e.progress}return{hasFile:s,selectedFileName:s?n[0].name:"",uploadHandle:o,hasServerError:i,progress:a}})(nl,rl),g=di(),b=(0,oo.useRef)(!0),w=e("fileUpload.contentHint",{size:x(a)}),_=(0,oo.useRef)(""),C=(0,oo.useRef)(null);(0,oo.useEffect)((()=>{_.current&&C.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(w),_.current=w}),[w,n]),(0,oo.useEffect)((()=>{v>0&&t(1===v?e("fileUpload.srStartedText"):`${v}%`)}),[v,t,e]),(0,oo.useEffect)((()=>{b.current||h||!f||(p(),u(),s(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=f}),[h,f,p,u,s,t,e]);const E=(0,oo.useCallback)((({fileList:e})=>{d(e[0]),s()}),[d,!1,s]),S=(0,oo.useCallback)((()=>{m&&m.abort(),p(),u(),s()}),[m,p,u,s]),j=(0,oo.useMemo)((()=>({[rl]:[kc((()=>o),e("fileUpload.errors.unavailable")),kc(Ac,e("fileUpload.errors.noFile")),kc(Nc,e("fileUpload.errors.tooLarge"),a)]})),[a,o,e]);return(0,Fo.jsx)("div",{className:Zo(["upload",...y?["upload--error"]:[]]),ref:C,children:(0,Fo.jsxs)(Tc,{formId:nl,persistData:!0,onSubmit:E,validationSchema:j,children:[(h||!f)&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)(Qc,{}),(0,Fo.jsx)("div",{className:Zo("upload__button-container"),children:(0,Fo.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,ref:c,className:Zo("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&f&&(0,Fo.jsx)(tl,{controlName:rl,skiplinkId:r,accept:i?.join(", ")||"",contentHint:w,isComplete:f,isUploading:h,onClickCancel:S}),!l.current&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("span",{className:Zo("notification"),id:g,children:e("fileUpload.unavailableText")}),(0,Fo.jsx)("div",{className:Zo("upload__button-container"),children:(0,Fo.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,className:Zo("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},ol=()=>{const{t:e}=wo(),{showFileUpload:t,serviceAllowsUploads:n}=ri(),[r,s]=(0,oo.useState)(n||!1),o=Wo(),i=(0,oo.useRef)(null),{setUserEntryType:a,activeEntry:c}=Jc(),l=(0,oo.useRef)(null),{sendPolite:u}=Oo(),d=!!tr();return(0,oo.useEffect)((()=>{S(l.current,(()=>{n||o()})),s(n||!1)}),[n,o]),(0,oo.useEffect)((()=>{i.current&&!n&&u(e("fileUpload.srUnavailableText")),!1===i.current&&n&&u(e("fileUpload.srAvailableText")),d&&(i.current=n)}),[n,d,u,e]),t||c===A?null:(0,Fo.jsx)(fc,{isActive:r,transitionStartState:hc.rendered,children:(0,Fo.jsx)("div",{className:Zo("upload-toggle-wrapper"),children:(0,Fo.jsx)(fc,{isActive:r,transitionStartState:hc.visuallyHidden,children:(0,Fo.jsx)("button",{className:Zo(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{a(A),o()}:void 0,children:(0,Fo.jsx)(gi,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},il=()=>{const{isOpen:e}=_o(),t=(0,oo.useRef)(null),{hasCountdown:n}=li(),[r,s]=(0,oo.useState)(n),{hasPrompt:o}=ui(),[i,a]=(0,oo.useState)(o),c=Wo(),l=(0,oo.useRef)(!1),{activeEntry:u}=Jc(),[d,p]=(0,oo.useState)({text:Zc,upload:sl}),[h,f]=(0,oo.useState)((()=>u)),m=Hn(),{accountAllowsUploads:y}=ri(),v=(0,oo.useCallback)((()=>{S(t.current,c)}),[c]);(0,oo.useEffect)((()=>{const{customComponents:e}=m,{entry:t}=e||{};t&&p((e=>({...e,...t})))}),[m]),(0,oo.useEffect)((()=>{v(),s(n),a(o)}),[n,o,v]),(0,oo.useEffect)((()=>{f(u),v()}),[u,v,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const g=d[h];return(0,Fo.jsxs)("div",{className:Zo("chat__entry"),ref:t,children:[r&&(0,Fo.jsx)(qc,{}),i&&(0,Fo.jsx)(Gc,{}),(0,Fo.jsxs)("div",{className:Zo(["entry__body",...n||o?["entry__body--hidden"]:[]]),children:[h!==A&&y&&e?(0,Fo.jsx)(ol,{}):null,(0,Fo.jsx)(g,{})]})]})},al=()=>{const{t:e}=wo(),{isOpen:t,closeChat:n}=_o(),{isWindow:r}=rr();return t&&r?(0,Fo.jsx)("button",{type:"button",className:Zo("button","collapse-button"),onClick:n,children:(0,Fo.jsx)(gi,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},cl=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:s,srText:o}}=Po(),i=Io(),a=di(),{sendPolite:c}=Oo(),l=Wo(),u="SeamlySessionExpiredError"===e?.name;return(0,oo.useEffect)((()=>{!u&&o&&setTimeout((()=>{c(o)}),200)}),[c,o,u]),u?(0,Fo.jsx)(Fo.Fragment,{}):(0,Fo.jsxs)("section",{className:Zo("interrupt"),"aria-labelledby":a,children:[(0,Fo.jsx)(al,{}),(0,Fo.jsxs)("div",{className:Zo("interrupt__body"),children:[(0,Fo.jsx)("h2",{id:a,className:Zo("interrupt__title"),children:t}),(0,Fo.jsx)("p",{className:Zo("interrupt__message"),children:n}),r&&s&&(0,Fo.jsx)("div",{className:Zo("interrupt__actions"),children:(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{s&&i[s]&&i[s](),l()},children:r})})]})]})},ll=function({children:e}){const t=In(Mo),{isOpen:n}=_o();return t?(0,Fo.jsx)(cl,{}):(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsxs)(Vc,{children:[(0,Fo.jsxs)("div",{className:Zo("chat__container__header"),children:[(0,Fo.jsx)(wc,{}),(0,Fo.jsx)(al,{})]}),e]}),(0,Fo.jsx)(il,{}),n&&(0,Fo.jsx)($c,{})]})};function ul({event:e}){const[t]=sc(e);return(0,Fo.jsx)("li",{children:(0,Fo.jsx)(t,{event:e})})}function dl({events:e}){return(0,Fo.jsx)("ul",{className:Zo("collapsed-chat-messages"),children:e.map((e=>(0,Fo.jsx)(ul,{event:e},e.payload.id)))})}function pl(){const{preChatEvents:e}=Hn(),t=In(Mo),{isOpen:n}=_o();return t||!e?.length||n?null:(0,Fo.jsx)(dl,{events:e})}function hl(){const{t:e}=wo(),t=e("window.chat.continue"),n=(0,oo.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t}}})),[t]);return(0,Fo.jsx)(dl,{events:[n]})}const fl=()=>{const e=Vn(),t=tr(),n=In(Mo),r=t&&!n,s=r?t.avatar:e;return s?(0,Fo.jsx)("img",{className:Zo(r?"avatar":"icon"),src:s,alt:""}):(0,Fo.jsx)(gi,{name:"avatar",size:"32",alt:""})},ml=({onClick:e})=>{const t=Ro(),{t:n}=wo(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),s=Wo(),{isOpen:o}=_o(),i=Yn(),a=(0,oo.useCallback)((()=>{e(),s()}),[s,e]);return(0,Fo.jsx)(fc,{isActive:!o,transitionStartState:hc.rendered,children:(0,Fo.jsxs)("button",{className:Zo("window-open-button"),"aria-label":r,"aria-hidden":o,onClick:a,children:[(0,Fo.jsx)(fc,{isActive:!!i,transitionStartState:hc.notRendered,children:(0,Fo.jsx)("span",{className:Zo("message-count"),"aria-hidden":"true",children:i})}),(0,Fo.jsx)(fl,{})]})})},yl=(e,t,n)=>"object"==typeof e?e[t]:n,vl=n.p+"sounds/beep.mp3",gl=!!window.Notification,bl={app:()=>(0,Fo.jsx)(vc,{children:(0,Fo.jsx)(ll,{children:(0,Fo.jsx)(cc,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=so(),{connectWhenInView:t}=Hn(),n=In(or),{containerRef:r,isVisible:s}=Co({enabled:t,freezeOnceVisible:!0});return(0,oo.useEffect)((()=>{s&&e(to())}),[e,s]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=_o();return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)(fc,{isActive:!n,transitionStartState:hc.rendered,children:(0,Fo.jsxs)("div",{ref:t,className:Zo("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,Fo.jsx)(pl,{}),(0,Fo.jsx)(mc,{})]})}),(0,Fo.jsx)(fc,{isActive:n,transitionStartState:hc.rendered,children:(0,Fo.jsx)(vc,{ref:t,children:e&&(0,Fo.jsx)(ll,{children:n&&(0,Fo.jsx)(cc,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=_o(),n=Eo(),{continueChat:r,preChat:s}=Hn();return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)(ml,{onClick:t}),(0,Fo.jsx)(fc,{isActive:!!s&&!e&&!n,exitAfter:yl(s,"exitAfter"),enterDelay:yl(s,"enterDelay"),transitionStartState:hc.notRendered,children:(0,Fo.jsx)("div",{className:Zo("unstarted-wrapper","unstarted-wrapper--window"),children:(0,Fo.jsx)(pl,{})})}),(0,Fo.jsx)(fc,{isActive:r&&!e&&n,exitAfter:yl(r,"exitAfter"),enterDelay:yl(r,"enterDelay"),transitionStartState:hc.notRendered,children:(0,Fo.jsx)("div",{className:Zo("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,Fo.jsx)(hl,{})})}),(0,Fo.jsx)(fc,{isActive:e,transitionStartState:hc.notRendered,children:(0,Fo.jsx)(vc,{children:(0,Fo.jsx)(ll,{children:(0,Fo.jsx)(cc,{})})})})]})}};function xl(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const wl=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=Qn(),{notificationAudioURL:t}=Hn(),[n,r]=(0,oo.useState)(gl?Notification.permission:"default"),[s,o]=(0,oo.useState)(document.visibilityState),i=In(Fa),a=(0,oo.useCallback)((async()=>{if(gl&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,oo.useMemo)((()=>"granted"===n),[n]),l=(0,oo.useMemo)((()=>"hidden"===s),[s]);(0,oo.useEffect)((()=>{"default"===n&&e&&a()}),[n,e,a]);const u=(0,oo.useCallback)((async(e,r)=>{if(i&&gl){if("default"===n&&a(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||vl);await e.play()}catch(e){console.warn(e)}if(c&&(l||!document.hasFocus())){const t=new Notification(e,r);t.onclick=function(){window.parent.focus(),window.focus(),t.close();const e=document.querySelector(`input[name=${Yc}]`);e&&e.focus()}}}}),[t,n,c,a,i,l]);return(0,oo.useEffect)((()=>{if(!i)return()=>{};function e(){o(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[i]),{permission:n,requestPermission:a,sendNotification:u}})(),[,n]=Ho(),r=Hn(),s=tr(),{proactiveMessages:o}=Qn(),{isOpen:i,isVisible:a}=_o(),c=Qo(),l=Eo(),u=In(Da),{body:d}=Ko(u),{userLocale:p}=wo(),h=(0,oo.useRef)(void 0),f=(0,oo.useMemo)((()=>d?"string"==typeof d?xl(d):"text"in d?xl(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?xl(d.prompt?.text):"":""),[d]);(0,oo.useEffect)((()=>{s?.name&&f&&o&&u&&h.current!==u.payload?.id&&(t(s.name,{body:f,icon:s?.avatar}),h.current=u.payload.id)}),[s?.avatar,s?.name,u,f,o,t]);const m=bl[r.layoutMode],y=(0,oo.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),v=(0,oo.useMemo)((()=>{if(p){const e=document.querySelector("html")?.getAttribute("lang");if(e!==p)return p}}),[p]);if(!m)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const g=["app",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];return"function"!=typeof c?g.push(...c):g.push(...c(r)),i||"app"===r.layoutMode||g.push("app--collapsed"),l&&g.push("app--user-responded"),a?(0,Fo.jsx)("div",{className:Zo(g),lang:v,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,Fo.jsx)(m,{})}):null},_l=e=>(0,Fo.jsx)(Ma,{...e,children:(0,Fo.jsx)(wl,{})});class Cl{constructor(e,n){const{namespace:r="",parentElement:s,...o}=e;this.config={...o,namespace:r},this.namespace=r,this.parentElement=s,this.externalApi=n,this.api=new we({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(t()),this.functions={},this.registerFunctions({on:this.eventBus.on,off:this.eventBus.off}),this.eventBus.on("function.register",((e,t)=>this.registerFunction(e,t))),this.eventBus.on("function.unregister",((e,t)=>this.unregisterFunction(e,t)))}async render(){const{view:e,...t}=this.config.customComponents||{},n={...this.config,parentElement:this.parentElement,customComponents:Object.keys(t).length?t:void 0},r=ro({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(fr(n)),await r.dispatch(hn()),await r.dispatch(lr()),r.dispatch(cr()),e?(0,s.render)((0,Fo.jsx)(Ma,{eventBus:this.eventBus,store:r,api:this.api,children:(0,Fo.jsx)(e,{})}),this.parentElement):(0,s.render)((0,Fo.jsx)(_l,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,s.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),this.functions={}}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const n=this.functions[e];n&&n.length&&(this.functions[e]=n.filter((e=>e!==t)))}execFunction(e,...t){const n=this.functions[e];return!(!n||!n.length||(n.forEach((n=>{try{n(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}const El=e=>"object"==typeof e&&"action"in e,Sl=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),jl=class{constructor(e){this._waitingActions=[],this._instances={},this._timeoutId=void 0,this.appConfig=e,this.context={}}push(...e){(e=e.filter(El).map(Sl)).length&&(this._waitingActions.push(...e),this.handleActions())}handleActions(){const e=this._waitingActions;this._waitingActions=[],e.forEach((e=>{switch(e.action){case"init":this.handleInit(e);break;case"destroy":this.handleDestroy(e);break;default:this.handleAction(e)||this.setContext(e.action,...e.args)||this._waitingActions.push(e)}}))}instanceInitializing(e){const t=Object.keys(this._instances);return!e&&t.length>0||t.includes(e)}setContext(e,t){const{instance:n}=t;if(this.instanceInitializing(n))return!1;switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:n,locale:r}=t;return n&&r&&(this.context.userLocale=r,this.context.source=$),!0;case"setContext":const{userLocale:s,contentLocale:o}=t;return this.context.userLocale=s,this.context.contentLocale=o,s&&s!=this.appConfig?.userLocale&&(this.context.source=$),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables={...t}),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace:s}=n||t;if(s?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==s||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},window.clearTimeout(this._timeoutId),this._timeoutId=window.setTimeout((()=>{e.render()}),60)}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,s=Object.values(this._instances);return!n&&s.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),s.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new Cl(e,this)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){const t={...e.context||this.appConfig.context,...this.context},n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r={...this.appConfig.defaults,...e.defaults},s={...this.appConfig,...e,api:{...this.appConfig.api,...e.api},context:Object.keys(t).length?t:void 0,defaults:Object.keys(r).length?r:void 0};return"function"==typeof this.appConfig?this.appConfig(s):s}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},Tl=()=>{const e=so();return{addEvent:t=>e(ns(t)),clearEvents:()=>e(ss()),setHistory:t=>e(_s(t)),setEventsRead:t=>e(vs(t)),setLoadedImageEventIds:t=>e(Ss(t)),ackEvent:t=>e(ts(t)),setIsLoading:t=>e(Es(t)),setParticipant:t=>e(js(t)),setHeaderTitle:t=>e(ws(t)),setHeaderSubTitle:t=>e(xs(t)),resetHistoryLoadedFlag:()=>e(hs()),setActiveService:t=>e(ms(t)),initIdleDetachCountdown:t=>e(us(t)),decrementIdleDetachCountdownCounter:()=>e(cs()),stopIdleDetachCountdownCounter:()=>e(Bs()),clearIdleDetachCountdown:()=>e(is()),initResumeConversationPrompt:()=>e(ds()),clearResumeConversationPrompt:()=>e(as()),setServiceDataItem:t=>e(ks(t)),setFeatures:t=>e(bs(t)),setFeatureEnabledState:t=>e(gs(t)),clearFeatures:()=>e(os()),setInitialState:t=>e(Cs(t)),setUserSelectedOptions:t=>e(Us(t)),setUserSelectedOption:t=>e(Ds(t)),showOption:t=>e(Fs(t)),hideOption:()=>e(ls()),setServiceEntryMetadata:t=>e(Ns(t)),setBlockAutoEntrySwitch:t=>e(ys(t)),setActiveEntryType:t=>e(fs(t)),setUserEntryType:t=>e(Ps(t)),registerUpload:t=>e(ps(t)),setUploadProgress:t=>e(Os(t)),setUploadComplete:t=>e(Rs(t)),setUploadError:t=>e(Is(t)),clearAllUploads:()=>e(rs()),setSeamlyContainerElement:t=>e(Ts(t))}},kl=()=>{const{t:e}=wo(),{title:t,subTitle:n}=qn().headerTitles,r=Yn(),{isOpen:s}=_o(),o=tr(),i=In(Mo),a=Vn(),c=o?.avatar??a,l=i?"":n,u=["message-count"];return s&&u.push("message-count__hide"),0===r&&u.push("message-count__empty"),l||!s?(0,Fo.jsxs)("div",{className:Zo("agent-info"),children:[(0,Fo.jsxs)("div",{className:Zo("agent-info__graphic"),children:[c?(0,Fo.jsx)("img",{className:Zo(o?.avatar?"avatar":"icon"),src:c,alt:""}):(0,Fo.jsx)(gi,{name:"avatar",size:"32",alt:""}),(0,Fo.jsx)("span",{className:Zo(u),"aria-hidden":"true",children:r})]}),(0,Fo.jsxs)("div",{className:Zo("agent-info__body"),children:[(0,Fo.jsx)("p",{className:Zo("agent-info__heading"),children:t??e("header.title")}),(0,Fo.jsx)("p",{className:Zo("agent-info__text"),children:l})]})]}):null},Nl=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:n}=qn(),r=(0,oo.useRef)(null),{t:s}=wo();return(0,Fo.jsxs)("header",{className:Zo("chat__header"),children:[e,(0,Fo.jsx)("div",{className:Zo("header-controls"),children:(0,Fo.jsx)("button",{type:"button",className:Zo("button","header-controls__collapse"),onClick:t,ref:r,id:n,children:(0,Fo.jsx)(gi,{name:"chevronDown",size:"32",alt:s("header.collapseApp")})})})]})},Al=function(e){if(window.seamly&&!Array.isArray(window.seamly))throw new Error("Seamly UI has already been initialised. Use the window.seamly object to start new instances instead.");const t=Array.isArray(window.seamly)?window.seamly:[],n=new jl(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
|
|
2
|
+
(()=>{var e={2086:e=>{e.exports=function(e){var t={},n=[];(e=e||this).on=function(n,r,s){return(t[n]=t[n]||[]).push([r,s]),e},e.off=function(r,s){r||(t={});for(var o=t[r]||n,i=o.length=s?o.length:0;i--;)s==o[i][0]&&o.splice(i,1);return e},e.emit=function(r){for(var s,o=t[r]||n,i=o.length>0?o.slice(0,o.length):o,a=0;s=i[a++];)s[0].apply(s[1],n.slice.call(arguments,1));return e}}},7402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>f,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>c,StrictMode:()=>te,Suspense:()=>b,SuspenseList:()=>C,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>X,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>q,createPortal:()=>j,createRef:()=>r.createRef,default:()=>le,findDOMNode:()=>Z,flushSync:()=>ee,forwardRef:()=>p,hydrate:()=>L,isElement:()=>ie,isFragment:()=>K,isMemo:()=>J,isValidElement:()=>G,lazy:()=>w,memo:()=>l,render:()=>O,startTransition:()=>ne,unmountComponentAtNode:()=>Y,unstable_batchedUpdates:()=>Q,useDeferredValue:()=>re,useInsertionEffect:()=>oe,useSyncExternalStore:()=>ae,useTransition:()=>se,version:()=>W});var r=n(8785),s=n(1162),o={};for(const e in s)["default","Component","Fragment","createContext","createElement","createRef","Children","PureComponent","StrictMode","Suspense","SuspenseList","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","cloneElement","createFactory","createPortal","findDOMNode","flushSync","forwardRef","hydrate","isElement","isFragment","isMemo","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(o[e]=()=>s[e]);function i(e,t){for(var n in t)e[n]=t[n];return e}function a(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function c(e,t){this.props=e,this.context=t}function l(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:a(this.props,e)}function s(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return s.displayName="Memo("+(e.displayName||e.name)+")",s.prototype.isReactComponent=!0,s.__f=!0,s}n.d(t,o),(c.prototype=new r.Component).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return a(this.props,e)||a(this.state,t)};var u=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),u&&u(e)};var d="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function p(e){function t(t){var n=i({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=d,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var h=function(e,t){return null==e?null:(0,r.toChildArray)((0,r.toChildArray)(e).map(t))},f={map:h,forEach:h,count:function(e){return e?(0,r.toChildArray)(e).length:0},only:function(e){var t=(0,r.toChildArray)(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:r.toChildArray},m=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var s,o=t;o=o.__;)if((s=o.__c)&&s.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),s.__c(e,t);m(e,t,n,r)};var y=r.options.unmount;function v(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=i({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return v(e,t,n)}))),e}function g(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return g(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function b(){this.__u=0,this.t=null,this.__b=null}function x(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function w(e){var t,n,s;function o(o){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){s=e})),s)throw s;if(!n)throw t;return(0,r.createElement)(n,o)}return o.displayName="Lazy",o.__f=!0,o}function C(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),y&&y(e)},(b.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var s=x(r.__v),o=!1,i=function(){o||(o=!0,n.__R=null,s?s(a):a())};n.__R=i;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=g(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},b.prototype.componentWillUnmount=function(){this.t=[]},b.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),s=this.__v.__k[0].__c;this.__v.__k[0]=v(this.__b,n,s.__O=s.__P)}this.__b=null}var o=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return o&&(o.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),o]};var _=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function E(e){return this.getChildContext=function(){return e.context},e.children}function S(e){var t=this,n=e.i;t.componentWillUnmount=function(){(0,r.render)(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),(0,r.render)((0,r.createElement)(E,{context:t.context},e.__v),t.l)}function j(e,t){var n=(0,r.createElement)(S,{__v:e,i:t});return n.containerInfo=t,n}(C.prototype=new r.Component).__a=function(e){var t=this,n=x(t.__v),r=t.o.get(e);return r[0]++,function(s){var o=function(){t.props.revealOrder?(r.push(s),_(t,e,r)):s()};n?n(o):o()}},C.prototype.render=function(e){this.u=null,this.o=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},C.prototype.componentDidUpdate=C.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){_(e,n,t)}))};var T="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,k=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,N=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,A=/[A-Z0-9]/g,R="undefined"!=typeof document,I=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function O(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function L(e,t,n){return(0,r.hydrate)(e,t),"function"==typeof n&&n(),e?e.__c:null}r.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(r.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var M=r.options.event;function P(){}function D(){return this.cancelBubble}function U(){return this.defaultPrevented}r.options.event=function(e){return M&&(e=M(e)),e.persist=P,e.isPropagationStopped=D,e.isDefaultPrevented=U,e.nativeEvent=e};var F,B={enumerable:!1,configurable:!0,get:function(){return this.class}},z=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,s={};for(var o in t){var i=t[o];if(!("value"===o&&"defaultValue"in t&&null==i||R&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var a=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===i?i="":"translate"===a&&"no"===i?i=!1:"ondoubleclick"===a?o="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||I(t.type)?"onfocus"===a?o="onfocusin":"onblur"===a?o="onfocusout":N.test(o)?o=a:-1===n.indexOf("-")&&k.test(o)?o=o.replace(A,"-$&").toLowerCase():null===i&&(i=void 0):a=o="oninput","oninput"===a&&s[o=a]&&(o="oninputCapture"),s[o]=i}}"select"==n&&s.multiple&&Array.isArray(s.value)&&(s.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=s.value.indexOf(e.props.value)}))),"select"==n&&null!=s.defaultValue&&(s.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=s.multiple?-1!=s.defaultValue.indexOf(e.props.value):s.defaultValue==e.props.value}))),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",B)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(e),e.$$typeof=T,z&&z(e)};var $=r.options.__r;r.options.__r=function(e){$&&$(e),F=e.__c};var H=r.options.diffed;r.options.diffed=function(e){H&&H(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),F=null};var V={ReactCurrentDispatcher:{current:{readContext:function(e){return F.__n[e.__c].props.value},useCallback:s.useCallback,useContext:s.useContext,useDebugValue:s.useDebugValue,useDeferredValue:re,useEffect:s.useEffect,useId:s.useId,useImperativeHandle:s.useImperativeHandle,useInsertionEffect:oe,useLayoutEffect:s.useLayoutEffect,useMemo:s.useMemo,useReducer:s.useReducer,useRef:s.useRef,useState:s.useState,useSyncExternalStore:ae,useTransition:se}}},W="17.0.2";function q(e){return r.createElement.bind(null,e)}function G(e){return!!e&&e.$$typeof===T}function K(e){return G(e)&&e.type===r.Fragment}function J(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function X(e){return G(e)?r.cloneElement.apply(null,arguments):e}function Y(e){return!!e.__k&&((0,r.render)(null,e),!0)}function Z(e){return e&&(e.base||1===e.nodeType&&e)||null}var Q=function(e,t){return e(t)},ee=function(e,t){return e(t)},te=r.Fragment;function ne(e){e()}function re(e){return e}function se(){return[!1,ne]}var oe=s.useLayoutEffect,ie=G;function ae(e,t){var n=t(),r=(0,s.useState)({h:{__:n,v:t}}),o=r[0].h,i=r[1];return(0,s.useLayoutEffect)((function(){o.__=n,o.v=t,ce(o)&&i({h:o})}),[e,n,t]),(0,s.useEffect)((function(){return ce(o)&&i({h:o}),e((function(){ce(o)&&i({h:o})}))}),[e]),n}function ce(e){var t,n,r=e.v,s=e.__;try{var o=r();return!((t=s)===(n=o)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var le={useState:s.useState,useId:s.useId,useReducer:s.useReducer,useEffect:s.useEffect,useLayoutEffect:s.useLayoutEffect,useInsertionEffect:oe,useTransition:se,useDeferredValue:re,useSyncExternalStore:ae,startTransition:ne,useRef:s.useRef,useImperativeHandle:s.useImperativeHandle,useMemo:s.useMemo,useCallback:s.useCallback,useContext:s.useContext,useDebugValue:s.useDebugValue,version:"17.0.2",Children:f,render:O,hydrate:L,unmountComponentAtNode:Y,createPortal:j,createElement:r.createElement,createContext:r.createContext,createFactory:q,cloneElement:X,createRef:r.createRef,Fragment:r.Fragment,isValidElement:G,isElement:ie,isFragment:K,isMemo:J,findDOMNode:Z,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:ee,unstable_batchedUpdates:Q,StrictMode:te,Suspense:b,SuspenseList:C,lazy:w,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:V}},7154:(e,t,n)=>{"use strict";var r=n(7402),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useSyncExternalStore,i=r.useRef,a=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=i(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=c((function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return i=t}return i=e}if(t=i,s(o,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(o=e,i=n)}var o,i,a=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,u]);var h=o(e,d[0],d[1]);return a((function(){p.hasValue=!0,p.value=h}),[h]),l(h),h}},8418:(e,t,n)=>{"use strict";e.exports=n(7154)},8785:e=>{"use strict";e.exports=require("preact")},1162:e=>{"use strict";e.exports=require("preact/hooks")},9497:(e,t,n)=>{"use strict";n(8107);var r=n(7015);e.exports=r("Array","at")},9306:(e,t,n)=>{"use strict";var r=n(4901),s=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(s(e)+" is not a function")}},3506:(e,t,n)=>{"use strict";var r=n(3925),s=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o("Can't set "+s(e)+" as a prototype")}},7080:(e,t,n)=>{"use strict";var r=n(4402).has;e.exports=function(e){return r(e),e}},6469:(e,t,n)=>{"use strict";var r=n(8227),s=n(2360),o=n(4913).f,i=r("unscopables"),a=Array.prototype;void 0===a[i]&&o(a,i,{configurable:!0,value:s(null)}),e.exports=function(e){a[i][e]=!0}},679:(e,t,n)=>{"use strict";var r=n(1625),s=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new s("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),s=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(s(e)+" is not an object")}},9617:(e,t,n)=>{"use strict";var r=n(5397),s=n(5610),o=n(6198),i=function(e){return function(t,n,i){var a=r(t),c=o(a);if(0===c)return!e&&-1;var l,u=s(i,c);if(e&&n!=n){for(;c>u;)if((l=a[u++])!=l)return!0}else for(;c>u;u++)if((e||u in a)&&a[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},4527:(e,t,n)=>{"use strict";var r=n(3724),s=n(4376),o=TypeError,i=Object.getOwnPropertyDescriptor,a=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=a?function(e,t){if(s(e)&&!i(e,"length").writable)throw new o("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},4576:(e,t,n)=>{"use strict";var r=n(9504),s=r({}.toString),o=r("".slice);e.exports=function(e){return o(s(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),s=n(4901),o=n(4576),i=n(8227)("toStringTag"),a=Object,c="Arguments"===o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=a(e),i))?n:c?o(t):"Object"===(r=o(t))&&s(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),s=n(5031),o=n(7347),i=n(4913);e.exports=function(e,t,n){for(var a=s(t),c=i.f,l=o.f,u=0;u<a.length;u++){var d=a[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},6699:(e,t,n)=>{"use strict";var r=n(3724),s=n(4913),o=n(6980);e.exports=r?function(e,t,n){return s.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6840:(e,t,n)=>{"use strict";var r=n(4901),s=n(4913),o=n(283),i=n(9433);e.exports=function(e,t,n,a){a||(a={});var c=a.enumerable,l=void 0!==a.name?a.name:t;if(r(n)&&o(n,l,a),a.global)c?e[t]=n:i(t,n);else{try{a.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:s.f(e,t,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return e}},9433:(e,t,n)=>{"use strict";var r=n(4475),s=Object.defineProperty;e.exports=function(e,t){try{s(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,n)=>{"use strict";var r=n(4475),s=n(34),o=r.document,i=s(o)&&s(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},6837:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},5002:e=>{"use strict";e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},9392:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7388:(e,t,n)=>{"use strict";var r,s,o=n(4475),i=n(9392),a=o.process,c=o.Deno,l=a&&a.versions||c&&c.version,u=l&&l.v8;u&&(s=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!s&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(s=+r[1]),e.exports=s},7015:(e,t,n)=>{"use strict";var r=n(4475),s=n(9504);e.exports=function(e,t){return s(r[e].prototype[t])}},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(e,t,n)=>{"use strict";var r=n(9504),s=Error,o=r("".replace),i=String(new s("zxcasd").stack),a=/\n\s*at [^:]*:[^\n]*/,c=a.test(i);e.exports=function(e,t){if(c&&"string"==typeof e&&!s.prepareStackTrace)for(;t--;)e=o(e,a,"");return e}},6518:(e,t,n)=>{"use strict";var r=n(4475),s=n(7347).f,o=n(6699),i=n(6840),a=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n,u,d,p,h,f=e.target,m=e.global,y=e.stat;if(n=m?r:y?r[f]||a(f,{}):r[f]&&r[f].prototype)for(u in t){if(p=t[u],d=e.dontCallGetSet?(h=s(n,u))&&h.value:n[u],!l(m?u:f+(y?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&o(p,"sham",!0),i(n,u,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,n)=>{"use strict";var r=n(616),s=Function.prototype.call;e.exports=r?s.bind(s):function(){return s.apply(s,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),s=n(9297),o=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,a=s(o,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&i(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},6706:(e,t,n)=>{"use strict";var r=n(9504),s=n(9306);e.exports=function(e,t,n){try{return r(s(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},9504:(e,t,n)=>{"use strict";var r=n(616),s=Function.prototype,o=s.call,i=r&&s.bind.bind(o,o);e.exports=r?i:function(e){return function(){return o.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4475),s=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],s(n)?n:void 0):r[e]&&r[e][t];var n}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},5966:(e,t,n)=>{"use strict";var r=n(9306),s=n(4117);e.exports=function(e,t){var n=e[t];return s(n)?void 0:r(n)}},3789:(e,t,n)=>{"use strict";var r=n(9306),s=n(8551),o=n(9565),i=n(1291),a=n(1767),c="Invalid size",l=RangeError,u=TypeError,d=Math.max,p=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};p.prototype={getIterator:function(){return a(s(o(this.keys,this.set)))},includes:function(e){return o(this.has,this.set,e)}},e.exports=function(e){s(e);var t=+e.size;if(t!=t)throw new u(c);var n=i(t);if(n<0)throw new l(c);return new p(e,n)}},4475:function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,n)=>{"use strict";var r=n(9504),s=n(8981),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(s(e),t)}},421:e=>{"use strict";e.exports={}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},5917:(e,t,n)=>{"use strict";var r=n(3724),s=n(9039),o=n(4055);e.exports=!r&&!s((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),s=n(9039),o=n(4576),i=Object,a=r("".split);e.exports=s((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?a(e,""):i(e)}:i},3167:(e,t,n)=>{"use strict";var r=n(4901),s=n(34),o=n(2967);e.exports=function(e,t,n){var i,a;return o&&r(i=t.constructor)&&i!==n&&s(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),s=n(4901),o=n(7629),i=r(Function.toString);s(o.inspectSource)||(o.inspectSource=function(e){return i(e)}),e.exports=o.inspectSource},1181:(e,t,n)=>{"use strict";var r,s,o,i=n(8622),a=n(4475),c=n(34),l=n(6699),u=n(9297),d=n(7629),p=n(6119),h=n(421),f="Object already initialized",m=a.TypeError,y=a.WeakMap;if(i||d.state){var v=d.state||(d.state=new y);v.get=v.get,v.has=v.has,v.set=v.set,r=function(e,t){if(v.has(e))throw new m(f);return t.facade=e,v.set(e,t),t},s=function(e){return v.get(e)||{}},o=function(e){return v.has(e)}}else{var g=p("state");h[g]=!0,r=function(e,t){if(u(e,g))throw new m(f);return t.facade=e,l(e,g,t),t},s=function(e){return u(e,g)?e[g]:{}},o=function(e){return u(e,g)}}e.exports={set:r,get:s,has:o,enforce:function(e){return o(e)?s(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=s(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},4376:(e,t,n)=>{"use strict";var r=n(4576);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},2796:(e,t,n)=>{"use strict";var r=n(9039),s=n(4901),o=/#|\.prototype\./,i=function(e,t){var n=c[a(e)];return n===u||n!==l&&(s(t)?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},3925:(e,t,n)=>{"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},6395:e=>{"use strict";e.exports=!1},757:(e,t,n)=>{"use strict";var r=n(7751),s=n(4901),o=n(1625),i=n(7040),a=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return s(t)&&o(t.prototype,a(e))}},507:(e,t,n)=>{"use strict";var r=n(9565);e.exports=function(e,t,n){for(var s,o,i=n?e:e.iterator,a=e.next;!(s=r(a,i)).done;)if(void 0!==(o=t(s.value)))return o}},9539:(e,t,n)=>{"use strict";var r=n(9565),s=n(8551),o=n(5966);e.exports=function(e,t,n){var i,a;s(e);try{if(!(i=o(e,"return"))){if("throw"===t)throw n;return n}i=r(i,e)}catch(e){a=!0,i=e}if("throw"===t)throw n;if(a)throw i;return s(i),n}},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},283:(e,t,n)=>{"use strict";var r=n(9504),s=n(9039),o=n(4901),i=n(9297),a=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,p=u.get,h=String,f=Object.defineProperty,m=r("".slice),y=r("".replace),v=r([].join),g=a&&!s((function(){return 8!==f((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=e.exports=function(e,t,n){"Symbol("===m(h(t),0,7)&&(t="["+y(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!i(e,"name")||c&&e.name!==t)&&(a?f(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&i(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?a&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return i(r,"source")||(r.source=v(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return o(this)&&p(this).source||l(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},2603:(e,t,n)=>{"use strict";var r=n(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},2360:(e,t,n)=>{"use strict";var r,s=n(8551),o=n(6801),i=n(8727),a=n(421),c=n(397),l=n(4055),u=n(6119),d="prototype",p="script",h=u("IE_PROTO"),f=function(){},m=function(e){return"<"+p+">"+e+"</"+p+">"},y=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;v="undefined"!=typeof document?document.domain&&r?y(r):(t=l("iframe"),n="java"+p+":",t.style.display="none",c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):y(r);for(var s=i.length;s--;)delete v[d][i[s]];return v()};a[h]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(f[d]=s(e),n=new f,f[d]=null,n[h]=e):n=v(),void 0===t?n:o.f(n,t)}},6801:(e,t,n)=>{"use strict";var r=n(3724),s=n(8686),o=n(4913),i=n(8551),a=n(5397),c=n(1072);t.f=r&&!s?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),s=c(t),l=s.length,u=0;l>u;)o.f(e,n=s[u++],r[n]);return e}},4913:(e,t,n)=>{"use strict";var r=n(3724),s=n(5917),o=n(8686),i=n(8551),a=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",h="writable";t.f=r?o?function(e,t,n){if(i(e),t=a(t),i(n),"function"==typeof e&&"prototype"===t&&"value"in n&&h in n&&!n[h]){var r=u(e,t);r&&r[h]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(i(e),t=a(t),i(n),s)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),s=n(9565),o=n(8773),i=n(6980),a=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=a(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return i(!s(o.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),s=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,s)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),s=n(9297),o=n(5397),i=n(9617).indexOf,a=n(421),c=r([].push);e.exports=function(e,t){var n,r=o(e),l=0,u=[];for(n in r)!s(a,n)&&s(r,n)&&c(u,n);for(;t.length>l;)s(r,n=t[l++])&&(~i(u,n)||c(u,n));return u}},1072:(e,t,n)=>{"use strict";var r=n(1828),s=n(8727);e.exports=Object.keys||function(e){return r(e,s)}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,s=r&&!n.call({1:2},1);t.f=s?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),s=n(34),o=n(7750),i=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return o(n),i(r),s(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),s=n(4901),o=n(34),i=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&s(n=e.toString)&&!o(a=r(n,e)))return a;if(s(n=e.valueOf)&&!o(a=r(n,e)))return a;if("string"!==t&&s(n=e.toString)&&!o(a=r(n,e)))return a;throw new i("Can't convert object to primitive value")}},5031:(e,t,n)=>{"use strict";var r=n(7751),s=n(9504),o=n(8480),i=n(3717),a=n(8551),c=s([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=i.f;return n?c(t,n(e)):t}},7750:(e,t,n)=>{"use strict";var r=n(4117),s=TypeError;e.exports=function(e){if(r(e))throw new s("Can't call method on "+e);return e}},9286:(e,t,n)=>{"use strict";var r=n(4402),s=n(8469),o=r.Set,i=r.add;e.exports=function(e){var t=new o;return s(e,(function(e){i(t,e)})),t}},3440:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402),o=n(9286),i=n(5170),a=n(3789),c=n(8469),l=n(507),u=s.has,d=s.remove;e.exports=function(e){var t=r(this),n=a(e),s=o(t);return i(t)<=n.size?c(t,(function(e){n.includes(e)&&d(s,e)})):l(n.getIterator(),(function(e){u(t,e)&&d(s,e)})),s}},4402:(e,t,n)=>{"use strict";var r=n(9504),s=Set.prototype;e.exports={Set,add:r(s.add),has:r(s.has),remove:r(s.delete),proto:s}},8750:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402),o=n(5170),i=n(3789),a=n(8469),c=n(507),l=s.Set,u=s.add,d=s.has;e.exports=function(e){var t=r(this),n=i(e),s=new l;return o(t)>n.size?c(n.getIterator(),(function(e){d(t,e)&&u(s,e)})):a(t,(function(e){n.includes(e)&&u(s,e)})),s}},4449:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402).has,o=n(5170),i=n(3789),a=n(8469),c=n(507),l=n(9539);e.exports=function(e){var t=r(this),n=i(e);if(o(t)<=n.size)return!1!==a(t,(function(e){if(n.includes(e))return!1}),!0);var u=n.getIterator();return!1!==c(u,(function(e){if(s(t,e))return l(u,"normal",!1)}))}},3838:(e,t,n)=>{"use strict";var r=n(7080),s=n(5170),o=n(8469),i=n(3789);e.exports=function(e){var t=r(this),n=i(e);return!(s(t)>n.size)&&!1!==o(t,(function(e){if(!n.includes(e))return!1}),!0)}},8527:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402).has,o=n(5170),i=n(3789),a=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=i(e);if(o(t)<n.size)return!1;var l=n.getIterator();return!1!==a(l,(function(e){if(!s(t,e))return c(l,"normal",!1)}))}},8469:(e,t,n)=>{"use strict";var r=n(9504),s=n(507),o=n(4402),i=o.Set,a=o.proto,c=r(a.forEach),l=r(a.keys),u=l(new i).next;e.exports=function(e,t,n){return n?s({iterator:l(e),next:u},t):c(e,t)}},4916:(e,t,n)=>{"use strict";var r=n(7751),s=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};e.exports=function(e){var t=r("Set");try{(new t)[e](s(0));try{return(new t)[e](s(-1)),!1}catch(e){return!0}}catch(e){return!1}}},5170:(e,t,n)=>{"use strict";var r=n(6706),s=n(4402);e.exports=r(s.proto,"size","get")||function(e){return e.size}},3650:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402),o=n(9286),i=n(3789),a=n(507),c=s.add,l=s.has,u=s.remove;e.exports=function(e){var t=r(this),n=i(e).getIterator(),s=o(t);return a(n,(function(e){l(t,e)?u(s,e):c(s,e)})),s}},4204:(e,t,n)=>{"use strict";var r=n(7080),s=n(4402).add,o=n(9286),i=n(3789),a=n(507);e.exports=function(e){var t=r(this),n=i(e).getIterator(),c=o(t);return a(n,(function(e){s(c,e)})),c}},6119:(e,t,n)=>{"use strict";var r=n(5745),s=n(3392),o=r("keys");e.exports=function(e){return o[e]||(o[e]=s(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),s=n(4475),o=n(9433),i="__core-js_shared__",a=e.exports=s[i]||o(i,{});(a.versions||(a.versions=[])).push({version:"3.37.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},4495:(e,t,n)=>{"use strict";var r=n(7388),s=n(9039),o=n(4475).String;e.exports=!!Object.getOwnPropertySymbols&&!s((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:(e,t,n)=>{"use strict";var r=n(1291),s=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?s(n+t,0):o(n,t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),s=n(7750);e.exports=function(e){return r(s(e))}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},8014:(e,t,n)=>{"use strict";var r=n(1291),s=Math.min;e.exports=function(e){var t=r(e);return t>0?s(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),s=Object;e.exports=function(e){return s(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),s=n(34),o=n(757),i=n(5966),a=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!s(e)||o(e))return e;var n,c=i(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!s(n)||o(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},6969:(e,t,n)=>{"use strict";var r=n(2777),s=n(757);e.exports=function(e){var t=r(e,"string");return s(t)?t:t+""}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},655:(e,t,n)=>{"use strict";var r=n(6955),s=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return s(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,n)=>{"use strict";var r=n(9504),s=0,o=Math.random(),i=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++s+o,36)}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,n)=>{"use strict";var r=n(3724),s=n(9039);e.exports=r&&s((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:(e,t,n)=>{"use strict";var r=n(4475),s=n(4901),o=r.WeakMap;e.exports=s(o)&&/native code/.test(String(o))},8227:(e,t,n)=>{"use strict";var r=n(4475),s=n(5745),o=n(9297),i=n(3392),a=n(4495),c=n(7040),l=r.Symbol,u=s("wks"),d=c?l.for||l:l&&l.withoutSetter||i;e.exports=function(e){return o(u,e)||(u[e]=a&&o(l,e)?l[e]:d("Symbol."+e)),u[e]}},8107:(e,t,n)=>{"use strict";var r=n(6518),s=n(8981),o=n(6198),i=n(1291),a=n(6469);r({target:"Array",proto:!0},{at:function(e){var t=s(this),n=o(t),r=i(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}}),a("at")},4114:(e,t,n)=>{"use strict";var r=n(6518),s=n(8981),o=n(6198),i=n(4527),a=n(6837);r({target:"Array",proto:!0,arity:1,forced:n(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=s(this),n=o(t),r=arguments.length;a(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return i(t,n),n}})},7642:(e,t,n)=>{"use strict";var r=n(6518),s=n(3440);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("difference")},{difference:s})},8004:(e,t,n)=>{"use strict";var r=n(6518),s=n(9039),o=n(8750);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("intersection")||s((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:o})},3853:(e,t,n)=>{"use strict";var r=n(6518),s=n(4449);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isDisjointFrom")},{isDisjointFrom:s})},5876:(e,t,n)=>{"use strict";var r=n(6518),s=n(3838);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSubsetOf")},{isSubsetOf:s})},2475:(e,t,n)=>{"use strict";var r=n(6518),s=n(8527);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSupersetOf")},{isSupersetOf:s})},5024:(e,t,n)=>{"use strict";var r=n(6518),s=n(3650);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("symmetricDifference")},{symmetricDifference:s})},1698:(e,t,n)=>{"use strict";var r=n(6518),s=n(4204);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("union")},{union:s})},3375:(e,t,n)=>{"use strict";n(7642)},9225:(e,t,n)=>{"use strict";n(8004)},3972:(e,t,n)=>{"use strict";n(3853)},9209:(e,t,n)=>{"use strict";n(5876)},5714:(e,t,n)=>{"use strict";n(2475)},7561:(e,t,n)=>{"use strict";n(5024)},6197:(e,t,n)=>{"use strict";n(1698)},4979:(e,t,n)=>{"use strict";var r=n(6518),s=n(4475),o=n(7751),i=n(6980),a=n(4913).f,c=n(9297),l=n(679),u=n(3167),d=n(2603),p=n(5002),h=n(6193),f=n(3724),m=n(6395),y="DOMException",v=o("Error"),g=o(y),b=function(){l(this,x);var e=arguments.length,t=d(e<1?void 0:arguments[0]),n=d(e<2?void 0:arguments[1],"Error"),r=new g(t,n),s=new v(t);return s.name=y,a(r,"stack",i(1,h(s.stack,1))),u(r,this,b),r},x=b.prototype=g.prototype,w="stack"in new v(y),C="stack"in new g(1,2),_=g&&f&&Object.getOwnPropertyDescriptor(s,y),E=!(!_||_.writable&&_.configurable),S=w&&!E&&!C;r({global:!0,constructor:!0,forced:m||S},{DOMException:S?b:g});var j=o(y),T=j.prototype;if(T.constructor!==j)for(var k in m||a(T,"constructor",i(1,j)),p)if(c(p,k)){var N=p[k],A=N.s;c(j,A)||a(j,A,i(6,N.c))}}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var s=r.length-1;s>-1&&(!e||!/^http(s?):/.test(e));)e=r[s--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var r={};(()=>{"use strict";n.r(r),n.d(r,{API:()=>we,AgentInfo:()=>kl,Chat:()=>vc,ChatFrame:()=>ll,ComponentFilter:()=>_a,Conversation:()=>cc,Engine:()=>_l,EntryContainer:()=>il,EventParticipant:()=>hi,ExternalApi:()=>jl,Header:()=>Nl,Icon:()=>gi,Interrupt:()=>cl,MessageContainer:()=>fi,SeamlyActivityMonitor:()=>Ea,SeamlyApiContext:()=>So,SeamlyEventBusContext:()=>jo,SeamlyFileUpload:()=>Ta,SeamlyGeneralError:()=>c,SeamlyLiveRegionContext:()=>To,SeamlyOfflineError:()=>Cr,SeamlyStoreProvider:()=>Dn,Text:()=>ga,TextEntry:()=>Zc,Upload:()=>sl,View:()=>wl,calculateVisibility:()=>bn,className:()=>Zo,default:()=>Al,eventTypes:()=>T,randomId:()=>m,useChoicePrompt:()=>Ti,useEvents:()=>Jn,useGeneratedId:()=>di,useI18n:()=>wo,useSeamlyActions:()=>Tl,useSeamlyChat:()=>Do,useSeamlyCommands:()=>Io,useSeamlyConfig:()=>Hn,useSeamlyEventStream:()=>pi,useSeamlyIdleDetachCountdown:()=>li,useSeamlyMessageContainerClassNames:()=>ei,useSeamlyOptions:()=>oi,useSeamlyVisibility:()=>Co,useTranslatedEventData:()=>Ko,useTranslations:()=>Go,useTranslationsContainer:()=>Jo,visibilityStates:()=>vn}),n(9497),n(4114);var e=n(2086),t=n.n(e),s=n(8785);class o extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.status=t?.status}}class i extends Error{action="";langKey="";constructor(e,...t){if(super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Object.getPrototypeOf(this)),this.originalError=e,e?.payload&&(this.originalEvent=e,this.originalError=e.payload.error,this.message=`Event of type ${e.payload.type} encountered`),!this.message&&e?.message){const t=function(e){try{return JSON.parse(e).error}catch(t){return e}}(e.message);this.message=t}e?.error&&(this.originalError=e.error)}}class a extends i{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class c extends i{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class l extends i{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class u extends i{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const d="cvco",p="seamly-client-participant",h=50,f=300;function m(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function y(e){const t=`cvco.${e}`;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let n;do{n=sessionStorage.getItem(e[0])}while(e.shift()&&!n);return n?JSON.parse(n):{}},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const v=(e,t)=>{let n;return function(...r){let s=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,s||e.apply(this,r),s=!1}),t),t=>{s=!0,t&&e.apply(this,r)}}},g=e=>Math.ceil(e/1e3),b=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},x=(e,t=2)=>{if(0===e)return"0 Bytes";const n=t<0?0:t,r=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/1024**r).toFixed(n))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]}`},w={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},C={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},_=e=>e.code?C[e.code]:w[e.keyCode],E=e=>{e&&e.focus()},S=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function j(e){return"object"==typeof e}const T={info:"info",message:"message",participant:"participant",system:"system"},k="text",N="text",A="upload",R="received",I="read",O="custom",L="typing",M="read",P="detach_service",D="dismiss",U="set_topic",F="click_cta",B="translation_proposal",z=B,$="window_api",H="assertive",V="polite",W={new_topic:"newTopic",new_translation:"newTranslation"},q="uploads",G="navigate";n(3375),n(9225),n(3972),n(9209),n(5714),n(7561),n(6197),n(4979);var K=e=>"function"==typeof e?e:function(){return e},J="undefined"!=typeof self?self:null,X="undefined"!=typeof window?window:null,Y=J||X||Y,Z="closed",Q="errored",ee="joined",te="joining",ne="leaving",re="phx_close",se="phx_error",oe="phx_reply",ie="phx_leave",ae="websocket",ce=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},le=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}},ue=class{constructor(e,t,n){this.state=Z,this.topic=e,this.params=K(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ce(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new le((()=>{this.socket.isConnected()&&this.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((()=>this.rejoinTimer.reset()))),this.stateChangeRefs.push(this.socket.onOpen((()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()}))),this.joinPush.receive("ok",(()=>{this.state=ee,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Z,this.socket.remove(this)})),this.onError((e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new ce(this,ie,K({}),this.timeout).send(),this.state=Q,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(oe,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(re,e)}onError(e){return this.on(se,(t=>e(t)))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter((n=>!(n.event===e&&(void 0===t||t===n.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new ce(this,e,(function(){return t}),n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ne;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(re,"leave")},n=new ce(this,ie,K({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return!(this.topic!==e||r&&r!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=te,this.joinPush.resend(e))}trigger(e,t,n,r){let s=this.onMessage(e,t,n,r);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter((t=>t.event===e));for(let e=0;e<o.length;e++)o[e].callback(s,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Z}isErrored(){return this.state===Q}isJoined(){return this.state===ee}isJoining(){return this.state===te}isLeaving(){return this.state===ne}},de=class{static request(e,t,n,r,s,o,i){if(Y.XDomainRequest){let n=new Y.XDomainRequest;return this.xdomainRequest(n,e,t,r,s,o,i)}{let a=new Y.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,s,o,i)}}static xdomainRequest(e,t,n,r,s,o,i){return e.timeout=s,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);i&&i(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,s,o,i,a){return e.open(t,n,!0),e.timeout=o,e.setRequestHeader("Content-Type",r),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(4===e.readyState&&a){let t=this.parseJSON(e.responseText);a(t)}},i&&(e.ontimeout=i),e.send(s),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let s=t?`${t}[${r}]`:r,o=e[r];"object"==typeof o?n.push(this.serialize(o,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(o))}return n.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},pe=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,setTimeout((()=>this.poll()),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ae),"$1/longpoll")}endpointURL(){return de.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return 1===this.readyState||0===this.readyState}poll(){this.ajax("GET","application/json",null,(()=>this.ontimeout()),(e=>{if(e){var{status:t,token:n,messages:r}=e;this.token=n}else t=0;switch(t){case 200:r.forEach((e=>{setTimeout((()=>this.onmessage({data:e})),0)})),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){"string"!=typeof e&&(e=(e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout((()=>{this.batchSend(this.currentBatch),this.currentBatch=null}),0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join("\n"),(()=>this.onerror("timeout")),(e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))}))}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=3;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,s){let o;o=de.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(o),r()}),(e=>{this.reqs.delete(o),this.isActive()&&s(e)})),this.reqs.add(o)}},he={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,s,o,i]=JSON.parse(e);return t({join_ref:n,ref:r,topic:s,event:o,payload:i})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:s,payload:o}=e,i=this.META_LENGTH+t.length+n.length+s.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+i),c=new DataView(a),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,t.length),c.setUint8(l++,n.length),c.setUint8(l++,s.length),c.setUint8(l++,r.length),Array.from(t,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(n,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(s,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(a.byteLength+o.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(o),a.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=t.getUint8(3),i=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(i,i+r));i+=r;let c=n.decode(e.slice(i,i+s));i+=s;let l=n.decode(e.slice(i,i+o));return i+=o,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(i,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=t.getUint8(3),i=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(a,a+r));a+=r;let l=n.decode(e.slice(a,a+s));a+=s;let u=n.decode(e.slice(a,a+o));a+=o;let d=n.decode(e.slice(a,a+i));a+=i;let p=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:oe,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=this.HEADER_LENGTH+2,i=n.decode(e.slice(o,o+r));o+=r;let a=n.decode(e.slice(o,o+s));return o+=s,{join_ref:null,ref:null,topic:i,event:a,payload:e.slice(o,e.byteLength)}}},fe=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||1e4,this.transport=t.transport||Y.WebSocket||pe,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Y.sessionStorage,this.establishedConnections=0,this.defaultEncoder=he.encode.bind(he),this.defaultDecoder=he.decode.bind(he),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==pe?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;X&&X.addEventListener&&(X.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),X.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=K(t.params||{}),this.endPoint=`${e}/${ae}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new le((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return pe}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=de.appendParams(de.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=K(e)),this.conn||(this.longPollFallbackMs&&this.transport!==pe?this.connectWithFallback(pe,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage((s=>{s.ref===t&&(this.off([r]),e(Date.now()-n))}));return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n,r=!1,s=!0,o=t=>{this.log("transport",`falling back to ${e.name}...`,t),this.off([void 0,n]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),n=this.onError((e=>{this.log("transport","error",e),s&&!r&&(clearTimeout(this.fallbackTimer),o(e))})),this.onOpen((()=>{if(r=!0,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping((e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)}))})),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((([,e])=>e()))}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown((()=>this.reconnectTimer.scheduleTimeout()),1e3,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()}))}))}waitForBufferDone(e,t=1){5!==t&&this.conn&&this.conn.bufferedAmount?setTimeout((()=>{this.waitForBufferDone(e,t+1)}),150*t):e()}waitForSocketClosed(e,t=1){5!==t&&this.conn&&3!==this.conn.readyState?setTimeout((()=>{this.waitForSocketClosed(e,t+1)}),150*t):e()}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((([,t])=>t(e)))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,r])=>{r(e,t,n)})),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(se)}))}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((t=>t!==e))}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((([t])=>-1===e.indexOf(t)))}channel(e,t={}){let n=new ue(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:s,join_ref:o}=e;this.log("push",`${t} ${n} (${o}, ${s})`,r)}this.isConnected()?this.encode(e,(e=>this.conn.send(e))):this.sendBuffer.push((()=>this.encode(e,(e=>this.conn.send(e)))))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:n,payload:r,ref:s,join_ref:o}=e;s&&s===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${s&&"("+s+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const i=this.channels[e];i.isMember(t,n,r,o)&&i.trigger(n,r,s,o)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,n]=this.stateChangeCallbacks.message[t];n(e)}}))}leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t.isJoined()||t.isJoining())));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};const me=()=>null,ye=new Set;class ve{#e=[];async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:s,params:o}=(e=>{const t=e.indexOf("?");return t<0?{url:e,params:{}}:{url:e.slice(0,t),params:e.slice(t+1).split("&").reduce((function(e,t){const[n,r]=t.split("=");return{...e,[n]:decodeURIComponent(r)}}),{})}})(this.url);this.socket=new fe(s,{params:{...o,v:"3"},reconnectAfterMs:e=>{const t=2**e*250;return Math.min(t,1e4)}}),this.socket.onError((e=>{me("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{me("[SOCKET]OPEN")})),this.socket.onClose((()=>{me("[SOCKET]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"socket_closed"})})),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName}),this.start(),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&this.#t({connected:!0,ready:!0,currentState:"attach_channel_succeeded"})})),this.channel.onClose((()=>{me("[CHANNEL]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{me("[CHANNEL][ERROR]",e),this.#t({connected:!1,ready:!1,currentState:"channel_erred"})})),this.#n("ack","ui","error","participant","message","service_data","system","info","sync")}start(){this.channel?.join().receive("ok",(()=>{me("[CHANNEL][JOIN] OK"),this.#t({connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{me("[CHANNEL][JOIN] ERROR",e),this.#t({connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{me("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){this.channel?.leave().receive("ok",(()=>{this.socket?.disconnect(),me("[CHANNEL][LEAVE] OK"),this.#e=[]}))}#n(...e){e.forEach((e=>{this.channel?.on(e,(t=>{me("[RECEIVE]",e,t)}))}))}onConnection(e){this.#e.push(e)}#t(e){this.#e=this.#e.filter((t=>!t(e))),ye.forEach((e=>e()))}pushToChannel(e,t,n=1e4){this.channel?.push(e,t,n)}static subscribe(e){return ye.add(e),()=>ye.delete(e)}}const ge=()=>null,be=async(e,t)=>{const n=new URL(e);n.searchParams.set("v","3");const r=await fetch(n.href,{mode:"cors",...t});if(!r.ok)throw new o(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function xe(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return null;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return null;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:null}class we{#r;#s;#o;#i="window";#a;conversation=new ve;constructor({layoutMode:e,namespace:t,config:n,context:r}){this.store=function(e,t){const n=t(e),r=n.get()||{};return{get:e=>void 0===e?r:r[e],set:(e,t)=>(r[e]=t,n.set(r),t),delete(e){const t=this.get(e);return delete r[e],n.set(r),t}}}(`${t}.connection${r?.userLocale?`.${r.userLocale}`:""}`,n.storageProvider||y),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},this.#a={...n,sendEnvironment:n.sendEnvironment??!0,context:{...r,channelName:r?.channelName||"web"}},this.#r=!1,this.connected=!1,this.configReady=!1,this.#s=n.externalId,e&&(this.#i=e),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}#c(){return this.store.get("accessToken")}#l(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}#u(e){this.store.set("conversationUrl",e)}hasConversation(){return!!this.getConversationUrl()}#d(){return this.store.get("channelTopic")||this.store.get("channelName")}#p(e){this.store.set("channelTopic",e)}#h=e=>e||this.locale;clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}#f(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}#m({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>(e[t]=n,e)),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversation?.disconnect&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}async#y(){if(!this.hasConversation())try{"function"==typeof this.#a?.getConversationAuthToken&&(this.#o=await this.#a.getConversationAuthToken());const e=await be(`${this.#f("http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#o?void 0:this.#s,token:this.#o})}),t=await e.json(),{conversation:n}=t,r={...n};return delete r.accessToken,delete r.channelTopic,this.#l(n.accessToken),this.#p(n.channelTopic),this.#m(t),this.URLS.conversation&&this.#u(this.URLS.conversation),this.locale=n.translation?.locale,this.userResponded=n.userResponded,r}catch(e){if(e.status>=500)throw new c(e);if(400===e.status)throw new u(e);if(404===e.status)throw new a(e);throw e}}async getConfig(){try{const e=await be(`${this.#f("http")}/client/${this.connectionInfo.apiKey}/configs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:{...this.#a.context,environment:!0===this.#a.sendEnvironment?this.getEnvironment():this.#a.sendEnvironment}})}),t=await e.json();return this.#m(t),delete this.URLS.socket,this.configReady=!0,t.config}catch(e){if(404===e.status)throw new a(e);if(e.status>=500)throw new c(e);throw e}}async getConversation(){if(!this.hasConversation())return null;try{const e=await be(`${this.#f("http")}${this.URLS.history}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),t=await e.json();this.#m(t);const{messages:n,participants:r,activeServiceSessionId:s,activeServiceSettings:o,serviceData:i,ui:a,translation:c}=t.history;return{events:n.map((([e,t])=>({type:e,payload:{...t,type:"participant"===e?e:t.type}}))),participants:r,activeServiceSessionId:s,activeServiceSettings:o,serviceData:i,resumeConversationPrompt:!!a&&Boolean(a.resumeConversationPrompt),translationProposal:a.translationProposal,translation:c}}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw new o(e)}}async connect(){this.connected=!1;const e=await this.#y();return this.URLS.socket&&(this.conversation.connect(`${this.#f("ws")}${this.URLS.socket}`,this.#a.context.channelName,this.#d(),this.#c()),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,this.#r=t}))),e}uploadFile(e,t,n,r){const s=new FormData;s.append("upload",e);const o=new XMLHttpRequest;return o.open("POST",`${this.#f("http")}${this.URLS.uploads}`),o.setRequestHeader("Authorization",`Bearer ${this.#c()}`),o.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},o.onloadend=()=>{if(0!==o.status)if(200!==o.status&&201!==o.status||!n){if(!r)throw new Error(o.response);try{r(JSON.parse(o.response))}catch(e){r(o.response)}}else try{n(JSON.parse(o.response))}catch(e){n(o.response)}},o.send(s),o}async getConversationIntitialState(){try{const n=await be(`${this.#f("http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),r=await n.json();return this.#m(r),this.userResponded=r.conversation.userResponded,e=r.conversation,t=["accessToken","channelTopic"],Object.keys(e).reduce(((n,r)=>(t.includes(r)||(n[r]=e[r]),n)),{})}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw e}var e,t}async getTranslations(e){try{if(!this.URLS.translations)throw new a;const t=this.#h(e);if(!t)throw new c;const n=`${this.#f("http")}${this.URLS.translations}`.replace("{version}",String(4)).replace("{locale}",t),r=await be(n,{method:"GET"});return(await r.json()).translations}catch(e){if(e.status>=500)throw new c(e);throw new o(e)}}send(e,t=void 0,n=!0){!this.connected||n&&!this.#r?this.conversation?.onConnection((({connected:r,ready:s})=>(this.connected=r,this.#r=s,!!(n?s:r)&&(this.send(e,t,n),!0)))):(ge("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:s}=t;return s||(s=m()),{type:n,body:r,transactionId:s}}(e,t),1e4))}sendContext(e){const{contentLocale:t,source:n,userLocale:r,variables:s,environment:o}=e,i={};if(o&&(i.environment=o),t){if("string"!=typeof t)throw new Error("Content locale must be a string");i.contentLocale=t}if(n){if("string"!=typeof n)throw new Error("Source must be a string");i.source=n}if(r){if("string"!=typeof r)throw new Error("User locale must be a string");i.userLocale=r,this.#v(i,r)}if(s){if("object"!=typeof s)throw new Error("Variables must be an object");i.variables=s}0===Object.keys(i).length&&i.constructor===Object||this.send("context",i,!1)}#v(e,t){e.source||t==this.#a.context?.userLocale||(e.source=$)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#i,clientVersion:"23.0.6-alpha.2",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:xe(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}var Ce=Symbol.for("immer-nothing"),_e=Symbol.for("immer-draftable"),Ee=Symbol.for("immer-state");function Se(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var je=Object.getPrototypeOf;function Te(e){return!!e&&!!e[Ee]}function ke(e){return!!e&&(Ae(e)||Array.isArray(e)||!!e[_e]||!!e.constructor?.[_e]||Me(e)||Pe(e))}var Ne=Object.prototype.constructor.toString();function Ae(e){if(!e||"object"!=typeof e)return!1;const t=je(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Ne}function Re(e,t){0===Ie(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Ie(e){const t=e[Ee];return t?t.type_:Array.isArray(e)?1:Me(e)?2:Pe(e)?3:0}function Oe(e,t){return 2===Ie(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Le(e,t,n){const r=Ie(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Me(e){return e instanceof Map}function Pe(e){return e instanceof Set}function De(e){return e.copy_||e.base_}function Ue(e,t){if(Me(e))return new Map(e);if(Pe(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ae(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Ee];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const s=n[r],o=t[s];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(je(e),t)}{const t=je(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function Fe(e,t=!1){return ze(e)||Te(e)||!ke(e)||(Ie(e)>1&&(e.set=e.add=e.clear=e.delete=Be),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Fe(t,!0)))),e}function Be(){Se(2)}function ze(e){return Object.isFrozen(e)}var $e,He={};function Ve(e){const t=He[e];return t||Se(0),t}function We(){return $e}function qe(e,t){t&&(Ve("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ge(e){Ke(e),e.drafts_.forEach(Xe),e.drafts_=null}function Ke(e){e===$e&&($e=e.parent_)}function Je(e){return $e={drafts_:[],parent_:$e,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xe(e){const t=e[Ee];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ee].modified_&&(Ge(t),Se(4)),ke(e)&&(e=Ze(t,e),t.parent_||et(t,e)),t.patches_&&Ve("Patches").generateReplacementPatches_(n[Ee].base_,e,t.patches_,t.inversePatches_)):e=Ze(t,n,[]),Ge(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ce?e:void 0}function Ze(e,t,n){if(ze(t))return t;const r=t[Ee];if(!r)return Re(t,((s,o)=>Qe(e,r,t,s,o,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return et(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let s=t,o=!1;3===r.type_&&(s=new Set(t),t.clear(),o=!0),Re(s,((s,i)=>Qe(e,r,t,s,i,n,o))),et(e,t,!1),n&&e.patches_&&Ve("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Qe(e,t,n,r,s,o,i){if(Te(s)){const i=Ze(e,s,o&&t&&3!==t.type_&&!Oe(t.assigned_,r)?o.concat(r):void 0);if(Le(n,r,i),!Te(i))return;e.canAutoFreeze_=!1}else i&&n.add(s);if(ke(s)&&!ze(s)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ze(e,s),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||et(e,s)}}function et(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Fe(t,n)}var tt={get(e,t){if(t===Ee)return e;const n=De(e);if(!Oe(n,t))return function(e,t,n){const r=st(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!ke(r)?r:r===rt(e.base_,t)?(it(e),e.copy_[t]=at(r,e)):r},has:(e,t)=>t in De(e),ownKeys:e=>Reflect.ownKeys(De(e)),set(e,t,n){const r=st(De(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=rt(De(e),t),i=r?.[Ee];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((s=n)===(o=r)?0!==s||1/s==1/o:s!=s&&o!=o)&&(void 0!==n||Oe(e.base_,t)))return!0;it(e),ot(e)}var s,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==rt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,it(e),ot(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=De(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Se(11)},getPrototypeOf:e=>je(e.base_),setPrototypeOf(){Se(12)}},nt={};function rt(e,t){const n=e[Ee];return(n?De(n):e)[t]}function st(e,t){if(!(t in e))return;let n=je(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=je(n)}}function ot(e){e.modified_||(e.modified_=!0,e.parent_&&ot(e.parent_))}function it(e){e.copy_||(e.copy_=Ue(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function at(e,t){const n=Me(e)?Ve("MapSet").proxyMap_(e,t):Pe(e)?Ve("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:We(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,o=tt;n&&(s=[r],o=nt);const{revoke:i,proxy:a}=Proxy.revocable(s,o);return r.draft_=a,r.revoke_=i,a}(e,t);return(t?t.scope_:We()).drafts_.push(n),n}function ct(e){return Te(e)||Se(10),lt(e)}function lt(e){if(!ke(e)||ze(e))return e;const t=e[Ee];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ue(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ue(e,!0);return Re(n,((e,t)=>{Le(n,e,lt(t))})),t&&(t.finalized_=!1),n}Re(tt,((e,t)=>{nt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),nt.deleteProperty=function(e,t){return nt.set.call(this,e,t,void 0)},nt.set=function(e,t,n){return tt.set.call(this,e[0],t,n,e[0])};var ut=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...s){return r.produce(e,(e=>t.call(this,e,...s)))}}let r;if("function"!=typeof t&&Se(6),void 0!==n&&"function"!=typeof n&&Se(7),ke(e)){const s=Je(this),o=at(e,void 0);let i=!0;try{r=t(o),i=!1}finally{i?Ge(s):Ke(s)}return qe(s,n),Ye(r,s)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Ce&&(r=void 0),this.autoFreeze_&&Fe(r,!0),n){const t=[],s=[];Ve("Patches").generateReplacementPatches_(e,r,t,s),n(t,s)}return r}Se(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ke(e)||Se(8),Te(e)&&(e=ct(e));const t=Je(this),n=at(e,void 0);return n[Ee].isManual_=!0,Ke(t),n}finishDraft(e,t){const n=e&&e[Ee];n&&n.isManual_||Se(9);const{scope_:r}=n;return qe(r,t),Ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Ve("Patches").applyPatches_;return Te(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},dt=ut.produce;ut.produceWithPatches.bind(ut),ut.setAutoFreeze.bind(ut),ut.setUseStrictShallowCopy.bind(ut),ut.applyPatches.bind(ut),ut.createDraft.bind(ut),ut.finishDraft.bind(ut);var pt=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var ht="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},ft=0,mt=1;function yt(){return{s:ft,v:void 0,o:null,p:null}}function vt(e,t={}){let n=yt();const{resultEqualityCheck:r}=t;let s,o=0;function i(){let t=n;const{length:i}=arguments;for(let e=0,n=i;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===mt)c=t.v;else if(c=e.apply(null,arguments),o++,r){const e=s?.deref?.()??s;null!=e&&r(e,c)&&(c=e,0!==o&&o--),s="object"==typeof c&&null!==c||"function"==typeof c?new ht(c):c}return a.s=mt,a.v=c,c}return i.clearCache=()=>{n=yt(),i.resetResultsCount()},i.resultsCount=()=>o,i.resetResultsCount=()=>{o=0},i}function gt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,s=0,o={},i=e.pop();"object"==typeof i&&(o=i,i=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(i,`createSelector expects an output function after the inputs, but received: [${typeof i}]`);const a={...n,...o},{memoize:c,memoizeOptions:l=[],argsMemoize:u=vt,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,h=pt(l),f=pt(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=c((function(){return r++,i.apply(null,arguments)}),...h),v=u((function(){s++;const e=function(e,t){const n=[],{length:r}=e;for(let s=0;s<r;s++)n.push(e[s].apply(null,t));return n}(m,arguments);return t=y.apply(null,e),t}),...f);return Object.assign(v,{resultFunc:i,memoizedResultFunc:y,dependencies:m,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var bt=gt(vt),xt=Object.assign(((e,t=bt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>xt});function wt(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 Ct=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),_t=()=>Math.random().toString(36).substring(7).split("").join("."),Et={INIT:`@@redux/INIT${_t()}`,REPLACE:`@@redux/REPLACE${_t()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_t()}`};function St(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 jt(e,t,n){if("function"!=typeof e)throw new Error(wt(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(wt(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(wt(1));return n(jt)(e,t)}let r=e,s=t,o=new Map,i=o,a=0,c=!1;function l(){i===o&&(i=new Map,o.forEach(((e,t)=>{i.set(t,e)})))}function u(){if(c)throw new Error(wt(3));return s}function d(e){if("function"!=typeof e)throw new Error(wt(4));if(c)throw new Error(wt(5));let t=!0;l();const n=a++;return i.set(n,e),function(){if(t){if(c)throw new Error(wt(6));t=!1,l(),i.delete(n),o=null}}}function p(e){if(!St(e))throw new Error(wt(7));if(void 0===e.type)throw new Error(wt(8));if("string"!=typeof e.type)throw new Error(wt(17));if(c)throw new Error(wt(9));try{c=!0,s=r(s,e)}finally{c=!1}return(o=i).forEach((e=>{e()})),e}return p({type:Et.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(wt(10));r=e,p({type:Et.REPLACE})},[Ct]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(wt(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[Ct](){return this}}}}}function Tt(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const s=t[r];"function"==typeof e[s]&&(n[s]=e[s])}const r=Object.keys(n);let s;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Et.INIT}))throw new Error(wt(12));if(void 0===n(void 0,{type:Et.PROBE_UNKNOWN_ACTION()}))throw new Error(wt(13))}))}(n)}catch(e){s=e}return function(e={},t){if(s)throw s;let o=!1;const i={};for(let s=0;s<r.length;s++){const a=r[s],c=n[a],l=e[a],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(wt(14));i[a]=u,o=o||u!==l}return o=o||r.length!==Object.keys(e).length,o?i:e}}function kt(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Nt(e){return({dispatch:t,getState:n})=>r=>s=>"function"==typeof s?s(t,n,e):r(s)}var At=Nt(),Rt=Nt,It=(((...e)=>{const t=gt(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(Te(e)?ct(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(vt),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?kt:kt.apply(null,arguments)}),Ot=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Lt(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(dn(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return St(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Mt=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))}};function Pt(e){return ke(e)?dt(e,(()=>{})):e}function Dt(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error(dn(10));const r=n.insert(t,e);return e.set(t,r),r}var Ut=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:s=!0}=e??{};let o=new Mt;return t&&("boolean"==typeof t?o.push(At):o.push(Rt(t.extraArgument))),o},Ft=e=>t=>{setTimeout(t,e)},Bt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ft(10),zt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Mt(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let s=!0,o=!1,i=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?Bt:"callback"===e.type?e.queueNotification:Ft(e.timeout),l=()=>{i=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>s&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return s=!e?.meta?.RTK_autoBatch,o=!s,o&&(i||(i=!0,c(l))),r.dispatch(e)}finally{s=!0}}})})("object"==typeof n?n:void 0)),r},$t=!0;function Ht(e){const t={},n=[];let r;const s={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(dn(28));if(r in t)throw new Error(dn(29));return t[r]=n,s},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),s),addDefaultCase:e=>(r=e,s)};return e(s),[t,n,r]}var Vt=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Wt(...e){return t=>e.some((e=>((e,t)=>Ot(e)?e.match(t):e(t))(e,t)))}var qt=["name","message","stack","code"],Gt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Kt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Jt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of qt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Xt=(()=>{function e(e,t,n){const r=Lt(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),s=Lt(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=Lt(e+"/rejected",((e,t,r,s,o)=>({payload:s,error:(n&&n.serializeError||Jt)(e||"Rejected"),meta:{...o||{},arg:r,requestId:t,rejectedWithValue:!!s,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(i,a,c)=>{const l=n?.idGenerator?n.idGenerator(e):Vt(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let o=n?.condition?.(e,{getState:a,extra:c});if(null!==(m=o)&&"object"==typeof m&&"function"==typeof m.then&&(o=await o),!1===o||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const y=new Promise(((e,t)=>{d=()=>{t({name:"AbortError",message:p||"Aborted"})},u.signal.addEventListener("abort",d)}));i(s(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:c}))),f=await Promise.race([y,Promise.resolve(t(e,{dispatch:i,getState:a,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Gt(e,t),fulfillWithValue:(e,t)=>new Kt(e,t)})).then((t=>{if(t instanceof Gt)throw t;return t instanceof Kt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof Gt?o(null,l,e,t.payload,t.meta):o(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&o.match(f)&&f.meta.condition||i(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(Yt)})}}),{pending:s,rejected:o,fulfilled:r,settled:Wt(o,r),typePrefix:e})}return e.withTypes=()=>e,e})();function Yt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Zt=Symbol.for("rtk-slice-createasyncthunk");function Qt(e,t){return`${e}/${t}`}function en({creators:e}={}){const t=e?.asyncThunk?.[Zt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(dn(11));const s=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(s),i={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(dn(12));if(n in i.sliceCaseReducersByType)throw new Error(dn(13));return i.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(i.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(i.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(i.sliceCaseReducersByName[e]=t,a)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Ht(e.extraReducers):[e.extraReducers],s={...t,...i.sliceCaseReducersByType};return function(e,t){let o,[a,c,l]=Ht((e=>{for(let t in s)e.addCase(t,s[t]);for(let t of i.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}));if("function"==typeof e)o=()=>Pt(e());else{const t=Pt(e);o=()=>t}function u(e=o(),t){let n=[a[t.type],...c.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===n.filter((e=>!!e)).length&&(n=[l]),n.reduce(((e,n)=>{if(n){if(Te(e)){const r=n(e,t);return void 0===r?e:r}if(ke(e))return dt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(dn(9))}return r}}return e}),e)}return u.getInitialState=o,u}(e.initialState)}o.forEach((r=>{const o=s[r],i={reducerName:r,type:Qt(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},r,s){let o,i;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(dn(17));o=r.reducer,i=r.prepare}else o=r;s.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,i?Lt(e,i):Lt(e))}(i,o,a):function({type:e,reducerName:t},n,r,s){if(!s)throw new Error(dn(18));const{payloadCreator:o,fulfilled:i,pending:a,rejected:c,settled:l,options:u}=n,d=s(e,o,u);r.exposeAction(t,d),i&&r.addCase(d.fulfilled,i),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:i||rn,pending:a||rn,rejected:c||rn,settled:l||rn})}(i,o,a,t)}));const l=e=>e,u=new Map;let d;function p(e,t){return d||(d=c()),d(e,t)}function h(){return d||(d=c()),d.getInitialState()}function f(t,n=!1){function r(e){let r=e[t];return void 0===r&&n&&(r=h()),r}function s(t=l){const r=Dt(u,n,{insert:()=>new WeakMap});return Dt(r,t,{insert:()=>{const r={};for(const[s,o]of Object.entries(e.selectors??{}))r[s]=tn(o,t,h,n);return r}})}return{reducerPath:t,getSelectors:s,get selectors(){return s(r)},selectSlice:r}}const m={name:n,reducer:p,actions:i.actionCreators,caseReducers:i.sliceCaseReducersByName,getInitialState:h,...f(r),injectInto(e,{reducerPath:t,...n}={}){const s=t??r;return e.inject({reducerPath:s,reducer:p},n),{...m,...f(s,!0)}}};return m}}function tn(e,t,n,r){function s(s,...o){let i=t(s);return void 0===i&&r&&(i=n()),e(i,...o)}return s.unwrapped=e,s}var nn=en();function rn(){}var{assign:sn}=Object,on="listenerMiddleware",an=e=>{let{type:t,actionCreator:n,matcher:r,predicate:s,effect:o}=e;if(t)s=Lt(t).match;else if(n)t=n.type,s=n.match;else if(r)s=r;else if(!s)throw new Error(dn(21));return((e,t)=>{if("function"!=typeof e)throw new Error(dn(32))})(o),{predicate:s,type:t,effect:o}},cn=Object.assign((e=>{const{type:t,predicate:n,effect:r}=an(e);return{id:Vt(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(dn(22))}}}),{withTypes:()=>cn}),ln=Object.assign(Lt(`${on}/add`),{withTypes:()=>ln}),un=(Lt(`${on}/removeAll`),Object.assign(Lt(`${on}/remove`),{withTypes:()=>un}));function dn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");class pn extends i{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const hn=Xt("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,defaultLocale:r,preChat:s,agentParticipant:o,userParticipant:i,startChatIcon:a}=await t.getConfig(),c=n?.context?.userLocale||r,l=n?.context?.contentLocale||r,{connectWhenInView:u}=n;return{features:e,defaultLocale:r,preChat:s,agentParticipant:o,userParticipant:i,startChatIcon:a,defaultUserLocale:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})),fn=Xt("resetConfig",(async(e,{extra:{config:t}})=>t)),mn=bt((({app:e})=>e),(({userHasResponded:e})=>e)),yn="visibility",vn={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},gn=bt((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?vn.open:vn.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),bn=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:s,layoutMode:o,hideOnNoUserResponse:i}=r,{visible:a}=s||{};if("app"===o&&!t)return vn.open;if("window"===o&&i&&n!==vn.open)return e?n||t||vn.open:vn.hidden;if("inline"===o&&e&&!n)return t||vn.open;const c=vn.minimized;return n||t||a||c};var xn=n(7402),wn=n(8418),Cn=xn.default,_n=Symbol.for("react-redux-context"),En="undefined"!=typeof globalThis?globalThis:{};function Sn(){if(!Cn.createContext)return{};const e=En[_n]??(En[_n]=new Map);let t=e.get(Cn.createContext);return t||(t=Cn.createContext(null),e.set(Cn.createContext,t)),t}var jn=Sn();function Tn(e=jn){return function(){return Cn.useContext(e)}}var kn=Tn(),Nn=()=>{throw new Error("uSES not initialized!")},An=(e,t)=>e===t;function Rn(e=jn){const t=e===jn?kn:Tn(e),n=(e,n={})=>{const{equalityFn:r=An,devModeChecks:s={}}="function"==typeof n?{equalityFn:n}:n,{store:o,subscription:i,getServerState:a,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(Cn.useRef(!0),Cn.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,s.stabilityCheck])),d=Nn(i.addNestedSub,o.getState,a||o.getState,u,r);return Cn.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var In=Rn();Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen"),Symbol.for("react.client.reference");var On={notify(){},get:()=>[]};var Ln=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Mn="undefined"!=typeof navigator&&"ReactNative"===navigator.product,Pn=Ln||Mn?Cn.useLayoutEffect:Cn.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var Dn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:s="once",identityFunctionCheck:o="once"}){const i=Cn.useMemo((()=>{const t=function(e,t){let n,r=On,s=0,o=!1;function i(){l.onStateChange&&l.onStateChange()}function a(){s++,n||(n=t?t.addNestedSub(i):e.subscribe(i),r=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 s=t={callback:n,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){r&&null!==e&&(r=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}())}function c(){s--,n&&0===s&&(n(),n=void 0,r.clear(),r=On)}const l={addNestedSub:function(e){a();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:i,isSubscribed:function(){return o},trySubscribe:function(){o||(o=!0,a())},tryUnsubscribe:function(){o&&(o=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:s,identityFunctionCheck:o}}),[e,r,s,o]),a=Cn.useMemo((()=>e.getState()),[e]);Pn((()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),a!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[i,a]);const c=t||jn;return Cn.createElement(c.Provider,{value:i},n)};function Un(e=jn){const t=e===jn?kn:Tn(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Fn=Un();function Bn(e=jn){const t=e===jn?Fn:Un(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var zn,$n=Bn();zn=wn.useSyncExternalStoreWithSelector,Nn=zn,xn.useSyncExternalStore;const Hn=()=>In(gn);function Vn(){const{startChatIcon:e}=Hn();return e}const Wn=({state:e})=>e,qn=()=>In(Wn),Gn=bt(Wn,gn,mn,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const s={type:"service_data",payload:t.suggestion};return[...e,s]})),Kn=bt(Gn,gn,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,s)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const o=s[n-1];if(!t?.occurredAt||!o.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const i=g(t.occurredAt-o.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:i}}})):e})),Jn=()=>In(Kn),Xn=(bt(Kn,(e=>e.map((e=>e.payload.id)))),()=>qn().isLoading),Yn=()=>qn().unreadEvents,Zn=()=>qn().skiplinkTargetId,Qn=()=>qn().serviceInfo,er=bt(Kn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),tr=()=>{const{participants:e,currentAgent:t}=qn().participantInfo;return t?e[t]:null},nr=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=qn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},rr=()=>{const{layoutMode:e}=Hn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},sr=bt((({visibility:e})=>e),(e=>e.visibility)),or=bt((({visibility:e})=>e),(e=>e.showInlineView)),ir=[vn.open,vn.minimized,vn.hidden],ar=Xt("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const s=t(),o=sr(s),i=mn(s),a=n.hasConversation(),c=gn(s),{visibilityCallback:l=bn,layoutMode:u}=c,{unreadEvents:d}=Wn(s),p=l({hasResponded:i,previousVisibility:o,requestedVisibility:e,config:c});if(p&&!ir.includes(p))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),null;if(o===p)return null;const h=n.store.get(yn);return n.store.set(yn,{...h||{},[u]:e}),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:i,unreadMessageCount:d}),p})),cr=Xt("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:s}=gn(n()),o=r.store.get(yn)?.[s]||vn.initialize;return t(ar(o)),o})),lr=Xt("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{let s=n?.context?.contentLocale,o=n?.context?.userLocale;const i=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=await t.getConversationIntitialState();return s=e.context?.contentLocale||s,o=e.context?.userLocale||o,t.sendContext({...e.context,environment:i}),{initialState:e,contentLocale:s,userLocale:o,config:n}}return n?.context?.topic&&t.send("action",{type:U,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext({...n.context,environment:i}),{initialState:void 0,contentLocale:s,userLocale:o,config:n}}catch(e){if(e instanceof l){const e=new l;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new pn;return r({name:t.name,message:t.message,langKey:t.langKey})}})),ur=((e,t,n)=>{const{wait:r=300,maxWait:s=0,leading:o=!1}=n??{};let i,a=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,i&&(i(!0),i=void 0)};return Xt(e,t,{condition:()=>{const e=o&&!a;return a&&clearTimeout(a),a=setTimeout((()=>{l(),a=null}),r),!!e||(i&&(i(!1),i=void 0),s&&!c&&(c=setTimeout(l,s)),new Promise((e=>{i=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(fn()),await t(hn()),await t(lr()),t(cr())}),{wait:2e3,leading:!0}),dr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],pr=(e,t)=>{const{messages:n,...r}=(s=t,dr.reduce(((e,t)=>(t in s&&(e[t]=s[t]),e)),{}));var s;let o=e;return Object.keys(r).length>0&&(o={...o,...r}),n&&(o={...o,messages:{...o.messages,...n}}),o},hr=nn({name:"config",initialState:{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}},api:{domain:"",key:"",secure:!0,sendEnvironment:!0},context:{},notificationAudioURL:void 0,hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showSuggestions:!0,preChat:{enterDelay:1e3,exitAfter:4e3},continueChat:{enterDelay:0,exitAfter:2e3},customComponents:{},defaults:{visible:null},preChatEvents:[],parentElement:void 0,layoutMode:"window"},reducers:{setConfig:(e,{payload:t})=>pr(e,t),updateConfig:(e,{payload:t})=>pr(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(fn.fulfilled,(e=>e)).addCase(hn.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:s,defaultUserLocale:o,defaultContentLocale:i}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.userLocale=o,e.context.contentLocale=i,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=s}))}}),{setConfig:fr,updateConfig:mr,setPreChatEvents:yr}=hr.actions,vr=hr.reducer,gr={userHasResponded:!1},br=nn({name:"app",initialState:gr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>gr)).addCase(lr.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:xr}=br.actions,wr=br.reducer;class Cr extends i{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const _r={SeamlyGeneralError:c,SeamlyConfigurationError:a,SeamlySessionExpiredError:l,SeamlyOfflineError:Cr,SeamlyUnauthorizedError:u,SeamlyUnavailableError:pn},Er=Lt("catch-error",(e=>({payload:e}))),Sr={controls:{}},jr={touched:!1},Tr={controls:jr},kr=nn({name:"forms",initialState:Tr,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...Sr,persistData:t}:{...Sr,persistData:t};e[n]=r},deregisterForm:(e,{payload:{formId:t}})=>(e[t]?.persistData||delete e[t],e),registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:jr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const s={...r.controls};return delete s[t],{...e,[n]:{...r,controls:s}}},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{e[t]?.controls&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{e[t]?.controls[n]&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(ur.pending,(()=>Tr))}}),{registerForm:Nr,deregisterForm:Ar,registerControl:Rr,deregisterControl:Ir,updateControlValue:Or,updateControlTouched:Lr}=kr.actions,Mr=kr.reducer,Pr=Xt("setLocale",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return{translations:await t.getTranslations(e),userLocale:e}}catch(e){return n(e)}}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),Dr={translations:{"errors.configError.message":"We are sorry this happened, please retry at a later time.","errors.configError.srText":"A chat configuration error occurred. Our apologies, please retry at a later time.","errors.configError.title":"Chat configuration error.","errors.general.buttonText":"Restart chat","errors.general.message":"Do you want to start a new chat session?","errors.general.srText":"Something went wrong with the chat session. You can restart the chat.","errors.general.title":"Something went wrong","errors.seamlyOffline.message":"There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.","errors.seamlyOffline.srText":"The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.","errors.seamlyOffline.title":"Connection issues","errors.seamlyUnavailable.buttonText":"Try again","errors.seamlyUnavailable.message":"The server could not be reached. Try again in a little while.","errors.seamlyUnavailable.srText":"The chat server could not be reached. Try again in a little while.","errors.seamlyUnavailable.title":"Server unavailable"},isLoading:!1,initialLocale:void 0,userLocale:void 0},Ur=nn({name:"app",initialState:Dr,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Dr)).addCase(hn.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(Pr.pending,(e=>{e.isLoading=!0})).addCase(Pr.rejected,(e=>{e.isLoading=!1})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t?.translations&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>{if(!t.translations)return e;const r=t.translations[n];return e[n]=r,e}),{}))}))}}),{setInitialLocale:Fr,setTranslations:Br}=Ur.actions,zr=Ur.reducer,$r=Xt("getConversation",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return t.getConversation()}catch(e){return n({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError})}}),{condition(e,{getState:t}){const{state:{events:n}}=t(),r=n[n.length-1],s=e?.lastEvent?.id;return r&&s!==r.payload.id}}),Hr={error:void 0},Vr=nn({name:"interrupt",initialState:Hr,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>Hr},extraReducers:e=>{e.addCase(hn.pending,(()=>Hr)).addMatcher(Wt(lr.rejected,hn.rejected,Pr.rejected,ar.rejected,cr.rejected,$r.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Wr,clearInterrupt:qr}=Vr.actions,Gr=Vr.reducer,Kr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],Jr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===T.message&&!t.fromClient||e===T.info&&t.type===k,Xr=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),Yr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:s,name:o,introduction:i}=t.participant,a=n[r],c={...n,[r]:a?{...a,...s?{avatar:s}:{},...o?{name:o}:{},...i?{introduction:i}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Zr=(e,t)=>{const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{},{blockAutoEntrySwitch:r}=e,s=t?.payload?.actions||{},o=t?.payload?.translatedActions||{};if(!n)return{...e,optionsOverride:{},actions:s,translatedActions:o};const{type:i,options:a}=n;let c=e.active;return r||i===e.userSelected||(c=i),{...e,active:c,optionsOverride:{...e.optionsOverride||{},...i?{[i]:a}:{}},actions:s,translatedActions:o}},Qr={events:[],isLastEventFromClient:!1,initialState:{userResponded:!1},unreadEvents:0,userHasResponded:!1,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1,remaining:void 0,wasStopped:void 0,count:void 0,timer:void 0},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:"",proactiveMessages:!1},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:m(),optionsButtonId:m(),headerCollapseButtonId:m(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:N,active:N,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{},actions:{},translatedActions:{}},seamlyContainerElement:null},es=nn({name:"store",initialState:Qr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,s=e.options.features.hasOwnProperty(q);let o={...e.options};if(s&&(n===T.message||n===T.participant)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;o={...o,features:{...o.features,uploads:{enabled:o.features.uploads?.enabled||!1,...o.features?.uploads||{},enabledFromEntry:e===A}}}}const i=Jr(t.payload);if(e.events.find((e=>e.payload.id===r.id)))return;const a=Zr(e.entryMeta,t.payload);e.entryMeta=s||a.active!==A?a:{...e.entryMeta},e.options=o,i&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?I:R)),t.payload.payload.key=m(),e.events.push(t.payload),r.fromClient&&(e.isLastEventFromClient=r.fromClient)},ackEvent:(e,{payload:{payload:t}})=>{if(!t.transactionId)return void console.warn("ACK received without transaction ID.");const n=e.events.find((e=>e.payload.transactionId===t.transactionId&&(!t.type||e.type===t.type))),{id:r,occurredAt:s}=t;n&&(n.payload.id=r,n.payload.occurredAt=s,e.events=Xr(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(e.payload.id&&-1!==t.indexOf(e.payload.id)&&(e.payload={...e.payload,..."service_data"!==e.type&&e.payload.messageStatus===R&&{messageStatus:I}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:s,serviceData:o,resumeConversationPrompt:i}})=>{const a=((e,t)=>{const n=e.filter((e=>"message"===e.type&&!e.payload.optimisticallyInjected&&!t.some((t=>t.payload.id===e.payload.id)))),r=t.filter((e=>!("participant"===e.type&&!e.payload.participant?.introduction))).reverse();return Xr([...r,...n])})(e.events,t),c={...e.participantInfo.participants,...n},l=a.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let u=null;l&&("message"===l.type&&(u=l.payload.participant),"participant"===l.type&&(u=l.payload.participant?.id));const{entry:d}=s,p=d?.options?.upload,h=Zr({...e.entryMeta,...d,active:d?.default||k,options:{...d?.options?d.options:{}}},a[a.length-1]);let f={...e.options.features};const m=f.hasOwnProperty(q);if(m&&"message"===l?.type){const{payload:e}=l,t=e?.entry?.type||{};f={...f,uploads:{enabled:!(!p||!p?.enabled),enabledFromEntry:t===A}}}e.unreadEvents=a.filter((e=>"message"===e.type&&e.payload.messageStatus===R)).length,e.events=a.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...u?Yr(e.participantInfo,{participant:c[u]}):{},participants:c},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,activeServiceSessionId:r,proactiveMessages:s?.proactiveMessages?.enabled||!1},e.serviceData={...e.serviceData,...o},e.options={...e.options,features:f},e.entryMeta=m||h.active!==A?h:{...e.entryMeta},e.resumeConversationPrompt=i||!1,u&&(e.headerTitles.subTitle=c[u].name)},resetHistoryLoadedFlag:e=>{e.historyLoaded=!1},setIsLoading:(e,{payload:t})=>{e.isLoading=t},initIdleDetachCountdown:(e,{payload:t})=>{const{delaySeconds:n,delayTime:r}=t;e.idleDetachCountdown={hasCountdown:!0,isActive:!0,wasStopped:!1,count:n,remaining:n,timer:r}},decrementIdleDetachCountdownCounter:e=>{const{idleDetachCountdown:t}=e,{remaining:n=0}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=b(r)},stopIdleDetachCountdownCounter:e=>{e.idleDetachCountdown.isActive=!1,e.idleDetachCountdown.wasStopped=!0},clearIdleDetachCountdown:e=>{e.idleDetachCountdown.hasCountdown=!1,e.idleDetachCountdown.isActive=!1},initResumeConversationPrompt:e=>{e.resumeConversationPrompt=!0},clearResumeConversationPrompt:e=>{e.resumeConversationPrompt=!1},setParticipant:(e,{payload:t})=>{e.participantInfo=Yr(e.participantInfo,{participant:t.participant,fromClient:t.fromClient})},setActiveService:(e,{payload:t})=>{e.serviceInfo.activeServiceSessionId!==t&&(e.serviceInfo.activeServiceSessionId=t)},setHeaderTitle:(e,{payload:t})=>{e.headerTitles.title=t},setHeaderSubTitle:(e,{payload:t})=>{e.headerTitles.subTitle=t},setInitialState:(e,{payload:t})=>{e.initialState=t,e.unreadEvents=Qr.unreadEvents},setServiceDataItem:(e,{payload:t})=>{e.serviceData[t.type]=t},setFeatures:(e,{payload:t})=>{t.features&&(e.options.features=t.features)},setFeatureEnabledState:(e,{payload:t})=>{e.options.features.hasOwnProperty(t.key)&&(e.options.features[t.key].enabled=t.enabled)},clearFeatures:e=>{e.options.features={webNotifications:e.options.features.webNotifications}},showOption:(e,{payload:t})=>{e.options.panelActive=!0,e.options.optionActive=t},hideOption:e=>{e.options.panelActive=!1,e.options.optionActive=""},setUserSelectedOptions:(e,{payload:t})=>{e.options.userSelectedOptions=t},setUserSelectedOption:(e,{payload:t})=>{const{option:n,value:r}=t;e.options.userSelectedOptions[n]=r},setBlockAutoEntrySwitch:(e,{payload:t})=>{e.entryMeta.blockAutoEntrySwitch=t},setServiceEntryMetadata:(e,{payload:t})=>{e.entryMeta.active=t.default,e.entryMeta.options=t.options||{},e.entryMeta.optionsOverride={},e.entryMeta.actions={},e.entryMeta.translatedActions={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},clearAbortTransaction:e=>{e.entryMeta.actions={},e.entryMeta.translatedActions={}},registerUpload:(e,{payload:t})=>{e.currentUploads.push({id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle})},setUploadProgress:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}:e))},startProcessingImage:(e,{payload:t})=>{e.processingFileUploads.push(t)},doneProcessingImage:(e,{payload:t})=>{e.processingFileUploads=e.processingFileUploads.filter((e=>e!==t))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,error:t.errorText,progress:0,uploading:!1,uploadHandle:null}:e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?{...e,complete:!0}:e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t},setProactiveMessages:(e,{payload:t})=>{e.serviceInfo.proactiveMessages=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Qr)).addCase(lr.pending,(e=>{e.isLoading=!0})).addCase(hn.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name,t.features&&(e.options.features=t.features)})).addCase(lr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Wt(us,ds),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:ts,addEvent:ns,clearAllUploads:rs,clearEvents:ss,clearFeatures:os,clearIdleDetachCountdown:is,clearResumeConversationPrompt:as,decrementIdleDetachCountdownCounter:cs,hideOption:ls,initIdleDetachCountdown:us,initResumeConversationPrompt:ds,registerUpload:ps,resetHistoryLoadedFlag:hs,setActiveEntryType:fs,setActiveService:ms,setBlockAutoEntrySwitch:ys,setEventsRead:vs,setFeatureEnabledState:gs,setFeatures:bs,setHeaderSubTitle:xs,setHeaderTitle:ws,setHistory:Cs,setInitialState:_s,setIsLoading:Es,setLoadedImageEventIds:Ss,setParticipant:js,setSeamlyContainerElement:Ts,setServiceDataItem:ks,setServiceEntryMetadata:Ns,clearAbortTransaction:As,setUploadComplete:Rs,setUploadError:Is,setUploadProgress:Os,startProcessingImage:Ls,doneProcessingImage:Ms,setUserEntryType:Ps,setUserSelectedOption:Ds,setUserSelectedOptions:Us,showOption:Fs,stopIdleDetachCountdownCounter:Bs,setProactiveMessages:zs}=es.actions,$s=es.reducer,Hs={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Vt(),translatedEventGroups:{},translationProposal:null},Vs=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},s,o)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return o.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,s]]=Object.entries(n);return{lastGroupId:e.filter((e=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:s}},Ws=nn({name:"translation",initialState:Hs,reducers:{enableTranslation:(e,{payload:t})=>{e.isActive=!0,e.currentLocale=t},disableTranslation:e=>{e.isActive=!1,e.currentLocale=void 0},enableEventsTranslation:(e,{payload:{events:t,id:n}})=>{delete e.translatedEventGroups[n];const{lastGroupId:r}=Vs(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:s,eventIds:o}=Vs(t,n);e.lastGroupId=r,e.translatedEventGroups[s]=o},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Hs)).addCase(hn.fulfilled,((e,{payload:t})=>{const n=t?.features?.translation;n?.languages&&(e.isAvailable=!0===n.enabled,e.languages=[...n.languages].sort(((e,n)=>e.locale===t.defaultUserLocale?-1:n.locale===t.defaultUserLocale?1:e.nativeName?.localeCompare(n.nativeName||"",void 0,{sensitivity:"base"})||0)))})).addCase(Cs,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(ns,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:qs,disableTranslation:Gs,enableEventsTranslation:Ks,disableEventsTranslation:Js,setTranslationProposalPrompt:Xs,disableTranslationProposalPrompt:Ys}=Ws.actions,Zs=Ws.reducer,Qs=({dispatch:e})=>t=>n=>{const r=t(n);if(Cs.match(n)&&n.payload?.translation?.enabled)return e(qs(n.payload.translation.locale)),e(Pr(n.payload.translation.locale)),r;if(hn.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(Pr(n.payload.defaultUserLocale)),r;if(lr.fulfilled.match(n))return n.payload.userLocale&&e(Pr(n.payload.userLocale)),r;if(ns.match(n)&&"info"===n.payload.type&&n.payload.payload.body&&"subtype"in n.payload.payload.body&&"new_translation"===n.payload.payload.body.subtype){const{body:t}=n.payload.payload;if(t.translationLocale&&t.translationEnabled)return e(Pr(t.translationLocale)),r}return r},eo=nn({name:"visibility",initialState:{visibility:vn.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(ar.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(hn.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:to}=eo.actions,no=Tt({state:$s,app:wr,config:vr,i18n:zr,translations:Zs,visibility:eo.reducer,forms:Mr,interrupt:Gr});function ro({initialState:e,api:t,eventBus:n,config:r}){const s=function(e){const t=Ut(),{reducer:n,middleware:r,devTools:s=!0,preloadedState:o,enhancers:i}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!St(n))throw new Error(dn(1));a=Tt(n)}if(!$t&&r&&"function"!=typeof r)throw new Error(dn(2));if("function"==typeof r){if(c=r(t),!$t&&!Array.isArray(c))throw new Error(dn(3))}else c=t();if(!$t&&c.some((e=>"function"!=typeof e)))throw new Error(dn(4));let l=kt;s&&(l=It({trace:!$t,..."object"==typeof s&&s}));const u=function(...e){return t=>(n,r)=>{const s=t(n,r);let o=()=>{throw new Error(wt(15))};const i={getState:s.getState,dispatch:(e,...t)=>o(e,...t)},a=e.map((e=>e(i)));return o=kt(...a)(s.dispatch),{...s,dispatch:o}}}(...c),d=zt(u);if(!$t&&i&&"function"!=typeof i)throw new Error(dn(5));let p="function"==typeof i?i(d):d();if(!$t&&!Array.isArray(p))throw new Error(dn(6));if(!$t&&p.some((e=>"function"!=typeof e)))throw new Error(dn(7));return $t||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),jt(a,o,l(...p))}({reducer:no,preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat(function({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:s,api:o,layoutMode:a}=gn(t()),{error:c,type:l}=n,u=_r[c?.name]?new _r[c.name](c):new i(c);r?.(u,{namespace:s,api:o,layoutMode:a,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{try{return t.payload?.originalEvent?.payload?n({error:t.payload,type:t.payload?.originalEvent?.payload?.type}):t.payload?.originalError&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}({api:t}),function({api:e}){return()=>t=>n=>{const{payload:r,type:s}=n;if(s===Wr.type){if(!Kr.includes(r.name))throw new c(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}({api:t}),function({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case Us.toString():e.store.set("options",n.payload);break;case Ds.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Qs)});return s}const so=$n;var oo=n(1162);function io(e=""){const t=e=>/\s/.test(e),n=[],r={};let s=0,o=null,i=!1,a=0;for(;a<e.length;){if(i&&(t(e[a])||"{"===e[a]))i=!1,o=e.slice(s,a),"{"===e[a]&&a--;else if(!i&&!t(e[a])){const t="{"===e[a];if(o&&t){const t=ao(e,a);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[o]=e.slice(a+1,t),a=t,o=null}else o&&(n.push(o),o=null),i=!0,s=a}a++}return i&&(o=e.slice(s)),o&&n.push(o),{args:n,cases:r}}function ao(e,t){let n=0;for(let r=t+1;r<e.length;r++){let t=e.charAt(r);if("}"===t){if(0===n)return r;n--}else"{"===t&&n++}return-1}function co(e){return lo(e.slice(1,-1),",",3)}function lo(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let s=e.indexOf(t);if(-1===s)return r.push(e),r;let o=e.substring(0,s).trim(),i=e.substring(s+t.length+1).trim();return r.push(o),lo(i,t,n-1,r)}let uo,po=0;const ho="other";function fo(e,t){let n=0,r="",s=0;const o={};for(;n<e.length;){if("#"!==e[n]||s)r+=e[n];else{let e="__hashToken"+po++;r+=`{${e}, number}`,o[e]=t}"{"===e[n]?s++:"}"===e[n]&&s--,n++}return{caseBody:r,numberValues:o}}const mo="other",yo=bt((({i18n:e})=>e),(({translations:e})=>e)),vo=bt((({i18n:e})=>e),(({initialLocale:e})=>e)),go=bt((({i18n:e})=>e),(({userLocale:e})=>e)),bo=bt((({i18n:e})=>e),(({isLoading:e})=>e)),xo=new class{constructor(e,t={}){this.locale=e,this.typeHandlers=t}format=function(e){const t={};return function(...n){let r=n.length?n.map((e=>null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e))).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,r))return t[r];let s=e(...n);return t[r]=s,s}}(((e,t={})=>this.process(e,t).flat(1/0).join("")));process(e,t={}){if(!e)return[];let n=e.indexOf("{");if(-1!==n){let r=ao(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let s=e.substring(n,r+1);if(s){let o=[],i=e.substring(0,n);i&&o.push(i);let[a,c,l]=co(s),u=t[a];null==u&&(u="");let d=c&&this.typeHandlers[c];o.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&o.push(this.process(p,t)),o}}}return[e]}}("en-GB",{plural:function(e,t,n,r,s){const{args:o,cases:i}=io(t);let a=parseInt(e);o.forEach((e=>{e.startsWith("offset:")&&(a-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==uo&&uo.resolvedOptions().locale===n||(uo=new Intl.PluralRules(n));const e=uo.select(a);e!==ho&&c.push(e)}1===a&&c.push("one"),c.push(`=${a}`,ho);for(let e=0;e<c.length;e++){const t=c[e];if(t in i){const{caseBody:e,numberValues:n}=fo(i[t],a);return s(e,{...r,...n})}}return e},select:function(e,t,n,r,s){const{cases:o}=io(t);return e in o?s(o[e],r):mo in o?s(o[mo],r):e}});function wo(){const e=In(yo),t=In(go),n=In(vo),r=In(bo);return{t:(0,oo.useCallback)(((n,s={})=>{if(!e)return"";const o=e[n];return o?xo.format(o,s):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const Co=()=>{const e=so(),t=In(sr),n=!!t&&t!==vn.hidden,r=t===vn.open,s=t===vn.minimized,o=(0,oo.useCallback)((t=>e(ar(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:s,visible:t,setVisibility:o,openChat:()=>{o(vn.open)},closeChat:()=>{o(vn.minimized)}}},_o=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,s.createRef)()})=>{const[r,o]=(0,oo.useState)(null),i=!!r?.isIntersecting||!t,a=i&&e,c=([e])=>o(e);return(0,oo.useEffect)((()=>{const e=n?.current;if(!window.IntersectionObserver||a||!e||!t)return()=>{};const r=new IntersectionObserver(c,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,a]),{isVisible:i,containerRef:n}},Eo=()=>In(mn),So=(0,s.createContext)(null),jo=(0,s.createContext)(null),To=(0,s.createContext)(null),ko=()=>{const e=(0,oo.useContext)(jo);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},No=()=>{const e=(0,oo.useContext)(So);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},Ao=()=>No().store,Ro=()=>{const e=No();return(0,oo.useCallback)((()=>e.hasConversation()),[e])},Io=()=>{const e=No(),t=so(),n=ko(),r=Eo(),s=Ro(),{visible:o,setVisibility:i}=Co(),a=Yn(),c=(0,oo.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,oo.useCallback)((()=>{c("ui.beforeStart",{visibility:o,hasConversation:s(),hasResponded:r,unreadMessageCount:a}),e.send("start"),c("ui.start",{visibility:o,hasConversation:s(),hasResponded:r,unreadMessageCount:a})}),[e,c,s,r,a,o]),u=(0,oo.useCallback)((async()=>{await t(ur())}),[t]),d=(0,oo.useCallback)((e=>({type:e,id:m(),transactionId:m(),participant:p,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,oo.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,oo.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const s={...h(n),...r};e.send("message",s),c("message",s),t(ns({type:"message",payload:{...s,optimisticallyInjected:!0}}))}),[e,t,c,h]),y=(0,oo.useCallback)(((e,n=m())=>{t(ns({type:"message",payload:{...h(e),transactionId:n}}))}),[t,h]),v=(0,oo.useCallback)(((e,n,r,s,o,i,a)=>{t(ns({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:p,fromClient:!0,occurredAt:r,body:{contentType:s,filename:o,filesize:i,url:a}}}))}),[t]),g=(0,oo.useCallback)(((e,n=m())=>{t(ns({type:"info",payload:{body:{subtype:e},fromClient:!1,fromHistory:!0,id:m(),transactionId:n,type:"divider"}}))}),[t]),b=(0,oo.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==L&&n!==M&&c(`action.${n}`,t)}),[e,c]),x=(0,oo.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,oo.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(_s(e)),e.userResponded&&(t(xr(e.userResponded)),i(vn.open)))})).catch((e=>{t(Wr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,i]);return{connect:w,start:l,sendMessage:f,sendAction:b,sendContext:x,reset:u,emitEvent:c,addMessageBubble:y,addUploadBubble:v,addDivider:g,apiConnected:e.connected,apiConfigReady:e.configReady}},Oo=()=>{const e=(()=>{const e=(0,oo.useContext)(To);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,oo.useCallback)((t=>{t&&e({ariaLive:V,messageText:t})}),[e]),sendAssertive:(0,oo.useCallback)((t=>{t&&e({ariaLive:H,messageText:t})}),[e])}},Lo=bt((({interrupt:e})=>e),(({error:e})=>e)),Mo=bt(Lo,(e=>Boolean(e)));function Po(){const{t:e}=wo(),t=In(Lo);return{hasError:In(Mo),meta:(0,oo.useMemo)((()=>{if(!t)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0,action:void 0};const{langKey:n,action:r}=t,s=e(`${n}.title`),o=e(`${n}.message`),i=e(`${n}.srText`),a=r?e(`${n}.buttonText`):null;return{...n?{title:s,message:o,srText:i}:{},...r?{action:r}:{},...r&&n?{buttonText:a}:{},originalError:t}}),[t,e]),error:t}}const Do=()=>{const{t:e}=wo(),{isInline:t,isWindow:n,isApp:r}=rr(),{isOpen:s,isVisible:o}=Co(),i=In(or),{start:a,connect:l,apiConfigReady:u,apiConnected:d}=Io(),p=(0,oo.useRef)(!1),{sendAssertive:h}=Oo();!function(){const{meta:{originalError:e,action:t}}=Po(),n=so(),{reset:r}=Io(),s="SeamlySessionExpiredError"===e?.name,o=(0,oo.useRef)(0),i=(0,oo.useRef)(null);(0,oo.useEffect)((()=>{if(s&&"reset"===t){if(o.current>=10){i.current=setTimeout((()=>{o.current=0}),1e4);const e=new c;return n(Wr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}o.current+=1,r()}return()=>{i.current&&clearTimeout(i.current)}}),[t,r,s,n])}(),(0,oo.useEffect)((()=>{o&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[o,h,e]),(0,oo.useEffect)((()=>{o&&h(e(s?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[s,o,h,e]),(0,oo.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,oo.useCallback)((async()=>{d||(p.current=!0,await l()),(r||s||o&&t)&&a()}),[d,l,r,t,s,o,a]);(0,oo.useEffect)((()=>{!u||p.current||n&&!s||!(!t||o&&i)||f()}),[u,f,t,s,o,n,i])},Uo=require("preact/compat"),Fo=require("preact/jsx-runtime"),Bo=({children:e})=>(Do(),(0,Fo.jsx)(Fo.Fragment,{children:e})),zo=(0,s.createContext)(null),$o=(e=0)=>new Promise((t=>{setTimeout(t,e)})),Ho=()=>{const{seamlyContainerElement:e}=qn(),t=so();return[e,(0,oo.useCallback)((e=>{t(Ts(e))}),[t])]},Vo=e=>(0,oo.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await $o(180);const e="string"==typeof t?document.getElementById(t):t;E(e)}))}),[e]),Wo=()=>{const e=Zn();return Vo(e)},qo=e=>bt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function Go(){const{sendContext:e}=Io(),t=so(),n=Hn(),r=(0,oo.useCallback)(((t,n)=>{e({userLocale:t,source:n})}),[e]),s=(0,oo.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(Gs())}),[n.context?.contentLocale,t,e]),{languages:o,isActive:i,isAvailable:a,currentLocale:c}=In((({translations:e})=>e));return{languages:o,isActive:i,isAvailable:a,currentLocale:c,enableTranslations:r,disableTranslations:s}}const Ko=e=>{const t=In(qo(e));if(!e?.payload)return{body:void 0,hasTranslation:!1,isTranslated:!1,locale:""};const n=e.payload?.translatedBody&&"data"in e.payload.translatedBody?e.payload?.translatedBody.data:e.payload.translatedBody,{translation:r,body:s}={body:e.payload?.body,translation:e.payload?.translation},o=!!n;return{body:t&&o?n:s,hasTranslation:o,isTranslated:t&&o,locale:r?.locale}};function Jo(){const e=In((({translations:e})=>e.containerId));return{id:e,focusContainer:Vo(e)}}function Xo(e){const{languages:t}=Go();return(0,oo.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const Yo=()=>{const{isActive:e,languages:t}=Go(),n=so(),{sendAction:r}=Io(),{translationProposal:s}=In((e=>e.translations)),{enableTranslations:o}=Go(),{isOpen:i}=Co(),{userLocale:a}=wo(),c=s?.proposedLocale,l=Xo(c),u=(0,oo.useMemo)((()=>null!==s&&!e&&i&&a!==c&&t.some((e=>e.locale===c))),[s,e,i,a,c,t]);return{activateTranslationProposal:()=>{o(s?.proposedLocale,z)},dismissTranslationProposal:()=>{r({type:D,body:{type:B}}),n(Ys())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:s}},Zo=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e?.split(" "))).flat().filter((e=>e&&e.length)).map((e=>e&&e.indexOf(d)>-1?e:[d,e].join("-"))).join(" "),Qo=()=>Hn().appContainerClassNames,ei=e=>{const{fromClient:t}=e.payload,n=["message"];return"info"===e.type?n.push("message--source-info"):t?n.push("message--source-user"):n.push("message--source-agent"),n},ti=()=>{const e=No();return(0,Uo.useSyncExternalStore)(ve.subscribe,(()=>e.conversation))},ni=(0,s.createContext)(null),ri=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=qn(),{allowedMimeTypes:s,maxSize:o}=n.upload||{},{enabled:i,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...s?{allowedMimeTypes:s}:{},...o?{maxSize:o}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||i,allowedMimeTypes:c,maxSize:l}},si=()=>{const{currentUploads:e}=qn(),t=so(),n=(()=>{const e=(0,oo.useContext)(ni);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,oo.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,oo.useCallback)((()=>{t(rs())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},oi=()=>{const{t:e}=wo(),{options:t}=qn(),{panelActive:n,optionActive:r,userSelectedOptions:s,features:o}=t,{extraMenuItem:i,sendTranscript:a}=o,c={extraMenuItem:i,sendTranscript:a},l=t=>"extraMenuItem"===t?"Extra menu item":e(`options.${t}.menuTitle`),u=Object.keys(c).filter((e=>c[e])).map((e=>({name:e,title:l(e),available:c[e].enabled}))),d=i||a,p=so(),{get:h,set:f}=Ao();return{allowOptionSelection:d,userSelectedOptions:s,features:o,menuOptions:u,initUserSelectedOptions:(0,oo.useCallback)((()=>{const e=h("options")||{};p(Us(e))}),[h,p]),setUserSelectedOptions:(0,oo.useCallback)((e=>{p(Us(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,oo.useCallback)(((e,t)=>{const n=h("options")||{};"object"==typeof n&&f("options",{...n,[e]:t}),p(Ds({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(Fs(e))},hideOption:()=>{p(ls())},panelActive:n,optionActive:r}},ii=()=>{const{optionsButtonId:e}=qn();return{id:e,focusButton:Vo(e)}},ai=(0,s.createContext)(null),ci=()=>{const e=(0,oo.useContext)(ai);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},li=()=>{const e=so(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:s,timer:o,wasStopped:i}}=qn(),{isOpen:a}=Co(),{emitEvent:c,sendAction:l}=Io(),{t:u}=wo(),{sendAssertive:d,sendPolite:p}=Oo(),h=(0,oo.useCallback)((e=>{a&&d(e)}),[a,d]),f=(0,oo.useCallback)((e=>{a&&p(e)}),[a,p]),m=(0,oo.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=b(n);e(us({delaySeconds:n,delayTime:r})),c("idleTimer.start"),h(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,h,u]),y=(0,oo.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:P}),h(u("idleDetachWarning.notifyTransferText"))),i||c("idleTimer.stop"),e(is()))}),[e,c,t,l,h,u,i]),v=(0,oo.useCallback)((()=>{if(!s||s<=0)return;const t=s-1;t%10==0&&h(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",b(t))}`),e(cs())}),[e,s,h,u]),g=(0,oo.useCallback)((()=>{n&&(e(Bs()),s&&(c("idleTimer.stop"),f(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,s,f,u]);return{hasCountdown:t,isActive:n,count:r,remaining:s,timer:o,wasStopped:i,initCountdown:m,endCountdown:y,decrementCountdown:v,stopCountdown:g}},ui=()=>{const e=so(),t=qn().resumeConversationPrompt,{sendAction:n}=Io(),{t:r}=wo(),{sendAssertive:s}=Oo();return{continueChat:()=>{n({type:D,body:{type:"resume_conversation_prompt"}}),e(as())},hasPrompt:t,restartChat:()=>{s(r("resumeConversationPrompt.srNotifyRestartText")),n({type:P}),e(as())}}},di=()=>{const[e]=(0,oo.useState)((()=>m()));return e},pi=(e,t)=>{const n=ti();(0,oo.useEffect)((()=>{if(n.channel){const{channel:r}=n;r.onMessage=(n,r)=>(t&&!t({type:n,payload:r})||e({type:n,payload:r}),r)}}),[e,t,n])},hi=({eventPayload:e})=>{const{t}=wo(),{fromClient:n,participant:r}=e,s=(e=>qn().participantInfo.participants[e])(r)||{},{messages:o}=Hn(),i=n?t("participants.user.name"):s&&s.name,{showAvatar:a,showName:c}=o&&o[n?"user":"agent"]||{};if(!a&&!c)return null;const l=[];return a&&i&&s.avatar&&l.push((0,Fo.jsx)("span",{className:Zo("message__avatar"),children:(0,Fo.jsx)("img",{src:s.avatar,className:Zo("avatar"),alt:""})})),c&&i&&l.push((0,Fo.jsx)("span",{className:Zo("message__author-name"),children:i})),l.length>0?(0,Fo.jsx)("div",{className:Zo("message__author"),children:l}):null},fi=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:s,bodyProps:o={},info:i,...a})=>{const c=ei(t),{hasTranslation:l,isTranslated:u,locale:d}=Ko(t);return n&&c.push(`message--type-${n}`),r&&("string"==typeof r&&(r=r.split(" ").filter((e=>e.length))),r.forEach((e=>{c.push(`message--${e}`)}))),u&&c.push("message--is-translated"),l&&c.push("message--has-translation"),u&&(o={...o,lang:d}),(0,Fo.jsx)(Fo.Fragment,{children:(0,Fo.jsxs)("div",{className:Zo(c),...a,children:[e&&(0,Fo.jsx)(hi,{eventPayload:t.payload}),(0,Fo.jsx)("div",{className:Zo("message__body"),...o,children:s}),i&&(0,Fo.jsx)("div",{"aria-hidden":"true",className:Zo("message__info"),children:i})]})})},mi=({id:e,action:t,buttonText:n,description:r,hasFocus:s,image:o,title:i,isCarouselItem:a})=>{const c=(0,oo.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=Io(),p=di(),h=(0,oo.useRef)(!1),f=t?.type===G?"a":"button",m=(0,oo.useCallback)((()=>d("action.click_card",{type:F,originMessage:e,action:t})),[d,e,t]),y=(0,oo.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:U,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),v=(0,oo.useMemo)((()=>t?.type===G?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,oo.useEffect)((()=>{a&&(s&&h.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),h.current=!0}),[s,a]),(0,Fo.jsxs)("div",{className:Zo("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[o?(0,Fo.jsx)("img",{className:Zo("card__image"),src:o,alt:""}):null,(0,Fo.jsxs)("div",{className:Zo("card__content"),id:e,children:[i&&(0,Fo.jsx)("h2",{className:Zo("card__title"),children:i}),r&&(0,Fo.jsx)("div",{className:Zo("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,Fo.jsx)(f,{tabIndex:a&&!s?-1:void 0,className:Zo("button","button--primary"),"aria-describedby":p,...v,children:n})]})]})};function yi({item:e,items:t,index:n,isActive:r}){const{t:s}=wo();return(0,Fo.jsx)("div",{className:Zo("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":s("carousel.slide.label",{index:n+1,total:t.length}),children:(0,Fo.jsx)(mi,{...e,isCarouselItem:!0,hasFocus:r})})}const vi={send:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>'},balloon:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>'},newTopic:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>'},newTranslation:{16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>'},avatar:{32:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">\n<path fill="#4A48C1" d="M10,14.8c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S11.1,14.8,10,14.8z M15.9,14.8c1.1,0,2-0.9,2-2s-0.9-2-2-2\n\ts-2,0.9-2,2S14.8,14.8,15.9,14.8z M21.8,10.8c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S22.9,10.8,21.8,10.8z M21.3,18.1H10.7\n\tC11.7,23.9,20.2,23.9,21.3,18.1z"/>\n</svg>\n'},chevronDown:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>'},chevronRight:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>'},close:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>'},enlarge:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>'},options:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>'},file:{32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>'},upload:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>'},download:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>'},error:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>'},arrowLeft:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n'},arrowRight:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},check:{16:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="16px"\n height="16px"\n x="0px"\n y="0px"\n viewBox="0 0 16 16"\n>\n <path\n fill="currentColor"\n d="M11.6,4.3l-5,5L4.9,7.5C4.4,7,3.7,7,3.2,7.5l0,0C2.8,8,2.8,8.7,3.2,9.2l1.7,1.7l0,0l0.8,0.8\n\tc0.5,0.5,1.2,0.5,1.7,0l0.8-0.8l5-5c0.5-0.5,0.5-1.2,0-1.7l0,0C12.8,3.8,12.1,3.8,11.6,4.3z"\n />\n</svg>\n',32:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="32px"\n height="32px"\n x="0px"\n y="0px"\n viewBox="0 0 32 32"\n>\n <path\n fill="currentColor"\n d="M22.9,9.3l-9.3,9.3l-3.2-3.2c-0.9-0.9-2.3-0.9-3.2,0l0,0c-0.9,0.9-0.9,2.3,0,3.2l3.2,3.2l0,0l1.6,1.6\n\tc0.9,0.9,2.3,0.9,3.2,0l1.6-1.6l9.3-9.3c0.9-0.9,0.9-2.3,0-3.2l0,0C25.2,8.4,23.7,8.4,22.9,9.3z"\n />\n</svg>\n'}},gi=({name:e,size:t="32",className:n,alt:r})=>(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("div",{"aria-hidden":"true",className:n||Zo("icon"),dangerouslySetInnerHTML:{__html:vi[e][t]}}),r&&(0,Fo.jsx)("span",{className:Zo("visually-hidden"),children:r})]});function bi({items:e,currentIndex:t,onChange:n,children:r}){const{t:s}=wo(),o=e.length;return(0,Fo.jsxs)("div",{className:Zo("carousel-controls"),children:[(0,Fo.jsx)("button",{className:Zo("button","button--previous"),"aria-label":s("carousel.controls.previous"),onClick:()=>{n((t-1+o)%o)},children:(0,Fo.jsx)(gi,{name:"arrowLeft",size:"16",alt:""})}),r,(0,Fo.jsx)("button",{className:Zo("button","button--next"),"aria-label":s("carousel.controls.next"),onClick:()=>{n((t+1)%o)},children:(0,Fo.jsx)(gi,{name:"arrowRight",size:"16",alt:""})})]})}function xi({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:s}){const o=e.length,i=(0,oo.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),s=Math.min(o-1,Math.max(0,r));s!==t&&n(s)}),[o,t,n]);return(0,Fo.jsx)("div",{className:Zo("carousel-pagination__wrapper"),role:"group",children:(0,Fo.jsx)("ul",{className:Zo("carousel-pagination"),children:e.map(((e,n)=>{const o=t===n;return(0,Fo.jsx)("li",{className:Zo("carousel-pagination__item",o?"is-active":void 0),children:(0,Fo.jsx)("button",{className:Zo("carousel-pagination__button"),type:"button",onClick:i,"data-item":n,"aria-disabled":o?"true":void 0,"aria-label":s(e,n)})},r(e,n,"pagination-item-"))}))})})}const wi=(e,t,n)=>`${n}${t}`,Ci=e=>e.label,_i=({target:e})=>{e.scrollLeft=0};function Ei({currentIndex:e=0,onChange:t=(()=>{}),getItemKey:n=wi,getItemLabel:r=Ci,items:o}){const i=di(),a=o.length,[c,l]=(0,oo.useState)(Number(e||0));(0,oo.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,oo.useRef)([]);u.current=(0,oo.useMemo)((()=>Array(a).fill(1).map((()=>(0,s.createRef)()))),[a]);const d=(0,oo.useRef)(!0),p=(0,oo.useRef)(null);return p.current=t,(0,oo.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,Fo.jsxs)("div",{className:Zo("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,Fo.jsx)("div",{className:Zo("carousel__slides-wrapper"),onScroll:_i,children:(0,Fo.jsx)("div",{id:i,className:Zo("carousel__slides"),style:{width:100*a+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:o.map(((e,t)=>{const r=c===t;return(0,Fo.jsx)("div",{ref:u.current[t],className:Zo("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,Fo.jsx)(yi,{item:e,items:o,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,Fo.jsx)("div",{className:Zo("carousel__controls"),children:(0,Fo.jsx)(bi,{currentIndex:c,items:o,onChange:l,children:(0,Fo.jsx)("div",{className:Zo("carousel__pagination"),children:(0,Fo.jsx)(xi,{currentIndex:c,items:o,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const Si=(e,t,n="")=>`${n}${e.title}:${t}`,ji=e=>e.title,Ti=e=>{const{payload:t}=e,[n,r]=(0,oo.useState)(!1),{sendAction:s,addMessageBubble:o,addDivider:i}=Io(),{activeServiceSessionId:a}=Qn(),c=In(er),{body:l}=Ko(e),{service:u}=t,d=(0,oo.useMemo)((()=>{if("choice_prompt"===e.payload.type)return{...e,payload:{...e.payload,body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&{...e.payload.translatedBody,data:e.payload.translatedBody?.prompt}}}}),[e]),p=l?.chooseAgain&&a===u?.serviceSessionId&&t.id!==c;return(0,oo.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:d,showOptions:n,chooseAgain:p,onChoiceClickHandler:e=>{const n=m();p&&i("new_topic",n),o(e.text,n),s({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:p},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}},ki=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Ni=({id:e,categories:t=[],question:n,onClick:r,hasIcon:s})=>{const o=(0,oo.useMemo)((()=>["suggestions__item",...t.map(ki)]),[t]),i=(0,oo.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,Fo.jsx)("li",{className:Zo(o),children:(0,Fo.jsxs)("button",{type:"button",onClick:i,className:Zo("button","button--primary"),children:[s&&(0,Fo.jsx)(gi,{name:"chevronRight",size:"8",alt:""}),n]})})},Ai=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,Fo.jsx)("ul",{className:Zo("suggestions__list",e||""),children:t.map((e=>(0,Fo.jsx)(Ni,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),Ri=e=>{const{sendAction:t}=Io();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}},Ii=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:s,iconSize:o,iconClassName:i,dividerType:a,title:c,description:l})=>{const u=Boolean(s||n);return(0,Fo.jsxs)("div",{className:Zo("divider",a&&`divider--type-${a}`,t),children:[u&&(0,Fo.jsx)("span",{className:Zo("divider__graphic"),children:s?(0,Fo.jsx)(gi,{name:s,size:o,className:i,alt:""}):(0,Fo.jsx)("img",{src:n,className:Zo({icon:"icon"===r,avatar:"avatar"===r},i)})}),(0,Fo.jsxs)("div",{className:Zo("divider__body"),children:[c?(0,Fo.jsx)("h2",{className:Zo("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,Fo.jsx)("p",{className:Zo("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},Oi={[W.new_topic]:"new-topic"},Li={default:({event:e})=>{const{t}=wo(),{subtype:n}=e.payload.body,r=Oi[W[n]];return W[n]?(0,Fo.jsx)(Ii,{dividerType:r,iconName:W[n],title:t(`dividerKeys.${W[n]}`)}):null},[W.new_translation]:({event:e})=>{const{t}=wo(),n=Jn(),{body:{translationEnabled:r,text:s,title:o},id:i}=e.payload,a=In((e=>e.translations.translatedEventGroups)),c=so(),l=(0,oo.useCallback)((()=>{a[i]?c(Ks({events:n,id:i})):c(Js({events:n,id:i}))}),[c,n,i,a]);return(0,Fo.jsx)(Ii,{iconName:"newTranslation",dividerType:"new-translation",title:o,description:s,children:r?(0,Fo.jsx)(Fo.Fragment,{children:(0,Fo.jsx)("button",{className:Zo("button","button--secondary"),onClick:l,children:t(a[i]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},Mi={month:"long",day:"numeric",year:"numeric"},Pi={hour:"numeric",minute:"numeric"},Di=({event:e})=>{const t=(()=>{const[e,t]=(0,oo.useReducer)((e=>e+1),0);return(0,oo.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:s,srText:o}=(e=>{const{t}=wo(),n=Hn(),r=n?.context?.userLocale??[],s=new Date(e),o=new Date,i=new Date(o);i.setHours(24,0,0,0);const a=i.valueOf()-o.valueOf(),c=s.toString(),l=new Intl.DateTimeFormat(r,Pi).format(s);let u=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),s=864e5;return r>=n+s?e:r>n?"today":r>n-s?"yesterday":e})(s,o);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,Mi).format(s)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:a}})(g(e.payload.timeIndicator));return(0,oo.useEffect)((()=>{const e=setTimeout((()=>{t()}),s);return()=>{clearTimeout(e)}}),[t,s]),(0,Fo.jsxs)(Ii,{dividerType:"time-indicator",children:[(0,Fo.jsxs)("h2",{className:Zo("divider__time"),"aria-hidden":"true",children:[(0,Fo.jsx)("span",{className:Zo("divider__time--date"),children:n}),(0,Fo.jsx)("span",{className:Zo("divider__time--time"),children:r})]}),(0,Fo.jsx)("p",{className:Zo("visually-hidden"),children:o})]})};var Ui=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Fi=Ui.join(","),Bi="undefined"==typeof Element,zi=Bi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,$i=!Bi&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Hi=function e(t,n){var r;void 0===n&&(n=!0);var s=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===s||"true"===s||n&&t&&e(t.parentNode)},Vi=function(e,t,n){if(Hi(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Fi));return t&&zi.call(e,Fi)&&r.unshift(e),r.filter(n)},Wi=function e(t,n,r){for(var s=[],o=Array.from(t);o.length;){var i=o.shift();if(!Hi(i,!1))if("SLOT"===i.tagName){var a=i.assignedElements(),c=e(a.length?a:i.children,!0,r);r.flatten?s.push.apply(s,c):s.push({scopeParent:i,candidates:c})}else{zi.call(i,Fi)&&r.filter(i)&&(n||!t.includes(i))&&s.push(i);var l=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),u=!Hi(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(l&&u){var d=e(!0===l?i.children:l.children,!0,r);r.flatten?s.push.apply(s,d):s.push({scopeParent:i,candidates:d})}else o.unshift.apply(o,i.children)}}return s},qi=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Gi=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!qi(e)?0:e.tabIndex},Ki=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ji=function(e){return"INPUT"===e.tagName},Xi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Yi=function(e,t){return!(t.disabled||Hi(t)||function(e){return Ji(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var s=zi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(zi.call(s,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Xi(e)}else{if("function"==typeof r){for(var o=e;e;){var i=e.parentElement,a=$i(e);if(i&&!i.shadowRoot&&!0===r(i))return Xi(e);e=e.assignedSlot?e.assignedSlot:i||a===e.ownerDocument?i:a.host}e=o}if(function(e){var t,n,r,s,o=e&&$i(e),i=null===(t=o)||void 0===t?void 0:t.host,a=!1;if(o&&o!==e)for(a=!!(null!==(n=i)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(i)||null!=e&&null!==(s=e.ownerDocument)&&void 0!==s&&s.contains(e));!a&&i;){var c,l,u;a=!(null===(l=i=null===(c=o=$i(i))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(i))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!zi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Zi=function(e,t){return!(function(e){return function(e){return Ji(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||$i(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var s=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!s||s===e}(e)}(t)||Gi(t)<0||!Yi(e,t))},Qi=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ea=function e(t){var n=[],r=[];return t.forEach((function(t,s){var o=!!t.scopeParent,i=o?t.scopeParent:t,a=function(e,t){var n=Gi(e);return n<0&&t&&!qi(e)?0:n}(i,o),c=o?e(t.candidates):i;0===a?o?n.push.apply(n,c):n.push(i):r.push({documentOrder:s,tabIndex:a,item:t,isScope:o,content:c})})),r.sort(Ki).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ta=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==zi.call(e,Fi)&&Zi(t,e)},na=Ui.concat("iframe").join(","),ra=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==zi.call(e,na)&&Yi(t,e)};function sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function oa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sa(Object(n),!0).forEach((function(t){var r,s,o;r=e,s=t,o=n[t],s=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(s),s in r?Object.defineProperty(r,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[s]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ia=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},aa=function(e){return ia(e)&&!e.shiftKey},ca=function(e){return ia(e)&&e.shiftKey},la=function(e){return setTimeout(e,0)},ua=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},da=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e.apply(void 0,n):e},pa=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},ha=[],fa=function(e,t){var n,r=(null==t?void 0:t.document)||document,s=(null==t?void 0:t.trapStack)||ha,o=oa({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:aa,isKeyBackward:ca},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},a=function(e,t,n){return e&&void 0!==e[t]?e[t]:o[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return i.containerGroups.findIndex((function(t){var r=t.container,s=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||s.find((function(t){return t===e}))}))},l=function(e){var t=o[e];if("function"==typeof t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];t=t.apply(void 0,s)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var a=t;if("string"==typeof t&&!(a=r.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return a},u=function(){var e=l("initialFocus");if(!1===e)return!1;if(void 0===e||!ra(e,o.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(i.containerGroups=i.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Wi([e],t.includeContainer,{filter:Zi.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Qi}):Vi(e,t.includeContainer,Zi.bind(null,t)),ea(n)}(e,o.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?Wi([e],t.includeContainer,{filter:Yi.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Vi(e,t.includeContainer,Yi.bind(null,t))}(e,o.tabbableOptions),r=t.length>0?t[0]:void 0,s=t.length>0?t[t.length-1]:void 0,i=n.find((function(e){return ta(e)})),a=n.slice().reverse().find((function(e){return ta(e)})),c=!!t.find((function(e){return Gi(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:s,firstDomTabbableNode:i,lastDomTabbableNode:a,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=t.indexOf(e);return s<0?r?n.slice(n.indexOf(e)+1).find((function(e){return ta(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return ta(e)})):t[s+(r?1:-1)]}}})),i.tabbableGroups=i.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),i.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find((function(e){return e.posTabIndexesFound}))&&i.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},h=function e(t){!1!==t&&t!==p(document)&&(t&&t.focus?(t.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(u()))},f=function(e){var t=l("setReturnFocus",e);return t||!1!==t&&e},m=function(e){var t=e.target,n=e.event,r=e.isBackward,s=void 0!==r&&r;t=t||pa(n),d();var a=null;if(i.tabbableGroups.length>0){var u=c(t,n),p=u>=0?i.containerGroups[u]:void 0;if(u<0)a=s?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(s){var h=ua(i.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||ra(t,o.tabbableOptions)&&!ta(t,o.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?i.tabbableGroups.length-1:h-1,m=i.tabbableGroups[f];a=Gi(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else ia(n)||(a=p.nextTabbableNode(t,!1))}else{var y=ua(i.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||ra(t,o.tabbableOptions)&&!ta(t,o.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var v=y===i.tabbableGroups.length-1?0:y+1,g=i.tabbableGroups[v];a=Gi(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else ia(n)||(a=p.nextTabbableNode(t))}}else a=l("fallbackFocus");return a},y=function(e){var t=pa(e);c(t,e)>=0||(da(o.clickOutsideDeactivates,e)?n.deactivate({returnFocus:o.returnFocusOnDeactivate}):da(o.allowOutsideClick,e)||e.preventDefault())},v=function(e){var t=pa(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(i.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var s=!0;if(i.mostRecentlyFocusedNode)if(Gi(i.mostRecentlyFocusedNode)>0){var a=c(i.mostRecentlyFocusedNode),l=i.containerGroups[a].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===i.mostRecentlyFocusedNode}));d>=0&&(o.isKeyForward(i.recentNavEvent)?d+1<l.length&&(r=l[d+1],s=!1):d-1>=0&&(r=l[d-1],s=!1))}}else i.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return Gi(e)>0}))}))||(s=!1);else s=!1;s&&(r=m({target:i.mostRecentlyFocusedNode,isBackward:o.isKeyBackward(i.recentNavEvent)})),h(r||i.mostRecentlyFocusedNode||u())}i.recentNavEvent=void 0},g=function(e){if(("Escape"===(null==(t=e)?void 0:t.key)||"Esc"===(null==t?void 0:t.key)||27===(null==t?void 0:t.keyCode))&&!1!==da(o.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(o.isKeyForward(e)||o.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(ia(e)&&e.preventDefault(),h(n))}(e,o.isKeyBackward(e))},b=function(e){var t=pa(e);c(t,e)>=0||da(o.clickOutsideDeactivates,e)||da(o.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},x=function(){if(i.active)return function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var r=e.indexOf(t);-1===r||e.splice(r,1),e.push(t)}(s,n),i.delayInitialFocusTimer=o.delayInitialFocus?la((function(){h(u())})):h(u()),r.addEventListener("focusin",v,!0),r.addEventListener("mousedown",y,{capture:!0,passive:!1}),r.addEventListener("touchstart",y,{capture:!0,passive:!1}),r.addEventListener("click",b,{capture:!0,passive:!1}),r.addEventListener("keydown",g,{capture:!0,passive:!1}),n},w=function(){if(i.active)return r.removeEventListener("focusin",v,!0),r.removeEventListener("mousedown",y,!0),r.removeEventListener("touchstart",y,!0),r.removeEventListener("click",b,!0),r.removeEventListener("keydown",g,!0),n},C="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===i.mostRecentlyFocusedNode}))}))&&h(u())})):void 0,_=function(){C&&(C.disconnect(),i.active&&!i.paused&&i.containers.map((function(e){C.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return i.active},get paused(){return i.paused},activate:function(e){if(i.active)return this;var t=a(e,"onActivate"),n=a(e,"onPostActivate"),s=a(e,"checkCanFocusTrap");s||d(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var o=function(){s&&d(),x(),_(),null==n||n()};return s?(s(i.containers.concat()).then(o,o),this):(o(),this)},deactivate:function(e){if(!i.active)return this;var t=oa({onDeactivate:o.onDeactivate,onPostDeactivate:o.onPostDeactivate,checkCanReturnFocus:o.checkCanReturnFocus},e);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,w(),i.active=!1,i.paused=!1,_(),function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}(s,n);var r=a(t,"onDeactivate"),c=a(t,"onPostDeactivate"),l=a(t,"checkCanReturnFocus"),u=a(t,"returnFocus","returnFocusOnDeactivate");null==r||r();var d=function(){la((function(){u&&h(f(i.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(f(i.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){if(i.paused||!i.active)return this;var t=a(e,"onPause"),n=a(e,"onPostPause");return i.paused=!0,null==t||t(),w(),_(),null==n||n(),this},unpause:function(e){if(!i.paused||!i.active)return this;var t=a(e,"onUnpause"),n=a(e,"onPostUnpause");return i.paused=!1,null==t||t(),d(),x(),_(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),i.active&&d(),_(),this}},n.updateContainerElements(e),n};const ma=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":o})=>{const i=di(),a=(0,oo.useRef)(null),c=(0,oo.useRef)(null),[l,u]=(0,oo.useState)(!1);return(0,oo.useEffect)((()=>(l&&a.current&&(c.current=fa(a.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,oo.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((n=>{const r=n.getAttribute("aria-hidden");null!==r&&"false"!==r||(null!==r&&e.push(r),t.push(n),n.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,n)=>{const r=e[n];null===r?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r)}))}})();return()=>{e()}}),[l]),(0,oo.useEffect)((()=>{l&&a.current&&a.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,oo.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",i),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),r&&t.setAttribute("aria-label",r),o&&t.setAttribute("aria-labelledby",o),e.appendChild(t),a.current=t,u(!0),()=>{a.current&&(e.removeChild(a.current),a.current=null)}}),[r,o,i]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>a.current&&(0,s.render)(e,a.current)}):a.current&&(0,s.render)((0,s.toChildArray)(e).filter(j).map((e=>(e.props={...e.props,onClose:t},e))),a.current)},ya=({url:e,description:t,onClose:n})=>{const r=Hn(),s=ci(),o=Qo(),i=(0,oo.useRef)(null),{t:a}=wo(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof o?c.push(...o):c.push(...o(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,Fo.jsx)(ma,{onClose:n,"aria-label":a("lightbox.heading"),fallBackFocusRef:i,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,Fo.jsx)("div",{className:Zo(c),onClick:u,style:d,children:(0,Fo.jsxs)("div",{className:Zo("modal__float"),tabIndex:-1,onMouseDown:s,onKeyDown:s,onTouchStart:s,onMouseMove:s,onWheel:s,onPointerDown:s,onPointerMove:s,ref:i,children:[(0,Fo.jsx)("div",{className:Zo("modal__inner"),onClick:l,children:(0,Fo.jsx)("img",{className:Zo("modal__image"),src:e,alt:t})}),(0,Fo.jsxs)("button",{type:"button",className:Zo("modal__close"),onClick:n,children:[(0,Fo.jsx)(gi,{name:"close",size:"16",alt:""}),a("lightbox.closeLabel")]})]})}))(n))})},va=({description:e,url:t})=>{const{t:n}=wo(),[r,s]=(0,oo.useState)(!1);return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsxs)("button",{type:"button",className:Zo("modal__enlarge"),onClick:()=>{s(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,Fo.jsx)(gi,{name:"enlarge",size:"32",alt:""})]}),r&&(0,Fo.jsx)(ya,{url:t,description:e,onClose:()=>{s(!1)}})]})},ga=({event:e,...t})=>{const{body:n}=Ko(e),r=Ri(e.payload.id),s=(0,oo.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,Fo.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,Fo.jsx)(fi,{type:"text",event:e,onClick:r,...t,...s})},ba="PROCESSING_IMAGE",xa=({img:e,filename:t})=>{const{t:n}=wo(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,Fo.jsx)(Fo.Fragment,{children:(0,Fo.jsxs)("span",{className:Zo(["download","download--preview"]),children:[(0,Fo.jsx)("img",{src:e,alt:r}),(0,Fo.jsx)("span",{"aria-hidden":"true",className:Zo("file-download"),children:t})]})})},wa=({children:e,url:t,target:n})=>t?(0,Fo.jsx)("a",{href:t,download:!0,target:n,className:Zo(["download","download-link"]),children:e}):(0,Fo.jsx)("span",{className:Zo("download"),children:e}),Ca={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=wo(),o=di(),{body:i,subEvent:a,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=Ti(e);return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,s.toChildArray)(t).filter(j).map((e=>(e.props={...e.props,event:a,descriptorId:o,showTranslationToggle:!1},e))),l&&(0,Fo.jsxs)("button",{type:"button",className:Zo("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":o,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,Fo.jsx)(gi,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,Fo.jsx)(fi,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,Fo.jsx)("ul",{className:Zo("choice-prompt","choice-prompt--many"),children:i?.choices?.map((e=>(0,Fo.jsx)("li",{className:Zo("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:ga,image:({event:e,descriptorId:t,...n})=>{const{body:r}=Ko(e),[s,o]=(0,oo.useState)(!1),i=so();return(0,Fo.jsxs)(fi,{event:e,type:"image",...n,children:[(0,Fo.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{i(Ss(e.payload.id)),o(!0)}}),r?.isZoomable&&s&&(0,Fo.jsx)(va,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=Ko(e),s=Ri(n.id);return(0,Fo.jsx)(fi,{type:"splash",event:e,onClick:s,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=Ko(e);return ei(e).push("message--type-video"),(0,Fo.jsxs)(fi,{event:e,type:"video",...n,children:[(0,Fo.jsx)("div",{id:t,className:Zo("visually-hidden"),children:r?.description}),(0,Fo.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=wo(),{body:r}=Ko(e),{fromClient:s,id:o}=e.payload,{filename:i,url:a}=r,c=(e=>{const{processingFileUploads:t}=In((({state:e})=>e));return(0,oo.useMemo)((()=>{if(t.some((t=>t===e)))return ba;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(o),l=(0,oo.useMemo)((()=>n(a?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:i})),[a,i,n]);return(0,Fo.jsx)(fi,{event:e,type:"upload",...t,children:c&&c!==ba?(0,Fo.jsx)(xa,{img:c,filename:i}):(0,Fo.jsxs)(wa,{url:a,target:s?void 0:"_blank",children:[(0,Fo.jsx)(gi,{name:"download",size:"16",alt:l}),(0,Fo.jsx)("span",{"aria-hidden":"true",className:Zo("file-download"),children:i})]})})},cta:({event:e})=>{const{body:t}=Ko(e),n=Ri(e.payload.id),{emitEvent:r}=Io(),s=di(),o=(0,oo.useCallback)((()=>r(`action.${F}`,{type:F,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,Fo.jsxs)(fi,{type:"cta",event:e,children:[(0,Fo.jsx)("div",{className:Zo("cta__content"),id:s,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,Fo.jsx)("a",{className:Zo("button","button--primary"),"aria-describedby":s,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:o,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=Ko(e),n=t.cards;return(0,Fo.jsx)(fi,{event:e,modifiers:"type-carousel",children:(0,Fo.jsx)(Ei,{items:n,getItemKey:Si,getItemLabel:ji})})},card:({event:e})=>{const{body:t}=Ko(e),n=di();return(0,Fo.jsx)(fi,{type:"card",event:e,children:(0,Fo.jsx)(mi,{id:n,...t})})}},info:{text:ga,divider:({event:e,...t})=>{const n=Li[W[e.payload.body.subtype]]||Li.default;return(0,Fo.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=wo(),{body:r}=Ko(e);return(0,Fo.jsx)(fi,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:Di},participant:{participant:({event:e})=>{const{participant:t}=e.payload,{body:n}=(e=>{const{translatedBody:t,translation:n,body:r}={body:e.payload?.participant?.introduction,translatedBody:e.payload?.participant?.translatedIntroduction,translation:e.payload?.participant?.translation},s=!!t,o=In(qo(e));return{body:o&&s?t:r,hasTranslation:s,isTranslated:o&&s,locale:n?.locale}})(e);return n?(0,Fo.jsx)(Ii,{graphicSrc:t?.avatar,graphicType:t?.avatar?"avatar":void 0,iconName:t?.avatar?void 0:"balloon",dividerType:"participant",title:n}):null}},service_data:{suggestion:({event:e,...t})=>{const[n,r]=(0,oo.useState)(!0),s=so(),o=Eo(),{sendAction:i,addMessageBubble:a}=Io(),{suggestions:c,payload:l}=(e=>{const{payload:t}=e,{body:n}=Ko(e);return{suggestions:n,payload:t}})(e),{showSuggestions:u}=Hn(),d=Jn(),{t:p}=wo(),h=p("suggestions.headingText"),f=p("suggestions.footerText"),m=(0,oo.useMemo)((()=>d.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[d]),y=(0,oo.useCallback)((({id:e,question:t})=>{r(!1),s(xr(!0)),i({type:O,originMessage:l.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),a(t)}),[s,i,l.id,a]);return n&&!o&&m&&u?(0,Fo.jsxs)("div",{className:Zo("suggestions","suggestions--conversation"),children:[h&&(0,Fo.jsx)("p",{className:Zo("suggestions__heading"),children:h}),(0,Fo.jsxs)(fi,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,Fo.jsx)(Ai,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:c}),f&&(0,Fo.jsx)("p",{className:Zo("suggestions__footer"),children:f})]})]}):null}}},_a=({children:e})=>{const{customComponents:t}=Hn(),n=(0,oo.useMemo)((()=>Object.keys(Ca).reduce(((e,n)=>(e[n]={...Ca[n],...t?t[n]:{}},e)),{fallback:ga})),[t]);return(0,Fo.jsx)(zo.Provider,{value:n,children:e})},Ea=({children:e})=>{const{isMinimized:t}=Co(),n=(0,oo.useRef)(0),{sendAction:r}=Io(),{hasCountdown:s,isActive:o,stopCountdown:i}=li(),a=(0,oo.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),a=()=>{r({type:"interactivity_update"}),n.current=e};s&&o&&(a(),i()),e-n.current>15e3&&a()}),[r,s,o,i,t]);return(0,Fo.jsx)("div",{className:Zo("activity-monitor"),tabIndex:-1,onMouseDown:a,onKeyUp:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,children:(0,Fo.jsx)(ai.Provider,{value:a,children:e})})},Sa=["text","choice_prompt","image","video"],ja=()=>{const e=ti(),t=(0,oo.useRef)(),n=(0,oo.useRef)(),r=so(),s=ko(),o=(0,oo.useRef)(null),{initCountdown:i,endCountdown:a}=li(),{emitEvent:u}=Io();return(0,oo.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new Cr(e);r(Wr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(ss())})),t.onOpen((()=>{r(qr())}))}}),[e,r]),(0,oo.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new c;return r(Wr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,oo.useEffect)((()=>{const t=e=>{if("participant"!==e.type)return;const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:s}=t;!n&&"string"!=typeof s&&s?.name&&r(xs(s.name)),r(js({participant:s,fromClient:n})),"string"!=typeof s&&s.introduction&&r(ns(e))};e.onConnection((({connected:n})=>{const{channel:o}=e;return!(!n||!o||(o.onMessage=(e,n)=>{const o={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(Es(n.state.loading)),n.type){case"idle_detach_countdown":i(n.body.duration);break;case"idle_detach_countdown_elapsed":a(void 0,!0);break;case"resume_conversation_prompt":r(ds());break;case"translation_proposal":r(Xs(n.body));break;case"user_first_response":r(xr(!0)),s.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(Pr(n.userLocale));break;case"message":switch(t(n),n.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":n.service&&n.service.serviceSessionId&&r(ms(n.service.serviceSessionId)),r(ns(o))}break;case"participant":t(o);break;case"service_data":n.persist&&r(ks(n));break;case"ack":r(ts(o));break;case"system":if("service_changed"===n.type){const{serviceSettings:e,...t}=n,{entry:s,proactiveMessages:o}=e,{upload:i}=s.options;r(gs({key:q,enabled:!(!i||!i.enabled)})),r(zs(o.enabled||!1)),r(Ns(s)),n.serviceSessionId&&r(ms(n.serviceSessionId)),u("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(ns(o));break;case"error":switch(n.type){case"find_conversation_erred":const e=new l(o);r(Wr({name:e.name,action:e.action,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError}));break;case"conversation_erred":case"attach_channel_erred":const t=new c(o);r(Wr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError,action:t.action}))}}return n},1))}))}),[e,r,u,a,s,i]),(0,oo.useEffect)((()=>{e.onConnection((({connected:t})=>{const{channel:r}=e;return!(!t||!r||(n.current&&r.off("message",n.current),n.current=r.on("message",(e=>Sa.includes(e.type)?(e.id!==o.current&&s.emit("message",e),o.current=e.id,e):e)),0))}))}),[e,s]),(0,oo.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.channel?.off("sync",t.current),t.current=e.channel?.on("sync",(async e=>{try{const t=await r($r(e)).unwrap();if(!t)return;r(Cs(t))}catch(e){}})),!0)))}),[e,r]),null},Ta=({children:e})=>{const{t}=wo(),n=so(),r=No(),{addUploadBubble:s}=Io(),o=(0,oo.useCallback)((async(e,t)=>{n(Ls(t));const r=await(e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>"string"==typeof r.result?t(r.result):void 0,r.onerror=e=>n(e)})))(e),s=new Image;s.src=r,await s.decode();const o=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,s]=(e=>{const{height:t,width:n}=e;return n>t&&n>600?[600,600*t/n]:t>600?[600*n/t,600]:[n,t]})(e);return t.width=r,t.height=s,n?.drawImage(e,0,0,r,s),t.toDataURL()})(s);try{sessionStorage.setItem(`image-${t}`,o)}catch(e){}finally{n(Ms(t))}}),[n]),i=(0,oo.useCallback)((e=>{const i=m(),a=r.uploadFile(e,(e=>{n(Os({fileId:i,progress:Math.ceil(e)}))}),(async t=>{const{id:r,transactionId:a,occurredAt:c,body:{contentType:l,filename:u,filesize:d,url:p}}=t;n(Rs(i)),s(r,a,c,l,u,d,p),await o(e,r)}),(e=>{let r;switch(e?.error||""){case"file_uploads_are_disabled":r=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":r=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":r=t("fileUpload.errors.wrongType");break;case"virus_found":r=t("fileUpload.errors.virusFound");break;default:r=t("fileUpload.errors.general")}n(Is({fileId:i,errorText:r}))}));n(ps({fileId:i,fileName:e.name,uploadHandle:a}))}),[o,s,r,n,t]);return(0,Fo.jsx)(ni.Provider,{value:i,children:e})},ka=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=li();return((e,t)=>{const n=(0,oo.useRef)(e);(0,oo.useEffect)((()=>{n.current=e}),[e]),(0,oo.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},Na=()=>{const{initUserSelectedOptions:e}=oi(),t=(0,oo.useRef)(!1),n=Hn();return(0,oo.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function Aa(e,t,n=[]){const r=ko(),s=(0,oo.useRef)(t);(0,oo.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>s.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const Ra=()=>{const e=Hn(),{sendMessage:t,sendContext:n,sendAction:r}=Io(),s=so(),{setVisibility:o,visible:i}=Co(),a=(0,oo.useRef)(i),c=ko(),l=No(),u=Yn(),d=(0,oo.useRef)(null),h=(0,oo.useRef)(null),{isInline:f,isResolving:m}=rr(),y=In(Mo),v=(()=>{const{get:e}=Ao();return e?e("conversationUrl"):null})(),g=(0,oo.useRef)(null),b=ci(),{enableTranslations:x,disableTranslations:w}=Go();return(0,oo.useEffect)((()=>{a.current=i}),[i]),Aa("askText",(e=>{t({body:e})}),[l.send]),Aa("setVariables",(e=>{n({variables:e})}),[l.send]),Aa("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),Aa("setVisibility",(e=>{Object.values(vn).includes(e)?(b(),o(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),Aa("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),Aa("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&s(mr({showSuggestions:!1})),e&&t?r({type:U,body:{name:e,fallbackMessage:t,participant:n?p:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),Aa("setContext",(e=>{n(e)}),[l.send]),Aa("setTranslation",(({enabled:e,locale:t})=>{e?x(t,$):w()}),[l.send]),(0,oo.useEffect)((()=>{m||y||(g.current&&g.current!==v&&c.emit("unreadMessageCount",u),i===vn.open&&i!==h.current&&0!==d.current&&c.emit("unreadMessageCount",0),i!==vn.open&&u!==d.current&&c.emit("unreadMessageCount",u),h.current=i,d.current=u,"string"==typeof v&&(g.current=v))}),[u,i,c,f,m,y,v]),null},Ia=({children:e})=>{const t=ko(),n=(0,oo.useRef)(null),[r,s]=(0,oo.useState)(),o=(0,oo.useRef)(!0),i=(0,oo.useCallback)((e=>{o.current&&(s(e),t.emit("aria-live",e))}),[s,t]);return(0,oo.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{i({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,i]),(0,oo.useEffect)((()=>()=>{o.current=!1}),[]),(0,Fo.jsxs)(To.Provider,{value:i,children:[e,(0,Fo.jsxs)("div",{className:Zo("app__live-container"),children:[(0,Fo.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Zo("visually-hidden"),children:r?.ariaLive===H?r?.messageText:null}),(0,Fo.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Zo("visually-hidden"),children:r?.ariaLive===V?r?.messageText:null})]})]})},Oa=()=>{const{t:e}=wo(),t=Jn(),n=(0,oo.useRef)(0),r=(0,oo.useRef)(0),s=qn().historyLoaded,{sendPolite:o}=Oo(),{isOpen:i}=Co(),a=(0,oo.useRef)(null),c=(0,oo.useRef)(null),l=(0,oo.useMemo)((()=>v((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(o(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[o,e]);return(0,oo.useEffect)((()=>{t.length>n.current&&(i&&(c.current=l(t)),n.current=t.length)}),[t,l,i]),(0,oo.useEffect)((()=>{a.current&&!i&&c.current&&(c.current(!0),c.current=null)}),[i]),(0,oo.useEffect)((()=>{s&&setTimeout((()=>{o(e("window.srTexts.onHistoryLoad"))}),500)}),[s,e,o]),null},La=()=>{const{t:e}=wo(),{isOpen:t,isVisible:n}=Co(),r=Yn(),{sendPolite:s}=Oo(),o=(0,oo.useMemo)((()=>v(s,2e3)),[s]),i=(0,oo.useRef)(null),a=(0,oo.useRef)(null);return(0,oo.useEffect)((()=>{i.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=o(e("message.srTextUnreadCount",{unreadCount:r}))),i.current=n}),[r,t,n,o,e]),null},Ma=({store:e,children:t,eventBus:n,api:r})=>((0,oo.useErrorBoundary)((t=>{console.error(t),e.dispatch(Er(t))})),(0,Fo.jsx)(Dn,{store:e,children:(0,Fo.jsx)(jo.Provider,{value:n,children:(0,Fo.jsx)(So.Provider,{value:r,children:(0,Fo.jsx)(Ia,{children:(0,Fo.jsx)(Bo,{children:(0,Fo.jsxs)(_a,{children:[(0,Fo.jsx)(Na,{}),(0,Fo.jsx)(ja,{}),(0,Fo.jsx)(La,{}),(0,Fo.jsx)(Oa,{}),(0,Fo.jsx)(ka,{}),(0,Fo.jsxs)(Ea,{children:[(0,Fo.jsx)(Ra,{}),(0,Fo.jsx)(Ta,{children:t})]})]})})})})})})),Pa=bt(Kn,(e=>e.filter((e=>Jr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===R)))),Da=bt([Pa],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),Ua=bt(Pa,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),Fa=bt((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),Ba=()=>{const{t:e}=wo(),{showDisclaimer:t}=Hn();return t?(0,Fo.jsxs)("div",{className:Zo("disclaimer"),tabIndex:0,children:[(0,Fo.jsx)("h2",{className:Zo("disclaimer__title"),children:e("disclaimer.title")}),(0,Fo.jsx)("div",{className:Zo("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},za=bt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),$a=bt(za,(e=>e?.controls||{})),Ha=bt($a,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Va=bt([$a,(e,{name:t})=>t],((e,t)=>e[t]?.value)),Wa=bt([$a,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),qa=(0,s.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:Ga,Consumer:Ka}=qa,Ja=qa;function Xa(){return(0,oo.useContext)(Ja)}function Ya(e){const t=so(),{formId:n,updateControlValue:r,updateControlTouched:s,errors:o}=Xa(),i=!!In((e=>za(e,{formId:n}))),a=In((t=>Va(t,{formId:n,name:e}))),c=In((t=>Wa(t,{formId:n,name:e}))),l=o?.[e],u=!l;(0,oo.useEffect)((()=>{i&&t(Rr({formId:n,name:e}))}),[i,n,e,t]),(0,oo.useLayoutEffect)((()=>()=>{t(Ir({formId:n,name:e}))}),[i,n,e,t]);const d=(0,oo.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,oo.useCallback)((()=>{s(e,!0)}),[s,e]);return[(0,oo.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:a})),[e,d,p,a]),(0,oo.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function Za(e){const{t}=wo(),{sendAssertive:n}=Oo(),{hasLimit:r,limit:s}=nr(),o=(0,oo.useMemo)((()=>v(n,f)),[n]),i=(0,oo.useMemo)((()=>v(((e,n)=>{e&&o(t("input.srCharacterLimitText",{limit:n}))}),f)),[o,t]),[{value:a}]=Ya(e),c=s&&r&&a?s-a.length:s,l=!(!r||!c)&&c<=h,u=!(!r||!c)&&c<0;return(0,oo.useEffect)((()=>{i(l,c)}),[l,c,i]),{hasCharacterLimit:r,characterLimit:s,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Qa=e=>{const{hasCharacterLimit:t,characterLimit:n}=Za(e),{entryMeta:{optionsOverride:{text:r}}}=qn(),{t:s}=wo();return{placeholder:(0,oo.useMemo)((()=>s("input.inputPlaceholder",{hasLimit:t,text:r?.placeholder||s("input.inputPlaceholderText"),limit:t?n:null})),[s,t,n,r?.placeholder]),label:(0,oo.useMemo)((()=>s("input.inputLabel",{hasLimit:!r?.label&&t,text:r?.label||s("input.inputLabelText"),limit:!r?.label&&t?n:null})),[s,t,n,r?.label]),labelClass:(0,oo.useMemo)((()=>r?.label?"label":"visually-hidden"),[r?.label])}};function ec(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=so(),{entryMeta:{actions:t,translatedActions:n}}=qn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(As())}}})(),n=No();return e?(0,Fo.jsx)("li",{className:Zo(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,Fo.jsx)("button",{className:Zo(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:U,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const tc=(0,s.createContext)(null),nc=()=>{const e=(0,oo.useContext)(tc);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},rc=tc,sc=e=>{const t=(()=>{const e=(0,oo.useContext)(zo);if(!e)throw new Error("useComponentContext has to be used within <ComponentContext.Provider>");return e})(),n=t[e.type];let r=n[e.payload.type],s=null;return"choice_prompt"===e.payload.type&&(s=n[e.payload.body.prompt.type]),"participant"===e.type&&(r=n[e.type]),r&&"function"!=typeof r&&(r=r[e.payload.body.type]),[r||t?.fallback,s]},oc=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=nc(),{sendAction:s}=Io(),o=e.payload.id?n[e.payload.id]:void 0,{containerRef:i,isVisible:a}=_o({containerRef:o,freezeOnceVisible:!0}),c=so(),[l,u]=sc(e);if((0,Uo.useEffect)((()=>{if(a&&r?.includes(e.payload.id)){const t=r.reduce(((t,n)=>e?.payload?.id&&n&&!t.includes(e.payload.id)?t.concat(n):t),[]);c(vs(t)),s({type:M,events:t})}}),[c,e.payload.id,a,s,r]),!l)return null;const d=["conversation__item"];return"info"===e.type?d.push("conversation__item--source-info"):e.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),t&&d.push("conversation__item--new-participant"),(0,Fo.jsxs)("li",{className:Zo(d),ref:i,children:[e.payload.timeIndicator&&(0,Fo.jsx)(Di,{event:e}),(0,Fo.jsx)(l,{event:e,children:(0,Fo.jsx)(u,{event:e})})]})},ic=()=>{const{id:e}=tr()||{};return(0,Fo.jsx)("li",{className:Zo("conversation__item","conversation__item--source-agent"),children:(0,Fo.jsxs)("div",{className:Zo("message","message--source-agent","message--type-loading"),children:[(0,Fo.jsx)(hi,{eventPayload:{fromClient:!1,participant:e}}),(0,Fo.jsx)("div",{className:Zo("message__body"),children:(0,Fo.jsxs)("span",{className:Zo("loader"),children:[(0,Fo.jsx)("span",{className:Zo("loader__part","one")}),(0,Fo.jsx)("span",{className:Zo("loader__part","two")}),(0,Fo.jsx)("span",{className:Zo("loader__part","three")}),(0,Fo.jsx)("span",{className:Zo("loader__part","four")})]})})]})})},ac=()=>{const e=Jn();let t;return(0,Fo.jsx)(Fo.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let s=!1;if("participant"!==n&&"service_data"!==n){const{participant:n,fromClient:o}=r,i=o?"seamly-client-participant":n;"info"!==e.type&&t!==i&&(s=!0),t=i}return(0,Fo.jsx)(oc,{event:e,newParticipant:s},e.payload.key||e.payload.id)}))})},cc=()=>{const{t:e}=wo(),t=Xn(),n=((e,t=20)=>{const[n,r]=(0,oo.useState)(e),s=(0,oo.useRef)(null);return(0,oo.useEffect)((()=>(s.current=setTimeout((()=>r(e)),t),()=>{s.current&&clearTimeout(s.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=Co(),s=Zn(),o=Wo();return(0,Fo.jsxs)(Fo.Fragment,{children:[r&&(0,Fo.jsx)("a",{className:Zo("skip-link"),href:`#${s}`,onClick:e=>{e.preventDefault(),o()},children:e("skiplinkText")}),(0,Fo.jsx)("div",{className:Zo("chat__body"),children:(0,Fo.jsxs)("div",{className:Zo("conversation__container"),children:[(0,Fo.jsx)(Ba,{}),(0,Fo.jsxs)("ol",{className:Zo("conversation"),children:[(0,Fo.jsx)(_a,{children:(0,Fo.jsx)(ac,{})}),n?(0,Fo.jsx)(ic,{}):null,(0,Fo.jsx)(ec,{})]})]})})]})};function lc(e,t){const n=(0,oo.useRef)(null),r=(0,oo.useRef)(e);return(0,oo.useEffect)((()=>{r.current=e}),[e]),(0,oo.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const uc={visible:Zo("transition--visible"),in:Zo("transition--in"),visuallyHidden:Zo("visually-hidden")},dc=Object.values(uc),pc=e=>{const t=(0,oo.useRef)(null);t.current=e;const n="function"==typeof e;return(0,oo.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},hc={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},fc=({children:e,isActive:t,timeout:n=300,transitionStartState:r=hc.notRendered,onInTransitionComplete:o=(()=>{}),onOutTransitionComplete:i=(()=>{}),exitAfter:a,enterDelay:c=0})=>{const l=(0,oo.useRef)(!1),u=(0,oo.useRef)(null),d=(0,oo.useRef)(null),p=r===hc.visuallyHidden,[h,f]=(0,oo.useState)((()=>p?[uc.visuallyHidden]:[])),[m,y]=(0,oo.useState)((()=>0===c)),v=(0,oo.useMemo)((()=>a?a+c:a),[c,a]);lc((()=>y(!1)),t?v:void 0),lc((()=>y(!0)),t?c:void 0);const g=(0,oo.useMemo)((()=>m&&t),[t,m]),b=pc(o),x=pc(i),w="notRendered"!==r||h.length>0;return(0,oo.useEffect)((()=>(l.current&&!g&&(f([uc.visible]),u.current=setTimeout((()=>{f([...p?[uc.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&g&&(f([uc.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{f([uc.visible,uc.in]),b&&(u.current=setTimeout((()=>{b()}),n))}))}))),l.current=g,()=>{u.current&&clearTimeout(u.current),d.current&&cancelAnimationFrame(d.current)})),[p,b,x,n,g]),(0,Fo.jsx)(Fo.Fragment,{children:w&&(0,s.toChildArray)(e).filter(j).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!dc.includes(e)));return(0,s.cloneElement)(e,{className:[...n,...h].join(" ")})}))})},mc=({isAside:e=!1})=>{const{isInline:t}=rr(),{t:n}=wo(),{sendAction:r,addMessageBubble:s}=Io(),{isOpen:o,setVisibility:i}=Co(),{showSuggestions:a}=Hn(),c=di(),l=Wo(),u=(0,oo.useRef)(null),{sendPolite:d}=Oo(),p=In(Mo),{hasCountdown:h,endCountdown:f}=li(),{hasPrompt:m,continueChat:y}=ui(),v=Eo(),g=qn().serviceData.suggestion;const{body:b}=Ko({payload:g,type:"service_data"}),x=(0,oo.useMemo)((()=>p?[]:Array.isArray(b)?b:b?.data),[b,p]),w=(0,oo.useRef)(),C=(0,oo.useRef)(!1),_=(0,oo.useRef)(),E=!!x?.length,j=t?(v||o)&&!e:v,T=(0,oo.useRef)(j),k=E&&!j&&a,N=E?x:_.current;_.current=N;const A=(0,oo.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Zo(t)}),[e]),R=(0,oo.useCallback)((({id:e,question:t})=>{h&&f(!0),m&&y(),r({type:O,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),s(t),o||i(vn.open),l()}),[s,y,f,l,h,m,g,r,i,o]);(0,oo.useEffect)((()=>{if(w.current!==x&&!j){if(E){const e=C.current?n("suggestions.srUpdatedText"):n("suggestions.srAvailableText");setTimeout((()=>{d(e)}),30)}else C.current&&d(n("suggestions.srUnavailableText"));w.current=x}!T.current&&j?(S(u.current,l),d(n("suggestions.srUnavailableText"))):!E&&C.current&&S(u.current,l),C.current=E,T.current=j}),[x,E,j,l,d,n]);const I=n("suggestions.headingText"),L=n("suggestions.footerText"),M=I?"section":"div";return(0,Fo.jsx)(fc,{isActive:!!k,transitionStartState:hc.notRendered,children:(0,Fo.jsxs)(M,{className:A,"aria-labelledby":I?c:void 0,ref:u,children:[I&&(0,Fo.jsx)("p",{id:c,className:Zo("suggestions__heading"),children:I}),!!N&&(0,Fo.jsx)(Ai,{suggestions:N,onClickSuggestion:R}),L&&!o&&(0,Fo.jsx)("p",{className:Zo("suggestions__footer"),children:L})]})})},yc=(0,Uo.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:s,setVisibility:o}=Co(),{namespace:i,layoutMode:a}=Hn(),{isInline:c}=rr(),l=Qo(),u=Eo(),{t:d}=wo(),p=["chat",`chat--layout-${a}`,`namespace--${i}`,t];return"function"!=typeof l&&p.push(...l),r||"app"===a||p.push("chat--collapsed"),u&&p.push("chat--user-responded"),s&&(0,Fo.jsxs)("section",{className:Zo(p),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&o(vn.minimized)},tabIndex:-1,ref:n,"aria-label":d("chat.srLabel"),children:[(0,Fo.jsx)("div",{className:Zo("chat-wrapper"),children:e}),"inline"===a&&r&&(0,Fo.jsx)(mc,{isAside:!0})]})})),vc=yc,gc=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:s,id:o})=>{const i=di();return(0,Fo.jsxs)("section",{tabIndex:-1,id:o,"aria-labelledby":n?i:void 0,className:Zo("chat-status",n?void 0:"chat-status--condensed"),children:[(0,Fo.jsxs)("div",{className:Zo("chat-status__body"),children:[n?(0,Fo.jsx)("h2",{className:Zo("chat-status__title"),id:i,children:n}):null,e]}),"function"==typeof t&&(0,Fo.jsxs)("button",{type:"button",onClick:t,className:Zo("button","button--tertiary","chat-status__close"),children:[r||(0,Fo.jsx)(gi,{name:"close",size:"16",alt:""}),s&&(0,Fo.jsx)("span",{className:Zo("visually-hidden"),children:s})]})]})},bc=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,Fo.jsxs)("button",{type:"button",onClick:e,className:Zo("button","button--primary","chat-status__button"),children:[(0,Fo.jsx)(gi,{name:t,size:"16",alt:""}),n,r&&(0,Fo.jsx)("span",{className:Zo("visually-hidden"),children:r})]});function xc(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=Yo(),{id:s}=Jo();return e&&t?(0,Fo.jsx)(gc,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:s,title:t.titleLabel,children:(0,Fo.jsx)(bc,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function wc(){const e=In(Mo),{isActive:t}=Go();return e||t?null:(0,Fo.jsx)(xc,{})}const Cc=({label:e,checked:t,description:n,onChange:r,id:s,itemClassName:o})=>(0,Fo.jsxs)("li",{className:Zo([o||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:s,children:[(0,Fo.jsx)(gi,{name:"check",size:"16",alt:""}),e," ",n&&(0,Fo.jsxs)("span",{children:["(",n,")"]})]}),_c=({onChange:e,describedById:t})=>{const{context:n}=Hn(),r=(0,Uo.useMemo)((()=>n?.contentLocale),[n?.contentLocale]),{t:s}=wo(),{languages:o,currentLocale:i,enableTranslations:a,disableTranslations:c}=Go(),l=Wo(),u=t=>()=>{t===i||r===t?c():a(t,"translation_choice"),e(),l()},{primaryLanguages:d,remainingLanguages:p}=(0,Uo.useMemo)((()=>o.reduce(((e,t)=>{const n=t.locale===r,s=((e,t,n)=>t===e.locale||!t&&n)(t,i,n);t.locale!==r&&e.remainingLanguages.push({...t,checked:s,isOriginal:n});const o=e.remainingLanguages.findIndex((e=>e.locale===i));return(n||s&&o>4)&&e.primaryLanguages.push({...t,checked:s,isOriginal:n}),e}),{primaryLanguages:[],remainingLanguages:[]})),[i,r,o]);return(0,Fo.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Zo("translation-options"),children:[d.map((({locale:e,nativeName:t,checked:n,isOriginal:r},o)=>(0,Fo.jsx)(Cc,{id:e,label:t,checked:n,description:r?s("translations.settings.original"):void 0,onChange:u(e),itemClassName:Zo({"translation-options__item--original":r,"translation-options__item--selected":n&&0!==o})},e))),p.map((({locale:e,nativeName:t,checked:n,isOriginal:r})=>(0,Fo.jsx)(Cc,{id:e,label:t,checked:n,description:r?s("translations.settings.original"):void 0,onChange:u(e)},e)))]})},Ec=({className:e,children:t,onCancel:n,headingText:r,description:s,descriptionId:o,cancelButtonText:i,cancelButtonRef:a,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=di(),{hideOption:d}=oi(),{focusButton:p}=ii(),h=(0,oo.useCallback)((()=>{d(),c||p()}),[c,p,d]),f=(0,oo.useCallback)((()=>{n&&n(),h()}),[h,n]),m=(e=>{const t=(0,oo.useRef)(null);return(0,oo.useEffect)((()=>{const n=n=>{t.current&&n.target instanceof HTMLElement&&!t.current.contains(n.target)&&(n.preventDefault(),n.stopPropagation(),e())};return document.addEventListener("click",n,!0),document.addEventListener("touchstart",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("touchstart",n,!0)}}),[e,t]),t})(f);return(0,oo.useEffect)((()=>{E(m.current)}),[m]),(0,Fo.jsx)("section",{className:Zo("options",{"options--right":"right"===l.horizontal,"options--left":"left"===l.horizontal,"options--top":"top"===l.vertical,"options--bottom":"bottom"===l.vertical},e||""),"aria-labelledby":u,tabIndex:-1,ref:m,children:(0,Fo.jsxs)("div",{className:Zo("options__body"),children:[(0,Fo.jsx)("h2",{id:u,className:Zo("options__title"),children:r}),(0,Fo.jsxs)("button",{type:"button",onClick:f,"aria-describedby":u,className:Zo("button","options__close"),ref:e=>{a&&(a.current=e)},children:[(0,Fo.jsx)(gi,{name:"close",size:"16",alt:""}),(0,Fo.jsx)("span",{children:i})]}),s?(0,Fo.jsx)("p",{className:Zo("options__description"),id:o,children:s}):null,(0,Fo.jsx)("div",{className:Zo("options__wrapper"),children:t})]})})},Sc=function({onClose:e,position:t}){const{t:n}=wo(),r=di();return(0,Fo.jsx)(Ec,{onCancel:e,headingText:n("translations.menu.title"),cancelButtonText:n("translations.settings.cancelButtonText"),description:n("translations.menu.description"),descriptionId:r,position:t,disableButtonFocusing:!0,children:(0,Fo.jsx)(_c,{describedById:r,onChange:e})})};function jc({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,s]=(0,oo.useState)(!1),o=(0,oo.useRef)(null),i=di();return(0,Fo.jsxs)("div",{className:Zo("translations__container"),onKeyDown:e=>{r&&_(e)===C.Escape&&(s(!1),E(o.current))},children:[(0,Fo.jsx)(fc,{transitionStartState:hc.notRendered,isActive:r,children:(0,Fo.jsx)("div",{className:Zo("options__dialog"),role:"dialog",children:(0,Fo.jsx)(Sc,{onClose:()=>{s(!1)},position:t})})}),(0,Fo.jsx)("button",{type:"button",className:Zo(["button","chat__options__button",...n]),id:i,onClick:()=>{s(!r)},onKeyDown:e=>{_(e)===C.ArrowDown&&(s(!0),e.preventDefault())},ref:o,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const Tc=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:s,validationSchema:o={},...i})=>{const a=so(),c=In((e=>Ha(e,{formId:t}))),[l,u]=(0,oo.useState)(!1),[d,p]=(0,oo.useState)({}),{isValid:h,errors:f}=function(e,t){const n=(0,oo.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const s=Array.isArray(r)?r:[r];for(let r=0;r<s?.length;r++)if(!s[r].fn(e[n],s[r].compareValue)){t[n]=s[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,o),m=(0,oo.useMemo)((()=>({...f,...d})),[f,d]);(0,oo.useLayoutEffect)((()=>{a(Nr({formId:t,persistData:n}))}),[t,n,a]),(0,oo.useEffect)((()=>()=>{a(Ar({formId:t}))}),[t,n,a]);const y=(0,oo.useCallback)(((e,n)=>{a(Or({formId:t,name:e,value:n}))}),[t,a]),v=(0,oo.useCallback)(((e,n)=>{a(Lr({formId:t,name:e,touched:n}))}),[a,t]),g=(0,oo.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,oo.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&h&&(a(xr(!0)),s(c,{updateControlValue:y,setError:g}))}),[h,a,s,c,y,g]);(0,oo.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,oo.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:o,updateControlValue:y,updateControlTouched:v})),[t,c,m,l,b,o,y,v]);return t?s?(0,Fo.jsx)(Ga,{...i,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},kc=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),Nc=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},Ac=e=>!!e?.length,Rc=e=>{const t=e&&e.trim();return!(!t||!t.match(/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i))},Ic=e=>!!e,Oc=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:s,isSubmitted:o}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Xa();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),i=["form"];return!t&&o&&(i.push("form--submitted"),s?i.push("form--valid"):i.push("form--invalid")),(0,Fo.jsx)("form",{onSubmit:r,className:Zo([...i,e]),...n})};function Lc({id:e,error:t}){const[n,r]=(0,oo.useState)(!1);return(0,oo.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,Fo.jsx)("div",{className:Zo("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,Fo.jsxs)("span",{id:e,className:Zo("error__message"),children:[(0,Fo.jsx)(gi,{name:"error",size:"16",alt:""}),t]})})}const Mc=({contentHint:e,id:t,labelText:n,labelClass:r,validity:s,errorText:o,children:i})=>(0,Fo.jsxs)(Fo.Fragment,{children:[e&&(0,Fo.jsx)("span",{id:`${t}-content-hint`,className:Zo("input__content-hint"),children:e}),(0,Fo.jsx)(Lc,{id:`${t}-error`,error:!s&&o}),(0,Fo.jsxs)("div",{className:Zo("form-control__wrapper"),children:[(0,Fo.jsx)("label",{htmlFor:t,className:Zo(r),children:n}),i]})]}),Pc=function({id:e,name:t,type:n,labelText:r,labelClass:s,contentHint:o=null,"aria-invalid":i,"aria-describedby":a,...c}){const{isSubmitted:l}=Xa(),[u,{error:d}]=Ya(t),p=l&&d,h=[];return a&&h.push(a),o&&h.push(`${e}-content-hint`),p&&h.push(`${e}-error`),(0,Fo.jsx)(Mc,{id:e,contentHint:o,validity:!p,errorText:d,labelText:r,labelClass:s,children:(0,Fo.jsx)("input",{...u,...c,id:e,type:n,"aria-invalid":i||p?"true":"false","aria-describedby":h.join(" ")||void 0,name:t})})};function Dc({controlName:e,describedById:t}){const{t:n}=wo();return(0,Fo.jsxs)(Oc,{noValidate:"true",className:Zo("options__form"),children:[(0,Fo.jsx)(Pc,{id:"email-id",name:e,type:"email",className:Zo("transcript__input"),"aria-describedby":t,labelClass:Zo("label"),labelText:n("options.sendTranscript.label")}),(0,Fo.jsx)("div",{className:Zo("options__actions"),children:(0,Fo.jsx)("button",{type:"submit",className:Zo("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const Uc="email",Fc={sendTranscript:()=>{const[e,t]=(0,oo.useState)(void 0),{hideOption:n}=oi(),{focusButton:r}=ii(),{t:s}=wo(),o=di(),{sendAction:i}=Io(),a=(0,oo.useMemo)((()=>({[Uc]:[kc(Ic,s("options.sendTranscript.noEmailText")),kc(Rc,s("options.sendTranscript.invalidEmailText"))]})),[s]),c=(0,oo.useCallback)((e=>{const t=e[Uc].trim();i({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[i,n,r]),l=(0,oo.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,Fo.jsx)(Ec,{className:e,headingText:s("options.sendTranscript.title"),cancelButtonText:s("options.cancelButtonText"),description:s("options.sendTranscript.description"),descriptionId:o,position:{vertical:"top",horizontal:"right"},children:(0,Fo.jsx)(Tc,{formId:"sendTranscript",onSubmit:c,validationSchema:a,onError:l,children:(0,Fo.jsx)(Dc,{controlName:Uc,describedById:o})})})}},Bc=()=>{const{optionActive:e}=oi(),t=(0,oo.useRef)(),n=Fc[t.current??e];return e&&(t.current=e),n?(0,Fo.jsx)(n,{}):null},zc=()=>{const{t:e}=wo(),{menuOptions:t,showOption:n,panelActive:r,hideOption:s}=oi(),{id:o}=ii(),i=(0,oo.useRef)(null),[a,c]=(0,oo.useState)(!1),l=(0,oo.useRef)(null),u=t.length,d=(0,oo.useRef)([]),p=(0,oo.useRef)(!1),h=u>1,f=t[0],m=(0,oo.useMemo)((()=>f?.name?.trim().replace(/\s+/g,"")),[f]);return(0,oo.useEffect)((()=>()=>{i.current&&clearTimeout(i.current)}),[]),(0,oo.useEffect)((()=>{a&&!p.current&&requestAnimationFrame((async()=>{await $o(60);const e=t.findIndex((e=>e.available)),n=-1===e?0:e;d.current&&E(d.current[n])})),p.current=a}),[a,t]),u?(0,Fo.jsxs)("div",{className:Zo("options__container"),onKeyDown:e=>{a&&(_(e)===C.Escape&&(c(!1),E(l.current)),_(e)===C.Home&&(d.current&&E(d.current[0]),e.preventDefault()),_(e)===C.End&&(d.current&&E(d.current[u-1]),e.preventDefault()))},onFocusOut:()=>{h&&(i.current=setTimeout((()=>{c(!1)}),200))},onFocusIn:()=>{i.current&&clearTimeout(i.current)},children:[(0,Fo.jsx)(fc,{transitionStartState:hc.notRendered,isActive:r,children:(0,Fo.jsx)("div",{className:Zo("options__dialog"),children:(0,Fo.jsx)(Bc,{})})}),h&&(0,Fo.jsx)(fc,{isActive:a,transitionStartState:hc.notRendered,children:(0,Fo.jsx)("ul",{className:Zo(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":o,children:t.map((({name:r,title:s,available:o},i)=>(0,Fo.jsx)("li",{className:Zo("options__menu__item"),role:"menuitem","data-testid":r,children:(0,Fo.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[i]=e)},className:Zo(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(_(e)===C.ArrowDown){const n=Math.min(u-1,t+1);d.current&&E(d.current[t===n?0:n]),e.preventDefault()}if(_(e)===C.ArrowUp){const n=Math.max(0,t-1);d.current&&E(d.current[t===n?u-1:n]),e.preventDefault()}})(e,i),onKeyPress:e=>((e,n)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let s=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===s&&(s=t)})),-1!==s&&d.current&&E(d.current[s])})(e,i),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,o),"aria-disabled":!o,children:[(0,Fo.jsxs)("span",{className:Zo("button__text"),children:[s,!o&&" "]}),o?null:(0,Fo.jsx)("span",{className:Zo("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,Fo.jsxs)("button",{type:"button",className:Zo(["button","button--secondary","chat__options__button",...!h&&m?[`chat__options__button--${m}`]:[]]),id:o,onClick:()=>{r&&s(),h?c((e=>!e)):f.available&&!r&&n(f.name)},onKeyDown:h?e=>{_(e)===C.ArrowDown&&(c(!0),e.preventDefault())}:void 0,ref:l,"aria-haspopup":!!h&&"menu","aria-expanded":!!h&&a,"aria-disabled":!h&&!f.available,children:[h?(0,Fo.jsx)(gi,{name:"options",size:"32",alt:""}):null,(0,Fo.jsx)("span",{className:Zo("button__text"),children:h?e("options.openButtonText"):`${f.title}${f.available?"":" "}`}),h||f.available?null:(0,Fo.jsx)("span",{className:Zo("button__state"),children:e("options.unavailableText")})]})]}):null};function $c(){const{menuOptions:e,allowOptionSelection:t}=oi(),{isAvailable:n}=Go(),r=In(Mo),{t:s,userLocale:o}=wo(),i=Xo(o);if(!n&&(!t||!e.length)||r)return null;const a=s("translations.settings.openButtonText",{hasLanguage:!!i,language:i});return(0,Fo.jsxs)("div",{className:Zo("chat__options"),children:[n&&(0,Fo.jsx)("div",{className:Zo("chat__options-item","chat__options-item--left"),children:(0,Fo.jsxs)(jc,{classNames:["button--secondary"],children:[(0,Fo.jsx)(gi,{alt:a,name:"newTranslation",size:"16"}),(0,Fo.jsx)("span",{className:Zo("button__text"),children:a})]})}),t&&(0,Fo.jsx)("div",{className:Zo("chat__options-item","chat__options-item--right"),children:(0,Fo.jsx)(zc,{})})]})}const Hc=()=>{const{scrollToRef:e,unreadIds:t}=nc(),{isMinimized:n}=Co(),{t:r}=wo();return(0,Fo.jsx)(fc,{isActive:!!t.length&&!n,children:(0,Fo.jsx)("div",{className:Zo("unread-messages"),children:(0,Fo.jsxs)("button",{type:"button",className:Zo("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,Fo.jsx)(gi,{name:"chevronDown",size:"32",alt:""})]})})})},Vc=({children:e})=>{const t=Jn(),n=(0,oo.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,s.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:o,containerRef:i,unreadIds:a}=(e=>{const t=(0,oo.useRef)(null),[n,r]=(0,oo.useState)(!0),s=In(Ua),o=Jn(),i=Xn(),{isOpen:a}=Co(),c=qn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=In((({state:e})=>e));(0,oo.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:s}=e,o=Math.abs(t-n-s)>10;r(!o)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,oo.useCallback)((()=>{requestAnimationFrame((async()=>{await $o(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,oo.useEffect)((()=>{u&&d()}),[u,d]),(0,oo.useEffect)((()=>{n&&d()}),[n,s,o,i,a,c,l,d]),{containerRef:t,unreadIds:s,scrollToRef:()=>{const n=s.at(0);if(void 0!==n){const r=e[n]?.current;t.current?.scrollTo({top:r?.offsetTop,behavior:"auto",left:0})}},scrollToBottom:d}})(n);return(0,Fo.jsx)(rc.Provider,{value:{eventRefs:n,unreadIds:a,scrollToRef:r,scrollToBottom:o,containerRef:i},children:(0,Fo.jsxs)("div",{className:Zo("chat__container"),children:[(0,Fo.jsx)("div",{className:Zo("chat__container__scroll-area"),ref:i,children:e}),(0,Fo.jsx)(Hc,{})]})})},Wc=({baseClassName:e,children:t,title:n})=>{const r=Zn(),s=di();return(0,Fo.jsxs)("section",{id:r,className:Zo(e),"aria-describedby":s,tabIndex:-1,children:[(0,Fo.jsx)("h2",{className:Zo(`${e}__title`),id:s,children:n}),t]})},qc=()=>{const{t:e}=wo(),t=Wo(),n=ci(),{emitEvent:r}=Io(),{isActive:s,remaining:o,timer:i,endCountdown:a}=li(),c=!!o&&o>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,Fo.jsx)(Wc,{baseClassName:"idle",title:l,children:c&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("div",{className:Zo("idle__count-container"),children:s&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("span",{className:Zo("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,Fo.jsx)("span",{className:Zo("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",i)})]})}),(0,Fo.jsxs)("div",{className:Zo("idle__options"),children:[(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{n(),a(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{a(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},Gc=()=>{const{t:e}=wo(),t=ci(),{name:n}=tr()||{},{continueChat:r,restartChat:s}=ui();return(0,Fo.jsx)(Wc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,Fo.jsxs)("div",{className:Zo("prompt__options"),children:[(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:s,children:e("resumeConversationPrompt.detachButton")})]})})},Kc=()=>{const{sendAction:e}=Io(),{features:t}=oi(),{typingPeekahead:n}=t||{},r=(0,oo.useRef)(null),s=(0,oo.useRef)(null),o=(0,oo.useRef)(!1),i=(0,oo.useRef)(null);(0,oo.useEffect)((()=>()=>{i.current&&clearInterval(i.current),r.current&&clearTimeout(r.current),s.current&&clearTimeout(s.current)}),[]);const a=(t,r)=>{e({type:L,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(o.current=!0,i.current||(a(!0,e.target.value),i.current=setInterval((()=>{!o.current&&i.current?(clearInterval(i.current),i.current=null):n&&n.enabled&&a(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),s.current&&clearTimeout(s.current),r.current=setTimeout((()=>{o.current=!1}),300),s.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}},Jc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:s}=qn().entryMeta,o=so(),i=n||t||e,a=s[i]||r[i]||{},c=(0,oo.useCallback)((e=>{o(ys(e))}),[o]),l=(0,oo.useCallback)((e=>{o(fs(e))}),[o]),u=(0,oo.useCallback)((e=>{o(Ps(e))}),[o]),d=(0,oo.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:i,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Xc({controlName:e,skipLinkId:t}){const{t:n}=wo(),{sendAssertive:r}=Oo(),{emitEvent:s}=Io(),o=Kc(),{setBlockAutoEntrySwitch:i}=Jc(),{placeholder:a,label:c,labelClass:l}=Qa(e),{hasCharacterLimit:u,reachedCharacterWarning:d,reachedCharacterLimit:p,remainingChars:h}=Za(e),[{value:f}]=Ya(e),m=!!f,y=(0,oo.useCallback)((()=>{d&&r(n("input.srCharacterLimitText",{limit:h})),s("ui.inputFocus")}),[n,r,d,h,s]);return(0,oo.useLayoutEffect)((()=>(i(m),()=>{i(!1)})),[i,m]),(0,Fo.jsxs)(Oc,{className:Zo("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,Fo.jsxs)("div",{className:Zo(["input--text__container",...d&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,Fo.jsx)(Pc,{id:t,type:"text",name:e,className:Zo("input__text"),autocomplete:"off",placeholder:a,labelText:c,labelClass:Zo(l),"aria-invalid":!!u&&p,onKeyUp:o,onFocus:y}),(0,Fo.jsx)("div",{className:Zo("character-count"),children:d&&(0,Fo.jsx)("span",{children:h})})]}),(0,Fo.jsx)("button",{className:Zo("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!m||p,children:(0,Fo.jsx)(gi,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const Yc="textMessageEntry";function Zc({...e}){const{isOpen:t,setVisibility:n}=Co(),r=Zn(),s=Wo(),{sendMessage:o}=Io(),i=(0,oo.useCallback)(((e,{updateControlValue:r})=>{o({body:e[Yc]}),r(Yc,""),s(),t||n(vn.open)}),[o,s,t,n]);return(0,Fo.jsx)(Tc,{...e,formId:"textEntry",persistData:!0,onSubmit:i,children:(0,Fo.jsx)(Xc,{controlName:Yc,skipLinkId:r})})}const Qc=()=>{const{t:e}=wo(),{currentUploads:t}=si();return(0,Fo.jsx)("div",{className:Zo("progress"),children:t.map((({id:t,name:n,progress:r,uploading:s,error:o})=>(0,Fo.jsxs)("div",{className:Zo("progress_container"),children:[(0,Fo.jsxs)("div",{className:Zo("progress__text"),children:[(0,Fo.jsx)("span",{className:Zo("progress__text--file-name"),children:n}),(0,Fo.jsx)("span",{className:Zo("progress__text--percentage"),children:`${r}%`})]}),(0,Fo.jsx)(Lc,{error:o,id:"progress-error"}),(0,Fo.jsx)("progress",{className:Zo("progress__bar"),role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-label":e("fileUpload.srProgressLabel",{fileName:n}),max:"100","aria-valuenow":r,value:r,"aria-busy":s,children:`${r}%`})]},t)))})};function el({id:e,name:t,labelText:n,contentHint:r,outputText:s,accept:o}){const{isSubmitted:i}=Xa(),[a,c]=(0,oo.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=Ya(t),p=di(),h=di(),f=di(),m=i&&d,y=[f];r&&y.push(h),m&&y.push(p);const v=(0,oo.useCallback)((()=>{c(!0)}),[c]),g=(0,oo.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,oo.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,Fo.jsxs)("div",{className:Zo("upload__container"),children:[r&&(0,Fo.jsx)("span",{className:Zo("upload__content-hint"),id:h,children:r}),(0,Fo.jsx)(Lc,{id:p,error:m&&d}),(0,Fo.jsx)("div",{className:Zo(["file-upload",...a?["focus-within"]:[]]),children:(0,Fo.jsxs)("label",{htmlFor:e,className:Zo("upload__label"),children:[(0,Fo.jsx)(gi,{name:"upload",size:"32",alt:""}),(0,Fo.jsxs)("div",{children:[(0,Fo.jsx)("span",{className:Zo(["upload__label--text"]),children:n}),(0,Fo.jsx)("input",{id:e,className:Zo("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:o||null,onFocus:v,onBlur:g}),(0,Fo.jsx)("span",{className:Zo("upload__output"),"aria-hidden":"true",id:f,children:s})]})]})})]})}const tl=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:s,isComplete:o,onClickCancel:i})=>{const{t:a}=wo(),[{value:c}]=Ya(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,Fo.jsxs)(Oc,{className:Zo("upload-form"),children:[(0,Fo.jsx)(el,{name:t,id:e,accept:n,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,Fo.jsxs)("div",{className:Zo("upload__button-container"),children:[(0,Fo.jsx)("button",{id:s||!o?e:void 0,type:"button",onClick:i,className:Zo("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,Fo.jsx)("button",{className:Zo("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})},nl="fileListForm",rl="fileList",sl=()=>{const{t:e}=wo(),{sendPolite:t,sendAssertive:n}=Oo(),r=Zn(),s=Wo(),{serviceAllowsUploads:o,allowedMimeTypes:i,maxSize:a}=ri(),c=(0,oo.useRef)(null),l=(0,oo.useRef)(o),{cancelEntrySelection:u}=Jc(),{uploadFile:d,clearUploads:p,isUploading:h,isComplete:f}=si(),{uploadHandle:m,hasServerError:y,progress:v}=((e,t)=>{const n=In((n=>Va(n,{formId:e,name:t}))),{currentUploads:r}=si(),s=n&&n.length>0;let o=null,i=!1,a=0;if(r&&r.length>0){const e=r[0];o=e.uploadHandle,i=!!e.error,a=e.progress}return{hasFile:s,selectedFileName:s?n[0].name:"",uploadHandle:o,hasServerError:i,progress:a}})(nl,rl),g=di(),b=(0,oo.useRef)(!0),w=e("fileUpload.contentHint",{size:x(a)}),C=(0,oo.useRef)(""),_=(0,oo.useRef)(null);(0,oo.useEffect)((()=>{C.current&&_.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(w),C.current=w}),[w,n]),(0,oo.useEffect)((()=>{v>0&&t(1===v?e("fileUpload.srStartedText"):`${v}%`)}),[v,t,e]),(0,oo.useEffect)((()=>{b.current||h||!f||(p(),u(),s(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=f}),[h,f,p,u,s,t,e]);const E=(0,oo.useCallback)((({fileList:e})=>{d(e[0]),s()}),[d,!1,s]),S=(0,oo.useCallback)((()=>{m&&m.abort(),p(),u(),s()}),[m,p,u,s]),j=(0,oo.useMemo)((()=>({[rl]:[kc((()=>o),e("fileUpload.errors.unavailable")),kc(Ac,e("fileUpload.errors.noFile")),kc(Nc,e("fileUpload.errors.tooLarge"),a)]})),[a,o,e]);return(0,Fo.jsx)("div",{className:Zo(["upload",...y?["upload--error"]:[]]),ref:_,children:(0,Fo.jsxs)(Tc,{formId:nl,persistData:!0,onSubmit:E,validationSchema:j,children:[(h||!f)&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)(Qc,{}),(0,Fo.jsx)("div",{className:Zo("upload__button-container"),children:(0,Fo.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,ref:c,className:Zo("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&f&&(0,Fo.jsx)(tl,{controlName:rl,skiplinkId:r,accept:i?.join(", ")||"",contentHint:w,isComplete:f,isUploading:h,onClickCancel:S}),!l.current&&(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)("span",{className:Zo("notification"),id:g,children:e("fileUpload.unavailableText")}),(0,Fo.jsx)("div",{className:Zo("upload__button-container"),children:(0,Fo.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,className:Zo("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},ol=()=>{const{t:e}=wo(),{showFileUpload:t,serviceAllowsUploads:n}=ri(),[r,s]=(0,oo.useState)(n||!1),o=Wo(),i=(0,oo.useRef)(null),{setUserEntryType:a,activeEntry:c}=Jc(),l=(0,oo.useRef)(null),{sendPolite:u}=Oo(),d=!!tr();return(0,oo.useEffect)((()=>{S(l.current,(()=>{n||o()})),s(n||!1)}),[n,o]),(0,oo.useEffect)((()=>{i.current&&!n&&u(e("fileUpload.srUnavailableText")),!1===i.current&&n&&u(e("fileUpload.srAvailableText")),d&&(i.current=n)}),[n,d,u,e]),t||c===A?null:(0,Fo.jsx)(fc,{isActive:r,transitionStartState:hc.rendered,children:(0,Fo.jsx)("div",{className:Zo("upload-toggle-wrapper"),children:(0,Fo.jsx)(fc,{isActive:r,transitionStartState:hc.visuallyHidden,children:(0,Fo.jsx)("button",{className:Zo(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{a(A),o()}:void 0,children:(0,Fo.jsx)(gi,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},il=()=>{const{isOpen:e}=Co(),t=(0,oo.useRef)(null),{hasCountdown:n}=li(),[r,s]=(0,oo.useState)(n),{hasPrompt:o}=ui(),[i,a]=(0,oo.useState)(o),c=Wo(),l=(0,oo.useRef)(!1),{activeEntry:u}=Jc(),[d,p]=(0,oo.useState)({text:Zc,upload:sl}),[h,f]=(0,oo.useState)((()=>u)),m=Hn(),{accountAllowsUploads:y}=ri(),v=(0,oo.useCallback)((()=>{S(t.current,c)}),[c]);(0,oo.useEffect)((()=>{const{customComponents:e}=m,{entry:t}=e||{};t&&p((e=>({...e,...t})))}),[m]),(0,oo.useEffect)((()=>{v(),s(n),a(o)}),[n,o,v]),(0,oo.useEffect)((()=>{f(u),v()}),[u,v,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const g=d[h];return(0,Fo.jsxs)("div",{className:Zo("chat__entry"),ref:t,children:[r&&(0,Fo.jsx)(qc,{}),i&&(0,Fo.jsx)(Gc,{}),(0,Fo.jsxs)("div",{className:Zo(["entry__body",...n||o?["entry__body--hidden"]:[]]),children:[h!==A&&y&&e?(0,Fo.jsx)(ol,{}):null,(0,Fo.jsx)(g,{})]})]})},al=()=>{const{t:e}=wo(),{isOpen:t,closeChat:n}=Co(),{isWindow:r}=rr();return t&&r?(0,Fo.jsx)("button",{type:"button",className:Zo("button","collapse-button"),onClick:n,children:(0,Fo.jsx)(gi,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},cl=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:s,srText:o}}=Po(),i=Io(),a=di(),{sendPolite:c}=Oo(),l=Wo(),u="SeamlySessionExpiredError"===e?.name;return(0,oo.useEffect)((()=>{!u&&o&&setTimeout((()=>{c(o)}),200)}),[c,o,u]),u?(0,Fo.jsx)(Fo.Fragment,{}):(0,Fo.jsxs)("section",{className:Zo("interrupt"),"aria-labelledby":a,children:[(0,Fo.jsx)(al,{}),(0,Fo.jsxs)("div",{className:Zo("interrupt__body"),children:[(0,Fo.jsx)("h2",{id:a,className:Zo("interrupt__title"),children:t}),(0,Fo.jsx)("p",{className:Zo("interrupt__message"),children:n}),r&&s&&(0,Fo.jsx)("div",{className:Zo("interrupt__actions"),children:(0,Fo.jsx)("button",{type:"button",className:Zo("button","button--primary"),onClick:()=>{s&&i[s]&&i[s](),l()},children:r})})]})]})},ll=function({children:e}){const t=In(Mo),{isOpen:n}=Co();return t?(0,Fo.jsx)(cl,{}):(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsxs)(Vc,{children:[(0,Fo.jsxs)("div",{className:Zo("chat__container__header"),children:[(0,Fo.jsx)(wc,{}),(0,Fo.jsx)(al,{})]}),e]}),(0,Fo.jsx)(il,{}),n&&(0,Fo.jsx)($c,{})]})};function ul({event:e}){const[t]=sc(e);return(0,Fo.jsx)("li",{children:(0,Fo.jsx)(t,{event:e})})}function dl({events:e}){return(0,Fo.jsx)("ul",{className:Zo("collapsed-chat-messages"),children:e.map((e=>(0,Fo.jsx)(ul,{event:e},e.payload.id)))})}function pl(){const{preChatEvents:e}=Hn(),t=In(Mo),{isOpen:n}=Co();return t||!e?.length||n?null:(0,Fo.jsx)(dl,{events:e})}function hl(){const{t:e}=wo(),t=e("window.chat.continue"),n=(0,oo.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t}}})),[t]);return(0,Fo.jsx)(dl,{events:[n]})}const fl=()=>{const e=Vn(),t=tr(),n=In(Mo),r=t&&!n,s=r?t.avatar:e;return s?(0,Fo.jsx)("img",{className:Zo(r?"avatar":"icon"),src:s,alt:""}):(0,Fo.jsx)(gi,{name:"avatar",size:"32",alt:""})},ml=({onClick:e})=>{const t=Ro(),{t:n}=wo(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),s=Wo(),{isOpen:o}=Co(),i=Yn(),a=(0,oo.useCallback)((()=>{e(),s()}),[s,e]);return(0,Fo.jsx)(fc,{isActive:!o,transitionStartState:hc.rendered,children:(0,Fo.jsxs)("button",{className:Zo("window-open-button"),"aria-label":r,"aria-hidden":o,onClick:a,children:[(0,Fo.jsx)(fc,{isActive:!!i,transitionStartState:hc.notRendered,children:(0,Fo.jsx)("span",{className:Zo("message-count"),"aria-hidden":"true",children:i})}),(0,Fo.jsx)(fl,{})]})})},yl=(e,t,n)=>"object"==typeof e?e[t]:n,vl=n.p+"sounds/beep.mp3",gl=!!window.Notification,bl={app:()=>(0,Fo.jsx)(vc,{children:(0,Fo.jsx)(ll,{children:(0,Fo.jsx)(cc,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=so(),{connectWhenInView:t}=Hn(),n=In(or),{containerRef:r,isVisible:s}=_o({enabled:t,freezeOnceVisible:!0});return(0,oo.useEffect)((()=>{s&&e(to())}),[e,s]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=Co();return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)(fc,{isActive:!n,transitionStartState:hc.rendered,children:(0,Fo.jsxs)("div",{ref:t,className:Zo("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,Fo.jsx)(pl,{}),(0,Fo.jsx)(mc,{})]})}),(0,Fo.jsx)(fc,{isActive:n,transitionStartState:hc.rendered,children:(0,Fo.jsx)(vc,{ref:t,children:e&&(0,Fo.jsx)(ll,{children:n&&(0,Fo.jsx)(cc,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=Co(),n=Eo(),{continueChat:r,preChat:s}=Hn();return(0,Fo.jsxs)(Fo.Fragment,{children:[(0,Fo.jsx)(ml,{onClick:t}),(0,Fo.jsx)(fc,{isActive:!!s&&!e&&!n,exitAfter:yl(s,"exitAfter"),enterDelay:yl(s,"enterDelay"),transitionStartState:hc.notRendered,children:(0,Fo.jsx)("div",{className:Zo("unstarted-wrapper","unstarted-wrapper--window"),children:(0,Fo.jsx)(pl,{})})}),(0,Fo.jsx)(fc,{isActive:r&&!e&&n,exitAfter:yl(r,"exitAfter"),enterDelay:yl(r,"enterDelay"),transitionStartState:hc.notRendered,children:(0,Fo.jsx)("div",{className:Zo("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,Fo.jsx)(hl,{})})}),(0,Fo.jsx)(fc,{isActive:e,transitionStartState:hc.notRendered,children:(0,Fo.jsx)(vc,{children:(0,Fo.jsx)(ll,{children:(0,Fo.jsx)(cc,{})})})})]})}};function xl(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const wl=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=Qn(),{notificationAudioURL:t}=Hn(),[n,r]=(0,oo.useState)(gl?Notification.permission:"default"),[s,o]=(0,oo.useState)(document.visibilityState),i=In(Fa),a=(0,oo.useCallback)((async()=>{if(gl&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,oo.useMemo)((()=>"granted"===n),[n]),l=(0,oo.useMemo)((()=>"hidden"===s),[s]);(0,oo.useEffect)((()=>{"default"===n&&e&&a()}),[n,e,a]);const u=(0,oo.useCallback)((async(e,r)=>{if(i&&gl){if("default"===n&&a(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||vl);await e.play()}catch(e){console.warn(e)}if(c&&(l||!document.hasFocus())){const t=new Notification(e,r);t.onclick=function(){window.parent.focus(),window.focus(),t.close();const e=document.querySelector(`input[name=${Yc}]`);e&&e.focus()}}}}),[t,n,c,a,i,l]);return(0,oo.useEffect)((()=>{if(!i)return()=>{};function e(){o(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[i]),{permission:n,requestPermission:a,sendNotification:u}})(),[,n]=Ho(),r=Hn(),s=tr(),{proactiveMessages:o}=Qn(),{isOpen:i,isVisible:a}=Co(),c=Qo(),l=Eo(),u=In(Da),{body:d}=Ko(u),{userLocale:p}=wo(),h=(0,oo.useRef)(void 0),f=(0,oo.useMemo)((()=>d?"string"==typeof d?xl(d):"text"in d?xl(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?xl(d.prompt?.text):"":""),[d]);(0,oo.useEffect)((()=>{s?.name&&f&&o&&u&&h.current!==u.payload?.id&&(t(s.name,{body:f,icon:s?.avatar}),h.current=u.payload.id)}),[s?.avatar,s?.name,u,f,o,t]);const m=bl[r.layoutMode],y=(0,oo.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),v=(0,oo.useMemo)((()=>{if(p){const e=document.querySelector("html")?.getAttribute("lang");if(e!==p)return p}}),[p]);if(!m)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const g=["app",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];return"function"!=typeof c?g.push(...c):g.push(...c(r)),i||"app"===r.layoutMode||g.push("app--collapsed"),l&&g.push("app--user-responded"),a?(0,Fo.jsx)("div",{className:Zo(g),lang:v,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,Fo.jsx)(m,{})}):null},Cl=e=>(0,Fo.jsx)(Ma,{...e,children:(0,Fo.jsx)(wl,{})});class _l{constructor(e,n){const{namespace:r="",parentElement:s,...o}=e;this.config={...o,namespace:r},this.namespace=r,this.parentElement=s,this.externalApi=n,this.api=new we({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(t()),this.functions={},this.registerFunctions({on:this.eventBus.on,off:this.eventBus.off}),this.eventBus.on("function.register",((e,t)=>this.registerFunction(e,t))),this.eventBus.on("function.unregister",((e,t)=>this.unregisterFunction(e,t)))}async render(){const{view:e,...t}=this.config.customComponents||{},n={...this.config,parentElement:this.parentElement,customComponents:Object.keys(t).length?t:void 0},r=ro({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(fr(n)),await r.dispatch(hn()),await r.dispatch(lr()),r.dispatch(cr()),e?(0,s.render)((0,Fo.jsx)(Ma,{eventBus:this.eventBus,store:r,api:this.api,children:(0,Fo.jsx)(e,{})}),this.parentElement):(0,s.render)((0,Fo.jsx)(Cl,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,s.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),this.functions={}}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const n=this.functions[e];n&&n.length&&(this.functions[e]=n.filter((e=>e!==t)))}execFunction(e,...t){const n=this.functions[e];return!(!n||!n.length||(n.forEach((n=>{try{n(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}const El=e=>"object"==typeof e&&"action"in e,Sl=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),jl=class{constructor(e){this._waitingActions=[],this._instances={},this.timeoutId=void 0,this.appConfig=e,this.context={}}push(...e){(e=e.filter(El).map(Sl)).length&&(this._waitingActions.push(...e),this.handleActions())}handleActions(){const e=this._waitingActions;this._waitingActions=[],e.forEach((e=>{switch(e.action){case"init":this.handleInit(e);break;case"destroy":this.handleDestroy(e);break;default:this.handleAction(e)||this.setContext(e.action,...e.args)||this._waitingActions.push(e)}}))}instanceInitializing(e){const t=Object.keys(this._instances);return!e&&t.length>0||t.includes(e)}setContext(e,t){const{instance:n}=t;if(this.instanceInitializing(n))return!1;switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:n,locale:r}=t;return n&&r&&(this.context.userLocale=r,this.context.source=$),!0;case"setContext":const{userLocale:s,contentLocale:o}=t;return this.context.userLocale=s,this.context.contentLocale=o,s&&s!=this.appConfig?.userLocale&&(this.context.source=$),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables={...t}),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace:s}=n||t;if(s?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==s||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout((()=>{e.render()}),60)}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,s=Object.values(this._instances);return!n&&s.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),s.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new _l(e,this)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){const t={...e.context||this.appConfig.context,...this.context},n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r={...this.appConfig.defaults,...e.defaults},s={...this.appConfig,...e,api:{...this.appConfig.api,...e.api},context:Object.keys(t).length?t:void 0,defaults:Object.keys(r).length?r:void 0};return"function"==typeof this.appConfig?this.appConfig(s):s}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},Tl=()=>{const e=so();return{addEvent:t=>e(ns(t)),clearEvents:()=>e(ss()),setHistory:t=>e(Cs(t)),setEventsRead:t=>e(vs(t)),setLoadedImageEventIds:t=>e(Ss(t)),ackEvent:t=>e(ts(t)),setIsLoading:t=>e(Es(t)),setParticipant:t=>e(js(t)),setHeaderTitle:t=>e(ws(t)),setHeaderSubTitle:t=>e(xs(t)),resetHistoryLoadedFlag:()=>e(hs()),setActiveService:t=>e(ms(t)),initIdleDetachCountdown:t=>e(us(t)),decrementIdleDetachCountdownCounter:()=>e(cs()),stopIdleDetachCountdownCounter:()=>e(Bs()),clearIdleDetachCountdown:()=>e(is()),initResumeConversationPrompt:()=>e(ds()),clearResumeConversationPrompt:()=>e(as()),setServiceDataItem:t=>e(ks(t)),setFeatures:t=>e(bs(t)),setFeatureEnabledState:t=>e(gs(t)),clearFeatures:()=>e(os()),setInitialState:t=>e(_s(t)),setUserSelectedOptions:t=>e(Us(t)),setUserSelectedOption:t=>e(Ds(t)),showOption:t=>e(Fs(t)),hideOption:()=>e(ls()),setServiceEntryMetadata:t=>e(Ns(t)),setBlockAutoEntrySwitch:t=>e(ys(t)),setActiveEntryType:t=>e(fs(t)),setUserEntryType:t=>e(Ps(t)),registerUpload:t=>e(ps(t)),setUploadProgress:t=>e(Os(t)),setUploadComplete:t=>e(Rs(t)),setUploadError:t=>e(Is(t)),clearAllUploads:()=>e(rs()),setSeamlyContainerElement:t=>e(Ts(t))}},kl=()=>{const{t:e}=wo(),{title:t,subTitle:n}=qn().headerTitles,r=Yn(),{isOpen:s}=Co(),o=tr(),i=In(Mo),a=Vn(),c=o?.avatar??a,l=i?"":n,u=["message-count"];return s&&u.push("message-count__hide"),0===r&&u.push("message-count__empty"),l||!s?(0,Fo.jsxs)("div",{className:Zo("agent-info"),children:[(0,Fo.jsxs)("div",{className:Zo("agent-info__graphic"),children:[c?(0,Fo.jsx)("img",{className:Zo(o?.avatar?"avatar":"icon"),src:c,alt:""}):(0,Fo.jsx)(gi,{name:"avatar",size:"32",alt:""}),(0,Fo.jsx)("span",{className:Zo(u),"aria-hidden":"true",children:r})]}),(0,Fo.jsxs)("div",{className:Zo("agent-info__body"),children:[(0,Fo.jsx)("p",{className:Zo("agent-info__heading"),children:t??e("header.title")}),(0,Fo.jsx)("p",{className:Zo("agent-info__text"),children:l})]})]}):null},Nl=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:n}=qn(),r=(0,oo.useRef)(null),{t:s}=wo();return(0,Fo.jsxs)("header",{className:Zo("chat__header"),children:[e,(0,Fo.jsx)("div",{className:Zo("header-controls"),children:(0,Fo.jsx)("button",{type:"button",className:Zo("button","header-controls__collapse"),onClick:t,ref:r,id:n,children:(0,Fo.jsx)(gi,{name:"chevronDown",size:"32",alt:s("header.collapseApp")})})})]})},Al=function(e){if(window.seamly&&!Array.isArray(window.seamly))throw new Error("Seamly UI has already been initialised. Use the window.seamly object to start new instances instead.");const t=Array.isArray(window.seamly)?window.seamly:[],n=new jl(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
|
|
3
3
|
//# sourceMappingURL=~/index.min.js.map
|