@seamly/web-ui 23.0.0-alpha.1 → 23.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/lib/components.js +9 -5
- package/build/dist/lib/components.js.map +1 -1
- package/build/dist/lib/components.min.js +1 -1
- package/build/dist/lib/components.min.js.map +1 -1
- package/build/dist/lib/hooks.js +7 -3
- package/build/dist/lib/hooks.js.map +1 -1
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/hooks.min.js.map +1 -1
- package/build/dist/lib/index.debug.js +4 -4
- 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 +10 -6
- 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 +10 -6
- 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 +10 -6
- 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 +10 -6
- 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/domains/app/actions.ts +5 -2
- package/src/javascripts/domains/translations/components/options-dialog/translation-options.tsx +2 -2
- package/src/javascripts/domains/translations/middleware.ts +3 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={5576:e=>{e.exports=()=>()=>null},1792: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 i=t[r]||n,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(r){for(var o,i=t[r]||n,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],n.slice.call(arguments,1));return e}}},144:(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:()=>C,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>J,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>q,createPortal:()=>S,createRef:()=>r.createRef,default:()=>ce,findDOMNode:()=>Y,flushSync:()=>Q,forwardRef:()=>p,hydrate:()=>P,isElement:()=>ie,isFragment:()=>K,isValidElement:()=>G,lazy:()=>w,memo:()=>l,render:()=>R,startTransition:()=>te,unmountComponentAtNode:()=>X,unstable_batchedUpdates:()=>Z,useDeferredValue:()=>ne,useInsertionEffect:()=>oe,useSyncExternalStore:()=>se,useTransition:()=>re,version:()=>W});var r=n(9150),o=n(8056),i={};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&&(i[e]=()=>o[e]);function s(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){this.props=e}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,i),(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=s({},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,i=t;i=i.__;)if((o=i.__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 v=r.options.unmount;function y(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=s({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return y(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 i(i){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,i)}return i.displayName="Lazy",i.__f=!0,i}function C(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),v&&v(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),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;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(s,s)},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]=y(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return i&&(i.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),i]};var _=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function j(e){return this.getChildContext=function(){return e.context},e.children}function E(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)(j,{context:t.context},e.__v),t.l)}function S(e,t){var n=(0,r.createElement)(E,{__v:e,i:t});return n.containerInfo=t,n}(C.prototype=new r.Component).__a=function(e){var t=this,n=x(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),_(t,e,r)):o()};n?n(i):i()}},C.prototype.render=function(e){this.u=null,this.o=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},C.prototype.componentDidUpdate=C.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){_(e,n,t)}))};var T="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,O=/^(?: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]/,k=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,N=/[A-Z0-9]/g,A="undefined"!=typeof document,I=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function R(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function P(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 L=r.options.event;function M(){}function D(){return this.cancelBubble}function F(){return this.defaultPrevented}r.options.event=function(e){return L&&(e=L(e)),e.persist=M,e.isPropagationStopped=D,e.isDefaultPrevented=F,e.nativeEvent=e};var U,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 i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||A&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"ondoubleclick"===a?i="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||I(t.type)?"onfocus"===a?i="onfocusin":"onblur"===a?i="onfocusout":k.test(i)?i=a:-1===n.indexOf("-")&&O.test(i)?i=i.replace(N,"-$&").toLowerCase():null===s&&(s=void 0):a=i="oninput","oninput"===a&&o[i=a]&&(i="oninputCapture"),o[i]=s}}"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),U=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),U=null};var V={ReactCurrentDispatcher:{current:{readContext:function(e){return U.__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,ie=G;function se(e,t){var n=t(),r=(0,o.useState)({h:{__:n,v:t}}),i=r[0].h,s=r[1];return(0,o.useLayoutEffect)((function(){i.__=n,i.v=t,ae(i)&&s({h:i})}),[e,n,t]),(0,o.useEffect)((function(){return ae(i)&&s({h:i}),e((function(){ae(i)&&s({h:i})}))}),[e]),n}function ae(e){var t,n,r=e.v,o=e.__;try{var i=r();return!((t=o)===(n=i)&&(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:se,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:R,hydrate:P,unmountComponentAtNode:X,createPortal:S,createElement:r.createElement,createContext:r.createContext,createFactory:q,cloneElement:J,createRef:r.createRef,Fragment:r.Fragment,isValidElement:G,isElement:ie,isFragment:K,findDOMNode:Y,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:Q,unstable_batchedUpdates:Z,StrictMode:ee,Suspense:b,SuspenseList:C,lazy:w,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:V}},7556:(e,t,n)=>{"use strict";var r=n(144),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useSyncExternalStore,s=r.useRef,a=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=s(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,i=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return s=t}return s=e}if(t=s,o(i,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(i=e,s=n)}var i,s,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=i(e,d[0],d[1]);return a((function(){p.hasValue=!0,p.value=h}),[h]),l(h),h}},6728:(e,t,n)=>{"use strict";e.exports=n(7556)},9150:e=>{"use strict";e.exports=require("preact")},8056:e=>{"use strict";e.exports=require("preact/hooks")},6592:(e,t,n)=>{"use strict";n(1440);var r=n(1568);e.exports=r("Array","at")},1896:(e,t,n)=>{"use strict";var r=n(9063),o=n(4596),i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not a function")}},2328:(e,t,n)=>{"use strict";var r=n(1840),o=n(8340),i=n(368).f,s=r("unscopables"),a=Array.prototype;void 0===a[s]&&i(a,s,{configurable:!0,value:o(null)}),e.exports=function(e){a[s][e]=!0}},8424:(e,t,n)=>{"use strict";var r=n(808),o=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not an object")}},2196:(e,t,n)=>{"use strict";var r=n(9740),o=n(4160),i=n(9480),s=function(e){return function(t,n,s){var a,c=r(t),l=i(c),u=o(s,l);if(e&&n!=n){for(;l>u;)if((a=c[u++])!=a)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},5983:(e,t,n)=>{"use strict";var r=n(1447),o=r({}.toString),i=r("".slice);e.exports=function(e){return i(o(e),8,-1)}},4304:(e,t,n)=>{"use strict";var r=n(6216),o=n(9976),i=n(4560),s=n(368);e.exports=function(e,t,n){for(var a=o(t),c=s.f,l=i.f,u=0;u<a.length;u++){var d=a[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},3652:(e,t,n)=>{"use strict";var r=n(3528),o=n(368),i=n(9200);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},9200:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},3244:(e,t,n)=>{"use strict";var r=n(9063),o=n(368),i=n(316),s=n(1544);e.exports=function(e,t,n,a){a||(a={});var c=a.enumerable,l=void 0!==a.name?a.name:t;if(r(n)&&i(n,l,a),a.global)c?e[t]=n:s(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}},1544:(e,t,n)=>{"use strict";var r=n(5624),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}},3528:(e,t,n)=>{"use strict";var r=n(6040);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},9308:(e,t,n)=>{"use strict";var r=n(5624),o=n(808),i=r.document,s=o(i)&&o(i.createElement);e.exports=function(e){return s?i.createElement(e):{}}},8232:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},3356:(e,t,n)=>{"use strict";var r,o,i=n(5624),s=n(8232),a=i.process,c=i.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&&s&&(!(r=s.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},1568:(e,t,n)=>{"use strict";var r=n(5624),o=n(1447);e.exports=function(e,t){return o(r[e].prototype[t])}},4656:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3748:(e,t,n)=>{"use strict";var r=n(5624),o=n(4560).f,i=n(3652),s=n(3244),a=n(1544),c=n(4304),l=n(5272);e.exports=function(e,t){var n,u,d,p,h,f=e.target,m=e.global,v=e.stat;if(n=m?r:v?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+(v?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),s(n,u,p,e)}}},6040:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},5744:(e,t,n)=>{"use strict";var r=n(6040);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},892:(e,t,n)=>{"use strict";var r=n(5744),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},3788:(e,t,n)=>{"use strict";var r=n(3528),o=n(6216),i=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,a=o(i,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&s(i,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},1447:(e,t,n)=>{"use strict";var r=n(5744),o=Function.prototype,i=o.call,s=r&&o.bind.bind(i,i);e.exports=r?s:function(e){return function(){return i.apply(e,arguments)}}},4960:(e,t,n)=>{"use strict";var r=n(5624),o=n(9063);e.exports=function(e,t){return arguments.length<2?(n=r[e],o(n)?n:void 0):r[e]&&r[e][t];var n}},364:(e,t,n)=>{"use strict";var r=n(1896),o=n(952);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},5624: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")()},6216:(e,t,n)=>{"use strict";var r=n(1447),o=n(6804),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(o(e),t)}},6480:e=>{"use strict";e.exports={}},6836:(e,t,n)=>{"use strict";var r=n(4960);e.exports=r("document","documentElement")},784:(e,t,n)=>{"use strict";var r=n(3528),o=n(6040),i=n(9308);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},6212:(e,t,n)=>{"use strict";var r=n(1447),o=n(6040),i=n(5983),s=Object,a=r("".split);e.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"===i(e)?a(e,""):s(e)}:s},8460:(e,t,n)=>{"use strict";var r=n(1447),o=n(9063),i=n(9136),s=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(e){return s(e)}),e.exports=i.inspectSource},5444:(e,t,n)=>{"use strict";var r,o,i,s=n(280),a=n(5624),c=n(808),l=n(3652),u=n(6216),d=n(9136),p=n(8192),h=n(6480),f="Object already initialized",m=a.TypeError,v=a.WeakMap;if(s||d.state){var y=d.state||(d.state=new v);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw new m(f);return t.facade=e,y.set(e,t),t},o=function(e){return y.get(e)||{}},i=function(e){return y.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]:{}},i=function(e){return u(e,g)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(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}}}},9063: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}},5272:(e,t,n)=>{"use strict";var r=n(6040),o=n(9063),i=/#|\.prototype\./,s=function(e,t){var n=c[a(e)];return n===u||n!==l&&(o(t)?r(t):!!t)},a=s.normalize=function(e){return String(e).replace(i,".").toLowerCase()},c=s.data={},l=s.NATIVE="N",u=s.POLYFILL="P";e.exports=s},952:e=>{"use strict";e.exports=function(e){return null==e}},808:(e,t,n)=>{"use strict";var r=n(9063);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},2804:e=>{"use strict";e.exports=!1},6232:(e,t,n)=>{"use strict";var r=n(4960),o=n(9063),i=n(6056),s=n(9448),a=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&i(t.prototype,a(e))}},9480:(e,t,n)=>{"use strict";var r=n(960);e.exports=function(e){return r(e.length)}},316:(e,t,n)=>{"use strict";var r=n(1447),o=n(6040),i=n(9063),s=n(6216),a=n(3528),c=n(3788).CONFIGURABLE,l=n(8460),u=n(5444),d=u.enforce,p=u.get,h=String,f=Object.defineProperty,m=r("".slice),v=r("".replace),y=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="["+v(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!s(e,"name")||c&&e.name!==t)&&(a?f(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&s(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?a&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return s(r,"source")||(r.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return i(this)&&p(this).source||l(this)}),"toString")},1736: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)}},8340:(e,t,n)=>{"use strict";var r,o=n(8424),i=n(5045),s=n(4656),a=n(6480),c=n(6836),l=n(9308),u=n(8192),d="prototype",p="script",h=u("IE_PROTO"),f=function(){},m=function(e){return"<"+p+">"+e+"</"+p+">"},v=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;y="undefined"!=typeof document?document.domain&&r?v(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):v(r);for(var o=s.length;o--;)delete y[d][s[o]];return y()};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=y(),void 0===t?n:i.f(n,t)}},5045:(e,t,n)=>{"use strict";var r=n(3528),o=n(4859),i=n(368),s=n(8424),a=n(9740),c=n(4152);t.f=r&&!o?Object.defineProperties:function(e,t){s(e);for(var n,r=a(t),o=c(t),l=o.length,u=0;l>u;)i.f(e,n=o[u++],r[n]);return e}},368:(e,t,n)=>{"use strict";var r=n(3528),o=n(784),i=n(4859),s=n(8424),a=n(8732),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",h="writable";t.f=r?i?function(e,t,n){if(s(e),t=a(t),s(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(s(e),t=a(t),s(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}},4560:(e,t,n)=>{"use strict";var r=n(3528),o=n(892),i=n(2460),s=n(9200),a=n(9740),c=n(8732),l=n(6216),u=n(784),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 s(!o(i.f,e,t),e[t])}},692:(e,t,n)=>{"use strict";var r=n(9232),o=n(4656).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},8167:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},6056:(e,t,n)=>{"use strict";var r=n(1447);e.exports=r({}.isPrototypeOf)},9232:(e,t,n)=>{"use strict";var r=n(1447),o=n(6216),i=n(9740),s=n(2196).indexOf,a=n(6480),c=r([].push);e.exports=function(e,t){var n,r=i(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++])&&(~s(u,n)||c(u,n));return u}},4152:(e,t,n)=>{"use strict";var r=n(9232),o=n(4656);e.exports=Object.keys||function(e){return r(e,o)}},2460:(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},7664:(e,t,n)=>{"use strict";var r=n(892),o=n(9063),i=n(808),s=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&o(n=e.toString)&&!i(a=r(n,e)))return a;if(o(n=e.valueOf)&&!i(a=r(n,e)))return a;if("string"!==t&&o(n=e.toString)&&!i(a=r(n,e)))return a;throw new s("Can't convert object to primitive value")}},9976:(e,t,n)=>{"use strict";var r=n(4960),o=n(1447),i=n(692),s=n(8167),a=n(8424),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(a(e)),n=s.f;return n?c(t,n(e)):t}},2696:(e,t,n)=>{"use strict";var r=n(952),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},8192:(e,t,n)=>{"use strict";var r=n(8196),o=n(320),i=r("keys");e.exports=function(e){return i[e]||(i[e]=o(e))}},9136:(e,t,n)=>{"use strict";var r=n(5624),o=n(1544),i="__core-js_shared__",s=r[i]||o(i,{});e.exports=s},8196:(e,t,n)=>{"use strict";var r=n(2804),o=n(9136);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.35.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE",source:"https://github.com/zloirock/core-js"})},8972:(e,t,n)=>{"use strict";var r=n(3356),o=n(6040),i=n(5624).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!i(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},4160:(e,t,n)=>{"use strict";var r=n(3288),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},9740:(e,t,n)=>{"use strict";var r=n(6212),o=n(2696);e.exports=function(e){return r(o(e))}},3288:(e,t,n)=>{"use strict";var r=n(1736);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},960:(e,t,n)=>{"use strict";var r=n(3288),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},6804:(e,t,n)=>{"use strict";var r=n(2696),o=Object;e.exports=function(e){return o(r(e))}},8176:(e,t,n)=>{"use strict";var r=n(892),o=n(808),i=n(6232),s=n(364),a=n(7664),c=n(1840),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!o(e)||i(e))return e;var n,c=s(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||i(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},8732:(e,t,n)=>{"use strict";var r=n(8176),o=n(6232);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},4596:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},320:(e,t,n)=>{"use strict";var r=n(1447),o=0,i=Math.random(),s=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++o+i,36)}},9448:(e,t,n)=>{"use strict";var r=n(8972);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},4859:(e,t,n)=>{"use strict";var r=n(3528),o=n(6040);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},280:(e,t,n)=>{"use strict";var r=n(5624),o=n(9063),i=r.WeakMap;e.exports=o(i)&&/native code/.test(String(i))},1840:(e,t,n)=>{"use strict";var r=n(5624),o=n(8196),i=n(6216),s=n(320),a=n(8972),c=n(9448),l=r.Symbol,u=o("wks"),d=c?l.for||l:l&&l.withoutSetter||s;e.exports=function(e){return i(u,e)||(u[e]=a&&i(l,e)?l[e]:d("Symbol."+e)),u[e]}},1440:(e,t,n)=>{"use strict";var r=n(3748),o=n(6804),i=n(9480),s=n(3288),a=n(2328);r({target:"Array",proto:!0},{at:function(e){var t=o(this),n=i(t),r=s(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}}),a("at")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.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;)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:()=>Se,AgentInfo:()=>su,Chat:()=>qc,ChatFrame:()=>Bl,ComponentFilter:()=>Qa,Conversation:()=>Dc,Engine:()=>tu,EntryContainer:()=>Dl,EventParticipant:()=>Hs,ExternalApi:()=>ou,Header:()=>au,Icon:()=>Ks,Interrupt:()=>Ul,MessageContainer:()=>Vs,SeamlyApiContext:()=>ns,SeamlyEventBusContext:()=>rs,SeamlyGeneralError:()=>l,SeamlyLiveRegionContext:()=>cs,SeamlyOfflineError:()=>Wr,SeamlyStoreProvider:()=>Bn,Text:()=>Ka,View:()=>Zl,calculateVisibility:()=>jn,className:()=>$s,default:()=>cu,eventTypes:()=>pr,randomId:()=>g,useChoicePrompt:()=>ra,useEvents:()=>Zn,useGeneratedId:()=>Ps,useI18n:()=>Zi,useSeamlyActions:()=>iu,useSeamlyChat:()=>hs,useSeamlyCommands:()=>as,useSeamlyConfig:()=>qn,useSeamlyEventStream:()=>Ms,useSeamlyIdleDetachCountdown:()=>Is,useSeamlyMessageContainerClassNames:()=>js,useSeamlyOptions:()=>Os,useSeamlyVisibility:()=>Qi,useTranslatedEventData:()=>Fs,useTranslations:()=>Ds,useTranslationsContainer:()=>Us,visibilityStates:()=>Cn}),n(6592);const e=require("preact/jsx-runtime");var t=n(1792),o=n.n(t),i=n(9150);class s extends Error{constructor(e,t){super(e,{cause:null==t?void 0:t.cause}),this.status=null==t?void 0:t.status}}class a 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 c extends a{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class l extends a{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class u extends a{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class d extends a{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const p="cvco",h="seamly-client-participant",f=50,m=300;var v=n(5576),y=n.n(v);function g(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function b(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 JSON.parse(n)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const x=(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)}}},w=e=>Math.ceil(e/1e3),C=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},_=(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]}`},j={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},E={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},S=e=>e.code?E[e.code]:j[e.keyCode],T=e=>{e&&e.focus()},O=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};var k=e=>"function"==typeof e?e:function(){return e},N="undefined"!=typeof self?self:null,A="undefined"!=typeof window?window:null,I=N||A||I,R="closed",P="errored",L="joined",M="joining",D="leaving",F="phx_close",U="phx_error",B="phx_reply",z="phx_leave",$="websocket",H=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})}},V=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))}},W=class{constructor(e,t,n){this.state=R,this.topic=e,this.params=k(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new H(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new V((()=>{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=L,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=P,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=P,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 H(this,z,k({}),this.timeout).send(),this.state=P,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(B,((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(F,e)}onError(e){return this.on(U,(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 H(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=D;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(F,"leave")},n=new H(this,z,k({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return!(this.topic!==e||r&&r!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=M,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 i=this.bindings.filter((t=>t.event===e));for(let e=0;e<i.length;e++)i[e].callback(o,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===R}isErrored(){return this.state===P}isJoined(){return this.state===L}isJoining(){return this.state===M}isLeaving(){return this.state===D}},q=class{static request(e,t,n,r,o,i,s){if(I.XDomainRequest){let n=new I.XDomainRequest;return this.xdomainRequest(n,e,t,r,o,i,s)}{let a=new I.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,o,i,s)}}static xdomainRequest(e,t,n,r,o,i,s){return e.timeout=o,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,o,i,s,a){return e.open(t,n,!0),e.timeout=i,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)}},s&&(e.ontimeout=s),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,i=e[r];"object"==typeof i?n.push(this.serialize(i,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}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)}`}},G=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("(.*)/"+$),"$1/longpoll")}endpointURL(){return q.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 i;i=q.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(i),r()}),(e=>{this.reqs.delete(i),this.isActive()&&o(e)})),this.reqs.add(i)}},K={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,i,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+n.length+o.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),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+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),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),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(s,s+r));s+=r;let c=n.decode(e.slice(s,s+o));s+=o;let l=n.decode(e.slice(s,s+i));return s+=i,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=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+i));a+=i;let d=n.decode(e.slice(a,a+s));a+=s;let p=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:B,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=n.decode(e.slice(i,i+r));i+=r;let a=n.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}},J=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||I.WebSocket||G,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||I.sessionStorage,this.establishedConnections=0,this.defaultEncoder=K.encode.bind(K),this.defaultDecoder=K.decode.bind(K),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==G?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;A&&A.addEventListener&&(A.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),A.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=k(t.params||{}),this.endPoint=`${e}/${$}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new V((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return G}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=q.appendParams(q.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=k(e)),this.conn||(this.longPollFallbackMs&&this.transport!==G?this.connectWithFallback(G,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,i=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 i("memorized");this.fallbackTimer=setTimeout(i,t),n=this.onError((e=>{this.log("transport","error",e),o&&!r&&(clearTimeout(this.fallbackTimer),i(e))})),this.onOpen((()=>{if(r=!0,!o)return console.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(i,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(U)}))}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 W(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:i}=e;this.log("push",`${t} ${n} (${i}, ${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:i}=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 s=this.channels[e];s.isMember(t,n,r,i)&&s.trigger(n,r,o,i)}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())}};var X,Y,Z,Q,ee=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},te=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n};const ne=y()("seamly"),re=new Set;Y=new WeakMap,X=new WeakSet,Z=function(...e){e.forEach((e=>{this.channel.on(e,(t=>{ne("[RECEIVE]",e,t)}))}))},Q=function(e){te(this,Y,ee(this,Y,"f").filter((t=>!t(e))),"f"),re.forEach((e=>e()))};const oe=class{constructor(){X.add(this),Y.set(this,[])}connect(e,t,n,r){return o=this,i=void 0,a=function*(){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o,params:i}=(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 J(o,{params:Object.assign(Object.assign({},i),{v:"3"}),reconnectAfterMs:e=>{const t=250*Math.pow(2,e);return Math.min(t,1e4)}}),this.socket.onError((e=>{ne("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{ne("[SOCKET]OPEN")})),this.socket.onClose((()=>{ne("[SOCKET]CLOSE"),ee(this,X,"m",Q).call(this,{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&&ee(this,X,"m",Q).call(this,{connected:!0,ready:!0,currentState:"attach_channel_succeeded"})})),this.channel.onClose((()=>{ne("[CHANNEL]CLOSE"),ee(this,X,"m",Q).call(this,{connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{ne("[CHANNEL][ERROR]",e),ee(this,X,"m",Q).call(this,{connected:!1,ready:!1,currentState:"channel_erred"})})),ee(this,X,"m",Z).call(this,"ack","ui","error","participant","message","service_data","system","info","sync")},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{c(a.next(e))}catch(e){t(e)}}function r(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}c((a=a.apply(o,i||[])).next())}));var o,i,s,a}start(){this.channel.join().receive("ok",(()=>{ne("[CHANNEL][JOIN] OK"),ee(this,X,"m",Q).call(this,{connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{ne("[CHANNEL][JOIN] ERROR",e),ee(this,X,"m",Q).call(this,{connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{ne("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){var e;null===(e=this.channel)||void 0===e||e.leave().receive("ok",(()=>{var e;null===(e=this.socket)||void 0===e||e.disconnect(),ne("[CHANNEL][LEAVE] OK"),te(this,Y,[],"f")}))}onConnection(e){ee(this,Y,"f").push(e)}pushToChannel(e,t,n=1e4){this.channel.push(e,t,n)}static subscribe(e){return re.add(e),()=>re.delete(e)}};var ie,se,ae,ce,le,ue,de,pe,he,fe,me,ve,ye,ge,be,xe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},we=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},Ce=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};const _e=y()("seamly"),je=(e,t)=>xe(void 0,void 0,void 0,(function*(){const n=new URL(e);n.searchParams.set("v","3");const r=yield fetch(n.href,Object.assign({mode:"cors"},t));if(!r.ok)throw new s(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r}));function Ee(){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 Se{constructor({layoutMode:e,namespace:t,config:n,context:r}){var o;ie.add(this),se.set(this,void 0),ae.set(this,void 0),ce.set(this,void 0),le.set(this,void 0),ue.set(this,void 0),this.conversation=new oe,ve.set(this,(e=>e||this.locale)),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.contentLocale?`.${r.contentLocale}`:""}`,n.storageProvider||b),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},we(this,ue,Object.assign(Object.assign({},n),{sendEnvironment:null===(o=n.sendEnvironment)||void 0===o||o,context:Object.assign(Object.assign({},r),{channelName:r.channelName||"web"})}),"f"),we(this,se,!1,"f"),this.connected=!1,this.configReady=!1,we(this,ae,n.externalId,"f"),we(this,le,e,"f"),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getConversationUrl(){return this.store.get("conversationUrl")}hasConversation(){return!!this.getConversationUrl()}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}reset(){return xe(this,void 0,void 0,(function*(){return yield this.disconnect(),this.clearStore(),this.getConfig()}))}disconnect(){var e;return xe(this,void 0,void 0,(function*(){(null===(e=this.conversation)||void 0===e?void 0:e.disconnect)&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}))}getConfig(){return xe(this,void 0,void 0,(function*(){try{const e=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}/client/${this.connectionInfo.apiKey}/configs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:Object.assign(Object.assign({},Ce(this,ue,"f").context),{environment:!0===Ce(this,ue,"f").sendEnvironment?this.getEnvironment():Ce(this,ue,"f").sendEnvironment})})}),t=yield e.json();return Ce(this,ie,"m",ge).call(this,t),this.configReady=!0,t.config}catch(e){if(404===e.status)throw new c(e);if(e.status>=500)throw new l(e);throw e}}))}getConversation(){return xe(this,void 0,void 0,(function*(){if(!this.hasConversation())return null;try{const e=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.history}`,{method:"GET",headers:{Authorization:`Bearer ${Ce(this,ie,"m",de).call(this)}`}}),t=yield e.json();Ce(this,ie,"m",ge).call(this,t);const{messages:n,participants:r,activeServiceSessionId:o,activeServiceSettings:i,serviceData:s,ui:a,translation:c}=t.history;return{events:n.map((([e,t])=>({type:e,payload:Object.assign(Object.assign({},t),{type:"participant"===e?e:t.type})}))),participants:r,activeServiceSessionId:o,activeServiceSettings:i,serviceData:s,resumeConversationPrompt:!!a&&Boolean(a.resumeConversationPrompt),translationProposal:a.translationProposal,translation:c}}catch(e){if(401===e.status)throw new d(e);if(404===e.status)throw new u(e);if(e.status>=500)throw new l(e);throw new s(e)}}))}connect(){return xe(this,void 0,void 0,(function*(){this.connected=!1;let e={};return this.hasConversation()||(e=yield Ce(this,ie,"m",be).call(this)),this.conversation.connect(`${Ce(this,ie,"m",ye).call(this,"ws")}${this.URLS.socket}`,Ce(this,ue,"f").context.channelName,Ce(this,ie,"m",fe).call(this),Ce(this,ie,"m",de).call(this)),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,we(this,se,t,"f")})),e}))}uploadFile(e,t,n,r){const o=new FormData;o.append("upload",e);const i=new XMLHttpRequest;return i.open("POST",`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.uploads}`),i.setRequestHeader("Authorization",`Bearer ${Ce(this,ie,"m",de).call(this)}`),i.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},i.onloadend=()=>{if(0!==i.status)if(200!==i.status&&201!==i.status||!n){if(!r)throw new Error(i.response);try{r(JSON.parse(i.response))}catch(e){r(i.response)}}else try{n(JSON.parse(i.response))}catch(e){n(i.response)}},i.send(o),i}getConversationIntitialState(){return xe(this,void 0,void 0,(function*(){try{const n=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${Ce(this,ie,"m",de).call(this)}`}}),r=yield n.json();return Ce(this,ie,"m",ge).call(this,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 d(e);if(404===e.status)throw new u(e);if(e.status>=500)throw new l(e);throw e}var e,t}))}getTranslations(e){return xe(this,void 0,void 0,(function*(){try{if(!this.URLS.translations)throw new c;const t=`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.translations}`.replace("{version}",String(4)).replace("{locale}",Ce(this,ve,"f").call(this,e)),n=yield je(t,{method:"GET"});return(yield n.json()).translations}catch(e){if(e.status>=500)throw new l(e);throw new s(e)}}))}send(e,t,n=!0){var r;!this.connected||n&&!Ce(this,se,"f")?null===(r=this.conversation)||void 0===r||r.onConnection((({connected:r,ready:o})=>(this.connected=r,we(this,se,o,"f"),!!(n?o:r)&&(this.send(e,t,n),!0)))):(_e("[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=g()),{type:n,body:r,transactionId:o}}(e,t),1e4))}sendContext(e){var t,n;const{contentLocale:r,userLocale:o,variables:i,environment:s}=e,a={};if(s&&(a.environment=s),r){if("string"!=typeof r)throw new Error("Content locale must be a string");a.contentLocale=r}if(o){if("string"!=typeof o)throw new Error("User locale must be a string");a.userLocale=o}if(i){if("object"!=typeof i)throw new Error("Variables must be an object");a.variables=i}if(0===Object.keys(a).length&&a.constructor===Object)return;const{contentLocale:c}=a,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(a,["contentLocale"]),u=null===(t=Ce(this,ue,"f").context)||void 0===t?void 0:t.contentLocale,d=null===(n=Ce(this,ue,"f").context)||void 0===n?void 0:n.userLocale;this.send("context",Object.assign(Object.assign({},u?{contentLocale:u,userLocale:d}:{}),l),!1)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:Ce(this,le,"f"),clientVersion:"23.0.0-alpha.1",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:Ee(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}se=new WeakMap,ae=new WeakMap,ce=new WeakMap,le=new WeakMap,ue=new WeakMap,ve=new WeakMap,ie=new WeakSet,de=function(){return this.store.get("accessToken")},pe=function(e){this.store.set("accessToken",e)},he=function(e){this.store.set("conversationUrl",e)},fe=function(){return this.store.get("channelTopic")||this.store.get("channelName")},me=function(e){this.store.set("channelTopic",e)},ye=function(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`},ge=function({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>Object.assign(Object.assign({},e),{[t]:n})),this.URLS)},be=function(){var e,t;return xe(this,void 0,void 0,(function*(){try{"function"==typeof(null===(e=Ce(this,ue,"f"))||void 0===e?void 0:e.getConversationAuthToken)&&we(this,ce,yield Ce(this,ue,"f").getConversationAuthToken(),"f");const n=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:Ce(this,ce,"f")?void 0:Ce(this,ae,"f"),token:Ce(this,ce,"f")})}),r=yield n.json(),{conversation:o}=r,i=Object.assign({},o);return delete i.accessToken,delete i.channelTopic,Ce(this,ie,"m",pe).call(this,o.accessToken),Ce(this,ie,"m",me).call(this,o.channelTopic),Ce(this,ie,"m",ge).call(this,r),Ce(this,ie,"m",he).call(this,this.URLS.conversation),this.locale=null===(t=o.translation)||void 0===t?void 0:t.locale,this.userResponded=o.userResponded,i}catch(e){if(e.status>=500)throw new l(e);if(400===e.status)throw new d(e);if(404===e.status)throw new c(e);throw e}}))};var Te=Symbol.for("immer-nothing"),Oe=Symbol.for("immer-draftable"),ke=Symbol.for("immer-state");function Ne(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ae=Object.getPrototypeOf;function Ie(e){return!!e&&!!e[ke]}function Re(e){return!!e&&(Le(e)||Array.isArray(e)||!!e[Oe]||!!e.constructor?.[Oe]||Be(e)||ze(e))}var Pe=Object.prototype.constructor.toString();function Le(e){if(!e||"object"!=typeof e)return!1;const t=Ae(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)===Pe}function Me(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[ke];return t?t.type_:Array.isArray(e)?1:Be(e)?2:ze(e)?3:0}function Fe(e,t){return 2===De(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ue(e,t,n){const r=De(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Be(e){return e instanceof Map}function ze(e){return e instanceof Set}function $e(e){return e.copy_||e.base_}function He(e,t){if(Be(e))return new Map(e);if(ze(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Le(e)){if(!Ae(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ke];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Ae(e),n)}function Ve(e,t=!1){return qe(e)||Ie(e)||!Re(e)||(De(e)>1&&(e.set=e.add=e.clear=e.delete=We),Object.freeze(e),t&&Me(e,((e,t)=>Ve(t,!0)))),e}function We(){Ne(2)}function qe(e){return Object.isFrozen(e)}var Ge,Ke={};function Je(e){const t=Ke[e];return t||Ne(0),t}function Xe(){return Ge}function Ye(e,t){t&&(Je("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ze(e){Qe(e),e.drafts_.forEach(tt),e.drafts_=null}function Qe(e){e===Ge&&(Ge=e.parent_)}function et(e){return Ge={drafts_:[],parent_:Ge,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function tt(e){const t=e[ke];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function nt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ke].modified_&&(Ze(t),Ne(4)),Re(e)&&(e=rt(t,e),t.parent_||it(t,e)),t.patches_&&Je("Patches").generateReplacementPatches_(n[ke].base_,e,t.patches_,t.inversePatches_)):e=rt(t,n,[]),Ze(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Te?e:void 0}function rt(e,t,n){if(qe(t))return t;const r=t[ke];if(!r)return Me(t,((o,i)=>ot(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return it(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),Me(o,((o,s)=>ot(e,r,t,o,s,n,i))),it(e,t,!1),n&&e.patches_&&Je("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ot(e,t,n,r,o,i,s){if(Ie(o)){const s=rt(e,o,i&&t&&3!==t.type_&&!Fe(t.assigned_,r)?i.concat(r):void 0);if(Ue(n,r,s),!Ie(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(Re(o)&&!qe(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;rt(e,o),t&&t.scope_.parent_||it(e,o)}}function it(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ve(t,n)}var st={get(e,t){if(t===ke)return e;const n=$e(e);if(!Fe(n,t))return function(e,t,n){const r=lt(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_||!Re(r)?r:r===ct(e.base_,t)?(dt(e),e.copy_[t]=pt(r,e)):r},has:(e,t)=>t in $e(e),ownKeys:e=>Reflect.ownKeys($e(e)),set(e,t,n){const r=lt($e(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ct($e(e),t),s=r?.[ke];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||Fe(e.base_,t)))return!0;dt(e),ut(e)}var o,i;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!==ct(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,dt(e),ut(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=$e(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ne(11)},getPrototypeOf:e=>Ae(e.base_),setPrototypeOf(){Ne(12)}},at={};function ct(e,t){const n=e[ke];return(n?$e(n):e)[t]}function lt(e,t){if(!(t in e))return;let n=Ae(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ae(n)}}function ut(e){e.modified_||(e.modified_=!0,e.parent_&&ut(e.parent_))}function dt(e){e.copy_||(e.copy_=He(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function pt(e,t){const n=Be(e)?Je("MapSet").proxyMap_(e,t):ze(e)?Je("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Xe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=st;n&&(o=[r],i=at);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:Xe()).drafts_.push(n),n}function ht(e){return Ie(e)||Ne(10),ft(e)}function ft(e){if(!Re(e)||qe(e))return e;const t=e[ke];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=He(e,t.scope_.immer_.useStrictShallowCopy_)}else n=He(e,!0);return Me(n,((e,t)=>{Ue(n,e,ft(t))})),t&&(t.finalized_=!1),n}Me(st,((e,t)=>{at[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),at.deleteProperty=function(e,t){return at.set.call(this,e,t,void 0)},at.set=function(e,t,n){return st.set.call(this,e[0],t,n,e[0])};var mt=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&&Ne(6),void 0!==n&&"function"!=typeof n&&Ne(7),Re(e)){const o=et(this),i=pt(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?Ze(o):Qe(o)}return Ye(o,n),nt(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Te&&(r=void 0),this.autoFreeze_&&Ve(r,!0),n){const t=[],o=[];Je("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Ne(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){Re(e)||Ne(8),Ie(e)&&(e=ht(e));const t=et(this),n=pt(e,void 0);return n[ke].isManual_=!0,Qe(t),n}finishDraft(e,t){const n=e&&e[ke];n&&n.isManual_||Ne(9);const{scope_:r}=n;return Ye(r,t),nt(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=Je("Patches").applyPatches_;return Ie(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},vt=mt.produce;mt.produceWithPatches.bind(mt),mt.setAutoFreeze.bind(mt),mt.setUseStrictShallowCopy.bind(mt),mt.applyPatches.bind(mt),mt.createDraft.bind(mt),mt.finishDraft.bind(mt);var yt=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var gt="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},bt=0,xt=1;function wt(){return{s:bt,v:void 0,o:null,p:null}}function Ct(e,t={}){let n=wt();const{resultEqualityCheck:r}=t;let o,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;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=wt(),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=wt(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===xt?c=t.v:(c=e.apply(null,arguments),i++),a.s=xt,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==i&&i--),o="object"==typeof c&&null!==c||"function"==typeof c?new gt(c):c}return a.v=c,c}return s.clearCache=()=>{n=wt(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function _t(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:c,memoizeOptions:l=[],argsMemoize:u=Ct,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,h=yt(l),f=yt(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),v=c((function(){return r++,s.apply(null,arguments)}),...h),y=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=v.apply(null,e),t}),...f);return Object.assign(y,{resultFunc:s,memoizedResultFunc:v,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 jt=_t(Ct),Et=Object.assign(((e,t=jt)=>{!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:()=>Et});function St(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")(),Ot=()=>Math.random().toString(36).substring(7).split("").join("."),kt={INIT:`@@redux/INIT${Ot()}`,REPLACE:`@@redux/REPLACE${Ot()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ot()}`};function Nt(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 At(e,t,n){if("function"!=typeof e)throw new Error(St(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(St(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(St(1));return n(At)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function u(){if(c)throw new Error(St(3));return o}function d(e){if("function"!=typeof e)throw new Error(St(4));if(c)throw new Error(St(5));let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(c)throw new Error(St(6));t=!1,l(),s.delete(n),i=null}}}function p(e){if(!Nt(e))throw new Error(St(7));if(void 0===e.type)throw new Error(St(8));if("string"!=typeof e.type)throw new Error(St(17));if(c)throw new Error(St(9));try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach((e=>{e()})),e}return p({type:kt.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(St(10));r=e,p({type:kt.REPLACE})},[Tt]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(St(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:kt.INIT}))throw new Error(St(12));if(void 0===n(void 0,{type:kt.PROBE_UNKNOWN_ACTION()}))throw new Error(St(13))}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;let i=!1;const s={};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(St(14));s[a]=u,i=i||u!==l}return i=i||r.length!==Object.keys(e).length,i?s:e}}function Rt(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Pt(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var Lt=Pt(),Mt=Pt,Dt=(((...e)=>{const t=_t(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(Ie(e)?ht(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(Ct),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Rt:Rt.apply(null,arguments)}),Ft=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Ut(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(mn(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 Nt(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Bt=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 zt(e){return Re(e)?vt(e,(()=>{})):e}function $t(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(mn(10));const r=n.insert(t,e);return e.set(t,r),r}var Ht=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let i=new Bt;return t&&("boolean"==typeof t?i.push(Lt):i.push(Mt(t.extraArgument))),i},Vt=e=>t=>{setTimeout(t,e)},Wt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Vt(10),qt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Bt(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,i=!1,s=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?Wt:"callback"===e.type?e.queueNotification:Vt(e.timeout),l=()=>{s=!1,i&&(i=!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,i=!o,i&&(s||(s=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r},Gt=!0;function Kt(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(mn(28));if(r in t)throw new Error(mn(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 Jt=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Xt(...e){return t=>e.some((e=>((e,t)=>Ft(e)?e.match(t):e(t))(e,t)))}var Yt=["name","message","stack","code"],Zt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Qt=class{constructor(e,t){this.payload=e,this.meta=t}_type},en=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Yt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},tn=(()=>{function e(e,t,n){const r=Ut(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=Ut(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Ut(e+"/rejected",((e,t,r,o,i)=>({payload:o,error:(n&&n.serializeError||en)(e||"Rejected"),meta:{...i||{},arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,c)=>{const l=n?.idGenerator?n.idGenerator(e):Jt(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:c});if(null!==(m=i)&&"object"==typeof m&&"function"==typeof m.then&&(i=await i),!1===i||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const v=new Promise(((e,t)=>{d=()=>{t({name:"AbortError",message:p||"Aborted"})},u.signal.addEventListener("abort",d)}));s(o(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:c}))),f=await Promise.race([v,Promise.resolve(t(e,{dispatch:s,getState:a,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Zt(e,t),fulfillWithValue:(e,t)=>new Qt(e,t)})).then((t=>{if(t instanceof Zt)throw t;return t instanceof Qt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof Zt?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(nn)})}}),{pending:o,rejected:i,fulfilled:r,settled:Xt(i,r),typePrefix:e})}return e.withTypes=()=>e,e})();function nn(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var rn=Symbol.for("rtk-slice-createasyncthunk");function on(e,t){return`${e}/${t}`}function sn(e,t,n,r){function o(o,...i){let s=t(o);return void 0===s&&r&&(s=n()),e(s,...i)}return o.unwrapped=e,o}var an=function({creators:e}={}){const t=e?.asyncThunk?.[rn];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(mn(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)||{},i=Object.keys(o),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(mn(12));if(n in s.sliceCaseReducersByType)throw new Error(mn(13));return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Kt(e.extraReducers):[e.extraReducers],o={...t,...s.sliceCaseReducersByType};return function(e,t){let i,[a,c,l]=Kt((e=>{for(let t in o)e.addCase(t,o[t]);for(let t of s.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)i=()=>zt(e());else{const t=zt(e);i=()=>t}function u(e=i(),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(Re(e))return vt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(mn(9))}return r}}return e}),e)}return u.getInitialState=i,u}(e.initialState)}i.forEach((r=>{const i=o[r],s={reducerName:r,type:on(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},r,o){let i,s;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(mn(17));i=r.reducer,s=r.prepare}else i=r;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Ut(e,s):Ut(e))}(s,i,a):function({type:e,reducerName:t},n,r,o){if(!o)throw new Error(mn(18));const{payloadCreator:i,fulfilled:s,pending:a,rejected:c,settled:l,options:u}=n,d=o(e,i,u);r.exposeAction(t,d),s&&r.addCase(d.fulfilled,s),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:s||cn,pending:a||cn,rejected:c||cn,settled:l||cn})}(s,i,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=$t(u,n,{insert:()=>new WeakMap});return $t(r,t,{insert:()=>{const r={};for(const[o,i]of Object.entries(e.selectors??{}))r[o]=sn(i,t,h,n);return r}})}return{reducerPath:t,getSelectors:o,get selectors(){return o(r)},selectSlice:r}}const m={name:n,reducer:p,actions:s.actionCreators,caseReducers:s.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 cn(){}var{assign:ln}=Object,un="listenerMiddleware",dn=e=>{let{type:t,actionCreator:n,matcher:r,predicate:o,effect:i}=e;if(t)o=Ut(t).match;else if(n)t=n.type,o=n.match;else if(r)o=r;else if(!o)throw new Error(mn(21));return((e,t)=>{if("function"!=typeof e)throw new Error(mn(32))})(i),{predicate:o,type:t,effect:i}},pn=Object.assign((e=>{const{type:t,predicate:n,effect:r}=dn(e);return{id:Jt(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(mn(22))}}}),{withTypes:()=>pn}),hn=Object.assign(Ut(`${un}/add`),{withTypes:()=>hn}),fn=(Ut(`${un}/removeAll`),Object.assign(Ut(`${un}/remove`),{withTypes:()=>fn}));function mn(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 vn extends a{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}var yn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const gn=tn("initializeConfig",((e,{extra:{api:t,config:n},rejectWithValue:r})=>yn(void 0,void 0,void 0,(function*(){var e;try{const{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c}=yield t.getConfig(),l=(null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.contentLocale)||o,{connectWhenInView:u}=n;return{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})))),bn=tn("resetConfig",((e,{extra:{config:t}})=>yn(void 0,void 0,void 0,(function*(){return t})))),xn=jt((({app:e})=>e),(({userHasResponded:e})=>e)),wn="visibility",Cn={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},_n=jt((({config:e})=>e),(e=>{let t=Object.assign({visible:"inline"===(null==e?void 0:e.layoutMode)?Cn.open:Cn.minimized,appContainerClassNames:(null==e?void 0:e.appContainerClassNames)||[]},e);return"function"==typeof t.appContainerClassNames&&(t=Object.assign(Object.assign({},t),{appContainerClassNames:t.appContainerClassNames(t)})),t})),jn=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=r,{visible:a}=o||{};if("app"===i&&!t)return Cn.open;if("window"===i&&s&&n!==Cn.open)return e?n||t||Cn.open:Cn.hidden;if("inline"===i&&e&&!n)return t||Cn.open;const c=Cn.minimized;return n||t||a||c};var En=n(144),Sn=n(6728),Tn=En.default,On=Symbol.for("react-redux-context"),kn="undefined"!=typeof globalThis?globalThis:{};function Nn(){if(!Tn.createContext)return{};const e=kn[On]??(kn[On]=new Map);let t=e.get(Tn.createContext);return t||(t=Tn.createContext(null),e.set(Tn.createContext,t)),t}var An=Nn();function In(e=An){return function(){return Tn.useContext(e)}}var Rn=In(),Pn=()=>{throw new Error("uSES not initialized!")},Ln=(e,t)=>e===t;function Mn(e=An){const t=e===An?Rn:In(e),n=(e,n={})=>{const{equalityFn:r=Ln,devModeChecks:o={}}="function"==typeof n?{equalityFn:n}:n,{store:i,subscription:s,getServerState:a,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(Tn.useRef(!0),Tn.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,o.stabilityCheck])),d=Pn(s.addNestedSub,i.getState,a||i.getState,u,r);return Tn.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var Dn=Mn();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 Fn={notify(){},get:()=>[]};var Un="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?Tn.useLayoutEffect:Tn.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var Bn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:o="once",identityFunctionCheck:i="once"}){const s=Tn.useMemo((()=>{const t=function(e,t){let n,r=Fn,o=0,i=!1;function s(){l.onStateChange&&l.onStateChange()}function a(){o++,n||(n=t?t.addNestedSub(s):e.subscribe(s),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=Fn)}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:s,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,a())},tryUnsubscribe:function(){i&&(i=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:o,identityFunctionCheck:i}}),[e,r,o,i]),a=Tn.useMemo((()=>e.getState()),[e]);Un((()=>{const{subscription:t}=s;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),a!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[s,a]);const c=t||An;return Tn.createElement(c.Provider,{value:s},n)};function zn(e=An){const t=e===An?Rn:In(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var $n=zn();function Hn(e=An){const t=e===An?$n:zn(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Vn,Wn=Hn();Vn=Sn.useSyncExternalStoreWithSelector,Pn=Vn,En.useSyncExternalStore;const qn=()=>Dn(_n);function Gn(){const{startChatIcon:e}=qn();return e}const Kn=({state:e})=>e,Jn=()=>Dn(Kn),Xn=jt(Kn,_n,xn,(({events:e,serviceData:t},n,r)=>{var o;if(r||"inline"===n.layoutMode||!(null==t?void 0:t.suggestion)||!(null===(o=null==t?void 0:t.suggestion)||void 0===o?void 0:o.body.length))return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),Yn=jt(Xn,_n,((e,t)=>{var n,r;const{enabled:o,threshold:i}=null!==(r=null===(n=null==t?void 0:t.messages)||void 0===n?void 0:n.timeIndicator)&&void 0!==r?r:{};if(!o)return e;const s=[];let a=null;return e.forEach(((e,t)=>{if(0===t)s.push(Object.assign(Object.assign({},e),{timeIndicator:e.payload.occurredAt}));else{const t=a&&w(e.payload.occurredAt-a.payload.occurredAt)>=i?e.payload.occurredAt:void 0;s.push(Object.assign(Object.assign({},e),{timeIndicator:t}))}a=e})),s})),Zn=()=>Dn(Yn),Qn=(jt(Yn,(e=>e.map((e=>e.payload.id)))),()=>Jn().isLoading),er=()=>Jn().unreadEvents,tr=()=>Jn().skiplinkTargetId,nr=()=>Jn().serviceInfo,rr=jt(Yn,(e=>{var t;const n=e.filter((e=>"message"===e.type));return null===(t=n[n.length-1])||void 0===t?void 0:t.payload.id})),or=()=>{const{participants:e,currentAgent:t}=Jn().participantInfo;return t?e[t]:null},ir=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=Jn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},sr=()=>{const{layoutMode:e}=qn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},ar=jt((({visibility:e})=>e),(e=>e.visibility)),cr=jt((({visibility:e})=>e),(e=>e.showInlineView));const lr=[Cn.open,Cn.minimized,Cn.hidden],ur=tn("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),i=ar(o),s=xn(o),a=n.hasConversation(),c=_n(o),{visibilityCallback:l=jn,layoutMode:u}=c,{unreadEvents:d}=Kn(o),p=l({hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(!lr.includes(p))return void console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');if(i===p)return;const h=n.store.get(wn);return n.store.set(wn,Object.assign(Object.assign({},h||{}),{[u]:e})),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:d}),p})),dr=tn("initialize",((e,{dispatch:t,getState:n,extra:{api:r}})=>{return o=void 0,i=void 0,a=function*(){var e;const{layoutMode:o}=_n(n()),i=(null===(e=r.store.get(wn))||void 0===e?void 0:e[o])||Cn.initialize;return t(ur(i)),i},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{c(a.next(e))}catch(e){t(e)}}function r(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}c((a=a.apply(o,i||[])).next())}));var o,i,s,a})),pr={info:"info",message:"message",participant:"participant",system:"system"},hr="text",fr="text",mr="upload",vr="received",yr="read",gr="custom",br="typing",xr="read",wr="detach_service",Cr="dismiss",_r="set_topic",jr="click_cta",Er="assertive",Sr="polite",Tr={new_topic:"newTopic",new_translation:"newTranslation"},Or="uploads",kr="navigate";var Nr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const Ar=tn("initializeApp",((e,{extra:{api:t,config:n},rejectWithValue:r})=>Nr(void 0,void 0,void 0,(function*(){var e,o,i;const s=null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.contentLocale,a=null===(o=null==n?void 0:n.context)||void 0===o?void 0:o.userLocale,c=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=yield t.getConversationIntitialState();return t.sendContext(Object.assign(Object.assign({},e.context),{environment:c})),{initialState:e,contentLocale:s,userLocale:a,config:n}}return(null===(i=null==n?void 0:n.context)||void 0===i?void 0:i.topic)&&t.send("action",{type:_r,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext(Object.assign(Object.assign({},n.context),{environment:c})),{initialState:void 0,contentLocale:s,userLocale:a,config:n}}catch(e){if(e instanceof u){const e=new u;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new vn;return r({name:t.name,message:t.message,langKey:t.langKey})}})))),Ir=((e,t,n)=>{const{wait:r=300,maxWait:o=0,leading:i=!1}=null!=n?n:{};let s,a=null,c=null;const l=()=>{clearTimeout(c),c=void 0,s&&(s(!0),s=void 0)};return tn(e,t,{condition:()=>{const e=i&&!a;return clearTimeout(a),a=setTimeout((()=>{l(),a=null}),r),!!e||(s&&(s(!1),s=void 0),o&&!c&&(c=setTimeout(l,o)),new Promise((e=>{s=e})))}})})("resetApp",((e,{dispatch:t,extra:{api:n}})=>Nr(void 0,void 0,void 0,(function*(){yield n.disconnect(),n.clearStore(),t(bn()),yield t(gn()),yield t(Ar()),t(dr())}))),{wait:2e3,leading:!0});const Rr=Object.assign(Object.assign({},{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},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:[]}),Pr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],Lr=(e,t)=>{const n=(i=t,Pr.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:r}=n,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["messages"]);var i;let s=e;return Object.keys(o).length>0&&(s=Object.assign(Object.assign({},s),o)),r&&(s=Object.assign(Object.assign({},s),{messages:Object.assign(Object.assign({},s.messages),r)})),s},Mr=an({name:"config",initialState:Rr,reducers:{setConfig:(e,{payload:t})=>Lr(e,t),updateConfig:(e,{payload:t})=>Lr(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(bn.fulfilled,(e=>e)).addCase(gn.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o,defaultContentLocale:i}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.contentLocale=i,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o}))}}),{setConfig:Dr,updateConfig:Fr,setPreChatEvents:Ur}=Mr.actions,Br=Mr.reducer,zr={userHasResponded:!1},$r=an({name:"app",initialState:zr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(Ir.pending,(()=>zr)).addCase(Ar.fulfilled,((e,{payload:t})=>{var n;t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=null===(n=t.initialState)||void 0===n?void 0:n.userResponded)}))}}),{setHasResponded:Hr}=$r.actions,Vr=$r.reducer;class Wr extends a{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const qr={SeamlyGeneralError:l,SeamlyConfigurationError:c,SeamlySessionExpiredError:u,SeamlyOfflineError:Wr,SeamlyUnauthorizedError:d,SeamlyUnavailableError:vn},Gr=Ut("catch-error",(e=>({payload:e}))),Kr={controls:{}},Jr={value:"",touched:!1},Xr={controls:Jr},Yr=an({name:"forms",initialState:Xr,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{var r;const o=t&&null!==(r=e[n])&&void 0!==r?r:Object.assign(Object.assign({},Kr),{persistData:t});e[n]=o},deregisterForm:(e,{payload:{formId:t}})=>{var n;return(null===(n=e[t])||void 0===n?void 0:n.persistData)||delete e[t],e},registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:Jr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o=Object.assign({},r.controls);return delete o[t],Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},r),{controls:o})})},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls)&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls[n])&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(Ir.pending,(()=>Xr))}}),{registerForm:Zr,deregisterForm:Qr,registerControl:eo,deregisterControl:to,updateControlValue:no,updateControlTouched:ro}=Yr.actions,oo=Yr.reducer;const io=tn("setLocale",((e,{extra:{api:t},rejectWithValue:n})=>{return r=void 0,o=void 0,s=function*(){try{return{translations:yield t.getTranslations(e),userLocale:e}}catch(e){return n(e)}},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,a)}c((s=s.apply(r,o||[])).next())}));var r,o,i,s}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),so={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},ao=an({name:"app",initialState:so,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(Ir.pending,(()=>so)).addCase(gn.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultContentLocale})).addCase(io.pending,(e=>{e.isLoading=!0})).addCase(io.rejected,(e=>{e.isLoading=!1})).addCase(io.fulfilled,((e,{payload:t})=>{e.isLoading=!1,(null==t?void 0:t.translations)&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t.translations[n]})),{}))}))}}),{setInitialLocale:co,setTranslations:lo}=ao.actions,uo=ao.reducer;const po=tn("getConversation",((e,{extra:{api:t},rejectWithValue:n})=>{return r=void 0,o=void 0,s=function*(){try{return t.getConversation()}catch(e){return n({name:null==e?void 0:e.name,message:null==e?void 0:e.message,langKey:null==e?void 0:e.langKey,action:null==e?void 0:e.action,originalEvent:null==e?void 0:e.originalEvent,originalError:null==e?void 0:e.originalError})}},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,a)}c((s=s.apply(r,o||[])).next())}));var r,o,i,s}),{condition(e,{getState:t}){var n;const{state:{events:r}}=t(),o=r[r.length-1],i=null===(n=null==e?void 0:e.lastEvent)||void 0===n?void 0:n.id;return o&&i!==o.payload.id}}),ho={error:void 0},fo=an({name:"interrupt",initialState:ho,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>ho},extraReducers:e=>{e.addCase(gn.pending,(()=>ho)).addMatcher(Xt(Ar.rejected,gn.rejected,io.rejected,ur.rejected,dr.rejected,po.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:mo,clearInterrupt:vo}=fo.actions,yo=fo.reducer,go=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],bo=({type:e,payload:t})=>"hidden"===document.visibilityState||e===pr.message&&!t.fromClient||e===pr.info&&t.type===hr,xo=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),wo=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:i,introduction:s}=t.participant,a=n[r],c=Object.assign(Object.assign({},n),{[r]:a?Object.assign(Object.assign(Object.assign(Object.assign({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return Object.assign(Object.assign({},e),{participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r})},Co=(e,t)=>{var n,r;const o="message"===(null==t?void 0:t.type)?(null==t?void 0:t.payload.translatedEntry)||(null==t?void 0:t.payload.entry):{},{blockAutoEntrySwitch:i}=e,s=(null===(n=null==t?void 0:t.payload)||void 0===n?void 0:n.actions)||{},a=(null===(r=null==t?void 0:t.payload)||void 0===r?void 0:r.translatedActions)||{};if(!o)return Object.assign(Object.assign({},e),{optionsOverride:{},actions:s,translatedActions:a});const{type:c,options:l}=o;let u=e.active;return i||c===e.userSelected||(u=c),Object.assign(Object.assign({},e),{active:u,optionsOverride:Object.assign(Object.assign({},e.optionsOverride||{}),c?{[c]:l}:{}),actions:s,translatedActions:a})},_o={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:g(),optionsButtonId:g(),headerCollapseButtonId:g(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:fr,active:fr,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{},actions:{},translatedActions:{}},seamlyContainerElement:null},jo=an({name:"store",initialState:_o,reducers:{addEvent:(e,t)=>{var n,r;const{type:o,payload:i}=t.payload,s=e.options.features.hasOwnProperty(Or);let a=Object.assign({},e.options);if(s&&(o===pr.message||o===pr.participant)&&!i.fromClient){const e="message"===o?null===(n=i.entry)||void 0===n?void 0:n.type:{};a=Object.assign(Object.assign({},a),{features:Object.assign(Object.assign({},a.features),{uploads:Object.assign(Object.assign({},null===(r=a.features)||void 0===r?void 0:r.uploads),{enabledFromEntry:e===mr})})})}const c=bo(t.payload);if(e.events.find((e=>e.payload.id===i.id)))return;const l=Co(e.entryMeta,t.payload);e.entryMeta=s||l.active!==mr?l:Object.assign({},e.entryMeta),e.options=a,c&&(e.unreadEvents+=1,"service_data"!==o&&(t.payload.payload.messageStatus=i.fromClient?yr:vr)),t.payload.payload.key=g(),e.events.push(t.payload),e.isLastEventFromClient=i.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=xo(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(-1!==t.indexOf(e.payload.id)&&(e.payload=Object.assign(Object.assign({},e.payload),"service_data"!==e.type&&e.payload.messageStatus===vr&&{messageStatus:yr})),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:o={},serviceData:i,resumeConversationPrompt:s}})=>{var a,c,l;const u=((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 xo([...r,...n])})(e.events,t),d=Object.assign(Object.assign({},e.participantInfo.participants),n),p=u.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let h=null;p&&("message"===p.type&&(h=p.payload.participant),"participant"===p.type&&(h=p.payload.participant.id));const{entry:f}=o,m=null===(a=null==f?void 0:f.options)||void 0===a?void 0:a.upload,v=Co(Object.assign(Object.assign(Object.assign({},e.entryMeta),f),{active:(null==f?void 0:f.default)||hr,options:Object.assign({},(null==f?void 0:f.options)?f.options:{})}),u[u.length-1]);let y=Object.assign({},e.options.features);const g=y.hasOwnProperty(Or);if(g&&"message"===(null==p?void 0:p.type)){const{payload:e}=p,t=(null===(c=null==e?void 0:e.entry)||void 0===c?void 0:c.type)||{};y=Object.assign(Object.assign({},y),{uploads:{enabled:!(!m||!(null==m?void 0:m.enabled)),enabledFromEntry:t===mr}})}e.unreadEvents=u.filter((e=>"message"===e.type&&e.payload.messageStatus===vr)).length,e.events=u.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),e.participantInfo=Object.assign(Object.assign(Object.assign({},e.participantInfo),h?wo(e.participantInfo,{participant:d[h]}):{}),{participants:d}),e.historyLoaded=!0,e.serviceInfo=Object.assign(Object.assign({},e.serviceInfo),{activeServiceSessionId:r,proactiveMessages:(null===(l=null==o?void 0:o.proactiveMessages)||void 0===l?void 0:l.enabled)||!1}),e.serviceData=Object.assign(Object.assign({},e.serviceData),i),e.options=Object.assign(Object.assign({},e.options),{features:y}),e.entryMeta=g||v.active!==mr?v:Object.assign({},e.entryMeta),e.resumeConversationPrompt=s||!1,h&&(e.headerTitles.subTitle=d[h].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}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=C(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=wo(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=_o.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?Object.assign(Object.assign({},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?Object.assign(Object.assign({},e),{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?Object.assign(Object.assign({},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(Ir.pending,(()=>_o)).addCase(Ar.pending,(e=>{e.isLoading=!0})).addCase(gn.fulfilled,((e,{payload:t})=>{var n;e.headerTitles.subTitle=null===(n=t.agentParticipant)||void 0===n?void 0:n.name,t.features&&(e.options.features=t.features)})).addCase(Ar.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Xt(Po,Lo),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:Eo,addEvent:So,clearAllUploads:To,clearEvents:Oo,clearFeatures:ko,clearIdleDetachCountdown:No,clearResumeConversationPrompt:Ao,decrementIdleDetachCountdownCounter:Io,hideOption:Ro,initIdleDetachCountdown:Po,initResumeConversationPrompt:Lo,registerUpload:Mo,resetHistoryLoadedFlag:Do,setActiveEntryType:Fo,setActiveService:Uo,setBlockAutoEntrySwitch:Bo,setEventsRead:zo,setFeatureEnabledState:$o,setFeatures:Ho,setHeaderSubTitle:Vo,setHeaderTitle:Wo,setHistory:qo,setInitialState:Go,setIsLoading:Ko,setLoadedImageEventIds:Jo,setParticipant:Xo,setSeamlyContainerElement:Yo,setServiceDataItem:Zo,setServiceEntryMetadata:Qo,clearAbortTransaction:ei,setUploadComplete:ti,setUploadError:ni,setUploadProgress:ri,startProcessingImage:oi,doneProcessingImage:ii,setUserEntryType:si,setUserSelectedOption:ai,setUserSelectedOptions:ci,showOption:li,stopIdleDetachCountdownCounter:ui,setProactiveMessages:di}=jo.actions,pi=jo.reducer,hi=jt((({i18n:e})=>e),(({translations:e})=>e)),fi=jt((({i18n:e})=>e),(({initialLocale:e})=>e)),mi=jt((({i18n:e})=>e),(({userLocale:e})=>e)),vi=jt((({i18n:e})=>e),(({isLoading:e})=>e)),yi={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Jt(),translatedEventGroups:{},translationProposal:null},gi=(e,t)=>{const n=[...e].reduce(((e,{payload:n},r,o)=>{var i;if(e[t]){if("divider"===(null==n?void 0:n.type)&&(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.translationEnabled))return o.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=>{var t;return"divider"===(null===(t=e.payload)||void 0===t?void 0:t.type)})).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},bi=an({name:"translation",initialState:yi,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}=gi(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:i}=gi(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=i},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(Ir.pending,(()=>yi)).addCase(gn.fulfilled,((e,{payload:t})=>{var n;const r=null===(n=null==t?void 0:t.features)||void 0===n?void 0:n.translation;r&&(e.isAvailable=!0===r.enabled,e.languages=[...r.languages].sort(((e,n)=>e.locale===t.defaultContentLocale?-1:n.locale===t.defaultContentLocale?1:e.nativeName.localeCompare(n.nativeName,void 0,{sensitivity:"base"}))))})).addCase(qo,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(io.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(So,((e,{payload:t})=>{e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:xi,disableTranslation:wi,enableEventsTranslation:Ci,disableEventsTranslation:_i,setTranslationProposalPrompt:ji,disableTranslationProposalPrompt:Ei}=bi.actions,Si=bi.reducer,Ti=({dispatch:e,getState:t})=>n=>r=>{var o,i,s,a,c,l,u;const d=n(r);if(qo.match(r)&&(null===(i=null===(o=r.payload)||void 0===o?void 0:o.translation)||void 0===i?void 0:i.enabled))return e(xi(r.payload.translation.locale)),e(io(r.payload.translation.locale)),d;if(gn.fulfilled.match(r)&&r.payload.defaultContentLocale)return e(io(r.payload.defaultContentLocale)),d;if(Ar.fulfilled.match(r))return e(io(r.payload.contentLocale)),d;if(So.match(r)&&"info"===r.payload.type&&(null===(a=null===(s=r.payload)||void 0===s?void 0:s.payload)||void 0===a?void 0:a.body)&&"subtype"in r.payload.payload.body&&"new_translation"===(null===(u=null===(l=null===(c=r.payload)||void 0===c?void 0:c.payload)||void 0===l?void 0:l.body)||void 0===u?void 0:u.subtype)&&r.payload.payload.body.translationEnabled)return e(io(r.payload.payload.body.translationLocale)),d;if(wi.match(r)){const n=fi(t());return e(io(n)),d}return d},Oi=an({name:"visibility",initialState:{visibility:Cn.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(ur.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(gn.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:ki}=Oi.actions,Ni=It({state:pi,app:Vr,config:Br,i18n:uo,translations:Si,visibility:Oi.reducer,forms:oo,interrupt:yo});function Ai({initialState:e,api:t,eventBus:n,config:r}){const o=function(e){const t=Ht(),{reducer:n,middleware:r,devTools:o=!0,preloadedState:i,enhancers:s}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!Nt(n))throw new Error(mn(1));a=It(n)}if(!Gt&&r&&"function"!=typeof r)throw new Error(mn(2));if("function"==typeof r){if(c=r(t),!Gt&&!Array.isArray(c))throw new Error(mn(3))}else c=t();if(!Gt&&c.some((e=>"function"!=typeof e)))throw new Error(mn(4));let l=Rt;o&&(l=Dt({trace:!Gt,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error(St(15))};const s={getState:o.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map((e=>e(s)));return i=Rt(...a)(o.dispatch),{...o,dispatch:i}}}(...c),d=qt(u);if(!Gt&&s&&"function"!=typeof s)throw new Error(mn(5));let p="function"==typeof s?s(d):d();if(!Gt&&!Array.isArray(p))throw new Error(mn(6));if(!Gt&&p.some((e=>"function"!=typeof e)))throw new Error(mn(7));return Gt||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),At(a,i,l(...p))}({reducer:Ni,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:i,layoutMode:s}=_n(t()),{error:c,type:l}=n,u=qr[null==c?void 0:c.name]?new qr[c.name](c):new a(c);null==r||r(u,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{var r,o,i,s,a,c;try{return(null===(o=null===(r=t.payload)||void 0===r?void 0:r.originalEvent)||void 0===o?void 0:o.payload)?n({error:t.payload,type:null===(a=null===(s=null===(i=t.payload)||void 0===i?void 0:i.originalEvent)||void 0===s?void 0:s.payload)||void 0===a?void 0:a.type}):(null===(c=t.payload)||void 0===c?void 0:c.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===mo.type){if(!go.includes(r.name))throw new l(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 ci.toString():e.store.set("options",n.payload);break;case ai.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Ti)});return o}const Ii=Wn;var Ri,Pi=n(8056);function Li(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Mi(e){return Mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mi(e)}function Di(e){var t=function(e,t){if("object"!=Mi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Mi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Mi(t)?t:String(t)}function Fi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Di(r.key),r)}}function Ui(e,t,n){return(t=Di(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bi(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?Bi(t):t)}),[])}function zi(e){for(var t=function(e){return/\s/.test(e)},n=[],r={},o=0,i=null,s=!1,a=0;a<e.length;){if(s&&(t(e[a])||"{"===e[a]))s=!1,i=e.slice(o,a),"{"===e[a]&&a--;else if(!s&&!t(e[a])){var c="{"===e[a];if(i&&c){var l=$i(e,a);if(-1===l)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));r[i]=e.slice(a+1,l),a=l,i=null}else i&&(n.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&n.push(i),{args:n,cases:r}}function $i(e,t){for(var n=0,r=t+1;r<e.length;r++){var o=e.charAt(r);if("}"===o){if(0===n)return r;n--}else"{"===o&&n++}return-1}function Hi(e){return Vi(e.slice(1,-1),",",3)}function Vi(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return r;if(1===n)return r.push(e),r;var o=e.indexOf(t);if(-1===o)return r.push(e),r;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return r.push(i),Vi(s,t,n-1,r)}function Wi(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 qi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wi(Object(n),!0).forEach((function(t){Ui(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Gi=0,Ki="other";function Ji(e,t){for(var n=0,r="",o=0,i={};n<e.length;){if("#"!==e[n]||o)r+=e[n];else{var s="__hashToken".concat(Gi++);r+="{".concat(s,", number}"),i[s]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:i}}var Xi="other";const Yi=new(function(){function e(t){var n,r,o=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ui(this,"format",(n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Bi(o.process(e,t)).join("")},r={},function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i=t.length?t.map((function(e){return 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(r,i))return r[i];var s=n.apply(void 0,t);return r[i]=s,s})),this.locale=t,this.typeHandlers=i}var t,n;return t=e,n=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var n,r,o=e.indexOf("{");if(-1!==o){var i=$i(e,o);if(-1===i)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var s=e.substring(o,i+1);if(s){var a=[],c=e.substring(0,o);c&&a.push(c);var l=(n=Hi(s),r=3,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw o}}return a}}(n,r)||function(e,t){if(e){if("string"==typeof e)return Li(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Li(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],d=l[1],p=l[2],h=t[u];null==h&&(h="");var f=d&&this.typeHandlers[d];a.push(f?f(h,p,this.locale,t,this.process.bind(this)):h);var m=e.substring(i+1);return m&&a.push(this.process(m,t)),a}}return[e]}}],n&&Fi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}())("en-GB",{plural:function(e){var t=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,o=zi(arguments.length>1&&void 0!==arguments[1]?arguments[1]:""),i=o.args,s=o.cases,a=parseInt(e);i.forEach((function(e){e.startsWith("offset:")&&(a-=parseInt(e.slice(7)))}));var c=[];if("PluralRules"in Intl){void 0!==Ri&&Ri.resolvedOptions().locale===t||(Ri=new Intl.PluralRules(t));var l=Ri.select(a);l!==Ki&&c.push(l)}1===a&&c.push("one"),c.push("=".concat(a),Ki);for(var u=0;u<c.length;u++){var d=c[u];if(d in s){var p=Ji(s[d],a),h=p.caseBody,f=p.numberValues;return r(h,qi(qi({},n),f))}}return e},select:function(e){var t=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,r=zi(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").cases;return e in r?n(r[e],t):Xi in r?n(r[Xi],t):e}});function Zi(){const e=Dn(hi),t=Dn(mi),n=Dn(fi),r=Dn(vi);return{t:(0,Pi.useCallback)(((n,o={})=>{const i=e[n];return i?Yi.format(i,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),null)}),[e,t,r]),userLocale:t,initialLocale:n}}const Qi=()=>{const e=Ii(),t=Dn(ar),n=!!t&&t!==Cn.hidden,r=t===Cn.open,o=t===Cn.minimized,i=(0,Pi.useCallback)((t=>e(ur(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:o,visible:t,setVisibility:i,openChat:()=>{i(Cn.open)},closeChat:()=>{i(Cn.minimized)}}},es=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,i.createRef)()})=>{const[r,o]=(0,Pi.useState)(null),s=!!(null==r?void 0:r.isIntersecting)||!t,a=s&&e,c=([e])=>o(e);return(0,Pi.useEffect)((()=>{const e=null==n?void 0: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:s,containerRef:n}},ts=()=>Dn(xn),ns=(0,i.createContext)(null),rs=(0,i.createContext)(null),os=()=>(0,Pi.useContext)(ns),is=()=>os().store,ss=()=>{const e=os();return(0,Pi.useCallback)((()=>e.hasConversation()),[e])},as=()=>{const e=os(),t=Wn(),n=(0,Pi.useContext)(rs),r=ts(),o=ss(),{visible:i,setVisibility:s}=Qi(),a=er(),c=(0,Pi.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,Pi.useCallback)((()=>{c("ui.beforeStart",{visibility:i,hasConversation:o(),hasResponded:r,unreadMessageCount:a}),e.send("start"),c("ui.start",{visibility:i,hasConversation:o(),hasResponded:r,unreadMessageCount:a})}),[e,c,o,r,a,i]),u=(0,Pi.useCallback)((async()=>{t(Ir())}),[t]),d=(0,Pi.useCallback)((e=>({type:e,id:g(),transactionId:g(),participant:h,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),p=(0,Pi.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,Pi.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const o={...p(n),...r};e.send("message",o),c("message",o),t(So({type:"message",payload:{...o,optimisticallyInjected:!0}}))}),[e,t,c,p]),m=(0,Pi.useCallback)(((e,n=g())=>{t(So({type:"message",payload:{...p(e),transactionId:n}}))}),[t,p]),v=(0,Pi.useCallback)(((e,n,r,o,i,s,a)=>{t(So({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:h,fromClient:!0,occurredAt:r,meta:{},body:{contentType:o,filename:i,filesize:s,url:a}}}))}),[t]),y=(0,Pi.useCallback)(((e,n=g())=>{const r={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:g(),transactionId:n,type:"divider"};t(So({type:"info",payload:r}))}),[t]),b=(0,Pi.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==br&&n!==xr&&c(`action.${n}`,t)}),[e,c]),x=(0,Pi.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,Pi.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(Go(e)),e.userResponded&&(t(Hr(e.userResponded)),s(Cn.open)))})).catch((e=>{t(mo({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,s]);return{connect:w,start:l,sendMessage:f,sendAction:b,sendContext:x,reset:u,emitEvent:c,addMessageBubble:m,addUploadBubble:v,addDivider:y,apiConnected:e.connected,apiConfigReady:e.configReady}},cs=(0,i.createContext)(null),ls=()=>{const e=(0,Pi.useContext)(cs);return{sendPolite:(0,Pi.useCallback)((t=>{t&&e({ariaLive:Sr,messageText:t})}),[e]),sendAssertive:(0,Pi.useCallback)((t=>{t&&e({ariaLive:Er,messageText:t})}),[e])}},us=jt((({interrupt:e})=>e),(({error:e})=>e)),ds=jt(us,(e=>Boolean(e)));function ps(){const{t:e}=Zi(),t=Dn(us),n=Dn(ds),r=(0,Pi.useMemo)((()=>{if(!n)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0};const{langKey:r,action:o}=t,i=e(`${r}.title`),s=e(`${r}.message`),a=e(`${r}.srText`),c=o?e(`${r}.buttonText`):null;return Object.assign(Object.assign(Object.assign(Object.assign({},r?{title:i,message:s,srText:a}:{}),o?{action:o}:{}),o&&r?{buttonText:c}:{}),{originalError:t})}),[n,t,e]);return{hasError:n,meta:r,error:t}}const hs=()=>{const{t:e}=Zi(),{isInline:t,isWindow:n,isApp:r}=sr(),{isOpen:o,isVisible:i}=Qi(),s=Dn(cr),{start:a,connect:c,apiConfigReady:u,apiConnected:d}=as(),p=(0,Pi.useRef)(!1),{sendAssertive:h}=ls();!function(){const{meta:{originalError:e,action:t}}=ps(),n=Ii(),{reset:r}=as(),o="SeamlySessionExpiredError"===(null==e?void 0:e.name),i=(0,Pi.useRef)(0),s=(0,Pi.useRef)(null);(0,Pi.useEffect)((()=>{if(o&&"reset"===t){if(i.current>=10){s.current=setTimeout((()=>{i.current=0}),1e4);const e=new l;return n(mo({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}i.current+=1,r()}return()=>{s.current&&clearTimeout(s.current)}}),[t,r,o,n])}(),(0,Pi.useEffect)((()=>{i&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[i,h,e]),(0,Pi.useEffect)((()=>{i&&h(e(o?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[o,i,h,e]),(0,Pi.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,Pi.useCallback)((()=>{return e=void 0,n=void 0,l=function*(){d||(p.current=!0,yield c()),(r||o||i&&t)&&a()},new((s=void 0)||(s=Promise))((function(t,r){function o(e){try{a(l.next(e))}catch(e){r(e)}}function i(e){try{a(l.throw(e))}catch(e){r(e)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof s?n:new s((function(e){e(n)}))).then(o,i)}a((l=l.apply(e,n||[])).next())}));var e,n,s,l}),[d,c,r,t,o,i,a]);(0,Pi.useEffect)((()=>{!u||p.current||n&&!o||!(!t||i&&s)||f()}),[u,f,t,o,i,n,s])},fs=({children:t})=>(hs(),(0,e.jsx)(e.Fragment,{children:t})),ms=(0,i.createContext)({}),vs=e=>jt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>{var n;return!t.includes(null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.id)})))),ys=require("preact/compat"),gs=()=>{const e=os();return(0,ys.useSyncExternalStore)(oe.subscribe,(()=>e.conversation))},bs=(e=0)=>new Promise((t=>{setTimeout(t,e)})),xs=()=>{const{seamlyContainerElement:e}=Jn(),t=Wn();return[e,(0,Pi.useCallback)((e=>{t(Yo(e))}),[t])]},ws=e=>(0,Pi.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await bs(180);const e="string"==typeof t?document.getElementById(t):t;T(e)}))}),[e]),Cs=()=>{const e=tr();return ws(e)},_s=()=>qn().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},Es=(0,i.createContext)({}),Ss=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=Jn(),{allowedMimeTypes:o,maxSize:i}=n.upload||{},{enabled:s,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...o?{allowedMimeTypes:o}:{},...i?{maxSize:i}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:l}},Ts=()=>{const{currentUploads:e}=Jn(),t=Wn(),n=(0,Pi.useContext)(Es);return{uploadFile:(0,Pi.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,Pi.useCallback)((()=>{t(To())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},Os=()=>{const{t:e}=Zi(),{options:t}=Jn(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:i}=t,{extraMenuItem:s,sendTranscript:a}=i,c={extraMenuItem:s,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=s||a,p=Wn(),{get:h,set:f}=is();return{allowOptionSelection:d,userSelectedOptions:o,features:i,menuOptions:u,initUserSelectedOptions:(0,Pi.useCallback)((()=>{const e=h("options")||{};p(ci(e))}),[h,p]),setUserSelectedOptions:(0,Pi.useCallback)((e=>{p(ci(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,Pi.useCallback)(((e,t)=>{const n=h("options")||{};f("options",{...n,[e]:t}),p(ai({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(li(e))},hideOption:()=>{p(Ro())},panelActive:n,optionActive:r}},ks=()=>{const{optionsButtonId:e}=Jn();return{id:e,focusButton:ws(e)}},Ns=(0,i.createContext)(null),As=()=>(0,Pi.useContext)(Ns),Is=()=>{const e=Wn(),{idleDetachCountdown:t}=Jn(),{isOpen:n}=Qi(),r=(0,Pi.useRef)({});r.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:n};const{emitEvent:o,sendAction:i}=as(),{t:s}=Zi(),{sendAssertive:a,sendPolite:c}=ls(),l=(0,Pi.useCallback)((e=>{const{isOpen:t}=r.current;t&&a(e)}),[a]),u=(0,Pi.useCallback)((e=>{const{isOpen:t}=r.current;t&&c(e)}),[c]),d=(0,Pi.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=C(n);e(Po({delaySeconds:n,delayTime:r})),o("idleTimer.start"),l(`${s("idleDetachWarning.countdownTitle")} ${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",r)}`)}),[e,o,l,s]),p=(0,Pi.useCallback)(((t,n)=>{const{hasCountdown:a,wasStopped:c}=r.current;a&&(t||(n||i({type:wr}),l(s("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e(No()))}),[e,i,o,l,s]),h=(0,Pi.useCallback)((()=>{const{remaining:t}=r.current;if(t<=0)return;const n=t-1;n%10==0&&l(`${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",C(n))}`),e(Io())}),[e,l,s]),f=(0,Pi.useCallback)((()=>{const{isActive:t,remaining:n}=r.current;t&&(e(ui()),n&&(o("idleTimer.stop"),u(s("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,u,s]);return{...t,initCountdown:d,endCountdown:p,decrementCountdown:h,stopCountdown:f}},Rs=()=>{const e=Wn(),t=Jn().resumeConversationPrompt,{sendAction:n}=as(),{t:r}=Zi(),{sendAssertive:o}=ls();return{continueChat:()=>{n({type:Cr,body:{type:"resume_conversation_prompt"}}),e(Ao())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:wr}),e(Ao())}}},Ps=()=>{const[e]=(0,Pi.useState)((()=>g()));return e},Ls=e=>{const t=(0,Pi.useRef)(null);t.current=e;const n="function"==typeof e;return(0,Pi.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},Ms=(e,t)=>{const n=gs();(0,Pi.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])};function Ds(){const{sendContext:e}=as(),t=Wn(),n=qn(),r=(0,Pi.useCallback)((t=>{e({userLocale:t})}),[e]),o=(0,Pi.useCallback)((()=>{e({userLocale:n.context.userLocale}),t(wi())}),[n.context,t,e]),{languages:i,isActive:s,isAvailable:a,currentLocale:c}=Dn((({translations:e})=>e));return{languages:i,isActive:s,isAvailable:a,currentLocale:c,enableTranslations:r,disableTranslations:o}}function Fs(e){const{translatedBody:t,translation:n,body:r}=(null==e?void 0:e.payload)?"participant"===e.type?{body:null===(o=e.payload)||void 0===o?void 0:o.participant.introduction,translatedBody:null===(s=null===(i=e.payload)||void 0===i?void 0:i.participant)||void 0===s?void 0:s.translatedIntroduction,translation:null===(c=null===(a=e.payload)||void 0===a?void 0:a.participant)||void 0===c?void 0:c.translation}:{body:e.payload.body,translatedBody:e.payload.translatedBody,translation:null===(l=null==e?void 0:e.payload)||void 0===l?void 0:l.translation}:{body:void 0,translatedBody:void 0};var o,i,s,a,c,l;const u=!!t,d=Dn(vs(e));return{body:u&&d?t:r,hasTranslation:u,isTranslated:d&&u,locale:null==n?void 0:n.locale}}function Us(){const e=Dn((({translations:e})=>e.containerId));return{id:e,focusContainer:ws(e)}}function Bs(e){const{languages:t}=Ds();return(0,Pi.useMemo)((()=>{var n;return null===(n=null==t?void 0:t.find((t=>t.locale===e)))||void 0===n?void 0:n.nativeName}),[e,t])}const zs=()=>{const{isActive:e,languages:t}=Ds(),n=Wn(),{sendAction:r}=as(),{translationProposal:o}=Dn((e=>e.translations)),{enableTranslations:i}=Ds(),{isOpen:s}=Qi(),{userLocale:a}=Zi(),c=null==o?void 0:o.proposedLocale,l=Bs(c),u=(0,Pi.useMemo)((()=>null!==o&&!e&&s&&a!==c&&t.some((e=>e.locale===c))),[o,e,s,a,c,t]);return{activateTranslationProposal:()=>{i(null==o?void 0:o.proposedLocale)},dismissTranslationProposal:()=>{r({type:Cr,body:{type:"translation_proposal"}}),n(Ei())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}},$s=(...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.length)).map((e=>e.indexOf(p)>-1?e:[p,e].join("-"))).join(" "),Hs=({eventPayload:t})=>{const{t:n}=Zi(),{fromClient:r,participant:o}=t,i=(e=>Jn().participantInfo.participants[e])(o)||{},{messages:s}=qn(),a=r?n("participants.user.name"):i&&i.name,{showAvatar:c,showName:l}=s[r?"user":"agent"]||{};if(!c&&!l)return null;const u=[];return c&&a&&i.avatar&&u.push((0,e.jsx)("span",{className:$s("message__avatar"),children:(0,e.jsx)("img",{src:i.avatar,className:$s("avatar"),alt:""})})),l&&a&&u.push((0,e.jsx)("span",{className:$s("message__author-name"),children:a})),u.length>0&&(0,e.jsx)("div",{className:$s("message__author"),children:u})},Vs=function({showParticipant:t=!0,event:n,type:r,modifiers:o,children:i,bodyProps:s={},info:a,...c}){const l=js(n),{hasTranslation:u,isTranslated:d,locale:p}=Fs(n);return r&&l.push(`message--type-${r}`),o&&("string"==typeof o&&(o=o.split(" ").filter((e=>e.length))),o.forEach((e=>{l.push(`message--${e}`)}))),d&&l.push("message--is-translated"),u&&l.push("message--has-translation"),d&&(s={...s,lang:p}),(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:$s(l),...c,children:[t&&(0,e.jsx)(Hs,{eventPayload:n.payload}),(0,e.jsx)("div",{className:$s("message__body"),...s,children:i}),a&&(0,e.jsx)("div",{"aria-hidden":"true",className:$s("message__info"),children:a})]})})},Ws=({id:t,action:n,buttonText:r,description:o,hasFocus:i,image:s,title:a,isCarouselItem:c})=>{const l=(0,Pi.useRef)(null),{sendMessage:u,sendAction:d,emitEvent:p}=as(),h=Ps(),f=(0,Pi.useRef)(!1),m=n.type===kr?"a":"button",v=(0,Pi.useCallback)((()=>p("action.click_card",{type:jr,originMessage:t,action:n})),[p,t,n]),y=(0,Pi.useCallback)((()=>{if(v(),"ask"===n.type)u({body:n.ask});else if("topic"===n.type){const{topic:e,fallbackMessage:t}=n;d({type:_r,body:{name:e,fallbackMessage:t}})}}),[u,n,d,v]),g=(0,Pi.useMemo)((()=>n.type===kr?{href:n.link,rel:"noopener noreferrer",target:n.newTab?"_blank":"_self",onClick:v}:{onClick:y}),[n,y,v]);return(0,Pi.useEffect)((()=>{c&&(i&&f.current?window.requestAnimationFrame((()=>l.current.focus())):l.current.blur()),f.current=!0}),[i,c]),(0,e.jsxs)("div",{className:$s("card__wrapper"),id:t,tabIndex:-1,ref:l,children:[s?(0,e.jsx)("img",{className:$s("card__image"),src:s,alt:""}):null,(0,e.jsxs)("div",{className:$s("card__content"),id:t,children:[a&&(0,e.jsx)("h2",{className:$s("card__title"),children:a}),o&&(0,e.jsx)("div",{className:$s("card__description"),dangerouslySetInnerHTML:{__html:o}}),(0,e.jsx)(m,Object.assign({tabIndex:c&&!i?-1:void 0,className:$s("button","button--primary"),"aria-describedby":h},g,{children:r}))]})]})};function qs({item:t,items:n,index:r,isActive:o}){const{t:i}=Zi();return(0,e.jsx)("div",{className:$s("carousel-item",`carousel-item--${t.type}`),role:"group","aria-roledescription":"slide","aria-label":i("carousel.slide.label",{index:r+1,total:n.length}),children:(0,e.jsx)(Ws,{...t,isCarouselItem:!0,hasFocus:o})})}const Gs={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'}},Ks=({name:t,size:n="32",className:r,alt:o})=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{"aria-hidden":"true",className:r||$s("icon"),dangerouslySetInnerHTML:{__html:Gs[t][n]}}),o&&(0,e.jsx)("span",{className:$s("visually-hidden"),children:o})]});function Js({items:t,currentIndex:n,onChange:r,children:o}){const{t:i}=Zi(),s=t.length;return(0,e.jsxs)("div",{className:$s("carousel-controls"),children:[(0,e.jsx)("button",{className:$s("button","button--previous"),"aria-label":i("carousel.controls.previous"),onClick:()=>{r((n-1+s)%s)},children:(0,e.jsx)(Ks,{name:"arrowLeft",size:"16",alt:""})}),o,(0,e.jsx)("button",{className:$s("button","button--next"),"aria-label":i("carousel.controls.next"),onClick:()=>{r((n+1)%s)},children:(0,e.jsx)(Ks,{name:"arrowRight",size:"16",alt:""})})]})}function Xs({items:t,currentIndex:n,onChange:r,getItemKey:o,getItemLabel:i}){const s=t.length,a=(0,Pi.useCallback)((e=>{const t=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,t));o!==n&&r(o)}),[s,n,r]);return(0,e.jsx)("div",{className:$s("carousel-pagination__wrapper"),role:"group",children:(0,e.jsx)("ul",{className:$s("carousel-pagination"),children:t.map(((t,r)=>{const s=n===r;return(0,e.jsx)("li",{className:$s("carousel-pagination__item",s?"is-active":void 0),children:(0,e.jsx)("button",{className:$s("carousel-pagination__button"),type:"button",onClick:a,"data-item":r,"aria-disabled":s?"true":void 0,"aria-label":i(t,r)})},o(t,r,"pagination-item-"))}))})})}const Ys=(e,t,n)=>`${n}${t}`,Zs=e=>e.label,Qs=({target:e})=>{e.scrollLeft=0};function ea({currentIndex:t,onChange:n,getItemKey:r=Ys,getItemLabel:o=Zs,items:s}){const a=Ps(),c=s.length,[l,u]=(0,Pi.useState)(Number(t||"0"));(0,Pi.useEffect)((()=>{u(Number(t||"0"))}),[u,t]);const d=(0,Pi.useRef)([]);d.current=(0,Pi.useMemo)((()=>Array(c).fill(1).map((()=>(0,i.createRef)()))),[c]);const p=(0,Pi.useRef)(!0),h=(0,Pi.useRef)();return h.current=n,(0,Pi.useEffect)((()=>{p.current?p.current=!1:h.current&&h.current(l)}),[l]),(0,e.jsxs)("div",{className:$s("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,e.jsx)("div",{className:$s("carousel__slides-wrapper"),onScroll:Qs,children:(0,e.jsx)("div",{id:a,className:$s("carousel__slides"),style:{width:100*c+"%",left:-100*l+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((t,n)=>{const o=l===n;return(0,e.jsx)("div",{ref:d.current[n],className:$s("carousel__slide",o?"is-active":void 0),"aria-hidden":o?void 0:"true",children:(0,e.jsx)(qs,{item:t,items:s,currentIndex:l,index:n,isActive:o})},r(t,n,"item-"))}))})}),(0,e.jsx)("div",{className:$s("carousel__controls"),children:(0,e.jsx)(Js,{currentIndex:l,items:s,onChange:u,controlId:a,children:(0,e.jsx)("div",{className:$s("carousel__pagination"),children:(0,e.jsx)(Xs,{currentIndex:l,items:s,onChange:u,getItemKey:r,getItemLabel:o})})})})]})}const ta=(e,t,n="")=>`${n}${e.title}:${t}`,na=e=>e.title,ra=e=>{const{payload:t}=e,[n,r]=(0,Pi.useState)(!1),{sendAction:o,addMessageBubble:i,addDivider:s}=as(),{activeServiceSessionId:a}=nr(),c=Dn(rr),{body:l}=Fs(e),{service:u}=t,d=(0,Pi.useMemo)((()=>({...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,Pi.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:d,showOptions:n,chooseAgain:p,onChoiceClickHandler:e=>{const n=g();p&&s("new_topic",n),i(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))}}},oa=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,ia=({id:t,categories:n=[],question:r,onClick:o,hasIcon:i})=>{const s=(0,Pi.useMemo)((()=>["suggestions__item",...n.map(oa)]),[n]),a=(0,Pi.useCallback)((()=>{o&&o({id:t,question:r})}),[t,r,o]);return(0,e.jsx)("li",{className:$s(s),children:(0,e.jsxs)("button",{type:"button",onClick:a,className:$s("button","button--primary"),children:[i&&(0,e.jsx)(Ks,{name:"chevronRight",size:"8",alt:""}),r]})})},sa=({className:t,suggestions:n=[],onClickSuggestion:r,hasIcon:o=!0})=>(0,e.jsx)("ul",{className:$s("suggestions__list",t),children:n.map((t=>(0,e.jsx)(ia,{hasIcon:o,onClick:r,...t},t.id)))}),aa=e=>{const{sendAction:t}=as();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}};function ca({children:t,childrenHTML:n,className:r,graphicSrc:o,graphicType:i="icon",iconName:s,iconSize:a,iconClassName:c,dividerType:l}){const u=Boolean(s||o),d=n?{dangerouslySetInnerHTML:{__html:n}}:{children:t};return(0,e.jsxs)("div",{className:$s("divider",l&&`divider--type-${l}`,r),children:[u&&(0,e.jsx)("span",{className:$s("divider__graphic"),children:s?(0,e.jsx)(Ks,{name:s,size:a,className:c,alt:""}):(0,e.jsx)("img",{src:o,className:$s({icon:"icon"===i,avatar:"avatar"===i},c)})}),(0,e.jsx)("div",{className:$s("divider__body"),...d})]})}const la={[Tr.new_topic]:"newtopic"},ua={default:({event:t})=>{const{t:n}=Zi(),{subtype:r}=t.payload.body,o=la[Tr[r]];return(0,e.jsx)(ca,{dividerType:o,iconName:Tr[r],children:(0,e.jsx)("p",{children:n(`dividerKeys.${Tr[r]}`)})})},[Tr.new_translation]:({event:t})=>{const{t:n}=Zi(),r=Zn(),{body:{translationEnabled:o,text:i,title:s},id:a}=t.payload,c=Dn((e=>e.translations.translatedEventGroups)),l=Wn(),u=(0,Pi.useCallback)((()=>{c[a]?l(Ci({events:r,id:a})):l(_i({events:r,id:a}))}),[l,r,a,c]);return(0,e.jsxs)(ca,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,e.jsx)("p",{className:$s("divider__title"),children:s}),i&&(0,e.jsx)("p",{children:i}),o?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("button",{className:$s("button","button--secondary"),onClick:u,children:n(c[a]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null]})}},da={month:"long",day:"numeric",year:"numeric"},pa={hour:"numeric",minute:"numeric"},ha=({event:t})=>{const n=(()=>{const[e,t]=(0,Pi.useReducer)((e=>e+1),0);return(0,Pi.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:r,time:o,timeUntilMidnight:i,srText:s}=(e=>{const{t}=Zi(),n=qn(),r=n?.context?.locale??[],o=new Date(e),i=new Date,s=new Date(i);s.setHours(24,0,0,0);const a=s-i,c=o.toString(),l=new Intl.DateTimeFormat(r,pa).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,i);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,da).format(o)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:a}})(w(t.timeIndicator));return(0,Pi.useEffect)((()=>{const e=setTimeout((()=>{n()}),i);return()=>{clearTimeout(e)}}),[n,i]),(0,e.jsxs)(ca,{dividerType:"time-indicator",children:[(0,e.jsxs)("p",{className:$s("divider__time"),"aria-hidden":"true",children:[(0,e.jsx)("span",{children:r}),(0,e.jsx)("span",{children:o})]}),(0,e.jsx)("p",{className:$s("visually-hidden"),children:s})]})};var fa=["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])"],ma=fa.join(","),va="undefined"==typeof Element,ya=va?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ga=!va&&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},ba=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)},xa=function(e,t,n){if(ba(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ma));return t&&ya.call(e,ma)&&r.unshift(e),r.filter(n)},wa=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!ba(s,!1))if("SLOT"===s.tagName){var a=s.assignedElements(),c=e(a.length?a:s.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{ya.call(s,ma)&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var l=s.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(s),u=!ba(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(l&&u){var d=e(!0===l?s.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:s,candidates:d})}else i.unshift.apply(i,s.children)}}return o},Ca=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},_a=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))&&!Ca(e)?0:e.tabIndex},ja=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ea=function(e){return"INPUT"===e.tagName},Sa=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Ta=function(e,t){return!(t.disabled||ba(t)||function(e){return Ea(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=ya.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ya.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Sa(e)}else{if("function"==typeof r){for(var i=e;e;){var s=e.parentElement,a=ga(e);if(s&&!s.shadowRoot&&!0===r(s))return Sa(e);e=e.assignedSlot?e.assignedSlot:s||a===e.ownerDocument?s:a.host}e=i}if(function(e){var t,n,r,o,i=e&&ga(e),s=null===(t=i)||void 0===t?void 0:t.host,a=!1;if(i&&i!==e)for(a=!!(null!==(n=s)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(s)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&s;){var c,l,u;a=!(null===(l=s=null===(c=i=ga(s))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(s))}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!!ya.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Oa=function(e,t){return!(function(e){return function(e){return Ea(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ga(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)||_a(t)<0||!Ta(e,t))},ka=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Na=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,s=i?t.scopeParent:t,a=function(e,t){var n=_a(e);return n<0&&t&&!Ca(e)?0:n}(s,i),c=i?e(t.candidates):s;0===a?i?n.push.apply(n,c):n.push(s):r.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:c})})),r.sort(ja).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Aa=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ya.call(e,ma)&&Oa(t,e)},Ia=fa.concat("iframe").join(","),Ra=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ya.call(e,Ia)&&Ta(t,e)};function Pa(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 La(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pa(Object(n),!0).forEach((function(t){var r,o,i;r=e,o=t,i=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:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ma=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},Da=function(e){return Ma(e)&&!e.shiftKey},Fa=function(e){return Ma(e)&&e.shiftKey},Ua=function(e){return setTimeout(e,0)},Ba=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},za=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},$a=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},Ha=[],Va=function(e,t){var n,r=(null==t?void 0:t.document)||document,o=(null==t?void 0:t.trapStack)||Ha,i=La({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Da,isKeyBackward:Fa},t),s={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]:i[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return s.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=i[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),s=1;s<n;s++)o[s-1]=arguments[s];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||!Ra(e,i.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=s.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(s.containerGroups=s.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?wa([e],t.includeContainer,{filter:Oa.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:ka}):xa(e,t.includeContainer,Oa.bind(null,t)),Na(n)}(e,i.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?wa([e],t.includeContainer,{filter:Ta.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):xa(e,t.includeContainer,Ta.bind(null,t))}(e,i.tabbableOptions),r=t.length>0?t[0]:void 0,o=t.length>0?t[t.length-1]:void 0,s=n.find((function(e){return Aa(e)})),a=n.slice().reverse().find((function(e){return Aa(e)})),c=!!t.find((function(e){return _a(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:o,firstDomTabbableNode:s,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 Aa(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return Aa(e)})):t[o+(r?1:-1)]}}})),s.tabbableGroups=s.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),s.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(s.containerGroups.find((function(e){return e.posTabIndexesFound}))&&s.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:!!i.preventScroll}),s.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||$a(n),d();var a=null;if(s.tabbableGroups.length>0){var u=c(t,n),p=u>=0?s.containerGroups[u]:void 0;if(u<0)a=o?s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:s.tabbableGroups[0].firstTabbableNode;else if(o){var h=Ba(s.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||Ra(t,i.tabbableOptions)&&!Aa(t,i.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?s.tabbableGroups.length-1:h-1,m=s.tabbableGroups[f];a=_a(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else Ma(n)||(a=p.nextTabbableNode(t,!1))}else{var v=Ba(s.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(v<0&&(p.container===t||Ra(t,i.tabbableOptions)&&!Aa(t,i.tabbableOptions)&&!p.nextTabbableNode(t))&&(v=u),v>=0){var y=v===s.tabbableGroups.length-1?0:v+1,g=s.tabbableGroups[y];a=_a(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else Ma(n)||(a=p.nextTabbableNode(t))}}else a=l("fallbackFocus");return a},v=function(e){var t=$a(e);c(t,e)>=0||(za(i.clickOutsideDeactivates,e)?n.deactivate({returnFocus:i.returnFocusOnDeactivate}):za(i.allowOutsideClick,e)||e.preventDefault())},y=function(e){var t=$a(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(s.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var o=!0;if(s.mostRecentlyFocusedNode)if(_a(s.mostRecentlyFocusedNode)>0){var a=c(s.mostRecentlyFocusedNode),l=s.containerGroups[a].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===s.mostRecentlyFocusedNode}));d>=0&&(i.isKeyForward(s.recentNavEvent)?d+1<l.length&&(r=l[d+1],o=!1):d-1>=0&&(r=l[d-1],o=!1))}}else s.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return _a(e)>0}))}))||(o=!1);else o=!1;o&&(r=m({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),h(r||s.mostRecentlyFocusedNode||u())}s.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!==za(i.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(i.isKeyForward(e)||i.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(Ma(e)&&e.preventDefault(),h(n))}(e,i.isKeyBackward(e))},b=function(e){var t=$a(e);c(t,e)>=0||za(i.clickOutsideDeactivates,e)||za(i.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},x=function(){if(s.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),s.delayInitialFocusTimer=i.delayInitialFocus?Ua((function(){h(u())})):h(u()),r.addEventListener("focusin",y,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",b,{capture:!0,passive:!1}),r.addEventListener("keydown",g,{capture:!0,passive:!1}),n},w=function(){if(s.active)return r.removeEventListener("focusin",y,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",b,!0),r.removeEventListener("keydown",g,!0),n},C="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===s.mostRecentlyFocusedNode}))}))&&h(u())})):void 0,_=function(){C&&(C.disconnect(),s.active&&!s.paused&&s.containers.map((function(e){C.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return s.active},get paused(){return s.paused},activate:function(e){if(s.active)return this;var t=a(e,"onActivate"),n=a(e,"onPostActivate"),o=a(e,"checkCanFocusTrap");o||d(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var i=function(){o&&d(),x(),_(),null==n||n()};return o?(o(s.containers.concat()).then(i,i),this):(i(),this)},deactivate:function(e){if(!s.active)return this;var t=La({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},e);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,w(),s.active=!1,s.paused=!1,_(),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(){Ua((function(){u&&h(f(s.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(f(s.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){if(s.paused||!s.active)return this;var t=a(e,"onPause"),n=a(e,"onPostPause");return s.paused=!0,null==t||t(),w(),_(),null==n||n(),this},unpause:function(e){if(!s.paused||!s.active)return this;var t=a(e,"onUnpause"),n=a(e,"onPostUnpause");return s.paused=!1,null==t||t(),d(),x(),_(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return s.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),s.active&&d(),_(),this}},n.updateContainerElements(e),n};const Wa=({children:e,onClose:t,"aria-label":n,"aria-labelledby":r,fallBackFocusRef:o})=>{const s=Ps(),a=(0,Pi.useRef)(null),c=(0,Pi.useRef)(null),[l,u]=(0,Pi.useState)(!1);return(0,Pi.useEffect)((()=>(l&&(c.current=Va(a.current,{initialFocus:o&&o.current?o.current:null}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,o]),(0,Pi.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||(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,Pi.useEffect)((()=>{l&&a.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,Pi.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",s),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),n&&t.setAttribute("aria-label",n),r&&t.setAttribute("aria-labelledby",r),e.appendChild(t),a.current=t,u(!0),()=>{a.current&&(e.removeChild(a.current),a.current=null)}}),[n,r,s]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>a.current&&(0,i.render)(e,a.current)}):a.current&&(0,i.render)((0,i.toChildArray)(e).map((e=>(e.props={...e.props,onClose:t},e))),a.current)},qa=({url:t,description:n,onClose:r})=>{const{zIndex:o,layoutMode:i,namespace:s}=qn(),a=As(),c=_s(),l=(0,Pi.useRef)(null),{t:u}=Zi(),d=["modal",`app--layout-${i}`,`namespace--${s}`,...c],p=e=>{e.stopPropagation()},h=()=>{r()},f=o?{zIndex:o+1}:void 0;return(0,e.jsx)(Wa,{onClose:r,"aria-label":u("lightbox.heading"),fallBackFocusRef:l,children:({onClose:r,modalRenderFn:o})=>o((r=>(0,e.jsx)("div",{className:$s(d),onClick:h,style:f,children:(0,e.jsxs)("div",{className:$s("modal__float"),tabIndex:"-1",onMouseDown:a,onKeyDown:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,ref:l,children:[(0,e.jsx)("div",{className:$s("modal__inner"),onClick:p,children:(0,e.jsx)("img",{className:$s("modal__image"),src:t,alt:n})}),(0,e.jsxs)("button",{type:"button",className:$s("modal__close"),onClick:r,children:[(0,e.jsx)(Ks,{name:"close",size:"16",alt:""}),u("lightbox.closeLabel")]})]})}))(r))})},Ga=({description:t,url:n})=>{const{t:r}=Zi(),[o,i]=(0,Pi.useState)(!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:$s("modal__enlarge"),onClick:()=>{i(!0)},children:[r("message.image.srTextEnlargeButtonLabel",{description:t}),(0,e.jsx)(Ks,{name:"enlarge",size:"32",alt:""})]}),o&&(0,e.jsx)(qa,{url:n,description:t,onClose:()=>{i(!1)}})]})},Ka=({event:t,...n})=>{const{body:r}=Fs(t),o=aa(t.payload.id),i=(0,Pi.useMemo)((()=>t.payload.optimisticallyInjected?{children:(0,e.jsx)("p",{children:r.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:r?.data?.text||r.text}}}),[r,t]);return(0,e.jsx)(Vs,{type:"text",event:t,onClick:o,...n,...i})},Ja="PROCESSING_IMAGE",Xa=({img:t,filename:n})=>{const{t:r}=Zi(),o=r("fileUpload.srFileUploadedText",{fileName:n});return(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("span",{className:$s(["download","download--preview"]),children:[(0,e.jsx)("img",{src:t,alt:o}),(0,e.jsx)("span",{"aria-hidden":"true",className:$s("file-download"),children:n})]})})},Ya=({children:t,url:n,target:r})=>n?(0,e.jsx)("a",{href:n,download:!0,target:r,className:$s(["download","download-link"]),children:t}):(0,e.jsx)("span",{className:$s("download"),children:t}),Za={message:{choice_prompt:({event:t,children:n,...r})=>{const{t:o}=Zi(),s=Ps(),{body:a,subEvent:c,showOptions:l,chooseAgain:u,onChoiceClickHandler:d,onChooseAgainClickHandler:p}=ra(t);return(0,e.jsxs)(e.Fragment,{children:[(0,i.toChildArray)(n).map((e=>(e.props={...e.props,event:c,descriptorId:s,showTranslationToggle:!1},e))),u&&(0,e.jsxs)("button",{type:"button",className:$s("button","button--secondary","button--choose-again"),"aria-expanded":l?"true":"false",onClick:p,"aria-describedby":s,children:[o(l?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,e.jsx)(Ks,{name:"chevronDown",size:"8",alt:""})]}),l&&(0,e.jsx)(Vs,{type:"choice-prompt",showParticipant:!1,event:t,...r,children:(0,e.jsx)("ul",{className:$s("choice-prompt","choice-prompt--many"),children:a.choices.map((t=>(0,e.jsx)("li",{className:$s("choice-prompt__item",{[`choice-prompt__item--${t.category}`]:t.category}),children:(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{d(t)},children:t.text})},t.id)))})})]})},text:Ka,image:({event:t,descriptorId:n,...r})=>{const{body:o}=Fs(t),{description:i,url:s,isZoomable:a}=o,[c,l]=(0,Pi.useState)(!1),u=Wn();return(0,e.jsxs)(Vs,{event:t,type:"image",...r,children:[(0,e.jsx)("img",{src:s,id:n,alt:i,onLoad:()=>{u(Jo(t.payload.id)),l(!0)}}),a&&c&&(0,e.jsx)(Ga,{description:i,url:s})]})},splash:({event:t,...n})=>{const{payload:r}=t,{body:o}=Fs(t),i=aa(r.id);return(0,e.jsx)(Vs,{type:"splash",event:t,onClick:i,...n,bodyProps:{dangerouslySetInnerHTML:{__html:o.text}}})},video:({event:t,descriptorId:n,...r})=>{const{body:o}=Fs(t),{description:i,url:s}=o;return js(t).push("message--type-video"),(0,e.jsxs)(Vs,{event:t,type:"video",...r,children:[(0,e.jsx)("div",{id:n,className:$s("visually-hidden"),children:i}),(0,e.jsx)("iframe",{title:i,src:s,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:t,...n})=>{const{t:r}=Zi(),{body:o}=Fs(t),{fromClient:i,id:s}=t.payload,{filename:a,url:c}=o,l=(e=>{const{processingFileUploads:t}=Dn((({state:e})=>e));return(0,Pi.useMemo)((()=>{if(t.some((t=>t===e)))return Ja;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(s),u=(0,Pi.useMemo)((()=>r(c?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:a})),[c,a,r]);return(0,e.jsx)(Vs,{event:t,type:"upload",...n,children:l&&l!==Ja?(0,e.jsx)(Xa,{img:l,filename:a}):(0,e.jsxs)(Ya,{url:c,target:i?void 0:"_blank",children:[(0,e.jsx)(Ks,{name:"download",size:"16",alt:u}),(0,e.jsx)("span",{"aria-hidden":"true",className:$s("file-download"),children:a})]})})},cta:({event:t})=>{const{body:n}=Fs(t),r=aa(t.payload.id),{emitEvent:o}=as(),i=Ps(),s=(0,Pi.useCallback)((()=>o(`action.${jr}`,{type:jr,originMessage:t.payload.id,link:{url:n.buttonLink}})),[o,n,t]);return(0,e.jsxs)(Vs,{type:"cta",event:t,children:[(0,e.jsx)("div",{className:$s("cta__content"),id:i,dangerouslySetInnerHTML:{__html:n.description},onClick:r}),(0,e.jsx)("a",{className:$s("button","button--primary"),"aria-describedby":i,href:n.buttonLink,rel:"noreferrer",target:n.buttonNewTab?"_blank":"_self",onClick:s,children:n.buttonText})]})},carousel:({event:t})=>{const{body:n}=Fs(t),r=n.cards;return(0,e.jsx)(Vs,{event:t,modifiers:"type-carousel",children:(0,e.jsx)(ea,{items:r,ItemComponent:qs,getItemKey:ta,getItemLabel:na})})},card:({event:t})=>{const{body:n}=Fs(t),r=Ps();return(0,e.jsx)(Vs,{type:"card",event:t,children:(0,e.jsx)(Ws,{id:r,...n})})}},info:{text:Ka,divider:({event:t,...n})=>{const r=ua[Tr[t.payload.body.subtype]]||ua.default;return(0,e.jsx)(r,{event:t,...n})},translation:({event:t,...n})=>{const{t:r}=Zi(),{body:o}=Fs(t);return(0,e.jsx)(Vs,{type:"text",event:t,...n,children:r(o.key.join("."),o.variables)})},timeIndicator:ha},participant:{participant:({event:t})=>{const{participant:n}=t.payload,{body:r}=Fs(t);return r?(0,e.jsx)(ca,{graphicSrc:n.avatar,graphicType:n.avatar?"avatar":void 0,iconName:n.avatar?void 0:"balloon",childrenHTML:r,dividerType:"participant"}):null}},service_data:{suggestion:({event:t,...n})=>{const[r,o]=(0,Pi.useState)(!0),i=Wn(),s=ts(),{sendAction:a,addMessageBubble:c}=as(),{suggestions:l,payload:u}=(e=>{const{payload:t}=e,{body:n}=Fs(e);return{suggestions:n,payload:t}})(t),{showSuggestions:d}=qn(),p=Zn(),{t:h}=Zi(),f=h("suggestions.headingText"),m=h("suggestions.footerText"),v=(0,Pi.useMemo)((()=>p.some((({payload:e})=>e?.transactionLast))),[p]),y=(0,Pi.useCallback)((({id:e,question:t})=>{o(!1),i(Hr(!0)),a({type:gr,originMessage:u.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),c(t)}),[i,a,u.id,c]);return r&&!s&&v&&d?(0,e.jsxs)("div",{className:$s("suggestions","suggestions--conversation"),children:[f&&(0,e.jsx)("p",{className:$s("suggestions__heading"),children:f}),(0,e.jsxs)(Vs,{type:"suggestions",showParticipant:!1,event:t,...n,children:[(0,e.jsx)(sa,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:l}),m&&(0,e.jsx)("p",{className:$s("suggestions__footer"),children:m})]})]}):null}}},Qa=({children:t})=>{const{customComponents:n}=qn(),r=(0,Pi.useMemo)((()=>Object.keys(Za).reduce(((e,t)=>({...e,[t]:{...Za[t],...n?n[t]:{}}})),{fallback:Ka})),[n]);return(0,e.jsx)(ms.Provider,{value:r,children:t})},ec=({children:t})=>{const{isMinimized:n}=Qi(),r=(0,Pi.useRef)(0),{sendAction:o}=as(),{hasCountdown:i,isActive:s,stopCountdown:a}=Is(),c=(0,Pi.useCallback)((()=>{if(n)return;const e=(new Date).getTime(),t=()=>{o({type:"interactivity_update"}),r.current=e};i&&s&&(t(),a()),e-r.current>15e3&&t()}),[o,i,s,a,n]);return(0,e.jsx)("div",{className:$s("activity-monitor"),tabIndex:-1,onMouseDown:c,onKeyUp:c,onTouchStart:c,onMouseMove:c,onWheel:c,onPointerDown:c,onPointerMove:c,children:(0,e.jsx)(Ns.Provider,{value:c,children:t})})};const tc=["text","choice_prompt","image","video"],nc=()=>{const e=gs(),t=(0,Pi.useRef)(),n=(0,Pi.useRef)(),r=Ii(),o=(0,Pi.useContext)(rs),i=(0,Pi.useRef)(null),{initCountdown:s,endCountdown:a}=Is(),{emitEvent:c}=as();return(0,Pi.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new Wr(e);r(mo({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(Oo())})),t.onOpen((()=>{r(vo())}))}}),[e,r]),(0,Pi.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new l;return r(mo({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,Pi.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&&(null==o?void 0:o.name)&&r(Vo(o.name)),r(Xo({participant:o,fromClient:n})),"string"!=typeof o&&o.introduction&&r(So(e))};e.onConnection((({connected:n})=>{if(!n)return!1;const{channel:i}=e;return i.onMessage=(e,n)=>{const i={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(Ko(n.state.loading)),n.type){case"idle_detach_countdown":s(n.body.duration);break;case"idle_detach_countdown_elapsed":a(void 0,!0);break;case"resume_conversation_prompt":r(Lo());break;case"translation_proposal":r(ji(n.body));break;case"user_first_response":r(Hr(!0)),o.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(io(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(So(i))}break;case"participant":t(i);break;case"service_data":n.persist&&r(Zo(n));break;case"ack":r(Eo(i));break;case"system":if("service_changed"===n.type){const{serviceSettings:e}=n,t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["serviceSettings"]),{entry:o,proactiveMessages:i}=e,{upload:s}=o.options;r($o({key:Or,enabled:!(!s||!s.enabled)})),r(di(i.enabled||!1)),r(Qo(o)),n.serviceSessionId&&r(Uo(n.serviceSessionId)),c("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(So(i));break;case"error":switch(n.type){case"find_conversation_erred":const e=new u(i);r(mo({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 l(i);r(mo({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError,action:t.action}))}}return n},!1}))}),[e,r,c,a,o,s]),(0,Pi.useEffect)((()=>{e.onConnection((({connected:t})=>{if(!t)return!1;const{channel:r}=e;return n.current&&r.off("message",n.current),n.current=r.on("message",(e=>tc.includes(e.type)?(e.id!==i.current&&o.emit("message",e),i.current=e.id,e):e)),!0}))}),[e,o]),(0,Pi.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.channel.off("sync",t.current),t.current=e.channel.on("sync",(e=>{return t=void 0,n=void 0,i=function*(){try{const t=yield r(po(e)).unwrap();if(!t)return;r(qo(t))}catch(e){}},new((o=void 0)||(o=Promise))((function(e,r){function s(e){try{c(i.next(e))}catch(e){r(e)}}function a(e){try{c(i.throw(e))}catch(e){r(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(s,a)}c((i=i.apply(t,n||[])).next())}));var t,n,o,i})),!0)))}),[e,r]),null};var rc=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const oc=({children:t})=>{const{t:n}=Zi(),r=Wn(),o=os(),{addUploadBubble:i}=as(),s=(0,Pi.useCallback)(((e,t)=>rc(void 0,void 0,void 0,(function*(){r(oi(t));const n=yield(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=n,yield o.decode();const i=(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}`,i)}catch(e){}finally{r(ii(t))}}))),[r]),a=(0,Pi.useCallback)((e=>{const t=g(),a=o.uploadFile(e,(e=>{r(ri({fileId:t,progress:Math.ceil(e)}))}),(n=>rc(void 0,void 0,void 0,(function*(){const{id:o,transactionId:a,occurredAt:c,body:{contentType:l,filename:u,filesize:d,url:p}}=n;r(ti(t)),i(o,a,c,l,u,d,p),yield s(e,o)}))),(e=>{let o;switch((null==e?void 0:e.error)||""){case"file_uploads_are_disabled":o=n("fileUpload.errors.unavailable");break;case"request_entity_too_large":o=n("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":o=n("fileUpload.errors.wrongType");break;case"virus_found":o=n("fileUpload.errors.virusFound");break;default:o=n("fileUpload.errors.general")}r(ni({fileId:t,errorText:o}))}));r(Mo({fileId:t,fileName:e.name,uploadHandle:a}))}),[s,i,o,r,n]);return(0,e.jsx)(Es.Provider,{value:a,children:t})},ic=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=Is();return((e,t)=>{const n=(0,Pi.useRef)(e);(0,Pi.useEffect)((()=>{n.current=e}),[e]),(0,Pi.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n>0?1e3:null),null},sc=()=>{const{initUserSelectedOptions:e}=Os(),t=(0,Pi.useRef)(!1),n=qn();return(0,Pi.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function ac(e,t,n=[]){const r=(0,Pi.useContext)(rs),o=(0,Pi.useRef)();o.current=t,(0,Pi.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 cc=()=>{const e=qn(),{sendMessage:t,sendContext:n,sendAction:r}=as(),o=Wn(),{setVisibility:i,visible:s}=Qi(),a=(0,Pi.useRef)(s),c=(0,Pi.useContext)(rs),l=os(),u=er(),d=(0,Pi.useRef)(null),p=(0,Pi.useRef)(null),{isInline:f,isResolving:m}=sr(),v=Dn(ds),y=(()=>{const{get:e}=is();return e?e("conversationUrl"):null})(),g=(0,Pi.useRef)(null),b=As(),{enableTranslations:x,disableTranslations:w}=Ds();return(0,Pi.useEffect)((()=>{a.current=s}),[s]),ac("askText",(e=>{t({body:e})}),[l.send]),ac("setVariables",(e=>{n({variables:e})}),[l.send]),ac("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),ac("setVisibility",(e=>{Object.values(Cn).includes(e)?(b(),i(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e?.api]),ac("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),ac("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&o(Fr({showSuggestions:!1})),e&&t?r({type:_r,body:{name:e,fallbackMessage:t,participant:n?h:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),ac("setContext",(e=>{n(e)}),[l.send]),ac("setTranslation",(({enabled:e,locale:t})=>{e?x(t,"window_api"):w()}),[l.send]),(0,Pi.useEffect)((()=>{m||v||(g.current&&g.current!==y&&c.emit("unreadMessageCount",u),s===Cn.open&&s!==p.current&&0!==d.current&&c.emit("unreadMessageCount",0),s!==Cn.open&&u!==d.current&&c.emit("unreadMessageCount",u),p.current=s,d.current=u,g.current=y)}),[u,s,c,f,m,v,y]),null},lc=({children:t})=>{const n=(0,Pi.useContext)(rs),[r,o]=(0,Pi.useState)({}),i=(0,Pi.useRef)(!0),s=(0,Pi.useCallback)((e=>{i.current&&(o(e),n.emit("aria-live",e))}),[o,n]);(0,Pi.useEffect)((()=>{let e=null;return r&&r.messageText&&(e=setTimeout((()=>{s({}),clearTimeout(e)}),600)),()=>{clearTimeout(e)}}),[r,s]),(0,Pi.useEffect)((()=>()=>{i.current=!1}),[]);const{ariaLive:a,messageText:c}=r;return(0,e.jsxs)(cs.Provider,{value:s,children:[t,(0,e.jsxs)("div",{className:$s("app__live-container"),children:[(0,e.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:$s("visually-hidden"),children:a===Er?c:null}),(0,e.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:$s("visually-hidden"),children:a===Sr?c:null})]})]})},uc=()=>{const{t:e}=Zi(),t=Zn(),n=(0,Pi.useRef)(0),r=(0,Pi.useRef)(0),o=Jn().historyLoaded,{sendPolite:i}=ls(),{isOpen:s}=Qi(),a=(0,Pi.useRef)(null),c=(0,Pi.useRef)(null),l=(0,Pi.useMemo)((()=>x((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(i(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[i,e]);return(0,Pi.useEffect)((()=>{t.length>n.current&&(s&&(c.current=l(t)),n.current=t.length)}),[t,l,s]),(0,Pi.useEffect)((()=>{a.current&&!s&&c.current&&(c.current(!0),c.current=null)}),[s]),(0,Pi.useEffect)((()=>{o&&setTimeout((()=>{i(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,i]),null},dc=()=>{const{t:e}=Zi(),{isOpen:t,isVisible:n}=Qi(),r=er(),{sendPolite:o}=ls(),i=(0,Pi.useMemo)((()=>x(o,2e3)),[o]),s=(0,Pi.useRef)(null),a=(0,Pi.useRef)(null);return(0,Pi.useEffect)((()=>{s.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=i(e("message.srTextUnreadCount",{unreadCount:r}))),s.current=n}),[r,t,n,i,e]),null},pc=({store:t,children:n,eventBus:r,api:o})=>((0,Pi.useErrorBoundary)((e=>{t.dispatch(Gr(e))})),(0,e.jsx)(Bn,{store:t,children:(0,e.jsx)(rs.Provider,{value:r,children:(0,e.jsx)(ns.Provider,{value:o,children:(0,e.jsx)(lc,{children:(0,e.jsx)(fs,{children:(0,e.jsxs)(Qa,{children:[(0,e.jsx)(sc,{}),(0,e.jsx)(nc,{}),(0,e.jsx)(dc,{}),(0,e.jsx)(uc,{}),(0,e.jsx)(ic,{}),(0,e.jsxs)(ec,{children:[(0,e.jsx)(cc,{}),(0,e.jsx)(oc,{children:n})]})]})})})})})})),hc=jt(Yn,(e=>e.filter((e=>{var t;return bo(e)&&"service_data"!==e.type&&(null===(t=e.payload)||void 0===t?void 0:t.messageStatus)===vr})))),fc=jt(hc,(e=>e.at(-1))),mc=jt(hc,(e=>e.map((e=>e.payload.id)))),vc=jt((({state:e})=>{var t;return null===(t=e.options.features)||void 0===t?void 0:t.webNotifications}),(e=>null==e?void 0:e.enabled)),yc=()=>{const{t}=Zi(),{showDisclaimer:n}=qn();return n&&(0,e.jsxs)("div",{className:$s("disclaimer"),tabIndex:"0",children:[(0,e.jsx)("h2",{className:$s("disclaimer__title"),children:t("disclaimer.title")}),(0,e.jsx)("div",{className:$s("disclaimer__message"),dangerouslySetInnerHTML:{__html:t("disclaimer.content")}})]})},gc=jt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),bc=jt(gc,(e=>(null==e?void 0:e.controls)||{})),xc=jt(bc,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),wc=jt([bc,(e,{name:t})=>t],((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.value})),Cc=jt([bc,(e,{name:t})=>t],((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.touched})),_c=(0,i.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),jc=_c,{Provider:Ec,Consumer:Sc}=_c;function Tc(){return(0,Pi.useContext)(jc)}function Oc(e){const t=Wn(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:i}=Tc(),s=!!Dn((e=>gc(e,{formId:n}))),a=Dn((t=>wc(t,{formId:n,name:e}))),c=Dn((t=>Cc(t,{formId:n,name:e}))),l=null==i?void 0:i[e],u=!l;(0,Pi.useEffect)((()=>{s&&t(eo({formId:n,name:e}))}),[s,n,e,t]),(0,Pi.useLayoutEffect)((()=>()=>{t(to({formId:n,name:e}))}),[s,n,e,t]);const d=(0,Pi.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,Pi.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,Pi.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:a})),[e,d,p,a]),(0,Pi.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function kc(e){const{t}=Zi(),{sendAssertive:n}=ls(),{hasLimit:r,limit:o}=ir(),i=(0,Pi.useMemo)((()=>x(n,m)),[n]),s=(0,Pi.useMemo)((()=>x(((e,n)=>{e&&i(t("input.srCharacterLimitText",{limit:n}))}),m)),[i,t]),[{value:a}]=Oc(e),c=r&&a?o-a.length:o,l=!!r&&c<=f,u=!!r&&c<0;return(0,Pi.useEffect)((()=>{s(l,c)}),[l,c,s]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Nc=e=>{const{hasCharacterLimit:t,characterLimit:n}=kc(e),{entryMeta:{optionsOverride:{text:r}}}=Jn(),{t:o}=Zi();return{placeholder:(0,Pi.useMemo)((()=>o("input.inputPlaceholder",{hasLimit:t,text:(null==r?void 0:r.placeholder)||o("input.inputPlaceholderText"),limit:t?n:null})),[o,t,n,null==r?void 0:r.placeholder]),label:(0,Pi.useMemo)((()=>o("input.inputLabel",{hasLimit:!(null==r?void 0:r.label)&&t,text:(null==r?void 0:r.label)||o("input.inputLabelText"),limit:!(null==r?void 0:r.label)&&t?n:null})),[o,t,n,null==r?void 0:r.label]),labelClass:(0,Pi.useMemo)((()=>(null==r?void 0:r.label)?"label":"visually-hidden"),[null==r?void 0:r.label])}};function Ac(){const{abortTransaction:t,clearEntryAbortTransaction:n}=(()=>{const e=Wn(),{entryMeta:{actions:t,translatedActions:n}}=Jn();return{abortTransaction:(null==n?void 0:n.abortTransaction)||(null==t?void 0:t.abortTransaction),clearEntryAbortTransaction:()=>{e(ei())}}})(),r=os();return t?(0,e.jsx)("li",{className:$s(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,e.jsx)("button",{className:$s(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{r.send("action",{type:_r,body:{name:t.topicName,fallbackMessage:t.topicFallbackMessage}}),n()},children:t.label})}):null}const Ic=(0,i.createContext)(null),Rc=e=>{const t=(0,Pi.useContext)(ms),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]},Pc=({event:t,newParticipant:n})=>{const{eventRefs:r,unreadIds:o}=(0,ys.useContext)(Ic),{sendAction:i}=as(),s=r[t.payload.id],{containerRef:a,isVisible:c}=es({containerRef:s,freezeOnceVisible:!0}),l=Wn(),[u,d]=Rc(t);if((0,ys.useEffect)((()=>{if(c&&(null==o?void 0:o.includes(t.payload.id))){const e=o.reduce(((e,n)=>e.includes(t.payload.id)?e:e.concat(n)),[]);l(zo(e)),i({type:xr,events:e})}}),[l,t.payload.id,c,i,o]),!u)return null;const p=["conversation__item"];return"info"===t.type?p.push("conversation__item--source-info"):t.payload.fromClient?p.push("conversation__item--source-user"):p.push("conversation__item--source-agent"),n&&p.push("conversation__item--new-participant"),(0,e.jsxs)("li",{className:$s(p),ref:a,children:[t.timeIndicator&&(0,e.jsx)(ha,{event:t}),(0,e.jsx)(u,{event:t,children:(0,e.jsx)(d,{event:t})})]})},Lc=()=>{const{id:t}=or()||{};return(0,e.jsx)("li",{className:$s("conversation__item","conversation__item--source-agent"),children:(0,e.jsxs)("div",{className:$s("message","message--source-agent","message--type-loading"),children:[(0,e.jsx)(Hs,{eventPayload:{fromClient:!1,participant:t}}),(0,e.jsx)("div",{className:$s("message__body"),children:(0,e.jsxs)("span",{className:$s("loader"),children:[(0,e.jsx)("span",{className:$s("loader__part","one")}),(0,e.jsx)("span",{className:$s("loader__part","two")}),(0,e.jsx)("span",{className:$s("loader__part","three")}),(0,e.jsx)("span",{className:$s("loader__part","four")})]})})]})})},Mc=()=>{const t=Zn();let n=null;return(0,e.jsx)(e.Fragment,{children:t.map((t=>{const{type:r,payload:o}=t;let i=!1;if("participant"!==r&&"service_data"!==r){const{participant:e,fromClient:r}=o,s=r?"seamly-client-participant":e;"info"!==t.type&&n!==s&&(i=!0),n=s}return(0,e.jsx)(Pc,{event:t,newParticipant:i},t.payload.key||t.payload.id)}))})},Dc=()=>{const{t}=Zi(),n=Qn(),r=((e,t=20)=>{const[n,r]=(0,Pi.useState)(e),o=(0,Pi.useRef)(null);return(0,Pi.useEffect)((()=>(o.current=setTimeout((()=>r(e)),t),()=>{clearTimeout(o.current)})),[e,t]),n})(n,n?0:20),{isOpen:o}=Qi(),i=tr(),s=Cs();return(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)("a",{className:$s("skip-link"),href:`#${i}`,onClick:e=>{e.preventDefault(),s()},children:t("skiplinkText")}),(0,e.jsx)("div",{className:$s("chat__body"),children:(0,e.jsxs)("div",{className:$s("conversation__container"),children:[(0,e.jsx)(yc,{}),(0,e.jsxs)("ol",{className:$s("conversation"),children:[(0,e.jsx)(Qa,{children:(0,e.jsx)(Mc,{})}),r?(0,e.jsx)(Lc,{}):null,(0,e.jsx)(Ac,{})]})]})})]})};function Fc(e,t){const n=(0,Pi.useRef)(null),r=(0,Pi.useRef)(e);return(0,Pi.useEffect)((()=>{r.current=e}),[e]),(0,Pi.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout(r.current,t),()=>clearTimeout(n.current))),[t]),n}function Uc(e){return"object"==typeof e}const Bc={visible:$s("transition--visible"),in:$s("transition--in"),visuallyHidden:$s("visually-hidden")},zc=Object.values(Bc),$c={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},Hc=({children:t,isActive:n,timeout:r=300,transitionStartState:o=$c.notRendered,onInTransitionComplete:s=(()=>{}),onOutTransitionComplete:a=(()=>{}),exitAfter:c,enterDelay:l=0})=>{const u=(0,Pi.useRef)(!1),d=o===$c.visuallyHidden,[p,h]=(0,Pi.useState)((()=>d?[Bc.visuallyHidden]:[])),[f,m]=(0,Pi.useState)((()=>0===l)),v=(0,Pi.useMemo)((()=>c?c+l:c),[l,c]);Fc((()=>m(!1)),n?v:void 0),Fc((()=>m(!0)),n?l:void 0);const y=(0,Pi.useMemo)((()=>f&&n),[n,f]),g=Ls(s),b=Ls(a),x="notRendered"!==o||p.length>0;return(0,Pi.useEffect)((()=>{let e=null,t=null;return u.current&&!y&&(h([Bc.visible]),e=setTimeout((()=>{h([...d?[Bc.visuallyHidden]:[]]),b&&(t=requestAnimationFrame((()=>{b()})))}),r)),!u.current&&y&&(h([Bc.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{h([Bc.visible,Bc.in]),g&&(e=setTimeout((()=>{g()}),r))}))}))),u.current=y,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[d,g,b,r,y]),(0,e.jsx)(e.Fragment,{children:x&&(0,i.toChildArray)(t).filter(Uc).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!zc.includes(e)));return(0,i.cloneElement)(e,{className:[...n,...p].join(" ")})}))})},Vc=({isAside:t=!1})=>{const{isInline:n}=sr(),{t:r}=Zi(),{sendAction:o,addMessageBubble:i}=as(),{isOpen:s,setVisibility:a}=Qi(),{showSuggestions:c}=qn(),l=Ps(),u=Cs(),d=(0,Pi.useRef)(null),{sendPolite:p}=ls(),h=Dn(ds),{hasCountdown:f,endCountdown:m}=Is(),{hasPrompt:v,continueChat:y}=Rs(),g=ts(),b=("suggestion",Jn().serviceData.suggestion);const{body:x}=Fs({payload:b}),w=(0,Pi.useMemo)((()=>b&&!h?x:[]),[b,h,x]),C=(0,Pi.useRef)(null),_=(0,Pi.useRef)(!1),j=(0,Pi.useRef)([]),E=!!w.length,S=n?(g||s)&&!t:g,T=(0,Pi.useRef)(S),k=E&&!S&&c,N=E?w:j.current;j.current=N;const A=(0,Pi.useMemo)((()=>{const e=["suggestions"];return t&&e.push("suggestions--aside"),$s(e)}),[t]),I=(0,Pi.useCallback)((({id:e,question:t})=>{f&&m(!0),v&&y(),o({type:gr,originMessage:b.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),i(t),s||a(Cn.open),u()}),[i,y,m,u,f,v,b,o,a,s]);(0,Pi.useEffect)((()=>{if(C.current!==w&&!S){if(E){const e=_.current?r("suggestions.srUpdatedText"):r("suggestions.srAvailableText");setTimeout((()=>{p(e)}),30)}else _.current&&p(r("suggestions.srUnavailableText"));C.current=w}!T.current&&S?(O(d.current,u),p(r("suggestions.srUnavailableText"))):!E&&_.current&&O(d.current,u),_.current=E,T.current=S}),[w,E,S,u,p,r]);const R=r("suggestions.headingText"),P=r("suggestions.footerText"),L=R?"section":"div";return(0,e.jsx)(Hc,{isActive:k,transitionStartState:$c.notRendered,children:(0,e.jsxs)(L,{className:A,"aria-labelledby":R?l:null,ref:d,children:[R&&(0,e.jsx)("p",{id:l,className:$s("suggestions__heading"),children:R}),!!N.length&&(0,e.jsx)(sa,{suggestions:N,onClickSuggestion:I}),P&&!s&&(0,e.jsx)("p",{className:$s("suggestions__footer"),children:P})]})})},Wc=(0,ys.forwardRef)((({children:t,className:n=""},r)=>{const{isOpen:o,isVisible:i,setVisibility:s}=Qi(),{namespace:a,layoutMode:c}=qn(),{isInline:l}=sr(),u=_s(),d=ts(),{t:p}=Zi(),h=["chat",`chat--layout-${c}`,`namespace--${a}`,...u,n];return o||"app"===c||h.push("chat--collapsed"),d&&h.push("chat--user-responded"),i&&(0,e.jsxs)("section",{className:$s(h),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&o&&s(Cn.minimized)},tabIndex:"-1",ref:r,"aria-label":p("chat.srLabel"),children:[(0,e.jsx)("div",{className:$s("chat-wrapper"),children:t}),"inline"===c&&o&&(0,e.jsx)(Vc,{isAside:!0})]})})),qc=Wc,Gc=({children:t,handleClose:n,title:r,closeButtonText:o,srCloseButtonText:i,id:s})=>{const a=Ps();return(0,e.jsxs)("section",{tabIndex:-1,id:s,"aria-labelledby":r?a:void 0,className:$s("chat-status",!r&&"chat-status--condensed"),children:[(0,e.jsxs)("div",{className:$s("chat-status__body"),children:[r?(0,e.jsx)("h2",{className:$s("chat-status__title"),id:a,children:r}):null,t]}),"function"==typeof n&&(0,e.jsxs)("button",{type:"button",onClick:n,className:$s("button","button--tertiary","chat-status__close"),children:[o||(0,e.jsx)(Ks,{name:"close",size:"16",alt:""}),i&&(0,e.jsx)("span",{className:$s("visually-hidden"),children:i})]})]})},Kc=({handleClick:t,icon:n,title:r,srButtonText:o})=>(0,e.jsxs)("button",{type:"button",onClick:t,className:$s("button","button--primary","chat-status__button"),children:[(0,e.jsx)(Ks,{name:n,size:"16",alt:""}),r,o&&(0,e.jsx)("span",{className:$s("visually-hidden"),children:o})]});function Jc(){const{showProposal:t,translationProposal:n,dismissTranslationProposal:r,activateTranslationProposal:o}=zs(),{id:i}=Us();return t?(0,e.jsx)(Gc,{handleClose:r,srCloseButtonText:n.srDismissButtonText,id:i,title:n.titleLabel,children:(0,e.jsx)(Kc,{handleClick:o,icon:"newTranslation",title:n.buttonLabel})}):null}function Xc(){const t=Dn(ds),{isActive:n}=Ds();return t||n?null:(0,e.jsx)(Jc,{})}const Yc=({label:t,checked:n,description:r,onChange:o,id:i,itemClassName:s})=>(0,e.jsxs)("li",{className:$s([s,"translation-options__item"]),"aria-selected":n,role:"option",tabIndex:0,onClick:o,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),o())},id:i,children:[(0,e.jsx)(Ks,{name:"check",size:"16",alt:""}),t," ",r&&(0,e.jsxs)("span",{children:["(",r,")"]})]}),Zc=({onChange:t,describedById:n})=>{const{context:{contentLocale:r}}=qn(),{t:o}=Zi(),{languages:i,currentLocale:s,enableTranslations:a,disableTranslations:c}=Ds(),l=Cs(),u=e=>()=>{e===s||r===e?c():a(e),t(),l()},{primaryLanguages:d,remainingLanguages:p}=(0,ys.useMemo)((()=>i.reduce(((e,t)=>{const n=t.locale===r,o=((e,t,n)=>t===e.locale||!t&&n)(t,s,n);t.locale!==r&&e.remainingLanguages.push(Object.assign(Object.assign({},t),{checked:o,isOriginal:n}));const i=e.remainingLanguages.findIndex((e=>e.locale===s));return(n||o&&i>4)&&e.primaryLanguages.push(Object.assign(Object.assign({},t),{checked:o,isOriginal:n})),e}),{primaryLanguages:[],remainingLanguages:[]})),[s,r,i]);return(0,e.jsxs)("ul",{"aria-describedby":n,role:"listbox",tabIndex:-1,className:$s("translation-options"),children:[d.map((({locale:t,nativeName:n,checked:r,isOriginal:i},s)=>(0,e.jsx)(Yc,{id:t,label:n,checked:r,description:i&&o("translations.settings.original"),onChange:u(t),itemClassName:$s({"translation-options__item--original":i,"translation-options__item--selected":r&&0!==s})},t))),p.map((({locale:t,nativeName:n,checked:r,isOriginal:i})=>(0,e.jsx)(Yc,{id:t,label:n,checked:r,description:i&&o("translations.settings.original"),onChange:u(t)},t)))]})},Qc=({className:t,children:n,onCancel:r,headingText:o,description:i,descriptionId:s,cancelButtonText:a,cancelButtonRef:c,disableButtonFocusing:l,position:u={horizontal:"left",vertical:"top"}})=>{const d=Ps(),{hideOption:p}=Os(),{focusButton:h}=ks(),f=(0,Pi.useCallback)((()=>{p(),l||h()}),[l,h,p]),m=(0,Pi.useCallback)((()=>{r&&r(),f()}),[f,r]),v=(e=>{const t=(0,Pi.useRef)(null);return(0,Pi.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})(m);return(0,Pi.useEffect)((()=>{T(v.current)}),[v]),(0,e.jsx)("section",{className:$s("options",{"options--right":"right"===u.horizontal,"options--left":"left"===u.horizontal,"options--top":"top"===u.vertical,"options--bottom":"bottom"===u.vertical},t),"aria-labelledby":d,tabIndex:-1,ref:v,children:(0,e.jsxs)("div",{className:$s("options__body"),children:[(0,e.jsx)("h2",{id:d,className:$s("options__title"),children:o}),(0,e.jsxs)("button",{type:"button",onClick:m,"aria-describedby":d,className:$s("button","options__close"),ref:e=>{c&&(c.current=e)},children:[(0,e.jsx)(Ks,{name:"close",size:"16",alt:""}),(0,e.jsx)("span",{children:a})]}),i?(0,e.jsx)("p",{className:$s("options__description"),id:s,children:i}):null,(0,e.jsx)("div",{className:$s("options__wrapper"),children:n})]})})},el=function({onClose:t,position:n}){const{t:r}=Zi(),o=Ps();return(0,e.jsx)(Qc,{onCancel:t,headingText:r("translations.menu.title"),cancelButtonText:r("translations.settings.cancelButtonText"),description:r("translations.menu.description"),descriptionId:o,position:n,disableButtonFocusing:!0,children:(0,e.jsx)(Zc,{describedById:o,onChange:t})})};function tl({children:t,position:n={horizontal:"left",vertical:"top"},classNames:r}){const[o,i]=(0,Pi.useState)(!1),s=(0,Pi.useRef)(null),a=Ps();return(0,e.jsxs)("div",{className:$s("translations__container"),onKeyDown:e=>{o&&S(e)===E.Escape&&(i(!1),T(s.current))},children:[(0,e.jsx)(Hc,{transitionStartState:$c.notRendered,isActive:o,children:(0,e.jsx)("div",{className:$s("options__dialog"),role:"dialog",children:(0,e.jsx)(el,{onClose:()=>{i(!1)},position:n})})}),(0,e.jsx)("button",{type:"button",className:$s(["button","chat__options__button",...r]),id:a,onClick:()=>{i(!o)},onKeyDown:e=>{S(e)===E.ArrowDown&&(i(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":o,children:t})]})}var nl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function rl(t){var{children:n,formId:r,persistData:o,onError:i,onSubmit:s,validationSchema:a}=t,c=nl(t,["children","formId","persistData","onError","onSubmit","validationSchema"]);const l=Wn(),u=Dn((e=>xc(e,{formId:r}))),[d,p]=(0,Pi.useState)(!1),[h,f]=(0,Pi.useState)({}),{isValid:m,errors:v}=function(e,t){const n=(0,Pi.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{var o;const i=Array.isArray(r)?r:[r];for(let r=0;null!==(o=r<(null==i?void 0:i.length))&&void 0!==o&&o;r++)if(!i[r].fn(e[n],i[r].compareValue)){t[n]=i[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(u,a),y=(0,Pi.useMemo)((()=>Object.assign(Object.assign({},v),h)),[v,h]);(0,Pi.useLayoutEffect)((()=>{l(Zr({formId:r,persistData:o}))}),[r,o,l]),(0,Pi.useEffect)((()=>()=>{l(Qr({formId:r}))}),[r,o,l]);const g=(0,Pi.useCallback)(((e,t)=>{l(no({formId:r,name:e,value:t}))}),[r,l]),b=(0,Pi.useCallback)(((e,t)=>{l(ro({formId:r,name:e,touched:t}))}),[l,r]),x=(0,Pi.useCallback)(((e,t)=>{f((n=>Object.assign(Object.assign({},n),{[e]:t})))}),[f]),w=(0,Pi.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");p(!t),!t&&m&&(l(Hr(!0)),s(u,{updateControlValue:g,setError:x}))}),[m,l,s,u,g,x]);(0,Pi.useEffect)((()=>{i&&i({errors:y,isSubmitted:d,isValid:0===Object.keys(y).length})}),[d,y,i]);const C=(0,Pi.useMemo)((()=>({formId:r,values:u,errors:y,isValid:0===Object.keys(y).length,isSubmitted:d,handleSubmit:w,validationSchema:a,updateControlValue:g,updateControlTouched:b})),[r,u,y,d,w,a,g,b]);return r?s?(0,e.jsx)(Ec,Object.assign({},c,{value:C,children:n})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}const ol=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),il=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},sl=e=>!!e?.length>0,al=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))},cl=e=>!!e,ll=function({className:t,disableValidationClasses:n,...r}){const{handleSubmit:o,isValid:i,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Tc();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),a=["form"];return!n&&s&&(a.push("form--submitted"),i?a.push("form--valid"):a.push("form--invalid")),(0,e.jsx)("form",{onSubmit:o,className:$s([...a,t]),...r})};function ul({id:t,error:n}){const[r,o]=(0,Pi.useState)(!1);return(0,Pi.useEffect)((()=>{const e=setTimeout((()=>o(!0)),300);return()=>clearTimeout(e)}),[]),(0,e.jsx)("div",{className:$s("error"),"aria-live":"assertive","aria-atomic":"true",children:r&&n&&(0,e.jsxs)("span",{id:t,className:$s("error__message"),children:[(0,e.jsx)(Ks,{name:"error",size:"16",alt:""}),n]})})}const dl=({contentHint:t,id:n,labelText:r,labelClass:o,validity:i,errorText:s,children:a})=>(0,e.jsxs)(e.Fragment,{children:[t&&(0,e.jsx)("span",{id:`${n}-content-hint`,className:$s("input__content-hint"),children:t}),(0,e.jsx)(ul,{id:`${n}-error`,error:!i&&s}),(0,e.jsxs)("div",{className:$s("form-control__wrapper"),children:[(0,e.jsx)("label",{htmlFor:n,className:$s(o),children:r}),a]})]});const pl=function(t){var{id:n,name:r,type:o,labelText:i,labelClass:s,contentHint:a=null,"aria-describedby":c}=t,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["id","name","type","labelText","labelClass","contentHint","aria-describedby"]);const{isSubmitted:u}=Tc(),[d,{error:p}]=Oc(r),h=u&&p,f=[];return c&&f.push(c),a&&f.push(`${n}-content-hint`),h&&f.push(`${n}-error`),(0,e.jsx)(dl,{id:n,contentHint:a,validity:!h,errorText:p,labelText:i,labelClass:s,children:(0,e.jsx)("input",Object.assign({id:n,name:r,type:o,"aria-invalid":h?"true":"false","aria-describedby":f.join(" ")||null},d,l))})};function hl({controlName:t,describedById:n}){const{t:r}=Zi();return(0,e.jsxs)(ll,{noValidate:"true",className:$s("options__form"),children:[(0,e.jsx)(pl,{name:t,type:"email",className:$s("transcript__input"),"aria-describedby":n,labelClass:$s("label"),labelText:r("options.sendTranscript.label")}),(0,e.jsx)("div",{className:$s("options__actions"),children:(0,e.jsx)("button",{type:"submit",className:$s("button","button--primary","options__submit"),children:r("options.sendTranscript.sendButtonText")})})]})}const fl="email",ml={sendTranscript:()=>{const[t,n]=(0,Pi.useState)(void 0),{hideOption:r}=Os(),{focusButton:o}=ks(),{t:i}=Zi(),s=Ps(),{sendAction:a}=as(),c=(0,Pi.useMemo)((()=>({[fl]:[ol(cl,i("options.sendTranscript.noEmailText")),ol(al,i("options.sendTranscript.invalidEmailText"))]})),[i]),l=(0,Pi.useCallback)((e=>{const t=e[fl].trim();a({type:"send_transcript",body:{emailAddress:t}}),r(),o()}),[a,r,o]),u=(0,Pi.useCallback)((({isValid:e,isSubmitted:t})=>{n(t&&!e?"options--error":void 0)}),[n]);return(0,e.jsx)(Qc,{className:t,headingText:i("options.sendTranscript.title"),cancelButtonText:i("options.cancelButtonText"),description:i("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,e.jsx)(rl,{formId:"sendTranscript",onSubmit:l,validationSchema:c,onError:u,children:(0,e.jsx)(hl,{controlName:fl,describedById:s})})})}},vl=()=>{const{optionActive:t}=Os(),n=(0,Pi.useRef)(null),r=ml[t||n.current];return t&&(n.current=t),r?(0,e.jsx)(r,{}):null},yl=()=>{const{t}=Zi(),{menuOptions:n,showOption:r,panelActive:o,hideOption:s}=Os(),{id:a}=ks(),c=(0,Pi.useRef)(null),[l,u]=(0,Pi.useState)(!1),d=(0,Pi.useRef)(null),p=n.length,h=(0,Pi.useRef)(Array.from({length:p},(()=>(0,i.createRef)()))),f=(0,Pi.useRef)(!1),m=p>1,v=n[0],y=(0,Pi.useMemo)((()=>v?.name?.trim().replace(/\s+/g,"")),[v]);return(0,Pi.useEffect)((()=>()=>{clearTimeout(c.current)}),[]),(0,Pi.useEffect)((()=>{l&&!f.current&&requestAnimationFrame((async()=>{await bs(60);const e=n.findIndex((e=>e.available)),t=-1===e?0:e;T(h.current[t])})),f.current=l}),[l,n]),p?(0,e.jsxs)("div",{className:$s("options__container"),onKeyDown:e=>{l&&(S(e)===E.Escape&&(u(!1),T(d.current)),S(e)===E.Home&&(T(h.current[0]),e.preventDefault()),S(e)===E.End&&(T(h.current[p-1]),e.preventDefault()))},onfocusout:()=>{m&&(c.current=setTimeout((()=>{u(!1)}),200))},onfocusin:()=>{clearTimeout(c.current)},children:[(0,e.jsx)(Hc,{transitionStartState:$c.notRendered,isActive:o,children:(0,e.jsx)("div",{className:$s("options__dialog"),children:(0,e.jsx)(vl,{})})}),m&&(0,e.jsx)(Hc,{isActive:l,transitionStartState:$c.notRendered,children:(0,e.jsx)("ul",{className:$s(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":a,children:n.map((({name:o,title:i,available:s},a)=>(0,e.jsx)("li",{className:$s("options__menu__item"),role:"menuitem","data-testid":o,children:(0,e.jsxs)("button",{type:"button",ref:e=>{h.current[a]=e},className:$s(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(S(e)===E.ArrowDown){const n=Math.min(p-1,t+1);T(h.current[t===n?0:n]),e.preventDefault()}if(S(e)===E.ArrowUp){const n=Math.max(0,t-1);T(h.current[t===n?p-1:n]),e.preventDefault()}})(e,a),onKeyPress:e=>((e,t)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let o=-1;n.forEach(((e,n)=>{n>t&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=n)})),-1!==o&&T(h.current[o])})(e,a),onClick:()=>((e,t)=>{t&&(u(!1),r(e))})(o,s),"aria-disabled":s?null:"true",children:[(0,e.jsxs)("span",{className:$s("button__text"),children:[i,!s&&" "]}),!s&&(0,e.jsx)("span",{className:$s("button__state"),children:t("options.unavailableText")})]})},o)))})}),(0,e.jsxs)("button",{type:"button",className:$s(["button","button--secondary","chat__options__button",...!m&&y?[`chat__options__button--${y}`]:[]]),id:a,onClick:()=>{o&&s(),m?u((e=>!e)):v.available&&!o&&r(v.name)},onKeyDown:m?e=>{S(e)===E.ArrowDown&&(u(!0),e.preventDefault())}:null,ref:d,"aria-haspopup":m?"menu":null,"aria-expanded":m?l.toString():null,"aria-disabled":m||v.available?null:"true",children:[m&&(0,e.jsx)(Ks,{name:"options",size:"32",alt:""}),(0,e.jsx)("span",{className:$s("button__text"),children:m?t("options.openButtonText"):`${v.title}${v.available?"":" "}`}),!m&&!v.available&&(0,e.jsx)("span",{className:$s("button__state"),children:t("options.unavailableText")})]})]}):null};function gl(){const{menuOptions:t,allowOptionSelection:n}=Os(),{isAvailable:r}=Ds(),o=Dn(ds),{t:i,locale:s}=Zi(),a=Bs(s);if(!r&&(!n||!t.length)||o)return null;const c=i("translations.settings.openButtonText",{hasLanguage:!!a,language:a});return(0,e.jsxs)("div",{className:$s("chat__options"),children:[r&&(0,e.jsx)("div",{className:$s("chat__options-item","chat__options-item--left"),children:(0,e.jsxs)(tl,{classNames:["button--secondary"],children:[(0,e.jsx)(Ks,{alt:c,name:"newTranslation",size:"16"}),(0,e.jsx)("span",{className:$s("button__text"),children:c})]})}),n&&(0,e.jsx)("div",{className:$s("chat__options-item","chat__options-item--right"),children:(0,e.jsx)(yl,{})})]})}const bl=()=>{const{scrollToRef:t,unreadIds:n}=(0,Pi.useContext)(Ic),{isMinimized:r}=Qi(),{t:o}=Zi();return(0,e.jsx)(Hc,{isActive:!!n.length&&!r,children:(0,e.jsx)("div",{className:$s("unread-messages"),children:(0,e.jsxs)("button",{type:"button",className:$s("button","button--primary"),onClick:t,children:[o("message.unreadMessagesCount",{unreadCount:n.length}),(0,e.jsx)(Ks,{name:"chevronDown",size:"32",alt:""})]})})})};const xl=e=>{const t=(0,Pi.useRef)(),[n,r]=(0,Pi.useState)(!0),o=Dn(mc),i=Zn(),s=Qn(),{isOpen:a}=Qi(),c=Jn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=Dn((({state:e})=>e));(0,Pi.useEffect)((()=>{const e=t.current,n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,i=Math.abs(t-n-o)>10;r(!i)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,Pi.useCallback)((()=>{requestAnimationFrame((()=>{return e=void 0,n=void 0,o=function*(){var e,n;yield bs(30),null===(e=t.current)||void 0===e||e.scrollTo({top:null===(n=t.current)||void 0===n?void 0:n.scrollHeight,left:0,behavior:"auto"})},new((r=void 0)||(r=Promise))((function(t,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,a)}c((o=o.apply(e,n||[])).next())}));var e,n,r,o}))}),[]);return(0,Pi.useEffect)((()=>{u&&d()}),[u,d]),(0,Pi.useEffect)((()=>{n&&d()}),[n,o,i,s,a,c,l,d]),{containerRef:t,unreadIds:o,scrollToRef:()=>{var n,r;const i=null===(n=e[null==o?void 0:o.at(0)])||void 0===n?void 0:n.current;null===(r=t.current)||void 0===r||r.scrollTo({top:null==i?void 0:i.offsetTop,behavior:"auto",left:0})},scrollToBottom:d}},wl=({children:t})=>{const n=Zn(),r=(0,Pi.useMemo)((()=>n.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,i.createRef)(),e):e),{})),[n]),{scrollToRef:o,scrollToBottom:s,containerRef:a,unreadIds:c}=xl(r);return(0,e.jsx)(Ic.Provider,{value:{eventRefs:r,unreadIds:c,scrollToRef:o,scrollToBottom:s,containerRef:a},children:(0,e.jsxs)("div",{className:$s("chat__container"),children:[(0,e.jsx)("div",{className:$s("chat__container__scroll-area"),ref:a,children:t}),(0,e.jsx)(bl,{})]})})},Cl=({baseClassName:t,children:n,title:r})=>{const o=tr(),i=Ps();return(0,e.jsxs)("section",{id:o,className:$s(t),"aria-describedby":i,tabIndex:"-1",children:[(0,e.jsx)("h2",{className:$s(`${t}__title`),id:i,children:r}),n]})},_l=()=>{const{t}=Zi(),n=Cs(),r=As(),{emitEvent:o}=as(),{isActive:i,remaining:s,timer:a,endCountdown:c}=Is(),l=s>0,u=t(l?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,e.jsx)(Cl,{baseClassName:"idle",title:u,children:l&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:$s("idle__count-container"),children:i&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:$s("idle__count-text"),children:t("idleDetachWarning.countdownText")}),(0,e.jsx)("span",{className:$s("idle__count-timer"),children:t("idleDetachWarning.countdownTimer",a)})]})}),(0,e.jsxs)("div",{className:$s("idle__options"),children:[(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{r(),c(!0),n(),o("idleTimer.selectContinue")},children:t("idleDetachWarning.continueButton")}),(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{c(),n(),o("idleTimer.selectEnd")},children:t("idleDetachWarning.detachButton")})]})]})})},jl=()=>{const{t}=Zi(),n=As(),{name:r}=or()||{},{continueChat:o,restartChat:i}=Rs();return(0,e.jsx)(Cl,{baseClassName:"prompt",title:t("resumeConversationPrompt.title",{name:r}),children:(0,e.jsxs)("div",{className:$s("prompt__options"),children:[(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{n(),o()},children:t("resumeConversationPrompt.continueButton")}),(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:i,children:t("resumeConversationPrompt.detachButton")})]})})},El=()=>{const{sendAction:e}=as(),{features:t}=Os(),{typingPeekahead:n}=t||{},r=(0,Pi.useRef)(null),o=(0,Pi.useRef)(null),i=(0,Pi.useRef)(!1),s=(0,Pi.useRef)(null);(0,Pi.useEffect)((()=>()=>{clearInterval(s.current),clearTimeout(r.current),clearTimeout(o.current)}),[]);const a=(t,r)=>{e({type:br,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(i.current=!0,s.current||(a(!0,e.target.value),s.current=setInterval((()=>{i.current?n&&n.enabled&&a(!0,e.target.value):(clearInterval(s.current),s.current=null)}),2e3)),clearTimeout(r.current),clearTimeout(o.current),r.current=setTimeout((()=>{i.current=!1}),300),o.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}},Sl=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=Jn().entryMeta,i=Wn(),s=n||t||e,a=o[s]||r[s]||{},c=(0,Pi.useCallback)((e=>{i(Bo(e))}),[i]),l=(0,Pi.useCallback)((e=>{i(Fo(e))}),[i]),u=(0,Pi.useCallback)((e=>{i(si(e))}),[i]),d=(0,Pi.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:s,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Tl({controlName:t,skipLinkId:n}){const{t:r}=Zi(),{sendAssertive:o}=ls(),{emitEvent:i}=as(),s=El(),{setBlockAutoEntrySwitch:a}=Sl(),{placeholder:c,label:l,labelClass:u}=Nc(t),{hasCharacterLimit:d,reachedCharacterWarning:p,reachedCharacterLimit:h,remainingChars:f}=kc(t),[{value:m}]=Oc(t),v=!!m,y=(0,Pi.useCallback)((()=>{p&&o(r("input.srCharacterLimitText",{limit:f})),i("ui.inputFocus")}),[r,o,p,f,i]);return(0,Pi.useLayoutEffect)((()=>(a(v),()=>{a(!1)})),[a,v]),(0,e.jsxs)(ll,{className:$s("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,e.jsxs)("div",{className:$s(["input--text__container",...p&&!h?["character-warning"]:[],...h?["character-exceeded"]:[]]),children:[(0,e.jsx)(pl,{id:n,type:"text",name:t,className:$s("input__text"),autocomplete:"off",placeholder:c,labelText:l,labelClass:$s(u),"aria-invalid":d?h:null,onKeyUp:s,onFocus:y}),(0,e.jsx)("div",{className:$s("character-count"),children:p&&(0,e.jsx)("span",{children:f})})]}),(0,e.jsx)("button",{className:$s("button","input__submit"),type:"submit",onPointerDown:e=>{e.preventDefault()},"aria-disabled":!v||h?"true":null,children:(0,e.jsx)(Ks,{name:"send",size:"32",alt:r("input.sendMessage")})})]})}const Ol="textMessageEntry";function kl({...t}){const{isOpen:n,setVisibility:r}=Qi(),o=tr(),i=Cs(),{sendMessage:s}=as(),a=(0,Pi.useCallback)(((e,{updateControlValue:t})=>{s({body:e[Ol]}),t(Ol,""),i(),n||r(Cn.open)}),[s,i,n,r]);return(0,e.jsx)(rl,{...t,formId:"textEntry",persistData:!0,onSubmit:a,children:(0,e.jsx)(Tl,{controlName:Ol,skipLinkId:o})})}const Nl=()=>{const{t}=Zi(),{currentUploads:n}=Ts();return(0,e.jsx)("div",{className:$s("progress"),children:n.map((({id:n,name:r,progress:o,uploading:i,error:s})=>(0,e.jsxs)("div",{className:$s("progress_container"),children:[(0,e.jsxs)("div",{className:$s("progress__text"),children:[(0,e.jsx)("span",{className:$s("progress__text--file-name"),children:r}),(0,e.jsx)("span",{className:$s("progress__text--percentage"),children:`${o}%`})]}),(0,e.jsx)(ul,{error:s}),(0,e.jsx)("progress",{className:$s("progress__bar"),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-label":t("fileUpload.srProgressLabel",{fileName:r}),max:"100","aria-valuenow":o,value:o,"aria-busy":i,children:`${o}%`})]},n)))})};function Al({id:t,name:n,labelText:r,contentHint:o,outputText:i,accept:s}){const{isSubmitted:a}=Tc(),[c,l]=(0,Pi.useState)(!1),[{onInput:u,onBlur:d},{error:p}]=Oc(n),h=Ps(),f=Ps(),m=Ps(),v=a&&p,y=[m];o&&y.push(f),v&&y.push(h);const g=(0,Pi.useCallback)((()=>{l(!0)}),[l]),b=(0,Pi.useCallback)((()=>{l(!1),d()}),[l,d]),x=(0,Pi.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,e.jsxs)("div",{className:$s("upload__container"),children:[o&&(0,e.jsx)("span",{className:$s("upload__content-hint"),id:f,children:o}),(0,e.jsx)(ul,{id:h,error:v&&p}),(0,e.jsx)("div",{className:$s(["file-upload",...c?["focus-within"]:[]]),children:(0,e.jsxs)("label",{htmlFor:t,className:$s("upload__label"),children:[(0,e.jsx)(Ks,{name:"upload",size:"32",alt:""}),(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:$s(["upload__label--text"]),children:r}),(0,e.jsx)("input",{id:t,className:$s("upload__input"),type:"file",name:n,onChange:x,"aria-invalid":v?"true":"false","aria-describedby":y.join(" "),accept:s||null,onFocus:g,onBlur:b}),(0,e.jsx)("span",{className:$s("upload__output"),"aria-hidden":"true",id:m,children:i})]})]})})]})}function Il({skiplinkId:t,controlName:n,accept:r,contentHint:o,isUploading:i,isComplete:s,onClickCancel:a}){const{t:c}=Zi(),[{value:l}]=Oc(n),u=l&&l.length>0,d=u?l[0].name:"";return(0,e.jsxs)(ll,{className:$s("upload-form"),children:[(0,e.jsx)(Al,{name:n,id:t,accept:r,labelText:c("fileUpload.labelText"),outputText:c("fileUpload.selectedText",{hasFile:u,filename:d}),contentHint:o}),(0,e.jsxs)("div",{className:$s("upload__button-container"),children:[(0,e.jsx)("button",{id:i||!s?t:void 0,type:"button",onClick:a,className:$s("button","button--secondary","upload__cancel"),children:c("fileUpload.cancelButtonText")}),(0,e.jsx)("button",{className:$s("button","button--primary"),type:"submit",children:c("fileUpload.uploadButtonText")})]})]})}const Rl="fileListForm",Pl="fileList",Ll=()=>{const{t}=Zi(),{sendPolite:n,sendAssertive:r}=ls(),o=tr(),i=Cs(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:c}=Ss(),l=(0,Pi.useRef)(null),u=(0,Pi.useRef)(s),{cancelEntrySelection:d}=Sl(),{uploadFile:p,clearUploads:h,isUploading:f,isComplete:m}=Ts(),{hasFile:v,selectedFileName:y,uploadHandle:g,hasServerError:b,progress:x}=((e,t)=>{const n=Dn((n=>wc(n,{formId:e,name:t}))),{currentUploads:r}=Ts(),o=n&&n.length>0;let i=null,s=!1,a=0;if(r&&r.length>0){const e=r[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(Rl,Pl),w=Ps(),C=(0,Pi.useRef)(!0),j=t("fileUpload.contentHint",{size:_(c)}),E=(0,Pi.useRef)(""),S=(0,Pi.useRef)(null);(0,Pi.useEffect)((()=>{E.current&&S.current?.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&r(j),E.current=j}),[j,r]),(0,Pi.useEffect)((()=>{x>0&&n(1===x?t("fileUpload.srStartedText"):`${x}%`)}),[x,n,t]),(0,Pi.useEffect)((()=>{C.current||f||!m||(h(),d(),i(),setTimeout((()=>{n(t("fileUpload.srCompleteText"))}),300)),C.current=m}),[f,m,h,d,i,n,t]);const T=(0,Pi.useCallback)((({fileList:e})=>{p(e[0]),i()}),[p,!1,i]),O=(0,Pi.useCallback)((()=>{g&&g.abort(),h(),d(),i()}),[g,h,d,i]),k=(0,Pi.useMemo)((()=>({[Pl]:[ol((()=>s),t("fileUpload.errors.unavailable")),ol(sl,t("fileUpload.errors.noFile")),ol(il,t("fileUpload.errors.tooLarge"),c)]})),[c,s,t]);return(0,e.jsx)("div",{className:$s(["upload",...b?["upload--error"]:[]]),ref:S,children:(0,e.jsxs)(rl,{formId:Rl,persistData:!0,onSubmit:T,validationSchema:k,children:[(f||!m)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Nl,{}),(0,e.jsx)("div",{className:$s("upload__button-container"),children:(0,e.jsx)("button",{id:f||!m?o:void 0,type:"button",onClick:O,ref:l,className:$s("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]}),!f&&m&&(0,e.jsx)(Il,{controlName:Pl,skiplinkId:o,accept:a.join(", "),contentHint:j,isComplete:m,isUploading:f,outputText:t("fileUpload.selectedText",{hasFile:v,filename:y}),onClickCancel:O}),!u.current&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:$s("notification"),id:w,children:t("fileUpload.unavailableText")}),(0,e.jsx)("div",{className:$s("upload__button-container"),children:(0,e.jsx)("button",{id:f||!m?o:void 0,type:"button",onClick:O,className:$s("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]})]})})},Ml=()=>{const{t}=Zi(),{showFileUpload:n,serviceAllowsUploads:r}=Ss(),[o,i]=(0,Pi.useState)(r),s=Cs(),a=(0,Pi.useRef)(null),{setUserEntryType:c,activeEntry:l}=Sl(),u=(0,Pi.useRef)(null),{sendPolite:d}=ls(),p=!!or();return(0,Pi.useEffect)((()=>{O(u.current,(()=>{r||s()})),i(r)}),[r,s]),(0,Pi.useEffect)((()=>{a.current&&!r&&d(t("fileUpload.srUnavailableText")),!1===a.current&&r&&d(t("fileUpload.srAvailableText")),p&&(a.current=r)}),[r,p,d,t]),!n&&l!==mr&&(0,e.jsx)(Hc,{isActive:o,transitionStartState:$c.rendered,children:(0,e.jsx)("div",{className:$s("upload-toggle-wrapper"),children:(0,e.jsx)(Hc,{isActive:o,transitionStartState:$c.visuallyHidden,children:(0,e.jsx)("button",{className:$s(["button","button--secondary","upload-toggle"]),ref:u,"aria-disabled":o?null:"true",type:"button",onClick:o?()=>{c(mr),s()}:null,children:(0,e.jsx)(Ks,{name:"file",size:"32",alt:t("fileUpload.toggleButtonText")})})})})})},Dl=()=>{const{isOpen:t}=Qi(),n=(0,Pi.useRef)(null),{hasCountdown:r}=Is(),[o,i]=(0,Pi.useState)(r),{hasPrompt:s}=Rs(),[a,c]=(0,Pi.useState)(s),l=Cs(),u=(0,Pi.useRef)(!1),{activeEntry:d}=Sl(),[p,h]=(0,Pi.useState)({text:kl,upload:Ll}),[f,m]=(0,Pi.useState)((()=>d)),v=qn(),{accountAllowsUploads:y}=Ss(),g=(0,Pi.useCallback)((()=>{O(n.current,l)}),[l]);(0,Pi.useEffect)((()=>{const{customComponents:e}=v,{entry:t}=e||{};t&&h((e=>({...e,...t})))}),[v]),(0,Pi.useEffect)((()=>{g(),i(r),c(s)}),[r,s,g]),(0,Pi.useEffect)((()=>{m(d),g()}),[d,g,n]),u.current=!(!n.current||!n.current.contains(document.activeElement));const b=p[f];return(0,e.jsxs)("div",{className:$s("chat__entry"),ref:n,children:[o&&(0,e.jsx)(_l,{}),a&&(0,e.jsx)(jl,{}),(0,e.jsxs)("div",{className:$s(["entry__body",...r||s?["entry__body--hidden"]:[]]),children:[f!==mr&&y&&t&&(0,e.jsx)(Ml,{}),(0,e.jsx)(b,{})]})]})},Fl=()=>{const{t}=Zi(),{isOpen:n,closeChat:r}=Qi(),{isWindow:o}=sr();return n&&o?(0,e.jsx)("button",{type:"button",className:$s("button","collapse-button"),onClick:r,children:(0,e.jsx)(Ks,{name:"chevronDown",size:"32",alt:t("window.srCollapseButton")})}):null},Ul=()=>{const{meta:{originalError:t,title:n,message:r,buttonText:o,action:i,srText:s}}=ps(),a=as(),c=Ps(),{sendPolite:l}=ls(),u=Cs(),d="SeamlySessionExpiredError"===t?.name;return(0,Pi.useEffect)((()=>{!d&&s&&setTimeout((()=>{l(s)}),200)}),[l,s,d]),d?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)("section",{className:$s("interrupt"),"aria-labelledby":c,children:[(0,e.jsx)(Fl,{}),(0,e.jsxs)("div",{className:$s("interrupt__body"),children:[(0,e.jsx)("h2",{id:c,className:$s("interrupt__title"),children:n}),(0,e.jsx)("p",{className:$s("interrupt__message"),children:r}),o&&i&&(0,e.jsx)("div",{className:$s("interrupt__actions"),children:(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{a[i]&&a[i](),u()},children:o})})]})]})},Bl=function({children:t}){const n=Dn(ds),{isOpen:r}=Qi();return n?(0,e.jsx)(Ul,{}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(wl,{children:[(0,e.jsxs)("div",{className:$s("chat__container__header"),children:[(0,e.jsx)(Xc,{}),(0,e.jsx)(Fl,{})]}),t]}),(0,e.jsx)(Dl,{}),r&&(0,e.jsx)(gl,{})]})};function zl({event:t}){const[n]=Rc(t);return(0,e.jsx)("li",{children:(0,e.jsx)(n,{event:t})})}function $l({events:t}){return(0,e.jsx)("ul",{className:$s("collapsed-chat-messages"),children:t.map((t=>(0,e.jsx)(zl,{event:t},t.payload.id)))})}function Hl(){const{preChatEvents:t}=qn(),n=Dn(ds),{isOpen:r}=Qi();return!(n||!(null==t?void 0:t.length)||r)&&(0,e.jsx)($l,{events:t})}function Vl(){const{t}=Zi(),n=t("window.chat.continue"),r=(0,Pi.useMemo)((()=>({type:"message",payload:{body:{text:n}}})),[n]);return(0,e.jsx)($l,{events:[r]})}const Wl=()=>{const t=Gn(),n=or(),r=Dn(ds),o=n&&!r,i=o?n.avatar:t;return i?(0,e.jsx)("img",{className:$s(o?"avatar":"icon"),src:i,alt:""}):(0,e.jsx)(Ks,{name:"avatar",size:"32",alt:""})},ql=({onClick:t})=>{const n=ss(),{t:r}=Zi(),o=n()?r("window.openButton.srContinue"):r("window.openButton.srStart"),i=Cs(),{isOpen:s}=Qi(),a=er(),c=(0,Pi.useCallback)((()=>{t(),i()}),[i,t]);return(0,e.jsx)(Hc,{isActive:!s,transitionStartState:$c.rendered,children:(0,e.jsxs)("button",{className:$s("window-open-button"),"aria-label":o,"aria-hidden":s,onClick:c,children:[(0,e.jsx)(Hc,{isActive:!!a,transitionStartState:$c.notRendered,children:(0,e.jsx)("span",{className:$s("message-count"),"aria-hidden":"true",children:a})}),(0,e.jsx)(Wl,{})]})})},Gl=(e,t,n)=>"object"==typeof e?e[t]:n,Kl=n.p+"sounds/beep.mp3";var Jl=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const Xl=!!window.Notification,Yl={app:()=>(0,e.jsx)(qc,{children:(0,e.jsx)(Bl,{children:(0,e.jsx)(Dc,{})})}),inline:()=>{const{showInlineView:t,containerRef:n}=(()=>{const e=Wn(),{connectWhenInView:t}=qn(),n=Dn(cr),{containerRef:r,isVisible:o}=es({enabled:t,freezeOnceVisible:!0});return(0,Pi.useEffect)((()=>{o&&e(ki())}),[e,o]),{containerRef:r,showInlineView:n}})(),{isOpen:r}=Qi();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Hc,{isActive:!r,transitionStartState:$c.rendered,children:(0,e.jsxs)("div",{ref:n,className:$s("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,e.jsx)(Hl,{}),(0,e.jsx)(Vc,{})]})}),(0,e.jsx)(Hc,{isActive:r,transitionStartState:$c.rendered,children:(0,e.jsx)(qc,{ref:n,children:t&&(0,e.jsx)(Bl,{children:r&&(0,e.jsx)(Dc,{})})})})]})},window:()=>{const{isOpen:t,openChat:n}=Qi(),r=ts(),{continueChat:o,preChat:i}=qn();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ql,{onClick:n}),(0,e.jsx)(Hc,{isActive:i&&!t&&!r,exitAfter:Gl(i,"exitAfter"),enterDelay:Gl(i,"enterDelay"),transitionStartState:$c.notRendered,children:(0,e.jsx)("div",{className:$s("unstarted-wrapper","unstarted-wrapper--window"),children:(0,e.jsx)(Hl,{})})}),(0,e.jsx)(Hc,{isActive:o&&!t&&r,exitAfter:Gl(o,"exitAfter"),enterDelay:Gl(o,"enterDelay"),transitionStartState:$c.notRendered,children:(0,e.jsx)("div",{className:$s("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,e.jsx)(Vl,{})})}),(0,e.jsx)(Hc,{isActive:t,transitionStartState:$c.notRendered,children:(0,e.jsx)(qc,{children:(0,e.jsx)(Bl,{children:(0,e.jsx)(Dc,{})})})})]})}},Zl=({children:t})=>{const{sendNotification:n}=(()=>{const{proactiveMessages:e}=nr(),{notificationAudioURL:t}=qn(),[n,r]=(0,Pi.useState)(Xl?Notification.permission:"default"),[o,i]=(0,Pi.useState)(document.visibilityState),s=Dn(vc),a=(0,Pi.useCallback)((()=>Jl(void 0,void 0,void 0,(function*(){if(Xl&&"granted"!==n){const e=yield Notification.requestPermission();r(e)}}))),[n]),c=(0,Pi.useMemo)((()=>"granted"===n),[n]),l=(0,Pi.useMemo)((()=>"hidden"===o),[o]);(0,Pi.useEffect)((()=>{"default"===n&&e&&a()}),[n,e,a]);const u=(0,Pi.useCallback)(((e,r)=>Jl(void 0,void 0,void 0,(function*(){if(s&&Xl){if("default"===n&&a(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||Kl);yield 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=${Ol}]`);e&&e.focus()}}}}))),[t,n,c,a,s,l]);return(0,Pi.useEffect)((()=>{if(!s)return()=>{};function e(){i(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[s]),{permission:n,requestPermission:a,sendNotification:u}})(),[,r]=xs(),{namespace:o,layoutMode:i,zIndex:s}=qn(),a=or(),{proactiveMessages:c}=nr(),{isOpen:l,isVisible:u}=Qi(),d=_s(),p=ts(),h=Dn(fc),{body:f}=Fs(h),{userLocale:m}=Zi(),v=(0,Pi.useRef)(void 0),y=(0,Pi.useMemo)((()=>{var e;return f?function(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""}((null==f?void 0:f.text)||(null===(e=null==f?void 0:f.prompt)||void 0===e?void 0:e.text)||f):void 0}),[f]);(0,Pi.useEffect)((()=>{var e;(null==a?void 0:a.name)&&y&&c&&h&&v.current!==(null===(e=h.payload)||void 0===e?void 0:e.id)&&(n(a.name,{body:y,icon:null==a?void 0:a.avatar}),v.current=h.payload.id)}),[null==a?void 0:a.avatar,null==a?void 0:a.name,h,y,c,n]);const g=Yl[i],b=(0,Pi.useCallback)((e=>{"function"==typeof r&&r(e)}),[r]),x=(0,Pi.useMemo)((()=>{if(m&&document.querySelector("html").getAttribute("lang")!==m)return m}),[m]);if(!g)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const w=["app",`app--layout-${i}`,`namespace--${o}`];return"function"!=typeof d&&w.push(...d),l||"app"===i||w.push("app--collapsed"),p&&w.push("app--user-responded"),u&&(0,e.jsx)("div",{className:$s(w),lang:x,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:s},ref:b,children:t||(0,e.jsx)(g,{})})},Ql=t=>(0,e.jsx)(pc,{...t,children:(0,e.jsx)(Zl,{})});var eu=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};class tu{constructor(e,t){const{namespace:n="",parentElement:r}=e,i=eu(e,["namespace","parentElement"]);this.config=Object.assign(Object.assign({},i),{namespace:n}),this.namespace=n,this.parentElement=r,this.externalApi=t,this.api=new Se({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(o()),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)))}render(){return t=this,n=void 0,o=function*(){const t=this.config.customComponents||{},{view:n}=t,r=eu(t,["view"]),o=Object.assign(Object.assign({},this.config),{customComponents:Object.keys(r).length?r:void 0}),s=Ai({api:this.api,eventBus:this.eventBus,config:o,initialState:void 0});s.dispatch(Dr(o)),yield s.dispatch(gn()),yield s.dispatch(Ar()),s.dispatch(dr()),n?(0,i.render)((0,e.jsx)(pc,{eventBus:this.eventBus,store:s,api:this.api,children:(0,e.jsx)(n,{})}),this.parentElement):(0,i.render)((0,e.jsx)(Ql,{config:o,eventBus:this.eventBus,store:s,api:this.api}),this.parentElement)},new((r=void 0)||(r=Promise))((function(e,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,a)}c((o=o.apply(t,n||[])).next())}));var t,n,r,o}destroy(){(0,i.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),delete 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 nu=e=>"object"==typeof e&&"action"in e,ru=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),ou=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(nu).map(ru)).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:i}=t;return this.context.userLocale=o,this.context.contentLocale=i,!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 tu(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||{}}}},iu=()=>{const e=Wn();return{addEvent:t=>e(So(t)),clearEvents:()=>e(Oo()),setHistory:t=>e(qo(t)),setEventsRead:t=>e(zo(t)),setLoadedImageEventIds:t=>e(Jo(t)),ackEvent:t=>e(Eo(t)),setIsLoading:t=>e(Ko(t)),setParticipant:t=>e(Xo(t)),setHeaderTitle:t=>e(Wo(t)),setHeaderSubTitle:t=>e(Vo(t)),resetHistoryLoadedFlag:()=>e(Do()),setActiveService:()=>e(Uo()),initIdleDetachCountdown:t=>e(Po(t)),decrementIdleDetachCountdownCounter:()=>e(Io()),stopIdleDetachCountdownCounter:()=>e(ui()),clearIdleDetachCountdown:()=>e(No()),initResumeConversationPrompt:()=>e(Lo()),clearResumeConversationPrompt:()=>e(Ao()),setServiceDataItem:t=>e(Zo(t)),setFeatures:t=>e(Ho(t)),setFeatureEnabledState:t=>e($o(t)),clearFeatures:()=>e(ko()),setInitialState:t=>e(Go(t)),setUserSelectedOptions:t=>e(ci(t)),setUserSelectedOption:t=>e(ai(t)),showOption:t=>e(li(t)),hideOption:()=>e(Ro()),setServiceEntryMetadata:t=>e(Qo(t)),setBlockAutoEntrySwitch:t=>e(Bo(t)),setActiveEntryType:t=>e(Fo(t)),setUserEntryType:t=>e(si(t)),registerUpload:t=>e(Mo(t)),setUploadProgress:t=>e(ri(t)),setUploadComplete:t=>e(ti(t)),setUploadError:t=>e(ni(t)),clearAllUploads:()=>e(To()),setSeamlyContainerElement:t=>e(Yo(t))}},su=()=>{const{t}=Zi(),{title:n,subTitle:r}=Jn().headerTitles,o=er(),{isOpen:i}=Qi(),s=or(),a=Dn(ds),c=Gn(),l=s?.avatar??c,u=a?"":r,d=["message-count"];return i&&d.push("message-count__hide"),0===o&&d.push("message-count__empty"),(u||!i)&&(0,e.jsxs)("div",{className:$s("agent-info"),children:[(0,e.jsxs)("div",{className:$s("agent-info__graphic"),children:[l?(0,e.jsx)("img",{className:$s(s?.avatar?"avatar":"icon"),src:l,alt:""}):(0,e.jsx)(Ks,{name:"avatar",size:"32",alt:""}),(0,e.jsx)("span",{className:$s(d),"aria-hidden":"true",children:o})]}),(0,e.jsxs)("div",{className:$s("agent-info__body"),children:[(0,e.jsx)("p",{className:$s("agent-info__heading"),children:n??t("header.title")}),(0,e.jsx)("p",{className:$s("agent-info__text"),children:u})]})]})},au=({children:t,onCloseChat:n})=>{const{headerCollapseButtonId:r}=Jn(),o=(0,Pi.useRef)(null),{t:i}=Zi();return(0,e.jsxs)("header",{className:$s("chat__header"),children:[t,(0,e.jsx)("div",{className:$s("header-controls"),children:(0,e.jsx)("button",{type:"button",className:$s("button","header-controls__collapse"),onClick:n,ref:o,id:r,children:(0,e.jsx)(Ks,{name:"chevronDown",size:"32",alt:i("header.collapseApp")})})})]})},cu=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 ou(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
|
|
2
|
+
(()=>{var e={5576:e=>{e.exports=()=>()=>null},1792: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 i=t[r]||n,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(r){for(var o,i=t[r]||n,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],n.slice.call(arguments,1));return e}}},144:(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:()=>C,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>J,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>q,createPortal:()=>S,createRef:()=>r.createRef,default:()=>ce,findDOMNode:()=>Y,flushSync:()=>Q,forwardRef:()=>p,hydrate:()=>P,isElement:()=>ie,isFragment:()=>K,isValidElement:()=>G,lazy:()=>w,memo:()=>l,render:()=>R,startTransition:()=>te,unmountComponentAtNode:()=>X,unstable_batchedUpdates:()=>Z,useDeferredValue:()=>ne,useInsertionEffect:()=>oe,useSyncExternalStore:()=>se,useTransition:()=>re,version:()=>W});var r=n(9150),o=n(8056),i={};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&&(i[e]=()=>o[e]);function s(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){this.props=e}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,i),(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=s({},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,i=t;i=i.__;)if((o=i.__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 v=r.options.unmount;function y(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=s({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return y(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 i(i){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,i)}return i.displayName="Lazy",i.__f=!0,i}function C(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),v&&v(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),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;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(s,s)},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]=y(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return i&&(i.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),i]};var _=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function j(e){return this.getChildContext=function(){return e.context},e.children}function E(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)(j,{context:t.context},e.__v),t.l)}function S(e,t){var n=(0,r.createElement)(E,{__v:e,i:t});return n.containerInfo=t,n}(C.prototype=new r.Component).__a=function(e){var t=this,n=x(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),_(t,e,r)):o()};n?n(i):i()}},C.prototype.render=function(e){this.u=null,this.o=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},C.prototype.componentDidUpdate=C.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){_(e,n,t)}))};var T="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,O=/^(?: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]/,k=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,N=/[A-Z0-9]/g,A="undefined"!=typeof document,I=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function R(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function P(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 L=r.options.event;function M(){}function D(){return this.cancelBubble}function F(){return this.defaultPrevented}r.options.event=function(e){return L&&(e=L(e)),e.persist=M,e.isPropagationStopped=D,e.isDefaultPrevented=F,e.nativeEvent=e};var U,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 i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||A&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"ondoubleclick"===a?i="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||I(t.type)?"onfocus"===a?i="onfocusin":"onblur"===a?i="onfocusout":k.test(i)?i=a:-1===n.indexOf("-")&&O.test(i)?i=i.replace(N,"-$&").toLowerCase():null===s&&(s=void 0):a=i="oninput","oninput"===a&&o[i=a]&&(i="oninputCapture"),o[i]=s}}"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),U=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),U=null};var V={ReactCurrentDispatcher:{current:{readContext:function(e){return U.__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,ie=G;function se(e,t){var n=t(),r=(0,o.useState)({h:{__:n,v:t}}),i=r[0].h,s=r[1];return(0,o.useLayoutEffect)((function(){i.__=n,i.v=t,ae(i)&&s({h:i})}),[e,n,t]),(0,o.useEffect)((function(){return ae(i)&&s({h:i}),e((function(){ae(i)&&s({h:i})}))}),[e]),n}function ae(e){var t,n,r=e.v,o=e.__;try{var i=r();return!((t=o)===(n=i)&&(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:se,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:R,hydrate:P,unmountComponentAtNode:X,createPortal:S,createElement:r.createElement,createContext:r.createContext,createFactory:q,cloneElement:J,createRef:r.createRef,Fragment:r.Fragment,isValidElement:G,isElement:ie,isFragment:K,findDOMNode:Y,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:Q,unstable_batchedUpdates:Z,StrictMode:ee,Suspense:b,SuspenseList:C,lazy:w,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:V}},7556:(e,t,n)=>{"use strict";var r=n(144),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useSyncExternalStore,s=r.useRef,a=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=s(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,i=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return s=t}return s=e}if(t=s,o(i,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(i=e,s=n)}var i,s,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=i(e,d[0],d[1]);return a((function(){p.hasValue=!0,p.value=h}),[h]),l(h),h}},6728:(e,t,n)=>{"use strict";e.exports=n(7556)},9150:e=>{"use strict";e.exports=require("preact")},8056:e=>{"use strict";e.exports=require("preact/hooks")},6592:(e,t,n)=>{"use strict";n(1440);var r=n(1568);e.exports=r("Array","at")},1896:(e,t,n)=>{"use strict";var r=n(9063),o=n(4596),i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not a function")}},2328:(e,t,n)=>{"use strict";var r=n(1840),o=n(8340),i=n(368).f,s=r("unscopables"),a=Array.prototype;void 0===a[s]&&i(a,s,{configurable:!0,value:o(null)}),e.exports=function(e){a[s][e]=!0}},8424:(e,t,n)=>{"use strict";var r=n(808),o=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(o(e)+" is not an object")}},2196:(e,t,n)=>{"use strict";var r=n(9740),o=n(4160),i=n(9480),s=function(e){return function(t,n,s){var a,c=r(t),l=i(c),u=o(s,l);if(e&&n!=n){for(;l>u;)if((a=c[u++])!=a)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},5983:(e,t,n)=>{"use strict";var r=n(1447),o=r({}.toString),i=r("".slice);e.exports=function(e){return i(o(e),8,-1)}},4304:(e,t,n)=>{"use strict";var r=n(6216),o=n(9976),i=n(4560),s=n(368);e.exports=function(e,t,n){for(var a=o(t),c=s.f,l=i.f,u=0;u<a.length;u++){var d=a[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},3652:(e,t,n)=>{"use strict";var r=n(3528),o=n(368),i=n(9200);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},9200:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},3244:(e,t,n)=>{"use strict";var r=n(9063),o=n(368),i=n(316),s=n(1544);e.exports=function(e,t,n,a){a||(a={});var c=a.enumerable,l=void 0!==a.name?a.name:t;if(r(n)&&i(n,l,a),a.global)c?e[t]=n:s(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}},1544:(e,t,n)=>{"use strict";var r=n(5624),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}},3528:(e,t,n)=>{"use strict";var r=n(6040);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},9308:(e,t,n)=>{"use strict";var r=n(5624),o=n(808),i=r.document,s=o(i)&&o(i.createElement);e.exports=function(e){return s?i.createElement(e):{}}},8232:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},3356:(e,t,n)=>{"use strict";var r,o,i=n(5624),s=n(8232),a=i.process,c=i.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&&s&&(!(r=s.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},1568:(e,t,n)=>{"use strict";var r=n(5624),o=n(1447);e.exports=function(e,t){return o(r[e].prototype[t])}},4656:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3748:(e,t,n)=>{"use strict";var r=n(5624),o=n(4560).f,i=n(3652),s=n(3244),a=n(1544),c=n(4304),l=n(5272);e.exports=function(e,t){var n,u,d,p,h,f=e.target,m=e.global,v=e.stat;if(n=m?r:v?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+(v?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),s(n,u,p,e)}}},6040:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},5744:(e,t,n)=>{"use strict";var r=n(6040);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},892:(e,t,n)=>{"use strict";var r=n(5744),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},3788:(e,t,n)=>{"use strict";var r=n(3528),o=n(6216),i=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,a=o(i,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&s(i,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},1447:(e,t,n)=>{"use strict";var r=n(5744),o=Function.prototype,i=o.call,s=r&&o.bind.bind(i,i);e.exports=r?s:function(e){return function(){return i.apply(e,arguments)}}},4960:(e,t,n)=>{"use strict";var r=n(5624),o=n(9063);e.exports=function(e,t){return arguments.length<2?(n=r[e],o(n)?n:void 0):r[e]&&r[e][t];var n}},364:(e,t,n)=>{"use strict";var r=n(1896),o=n(952);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},5624: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")()},6216:(e,t,n)=>{"use strict";var r=n(1447),o=n(6804),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(o(e),t)}},6480:e=>{"use strict";e.exports={}},6836:(e,t,n)=>{"use strict";var r=n(4960);e.exports=r("document","documentElement")},784:(e,t,n)=>{"use strict";var r=n(3528),o=n(6040),i=n(9308);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},6212:(e,t,n)=>{"use strict";var r=n(1447),o=n(6040),i=n(5983),s=Object,a=r("".split);e.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"===i(e)?a(e,""):s(e)}:s},8460:(e,t,n)=>{"use strict";var r=n(1447),o=n(9063),i=n(9136),s=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(e){return s(e)}),e.exports=i.inspectSource},5444:(e,t,n)=>{"use strict";var r,o,i,s=n(280),a=n(5624),c=n(808),l=n(3652),u=n(6216),d=n(9136),p=n(8192),h=n(6480),f="Object already initialized",m=a.TypeError,v=a.WeakMap;if(s||d.state){var y=d.state||(d.state=new v);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw new m(f);return t.facade=e,y.set(e,t),t},o=function(e){return y.get(e)||{}},i=function(e){return y.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]:{}},i=function(e){return u(e,g)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(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}}}},9063: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}},5272:(e,t,n)=>{"use strict";var r=n(6040),o=n(9063),i=/#|\.prototype\./,s=function(e,t){var n=c[a(e)];return n===u||n!==l&&(o(t)?r(t):!!t)},a=s.normalize=function(e){return String(e).replace(i,".").toLowerCase()},c=s.data={},l=s.NATIVE="N",u=s.POLYFILL="P";e.exports=s},952:e=>{"use strict";e.exports=function(e){return null==e}},808:(e,t,n)=>{"use strict";var r=n(9063);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},2804:e=>{"use strict";e.exports=!1},6232:(e,t,n)=>{"use strict";var r=n(4960),o=n(9063),i=n(6056),s=n(9448),a=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&i(t.prototype,a(e))}},9480:(e,t,n)=>{"use strict";var r=n(960);e.exports=function(e){return r(e.length)}},316:(e,t,n)=>{"use strict";var r=n(1447),o=n(6040),i=n(9063),s=n(6216),a=n(3528),c=n(3788).CONFIGURABLE,l=n(8460),u=n(5444),d=u.enforce,p=u.get,h=String,f=Object.defineProperty,m=r("".slice),v=r("".replace),y=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="["+v(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!s(e,"name")||c&&e.name!==t)&&(a?f(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&s(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?a&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return s(r,"source")||(r.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return i(this)&&p(this).source||l(this)}),"toString")},1736: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)}},8340:(e,t,n)=>{"use strict";var r,o=n(8424),i=n(5045),s=n(4656),a=n(6480),c=n(6836),l=n(9308),u=n(8192),d="prototype",p="script",h=u("IE_PROTO"),f=function(){},m=function(e){return"<"+p+">"+e+"</"+p+">"},v=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;y="undefined"!=typeof document?document.domain&&r?v(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):v(r);for(var o=s.length;o--;)delete y[d][s[o]];return y()};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=y(),void 0===t?n:i.f(n,t)}},5045:(e,t,n)=>{"use strict";var r=n(3528),o=n(4859),i=n(368),s=n(8424),a=n(9740),c=n(4152);t.f=r&&!o?Object.defineProperties:function(e,t){s(e);for(var n,r=a(t),o=c(t),l=o.length,u=0;l>u;)i.f(e,n=o[u++],r[n]);return e}},368:(e,t,n)=>{"use strict";var r=n(3528),o=n(784),i=n(4859),s=n(8424),a=n(8732),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",h="writable";t.f=r?i?function(e,t,n){if(s(e),t=a(t),s(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(s(e),t=a(t),s(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}},4560:(e,t,n)=>{"use strict";var r=n(3528),o=n(892),i=n(2460),s=n(9200),a=n(9740),c=n(8732),l=n(6216),u=n(784),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 s(!o(i.f,e,t),e[t])}},692:(e,t,n)=>{"use strict";var r=n(9232),o=n(4656).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},8167:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},6056:(e,t,n)=>{"use strict";var r=n(1447);e.exports=r({}.isPrototypeOf)},9232:(e,t,n)=>{"use strict";var r=n(1447),o=n(6216),i=n(9740),s=n(2196).indexOf,a=n(6480),c=r([].push);e.exports=function(e,t){var n,r=i(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++])&&(~s(u,n)||c(u,n));return u}},4152:(e,t,n)=>{"use strict";var r=n(9232),o=n(4656);e.exports=Object.keys||function(e){return r(e,o)}},2460:(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},7664:(e,t,n)=>{"use strict";var r=n(892),o=n(9063),i=n(808),s=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&o(n=e.toString)&&!i(a=r(n,e)))return a;if(o(n=e.valueOf)&&!i(a=r(n,e)))return a;if("string"!==t&&o(n=e.toString)&&!i(a=r(n,e)))return a;throw new s("Can't convert object to primitive value")}},9976:(e,t,n)=>{"use strict";var r=n(4960),o=n(1447),i=n(692),s=n(8167),a=n(8424),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(a(e)),n=s.f;return n?c(t,n(e)):t}},2696:(e,t,n)=>{"use strict";var r=n(952),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},8192:(e,t,n)=>{"use strict";var r=n(8196),o=n(320),i=r("keys");e.exports=function(e){return i[e]||(i[e]=o(e))}},9136:(e,t,n)=>{"use strict";var r=n(5624),o=n(1544),i="__core-js_shared__",s=r[i]||o(i,{});e.exports=s},8196:(e,t,n)=>{"use strict";var r=n(2804),o=n(9136);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.35.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE",source:"https://github.com/zloirock/core-js"})},8972:(e,t,n)=>{"use strict";var r=n(3356),o=n(6040),i=n(5624).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!i(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},4160:(e,t,n)=>{"use strict";var r=n(3288),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},9740:(e,t,n)=>{"use strict";var r=n(6212),o=n(2696);e.exports=function(e){return r(o(e))}},3288:(e,t,n)=>{"use strict";var r=n(1736);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},960:(e,t,n)=>{"use strict";var r=n(3288),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},6804:(e,t,n)=>{"use strict";var r=n(2696),o=Object;e.exports=function(e){return o(r(e))}},8176:(e,t,n)=>{"use strict";var r=n(892),o=n(808),i=n(6232),s=n(364),a=n(7664),c=n(1840),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!o(e)||i(e))return e;var n,c=s(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||i(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},8732:(e,t,n)=>{"use strict";var r=n(8176),o=n(6232);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},4596:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},320:(e,t,n)=>{"use strict";var r=n(1447),o=0,i=Math.random(),s=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++o+i,36)}},9448:(e,t,n)=>{"use strict";var r=n(8972);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},4859:(e,t,n)=>{"use strict";var r=n(3528),o=n(6040);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},280:(e,t,n)=>{"use strict";var r=n(5624),o=n(9063),i=r.WeakMap;e.exports=o(i)&&/native code/.test(String(i))},1840:(e,t,n)=>{"use strict";var r=n(5624),o=n(8196),i=n(6216),s=n(320),a=n(8972),c=n(9448),l=r.Symbol,u=o("wks"),d=c?l.for||l:l&&l.withoutSetter||s;e.exports=function(e){return i(u,e)||(u[e]=a&&i(l,e)?l[e]:d("Symbol."+e)),u[e]}},1440:(e,t,n)=>{"use strict";var r=n(3748),o=n(6804),i=n(9480),s=n(3288),a=n(2328);r({target:"Array",proto:!0},{at:function(e){var t=o(this),n=i(t),r=s(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}}),a("at")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.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;)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:()=>Se,AgentInfo:()=>su,Chat:()=>qc,ChatFrame:()=>Bl,ComponentFilter:()=>Qa,Conversation:()=>Dc,Engine:()=>tu,EntryContainer:()=>Dl,EventParticipant:()=>Hs,ExternalApi:()=>ou,Header:()=>au,Icon:()=>Ks,Interrupt:()=>Ul,MessageContainer:()=>Vs,SeamlyApiContext:()=>ns,SeamlyEventBusContext:()=>rs,SeamlyGeneralError:()=>l,SeamlyLiveRegionContext:()=>cs,SeamlyOfflineError:()=>Wr,SeamlyStoreProvider:()=>Bn,Text:()=>Ka,View:()=>Zl,calculateVisibility:()=>jn,className:()=>$s,default:()=>cu,eventTypes:()=>pr,randomId:()=>g,useChoicePrompt:()=>ra,useEvents:()=>Zn,useGeneratedId:()=>Ps,useI18n:()=>Zi,useSeamlyActions:()=>iu,useSeamlyChat:()=>hs,useSeamlyCommands:()=>as,useSeamlyConfig:()=>qn,useSeamlyEventStream:()=>Ms,useSeamlyIdleDetachCountdown:()=>Is,useSeamlyMessageContainerClassNames:()=>js,useSeamlyOptions:()=>Os,useSeamlyVisibility:()=>Qi,useTranslatedEventData:()=>Fs,useTranslations:()=>Ds,useTranslationsContainer:()=>Us,visibilityStates:()=>Cn}),n(6592);const e=require("preact/jsx-runtime");var t=n(1792),o=n.n(t),i=n(9150);class s extends Error{constructor(e,t){super(e,{cause:null==t?void 0:t.cause}),this.status=null==t?void 0:t.status}}class a 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 c extends a{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class l extends a{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class u extends a{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class d extends a{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const p="cvco",h="seamly-client-participant",f=50,m=300;var v=n(5576),y=n.n(v);function g(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function b(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 JSON.parse(n)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const x=(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)}}},w=e=>Math.ceil(e/1e3),C=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},_=(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]}`},j={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},E={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},S=e=>e.code?E[e.code]:j[e.keyCode],T=e=>{e&&e.focus()},O=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};var k=e=>"function"==typeof e?e:function(){return e},N="undefined"!=typeof self?self:null,A="undefined"!=typeof window?window:null,I=N||A||I,R="closed",P="errored",L="joined",M="joining",D="leaving",F="phx_close",U="phx_error",B="phx_reply",z="phx_leave",$="websocket",H=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})}},V=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))}},W=class{constructor(e,t,n){this.state=R,this.topic=e,this.params=k(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new H(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new V((()=>{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=L,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=P,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=P,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 H(this,z,k({}),this.timeout).send(),this.state=P,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(B,((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(F,e)}onError(e){return this.on(U,(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 H(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=D;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(F,"leave")},n=new H(this,z,k({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return!(this.topic!==e||r&&r!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=M,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 i=this.bindings.filter((t=>t.event===e));for(let e=0;e<i.length;e++)i[e].callback(o,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===R}isErrored(){return this.state===P}isJoined(){return this.state===L}isJoining(){return this.state===M}isLeaving(){return this.state===D}},q=class{static request(e,t,n,r,o,i,s){if(I.XDomainRequest){let n=new I.XDomainRequest;return this.xdomainRequest(n,e,t,r,o,i,s)}{let a=new I.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,o,i,s)}}static xdomainRequest(e,t,n,r,o,i,s){return e.timeout=o,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,o,i,s,a){return e.open(t,n,!0),e.timeout=i,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)}},s&&(e.ontimeout=s),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,i=e[r];"object"==typeof i?n.push(this.serialize(i,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}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)}`}},G=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("(.*)/"+$),"$1/longpoll")}endpointURL(){return q.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 i;i=q.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(i),r()}),(e=>{this.reqs.delete(i),this.isActive()&&o(e)})),this.reqs.add(i)}},K={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,i,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+n.length+o.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),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+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),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),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(s,s+r));s+=r;let c=n.decode(e.slice(s,s+o));s+=o;let l=n.decode(e.slice(s,s+i));return s+=i,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=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+i));a+=i;let d=n.decode(e.slice(a,a+s));a+=s;let p=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:B,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=n.decode(e.slice(i,i+r));i+=r;let a=n.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}},J=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||I.WebSocket||G,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||I.sessionStorage,this.establishedConnections=0,this.defaultEncoder=K.encode.bind(K),this.defaultDecoder=K.decode.bind(K),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==G?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;A&&A.addEventListener&&(A.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),A.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=k(t.params||{}),this.endPoint=`${e}/${$}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new V((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return G}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=q.appendParams(q.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=k(e)),this.conn||(this.longPollFallbackMs&&this.transport!==G?this.connectWithFallback(G,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,i=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 i("memorized");this.fallbackTimer=setTimeout(i,t),n=this.onError((e=>{this.log("transport","error",e),o&&!r&&(clearTimeout(this.fallbackTimer),i(e))})),this.onOpen((()=>{if(r=!0,!o)return console.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(i,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(U)}))}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 W(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:i}=e;this.log("push",`${t} ${n} (${i}, ${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:i}=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 s=this.channels[e];s.isMember(t,n,r,i)&&s.trigger(n,r,o,i)}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())}};var X,Y,Z,Q,ee=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},te=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n};const ne=y()("seamly"),re=new Set;Y=new WeakMap,X=new WeakSet,Z=function(...e){e.forEach((e=>{this.channel.on(e,(t=>{ne("[RECEIVE]",e,t)}))}))},Q=function(e){te(this,Y,ee(this,Y,"f").filter((t=>!t(e))),"f"),re.forEach((e=>e()))};const oe=class{constructor(){X.add(this),Y.set(this,[])}connect(e,t,n,r){return o=this,i=void 0,a=function*(){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o,params:i}=(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 J(o,{params:Object.assign(Object.assign({},i),{v:"3"}),reconnectAfterMs:e=>{const t=250*Math.pow(2,e);return Math.min(t,1e4)}}),this.socket.onError((e=>{ne("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{ne("[SOCKET]OPEN")})),this.socket.onClose((()=>{ne("[SOCKET]CLOSE"),ee(this,X,"m",Q).call(this,{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&&ee(this,X,"m",Q).call(this,{connected:!0,ready:!0,currentState:"attach_channel_succeeded"})})),this.channel.onClose((()=>{ne("[CHANNEL]CLOSE"),ee(this,X,"m",Q).call(this,{connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{ne("[CHANNEL][ERROR]",e),ee(this,X,"m",Q).call(this,{connected:!1,ready:!1,currentState:"channel_erred"})})),ee(this,X,"m",Z).call(this,"ack","ui","error","participant","message","service_data","system","info","sync")},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{c(a.next(e))}catch(e){t(e)}}function r(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}c((a=a.apply(o,i||[])).next())}));var o,i,s,a}start(){this.channel.join().receive("ok",(()=>{ne("[CHANNEL][JOIN] OK"),ee(this,X,"m",Q).call(this,{connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{ne("[CHANNEL][JOIN] ERROR",e),ee(this,X,"m",Q).call(this,{connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{ne("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){var e;null===(e=this.channel)||void 0===e||e.leave().receive("ok",(()=>{var e;null===(e=this.socket)||void 0===e||e.disconnect(),ne("[CHANNEL][LEAVE] OK"),te(this,Y,[],"f")}))}onConnection(e){ee(this,Y,"f").push(e)}pushToChannel(e,t,n=1e4){this.channel.push(e,t,n)}static subscribe(e){return re.add(e),()=>re.delete(e)}};var ie,se,ae,ce,le,ue,de,pe,he,fe,me,ve,ye,ge,be,xe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},we=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},Ce=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};const _e=y()("seamly"),je=(e,t)=>xe(void 0,void 0,void 0,(function*(){const n=new URL(e);n.searchParams.set("v","3");const r=yield fetch(n.href,Object.assign({mode:"cors"},t));if(!r.ok)throw new s(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r}));function Ee(){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 Se{constructor({layoutMode:e,namespace:t,config:n,context:r}){var o;ie.add(this),se.set(this,void 0),ae.set(this,void 0),ce.set(this,void 0),le.set(this,void 0),ue.set(this,void 0),this.conversation=new oe,ve.set(this,(e=>e||this.locale)),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.contentLocale?`.${r.contentLocale}`:""}`,n.storageProvider||b),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},we(this,ue,Object.assign(Object.assign({},n),{sendEnvironment:null===(o=n.sendEnvironment)||void 0===o||o,context:Object.assign(Object.assign({},r),{channelName:r.channelName||"web"})}),"f"),we(this,se,!1,"f"),this.connected=!1,this.configReady=!1,we(this,ae,n.externalId,"f"),we(this,le,e,"f"),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getConversationUrl(){return this.store.get("conversationUrl")}hasConversation(){return!!this.getConversationUrl()}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}reset(){return xe(this,void 0,void 0,(function*(){return yield this.disconnect(),this.clearStore(),this.getConfig()}))}disconnect(){var e;return xe(this,void 0,void 0,(function*(){(null===(e=this.conversation)||void 0===e?void 0:e.disconnect)&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}))}getConfig(){return xe(this,void 0,void 0,(function*(){try{const e=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}/client/${this.connectionInfo.apiKey}/configs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:Object.assign(Object.assign({},Ce(this,ue,"f").context),{environment:!0===Ce(this,ue,"f").sendEnvironment?this.getEnvironment():Ce(this,ue,"f").sendEnvironment})})}),t=yield e.json();return Ce(this,ie,"m",ge).call(this,t),this.configReady=!0,t.config}catch(e){if(404===e.status)throw new c(e);if(e.status>=500)throw new l(e);throw e}}))}getConversation(){return xe(this,void 0,void 0,(function*(){if(!this.hasConversation())return null;try{const e=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.history}`,{method:"GET",headers:{Authorization:`Bearer ${Ce(this,ie,"m",de).call(this)}`}}),t=yield e.json();Ce(this,ie,"m",ge).call(this,t);const{messages:n,participants:r,activeServiceSessionId:o,activeServiceSettings:i,serviceData:s,ui:a,translation:c}=t.history;return{events:n.map((([e,t])=>({type:e,payload:Object.assign(Object.assign({},t),{type:"participant"===e?e:t.type})}))),participants:r,activeServiceSessionId:o,activeServiceSettings:i,serviceData:s,resumeConversationPrompt:!!a&&Boolean(a.resumeConversationPrompt),translationProposal:a.translationProposal,translation:c}}catch(e){if(401===e.status)throw new d(e);if(404===e.status)throw new u(e);if(e.status>=500)throw new l(e);throw new s(e)}}))}connect(){return xe(this,void 0,void 0,(function*(){this.connected=!1;let e={};return this.hasConversation()||(e=yield Ce(this,ie,"m",be).call(this)),this.conversation.connect(`${Ce(this,ie,"m",ye).call(this,"ws")}${this.URLS.socket}`,Ce(this,ue,"f").context.channelName,Ce(this,ie,"m",fe).call(this),Ce(this,ie,"m",de).call(this)),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,we(this,se,t,"f")})),e}))}uploadFile(e,t,n,r){const o=new FormData;o.append("upload",e);const i=new XMLHttpRequest;return i.open("POST",`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.uploads}`),i.setRequestHeader("Authorization",`Bearer ${Ce(this,ie,"m",de).call(this)}`),i.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},i.onloadend=()=>{if(0!==i.status)if(200!==i.status&&201!==i.status||!n){if(!r)throw new Error(i.response);try{r(JSON.parse(i.response))}catch(e){r(i.response)}}else try{n(JSON.parse(i.response))}catch(e){n(i.response)}},i.send(o),i}getConversationIntitialState(){return xe(this,void 0,void 0,(function*(){try{const n=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${Ce(this,ie,"m",de).call(this)}`}}),r=yield n.json();return Ce(this,ie,"m",ge).call(this,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 d(e);if(404===e.status)throw new u(e);if(e.status>=500)throw new l(e);throw e}var e,t}))}getTranslations(e){return xe(this,void 0,void 0,(function*(){try{if(!this.URLS.translations)throw new c;const t=`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.translations}`.replace("{version}",String(4)).replace("{locale}",Ce(this,ve,"f").call(this,e)),n=yield je(t,{method:"GET"});return(yield n.json()).translations}catch(e){if(e.status>=500)throw new l(e);throw new s(e)}}))}send(e,t,n=!0){var r;!this.connected||n&&!Ce(this,se,"f")?null===(r=this.conversation)||void 0===r||r.onConnection((({connected:r,ready:o})=>(this.connected=r,we(this,se,o,"f"),!!(n?o:r)&&(this.send(e,t,n),!0)))):(_e("[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=g()),{type:n,body:r,transactionId:o}}(e,t),1e4))}sendContext(e){var t,n;const{contentLocale:r,userLocale:o,variables:i,environment:s}=e,a={};if(s&&(a.environment=s),r){if("string"!=typeof r)throw new Error("Content locale must be a string");a.contentLocale=r}if(o){if("string"!=typeof o)throw new Error("User locale must be a string");a.userLocale=o}if(i){if("object"!=typeof i)throw new Error("Variables must be an object");a.variables=i}if(0===Object.keys(a).length&&a.constructor===Object)return;const{contentLocale:c}=a,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(a,["contentLocale"]),u=null===(t=Ce(this,ue,"f").context)||void 0===t?void 0:t.contentLocale,d=null===(n=Ce(this,ue,"f").context)||void 0===n?void 0:n.userLocale;this.send("context",Object.assign(Object.assign({},u?{contentLocale:u,userLocale:d}:{}),l),!1)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:Ce(this,le,"f"),clientVersion:"23.0.0-alpha.2",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:Ee(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}se=new WeakMap,ae=new WeakMap,ce=new WeakMap,le=new WeakMap,ue=new WeakMap,ve=new WeakMap,ie=new WeakSet,de=function(){return this.store.get("accessToken")},pe=function(e){this.store.set("accessToken",e)},he=function(e){this.store.set("conversationUrl",e)},fe=function(){return this.store.get("channelTopic")||this.store.get("channelName")},me=function(e){this.store.set("channelTopic",e)},ye=function(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`},ge=function({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>Object.assign(Object.assign({},e),{[t]:n})),this.URLS)},be=function(){var e,t;return xe(this,void 0,void 0,(function*(){try{"function"==typeof(null===(e=Ce(this,ue,"f"))||void 0===e?void 0:e.getConversationAuthToken)&&we(this,ce,yield Ce(this,ue,"f").getConversationAuthToken(),"f");const n=yield je(`${Ce(this,ie,"m",ye).call(this,"http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:Ce(this,ce,"f")?void 0:Ce(this,ae,"f"),token:Ce(this,ce,"f")})}),r=yield n.json(),{conversation:o}=r,i=Object.assign({},o);return delete i.accessToken,delete i.channelTopic,Ce(this,ie,"m",pe).call(this,o.accessToken),Ce(this,ie,"m",me).call(this,o.channelTopic),Ce(this,ie,"m",ge).call(this,r),Ce(this,ie,"m",he).call(this,this.URLS.conversation),this.locale=null===(t=o.translation)||void 0===t?void 0:t.locale,this.userResponded=o.userResponded,i}catch(e){if(e.status>=500)throw new l(e);if(400===e.status)throw new d(e);if(404===e.status)throw new c(e);throw e}}))};var Te=Symbol.for("immer-nothing"),Oe=Symbol.for("immer-draftable"),ke=Symbol.for("immer-state");function Ne(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ae=Object.getPrototypeOf;function Ie(e){return!!e&&!!e[ke]}function Re(e){return!!e&&(Le(e)||Array.isArray(e)||!!e[Oe]||!!e.constructor?.[Oe]||Be(e)||ze(e))}var Pe=Object.prototype.constructor.toString();function Le(e){if(!e||"object"!=typeof e)return!1;const t=Ae(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)===Pe}function Me(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[ke];return t?t.type_:Array.isArray(e)?1:Be(e)?2:ze(e)?3:0}function Fe(e,t){return 2===De(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ue(e,t,n){const r=De(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Be(e){return e instanceof Map}function ze(e){return e instanceof Set}function $e(e){return e.copy_||e.base_}function He(e,t){if(Be(e))return new Map(e);if(ze(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Le(e)){if(!Ae(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ke];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Ae(e),n)}function Ve(e,t=!1){return qe(e)||Ie(e)||!Re(e)||(De(e)>1&&(e.set=e.add=e.clear=e.delete=We),Object.freeze(e),t&&Me(e,((e,t)=>Ve(t,!0)))),e}function We(){Ne(2)}function qe(e){return Object.isFrozen(e)}var Ge,Ke={};function Je(e){const t=Ke[e];return t||Ne(0),t}function Xe(){return Ge}function Ye(e,t){t&&(Je("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ze(e){Qe(e),e.drafts_.forEach(tt),e.drafts_=null}function Qe(e){e===Ge&&(Ge=e.parent_)}function et(e){return Ge={drafts_:[],parent_:Ge,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function tt(e){const t=e[ke];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function nt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ke].modified_&&(Ze(t),Ne(4)),Re(e)&&(e=rt(t,e),t.parent_||it(t,e)),t.patches_&&Je("Patches").generateReplacementPatches_(n[ke].base_,e,t.patches_,t.inversePatches_)):e=rt(t,n,[]),Ze(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Te?e:void 0}function rt(e,t,n){if(qe(t))return t;const r=t[ke];if(!r)return Me(t,((o,i)=>ot(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return it(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),Me(o,((o,s)=>ot(e,r,t,o,s,n,i))),it(e,t,!1),n&&e.patches_&&Je("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ot(e,t,n,r,o,i,s){if(Ie(o)){const s=rt(e,o,i&&t&&3!==t.type_&&!Fe(t.assigned_,r)?i.concat(r):void 0);if(Ue(n,r,s),!Ie(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(Re(o)&&!qe(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;rt(e,o),t&&t.scope_.parent_||it(e,o)}}function it(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ve(t,n)}var st={get(e,t){if(t===ke)return e;const n=$e(e);if(!Fe(n,t))return function(e,t,n){const r=lt(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_||!Re(r)?r:r===ct(e.base_,t)?(dt(e),e.copy_[t]=pt(r,e)):r},has:(e,t)=>t in $e(e),ownKeys:e=>Reflect.ownKeys($e(e)),set(e,t,n){const r=lt($e(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ct($e(e),t),s=r?.[ke];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||Fe(e.base_,t)))return!0;dt(e),ut(e)}var o,i;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!==ct(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,dt(e),ut(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=$e(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ne(11)},getPrototypeOf:e=>Ae(e.base_),setPrototypeOf(){Ne(12)}},at={};function ct(e,t){const n=e[ke];return(n?$e(n):e)[t]}function lt(e,t){if(!(t in e))return;let n=Ae(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ae(n)}}function ut(e){e.modified_||(e.modified_=!0,e.parent_&&ut(e.parent_))}function dt(e){e.copy_||(e.copy_=He(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function pt(e,t){const n=Be(e)?Je("MapSet").proxyMap_(e,t):ze(e)?Je("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Xe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=st;n&&(o=[r],i=at);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:Xe()).drafts_.push(n),n}function ht(e){return Ie(e)||Ne(10),ft(e)}function ft(e){if(!Re(e)||qe(e))return e;const t=e[ke];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=He(e,t.scope_.immer_.useStrictShallowCopy_)}else n=He(e,!0);return Me(n,((e,t)=>{Ue(n,e,ft(t))})),t&&(t.finalized_=!1),n}Me(st,((e,t)=>{at[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),at.deleteProperty=function(e,t){return at.set.call(this,e,t,void 0)},at.set=function(e,t,n){return st.set.call(this,e[0],t,n,e[0])};var mt=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&&Ne(6),void 0!==n&&"function"!=typeof n&&Ne(7),Re(e)){const o=et(this),i=pt(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?Ze(o):Qe(o)}return Ye(o,n),nt(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Te&&(r=void 0),this.autoFreeze_&&Ve(r,!0),n){const t=[],o=[];Je("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Ne(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){Re(e)||Ne(8),Ie(e)&&(e=ht(e));const t=et(this),n=pt(e,void 0);return n[ke].isManual_=!0,Qe(t),n}finishDraft(e,t){const n=e&&e[ke];n&&n.isManual_||Ne(9);const{scope_:r}=n;return Ye(r,t),nt(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=Je("Patches").applyPatches_;return Ie(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},vt=mt.produce;mt.produceWithPatches.bind(mt),mt.setAutoFreeze.bind(mt),mt.setUseStrictShallowCopy.bind(mt),mt.applyPatches.bind(mt),mt.createDraft.bind(mt),mt.finishDraft.bind(mt);var yt=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var gt="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},bt=0,xt=1;function wt(){return{s:bt,v:void 0,o:null,p:null}}function Ct(e,t={}){let n=wt();const{resultEqualityCheck:r}=t;let o,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;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=wt(),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=wt(),e.set(n,t)):t=r}}const a=t;let c;if(t.s===xt?c=t.v:(c=e.apply(null,arguments),i++),a.s=xt,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==i&&i--),o="object"==typeof c&&null!==c||"function"==typeof c?new gt(c):c}return a.v=c,c}return s.clearCache=()=>{n=wt(),s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function _t(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:c,memoizeOptions:l=[],argsMemoize:u=Ct,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,h=yt(l),f=yt(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),v=c((function(){return r++,s.apply(null,arguments)}),...h),y=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=v.apply(null,e),t}),...f);return Object.assign(y,{resultFunc:s,memoizedResultFunc:v,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 jt=_t(Ct),Et=Object.assign(((e,t=jt)=>{!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:()=>Et});function St(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")(),Ot=()=>Math.random().toString(36).substring(7).split("").join("."),kt={INIT:`@@redux/INIT${Ot()}`,REPLACE:`@@redux/REPLACE${Ot()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ot()}`};function Nt(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 At(e,t,n){if("function"!=typeof e)throw new Error(St(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(St(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(St(1));return n(At)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function u(){if(c)throw new Error(St(3));return o}function d(e){if("function"!=typeof e)throw new Error(St(4));if(c)throw new Error(St(5));let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(c)throw new Error(St(6));t=!1,l(),s.delete(n),i=null}}}function p(e){if(!Nt(e))throw new Error(St(7));if(void 0===e.type)throw new Error(St(8));if("string"!=typeof e.type)throw new Error(St(17));if(c)throw new Error(St(9));try{c=!0,o=r(o,e)}finally{c=!1}return(i=s).forEach((e=>{e()})),e}return p({type:kt.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(St(10));r=e,p({type:kt.REPLACE})},[Tt]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(St(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:kt.INIT}))throw new Error(St(12));if(void 0===n(void 0,{type:kt.PROBE_UNKNOWN_ACTION()}))throw new Error(St(13))}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;let i=!1;const s={};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(St(14));s[a]=u,i=i||u!==l}return i=i||r.length!==Object.keys(e).length,i?s:e}}function Rt(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Pt(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var Lt=Pt(),Mt=Pt,Dt=(((...e)=>{const t=_t(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(Ie(e)?ht(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(Ct),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Rt:Rt.apply(null,arguments)}),Ft=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Ut(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(mn(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 Nt(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Bt=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 zt(e){return Re(e)?vt(e,(()=>{})):e}function $t(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(mn(10));const r=n.insert(t,e);return e.set(t,r),r}var Ht=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let i=new Bt;return t&&("boolean"==typeof t?i.push(Lt):i.push(Mt(t.extraArgument))),i},Vt=e=>t=>{setTimeout(t,e)},Wt="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Vt(10),qt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Bt(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,i=!1,s=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?Wt:"callback"===e.type?e.queueNotification:Vt(e.timeout),l=()=>{s=!1,i&&(i=!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,i=!o,i&&(s||(s=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r},Gt=!0;function Kt(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(mn(28));if(r in t)throw new Error(mn(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 Jt=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Xt(...e){return t=>e.some((e=>((e,t)=>Ft(e)?e.match(t):e(t))(e,t)))}var Yt=["name","message","stack","code"],Zt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Qt=class{constructor(e,t){this.payload=e,this.meta=t}_type},en=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Yt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},tn=(()=>{function e(e,t,n){const r=Ut(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=Ut(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Ut(e+"/rejected",((e,t,r,o,i)=>({payload:o,error:(n&&n.serializeError||en)(e||"Rejected"),meta:{...i||{},arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,c)=>{const l=n?.idGenerator?n.idGenerator(e):Jt(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:c});if(null!==(m=i)&&"object"==typeof m&&"function"==typeof m.then&&(i=await i),!1===i||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const v=new Promise(((e,t)=>{d=()=>{t({name:"AbortError",message:p||"Aborted"})},u.signal.addEventListener("abort",d)}));s(o(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:c}))),f=await Promise.race([v,Promise.resolve(t(e,{dispatch:s,getState:a,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Zt(e,t),fulfillWithValue:(e,t)=>new Qt(e,t)})).then((t=>{if(t instanceof Zt)throw t;return t instanceof Qt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof Zt?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(nn)})}}),{pending:o,rejected:i,fulfilled:r,settled:Xt(i,r),typePrefix:e})}return e.withTypes=()=>e,e})();function nn(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var rn=Symbol.for("rtk-slice-createasyncthunk");function on(e,t){return`${e}/${t}`}function sn(e,t,n,r){function o(o,...i){let s=t(o);return void 0===s&&r&&(s=n()),e(s,...i)}return o.unwrapped=e,o}var an=function({creators:e}={}){const t=e?.asyncThunk?.[rn];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(mn(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)||{},i=Object.keys(o),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(mn(12));if(n in s.sliceCaseReducersByType)throw new Error(mn(13));return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Kt(e.extraReducers):[e.extraReducers],o={...t,...s.sliceCaseReducersByType};return function(e,t){let i,[a,c,l]=Kt((e=>{for(let t in o)e.addCase(t,o[t]);for(let t of s.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)i=()=>zt(e());else{const t=zt(e);i=()=>t}function u(e=i(),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(Re(e))return vt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(mn(9))}return r}}return e}),e)}return u.getInitialState=i,u}(e.initialState)}i.forEach((r=>{const i=o[r],s={reducerName:r,type:on(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},r,o){let i,s;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(mn(17));i=r.reducer,s=r.prepare}else i=r;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Ut(e,s):Ut(e))}(s,i,a):function({type:e,reducerName:t},n,r,o){if(!o)throw new Error(mn(18));const{payloadCreator:i,fulfilled:s,pending:a,rejected:c,settled:l,options:u}=n,d=o(e,i,u);r.exposeAction(t,d),s&&r.addCase(d.fulfilled,s),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:s||cn,pending:a||cn,rejected:c||cn,settled:l||cn})}(s,i,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=$t(u,n,{insert:()=>new WeakMap});return $t(r,t,{insert:()=>{const r={};for(const[o,i]of Object.entries(e.selectors??{}))r[o]=sn(i,t,h,n);return r}})}return{reducerPath:t,getSelectors:o,get selectors(){return o(r)},selectSlice:r}}const m={name:n,reducer:p,actions:s.actionCreators,caseReducers:s.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 cn(){}var{assign:ln}=Object,un="listenerMiddleware",dn=e=>{let{type:t,actionCreator:n,matcher:r,predicate:o,effect:i}=e;if(t)o=Ut(t).match;else if(n)t=n.type,o=n.match;else if(r)o=r;else if(!o)throw new Error(mn(21));return((e,t)=>{if("function"!=typeof e)throw new Error(mn(32))})(i),{predicate:o,type:t,effect:i}},pn=Object.assign((e=>{const{type:t,predicate:n,effect:r}=dn(e);return{id:Jt(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(mn(22))}}}),{withTypes:()=>pn}),hn=Object.assign(Ut(`${un}/add`),{withTypes:()=>hn}),fn=(Ut(`${un}/removeAll`),Object.assign(Ut(`${un}/remove`),{withTypes:()=>fn}));function mn(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 vn extends a{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}var yn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const gn=tn("initializeConfig",((e,{extra:{api:t,config:n},rejectWithValue:r})=>yn(void 0,void 0,void 0,(function*(){var e;try{const{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c}=yield t.getConfig(),l=(null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.contentLocale)||o,{connectWhenInView:u}=n;return{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})))),bn=tn("resetConfig",((e,{extra:{config:t}})=>yn(void 0,void 0,void 0,(function*(){return t})))),xn=jt((({app:e})=>e),(({userHasResponded:e})=>e)),wn="visibility",Cn={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},_n=jt((({config:e})=>e),(e=>{let t=Object.assign({visible:"inline"===(null==e?void 0:e.layoutMode)?Cn.open:Cn.minimized,appContainerClassNames:(null==e?void 0:e.appContainerClassNames)||[]},e);return"function"==typeof t.appContainerClassNames&&(t=Object.assign(Object.assign({},t),{appContainerClassNames:t.appContainerClassNames(t)})),t})),jn=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=r,{visible:a}=o||{};if("app"===i&&!t)return Cn.open;if("window"===i&&s&&n!==Cn.open)return e?n||t||Cn.open:Cn.hidden;if("inline"===i&&e&&!n)return t||Cn.open;const c=Cn.minimized;return n||t||a||c};var En=n(144),Sn=n(6728),Tn=En.default,On=Symbol.for("react-redux-context"),kn="undefined"!=typeof globalThis?globalThis:{};function Nn(){if(!Tn.createContext)return{};const e=kn[On]??(kn[On]=new Map);let t=e.get(Tn.createContext);return t||(t=Tn.createContext(null),e.set(Tn.createContext,t)),t}var An=Nn();function In(e=An){return function(){return Tn.useContext(e)}}var Rn=In(),Pn=()=>{throw new Error("uSES not initialized!")},Ln=(e,t)=>e===t;function Mn(e=An){const t=e===An?Rn:In(e),n=(e,n={})=>{const{equalityFn:r=Ln,devModeChecks:o={}}="function"==typeof n?{equalityFn:n}:n,{store:i,subscription:s,getServerState:a,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(Tn.useRef(!0),Tn.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,o.stabilityCheck])),d=Pn(s.addNestedSub,i.getState,a||i.getState,u,r);return Tn.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var Dn=Mn();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 Fn={notify(){},get:()=>[]};var Un="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?Tn.useLayoutEffect:Tn.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var Bn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:o="once",identityFunctionCheck:i="once"}){const s=Tn.useMemo((()=>{const t=function(e,t){let n,r=Fn,o=0,i=!1;function s(){l.onStateChange&&l.onStateChange()}function a(){o++,n||(n=t?t.addNestedSub(s):e.subscribe(s),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=Fn)}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:s,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,a())},tryUnsubscribe:function(){i&&(i=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:o,identityFunctionCheck:i}}),[e,r,o,i]),a=Tn.useMemo((()=>e.getState()),[e]);Un((()=>{const{subscription:t}=s;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),a!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[s,a]);const c=t||An;return Tn.createElement(c.Provider,{value:s},n)};function zn(e=An){const t=e===An?Rn:In(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var $n=zn();function Hn(e=An){const t=e===An?$n:zn(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Vn,Wn=Hn();Vn=Sn.useSyncExternalStoreWithSelector,Pn=Vn,En.useSyncExternalStore;const qn=()=>Dn(_n);function Gn(){const{startChatIcon:e}=qn();return e}const Kn=({state:e})=>e,Jn=()=>Dn(Kn),Xn=jt(Kn,_n,xn,(({events:e,serviceData:t},n,r)=>{var o;if(r||"inline"===n.layoutMode||!(null==t?void 0:t.suggestion)||!(null===(o=null==t?void 0:t.suggestion)||void 0===o?void 0:o.body.length))return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),Yn=jt(Xn,_n,((e,t)=>{var n,r;const{enabled:o,threshold:i}=null!==(r=null===(n=null==t?void 0:t.messages)||void 0===n?void 0:n.timeIndicator)&&void 0!==r?r:{};if(!o)return e;const s=[];let a=null;return e.forEach(((e,t)=>{if(0===t)s.push(Object.assign(Object.assign({},e),{timeIndicator:e.payload.occurredAt}));else{const t=a&&w(e.payload.occurredAt-a.payload.occurredAt)>=i?e.payload.occurredAt:void 0;s.push(Object.assign(Object.assign({},e),{timeIndicator:t}))}a=e})),s})),Zn=()=>Dn(Yn),Qn=(jt(Yn,(e=>e.map((e=>e.payload.id)))),()=>Jn().isLoading),er=()=>Jn().unreadEvents,tr=()=>Jn().skiplinkTargetId,nr=()=>Jn().serviceInfo,rr=jt(Yn,(e=>{var t;const n=e.filter((e=>"message"===e.type));return null===(t=n[n.length-1])||void 0===t?void 0:t.payload.id})),or=()=>{const{participants:e,currentAgent:t}=Jn().participantInfo;return t?e[t]:null},ir=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=Jn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},sr=()=>{const{layoutMode:e}=qn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},ar=jt((({visibility:e})=>e),(e=>e.visibility)),cr=jt((({visibility:e})=>e),(e=>e.showInlineView));const lr=[Cn.open,Cn.minimized,Cn.hidden],ur=tn("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),i=ar(o),s=xn(o),a=n.hasConversation(),c=_n(o),{visibilityCallback:l=jn,layoutMode:u}=c,{unreadEvents:d}=Kn(o),p=l({hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(!lr.includes(p))return void console.error('The visibilityCallback function should return "open", "minimized" or "hidden".');if(i===p)return;const h=n.store.get(wn);return n.store.set(wn,Object.assign(Object.assign({},h||{}),{[u]:e})),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:d}),p})),dr=tn("initialize",((e,{dispatch:t,getState:n,extra:{api:r}})=>{return o=void 0,i=void 0,a=function*(){var e;const{layoutMode:o}=_n(n()),i=(null===(e=r.store.get(wn))||void 0===e?void 0:e[o])||Cn.initialize;return t(ur(i)),i},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{c(a.next(e))}catch(e){t(e)}}function r(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}c((a=a.apply(o,i||[])).next())}));var o,i,s,a})),pr={info:"info",message:"message",participant:"participant",system:"system"},hr="text",fr="text",mr="upload",vr="received",yr="read",gr="custom",br="typing",xr="read",wr="detach_service",Cr="dismiss",_r="set_topic",jr="click_cta",Er="assertive",Sr="polite",Tr={new_topic:"newTopic",new_translation:"newTranslation"},Or="uploads",kr="navigate";var Nr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const Ar=tn("initializeApp",((e,{extra:{api:t,config:n},rejectWithValue:r})=>Nr(void 0,void 0,void 0,(function*(){var e,o,i;let s=null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.contentLocale,a=null===(o=null==n?void 0:n.context)||void 0===o?void 0:o.userLocale;const c=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=yield t.getConversationIntitialState();return s=e.context.contentLocale||s,a=e.context.userLocale||a,t.sendContext(Object.assign(Object.assign({},e.context),{environment:c})),{initialState:e,contentLocale:s,userLocale:a,config:n}}return(null===(i=null==n?void 0:n.context)||void 0===i?void 0:i.topic)&&t.send("action",{type:_r,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext(Object.assign(Object.assign({},n.context),{environment:c})),{initialState:void 0,contentLocale:s,userLocale:a,config:n}}catch(e){if(e instanceof u){const e=new u;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new vn;return r({name:t.name,message:t.message,langKey:t.langKey})}})))),Ir=((e,t,n)=>{const{wait:r=300,maxWait:o=0,leading:i=!1}=null!=n?n:{};let s,a=null,c=null;const l=()=>{clearTimeout(c),c=void 0,s&&(s(!0),s=void 0)};return tn(e,t,{condition:()=>{const e=i&&!a;return clearTimeout(a),a=setTimeout((()=>{l(),a=null}),r),!!e||(s&&(s(!1),s=void 0),o&&!c&&(c=setTimeout(l,o)),new Promise((e=>{s=e})))}})})("resetApp",((e,{dispatch:t,extra:{api:n}})=>Nr(void 0,void 0,void 0,(function*(){yield n.disconnect(),n.clearStore(),t(bn()),yield t(gn()),yield t(Ar()),t(dr())}))),{wait:2e3,leading:!0});const Rr=Object.assign(Object.assign({},{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},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:[]}),Pr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],Lr=(e,t)=>{const n=(i=t,Pr.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:r}=n,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["messages"]);var i;let s=e;return Object.keys(o).length>0&&(s=Object.assign(Object.assign({},s),o)),r&&(s=Object.assign(Object.assign({},s),{messages:Object.assign(Object.assign({},s.messages),r)})),s},Mr=an({name:"config",initialState:Rr,reducers:{setConfig:(e,{payload:t})=>Lr(e,t),updateConfig:(e,{payload:t})=>Lr(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(bn.fulfilled,(e=>e)).addCase(gn.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o,defaultContentLocale:i}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.contentLocale=i,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o}))}}),{setConfig:Dr,updateConfig:Fr,setPreChatEvents:Ur}=Mr.actions,Br=Mr.reducer,zr={userHasResponded:!1},$r=an({name:"app",initialState:zr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(Ir.pending,(()=>zr)).addCase(Ar.fulfilled,((e,{payload:t})=>{var n;t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=null===(n=t.initialState)||void 0===n?void 0:n.userResponded)}))}}),{setHasResponded:Hr}=$r.actions,Vr=$r.reducer;class Wr extends a{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const qr={SeamlyGeneralError:l,SeamlyConfigurationError:c,SeamlySessionExpiredError:u,SeamlyOfflineError:Wr,SeamlyUnauthorizedError:d,SeamlyUnavailableError:vn},Gr=Ut("catch-error",(e=>({payload:e}))),Kr={controls:{}},Jr={value:"",touched:!1},Xr={controls:Jr},Yr=an({name:"forms",initialState:Xr,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{var r;const o=t&&null!==(r=e[n])&&void 0!==r?r:Object.assign(Object.assign({},Kr),{persistData:t});e[n]=o},deregisterForm:(e,{payload:{formId:t}})=>{var n;return(null===(n=e[t])||void 0===n?void 0:n.persistData)||delete e[t],e},registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:Jr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o=Object.assign({},r.controls);return delete o[t],Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},r),{controls:o})})},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls)&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls[n])&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(Ir.pending,(()=>Xr))}}),{registerForm:Zr,deregisterForm:Qr,registerControl:eo,deregisterControl:to,updateControlValue:no,updateControlTouched:ro}=Yr.actions,oo=Yr.reducer;const io=tn("setLocale",((e,{extra:{api:t},rejectWithValue:n})=>{return r=void 0,o=void 0,s=function*(){try{return{translations:yield t.getTranslations(e),userLocale:e}}catch(e){return n(e)}},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,a)}c((s=s.apply(r,o||[])).next())}));var r,o,i,s}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),so={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},ao=an({name:"app",initialState:so,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(Ir.pending,(()=>so)).addCase(gn.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultContentLocale})).addCase(io.pending,(e=>{e.isLoading=!0})).addCase(io.rejected,(e=>{e.isLoading=!1})).addCase(io.fulfilled,((e,{payload:t})=>{e.isLoading=!1,(null==t?void 0:t.translations)&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t.translations[n]})),{}))}))}}),{setInitialLocale:co,setTranslations:lo}=ao.actions,uo=ao.reducer;const po=tn("getConversation",((e,{extra:{api:t},rejectWithValue:n})=>{return r=void 0,o=void 0,s=function*(){try{return t.getConversation()}catch(e){return n({name:null==e?void 0:e.name,message:null==e?void 0:e.message,langKey:null==e?void 0:e.langKey,action:null==e?void 0:e.action,originalEvent:null==e?void 0:e.originalEvent,originalError:null==e?void 0:e.originalError})}},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,a)}c((s=s.apply(r,o||[])).next())}));var r,o,i,s}),{condition(e,{getState:t}){var n;const{state:{events:r}}=t(),o=r[r.length-1],i=null===(n=null==e?void 0:e.lastEvent)||void 0===n?void 0:n.id;return o&&i!==o.payload.id}}),ho={error:void 0},fo=an({name:"interrupt",initialState:ho,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>ho},extraReducers:e=>{e.addCase(gn.pending,(()=>ho)).addMatcher(Xt(Ar.rejected,gn.rejected,io.rejected,ur.rejected,dr.rejected,po.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:mo,clearInterrupt:vo}=fo.actions,yo=fo.reducer,go=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],bo=({type:e,payload:t})=>"hidden"===document.visibilityState||e===pr.message&&!t.fromClient||e===pr.info&&t.type===hr,xo=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),wo=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:i,introduction:s}=t.participant,a=n[r],c=Object.assign(Object.assign({},n),{[r]:a?Object.assign(Object.assign(Object.assign(Object.assign({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return Object.assign(Object.assign({},e),{participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r})},Co=(e,t)=>{var n,r;const o="message"===(null==t?void 0:t.type)?(null==t?void 0:t.payload.translatedEntry)||(null==t?void 0:t.payload.entry):{},{blockAutoEntrySwitch:i}=e,s=(null===(n=null==t?void 0:t.payload)||void 0===n?void 0:n.actions)||{},a=(null===(r=null==t?void 0:t.payload)||void 0===r?void 0:r.translatedActions)||{};if(!o)return Object.assign(Object.assign({},e),{optionsOverride:{},actions:s,translatedActions:a});const{type:c,options:l}=o;let u=e.active;return i||c===e.userSelected||(u=c),Object.assign(Object.assign({},e),{active:u,optionsOverride:Object.assign(Object.assign({},e.optionsOverride||{}),c?{[c]:l}:{}),actions:s,translatedActions:a})},_o={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:g(),optionsButtonId:g(),headerCollapseButtonId:g(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:fr,active:fr,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{},actions:{},translatedActions:{}},seamlyContainerElement:null},jo=an({name:"store",initialState:_o,reducers:{addEvent:(e,t)=>{var n,r;const{type:o,payload:i}=t.payload,s=e.options.features.hasOwnProperty(Or);let a=Object.assign({},e.options);if(s&&(o===pr.message||o===pr.participant)&&!i.fromClient){const e="message"===o?null===(n=i.entry)||void 0===n?void 0:n.type:{};a=Object.assign(Object.assign({},a),{features:Object.assign(Object.assign({},a.features),{uploads:Object.assign(Object.assign({},null===(r=a.features)||void 0===r?void 0:r.uploads),{enabledFromEntry:e===mr})})})}const c=bo(t.payload);if(e.events.find((e=>e.payload.id===i.id)))return;const l=Co(e.entryMeta,t.payload);e.entryMeta=s||l.active!==mr?l:Object.assign({},e.entryMeta),e.options=a,c&&(e.unreadEvents+=1,"service_data"!==o&&(t.payload.payload.messageStatus=i.fromClient?yr:vr)),t.payload.payload.key=g(),e.events.push(t.payload),e.isLastEventFromClient=i.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=xo(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(-1!==t.indexOf(e.payload.id)&&(e.payload=Object.assign(Object.assign({},e.payload),"service_data"!==e.type&&e.payload.messageStatus===vr&&{messageStatus:yr})),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:o={},serviceData:i,resumeConversationPrompt:s}})=>{var a,c,l;const u=((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 xo([...r,...n])})(e.events,t),d=Object.assign(Object.assign({},e.participantInfo.participants),n),p=u.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let h=null;p&&("message"===p.type&&(h=p.payload.participant),"participant"===p.type&&(h=p.payload.participant.id));const{entry:f}=o,m=null===(a=null==f?void 0:f.options)||void 0===a?void 0:a.upload,v=Co(Object.assign(Object.assign(Object.assign({},e.entryMeta),f),{active:(null==f?void 0:f.default)||hr,options:Object.assign({},(null==f?void 0:f.options)?f.options:{})}),u[u.length-1]);let y=Object.assign({},e.options.features);const g=y.hasOwnProperty(Or);if(g&&"message"===(null==p?void 0:p.type)){const{payload:e}=p,t=(null===(c=null==e?void 0:e.entry)||void 0===c?void 0:c.type)||{};y=Object.assign(Object.assign({},y),{uploads:{enabled:!(!m||!(null==m?void 0:m.enabled)),enabledFromEntry:t===mr}})}e.unreadEvents=u.filter((e=>"message"===e.type&&e.payload.messageStatus===vr)).length,e.events=u.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),e.participantInfo=Object.assign(Object.assign(Object.assign({},e.participantInfo),h?wo(e.participantInfo,{participant:d[h]}):{}),{participants:d}),e.historyLoaded=!0,e.serviceInfo=Object.assign(Object.assign({},e.serviceInfo),{activeServiceSessionId:r,proactiveMessages:(null===(l=null==o?void 0:o.proactiveMessages)||void 0===l?void 0:l.enabled)||!1}),e.serviceData=Object.assign(Object.assign({},e.serviceData),i),e.options=Object.assign(Object.assign({},e.options),{features:y}),e.entryMeta=g||v.active!==mr?v:Object.assign({},e.entryMeta),e.resumeConversationPrompt=s||!1,h&&(e.headerTitles.subTitle=d[h].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}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=C(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=wo(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=_o.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?Object.assign(Object.assign({},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?Object.assign(Object.assign({},e),{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?Object.assign(Object.assign({},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(Ir.pending,(()=>_o)).addCase(Ar.pending,(e=>{e.isLoading=!0})).addCase(gn.fulfilled,((e,{payload:t})=>{var n;e.headerTitles.subTitle=null===(n=t.agentParticipant)||void 0===n?void 0:n.name,t.features&&(e.options.features=t.features)})).addCase(Ar.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Xt(Po,Lo),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:Eo,addEvent:So,clearAllUploads:To,clearEvents:Oo,clearFeatures:ko,clearIdleDetachCountdown:No,clearResumeConversationPrompt:Ao,decrementIdleDetachCountdownCounter:Io,hideOption:Ro,initIdleDetachCountdown:Po,initResumeConversationPrompt:Lo,registerUpload:Mo,resetHistoryLoadedFlag:Do,setActiveEntryType:Fo,setActiveService:Uo,setBlockAutoEntrySwitch:Bo,setEventsRead:zo,setFeatureEnabledState:$o,setFeatures:Ho,setHeaderSubTitle:Vo,setHeaderTitle:Wo,setHistory:qo,setInitialState:Go,setIsLoading:Ko,setLoadedImageEventIds:Jo,setParticipant:Xo,setSeamlyContainerElement:Yo,setServiceDataItem:Zo,setServiceEntryMetadata:Qo,clearAbortTransaction:ei,setUploadComplete:ti,setUploadError:ni,setUploadProgress:ri,startProcessingImage:oi,doneProcessingImage:ii,setUserEntryType:si,setUserSelectedOption:ai,setUserSelectedOptions:ci,showOption:li,stopIdleDetachCountdownCounter:ui,setProactiveMessages:di}=jo.actions,pi=jo.reducer,hi=jt((({i18n:e})=>e),(({translations:e})=>e)),fi=jt((({i18n:e})=>e),(({initialLocale:e})=>e)),mi=jt((({i18n:e})=>e),(({userLocale:e})=>e)),vi=jt((({i18n:e})=>e),(({isLoading:e})=>e)),yi={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Jt(),translatedEventGroups:{},translationProposal:null},gi=(e,t)=>{const n=[...e].reduce(((e,{payload:n},r,o)=>{var i;if(e[t]){if("divider"===(null==n?void 0:n.type)&&(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.translationEnabled))return o.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=>{var t;return"divider"===(null===(t=e.payload)||void 0===t?void 0:t.type)})).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},bi=an({name:"translation",initialState:yi,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}=gi(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:i}=gi(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=i},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(Ir.pending,(()=>yi)).addCase(gn.fulfilled,((e,{payload:t})=>{var n;const r=null===(n=null==t?void 0:t.features)||void 0===n?void 0:n.translation;r&&(e.isAvailable=!0===r.enabled,e.languages=[...r.languages].sort(((e,n)=>e.locale===t.defaultContentLocale?-1:n.locale===t.defaultContentLocale?1:e.nativeName.localeCompare(n.nativeName,void 0,{sensitivity:"base"}))))})).addCase(qo,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(io.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(So,((e,{payload:t})=>{e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:xi,disableTranslation:wi,enableEventsTranslation:Ci,disableEventsTranslation:_i,setTranslationProposalPrompt:ji,disableTranslationProposalPrompt:Ei}=bi.actions,Si=bi.reducer,Ti=({dispatch:e,getState:t})=>n=>r=>{var o,i,s,a,c,l,u;const d=n(r);if(qo.match(r)&&(null===(i=null===(o=r.payload)||void 0===o?void 0:o.translation)||void 0===i?void 0:i.enabled))return e(xi(r.payload.translation.locale)),e(io(r.payload.translation.locale)),d;if(gn.fulfilled.match(r)&&r.payload.defaultContentLocale)return e(io(r.payload.defaultContentLocale)),d;if(Ar.fulfilled.match(r))return r.payload.contentLocale&&e(io(r.payload.contentLocale)),d;if(So.match(r)&&"info"===r.payload.type&&(null===(a=null===(s=r.payload)||void 0===s?void 0:s.payload)||void 0===a?void 0:a.body)&&"subtype"in r.payload.payload.body&&"new_translation"===(null===(u=null===(l=null===(c=r.payload)||void 0===c?void 0:c.payload)||void 0===l?void 0:l.body)||void 0===u?void 0:u.subtype)&&r.payload.payload.body.translationEnabled)return e(io(r.payload.payload.body.translationLocale)),d;if(wi.match(r)){const n=fi(t());return e(io(n)),d}return d},Oi=an({name:"visibility",initialState:{visibility:Cn.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(ur.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(gn.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:ki}=Oi.actions,Ni=It({state:pi,app:Vr,config:Br,i18n:uo,translations:Si,visibility:Oi.reducer,forms:oo,interrupt:yo});function Ai({initialState:e,api:t,eventBus:n,config:r}){const o=function(e){const t=Ht(),{reducer:n,middleware:r,devTools:o=!0,preloadedState:i,enhancers:s}=e||{};let a,c;if("function"==typeof n)a=n;else{if(!Nt(n))throw new Error(mn(1));a=It(n)}if(!Gt&&r&&"function"!=typeof r)throw new Error(mn(2));if("function"==typeof r){if(c=r(t),!Gt&&!Array.isArray(c))throw new Error(mn(3))}else c=t();if(!Gt&&c.some((e=>"function"!=typeof e)))throw new Error(mn(4));let l=Rt;o&&(l=Dt({trace:!Gt,..."object"==typeof o&&o}));const u=function(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error(St(15))};const s={getState:o.getState,dispatch:(e,...t)=>i(e,...t)},a=e.map((e=>e(s)));return i=Rt(...a)(o.dispatch),{...o,dispatch:i}}}(...c),d=qt(u);if(!Gt&&s&&"function"!=typeof s)throw new Error(mn(5));let p="function"==typeof s?s(d):d();if(!Gt&&!Array.isArray(p))throw new Error(mn(6));if(!Gt&&p.some((e=>"function"!=typeof e)))throw new Error(mn(7));return Gt||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),At(a,i,l(...p))}({reducer:Ni,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:i,layoutMode:s}=_n(t()),{error:c,type:l}=n,u=qr[null==c?void 0:c.name]?new qr[c.name](c):new a(c);null==r||r(u,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{var r,o,i,s,a,c;try{return(null===(o=null===(r=t.payload)||void 0===r?void 0:r.originalEvent)||void 0===o?void 0:o.payload)?n({error:t.payload,type:null===(a=null===(s=null===(i=t.payload)||void 0===i?void 0:i.originalEvent)||void 0===s?void 0:s.payload)||void 0===a?void 0:a.type}):(null===(c=t.payload)||void 0===c?void 0:c.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===mo.type){if(!go.includes(r.name))throw new l(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 ci.toString():e.store.set("options",n.payload);break;case ai.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Ti)});return o}const Ii=Wn;var Ri,Pi=n(8056);function Li(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Mi(e){return Mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mi(e)}function Di(e){var t=function(e,t){if("object"!=Mi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Mi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Mi(t)?t:String(t)}function Fi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Di(r.key),r)}}function Ui(e,t,n){return(t=Di(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bi(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?Bi(t):t)}),[])}function zi(e){for(var t=function(e){return/\s/.test(e)},n=[],r={},o=0,i=null,s=!1,a=0;a<e.length;){if(s&&(t(e[a])||"{"===e[a]))s=!1,i=e.slice(o,a),"{"===e[a]&&a--;else if(!s&&!t(e[a])){var c="{"===e[a];if(i&&c){var l=$i(e,a);if(-1===l)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));r[i]=e.slice(a+1,l),a=l,i=null}else i&&(n.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&n.push(i),{args:n,cases:r}}function $i(e,t){for(var n=0,r=t+1;r<e.length;r++){var o=e.charAt(r);if("}"===o){if(0===n)return r;n--}else"{"===o&&n++}return-1}function Hi(e){return Vi(e.slice(1,-1),",",3)}function Vi(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return r;if(1===n)return r.push(e),r;var o=e.indexOf(t);if(-1===o)return r.push(e),r;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return r.push(i),Vi(s,t,n-1,r)}function Wi(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 qi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wi(Object(n),!0).forEach((function(t){Ui(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Gi=0,Ki="other";function Ji(e,t){for(var n=0,r="",o=0,i={};n<e.length;){if("#"!==e[n]||o)r+=e[n];else{var s="__hashToken".concat(Gi++);r+="{".concat(s,", number}"),i[s]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:i}}var Xi="other";const Yi=new(function(){function e(t){var n,r,o=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ui(this,"format",(n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Bi(o.process(e,t)).join("")},r={},function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i=t.length?t.map((function(e){return 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(r,i))return r[i];var s=n.apply(void 0,t);return r[i]=s,s})),this.locale=t,this.typeHandlers=i}var t,n;return t=e,n=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var n,r,o=e.indexOf("{");if(-1!==o){var i=$i(e,o);if(-1===i)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var s=e.substring(o,i+1);if(s){var a=[],c=e.substring(0,o);c&&a.push(c);var l=(n=Hi(s),r=3,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw o}}return a}}(n,r)||function(e,t){if(e){if("string"==typeof e)return Li(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Li(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],d=l[1],p=l[2],h=t[u];null==h&&(h="");var f=d&&this.typeHandlers[d];a.push(f?f(h,p,this.locale,t,this.process.bind(this)):h);var m=e.substring(i+1);return m&&a.push(this.process(m,t)),a}}return[e]}}],n&&Fi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}())("en-GB",{plural:function(e){var t=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,o=zi(arguments.length>1&&void 0!==arguments[1]?arguments[1]:""),i=o.args,s=o.cases,a=parseInt(e);i.forEach((function(e){e.startsWith("offset:")&&(a-=parseInt(e.slice(7)))}));var c=[];if("PluralRules"in Intl){void 0!==Ri&&Ri.resolvedOptions().locale===t||(Ri=new Intl.PluralRules(t));var l=Ri.select(a);l!==Ki&&c.push(l)}1===a&&c.push("one"),c.push("=".concat(a),Ki);for(var u=0;u<c.length;u++){var d=c[u];if(d in s){var p=Ji(s[d],a),h=p.caseBody,f=p.numberValues;return r(h,qi(qi({},n),f))}}return e},select:function(e){var t=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,r=zi(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").cases;return e in r?n(r[e],t):Xi in r?n(r[Xi],t):e}});function Zi(){const e=Dn(hi),t=Dn(mi),n=Dn(fi),r=Dn(vi);return{t:(0,Pi.useCallback)(((n,o={})=>{const i=e[n];return i?Yi.format(i,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),null)}),[e,t,r]),userLocale:t,initialLocale:n}}const Qi=()=>{const e=Ii(),t=Dn(ar),n=!!t&&t!==Cn.hidden,r=t===Cn.open,o=t===Cn.minimized,i=(0,Pi.useCallback)((t=>e(ur(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:o,visible:t,setVisibility:i,openChat:()=>{i(Cn.open)},closeChat:()=>{i(Cn.minimized)}}},es=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,i.createRef)()})=>{const[r,o]=(0,Pi.useState)(null),s=!!(null==r?void 0:r.isIntersecting)||!t,a=s&&e,c=([e])=>o(e);return(0,Pi.useEffect)((()=>{const e=null==n?void 0: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:s,containerRef:n}},ts=()=>Dn(xn),ns=(0,i.createContext)(null),rs=(0,i.createContext)(null),os=()=>(0,Pi.useContext)(ns),is=()=>os().store,ss=()=>{const e=os();return(0,Pi.useCallback)((()=>e.hasConversation()),[e])},as=()=>{const e=os(),t=Wn(),n=(0,Pi.useContext)(rs),r=ts(),o=ss(),{visible:i,setVisibility:s}=Qi(),a=er(),c=(0,Pi.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,Pi.useCallback)((()=>{c("ui.beforeStart",{visibility:i,hasConversation:o(),hasResponded:r,unreadMessageCount:a}),e.send("start"),c("ui.start",{visibility:i,hasConversation:o(),hasResponded:r,unreadMessageCount:a})}),[e,c,o,r,a,i]),u=(0,Pi.useCallback)((async()=>{t(Ir())}),[t]),d=(0,Pi.useCallback)((e=>({type:e,id:g(),transactionId:g(),participant:h,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),p=(0,Pi.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,Pi.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const o={...p(n),...r};e.send("message",o),c("message",o),t(So({type:"message",payload:{...o,optimisticallyInjected:!0}}))}),[e,t,c,p]),m=(0,Pi.useCallback)(((e,n=g())=>{t(So({type:"message",payload:{...p(e),transactionId:n}}))}),[t,p]),v=(0,Pi.useCallback)(((e,n,r,o,i,s,a)=>{t(So({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:h,fromClient:!0,occurredAt:r,meta:{},body:{contentType:o,filename:i,filesize:s,url:a}}}))}),[t]),y=(0,Pi.useCallback)(((e,n=g())=>{const r={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:g(),transactionId:n,type:"divider"};t(So({type:"info",payload:r}))}),[t]),b=(0,Pi.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==br&&n!==xr&&c(`action.${n}`,t)}),[e,c]),x=(0,Pi.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,Pi.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(Go(e)),e.userResponded&&(t(Hr(e.userResponded)),s(Cn.open)))})).catch((e=>{t(mo({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,s]);return{connect:w,start:l,sendMessage:f,sendAction:b,sendContext:x,reset:u,emitEvent:c,addMessageBubble:m,addUploadBubble:v,addDivider:y,apiConnected:e.connected,apiConfigReady:e.configReady}},cs=(0,i.createContext)(null),ls=()=>{const e=(0,Pi.useContext)(cs);return{sendPolite:(0,Pi.useCallback)((t=>{t&&e({ariaLive:Sr,messageText:t})}),[e]),sendAssertive:(0,Pi.useCallback)((t=>{t&&e({ariaLive:Er,messageText:t})}),[e])}},us=jt((({interrupt:e})=>e),(({error:e})=>e)),ds=jt(us,(e=>Boolean(e)));function ps(){const{t:e}=Zi(),t=Dn(us),n=Dn(ds),r=(0,Pi.useMemo)((()=>{if(!n)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0};const{langKey:r,action:o}=t,i=e(`${r}.title`),s=e(`${r}.message`),a=e(`${r}.srText`),c=o?e(`${r}.buttonText`):null;return Object.assign(Object.assign(Object.assign(Object.assign({},r?{title:i,message:s,srText:a}:{}),o?{action:o}:{}),o&&r?{buttonText:c}:{}),{originalError:t})}),[n,t,e]);return{hasError:n,meta:r,error:t}}const hs=()=>{const{t:e}=Zi(),{isInline:t,isWindow:n,isApp:r}=sr(),{isOpen:o,isVisible:i}=Qi(),s=Dn(cr),{start:a,connect:c,apiConfigReady:u,apiConnected:d}=as(),p=(0,Pi.useRef)(!1),{sendAssertive:h}=ls();!function(){const{meta:{originalError:e,action:t}}=ps(),n=Ii(),{reset:r}=as(),o="SeamlySessionExpiredError"===(null==e?void 0:e.name),i=(0,Pi.useRef)(0),s=(0,Pi.useRef)(null);(0,Pi.useEffect)((()=>{if(o&&"reset"===t){if(i.current>=10){s.current=setTimeout((()=>{i.current=0}),1e4);const e=new l;return n(mo({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}i.current+=1,r()}return()=>{s.current&&clearTimeout(s.current)}}),[t,r,o,n])}(),(0,Pi.useEffect)((()=>{i&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[i,h,e]),(0,Pi.useEffect)((()=>{i&&h(e(o?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[o,i,h,e]),(0,Pi.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,Pi.useCallback)((()=>{return e=void 0,n=void 0,l=function*(){d||(p.current=!0,yield c()),(r||o||i&&t)&&a()},new((s=void 0)||(s=Promise))((function(t,r){function o(e){try{a(l.next(e))}catch(e){r(e)}}function i(e){try{a(l.throw(e))}catch(e){r(e)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof s?n:new s((function(e){e(n)}))).then(o,i)}a((l=l.apply(e,n||[])).next())}));var e,n,s,l}),[d,c,r,t,o,i,a]);(0,Pi.useEffect)((()=>{!u||p.current||n&&!o||!(!t||i&&s)||f()}),[u,f,t,o,i,n,s])},fs=({children:t})=>(hs(),(0,e.jsx)(e.Fragment,{children:t})),ms=(0,i.createContext)({}),vs=e=>jt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>{var n;return!t.includes(null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.id)})))),ys=require("preact/compat"),gs=()=>{const e=os();return(0,ys.useSyncExternalStore)(oe.subscribe,(()=>e.conversation))},bs=(e=0)=>new Promise((t=>{setTimeout(t,e)})),xs=()=>{const{seamlyContainerElement:e}=Jn(),t=Wn();return[e,(0,Pi.useCallback)((e=>{t(Yo(e))}),[t])]},ws=e=>(0,Pi.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await bs(180);const e="string"==typeof t?document.getElementById(t):t;T(e)}))}),[e]),Cs=()=>{const e=tr();return ws(e)},_s=()=>qn().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},Es=(0,i.createContext)({}),Ss=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=Jn(),{allowedMimeTypes:o,maxSize:i}=n.upload||{},{enabled:s,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...o?{allowedMimeTypes:o}:{},...i?{maxSize:i}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:l}},Ts=()=>{const{currentUploads:e}=Jn(),t=Wn(),n=(0,Pi.useContext)(Es);return{uploadFile:(0,Pi.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,Pi.useCallback)((()=>{t(To())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},Os=()=>{const{t:e}=Zi(),{options:t}=Jn(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:i}=t,{extraMenuItem:s,sendTranscript:a}=i,c={extraMenuItem:s,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=s||a,p=Wn(),{get:h,set:f}=is();return{allowOptionSelection:d,userSelectedOptions:o,features:i,menuOptions:u,initUserSelectedOptions:(0,Pi.useCallback)((()=>{const e=h("options")||{};p(ci(e))}),[h,p]),setUserSelectedOptions:(0,Pi.useCallback)((e=>{p(ci(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,Pi.useCallback)(((e,t)=>{const n=h("options")||{};f("options",{...n,[e]:t}),p(ai({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(li(e))},hideOption:()=>{p(Ro())},panelActive:n,optionActive:r}},ks=()=>{const{optionsButtonId:e}=Jn();return{id:e,focusButton:ws(e)}},Ns=(0,i.createContext)(null),As=()=>(0,Pi.useContext)(Ns),Is=()=>{const e=Wn(),{idleDetachCountdown:t}=Jn(),{isOpen:n}=Qi(),r=(0,Pi.useRef)({});r.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:n};const{emitEvent:o,sendAction:i}=as(),{t:s}=Zi(),{sendAssertive:a,sendPolite:c}=ls(),l=(0,Pi.useCallback)((e=>{const{isOpen:t}=r.current;t&&a(e)}),[a]),u=(0,Pi.useCallback)((e=>{const{isOpen:t}=r.current;t&&c(e)}),[c]),d=(0,Pi.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=C(n);e(Po({delaySeconds:n,delayTime:r})),o("idleTimer.start"),l(`${s("idleDetachWarning.countdownTitle")} ${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",r)}`)}),[e,o,l,s]),p=(0,Pi.useCallback)(((t,n)=>{const{hasCountdown:a,wasStopped:c}=r.current;a&&(t||(n||i({type:wr}),l(s("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e(No()))}),[e,i,o,l,s]),h=(0,Pi.useCallback)((()=>{const{remaining:t}=r.current;if(t<=0)return;const n=t-1;n%10==0&&l(`${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",C(n))}`),e(Io())}),[e,l,s]),f=(0,Pi.useCallback)((()=>{const{isActive:t,remaining:n}=r.current;t&&(e(ui()),n&&(o("idleTimer.stop"),u(s("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,u,s]);return{...t,initCountdown:d,endCountdown:p,decrementCountdown:h,stopCountdown:f}},Rs=()=>{const e=Wn(),t=Jn().resumeConversationPrompt,{sendAction:n}=as(),{t:r}=Zi(),{sendAssertive:o}=ls();return{continueChat:()=>{n({type:Cr,body:{type:"resume_conversation_prompt"}}),e(Ao())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:wr}),e(Ao())}}},Ps=()=>{const[e]=(0,Pi.useState)((()=>g()));return e},Ls=e=>{const t=(0,Pi.useRef)(null);t.current=e;const n="function"==typeof e;return(0,Pi.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},Ms=(e,t)=>{const n=gs();(0,Pi.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])};function Ds(){const{sendContext:e}=as(),t=Wn(),n=qn(),r=(0,Pi.useCallback)((t=>{e({userLocale:t})}),[e]),o=(0,Pi.useCallback)((()=>{e({userLocale:n.context.userLocale}),t(wi())}),[n.context,t,e]),{languages:i,isActive:s,isAvailable:a,currentLocale:c}=Dn((({translations:e})=>e));return{languages:i,isActive:s,isAvailable:a,currentLocale:c,enableTranslations:r,disableTranslations:o}}function Fs(e){const{translatedBody:t,translation:n,body:r}=(null==e?void 0:e.payload)?"participant"===e.type?{body:null===(o=e.payload)||void 0===o?void 0:o.participant.introduction,translatedBody:null===(s=null===(i=e.payload)||void 0===i?void 0:i.participant)||void 0===s?void 0:s.translatedIntroduction,translation:null===(c=null===(a=e.payload)||void 0===a?void 0:a.participant)||void 0===c?void 0:c.translation}:{body:e.payload.body,translatedBody:e.payload.translatedBody,translation:null===(l=null==e?void 0:e.payload)||void 0===l?void 0:l.translation}:{body:void 0,translatedBody:void 0};var o,i,s,a,c,l;const u=!!t,d=Dn(vs(e));return{body:u&&d?t:r,hasTranslation:u,isTranslated:d&&u,locale:null==n?void 0:n.locale}}function Us(){const e=Dn((({translations:e})=>e.containerId));return{id:e,focusContainer:ws(e)}}function Bs(e){const{languages:t}=Ds();return(0,Pi.useMemo)((()=>{var n;return null===(n=null==t?void 0:t.find((t=>t.locale===e)))||void 0===n?void 0:n.nativeName}),[e,t])}const zs=()=>{const{isActive:e,languages:t}=Ds(),n=Wn(),{sendAction:r}=as(),{translationProposal:o}=Dn((e=>e.translations)),{enableTranslations:i}=Ds(),{isOpen:s}=Qi(),{userLocale:a}=Zi(),c=null==o?void 0:o.proposedLocale,l=Bs(c),u=(0,Pi.useMemo)((()=>null!==o&&!e&&s&&a!==c&&t.some((e=>e.locale===c))),[o,e,s,a,c,t]);return{activateTranslationProposal:()=>{i(null==o?void 0:o.proposedLocale)},dismissTranslationProposal:()=>{r({type:Cr,body:{type:"translation_proposal"}}),n(Ei())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}},$s=(...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.length)).map((e=>e.indexOf(p)>-1?e:[p,e].join("-"))).join(" "),Hs=({eventPayload:t})=>{const{t:n}=Zi(),{fromClient:r,participant:o}=t,i=(e=>Jn().participantInfo.participants[e])(o)||{},{messages:s}=qn(),a=r?n("participants.user.name"):i&&i.name,{showAvatar:c,showName:l}=s[r?"user":"agent"]||{};if(!c&&!l)return null;const u=[];return c&&a&&i.avatar&&u.push((0,e.jsx)("span",{className:$s("message__avatar"),children:(0,e.jsx)("img",{src:i.avatar,className:$s("avatar"),alt:""})})),l&&a&&u.push((0,e.jsx)("span",{className:$s("message__author-name"),children:a})),u.length>0&&(0,e.jsx)("div",{className:$s("message__author"),children:u})},Vs=function({showParticipant:t=!0,event:n,type:r,modifiers:o,children:i,bodyProps:s={},info:a,...c}){const l=js(n),{hasTranslation:u,isTranslated:d,locale:p}=Fs(n);return r&&l.push(`message--type-${r}`),o&&("string"==typeof o&&(o=o.split(" ").filter((e=>e.length))),o.forEach((e=>{l.push(`message--${e}`)}))),d&&l.push("message--is-translated"),u&&l.push("message--has-translation"),d&&(s={...s,lang:p}),(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:$s(l),...c,children:[t&&(0,e.jsx)(Hs,{eventPayload:n.payload}),(0,e.jsx)("div",{className:$s("message__body"),...s,children:i}),a&&(0,e.jsx)("div",{"aria-hidden":"true",className:$s("message__info"),children:a})]})})},Ws=({id:t,action:n,buttonText:r,description:o,hasFocus:i,image:s,title:a,isCarouselItem:c})=>{const l=(0,Pi.useRef)(null),{sendMessage:u,sendAction:d,emitEvent:p}=as(),h=Ps(),f=(0,Pi.useRef)(!1),m=n.type===kr?"a":"button",v=(0,Pi.useCallback)((()=>p("action.click_card",{type:jr,originMessage:t,action:n})),[p,t,n]),y=(0,Pi.useCallback)((()=>{if(v(),"ask"===n.type)u({body:n.ask});else if("topic"===n.type){const{topic:e,fallbackMessage:t}=n;d({type:_r,body:{name:e,fallbackMessage:t}})}}),[u,n,d,v]),g=(0,Pi.useMemo)((()=>n.type===kr?{href:n.link,rel:"noopener noreferrer",target:n.newTab?"_blank":"_self",onClick:v}:{onClick:y}),[n,y,v]);return(0,Pi.useEffect)((()=>{c&&(i&&f.current?window.requestAnimationFrame((()=>l.current.focus())):l.current.blur()),f.current=!0}),[i,c]),(0,e.jsxs)("div",{className:$s("card__wrapper"),id:t,tabIndex:-1,ref:l,children:[s?(0,e.jsx)("img",{className:$s("card__image"),src:s,alt:""}):null,(0,e.jsxs)("div",{className:$s("card__content"),id:t,children:[a&&(0,e.jsx)("h2",{className:$s("card__title"),children:a}),o&&(0,e.jsx)("div",{className:$s("card__description"),dangerouslySetInnerHTML:{__html:o}}),(0,e.jsx)(m,Object.assign({tabIndex:c&&!i?-1:void 0,className:$s("button","button--primary"),"aria-describedby":h},g,{children:r}))]})]})};function qs({item:t,items:n,index:r,isActive:o}){const{t:i}=Zi();return(0,e.jsx)("div",{className:$s("carousel-item",`carousel-item--${t.type}`),role:"group","aria-roledescription":"slide","aria-label":i("carousel.slide.label",{index:r+1,total:n.length}),children:(0,e.jsx)(Ws,{...t,isCarouselItem:!0,hasFocus:o})})}const Gs={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'}},Ks=({name:t,size:n="32",className:r,alt:o})=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{"aria-hidden":"true",className:r||$s("icon"),dangerouslySetInnerHTML:{__html:Gs[t][n]}}),o&&(0,e.jsx)("span",{className:$s("visually-hidden"),children:o})]});function Js({items:t,currentIndex:n,onChange:r,children:o}){const{t:i}=Zi(),s=t.length;return(0,e.jsxs)("div",{className:$s("carousel-controls"),children:[(0,e.jsx)("button",{className:$s("button","button--previous"),"aria-label":i("carousel.controls.previous"),onClick:()=>{r((n-1+s)%s)},children:(0,e.jsx)(Ks,{name:"arrowLeft",size:"16",alt:""})}),o,(0,e.jsx)("button",{className:$s("button","button--next"),"aria-label":i("carousel.controls.next"),onClick:()=>{r((n+1)%s)},children:(0,e.jsx)(Ks,{name:"arrowRight",size:"16",alt:""})})]})}function Xs({items:t,currentIndex:n,onChange:r,getItemKey:o,getItemLabel:i}){const s=t.length,a=(0,Pi.useCallback)((e=>{const t=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,t));o!==n&&r(o)}),[s,n,r]);return(0,e.jsx)("div",{className:$s("carousel-pagination__wrapper"),role:"group",children:(0,e.jsx)("ul",{className:$s("carousel-pagination"),children:t.map(((t,r)=>{const s=n===r;return(0,e.jsx)("li",{className:$s("carousel-pagination__item",s?"is-active":void 0),children:(0,e.jsx)("button",{className:$s("carousel-pagination__button"),type:"button",onClick:a,"data-item":r,"aria-disabled":s?"true":void 0,"aria-label":i(t,r)})},o(t,r,"pagination-item-"))}))})})}const Ys=(e,t,n)=>`${n}${t}`,Zs=e=>e.label,Qs=({target:e})=>{e.scrollLeft=0};function ea({currentIndex:t,onChange:n,getItemKey:r=Ys,getItemLabel:o=Zs,items:s}){const a=Ps(),c=s.length,[l,u]=(0,Pi.useState)(Number(t||"0"));(0,Pi.useEffect)((()=>{u(Number(t||"0"))}),[u,t]);const d=(0,Pi.useRef)([]);d.current=(0,Pi.useMemo)((()=>Array(c).fill(1).map((()=>(0,i.createRef)()))),[c]);const p=(0,Pi.useRef)(!0),h=(0,Pi.useRef)();return h.current=n,(0,Pi.useEffect)((()=>{p.current?p.current=!1:h.current&&h.current(l)}),[l]),(0,e.jsxs)("div",{className:$s("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,e.jsx)("div",{className:$s("carousel__slides-wrapper"),onScroll:Qs,children:(0,e.jsx)("div",{id:a,className:$s("carousel__slides"),style:{width:100*c+"%",left:-100*l+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((t,n)=>{const o=l===n;return(0,e.jsx)("div",{ref:d.current[n],className:$s("carousel__slide",o?"is-active":void 0),"aria-hidden":o?void 0:"true",children:(0,e.jsx)(qs,{item:t,items:s,currentIndex:l,index:n,isActive:o})},r(t,n,"item-"))}))})}),(0,e.jsx)("div",{className:$s("carousel__controls"),children:(0,e.jsx)(Js,{currentIndex:l,items:s,onChange:u,controlId:a,children:(0,e.jsx)("div",{className:$s("carousel__pagination"),children:(0,e.jsx)(Xs,{currentIndex:l,items:s,onChange:u,getItemKey:r,getItemLabel:o})})})})]})}const ta=(e,t,n="")=>`${n}${e.title}:${t}`,na=e=>e.title,ra=e=>{const{payload:t}=e,[n,r]=(0,Pi.useState)(!1),{sendAction:o,addMessageBubble:i,addDivider:s}=as(),{activeServiceSessionId:a}=nr(),c=Dn(rr),{body:l}=Fs(e),{service:u}=t,d=(0,Pi.useMemo)((()=>({...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,Pi.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:d,showOptions:n,chooseAgain:p,onChoiceClickHandler:e=>{const n=g();p&&s("new_topic",n),i(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))}}},oa=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,ia=({id:t,categories:n=[],question:r,onClick:o,hasIcon:i})=>{const s=(0,Pi.useMemo)((()=>["suggestions__item",...n.map(oa)]),[n]),a=(0,Pi.useCallback)((()=>{o&&o({id:t,question:r})}),[t,r,o]);return(0,e.jsx)("li",{className:$s(s),children:(0,e.jsxs)("button",{type:"button",onClick:a,className:$s("button","button--primary"),children:[i&&(0,e.jsx)(Ks,{name:"chevronRight",size:"8",alt:""}),r]})})},sa=({className:t,suggestions:n=[],onClickSuggestion:r,hasIcon:o=!0})=>(0,e.jsx)("ul",{className:$s("suggestions__list",t),children:n.map((t=>(0,e.jsx)(ia,{hasIcon:o,onClick:r,...t},t.id)))}),aa=e=>{const{sendAction:t}=as();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}};function ca({children:t,childrenHTML:n,className:r,graphicSrc:o,graphicType:i="icon",iconName:s,iconSize:a,iconClassName:c,dividerType:l}){const u=Boolean(s||o),d=n?{dangerouslySetInnerHTML:{__html:n}}:{children:t};return(0,e.jsxs)("div",{className:$s("divider",l&&`divider--type-${l}`,r),children:[u&&(0,e.jsx)("span",{className:$s("divider__graphic"),children:s?(0,e.jsx)(Ks,{name:s,size:a,className:c,alt:""}):(0,e.jsx)("img",{src:o,className:$s({icon:"icon"===i,avatar:"avatar"===i},c)})}),(0,e.jsx)("div",{className:$s("divider__body"),...d})]})}const la={[Tr.new_topic]:"newtopic"},ua={default:({event:t})=>{const{t:n}=Zi(),{subtype:r}=t.payload.body,o=la[Tr[r]];return(0,e.jsx)(ca,{dividerType:o,iconName:Tr[r],children:(0,e.jsx)("p",{children:n(`dividerKeys.${Tr[r]}`)})})},[Tr.new_translation]:({event:t})=>{const{t:n}=Zi(),r=Zn(),{body:{translationEnabled:o,text:i,title:s},id:a}=t.payload,c=Dn((e=>e.translations.translatedEventGroups)),l=Wn(),u=(0,Pi.useCallback)((()=>{c[a]?l(Ci({events:r,id:a})):l(_i({events:r,id:a}))}),[l,r,a,c]);return(0,e.jsxs)(ca,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,e.jsx)("p",{className:$s("divider__title"),children:s}),i&&(0,e.jsx)("p",{children:i}),o?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("button",{className:$s("button","button--secondary"),onClick:u,children:n(c[a]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null]})}},da={month:"long",day:"numeric",year:"numeric"},pa={hour:"numeric",minute:"numeric"},ha=({event:t})=>{const n=(()=>{const[e,t]=(0,Pi.useReducer)((e=>e+1),0);return(0,Pi.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:r,time:o,timeUntilMidnight:i,srText:s}=(e=>{const{t}=Zi(),n=qn(),r=n?.context?.locale??[],o=new Date(e),i=new Date,s=new Date(i);s.setHours(24,0,0,0);const a=s-i,c=o.toString(),l=new Intl.DateTimeFormat(r,pa).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,i);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,da).format(o)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:a}})(w(t.timeIndicator));return(0,Pi.useEffect)((()=>{const e=setTimeout((()=>{n()}),i);return()=>{clearTimeout(e)}}),[n,i]),(0,e.jsxs)(ca,{dividerType:"time-indicator",children:[(0,e.jsxs)("p",{className:$s("divider__time"),"aria-hidden":"true",children:[(0,e.jsx)("span",{children:r}),(0,e.jsx)("span",{children:o})]}),(0,e.jsx)("p",{className:$s("visually-hidden"),children:s})]})};var fa=["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])"],ma=fa.join(","),va="undefined"==typeof Element,ya=va?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ga=!va&&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},ba=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)},xa=function(e,t,n){if(ba(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ma));return t&&ya.call(e,ma)&&r.unshift(e),r.filter(n)},wa=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!ba(s,!1))if("SLOT"===s.tagName){var a=s.assignedElements(),c=e(a.length?a:s.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{ya.call(s,ma)&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var l=s.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(s),u=!ba(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(l&&u){var d=e(!0===l?s.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:s,candidates:d})}else i.unshift.apply(i,s.children)}}return o},Ca=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},_a=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))&&!Ca(e)?0:e.tabIndex},ja=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ea=function(e){return"INPUT"===e.tagName},Sa=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Ta=function(e,t){return!(t.disabled||ba(t)||function(e){return Ea(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=ya.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ya.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Sa(e)}else{if("function"==typeof r){for(var i=e;e;){var s=e.parentElement,a=ga(e);if(s&&!s.shadowRoot&&!0===r(s))return Sa(e);e=e.assignedSlot?e.assignedSlot:s||a===e.ownerDocument?s:a.host}e=i}if(function(e){var t,n,r,o,i=e&&ga(e),s=null===(t=i)||void 0===t?void 0:t.host,a=!1;if(i&&i!==e)for(a=!!(null!==(n=s)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(s)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&s;){var c,l,u;a=!(null===(l=s=null===(c=i=ga(s))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(s))}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!!ya.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Oa=function(e,t){return!(function(e){return function(e){return Ea(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ga(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)||_a(t)<0||!Ta(e,t))},ka=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Na=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,s=i?t.scopeParent:t,a=function(e,t){var n=_a(e);return n<0&&t&&!Ca(e)?0:n}(s,i),c=i?e(t.candidates):s;0===a?i?n.push.apply(n,c):n.push(s):r.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:c})})),r.sort(ja).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Aa=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ya.call(e,ma)&&Oa(t,e)},Ia=fa.concat("iframe").join(","),Ra=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ya.call(e,Ia)&&Ta(t,e)};function Pa(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 La(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pa(Object(n),!0).forEach((function(t){var r,o,i;r=e,o=t,i=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:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ma=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},Da=function(e){return Ma(e)&&!e.shiftKey},Fa=function(e){return Ma(e)&&e.shiftKey},Ua=function(e){return setTimeout(e,0)},Ba=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},za=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},$a=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},Ha=[],Va=function(e,t){var n,r=(null==t?void 0:t.document)||document,o=(null==t?void 0:t.trapStack)||Ha,i=La({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Da,isKeyBackward:Fa},t),s={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]:i[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return s.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=i[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),s=1;s<n;s++)o[s-1]=arguments[s];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||!Ra(e,i.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=s.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(s.containerGroups=s.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?wa([e],t.includeContainer,{filter:Oa.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:ka}):xa(e,t.includeContainer,Oa.bind(null,t)),Na(n)}(e,i.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?wa([e],t.includeContainer,{filter:Ta.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):xa(e,t.includeContainer,Ta.bind(null,t))}(e,i.tabbableOptions),r=t.length>0?t[0]:void 0,o=t.length>0?t[t.length-1]:void 0,s=n.find((function(e){return Aa(e)})),a=n.slice().reverse().find((function(e){return Aa(e)})),c=!!t.find((function(e){return _a(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:o,firstDomTabbableNode:s,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 Aa(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return Aa(e)})):t[o+(r?1:-1)]}}})),s.tabbableGroups=s.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),s.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(s.containerGroups.find((function(e){return e.posTabIndexesFound}))&&s.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:!!i.preventScroll}),s.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||$a(n),d();var a=null;if(s.tabbableGroups.length>0){var u=c(t,n),p=u>=0?s.containerGroups[u]:void 0;if(u<0)a=o?s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:s.tabbableGroups[0].firstTabbableNode;else if(o){var h=Ba(s.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||Ra(t,i.tabbableOptions)&&!Aa(t,i.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?s.tabbableGroups.length-1:h-1,m=s.tabbableGroups[f];a=_a(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else Ma(n)||(a=p.nextTabbableNode(t,!1))}else{var v=Ba(s.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(v<0&&(p.container===t||Ra(t,i.tabbableOptions)&&!Aa(t,i.tabbableOptions)&&!p.nextTabbableNode(t))&&(v=u),v>=0){var y=v===s.tabbableGroups.length-1?0:v+1,g=s.tabbableGroups[y];a=_a(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else Ma(n)||(a=p.nextTabbableNode(t))}}else a=l("fallbackFocus");return a},v=function(e){var t=$a(e);c(t,e)>=0||(za(i.clickOutsideDeactivates,e)?n.deactivate({returnFocus:i.returnFocusOnDeactivate}):za(i.allowOutsideClick,e)||e.preventDefault())},y=function(e){var t=$a(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(s.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var o=!0;if(s.mostRecentlyFocusedNode)if(_a(s.mostRecentlyFocusedNode)>0){var a=c(s.mostRecentlyFocusedNode),l=s.containerGroups[a].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===s.mostRecentlyFocusedNode}));d>=0&&(i.isKeyForward(s.recentNavEvent)?d+1<l.length&&(r=l[d+1],o=!1):d-1>=0&&(r=l[d-1],o=!1))}}else s.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return _a(e)>0}))}))||(o=!1);else o=!1;o&&(r=m({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),h(r||s.mostRecentlyFocusedNode||u())}s.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!==za(i.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(i.isKeyForward(e)||i.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(Ma(e)&&e.preventDefault(),h(n))}(e,i.isKeyBackward(e))},b=function(e){var t=$a(e);c(t,e)>=0||za(i.clickOutsideDeactivates,e)||za(i.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},x=function(){if(s.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),s.delayInitialFocusTimer=i.delayInitialFocus?Ua((function(){h(u())})):h(u()),r.addEventListener("focusin",y,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",b,{capture:!0,passive:!1}),r.addEventListener("keydown",g,{capture:!0,passive:!1}),n},w=function(){if(s.active)return r.removeEventListener("focusin",y,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",b,!0),r.removeEventListener("keydown",g,!0),n},C="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===s.mostRecentlyFocusedNode}))}))&&h(u())})):void 0,_=function(){C&&(C.disconnect(),s.active&&!s.paused&&s.containers.map((function(e){C.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return s.active},get paused(){return s.paused},activate:function(e){if(s.active)return this;var t=a(e,"onActivate"),n=a(e,"onPostActivate"),o=a(e,"checkCanFocusTrap");o||d(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var i=function(){o&&d(),x(),_(),null==n||n()};return o?(o(s.containers.concat()).then(i,i),this):(i(),this)},deactivate:function(e){if(!s.active)return this;var t=La({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},e);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,w(),s.active=!1,s.paused=!1,_(),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(){Ua((function(){u&&h(f(s.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(f(s.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){if(s.paused||!s.active)return this;var t=a(e,"onPause"),n=a(e,"onPostPause");return s.paused=!0,null==t||t(),w(),_(),null==n||n(),this},unpause:function(e){if(!s.paused||!s.active)return this;var t=a(e,"onUnpause"),n=a(e,"onPostUnpause");return s.paused=!1,null==t||t(),d(),x(),_(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return s.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),s.active&&d(),_(),this}},n.updateContainerElements(e),n};const Wa=({children:e,onClose:t,"aria-label":n,"aria-labelledby":r,fallBackFocusRef:o})=>{const s=Ps(),a=(0,Pi.useRef)(null),c=(0,Pi.useRef)(null),[l,u]=(0,Pi.useState)(!1);return(0,Pi.useEffect)((()=>(l&&(c.current=Va(a.current,{initialFocus:o&&o.current?o.current:null}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,o]),(0,Pi.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||(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,Pi.useEffect)((()=>{l&&a.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,Pi.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",s),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),n&&t.setAttribute("aria-label",n),r&&t.setAttribute("aria-labelledby",r),e.appendChild(t),a.current=t,u(!0),()=>{a.current&&(e.removeChild(a.current),a.current=null)}}),[n,r,s]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>a.current&&(0,i.render)(e,a.current)}):a.current&&(0,i.render)((0,i.toChildArray)(e).map((e=>(e.props={...e.props,onClose:t},e))),a.current)},qa=({url:t,description:n,onClose:r})=>{const{zIndex:o,layoutMode:i,namespace:s}=qn(),a=As(),c=_s(),l=(0,Pi.useRef)(null),{t:u}=Zi(),d=["modal",`app--layout-${i}`,`namespace--${s}`,...c],p=e=>{e.stopPropagation()},h=()=>{r()},f=o?{zIndex:o+1}:void 0;return(0,e.jsx)(Wa,{onClose:r,"aria-label":u("lightbox.heading"),fallBackFocusRef:l,children:({onClose:r,modalRenderFn:o})=>o((r=>(0,e.jsx)("div",{className:$s(d),onClick:h,style:f,children:(0,e.jsxs)("div",{className:$s("modal__float"),tabIndex:"-1",onMouseDown:a,onKeyDown:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,ref:l,children:[(0,e.jsx)("div",{className:$s("modal__inner"),onClick:p,children:(0,e.jsx)("img",{className:$s("modal__image"),src:t,alt:n})}),(0,e.jsxs)("button",{type:"button",className:$s("modal__close"),onClick:r,children:[(0,e.jsx)(Ks,{name:"close",size:"16",alt:""}),u("lightbox.closeLabel")]})]})}))(r))})},Ga=({description:t,url:n})=>{const{t:r}=Zi(),[o,i]=(0,Pi.useState)(!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:$s("modal__enlarge"),onClick:()=>{i(!0)},children:[r("message.image.srTextEnlargeButtonLabel",{description:t}),(0,e.jsx)(Ks,{name:"enlarge",size:"32",alt:""})]}),o&&(0,e.jsx)(qa,{url:n,description:t,onClose:()=>{i(!1)}})]})},Ka=({event:t,...n})=>{const{body:r}=Fs(t),o=aa(t.payload.id),i=(0,Pi.useMemo)((()=>t.payload.optimisticallyInjected?{children:(0,e.jsx)("p",{children:r.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:r?.data?.text||r.text}}}),[r,t]);return(0,e.jsx)(Vs,{type:"text",event:t,onClick:o,...n,...i})},Ja="PROCESSING_IMAGE",Xa=({img:t,filename:n})=>{const{t:r}=Zi(),o=r("fileUpload.srFileUploadedText",{fileName:n});return(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("span",{className:$s(["download","download--preview"]),children:[(0,e.jsx)("img",{src:t,alt:o}),(0,e.jsx)("span",{"aria-hidden":"true",className:$s("file-download"),children:n})]})})},Ya=({children:t,url:n,target:r})=>n?(0,e.jsx)("a",{href:n,download:!0,target:r,className:$s(["download","download-link"]),children:t}):(0,e.jsx)("span",{className:$s("download"),children:t}),Za={message:{choice_prompt:({event:t,children:n,...r})=>{const{t:o}=Zi(),s=Ps(),{body:a,subEvent:c,showOptions:l,chooseAgain:u,onChoiceClickHandler:d,onChooseAgainClickHandler:p}=ra(t);return(0,e.jsxs)(e.Fragment,{children:[(0,i.toChildArray)(n).map((e=>(e.props={...e.props,event:c,descriptorId:s,showTranslationToggle:!1},e))),u&&(0,e.jsxs)("button",{type:"button",className:$s("button","button--secondary","button--choose-again"),"aria-expanded":l?"true":"false",onClick:p,"aria-describedby":s,children:[o(l?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,e.jsx)(Ks,{name:"chevronDown",size:"8",alt:""})]}),l&&(0,e.jsx)(Vs,{type:"choice-prompt",showParticipant:!1,event:t,...r,children:(0,e.jsx)("ul",{className:$s("choice-prompt","choice-prompt--many"),children:a.choices.map((t=>(0,e.jsx)("li",{className:$s("choice-prompt__item",{[`choice-prompt__item--${t.category}`]:t.category}),children:(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{d(t)},children:t.text})},t.id)))})})]})},text:Ka,image:({event:t,descriptorId:n,...r})=>{const{body:o}=Fs(t),{description:i,url:s,isZoomable:a}=o,[c,l]=(0,Pi.useState)(!1),u=Wn();return(0,e.jsxs)(Vs,{event:t,type:"image",...r,children:[(0,e.jsx)("img",{src:s,id:n,alt:i,onLoad:()=>{u(Jo(t.payload.id)),l(!0)}}),a&&c&&(0,e.jsx)(Ga,{description:i,url:s})]})},splash:({event:t,...n})=>{const{payload:r}=t,{body:o}=Fs(t),i=aa(r.id);return(0,e.jsx)(Vs,{type:"splash",event:t,onClick:i,...n,bodyProps:{dangerouslySetInnerHTML:{__html:o.text}}})},video:({event:t,descriptorId:n,...r})=>{const{body:o}=Fs(t),{description:i,url:s}=o;return js(t).push("message--type-video"),(0,e.jsxs)(Vs,{event:t,type:"video",...r,children:[(0,e.jsx)("div",{id:n,className:$s("visually-hidden"),children:i}),(0,e.jsx)("iframe",{title:i,src:s,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:t,...n})=>{const{t:r}=Zi(),{body:o}=Fs(t),{fromClient:i,id:s}=t.payload,{filename:a,url:c}=o,l=(e=>{const{processingFileUploads:t}=Dn((({state:e})=>e));return(0,Pi.useMemo)((()=>{if(t.some((t=>t===e)))return Ja;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(s),u=(0,Pi.useMemo)((()=>r(c?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:a})),[c,a,r]);return(0,e.jsx)(Vs,{event:t,type:"upload",...n,children:l&&l!==Ja?(0,e.jsx)(Xa,{img:l,filename:a}):(0,e.jsxs)(Ya,{url:c,target:i?void 0:"_blank",children:[(0,e.jsx)(Ks,{name:"download",size:"16",alt:u}),(0,e.jsx)("span",{"aria-hidden":"true",className:$s("file-download"),children:a})]})})},cta:({event:t})=>{const{body:n}=Fs(t),r=aa(t.payload.id),{emitEvent:o}=as(),i=Ps(),s=(0,Pi.useCallback)((()=>o(`action.${jr}`,{type:jr,originMessage:t.payload.id,link:{url:n.buttonLink}})),[o,n,t]);return(0,e.jsxs)(Vs,{type:"cta",event:t,children:[(0,e.jsx)("div",{className:$s("cta__content"),id:i,dangerouslySetInnerHTML:{__html:n.description},onClick:r}),(0,e.jsx)("a",{className:$s("button","button--primary"),"aria-describedby":i,href:n.buttonLink,rel:"noreferrer",target:n.buttonNewTab?"_blank":"_self",onClick:s,children:n.buttonText})]})},carousel:({event:t})=>{const{body:n}=Fs(t),r=n.cards;return(0,e.jsx)(Vs,{event:t,modifiers:"type-carousel",children:(0,e.jsx)(ea,{items:r,ItemComponent:qs,getItemKey:ta,getItemLabel:na})})},card:({event:t})=>{const{body:n}=Fs(t),r=Ps();return(0,e.jsx)(Vs,{type:"card",event:t,children:(0,e.jsx)(Ws,{id:r,...n})})}},info:{text:Ka,divider:({event:t,...n})=>{const r=ua[Tr[t.payload.body.subtype]]||ua.default;return(0,e.jsx)(r,{event:t,...n})},translation:({event:t,...n})=>{const{t:r}=Zi(),{body:o}=Fs(t);return(0,e.jsx)(Vs,{type:"text",event:t,...n,children:r(o.key.join("."),o.variables)})},timeIndicator:ha},participant:{participant:({event:t})=>{const{participant:n}=t.payload,{body:r}=Fs(t);return r?(0,e.jsx)(ca,{graphicSrc:n.avatar,graphicType:n.avatar?"avatar":void 0,iconName:n.avatar?void 0:"balloon",childrenHTML:r,dividerType:"participant"}):null}},service_data:{suggestion:({event:t,...n})=>{const[r,o]=(0,Pi.useState)(!0),i=Wn(),s=ts(),{sendAction:a,addMessageBubble:c}=as(),{suggestions:l,payload:u}=(e=>{const{payload:t}=e,{body:n}=Fs(e);return{suggestions:n,payload:t}})(t),{showSuggestions:d}=qn(),p=Zn(),{t:h}=Zi(),f=h("suggestions.headingText"),m=h("suggestions.footerText"),v=(0,Pi.useMemo)((()=>p.some((({payload:e})=>e?.transactionLast))),[p]),y=(0,Pi.useCallback)((({id:e,question:t})=>{o(!1),i(Hr(!0)),a({type:gr,originMessage:u.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),c(t)}),[i,a,u.id,c]);return r&&!s&&v&&d?(0,e.jsxs)("div",{className:$s("suggestions","suggestions--conversation"),children:[f&&(0,e.jsx)("p",{className:$s("suggestions__heading"),children:f}),(0,e.jsxs)(Vs,{type:"suggestions",showParticipant:!1,event:t,...n,children:[(0,e.jsx)(sa,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:l}),m&&(0,e.jsx)("p",{className:$s("suggestions__footer"),children:m})]})]}):null}}},Qa=({children:t})=>{const{customComponents:n}=qn(),r=(0,Pi.useMemo)((()=>Object.keys(Za).reduce(((e,t)=>({...e,[t]:{...Za[t],...n?n[t]:{}}})),{fallback:Ka})),[n]);return(0,e.jsx)(ms.Provider,{value:r,children:t})},ec=({children:t})=>{const{isMinimized:n}=Qi(),r=(0,Pi.useRef)(0),{sendAction:o}=as(),{hasCountdown:i,isActive:s,stopCountdown:a}=Is(),c=(0,Pi.useCallback)((()=>{if(n)return;const e=(new Date).getTime(),t=()=>{o({type:"interactivity_update"}),r.current=e};i&&s&&(t(),a()),e-r.current>15e3&&t()}),[o,i,s,a,n]);return(0,e.jsx)("div",{className:$s("activity-monitor"),tabIndex:-1,onMouseDown:c,onKeyUp:c,onTouchStart:c,onMouseMove:c,onWheel:c,onPointerDown:c,onPointerMove:c,children:(0,e.jsx)(Ns.Provider,{value:c,children:t})})};const tc=["text","choice_prompt","image","video"],nc=()=>{const e=gs(),t=(0,Pi.useRef)(),n=(0,Pi.useRef)(),r=Ii(),o=(0,Pi.useContext)(rs),i=(0,Pi.useRef)(null),{initCountdown:s,endCountdown:a}=Is(),{emitEvent:c}=as();return(0,Pi.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new Wr(e);r(mo({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(Oo())})),t.onOpen((()=>{r(vo())}))}}),[e,r]),(0,Pi.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new l;return r(mo({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,Pi.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&&(null==o?void 0:o.name)&&r(Vo(o.name)),r(Xo({participant:o,fromClient:n})),"string"!=typeof o&&o.introduction&&r(So(e))};e.onConnection((({connected:n})=>{if(!n)return!1;const{channel:i}=e;return i.onMessage=(e,n)=>{const i={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(Ko(n.state.loading)),n.type){case"idle_detach_countdown":s(n.body.duration);break;case"idle_detach_countdown_elapsed":a(void 0,!0);break;case"resume_conversation_prompt":r(Lo());break;case"translation_proposal":r(ji(n.body));break;case"user_first_response":r(Hr(!0)),o.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(io(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(So(i))}break;case"participant":t(i);break;case"service_data":n.persist&&r(Zo(n));break;case"ack":r(Eo(i));break;case"system":if("service_changed"===n.type){const{serviceSettings:e}=n,t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["serviceSettings"]),{entry:o,proactiveMessages:i}=e,{upload:s}=o.options;r($o({key:Or,enabled:!(!s||!s.enabled)})),r(di(i.enabled||!1)),r(Qo(o)),n.serviceSessionId&&r(Uo(n.serviceSessionId)),c("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(So(i));break;case"error":switch(n.type){case"find_conversation_erred":const e=new u(i);r(mo({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 l(i);r(mo({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError,action:t.action}))}}return n},!1}))}),[e,r,c,a,o,s]),(0,Pi.useEffect)((()=>{e.onConnection((({connected:t})=>{if(!t)return!1;const{channel:r}=e;return n.current&&r.off("message",n.current),n.current=r.on("message",(e=>tc.includes(e.type)?(e.id!==i.current&&o.emit("message",e),i.current=e.id,e):e)),!0}))}),[e,o]),(0,Pi.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.channel.off("sync",t.current),t.current=e.channel.on("sync",(e=>{return t=void 0,n=void 0,i=function*(){try{const t=yield r(po(e)).unwrap();if(!t)return;r(qo(t))}catch(e){}},new((o=void 0)||(o=Promise))((function(e,r){function s(e){try{c(i.next(e))}catch(e){r(e)}}function a(e){try{c(i.throw(e))}catch(e){r(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(s,a)}c((i=i.apply(t,n||[])).next())}));var t,n,o,i})),!0)))}),[e,r]),null};var rc=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const oc=({children:t})=>{const{t:n}=Zi(),r=Wn(),o=os(),{addUploadBubble:i}=as(),s=(0,Pi.useCallback)(((e,t)=>rc(void 0,void 0,void 0,(function*(){r(oi(t));const n=yield(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=n,yield o.decode();const i=(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}`,i)}catch(e){}finally{r(ii(t))}}))),[r]),a=(0,Pi.useCallback)((e=>{const t=g(),a=o.uploadFile(e,(e=>{r(ri({fileId:t,progress:Math.ceil(e)}))}),(n=>rc(void 0,void 0,void 0,(function*(){const{id:o,transactionId:a,occurredAt:c,body:{contentType:l,filename:u,filesize:d,url:p}}=n;r(ti(t)),i(o,a,c,l,u,d,p),yield s(e,o)}))),(e=>{let o;switch((null==e?void 0:e.error)||""){case"file_uploads_are_disabled":o=n("fileUpload.errors.unavailable");break;case"request_entity_too_large":o=n("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":o=n("fileUpload.errors.wrongType");break;case"virus_found":o=n("fileUpload.errors.virusFound");break;default:o=n("fileUpload.errors.general")}r(ni({fileId:t,errorText:o}))}));r(Mo({fileId:t,fileName:e.name,uploadHandle:a}))}),[s,i,o,r,n]);return(0,e.jsx)(Es.Provider,{value:a,children:t})},ic=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=Is();return((e,t)=>{const n=(0,Pi.useRef)(e);(0,Pi.useEffect)((()=>{n.current=e}),[e]),(0,Pi.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n>0?1e3:null),null},sc=()=>{const{initUserSelectedOptions:e}=Os(),t=(0,Pi.useRef)(!1),n=qn();return(0,Pi.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function ac(e,t,n=[]){const r=(0,Pi.useContext)(rs),o=(0,Pi.useRef)();o.current=t,(0,Pi.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 cc=()=>{const e=qn(),{sendMessage:t,sendContext:n,sendAction:r}=as(),o=Wn(),{setVisibility:i,visible:s}=Qi(),a=(0,Pi.useRef)(s),c=(0,Pi.useContext)(rs),l=os(),u=er(),d=(0,Pi.useRef)(null),p=(0,Pi.useRef)(null),{isInline:f,isResolving:m}=sr(),v=Dn(ds),y=(()=>{const{get:e}=is();return e?e("conversationUrl"):null})(),g=(0,Pi.useRef)(null),b=As(),{enableTranslations:x,disableTranslations:w}=Ds();return(0,Pi.useEffect)((()=>{a.current=s}),[s]),ac("askText",(e=>{t({body:e})}),[l.send]),ac("setVariables",(e=>{n({variables:e})}),[l.send]),ac("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),ac("setVisibility",(e=>{Object.values(Cn).includes(e)?(b(),i(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e?.api]),ac("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),ac("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&o(Fr({showSuggestions:!1})),e&&t?r({type:_r,body:{name:e,fallbackMessage:t,participant:n?h:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),ac("setContext",(e=>{n(e)}),[l.send]),ac("setTranslation",(({enabled:e,locale:t})=>{e?x(t,"window_api"):w()}),[l.send]),(0,Pi.useEffect)((()=>{m||v||(g.current&&g.current!==y&&c.emit("unreadMessageCount",u),s===Cn.open&&s!==p.current&&0!==d.current&&c.emit("unreadMessageCount",0),s!==Cn.open&&u!==d.current&&c.emit("unreadMessageCount",u),p.current=s,d.current=u,g.current=y)}),[u,s,c,f,m,v,y]),null},lc=({children:t})=>{const n=(0,Pi.useContext)(rs),[r,o]=(0,Pi.useState)({}),i=(0,Pi.useRef)(!0),s=(0,Pi.useCallback)((e=>{i.current&&(o(e),n.emit("aria-live",e))}),[o,n]);(0,Pi.useEffect)((()=>{let e=null;return r&&r.messageText&&(e=setTimeout((()=>{s({}),clearTimeout(e)}),600)),()=>{clearTimeout(e)}}),[r,s]),(0,Pi.useEffect)((()=>()=>{i.current=!1}),[]);const{ariaLive:a,messageText:c}=r;return(0,e.jsxs)(cs.Provider,{value:s,children:[t,(0,e.jsxs)("div",{className:$s("app__live-container"),children:[(0,e.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:$s("visually-hidden"),children:a===Er?c:null}),(0,e.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:$s("visually-hidden"),children:a===Sr?c:null})]})]})},uc=()=>{const{t:e}=Zi(),t=Zn(),n=(0,Pi.useRef)(0),r=(0,Pi.useRef)(0),o=Jn().historyLoaded,{sendPolite:i}=ls(),{isOpen:s}=Qi(),a=(0,Pi.useRef)(null),c=(0,Pi.useRef)(null),l=(0,Pi.useMemo)((()=>x((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(i(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[i,e]);return(0,Pi.useEffect)((()=>{t.length>n.current&&(s&&(c.current=l(t)),n.current=t.length)}),[t,l,s]),(0,Pi.useEffect)((()=>{a.current&&!s&&c.current&&(c.current(!0),c.current=null)}),[s]),(0,Pi.useEffect)((()=>{o&&setTimeout((()=>{i(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,i]),null},dc=()=>{const{t:e}=Zi(),{isOpen:t,isVisible:n}=Qi(),r=er(),{sendPolite:o}=ls(),i=(0,Pi.useMemo)((()=>x(o,2e3)),[o]),s=(0,Pi.useRef)(null),a=(0,Pi.useRef)(null);return(0,Pi.useEffect)((()=>{s.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=i(e("message.srTextUnreadCount",{unreadCount:r}))),s.current=n}),[r,t,n,i,e]),null},pc=({store:t,children:n,eventBus:r,api:o})=>((0,Pi.useErrorBoundary)((e=>{t.dispatch(Gr(e))})),(0,e.jsx)(Bn,{store:t,children:(0,e.jsx)(rs.Provider,{value:r,children:(0,e.jsx)(ns.Provider,{value:o,children:(0,e.jsx)(lc,{children:(0,e.jsx)(fs,{children:(0,e.jsxs)(Qa,{children:[(0,e.jsx)(sc,{}),(0,e.jsx)(nc,{}),(0,e.jsx)(dc,{}),(0,e.jsx)(uc,{}),(0,e.jsx)(ic,{}),(0,e.jsxs)(ec,{children:[(0,e.jsx)(cc,{}),(0,e.jsx)(oc,{children:n})]})]})})})})})})),hc=jt(Yn,(e=>e.filter((e=>{var t;return bo(e)&&"service_data"!==e.type&&(null===(t=e.payload)||void 0===t?void 0:t.messageStatus)===vr})))),fc=jt(hc,(e=>e.at(-1))),mc=jt(hc,(e=>e.map((e=>e.payload.id)))),vc=jt((({state:e})=>{var t;return null===(t=e.options.features)||void 0===t?void 0:t.webNotifications}),(e=>null==e?void 0:e.enabled)),yc=()=>{const{t}=Zi(),{showDisclaimer:n}=qn();return n&&(0,e.jsxs)("div",{className:$s("disclaimer"),tabIndex:"0",children:[(0,e.jsx)("h2",{className:$s("disclaimer__title"),children:t("disclaimer.title")}),(0,e.jsx)("div",{className:$s("disclaimer__message"),dangerouslySetInnerHTML:{__html:t("disclaimer.content")}})]})},gc=jt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),bc=jt(gc,(e=>(null==e?void 0:e.controls)||{})),xc=jt(bc,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),wc=jt([bc,(e,{name:t})=>t],((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.value})),Cc=jt([bc,(e,{name:t})=>t],((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.touched})),_c=(0,i.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),jc=_c,{Provider:Ec,Consumer:Sc}=_c;function Tc(){return(0,Pi.useContext)(jc)}function Oc(e){const t=Wn(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:i}=Tc(),s=!!Dn((e=>gc(e,{formId:n}))),a=Dn((t=>wc(t,{formId:n,name:e}))),c=Dn((t=>Cc(t,{formId:n,name:e}))),l=null==i?void 0:i[e],u=!l;(0,Pi.useEffect)((()=>{s&&t(eo({formId:n,name:e}))}),[s,n,e,t]),(0,Pi.useLayoutEffect)((()=>()=>{t(to({formId:n,name:e}))}),[s,n,e,t]);const d=(0,Pi.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,Pi.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,Pi.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:a})),[e,d,p,a]),(0,Pi.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function kc(e){const{t}=Zi(),{sendAssertive:n}=ls(),{hasLimit:r,limit:o}=ir(),i=(0,Pi.useMemo)((()=>x(n,m)),[n]),s=(0,Pi.useMemo)((()=>x(((e,n)=>{e&&i(t("input.srCharacterLimitText",{limit:n}))}),m)),[i,t]),[{value:a}]=Oc(e),c=r&&a?o-a.length:o,l=!!r&&c<=f,u=!!r&&c<0;return(0,Pi.useEffect)((()=>{s(l,c)}),[l,c,s]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Nc=e=>{const{hasCharacterLimit:t,characterLimit:n}=kc(e),{entryMeta:{optionsOverride:{text:r}}}=Jn(),{t:o}=Zi();return{placeholder:(0,Pi.useMemo)((()=>o("input.inputPlaceholder",{hasLimit:t,text:(null==r?void 0:r.placeholder)||o("input.inputPlaceholderText"),limit:t?n:null})),[o,t,n,null==r?void 0:r.placeholder]),label:(0,Pi.useMemo)((()=>o("input.inputLabel",{hasLimit:!(null==r?void 0:r.label)&&t,text:(null==r?void 0:r.label)||o("input.inputLabelText"),limit:!(null==r?void 0:r.label)&&t?n:null})),[o,t,n,null==r?void 0:r.label]),labelClass:(0,Pi.useMemo)((()=>(null==r?void 0:r.label)?"label":"visually-hidden"),[null==r?void 0:r.label])}};function Ac(){const{abortTransaction:t,clearEntryAbortTransaction:n}=(()=>{const e=Wn(),{entryMeta:{actions:t,translatedActions:n}}=Jn();return{abortTransaction:(null==n?void 0:n.abortTransaction)||(null==t?void 0:t.abortTransaction),clearEntryAbortTransaction:()=>{e(ei())}}})(),r=os();return t?(0,e.jsx)("li",{className:$s(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,e.jsx)("button",{className:$s(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{r.send("action",{type:_r,body:{name:t.topicName,fallbackMessage:t.topicFallbackMessage}}),n()},children:t.label})}):null}const Ic=(0,i.createContext)(null),Rc=e=>{const t=(0,Pi.useContext)(ms),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]},Pc=({event:t,newParticipant:n})=>{const{eventRefs:r,unreadIds:o}=(0,ys.useContext)(Ic),{sendAction:i}=as(),s=r[t.payload.id],{containerRef:a,isVisible:c}=es({containerRef:s,freezeOnceVisible:!0}),l=Wn(),[u,d]=Rc(t);if((0,ys.useEffect)((()=>{if(c&&(null==o?void 0:o.includes(t.payload.id))){const e=o.reduce(((e,n)=>e.includes(t.payload.id)?e:e.concat(n)),[]);l(zo(e)),i({type:xr,events:e})}}),[l,t.payload.id,c,i,o]),!u)return null;const p=["conversation__item"];return"info"===t.type?p.push("conversation__item--source-info"):t.payload.fromClient?p.push("conversation__item--source-user"):p.push("conversation__item--source-agent"),n&&p.push("conversation__item--new-participant"),(0,e.jsxs)("li",{className:$s(p),ref:a,children:[t.timeIndicator&&(0,e.jsx)(ha,{event:t}),(0,e.jsx)(u,{event:t,children:(0,e.jsx)(d,{event:t})})]})},Lc=()=>{const{id:t}=or()||{};return(0,e.jsx)("li",{className:$s("conversation__item","conversation__item--source-agent"),children:(0,e.jsxs)("div",{className:$s("message","message--source-agent","message--type-loading"),children:[(0,e.jsx)(Hs,{eventPayload:{fromClient:!1,participant:t}}),(0,e.jsx)("div",{className:$s("message__body"),children:(0,e.jsxs)("span",{className:$s("loader"),children:[(0,e.jsx)("span",{className:$s("loader__part","one")}),(0,e.jsx)("span",{className:$s("loader__part","two")}),(0,e.jsx)("span",{className:$s("loader__part","three")}),(0,e.jsx)("span",{className:$s("loader__part","four")})]})})]})})},Mc=()=>{const t=Zn();let n=null;return(0,e.jsx)(e.Fragment,{children:t.map((t=>{const{type:r,payload:o}=t;let i=!1;if("participant"!==r&&"service_data"!==r){const{participant:e,fromClient:r}=o,s=r?"seamly-client-participant":e;"info"!==t.type&&n!==s&&(i=!0),n=s}return(0,e.jsx)(Pc,{event:t,newParticipant:i},t.payload.key||t.payload.id)}))})},Dc=()=>{const{t}=Zi(),n=Qn(),r=((e,t=20)=>{const[n,r]=(0,Pi.useState)(e),o=(0,Pi.useRef)(null);return(0,Pi.useEffect)((()=>(o.current=setTimeout((()=>r(e)),t),()=>{clearTimeout(o.current)})),[e,t]),n})(n,n?0:20),{isOpen:o}=Qi(),i=tr(),s=Cs();return(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)("a",{className:$s("skip-link"),href:`#${i}`,onClick:e=>{e.preventDefault(),s()},children:t("skiplinkText")}),(0,e.jsx)("div",{className:$s("chat__body"),children:(0,e.jsxs)("div",{className:$s("conversation__container"),children:[(0,e.jsx)(yc,{}),(0,e.jsxs)("ol",{className:$s("conversation"),children:[(0,e.jsx)(Qa,{children:(0,e.jsx)(Mc,{})}),r?(0,e.jsx)(Lc,{}):null,(0,e.jsx)(Ac,{})]})]})})]})};function Fc(e,t){const n=(0,Pi.useRef)(null),r=(0,Pi.useRef)(e);return(0,Pi.useEffect)((()=>{r.current=e}),[e]),(0,Pi.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout(r.current,t),()=>clearTimeout(n.current))),[t]),n}function Uc(e){return"object"==typeof e}const Bc={visible:$s("transition--visible"),in:$s("transition--in"),visuallyHidden:$s("visually-hidden")},zc=Object.values(Bc),$c={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},Hc=({children:t,isActive:n,timeout:r=300,transitionStartState:o=$c.notRendered,onInTransitionComplete:s=(()=>{}),onOutTransitionComplete:a=(()=>{}),exitAfter:c,enterDelay:l=0})=>{const u=(0,Pi.useRef)(!1),d=o===$c.visuallyHidden,[p,h]=(0,Pi.useState)((()=>d?[Bc.visuallyHidden]:[])),[f,m]=(0,Pi.useState)((()=>0===l)),v=(0,Pi.useMemo)((()=>c?c+l:c),[l,c]);Fc((()=>m(!1)),n?v:void 0),Fc((()=>m(!0)),n?l:void 0);const y=(0,Pi.useMemo)((()=>f&&n),[n,f]),g=Ls(s),b=Ls(a),x="notRendered"!==o||p.length>0;return(0,Pi.useEffect)((()=>{let e=null,t=null;return u.current&&!y&&(h([Bc.visible]),e=setTimeout((()=>{h([...d?[Bc.visuallyHidden]:[]]),b&&(t=requestAnimationFrame((()=>{b()})))}),r)),!u.current&&y&&(h([Bc.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{h([Bc.visible,Bc.in]),g&&(e=setTimeout((()=>{g()}),r))}))}))),u.current=y,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[d,g,b,r,y]),(0,e.jsx)(e.Fragment,{children:x&&(0,i.toChildArray)(t).filter(Uc).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!zc.includes(e)));return(0,i.cloneElement)(e,{className:[...n,...p].join(" ")})}))})},Vc=({isAside:t=!1})=>{const{isInline:n}=sr(),{t:r}=Zi(),{sendAction:o,addMessageBubble:i}=as(),{isOpen:s,setVisibility:a}=Qi(),{showSuggestions:c}=qn(),l=Ps(),u=Cs(),d=(0,Pi.useRef)(null),{sendPolite:p}=ls(),h=Dn(ds),{hasCountdown:f,endCountdown:m}=Is(),{hasPrompt:v,continueChat:y}=Rs(),g=ts(),b=("suggestion",Jn().serviceData.suggestion);const{body:x}=Fs({payload:b}),w=(0,Pi.useMemo)((()=>b&&!h?x:[]),[b,h,x]),C=(0,Pi.useRef)(null),_=(0,Pi.useRef)(!1),j=(0,Pi.useRef)([]),E=!!w.length,S=n?(g||s)&&!t:g,T=(0,Pi.useRef)(S),k=E&&!S&&c,N=E?w:j.current;j.current=N;const A=(0,Pi.useMemo)((()=>{const e=["suggestions"];return t&&e.push("suggestions--aside"),$s(e)}),[t]),I=(0,Pi.useCallback)((({id:e,question:t})=>{f&&m(!0),v&&y(),o({type:gr,originMessage:b.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),i(t),s||a(Cn.open),u()}),[i,y,m,u,f,v,b,o,a,s]);(0,Pi.useEffect)((()=>{if(C.current!==w&&!S){if(E){const e=_.current?r("suggestions.srUpdatedText"):r("suggestions.srAvailableText");setTimeout((()=>{p(e)}),30)}else _.current&&p(r("suggestions.srUnavailableText"));C.current=w}!T.current&&S?(O(d.current,u),p(r("suggestions.srUnavailableText"))):!E&&_.current&&O(d.current,u),_.current=E,T.current=S}),[w,E,S,u,p,r]);const R=r("suggestions.headingText"),P=r("suggestions.footerText"),L=R?"section":"div";return(0,e.jsx)(Hc,{isActive:k,transitionStartState:$c.notRendered,children:(0,e.jsxs)(L,{className:A,"aria-labelledby":R?l:null,ref:d,children:[R&&(0,e.jsx)("p",{id:l,className:$s("suggestions__heading"),children:R}),!!N.length&&(0,e.jsx)(sa,{suggestions:N,onClickSuggestion:I}),P&&!s&&(0,e.jsx)("p",{className:$s("suggestions__footer"),children:P})]})})},Wc=(0,ys.forwardRef)((({children:t,className:n=""},r)=>{const{isOpen:o,isVisible:i,setVisibility:s}=Qi(),{namespace:a,layoutMode:c}=qn(),{isInline:l}=sr(),u=_s(),d=ts(),{t:p}=Zi(),h=["chat",`chat--layout-${c}`,`namespace--${a}`,...u,n];return o||"app"===c||h.push("chat--collapsed"),d&&h.push("chat--user-responded"),i&&(0,e.jsxs)("section",{className:$s(h),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&o&&s(Cn.minimized)},tabIndex:"-1",ref:r,"aria-label":p("chat.srLabel"),children:[(0,e.jsx)("div",{className:$s("chat-wrapper"),children:t}),"inline"===c&&o&&(0,e.jsx)(Vc,{isAside:!0})]})})),qc=Wc,Gc=({children:t,handleClose:n,title:r,closeButtonText:o,srCloseButtonText:i,id:s})=>{const a=Ps();return(0,e.jsxs)("section",{tabIndex:-1,id:s,"aria-labelledby":r?a:void 0,className:$s("chat-status",!r&&"chat-status--condensed"),children:[(0,e.jsxs)("div",{className:$s("chat-status__body"),children:[r?(0,e.jsx)("h2",{className:$s("chat-status__title"),id:a,children:r}):null,t]}),"function"==typeof n&&(0,e.jsxs)("button",{type:"button",onClick:n,className:$s("button","button--tertiary","chat-status__close"),children:[o||(0,e.jsx)(Ks,{name:"close",size:"16",alt:""}),i&&(0,e.jsx)("span",{className:$s("visually-hidden"),children:i})]})]})},Kc=({handleClick:t,icon:n,title:r,srButtonText:o})=>(0,e.jsxs)("button",{type:"button",onClick:t,className:$s("button","button--primary","chat-status__button"),children:[(0,e.jsx)(Ks,{name:n,size:"16",alt:""}),r,o&&(0,e.jsx)("span",{className:$s("visually-hidden"),children:o})]});function Jc(){const{showProposal:t,translationProposal:n,dismissTranslationProposal:r,activateTranslationProposal:o}=zs(),{id:i}=Us();return t?(0,e.jsx)(Gc,{handleClose:r,srCloseButtonText:n.srDismissButtonText,id:i,title:n.titleLabel,children:(0,e.jsx)(Kc,{handleClick:o,icon:"newTranslation",title:n.buttonLabel})}):null}function Xc(){const t=Dn(ds),{isActive:n}=Ds();return t||n?null:(0,e.jsx)(Jc,{})}const Yc=({label:t,checked:n,description:r,onChange:o,id:i,itemClassName:s})=>(0,e.jsxs)("li",{className:$s([s,"translation-options__item"]),"aria-selected":n,role:"option",tabIndex:0,onClick:o,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),o())},id:i,children:[(0,e.jsx)(Ks,{name:"check",size:"16",alt:""}),t," ",r&&(0,e.jsxs)("span",{children:["(",r,")"]})]}),Zc=({onChange:t,describedById:n})=>{const{context:{userLocale:r,contentLocale:o}}=qn(),{t:i}=Zi(),{languages:s,currentLocale:a,enableTranslations:c,disableTranslations:l}=Ds(),u=Cs(),d=e=>()=>{e===a||r===e?l():c(e),t(),u()},{primaryLanguages:p,remainingLanguages:h}=(0,ys.useMemo)((()=>s.reduce(((e,t)=>{const n=t.locale===o,r=((e,t,n)=>t===e.locale||!t&&n)(t,a,n);t.locale!==o&&e.remainingLanguages.push(Object.assign(Object.assign({},t),{checked:r,isOriginal:n}));const i=e.remainingLanguages.findIndex((e=>e.locale===a));return(n||r&&i>4)&&e.primaryLanguages.push(Object.assign(Object.assign({},t),{checked:r,isOriginal:n})),e}),{primaryLanguages:[],remainingLanguages:[]})),[a,o,s]);return(0,e.jsxs)("ul",{"aria-describedby":n,role:"listbox",tabIndex:-1,className:$s("translation-options"),children:[p.map((({locale:t,nativeName:n,checked:r,isOriginal:o},s)=>(0,e.jsx)(Yc,{id:t,label:n,checked:r,description:o&&i("translations.settings.original"),onChange:d(t),itemClassName:$s({"translation-options__item--original":o,"translation-options__item--selected":r&&0!==s})},t))),h.map((({locale:t,nativeName:n,checked:r,isOriginal:o})=>(0,e.jsx)(Yc,{id:t,label:n,checked:r,description:o&&i("translations.settings.original"),onChange:d(t)},t)))]})},Qc=({className:t,children:n,onCancel:r,headingText:o,description:i,descriptionId:s,cancelButtonText:a,cancelButtonRef:c,disableButtonFocusing:l,position:u={horizontal:"left",vertical:"top"}})=>{const d=Ps(),{hideOption:p}=Os(),{focusButton:h}=ks(),f=(0,Pi.useCallback)((()=>{p(),l||h()}),[l,h,p]),m=(0,Pi.useCallback)((()=>{r&&r(),f()}),[f,r]),v=(e=>{const t=(0,Pi.useRef)(null);return(0,Pi.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})(m);return(0,Pi.useEffect)((()=>{T(v.current)}),[v]),(0,e.jsx)("section",{className:$s("options",{"options--right":"right"===u.horizontal,"options--left":"left"===u.horizontal,"options--top":"top"===u.vertical,"options--bottom":"bottom"===u.vertical},t),"aria-labelledby":d,tabIndex:-1,ref:v,children:(0,e.jsxs)("div",{className:$s("options__body"),children:[(0,e.jsx)("h2",{id:d,className:$s("options__title"),children:o}),(0,e.jsxs)("button",{type:"button",onClick:m,"aria-describedby":d,className:$s("button","options__close"),ref:e=>{c&&(c.current=e)},children:[(0,e.jsx)(Ks,{name:"close",size:"16",alt:""}),(0,e.jsx)("span",{children:a})]}),i?(0,e.jsx)("p",{className:$s("options__description"),id:s,children:i}):null,(0,e.jsx)("div",{className:$s("options__wrapper"),children:n})]})})},el=function({onClose:t,position:n}){const{t:r}=Zi(),o=Ps();return(0,e.jsx)(Qc,{onCancel:t,headingText:r("translations.menu.title"),cancelButtonText:r("translations.settings.cancelButtonText"),description:r("translations.menu.description"),descriptionId:o,position:n,disableButtonFocusing:!0,children:(0,e.jsx)(Zc,{describedById:o,onChange:t})})};function tl({children:t,position:n={horizontal:"left",vertical:"top"},classNames:r}){const[o,i]=(0,Pi.useState)(!1),s=(0,Pi.useRef)(null),a=Ps();return(0,e.jsxs)("div",{className:$s("translations__container"),onKeyDown:e=>{o&&S(e)===E.Escape&&(i(!1),T(s.current))},children:[(0,e.jsx)(Hc,{transitionStartState:$c.notRendered,isActive:o,children:(0,e.jsx)("div",{className:$s("options__dialog"),role:"dialog",children:(0,e.jsx)(el,{onClose:()=>{i(!1)},position:n})})}),(0,e.jsx)("button",{type:"button",className:$s(["button","chat__options__button",...r]),id:a,onClick:()=>{i(!o)},onKeyDown:e=>{S(e)===E.ArrowDown&&(i(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":o,children:t})]})}var nl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function rl(t){var{children:n,formId:r,persistData:o,onError:i,onSubmit:s,validationSchema:a}=t,c=nl(t,["children","formId","persistData","onError","onSubmit","validationSchema"]);const l=Wn(),u=Dn((e=>xc(e,{formId:r}))),[d,p]=(0,Pi.useState)(!1),[h,f]=(0,Pi.useState)({}),{isValid:m,errors:v}=function(e,t){const n=(0,Pi.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{var o;const i=Array.isArray(r)?r:[r];for(let r=0;null!==(o=r<(null==i?void 0:i.length))&&void 0!==o&&o;r++)if(!i[r].fn(e[n],i[r].compareValue)){t[n]=i[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(u,a),y=(0,Pi.useMemo)((()=>Object.assign(Object.assign({},v),h)),[v,h]);(0,Pi.useLayoutEffect)((()=>{l(Zr({formId:r,persistData:o}))}),[r,o,l]),(0,Pi.useEffect)((()=>()=>{l(Qr({formId:r}))}),[r,o,l]);const g=(0,Pi.useCallback)(((e,t)=>{l(no({formId:r,name:e,value:t}))}),[r,l]),b=(0,Pi.useCallback)(((e,t)=>{l(ro({formId:r,name:e,touched:t}))}),[l,r]),x=(0,Pi.useCallback)(((e,t)=>{f((n=>Object.assign(Object.assign({},n),{[e]:t})))}),[f]),w=(0,Pi.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");p(!t),!t&&m&&(l(Hr(!0)),s(u,{updateControlValue:g,setError:x}))}),[m,l,s,u,g,x]);(0,Pi.useEffect)((()=>{i&&i({errors:y,isSubmitted:d,isValid:0===Object.keys(y).length})}),[d,y,i]);const C=(0,Pi.useMemo)((()=>({formId:r,values:u,errors:y,isValid:0===Object.keys(y).length,isSubmitted:d,handleSubmit:w,validationSchema:a,updateControlValue:g,updateControlTouched:b})),[r,u,y,d,w,a,g,b]);return r?s?(0,e.jsx)(Ec,Object.assign({},c,{value:C,children:n})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}const ol=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),il=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},sl=e=>!!e?.length>0,al=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))},cl=e=>!!e,ll=function({className:t,disableValidationClasses:n,...r}){const{handleSubmit:o,isValid:i,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Tc();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),a=["form"];return!n&&s&&(a.push("form--submitted"),i?a.push("form--valid"):a.push("form--invalid")),(0,e.jsx)("form",{onSubmit:o,className:$s([...a,t]),...r})};function ul({id:t,error:n}){const[r,o]=(0,Pi.useState)(!1);return(0,Pi.useEffect)((()=>{const e=setTimeout((()=>o(!0)),300);return()=>clearTimeout(e)}),[]),(0,e.jsx)("div",{className:$s("error"),"aria-live":"assertive","aria-atomic":"true",children:r&&n&&(0,e.jsxs)("span",{id:t,className:$s("error__message"),children:[(0,e.jsx)(Ks,{name:"error",size:"16",alt:""}),n]})})}const dl=({contentHint:t,id:n,labelText:r,labelClass:o,validity:i,errorText:s,children:a})=>(0,e.jsxs)(e.Fragment,{children:[t&&(0,e.jsx)("span",{id:`${n}-content-hint`,className:$s("input__content-hint"),children:t}),(0,e.jsx)(ul,{id:`${n}-error`,error:!i&&s}),(0,e.jsxs)("div",{className:$s("form-control__wrapper"),children:[(0,e.jsx)("label",{htmlFor:n,className:$s(o),children:r}),a]})]});const pl=function(t){var{id:n,name:r,type:o,labelText:i,labelClass:s,contentHint:a=null,"aria-describedby":c}=t,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["id","name","type","labelText","labelClass","contentHint","aria-describedby"]);const{isSubmitted:u}=Tc(),[d,{error:p}]=Oc(r),h=u&&p,f=[];return c&&f.push(c),a&&f.push(`${n}-content-hint`),h&&f.push(`${n}-error`),(0,e.jsx)(dl,{id:n,contentHint:a,validity:!h,errorText:p,labelText:i,labelClass:s,children:(0,e.jsx)("input",Object.assign({id:n,name:r,type:o,"aria-invalid":h?"true":"false","aria-describedby":f.join(" ")||null},d,l))})};function hl({controlName:t,describedById:n}){const{t:r}=Zi();return(0,e.jsxs)(ll,{noValidate:"true",className:$s("options__form"),children:[(0,e.jsx)(pl,{name:t,type:"email",className:$s("transcript__input"),"aria-describedby":n,labelClass:$s("label"),labelText:r("options.sendTranscript.label")}),(0,e.jsx)("div",{className:$s("options__actions"),children:(0,e.jsx)("button",{type:"submit",className:$s("button","button--primary","options__submit"),children:r("options.sendTranscript.sendButtonText")})})]})}const fl="email",ml={sendTranscript:()=>{const[t,n]=(0,Pi.useState)(void 0),{hideOption:r}=Os(),{focusButton:o}=ks(),{t:i}=Zi(),s=Ps(),{sendAction:a}=as(),c=(0,Pi.useMemo)((()=>({[fl]:[ol(cl,i("options.sendTranscript.noEmailText")),ol(al,i("options.sendTranscript.invalidEmailText"))]})),[i]),l=(0,Pi.useCallback)((e=>{const t=e[fl].trim();a({type:"send_transcript",body:{emailAddress:t}}),r(),o()}),[a,r,o]),u=(0,Pi.useCallback)((({isValid:e,isSubmitted:t})=>{n(t&&!e?"options--error":void 0)}),[n]);return(0,e.jsx)(Qc,{className:t,headingText:i("options.sendTranscript.title"),cancelButtonText:i("options.cancelButtonText"),description:i("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,e.jsx)(rl,{formId:"sendTranscript",onSubmit:l,validationSchema:c,onError:u,children:(0,e.jsx)(hl,{controlName:fl,describedById:s})})})}},vl=()=>{const{optionActive:t}=Os(),n=(0,Pi.useRef)(null),r=ml[t||n.current];return t&&(n.current=t),r?(0,e.jsx)(r,{}):null},yl=()=>{const{t}=Zi(),{menuOptions:n,showOption:r,panelActive:o,hideOption:s}=Os(),{id:a}=ks(),c=(0,Pi.useRef)(null),[l,u]=(0,Pi.useState)(!1),d=(0,Pi.useRef)(null),p=n.length,h=(0,Pi.useRef)(Array.from({length:p},(()=>(0,i.createRef)()))),f=(0,Pi.useRef)(!1),m=p>1,v=n[0],y=(0,Pi.useMemo)((()=>v?.name?.trim().replace(/\s+/g,"")),[v]);return(0,Pi.useEffect)((()=>()=>{clearTimeout(c.current)}),[]),(0,Pi.useEffect)((()=>{l&&!f.current&&requestAnimationFrame((async()=>{await bs(60);const e=n.findIndex((e=>e.available)),t=-1===e?0:e;T(h.current[t])})),f.current=l}),[l,n]),p?(0,e.jsxs)("div",{className:$s("options__container"),onKeyDown:e=>{l&&(S(e)===E.Escape&&(u(!1),T(d.current)),S(e)===E.Home&&(T(h.current[0]),e.preventDefault()),S(e)===E.End&&(T(h.current[p-1]),e.preventDefault()))},onfocusout:()=>{m&&(c.current=setTimeout((()=>{u(!1)}),200))},onfocusin:()=>{clearTimeout(c.current)},children:[(0,e.jsx)(Hc,{transitionStartState:$c.notRendered,isActive:o,children:(0,e.jsx)("div",{className:$s("options__dialog"),children:(0,e.jsx)(vl,{})})}),m&&(0,e.jsx)(Hc,{isActive:l,transitionStartState:$c.notRendered,children:(0,e.jsx)("ul",{className:$s(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":a,children:n.map((({name:o,title:i,available:s},a)=>(0,e.jsx)("li",{className:$s("options__menu__item"),role:"menuitem","data-testid":o,children:(0,e.jsxs)("button",{type:"button",ref:e=>{h.current[a]=e},className:$s(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(S(e)===E.ArrowDown){const n=Math.min(p-1,t+1);T(h.current[t===n?0:n]),e.preventDefault()}if(S(e)===E.ArrowUp){const n=Math.max(0,t-1);T(h.current[t===n?p-1:n]),e.preventDefault()}})(e,a),onKeyPress:e=>((e,t)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let o=-1;n.forEach(((e,n)=>{n>t&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=n)})),-1!==o&&T(h.current[o])})(e,a),onClick:()=>((e,t)=>{t&&(u(!1),r(e))})(o,s),"aria-disabled":s?null:"true",children:[(0,e.jsxs)("span",{className:$s("button__text"),children:[i,!s&&" "]}),!s&&(0,e.jsx)("span",{className:$s("button__state"),children:t("options.unavailableText")})]})},o)))})}),(0,e.jsxs)("button",{type:"button",className:$s(["button","button--secondary","chat__options__button",...!m&&y?[`chat__options__button--${y}`]:[]]),id:a,onClick:()=>{o&&s(),m?u((e=>!e)):v.available&&!o&&r(v.name)},onKeyDown:m?e=>{S(e)===E.ArrowDown&&(u(!0),e.preventDefault())}:null,ref:d,"aria-haspopup":m?"menu":null,"aria-expanded":m?l.toString():null,"aria-disabled":m||v.available?null:"true",children:[m&&(0,e.jsx)(Ks,{name:"options",size:"32",alt:""}),(0,e.jsx)("span",{className:$s("button__text"),children:m?t("options.openButtonText"):`${v.title}${v.available?"":" "}`}),!m&&!v.available&&(0,e.jsx)("span",{className:$s("button__state"),children:t("options.unavailableText")})]})]}):null};function gl(){const{menuOptions:t,allowOptionSelection:n}=Os(),{isAvailable:r}=Ds(),o=Dn(ds),{t:i,locale:s}=Zi(),a=Bs(s);if(!r&&(!n||!t.length)||o)return null;const c=i("translations.settings.openButtonText",{hasLanguage:!!a,language:a});return(0,e.jsxs)("div",{className:$s("chat__options"),children:[r&&(0,e.jsx)("div",{className:$s("chat__options-item","chat__options-item--left"),children:(0,e.jsxs)(tl,{classNames:["button--secondary"],children:[(0,e.jsx)(Ks,{alt:c,name:"newTranslation",size:"16"}),(0,e.jsx)("span",{className:$s("button__text"),children:c})]})}),n&&(0,e.jsx)("div",{className:$s("chat__options-item","chat__options-item--right"),children:(0,e.jsx)(yl,{})})]})}const bl=()=>{const{scrollToRef:t,unreadIds:n}=(0,Pi.useContext)(Ic),{isMinimized:r}=Qi(),{t:o}=Zi();return(0,e.jsx)(Hc,{isActive:!!n.length&&!r,children:(0,e.jsx)("div",{className:$s("unread-messages"),children:(0,e.jsxs)("button",{type:"button",className:$s("button","button--primary"),onClick:t,children:[o("message.unreadMessagesCount",{unreadCount:n.length}),(0,e.jsx)(Ks,{name:"chevronDown",size:"32",alt:""})]})})})};const xl=e=>{const t=(0,Pi.useRef)(),[n,r]=(0,Pi.useState)(!0),o=Dn(mc),i=Zn(),s=Qn(),{isOpen:a}=Qi(),c=Jn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=Dn((({state:e})=>e));(0,Pi.useEffect)((()=>{const e=t.current,n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,i=Math.abs(t-n-o)>10;r(!i)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,Pi.useCallback)((()=>{requestAnimationFrame((()=>{return e=void 0,n=void 0,o=function*(){var e,n;yield bs(30),null===(e=t.current)||void 0===e||e.scrollTo({top:null===(n=t.current)||void 0===n?void 0:n.scrollHeight,left:0,behavior:"auto"})},new((r=void 0)||(r=Promise))((function(t,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,a)}c((o=o.apply(e,n||[])).next())}));var e,n,r,o}))}),[]);return(0,Pi.useEffect)((()=>{u&&d()}),[u,d]),(0,Pi.useEffect)((()=>{n&&d()}),[n,o,i,s,a,c,l,d]),{containerRef:t,unreadIds:o,scrollToRef:()=>{var n,r;const i=null===(n=e[null==o?void 0:o.at(0)])||void 0===n?void 0:n.current;null===(r=t.current)||void 0===r||r.scrollTo({top:null==i?void 0:i.offsetTop,behavior:"auto",left:0})},scrollToBottom:d}},wl=({children:t})=>{const n=Zn(),r=(0,Pi.useMemo)((()=>n.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,i.createRef)(),e):e),{})),[n]),{scrollToRef:o,scrollToBottom:s,containerRef:a,unreadIds:c}=xl(r);return(0,e.jsx)(Ic.Provider,{value:{eventRefs:r,unreadIds:c,scrollToRef:o,scrollToBottom:s,containerRef:a},children:(0,e.jsxs)("div",{className:$s("chat__container"),children:[(0,e.jsx)("div",{className:$s("chat__container__scroll-area"),ref:a,children:t}),(0,e.jsx)(bl,{})]})})},Cl=({baseClassName:t,children:n,title:r})=>{const o=tr(),i=Ps();return(0,e.jsxs)("section",{id:o,className:$s(t),"aria-describedby":i,tabIndex:"-1",children:[(0,e.jsx)("h2",{className:$s(`${t}__title`),id:i,children:r}),n]})},_l=()=>{const{t}=Zi(),n=Cs(),r=As(),{emitEvent:o}=as(),{isActive:i,remaining:s,timer:a,endCountdown:c}=Is(),l=s>0,u=t(l?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,e.jsx)(Cl,{baseClassName:"idle",title:u,children:l&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:$s("idle__count-container"),children:i&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:$s("idle__count-text"),children:t("idleDetachWarning.countdownText")}),(0,e.jsx)("span",{className:$s("idle__count-timer"),children:t("idleDetachWarning.countdownTimer",a)})]})}),(0,e.jsxs)("div",{className:$s("idle__options"),children:[(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{r(),c(!0),n(),o("idleTimer.selectContinue")},children:t("idleDetachWarning.continueButton")}),(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{c(),n(),o("idleTimer.selectEnd")},children:t("idleDetachWarning.detachButton")})]})]})})},jl=()=>{const{t}=Zi(),n=As(),{name:r}=or()||{},{continueChat:o,restartChat:i}=Rs();return(0,e.jsx)(Cl,{baseClassName:"prompt",title:t("resumeConversationPrompt.title",{name:r}),children:(0,e.jsxs)("div",{className:$s("prompt__options"),children:[(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{n(),o()},children:t("resumeConversationPrompt.continueButton")}),(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:i,children:t("resumeConversationPrompt.detachButton")})]})})},El=()=>{const{sendAction:e}=as(),{features:t}=Os(),{typingPeekahead:n}=t||{},r=(0,Pi.useRef)(null),o=(0,Pi.useRef)(null),i=(0,Pi.useRef)(!1),s=(0,Pi.useRef)(null);(0,Pi.useEffect)((()=>()=>{clearInterval(s.current),clearTimeout(r.current),clearTimeout(o.current)}),[]);const a=(t,r)=>{e({type:br,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(i.current=!0,s.current||(a(!0,e.target.value),s.current=setInterval((()=>{i.current?n&&n.enabled&&a(!0,e.target.value):(clearInterval(s.current),s.current=null)}),2e3)),clearTimeout(r.current),clearTimeout(o.current),r.current=setTimeout((()=>{i.current=!1}),300),o.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}},Sl=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=Jn().entryMeta,i=Wn(),s=n||t||e,a=o[s]||r[s]||{},c=(0,Pi.useCallback)((e=>{i(Bo(e))}),[i]),l=(0,Pi.useCallback)((e=>{i(Fo(e))}),[i]),u=(0,Pi.useCallback)((e=>{i(si(e))}),[i]),d=(0,Pi.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:s,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Tl({controlName:t,skipLinkId:n}){const{t:r}=Zi(),{sendAssertive:o}=ls(),{emitEvent:i}=as(),s=El(),{setBlockAutoEntrySwitch:a}=Sl(),{placeholder:c,label:l,labelClass:u}=Nc(t),{hasCharacterLimit:d,reachedCharacterWarning:p,reachedCharacterLimit:h,remainingChars:f}=kc(t),[{value:m}]=Oc(t),v=!!m,y=(0,Pi.useCallback)((()=>{p&&o(r("input.srCharacterLimitText",{limit:f})),i("ui.inputFocus")}),[r,o,p,f,i]);return(0,Pi.useLayoutEffect)((()=>(a(v),()=>{a(!1)})),[a,v]),(0,e.jsxs)(ll,{className:$s("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,e.jsxs)("div",{className:$s(["input--text__container",...p&&!h?["character-warning"]:[],...h?["character-exceeded"]:[]]),children:[(0,e.jsx)(pl,{id:n,type:"text",name:t,className:$s("input__text"),autocomplete:"off",placeholder:c,labelText:l,labelClass:$s(u),"aria-invalid":d?h:null,onKeyUp:s,onFocus:y}),(0,e.jsx)("div",{className:$s("character-count"),children:p&&(0,e.jsx)("span",{children:f})})]}),(0,e.jsx)("button",{className:$s("button","input__submit"),type:"submit",onPointerDown:e=>{e.preventDefault()},"aria-disabled":!v||h?"true":null,children:(0,e.jsx)(Ks,{name:"send",size:"32",alt:r("input.sendMessage")})})]})}const Ol="textMessageEntry";function kl({...t}){const{isOpen:n,setVisibility:r}=Qi(),o=tr(),i=Cs(),{sendMessage:s}=as(),a=(0,Pi.useCallback)(((e,{updateControlValue:t})=>{s({body:e[Ol]}),t(Ol,""),i(),n||r(Cn.open)}),[s,i,n,r]);return(0,e.jsx)(rl,{...t,formId:"textEntry",persistData:!0,onSubmit:a,children:(0,e.jsx)(Tl,{controlName:Ol,skipLinkId:o})})}const Nl=()=>{const{t}=Zi(),{currentUploads:n}=Ts();return(0,e.jsx)("div",{className:$s("progress"),children:n.map((({id:n,name:r,progress:o,uploading:i,error:s})=>(0,e.jsxs)("div",{className:$s("progress_container"),children:[(0,e.jsxs)("div",{className:$s("progress__text"),children:[(0,e.jsx)("span",{className:$s("progress__text--file-name"),children:r}),(0,e.jsx)("span",{className:$s("progress__text--percentage"),children:`${o}%`})]}),(0,e.jsx)(ul,{error:s}),(0,e.jsx)("progress",{className:$s("progress__bar"),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-label":t("fileUpload.srProgressLabel",{fileName:r}),max:"100","aria-valuenow":o,value:o,"aria-busy":i,children:`${o}%`})]},n)))})};function Al({id:t,name:n,labelText:r,contentHint:o,outputText:i,accept:s}){const{isSubmitted:a}=Tc(),[c,l]=(0,Pi.useState)(!1),[{onInput:u,onBlur:d},{error:p}]=Oc(n),h=Ps(),f=Ps(),m=Ps(),v=a&&p,y=[m];o&&y.push(f),v&&y.push(h);const g=(0,Pi.useCallback)((()=>{l(!0)}),[l]),b=(0,Pi.useCallback)((()=>{l(!1),d()}),[l,d]),x=(0,Pi.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,e.jsxs)("div",{className:$s("upload__container"),children:[o&&(0,e.jsx)("span",{className:$s("upload__content-hint"),id:f,children:o}),(0,e.jsx)(ul,{id:h,error:v&&p}),(0,e.jsx)("div",{className:$s(["file-upload",...c?["focus-within"]:[]]),children:(0,e.jsxs)("label",{htmlFor:t,className:$s("upload__label"),children:[(0,e.jsx)(Ks,{name:"upload",size:"32",alt:""}),(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:$s(["upload__label--text"]),children:r}),(0,e.jsx)("input",{id:t,className:$s("upload__input"),type:"file",name:n,onChange:x,"aria-invalid":v?"true":"false","aria-describedby":y.join(" "),accept:s||null,onFocus:g,onBlur:b}),(0,e.jsx)("span",{className:$s("upload__output"),"aria-hidden":"true",id:m,children:i})]})]})})]})}function Il({skiplinkId:t,controlName:n,accept:r,contentHint:o,isUploading:i,isComplete:s,onClickCancel:a}){const{t:c}=Zi(),[{value:l}]=Oc(n),u=l&&l.length>0,d=u?l[0].name:"";return(0,e.jsxs)(ll,{className:$s("upload-form"),children:[(0,e.jsx)(Al,{name:n,id:t,accept:r,labelText:c("fileUpload.labelText"),outputText:c("fileUpload.selectedText",{hasFile:u,filename:d}),contentHint:o}),(0,e.jsxs)("div",{className:$s("upload__button-container"),children:[(0,e.jsx)("button",{id:i||!s?t:void 0,type:"button",onClick:a,className:$s("button","button--secondary","upload__cancel"),children:c("fileUpload.cancelButtonText")}),(0,e.jsx)("button",{className:$s("button","button--primary"),type:"submit",children:c("fileUpload.uploadButtonText")})]})]})}const Rl="fileListForm",Pl="fileList",Ll=()=>{const{t}=Zi(),{sendPolite:n,sendAssertive:r}=ls(),o=tr(),i=Cs(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:c}=Ss(),l=(0,Pi.useRef)(null),u=(0,Pi.useRef)(s),{cancelEntrySelection:d}=Sl(),{uploadFile:p,clearUploads:h,isUploading:f,isComplete:m}=Ts(),{hasFile:v,selectedFileName:y,uploadHandle:g,hasServerError:b,progress:x}=((e,t)=>{const n=Dn((n=>wc(n,{formId:e,name:t}))),{currentUploads:r}=Ts(),o=n&&n.length>0;let i=null,s=!1,a=0;if(r&&r.length>0){const e=r[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(Rl,Pl),w=Ps(),C=(0,Pi.useRef)(!0),j=t("fileUpload.contentHint",{size:_(c)}),E=(0,Pi.useRef)(""),S=(0,Pi.useRef)(null);(0,Pi.useEffect)((()=>{E.current&&S.current?.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&r(j),E.current=j}),[j,r]),(0,Pi.useEffect)((()=>{x>0&&n(1===x?t("fileUpload.srStartedText"):`${x}%`)}),[x,n,t]),(0,Pi.useEffect)((()=>{C.current||f||!m||(h(),d(),i(),setTimeout((()=>{n(t("fileUpload.srCompleteText"))}),300)),C.current=m}),[f,m,h,d,i,n,t]);const T=(0,Pi.useCallback)((({fileList:e})=>{p(e[0]),i()}),[p,!1,i]),O=(0,Pi.useCallback)((()=>{g&&g.abort(),h(),d(),i()}),[g,h,d,i]),k=(0,Pi.useMemo)((()=>({[Pl]:[ol((()=>s),t("fileUpload.errors.unavailable")),ol(sl,t("fileUpload.errors.noFile")),ol(il,t("fileUpload.errors.tooLarge"),c)]})),[c,s,t]);return(0,e.jsx)("div",{className:$s(["upload",...b?["upload--error"]:[]]),ref:S,children:(0,e.jsxs)(rl,{formId:Rl,persistData:!0,onSubmit:T,validationSchema:k,children:[(f||!m)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Nl,{}),(0,e.jsx)("div",{className:$s("upload__button-container"),children:(0,e.jsx)("button",{id:f||!m?o:void 0,type:"button",onClick:O,ref:l,className:$s("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]}),!f&&m&&(0,e.jsx)(Il,{controlName:Pl,skiplinkId:o,accept:a.join(", "),contentHint:j,isComplete:m,isUploading:f,outputText:t("fileUpload.selectedText",{hasFile:v,filename:y}),onClickCancel:O}),!u.current&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:$s("notification"),id:w,children:t("fileUpload.unavailableText")}),(0,e.jsx)("div",{className:$s("upload__button-container"),children:(0,e.jsx)("button",{id:f||!m?o:void 0,type:"button",onClick:O,className:$s("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]})]})})},Ml=()=>{const{t}=Zi(),{showFileUpload:n,serviceAllowsUploads:r}=Ss(),[o,i]=(0,Pi.useState)(r),s=Cs(),a=(0,Pi.useRef)(null),{setUserEntryType:c,activeEntry:l}=Sl(),u=(0,Pi.useRef)(null),{sendPolite:d}=ls(),p=!!or();return(0,Pi.useEffect)((()=>{O(u.current,(()=>{r||s()})),i(r)}),[r,s]),(0,Pi.useEffect)((()=>{a.current&&!r&&d(t("fileUpload.srUnavailableText")),!1===a.current&&r&&d(t("fileUpload.srAvailableText")),p&&(a.current=r)}),[r,p,d,t]),!n&&l!==mr&&(0,e.jsx)(Hc,{isActive:o,transitionStartState:$c.rendered,children:(0,e.jsx)("div",{className:$s("upload-toggle-wrapper"),children:(0,e.jsx)(Hc,{isActive:o,transitionStartState:$c.visuallyHidden,children:(0,e.jsx)("button",{className:$s(["button","button--secondary","upload-toggle"]),ref:u,"aria-disabled":o?null:"true",type:"button",onClick:o?()=>{c(mr),s()}:null,children:(0,e.jsx)(Ks,{name:"file",size:"32",alt:t("fileUpload.toggleButtonText")})})})})})},Dl=()=>{const{isOpen:t}=Qi(),n=(0,Pi.useRef)(null),{hasCountdown:r}=Is(),[o,i]=(0,Pi.useState)(r),{hasPrompt:s}=Rs(),[a,c]=(0,Pi.useState)(s),l=Cs(),u=(0,Pi.useRef)(!1),{activeEntry:d}=Sl(),[p,h]=(0,Pi.useState)({text:kl,upload:Ll}),[f,m]=(0,Pi.useState)((()=>d)),v=qn(),{accountAllowsUploads:y}=Ss(),g=(0,Pi.useCallback)((()=>{O(n.current,l)}),[l]);(0,Pi.useEffect)((()=>{const{customComponents:e}=v,{entry:t}=e||{};t&&h((e=>({...e,...t})))}),[v]),(0,Pi.useEffect)((()=>{g(),i(r),c(s)}),[r,s,g]),(0,Pi.useEffect)((()=>{m(d),g()}),[d,g,n]),u.current=!(!n.current||!n.current.contains(document.activeElement));const b=p[f];return(0,e.jsxs)("div",{className:$s("chat__entry"),ref:n,children:[o&&(0,e.jsx)(_l,{}),a&&(0,e.jsx)(jl,{}),(0,e.jsxs)("div",{className:$s(["entry__body",...r||s?["entry__body--hidden"]:[]]),children:[f!==mr&&y&&t&&(0,e.jsx)(Ml,{}),(0,e.jsx)(b,{})]})]})},Fl=()=>{const{t}=Zi(),{isOpen:n,closeChat:r}=Qi(),{isWindow:o}=sr();return n&&o?(0,e.jsx)("button",{type:"button",className:$s("button","collapse-button"),onClick:r,children:(0,e.jsx)(Ks,{name:"chevronDown",size:"32",alt:t("window.srCollapseButton")})}):null},Ul=()=>{const{meta:{originalError:t,title:n,message:r,buttonText:o,action:i,srText:s}}=ps(),a=as(),c=Ps(),{sendPolite:l}=ls(),u=Cs(),d="SeamlySessionExpiredError"===t?.name;return(0,Pi.useEffect)((()=>{!d&&s&&setTimeout((()=>{l(s)}),200)}),[l,s,d]),d?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)("section",{className:$s("interrupt"),"aria-labelledby":c,children:[(0,e.jsx)(Fl,{}),(0,e.jsxs)("div",{className:$s("interrupt__body"),children:[(0,e.jsx)("h2",{id:c,className:$s("interrupt__title"),children:n}),(0,e.jsx)("p",{className:$s("interrupt__message"),children:r}),o&&i&&(0,e.jsx)("div",{className:$s("interrupt__actions"),children:(0,e.jsx)("button",{type:"button",className:$s("button","button--primary"),onClick:()=>{a[i]&&a[i](),u()},children:o})})]})]})},Bl=function({children:t}){const n=Dn(ds),{isOpen:r}=Qi();return n?(0,e.jsx)(Ul,{}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(wl,{children:[(0,e.jsxs)("div",{className:$s("chat__container__header"),children:[(0,e.jsx)(Xc,{}),(0,e.jsx)(Fl,{})]}),t]}),(0,e.jsx)(Dl,{}),r&&(0,e.jsx)(gl,{})]})};function zl({event:t}){const[n]=Rc(t);return(0,e.jsx)("li",{children:(0,e.jsx)(n,{event:t})})}function $l({events:t}){return(0,e.jsx)("ul",{className:$s("collapsed-chat-messages"),children:t.map((t=>(0,e.jsx)(zl,{event:t},t.payload.id)))})}function Hl(){const{preChatEvents:t}=qn(),n=Dn(ds),{isOpen:r}=Qi();return!(n||!(null==t?void 0:t.length)||r)&&(0,e.jsx)($l,{events:t})}function Vl(){const{t}=Zi(),n=t("window.chat.continue"),r=(0,Pi.useMemo)((()=>({type:"message",payload:{body:{text:n}}})),[n]);return(0,e.jsx)($l,{events:[r]})}const Wl=()=>{const t=Gn(),n=or(),r=Dn(ds),o=n&&!r,i=o?n.avatar:t;return i?(0,e.jsx)("img",{className:$s(o?"avatar":"icon"),src:i,alt:""}):(0,e.jsx)(Ks,{name:"avatar",size:"32",alt:""})},ql=({onClick:t})=>{const n=ss(),{t:r}=Zi(),o=n()?r("window.openButton.srContinue"):r("window.openButton.srStart"),i=Cs(),{isOpen:s}=Qi(),a=er(),c=(0,Pi.useCallback)((()=>{t(),i()}),[i,t]);return(0,e.jsx)(Hc,{isActive:!s,transitionStartState:$c.rendered,children:(0,e.jsxs)("button",{className:$s("window-open-button"),"aria-label":o,"aria-hidden":s,onClick:c,children:[(0,e.jsx)(Hc,{isActive:!!a,transitionStartState:$c.notRendered,children:(0,e.jsx)("span",{className:$s("message-count"),"aria-hidden":"true",children:a})}),(0,e.jsx)(Wl,{})]})})},Gl=(e,t,n)=>"object"==typeof e?e[t]:n,Kl=n.p+"sounds/beep.mp3";var Jl=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const Xl=!!window.Notification,Yl={app:()=>(0,e.jsx)(qc,{children:(0,e.jsx)(Bl,{children:(0,e.jsx)(Dc,{})})}),inline:()=>{const{showInlineView:t,containerRef:n}=(()=>{const e=Wn(),{connectWhenInView:t}=qn(),n=Dn(cr),{containerRef:r,isVisible:o}=es({enabled:t,freezeOnceVisible:!0});return(0,Pi.useEffect)((()=>{o&&e(ki())}),[e,o]),{containerRef:r,showInlineView:n}})(),{isOpen:r}=Qi();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Hc,{isActive:!r,transitionStartState:$c.rendered,children:(0,e.jsxs)("div",{ref:n,className:$s("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,e.jsx)(Hl,{}),(0,e.jsx)(Vc,{})]})}),(0,e.jsx)(Hc,{isActive:r,transitionStartState:$c.rendered,children:(0,e.jsx)(qc,{ref:n,children:t&&(0,e.jsx)(Bl,{children:r&&(0,e.jsx)(Dc,{})})})})]})},window:()=>{const{isOpen:t,openChat:n}=Qi(),r=ts(),{continueChat:o,preChat:i}=qn();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ql,{onClick:n}),(0,e.jsx)(Hc,{isActive:i&&!t&&!r,exitAfter:Gl(i,"exitAfter"),enterDelay:Gl(i,"enterDelay"),transitionStartState:$c.notRendered,children:(0,e.jsx)("div",{className:$s("unstarted-wrapper","unstarted-wrapper--window"),children:(0,e.jsx)(Hl,{})})}),(0,e.jsx)(Hc,{isActive:o&&!t&&r,exitAfter:Gl(o,"exitAfter"),enterDelay:Gl(o,"enterDelay"),transitionStartState:$c.notRendered,children:(0,e.jsx)("div",{className:$s("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,e.jsx)(Vl,{})})}),(0,e.jsx)(Hc,{isActive:t,transitionStartState:$c.notRendered,children:(0,e.jsx)(qc,{children:(0,e.jsx)(Bl,{children:(0,e.jsx)(Dc,{})})})})]})}},Zl=({children:t})=>{const{sendNotification:n}=(()=>{const{proactiveMessages:e}=nr(),{notificationAudioURL:t}=qn(),[n,r]=(0,Pi.useState)(Xl?Notification.permission:"default"),[o,i]=(0,Pi.useState)(document.visibilityState),s=Dn(vc),a=(0,Pi.useCallback)((()=>Jl(void 0,void 0,void 0,(function*(){if(Xl&&"granted"!==n){const e=yield Notification.requestPermission();r(e)}}))),[n]),c=(0,Pi.useMemo)((()=>"granted"===n),[n]),l=(0,Pi.useMemo)((()=>"hidden"===o),[o]);(0,Pi.useEffect)((()=>{"default"===n&&e&&a()}),[n,e,a]);const u=(0,Pi.useCallback)(((e,r)=>Jl(void 0,void 0,void 0,(function*(){if(s&&Xl){if("default"===n&&a(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||Kl);yield 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=${Ol}]`);e&&e.focus()}}}}))),[t,n,c,a,s,l]);return(0,Pi.useEffect)((()=>{if(!s)return()=>{};function e(){i(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[s]),{permission:n,requestPermission:a,sendNotification:u}})(),[,r]=xs(),{namespace:o,layoutMode:i,zIndex:s}=qn(),a=or(),{proactiveMessages:c}=nr(),{isOpen:l,isVisible:u}=Qi(),d=_s(),p=ts(),h=Dn(fc),{body:f}=Fs(h),{userLocale:m}=Zi(),v=(0,Pi.useRef)(void 0),y=(0,Pi.useMemo)((()=>{var e;return f?function(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""}((null==f?void 0:f.text)||(null===(e=null==f?void 0:f.prompt)||void 0===e?void 0:e.text)||f):void 0}),[f]);(0,Pi.useEffect)((()=>{var e;(null==a?void 0:a.name)&&y&&c&&h&&v.current!==(null===(e=h.payload)||void 0===e?void 0:e.id)&&(n(a.name,{body:y,icon:null==a?void 0:a.avatar}),v.current=h.payload.id)}),[null==a?void 0:a.avatar,null==a?void 0:a.name,h,y,c,n]);const g=Yl[i],b=(0,Pi.useCallback)((e=>{"function"==typeof r&&r(e)}),[r]),x=(0,Pi.useMemo)((()=>{if(m&&document.querySelector("html").getAttribute("lang")!==m)return m}),[m]);if(!g)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const w=["app",`app--layout-${i}`,`namespace--${o}`];return"function"!=typeof d&&w.push(...d),l||"app"===i||w.push("app--collapsed"),p&&w.push("app--user-responded"),u&&(0,e.jsx)("div",{className:$s(w),lang:x,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:s},ref:b,children:t||(0,e.jsx)(g,{})})},Ql=t=>(0,e.jsx)(pc,{...t,children:(0,e.jsx)(Zl,{})});var eu=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};class tu{constructor(e,t){const{namespace:n="",parentElement:r}=e,i=eu(e,["namespace","parentElement"]);this.config=Object.assign(Object.assign({},i),{namespace:n}),this.namespace=n,this.parentElement=r,this.externalApi=t,this.api=new Se({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(o()),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)))}render(){return t=this,n=void 0,o=function*(){const t=this.config.customComponents||{},{view:n}=t,r=eu(t,["view"]),o=Object.assign(Object.assign({},this.config),{customComponents:Object.keys(r).length?r:void 0}),s=Ai({api:this.api,eventBus:this.eventBus,config:o,initialState:void 0});s.dispatch(Dr(o)),yield s.dispatch(gn()),yield s.dispatch(Ar()),s.dispatch(dr()),n?(0,i.render)((0,e.jsx)(pc,{eventBus:this.eventBus,store:s,api:this.api,children:(0,e.jsx)(n,{})}),this.parentElement):(0,i.render)((0,e.jsx)(Ql,{config:o,eventBus:this.eventBus,store:s,api:this.api}),this.parentElement)},new((r=void 0)||(r=Promise))((function(e,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,a)}c((o=o.apply(t,n||[])).next())}));var t,n,r,o}destroy(){(0,i.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),delete 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 nu=e=>"object"==typeof e&&"action"in e,ru=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),ou=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(nu).map(ru)).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:i}=t;return this.context.userLocale=o,this.context.contentLocale=i,!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 tu(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||{}}}},iu=()=>{const e=Wn();return{addEvent:t=>e(So(t)),clearEvents:()=>e(Oo()),setHistory:t=>e(qo(t)),setEventsRead:t=>e(zo(t)),setLoadedImageEventIds:t=>e(Jo(t)),ackEvent:t=>e(Eo(t)),setIsLoading:t=>e(Ko(t)),setParticipant:t=>e(Xo(t)),setHeaderTitle:t=>e(Wo(t)),setHeaderSubTitle:t=>e(Vo(t)),resetHistoryLoadedFlag:()=>e(Do()),setActiveService:()=>e(Uo()),initIdleDetachCountdown:t=>e(Po(t)),decrementIdleDetachCountdownCounter:()=>e(Io()),stopIdleDetachCountdownCounter:()=>e(ui()),clearIdleDetachCountdown:()=>e(No()),initResumeConversationPrompt:()=>e(Lo()),clearResumeConversationPrompt:()=>e(Ao()),setServiceDataItem:t=>e(Zo(t)),setFeatures:t=>e(Ho(t)),setFeatureEnabledState:t=>e($o(t)),clearFeatures:()=>e(ko()),setInitialState:t=>e(Go(t)),setUserSelectedOptions:t=>e(ci(t)),setUserSelectedOption:t=>e(ai(t)),showOption:t=>e(li(t)),hideOption:()=>e(Ro()),setServiceEntryMetadata:t=>e(Qo(t)),setBlockAutoEntrySwitch:t=>e(Bo(t)),setActiveEntryType:t=>e(Fo(t)),setUserEntryType:t=>e(si(t)),registerUpload:t=>e(Mo(t)),setUploadProgress:t=>e(ri(t)),setUploadComplete:t=>e(ti(t)),setUploadError:t=>e(ni(t)),clearAllUploads:()=>e(To()),setSeamlyContainerElement:t=>e(Yo(t))}},su=()=>{const{t}=Zi(),{title:n,subTitle:r}=Jn().headerTitles,o=er(),{isOpen:i}=Qi(),s=or(),a=Dn(ds),c=Gn(),l=s?.avatar??c,u=a?"":r,d=["message-count"];return i&&d.push("message-count__hide"),0===o&&d.push("message-count__empty"),(u||!i)&&(0,e.jsxs)("div",{className:$s("agent-info"),children:[(0,e.jsxs)("div",{className:$s("agent-info__graphic"),children:[l?(0,e.jsx)("img",{className:$s(s?.avatar?"avatar":"icon"),src:l,alt:""}):(0,e.jsx)(Ks,{name:"avatar",size:"32",alt:""}),(0,e.jsx)("span",{className:$s(d),"aria-hidden":"true",children:o})]}),(0,e.jsxs)("div",{className:$s("agent-info__body"),children:[(0,e.jsx)("p",{className:$s("agent-info__heading"),children:n??t("header.title")}),(0,e.jsx)("p",{className:$s("agent-info__text"),children:u})]})]})},au=({children:t,onCloseChat:n})=>{const{headerCollapseButtonId:r}=Jn(),o=(0,Pi.useRef)(null),{t:i}=Zi();return(0,e.jsxs)("header",{className:$s("chat__header"),children:[t,(0,e.jsx)("div",{className:$s("header-controls"),children:(0,e.jsx)("button",{type:"button",className:$s("button","header-controls__collapse"),onClick:n,ref:o,id:r,children:(0,e.jsx)(Ks,{name:"chevronDown",size:"32",alt:i("header.collapseApp")})})})]})},cu=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 ou(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
|
|
3
3
|
//# sourceMappingURL=~/index.min.js.map
|