@seamly/web-ui 23.0.3 → 23.0.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/lib/index.debug.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- package/src/javascripts/style-guide/components/view.tsx +1 -1
|
@@ -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,o){return(t[n]=t[n]||[]).push([r,o]),e},e.off=function(r,o){r||(t={});for(var s=t[r]||n,i=s.length=o?s.length:0;i--;)o==s[i][0]&&s.splice(i,1);return e},e.emit=function(r){for(var o,s=t[r]||n,i=s.length>0?s.slice(0,s.length):s,a=0;o=i[a++];)o[0].apply(o[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:()=>ee,Suspense:()=>b,SuspenseList:()=>_,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>J,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>q,createPortal:()=>j,createRef:()=>r.createRef,default:()=>ce,findDOMNode:()=>Y,flushSync:()=>Q,forwardRef:()=>p,hydrate:()=>L,isElement:()=>se,isFragment:()=>K,isValidElement:()=>G,lazy:()=>w,memo:()=>l,render:()=>O,startTransition:()=>te,unmountComponentAtNode:()=>X,unstable_batchedUpdates:()=>Z,useDeferredValue:()=>ne,useInsertionEffect:()=>oe,useSyncExternalStore:()=>ie,useTransition:()=>re,version:()=>W});var r=n(8785),o=n(1162),s={};for(const e in o)["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","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(s[e]=()=>o[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 o(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}n.d(t,s),(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 o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__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,o;function s(s){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){o=e})),o)throw o;if(!n)throw t;return(0,r.createElement)(n,s)}return s.displayName="Lazy",s.__f=!0,s}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 o=x(r.__v),s=!1,i=function(){s||(s=!0,n.__R=null,o?o(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"),o=this.__v.__k[0].__c;this.__v.__k[0]=v(this.__b,n,o.__O=o.__P)}this.__b=null}var s=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return s&&(s.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),s]};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(o){var s=function(){t.props.revealOrder?(r.push(o),C(t,e,r)):o()};n?n(s):s()}},_.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,o={};for(var s in t){var i=t[s];if(!("value"===s&&"defaultValue"in t&&null==i||R&&"children"===s&&"noscript"===n||"class"===s||"className"===s)){var a=s.toLowerCase();"defaultValue"===s&&"value"in t&&null==t.value?s="value":"download"===s&&!0===i?i="":"translate"===a&&"no"===i?i=!1:"ondoubleclick"===a?s="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||I(t.type)?"onfocus"===a?s="onfocusin":"onblur"===a?s="onfocusout":N.test(s)?s=a:-1===n.indexOf("-")&&k.test(s)?s=s.replace(A,"-$&").toLowerCase():null===i&&(i=void 0):a=s="oninput","oninput"===a&&o[s=a]&&(s="oninputCapture"),o[s]=i}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==n&&null!=o.defaultValue&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",B)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(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}}}},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 G(e)?r.cloneElement.apply(null,arguments):e}function X(e){return!!e.__k&&((0,r.render)(null,e),!0)}function Y(e){return e&&(e.base||1===e.nodeType&&e)||null}var Z=function(e,t){return e(t)},Q=function(e,t){return e(t)},ee=r.Fragment;function te(e){e()}function ne(e){return e}function re(){return[!1,te]}var oe=o.useLayoutEffect,se=G;function ie(e,t){var n=t(),r=(0,o.useState)({h:{__:n,v:t}}),s=r[0].h,i=r[1];return(0,o.useLayoutEffect)((function(){s.__=n,s.v=t,ae(s)&&i({h:s})}),[e,n,t]),(0,o.useEffect)((function(){return ae(s)&&i({h:s}),e((function(){ae(s)&&i({h:s})}))}),[e]),n}function ae(e){var t,n,r=e.v,o=e.__;try{var s=r();return!((t=o)===(n=s)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var ce={useState:o.useState,useId:o.useId,useReducer:o.useReducer,useEffect:o.useEffect,useLayoutEffect:o.useLayoutEffect,useInsertionEffect:oe,useTransition:re,useDeferredValue:ne,useSyncExternalStore:ie,startTransition:te,useRef:o.useRef,useImperativeHandle:o.useImperativeHandle,useMemo:o.useMemo,useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,version:"17.0.2",Children:f,render:O,hydrate:L,unmountComponentAtNode:X,createPortal:j,createElement:r.createElement,createContext:r.createContext,createFactory:q,cloneElement:J,createRef:r.createRef,Fragment:r.Fragment,isValidElement:G,isElement:se,isFragment:K,findDOMNode:Y,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:Q,unstable_batchedUpdates:Z,StrictMode:ee,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),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=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,s=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,o(s,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(s=e,i=n)}var s,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=s(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),o=n(6823),s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not a function")}},3506:(e,t,n)=>{"use strict";var r=n(3925),o=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s("Can't set "+o(e)+" as a prototype")}},6469:(e,t,n)=>{"use strict";var r=n(8227),o=n(2360),s=n(4913).f,i=r("unscopables"),a=Array.prototype;void 0===a[i]&&s(a,i,{configurable:!0,value:o(null)}),e.exports=function(e){a[i][e]=!0}},679:(e,t,n)=>{"use strict";var r=n(1625),o=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new o("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),o=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not an object")}},7811:e=>{"use strict";e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},4644:(e,t,n)=>{"use strict";var r,o,s,i=n(7811),a=n(3724),c=n(4475),l=n(4901),u=n(34),d=n(9297),p=n(6955),h=n(6823),f=n(6699),m=n(6840),y=n(2106),v=n(1625),g=n(2787),b=n(2967),x=n(8227),w=n(3392),_=n(1181),C=_.enforce,E=_.get,S=c.Int8Array,j=S&&S.prototype,T=c.Uint8ClampedArray,k=T&&T.prototype,N=S&&g(S),A=j&&g(j),R=Object.prototype,I=c.TypeError,O=x("toStringTag"),L=w("TYPED_ARRAY_TAG"),M="TypedArrayConstructor",P=i&&!!b&&"Opera"!==p(c.opera),D=!1,U={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},F={BigInt64Array:8,BigUint64Array:8},B=function(e){var t=g(e);if(u(t)){var n=E(t);return n&&d(n,M)?n[M]:B(t)}},z=function(e){if(!u(e))return!1;var t=p(e);return d(U,t)||d(F,t)};for(r in U)(s=(o=c[r])&&o.prototype)?C(s)[M]=o:P=!1;for(r in F)(s=(o=c[r])&&o.prototype)&&(C(s)[M]=o);if((!P||!l(N)||N===Function.prototype)&&(N=function(){throw new I("Incorrect invocation")},P))for(r in U)c[r]&&b(c[r],N);if((!P||!A||A===R)&&(A=N.prototype,P))for(r in U)c[r]&&b(c[r].prototype,A);if(P&&g(k)!==A&&b(k,A),a&&!d(A,O))for(r in D=!0,y(A,O,{configurable:!0,get:function(){return u(this)?this[L]:void 0}}),U)c[r]&&f(c[r],L,r);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_TAG:D&&L,aTypedArray:function(e){if(z(e))return e;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(e){if(l(e)&&(!b||v(N,e)))return e;throw new I(h(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(a){if(n)for(var o in U){var s=c[o];if(s&&d(s.prototype,e))try{delete s.prototype[e]}catch(n){try{s.prototype[e]=t}catch(e){}}}A[e]&&!n||m(A,e,n?t:P&&j[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,o;if(a){if(b){if(n)for(r in U)if((o=c[r])&&d(o,e))try{delete o[e]}catch(e){}if(N[e]&&!n)return;try{return m(N,e,n?t:P&&N[e]||t)}catch(e){}}for(r in U)!(o=c[r])||o[e]&&!n||m(o,e,t)}},getTypedArrayConstructor:B,isView:function(e){if(!u(e))return!1;var t=p(e);return"DataView"===t||d(U,t)||d(F,t)},isTypedArray:z,TypedArray:N,TypedArrayPrototype:A}},5370:(e,t,n)=>{"use strict";var r=n(6198);e.exports=function(e,t,n){for(var o=0,s=arguments.length>2?n:r(t),i=new e(s);s>o;)i[o]=t[o++];return i}},9617:(e,t,n)=>{"use strict";var r=n(5397),o=n(5610),s=n(6198),i=function(e){return function(t,n,i){var a=r(t),c=s(a);if(0===c)return!e&&-1;var l,u=o(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),o=n(4376),s=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(o(e)&&!i(e,"length").writable)throw new s("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},7628:(e,t,n)=>{"use strict";var r=n(6198);e.exports=function(e,t){for(var n=r(e),o=new t(n),s=0;s<n;s++)o[s]=e[n-s-1];return o}},9928:(e,t,n)=>{"use strict";var r=n(6198),o=n(1291),s=RangeError;e.exports=function(e,t,n,i){var a=r(e),c=o(n),l=c<0?a+c:c;if(l>=a||l<0)throw new s("Incorrect index");for(var u=new t(a),d=0;d<a;d++)u[d]=d===l?i:e[d];return u}},4576:(e,t,n)=>{"use strict";var r=n(9504),o=r({}.toString),s=r("".slice);e.exports=function(e){return s(o(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),o=n(4901),s=n(4576),i=n(8227)("toStringTag"),a=Object,c="Arguments"===s(function(){return arguments}());e.exports=r?s: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?s(t):"Object"===(r=s(t))&&o(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),o=n(5031),s=n(7347),i=n(4913);e.exports=function(e,t,n){for(var a=o(t),c=i.f,l=s.f,u=0;u<a.length;u++){var d=a[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},2211:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},6699:(e,t,n)=>{"use strict";var r=n(3724),o=n(4913),s=n(6980);e.exports=r?function(e,t,n){return o.f(e,t,s(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}}},2106:(e,t,n)=>{"use strict";var r=n(283),o=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),o.f(e,t,n)}},6840:(e,t,n)=>{"use strict";var r=n(4901),o=n(4913),s=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)&&s(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:o.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),o=Object.defineProperty;e.exports=function(e,t){try{o(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),o=n(34),s=r.document,i=o(s)&&o(s.createElement);e.exports=function(e){return i?s.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,o,s=n(4475),i=n(9392),a=s.process,c=s.Deno,l=a&&a.versions||c&&c.version,u=l&&l.v8;u&&(o=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},7015:(e,t,n)=>{"use strict";var r=n(4475),o=n(9504);e.exports=function(e,t){return o(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),o=Error,s=r("".replace),i=String(new o("zxcasd").stack),a=/\n\s*at [^:]*:[^\n]*/,c=a.test(i);e.exports=function(e,t){if(c&&"string"==typeof e&&!o.prepareStackTrace)for(;t--;)e=s(e,a,"");return e}},6518:(e,t,n)=>{"use strict";var r=n(4475),o=n(7347).f,s=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=o(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)&&s(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),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),o=n(9297),s=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,a=o(s,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&i(s,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},6706:(e,t,n)=>{"use strict";var r=n(9504),o=n(9306);e.exports=function(e,t,n){try{return r(o(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},9504:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype,s=o.call,i=r&&o.bind.bind(s,s);e.exports=r?i:function(e){return function(){return s.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4475),o=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],o(n)?n:void 0):r[e]&&r[e][t];var n}},5966:(e,t,n)=>{"use strict";var r=n(9306),o=n(4117);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(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),o=n(8981),s=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return s(o(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),o=n(9039),s=n(4055);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),o=n(9039),s=n(4576),i=Object,a=r("".split);e.exports=o((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"===s(e)?a(e,""):i(e)}:i},3167:(e,t,n)=>{"use strict";var r=n(4901),o=n(34),s=n(2967);e.exports=function(e,t,n){var i,a;return s&&r(i=t.constructor)&&i!==n&&o(a=i.prototype)&&a!==n.prototype&&s(e,a),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),o=n(4901),s=n(7629),i=r(Function.toString);o(s.inspectSource)||(s.inspectSource=function(e){return i(e)}),e.exports=s.inspectSource},1181:(e,t,n)=>{"use strict";var r,o,s,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},o=function(e){return v.get(e)||{}},s=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},o=function(e){return u(e,g)?e[g]:{}},s=function(e){return u(e,g)}}e.exports={set:r,get:o,has:s,enforce:function(e){return s(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(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)}},1108:(e,t,n)=>{"use strict";var r=n(6955);e.exports=function(e){var t=r(e);return"BigInt64Array"===t||"BigUint64Array"===t}},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),o=n(4901),s=/#|\.prototype\./,i=function(e,t){var n=c[a(e)];return n===u||n!==l&&(o(t)?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(s,".").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),o=n(4901),s=n(1625),i=n(7040),a=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&s(t.prototype,a(e))}},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),o=n(9039),s=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&&!o((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 s(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,o=n(8551),s=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 o=i.length;o--;)delete v[d][i[o]];return v()};a[h]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(f[d]=o(e),n=new f,f[d]=null,n[h]=e):n=v(),void 0===t?n:s.f(n,t)}},6801:(e,t,n)=>{"use strict";var r=n(3724),o=n(8686),s=n(4913),i=n(8551),a=n(5397),c=n(1072);t.f=r&&!o?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),o=c(t),l=o.length,u=0;l>u;)s.f(e,n=o[u++],r[n]);return e}},4913:(e,t,n)=>{"use strict";var r=n(3724),o=n(5917),s=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?s?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),o)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),o=n(9565),s=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(!o(s.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},2787:(e,t,n)=>{"use strict";var r=n(9297),o=n(4901),s=n(8981),i=n(6119),a=n(2211),c=i("IE_PROTO"),l=Object,u=l.prototype;e.exports=a?l.getPrototypeOf:function(e){var t=s(e);if(r(t,c))return t[c];var n=t.constructor;return o(n)&&t instanceof n?n.prototype:t instanceof l?u:null}},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),o=n(9297),s=n(5397),i=n(9617).indexOf,a=n(421),c=r([].push);e.exports=function(e,t){var n,r=s(e),l=0,u=[];for(n in r)!o(a,n)&&o(r,n)&&c(u,n);for(;t.length>l;)o(r,n=t[l++])&&(~i(u,n)||c(u,n));return u}},1072:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727);e.exports=Object.keys||function(e){return r(e,o)}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),o=n(8551),s=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),s(r),t?e(n,r):n.__proto__=r,n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),o=n(4901),s=n(34),i=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&o(n=e.toString)&&!s(a=r(n,e)))return a;if(o(n=e.valueOf)&&!s(a=r(n,e)))return a;if("string"!==t&&o(n=e.toString)&&!s(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),o=n(9504),s=n(8480),i=n(3717),a=n(8551),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=s.f(a(e)),n=i.f;return n?c(t,n(e)):t}},7750:(e,t,n)=>{"use strict";var r=n(4117),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},6119:(e,t,n)=>{"use strict";var r=n(5745),o=n(3392),s=r("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),o=n(4475),s=n(9433),i="__core-js_shared__",a=e.exports=o[i]||s(i,{});(a.versions||(a.versions=[])).push({version:"3.36.0",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.0/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),o=n(9039),s=n(4475).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:(e,t,n)=>{"use strict";var r=n(1291),o=Math.max,s=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):s(n,t)}},5854:(e,t,n)=>{"use strict";var r=n(2777),o=TypeError;e.exports=function(e){var t=r(e,"number");if("number"==typeof t)throw new o("Can't convert number to bigint");return BigInt(t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),o=n(7750);e.exports=function(e){return r(o(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),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),o=Object;e.exports=function(e){return o(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),o=n(34),s=n(757),i=n(5966),a=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var n,c=i(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||s(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),o=n(757);e.exports=function(e){var t=r(e,"string");return o(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),o=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return o(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),o=0,s=Math.random(),i=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++o+s,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),o=n(9039);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},2812:e=>{"use strict";var t=TypeError;e.exports=function(e,n){if(e<n)throw new t("Not enough arguments");return e}},8622:(e,t,n)=>{"use strict";var r=n(4475),o=n(4901),s=r.WeakMap;e.exports=o(s)&&/native code/.test(String(s))},8227:(e,t,n)=>{"use strict";var r=n(4475),o=n(5745),s=n(9297),i=n(3392),a=n(4495),c=n(7040),l=r.Symbol,u=o("wks"),d=c?l.for||l:l&&l.withoutSetter||i;e.exports=function(e){return s(u,e)||(u[e]=a&&s(l,e)?l[e]:d("Symbol."+e)),u[e]}},8107:(e,t,n)=>{"use strict";var r=n(6518),o=n(8981),s=n(6198),i=n(1291),a=n(6469);r({target:"Array",proto:!0},{at:function(e){var t=o(this),n=s(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),o=n(8981),s=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=o(this),n=s(t),r=arguments.length;a(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return i(t,n),n}})},7467:(e,t,n)=>{"use strict";var r=n(7628),o=n(4644),s=o.aTypedArray,i=o.exportTypedArrayMethod,a=o.getTypedArrayConstructor;i("toReversed",(function(){return r(s(this),a(this))}))},4732:(e,t,n)=>{"use strict";var r=n(4644),o=n(9504),s=n(9306),i=n(5370),a=r.aTypedArray,c=r.getTypedArrayConstructor,l=r.exportTypedArrayMethod,u=o(r.TypedArrayPrototype.sort);l("toSorted",(function(e){void 0!==e&&s(e);var t=a(this),n=i(c(t),t);return u(n,e)}))},9577:(e,t,n)=>{"use strict";var r=n(9928),o=n(4644),s=n(1108),i=n(1291),a=n(5854),c=o.aTypedArray,l=o.getTypedArrayConstructor,u=o.exportTypedArrayMethod,d=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}();u("with",{with:function(e,t){var n=c(this),o=i(e),u=s(n)?a(t):+t;return r(n,l(n),o,u)}}.with,!d)},4979:(e,t,n)=>{"use strict";var r=n(6518),o=n(4475),s=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=s("Error"),g=s(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),o=new v(t);return o.name=y,a(r,"stack",i(1,h(o.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(o,y),E=!(!C||C.writable&&C.configurable),S=w&&!E&&!_;r({global:!0,constructor:!0,forced:m||S},{DOMException:S?b:g});var j=s(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))}},4603:(e,t,n)=>{"use strict";var r=n(6840),o=n(9504),s=n(655),i=n(2812),a=URLSearchParams,c=a.prototype,l=o(c.append),u=o(c.delete),d=o(c.forEach),p=o([].push),h=new a("a=1&a=2&b=3");h.delete("a",1),h.delete("b",void 0),h+""!="a=2"&&r(c,"delete",(function(e){var t=arguments.length,n=t<2?void 0:arguments[1];if(t&&void 0===n)return u(this,e);var r=[];d(this,(function(e,t){p(r,{key:t,value:e})})),i(t,1);for(var o,a=s(e),c=s(n),h=0,f=0,m=!1,y=r.length;h<y;)o=r[h++],m||o.key===a?(m=!0,u(this,o.key)):f++;for(;f<y;)(o=r[f++]).key===a&&o.value===c||l(this,o.key,o.value)}),{enumerable:!0,unsafe:!0})},7566:(e,t,n)=>{"use strict";var r=n(6840),o=n(9504),s=n(655),i=n(2812),a=URLSearchParams,c=a.prototype,l=o(c.getAll),u=o(c.has),d=new a("a=1");!d.has("a",2)&&d.has("a",void 0)||r(c,"has",(function(e){var t=arguments.length,n=t<2?void 0:arguments[1];if(t&&void 0===n)return u(this,e);var r=l(this,e);i(t,1);for(var o=s(n),a=0;a<r.length;)if(r[a++]===o)return!0;return!1}),{enumerable:!0,unsafe:!0})},8721:(e,t,n)=>{"use strict";var r=n(3724),o=n(9504),s=n(2106),i=URLSearchParams.prototype,a=o(i.forEach);r&&!("size"in i)&&s(i,"size",{get:function(){var e=0;return a(this,(function(){e++})),e},configurable:!0,enumerable:!0})}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.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 o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].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:()=>ee,AgentInfo:()=>Cl,Chat:()=>pc,ChatFrame:()=>ol,ComponentFilter:()=>ga,Conversation:()=>rc,Engine:()=>gl,EntryContainer:()=>tl,EventParticipant:()=>ci,ExternalApi:()=>wl,Header:()=>El,Icon:()=>hi,Interrupt:()=>rl,MessageContainer:()=>li,SeamlyActivityMonitor:()=>ba,SeamlyApiContext:()=>xs,SeamlyEventBusContext:()=>ws,SeamlyFileUpload:()=>_a,SeamlyGeneralError:()=>c,SeamlyLiveRegionContext:()=>_s,SeamlyOfflineError:()=>vr,SeamlyStoreProvider:()=>fn,Text:()=>ha,View:()=>yl,calculateVisibility:()=>Yt,className:()=>Gs,default:()=>Sl,eventTypes:()=>Bn,randomId:()=>m,useChoicePrompt:()=>_i,useEvents:()=>jn,useGeneratedId:()=>ii,useI18n:()=>ys,useSeamlyActions:()=>_l,useSeamlyChat:()=>Is,useSeamlyCommands:()=>Ts,useSeamlyConfig:()=>xn,useSeamlyEventStream:()=>ai,useSeamlyIdleDetachCountdown:()=>oi,useSeamlyMessageContainerClassNames:()=>Js,useSeamlyOptions:()=>ei,useSeamlyVisibility:()=>vs,useTranslatedEventData:()=>Hs,useTranslations:()=>$s,useTranslationsContainer:()=>Vs,visibilityStates:()=>Jt}),n(9497),n(4114);var e=n(2086),t=n.n(e),o=n(8785);n(4603),n(7566),n(8721);class s 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 o=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,o||e.apply(this,r),o=!1}),t),t=>{o=!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}n(7467),n(4732),n(9577),n(4979);var T=e=>"function"==typeof e?e:function(){return e},k="undefined"!=typeof self?self:null,N="undefined"!=typeof window?window:null,A=k||N||A,R="closed",I="errored",O="joined",L="joining",M="leaving",P="phx_close",D="phx_error",U="phx_reply",F="phx_leave",B="websocket",z=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})}},$=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))}},H=class{constructor(e,t,n){this.state=R,this.topic=e,this.params=T(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new z(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new $((()=>{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=O,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=I,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=R,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=I,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 z(this,F,T({}),this.timeout).send(),this.state=I,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(U,((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(P,e)}onError(e){return this.on(D,(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 z(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=M;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(P,"leave")},n=new z(this,F,T({}),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=L,this.joinPush.resend(e))}trigger(e,t,n,r){let o=this.onMessage(e,t,n,r);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter((t=>t.event===e));for(let e=0;e<s.length;e++)s[e].callback(o,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===R}isErrored(){return this.state===I}isJoined(){return this.state===O}isJoining(){return this.state===L}isLeaving(){return this.state===M}},V=class{static request(e,t,n,r,o,s,i){if(A.XDomainRequest){let n=new A.XDomainRequest;return this.xdomainRequest(n,e,t,r,o,s,i)}{let a=new A.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,o,s,i)}}static xdomainRequest(e,t,n,r,o,s,i){return e.timeout=o,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);i&&i(t)},s&&(e.ontimeout=s),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,o,s,i,a){return e.open(t,n,!0),e.timeout=s,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(o),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 o=t?`${t}[${r}]`:r,s=e[r];"object"==typeof s?n.push(this.serialize(s,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(s))}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)}`}},W=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("(.*)/"+B),"$1/longpoll")}endpointURL(){return V.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,o){let s;s=V.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(s),r()}),(e=>{this.reqs.delete(s),this.isActive()&&o(e)})),this.reqs.add(s)}},q={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,o,s,i]=JSON.parse(e);return t({join_ref:n,ref:r,topic:o,event:s,payload:i})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:o,payload:s}=e,i=this.META_LENGTH+t.length+n.length+o.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++,o.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(o,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(a.byteLength+s.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(s),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),o=t.getUint8(2),s=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+o));i+=o;let l=n.decode(e.slice(i,i+s));return i+=s,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(i,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),s=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+o));a+=o;let u=n.decode(e.slice(a,a+s));a+=s;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:U,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),s=this.HEADER_LENGTH+2,i=n.decode(e.slice(s,s+r));s+=r;let a=n.decode(e.slice(s,s+o));return s+=o,{join_ref:null,ref:null,topic:i,event:a,payload:e.slice(s,e.byteLength)}}},G=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||A.WebSocket||W,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||A.sessionStorage,this.establishedConnections=0,this.defaultEncoder=q.encode.bind(q),this.defaultDecoder=q.decode.bind(q),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==W?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;N&&N.addEventListener&&(N.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),N.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=T(t.params||{}),this.endPoint=`${e}/${B}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new $((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return W}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=V.appendParams(V.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=T(e)),this.conn||(this.longPollFallbackMs&&this.transport!==W?this.connectWithFallback(W,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((o=>{o.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,o=!0,s=t=>{this.log("transport",`falling back to ${e.name}...`,t),this.off([void 0,n]),o=!1,this.storeSession("phx:longpoll","true"),this.replaceTransport(e),this.transportConnect()};if(this.getSession("phx:longpoll"))return s("memorized");this.fallbackTimer=setTimeout(s,t),n=this.onError((e=>{this.log("transport","error",e),o&&!r&&(clearTimeout(this.fallbackTimer),s(e))})),this.onOpen((()=>{if(r=!0,!o)return console.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(s,t),this.ping((e=>{this.log("transport","connected to primary after",e),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(D)}))}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.joinRef()!==e.joinRef()))}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 H(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:o,join_ref:s}=e;this.log("push",`${t} ${n} (${s}, ${o})`,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:o,join_ref:s}=e;o&&o===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${o&&"("+o+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const i=this.channels[e];i.isMember(t,n,r,s)&&i.trigger(n,r,o,s)}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 K=()=>null,J=new Set;class X{#e=[];async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o,params:s}=(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 G(o,{params:{...s,v:"3"},reconnectAfterMs:e=>{const t=2**e*250;return Math.min(t,1e4)}}),this.socket.onError((e=>{K("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{K("[SOCKET]OPEN")})),this.socket.onClose((()=>{K("[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((()=>{K("[CHANNEL]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{K("[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",(()=>{K("[CHANNEL][JOIN] OK"),this.#t({connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{K("[CHANNEL][JOIN] ERROR",e),this.#t({connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{K("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){this.channel?.leave().receive("ok",(()=>{this.socket?.disconnect(),K("[CHANNEL][LEAVE] OK"),this.#e=[]}))}#n(...e){e.forEach((e=>{this.channel?.on(e,(t=>{K("[RECEIVE]",e,t)}))}))}onConnection(e){this.#e.push(e)}#t(e){this.#e=this.#e.filter((t=>!t(e))),J.forEach((e=>e()))}pushToChannel(e,t,n=1e4){this.channel?.push(e,t,n)}static subscribe(e){return J.add(e),()=>J.delete(e)}}const Y=()=>null,Z=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 s(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function Q(){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 ee{#r;#o;#s;#i="window";#a;conversation=new X;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.#o=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.#s=await this.#a.getConversationAuthToken());const e=await Z(`${this.#f("http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#s?void 0:this.#o,token:this.#s})}),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 Z(`${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 Z(`${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:o,activeServiceSettings:s,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:o,activeServiceSettings:s,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 s(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 o=new FormData;o.append("upload",e);const s=new XMLHttpRequest;return s.open("POST",`${this.#f("http")}${this.URLS.uploads}`),s.setRequestHeader("Authorization",`Bearer ${this.#c()}`),s.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},s.onloadend=()=>{if(0!==s.status)if(200!==s.status&&201!==s.status||!n){if(!r)throw new Error(s.response);try{r(JSON.parse(s.response))}catch(e){r(s.response)}}else try{n(JSON.parse(s.response))}catch(e){n(s.response)}},s.send(o),s}async getConversationIntitialState(){try{const n=await Z(`${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 Z(n,{method:"GET"});return(await r.json()).translations}catch(e){if(e.status>=500)throw new c(e);throw new s(e)}}send(e,t=void 0,n=!0){!this.connected||n&&!this.#r?this.conversation?.onConnection((({connected:r,ready:o})=>(this.connected=r,this.#r=o,!!(n?o:r)&&(this.send(e,t,n),!0)))):(Y("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:o}=t;return o||(o=m()),{type:n,body:r,transactionId:o}}(e,t),1e4))}sendContext(e){const{contentLocale:t,userLocale:n,variables:r,environment:o}=e,s={};if(o&&(s.environment=o),t){if("string"!=typeof t)throw new Error("Content locale must be a string");s.contentLocale=t}if(n){if("string"!=typeof n)throw new Error("User locale must be a string");s.userLocale=n}if(r){if("object"!=typeof r)throw new Error("Variables must be an object");s.variables=r}0===Object.keys(s).length&&s.constructor===Object||this.send("context",s,!1)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#i,clientVersion:"23.0.3",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:Q(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}var te=Symbol.for("immer-nothing"),ne=Symbol.for("immer-draftable"),re=Symbol.for("immer-state");function oe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var se=Object.getPrototypeOf;function ie(e){return!!e&&!!e[re]}function ae(e){return!!e&&(le(e)||Array.isArray(e)||!!e[ne]||!!e.constructor?.[ne]||fe(e)||me(e))}var ce=Object.prototype.constructor.toString();function le(e){if(!e||"object"!=typeof e)return!1;const t=se(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)===ce}function ue(e,t){0===de(e)?Object.entries(e).forEach((([n,r])=>{t(n,r,e)})):e.forEach(((n,r)=>t(r,n,e)))}function de(e){const t=e[re];return t?t.type_:Array.isArray(e)?1:fe(e)?2:me(e)?3:0}function pe(e,t){return 2===de(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function he(e,t,n){const r=de(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function fe(e){return e instanceof Map}function me(e){return e instanceof Set}function ye(e){return e.copy_||e.base_}function ve(e,t){if(fe(e))return new Map(e);if(me(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&le(e)){if(!se(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[re];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],s=n[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(se(e),n)}function ge(e,t=!1){return xe(e)||ie(e)||!ae(e)||(de(e)>1&&(e.set=e.add=e.clear=e.delete=be),Object.freeze(e),t&&ue(e,((e,t)=>ge(t,!0)))),e}function be(){oe(2)}function xe(e){return Object.isFrozen(e)}var we,_e={};function Ce(e){const t=_e[e];return t||oe(0),t}function Ee(){return we}function Se(e,t){t&&(Ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function je(e){Te(e),e.drafts_.forEach(Ne),e.drafts_=null}function Te(e){e===we&&(we=e.parent_)}function ke(e){return we={drafts_:[],parent_:we,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ne(e){const t=e[re];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ae(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[re].modified_&&(je(t),oe(4)),ae(e)&&(e=Re(t,e),t.parent_||Oe(t,e)),t.patches_&&Ce("Patches").generateReplacementPatches_(n[re].base_,e,t.patches_,t.inversePatches_)):e=Re(t,n,[]),je(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==te?e:void 0}function Re(e,t,n){if(xe(t))return t;const r=t[re];if(!r)return ue(t,((o,s)=>Ie(e,r,t,o,s,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Oe(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,s=!1;3===r.type_&&(o=new Set(t),t.clear(),s=!0),ue(o,((o,i)=>Ie(e,r,t,o,i,n,s))),Oe(e,t,!1),n&&e.patches_&&Ce("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ie(e,t,n,r,o,s,i){if(ie(o)){const i=Re(e,o,s&&t&&3!==t.type_&&!pe(t.assigned_,r)?s.concat(r):void 0);if(he(n,r,i),!ie(i))return;e.canAutoFreeze_=!1}else i&&n.add(o);if(ae(o)&&!xe(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Re(e,o),t&&t.scope_.parent_||Oe(e,o)}}function Oe(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ge(t,n)}var Le={get(e,t){if(t===re)return e;const n=ye(e);if(!pe(n,t))return function(e,t,n){const r=De(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_||!ae(r)?r:r===Pe(e.base_,t)?(Fe(e),e.copy_[t]=Be(r,e)):r},has:(e,t)=>t in ye(e),ownKeys:e=>Reflect.ownKeys(ye(e)),set(e,t,n){const r=De(ye(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Pe(ye(e),t),i=r?.[re];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)&&(void 0!==n||pe(e.base_,t)))return!0;Fe(e),Ue(e)}var o,s;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!==Pe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Fe(e),Ue(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ye(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){oe(11)},getPrototypeOf:e=>se(e.base_),setPrototypeOf(){oe(12)}},Me={};function Pe(e,t){const n=e[re];return(n?ye(n):e)[t]}function De(e,t){if(!(t in e))return;let n=se(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=se(n)}}function Ue(e){e.modified_||(e.modified_=!0,e.parent_&&Ue(e.parent_))}function Fe(e){e.copy_||(e.copy_=ve(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Be(e,t){const n=fe(e)?Ce("MapSet").proxyMap_(e,t):me(e)?Ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ee(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,s=Le;n&&(o=[r],s=Me);const{revoke:i,proxy:a}=Proxy.revocable(o,s);return r.draft_=a,r.revoke_=i,a}(e,t);return(t?t.scope_:Ee()).drafts_.push(n),n}function ze(e){return ie(e)||oe(10),$e(e)}function $e(e){if(!ae(e)||xe(e))return e;const t=e[re];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ve(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ve(e,!0);return ue(n,((e,t)=>{he(n,e,$e(t))})),t&&(t.finalized_=!1),n}ue(Le,((e,t)=>{Me[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Me.deleteProperty=function(e,t){return Me.set.call(this,e,t,void 0)},Me.set=function(e,t,n){return Le.set.call(this,e[0],t,n,e[0])};var He=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,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&oe(6),void 0!==n&&"function"!=typeof n&&oe(7),ae(e)){const o=ke(this),s=Be(e,void 0);let i=!0;try{r=t(s),i=!1}finally{i?je(o):Te(o)}return Se(o,n),Ae(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===te&&(r=void 0),this.autoFreeze_&&ge(r,!0),n){const t=[],o=[];Ce("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}oe(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){ae(e)||oe(8),ie(e)&&(e=ze(e));const t=ke(this),n=Be(e,void 0);return n[re].isManual_=!0,Te(t),n}finishDraft(e,t){const n=e&&e[re];n&&n.isManual_||oe(9);const{scope_:r}=n;return Se(r,t),Ae(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=Ce("Patches").applyPatches_;return ie(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Ve=He.produce;He.produceWithPatches.bind(He),He.setAutoFreeze.bind(He),He.setUseStrictShallowCopy.bind(He),He.applyPatches.bind(He),He.createDraft.bind(He),He.finishDraft.bind(He);var We=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var qe="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},Ge=0,Ke=1;function Je(){return{s:Ge,v:void 0,o:null,p:null}}function Xe(e,t={}){let n=Je();const{resultEqualityCheck:r}=t;let o,s=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=Je(),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=Je(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===Ke?c=t.v:(c=e.apply(null,arguments),s++),a.s=Ke,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==s&&s--),o="object"==typeof c&&null!==c||"function"==typeof c?new qe(c):c}return a.v=c,c}return i.clearCache=()=>{n=Je(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Ye(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,s={},i=e.pop();"object"==typeof i&&(s=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,...s},{memoize:c,memoizeOptions:l=[],argsMemoize:u=Xe,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,h=We(l),f=We(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(){o++;const e=function(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].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:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var Ze=Ye(Xe),Qe=Object.assign(((e,t=Ze)=>{!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:()=>Qe});function et(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 tt=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),nt=()=>Math.random().toString(36).substring(7).split("").join("."),rt={INIT:`@@redux/INIT${nt()}`,REPLACE:`@@redux/REPLACE${nt()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${nt()}`};function ot(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 st(e,t,n){if("function"!=typeof e)throw new Error(et(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(et(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(et(1));return n(st)(e,t)}let r=e,o=t,s=new Map,i=s,a=0,c=!1;function l(){i===s&&(i=new Map,s.forEach(((e,t)=>{i.set(t,e)})))}function u(){if(c)throw new Error(et(3));return o}function d(e){if("function"!=typeof e)throw new Error(et(4));if(c)throw new Error(et(5));let t=!0;l();const n=a++;return i.set(n,e),function(){if(t){if(c)throw new Error(et(6));t=!1,l(),i.delete(n),s=null}}}function p(e){if(!ot(e))throw new Error(et(7));if(void 0===e.type)throw new Error(et(8));if("string"!=typeof e.type)throw new Error(et(17));if(c)throw new Error(et(9));try{c=!0,o=r(o,e)}finally{c=!1}return(s=i).forEach((e=>{e()})),e}return p({type:rt.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(et(10));r=e,p({type:rt.REPLACE})},[tt]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(et(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[tt](){return this}}}}}function it(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:rt.INIT}))throw new Error(et(12));if(void 0===n(void 0,{type:rt.PROBE_UNKNOWN_ACTION()}))throw new Error(et(13))}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;let s=!1;const i={};for(let o=0;o<r.length;o++){const a=r[o],c=n[a],l=e[a],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(et(14));i[a]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?i:e}}function at(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function ct(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var lt=ct(),ut=ct,dt=(((...e)=>{const t=Ye(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(ie(e)?ze(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(Xe),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?at:at.apply(null,arguments)}),pt=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function ht(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(Ht(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 ot(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var ft=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 mt(e){return ae(e)?Ve(e,(()=>{})):e}function yt(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(Ht(10));const r=n.insert(t,e);return e.set(t,r),r}var vt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let s=new ft;return t&&("boolean"==typeof t?s.push(lt):s.push(ut(t.extraArgument))),s},gt=e=>t=>{setTimeout(t,e)},bt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:gt(10),xt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new ft(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,s=!1,i=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?bt:"callback"===e.type?e.queueNotification:gt(e.timeout),l=()=>{i=!1,s&&(s=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>o&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,s=!o,s&&(i||(i=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r},wt=!0;function _t(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(Ht(28));if(r in t)throw new Error(Ht(29));return t[r]=n,o},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),o),addDefaultCase:e=>(r=e,o)};return e(o),[t,n,r]}var Ct=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Et(...e){return t=>e.some((e=>((e,t)=>pt(e)?e.match(t):e(t))(e,t)))}var St=["name","message","stack","code"],jt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Tt=class{constructor(e,t){this.payload=e,this.meta=t}_type},kt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of St)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Nt=(()=>{function e(e,t,n){const r=ht(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=ht(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),s=ht(e+"/rejected",((e,t,r,o,s)=>({payload:o,error:(n&&n.serializeError||kt)(e||"Rejected"),meta:{...s||{},arg:r,requestId:t,rejectedWithValue:!!o,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):Ct(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let s=n?.condition?.(e,{getState:a,extra:c});if(null!==(m=s)&&"object"==typeof m&&"function"==typeof m.then&&(s=await s),!1===s||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(o(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 jt(e,t),fulfillWithValue:(e,t)=>new Tt(e,t)})).then((t=>{if(t instanceof jt)throw t;return t instanceof Tt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof jt?s(null,l,e,t.payload,t.meta):s(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&s.match(f)&&f.meta.condition||i(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(At)})}}),{pending:o,rejected:s,fulfilled:r,settled:Et(s,r),typePrefix:e})}return e.withTypes=()=>e,e})();function At(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Rt=Symbol.for("rtk-slice-createasyncthunk");function It(e,t){return`${e}/${t}`}function Ot({creators:e}={}){const t=e?.asyncThunk?.[Rt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(Ht(11));const o=("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)||{},s=Object.keys(o),i={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(Ht(12));if(n in i.sliceCaseReducersByType)throw new Error(Ht(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?_t(e.extraReducers):[e.extraReducers],o={...t,...i.sliceCaseReducersByType};return function(e,t){let s,[a,c,l]=_t((e=>{for(let t in o)e.addCase(t,o[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)s=()=>mt(e());else{const t=mt(e);s=()=>t}function u(e=s(),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(ie(e)){const r=n(e,t);return void 0===r?e:r}if(ae(e))return Ve(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(Ht(9))}return r}}return e}),e)}return u.getInitialState=s,u}(e.initialState)}s.forEach((r=>{const s=o[r],i={reducerName:r,type:It(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(s)?function({type:e,reducerName:t,createNotation:n},r,o){let s,i;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(Ht(17));s=r.reducer,i=r.prepare}else s=r;o.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,i?ht(e,i):ht(e))}(i,s,a):function({type:e,reducerName:t},n,r,o){if(!o)throw new Error(Ht(18));const{payloadCreator:s,fulfilled:i,pending:a,rejected:c,settled:l,options:u}=n,d=o(e,s,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||Pt,pending:a||Pt,rejected:c||Pt,settled:l||Pt})}(i,s,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 o(t=l){const r=yt(u,n,{insert:()=>new WeakMap});return yt(r,t,{insert:()=>{const r={};for(const[o,s]of Object.entries(e.selectors??{}))r[o]=Lt(s,t,h,n);return r}})}return{reducerPath:t,getSelectors:o,get selectors(){return o(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 o=t??r;return e.inject({reducerPath:o,reducer:p},n),{...m,...f(o,!0)}}};return m}}function Lt(e,t,n,r){function o(o,...s){let i=t(o);return void 0===i&&r&&(i=n()),e(i,...s)}return o.unwrapped=e,o}var Mt=Ot();function Pt(){}var{assign:Dt}=Object,Ut="listenerMiddleware",Ft=e=>{let{type:t,actionCreator:n,matcher:r,predicate:o,effect:s}=e;if(t)o=ht(t).match;else if(n)t=n.type,o=n.match;else if(r)o=r;else if(!o)throw new Error(Ht(21));return((e,t)=>{if("function"!=typeof e)throw new Error(Ht(32))})(s),{predicate:o,type:t,effect:s}},Bt=Object.assign((e=>{const{type:t,predicate:n,effect:r}=Ft(e);return{id:Ct(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Ht(22))}}}),{withTypes:()=>Bt}),zt=Object.assign(ht(`${Ut}/add`),{withTypes:()=>zt}),$t=(ht(`${Ut}/removeAll`),Object.assign(ht(`${Ut}/remove`),{withTypes:()=>$t}));function Ht(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 Vt extends i{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const Wt=Nt("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,defaultLocale:r,preChat:o,agentParticipant:s,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:o,agentParticipant:s,userParticipant:i,startChatIcon:a,defaultUserLocale:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})),qt=Nt("resetConfig",(async(e,{extra:{config:t}})=>t)),Gt=Ze((({app:e})=>e),(({userHasResponded:e})=>e)),Kt="visibility",Jt={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},Xt=Ze((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?Jt.open:Jt.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),Yt=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:s,hideOnNoUserResponse:i}=r,{visible:a}=o||{};if("app"===s&&!t)return Jt.open;if("window"===s&&i&&n!==Jt.open)return e?n||t||Jt.open:Jt.hidden;if("inline"===s&&e&&!n)return t||Jt.open;const c=Jt.minimized;return n||t||a||c};var Zt=n(7402),Qt=n(8418),en=Zt.default,tn=Symbol.for("react-redux-context"),nn="undefined"!=typeof globalThis?globalThis:{};function rn(){if(!en.createContext)return{};const e=nn[tn]??(nn[tn]=new Map);let t=e.get(en.createContext);return t||(t=en.createContext(null),e.set(en.createContext,t)),t}var on=rn();function sn(e=on){return function(){return en.useContext(e)}}var an=sn(),cn=()=>{throw new Error("uSES not initialized!")},ln=(e,t)=>e===t;function un(e=on){const t=e===on?an:sn(e),n=(e,n={})=>{const{equalityFn:r=ln,devModeChecks:o={}}="function"==typeof n?{equalityFn:n}:n,{store:s,subscription:i,getServerState:a,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(en.useRef(!0),en.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,o.stabilityCheck])),d=cn(i.addNestedSub,s.getState,a||s.getState,u,r);return en.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var dn=un();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 pn={notify(){},get:()=>[]};var hn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?en.useLayoutEffect:en.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var fn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:o="once",identityFunctionCheck:s="once"}){const i=en.useMemo((()=>{const t=function(e,t){let n,r=pn,o=0,s=!1;function i(){l.onStateChange&&l.onStateChange()}function a(){o++,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 o=t={callback:n,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){r&&null!==e&&(r=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}())}function c(){o--,n&&0===o&&(n(),n=void 0,r.clear(),r=pn)}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 s},trySubscribe:function(){s||(s=!0,a())},tryUnsubscribe:function(){s&&(s=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:o,identityFunctionCheck:s}}),[e,r,o,s]),a=en.useMemo((()=>e.getState()),[e]);hn((()=>{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||on;return en.createElement(c.Provider,{value:i},n)};function mn(e=on){const t=e===on?an:sn(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var yn=mn();function vn(e=on){const t=e===on?yn:mn(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var gn,bn=vn();gn=Qt.useSyncExternalStoreWithSelector,cn=gn,Zt.useSyncExternalStore;const xn=()=>dn(Xt);function wn(){const{startChatIcon:e}=xn();return e}const _n=({state:e})=>e,Cn=()=>dn(_n),En=Ze(_n,Xt,Gt,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const o={type:"service_data",payload:t.suggestion};return[...e,o]})),Sn=Ze(En,Xt,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,o)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const s=o[n-1];if(!t?.occurredAt||!s.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const i=g(t.occurredAt-s.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:i}}})):e})),jn=()=>dn(Sn),Tn=(Ze(Sn,(e=>e.map((e=>e.payload.id)))),()=>Cn().isLoading),kn=()=>Cn().unreadEvents,Nn=()=>Cn().skiplinkTargetId,An=()=>Cn().serviceInfo,Rn=Ze(Sn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),In=()=>{const{participants:e,currentAgent:t}=Cn().participantInfo;return t?e[t]:null},On=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=Cn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},Ln=()=>{const{layoutMode:e}=xn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},Mn=Ze((({visibility:e})=>e),(e=>e.visibility)),Pn=Ze((({visibility:e})=>e),(e=>e.showInlineView)),Dn=[Jt.open,Jt.minimized,Jt.hidden],Un=Nt("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),s=Mn(o),i=Gt(o),a=n.hasConversation(),c=Xt(o),{visibilityCallback:l=Yt,layoutMode:u}=c,{unreadEvents:d}=_n(o),p=l({hasResponded:i,previousVisibility:s,requestedVisibility:e,config:c});if(p&&!Dn.includes(p))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),null;if(s===p)return null;const h=n.store.get(Kt);return n.store.set(Kt,{...h||{},[u]:e}),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:i,unreadMessageCount:d}),p})),Fn=Nt("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:o}=Xt(n()),s=r.store.get(Kt)?.[o]||Jt.initialize;return t(Un(s)),s})),Bn={info:"info",message:"message",participant:"participant",system:"system"},zn="text",$n="text",Hn="upload",Vn="received",Wn="read",qn="custom",Gn="typing",Kn="read",Jn="detach_service",Xn="dismiss",Yn="set_topic",Zn="click_cta",Qn="assertive",er="polite",tr={new_topic:"newTopic",new_translation:"newTranslation"},nr="uploads",rr="navigate",or=Nt("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{let o=n?.context?.contentLocale,s=n?.context?.userLocale;const i=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=await t.getConversationIntitialState();return o=e.context?.contentLocale||o,s=e.context?.userLocale||s,t.sendContext({...e.context,environment:i}),{initialState:e,contentLocale:o,userLocale:s,config:n}}return n?.context?.topic&&t.send("action",{type:Yn,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext({...n.context,environment:i}),{initialState:void 0,contentLocale:o,userLocale:s,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 Vt;return r({name:t.name,message:t.message,langKey:t.langKey})}})),sr=((e,t,n)=>{const{wait:r=300,maxWait:o=0,leading:s=!1}=n??{};let i,a=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,i&&(i(!0),i=void 0)};return Nt(e,t,{condition:()=>{const e=s&&!a;return a&&clearTimeout(a),a=setTimeout((()=>{l(),a=null}),r),!!e||(i&&(i(!1),i=void 0),o&&!c&&(c=setTimeout(l,o)),new Promise((e=>{i=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(qt()),await t(Wt()),await t(or()),t(Fn())}),{wait:2e3,leading:!0}),ir=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],ar=(e,t)=>{const{messages:n,...r}=(o=t,ir.reduce(((e,t)=>(t in o&&(e[t]=o[t]),e)),{}));var o;let s=e;return Object.keys(r).length>0&&(s={...s,...r}),n&&(s={...s,messages:{...s.messages,...n}}),s},cr=Mt({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})=>ar(e,t),updateConfig:(e,{payload:t})=>ar(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(qt.fulfilled,(e=>e)).addCase(Wt.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o,defaultUserLocale:s,defaultContentLocale:i}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.userLocale=s,e.context.contentLocale=i,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o}))}}),{setConfig:lr,updateConfig:ur,setPreChatEvents:dr}=cr.actions,pr=cr.reducer,hr={userHasResponded:!1},fr=Mt({name:"app",initialState:hr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(sr.pending,(()=>hr)).addCase(or.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:mr}=fr.actions,yr=fr.reducer;class vr extends i{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const gr={SeamlyGeneralError:c,SeamlyConfigurationError:a,SeamlySessionExpiredError:l,SeamlyOfflineError:vr,SeamlyUnauthorizedError:u,SeamlyUnavailableError:Vt},br=ht("catch-error",(e=>({payload:e}))),xr={controls:{}},wr={touched:!1},_r={controls:wr},Cr=Mt({name:"forms",initialState:_r,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...xr,persistData:t}:{...xr,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]:wr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o={...r.controls};return delete o[t],{...e,[n]:{...r,controls:o}}},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(sr.pending,(()=>_r))}}),{registerForm:Er,deregisterForm:Sr,registerControl:jr,deregisterControl:Tr,updateControlValue:kr,updateControlTouched:Nr}=Cr.actions,Ar=Cr.reducer,Rr=Nt("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}}),Ir={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},Or=Mt({name:"app",initialState:Ir,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(sr.pending,(()=>Ir)).addCase(Wt.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(Rr.pending,(e=>{e.isLoading=!0})).addCase(Rr.rejected,(e=>{e.isLoading=!1})).addCase(Rr.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:Lr,setTranslations:Mr}=Or.actions,Pr=Or.reducer,Dr=Nt("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],o=e?.lastEvent?.id;return r&&o!==r.payload.id}}),Ur={error:void 0},Fr=Mt({name:"interrupt",initialState:Ur,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>Ur},extraReducers:e=>{e.addCase(Wt.pending,(()=>Ur)).addMatcher(Et(or.rejected,Wt.rejected,Rr.rejected,Un.rejected,Fn.rejected,Dr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Br,clearInterrupt:zr}=Fr.actions,$r=Fr.reducer,Hr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],Vr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===Bn.message&&!t.fromClient||e===Bn.info&&t.type===zn,Wr=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),qr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:s,introduction:i}=t.participant,a=n[r],c={...n,[r]:a?{...a,...o?{avatar:o}:{},...s?{name:s}:{},...i?{introduction:i}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Gr=(e,t)=>{const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{},{blockAutoEntrySwitch:r}=e,o=t?.payload?.actions||{},s=t?.payload?.translatedActions||{};if(!n)return{...e,optionsOverride:{},actions:o,translatedActions:s};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:o,translatedActions:s}},Kr={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},Jr=Mt({name:"store",initialState:Kr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,o=e.options.features.hasOwnProperty(nr);let s={...e.options};if(o&&(n===Bn.message||n===Bn.participant)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;s={...s,features:{...s.features,uploads:{enabled:s.features.uploads?.enabled||!1,...s.features?.uploads||{},enabledFromEntry:e===Hn}}}}const i=Vr(t.payload);if(e.events.find((e=>e.payload.id===r.id)))return;const a=Gr(e.entryMeta,t.payload);e.entryMeta=o||a.active!==Hn?a:{...e.entryMeta},e.options=s,i&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?Wn:Vn)),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:o}=t;n&&(n.payload.id=r,n.payload.occurredAt=o,e.events=Wr(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===Vn&&{messageStatus:Wn}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:o,serviceData:s,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 Wr([...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}=o,p=d?.options?.upload,h=Gr({...e.entryMeta,...d,active:d?.default||zn,options:{...d?.options?d.options:{}}},a[a.length-1]);let f={...e.options.features};const m=f.hasOwnProperty(nr);if(m&&"message"===l?.type){const{payload:e}=l,t=e?.entry?.type||{};f={...f,uploads:{enabled:!(!p||!p?.enabled),enabledFromEntry:t===Hn}}}e.unreadEvents=a.filter((e=>"message"===e.type&&e.payload.messageStatus===Vn)).length,e.events=a.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...u?qr(e.participantInfo,{participant:c[u]}):{},participants:c},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,activeServiceSessionId:r,proactiveMessages:o?.proactiveMessages?.enabled||!1},e.serviceData={...e.serviceData,...s},e.options={...e.options,features:f},e.entryMeta=m||h.active!==Hn?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=qr(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=Kr.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(sr.pending,(()=>Kr)).addCase(or.pending,(e=>{e.isLoading=!0})).addCase(Wt.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name,t.features&&(e.options.features=t.features)})).addCase(or.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Et(so,io),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:Xr,addEvent:Yr,clearAllUploads:Zr,clearEvents:Qr,clearFeatures:eo,clearIdleDetachCountdown:to,clearResumeConversationPrompt:no,decrementIdleDetachCountdownCounter:ro,hideOption:oo,initIdleDetachCountdown:so,initResumeConversationPrompt:io,registerUpload:ao,resetHistoryLoadedFlag:co,setActiveEntryType:lo,setActiveService:uo,setBlockAutoEntrySwitch:po,setEventsRead:ho,setFeatureEnabledState:fo,setFeatures:mo,setHeaderSubTitle:yo,setHeaderTitle:vo,setHistory:go,setInitialState:bo,setIsLoading:xo,setLoadedImageEventIds:wo,setParticipant:_o,setSeamlyContainerElement:Co,setServiceDataItem:Eo,setServiceEntryMetadata:So,clearAbortTransaction:jo,setUploadComplete:To,setUploadError:ko,setUploadProgress:No,startProcessingImage:Ao,doneProcessingImage:Ro,setUserEntryType:Io,setUserSelectedOption:Oo,setUserSelectedOptions:Lo,showOption:Mo,stopIdleDetachCountdownCounter:Po,setProactiveMessages:Do}=Jr.actions,Uo=Jr.reducer,Fo={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Ct(),translatedEventGroups:{},translationProposal:null},Bo=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},o,s)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return s.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,o]]=Object.entries(n);return{lastGroupId:e.filter((e=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},zo=Mt({name:"translation",initialState:Fo,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}=Bo(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:s}=Bo(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=s},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(sr.pending,(()=>Fo)).addCase(Wt.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(go,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(Rr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(Yr,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:$o,disableTranslation:Ho,enableEventsTranslation:Vo,disableEventsTranslation:Wo,setTranslationProposalPrompt:qo,disableTranslationProposalPrompt:Go}=zo.actions,Ko=zo.reducer,Jo=({dispatch:e})=>t=>n=>{const r=t(n);if(go.match(n)&&n.payload?.translation?.enabled)return e($o(n.payload.translation.locale)),e(Rr(n.payload.translation.locale)),r;if(Wt.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(Rr(n.payload.defaultUserLocale)),r;if(or.fulfilled.match(n))return n.payload.userLocale&&e(Rr(n.payload.userLocale)),r;if(Yr.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(Rr(t.translationLocale)),r}return r},Xo=Mt({name:"visibility",initialState:{visibility:Jt.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(Un.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(Wt.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:Yo}=Xo.actions,Zo=it({state:Uo,app:yr,config:pr,i18n:Pr,translations:Ko,visibility:Xo.reducer,forms:Ar,interrupt:$r});function Qo({initialState:e,api:t,eventBus:n,config:r}){const o=function(e){const t=vt(),{reducer:n,middleware:r,devTools:o=!0,preloadedState:s,enhancers:i}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!ot(n))throw new Error(Ht(1));a=it(n)}if(!wt&&r&&"function"!=typeof r)throw new Error(Ht(2));if("function"==typeof r){if(c=r(t),!wt&&!Array.isArray(c))throw new Error(Ht(3))}else c=t();if(!wt&&c.some((e=>"function"!=typeof e)))throw new Error(Ht(4));let l=at;o&&(l=dt({trace:!wt,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let s=()=>{throw new Error(et(15))};const i={getState:o.getState,dispatch:(e,...t)=>s(e,...t)},a=e.map((e=>e(i)));return s=at(...a)(o.dispatch),{...o,dispatch:s}}}(...c),d=xt(u);if(!wt&&i&&"function"!=typeof i)throw new Error(Ht(5));let p="function"==typeof i?i(d):d();if(!wt&&!Array.isArray(p))throw new Error(Ht(6));if(!wt&&p.some((e=>"function"!=typeof e)))throw new Error(Ht(7));return wt||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),st(a,s,l(...p))}({reducer:Zo,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:o,api:s,layoutMode:a}=Xt(t()),{error:c,type:l}=n,u=gr[c?.name]?new gr[c.name](c):new i(c);r?.(u,{namespace:o,api:s,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:o}=n;if(o===Br.type){if(!Hr.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 Lo.toString():e.store.set("options",n.payload);break;case Oo.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Jo)});return o}const es=bn;var ts=n(1162);function ns(e=""){const t=e=>/\s/.test(e),n=[],r={};let o=0,s=null,i=!1,a=0;for(;a<e.length;){if(i&&(t(e[a])||"{"===e[a]))i=!1,s=e.slice(o,a),"{"===e[a]&&a--;else if(!i&&!t(e[a])){const t="{"===e[a];if(s&&t){const t=rs(e,a);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[s]=e.slice(a+1,t),a=t,s=null}else s&&(n.push(s),s=null),i=!0,o=a}a++}return i&&(s=e.slice(o)),s&&n.push(s),{args:n,cases:r}}function rs(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 os(e){return ss(e.slice(1,-1),",",3)}function ss(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let o=e.indexOf(t);if(-1===o)return r.push(e),r;let s=e.substring(0,o).trim(),i=e.substring(o+t.length+1).trim();return r.push(s),ss(i,t,n-1,r)}let is,as=0;const cs="other";function ls(e,t){let n=0,r="",o=0;const s={};for(;n<e.length;){if("#"!==e[n]||o)r+=e[n];else{let e="__hashToken"+as++;r+=`{${e}, number}`,s[e]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:s}}const us="other",ds=Ze((({i18n:e})=>e),(({translations:e})=>e)),ps=Ze((({i18n:e})=>e),(({initialLocale:e})=>e)),hs=Ze((({i18n:e})=>e),(({userLocale:e})=>e)),fs=Ze((({i18n:e})=>e),(({isLoading:e})=>e)),ms=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 o=e(...n);return t[r]=o,o}}(((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=rs(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let o=e.substring(n,r+1);if(o){let s=[],i=e.substring(0,n);i&&s.push(i);let[a,c,l]=os(o),u=t[a];null==u&&(u="");let d=c&&this.typeHandlers[c];s.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&s.push(this.process(p,t)),s}}}return[e]}}("en-GB",{plural:function(e,t,n,r,o){const{args:s,cases:i}=ns(t);let a=parseInt(e);s.forEach((e=>{e.startsWith("offset:")&&(a-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==is&&is.resolvedOptions().locale===n||(is=new Intl.PluralRules(n));const e=is.select(a);e!==cs&&c.push(e)}1===a&&c.push("one"),c.push(`=${a}`,cs);for(let e=0;e<c.length;e++){const t=c[e];if(t in i){const{caseBody:e,numberValues:n}=ls(i[t],a);return o(e,{...r,...n})}}return e},select:function(e,t,n,r,o){const{cases:s}=ns(t);return e in s?o(s[e],r):us in s?o(s[us],r):e}});function ys(){const e=dn(ds),t=dn(hs),n=dn(ps),r=dn(fs);return{t:(0,ts.useCallback)(((n,o={})=>{if(!e)return"";const s=e[n];return s?ms.format(s,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const vs=()=>{const e=es(),t=dn(Mn),n=!!t&&t!==Jt.hidden,r=t===Jt.open,o=t===Jt.minimized,s=(0,ts.useCallback)((t=>e(Un(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:o,visible:t,setVisibility:s,openChat:()=>{s(Jt.open)},closeChat:()=>{s(Jt.minimized)}}},gs=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,o.createRef)()})=>{const[r,s]=(0,ts.useState)(null),i=!!r?.isIntersecting||!t,a=i&&e,c=([e])=>s(e);return(0,ts.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}},bs=()=>dn(Gt),xs=(0,o.createContext)(null),ws=(0,o.createContext)(null),_s=(0,o.createContext)(null),Cs=()=>{const e=(0,ts.useContext)(ws);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},Es=()=>{const e=(0,ts.useContext)(xs);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},Ss=()=>Es().store,js=()=>{const e=Es();return(0,ts.useCallback)((()=>e.hasConversation()),[e])},Ts=()=>{const e=Es(),t=es(),n=Cs(),r=bs(),o=js(),{visible:s,setVisibility:i}=vs(),a=kn(),c=(0,ts.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,ts.useCallback)((()=>{c("ui.beforeStart",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:a}),e.send("start"),c("ui.start",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:a})}),[e,c,o,r,a,s]),u=(0,ts.useCallback)((async()=>{await t(sr())}),[t]),d=(0,ts.useCallback)((e=>({type:e,id:m(),transactionId:m(),participant:p,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,ts.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,ts.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const o={...h(n),...r};e.send("message",o),c("message",o),t(Yr({type:"message",payload:{...o,optimisticallyInjected:!0}}))}),[e,t,c,h]),y=(0,ts.useCallback)(((e,n=m())=>{t(Yr({type:"message",payload:{...h(e),transactionId:n}}))}),[t,h]),v=(0,ts.useCallback)(((e,n,r,o,s,i,a)=>{t(Yr({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:p,fromClient:!0,occurredAt:r,body:{contentType:o,filename:s,filesize:i,url:a}}}))}),[t]),g=(0,ts.useCallback)(((e,n=m())=>{t(Yr({type:"info",payload:{body:{subtype:e},fromClient:!1,fromHistory:!0,id:m(),transactionId:n,type:"divider"}}))}),[t]),b=(0,ts.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==Gn&&n!==Kn&&c(`action.${n}`,t)}),[e,c]),x=(0,ts.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,ts.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(bo(e)),e.userResponded&&(t(mr(e.userResponded)),i(Jt.open)))})).catch((e=>{t(Br({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}},ks=()=>{const e=(()=>{const e=(0,ts.useContext)(_s);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,ts.useCallback)((t=>{t&&e({ariaLive:er,messageText:t})}),[e]),sendAssertive:(0,ts.useCallback)((t=>{t&&e({ariaLive:Qn,messageText:t})}),[e])}},Ns=Ze((({interrupt:e})=>e),(({error:e})=>e)),As=Ze(Ns,(e=>Boolean(e)));function Rs(){const{t:e}=ys(),t=dn(Ns);return{hasError:dn(As),meta:(0,ts.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,o=e(`${n}.title`),s=e(`${n}.message`),i=e(`${n}.srText`),a=r?e(`${n}.buttonText`):null;return{...n?{title:o,message:s,srText:i}:{},...r?{action:r}:{},...r&&n?{buttonText:a}:{},originalError:t}}),[t,e]),error:t}}const Is=()=>{const{t:e}=ys(),{isInline:t,isWindow:n,isApp:r}=Ln(),{isOpen:o,isVisible:s}=vs(),i=dn(Pn),{start:a,connect:l,apiConfigReady:u,apiConnected:d}=Ts(),p=(0,ts.useRef)(!1),{sendAssertive:h}=ks();!function(){const{meta:{originalError:e,action:t}}=Rs(),n=es(),{reset:r}=Ts(),o="SeamlySessionExpiredError"===e?.name,s=(0,ts.useRef)(0),i=(0,ts.useRef)(null);(0,ts.useEffect)((()=>{if(o&&"reset"===t){if(s.current>=10){i.current=setTimeout((()=>{s.current=0}),1e4);const e=new c;return n(Br({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}s.current+=1,r()}return()=>{i.current&&clearTimeout(i.current)}}),[t,r,o,n])}(),(0,ts.useEffect)((()=>{s&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[s,h,e]),(0,ts.useEffect)((()=>{s&&h(e(o?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[o,s,h,e]),(0,ts.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,ts.useCallback)((async()=>{d||(p.current=!0,await l()),(r||o||s&&t)&&a()}),[d,l,r,t,o,s,a]);(0,ts.useEffect)((()=>{!u||p.current||n&&!o||!(!t||s&&i)||f()}),[u,f,t,o,s,n,i])},Os=require("preact/compat"),Ls=require("preact/jsx-runtime"),Ms=({children:e})=>(Is(),(0,Ls.jsx)(Ls.Fragment,{children:e})),Ps=(0,o.createContext)(null),Ds=(e=0)=>new Promise((t=>{setTimeout(t,e)})),Us=()=>{const{seamlyContainerElement:e}=Cn(),t=es();return[e,(0,ts.useCallback)((e=>{t(Co(e))}),[t])]},Fs=e=>(0,ts.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await Ds(180);const e="string"==typeof t?document.getElementById(t):t;E(e)}))}),[e]),Bs=()=>{const e=Nn();return Fs(e)},zs=e=>Ze((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function $s(){const{sendContext:e}=Ts(),t=es(),n=xn(),r=(0,ts.useCallback)((t=>{e({userLocale:t})}),[e]),o=(0,ts.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(Ho())}),[n.context?.contentLocale,t,e]),{languages:s,isActive:i,isAvailable:a,currentLocale:c}=dn((({translations:e})=>e));return{languages:s,isActive:i,isAvailable:a,currentLocale:c,enableTranslations:r,disableTranslations:o}}const Hs=e=>{const t=dn(zs(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:o}={body:e.payload?.body,translation:e.payload?.translation},s=!!n;return{body:t&&s?n:o,hasTranslation:s,isTranslated:t&&s,locale:r?.locale}};function Vs(){const e=dn((({translations:e})=>e.containerId));return{id:e,focusContainer:Fs(e)}}function Ws(e){const{languages:t}=$s();return(0,ts.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const qs=()=>{const{isActive:e,languages:t}=$s(),n=es(),{sendAction:r}=Ts(),{translationProposal:o}=dn((e=>e.translations)),{enableTranslations:s}=$s(),{isOpen:i}=vs(),{userLocale:a}=ys(),c=o?.proposedLocale,l=Ws(c),u=(0,ts.useMemo)((()=>null!==o&&!e&&i&&a!==c&&t.some((e=>e.locale===c))),[o,e,i,a,c,t]);return{activateTranslationProposal:()=>{s(o?.proposedLocale)},dismissTranslationProposal:()=>{r({type:Xn,body:{type:"translation_proposal"}}),n(Go())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}},Gs=(...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(" "),Ks=()=>xn().appContainerClassNames,Js=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},Xs=()=>{const e=Es();return(0,Os.useSyncExternalStore)(X.subscribe,(()=>e.conversation))},Ys=(0,o.createContext)(null),Zs=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=Cn(),{allowedMimeTypes:o,maxSize:s}=n.upload||{},{enabled:i,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...o?{allowedMimeTypes:o}:{},...s?{maxSize:s}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||i,allowedMimeTypes:c,maxSize:l}},Qs=()=>{const{currentUploads:e}=Cn(),t=es(),n=(()=>{const e=(0,ts.useContext)(Ys);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,ts.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,ts.useCallback)((()=>{t(Zr())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},ei=()=>{const{t:e}=ys(),{options:t}=Cn(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:s}=t,{extraMenuItem:i,sendTranscript:a}=s,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=es(),{get:h,set:f}=Ss();return{allowOptionSelection:d,userSelectedOptions:o,features:s,menuOptions:u,initUserSelectedOptions:(0,ts.useCallback)((()=>{const e=h("options")||{};p(Lo(e))}),[h,p]),setUserSelectedOptions:(0,ts.useCallback)((e=>{p(Lo(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,ts.useCallback)(((e,t)=>{const n=h("options")||{};"object"==typeof n&&f("options",{...n,[e]:t}),p(Oo({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(Mo(e))},hideOption:()=>{p(oo())},panelActive:n,optionActive:r}},ti=()=>{const{optionsButtonId:e}=Cn();return{id:e,focusButton:Fs(e)}},ni=(0,o.createContext)(null),ri=()=>{const e=(0,ts.useContext)(ni);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},oi=()=>{const e=es(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:i}}=Cn(),{isOpen:a}=vs(),{emitEvent:c,sendAction:l}=Ts(),{t:u}=ys(),{sendAssertive:d,sendPolite:p}=ks(),h=(0,ts.useCallback)((e=>{a&&d(e)}),[a,d]),f=(0,ts.useCallback)((e=>{a&&p(e)}),[a,p]),m=(0,ts.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=b(n);e(so({delaySeconds:n,delayTime:r})),c("idleTimer.start"),h(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,h,u]),y=(0,ts.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:Jn}),h(u("idleDetachWarning.notifyTransferText"))),i||c("idleTimer.stop"),e(to()))}),[e,c,t,l,h,u,i]),v=(0,ts.useCallback)((()=>{if(!o||o<=0)return;const t=o-1;t%10==0&&h(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",b(t))}`),e(ro())}),[e,o,h,u]),g=(0,ts.useCallback)((()=>{n&&(e(Po()),o&&(c("idleTimer.stop"),f(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,o,f,u]);return{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:i,initCountdown:m,endCountdown:y,decrementCountdown:v,stopCountdown:g}},si=()=>{const e=es(),t=Cn().resumeConversationPrompt,{sendAction:n}=Ts(),{t:r}=ys(),{sendAssertive:o}=ks();return{continueChat:()=>{n({type:Xn,body:{type:"resume_conversation_prompt"}}),e(no())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:Jn}),e(no())}}},ii=()=>{const[e]=(0,ts.useState)((()=>m()));return e},ai=(e,t)=>{const n=Xs();(0,ts.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])},ci=({eventPayload:e})=>{const{t}=ys(),{fromClient:n,participant:r}=e,o=(e=>Cn().participantInfo.participants[e])(r)||{},{messages:s}=xn(),i=n?t("participants.user.name"):o&&o.name,{showAvatar:a,showName:c}=s&&s[n?"user":"agent"]||{};if(!a&&!c)return null;const l=[];return a&&i&&o.avatar&&l.push((0,Ls.jsx)("span",{className:Gs("message__avatar"),children:(0,Ls.jsx)("img",{src:o.avatar,className:Gs("avatar"),alt:""})})),c&&i&&l.push((0,Ls.jsx)("span",{className:Gs("message__author-name"),children:i})),l.length>0?(0,Ls.jsx)("div",{className:Gs("message__author"),children:l}):null},li=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:o,bodyProps:s={},info:i,...a})=>{const c=Js(t),{hasTranslation:l,isTranslated:u,locale:d}=Hs(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&&(s={...s,lang:d}),(0,Ls.jsx)(Ls.Fragment,{children:(0,Ls.jsxs)("div",{className:Gs(c),...a,children:[e&&(0,Ls.jsx)(ci,{eventPayload:t.payload}),(0,Ls.jsx)("div",{className:Gs("message__body"),...s,children:o}),i&&(0,Ls.jsx)("div",{"aria-hidden":"true",className:Gs("message__info"),children:i})]})})},ui=({id:e,action:t,buttonText:n,description:r,hasFocus:o,image:s,title:i,isCarouselItem:a})=>{const c=(0,ts.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=Ts(),p=ii(),h=(0,ts.useRef)(!1),f=t?.type===rr?"a":"button",m=(0,ts.useCallback)((()=>d("action.click_card",{type:Zn,originMessage:e,action:t})),[d,e,t]),y=(0,ts.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:Yn,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),v=(0,ts.useMemo)((()=>t?.type===rr?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,ts.useEffect)((()=>{a&&(o&&h.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),h.current=!0}),[o,a]),(0,Ls.jsxs)("div",{className:Gs("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[s?(0,Ls.jsx)("img",{className:Gs("card__image"),src:s,alt:""}):null,(0,Ls.jsxs)("div",{className:Gs("card__content"),id:e,children:[i&&(0,Ls.jsx)("h2",{className:Gs("card__title"),children:i}),r&&(0,Ls.jsx)("div",{className:Gs("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,Ls.jsx)(f,{tabIndex:a&&!o?-1:void 0,className:Gs("button","button--primary"),"aria-describedby":p,...v,children:n})]})]})};function di({item:e,items:t,index:n,isActive:r}){const{t:o}=ys();return(0,Ls.jsx)("div",{className:Gs("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":o("carousel.slide.label",{index:n+1,total:t.length}),children:(0,Ls.jsx)(ui,{...e,isCarouselItem:!0,hasFocus:r})})}const pi={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'}},hi=({name:e,size:t="32",className:n,alt:r})=>(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("div",{"aria-hidden":"true",className:n||Gs("icon"),dangerouslySetInnerHTML:{__html:pi[e][t]}}),r&&(0,Ls.jsx)("span",{className:Gs("visually-hidden"),children:r})]});function fi({items:e,currentIndex:t,onChange:n,children:r}){const{t:o}=ys(),s=e.length;return(0,Ls.jsxs)("div",{className:Gs("carousel-controls"),children:[(0,Ls.jsx)("button",{className:Gs("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{n((t-1+s)%s)},children:(0,Ls.jsx)(hi,{name:"arrowLeft",size:"16",alt:""})}),r,(0,Ls.jsx)("button",{className:Gs("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{n((t+1)%s)},children:(0,Ls.jsx)(hi,{name:"arrowRight",size:"16",alt:""})})]})}function mi({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:o}){const s=e.length,i=(0,ts.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,r));o!==t&&n(o)}),[s,t,n]);return(0,Ls.jsx)("div",{className:Gs("carousel-pagination__wrapper"),role:"group",children:(0,Ls.jsx)("ul",{className:Gs("carousel-pagination"),children:e.map(((e,n)=>{const s=t===n;return(0,Ls.jsx)("li",{className:Gs("carousel-pagination__item",s?"is-active":void 0),children:(0,Ls.jsx)("button",{className:Gs("carousel-pagination__button"),type:"button",onClick:i,"data-item":n,"aria-disabled":s?"true":void 0,"aria-label":o(e,n)})},r(e,n,"pagination-item-"))}))})})}const yi=(e,t,n)=>`${n}${t}`,vi=e=>e.label,gi=({target:e})=>{e.scrollLeft=0};function bi({currentIndex:e=0,onChange:t=(()=>{}),getItemKey:n=yi,getItemLabel:r=vi,items:s}){const i=ii(),a=s.length,[c,l]=(0,ts.useState)(Number(e||0));(0,ts.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,ts.useRef)([]);u.current=(0,ts.useMemo)((()=>Array(a).fill(1).map((()=>(0,o.createRef)()))),[a]);const d=(0,ts.useRef)(!0),p=(0,ts.useRef)(null);return p.current=t,(0,ts.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,Ls.jsxs)("div",{className:Gs("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,Ls.jsx)("div",{className:Gs("carousel__slides-wrapper"),onScroll:gi,children:(0,Ls.jsx)("div",{id:i,className:Gs("carousel__slides"),style:{width:100*a+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((e,t)=>{const r=c===t;return(0,Ls.jsx)("div",{ref:u.current[t],className:Gs("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,Ls.jsx)(di,{item:e,items:s,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,Ls.jsx)("div",{className:Gs("carousel__controls"),children:(0,Ls.jsx)(fi,{currentIndex:c,items:s,onChange:l,children:(0,Ls.jsx)("div",{className:Gs("carousel__pagination"),children:(0,Ls.jsx)(mi,{currentIndex:c,items:s,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const xi=(e,t,n="")=>`${n}${e.title}:${t}`,wi=e=>e.title,_i=e=>{const{payload:t}=e,[n,r]=(0,ts.useState)(!1),{sendAction:o,addMessageBubble:s,addDivider:i}=Ts(),{activeServiceSessionId:a}=An(),c=dn(Rn),{body:l}=Hs(e),{service:u}=t,d=(0,ts.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,ts.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),s(e.text,n),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:p},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}},Ci=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Ei=({id:e,categories:t=[],question:n,onClick:r,hasIcon:o})=>{const s=(0,ts.useMemo)((()=>["suggestions__item",...t.map(Ci)]),[t]),i=(0,ts.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,Ls.jsx)("li",{className:Gs(s),children:(0,Ls.jsxs)("button",{type:"button",onClick:i,className:Gs("button","button--primary"),children:[o&&(0,Ls.jsx)(hi,{name:"chevronRight",size:"8",alt:""}),n]})})},Si=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,Ls.jsx)("ul",{className:Gs("suggestions__list",e||""),children:t.map((e=>(0,Ls.jsx)(Ei,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),ji=e=>{const{sendAction:t}=Ts();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}},Ti=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:o,iconSize:s,iconClassName:i,dividerType:a,title:c,description:l})=>{const u=Boolean(o||n);return(0,Ls.jsxs)("div",{className:Gs("divider",a&&`divider--type-${a}`,t),children:[u&&(0,Ls.jsx)("span",{className:Gs("divider__graphic"),children:o?(0,Ls.jsx)(hi,{name:o,size:s,className:i,alt:""}):(0,Ls.jsx)("img",{src:n,className:Gs({icon:"icon"===r,avatar:"avatar"===r},i)})}),(0,Ls.jsxs)("div",{className:Gs("divider__body"),children:[c?(0,Ls.jsx)("h2",{className:Gs("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,Ls.jsx)("p",{className:Gs("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},ki={[tr.new_topic]:"new-topic"},Ni={default:({event:e})=>{const{t}=ys(),{subtype:n}=e.payload.body,r=ki[tr[n]];return tr[n]?(0,Ls.jsx)(Ti,{dividerType:r,iconName:tr[n],title:t(`dividerKeys.${tr[n]}`)}):null},[tr.new_translation]:({event:e})=>{const{t}=ys(),n=jn(),{body:{translationEnabled:r,text:o,title:s},id:i}=e.payload,a=dn((e=>e.translations.translatedEventGroups)),c=es(),l=(0,ts.useCallback)((()=>{a[i]?c(Vo({events:n,id:i})):c(Wo({events:n,id:i}))}),[c,n,i,a]);return(0,Ls.jsx)(Ti,{iconName:"newTranslation",dividerType:"new-translation",title:s,description:o,children:r?(0,Ls.jsx)(Ls.Fragment,{children:(0,Ls.jsx)("button",{className:Gs("button","button--secondary"),onClick:l,children:t(a[i]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},Ai={month:"long",day:"numeric",year:"numeric"},Ri={hour:"numeric",minute:"numeric"},Ii=({event:e})=>{const t=(()=>{const[e,t]=(0,ts.useReducer)((e=>e+1),0);return(0,ts.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:o,srText:s}=(e=>{const{t}=ys(),n=xn(),r=n?.context?.userLocale??[],o=new Date(e),s=new Date,i=new Date(s);i.setHours(24,0,0,0);const a=i.valueOf()-s.valueOf(),c=o.toString(),l=new Intl.DateTimeFormat(r,Ri).format(o);let u=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),o=864e5;return r>=n+o?e:r>n?"today":r>n-o?"yesterday":e})(o,s);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,Ai).format(o)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:a}})(g(e.payload.timeIndicator));return(0,ts.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,Ls.jsxs)(Ti,{dividerType:"time-indicator",children:[(0,Ls.jsxs)("h2",{className:Gs("divider__time"),"aria-hidden":"true",children:[(0,Ls.jsx)("span",{className:Gs("divider__time--date"),children:n}),(0,Ls.jsx)("span",{className:Gs("divider__time--time"),children:r})]}),(0,Ls.jsx)("p",{className:Gs("visually-hidden"),children:s})]})};var Oi=["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])"],Li=Oi.join(","),Mi="undefined"==typeof Element,Pi=Mi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Di=!Mi&&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},Ui=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},Fi=function(e,t,n){if(Ui(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Li));return t&&Pi.call(e,Li)&&r.unshift(e),r.filter(n)},Bi=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Ui(i,!1))if("SLOT"===i.tagName){var a=i.assignedElements(),c=e(a.length?a:i.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{Pi.call(i,Li)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var l=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),u=!Ui(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(l&&u){var d=e(!0===l?i.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},zi=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},$i=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))&&!zi(e)?0:e.tabIndex},Hi=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Vi=function(e){return"INPUT"===e.tagName},Wi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},qi=function(e,t){return!(t.disabled||Ui(t)||function(e){return Vi(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Pi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Pi.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Wi(e)}else{if("function"==typeof r){for(var s=e;e;){var i=e.parentElement,a=Di(e);if(i&&!i.shadowRoot&&!0===r(i))return Wi(e);e=e.assignedSlot?e.assignedSlot:i||a===e.ownerDocument?i:a.host}e=s}if(function(e){var t,n,r,o,s=e&&Di(e),i=null===(t=s)||void 0===t?void 0:t.host,a=!1;if(s&&s!==e)for(a=!!(null!==(n=i)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(i)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&i;){var c,l,u;a=!(null===(l=i=null===(c=s=Di(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!!Pi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Gi=function(e,t){return!(function(e){return function(e){return Vi(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Di(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 o=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!o||o===e}(e)}(t)||$i(t)<0||!qi(e,t))},Ki=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ji=function e(t){var n=[],r=[];return t.forEach((function(t,o){var s=!!t.scopeParent,i=s?t.scopeParent:t,a=function(e,t){var n=$i(e);return n<0&&t&&!zi(e)?0:n}(i,s),c=s?e(t.candidates):i;0===a?s?n.push.apply(n,c):n.push(i):r.push({documentOrder:o,tabIndex:a,item:t,isScope:s,content:c})})),r.sort(Hi).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Xi=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Pi.call(e,Li)&&Gi(t,e)},Yi=Oi.concat("iframe").join(","),Zi=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Pi.call(e,Yi)&&qi(t,e)};function Qi(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 ea(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qi(Object(n),!0).forEach((function(t){var r,o,s;r=e,o=t,s=n[t],o=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)}(o),o in r?Object.defineProperty(r,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[o]=s})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ta=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},na=function(e){return ta(e)&&!e.shiftKey},ra=function(e){return ta(e)&&e.shiftKey},oa=function(e){return setTimeout(e,0)},sa=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},ia=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},aa=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},ca=[],la=function(e,t){var n,r=(null==t?void 0:t.document)||document,o=(null==t?void 0:t.trapStack)||ca,s=ea({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:na,isKeyBackward:ra},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]:s[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,o=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||o.find((function(t){return t===e}))}))},l=function(e){var t=s[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];t=t.apply(void 0,o)}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||!Zi(e,s.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?Bi([e],t.includeContainer,{filter:Gi.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ki}):Fi(e,t.includeContainer,Gi.bind(null,t)),Ji(n)}(e,s.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?Bi([e],t.includeContainer,{filter:qi.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Fi(e,t.includeContainer,qi.bind(null,t))}(e,s.tabbableOptions),r=t.length>0?t[0]:void 0,o=t.length>0?t[t.length-1]:void 0,i=n.find((function(e){return Xi(e)})),a=n.slice().reverse().find((function(e){return Xi(e)})),c=!!t.find((function(e){return $i(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:o,firstDomTabbableNode:i,lastDomTabbableNode:a,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=t.indexOf(e);return o<0?r?n.slice(n.indexOf(e)+1).find((function(e){return Xi(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return Xi(e)})):t[o+(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:!!s.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,o=void 0!==r&&r;t=t||aa(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=o?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(o){var h=sa(i.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||Zi(t,s.tabbableOptions)&&!Xi(t,s.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?i.tabbableGroups.length-1:h-1,m=i.tabbableGroups[f];a=$i(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else ta(n)||(a=p.nextTabbableNode(t,!1))}else{var y=sa(i.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||Zi(t,s.tabbableOptions)&&!Xi(t,s.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var v=y===i.tabbableGroups.length-1?0:y+1,g=i.tabbableGroups[v];a=$i(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else ta(n)||(a=p.nextTabbableNode(t))}}else a=l("fallbackFocus");return a},y=function(e){var t=aa(e);c(t,e)>=0||(ia(s.clickOutsideDeactivates,e)?n.deactivate({returnFocus:s.returnFocusOnDeactivate}):ia(s.allowOutsideClick,e)||e.preventDefault())},v=function(e){var t=aa(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(i.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var o=!0;if(i.mostRecentlyFocusedNode)if($i(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&&(s.isKeyForward(i.recentNavEvent)?d+1<l.length&&(r=l[d+1],o=!1):d-1>=0&&(r=l[d-1],o=!1))}}else i.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return $i(e)>0}))}))||(o=!1);else o=!1;o&&(r=m({target:i.mostRecentlyFocusedNode,isBackward:s.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!==ia(s.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(s.isKeyForward(e)||s.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&&(ta(e)&&e.preventDefault(),h(n))}(e,s.isKeyBackward(e))},b=function(e){var t=aa(e);c(t,e)>=0||ia(s.clickOutsideDeactivates,e)||ia(s.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)}(o,n),i.delayInitialFocusTimer=s.delayInitialFocus?oa((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"),o=a(e,"checkCanFocusTrap");o||d(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var s=function(){o&&d(),x(),C(),null==n||n()};return o?(o(i.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!i.active)return this;var t=ea({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.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()}(o,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(){oa((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 ua=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":s})=>{const i=ii(),a=(0,ts.useRef)(null),c=(0,ts.useRef)(null),[l,u]=(0,ts.useState)(!1);return(0,ts.useEffect)((()=>(l&&a.current&&(c.current=la(a.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,ts.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,ts.useEffect)((()=>{l&&a.current&&a.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,ts.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),s&&t.setAttribute("aria-labelledby",s),e.appendChild(t),a.current=t,u(!0),()=>{a.current&&(e.removeChild(a.current),a.current=null)}}),[r,s,i]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>a.current&&(0,o.render)(e,a.current)}):a.current&&(0,o.render)((0,o.toChildArray)(e).filter(j).map((e=>(e.props={...e.props,onClose:t},e))),a.current)},da=({url:e,description:t,onClose:n})=>{const r=xn(),o=ri(),s=Ks(),i=(0,ts.useRef)(null),{t:a}=ys(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof s?c.push(...s):c.push(...s(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,Ls.jsx)(ua,{onClose:n,"aria-label":a("lightbox.heading"),fallBackFocusRef:i,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,Ls.jsx)("div",{className:Gs(c),onClick:u,style:d,children:(0,Ls.jsxs)("div",{className:Gs("modal__float"),tabIndex:-1,onMouseDown:o,onKeyDown:o,onTouchStart:o,onMouseMove:o,onWheel:o,onPointerDown:o,onPointerMove:o,ref:i,children:[(0,Ls.jsx)("div",{className:Gs("modal__inner"),onClick:l,children:(0,Ls.jsx)("img",{className:Gs("modal__image"),src:e,alt:t})}),(0,Ls.jsxs)("button",{type:"button",className:Gs("modal__close"),onClick:n,children:[(0,Ls.jsx)(hi,{name:"close",size:"16",alt:""}),a("lightbox.closeLabel")]})]})}))(n))})},pa=({description:e,url:t})=>{const{t:n}=ys(),[r,o]=(0,ts.useState)(!1);return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsxs)("button",{type:"button",className:Gs("modal__enlarge"),onClick:()=>{o(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,Ls.jsx)(hi,{name:"enlarge",size:"32",alt:""})]}),r&&(0,Ls.jsx)(da,{url:t,description:e,onClose:()=>{o(!1)}})]})},ha=({event:e,...t})=>{const{body:n}=Hs(e),r=ji(e.payload.id),o=(0,ts.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,Ls.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,Ls.jsx)(li,{type:"text",event:e,onClick:r,...t,...o})},fa="PROCESSING_IMAGE",ma=({img:e,filename:t})=>{const{t:n}=ys(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,Ls.jsx)(Ls.Fragment,{children:(0,Ls.jsxs)("span",{className:Gs(["download","download--preview"]),children:[(0,Ls.jsx)("img",{src:e,alt:r}),(0,Ls.jsx)("span",{"aria-hidden":"true",className:Gs("file-download"),children:t})]})})},ya=({children:e,url:t,target:n})=>t?(0,Ls.jsx)("a",{href:t,download:!0,target:n,className:Gs(["download","download-link"]),children:e}):(0,Ls.jsx)("span",{className:Gs("download"),children:e}),va={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=ys(),s=ii(),{body:i,subEvent:a,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=_i(e);return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,o.toChildArray)(t).filter(j).map((e=>(e.props={...e.props,event:a,descriptorId:s,showTranslationToggle:!1},e))),l&&(0,Ls.jsxs)("button",{type:"button",className:Gs("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":s,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,Ls.jsx)(hi,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,Ls.jsx)(li,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,Ls.jsx)("ul",{className:Gs("choice-prompt","choice-prompt--many"),children:i?.choices?.map((e=>(0,Ls.jsx)("li",{className:Gs("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:ha,image:({event:e,descriptorId:t,...n})=>{const{body:r}=Hs(e),[o,s]=(0,ts.useState)(!1),i=es();return(0,Ls.jsxs)(li,{event:e,type:"image",...n,children:[(0,Ls.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{i(wo(e.payload.id)),s(!0)}}),r?.isZoomable&&o&&(0,Ls.jsx)(pa,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=Hs(e),o=ji(n.id);return(0,Ls.jsx)(li,{type:"splash",event:e,onClick:o,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=Hs(e);return Js(e).push("message--type-video"),(0,Ls.jsxs)(li,{event:e,type:"video",...n,children:[(0,Ls.jsx)("div",{id:t,className:Gs("visually-hidden"),children:r?.description}),(0,Ls.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=ys(),{body:r}=Hs(e),{fromClient:o,id:s}=e.payload,{filename:i,url:a}=r,c=(e=>{const{processingFileUploads:t}=dn((({state:e})=>e));return(0,ts.useMemo)((()=>{if(t.some((t=>t===e)))return fa;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(s),l=(0,ts.useMemo)((()=>n(a?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:i})),[a,i,n]);return(0,Ls.jsx)(li,{event:e,type:"upload",...t,children:c&&c!==fa?(0,Ls.jsx)(ma,{img:c,filename:i}):(0,Ls.jsxs)(ya,{url:a,target:o?void 0:"_blank",children:[(0,Ls.jsx)(hi,{name:"download",size:"16",alt:l}),(0,Ls.jsx)("span",{"aria-hidden":"true",className:Gs("file-download"),children:i})]})})},cta:({event:e})=>{const{body:t}=Hs(e),n=ji(e.payload.id),{emitEvent:r}=Ts(),o=ii(),s=(0,ts.useCallback)((()=>r(`action.${Zn}`,{type:Zn,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,Ls.jsxs)(li,{type:"cta",event:e,children:[(0,Ls.jsx)("div",{className:Gs("cta__content"),id:o,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,Ls.jsx)("a",{className:Gs("button","button--primary"),"aria-describedby":o,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:s,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=Hs(e),n=t.cards;return(0,Ls.jsx)(li,{event:e,modifiers:"type-carousel",children:(0,Ls.jsx)(bi,{items:n,getItemKey:xi,getItemLabel:wi})})},card:({event:e})=>{const{body:t}=Hs(e),n=ii();return(0,Ls.jsx)(li,{type:"card",event:e,children:(0,Ls.jsx)(ui,{id:n,...t})})}},info:{text:ha,divider:({event:e,...t})=>{const n=Ni[tr[e.payload.body.subtype]]||Ni.default;return(0,Ls.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=ys(),{body:r}=Hs(e);return(0,Ls.jsx)(li,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:Ii},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},o=!!t,s=dn(zs(e));return{body:s&&o?t:r,hasTranslation:o,isTranslated:s&&o,locale:n?.locale}})(e);return n?(0,Ls.jsx)(Ti,{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,ts.useState)(!0),o=es(),s=bs(),{sendAction:i,addMessageBubble:a}=Ts(),{suggestions:c,payload:l}=(e=>{const{payload:t}=e,{body:n}=Hs(e);return{suggestions:n,payload:t}})(e),{showSuggestions:u}=xn(),d=jn(),{t:p}=ys(),h=p("suggestions.headingText"),f=p("suggestions.footerText"),m=(0,ts.useMemo)((()=>d.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[d]),y=(0,ts.useCallback)((({id:e,question:t})=>{r(!1),o(mr(!0)),i({type:qn,originMessage:l.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),a(t)}),[o,i,l.id,a]);return n&&!s&&m&&u?(0,Ls.jsxs)("div",{className:Gs("suggestions","suggestions--conversation"),children:[h&&(0,Ls.jsx)("p",{className:Gs("suggestions__heading"),children:h}),(0,Ls.jsxs)(li,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,Ls.jsx)(Si,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:c}),f&&(0,Ls.jsx)("p",{className:Gs("suggestions__footer"),children:f})]})]}):null}}},ga=({children:e})=>{const{customComponents:t}=xn(),n=(0,ts.useMemo)((()=>Object.keys(va).reduce(((e,n)=>(e[n]={...va[n],...t?t[n]:{}},e)),{fallback:ha})),[t]);return(0,Ls.jsx)(Ps.Provider,{value:n,children:e})},ba=({children:e})=>{const{isMinimized:t}=vs(),n=(0,ts.useRef)(0),{sendAction:r}=Ts(),{hasCountdown:o,isActive:s,stopCountdown:i}=oi(),a=(0,ts.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),a=()=>{r({type:"interactivity_update"}),n.current=e};o&&s&&(a(),i()),e-n.current>15e3&&a()}),[r,o,s,i,t]);return(0,Ls.jsx)("div",{className:Gs("activity-monitor"),tabIndex:-1,onMouseDown:a,onKeyUp:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,children:(0,Ls.jsx)(ni.Provider,{value:a,children:e})})},xa=["text","choice_prompt","image","video"],wa=()=>{const e=Xs(),t=(0,ts.useRef)(),n=(0,ts.useRef)(),r=es(),o=Cs(),s=(0,ts.useRef)(null),{initCountdown:i,endCountdown:a}=oi(),{emitEvent:u}=Ts();return(0,ts.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new vr(e);r(Br({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(Qr())})),t.onOpen((()=>{r(zr())}))}}),[e,r]),(0,ts.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new c;return r(Br({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,ts.useEffect)((()=>{const t=e=>{if("participant"!==e.type)return;const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:o}=t;!n&&"string"!=typeof o&&o?.name&&r(yo(o.name)),r(_o({participant:o,fromClient:n})),"string"!=typeof o&&o.introduction&&r(Yr(e))};e.onConnection((({connected:n})=>{const{channel:s}=e;return!(!n||!s||(s.onMessage=(e,n)=>{const s={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(xo(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(io());break;case"translation_proposal":r(qo(n.body));break;case"user_first_response":r(mr(!0)),o.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(Rr(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(uo(n.service.serviceSessionId)),r(Yr(s))}break;case"participant":t(s);break;case"service_data":n.persist&&r(Eo(n));break;case"ack":r(Xr(s));break;case"system":if("service_changed"===n.type){const{serviceSettings:e,...t}=n,{entry:o,proactiveMessages:s}=e,{upload:i}=o.options;r(fo({key:nr,enabled:!(!i||!i.enabled)})),r(Do(s.enabled||!1)),r(So(o)),n.serviceSessionId&&r(uo(n.serviceSessionId)),u("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(Yr(s));break;case"error":switch(n.type){case"find_conversation_erred":const e=new l(s);r(Br({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(s);r(Br({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,o,i]),(0,ts.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=>xa.includes(e.type)?(e.id!==s.current&&o.emit("message",e),s.current=e.id,e):e)),0))}))}),[e,o]),(0,ts.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(Dr(e)).unwrap();if(!t)return;r(go(t))}catch(e){}})),!0)))}),[e,r]),null},_a=({children:e})=>{const{t}=ys(),n=es(),r=Es(),{addUploadBubble:o}=Ts(),s=(0,ts.useCallback)((async(e,t)=>{n(Ao(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),o=new Image;o.src=r,await o.decode();const s=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,o]=(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=o,n?.drawImage(e,0,0,r,o),t.toDataURL()})(o);try{sessionStorage.setItem(`image-${t}`,s)}catch(e){}finally{n(Ro(t))}}),[n]),i=(0,ts.useCallback)((e=>{const i=m(),a=r.uploadFile(e,(e=>{n(No({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(To(i)),o(r,a,c,l,u,d,p),await s(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(ko({fileId:i,errorText:r}))}));n(ao({fileId:i,fileName:e.name,uploadHandle:a}))}),[s,o,r,n,t]);return(0,Ls.jsx)(Ys.Provider,{value:i,children:e})},Ca=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=oi();return((e,t)=>{const n=(0,ts.useRef)(e);(0,ts.useEffect)((()=>{n.current=e}),[e]),(0,ts.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},Ea=()=>{const{initUserSelectedOptions:e}=ei(),t=(0,ts.useRef)(!1),n=xn();return(0,ts.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function Sa(e,t,n=[]){const r=Cs(),o=(0,ts.useRef)(t);(0,ts.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>o.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const ja=()=>{const e=xn(),{sendMessage:t,sendContext:n,sendAction:r}=Ts(),o=es(),{setVisibility:s,visible:i}=vs(),a=(0,ts.useRef)(i),c=Cs(),l=Es(),u=kn(),d=(0,ts.useRef)(null),h=(0,ts.useRef)(null),{isInline:f,isResolving:m}=Ln(),y=dn(As),v=(()=>{const{get:e}=Ss();return e?e("conversationUrl"):null})(),g=(0,ts.useRef)(null),b=ri(),{enableTranslations:x,disableTranslations:w}=$s();return(0,ts.useEffect)((()=>{a.current=i}),[i]),Sa("askText",(e=>{t({body:e})}),[l.send]),Sa("setVariables",(e=>{n({variables:e})}),[l.send]),Sa("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),Sa("setVisibility",(e=>{Object.values(Jt).includes(e)?(b(),s(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),Sa("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),Sa("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&o(ur({showSuggestions:!1})),e&&t?r({type:Yn,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]),Sa("setContext",(e=>{n(e)}),[l.send]),Sa("setTranslation",(({enabled:e,locale:t})=>{e?x(t):w()}),[l.send]),(0,ts.useEffect)((()=>{m||y||(g.current&&g.current!==v&&c.emit("unreadMessageCount",u),i===Jt.open&&i!==h.current&&0!==d.current&&c.emit("unreadMessageCount",0),i!==Jt.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},Ta=({children:e})=>{const t=Cs(),n=(0,ts.useRef)(null),[r,o]=(0,ts.useState)(),s=(0,ts.useRef)(!0),i=(0,ts.useCallback)((e=>{s.current&&(o(e),t.emit("aria-live",e))}),[o,t]);return(0,ts.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{i({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,i]),(0,ts.useEffect)((()=>()=>{s.current=!1}),[]),(0,Ls.jsxs)(_s.Provider,{value:i,children:[e,(0,Ls.jsxs)("div",{className:Gs("app__live-container"),children:[(0,Ls.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Gs("visually-hidden"),children:r?.ariaLive===Qn?r?.messageText:null}),(0,Ls.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Gs("visually-hidden"),children:r?.ariaLive===er?r?.messageText:null})]})]})},ka=()=>{const{t:e}=ys(),t=jn(),n=(0,ts.useRef)(0),r=(0,ts.useRef)(0),o=Cn().historyLoaded,{sendPolite:s}=ks(),{isOpen:i}=vs(),a=(0,ts.useRef)(null),c=(0,ts.useRef)(null),l=(0,ts.useMemo)((()=>v((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(s(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[s,e]);return(0,ts.useEffect)((()=>{t.length>n.current&&(i&&(c.current=l(t)),n.current=t.length)}),[t,l,i]),(0,ts.useEffect)((()=>{a.current&&!i&&c.current&&(c.current(!0),c.current=null)}),[i]),(0,ts.useEffect)((()=>{o&&setTimeout((()=>{s(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,s]),null},Na=()=>{const{t:e}=ys(),{isOpen:t,isVisible:n}=vs(),r=kn(),{sendPolite:o}=ks(),s=(0,ts.useMemo)((()=>v(o,2e3)),[o]),i=(0,ts.useRef)(null),a=(0,ts.useRef)(null);return(0,ts.useEffect)((()=>{i.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=s(e("message.srTextUnreadCount",{unreadCount:r}))),i.current=n}),[r,t,n,s,e]),null},Aa=({store:e,children:t,eventBus:n,api:r})=>((0,ts.useErrorBoundary)((t=>{console.error(t),e.dispatch(br(t))})),(0,Ls.jsx)(fn,{store:e,children:(0,Ls.jsx)(ws.Provider,{value:n,children:(0,Ls.jsx)(xs.Provider,{value:r,children:(0,Ls.jsx)(Ta,{children:(0,Ls.jsx)(Ms,{children:(0,Ls.jsxs)(ga,{children:[(0,Ls.jsx)(Ea,{}),(0,Ls.jsx)(wa,{}),(0,Ls.jsx)(Na,{}),(0,Ls.jsx)(ka,{}),(0,Ls.jsx)(Ca,{}),(0,Ls.jsxs)(ba,{children:[(0,Ls.jsx)(ja,{}),(0,Ls.jsx)(_a,{children:t})]})]})})})})})})),Ra=Ze(Sn,(e=>e.filter((e=>Vr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===Vn)))),Ia=Ze([Ra],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),Oa=Ze(Ra,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),La=Ze((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),Ma=()=>{const{t:e}=ys(),{showDisclaimer:t}=xn();return t?(0,Ls.jsxs)("div",{className:Gs("disclaimer"),tabIndex:0,children:[(0,Ls.jsx)("h2",{className:Gs("disclaimer__title"),children:e("disclaimer.title")}),(0,Ls.jsx)("div",{className:Gs("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},Pa=Ze([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),Da=Ze(Pa,(e=>e?.controls||{})),Ua=Ze(Da,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Fa=Ze([Da,(e,{name:t})=>t],((e,t)=>e[t]?.value)),Ba=Ze([Da,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),za=(0,o.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:$a,Consumer:Ha}=za,Va=za;function Wa(){return(0,ts.useContext)(Va)}function qa(e){const t=es(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:s}=Wa(),i=!!dn((e=>Pa(e,{formId:n}))),a=dn((t=>Fa(t,{formId:n,name:e}))),c=dn((t=>Ba(t,{formId:n,name:e}))),l=s?.[e],u=!l;(0,ts.useEffect)((()=>{i&&t(jr({formId:n,name:e}))}),[i,n,e,t]),(0,ts.useLayoutEffect)((()=>()=>{t(Tr({formId:n,name:e}))}),[i,n,e,t]);const d=(0,ts.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,ts.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,ts.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:a})),[e,d,p,a]),(0,ts.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function Ga(e){const{t}=ys(),{sendAssertive:n}=ks(),{hasLimit:r,limit:o}=On(),s=(0,ts.useMemo)((()=>v(n,f)),[n]),i=(0,ts.useMemo)((()=>v(((e,n)=>{e&&s(t("input.srCharacterLimitText",{limit:n}))}),f)),[s,t]),[{value:a}]=qa(e),c=o&&r&&a?o-a.length:o,l=!(!r||!c)&&c<=h,u=!(!r||!c)&&c<0;return(0,ts.useEffect)((()=>{i(l,c)}),[l,c,i]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Ka=e=>{const{hasCharacterLimit:t,characterLimit:n}=Ga(e),{entryMeta:{optionsOverride:{text:r}}}=Cn(),{t:o}=ys();return{placeholder:(0,ts.useMemo)((()=>o("input.inputPlaceholder",{hasLimit:t,text:r?.placeholder||o("input.inputPlaceholderText"),limit:t?n:null})),[o,t,n,r?.placeholder]),label:(0,ts.useMemo)((()=>o("input.inputLabel",{hasLimit:!r?.label&&t,text:r?.label||o("input.inputLabelText"),limit:!r?.label&&t?n:null})),[o,t,n,r?.label]),labelClass:(0,ts.useMemo)((()=>r?.label?"label":"visually-hidden"),[r?.label])}};function Ja(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=es(),{entryMeta:{actions:t,translatedActions:n}}=Cn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(jo())}}})(),n=Es();return e?(0,Ls.jsx)("li",{className:Gs(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,Ls.jsx)("button",{className:Gs(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:Yn,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const Xa=(0,o.createContext)(null),Ya=()=>{const e=(0,ts.useContext)(Xa);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},Za=Xa,Qa=e=>{const t=(()=>{const e=(0,ts.useContext)(Ps);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],o=null;return"choice_prompt"===e.payload.type&&(o=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,o]},ec=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=Ya(),{sendAction:o}=Ts(),s=e.payload.id?n[e.payload.id]:void 0,{containerRef:i,isVisible:a}=gs({containerRef:s,freezeOnceVisible:!0}),c=es(),[l,u]=Qa(e);if((0,Os.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(ho(t)),o({type:Kn,events:t})}}),[c,e.payload.id,a,o,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,Ls.jsxs)("li",{className:Gs(d),ref:i,children:[e.payload.timeIndicator&&(0,Ls.jsx)(Ii,{event:e}),(0,Ls.jsx)(l,{event:e,children:(0,Ls.jsx)(u,{event:e})})]})},tc=()=>{const{id:e}=In()||{};return(0,Ls.jsx)("li",{className:Gs("conversation__item","conversation__item--source-agent"),children:(0,Ls.jsxs)("div",{className:Gs("message","message--source-agent","message--type-loading"),children:[(0,Ls.jsx)(ci,{eventPayload:{fromClient:!1,participant:e}}),(0,Ls.jsx)("div",{className:Gs("message__body"),children:(0,Ls.jsxs)("span",{className:Gs("loader"),children:[(0,Ls.jsx)("span",{className:Gs("loader__part","one")}),(0,Ls.jsx)("span",{className:Gs("loader__part","two")}),(0,Ls.jsx)("span",{className:Gs("loader__part","three")}),(0,Ls.jsx)("span",{className:Gs("loader__part","four")})]})})]})})},nc=()=>{const e=jn();let t;return(0,Ls.jsx)(Ls.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let o=!1;if("participant"!==n&&"service_data"!==n){const{participant:n,fromClient:s}=r,i=s?"seamly-client-participant":n;"info"!==e.type&&t!==i&&(o=!0),t=i}return(0,Ls.jsx)(ec,{event:e,newParticipant:o},e.payload.key||e.payload.id)}))})},rc=()=>{const{t:e}=ys(),t=Tn(),n=((e,t=20)=>{const[n,r]=(0,ts.useState)(e),o=(0,ts.useRef)(null);return(0,ts.useEffect)((()=>(o.current=setTimeout((()=>r(e)),t),()=>{o.current&&clearTimeout(o.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=vs(),o=Nn(),s=Bs();return(0,Ls.jsxs)(Ls.Fragment,{children:[r&&(0,Ls.jsx)("a",{className:Gs("skip-link"),href:`#${o}`,onClick:e=>{e.preventDefault(),s()},children:e("skiplinkText")}),(0,Ls.jsx)("div",{className:Gs("chat__body"),children:(0,Ls.jsxs)("div",{className:Gs("conversation__container"),children:[(0,Ls.jsx)(Ma,{}),(0,Ls.jsxs)("ol",{className:Gs("conversation"),children:[(0,Ls.jsx)(ga,{children:(0,Ls.jsx)(nc,{})}),n?(0,Ls.jsx)(tc,{}):null,(0,Ls.jsx)(Ja,{})]})]})})]})};function oc(e,t){const n=(0,ts.useRef)(null),r=(0,ts.useRef)(e);return(0,ts.useEffect)((()=>{r.current=e}),[e]),(0,ts.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const sc={visible:Gs("transition--visible"),in:Gs("transition--in"),visuallyHidden:Gs("visually-hidden")},ic=Object.values(sc),ac=e=>{const t=(0,ts.useRef)(null);t.current=e;const n="function"==typeof e;return(0,ts.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},cc={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},lc=({children:e,isActive:t,timeout:n=300,transitionStartState:r=cc.notRendered,onInTransitionComplete:s=(()=>{}),onOutTransitionComplete:i=(()=>{}),exitAfter:a,enterDelay:c=0})=>{const l=(0,ts.useRef)(!1),u=(0,ts.useRef)(null),d=(0,ts.useRef)(null),p=r===cc.visuallyHidden,[h,f]=(0,ts.useState)((()=>p?[sc.visuallyHidden]:[])),[m,y]=(0,ts.useState)((()=>0===c)),v=(0,ts.useMemo)((()=>a?a+c:a),[c,a]);oc((()=>y(!1)),t?v:void 0),oc((()=>y(!0)),t?c:void 0);const g=(0,ts.useMemo)((()=>m&&t),[t,m]),b=ac(s),x=ac(i),w="notRendered"!==r||h.length>0;return(0,ts.useEffect)((()=>(l.current&&!g&&(f([sc.visible]),u.current=setTimeout((()=>{f([...p?[sc.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&g&&(f([sc.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{f([sc.visible,sc.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,Ls.jsx)(Ls.Fragment,{children:w&&(0,o.toChildArray)(e).filter(j).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!ic.includes(e)));return(0,o.cloneElement)(e,{className:[...n,...h].join(" ")})}))})},uc=({isAside:e=!1})=>{const{isInline:t}=Ln(),{t:n}=ys(),{sendAction:r,addMessageBubble:o}=Ts(),{isOpen:s,setVisibility:i}=vs(),{showSuggestions:a}=xn(),c=ii(),l=Bs(),u=(0,ts.useRef)(null),{sendPolite:d}=ks(),p=dn(As),{hasCountdown:h,endCountdown:f}=oi(),{hasPrompt:m,continueChat:y}=si(),v=bs(),g=("suggestion",Cn().serviceData.suggestion);const{body:b}=Hs({payload:g,type:"service_data"}),x=(0,ts.useMemo)((()=>p?[]:Array.isArray(b)?b:b?.data),[b,p]),w=(0,ts.useRef)(),_=(0,ts.useRef)(!1),C=(0,ts.useRef)(),E=!!x?.length,j=t?(v||s)&&!e:v,T=(0,ts.useRef)(j),k=E&&!j&&a,N=E?x:C.current;C.current=N;const A=(0,ts.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Gs(t)}),[e]),R=(0,ts.useCallback)((({id:e,question:t})=>{h&&f(!0),m&&y(),r({type:qn,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),o(t),s||i(Jt.open),l()}),[o,y,f,l,h,m,g,r,i,s]);(0,ts.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"),O=n("suggestions.footerText"),L=I?"section":"div";return(0,Ls.jsx)(lc,{isActive:!!k,transitionStartState:cc.notRendered,children:(0,Ls.jsxs)(L,{className:A,"aria-labelledby":I?c:void 0,ref:u,children:[I&&(0,Ls.jsx)("p",{id:c,className:Gs("suggestions__heading"),children:I}),!!N&&(0,Ls.jsx)(Si,{suggestions:N,onClickSuggestion:R}),O&&!s&&(0,Ls.jsx)("p",{className:Gs("suggestions__footer"),children:O})]})})},dc=(0,Os.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:o,setVisibility:s}=vs(),{namespace:i,layoutMode:a}=xn(),{isInline:c}=Ln(),l=Ks(),u=bs(),{t:d}=ys(),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"),o&&(0,Ls.jsxs)("section",{className:Gs(p),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&s(Jt.minimized)},tabIndex:-1,ref:n,"aria-label":d("chat.srLabel"),children:[(0,Ls.jsx)("div",{className:Gs("chat-wrapper"),children:e}),"inline"===a&&r&&(0,Ls.jsx)(uc,{isAside:!0})]})})),pc=dc,hc=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:o,id:s})=>{const i=ii();return(0,Ls.jsxs)("section",{tabIndex:-1,id:s,"aria-labelledby":n?i:void 0,className:Gs("chat-status",n?void 0:"chat-status--condensed"),children:[(0,Ls.jsxs)("div",{className:Gs("chat-status__body"),children:[n?(0,Ls.jsx)("h2",{className:Gs("chat-status__title"),id:i,children:n}):null,e]}),"function"==typeof t&&(0,Ls.jsxs)("button",{type:"button",onClick:t,className:Gs("button","button--tertiary","chat-status__close"),children:[r||(0,Ls.jsx)(hi,{name:"close",size:"16",alt:""}),o&&(0,Ls.jsx)("span",{className:Gs("visually-hidden"),children:o})]})]})},fc=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,Ls.jsxs)("button",{type:"button",onClick:e,className:Gs("button","button--primary","chat-status__button"),children:[(0,Ls.jsx)(hi,{name:t,size:"16",alt:""}),n,r&&(0,Ls.jsx)("span",{className:Gs("visually-hidden"),children:r})]});function mc(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=qs(),{id:o}=Vs();return e&&t?(0,Ls.jsx)(hc,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:o,title:t.titleLabel,children:(0,Ls.jsx)(fc,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function yc(){const e=dn(As),{isActive:t}=$s();return e||t?null:(0,Ls.jsx)(mc,{})}const vc=({label:e,checked:t,description:n,onChange:r,id:o,itemClassName:s})=>(0,Ls.jsxs)("li",{className:Gs([s||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:o,children:[(0,Ls.jsx)(hi,{name:"check",size:"16",alt:""}),e," ",n&&(0,Ls.jsxs)("span",{children:["(",n,")"]})]}),gc=({onChange:e,describedById:t})=>{const{context:n}=xn(),r=(0,Os.useMemo)((()=>n?.contentLocale),[n?.contentLocale]),{t:o}=ys(),{languages:s,currentLocale:i,enableTranslations:a,disableTranslations:c}=$s(),l=Bs(),u=t=>()=>{t===i||r===t?c():a(t),e(),l()},{primaryLanguages:d,remainingLanguages:p}=(0,Os.useMemo)((()=>s.reduce(((e,t)=>{const n=t.locale===r,o=((e,t,n)=>t===e.locale||!t&&n)(t,i,n);t.locale!==r&&e.remainingLanguages.push({...t,checked:o,isOriginal:n});const s=e.remainingLanguages.findIndex((e=>e.locale===i));return(n||o&&s>4)&&e.primaryLanguages.push({...t,checked:o,isOriginal:n}),e}),{primaryLanguages:[],remainingLanguages:[]})),[i,r,s]);return(0,Ls.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Gs("translation-options"),children:[d.map((({locale:e,nativeName:t,checked:n,isOriginal:r},s)=>(0,Ls.jsx)(vc,{id:e,label:t,checked:n,description:r?o("translations.settings.original"):void 0,onChange:u(e),itemClassName:Gs({"translation-options__item--original":r,"translation-options__item--selected":n&&0!==s})},e))),p.map((({locale:e,nativeName:t,checked:n,isOriginal:r})=>(0,Ls.jsx)(vc,{id:e,label:t,checked:n,description:r?o("translations.settings.original"):void 0,onChange:u(e)},e)))]})},bc=({className:e,children:t,onCancel:n,headingText:r,description:o,descriptionId:s,cancelButtonText:i,cancelButtonRef:a,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=ii(),{hideOption:d}=ei(),{focusButton:p}=ti(),h=(0,ts.useCallback)((()=>{d(),c||p()}),[c,p,d]),f=(0,ts.useCallback)((()=>{n&&n(),h()}),[h,n]),m=(e=>{const t=(0,ts.useRef)(null);return(0,ts.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,ts.useEffect)((()=>{E(m.current)}),[m]),(0,Ls.jsx)("section",{className:Gs("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,Ls.jsxs)("div",{className:Gs("options__body"),children:[(0,Ls.jsx)("h2",{id:u,className:Gs("options__title"),children:r}),(0,Ls.jsxs)("button",{type:"button",onClick:f,"aria-describedby":u,className:Gs("button","options__close"),ref:e=>{a&&(a.current=e)},children:[(0,Ls.jsx)(hi,{name:"close",size:"16",alt:""}),(0,Ls.jsx)("span",{children:i})]}),o?(0,Ls.jsx)("p",{className:Gs("options__description"),id:s,children:o}):null,(0,Ls.jsx)("div",{className:Gs("options__wrapper"),children:t})]})})},xc=function({onClose:e,position:t}){const{t:n}=ys(),r=ii();return(0,Ls.jsx)(bc,{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,Ls.jsx)(gc,{describedById:r,onChange:e})})};function wc({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,o]=(0,ts.useState)(!1),s=(0,ts.useRef)(null),i=ii();return(0,Ls.jsxs)("div",{className:Gs("translations__container"),onKeyDown:e=>{r&&C(e)===_.Escape&&(o(!1),E(s.current))},children:[(0,Ls.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Ls.jsx)("div",{className:Gs("options__dialog"),role:"dialog",children:(0,Ls.jsx)(xc,{onClose:()=>{o(!1)},position:t})})}),(0,Ls.jsx)("button",{type:"button",className:Gs(["button","chat__options__button",...n]),id:i,onClick:()=>{o(!r)},onKeyDown:e=>{C(e)===_.ArrowDown&&(o(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const _c=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:o,validationSchema:s={},...i})=>{const a=es(),c=dn((e=>Ua(e,{formId:t}))),[l,u]=(0,ts.useState)(!1),[d,p]=(0,ts.useState)({}),{isValid:h,errors:f}=function(e,t){const n=(0,ts.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const o=Array.isArray(r)?r:[r];for(let r=0;r<o?.length;r++)if(!o[r].fn(e[n],o[r].compareValue)){t[n]=o[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,s),m=(0,ts.useMemo)((()=>({...f,...d})),[f,d]);(0,ts.useLayoutEffect)((()=>{a(Er({formId:t,persistData:n}))}),[t,n,a]),(0,ts.useEffect)((()=>()=>{a(Sr({formId:t}))}),[t,n,a]);const y=(0,ts.useCallback)(((e,n)=>{a(kr({formId:t,name:e,value:n}))}),[t,a]),v=(0,ts.useCallback)(((e,n)=>{a(Nr({formId:t,name:e,touched:n}))}),[a,t]),g=(0,ts.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,ts.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&h&&(a(mr(!0)),o(c,{updateControlValue:y,setError:g}))}),[h,a,o,c,y,g]);(0,ts.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,ts.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:s,updateControlValue:y,updateControlTouched:v})),[t,c,m,l,b,s,y,v]);return t?o?(0,Ls.jsx)($a,{...i,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},Cc=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),Ec=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},Sc=e=>!!e?.length,jc=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))},Tc=e=>!!e,kc=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:o,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Wa();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),i=["form"];return!t&&s&&(i.push("form--submitted"),o?i.push("form--valid"):i.push("form--invalid")),(0,Ls.jsx)("form",{onSubmit:r,className:Gs([...i,e]),...n})};function Nc({id:e,error:t}){const[n,r]=(0,ts.useState)(!1);return(0,ts.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,Ls.jsx)("div",{className:Gs("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,Ls.jsxs)("span",{id:e,className:Gs("error__message"),children:[(0,Ls.jsx)(hi,{name:"error",size:"16",alt:""}),t]})})}const Ac=({contentHint:e,id:t,labelText:n,labelClass:r,validity:o,errorText:s,children:i})=>(0,Ls.jsxs)(Ls.Fragment,{children:[e&&(0,Ls.jsx)("span",{id:`${t}-content-hint`,className:Gs("input__content-hint"),children:e}),(0,Ls.jsx)(Nc,{id:`${t}-error`,error:!o&&s}),(0,Ls.jsxs)("div",{className:Gs("form-control__wrapper"),children:[(0,Ls.jsx)("label",{htmlFor:t,className:Gs(r),children:n}),i]})]}),Rc=function({id:e,name:t,type:n,labelText:r,labelClass:o,contentHint:s=null,"aria-invalid":i,"aria-describedby":a,...c}){const{isSubmitted:l}=Wa(),[u,{error:d}]=qa(t),p=l&&d,h=[];return a&&h.push(a),s&&h.push(`${e}-content-hint`),p&&h.push(`${e}-error`),(0,Ls.jsx)(Ac,{id:e,contentHint:s,validity:!p,errorText:d,labelText:r,labelClass:o,children:(0,Ls.jsx)("input",{...u,...c,id:e,type:n,"aria-invalid":i||p?"true":"false","aria-describedby":h.join(" ")||void 0,name:t})})};function Ic({controlName:e,describedById:t}){const{t:n}=ys();return(0,Ls.jsxs)(kc,{noValidate:"true",className:Gs("options__form"),children:[(0,Ls.jsx)(Rc,{id:"email-id",name:e,type:"email",className:Gs("transcript__input"),"aria-describedby":t,labelClass:Gs("label"),labelText:n("options.sendTranscript.label")}),(0,Ls.jsx)("div",{className:Gs("options__actions"),children:(0,Ls.jsx)("button",{type:"submit",className:Gs("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const Oc="email",Lc={sendTranscript:()=>{const[e,t]=(0,ts.useState)(void 0),{hideOption:n}=ei(),{focusButton:r}=ti(),{t:o}=ys(),s=ii(),{sendAction:i}=Ts(),a=(0,ts.useMemo)((()=>({[Oc]:[Cc(Tc,o("options.sendTranscript.noEmailText")),Cc(jc,o("options.sendTranscript.invalidEmailText"))]})),[o]),c=(0,ts.useCallback)((e=>{const t=e[Oc].trim();i({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[i,n,r]),l=(0,ts.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,Ls.jsx)(bc,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),description:o("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,Ls.jsx)(_c,{formId:"sendTranscript",onSubmit:c,validationSchema:a,onError:l,children:(0,Ls.jsx)(Ic,{controlName:Oc,describedById:s})})})}},Mc=()=>{const{optionActive:e}=ei(),t=(0,ts.useRef)(),n=Lc[t.current??e];return e&&(t.current=e),n?(0,Ls.jsx)(n,{}):null},Pc=()=>{const{t:e}=ys(),{menuOptions:t,showOption:n,panelActive:r,hideOption:o}=ei(),{id:s}=ti(),i=(0,ts.useRef)(null),[a,c]=(0,ts.useState)(!1),l=(0,ts.useRef)(null),u=t.length,d=(0,ts.useRef)([]),p=(0,ts.useRef)(!1),h=u>1,f=t[0],m=(0,ts.useMemo)((()=>f?.name?.trim().replace(/\s+/g,"")),[f]);return(0,ts.useEffect)((()=>()=>{i.current&&clearTimeout(i.current)}),[]),(0,ts.useEffect)((()=>{a&&!p.current&&requestAnimationFrame((async()=>{await Ds(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,Ls.jsxs)("div",{className:Gs("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,Ls.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Ls.jsx)("div",{className:Gs("options__dialog"),children:(0,Ls.jsx)(Mc,{})})}),h&&(0,Ls.jsx)(lc,{isActive:a,transitionStartState:cc.notRendered,children:(0,Ls.jsx)("ul",{className:Gs(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":s,children:t.map((({name:r,title:o,available:s},i)=>(0,Ls.jsx)("li",{className:Gs("options__menu__item"),role:"menuitem","data-testid":r,children:(0,Ls.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[i]=e)},className:Gs(["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 o=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=t)})),-1!==o&&d.current&&E(d.current[o])})(e,i),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,s),"aria-disabled":!s,children:[(0,Ls.jsxs)("span",{className:Gs("button__text"),children:[o,!s&&" "]}),s?null:(0,Ls.jsx)("span",{className:Gs("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,Ls.jsxs)("button",{type:"button",className:Gs(["button","button--secondary","chat__options__button",...!h&&m?[`chat__options__button--${m}`]:[]]),id:s,onClick:()=>{r&&o(),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,Ls.jsx)(hi,{name:"options",size:"32",alt:""}):null,(0,Ls.jsx)("span",{className:Gs("button__text"),children:h?e("options.openButtonText"):`${f.title}${f.available?"":" "}`}),h||f.available?null:(0,Ls.jsx)("span",{className:Gs("button__state"),children:e("options.unavailableText")})]})]}):null};function Dc(){const{menuOptions:e,allowOptionSelection:t}=ei(),{isAvailable:n}=$s(),r=dn(As),{t:o,userLocale:s}=ys(),i=Ws(s);if(!n&&(!t||!e.length)||r)return null;const a=o("translations.settings.openButtonText",{hasLanguage:!!i,language:i});return(0,Ls.jsxs)("div",{className:Gs("chat__options"),children:[n&&(0,Ls.jsx)("div",{className:Gs("chat__options-item","chat__options-item--left"),children:(0,Ls.jsxs)(wc,{classNames:["button--secondary"],children:[(0,Ls.jsx)(hi,{alt:a,name:"newTranslation",size:"16"}),(0,Ls.jsx)("span",{className:Gs("button__text"),children:a})]})}),t&&(0,Ls.jsx)("div",{className:Gs("chat__options-item","chat__options-item--right"),children:(0,Ls.jsx)(Pc,{})})]})}const Uc=()=>{const{scrollToRef:e,unreadIds:t}=Ya(),{isMinimized:n}=vs(),{t:r}=ys();return(0,Ls.jsx)(lc,{isActive:!!t.length&&!n,children:(0,Ls.jsx)("div",{className:Gs("unread-messages"),children:(0,Ls.jsxs)("button",{type:"button",className:Gs("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,Ls.jsx)(hi,{name:"chevronDown",size:"32",alt:""})]})})})},Fc=({children:e})=>{const t=jn(),n=(0,ts.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,o.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:s,containerRef:i,unreadIds:a}=(e=>{const t=(0,ts.useRef)(null),[n,r]=(0,ts.useState)(!0),o=dn(Oa),s=jn(),i=Tn(),{isOpen:a}=vs(),c=Cn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=dn((({state:e})=>e));(0,ts.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,s=Math.abs(t-n-o)>10;r(!s)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,ts.useCallback)((()=>{requestAnimationFrame((async()=>{await Ds(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,ts.useEffect)((()=>{u&&d()}),[u,d]),(0,ts.useEffect)((()=>{n&&d()}),[n,o,s,i,a,c,l,d]),{containerRef:t,unreadIds:o,scrollToRef:()=>{const n=o.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,Ls.jsx)(Za.Provider,{value:{eventRefs:n,unreadIds:a,scrollToRef:r,scrollToBottom:s,containerRef:i},children:(0,Ls.jsxs)("div",{className:Gs("chat__container"),children:[(0,Ls.jsx)("div",{className:Gs("chat__container__scroll-area"),ref:i,children:e}),(0,Ls.jsx)(Uc,{})]})})},Bc=({baseClassName:e,children:t,title:n})=>{const r=Nn(),o=ii();return(0,Ls.jsxs)("section",{id:r,className:Gs(e),"aria-describedby":o,tabIndex:-1,children:[(0,Ls.jsx)("h2",{className:Gs(`${e}__title`),id:o,children:n}),t]})},zc=()=>{const{t:e}=ys(),t=Bs(),n=ri(),{emitEvent:r}=Ts(),{isActive:o,remaining:s,timer:i,endCountdown:a}=oi(),c=!!s&&s>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,Ls.jsx)(Bc,{baseClassName:"idle",title:l,children:c&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("div",{className:Gs("idle__count-container"),children:o&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("span",{className:Gs("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,Ls.jsx)("span",{className:Gs("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",i)})]})}),(0,Ls.jsxs)("div",{className:Gs("idle__options"),children:[(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{n(),a(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{a(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},$c=()=>{const{t:e}=ys(),t=ri(),{name:n}=In()||{},{continueChat:r,restartChat:o}=si();return(0,Ls.jsx)(Bc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,Ls.jsxs)("div",{className:Gs("prompt__options"),children:[(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},Hc=()=>{const{sendAction:e}=Ts(),{features:t}=ei(),{typingPeekahead:n}=t||{},r=(0,ts.useRef)(null),o=(0,ts.useRef)(null),s=(0,ts.useRef)(!1),i=(0,ts.useRef)(null);(0,ts.useEffect)((()=>()=>{i.current&&clearInterval(i.current),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current)}),[]);const a=(t,r)=>{e({type:Gn,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(s.current=!0,i.current||(a(!0,e.target.value),i.current=setInterval((()=>{!s.current&&i.current?(clearInterval(i.current),i.current=null):n&&n.enabled&&a(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current),r.current=setTimeout((()=>{s.current=!1}),300),o.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}},Vc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=Cn().entryMeta,s=es(),i=n||t||e,a=o[i]||r[i]||{},c=(0,ts.useCallback)((e=>{s(po(e))}),[s]),l=(0,ts.useCallback)((e=>{s(lo(e))}),[s]),u=(0,ts.useCallback)((e=>{s(Io(e))}),[s]),d=(0,ts.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:i,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Wc({controlName:e,skipLinkId:t}){const{t:n}=ys(),{sendAssertive:r}=ks(),{emitEvent:o}=Ts(),s=Hc(),{setBlockAutoEntrySwitch:i}=Vc(),{placeholder:a,label:c,labelClass:l}=Ka(e),{hasCharacterLimit:u,reachedCharacterWarning:d,reachedCharacterLimit:p,remainingChars:h}=Ga(e),[{value:f}]=qa(e),m=!!f,y=(0,ts.useCallback)((()=>{d&&r(n("input.srCharacterLimitText",{limit:h})),o("ui.inputFocus")}),[n,r,d,h,o]);return(0,ts.useLayoutEffect)((()=>(i(m),()=>{i(!1)})),[i,m]),(0,Ls.jsxs)(kc,{className:Gs("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,Ls.jsxs)("div",{className:Gs(["input--text__container",...d&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,Ls.jsx)(Rc,{id:t,type:"text",name:e,className:Gs("input__text"),autocomplete:"off",placeholder:a,labelText:c,labelClass:Gs(l),"aria-invalid":!!u&&p,onKeyUp:s,onFocus:y}),(0,Ls.jsx)("div",{className:Gs("character-count"),children:d&&(0,Ls.jsx)("span",{children:h})})]}),(0,Ls.jsx)("button",{className:Gs("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!m||p,children:(0,Ls.jsx)(hi,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const qc="textMessageEntry";function Gc({...e}){const{isOpen:t,setVisibility:n}=vs(),r=Nn(),o=Bs(),{sendMessage:s}=Ts(),i=(0,ts.useCallback)(((e,{updateControlValue:r})=>{s({body:e[qc]}),r(qc,""),o(),t||n(Jt.open)}),[s,o,t,n]);return(0,Ls.jsx)(_c,{...e,formId:"textEntry",persistData:!0,onSubmit:i,children:(0,Ls.jsx)(Wc,{controlName:qc,skipLinkId:r})})}const Kc=()=>{const{t:e}=ys(),{currentUploads:t}=Qs();return(0,Ls.jsx)("div",{className:Gs("progress"),children:t.map((({id:t,name:n,progress:r,uploading:o,error:s})=>(0,Ls.jsxs)("div",{className:Gs("progress_container"),children:[(0,Ls.jsxs)("div",{className:Gs("progress__text"),children:[(0,Ls.jsx)("span",{className:Gs("progress__text--file-name"),children:n}),(0,Ls.jsx)("span",{className:Gs("progress__text--percentage"),children:`${r}%`})]}),(0,Ls.jsx)(Nc,{error:s,id:"progress-error"}),(0,Ls.jsx)("progress",{className:Gs("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":o,children:`${r}%`})]},t)))})};function Jc({id:e,name:t,labelText:n,contentHint:r,outputText:o,accept:s}){const{isSubmitted:i}=Wa(),[a,c]=(0,ts.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=qa(t),p=ii(),h=ii(),f=ii(),m=i&&d,y=[f];r&&y.push(h),m&&y.push(p);const v=(0,ts.useCallback)((()=>{c(!0)}),[c]),g=(0,ts.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,ts.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,Ls.jsxs)("div",{className:Gs("upload__container"),children:[r&&(0,Ls.jsx)("span",{className:Gs("upload__content-hint"),id:h,children:r}),(0,Ls.jsx)(Nc,{id:p,error:m&&d}),(0,Ls.jsx)("div",{className:Gs(["file-upload",...a?["focus-within"]:[]]),children:(0,Ls.jsxs)("label",{htmlFor:e,className:Gs("upload__label"),children:[(0,Ls.jsx)(hi,{name:"upload",size:"32",alt:""}),(0,Ls.jsxs)("div",{children:[(0,Ls.jsx)("span",{className:Gs(["upload__label--text"]),children:n}),(0,Ls.jsx)("input",{id:e,className:Gs("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:s||null,onFocus:v,onBlur:g}),(0,Ls.jsx)("span",{className:Gs("upload__output"),"aria-hidden":"true",id:f,children:o})]})]})})]})}const Xc=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:o,isComplete:s,onClickCancel:i})=>{const{t:a}=ys(),[{value:c}]=qa(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,Ls.jsxs)(kc,{className:Gs("upload-form"),children:[(0,Ls.jsx)(Jc,{name:t,id:e,accept:n,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,Ls.jsxs)("div",{className:Gs("upload__button-container"),children:[(0,Ls.jsx)("button",{id:o||!s?e:void 0,type:"button",onClick:i,className:Gs("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,Ls.jsx)("button",{className:Gs("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})},Yc="fileListForm",Zc="fileList",Qc=()=>{const{t:e}=ys(),{sendPolite:t,sendAssertive:n}=ks(),r=Nn(),o=Bs(),{serviceAllowsUploads:s,allowedMimeTypes:i,maxSize:a}=Zs(),c=(0,ts.useRef)(null),l=(0,ts.useRef)(s),{cancelEntrySelection:u}=Vc(),{uploadFile:d,clearUploads:p,isUploading:h,isComplete:f}=Qs(),{uploadHandle:m,hasServerError:y,progress:v}=((e,t)=>{const n=dn((n=>Fa(n,{formId:e,name:t}))),{currentUploads:r}=Qs(),o=n&&n.length>0;let s=null,i=!1,a=0;if(r&&r.length>0){const e=r[0];s=e.uploadHandle,i=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:s,hasServerError:i,progress:a}})(Yc,Zc),g=ii(),b=(0,ts.useRef)(!0),w=e("fileUpload.contentHint",{size:x(a)}),_=(0,ts.useRef)(""),C=(0,ts.useRef)(null);(0,ts.useEffect)((()=>{_.current&&C.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(w),_.current=w}),[w,n]),(0,ts.useEffect)((()=>{v>0&&t(1===v?e("fileUpload.srStartedText"):`${v}%`)}),[v,t,e]),(0,ts.useEffect)((()=>{b.current||h||!f||(p(),u(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=f}),[h,f,p,u,o,t,e]);const E=(0,ts.useCallback)((({fileList:e})=>{d(e[0]),o()}),[d,!1,o]),S=(0,ts.useCallback)((()=>{m&&m.abort(),p(),u(),o()}),[m,p,u,o]),j=(0,ts.useMemo)((()=>({[Zc]:[Cc((()=>s),e("fileUpload.errors.unavailable")),Cc(Sc,e("fileUpload.errors.noFile")),Cc(Ec,e("fileUpload.errors.tooLarge"),a)]})),[a,s,e]);return(0,Ls.jsx)("div",{className:Gs(["upload",...y?["upload--error"]:[]]),ref:C,children:(0,Ls.jsxs)(_c,{formId:Yc,persistData:!0,onSubmit:E,validationSchema:j,children:[(h||!f)&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)(Kc,{}),(0,Ls.jsx)("div",{className:Gs("upload__button-container"),children:(0,Ls.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,ref:c,className:Gs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&f&&(0,Ls.jsx)(Xc,{controlName:Zc,skiplinkId:r,accept:i?.join(", ")||"",contentHint:w,isComplete:f,isUploading:h,onClickCancel:S}),!l.current&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("span",{className:Gs("notification"),id:g,children:e("fileUpload.unavailableText")}),(0,Ls.jsx)("div",{className:Gs("upload__button-container"),children:(0,Ls.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,className:Gs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},el=()=>{const{t:e}=ys(),{showFileUpload:t,serviceAllowsUploads:n}=Zs(),[r,o]=(0,ts.useState)(n||!1),s=Bs(),i=(0,ts.useRef)(null),{setUserEntryType:a,activeEntry:c}=Vc(),l=(0,ts.useRef)(null),{sendPolite:u}=ks(),d=!!In();return(0,ts.useEffect)((()=>{S(l.current,(()=>{n||s()})),o(n||!1)}),[n,s]),(0,ts.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===Hn?null:(0,Ls.jsx)(lc,{isActive:r,transitionStartState:cc.rendered,children:(0,Ls.jsx)("div",{className:Gs("upload-toggle-wrapper"),children:(0,Ls.jsx)(lc,{isActive:r,transitionStartState:cc.visuallyHidden,children:(0,Ls.jsx)("button",{className:Gs(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{a(Hn),s()}:void 0,children:(0,Ls.jsx)(hi,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},tl=()=>{const{isOpen:e}=vs(),t=(0,ts.useRef)(null),{hasCountdown:n}=oi(),[r,o]=(0,ts.useState)(n),{hasPrompt:s}=si(),[i,a]=(0,ts.useState)(s),c=Bs(),l=(0,ts.useRef)(!1),{activeEntry:u}=Vc(),[d,p]=(0,ts.useState)({text:Gc,upload:Qc}),[h,f]=(0,ts.useState)((()=>u)),m=xn(),{accountAllowsUploads:y}=Zs(),v=(0,ts.useCallback)((()=>{S(t.current,c)}),[c]);(0,ts.useEffect)((()=>{const{customComponents:e}=m,{entry:t}=e||{};t&&p((e=>({...e,...t})))}),[m]),(0,ts.useEffect)((()=>{v(),o(n),a(s)}),[n,s,v]),(0,ts.useEffect)((()=>{f(u),v()}),[u,v,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const g=d[h];return(0,Ls.jsxs)("div",{className:Gs("chat__entry"),ref:t,children:[r&&(0,Ls.jsx)(zc,{}),i&&(0,Ls.jsx)($c,{}),(0,Ls.jsxs)("div",{className:Gs(["entry__body",...n||s?["entry__body--hidden"]:[]]),children:[h!==Hn&&y&&e?(0,Ls.jsx)(el,{}):null,(0,Ls.jsx)(g,{})]})]})},nl=()=>{const{t:e}=ys(),{isOpen:t,closeChat:n}=vs(),{isWindow:r}=Ln();return t&&r?(0,Ls.jsx)("button",{type:"button",className:Gs("button","collapse-button"),onClick:n,children:(0,Ls.jsx)(hi,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},rl=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:o,srText:s}}=Rs(),i=Ts(),a=ii(),{sendPolite:c}=ks(),l=Bs(),u="SeamlySessionExpiredError"===e?.name;return(0,ts.useEffect)((()=>{!u&&s&&setTimeout((()=>{c(s)}),200)}),[c,s,u]),u?(0,Ls.jsx)(Ls.Fragment,{}):(0,Ls.jsxs)("section",{className:Gs("interrupt"),"aria-labelledby":a,children:[(0,Ls.jsx)(nl,{}),(0,Ls.jsxs)("div",{className:Gs("interrupt__body"),children:[(0,Ls.jsx)("h2",{id:a,className:Gs("interrupt__title"),children:t}),(0,Ls.jsx)("p",{className:Gs("interrupt__message"),children:n}),r&&o&&(0,Ls.jsx)("div",{className:Gs("interrupt__actions"),children:(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{o&&i[o]&&i[o](),l()},children:r})})]})]})},ol=function({children:e}){const t=dn(As),{isOpen:n}=vs();return t?(0,Ls.jsx)(rl,{}):(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsxs)(Fc,{children:[(0,Ls.jsxs)("div",{className:Gs("chat__container__header"),children:[(0,Ls.jsx)(yc,{}),(0,Ls.jsx)(nl,{})]}),e]}),(0,Ls.jsx)(tl,{}),n&&(0,Ls.jsx)(Dc,{})]})};function sl({event:e}){const[t]=Qa(e);return(0,Ls.jsx)("li",{children:(0,Ls.jsx)(t,{event:e})})}function il({events:e}){return(0,Ls.jsx)("ul",{className:Gs("collapsed-chat-messages"),children:e.map((e=>(0,Ls.jsx)(sl,{event:e},e.payload.id)))})}function al(){const{preChatEvents:e}=xn(),t=dn(As),{isOpen:n}=vs();return t||!e?.length||n?null:(0,Ls.jsx)(il,{events:e})}function cl(){const{t:e}=ys(),t=e("window.chat.continue"),n=(0,ts.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t}}})),[t]);return(0,Ls.jsx)(il,{events:[n]})}const ll=()=>{const e=wn(),t=In(),n=dn(As),r=t&&!n,o=r?t.avatar:e;return o?(0,Ls.jsx)("img",{className:Gs(r?"avatar":"icon"),src:o,alt:""}):(0,Ls.jsx)(hi,{name:"avatar",size:"32",alt:""})},ul=({onClick:e})=>{const t=js(),{t:n}=ys(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),o=Bs(),{isOpen:s}=vs(),i=kn(),a=(0,ts.useCallback)((()=>{e(),o()}),[o,e]);return(0,Ls.jsx)(lc,{isActive:!s,transitionStartState:cc.rendered,children:(0,Ls.jsxs)("button",{className:Gs("window-open-button"),"aria-label":r,"aria-hidden":s,onClick:a,children:[(0,Ls.jsx)(lc,{isActive:!!i,transitionStartState:cc.notRendered,children:(0,Ls.jsx)("span",{className:Gs("message-count"),"aria-hidden":"true",children:i})}),(0,Ls.jsx)(ll,{})]})})},dl=(e,t,n)=>"object"==typeof e?e[t]:n,pl=n.p+"sounds/beep.mp3",hl=!!window.Notification,fl={app:()=>(0,Ls.jsx)(pc,{children:(0,Ls.jsx)(ol,{children:(0,Ls.jsx)(rc,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=es(),{connectWhenInView:t}=xn(),n=dn(Pn),{containerRef:r,isVisible:o}=gs({enabled:t,freezeOnceVisible:!0});return(0,ts.useEffect)((()=>{o&&e(Yo())}),[e,o]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=vs();return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)(lc,{isActive:!n,transitionStartState:cc.rendered,children:(0,Ls.jsxs)("div",{ref:t,className:Gs("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,Ls.jsx)(al,{}),(0,Ls.jsx)(uc,{})]})}),(0,Ls.jsx)(lc,{isActive:n,transitionStartState:cc.rendered,children:(0,Ls.jsx)(pc,{ref:t,children:e&&(0,Ls.jsx)(ol,{children:n&&(0,Ls.jsx)(rc,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=vs(),n=bs(),{continueChat:r,preChat:o}=xn();return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)(ul,{onClick:t}),(0,Ls.jsx)(lc,{isActive:!!o&&!e&&!n,exitAfter:dl(o,"exitAfter"),enterDelay:dl(o,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Ls.jsx)("div",{className:Gs("unstarted-wrapper","unstarted-wrapper--window"),children:(0,Ls.jsx)(al,{})})}),(0,Ls.jsx)(lc,{isActive:r&&!e&&n,exitAfter:dl(r,"exitAfter"),enterDelay:dl(r,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Ls.jsx)("div",{className:Gs("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,Ls.jsx)(cl,{})})}),(0,Ls.jsx)(lc,{isActive:e,transitionStartState:cc.notRendered,children:(0,Ls.jsx)(pc,{children:(0,Ls.jsx)(ol,{children:(0,Ls.jsx)(rc,{})})})})]})}};function ml(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const yl=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=An(),{notificationAudioURL:t}=xn(),[n,r]=(0,ts.useState)(hl?Notification.permission:"default"),[o,s]=(0,ts.useState)(document.visibilityState),i=dn(La),a=(0,ts.useCallback)((async()=>{if(hl&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,ts.useMemo)((()=>"granted"===n),[n]),l=(0,ts.useMemo)((()=>"hidden"===o),[o]);(0,ts.useEffect)((()=>{"default"===n&&e&&a()}),[n,e,a]);const u=(0,ts.useCallback)((async(e,r)=>{if(i&&hl){if("default"===n&&a(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||pl);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=${qc}]`);e&&e.focus()}}}}),[t,n,c,a,i,l]);return(0,ts.useEffect)((()=>{if(!i)return()=>{};function e(){s(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[i]),{permission:n,requestPermission:a,sendNotification:u}})(),[,n]=Us(),r=xn(),o=In(),{proactiveMessages:s}=An(),{isOpen:i,isVisible:a}=vs(),c=Ks(),l=bs(),u=dn(Ia),{body:d}=Hs(u),{userLocale:p}=ys(),h=(0,ts.useRef)(void 0),f=(0,ts.useMemo)((()=>d?"string"==typeof d?ml(d):"text"in d?ml(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?ml(d.prompt?.text):"":""),[d]);(0,ts.useEffect)((()=>{o?.name&&f&&s&&u&&h.current!==u.payload?.id&&(t(o.name,{body:f,icon:o?.avatar}),h.current=u.payload.id)}),[o?.avatar,o?.name,u,f,s,t]);const m=fl[r.layoutMode],y=(0,ts.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),v=(0,ts.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,Ls.jsx)("div",{className:Gs(g),lang:v,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,Ls.jsx)(m,{})}):null},vl=e=>(0,Ls.jsx)(Aa,{...e,children:(0,Ls.jsx)(yl,{})});class gl{constructor(e,n){const{namespace:r="",parentElement:o,...s}=e;this.config={...s,namespace:r},this.namespace=r,this.parentElement=o,this.externalApi=n,this.api=new ee({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=Qo({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(lr(n)),await r.dispatch(Wt()),await r.dispatch(or()),r.dispatch(Fn()),e?(0,o.render)((0,Ls.jsx)(Aa,{eventBus:this.eventBus,store:r,api:this.api,children:(0,Ls.jsx)(e,{})}),this.parentElement):(0,o.render)((0,Ls.jsx)(vl,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,o.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 bl=e=>"object"==typeof e&&"action"in e,xl=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),wl=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(bl).map(xl)).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),!0;case"setContext":const{userLocale:o,contentLocale:s}=t;return this.context.userLocale=o,this.context.contentLocale=s,!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:o}=n||t;if(o?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==o||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,o=Object.values(this._instances);return!n&&o.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),o.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new gl(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},o={...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(o):o}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},_l=()=>{const e=es();return{addEvent:t=>e(Yr(t)),clearEvents:()=>e(Qr()),setHistory:t=>e(go(t)),setEventsRead:t=>e(ho(t)),setLoadedImageEventIds:t=>e(wo(t)),ackEvent:t=>e(Xr(t)),setIsLoading:t=>e(xo(t)),setParticipant:t=>e(_o(t)),setHeaderTitle:t=>e(vo(t)),setHeaderSubTitle:t=>e(yo(t)),resetHistoryLoadedFlag:()=>e(co()),setActiveService:t=>e(uo(t)),initIdleDetachCountdown:t=>e(so(t)),decrementIdleDetachCountdownCounter:()=>e(ro()),stopIdleDetachCountdownCounter:()=>e(Po()),clearIdleDetachCountdown:()=>e(to()),initResumeConversationPrompt:()=>e(io()),clearResumeConversationPrompt:()=>e(no()),setServiceDataItem:t=>e(Eo(t)),setFeatures:t=>e(mo(t)),setFeatureEnabledState:t=>e(fo(t)),clearFeatures:()=>e(eo()),setInitialState:t=>e(bo(t)),setUserSelectedOptions:t=>e(Lo(t)),setUserSelectedOption:t=>e(Oo(t)),showOption:t=>e(Mo(t)),hideOption:()=>e(oo()),setServiceEntryMetadata:t=>e(So(t)),setBlockAutoEntrySwitch:t=>e(po(t)),setActiveEntryType:t=>e(lo(t)),setUserEntryType:t=>e(Io(t)),registerUpload:t=>e(ao(t)),setUploadProgress:t=>e(No(t)),setUploadComplete:t=>e(To(t)),setUploadError:t=>e(ko(t)),clearAllUploads:()=>e(Zr()),setSeamlyContainerElement:t=>e(Co(t))}},Cl=()=>{const{t:e}=ys(),{title:t,subTitle:n}=Cn().headerTitles,r=kn(),{isOpen:o}=vs(),s=In(),i=dn(As),a=wn(),c=s?.avatar??a,l=i?"":n,u=["message-count"];return o&&u.push("message-count__hide"),0===r&&u.push("message-count__empty"),l||!o?(0,Ls.jsxs)("div",{className:Gs("agent-info"),children:[(0,Ls.jsxs)("div",{className:Gs("agent-info__graphic"),children:[c?(0,Ls.jsx)("img",{className:Gs(s?.avatar?"avatar":"icon"),src:c,alt:""}):(0,Ls.jsx)(hi,{name:"avatar",size:"32",alt:""}),(0,Ls.jsx)("span",{className:Gs(u),"aria-hidden":"true",children:r})]}),(0,Ls.jsxs)("div",{className:Gs("agent-info__body"),children:[(0,Ls.jsx)("p",{className:Gs("agent-info__heading"),children:t??e("header.title")}),(0,Ls.jsx)("p",{className:Gs("agent-info__text"),children:l})]})]}):null},El=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:n}=Cn(),r=(0,ts.useRef)(null),{t:o}=ys();return(0,Ls.jsxs)("header",{className:Gs("chat__header"),children:[e,(0,Ls.jsx)("div",{className:Gs("header-controls"),children:(0,Ls.jsx)("button",{type:"button",className:Gs("button","header-controls__collapse"),onClick:t,ref:r,id:n,children:(0,Ls.jsx)(hi,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},Sl=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 wl(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,o){return(t[n]=t[n]||[]).push([r,o]),e},e.off=function(r,o){r||(t={});for(var s=t[r]||n,i=s.length=o?s.length:0;i--;)o==s[i][0]&&s.splice(i,1);return e},e.emit=function(r){for(var o,s=t[r]||n,i=s.length>0?s.slice(0,s.length):s,a=0;o=i[a++];)o[0].apply(o[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:()=>ee,Suspense:()=>b,SuspenseList:()=>_,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>J,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>q,createPortal:()=>j,createRef:()=>r.createRef,default:()=>ce,findDOMNode:()=>Y,flushSync:()=>Q,forwardRef:()=>p,hydrate:()=>L,isElement:()=>se,isFragment:()=>K,isValidElement:()=>G,lazy:()=>w,memo:()=>l,render:()=>O,startTransition:()=>te,unmountComponentAtNode:()=>X,unstable_batchedUpdates:()=>Z,useDeferredValue:()=>ne,useInsertionEffect:()=>oe,useSyncExternalStore:()=>ie,useTransition:()=>re,version:()=>W});var r=n(8785),o=n(1162),s={};for(const e in o)["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","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(s[e]=()=>o[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 o(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}n.d(t,s),(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 o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__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,o;function s(s){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){o=e})),o)throw o;if(!n)throw t;return(0,r.createElement)(n,s)}return s.displayName="Lazy",s.__f=!0,s}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 o=x(r.__v),s=!1,i=function(){s||(s=!0,n.__R=null,o?o(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"),o=this.__v.__k[0].__c;this.__v.__k[0]=v(this.__b,n,o.__O=o.__P)}this.__b=null}var s=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return s&&(s.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),s]};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(o){var s=function(){t.props.revealOrder?(r.push(o),C(t,e,r)):o()};n?n(s):s()}},_.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,o={};for(var s in t){var i=t[s];if(!("value"===s&&"defaultValue"in t&&null==i||R&&"children"===s&&"noscript"===n||"class"===s||"className"===s)){var a=s.toLowerCase();"defaultValue"===s&&"value"in t&&null==t.value?s="value":"download"===s&&!0===i?i="":"translate"===a&&"no"===i?i=!1:"ondoubleclick"===a?s="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||I(t.type)?"onfocus"===a?s="onfocusin":"onblur"===a?s="onfocusout":N.test(s)?s=a:-1===n.indexOf("-")&&k.test(s)?s=s.replace(A,"-$&").toLowerCase():null===i&&(i=void 0):a=s="oninput","oninput"===a&&o[s=a]&&(s="oninputCapture"),o[s]=i}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==n&&null!=o.defaultValue&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",B)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(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}}}},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 G(e)?r.cloneElement.apply(null,arguments):e}function X(e){return!!e.__k&&((0,r.render)(null,e),!0)}function Y(e){return e&&(e.base||1===e.nodeType&&e)||null}var Z=function(e,t){return e(t)},Q=function(e,t){return e(t)},ee=r.Fragment;function te(e){e()}function ne(e){return e}function re(){return[!1,te]}var oe=o.useLayoutEffect,se=G;function ie(e,t){var n=t(),r=(0,o.useState)({h:{__:n,v:t}}),s=r[0].h,i=r[1];return(0,o.useLayoutEffect)((function(){s.__=n,s.v=t,ae(s)&&i({h:s})}),[e,n,t]),(0,o.useEffect)((function(){return ae(s)&&i({h:s}),e((function(){ae(s)&&i({h:s})}))}),[e]),n}function ae(e){var t,n,r=e.v,o=e.__;try{var s=r();return!((t=o)===(n=s)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var ce={useState:o.useState,useId:o.useId,useReducer:o.useReducer,useEffect:o.useEffect,useLayoutEffect:o.useLayoutEffect,useInsertionEffect:oe,useTransition:re,useDeferredValue:ne,useSyncExternalStore:ie,startTransition:te,useRef:o.useRef,useImperativeHandle:o.useImperativeHandle,useMemo:o.useMemo,useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,version:"17.0.2",Children:f,render:O,hydrate:L,unmountComponentAtNode:X,createPortal:j,createElement:r.createElement,createContext:r.createContext,createFactory:q,cloneElement:J,createRef:r.createRef,Fragment:r.Fragment,isValidElement:G,isElement:se,isFragment:K,findDOMNode:Y,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:Q,unstable_batchedUpdates:Z,StrictMode:ee,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),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=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,s=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,o(s,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(s=e,i=n)}var s,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=s(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),o=n(6823),s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not a function")}},3506:(e,t,n)=>{"use strict";var r=n(3925),o=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s("Can't set "+o(e)+" as a prototype")}},6469:(e,t,n)=>{"use strict";var r=n(8227),o=n(2360),s=n(4913).f,i=r("unscopables"),a=Array.prototype;void 0===a[i]&&s(a,i,{configurable:!0,value:o(null)}),e.exports=function(e){a[i][e]=!0}},679:(e,t,n)=>{"use strict";var r=n(1625),o=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new o("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),o=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not an object")}},7811:e=>{"use strict";e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},4644:(e,t,n)=>{"use strict";var r,o,s,i=n(7811),a=n(3724),c=n(4475),l=n(4901),u=n(34),d=n(9297),p=n(6955),h=n(6823),f=n(6699),m=n(6840),y=n(2106),v=n(1625),g=n(2787),b=n(2967),x=n(8227),w=n(3392),_=n(1181),C=_.enforce,E=_.get,S=c.Int8Array,j=S&&S.prototype,T=c.Uint8ClampedArray,k=T&&T.prototype,N=S&&g(S),A=j&&g(j),R=Object.prototype,I=c.TypeError,O=x("toStringTag"),L=w("TYPED_ARRAY_TAG"),M="TypedArrayConstructor",P=i&&!!b&&"Opera"!==p(c.opera),D=!1,U={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},F={BigInt64Array:8,BigUint64Array:8},B=function(e){var t=g(e);if(u(t)){var n=E(t);return n&&d(n,M)?n[M]:B(t)}},z=function(e){if(!u(e))return!1;var t=p(e);return d(U,t)||d(F,t)};for(r in U)(s=(o=c[r])&&o.prototype)?C(s)[M]=o:P=!1;for(r in F)(s=(o=c[r])&&o.prototype)&&(C(s)[M]=o);if((!P||!l(N)||N===Function.prototype)&&(N=function(){throw new I("Incorrect invocation")},P))for(r in U)c[r]&&b(c[r],N);if((!P||!A||A===R)&&(A=N.prototype,P))for(r in U)c[r]&&b(c[r].prototype,A);if(P&&g(k)!==A&&b(k,A),a&&!d(A,O))for(r in D=!0,y(A,O,{configurable:!0,get:function(){return u(this)?this[L]:void 0}}),U)c[r]&&f(c[r],L,r);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_TAG:D&&L,aTypedArray:function(e){if(z(e))return e;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(e){if(l(e)&&(!b||v(N,e)))return e;throw new I(h(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(a){if(n)for(var o in U){var s=c[o];if(s&&d(s.prototype,e))try{delete s.prototype[e]}catch(n){try{s.prototype[e]=t}catch(e){}}}A[e]&&!n||m(A,e,n?t:P&&j[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,o;if(a){if(b){if(n)for(r in U)if((o=c[r])&&d(o,e))try{delete o[e]}catch(e){}if(N[e]&&!n)return;try{return m(N,e,n?t:P&&N[e]||t)}catch(e){}}for(r in U)!(o=c[r])||o[e]&&!n||m(o,e,t)}},getTypedArrayConstructor:B,isView:function(e){if(!u(e))return!1;var t=p(e);return"DataView"===t||d(U,t)||d(F,t)},isTypedArray:z,TypedArray:N,TypedArrayPrototype:A}},5370:(e,t,n)=>{"use strict";var r=n(6198);e.exports=function(e,t,n){for(var o=0,s=arguments.length>2?n:r(t),i=new e(s);s>o;)i[o]=t[o++];return i}},9617:(e,t,n)=>{"use strict";var r=n(5397),o=n(5610),s=n(6198),i=function(e){return function(t,n,i){var a=r(t),c=s(a);if(0===c)return!e&&-1;var l,u=o(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),o=n(4376),s=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(o(e)&&!i(e,"length").writable)throw new s("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},7628:(e,t,n)=>{"use strict";var r=n(6198);e.exports=function(e,t){for(var n=r(e),o=new t(n),s=0;s<n;s++)o[s]=e[n-s-1];return o}},9928:(e,t,n)=>{"use strict";var r=n(6198),o=n(1291),s=RangeError;e.exports=function(e,t,n,i){var a=r(e),c=o(n),l=c<0?a+c:c;if(l>=a||l<0)throw new s("Incorrect index");for(var u=new t(a),d=0;d<a;d++)u[d]=d===l?i:e[d];return u}},4576:(e,t,n)=>{"use strict";var r=n(9504),o=r({}.toString),s=r("".slice);e.exports=function(e){return s(o(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),o=n(4901),s=n(4576),i=n(8227)("toStringTag"),a=Object,c="Arguments"===s(function(){return arguments}());e.exports=r?s: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?s(t):"Object"===(r=s(t))&&o(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),o=n(5031),s=n(7347),i=n(4913);e.exports=function(e,t,n){for(var a=o(t),c=i.f,l=s.f,u=0;u<a.length;u++){var d=a[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},2211:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},6699:(e,t,n)=>{"use strict";var r=n(3724),o=n(4913),s=n(6980);e.exports=r?function(e,t,n){return o.f(e,t,s(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}}},2106:(e,t,n)=>{"use strict";var r=n(283),o=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),o.f(e,t,n)}},6840:(e,t,n)=>{"use strict";var r=n(4901),o=n(4913),s=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)&&s(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:o.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),o=Object.defineProperty;e.exports=function(e,t){try{o(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),o=n(34),s=r.document,i=o(s)&&o(s.createElement);e.exports=function(e){return i?s.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,o,s=n(4475),i=n(9392),a=s.process,c=s.Deno,l=a&&a.versions||c&&c.version,u=l&&l.v8;u&&(o=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},7015:(e,t,n)=>{"use strict";var r=n(4475),o=n(9504);e.exports=function(e,t){return o(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),o=Error,s=r("".replace),i=String(new o("zxcasd").stack),a=/\n\s*at [^:]*:[^\n]*/,c=a.test(i);e.exports=function(e,t){if(c&&"string"==typeof e&&!o.prepareStackTrace)for(;t--;)e=s(e,a,"");return e}},6518:(e,t,n)=>{"use strict";var r=n(4475),o=n(7347).f,s=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=o(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)&&s(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),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),o=n(9297),s=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,a=o(s,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&i(s,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},6706:(e,t,n)=>{"use strict";var r=n(9504),o=n(9306);e.exports=function(e,t,n){try{return r(o(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},9504:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype,s=o.call,i=r&&o.bind.bind(s,s);e.exports=r?i:function(e){return function(){return s.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4475),o=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],o(n)?n:void 0):r[e]&&r[e][t];var n}},5966:(e,t,n)=>{"use strict";var r=n(9306),o=n(4117);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(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),o=n(8981),s=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return s(o(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),o=n(9039),s=n(4055);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),o=n(9039),s=n(4576),i=Object,a=r("".split);e.exports=o((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"===s(e)?a(e,""):i(e)}:i},3167:(e,t,n)=>{"use strict";var r=n(4901),o=n(34),s=n(2967);e.exports=function(e,t,n){var i,a;return s&&r(i=t.constructor)&&i!==n&&o(a=i.prototype)&&a!==n.prototype&&s(e,a),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),o=n(4901),s=n(7629),i=r(Function.toString);o(s.inspectSource)||(s.inspectSource=function(e){return i(e)}),e.exports=s.inspectSource},1181:(e,t,n)=>{"use strict";var r,o,s,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},o=function(e){return v.get(e)||{}},s=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},o=function(e){return u(e,g)?e[g]:{}},s=function(e){return u(e,g)}}e.exports={set:r,get:o,has:s,enforce:function(e){return s(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(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)}},1108:(e,t,n)=>{"use strict";var r=n(6955);e.exports=function(e){var t=r(e);return"BigInt64Array"===t||"BigUint64Array"===t}},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),o=n(4901),s=/#|\.prototype\./,i=function(e,t){var n=c[a(e)];return n===u||n!==l&&(o(t)?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(s,".").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),o=n(4901),s=n(1625),i=n(7040),a=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&s(t.prototype,a(e))}},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),o=n(9039),s=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&&!o((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 s(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,o=n(8551),s=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 o=i.length;o--;)delete v[d][i[o]];return v()};a[h]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(f[d]=o(e),n=new f,f[d]=null,n[h]=e):n=v(),void 0===t?n:s.f(n,t)}},6801:(e,t,n)=>{"use strict";var r=n(3724),o=n(8686),s=n(4913),i=n(8551),a=n(5397),c=n(1072);t.f=r&&!o?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),o=c(t),l=o.length,u=0;l>u;)s.f(e,n=o[u++],r[n]);return e}},4913:(e,t,n)=>{"use strict";var r=n(3724),o=n(5917),s=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?s?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),o)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),o=n(9565),s=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(!o(s.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},2787:(e,t,n)=>{"use strict";var r=n(9297),o=n(4901),s=n(8981),i=n(6119),a=n(2211),c=i("IE_PROTO"),l=Object,u=l.prototype;e.exports=a?l.getPrototypeOf:function(e){var t=s(e);if(r(t,c))return t[c];var n=t.constructor;return o(n)&&t instanceof n?n.prototype:t instanceof l?u:null}},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),o=n(9297),s=n(5397),i=n(9617).indexOf,a=n(421),c=r([].push);e.exports=function(e,t){var n,r=s(e),l=0,u=[];for(n in r)!o(a,n)&&o(r,n)&&c(u,n);for(;t.length>l;)o(r,n=t[l++])&&(~i(u,n)||c(u,n));return u}},1072:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727);e.exports=Object.keys||function(e){return r(e,o)}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),o=n(8551),s=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),s(r),t?e(n,r):n.__proto__=r,n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),o=n(4901),s=n(34),i=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&o(n=e.toString)&&!s(a=r(n,e)))return a;if(o(n=e.valueOf)&&!s(a=r(n,e)))return a;if("string"!==t&&o(n=e.toString)&&!s(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),o=n(9504),s=n(8480),i=n(3717),a=n(8551),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=s.f(a(e)),n=i.f;return n?c(t,n(e)):t}},7750:(e,t,n)=>{"use strict";var r=n(4117),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},6119:(e,t,n)=>{"use strict";var r=n(5745),o=n(3392),s=r("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),o=n(4475),s=n(9433),i="__core-js_shared__",a=e.exports=o[i]||s(i,{});(a.versions||(a.versions=[])).push({version:"3.36.0",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.0/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),o=n(9039),s=n(4475).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:(e,t,n)=>{"use strict";var r=n(1291),o=Math.max,s=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):s(n,t)}},5854:(e,t,n)=>{"use strict";var r=n(2777),o=TypeError;e.exports=function(e){var t=r(e,"number");if("number"==typeof t)throw new o("Can't convert number to bigint");return BigInt(t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),o=n(7750);e.exports=function(e){return r(o(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),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),o=Object;e.exports=function(e){return o(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),o=n(34),s=n(757),i=n(5966),a=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var n,c=i(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||s(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),o=n(757);e.exports=function(e){var t=r(e,"string");return o(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),o=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return o(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),o=0,s=Math.random(),i=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++o+s,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),o=n(9039);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},2812:e=>{"use strict";var t=TypeError;e.exports=function(e,n){if(e<n)throw new t("Not enough arguments");return e}},8622:(e,t,n)=>{"use strict";var r=n(4475),o=n(4901),s=r.WeakMap;e.exports=o(s)&&/native code/.test(String(s))},8227:(e,t,n)=>{"use strict";var r=n(4475),o=n(5745),s=n(9297),i=n(3392),a=n(4495),c=n(7040),l=r.Symbol,u=o("wks"),d=c?l.for||l:l&&l.withoutSetter||i;e.exports=function(e){return s(u,e)||(u[e]=a&&s(l,e)?l[e]:d("Symbol."+e)),u[e]}},8107:(e,t,n)=>{"use strict";var r=n(6518),o=n(8981),s=n(6198),i=n(1291),a=n(6469);r({target:"Array",proto:!0},{at:function(e){var t=o(this),n=s(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),o=n(8981),s=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=o(this),n=s(t),r=arguments.length;a(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return i(t,n),n}})},7467:(e,t,n)=>{"use strict";var r=n(7628),o=n(4644),s=o.aTypedArray,i=o.exportTypedArrayMethod,a=o.getTypedArrayConstructor;i("toReversed",(function(){return r(s(this),a(this))}))},4732:(e,t,n)=>{"use strict";var r=n(4644),o=n(9504),s=n(9306),i=n(5370),a=r.aTypedArray,c=r.getTypedArrayConstructor,l=r.exportTypedArrayMethod,u=o(r.TypedArrayPrototype.sort);l("toSorted",(function(e){void 0!==e&&s(e);var t=a(this),n=i(c(t),t);return u(n,e)}))},9577:(e,t,n)=>{"use strict";var r=n(9928),o=n(4644),s=n(1108),i=n(1291),a=n(5854),c=o.aTypedArray,l=o.getTypedArrayConstructor,u=o.exportTypedArrayMethod,d=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}();u("with",{with:function(e,t){var n=c(this),o=i(e),u=s(n)?a(t):+t;return r(n,l(n),o,u)}}.with,!d)},4979:(e,t,n)=>{"use strict";var r=n(6518),o=n(4475),s=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=s("Error"),g=s(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),o=new v(t);return o.name=y,a(r,"stack",i(1,h(o.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(o,y),E=!(!C||C.writable&&C.configurable),S=w&&!E&&!_;r({global:!0,constructor:!0,forced:m||S},{DOMException:S?b:g});var j=s(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))}},4603:(e,t,n)=>{"use strict";var r=n(6840),o=n(9504),s=n(655),i=n(2812),a=URLSearchParams,c=a.prototype,l=o(c.append),u=o(c.delete),d=o(c.forEach),p=o([].push),h=new a("a=1&a=2&b=3");h.delete("a",1),h.delete("b",void 0),h+""!="a=2"&&r(c,"delete",(function(e){var t=arguments.length,n=t<2?void 0:arguments[1];if(t&&void 0===n)return u(this,e);var r=[];d(this,(function(e,t){p(r,{key:t,value:e})})),i(t,1);for(var o,a=s(e),c=s(n),h=0,f=0,m=!1,y=r.length;h<y;)o=r[h++],m||o.key===a?(m=!0,u(this,o.key)):f++;for(;f<y;)(o=r[f++]).key===a&&o.value===c||l(this,o.key,o.value)}),{enumerable:!0,unsafe:!0})},7566:(e,t,n)=>{"use strict";var r=n(6840),o=n(9504),s=n(655),i=n(2812),a=URLSearchParams,c=a.prototype,l=o(c.getAll),u=o(c.has),d=new a("a=1");!d.has("a",2)&&d.has("a",void 0)||r(c,"has",(function(e){var t=arguments.length,n=t<2?void 0:arguments[1];if(t&&void 0===n)return u(this,e);var r=l(this,e);i(t,1);for(var o=s(n),a=0;a<r.length;)if(r[a++]===o)return!0;return!1}),{enumerable:!0,unsafe:!0})},8721:(e,t,n)=>{"use strict";var r=n(3724),o=n(9504),s=n(2106),i=URLSearchParams.prototype,a=o(i.forEach);r&&!("size"in i)&&s(i,"size",{get:function(){var e=0;return a(this,(function(){e++})),e},configurable:!0,enumerable:!0})}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.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 o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].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:()=>ee,AgentInfo:()=>Cl,Chat:()=>pc,ChatFrame:()=>ol,ComponentFilter:()=>ga,Conversation:()=>rc,Engine:()=>gl,EntryContainer:()=>tl,EventParticipant:()=>ci,ExternalApi:()=>wl,Header:()=>El,Icon:()=>hi,Interrupt:()=>rl,MessageContainer:()=>li,SeamlyActivityMonitor:()=>ba,SeamlyApiContext:()=>xs,SeamlyEventBusContext:()=>ws,SeamlyFileUpload:()=>_a,SeamlyGeneralError:()=>c,SeamlyLiveRegionContext:()=>_s,SeamlyOfflineError:()=>vr,SeamlyStoreProvider:()=>fn,Text:()=>ha,View:()=>yl,calculateVisibility:()=>Yt,className:()=>Gs,default:()=>Sl,eventTypes:()=>Bn,randomId:()=>m,useChoicePrompt:()=>_i,useEvents:()=>jn,useGeneratedId:()=>ii,useI18n:()=>ys,useSeamlyActions:()=>_l,useSeamlyChat:()=>Is,useSeamlyCommands:()=>Ts,useSeamlyConfig:()=>xn,useSeamlyEventStream:()=>ai,useSeamlyIdleDetachCountdown:()=>oi,useSeamlyMessageContainerClassNames:()=>Js,useSeamlyOptions:()=>ei,useSeamlyVisibility:()=>vs,useTranslatedEventData:()=>Hs,useTranslations:()=>$s,useTranslationsContainer:()=>Vs,visibilityStates:()=>Jt}),n(9497),n(4114);var e=n(2086),t=n.n(e),o=n(8785);n(4603),n(7566),n(8721);class s 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 o=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,o||e.apply(this,r),o=!1}),t),t=>{o=!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}n(7467),n(4732),n(9577),n(4979);var T=e=>"function"==typeof e?e:function(){return e},k="undefined"!=typeof self?self:null,N="undefined"!=typeof window?window:null,A=k||N||A,R="closed",I="errored",O="joined",L="joining",M="leaving",P="phx_close",D="phx_error",U="phx_reply",F="phx_leave",B="websocket",z=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})}},$=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))}},H=class{constructor(e,t,n){this.state=R,this.topic=e,this.params=T(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new z(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new $((()=>{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=O,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=I,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=R,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=I,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 z(this,F,T({}),this.timeout).send(),this.state=I,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(U,((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(P,e)}onError(e){return this.on(D,(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 z(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=M;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(P,"leave")},n=new z(this,F,T({}),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=L,this.joinPush.resend(e))}trigger(e,t,n,r){let o=this.onMessage(e,t,n,r);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter((t=>t.event===e));for(let e=0;e<s.length;e++)s[e].callback(o,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===R}isErrored(){return this.state===I}isJoined(){return this.state===O}isJoining(){return this.state===L}isLeaving(){return this.state===M}},V=class{static request(e,t,n,r,o,s,i){if(A.XDomainRequest){let n=new A.XDomainRequest;return this.xdomainRequest(n,e,t,r,o,s,i)}{let a=new A.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,o,s,i)}}static xdomainRequest(e,t,n,r,o,s,i){return e.timeout=o,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);i&&i(t)},s&&(e.ontimeout=s),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,o,s,i,a){return e.open(t,n,!0),e.timeout=s,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(o),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 o=t?`${t}[${r}]`:r,s=e[r];"object"==typeof s?n.push(this.serialize(s,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(s))}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)}`}},W=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("(.*)/"+B),"$1/longpoll")}endpointURL(){return V.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,o){let s;s=V.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(s),r()}),(e=>{this.reqs.delete(s),this.isActive()&&o(e)})),this.reqs.add(s)}},q={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,o,s,i]=JSON.parse(e);return t({join_ref:n,ref:r,topic:o,event:s,payload:i})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:o,payload:s}=e,i=this.META_LENGTH+t.length+n.length+o.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++,o.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(o,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(a.byteLength+s.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(s),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),o=t.getUint8(2),s=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+o));i+=o;let l=n.decode(e.slice(i,i+s));return i+=s,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(i,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),s=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+o));a+=o;let u=n.decode(e.slice(a,a+s));a+=s;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:U,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),s=this.HEADER_LENGTH+2,i=n.decode(e.slice(s,s+r));s+=r;let a=n.decode(e.slice(s,s+o));return s+=o,{join_ref:null,ref:null,topic:i,event:a,payload:e.slice(s,e.byteLength)}}},G=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||A.WebSocket||W,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||A.sessionStorage,this.establishedConnections=0,this.defaultEncoder=q.encode.bind(q),this.defaultDecoder=q.decode.bind(q),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==W?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;N&&N.addEventListener&&(N.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),N.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=T(t.params||{}),this.endPoint=`${e}/${B}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new $((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return W}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=V.appendParams(V.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=T(e)),this.conn||(this.longPollFallbackMs&&this.transport!==W?this.connectWithFallback(W,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((o=>{o.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,o=!0,s=t=>{this.log("transport",`falling back to ${e.name}...`,t),this.off([void 0,n]),o=!1,this.storeSession("phx:longpoll","true"),this.replaceTransport(e),this.transportConnect()};if(this.getSession("phx:longpoll"))return s("memorized");this.fallbackTimer=setTimeout(s,t),n=this.onError((e=>{this.log("transport","error",e),o&&!r&&(clearTimeout(this.fallbackTimer),s(e))})),this.onOpen((()=>{if(r=!0,!o)return console.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(s,t),this.ping((e=>{this.log("transport","connected to primary after",e),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(D)}))}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.joinRef()!==e.joinRef()))}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 H(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:o,join_ref:s}=e;this.log("push",`${t} ${n} (${s}, ${o})`,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:o,join_ref:s}=e;o&&o===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${o&&"("+o+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const i=this.channels[e];i.isMember(t,n,r,s)&&i.trigger(n,r,o,s)}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 K=()=>null,J=new Set;class X{#e=[];async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o,params:s}=(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 G(o,{params:{...s,v:"3"},reconnectAfterMs:e=>{const t=2**e*250;return Math.min(t,1e4)}}),this.socket.onError((e=>{K("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{K("[SOCKET]OPEN")})),this.socket.onClose((()=>{K("[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((()=>{K("[CHANNEL]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{K("[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",(()=>{K("[CHANNEL][JOIN] OK"),this.#t({connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{K("[CHANNEL][JOIN] ERROR",e),this.#t({connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{K("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){this.channel?.leave().receive("ok",(()=>{this.socket?.disconnect(),K("[CHANNEL][LEAVE] OK"),this.#e=[]}))}#n(...e){e.forEach((e=>{this.channel?.on(e,(t=>{K("[RECEIVE]",e,t)}))}))}onConnection(e){this.#e.push(e)}#t(e){this.#e=this.#e.filter((t=>!t(e))),J.forEach((e=>e()))}pushToChannel(e,t,n=1e4){this.channel?.push(e,t,n)}static subscribe(e){return J.add(e),()=>J.delete(e)}}const Y=()=>null,Z=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 s(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function Q(){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 ee{#r;#o;#s;#i="window";#a;conversation=new X;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.#o=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.#s=await this.#a.getConversationAuthToken());const e=await Z(`${this.#f("http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#s?void 0:this.#o,token:this.#s})}),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 Z(`${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 Z(`${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:o,activeServiceSettings:s,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:o,activeServiceSettings:s,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 s(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 o=new FormData;o.append("upload",e);const s=new XMLHttpRequest;return s.open("POST",`${this.#f("http")}${this.URLS.uploads}`),s.setRequestHeader("Authorization",`Bearer ${this.#c()}`),s.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},s.onloadend=()=>{if(0!==s.status)if(200!==s.status&&201!==s.status||!n){if(!r)throw new Error(s.response);try{r(JSON.parse(s.response))}catch(e){r(s.response)}}else try{n(JSON.parse(s.response))}catch(e){n(s.response)}},s.send(o),s}async getConversationIntitialState(){try{const n=await Z(`${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 Z(n,{method:"GET"});return(await r.json()).translations}catch(e){if(e.status>=500)throw new c(e);throw new s(e)}}send(e,t=void 0,n=!0){!this.connected||n&&!this.#r?this.conversation?.onConnection((({connected:r,ready:o})=>(this.connected=r,this.#r=o,!!(n?o:r)&&(this.send(e,t,n),!0)))):(Y("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:o}=t;return o||(o=m()),{type:n,body:r,transactionId:o}}(e,t),1e4))}sendContext(e){const{contentLocale:t,userLocale:n,variables:r,environment:o}=e,s={};if(o&&(s.environment=o),t){if("string"!=typeof t)throw new Error("Content locale must be a string");s.contentLocale=t}if(n){if("string"!=typeof n)throw new Error("User locale must be a string");s.userLocale=n}if(r){if("object"!=typeof r)throw new Error("Variables must be an object");s.variables=r}0===Object.keys(s).length&&s.constructor===Object||this.send("context",s,!1)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#i,clientVersion:"23.0.4-beta.1",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:Q(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}var te=Symbol.for("immer-nothing"),ne=Symbol.for("immer-draftable"),re=Symbol.for("immer-state");function oe(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var se=Object.getPrototypeOf;function ie(e){return!!e&&!!e[re]}function ae(e){return!!e&&(le(e)||Array.isArray(e)||!!e[ne]||!!e.constructor?.[ne]||fe(e)||me(e))}var ce=Object.prototype.constructor.toString();function le(e){if(!e||"object"!=typeof e)return!1;const t=se(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)===ce}function ue(e,t){0===de(e)?Object.entries(e).forEach((([n,r])=>{t(n,r,e)})):e.forEach(((n,r)=>t(r,n,e)))}function de(e){const t=e[re];return t?t.type_:Array.isArray(e)?1:fe(e)?2:me(e)?3:0}function pe(e,t){return 2===de(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function he(e,t,n){const r=de(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function fe(e){return e instanceof Map}function me(e){return e instanceof Set}function ye(e){return e.copy_||e.base_}function ve(e,t){if(fe(e))return new Map(e);if(me(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&le(e)){if(!se(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[re];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],s=n[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(se(e),n)}function ge(e,t=!1){return xe(e)||ie(e)||!ae(e)||(de(e)>1&&(e.set=e.add=e.clear=e.delete=be),Object.freeze(e),t&&ue(e,((e,t)=>ge(t,!0)))),e}function be(){oe(2)}function xe(e){return Object.isFrozen(e)}var we,_e={};function Ce(e){const t=_e[e];return t||oe(0),t}function Ee(){return we}function Se(e,t){t&&(Ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function je(e){Te(e),e.drafts_.forEach(Ne),e.drafts_=null}function Te(e){e===we&&(we=e.parent_)}function ke(e){return we={drafts_:[],parent_:we,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ne(e){const t=e[re];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ae(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[re].modified_&&(je(t),oe(4)),ae(e)&&(e=Re(t,e),t.parent_||Oe(t,e)),t.patches_&&Ce("Patches").generateReplacementPatches_(n[re].base_,e,t.patches_,t.inversePatches_)):e=Re(t,n,[]),je(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==te?e:void 0}function Re(e,t,n){if(xe(t))return t;const r=t[re];if(!r)return ue(t,((o,s)=>Ie(e,r,t,o,s,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Oe(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,s=!1;3===r.type_&&(o=new Set(t),t.clear(),s=!0),ue(o,((o,i)=>Ie(e,r,t,o,i,n,s))),Oe(e,t,!1),n&&e.patches_&&Ce("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ie(e,t,n,r,o,s,i){if(ie(o)){const i=Re(e,o,s&&t&&3!==t.type_&&!pe(t.assigned_,r)?s.concat(r):void 0);if(he(n,r,i),!ie(i))return;e.canAutoFreeze_=!1}else i&&n.add(o);if(ae(o)&&!xe(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Re(e,o),t&&t.scope_.parent_||Oe(e,o)}}function Oe(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ge(t,n)}var Le={get(e,t){if(t===re)return e;const n=ye(e);if(!pe(n,t))return function(e,t,n){const r=De(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_||!ae(r)?r:r===Pe(e.base_,t)?(Fe(e),e.copy_[t]=Be(r,e)):r},has:(e,t)=>t in ye(e),ownKeys:e=>Reflect.ownKeys(ye(e)),set(e,t,n){const r=De(ye(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Pe(ye(e),t),i=r?.[re];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)&&(void 0!==n||pe(e.base_,t)))return!0;Fe(e),Ue(e)}var o,s;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!==Pe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Fe(e),Ue(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ye(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){oe(11)},getPrototypeOf:e=>se(e.base_),setPrototypeOf(){oe(12)}},Me={};function Pe(e,t){const n=e[re];return(n?ye(n):e)[t]}function De(e,t){if(!(t in e))return;let n=se(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=se(n)}}function Ue(e){e.modified_||(e.modified_=!0,e.parent_&&Ue(e.parent_))}function Fe(e){e.copy_||(e.copy_=ve(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Be(e,t){const n=fe(e)?Ce("MapSet").proxyMap_(e,t):me(e)?Ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ee(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,s=Le;n&&(o=[r],s=Me);const{revoke:i,proxy:a}=Proxy.revocable(o,s);return r.draft_=a,r.revoke_=i,a}(e,t);return(t?t.scope_:Ee()).drafts_.push(n),n}function ze(e){return ie(e)||oe(10),$e(e)}function $e(e){if(!ae(e)||xe(e))return e;const t=e[re];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ve(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ve(e,!0);return ue(n,((e,t)=>{he(n,e,$e(t))})),t&&(t.finalized_=!1),n}ue(Le,((e,t)=>{Me[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Me.deleteProperty=function(e,t){return Me.set.call(this,e,t,void 0)},Me.set=function(e,t,n){return Le.set.call(this,e[0],t,n,e[0])};var He=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,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&oe(6),void 0!==n&&"function"!=typeof n&&oe(7),ae(e)){const o=ke(this),s=Be(e,void 0);let i=!0;try{r=t(s),i=!1}finally{i?je(o):Te(o)}return Se(o,n),Ae(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===te&&(r=void 0),this.autoFreeze_&&ge(r,!0),n){const t=[],o=[];Ce("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}oe(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){ae(e)||oe(8),ie(e)&&(e=ze(e));const t=ke(this),n=Be(e,void 0);return n[re].isManual_=!0,Te(t),n}finishDraft(e,t){const n=e&&e[re];n&&n.isManual_||oe(9);const{scope_:r}=n;return Se(r,t),Ae(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=Ce("Patches").applyPatches_;return ie(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Ve=He.produce;He.produceWithPatches.bind(He),He.setAutoFreeze.bind(He),He.setUseStrictShallowCopy.bind(He),He.applyPatches.bind(He),He.createDraft.bind(He),He.finishDraft.bind(He);var We=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var qe="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},Ge=0,Ke=1;function Je(){return{s:Ge,v:void 0,o:null,p:null}}function Xe(e,t={}){let n=Je();const{resultEqualityCheck:r}=t;let o,s=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=Je(),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=Je(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===Ke?c=t.v:(c=e.apply(null,arguments),s++),a.s=Ke,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==s&&s--),o="object"==typeof c&&null!==c||"function"==typeof c?new qe(c):c}return a.v=c,c}return i.clearCache=()=>{n=Je(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Ye(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,s={},i=e.pop();"object"==typeof i&&(s=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,...s},{memoize:c,memoizeOptions:l=[],argsMemoize:u=Xe,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,h=We(l),f=We(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(){o++;const e=function(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].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:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var Ze=Ye(Xe),Qe=Object.assign(((e,t=Ze)=>{!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:()=>Qe});function et(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 tt=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),nt=()=>Math.random().toString(36).substring(7).split("").join("."),rt={INIT:`@@redux/INIT${nt()}`,REPLACE:`@@redux/REPLACE${nt()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${nt()}`};function ot(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 st(e,t,n){if("function"!=typeof e)throw new Error(et(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(et(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(et(1));return n(st)(e,t)}let r=e,o=t,s=new Map,i=s,a=0,c=!1;function l(){i===s&&(i=new Map,s.forEach(((e,t)=>{i.set(t,e)})))}function u(){if(c)throw new Error(et(3));return o}function d(e){if("function"!=typeof e)throw new Error(et(4));if(c)throw new Error(et(5));let t=!0;l();const n=a++;return i.set(n,e),function(){if(t){if(c)throw new Error(et(6));t=!1,l(),i.delete(n),s=null}}}function p(e){if(!ot(e))throw new Error(et(7));if(void 0===e.type)throw new Error(et(8));if("string"!=typeof e.type)throw new Error(et(17));if(c)throw new Error(et(9));try{c=!0,o=r(o,e)}finally{c=!1}return(s=i).forEach((e=>{e()})),e}return p({type:rt.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(et(10));r=e,p({type:rt.REPLACE})},[tt]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(et(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[tt](){return this}}}}}function it(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:rt.INIT}))throw new Error(et(12));if(void 0===n(void 0,{type:rt.PROBE_UNKNOWN_ACTION()}))throw new Error(et(13))}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;let s=!1;const i={};for(let o=0;o<r.length;o++){const a=r[o],c=n[a],l=e[a],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(et(14));i[a]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?i:e}}function at(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function ct(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var lt=ct(),ut=ct,dt=(((...e)=>{const t=Ye(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(ie(e)?ze(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(Xe),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?at:at.apply(null,arguments)}),pt=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function ht(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(Ht(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 ot(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var ft=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 mt(e){return ae(e)?Ve(e,(()=>{})):e}function yt(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(Ht(10));const r=n.insert(t,e);return e.set(t,r),r}var vt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let s=new ft;return t&&("boolean"==typeof t?s.push(lt):s.push(ut(t.extraArgument))),s},gt=e=>t=>{setTimeout(t,e)},bt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:gt(10),xt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new ft(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,s=!1,i=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?bt:"callback"===e.type?e.queueNotification:gt(e.timeout),l=()=>{i=!1,s&&(s=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>o&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,s=!o,s&&(i||(i=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r},wt=!0;function _t(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(Ht(28));if(r in t)throw new Error(Ht(29));return t[r]=n,o},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),o),addDefaultCase:e=>(r=e,o)};return e(o),[t,n,r]}var Ct=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Et(...e){return t=>e.some((e=>((e,t)=>pt(e)?e.match(t):e(t))(e,t)))}var St=["name","message","stack","code"],jt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Tt=class{constructor(e,t){this.payload=e,this.meta=t}_type},kt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of St)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Nt=(()=>{function e(e,t,n){const r=ht(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=ht(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),s=ht(e+"/rejected",((e,t,r,o,s)=>({payload:o,error:(n&&n.serializeError||kt)(e||"Rejected"),meta:{...s||{},arg:r,requestId:t,rejectedWithValue:!!o,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):Ct(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let s=n?.condition?.(e,{getState:a,extra:c});if(null!==(m=s)&&"object"==typeof m&&"function"==typeof m.then&&(s=await s),!1===s||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(o(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 jt(e,t),fulfillWithValue:(e,t)=>new Tt(e,t)})).then((t=>{if(t instanceof jt)throw t;return t instanceof Tt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof jt?s(null,l,e,t.payload,t.meta):s(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&s.match(f)&&f.meta.condition||i(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(At)})}}),{pending:o,rejected:s,fulfilled:r,settled:Et(s,r),typePrefix:e})}return e.withTypes=()=>e,e})();function At(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Rt=Symbol.for("rtk-slice-createasyncthunk");function It(e,t){return`${e}/${t}`}function Ot({creators:e}={}){const t=e?.asyncThunk?.[Rt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(Ht(11));const o=("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)||{},s=Object.keys(o),i={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(Ht(12));if(n in i.sliceCaseReducersByType)throw new Error(Ht(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?_t(e.extraReducers):[e.extraReducers],o={...t,...i.sliceCaseReducersByType};return function(e,t){let s,[a,c,l]=_t((e=>{for(let t in o)e.addCase(t,o[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)s=()=>mt(e());else{const t=mt(e);s=()=>t}function u(e=s(),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(ie(e)){const r=n(e,t);return void 0===r?e:r}if(ae(e))return Ve(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(Ht(9))}return r}}return e}),e)}return u.getInitialState=s,u}(e.initialState)}s.forEach((r=>{const s=o[r],i={reducerName:r,type:It(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(s)?function({type:e,reducerName:t,createNotation:n},r,o){let s,i;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(Ht(17));s=r.reducer,i=r.prepare}else s=r;o.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,i?ht(e,i):ht(e))}(i,s,a):function({type:e,reducerName:t},n,r,o){if(!o)throw new Error(Ht(18));const{payloadCreator:s,fulfilled:i,pending:a,rejected:c,settled:l,options:u}=n,d=o(e,s,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||Pt,pending:a||Pt,rejected:c||Pt,settled:l||Pt})}(i,s,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 o(t=l){const r=yt(u,n,{insert:()=>new WeakMap});return yt(r,t,{insert:()=>{const r={};for(const[o,s]of Object.entries(e.selectors??{}))r[o]=Lt(s,t,h,n);return r}})}return{reducerPath:t,getSelectors:o,get selectors(){return o(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 o=t??r;return e.inject({reducerPath:o,reducer:p},n),{...m,...f(o,!0)}}};return m}}function Lt(e,t,n,r){function o(o,...s){let i=t(o);return void 0===i&&r&&(i=n()),e(i,...s)}return o.unwrapped=e,o}var Mt=Ot();function Pt(){}var{assign:Dt}=Object,Ut="listenerMiddleware",Ft=e=>{let{type:t,actionCreator:n,matcher:r,predicate:o,effect:s}=e;if(t)o=ht(t).match;else if(n)t=n.type,o=n.match;else if(r)o=r;else if(!o)throw new Error(Ht(21));return((e,t)=>{if("function"!=typeof e)throw new Error(Ht(32))})(s),{predicate:o,type:t,effect:s}},Bt=Object.assign((e=>{const{type:t,predicate:n,effect:r}=Ft(e);return{id:Ct(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Ht(22))}}}),{withTypes:()=>Bt}),zt=Object.assign(ht(`${Ut}/add`),{withTypes:()=>zt}),$t=(ht(`${Ut}/removeAll`),Object.assign(ht(`${Ut}/remove`),{withTypes:()=>$t}));function Ht(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 Vt extends i{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const Wt=Nt("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,defaultLocale:r,preChat:o,agentParticipant:s,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:o,agentParticipant:s,userParticipant:i,startChatIcon:a,defaultUserLocale:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})),qt=Nt("resetConfig",(async(e,{extra:{config:t}})=>t)),Gt=Ze((({app:e})=>e),(({userHasResponded:e})=>e)),Kt="visibility",Jt={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},Xt=Ze((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?Jt.open:Jt.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),Yt=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:s,hideOnNoUserResponse:i}=r,{visible:a}=o||{};if("app"===s&&!t)return Jt.open;if("window"===s&&i&&n!==Jt.open)return e?n||t||Jt.open:Jt.hidden;if("inline"===s&&e&&!n)return t||Jt.open;const c=Jt.minimized;return n||t||a||c};var Zt=n(7402),Qt=n(8418),en=Zt.default,tn=Symbol.for("react-redux-context"),nn="undefined"!=typeof globalThis?globalThis:{};function rn(){if(!en.createContext)return{};const e=nn[tn]??(nn[tn]=new Map);let t=e.get(en.createContext);return t||(t=en.createContext(null),e.set(en.createContext,t)),t}var on=rn();function sn(e=on){return function(){return en.useContext(e)}}var an=sn(),cn=()=>{throw new Error("uSES not initialized!")},ln=(e,t)=>e===t;function un(e=on){const t=e===on?an:sn(e),n=(e,n={})=>{const{equalityFn:r=ln,devModeChecks:o={}}="function"==typeof n?{equalityFn:n}:n,{store:s,subscription:i,getServerState:a,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(en.useRef(!0),en.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,o.stabilityCheck])),d=cn(i.addNestedSub,s.getState,a||s.getState,u,r);return en.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var dn=un();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 pn={notify(){},get:()=>[]};var hn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?en.useLayoutEffect:en.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var fn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:o="once",identityFunctionCheck:s="once"}){const i=en.useMemo((()=>{const t=function(e,t){let n,r=pn,o=0,s=!1;function i(){l.onStateChange&&l.onStateChange()}function a(){o++,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 o=t={callback:n,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){r&&null!==e&&(r=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}())}function c(){o--,n&&0===o&&(n(),n=void 0,r.clear(),r=pn)}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 s},trySubscribe:function(){s||(s=!0,a())},tryUnsubscribe:function(){s&&(s=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:o,identityFunctionCheck:s}}),[e,r,o,s]),a=en.useMemo((()=>e.getState()),[e]);hn((()=>{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||on;return en.createElement(c.Provider,{value:i},n)};function mn(e=on){const t=e===on?an:sn(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var yn=mn();function vn(e=on){const t=e===on?yn:mn(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var gn,bn=vn();gn=Qt.useSyncExternalStoreWithSelector,cn=gn,Zt.useSyncExternalStore;const xn=()=>dn(Xt);function wn(){const{startChatIcon:e}=xn();return e}const _n=({state:e})=>e,Cn=()=>dn(_n),En=Ze(_n,Xt,Gt,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const o={type:"service_data",payload:t.suggestion};return[...e,o]})),Sn=Ze(En,Xt,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,o)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const s=o[n-1];if(!t?.occurredAt||!s.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const i=g(t.occurredAt-s.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:i}}})):e})),jn=()=>dn(Sn),Tn=(Ze(Sn,(e=>e.map((e=>e.payload.id)))),()=>Cn().isLoading),kn=()=>Cn().unreadEvents,Nn=()=>Cn().skiplinkTargetId,An=()=>Cn().serviceInfo,Rn=Ze(Sn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),In=()=>{const{participants:e,currentAgent:t}=Cn().participantInfo;return t?e[t]:null},On=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=Cn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},Ln=()=>{const{layoutMode:e}=xn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},Mn=Ze((({visibility:e})=>e),(e=>e.visibility)),Pn=Ze((({visibility:e})=>e),(e=>e.showInlineView)),Dn=[Jt.open,Jt.minimized,Jt.hidden],Un=Nt("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),s=Mn(o),i=Gt(o),a=n.hasConversation(),c=Xt(o),{visibilityCallback:l=Yt,layoutMode:u}=c,{unreadEvents:d}=_n(o),p=l({hasResponded:i,previousVisibility:s,requestedVisibility:e,config:c});if(p&&!Dn.includes(p))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),null;if(s===p)return null;const h=n.store.get(Kt);return n.store.set(Kt,{...h||{},[u]:e}),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:i,unreadMessageCount:d}),p})),Fn=Nt("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:o}=Xt(n()),s=r.store.get(Kt)?.[o]||Jt.initialize;return t(Un(s)),s})),Bn={info:"info",message:"message",participant:"participant",system:"system"},zn="text",$n="text",Hn="upload",Vn="received",Wn="read",qn="custom",Gn="typing",Kn="read",Jn="detach_service",Xn="dismiss",Yn="set_topic",Zn="click_cta",Qn="assertive",er="polite",tr={new_topic:"newTopic",new_translation:"newTranslation"},nr="uploads",rr="navigate",or=Nt("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{let o=n?.context?.contentLocale,s=n?.context?.userLocale;const i=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=await t.getConversationIntitialState();return o=e.context?.contentLocale||o,s=e.context?.userLocale||s,t.sendContext({...e.context,environment:i}),{initialState:e,contentLocale:o,userLocale:s,config:n}}return n?.context?.topic&&t.send("action",{type:Yn,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext({...n.context,environment:i}),{initialState:void 0,contentLocale:o,userLocale:s,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 Vt;return r({name:t.name,message:t.message,langKey:t.langKey})}})),sr=((e,t,n)=>{const{wait:r=300,maxWait:o=0,leading:s=!1}=n??{};let i,a=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,i&&(i(!0),i=void 0)};return Nt(e,t,{condition:()=>{const e=s&&!a;return a&&clearTimeout(a),a=setTimeout((()=>{l(),a=null}),r),!!e||(i&&(i(!1),i=void 0),o&&!c&&(c=setTimeout(l,o)),new Promise((e=>{i=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(qt()),await t(Wt()),await t(or()),t(Fn())}),{wait:2e3,leading:!0}),ir=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],ar=(e,t)=>{const{messages:n,...r}=(o=t,ir.reduce(((e,t)=>(t in o&&(e[t]=o[t]),e)),{}));var o;let s=e;return Object.keys(r).length>0&&(s={...s,...r}),n&&(s={...s,messages:{...s.messages,...n}}),s},cr=Mt({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})=>ar(e,t),updateConfig:(e,{payload:t})=>ar(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(qt.fulfilled,(e=>e)).addCase(Wt.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o,defaultUserLocale:s,defaultContentLocale:i}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.userLocale=s,e.context.contentLocale=i,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o}))}}),{setConfig:lr,updateConfig:ur,setPreChatEvents:dr}=cr.actions,pr=cr.reducer,hr={userHasResponded:!1},fr=Mt({name:"app",initialState:hr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(sr.pending,(()=>hr)).addCase(or.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:mr}=fr.actions,yr=fr.reducer;class vr extends i{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const gr={SeamlyGeneralError:c,SeamlyConfigurationError:a,SeamlySessionExpiredError:l,SeamlyOfflineError:vr,SeamlyUnauthorizedError:u,SeamlyUnavailableError:Vt},br=ht("catch-error",(e=>({payload:e}))),xr={controls:{}},wr={touched:!1},_r={controls:wr},Cr=Mt({name:"forms",initialState:_r,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...xr,persistData:t}:{...xr,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]:wr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o={...r.controls};return delete o[t],{...e,[n]:{...r,controls:o}}},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(sr.pending,(()=>_r))}}),{registerForm:Er,deregisterForm:Sr,registerControl:jr,deregisterControl:Tr,updateControlValue:kr,updateControlTouched:Nr}=Cr.actions,Ar=Cr.reducer,Rr=Nt("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}}),Ir={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},Or=Mt({name:"app",initialState:Ir,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(sr.pending,(()=>Ir)).addCase(Wt.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(Rr.pending,(e=>{e.isLoading=!0})).addCase(Rr.rejected,(e=>{e.isLoading=!1})).addCase(Rr.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:Lr,setTranslations:Mr}=Or.actions,Pr=Or.reducer,Dr=Nt("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],o=e?.lastEvent?.id;return r&&o!==r.payload.id}}),Ur={error:void 0},Fr=Mt({name:"interrupt",initialState:Ur,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>Ur},extraReducers:e=>{e.addCase(Wt.pending,(()=>Ur)).addMatcher(Et(or.rejected,Wt.rejected,Rr.rejected,Un.rejected,Fn.rejected,Dr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Br,clearInterrupt:zr}=Fr.actions,$r=Fr.reducer,Hr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],Vr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===Bn.message&&!t.fromClient||e===Bn.info&&t.type===zn,Wr=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),qr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:s,introduction:i}=t.participant,a=n[r],c={...n,[r]:a?{...a,...o?{avatar:o}:{},...s?{name:s}:{},...i?{introduction:i}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Gr=(e,t)=>{const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{},{blockAutoEntrySwitch:r}=e,o=t?.payload?.actions||{},s=t?.payload?.translatedActions||{};if(!n)return{...e,optionsOverride:{},actions:o,translatedActions:s};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:o,translatedActions:s}},Kr={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},Jr=Mt({name:"store",initialState:Kr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,o=e.options.features.hasOwnProperty(nr);let s={...e.options};if(o&&(n===Bn.message||n===Bn.participant)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;s={...s,features:{...s.features,uploads:{enabled:s.features.uploads?.enabled||!1,...s.features?.uploads||{},enabledFromEntry:e===Hn}}}}const i=Vr(t.payload);if(e.events.find((e=>e.payload.id===r.id)))return;const a=Gr(e.entryMeta,t.payload);e.entryMeta=o||a.active!==Hn?a:{...e.entryMeta},e.options=s,i&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?Wn:Vn)),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:o}=t;n&&(n.payload.id=r,n.payload.occurredAt=o,e.events=Wr(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===Vn&&{messageStatus:Wn}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:o,serviceData:s,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 Wr([...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}=o,p=d?.options?.upload,h=Gr({...e.entryMeta,...d,active:d?.default||zn,options:{...d?.options?d.options:{}}},a[a.length-1]);let f={...e.options.features};const m=f.hasOwnProperty(nr);if(m&&"message"===l?.type){const{payload:e}=l,t=e?.entry?.type||{};f={...f,uploads:{enabled:!(!p||!p?.enabled),enabledFromEntry:t===Hn}}}e.unreadEvents=a.filter((e=>"message"===e.type&&e.payload.messageStatus===Vn)).length,e.events=a.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...u?qr(e.participantInfo,{participant:c[u]}):{},participants:c},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,activeServiceSessionId:r,proactiveMessages:o?.proactiveMessages?.enabled||!1},e.serviceData={...e.serviceData,...s},e.options={...e.options,features:f},e.entryMeta=m||h.active!==Hn?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=qr(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=Kr.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(sr.pending,(()=>Kr)).addCase(or.pending,(e=>{e.isLoading=!0})).addCase(Wt.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name,t.features&&(e.options.features=t.features)})).addCase(or.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Et(so,io),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:Xr,addEvent:Yr,clearAllUploads:Zr,clearEvents:Qr,clearFeatures:eo,clearIdleDetachCountdown:to,clearResumeConversationPrompt:no,decrementIdleDetachCountdownCounter:ro,hideOption:oo,initIdleDetachCountdown:so,initResumeConversationPrompt:io,registerUpload:ao,resetHistoryLoadedFlag:co,setActiveEntryType:lo,setActiveService:uo,setBlockAutoEntrySwitch:po,setEventsRead:ho,setFeatureEnabledState:fo,setFeatures:mo,setHeaderSubTitle:yo,setHeaderTitle:vo,setHistory:go,setInitialState:bo,setIsLoading:xo,setLoadedImageEventIds:wo,setParticipant:_o,setSeamlyContainerElement:Co,setServiceDataItem:Eo,setServiceEntryMetadata:So,clearAbortTransaction:jo,setUploadComplete:To,setUploadError:ko,setUploadProgress:No,startProcessingImage:Ao,doneProcessingImage:Ro,setUserEntryType:Io,setUserSelectedOption:Oo,setUserSelectedOptions:Lo,showOption:Mo,stopIdleDetachCountdownCounter:Po,setProactiveMessages:Do}=Jr.actions,Uo=Jr.reducer,Fo={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Ct(),translatedEventGroups:{},translationProposal:null},Bo=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},o,s)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return s.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,o]]=Object.entries(n);return{lastGroupId:e.filter((e=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},zo=Mt({name:"translation",initialState:Fo,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}=Bo(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:s}=Bo(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=s},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(sr.pending,(()=>Fo)).addCase(Wt.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(go,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(Rr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(Yr,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:$o,disableTranslation:Ho,enableEventsTranslation:Vo,disableEventsTranslation:Wo,setTranslationProposalPrompt:qo,disableTranslationProposalPrompt:Go}=zo.actions,Ko=zo.reducer,Jo=({dispatch:e})=>t=>n=>{const r=t(n);if(go.match(n)&&n.payload?.translation?.enabled)return e($o(n.payload.translation.locale)),e(Rr(n.payload.translation.locale)),r;if(Wt.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(Rr(n.payload.defaultUserLocale)),r;if(or.fulfilled.match(n))return n.payload.userLocale&&e(Rr(n.payload.userLocale)),r;if(Yr.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(Rr(t.translationLocale)),r}return r},Xo=Mt({name:"visibility",initialState:{visibility:Jt.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(Un.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(Wt.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:Yo}=Xo.actions,Zo=it({state:Uo,app:yr,config:pr,i18n:Pr,translations:Ko,visibility:Xo.reducer,forms:Ar,interrupt:$r});function Qo({initialState:e,api:t,eventBus:n,config:r}){const o=function(e){const t=vt(),{reducer:n,middleware:r,devTools:o=!0,preloadedState:s,enhancers:i}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!ot(n))throw new Error(Ht(1));a=it(n)}if(!wt&&r&&"function"!=typeof r)throw new Error(Ht(2));if("function"==typeof r){if(c=r(t),!wt&&!Array.isArray(c))throw new Error(Ht(3))}else c=t();if(!wt&&c.some((e=>"function"!=typeof e)))throw new Error(Ht(4));let l=at;o&&(l=dt({trace:!wt,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let s=()=>{throw new Error(et(15))};const i={getState:o.getState,dispatch:(e,...t)=>s(e,...t)},a=e.map((e=>e(i)));return s=at(...a)(o.dispatch),{...o,dispatch:s}}}(...c),d=xt(u);if(!wt&&i&&"function"!=typeof i)throw new Error(Ht(5));let p="function"==typeof i?i(d):d();if(!wt&&!Array.isArray(p))throw new Error(Ht(6));if(!wt&&p.some((e=>"function"!=typeof e)))throw new Error(Ht(7));return wt||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),st(a,s,l(...p))}({reducer:Zo,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:o,api:s,layoutMode:a}=Xt(t()),{error:c,type:l}=n,u=gr[c?.name]?new gr[c.name](c):new i(c);r?.(u,{namespace:o,api:s,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:o}=n;if(o===Br.type){if(!Hr.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 Lo.toString():e.store.set("options",n.payload);break;case Oo.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Jo)});return o}const es=bn;var ts=n(1162);function ns(e=""){const t=e=>/\s/.test(e),n=[],r={};let o=0,s=null,i=!1,a=0;for(;a<e.length;){if(i&&(t(e[a])||"{"===e[a]))i=!1,s=e.slice(o,a),"{"===e[a]&&a--;else if(!i&&!t(e[a])){const t="{"===e[a];if(s&&t){const t=rs(e,a);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[s]=e.slice(a+1,t),a=t,s=null}else s&&(n.push(s),s=null),i=!0,o=a}a++}return i&&(s=e.slice(o)),s&&n.push(s),{args:n,cases:r}}function rs(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 os(e){return ss(e.slice(1,-1),",",3)}function ss(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let o=e.indexOf(t);if(-1===o)return r.push(e),r;let s=e.substring(0,o).trim(),i=e.substring(o+t.length+1).trim();return r.push(s),ss(i,t,n-1,r)}let is,as=0;const cs="other";function ls(e,t){let n=0,r="",o=0;const s={};for(;n<e.length;){if("#"!==e[n]||o)r+=e[n];else{let e="__hashToken"+as++;r+=`{${e}, number}`,s[e]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:s}}const us="other",ds=Ze((({i18n:e})=>e),(({translations:e})=>e)),ps=Ze((({i18n:e})=>e),(({initialLocale:e})=>e)),hs=Ze((({i18n:e})=>e),(({userLocale:e})=>e)),fs=Ze((({i18n:e})=>e),(({isLoading:e})=>e)),ms=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 o=e(...n);return t[r]=o,o}}(((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=rs(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let o=e.substring(n,r+1);if(o){let s=[],i=e.substring(0,n);i&&s.push(i);let[a,c,l]=os(o),u=t[a];null==u&&(u="");let d=c&&this.typeHandlers[c];s.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&s.push(this.process(p,t)),s}}}return[e]}}("en-GB",{plural:function(e,t,n,r,o){const{args:s,cases:i}=ns(t);let a=parseInt(e);s.forEach((e=>{e.startsWith("offset:")&&(a-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==is&&is.resolvedOptions().locale===n||(is=new Intl.PluralRules(n));const e=is.select(a);e!==cs&&c.push(e)}1===a&&c.push("one"),c.push(`=${a}`,cs);for(let e=0;e<c.length;e++){const t=c[e];if(t in i){const{caseBody:e,numberValues:n}=ls(i[t],a);return o(e,{...r,...n})}}return e},select:function(e,t,n,r,o){const{cases:s}=ns(t);return e in s?o(s[e],r):us in s?o(s[us],r):e}});function ys(){const e=dn(ds),t=dn(hs),n=dn(ps),r=dn(fs);return{t:(0,ts.useCallback)(((n,o={})=>{if(!e)return"";const s=e[n];return s?ms.format(s,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const vs=()=>{const e=es(),t=dn(Mn),n=!!t&&t!==Jt.hidden,r=t===Jt.open,o=t===Jt.minimized,s=(0,ts.useCallback)((t=>e(Un(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:o,visible:t,setVisibility:s,openChat:()=>{s(Jt.open)},closeChat:()=>{s(Jt.minimized)}}},gs=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,o.createRef)()})=>{const[r,s]=(0,ts.useState)(null),i=!!r?.isIntersecting||!t,a=i&&e,c=([e])=>s(e);return(0,ts.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}},bs=()=>dn(Gt),xs=(0,o.createContext)(null),ws=(0,o.createContext)(null),_s=(0,o.createContext)(null),Cs=()=>{const e=(0,ts.useContext)(ws);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},Es=()=>{const e=(0,ts.useContext)(xs);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},Ss=()=>Es().store,js=()=>{const e=Es();return(0,ts.useCallback)((()=>e.hasConversation()),[e])},Ts=()=>{const e=Es(),t=es(),n=Cs(),r=bs(),o=js(),{visible:s,setVisibility:i}=vs(),a=kn(),c=(0,ts.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,ts.useCallback)((()=>{c("ui.beforeStart",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:a}),e.send("start"),c("ui.start",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:a})}),[e,c,o,r,a,s]),u=(0,ts.useCallback)((async()=>{await t(sr())}),[t]),d=(0,ts.useCallback)((e=>({type:e,id:m(),transactionId:m(),participant:p,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,ts.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,ts.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const o={...h(n),...r};e.send("message",o),c("message",o),t(Yr({type:"message",payload:{...o,optimisticallyInjected:!0}}))}),[e,t,c,h]),y=(0,ts.useCallback)(((e,n=m())=>{t(Yr({type:"message",payload:{...h(e),transactionId:n}}))}),[t,h]),v=(0,ts.useCallback)(((e,n,r,o,s,i,a)=>{t(Yr({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:p,fromClient:!0,occurredAt:r,body:{contentType:o,filename:s,filesize:i,url:a}}}))}),[t]),g=(0,ts.useCallback)(((e,n=m())=>{t(Yr({type:"info",payload:{body:{subtype:e},fromClient:!1,fromHistory:!0,id:m(),transactionId:n,type:"divider"}}))}),[t]),b=(0,ts.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==Gn&&n!==Kn&&c(`action.${n}`,t)}),[e,c]),x=(0,ts.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,ts.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(bo(e)),e.userResponded&&(t(mr(e.userResponded)),i(Jt.open)))})).catch((e=>{t(Br({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}},ks=()=>{const e=(()=>{const e=(0,ts.useContext)(_s);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,ts.useCallback)((t=>{t&&e({ariaLive:er,messageText:t})}),[e]),sendAssertive:(0,ts.useCallback)((t=>{t&&e({ariaLive:Qn,messageText:t})}),[e])}},Ns=Ze((({interrupt:e})=>e),(({error:e})=>e)),As=Ze(Ns,(e=>Boolean(e)));function Rs(){const{t:e}=ys(),t=dn(Ns);return{hasError:dn(As),meta:(0,ts.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,o=e(`${n}.title`),s=e(`${n}.message`),i=e(`${n}.srText`),a=r?e(`${n}.buttonText`):null;return{...n?{title:o,message:s,srText:i}:{},...r?{action:r}:{},...r&&n?{buttonText:a}:{},originalError:t}}),[t,e]),error:t}}const Is=()=>{const{t:e}=ys(),{isInline:t,isWindow:n,isApp:r}=Ln(),{isOpen:o,isVisible:s}=vs(),i=dn(Pn),{start:a,connect:l,apiConfigReady:u,apiConnected:d}=Ts(),p=(0,ts.useRef)(!1),{sendAssertive:h}=ks();!function(){const{meta:{originalError:e,action:t}}=Rs(),n=es(),{reset:r}=Ts(),o="SeamlySessionExpiredError"===e?.name,s=(0,ts.useRef)(0),i=(0,ts.useRef)(null);(0,ts.useEffect)((()=>{if(o&&"reset"===t){if(s.current>=10){i.current=setTimeout((()=>{s.current=0}),1e4);const e=new c;return n(Br({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}s.current+=1,r()}return()=>{i.current&&clearTimeout(i.current)}}),[t,r,o,n])}(),(0,ts.useEffect)((()=>{s&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[s,h,e]),(0,ts.useEffect)((()=>{s&&h(e(o?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[o,s,h,e]),(0,ts.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,ts.useCallback)((async()=>{d||(p.current=!0,await l()),(r||o||s&&t)&&a()}),[d,l,r,t,o,s,a]);(0,ts.useEffect)((()=>{!u||p.current||n&&!o||!(!t||s&&i)||f()}),[u,f,t,o,s,n,i])},Os=require("preact/compat"),Ls=require("preact/jsx-runtime"),Ms=({children:e})=>(Is(),(0,Ls.jsx)(Ls.Fragment,{children:e})),Ps=(0,o.createContext)(null),Ds=(e=0)=>new Promise((t=>{setTimeout(t,e)})),Us=()=>{const{seamlyContainerElement:e}=Cn(),t=es();return[e,(0,ts.useCallback)((e=>{t(Co(e))}),[t])]},Fs=e=>(0,ts.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await Ds(180);const e="string"==typeof t?document.getElementById(t):t;E(e)}))}),[e]),Bs=()=>{const e=Nn();return Fs(e)},zs=e=>Ze((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function $s(){const{sendContext:e}=Ts(),t=es(),n=xn(),r=(0,ts.useCallback)((t=>{e({userLocale:t})}),[e]),o=(0,ts.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(Ho())}),[n.context?.contentLocale,t,e]),{languages:s,isActive:i,isAvailable:a,currentLocale:c}=dn((({translations:e})=>e));return{languages:s,isActive:i,isAvailable:a,currentLocale:c,enableTranslations:r,disableTranslations:o}}const Hs=e=>{const t=dn(zs(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:o}={body:e.payload?.body,translation:e.payload?.translation},s=!!n;return{body:t&&s?n:o,hasTranslation:s,isTranslated:t&&s,locale:r?.locale}};function Vs(){const e=dn((({translations:e})=>e.containerId));return{id:e,focusContainer:Fs(e)}}function Ws(e){const{languages:t}=$s();return(0,ts.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const qs=()=>{const{isActive:e,languages:t}=$s(),n=es(),{sendAction:r}=Ts(),{translationProposal:o}=dn((e=>e.translations)),{enableTranslations:s}=$s(),{isOpen:i}=vs(),{userLocale:a}=ys(),c=o?.proposedLocale,l=Ws(c),u=(0,ts.useMemo)((()=>null!==o&&!e&&i&&a!==c&&t.some((e=>e.locale===c))),[o,e,i,a,c,t]);return{activateTranslationProposal:()=>{s(o?.proposedLocale)},dismissTranslationProposal:()=>{r({type:Xn,body:{type:"translation_proposal"}}),n(Go())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}},Gs=(...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(" "),Ks=()=>xn().appContainerClassNames,Js=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},Xs=()=>{const e=Es();return(0,Os.useSyncExternalStore)(X.subscribe,(()=>e.conversation))},Ys=(0,o.createContext)(null),Zs=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=Cn(),{allowedMimeTypes:o,maxSize:s}=n.upload||{},{enabled:i,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...o?{allowedMimeTypes:o}:{},...s?{maxSize:s}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||i,allowedMimeTypes:c,maxSize:l}},Qs=()=>{const{currentUploads:e}=Cn(),t=es(),n=(()=>{const e=(0,ts.useContext)(Ys);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,ts.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,ts.useCallback)((()=>{t(Zr())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},ei=()=>{const{t:e}=ys(),{options:t}=Cn(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:s}=t,{extraMenuItem:i,sendTranscript:a}=s,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=es(),{get:h,set:f}=Ss();return{allowOptionSelection:d,userSelectedOptions:o,features:s,menuOptions:u,initUserSelectedOptions:(0,ts.useCallback)((()=>{const e=h("options")||{};p(Lo(e))}),[h,p]),setUserSelectedOptions:(0,ts.useCallback)((e=>{p(Lo(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,ts.useCallback)(((e,t)=>{const n=h("options")||{};"object"==typeof n&&f("options",{...n,[e]:t}),p(Oo({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(Mo(e))},hideOption:()=>{p(oo())},panelActive:n,optionActive:r}},ti=()=>{const{optionsButtonId:e}=Cn();return{id:e,focusButton:Fs(e)}},ni=(0,o.createContext)(null),ri=()=>{const e=(0,ts.useContext)(ni);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},oi=()=>{const e=es(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:i}}=Cn(),{isOpen:a}=vs(),{emitEvent:c,sendAction:l}=Ts(),{t:u}=ys(),{sendAssertive:d,sendPolite:p}=ks(),h=(0,ts.useCallback)((e=>{a&&d(e)}),[a,d]),f=(0,ts.useCallback)((e=>{a&&p(e)}),[a,p]),m=(0,ts.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=b(n);e(so({delaySeconds:n,delayTime:r})),c("idleTimer.start"),h(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,h,u]),y=(0,ts.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:Jn}),h(u("idleDetachWarning.notifyTransferText"))),i||c("idleTimer.stop"),e(to()))}),[e,c,t,l,h,u,i]),v=(0,ts.useCallback)((()=>{if(!o||o<=0)return;const t=o-1;t%10==0&&h(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",b(t))}`),e(ro())}),[e,o,h,u]),g=(0,ts.useCallback)((()=>{n&&(e(Po()),o&&(c("idleTimer.stop"),f(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,o,f,u]);return{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:i,initCountdown:m,endCountdown:y,decrementCountdown:v,stopCountdown:g}},si=()=>{const e=es(),t=Cn().resumeConversationPrompt,{sendAction:n}=Ts(),{t:r}=ys(),{sendAssertive:o}=ks();return{continueChat:()=>{n({type:Xn,body:{type:"resume_conversation_prompt"}}),e(no())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:Jn}),e(no())}}},ii=()=>{const[e]=(0,ts.useState)((()=>m()));return e},ai=(e,t)=>{const n=Xs();(0,ts.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])},ci=({eventPayload:e})=>{const{t}=ys(),{fromClient:n,participant:r}=e,o=(e=>Cn().participantInfo.participants[e])(r)||{},{messages:s}=xn(),i=n?t("participants.user.name"):o&&o.name,{showAvatar:a,showName:c}=s&&s[n?"user":"agent"]||{};if(!a&&!c)return null;const l=[];return a&&i&&o.avatar&&l.push((0,Ls.jsx)("span",{className:Gs("message__avatar"),children:(0,Ls.jsx)("img",{src:o.avatar,className:Gs("avatar"),alt:""})})),c&&i&&l.push((0,Ls.jsx)("span",{className:Gs("message__author-name"),children:i})),l.length>0?(0,Ls.jsx)("div",{className:Gs("message__author"),children:l}):null},li=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:o,bodyProps:s={},info:i,...a})=>{const c=Js(t),{hasTranslation:l,isTranslated:u,locale:d}=Hs(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&&(s={...s,lang:d}),(0,Ls.jsx)(Ls.Fragment,{children:(0,Ls.jsxs)("div",{className:Gs(c),...a,children:[e&&(0,Ls.jsx)(ci,{eventPayload:t.payload}),(0,Ls.jsx)("div",{className:Gs("message__body"),...s,children:o}),i&&(0,Ls.jsx)("div",{"aria-hidden":"true",className:Gs("message__info"),children:i})]})})},ui=({id:e,action:t,buttonText:n,description:r,hasFocus:o,image:s,title:i,isCarouselItem:a})=>{const c=(0,ts.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=Ts(),p=ii(),h=(0,ts.useRef)(!1),f=t?.type===rr?"a":"button",m=(0,ts.useCallback)((()=>d("action.click_card",{type:Zn,originMessage:e,action:t})),[d,e,t]),y=(0,ts.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:Yn,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),v=(0,ts.useMemo)((()=>t?.type===rr?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,ts.useEffect)((()=>{a&&(o&&h.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),h.current=!0}),[o,a]),(0,Ls.jsxs)("div",{className:Gs("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[s?(0,Ls.jsx)("img",{className:Gs("card__image"),src:s,alt:""}):null,(0,Ls.jsxs)("div",{className:Gs("card__content"),id:e,children:[i&&(0,Ls.jsx)("h2",{className:Gs("card__title"),children:i}),r&&(0,Ls.jsx)("div",{className:Gs("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,Ls.jsx)(f,{tabIndex:a&&!o?-1:void 0,className:Gs("button","button--primary"),"aria-describedby":p,...v,children:n})]})]})};function di({item:e,items:t,index:n,isActive:r}){const{t:o}=ys();return(0,Ls.jsx)("div",{className:Gs("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":o("carousel.slide.label",{index:n+1,total:t.length}),children:(0,Ls.jsx)(ui,{...e,isCarouselItem:!0,hasFocus:r})})}const pi={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'}},hi=({name:e,size:t="32",className:n,alt:r})=>(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("div",{"aria-hidden":"true",className:n||Gs("icon"),dangerouslySetInnerHTML:{__html:pi[e][t]}}),r&&(0,Ls.jsx)("span",{className:Gs("visually-hidden"),children:r})]});function fi({items:e,currentIndex:t,onChange:n,children:r}){const{t:o}=ys(),s=e.length;return(0,Ls.jsxs)("div",{className:Gs("carousel-controls"),children:[(0,Ls.jsx)("button",{className:Gs("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{n((t-1+s)%s)},children:(0,Ls.jsx)(hi,{name:"arrowLeft",size:"16",alt:""})}),r,(0,Ls.jsx)("button",{className:Gs("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{n((t+1)%s)},children:(0,Ls.jsx)(hi,{name:"arrowRight",size:"16",alt:""})})]})}function mi({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:o}){const s=e.length,i=(0,ts.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,r));o!==t&&n(o)}),[s,t,n]);return(0,Ls.jsx)("div",{className:Gs("carousel-pagination__wrapper"),role:"group",children:(0,Ls.jsx)("ul",{className:Gs("carousel-pagination"),children:e.map(((e,n)=>{const s=t===n;return(0,Ls.jsx)("li",{className:Gs("carousel-pagination__item",s?"is-active":void 0),children:(0,Ls.jsx)("button",{className:Gs("carousel-pagination__button"),type:"button",onClick:i,"data-item":n,"aria-disabled":s?"true":void 0,"aria-label":o(e,n)})},r(e,n,"pagination-item-"))}))})})}const yi=(e,t,n)=>`${n}${t}`,vi=e=>e.label,gi=({target:e})=>{e.scrollLeft=0};function bi({currentIndex:e=0,onChange:t=(()=>{}),getItemKey:n=yi,getItemLabel:r=vi,items:s}){const i=ii(),a=s.length,[c,l]=(0,ts.useState)(Number(e||0));(0,ts.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,ts.useRef)([]);u.current=(0,ts.useMemo)((()=>Array(a).fill(1).map((()=>(0,o.createRef)()))),[a]);const d=(0,ts.useRef)(!0),p=(0,ts.useRef)(null);return p.current=t,(0,ts.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,Ls.jsxs)("div",{className:Gs("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,Ls.jsx)("div",{className:Gs("carousel__slides-wrapper"),onScroll:gi,children:(0,Ls.jsx)("div",{id:i,className:Gs("carousel__slides"),style:{width:100*a+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((e,t)=>{const r=c===t;return(0,Ls.jsx)("div",{ref:u.current[t],className:Gs("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,Ls.jsx)(di,{item:e,items:s,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,Ls.jsx)("div",{className:Gs("carousel__controls"),children:(0,Ls.jsx)(fi,{currentIndex:c,items:s,onChange:l,children:(0,Ls.jsx)("div",{className:Gs("carousel__pagination"),children:(0,Ls.jsx)(mi,{currentIndex:c,items:s,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const xi=(e,t,n="")=>`${n}${e.title}:${t}`,wi=e=>e.title,_i=e=>{const{payload:t}=e,[n,r]=(0,ts.useState)(!1),{sendAction:o,addMessageBubble:s,addDivider:i}=Ts(),{activeServiceSessionId:a}=An(),c=dn(Rn),{body:l}=Hs(e),{service:u}=t,d=(0,ts.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,ts.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),s(e.text,n),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:p},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}},Ci=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Ei=({id:e,categories:t=[],question:n,onClick:r,hasIcon:o})=>{const s=(0,ts.useMemo)((()=>["suggestions__item",...t.map(Ci)]),[t]),i=(0,ts.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,Ls.jsx)("li",{className:Gs(s),children:(0,Ls.jsxs)("button",{type:"button",onClick:i,className:Gs("button","button--primary"),children:[o&&(0,Ls.jsx)(hi,{name:"chevronRight",size:"8",alt:""}),n]})})},Si=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,Ls.jsx)("ul",{className:Gs("suggestions__list",e||""),children:t.map((e=>(0,Ls.jsx)(Ei,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),ji=e=>{const{sendAction:t}=Ts();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}},Ti=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:o,iconSize:s,iconClassName:i,dividerType:a,title:c,description:l})=>{const u=Boolean(o||n);return(0,Ls.jsxs)("div",{className:Gs("divider",a&&`divider--type-${a}`,t),children:[u&&(0,Ls.jsx)("span",{className:Gs("divider__graphic"),children:o?(0,Ls.jsx)(hi,{name:o,size:s,className:i,alt:""}):(0,Ls.jsx)("img",{src:n,className:Gs({icon:"icon"===r,avatar:"avatar"===r},i)})}),(0,Ls.jsxs)("div",{className:Gs("divider__body"),children:[c?(0,Ls.jsx)("h2",{className:Gs("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,Ls.jsx)("p",{className:Gs("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},ki={[tr.new_topic]:"new-topic"},Ni={default:({event:e})=>{const{t}=ys(),{subtype:n}=e.payload.body,r=ki[tr[n]];return tr[n]?(0,Ls.jsx)(Ti,{dividerType:r,iconName:tr[n],title:t(`dividerKeys.${tr[n]}`)}):null},[tr.new_translation]:({event:e})=>{const{t}=ys(),n=jn(),{body:{translationEnabled:r,text:o,title:s},id:i}=e.payload,a=dn((e=>e.translations.translatedEventGroups)),c=es(),l=(0,ts.useCallback)((()=>{a[i]?c(Vo({events:n,id:i})):c(Wo({events:n,id:i}))}),[c,n,i,a]);return(0,Ls.jsx)(Ti,{iconName:"newTranslation",dividerType:"new-translation",title:s,description:o,children:r?(0,Ls.jsx)(Ls.Fragment,{children:(0,Ls.jsx)("button",{className:Gs("button","button--secondary"),onClick:l,children:t(a[i]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},Ai={month:"long",day:"numeric",year:"numeric"},Ri={hour:"numeric",minute:"numeric"},Ii=({event:e})=>{const t=(()=>{const[e,t]=(0,ts.useReducer)((e=>e+1),0);return(0,ts.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:o,srText:s}=(e=>{const{t}=ys(),n=xn(),r=n?.context?.userLocale??[],o=new Date(e),s=new Date,i=new Date(s);i.setHours(24,0,0,0);const a=i.valueOf()-s.valueOf(),c=o.toString(),l=new Intl.DateTimeFormat(r,Ri).format(o);let u=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),o=864e5;return r>=n+o?e:r>n?"today":r>n-o?"yesterday":e})(o,s);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,Ai).format(o)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:a}})(g(e.payload.timeIndicator));return(0,ts.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,Ls.jsxs)(Ti,{dividerType:"time-indicator",children:[(0,Ls.jsxs)("h2",{className:Gs("divider__time"),"aria-hidden":"true",children:[(0,Ls.jsx)("span",{className:Gs("divider__time--date"),children:n}),(0,Ls.jsx)("span",{className:Gs("divider__time--time"),children:r})]}),(0,Ls.jsx)("p",{className:Gs("visually-hidden"),children:s})]})};var Oi=["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])"],Li=Oi.join(","),Mi="undefined"==typeof Element,Pi=Mi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Di=!Mi&&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},Ui=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},Fi=function(e,t,n){if(Ui(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Li));return t&&Pi.call(e,Li)&&r.unshift(e),r.filter(n)},Bi=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Ui(i,!1))if("SLOT"===i.tagName){var a=i.assignedElements(),c=e(a.length?a:i.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{Pi.call(i,Li)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var l=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),u=!Ui(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(l&&u){var d=e(!0===l?i.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},zi=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},$i=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))&&!zi(e)?0:e.tabIndex},Hi=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Vi=function(e){return"INPUT"===e.tagName},Wi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},qi=function(e,t){return!(t.disabled||Ui(t)||function(e){return Vi(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Pi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Pi.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Wi(e)}else{if("function"==typeof r){for(var s=e;e;){var i=e.parentElement,a=Di(e);if(i&&!i.shadowRoot&&!0===r(i))return Wi(e);e=e.assignedSlot?e.assignedSlot:i||a===e.ownerDocument?i:a.host}e=s}if(function(e){var t,n,r,o,s=e&&Di(e),i=null===(t=s)||void 0===t?void 0:t.host,a=!1;if(s&&s!==e)for(a=!!(null!==(n=i)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(i)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&i;){var c,l,u;a=!(null===(l=i=null===(c=s=Di(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!!Pi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Gi=function(e,t){return!(function(e){return function(e){return Vi(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Di(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 o=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!o||o===e}(e)}(t)||$i(t)<0||!qi(e,t))},Ki=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ji=function e(t){var n=[],r=[];return t.forEach((function(t,o){var s=!!t.scopeParent,i=s?t.scopeParent:t,a=function(e,t){var n=$i(e);return n<0&&t&&!zi(e)?0:n}(i,s),c=s?e(t.candidates):i;0===a?s?n.push.apply(n,c):n.push(i):r.push({documentOrder:o,tabIndex:a,item:t,isScope:s,content:c})})),r.sort(Hi).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Xi=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Pi.call(e,Li)&&Gi(t,e)},Yi=Oi.concat("iframe").join(","),Zi=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Pi.call(e,Yi)&&qi(t,e)};function Qi(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 ea(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qi(Object(n),!0).forEach((function(t){var r,o,s;r=e,o=t,s=n[t],o=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)}(o),o in r?Object.defineProperty(r,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[o]=s})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ta=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},na=function(e){return ta(e)&&!e.shiftKey},ra=function(e){return ta(e)&&e.shiftKey},oa=function(e){return setTimeout(e,0)},sa=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},ia=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},aa=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},ca=[],la=function(e,t){var n,r=(null==t?void 0:t.document)||document,o=(null==t?void 0:t.trapStack)||ca,s=ea({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:na,isKeyBackward:ra},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]:s[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,o=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||o.find((function(t){return t===e}))}))},l=function(e){var t=s[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];t=t.apply(void 0,o)}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||!Zi(e,s.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?Bi([e],t.includeContainer,{filter:Gi.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ki}):Fi(e,t.includeContainer,Gi.bind(null,t)),Ji(n)}(e,s.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?Bi([e],t.includeContainer,{filter:qi.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Fi(e,t.includeContainer,qi.bind(null,t))}(e,s.tabbableOptions),r=t.length>0?t[0]:void 0,o=t.length>0?t[t.length-1]:void 0,i=n.find((function(e){return Xi(e)})),a=n.slice().reverse().find((function(e){return Xi(e)})),c=!!t.find((function(e){return $i(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:o,firstDomTabbableNode:i,lastDomTabbableNode:a,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=t.indexOf(e);return o<0?r?n.slice(n.indexOf(e)+1).find((function(e){return Xi(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return Xi(e)})):t[o+(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:!!s.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,o=void 0!==r&&r;t=t||aa(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=o?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(o){var h=sa(i.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||Zi(t,s.tabbableOptions)&&!Xi(t,s.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?i.tabbableGroups.length-1:h-1,m=i.tabbableGroups[f];a=$i(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else ta(n)||(a=p.nextTabbableNode(t,!1))}else{var y=sa(i.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||Zi(t,s.tabbableOptions)&&!Xi(t,s.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var v=y===i.tabbableGroups.length-1?0:y+1,g=i.tabbableGroups[v];a=$i(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else ta(n)||(a=p.nextTabbableNode(t))}}else a=l("fallbackFocus");return a},y=function(e){var t=aa(e);c(t,e)>=0||(ia(s.clickOutsideDeactivates,e)?n.deactivate({returnFocus:s.returnFocusOnDeactivate}):ia(s.allowOutsideClick,e)||e.preventDefault())},v=function(e){var t=aa(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(i.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var o=!0;if(i.mostRecentlyFocusedNode)if($i(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&&(s.isKeyForward(i.recentNavEvent)?d+1<l.length&&(r=l[d+1],o=!1):d-1>=0&&(r=l[d-1],o=!1))}}else i.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return $i(e)>0}))}))||(o=!1);else o=!1;o&&(r=m({target:i.mostRecentlyFocusedNode,isBackward:s.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!==ia(s.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(s.isKeyForward(e)||s.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&&(ta(e)&&e.preventDefault(),h(n))}(e,s.isKeyBackward(e))},b=function(e){var t=aa(e);c(t,e)>=0||ia(s.clickOutsideDeactivates,e)||ia(s.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)}(o,n),i.delayInitialFocusTimer=s.delayInitialFocus?oa((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"),o=a(e,"checkCanFocusTrap");o||d(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var s=function(){o&&d(),x(),C(),null==n||n()};return o?(o(i.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!i.active)return this;var t=ea({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.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()}(o,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(){oa((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 ua=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":s})=>{const i=ii(),a=(0,ts.useRef)(null),c=(0,ts.useRef)(null),[l,u]=(0,ts.useState)(!1);return(0,ts.useEffect)((()=>(l&&a.current&&(c.current=la(a.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,ts.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,ts.useEffect)((()=>{l&&a.current&&a.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,ts.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),s&&t.setAttribute("aria-labelledby",s),e.appendChild(t),a.current=t,u(!0),()=>{a.current&&(e.removeChild(a.current),a.current=null)}}),[r,s,i]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>a.current&&(0,o.render)(e,a.current)}):a.current&&(0,o.render)((0,o.toChildArray)(e).filter(j).map((e=>(e.props={...e.props,onClose:t},e))),a.current)},da=({url:e,description:t,onClose:n})=>{const r=xn(),o=ri(),s=Ks(),i=(0,ts.useRef)(null),{t:a}=ys(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof s?c.push(...s):c.push(...s(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,Ls.jsx)(ua,{onClose:n,"aria-label":a("lightbox.heading"),fallBackFocusRef:i,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,Ls.jsx)("div",{className:Gs(c),onClick:u,style:d,children:(0,Ls.jsxs)("div",{className:Gs("modal__float"),tabIndex:-1,onMouseDown:o,onKeyDown:o,onTouchStart:o,onMouseMove:o,onWheel:o,onPointerDown:o,onPointerMove:o,ref:i,children:[(0,Ls.jsx)("div",{className:Gs("modal__inner"),onClick:l,children:(0,Ls.jsx)("img",{className:Gs("modal__image"),src:e,alt:t})}),(0,Ls.jsxs)("button",{type:"button",className:Gs("modal__close"),onClick:n,children:[(0,Ls.jsx)(hi,{name:"close",size:"16",alt:""}),a("lightbox.closeLabel")]})]})}))(n))})},pa=({description:e,url:t})=>{const{t:n}=ys(),[r,o]=(0,ts.useState)(!1);return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsxs)("button",{type:"button",className:Gs("modal__enlarge"),onClick:()=>{o(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,Ls.jsx)(hi,{name:"enlarge",size:"32",alt:""})]}),r&&(0,Ls.jsx)(da,{url:t,description:e,onClose:()=>{o(!1)}})]})},ha=({event:e,...t})=>{const{body:n}=Hs(e),r=ji(e.payload.id),o=(0,ts.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,Ls.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,Ls.jsx)(li,{type:"text",event:e,onClick:r,...t,...o})},fa="PROCESSING_IMAGE",ma=({img:e,filename:t})=>{const{t:n}=ys(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,Ls.jsx)(Ls.Fragment,{children:(0,Ls.jsxs)("span",{className:Gs(["download","download--preview"]),children:[(0,Ls.jsx)("img",{src:e,alt:r}),(0,Ls.jsx)("span",{"aria-hidden":"true",className:Gs("file-download"),children:t})]})})},ya=({children:e,url:t,target:n})=>t?(0,Ls.jsx)("a",{href:t,download:!0,target:n,className:Gs(["download","download-link"]),children:e}):(0,Ls.jsx)("span",{className:Gs("download"),children:e}),va={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=ys(),s=ii(),{body:i,subEvent:a,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=_i(e);return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,o.toChildArray)(t).filter(j).map((e=>(e.props={...e.props,event:a,descriptorId:s,showTranslationToggle:!1},e))),l&&(0,Ls.jsxs)("button",{type:"button",className:Gs("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":s,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,Ls.jsx)(hi,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,Ls.jsx)(li,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,Ls.jsx)("ul",{className:Gs("choice-prompt","choice-prompt--many"),children:i?.choices?.map((e=>(0,Ls.jsx)("li",{className:Gs("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:ha,image:({event:e,descriptorId:t,...n})=>{const{body:r}=Hs(e),[o,s]=(0,ts.useState)(!1),i=es();return(0,Ls.jsxs)(li,{event:e,type:"image",...n,children:[(0,Ls.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{i(wo(e.payload.id)),s(!0)}}),r?.isZoomable&&o&&(0,Ls.jsx)(pa,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=Hs(e),o=ji(n.id);return(0,Ls.jsx)(li,{type:"splash",event:e,onClick:o,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=Hs(e);return Js(e).push("message--type-video"),(0,Ls.jsxs)(li,{event:e,type:"video",...n,children:[(0,Ls.jsx)("div",{id:t,className:Gs("visually-hidden"),children:r?.description}),(0,Ls.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=ys(),{body:r}=Hs(e),{fromClient:o,id:s}=e.payload,{filename:i,url:a}=r,c=(e=>{const{processingFileUploads:t}=dn((({state:e})=>e));return(0,ts.useMemo)((()=>{if(t.some((t=>t===e)))return fa;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(s),l=(0,ts.useMemo)((()=>n(a?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:i})),[a,i,n]);return(0,Ls.jsx)(li,{event:e,type:"upload",...t,children:c&&c!==fa?(0,Ls.jsx)(ma,{img:c,filename:i}):(0,Ls.jsxs)(ya,{url:a,target:o?void 0:"_blank",children:[(0,Ls.jsx)(hi,{name:"download",size:"16",alt:l}),(0,Ls.jsx)("span",{"aria-hidden":"true",className:Gs("file-download"),children:i})]})})},cta:({event:e})=>{const{body:t}=Hs(e),n=ji(e.payload.id),{emitEvent:r}=Ts(),o=ii(),s=(0,ts.useCallback)((()=>r(`action.${Zn}`,{type:Zn,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,Ls.jsxs)(li,{type:"cta",event:e,children:[(0,Ls.jsx)("div",{className:Gs("cta__content"),id:o,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,Ls.jsx)("a",{className:Gs("button","button--primary"),"aria-describedby":o,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:s,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=Hs(e),n=t.cards;return(0,Ls.jsx)(li,{event:e,modifiers:"type-carousel",children:(0,Ls.jsx)(bi,{items:n,getItemKey:xi,getItemLabel:wi})})},card:({event:e})=>{const{body:t}=Hs(e),n=ii();return(0,Ls.jsx)(li,{type:"card",event:e,children:(0,Ls.jsx)(ui,{id:n,...t})})}},info:{text:ha,divider:({event:e,...t})=>{const n=Ni[tr[e.payload.body.subtype]]||Ni.default;return(0,Ls.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=ys(),{body:r}=Hs(e);return(0,Ls.jsx)(li,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:Ii},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},o=!!t,s=dn(zs(e));return{body:s&&o?t:r,hasTranslation:o,isTranslated:s&&o,locale:n?.locale}})(e);return n?(0,Ls.jsx)(Ti,{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,ts.useState)(!0),o=es(),s=bs(),{sendAction:i,addMessageBubble:a}=Ts(),{suggestions:c,payload:l}=(e=>{const{payload:t}=e,{body:n}=Hs(e);return{suggestions:n,payload:t}})(e),{showSuggestions:u}=xn(),d=jn(),{t:p}=ys(),h=p("suggestions.headingText"),f=p("suggestions.footerText"),m=(0,ts.useMemo)((()=>d.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[d]),y=(0,ts.useCallback)((({id:e,question:t})=>{r(!1),o(mr(!0)),i({type:qn,originMessage:l.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),a(t)}),[o,i,l.id,a]);return n&&!s&&m&&u?(0,Ls.jsxs)("div",{className:Gs("suggestions","suggestions--conversation"),children:[h&&(0,Ls.jsx)("p",{className:Gs("suggestions__heading"),children:h}),(0,Ls.jsxs)(li,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,Ls.jsx)(Si,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:c}),f&&(0,Ls.jsx)("p",{className:Gs("suggestions__footer"),children:f})]})]}):null}}},ga=({children:e})=>{const{customComponents:t}=xn(),n=(0,ts.useMemo)((()=>Object.keys(va).reduce(((e,n)=>(e[n]={...va[n],...t?t[n]:{}},e)),{fallback:ha})),[t]);return(0,Ls.jsx)(Ps.Provider,{value:n,children:e})},ba=({children:e})=>{const{isMinimized:t}=vs(),n=(0,ts.useRef)(0),{sendAction:r}=Ts(),{hasCountdown:o,isActive:s,stopCountdown:i}=oi(),a=(0,ts.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),a=()=>{r({type:"interactivity_update"}),n.current=e};o&&s&&(a(),i()),e-n.current>15e3&&a()}),[r,o,s,i,t]);return(0,Ls.jsx)("div",{className:Gs("activity-monitor"),tabIndex:-1,onMouseDown:a,onKeyUp:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,children:(0,Ls.jsx)(ni.Provider,{value:a,children:e})})},xa=["text","choice_prompt","image","video"],wa=()=>{const e=Xs(),t=(0,ts.useRef)(),n=(0,ts.useRef)(),r=es(),o=Cs(),s=(0,ts.useRef)(null),{initCountdown:i,endCountdown:a}=oi(),{emitEvent:u}=Ts();return(0,ts.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new vr(e);r(Br({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(Qr())})),t.onOpen((()=>{r(zr())}))}}),[e,r]),(0,ts.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new c;return r(Br({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,ts.useEffect)((()=>{const t=e=>{if("participant"!==e.type)return;const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:o}=t;!n&&"string"!=typeof o&&o?.name&&r(yo(o.name)),r(_o({participant:o,fromClient:n})),"string"!=typeof o&&o.introduction&&r(Yr(e))};e.onConnection((({connected:n})=>{const{channel:s}=e;return!(!n||!s||(s.onMessage=(e,n)=>{const s={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(xo(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(io());break;case"translation_proposal":r(qo(n.body));break;case"user_first_response":r(mr(!0)),o.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(Rr(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(uo(n.service.serviceSessionId)),r(Yr(s))}break;case"participant":t(s);break;case"service_data":n.persist&&r(Eo(n));break;case"ack":r(Xr(s));break;case"system":if("service_changed"===n.type){const{serviceSettings:e,...t}=n,{entry:o,proactiveMessages:s}=e,{upload:i}=o.options;r(fo({key:nr,enabled:!(!i||!i.enabled)})),r(Do(s.enabled||!1)),r(So(o)),n.serviceSessionId&&r(uo(n.serviceSessionId)),u("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(Yr(s));break;case"error":switch(n.type){case"find_conversation_erred":const e=new l(s);r(Br({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(s);r(Br({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,o,i]),(0,ts.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=>xa.includes(e.type)?(e.id!==s.current&&o.emit("message",e),s.current=e.id,e):e)),0))}))}),[e,o]),(0,ts.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(Dr(e)).unwrap();if(!t)return;r(go(t))}catch(e){}})),!0)))}),[e,r]),null},_a=({children:e})=>{const{t}=ys(),n=es(),r=Es(),{addUploadBubble:o}=Ts(),s=(0,ts.useCallback)((async(e,t)=>{n(Ao(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),o=new Image;o.src=r,await o.decode();const s=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,o]=(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=o,n?.drawImage(e,0,0,r,o),t.toDataURL()})(o);try{sessionStorage.setItem(`image-${t}`,s)}catch(e){}finally{n(Ro(t))}}),[n]),i=(0,ts.useCallback)((e=>{const i=m(),a=r.uploadFile(e,(e=>{n(No({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(To(i)),o(r,a,c,l,u,d,p),await s(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(ko({fileId:i,errorText:r}))}));n(ao({fileId:i,fileName:e.name,uploadHandle:a}))}),[s,o,r,n,t]);return(0,Ls.jsx)(Ys.Provider,{value:i,children:e})},Ca=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=oi();return((e,t)=>{const n=(0,ts.useRef)(e);(0,ts.useEffect)((()=>{n.current=e}),[e]),(0,ts.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},Ea=()=>{const{initUserSelectedOptions:e}=ei(),t=(0,ts.useRef)(!1),n=xn();return(0,ts.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function Sa(e,t,n=[]){const r=Cs(),o=(0,ts.useRef)(t);(0,ts.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>o.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const ja=()=>{const e=xn(),{sendMessage:t,sendContext:n,sendAction:r}=Ts(),o=es(),{setVisibility:s,visible:i}=vs(),a=(0,ts.useRef)(i),c=Cs(),l=Es(),u=kn(),d=(0,ts.useRef)(null),h=(0,ts.useRef)(null),{isInline:f,isResolving:m}=Ln(),y=dn(As),v=(()=>{const{get:e}=Ss();return e?e("conversationUrl"):null})(),g=(0,ts.useRef)(null),b=ri(),{enableTranslations:x,disableTranslations:w}=$s();return(0,ts.useEffect)((()=>{a.current=i}),[i]),Sa("askText",(e=>{t({body:e})}),[l.send]),Sa("setVariables",(e=>{n({variables:e})}),[l.send]),Sa("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),Sa("setVisibility",(e=>{Object.values(Jt).includes(e)?(b(),s(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),Sa("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),Sa("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&o(ur({showSuggestions:!1})),e&&t?r({type:Yn,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]),Sa("setContext",(e=>{n(e)}),[l.send]),Sa("setTranslation",(({enabled:e,locale:t})=>{e?x(t):w()}),[l.send]),(0,ts.useEffect)((()=>{m||y||(g.current&&g.current!==v&&c.emit("unreadMessageCount",u),i===Jt.open&&i!==h.current&&0!==d.current&&c.emit("unreadMessageCount",0),i!==Jt.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},Ta=({children:e})=>{const t=Cs(),n=(0,ts.useRef)(null),[r,o]=(0,ts.useState)(),s=(0,ts.useRef)(!0),i=(0,ts.useCallback)((e=>{s.current&&(o(e),t.emit("aria-live",e))}),[o,t]);return(0,ts.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{i({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,i]),(0,ts.useEffect)((()=>()=>{s.current=!1}),[]),(0,Ls.jsxs)(_s.Provider,{value:i,children:[e,(0,Ls.jsxs)("div",{className:Gs("app__live-container"),children:[(0,Ls.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Gs("visually-hidden"),children:r?.ariaLive===Qn?r?.messageText:null}),(0,Ls.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Gs("visually-hidden"),children:r?.ariaLive===er?r?.messageText:null})]})]})},ka=()=>{const{t:e}=ys(),t=jn(),n=(0,ts.useRef)(0),r=(0,ts.useRef)(0),o=Cn().historyLoaded,{sendPolite:s}=ks(),{isOpen:i}=vs(),a=(0,ts.useRef)(null),c=(0,ts.useRef)(null),l=(0,ts.useMemo)((()=>v((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(s(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[s,e]);return(0,ts.useEffect)((()=>{t.length>n.current&&(i&&(c.current=l(t)),n.current=t.length)}),[t,l,i]),(0,ts.useEffect)((()=>{a.current&&!i&&c.current&&(c.current(!0),c.current=null)}),[i]),(0,ts.useEffect)((()=>{o&&setTimeout((()=>{s(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,s]),null},Na=()=>{const{t:e}=ys(),{isOpen:t,isVisible:n}=vs(),r=kn(),{sendPolite:o}=ks(),s=(0,ts.useMemo)((()=>v(o,2e3)),[o]),i=(0,ts.useRef)(null),a=(0,ts.useRef)(null);return(0,ts.useEffect)((()=>{i.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=s(e("message.srTextUnreadCount",{unreadCount:r}))),i.current=n}),[r,t,n,s,e]),null},Aa=({store:e,children:t,eventBus:n,api:r})=>((0,ts.useErrorBoundary)((t=>{console.error(t),e.dispatch(br(t))})),(0,Ls.jsx)(fn,{store:e,children:(0,Ls.jsx)(ws.Provider,{value:n,children:(0,Ls.jsx)(xs.Provider,{value:r,children:(0,Ls.jsx)(Ta,{children:(0,Ls.jsx)(Ms,{children:(0,Ls.jsxs)(ga,{children:[(0,Ls.jsx)(Ea,{}),(0,Ls.jsx)(wa,{}),(0,Ls.jsx)(Na,{}),(0,Ls.jsx)(ka,{}),(0,Ls.jsx)(Ca,{}),(0,Ls.jsxs)(ba,{children:[(0,Ls.jsx)(ja,{}),(0,Ls.jsx)(_a,{children:t})]})]})})})})})})),Ra=Ze(Sn,(e=>e.filter((e=>Vr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===Vn)))),Ia=Ze([Ra],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),Oa=Ze(Ra,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),La=Ze((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),Ma=()=>{const{t:e}=ys(),{showDisclaimer:t}=xn();return t?(0,Ls.jsxs)("div",{className:Gs("disclaimer"),tabIndex:0,children:[(0,Ls.jsx)("h2",{className:Gs("disclaimer__title"),children:e("disclaimer.title")}),(0,Ls.jsx)("div",{className:Gs("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},Pa=Ze([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),Da=Ze(Pa,(e=>e?.controls||{})),Ua=Ze(Da,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Fa=Ze([Da,(e,{name:t})=>t],((e,t)=>e[t]?.value)),Ba=Ze([Da,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),za=(0,o.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:$a,Consumer:Ha}=za,Va=za;function Wa(){return(0,ts.useContext)(Va)}function qa(e){const t=es(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:s}=Wa(),i=!!dn((e=>Pa(e,{formId:n}))),a=dn((t=>Fa(t,{formId:n,name:e}))),c=dn((t=>Ba(t,{formId:n,name:e}))),l=s?.[e],u=!l;(0,ts.useEffect)((()=>{i&&t(jr({formId:n,name:e}))}),[i,n,e,t]),(0,ts.useLayoutEffect)((()=>()=>{t(Tr({formId:n,name:e}))}),[i,n,e,t]);const d=(0,ts.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,ts.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,ts.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:a})),[e,d,p,a]),(0,ts.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function Ga(e){const{t}=ys(),{sendAssertive:n}=ks(),{hasLimit:r,limit:o}=On(),s=(0,ts.useMemo)((()=>v(n,f)),[n]),i=(0,ts.useMemo)((()=>v(((e,n)=>{e&&s(t("input.srCharacterLimitText",{limit:n}))}),f)),[s,t]),[{value:a}]=qa(e),c=o&&r&&a?o-a.length:o,l=!(!r||!c)&&c<=h,u=!(!r||!c)&&c<0;return(0,ts.useEffect)((()=>{i(l,c)}),[l,c,i]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Ka=e=>{const{hasCharacterLimit:t,characterLimit:n}=Ga(e),{entryMeta:{optionsOverride:{text:r}}}=Cn(),{t:o}=ys();return{placeholder:(0,ts.useMemo)((()=>o("input.inputPlaceholder",{hasLimit:t,text:r?.placeholder||o("input.inputPlaceholderText"),limit:t?n:null})),[o,t,n,r?.placeholder]),label:(0,ts.useMemo)((()=>o("input.inputLabel",{hasLimit:!r?.label&&t,text:r?.label||o("input.inputLabelText"),limit:!r?.label&&t?n:null})),[o,t,n,r?.label]),labelClass:(0,ts.useMemo)((()=>r?.label?"label":"visually-hidden"),[r?.label])}};function Ja(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=es(),{entryMeta:{actions:t,translatedActions:n}}=Cn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(jo())}}})(),n=Es();return e?(0,Ls.jsx)("li",{className:Gs(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,Ls.jsx)("button",{className:Gs(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:Yn,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const Xa=(0,o.createContext)(null),Ya=()=>{const e=(0,ts.useContext)(Xa);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},Za=Xa,Qa=e=>{const t=(()=>{const e=(0,ts.useContext)(Ps);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],o=null;return"choice_prompt"===e.payload.type&&(o=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,o]},ec=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=Ya(),{sendAction:o}=Ts(),s=e.payload.id?n[e.payload.id]:void 0,{containerRef:i,isVisible:a}=gs({containerRef:s,freezeOnceVisible:!0}),c=es(),[l,u]=Qa(e);if((0,Os.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(ho(t)),o({type:Kn,events:t})}}),[c,e.payload.id,a,o,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,Ls.jsxs)("li",{className:Gs(d),ref:i,children:[e.payload.timeIndicator&&(0,Ls.jsx)(Ii,{event:e}),(0,Ls.jsx)(l,{event:e,children:(0,Ls.jsx)(u,{event:e})})]})},tc=()=>{const{id:e}=In()||{};return(0,Ls.jsx)("li",{className:Gs("conversation__item","conversation__item--source-agent"),children:(0,Ls.jsxs)("div",{className:Gs("message","message--source-agent","message--type-loading"),children:[(0,Ls.jsx)(ci,{eventPayload:{fromClient:!1,participant:e}}),(0,Ls.jsx)("div",{className:Gs("message__body"),children:(0,Ls.jsxs)("span",{className:Gs("loader"),children:[(0,Ls.jsx)("span",{className:Gs("loader__part","one")}),(0,Ls.jsx)("span",{className:Gs("loader__part","two")}),(0,Ls.jsx)("span",{className:Gs("loader__part","three")}),(0,Ls.jsx)("span",{className:Gs("loader__part","four")})]})})]})})},nc=()=>{const e=jn();let t;return(0,Ls.jsx)(Ls.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let o=!1;if("participant"!==n&&"service_data"!==n){const{participant:n,fromClient:s}=r,i=s?"seamly-client-participant":n;"info"!==e.type&&t!==i&&(o=!0),t=i}return(0,Ls.jsx)(ec,{event:e,newParticipant:o},e.payload.key||e.payload.id)}))})},rc=()=>{const{t:e}=ys(),t=Tn(),n=((e,t=20)=>{const[n,r]=(0,ts.useState)(e),o=(0,ts.useRef)(null);return(0,ts.useEffect)((()=>(o.current=setTimeout((()=>r(e)),t),()=>{o.current&&clearTimeout(o.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=vs(),o=Nn(),s=Bs();return(0,Ls.jsxs)(Ls.Fragment,{children:[r&&(0,Ls.jsx)("a",{className:Gs("skip-link"),href:`#${o}`,onClick:e=>{e.preventDefault(),s()},children:e("skiplinkText")}),(0,Ls.jsx)("div",{className:Gs("chat__body"),children:(0,Ls.jsxs)("div",{className:Gs("conversation__container"),children:[(0,Ls.jsx)(Ma,{}),(0,Ls.jsxs)("ol",{className:Gs("conversation"),children:[(0,Ls.jsx)(ga,{children:(0,Ls.jsx)(nc,{})}),n?(0,Ls.jsx)(tc,{}):null,(0,Ls.jsx)(Ja,{})]})]})})]})};function oc(e,t){const n=(0,ts.useRef)(null),r=(0,ts.useRef)(e);return(0,ts.useEffect)((()=>{r.current=e}),[e]),(0,ts.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const sc={visible:Gs("transition--visible"),in:Gs("transition--in"),visuallyHidden:Gs("visually-hidden")},ic=Object.values(sc),ac=e=>{const t=(0,ts.useRef)(null);t.current=e;const n="function"==typeof e;return(0,ts.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},cc={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},lc=({children:e,isActive:t,timeout:n=300,transitionStartState:r=cc.notRendered,onInTransitionComplete:s=(()=>{}),onOutTransitionComplete:i=(()=>{}),exitAfter:a,enterDelay:c=0})=>{const l=(0,ts.useRef)(!1),u=(0,ts.useRef)(null),d=(0,ts.useRef)(null),p=r===cc.visuallyHidden,[h,f]=(0,ts.useState)((()=>p?[sc.visuallyHidden]:[])),[m,y]=(0,ts.useState)((()=>0===c)),v=(0,ts.useMemo)((()=>a?a+c:a),[c,a]);oc((()=>y(!1)),t?v:void 0),oc((()=>y(!0)),t?c:void 0);const g=(0,ts.useMemo)((()=>m&&t),[t,m]),b=ac(s),x=ac(i),w="notRendered"!==r||h.length>0;return(0,ts.useEffect)((()=>(l.current&&!g&&(f([sc.visible]),u.current=setTimeout((()=>{f([...p?[sc.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&g&&(f([sc.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{f([sc.visible,sc.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,Ls.jsx)(Ls.Fragment,{children:w&&(0,o.toChildArray)(e).filter(j).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!ic.includes(e)));return(0,o.cloneElement)(e,{className:[...n,...h].join(" ")})}))})},uc=({isAside:e=!1})=>{const{isInline:t}=Ln(),{t:n}=ys(),{sendAction:r,addMessageBubble:o}=Ts(),{isOpen:s,setVisibility:i}=vs(),{showSuggestions:a}=xn(),c=ii(),l=Bs(),u=(0,ts.useRef)(null),{sendPolite:d}=ks(),p=dn(As),{hasCountdown:h,endCountdown:f}=oi(),{hasPrompt:m,continueChat:y}=si(),v=bs(),g=("suggestion",Cn().serviceData.suggestion);const{body:b}=Hs({payload:g,type:"service_data"}),x=(0,ts.useMemo)((()=>p?[]:Array.isArray(b)?b:b?.data),[b,p]),w=(0,ts.useRef)(),_=(0,ts.useRef)(!1),C=(0,ts.useRef)(),E=!!x?.length,j=t?(v||s)&&!e:v,T=(0,ts.useRef)(j),k=E&&!j&&a,N=E?x:C.current;C.current=N;const A=(0,ts.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Gs(t)}),[e]),R=(0,ts.useCallback)((({id:e,question:t})=>{h&&f(!0),m&&y(),r({type:qn,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),o(t),s||i(Jt.open),l()}),[o,y,f,l,h,m,g,r,i,s]);(0,ts.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"),O=n("suggestions.footerText"),L=I?"section":"div";return(0,Ls.jsx)(lc,{isActive:!!k,transitionStartState:cc.notRendered,children:(0,Ls.jsxs)(L,{className:A,"aria-labelledby":I?c:void 0,ref:u,children:[I&&(0,Ls.jsx)("p",{id:c,className:Gs("suggestions__heading"),children:I}),!!N&&(0,Ls.jsx)(Si,{suggestions:N,onClickSuggestion:R}),O&&!s&&(0,Ls.jsx)("p",{className:Gs("suggestions__footer"),children:O})]})})},dc=(0,Os.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:o,setVisibility:s}=vs(),{namespace:i,layoutMode:a}=xn(),{isInline:c}=Ln(),l=Ks(),u=bs(),{t:d}=ys(),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"),o&&(0,Ls.jsxs)("section",{className:Gs(p),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&s(Jt.minimized)},tabIndex:-1,ref:n,"aria-label":d("chat.srLabel"),children:[(0,Ls.jsx)("div",{className:Gs("chat-wrapper"),children:e}),"inline"===a&&r&&(0,Ls.jsx)(uc,{isAside:!0})]})})),pc=dc,hc=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:o,id:s})=>{const i=ii();return(0,Ls.jsxs)("section",{tabIndex:-1,id:s,"aria-labelledby":n?i:void 0,className:Gs("chat-status",n?void 0:"chat-status--condensed"),children:[(0,Ls.jsxs)("div",{className:Gs("chat-status__body"),children:[n?(0,Ls.jsx)("h2",{className:Gs("chat-status__title"),id:i,children:n}):null,e]}),"function"==typeof t&&(0,Ls.jsxs)("button",{type:"button",onClick:t,className:Gs("button","button--tertiary","chat-status__close"),children:[r||(0,Ls.jsx)(hi,{name:"close",size:"16",alt:""}),o&&(0,Ls.jsx)("span",{className:Gs("visually-hidden"),children:o})]})]})},fc=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,Ls.jsxs)("button",{type:"button",onClick:e,className:Gs("button","button--primary","chat-status__button"),children:[(0,Ls.jsx)(hi,{name:t,size:"16",alt:""}),n,r&&(0,Ls.jsx)("span",{className:Gs("visually-hidden"),children:r})]});function mc(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=qs(),{id:o}=Vs();return e&&t?(0,Ls.jsx)(hc,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:o,title:t.titleLabel,children:(0,Ls.jsx)(fc,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function yc(){const e=dn(As),{isActive:t}=$s();return e||t?null:(0,Ls.jsx)(mc,{})}const vc=({label:e,checked:t,description:n,onChange:r,id:o,itemClassName:s})=>(0,Ls.jsxs)("li",{className:Gs([s||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:o,children:[(0,Ls.jsx)(hi,{name:"check",size:"16",alt:""}),e," ",n&&(0,Ls.jsxs)("span",{children:["(",n,")"]})]}),gc=({onChange:e,describedById:t})=>{const{context:n}=xn(),r=(0,Os.useMemo)((()=>n?.contentLocale),[n?.contentLocale]),{t:o}=ys(),{languages:s,currentLocale:i,enableTranslations:a,disableTranslations:c}=$s(),l=Bs(),u=t=>()=>{t===i||r===t?c():a(t),e(),l()},{primaryLanguages:d,remainingLanguages:p}=(0,Os.useMemo)((()=>s.reduce(((e,t)=>{const n=t.locale===r,o=((e,t,n)=>t===e.locale||!t&&n)(t,i,n);t.locale!==r&&e.remainingLanguages.push({...t,checked:o,isOriginal:n});const s=e.remainingLanguages.findIndex((e=>e.locale===i));return(n||o&&s>4)&&e.primaryLanguages.push({...t,checked:o,isOriginal:n}),e}),{primaryLanguages:[],remainingLanguages:[]})),[i,r,s]);return(0,Ls.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Gs("translation-options"),children:[d.map((({locale:e,nativeName:t,checked:n,isOriginal:r},s)=>(0,Ls.jsx)(vc,{id:e,label:t,checked:n,description:r?o("translations.settings.original"):void 0,onChange:u(e),itemClassName:Gs({"translation-options__item--original":r,"translation-options__item--selected":n&&0!==s})},e))),p.map((({locale:e,nativeName:t,checked:n,isOriginal:r})=>(0,Ls.jsx)(vc,{id:e,label:t,checked:n,description:r?o("translations.settings.original"):void 0,onChange:u(e)},e)))]})},bc=({className:e,children:t,onCancel:n,headingText:r,description:o,descriptionId:s,cancelButtonText:i,cancelButtonRef:a,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=ii(),{hideOption:d}=ei(),{focusButton:p}=ti(),h=(0,ts.useCallback)((()=>{d(),c||p()}),[c,p,d]),f=(0,ts.useCallback)((()=>{n&&n(),h()}),[h,n]),m=(e=>{const t=(0,ts.useRef)(null);return(0,ts.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,ts.useEffect)((()=>{E(m.current)}),[m]),(0,Ls.jsx)("section",{className:Gs("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,Ls.jsxs)("div",{className:Gs("options__body"),children:[(0,Ls.jsx)("h2",{id:u,className:Gs("options__title"),children:r}),(0,Ls.jsxs)("button",{type:"button",onClick:f,"aria-describedby":u,className:Gs("button","options__close"),ref:e=>{a&&(a.current=e)},children:[(0,Ls.jsx)(hi,{name:"close",size:"16",alt:""}),(0,Ls.jsx)("span",{children:i})]}),o?(0,Ls.jsx)("p",{className:Gs("options__description"),id:s,children:o}):null,(0,Ls.jsx)("div",{className:Gs("options__wrapper"),children:t})]})})},xc=function({onClose:e,position:t}){const{t:n}=ys(),r=ii();return(0,Ls.jsx)(bc,{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,Ls.jsx)(gc,{describedById:r,onChange:e})})};function wc({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,o]=(0,ts.useState)(!1),s=(0,ts.useRef)(null),i=ii();return(0,Ls.jsxs)("div",{className:Gs("translations__container"),onKeyDown:e=>{r&&C(e)===_.Escape&&(o(!1),E(s.current))},children:[(0,Ls.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Ls.jsx)("div",{className:Gs("options__dialog"),role:"dialog",children:(0,Ls.jsx)(xc,{onClose:()=>{o(!1)},position:t})})}),(0,Ls.jsx)("button",{type:"button",className:Gs(["button","chat__options__button",...n]),id:i,onClick:()=>{o(!r)},onKeyDown:e=>{C(e)===_.ArrowDown&&(o(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const _c=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:o,validationSchema:s={},...i})=>{const a=es(),c=dn((e=>Ua(e,{formId:t}))),[l,u]=(0,ts.useState)(!1),[d,p]=(0,ts.useState)({}),{isValid:h,errors:f}=function(e,t){const n=(0,ts.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const o=Array.isArray(r)?r:[r];for(let r=0;r<o?.length;r++)if(!o[r].fn(e[n],o[r].compareValue)){t[n]=o[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,s),m=(0,ts.useMemo)((()=>({...f,...d})),[f,d]);(0,ts.useLayoutEffect)((()=>{a(Er({formId:t,persistData:n}))}),[t,n,a]),(0,ts.useEffect)((()=>()=>{a(Sr({formId:t}))}),[t,n,a]);const y=(0,ts.useCallback)(((e,n)=>{a(kr({formId:t,name:e,value:n}))}),[t,a]),v=(0,ts.useCallback)(((e,n)=>{a(Nr({formId:t,name:e,touched:n}))}),[a,t]),g=(0,ts.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,ts.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&h&&(a(mr(!0)),o(c,{updateControlValue:y,setError:g}))}),[h,a,o,c,y,g]);(0,ts.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,ts.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:s,updateControlValue:y,updateControlTouched:v})),[t,c,m,l,b,s,y,v]);return t?o?(0,Ls.jsx)($a,{...i,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},Cc=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),Ec=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},Sc=e=>!!e?.length,jc=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))},Tc=e=>!!e,kc=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:o,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Wa();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),i=["form"];return!t&&s&&(i.push("form--submitted"),o?i.push("form--valid"):i.push("form--invalid")),(0,Ls.jsx)("form",{onSubmit:r,className:Gs([...i,e]),...n})};function Nc({id:e,error:t}){const[n,r]=(0,ts.useState)(!1);return(0,ts.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,Ls.jsx)("div",{className:Gs("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,Ls.jsxs)("span",{id:e,className:Gs("error__message"),children:[(0,Ls.jsx)(hi,{name:"error",size:"16",alt:""}),t]})})}const Ac=({contentHint:e,id:t,labelText:n,labelClass:r,validity:o,errorText:s,children:i})=>(0,Ls.jsxs)(Ls.Fragment,{children:[e&&(0,Ls.jsx)("span",{id:`${t}-content-hint`,className:Gs("input__content-hint"),children:e}),(0,Ls.jsx)(Nc,{id:`${t}-error`,error:!o&&s}),(0,Ls.jsxs)("div",{className:Gs("form-control__wrapper"),children:[(0,Ls.jsx)("label",{htmlFor:t,className:Gs(r),children:n}),i]})]}),Rc=function({id:e,name:t,type:n,labelText:r,labelClass:o,contentHint:s=null,"aria-invalid":i,"aria-describedby":a,...c}){const{isSubmitted:l}=Wa(),[u,{error:d}]=qa(t),p=l&&d,h=[];return a&&h.push(a),s&&h.push(`${e}-content-hint`),p&&h.push(`${e}-error`),(0,Ls.jsx)(Ac,{id:e,contentHint:s,validity:!p,errorText:d,labelText:r,labelClass:o,children:(0,Ls.jsx)("input",{...u,...c,id:e,type:n,"aria-invalid":i||p?"true":"false","aria-describedby":h.join(" ")||void 0,name:t})})};function Ic({controlName:e,describedById:t}){const{t:n}=ys();return(0,Ls.jsxs)(kc,{noValidate:"true",className:Gs("options__form"),children:[(0,Ls.jsx)(Rc,{id:"email-id",name:e,type:"email",className:Gs("transcript__input"),"aria-describedby":t,labelClass:Gs("label"),labelText:n("options.sendTranscript.label")}),(0,Ls.jsx)("div",{className:Gs("options__actions"),children:(0,Ls.jsx)("button",{type:"submit",className:Gs("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const Oc="email",Lc={sendTranscript:()=>{const[e,t]=(0,ts.useState)(void 0),{hideOption:n}=ei(),{focusButton:r}=ti(),{t:o}=ys(),s=ii(),{sendAction:i}=Ts(),a=(0,ts.useMemo)((()=>({[Oc]:[Cc(Tc,o("options.sendTranscript.noEmailText")),Cc(jc,o("options.sendTranscript.invalidEmailText"))]})),[o]),c=(0,ts.useCallback)((e=>{const t=e[Oc].trim();i({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[i,n,r]),l=(0,ts.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,Ls.jsx)(bc,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),description:o("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,Ls.jsx)(_c,{formId:"sendTranscript",onSubmit:c,validationSchema:a,onError:l,children:(0,Ls.jsx)(Ic,{controlName:Oc,describedById:s})})})}},Mc=()=>{const{optionActive:e}=ei(),t=(0,ts.useRef)(),n=Lc[t.current??e];return e&&(t.current=e),n?(0,Ls.jsx)(n,{}):null},Pc=()=>{const{t:e}=ys(),{menuOptions:t,showOption:n,panelActive:r,hideOption:o}=ei(),{id:s}=ti(),i=(0,ts.useRef)(null),[a,c]=(0,ts.useState)(!1),l=(0,ts.useRef)(null),u=t.length,d=(0,ts.useRef)([]),p=(0,ts.useRef)(!1),h=u>1,f=t[0],m=(0,ts.useMemo)((()=>f?.name?.trim().replace(/\s+/g,"")),[f]);return(0,ts.useEffect)((()=>()=>{i.current&&clearTimeout(i.current)}),[]),(0,ts.useEffect)((()=>{a&&!p.current&&requestAnimationFrame((async()=>{await Ds(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,Ls.jsxs)("div",{className:Gs("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,Ls.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Ls.jsx)("div",{className:Gs("options__dialog"),children:(0,Ls.jsx)(Mc,{})})}),h&&(0,Ls.jsx)(lc,{isActive:a,transitionStartState:cc.notRendered,children:(0,Ls.jsx)("ul",{className:Gs(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":s,children:t.map((({name:r,title:o,available:s},i)=>(0,Ls.jsx)("li",{className:Gs("options__menu__item"),role:"menuitem","data-testid":r,children:(0,Ls.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[i]=e)},className:Gs(["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 o=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=t)})),-1!==o&&d.current&&E(d.current[o])})(e,i),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,s),"aria-disabled":!s,children:[(0,Ls.jsxs)("span",{className:Gs("button__text"),children:[o,!s&&" "]}),s?null:(0,Ls.jsx)("span",{className:Gs("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,Ls.jsxs)("button",{type:"button",className:Gs(["button","button--secondary","chat__options__button",...!h&&m?[`chat__options__button--${m}`]:[]]),id:s,onClick:()=>{r&&o(),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,Ls.jsx)(hi,{name:"options",size:"32",alt:""}):null,(0,Ls.jsx)("span",{className:Gs("button__text"),children:h?e("options.openButtonText"):`${f.title}${f.available?"":" "}`}),h||f.available?null:(0,Ls.jsx)("span",{className:Gs("button__state"),children:e("options.unavailableText")})]})]}):null};function Dc(){const{menuOptions:e,allowOptionSelection:t}=ei(),{isAvailable:n}=$s(),r=dn(As),{t:o,userLocale:s}=ys(),i=Ws(s);if(!n&&(!t||!e.length)||r)return null;const a=o("translations.settings.openButtonText",{hasLanguage:!!i,language:i});return(0,Ls.jsxs)("div",{className:Gs("chat__options"),children:[n&&(0,Ls.jsx)("div",{className:Gs("chat__options-item","chat__options-item--left"),children:(0,Ls.jsxs)(wc,{classNames:["button--secondary"],children:[(0,Ls.jsx)(hi,{alt:a,name:"newTranslation",size:"16"}),(0,Ls.jsx)("span",{className:Gs("button__text"),children:a})]})}),t&&(0,Ls.jsx)("div",{className:Gs("chat__options-item","chat__options-item--right"),children:(0,Ls.jsx)(Pc,{})})]})}const Uc=()=>{const{scrollToRef:e,unreadIds:t}=Ya(),{isMinimized:n}=vs(),{t:r}=ys();return(0,Ls.jsx)(lc,{isActive:!!t.length&&!n,children:(0,Ls.jsx)("div",{className:Gs("unread-messages"),children:(0,Ls.jsxs)("button",{type:"button",className:Gs("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,Ls.jsx)(hi,{name:"chevronDown",size:"32",alt:""})]})})})},Fc=({children:e})=>{const t=jn(),n=(0,ts.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,o.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:s,containerRef:i,unreadIds:a}=(e=>{const t=(0,ts.useRef)(null),[n,r]=(0,ts.useState)(!0),o=dn(Oa),s=jn(),i=Tn(),{isOpen:a}=vs(),c=Cn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=dn((({state:e})=>e));(0,ts.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,s=Math.abs(t-n-o)>10;r(!s)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,ts.useCallback)((()=>{requestAnimationFrame((async()=>{await Ds(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,ts.useEffect)((()=>{u&&d()}),[u,d]),(0,ts.useEffect)((()=>{n&&d()}),[n,o,s,i,a,c,l,d]),{containerRef:t,unreadIds:o,scrollToRef:()=>{const n=o.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,Ls.jsx)(Za.Provider,{value:{eventRefs:n,unreadIds:a,scrollToRef:r,scrollToBottom:s,containerRef:i},children:(0,Ls.jsxs)("div",{className:Gs("chat__container"),children:[(0,Ls.jsx)("div",{className:Gs("chat__container__scroll-area"),ref:i,children:e}),(0,Ls.jsx)(Uc,{})]})})},Bc=({baseClassName:e,children:t,title:n})=>{const r=Nn(),o=ii();return(0,Ls.jsxs)("section",{id:r,className:Gs(e),"aria-describedby":o,tabIndex:-1,children:[(0,Ls.jsx)("h2",{className:Gs(`${e}__title`),id:o,children:n}),t]})},zc=()=>{const{t:e}=ys(),t=Bs(),n=ri(),{emitEvent:r}=Ts(),{isActive:o,remaining:s,timer:i,endCountdown:a}=oi(),c=!!s&&s>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,Ls.jsx)(Bc,{baseClassName:"idle",title:l,children:c&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("div",{className:Gs("idle__count-container"),children:o&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("span",{className:Gs("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,Ls.jsx)("span",{className:Gs("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",i)})]})}),(0,Ls.jsxs)("div",{className:Gs("idle__options"),children:[(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{n(),a(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{a(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},$c=()=>{const{t:e}=ys(),t=ri(),{name:n}=In()||{},{continueChat:r,restartChat:o}=si();return(0,Ls.jsx)(Bc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,Ls.jsxs)("div",{className:Gs("prompt__options"),children:[(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},Hc=()=>{const{sendAction:e}=Ts(),{features:t}=ei(),{typingPeekahead:n}=t||{},r=(0,ts.useRef)(null),o=(0,ts.useRef)(null),s=(0,ts.useRef)(!1),i=(0,ts.useRef)(null);(0,ts.useEffect)((()=>()=>{i.current&&clearInterval(i.current),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current)}),[]);const a=(t,r)=>{e({type:Gn,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(s.current=!0,i.current||(a(!0,e.target.value),i.current=setInterval((()=>{!s.current&&i.current?(clearInterval(i.current),i.current=null):n&&n.enabled&&a(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current),r.current=setTimeout((()=>{s.current=!1}),300),o.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}},Vc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=Cn().entryMeta,s=es(),i=n||t||e,a=o[i]||r[i]||{},c=(0,ts.useCallback)((e=>{s(po(e))}),[s]),l=(0,ts.useCallback)((e=>{s(lo(e))}),[s]),u=(0,ts.useCallback)((e=>{s(Io(e))}),[s]),d=(0,ts.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:i,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Wc({controlName:e,skipLinkId:t}){const{t:n}=ys(),{sendAssertive:r}=ks(),{emitEvent:o}=Ts(),s=Hc(),{setBlockAutoEntrySwitch:i}=Vc(),{placeholder:a,label:c,labelClass:l}=Ka(e),{hasCharacterLimit:u,reachedCharacterWarning:d,reachedCharacterLimit:p,remainingChars:h}=Ga(e),[{value:f}]=qa(e),m=!!f,y=(0,ts.useCallback)((()=>{d&&r(n("input.srCharacterLimitText",{limit:h})),o("ui.inputFocus")}),[n,r,d,h,o]);return(0,ts.useLayoutEffect)((()=>(i(m),()=>{i(!1)})),[i,m]),(0,Ls.jsxs)(kc,{className:Gs("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,Ls.jsxs)("div",{className:Gs(["input--text__container",...d&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,Ls.jsx)(Rc,{id:t,type:"text",name:e,className:Gs("input__text"),autocomplete:"off",placeholder:a,labelText:c,labelClass:Gs(l),"aria-invalid":!!u&&p,onKeyUp:s,onFocus:y}),(0,Ls.jsx)("div",{className:Gs("character-count"),children:d&&(0,Ls.jsx)("span",{children:h})})]}),(0,Ls.jsx)("button",{className:Gs("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!m||p,children:(0,Ls.jsx)(hi,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const qc="textMessageEntry";function Gc({...e}){const{isOpen:t,setVisibility:n}=vs(),r=Nn(),o=Bs(),{sendMessage:s}=Ts(),i=(0,ts.useCallback)(((e,{updateControlValue:r})=>{s({body:e[qc]}),r(qc,""),o(),t||n(Jt.open)}),[s,o,t,n]);return(0,Ls.jsx)(_c,{...e,formId:"textEntry",persistData:!0,onSubmit:i,children:(0,Ls.jsx)(Wc,{controlName:qc,skipLinkId:r})})}const Kc=()=>{const{t:e}=ys(),{currentUploads:t}=Qs();return(0,Ls.jsx)("div",{className:Gs("progress"),children:t.map((({id:t,name:n,progress:r,uploading:o,error:s})=>(0,Ls.jsxs)("div",{className:Gs("progress_container"),children:[(0,Ls.jsxs)("div",{className:Gs("progress__text"),children:[(0,Ls.jsx)("span",{className:Gs("progress__text--file-name"),children:n}),(0,Ls.jsx)("span",{className:Gs("progress__text--percentage"),children:`${r}%`})]}),(0,Ls.jsx)(Nc,{error:s,id:"progress-error"}),(0,Ls.jsx)("progress",{className:Gs("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":o,children:`${r}%`})]},t)))})};function Jc({id:e,name:t,labelText:n,contentHint:r,outputText:o,accept:s}){const{isSubmitted:i}=Wa(),[a,c]=(0,ts.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=qa(t),p=ii(),h=ii(),f=ii(),m=i&&d,y=[f];r&&y.push(h),m&&y.push(p);const v=(0,ts.useCallback)((()=>{c(!0)}),[c]),g=(0,ts.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,ts.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,Ls.jsxs)("div",{className:Gs("upload__container"),children:[r&&(0,Ls.jsx)("span",{className:Gs("upload__content-hint"),id:h,children:r}),(0,Ls.jsx)(Nc,{id:p,error:m&&d}),(0,Ls.jsx)("div",{className:Gs(["file-upload",...a?["focus-within"]:[]]),children:(0,Ls.jsxs)("label",{htmlFor:e,className:Gs("upload__label"),children:[(0,Ls.jsx)(hi,{name:"upload",size:"32",alt:""}),(0,Ls.jsxs)("div",{children:[(0,Ls.jsx)("span",{className:Gs(["upload__label--text"]),children:n}),(0,Ls.jsx)("input",{id:e,className:Gs("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:s||null,onFocus:v,onBlur:g}),(0,Ls.jsx)("span",{className:Gs("upload__output"),"aria-hidden":"true",id:f,children:o})]})]})})]})}const Xc=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:o,isComplete:s,onClickCancel:i})=>{const{t:a}=ys(),[{value:c}]=qa(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,Ls.jsxs)(kc,{className:Gs("upload-form"),children:[(0,Ls.jsx)(Jc,{name:t,id:e,accept:n,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,Ls.jsxs)("div",{className:Gs("upload__button-container"),children:[(0,Ls.jsx)("button",{id:o||!s?e:void 0,type:"button",onClick:i,className:Gs("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,Ls.jsx)("button",{className:Gs("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})},Yc="fileListForm",Zc="fileList",Qc=()=>{const{t:e}=ys(),{sendPolite:t,sendAssertive:n}=ks(),r=Nn(),o=Bs(),{serviceAllowsUploads:s,allowedMimeTypes:i,maxSize:a}=Zs(),c=(0,ts.useRef)(null),l=(0,ts.useRef)(s),{cancelEntrySelection:u}=Vc(),{uploadFile:d,clearUploads:p,isUploading:h,isComplete:f}=Qs(),{uploadHandle:m,hasServerError:y,progress:v}=((e,t)=>{const n=dn((n=>Fa(n,{formId:e,name:t}))),{currentUploads:r}=Qs(),o=n&&n.length>0;let s=null,i=!1,a=0;if(r&&r.length>0){const e=r[0];s=e.uploadHandle,i=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:s,hasServerError:i,progress:a}})(Yc,Zc),g=ii(),b=(0,ts.useRef)(!0),w=e("fileUpload.contentHint",{size:x(a)}),_=(0,ts.useRef)(""),C=(0,ts.useRef)(null);(0,ts.useEffect)((()=>{_.current&&C.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(w),_.current=w}),[w,n]),(0,ts.useEffect)((()=>{v>0&&t(1===v?e("fileUpload.srStartedText"):`${v}%`)}),[v,t,e]),(0,ts.useEffect)((()=>{b.current||h||!f||(p(),u(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=f}),[h,f,p,u,o,t,e]);const E=(0,ts.useCallback)((({fileList:e})=>{d(e[0]),o()}),[d,!1,o]),S=(0,ts.useCallback)((()=>{m&&m.abort(),p(),u(),o()}),[m,p,u,o]),j=(0,ts.useMemo)((()=>({[Zc]:[Cc((()=>s),e("fileUpload.errors.unavailable")),Cc(Sc,e("fileUpload.errors.noFile")),Cc(Ec,e("fileUpload.errors.tooLarge"),a)]})),[a,s,e]);return(0,Ls.jsx)("div",{className:Gs(["upload",...y?["upload--error"]:[]]),ref:C,children:(0,Ls.jsxs)(_c,{formId:Yc,persistData:!0,onSubmit:E,validationSchema:j,children:[(h||!f)&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)(Kc,{}),(0,Ls.jsx)("div",{className:Gs("upload__button-container"),children:(0,Ls.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,ref:c,className:Gs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&f&&(0,Ls.jsx)(Xc,{controlName:Zc,skiplinkId:r,accept:i?.join(", ")||"",contentHint:w,isComplete:f,isUploading:h,onClickCancel:S}),!l.current&&(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)("span",{className:Gs("notification"),id:g,children:e("fileUpload.unavailableText")}),(0,Ls.jsx)("div",{className:Gs("upload__button-container"),children:(0,Ls.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:S,className:Gs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},el=()=>{const{t:e}=ys(),{showFileUpload:t,serviceAllowsUploads:n}=Zs(),[r,o]=(0,ts.useState)(n||!1),s=Bs(),i=(0,ts.useRef)(null),{setUserEntryType:a,activeEntry:c}=Vc(),l=(0,ts.useRef)(null),{sendPolite:u}=ks(),d=!!In();return(0,ts.useEffect)((()=>{S(l.current,(()=>{n||s()})),o(n||!1)}),[n,s]),(0,ts.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===Hn?null:(0,Ls.jsx)(lc,{isActive:r,transitionStartState:cc.rendered,children:(0,Ls.jsx)("div",{className:Gs("upload-toggle-wrapper"),children:(0,Ls.jsx)(lc,{isActive:r,transitionStartState:cc.visuallyHidden,children:(0,Ls.jsx)("button",{className:Gs(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{a(Hn),s()}:void 0,children:(0,Ls.jsx)(hi,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},tl=()=>{const{isOpen:e}=vs(),t=(0,ts.useRef)(null),{hasCountdown:n}=oi(),[r,o]=(0,ts.useState)(n),{hasPrompt:s}=si(),[i,a]=(0,ts.useState)(s),c=Bs(),l=(0,ts.useRef)(!1),{activeEntry:u}=Vc(),[d,p]=(0,ts.useState)({text:Gc,upload:Qc}),[h,f]=(0,ts.useState)((()=>u)),m=xn(),{accountAllowsUploads:y}=Zs(),v=(0,ts.useCallback)((()=>{S(t.current,c)}),[c]);(0,ts.useEffect)((()=>{const{customComponents:e}=m,{entry:t}=e||{};t&&p((e=>({...e,...t})))}),[m]),(0,ts.useEffect)((()=>{v(),o(n),a(s)}),[n,s,v]),(0,ts.useEffect)((()=>{f(u),v()}),[u,v,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const g=d[h];return(0,Ls.jsxs)("div",{className:Gs("chat__entry"),ref:t,children:[r&&(0,Ls.jsx)(zc,{}),i&&(0,Ls.jsx)($c,{}),(0,Ls.jsxs)("div",{className:Gs(["entry__body",...n||s?["entry__body--hidden"]:[]]),children:[h!==Hn&&y&&e?(0,Ls.jsx)(el,{}):null,(0,Ls.jsx)(g,{})]})]})},nl=()=>{const{t:e}=ys(),{isOpen:t,closeChat:n}=vs(),{isWindow:r}=Ln();return t&&r?(0,Ls.jsx)("button",{type:"button",className:Gs("button","collapse-button"),onClick:n,children:(0,Ls.jsx)(hi,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},rl=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:o,srText:s}}=Rs(),i=Ts(),a=ii(),{sendPolite:c}=ks(),l=Bs(),u="SeamlySessionExpiredError"===e?.name;return(0,ts.useEffect)((()=>{!u&&s&&setTimeout((()=>{c(s)}),200)}),[c,s,u]),u?(0,Ls.jsx)(Ls.Fragment,{}):(0,Ls.jsxs)("section",{className:Gs("interrupt"),"aria-labelledby":a,children:[(0,Ls.jsx)(nl,{}),(0,Ls.jsxs)("div",{className:Gs("interrupt__body"),children:[(0,Ls.jsx)("h2",{id:a,className:Gs("interrupt__title"),children:t}),(0,Ls.jsx)("p",{className:Gs("interrupt__message"),children:n}),r&&o&&(0,Ls.jsx)("div",{className:Gs("interrupt__actions"),children:(0,Ls.jsx)("button",{type:"button",className:Gs("button","button--primary"),onClick:()=>{o&&i[o]&&i[o](),l()},children:r})})]})]})},ol=function({children:e}){const t=dn(As),{isOpen:n}=vs();return t?(0,Ls.jsx)(rl,{}):(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsxs)(Fc,{children:[(0,Ls.jsxs)("div",{className:Gs("chat__container__header"),children:[(0,Ls.jsx)(yc,{}),(0,Ls.jsx)(nl,{})]}),e]}),(0,Ls.jsx)(tl,{}),n&&(0,Ls.jsx)(Dc,{})]})};function sl({event:e}){const[t]=Qa(e);return(0,Ls.jsx)("li",{children:(0,Ls.jsx)(t,{event:e})})}function il({events:e}){return(0,Ls.jsx)("ul",{className:Gs("collapsed-chat-messages"),children:e.map((e=>(0,Ls.jsx)(sl,{event:e},e.payload.id)))})}function al(){const{preChatEvents:e}=xn(),t=dn(As),{isOpen:n}=vs();return t||!e?.length||n?null:(0,Ls.jsx)(il,{events:e})}function cl(){const{t:e}=ys(),t=e("window.chat.continue"),n=(0,ts.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t}}})),[t]);return(0,Ls.jsx)(il,{events:[n]})}const ll=()=>{const e=wn(),t=In(),n=dn(As),r=t&&!n,o=r?t.avatar:e;return o?(0,Ls.jsx)("img",{className:Gs(r?"avatar":"icon"),src:o,alt:""}):(0,Ls.jsx)(hi,{name:"avatar",size:"32",alt:""})},ul=({onClick:e})=>{const t=js(),{t:n}=ys(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),o=Bs(),{isOpen:s}=vs(),i=kn(),a=(0,ts.useCallback)((()=>{e(),o()}),[o,e]);return(0,Ls.jsx)(lc,{isActive:!s,transitionStartState:cc.rendered,children:(0,Ls.jsxs)("button",{className:Gs("window-open-button"),"aria-label":r,"aria-hidden":s,onClick:a,children:[(0,Ls.jsx)(lc,{isActive:!!i,transitionStartState:cc.notRendered,children:(0,Ls.jsx)("span",{className:Gs("message-count"),"aria-hidden":"true",children:i})}),(0,Ls.jsx)(ll,{})]})})},dl=(e,t,n)=>"object"==typeof e?e[t]:n,pl=n.p+"sounds/beep.mp3",hl=!!window.Notification,fl={app:()=>(0,Ls.jsx)(pc,{children:(0,Ls.jsx)(ol,{children:(0,Ls.jsx)(rc,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=es(),{connectWhenInView:t}=xn(),n=dn(Pn),{containerRef:r,isVisible:o}=gs({enabled:t,freezeOnceVisible:!0});return(0,ts.useEffect)((()=>{o&&e(Yo())}),[e,o]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=vs();return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)(lc,{isActive:!n,transitionStartState:cc.rendered,children:(0,Ls.jsxs)("div",{ref:t,className:Gs("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,Ls.jsx)(al,{}),(0,Ls.jsx)(uc,{})]})}),(0,Ls.jsx)(lc,{isActive:n,transitionStartState:cc.rendered,children:(0,Ls.jsx)(pc,{ref:t,children:e&&(0,Ls.jsx)(ol,{children:n&&(0,Ls.jsx)(rc,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=vs(),n=bs(),{continueChat:r,preChat:o}=xn();return(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)(ul,{onClick:t}),(0,Ls.jsx)(lc,{isActive:!!o&&!e&&!n,exitAfter:dl(o,"exitAfter"),enterDelay:dl(o,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Ls.jsx)("div",{className:Gs("unstarted-wrapper","unstarted-wrapper--window"),children:(0,Ls.jsx)(al,{})})}),(0,Ls.jsx)(lc,{isActive:r&&!e&&n,exitAfter:dl(r,"exitAfter"),enterDelay:dl(r,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Ls.jsx)("div",{className:Gs("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,Ls.jsx)(cl,{})})}),(0,Ls.jsx)(lc,{isActive:e,transitionStartState:cc.notRendered,children:(0,Ls.jsx)(pc,{children:(0,Ls.jsx)(ol,{children:(0,Ls.jsx)(rc,{})})})})]})}};function ml(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const yl=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=An(),{notificationAudioURL:t}=xn(),[n,r]=(0,ts.useState)(hl?Notification.permission:"default"),[o,s]=(0,ts.useState)(document.visibilityState),i=dn(La),a=(0,ts.useCallback)((async()=>{if(hl&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,ts.useMemo)((()=>"granted"===n),[n]),l=(0,ts.useMemo)((()=>"hidden"===o),[o]);(0,ts.useEffect)((()=>{"default"===n&&e&&a()}),[n,e,a]);const u=(0,ts.useCallback)((async(e,r)=>{if(i&&hl){if("default"===n&&a(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||pl);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=${qc}]`);e&&e.focus()}}}}),[t,n,c,a,i,l]);return(0,ts.useEffect)((()=>{if(!i)return()=>{};function e(){s(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[i]),{permission:n,requestPermission:a,sendNotification:u}})(),[,n]=Us(),r=xn(),o=In(),{proactiveMessages:s}=An(),{isOpen:i,isVisible:a}=vs(),c=Ks(),l=bs(),u=dn(Ia),{body:d}=Hs(u),{userLocale:p}=ys(),h=(0,ts.useRef)(void 0),f=(0,ts.useMemo)((()=>d?"string"==typeof d?ml(d):"text"in d?ml(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?ml(d.prompt?.text):"":""),[d]);(0,ts.useEffect)((()=>{o?.name&&f&&s&&u&&h.current!==u.payload?.id&&(t(o.name,{body:f,icon:o?.avatar}),h.current=u.payload.id)}),[o?.avatar,o?.name,u,f,s,t]);const m=fl[r.layoutMode],y=(0,ts.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),v=(0,ts.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,Ls.jsx)("div",{className:Gs(g),lang:v,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,Ls.jsx)(m,{})}):null},vl=e=>(0,Ls.jsx)(Aa,{...e,children:(0,Ls.jsx)(yl,{})});class gl{constructor(e,n){const{namespace:r="",parentElement:o,...s}=e;this.config={...s,namespace:r},this.namespace=r,this.parentElement=o,this.externalApi=n,this.api=new ee({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=Qo({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(lr(n)),await r.dispatch(Wt()),await r.dispatch(or()),r.dispatch(Fn()),e?(0,o.render)((0,Ls.jsx)(Aa,{eventBus:this.eventBus,store:r,api:this.api,children:(0,Ls.jsx)(e,{})}),this.parentElement):(0,o.render)((0,Ls.jsx)(vl,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,o.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 bl=e=>"object"==typeof e&&"action"in e,xl=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),wl=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(bl).map(xl)).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),!0;case"setContext":const{userLocale:o,contentLocale:s}=t;return this.context.userLocale=o,this.context.contentLocale=s,!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:o}=n||t;if(o?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==o||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,o=Object.values(this._instances);return!n&&o.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),o.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new gl(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},o={...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(o):o}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},_l=()=>{const e=es();return{addEvent:t=>e(Yr(t)),clearEvents:()=>e(Qr()),setHistory:t=>e(go(t)),setEventsRead:t=>e(ho(t)),setLoadedImageEventIds:t=>e(wo(t)),ackEvent:t=>e(Xr(t)),setIsLoading:t=>e(xo(t)),setParticipant:t=>e(_o(t)),setHeaderTitle:t=>e(vo(t)),setHeaderSubTitle:t=>e(yo(t)),resetHistoryLoadedFlag:()=>e(co()),setActiveService:t=>e(uo(t)),initIdleDetachCountdown:t=>e(so(t)),decrementIdleDetachCountdownCounter:()=>e(ro()),stopIdleDetachCountdownCounter:()=>e(Po()),clearIdleDetachCountdown:()=>e(to()),initResumeConversationPrompt:()=>e(io()),clearResumeConversationPrompt:()=>e(no()),setServiceDataItem:t=>e(Eo(t)),setFeatures:t=>e(mo(t)),setFeatureEnabledState:t=>e(fo(t)),clearFeatures:()=>e(eo()),setInitialState:t=>e(bo(t)),setUserSelectedOptions:t=>e(Lo(t)),setUserSelectedOption:t=>e(Oo(t)),showOption:t=>e(Mo(t)),hideOption:()=>e(oo()),setServiceEntryMetadata:t=>e(So(t)),setBlockAutoEntrySwitch:t=>e(po(t)),setActiveEntryType:t=>e(lo(t)),setUserEntryType:t=>e(Io(t)),registerUpload:t=>e(ao(t)),setUploadProgress:t=>e(No(t)),setUploadComplete:t=>e(To(t)),setUploadError:t=>e(ko(t)),clearAllUploads:()=>e(Zr()),setSeamlyContainerElement:t=>e(Co(t))}},Cl=()=>{const{t:e}=ys(),{title:t,subTitle:n}=Cn().headerTitles,r=kn(),{isOpen:o}=vs(),s=In(),i=dn(As),a=wn(),c=s?.avatar??a,l=i?"":n,u=["message-count"];return o&&u.push("message-count__hide"),0===r&&u.push("message-count__empty"),l||!o?(0,Ls.jsxs)("div",{className:Gs("agent-info"),children:[(0,Ls.jsxs)("div",{className:Gs("agent-info__graphic"),children:[c?(0,Ls.jsx)("img",{className:Gs(s?.avatar?"avatar":"icon"),src:c,alt:""}):(0,Ls.jsx)(hi,{name:"avatar",size:"32",alt:""}),(0,Ls.jsx)("span",{className:Gs(u),"aria-hidden":"true",children:r})]}),(0,Ls.jsxs)("div",{className:Gs("agent-info__body"),children:[(0,Ls.jsx)("p",{className:Gs("agent-info__heading"),children:t??e("header.title")}),(0,Ls.jsx)("p",{className:Gs("agent-info__text"),children:l})]})]}):null},El=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:n}=Cn(),r=(0,ts.useRef)(null),{t:o}=ys();return(0,Ls.jsxs)("header",{className:Gs("chat__header"),children:[e,(0,Ls.jsx)("div",{className:Gs("header-controls"),children:(0,Ls.jsx)("button",{type:"button",className:Gs("button","header-controls__collapse"),onClick:t,ref:r,id:n,children:(0,Ls.jsx)(hi,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},Sl=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 wl(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
|
|
3
3
|
//# sourceMappingURL=~/index.min.js.map
|