@seamly/web-ui 20.5.0 → 20.7.0
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/CHANGELOG.md +791 -0
- package/build/dist/lib/index.debug.js +43 -43
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +4 -4
- package/build/dist/lib/index.js +432 -621
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +349 -766
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +151 -92
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +1 -1
- package/src/javascripts/domains/store/index.js +11 -11
- package/src/javascripts/domains/translations/middleware.js +6 -5
- package/src/javascripts/style-guide/states.js +31 -1
- package/src/javascripts/ui/components/conversation/conversation.js +31 -26
- package/src/javascripts/ui/components/suggestions/index.js +37 -26
- package/src/javascripts/ui/hooks/use-seamly-commands.js +0 -17
- package/src/javascripts/ui/utils/seamly-utils.js +5 -3
- package/src/stylesheets/5-components/_suggestions.scss +3 -3
- package/webpack/parts/dev-server.js +10 -1
- package/src/.DS_Store +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={574:e=>{"use strict";function t(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n(){this._defaults=[]}for(var o=function(){var e=s[i];n.prototype[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return this._defaults.push({fn:e,args:r}),this}},i=0,s=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];i<s.length;i++)o();n.prototype._setDefaults=function(e){var n,o,i=function(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=t(e))){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}(this._defaults);try{for(i.s();!(n=i.n()).done;){var s=n.value;e[s.fn].apply(e,function(e){if(Array.isArray(e))return r(e)}(o=s.args)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||t(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}catch(e){i.e(e)}finally{i.f()}},e.exports=n},766:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var i;"undefined"!=typeof window?i=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),i=void 0):i=self;var s=r(767),a=r(445),c=r(501),l=r(842),u=r(244),p=u.isObject,f=u.mixin,d=u.hasOwn,h=r(253),y=r(574);function b(){}e.exports=function(e,r){return"function"==typeof r?new t.Request("GET",e).end(r):1===arguments.length?new t.Request("GET",e):new t.Request(e,r)};var m=t=e.exports;t.Request=E,m.getXHR=function(){if(i.XMLHttpRequest&&(!i.location||"file:"!==i.location.protocol))return new XMLHttpRequest;throw new Error("Browser-only version of superagent could not find XHR")};var g="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function v(e){if(!p(e))return e;var t=[];for(var r in e)d(e,r)&&O(t,r,e[r]);return t.join("&")}function O(e,t,r){if(void 0!==r)if(null!==r)if(Array.isArray(r)){var n,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}(r);try{for(i.s();!(n=i.n()).done;)O(e,t,n.value)}catch(e){i.e(e)}finally{i.f()}}else if(p(r))for(var s in r)d(r,s)&&O(e,"".concat(t,"[").concat(s,"]"),r[s]);else e.push(encodeURI(t)+"="+encodeURIComponent(r));else e.push(encodeURI(t))}function j(e){for(var t,r,n={},o=e.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(t=o[i]).indexOf("="))?n[decodeURIComponent(t)]="":n[decodeURIComponent(t.slice(0,r))]=decodeURIComponent(t.slice(r+1));return n}function w(e){return/[/+]json($|[^-\w])/i.test(e)}function _(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){for(var t,r,n,o,i=e.split(/\r?\n/),s={},a=0,c=i.length;a<c;++a)-1!==(t=(r=i[a]).indexOf(":"))&&(n=r.slice(0,t).toLowerCase(),o=g(r.slice(t+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function E(e,t){var r=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,n=null;try{n=new _(r)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,r.xhr?(t.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,t.status=r.xhr.status?r.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),r.callback(t)}r.emit("response",n);try{r._isResponseOK(n)||(e=new Error(n.statusText||n.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=n,e.status=e.status||n.status,r.callback(e,n)):r.callback(null,n)}))}m.serializeObject=v,m.parseString=j,m.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},m.serialize={"application/x-www-form-urlencoded":c.stringify,"application/json":a},m.parse={"application/x-www-form-urlencoded":j,"application/json":JSON.parse},f(_.prototype,h.prototype),_.prototype._parseBody=function(e){var t=m.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&w(this.type)&&(t=m.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},_.prototype.toError=function(){var e=this.req,t=e.method,r=e.url,n="cannot ".concat(t," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=t,o.url=r,o},m.Response=_,s(E.prototype),f(E.prototype,l.prototype),E.prototype.type=function(e){return this.set("Content-Type",m.types[e]||e),this},E.prototype.accept=function(e){return this.set("Accept",m.types[e]||e),this},E.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===n(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=r.encoder?r.encoder:function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,o)},E.prototype.query=function(e){return"string"!=typeof e&&(e=v(e)),e&&this._query.push(e),this},E.prototype.attach=function(e,t,r){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,r||t.name)}return this},E.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},E.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var r=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),r(e,t)},E.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},E.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},E.prototype.ca=E.prototype.agent,E.prototype.buffer=E.prototype.ca,E.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},E.prototype.pipe=E.prototype.write,E.prototype._isHost=function(e){return e&&"object"===n(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},E.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||b,this._finalizeQueryString(),this._end()},E.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},E.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=m.getXHR();var t=this.xhr,r=this._formData||this._data;this._setTimeouts(),t.addEventListener("readystatechange",(function(){var r=t.readyState;if(r>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}}));var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(e._uploadTimeoutTimer)),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.addEventListener("progress",n.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",n.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||m.serialize[o?o.split(";")[0]:""];!i&&w(o)&&(i=m.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&d(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===r?null:r)},m.agent=function(){return new y};for(var x=function(){var e=T[S];y.prototype[e.toLowerCase()]=function(t,r){var n=new m.Request(e,t);return this._setDefaults(n),r&&n.end(r),n}},S=0,T=["GET","POST","OPTIONS","PATCH","PUT","DELETE"];S<T.length;S++)x();function P(e,t,r){var n=m("DELETE",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}y.prototype.del=y.prototype.delete,m.get=function(e,t,r){var n=m("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},m.head=function(e,t,r){var n=m("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},m.options=function(e,t,r){var n=m("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},m.del=P,m.delete=P,m.patch=function(e,t,r){var n=m("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},m.post=function(e,t,r){var n=m("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},m.put=function(e,t,r){var n=m("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},842:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var o=r(695),i=r(244),s=i.isObject,a=i.hasOwn;function c(){}e.exports=c,c.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},c.prototype.parse=function(e){return this._parser=e,this},c.prototype.responseType=function(e){return this._responseType=e,this},c.prototype.serialize=function(e){return this._serializer=e,this},c.prototype.timeout=function(e){if(!e||"object"!==n(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(a(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},c.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var l=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),u=new Set([408,413,429,500,502,503,504,521,522,524]);c.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(e,t);if(!0===r)return!0;if(!1===r)return!1}catch(e){console.error(e)}if(t&&t.status&&u.has(t.status))return!0;if(e){if(e.code&&l.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},c.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},c.prototype.then=function(e,t){var r=this;if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){n.on("abort",(function(){if(!(r._maxRetries&&r._maxRetries>r._retries))if(r.timedout&&r.timedoutError)t(r.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=r.status,e.method=r.method,e.url=r.url,t(e)}})),n.end((function(r,n){r?t(r):e(n)}))}))}return this._fullfilledPromise.then(e,t)},c.prototype.catch=function(e){return this.then(void 0,e)},c.prototype.use=function(e){return e(this),this},c.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},c.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},c.prototype.get=function(e){return this._header[e.toLowerCase()]},c.prototype.getHeader=c.prototype.get,c.prototype.set=function(e,t){if(s(e)){for(var r in e)a(e,r)&&this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},c.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},c.prototype.field=function(e,t,r){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(s(e)){for(var n in e)a(e,n)&&this.field(n,e[n]);return this}if(Array.isArray(t)){for(var o in t)a(t,o)&&this.field(e,t[o]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),r?this._getFormData().append(e,t,r):this._getFormData().append(e,t),this},c.prototype.abort=function(){if(this._aborted)return this;if(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req){if(o.gte(process.version,"v13.0.0")&&o.lt(process.version,"v14.0.0"))throw new Error("Superagent does not work in v13 properly with abort() due to Node.js core changes");o.gte(process.version,"v14.0.0")&&(this.req.destroyed=!0),this.req.abort()}return this.clearTimeout(),this.emit("abort"),this},c.prototype._auth=function(e,t,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},c.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},c.prototype.redirects=function(e){return this._maxRedirects=e,this},c.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},c.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},c.prototype.send=function(e){var t=s(e),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&s(this._data))for(var n in e)a(e,n)&&(this._data[n]=e[n]);else"string"==typeof e?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||r||this.type("json"),this},c.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},c.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.slice(t+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.slice(0,t)+"?"+r.join("&")}}},c.prototype._appendQueryString=function(){console.warn("Unsupported")},c.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error("".concat(e+t,"ms exceeded"));n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.timedoutError=n,this.abort(),this.callback(n)}},c.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},253:(e,t,r)=>{"use strict";var n=r(244);function o(){}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=n.type(t);var r=n.params(t);for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(this[o]=r[o]);this.links={};try{e.link&&(this.links=n.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){var t=Math.trunc(e/100);this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},244:(e,t)=>{"use strict";function r(e){return r="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},r(e)}function n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){var t,r={},o=n(e.split(/ *; */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *= */),s=i.shift(),a=i.shift();s&&a&&(r[s]=a)}}catch(e){o.e(e)}finally{o.f()}return r},t.parseLinks=function(e){var t,r={},o=n(e.split(/ *, */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *; */),s=i[0].slice(1,-1);r[i[1].split(/ *= */)[1].slice(1,-1)]=s}}catch(e){o.e(e)}finally{o.f()}return r},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e},t.isObject=function(e){return null!==e&&"object"===r(e)},t.hasOwn=Object.hasOwn||function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(new Object(e),t)},t.mixin=function(e,r){for(var n in r)t.hasOwn(r,n)&&(e[n]=r[n])}},718:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC3986";e.exports={default:n,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:n}},501:(e,t,r)=>{"use strict";var n=r(383),o=r(409),i=r(718);e.exports={formats:i,parse:o,stringify:n}},409:(e,t,r)=>{"use strict";var n=r(753),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},l=function(e,t,r,n){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(i),l=a?i.slice(0,a.index):i,u=[];if(l){if(!r.plainObjects&&o.call(Object.prototype,l)&&!r.allowPrototypes)return;u.push(l)}for(var p=0;r.depth>0&&null!==(a=s.exec(i))&&p<r.depth;){if(p+=1,!r.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(a[1])}return a&&u.push("["+i.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:c(t,r),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&r.parseArrays)s=[].concat(o);else{s=r.plainObjects?Object.create(null):{};var l="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=parseInt(l,10);r.parseArrays||""!==l?!isNaN(u)&&a!==l&&String(u)===l&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(s=[])[u]=o:"__proto__"!==l&&(s[l]=o):s={0:o}}o=s}return o}(u,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var r,l={},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,f=u.split(t.delimiter,p),d=-1,h=t.charset;if(t.charsetSentinel)for(r=0;r<f.length;++r)0===f[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===f[r]?h="utf-8":"utf8=%26%2310003%3B"===f[r]&&(h="iso-8859-1"),d=r,r=f.length);for(r=0;r<f.length;++r)if(r!==d){var y,b,m=f[r],g=m.indexOf("]="),v=-1===g?m.indexOf("="):g+1;-1===v?(y=t.decoder(m,s.decoder,h,"key"),b=t.strictNullHandling?null:""):(y=t.decoder(m.slice(0,v),s.decoder,h,"key"),b=n.maybeMap(c(m.slice(v+1),t),(function(e){return t.decoder(e,s.decoder,h,"value")}))),b&&t.interpretNumericEntities&&"iso-8859-1"===h&&(b=a(b)),m.indexOf("[]=")>-1&&(b=i(b)?[b]:b),o.call(l,y)?l[y]=n.combine(l[y],b):l[y]=b}return l}(e,r):e,p=r.plainObjects?Object.create(null):{},f=Object.keys(u),d=0;d<f.length;++d){var h=f[d],y=l(h,u[h],r,"string"==typeof e);p=n.merge(p,y,r)}return!0===r.allowSparse?p:n.compact(p)}},383:(e,t,r)=>{"use strict";var n=r(478),o=r(753),i=r(718),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,l=String.prototype.split,u=Array.prototype.push,p=function(e,t){u.apply(e,c(t)?t:[t])},f=Date.prototype.toISOString,d=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return f.call(e)},skipNulls:!1,strictNullHandling:!1},y={},b=function e(t,r,i,s,a,u,f,d,b,m,g,v,O,j,w){for(var _,E=t,x=w,S=0,T=!1;void 0!==(x=x.get(y))&&!T;){var P=x.get(t);if(S+=1,void 0!==P){if(P===S)throw new RangeError("Cyclic object value");T=!0}void 0===x.get(y)&&(S=0)}if("function"==typeof f?E=f(r,E):E instanceof Date?E=m(E):"comma"===i&&c(E)&&(E=o.maybeMap(E,(function(e){return e instanceof Date?m(e):e}))),null===E){if(s)return u&&!O?u(r,h.encoder,j,"key",g):r;E=""}if("string"==typeof(_=E)||"number"==typeof _||"boolean"==typeof _||"symbol"==typeof _||"bigint"==typeof _||o.isBuffer(E)){if(u){var C=O?r:u(r,h.encoder,j,"key",g);if("comma"===i&&O){for(var A=l.call(String(E),","),I="",N=0;N<A.length;++N)I+=(0===N?"":",")+v(u(A[N],h.encoder,j,"value",g));return[v(C)+(c(E)&&1===A.length?"[]":"")+"="+I]}return[v(C)+"="+v(u(E,h.encoder,j,"value",g))]}return[v(r)+"="+v(String(E))]}var D,k=[];if(void 0===E)return k;if("comma"===i&&c(E))D=[{value:E.length>0?E.join(",")||null:void 0}];else if(c(f))D=f;else{var R=Object.keys(E);D=d?R.sort(d):R}for(var L="comma"===i&&c(E)&&1===E.length?r+"[]":r,M=0;M<D.length;++M){var U=D[M],F="object"==typeof U&&void 0!==U.value?U.value:E[U];if(!a||null!==F){var B=c(E)?"function"==typeof i?i(L,U):L:L+(b?"."+U:"["+U+"]");w.set(t,S);var H=n();H.set(y,w),p(k,e(F,B,i,s,a,u,f,d,b,m,g,v,O,j,H))}}return k};e.exports=function(e,t){var r,o=e,l=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=i.formatters[r],o=h.filter;return("function"==typeof e.filter||c(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof l.filter?o=(0,l.filter)("",o):c(l.filter)&&(r=l.filter);var u,f=[];if("object"!=typeof o||null===o)return"";u=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var d=a[u];r||(r=Object.keys(o)),l.sort&&r.sort(l.sort);for(var y=n(),m=0;m<r.length;++m){var g=r[m];l.skipNulls&&null===o[g]||p(f,b(o[g],g,d,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,y))}var v=f.join(l.delimiter),O=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?O+="utf8=%26%2310003%3B&":O+="utf8=%E2%9C%93&"),v.length>0?O+v:""}},753:(e,t,r)=>{"use strict";var n=r(718),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var l=a[c],u=s[l];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:s,prop:l}),r.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===r)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",l=0;l<a.length;++l){var u=a.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===n.RFC1738&&(40===u||41===u)?c+=a.charAt(l):u<128?c+=s[u]:u<2048?c+=s[192|u>>6]+s[128|63&u]:u<55296||u>=57344?c+=s[224|u>>12]+s[128|u>>6&63]+s[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&a.charCodeAt(l)),c+=s[240|u>>18]+s[128|u>>12&63]+s[128|u>>6&63]+s[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return i(t)&&!i(r)&&(s=a(t,n)),i(t)&&i(r)?(r.forEach((function(r,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&r&&"object"==typeof r?t[i]=e(s,r,n):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var s=r[i];return o.call(t,i)?t[i]=e(t[i],s,n):t[i]=s,t}),s)}}},905:e=>{e.exports=()=>()=>null},698:e=>{e.exports=null},924:(e,t,r)=>{"use strict";var n=r(210),o=r(559),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},559:(e,t,r)=>{"use strict";var n=r(612),o=r(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||n.call(s,i),c=o("%Object.getOwnPropertyDescriptor%",!0),l=o("%Object.defineProperty%",!0),u=o("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){var t=a(n,s,arguments);if(c&&l){var r=c(t,"length");r.configurable&&l(t,"length",{value:1+u(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(n,i,arguments)};l?l(e.exports,"apply",{value:p}):e.exports.apply=p},767:e=>{function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<n.length;o++)if((r=n[o])===t||r.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}},289:(e,t,r)=>{"use strict";var n=r(215),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,a=Object.defineProperty,c=r(44)(),l=a&&c,u=function(e,t,r,n){var o;(!(t in e)||"function"==typeof(o=n)&&"[object Function]"===i.call(o)&&n())&&(l?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},p=function(e,t){var r=arguments.length>2?arguments[2]:{},i=n(t);o&&(i=s.call(i,Object.getOwnPropertySymbols(t)));for(var a=0;a<i.length;a+=1)u(e,i[a],t[i[a]],r[i[a]])};p.supportsDescriptors=!!l,e.exports=p},445:e=>{e.exports=s,s.default=s,s.stable=u,s.stableStringify=u;var t="[...]",r="[Circular]",n=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,r,s){var a;void 0===s&&(s=i()),c(e,"",0,[],void 0,0,s);try{a=0===o.length?JSON.stringify(e,t,r):JSON.stringify(e,f(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==n.length;){var l=n.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function a(e,t,r,i){var s=Object.getOwnPropertyDescriptor(i,r);void 0!==s.get?s.configurable?(Object.defineProperty(i,r,{value:e}),n.push([i,r,t,s])):o.push([t,r,e]):(i[r]=e,n.push([i,r,t]))}function c(e,n,o,i,s,l,u){var p;if(l+=1,"object"==typeof e&&null!==e){for(p=0;p<i.length;p++)if(i[p]===e)return void a(r,e,n,s);if(void 0!==u.depthLimit&&l>u.depthLimit)return void a(t,e,n,s);if(void 0!==u.edgesLimit&&o+1>u.edgesLimit)return void a(t,e,n,s);if(i.push(e),Array.isArray(e))for(p=0;p<e.length;p++)c(e[p],p,p,i,e,l,u);else{var f=Object.keys(e);for(p=0;p<f.length;p++){var d=f[p];c(e[d],d,p,i,e,l,u)}}i.pop()}}function l(e,t){return e<t?-1:e>t?1:0}function u(e,t,r,s){void 0===s&&(s=i());var a,c=p(e,"",0,[],void 0,0,s)||e;try{a=0===o.length?JSON.stringify(c,t,r):JSON.stringify(c,f(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==n.length;){var l=n.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function p(e,o,i,s,c,u,f){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;d<s.length;d++)if(s[d]===e)return void a(r,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&u>f.depthLimit)return void a(t,e,o,c);if(void 0!==f.edgesLimit&&i+1>f.edgesLimit)return void a(t,e,o,c);if(s.push(e),Array.isArray(e))for(d=0;d<e.length;d++)p(e[d],d,d,s,e,u,f);else{var h={},y=Object.keys(e).sort(l);for(d=0;d<y.length;d++){var b=y[d];p(e[b],b,d,s,e,u,f),h[b]=e[b]}if(void 0===c)return h;n.push([c,o,e]),c[o]=h}s.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(o.length>0)for(var n=0;n<o.length;n++){var i=o[n];if(i[1]===t&&i[0]===r){r=i[2],o.splice(n,1);break}}return e.call(this,t,r)}}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(t+i);for(var s,a=r.call(arguments,1),c=function(){if(this instanceof s){var t=i.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(r.call(arguments)))},l=Math.max(0,i.length-a.length),u=[],p=0;p<l;p++)u.push("$"+p);if(s=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(c),i.prototype){var f=function(){};f.prototype=i.prototype,s.prototype=new f,f.prototype=null}return s}},612:(e,t,r)=>{"use strict";var n=r(648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var l=function(){throw new s},u=c?function(){try{return l}catch(e){try{return c(arguments,"callee").get}catch(e){return l}}}():l,p=r(405)(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},h="undefined"==typeof Uint8Array?n:f(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":p?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?f(""[Symbol.iterator]()):n,"%Symbol%":p?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":u,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},b=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=f(o.prototype))}return y[t]=r,r},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=r(612),v=r(642),O=g.call(Function.call,Array.prototype.concat),j=g.call(Function.apply,Array.prototype.splice),w=g.call(Function.call,String.prototype.replace),_=g.call(Function.call,String.prototype.slice),E=g.call(Function.call,RegExp.prototype.exec),x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,T=function(e){var t=_(e,0,1),r=_(e,-1);if("%"===t&&"%"!==r)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return w(e,x,(function(e,t,r,o){n[n.length]=r?w(o,S,"$1"):t||e})),n},P=function(e,t){var r,n=e;if(v(m,n)&&(n="%"+(r=m[n])[0]+"%"),v(y,n)){var i=y[n];if(i===d&&(i=b(n)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===E(/^%?[^%]*%?$/g,e))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=T(e),n=r.length>0?r[0]:"",i=P("%"+n+"%",t),a=i.name,l=i.value,u=!1,p=i.alias;p&&(n=p[0],j(r,O([0,1],p)));for(var f=1,d=!0;f<r.length;f+=1){var h=r[f],b=_(h,0,1),m=_(h,-1);if(('"'===b||"'"===b||"`"===b||'"'===m||"'"===m||"`"===m)&&b!==m)throw new o("property names with quotes must have matching quotes");if("constructor"!==h&&d||(u=!0),v(y,a="%"+(n+="."+h)+"%"))l=y[a];else if(null!=l){if(!(h in l)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&f+1>=r.length){var g=c(l,h);l=(d=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:l[h]}else d=v(l,h),l=l[h];d&&!u&&(y[a]=l)}}return l}},221:e=>{"use strict";"undefined"!=typeof self?e.exports=self:"undefined"!=typeof window?e.exports=window:e.exports=Function("return this")()},503:(e,t,r)=>{"use strict";var n=r(289),o=r(221),i=r(168),s=r(471),a=i(),c=function(){return a};n(c,{getPolyfill:i,implementation:o,shim:s}),e.exports=c},168:(e,t,r)=>{"use strict";var n=r(221);e.exports=function(){return"object"==typeof r.g&&r.g&&r.g.Math===Math&&r.g.Array===Array?r.g:n}},471:(e,t,r)=>{"use strict";var n=r(289),o=r(168);e.exports=function(){var e=o();if(n.supportsDescriptors){var t=Object.getOwnPropertyDescriptor(e,"globalThis");t&&(!t.configurable||!t.enumerable&&t.writable&&globalThis===e)||Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else"object"==typeof globalThis&&globalThis===e||(e.globalThis=e);return e}},44:(e,t,r)=>{"use strict";var n=r(210)("%Object.defineProperty%",!0),o=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};o.hasArrayLengthDefineBug=function(){if(!o())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=o},405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,r)=>{"use strict";var n=r(612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},679:e=>{e.exports=function(e){var t={},r=[];(e=e||this).on=function(r,n,o){return(t[r]=t[r]||[]).push([n,o]),e},e.off=function(n,o){n||(t={});for(var i=t[n]||r,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(n){for(var o,i=t[n]||r,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],r.slice.call(arguments,1));return e}}},631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=n&&o&&"function"==typeof o.get?o.get:null,s=n&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=a&&c&&"function"==typeof c.get?c.get:null,u=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,f="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,b=Function.prototype.toString,m=String.prototype.match,g=String.prototype.slice,v=String.prototype.replace,O=String.prototype.toUpperCase,j=String.prototype.toLowerCase,w=RegExp.prototype.test,_=Array.prototype.concat,E=Array.prototype.join,x=Array.prototype.slice,S=Math.floor,T="function"==typeof BigInt?BigInt.prototype.valueOf:null,P=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,A="function"==typeof Symbol&&"object"==typeof Symbol.iterator,I="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,D=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function k(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-S(-e):S(e);if(n!==e){var o=String(n),i=g.call(t,o.length+1);return v.call(o,r,"$&_")+"."+v.call(v.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(t,r,"$&_")}var R=r(654),L=R.custom,M=$(L)?L:null;function U(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function F(e){return v.call(String(e),/"/g,""")}function B(e){return!("[object Array]"!==q(e)||I&&"object"==typeof e&&I in e)}function H(e){return!("[object RegExp]"!==q(e)||I&&"object"==typeof e&&I in e)}function $(e){if(A)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!C)return!1;try{return C.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,n,o){var a=r||{};if(V(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!V(a,"customInspect")||a.customInspect;if("boolean"!=typeof c&&"symbol"!==c)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var y=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return G(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var O=String(t);return y?k(t,O):O}if("bigint"==typeof t){var w=String(t)+"n";return y?k(t,w):w}var S=void 0===a.depth?5:a.depth;if(void 0===n&&(n=0),n>=S&&S>0&&"object"==typeof t)return B(t)?"[Array]":"[Object]";var P,L=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=E.call(Array(e.indent+1)," ")}return{base:r,prev:E.call(Array(t+1),r)}}(a,n);if(void 0===o)o=[];else if(W(o,t)>=0)return"[Circular]";function z(t,r,i){if(r&&(o=x.call(o)).push(r),i){var s={depth:a.depth};return V(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,n+1,o)}return e(t,a,n+1,o)}if("function"==typeof t&&!H(t)){var K=function(e){if(e.name)return e.name;var t=m.call(b.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ee=Z(t,z);return"[Function"+(K?": "+K:" (anonymous)")+"]"+(ee.length>0?" { "+E.call(ee,", ")+" }":"")}if($(t)){var te=A?v.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(t);return"object"!=typeof t||A?te:Y(te)}if((P=t)&&"object"==typeof P&&("undefined"!=typeof HTMLElement&&P instanceof HTMLElement||"string"==typeof P.nodeName&&"function"==typeof P.getAttribute)){for(var re="<"+j.call(String(t.nodeName)),ne=t.attributes||[],oe=0;oe<ne.length;oe++)re+=" "+ne[oe].name+"="+U(F(ne[oe].value),"double",a);return re+=">",t.childNodes&&t.childNodes.length&&(re+="..."),re+"</"+j.call(String(t.nodeName))+">"}if(B(t)){if(0===t.length)return"[]";var ie=Z(t,z);return L&&!function(e){for(var t=0;t<e.length;t++)if(W(e[t],"\n")>=0)return!1;return!0}(ie)?"["+X(ie,L)+"]":"[ "+E.call(ie,", ")+" ]"}if(function(e){return!("[object Error]"!==q(e)||I&&"object"==typeof e&&I in e)}(t)){var se=Z(t,z);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+E.call(se,", ")+" }":"{ ["+String(t)+"] "+E.call(_.call("[cause]: "+z(t.cause),se),", ")+" }"}if("object"==typeof t&&c){if(M&&"function"==typeof t[M]&&R)return R(t,{depth:S-n});if("symbol"!==c&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{l.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ae=[];return s.call(t,(function(e,r){ae.push(z(r,t,!0)+" => "+z(e,t))})),Q("Map",i.call(t),ae,L)}if(function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ce=[];return u.call(t,(function(e){ce.push(z(e,t))})),Q("Set",l.call(t),ce,L)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return J("WeakMap");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return J("WeakSet");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{return d.call(e),!0}catch(e){}return!1}(t))return J("WeakRef");if(function(e){return!("[object Number]"!==q(e)||I&&"object"==typeof e&&I in e)}(t))return Y(z(Number(t)));if(function(e){if(!e||"object"!=typeof e||!T)return!1;try{return T.call(e),!0}catch(e){}return!1}(t))return Y(z(T.call(t)));if(function(e){return!("[object Boolean]"!==q(e)||I&&"object"==typeof e&&I in e)}(t))return Y(h.call(t));if(function(e){return!("[object String]"!==q(e)||I&&"object"==typeof e&&I in e)}(t))return Y(z(String(t)));if(!function(e){return!("[object Date]"!==q(e)||I&&"object"==typeof e&&I in e)}(t)&&!H(t)){var le=Z(t,z),ue=D?D(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",fe=!ue&&I&&Object(t)===t&&I in t?g.call(q(t),8,-1):pe?"Object":"",de=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(fe||pe?"["+E.call(_.call([],fe||[],pe||[]),": ")+"] ":"");return 0===le.length?de+"{}":L?de+"{"+X(le,L)+"}":de+"{ "+E.call(le,", ")+" }"}return String(t)};var z=Object.prototype.hasOwnProperty||function(e){return e in this};function V(e,t){return z.call(e,t)}function q(e){return y.call(e)}function W(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function G(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return G(g.call(e,0,t.maxStringLength),t)+n}return U(v.call(v.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,K),"single",t)}function K(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+O.call(t.toString(16))}function Y(e){return"Object("+e+")"}function J(e){return e+" { ? }"}function Q(e,t,r,n){return e+" ("+t+") {"+(n?X(r,n):E.call(r,", "))+"}"}function X(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+E.call(e,","+r)+"\n"+t.prev}function Z(e,t){var r=B(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=V(e,o)?t(e[o],e):""}var i,s="function"==typeof P?P(e):[];if(A){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var c in e)V(e,c)&&(r&&String(Number(c))===c&&c<e.length||A&&i["$"+c]instanceof Symbol||(w.call(/[^\w$]/,c)?n.push(t(c,e)+": "+t(e[c],e)):n.push(c+": "+t(e[c],e))));if("function"==typeof P)for(var l=0;l<s.length;l++)N.call(e,s[l])&&n.push("["+t(s[l])+"]: "+t(e[s[l]],e));return n}},987:(e,t,r)=>{"use strict";var n;if(!Object.keys){var o=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=r(414),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),l=a.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(e){var t=e.constructor;return t&&t.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&o.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{p(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===i.call(e),n=s(e),a=t&&"[object String]"===i.call(e),f=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var h=l&&r;if(a&&e.length>0&&!o.call(e,0))for(var y=0;y<e.length;++y)f.push(String(y));if(n&&e.length>0)for(var b=0;b<e.length;++b)f.push(String(b));else for(var m in e)h&&"prototype"===m||!o.call(e,m)||f.push(String(m));if(c)for(var g=function(e){if("undefined"==typeof window||!d)return p(e);try{return p(e)}catch(e){return!1}}(e),v=0;v<u.length;++v)g&&"constructor"===u[v]||!o.call(e,u[v])||f.push(u[v]);return f}}e.exports=n},215:(e,t,r)=>{"use strict";var n=Array.prototype.slice,o=r(414),i=Object.keys,s=i?function(e){return i(e)}:r(987),a=Object.keys;s.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return o(e)?a(n.call(e)):a(e)})}else Object.keys=s;return Object.keys||s},e.exports=s},414:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},478:(e,t,r)=>{"use strict";var n=r(210),o=r(924),i=r(631),s=n("%TypeError%"),a=n("%WeakMap%",!0),c=n("%Map%",!0),l=o("WeakMap.prototype.get",!0),u=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),f=o("Map.prototype.get",!0),d=o("Map.prototype.set",!0),h=o("Map.prototype.has",!0),y=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new s("Side channel does not contain "+i(e))},get:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return l(e,n)}else if(c){if(t)return f(t,n)}else if(r)return function(e,t){var r=y(e,t);return r&&r.value}(r,n)},has:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return p(e,n)}else if(c){if(t)return h(t,n)}else if(r)return function(e,t){return!!y(e,t)}(r,n);return!1},set:function(n,o){a&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new a),u(e,n,o)):c?(t||(t=new c),d(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=y(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n}},839:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,r=e.Symbol;if("function"==typeof r)if(r.observable)t=r.observable;else{t=r.for("https://github.com/benlesh/symbol-observable");try{r.observable=t}catch(e){}}else t="@@observable";return t}},868:(e,t,r)=>{e.exports=r(839)},813:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},n(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NO_IL=t.NO=t.MemoryStream=t.Stream=void 0;var i=r(868),s=r(503),a=i.default(s.getPolyfill()),c={};function l(){}function u(e){for(var t=e.length,r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function p(e,t,r){try{return e.f(t)}catch(e){return r._e(e),c}}t.NO=c;var f={_n:l,_e:l,_c:l};function d(e){e._start=function(e){e.next=e._n,e.error=e._e,e.complete=e._c,this.start(e)},e._stop=e.stop}t.NO_IL=f;var h=function(){function e(e,t){this._stream=e,this._listener=t}return e.prototype.unsubscribe=function(){this._stream._remove(this._listener)},e}(),y=function(){function e(e){this._listener=e}return e.prototype.next=function(e){this._listener._n(e)},e.prototype.error=function(e){this._listener._e(e)},e.prototype.complete=function(){this._listener._c()},e}(),b=function(){function e(e){this.type="fromObservable",this.ins=e,this.active=!1}return e.prototype._start=function(e){this.out=e,this.active=!0,this._sub=this.ins.subscribe(new y(e)),this.active||this._sub.unsubscribe()},e.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},e}(),m=function(){function e(e){this.type="merge",this.insArr=e,this.out=c,this.ac=0}return e.prototype._start=function(e){this.out=e;var t=this.insArr,r=t.length;this.ac=r;for(var n=0;n<r;n++)t[n]._add(this)},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,r=0;r<t;r++)e[r]._remove(this);this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){if(--this.ac<=0){var e=this.out;if(e===c)return;e._c()}},e}(),g=function(){function e(e,t,r){this.i=e,this.out=t,this.p=r,r.ils.push(this)}return e.prototype._n=function(e){var t=this.p,r=this.out;if(r!==c&&t.up(e,this.i)){var n=u(t.vals);r._n(n)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.p;e.out!==c&&0==--e.Nc&&e.out._c()},e}(),v=function(){function e(e){this.type="combine",this.insArr=e,this.out=c,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return e.prototype.up=function(e,t){var r=this.vals[t],n=this.Nn?r===c?--this.Nn:this.Nn:0;return this.vals[t]=e,0===n},e.prototype._start=function(e){this.out=e;var t=this.insArr,r=this.Nc=this.Nn=t.length,n=this.vals=new Array(r);if(0===r)e._n([]),e._c();else for(var o=0;o<r;o++)n[o]=c,t[o]._add(new g(o,e,this))},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,r=this.ils,n=0;n<t;n++)e[n]._remove(r[n]);this.out=c,this.ils=[],this.vals=[]},e}(),O=function(){function e(e){this.type="fromArray",this.a=e}return e.prototype._start=function(e){for(var t=this.a,r=0,n=t.length;r<n;r++)e._n(t[r]);e._c()},e.prototype._stop=function(){},e}(),j=function(){function e(e){this.type="fromPromise",this.on=!1,this.p=e}return e.prototype._start=function(e){var t=this;this.on=!0,this.p.then((function(r){t.on&&(e._n(r),e._c())}),(function(t){e._e(t)})).then(l,(function(e){setTimeout((function(){throw e}))}))},e.prototype._stop=function(){this.on=!1},e}(),w=function(){function e(e){this.type="periodic",this.period=e,this.intervalID=-1,this.i=0}return e.prototype._start=function(e){var t=this;this.intervalID=setInterval((function(){e._n(t.i++)}),this.period)},e.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},e}(),_=function(){function e(e,t){this.type="debug",this.ins=e,this.out=c,this.s=l,this.l="","string"==typeof t?this.l=t:"function"==typeof t&&(this.s=t)}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=this.s,n=this.l;if(r!==l)try{r(e)}catch(e){t._e(e)}else n?console.log(n+":",e):console.log(e);t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),E=function(){function e(e,t){this.type="drop",this.ins=t,this.out=c,this.max=e,this.dropped=0}return e.prototype._start=function(e){this.out=e,this.dropped=0,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&this.dropped++>=this.max&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),x=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(){this.op.end()},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.end()},e}(),S=function(){function e(e,t){this.type="endWhen",this.ins=t,this.out=c,this.o=e,this.oil=f}return e.prototype._start=function(e){this.out=e,this.o._add(this.oil=new x(e,this)),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=c,this.oil=f},e.prototype.end=function(){var e=this.out;e!==c&&e._c()},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.end()},e}(),T=function(){function e(e,t){this.type="filter",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&r&&t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),P=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(e){this.out._n(e)},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.inner=c,this.op.less()},e}(),C=function(){function e(e){this.type="flatten",this.ins=e,this.out=c,this.open=!0,this.inner=c,this.il=f}return e.prototype._start=function(e){this.out=e,this.open=!0,this.inner=c,this.il=f,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.inner!==c&&this.inner._remove(this.il),this.out=c,this.open=!0,this.inner=c,this.il=f},e.prototype.less=function(){var e=this.out;e!==c&&(this.open||this.inner!==c||e._c())},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=this.inner,n=this.il;r!==c&&n!==f&&r._remove(n),(this.inner=e)._add(this.il=new P(t,this))}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.open=!1,this.less()},e}(),A=function(){function e(e,t,r){var n=this;this.type="fold",this.ins=r,this.out=c,this.f=function(t){return e(n.acc,t)},this.acc=this.seed=t}return e.prototype._start=function(e){this.out=e,this.acc=this.seed,e._n(this.acc),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.acc=this.seed},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&t._n(this.acc=r)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),I=function(){function e(e){this.type="last",this.ins=e,this.out=c,this.has=!1,this.val=c}return e.prototype._start=function(e){this.out=e,this.has=!1,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.val=c},e.prototype._n=function(e){this.has=!0,this.val=e},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&(this.has?(e._n(this.val),e._c()):e._e(new Error("last() failed because input stream completed")))},e}(),N=function(){function e(e,t){this.type="map",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&t._n(r)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),D=function(){function e(e){this.type="remember",this.ins=e,this.out=c}return e.prototype._start=function(e){this.out=e,this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),k=function(){function e(e,t){this.type="replaceError",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;if(t!==c)try{this.ins._remove(this),(this.ins=this.f(e))._add(this)}catch(e){t._e(e)}},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),R=function(){function e(e,t){this.type="startWith",this.ins=e,this.out=c,this.val=t}return e.prototype._start=function(e){this.out=e,this.out._n(this.val),this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),L=function(){function e(e,t){this.type="take",this.ins=t,this.out=c,this.max=e,this.taken=0}return e.prototype._start=function(e){this.out=e,this.taken=0,this.max<=0?e._c():this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=++this.taken;r<this.max?t._n(e):r===this.max&&(t._n(e),t._c())}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),M=function(){function e(e){this._prod=e||c,this._ils=[],this._stopID=c,this._dl=c,this._d=!1,this._target=null,this._err=c}return e.prototype._n=function(e){var t=this._ils,r=t.length;if(this._d&&this._dl._n(e),1==r)t[0]._n(e);else{if(0==r)return;for(var n=u(t),o=0;o<r;o++)n[o]._n(e)}},e.prototype._e=function(e){if(this._err===c){this._err=e;var t=this._ils,r=t.length;if(this._x(),this._d&&this._dl._e(e),1==r)t[0]._e(e);else{if(0==r)return;for(var n=u(t),o=0;o<r;o++)n[o]._e(e)}if(!this._d&&0==r)throw this._err}},e.prototype._c=function(){var e=this._ils,t=e.length;if(this._x(),this._d&&this._dl._c(),1==t)e[0]._c();else{if(0==t)return;for(var r=u(e),n=0;n<t;n++)r[n]._c()}},e.prototype._x=function(){0!==this._ils.length&&(this._prod!==c&&this._prod._stop(),this._err=c,this._ils=[])},e.prototype._stopNow=function(){this._prod._stop(),this._err=c,this._stopID=c},e.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var r=this._ils;if(r.push(e),!(r.length>1))if(this._stopID!==c)clearTimeout(this._stopID),this._stopID=c;else{var n=this._prod;n!==c&&n._start(this)}},e.prototype._remove=function(e){var t=this,r=this._target;if(r)return r._remove(e);var n=this._ils,o=n.indexOf(e);o>-1&&(n.splice(o,1),this._prod!==c&&n.length<=0?(this._err=c,this._stopID=setTimeout((function(){return t._stopNow()}))):1===n.length&&this._pruneCycles())},e.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},e.prototype._hasNoSinks=function(e,t){if(-1!==t.indexOf(e))return!0;if(e.out===this)return!0;if(e.out&&e.out!==c)return this._hasNoSinks(e.out,t.concat(e));if(e._ils){for(var r=0,n=e._ils.length;r<n;r++)if(!this._hasNoSinks(e._ils[r],t.concat(e)))return!1;return!0}return!1},e.prototype.ctor=function(){return this instanceof U?U:e},e.prototype.addListener=function(e){e._n=e.next||l,e._e=e.error||l,e._c=e.complete||l,this._add(e)},e.prototype.removeListener=function(e){this._remove(e)},e.prototype.subscribe=function(e){return this.addListener(e),new h(this,e)},e.prototype[a]=function(){return this},e.create=function(t){if(t){if("function"!=typeof t.start||"function"!=typeof t.stop)throw new Error("producer requires both start and stop functions");d(t)}return new e(t)},e.createWithMemory=function(e){return e&&d(e),new U(e)},e.never=function(){return new e({_start:l,_stop:l})},e.empty=function(){return new e({_start:function(e){e._c()},_stop:l})},e.throw=function(t){return new e({_start:function(e){e._e(t)},_stop:l})},e.from=function(t){if("function"==typeof t[a])return e.fromObservable(t);if("function"==typeof t.then)return e.fromPromise(t);if(Array.isArray(t))return e.fromArray(t);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},e.of=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.fromArray(t)},e.fromArray=function(t){return new e(new O(t))},e.fromPromise=function(t){return new e(new j(t))},e.fromObservable=function(t){if(void 0!==t.endWhen)return t;var r="function"==typeof t[a]?t[a]():t;return new e(new b(r))},e.periodic=function(t){return new e(new w(t))},e.prototype._map=function(e){return new(this.ctor())(new N(e,this))},e.prototype.map=function(e){return this._map(e)},e.prototype.mapTo=function(e){var t=this.map((function(){return e}));return t._prod.type="mapTo",t},e.prototype.filter=function(t){var r,n,o=this._prod;return new e(o instanceof T?new T((r=o.f,n=t,function(e){return r(e)&&n(e)}),o.ins):new T(t,this))},e.prototype.take=function(e){return new(this.ctor())(new L(e,this))},e.prototype.drop=function(t){return new e(new E(t,this))},e.prototype.last=function(){return new e(new I(this))},e.prototype.startWith=function(e){return new U(new R(this,e))},e.prototype.endWhen=function(e){return new(this.ctor())(new S(e,this))},e.prototype.fold=function(e,t){return new U(new A(e,t,this))},e.prototype.replaceError=function(e){return new(this.ctor())(new k(e,this))},e.prototype.flatten=function(){return new e(new C(this))},e.prototype.compose=function(e){return e(this)},e.prototype.remember=function(){return new U(new D(this))},e.prototype.debug=function(e){return new(this.ctor())(new _(this,e))},e.prototype.imitate=function(e){if(e instanceof U)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=e;for(var t=this._ils,r=t.length,n=0;n<r;n++)e._add(t[n]);this._ils=[]},e.prototype.shamefullySendNext=function(e){this._n(e)},e.prototype.shamefullySendError=function(e){this._e(e)},e.prototype.shamefullySendComplete=function(){this._c()},e.prototype.setDebugListener=function(e){e?(this._d=!0,e._n=e.next||l,e._e=e.error||l,e._c=e.complete||l,this._dl=e):(this._d=!1,this._dl=c)},e.merge=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(new m(t))},e.combine=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(new v(t))},e}();t.Stream=M;var U=function(e){function t(t){var r=e.call(this,t)||this;return r._has=!1,r}return o(t,e),t.prototype._n=function(t){this._v=t,this._has=!0,e.prototype._n.call(this,t)},t.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var r=this._ils;if(r.push(e),r.length>1)this._has&&e._n(this._v);else if(this._stopID!==c)this._has&&e._n(this._v),clearTimeout(this._stopID),this._stopID=c;else if(this._has)e._n(this._v);else{var n=this._prod;n!==c&&n._start(this)}},t.prototype._stopNow=function(){this._has=!1,e.prototype._stopNow.call(this)},t.prototype._x=function(){this._has=!1,e.prototype._x.call(this)},t.prototype.map=function(e){return this._map(e)},t.prototype.mapTo=function(t){return e.prototype.mapTo.call(this,t)},t.prototype.take=function(t){return e.prototype.take.call(this,t)},t.prototype.endWhen=function(t){return e.prototype.endWhen.call(this,t)},t.prototype.replaceError=function(t){return e.prototype.replaceError.call(this,t)},t.prototype.remember=function(){return this},t.prototype.debug=function(t){return e.prototype.debug.call(this,t)},t}(M);t.MemoryStream=U;var F=M;t.default=F},654:()=>{},695:()=>{}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{API:()=>mp,AgentInfo:()=>Bp,Chat:()=>Ws,ChatFrame:()=>Fl,ComponentFilter:()=>nl,Conversation:()=>ol,DeprecatedToggleButton:()=>$p,DeprecatedView:()=>Yp,Engine:()=>Dp,EntryContainer:()=>Al,EventParticipant:()=>ia,ExternalApi:()=>Fp,Header:()=>Hp,Icon:()=>ji,Interrupt:()=>Gs,MessageContainer:()=>pa,SeamlyApiContext:()=>Zr,SeamlyEventBusContext:()=>en,SeamlyGeneralError:()=>io,SeamlyLiveRegionContext:()=>ko,SeamlyOfflineError:()=>ao,StoreProvider:()=>F,Text:()=>wa,View:()=>Kl,calculateVisibility:()=>jr,className:()=>Xr,createReduxStore:()=>Q,default:()=>Jp,eventTypes:()=>Ee,getUrlParams:()=>he,getUrlSearchString:()=>ye,randomId:()=>s,seamlyActions:()=>He,useChoicePrompt:()=>ba,useDispatch:()=>sn,useEvents:()=>cr,useGeneratedId:()=>So,useI18n:()=>Tn,useSeamlyChat:()=>qo,useSeamlyCommands:()=>Do,useSeamlyConfig:()=>re,useSeamlyEventStream:()=>ri,useSeamlyIdleDetachCountdown:()=>Zo,useSeamlyMessageContainerClassNames:()=>cn,useSeamlyOptions:()=>qn,useSeamlyVisibility:()=>vo,useTranslatedEventData:()=>fi,useTranslations:()=>pi,useTranslationsContainer:()=>di,visibilityStates:()=>C}),r(698);const e=require("preact");var t=r(679),o=r.n(t);const i=require("preact/hooks");function s(){return"_"+(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const l="//";function u(e,t,r="/"){return(n,...o)=>t(e+r+n,...o)}function p(e,t=(e=>({payload:e}))){const r=(...r)=>function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:e},t(...r));return r.toString=()=>String(e),r.match=t=>t?.type===String(e),r}function f(e,...t){const r=[];t.forEach((e=>{const t=typeof e;if("string"===t)return r.push([e]);"object"!==t||e instanceof Array||Object.keys(e).forEach((t=>r.push([t,e[t]])))}));const n=u(e,p,"/");return r.map((e=>n(...e)))}function d(e,t){const[r,n,o]=f(e,{pending:(e,t)=>({meta:{arg:e,requestId:t,status:"pending"}}),fulfilled:(e,t,r)=>({payload:t,meta:{arg:e,requestId:r,status:"fulfilled"}}),rejected:(e,t,r)=>({error:t,meta:{arg:e,requestId:r,status:"rejected",error:String(t)}})});return Object.assign((i=>(a,c,l)=>{const u=s(),p=(async()=>{let e;try{a(r(i,u));const o=t(i,{dispatch:a,getState:c,extra:l}),s=await o;e=n(i,s,u)}catch(t){e=o(i,t,u)}return a(e),e})();return Object.assign(p,{type:e,arg:i,requestId:u})}),{type:e,pending:r,fulfilled:n,rejected:o})}function h(e){return{createAction:u(e,p,l),createActions:u(e,f,l),createThunk:u(e,d,l),createReducer:(t,r)=>function(e,t={},r){const n=(e=r,n)=>{const o=t?.[n?.type];return o?o(e,n):e};return n.toString=()=>e,n}(e,t,r),selectState:t=>t[e]}}const{createAction:y,createThunk:b,createReducer:m,selectState:g}=h("config"),v=y("initialize",(e=>({config:e}))),O=y("update",(e=>({config:e}))),j=y("setPreChatEvents",(e=>({events:e})));var w="NOT_FOUND",_=function(e,t){return e===t};function E(e,t){var r,n,o="object"==typeof t?t:{equalityCheck:t},i=o.equalityCheck,s=void 0===i?_:i,a=o.maxSize,c=void 0===a?1:a,l=o.resultEqualityCheck,u=function(e){return function(t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;o<n;o++)if(!e(t[o],r[o]))return!1;return!0}}(s),p=1===c?(r=u,{get:function(e){return n&&r(n.key,e)?n.value:w},put:function(e,t){n={key:e,value:t}},getEntries:function(){return n?[n]:[]},clear:function(){n=void 0}}):function(e,t){var r=[];function n(e){var n=r.findIndex((function(r){return t(e,r.key)}));if(n>-1){var o=r[n];return n>0&&(r.splice(n,1),r.unshift(o)),o.value}return w}return{get:n,put:function(t,o){n(t)===w&&(r.unshift({key:t,value:o}),r.length>e&&r.pop())},getEntries:function(){return r},clear:function(){r=[]}}}(c,u);function f(){var t=p.get(arguments);if(t===w){if(t=e.apply(null,arguments),l){var r=p.getEntries(),n=r.find((function(e){return l(e.value,t)}));n&&(t=n.value)}p.put(arguments,t)}return t}return f.clearCache=function(){return p.clear()},f}function x(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return"function"==typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ");throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+r+"]")}return t}function S(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];var i,s=0,a={memoizeOptions:void 0},c=n.pop();if("object"==typeof c&&(a=c,c=n.pop()),"function"!=typeof c)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof c+"]");var l=a,u=l.memoizeOptions,p=void 0===u?r:u,f=Array.isArray(p)?p:[p],d=x(n),h=e.apply(void 0,[function(){return s++,c.apply(null,arguments)}].concat(f)),y=e((function(){for(var e=[],t=d.length,r=0;r<t;r++)e.push(d[r].apply(null,arguments));return i=h.apply(null,e)}));return Object.assign(y,{resultFunc:c,memoizedResultFunc:h,dependencies:d,lastResult:function(){return i},recomputations:function(){return s},resetRecomputations:function(){return s=0}}),y};return o}var T=S(E);const P="visibility",C={hidden:"hidden",minimized:"minimized",open:"open",initialize:null};function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const D=T(g,(e=>{let t=I({visible:"inline"===e?.layoutMode?C.open:C.minimized,appContainerClassNames:e.appContainerClassNames||[]},e);return"function"==typeof t.appContainerClassNames&&(t=I(I({},t),{},{appContainerClassNames:t.appContainerClassNames(t)})),t})),k=(0,e.createContext)(void 0),R=k,{Provider:L,Consumer:M}=k,U=require("preact/jsx-runtime");function F({store:e,children:t}){return(0,U.jsx)(L,{value:e,children:t})}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach((function(t){B(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(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 V="function"==typeof Symbol&&Symbol.observable||"@@observable",q=function(){return Math.random().toString(36).substring(7).split("").join(".")},W={INIT:"@@redux/INIT"+q(),REPLACE:"@@redux/REPLACE"+q(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+q()}};function G(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function K(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(z(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(z(1));return r(K)(e,t)}if("function"!=typeof e)throw new Error(z(2));var o=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(z(3));return i}function p(e){if("function"!=typeof e)throw new Error(z(4));if(c)throw new Error(z(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(z(6));t=!1,l();var r=a.indexOf(e);a.splice(r,1),s=null}}}function f(e){if(!G(e))throw new Error(z(7));if(void 0===e.type)throw new Error(z(8));if(c)throw new Error(z(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,r=0;r<t.length;r++)(0,t[r])();return e}function d(e){if("function"!=typeof e)throw new Error(z(10));o=e,f({type:W.REPLACE})}function h(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(z(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[V]=function(){return this},e}return f({type:W.INIT}),(n={dispatch:f,subscribe:p,getState:u,replaceReducer:d})[V]=h,n}function Y(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}let J=Y;function Q({reducers:e={},initialState:t={},middlewares:r=[]}={}){return K(function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var i,s=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:W.INIT}))throw new Error(z(12));if(void 0===r(void 0,{type:W.PROBE_UNKNOWN_ACTION()}))throw new Error(z(13))}))}(r)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},a=0;a<s.length;a++){var c=s[a],l=r[c],u=e[c],p=l(u,t);if(void 0===p)throw t&&t.type,new Error(z(14));o[c]=p,n=n||p!==u}return(n=n||s.length!==Object.keys(e).length)?o:e}}(e),t,J(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw new Error(z(15))},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return n=Y.apply(void 0,i)(r.dispatch),$($({},r),{},{dispatch:n})}}}(...r)))}function X(){return(0,i.useContext)(R)}function Z(){return X().dispatch}function ee(e,t=[]){const r=X(),[,n]=(0,i.useReducer)((e=>e+1),0),o=(0,i.useRef)(),s=(0,i.useCallback)(e,t),a=(0,i.useRef)(),c=(0,i.useRef)(),l=r.getState();return a.current===s&&c.current===l||(c.current=l,o.current=s(c.current),a.current=s),(0,i.useLayoutEffect)((()=>r.subscribe((()=>{if(r.getState()===c.current)return;const e=a.current?.(r.getState());e!==o.current&&(o.current=e,n())}))),[r]),o.current}const te=function(e,t,r=[]){return ee((0,i.useCallback)((r=>e(r,t)),r),r)};function re(){return ee(D)}function ne(){const{startChatIcon:e}=ee(D);return e}const oe="cvco",ie="2",se="seamly-client-participant";function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(r),!0).forEach((function(t){le(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ue=(e,t)=>{let r;return function(...n){const o=this;let i=!1;return clearTimeout(r),r=setTimeout((()=>{r=null,i||e.apply(o,n),i=!1}),t),t=>{i=!0,t&&e.apply(o,n)}}},pe=e=>Math.ceil(e/1e3),fe=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},de=(e,t=2)=>{if(0===e)return"0 Bytes";const r=t<0?0:t,n=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/1024**n).toFixed(r))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]},he=()=>{const{search:e}=window.location;return e?e.slice(e.indexOf("?")+1).split("&").reduce(((e,t)=>{const[r,n]=t.split("=");return ce(ce({},e),{},{[r]:decodeURIComponent(n)})}),{}):{}},ye=e=>Object.keys(e).reduce(((t,r)=>`${t}${t?"&":""}${r}=${encodeURIComponent(e[r])}`),""),be={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},me={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},ge=e=>e.code?me[e.code]:be[e.keyCode],ve=e=>{e&&e.focus()},Oe=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function we(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?je(Object(r),!0).forEach((function(t){_e(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ee={info:"info",message:"message",participant:"participant",system:"system"},xe="text",Se="text",Te="upload",Pe="received",Ce="read",Ae="custom",Ie="typing",Ne="read",De="detach_service",ke="set_topic",Re="set_translation",Le="click_cta",Me="assertive",Ue="polite",Fe={new_topic:"newTopic",new_translation:"newTranslation"},Be="uploads",He={ADD_EVENT:"ADD_EVENT",CLEAR_EVENTS:"CLEAR_EVENTS",SET_HISTORY:"SET_HISTORY",SET_EVENTS_READ:"SET_EVENTS_READ",SET_LOADED_IMAGE_EVENT_IDS:"SET_LOADED_IMAGE_EVENT_IDS",ACK_EVENT:"ACK_EVENT",SET_IS_LOADING:"SET_IS_LOADING",CLEAR_PARTICIPANTS:"CLEAR_PARTICIPANTS",SET_PARTICIPANT:"SET_PARTICIPANT",SET_HEADER_TITLE:"SET_HEADER_TITLE",SET_HEADER_SUB_TITLE:"SET_HEADER_SUB_TITLE",RESET_HISTORY_LOADED_FLAG:"RESET_HISTORY_LOADED_FLAG",SET_ACTIVE_SERVICE:"SET_ACTIVE_SERVICE",INIT_IDLE_DETACH_COUNTDOWN:"INIT_IDLE_DETACH_COUNTDOWN",DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:"DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER",STOP_IDLE_DETACH_COUNTDOWN_COUNTER:"STOP_IDLE_DETACH_COUNTDOWN_COUNTER",CLEAR_IDLE_DETACH_COUNTDOWN:"CLEAR_IDLE_DETACH_COUNTDOWN",INIT_RESUME_CONVERSATION_PROMPT:"INIT_RESUME_CONVERSATION_PROMPT",CLEAR_RESUME_CONVERSATION_PROMPT:"CLEAR_RESUME_CONVERSATION_PROMPT",SET_SERVICE_DATA_ITEM:"SET_SERVICE_DATA_ITEM",SET_FEATURES:"SET_FEATURES",SET_FEATURE_ENABLED_STATE:"SET_FEATURE_ENABLED_STATE",CLEAR_FEATURES:"CLEAR_FEATURES",SET_INITIAL_STATE:"SET_INITIAL_STATE",SET_USER_SELECTED_OPTIONS:"SET_USER_SELECTED_OPTIONS",SET_USER_SELECTED_OPTION:"SET_USER_SELECTED_OPTION",SHOW_OPTION:"SHOW_OPTION",HIDE_OPTION:"HIDE_OPTION",SET_SERVICE_ENTRY_METADATA:"SET_SERVICE_ENTRY_METADATA",SET_BLOCK_AUTO_ENTRY_SWITCH:"SET_BLOCK_AUTO_ENTRY_SWITCH",SET_ACTIVE_ENTRY_TYPE:"SET_ACTIVE_ENTRY_TYPE",SET_USER_ENTRY_TYPE:"SET_USER_ENTRY_TYPE",REGISTER_UPLOAD:"REGISTER_UPLOAD",SET_UPLOAD_PROGRESS:"SET_UPLOAD_PROGRESS",SET_UPLOAD_COMPLETE:"SET_UPLOAD_COMPLETE",SET_UPLOAD_ERROR:"SET_UPLOAD_ERROR",CLEAR_UPLOAD:"CLEAR_UPLOAD",CLEAR_ALL_UPLOADS:"CLEAR_ALL_UPLOADS",SET_SEAMLY_CONTAINER_ELEMENT:"SET_SEAMLY_CONTAINER_ELEMENT"},$e="navigate",{ADD_EVENT:ze,CLEAR_EVENTS:Ve,SET_HISTORY:qe,SET_EVENTS_READ:We,SET_LOADED_IMAGE_EVENT_IDS:Ge,ACK_EVENT:Ke,SET_IS_LOADING:Ye,CLEAR_PARTICIPANTS:Je,SET_PARTICIPANT:Qe,SET_HEADER_TITLE:Xe,SET_HEADER_SUB_TITLE:Ze,RESET_HISTORY_LOADED_FLAG:et,SET_ACTIVE_SERVICE:tt,INIT_IDLE_DETACH_COUNTDOWN:rt,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:nt,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:ot,CLEAR_IDLE_DETACH_COUNTDOWN:it,INIT_RESUME_CONVERSATION_PROMPT:st,CLEAR_RESUME_CONVERSATION_PROMPT:at,SET_SERVICE_DATA_ITEM:ct,SET_FEATURES:lt,SET_FEATURE_ENABLED_STATE:ut,CLEAR_FEATURES:pt,SET_INITIAL_STATE:ft,SET_USER_SELECTED_OPTION:dt,SET_USER_SELECTED_OPTIONS:ht,SHOW_OPTION:yt,HIDE_OPTION:bt,SET_BLOCK_AUTO_ENTRY_SWITCH:mt,SET_USER_ENTRY_TYPE:gt,SET_ACTIVE_ENTRY_TYPE:vt,SET_SERVICE_ENTRY_METADATA:Ot,REGISTER_UPLOAD:jt,SET_UPLOAD_PROGRESS:wt,SET_UPLOAD_COMPLETE:_t,SET_UPLOAD_ERROR:Et,CLEAR_UPLOAD:xt,CLEAR_ALL_UPLOADS:St,SET_SEAMLY_CONTAINER_ELEMENT:Tt}=He,Pt=({type:e,payload:t})=>e===Ee.message&&!t.fromClient||e===Ee.info&&t.type===xe,Ct=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),At=(e,t)=>{switch(t.type){case Je:return{participants:{},currentAgent:""};case Qe:if(!e)return{participants:{},currentAgent:""};const{participants:r}=e||{participants:{}},{id:n,avatar:o,name:i,introduction:s}=t.participant,a=r[n],c=we(we({},r),{},{[n]:a?we(we(we(we({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return we(we({},e),{},{participants:c,currentAgent:e.currentAgent===n||t.fromClient?e.currentAgent:n});default:return e}},It=(e,t)=>{switch(t.type){case Xe:return we(we({},e),{},{title:t.title});case Ze:return we(we({},e),{},{subTitle:t.title});default:return e}},Nt=(e,t)=>{const{entry:r}=t,{blockAutoEntrySwitch:n}=e;if(!r)return we(we({},e),{},{optionsOverride:{}});const{type:o,options:i}=r;let s=e.active;return n||o===e.userSelected||(s=o),we(we({},e),{},{active:s,optionsOverride:we(we({},e.optionsOverride),{},{[o]:i||{}})})},{createAction:Dt,createThunk:kt,createReducer:Rt,selectState:Lt}=h("i18n"),Mt=T(Lt,(e=>e.translations)),Ut=T(Lt,(e=>e.initialLocale)),Ft=T(Lt,(e=>e.locale)),Bt=Dt("setInitialLocale",(e=>({locale:e}))),Ht=function(){let e=!1;const t=[],r=async()=>{if(!e)for(;t.length;){const r=t.shift();e=!0,await r().catch((()=>{})),e=!1}};return{next:r,runExclusively:async e=>{const n=new Promise(((r,n)=>{t.push((async()=>{try{r(await e())}catch(e){n(e)}}))}));return r(),n}}}(),$t=kt("setLocale",(async(e,{getState:t,extra:{api:r}})=>Ht.runExclusively((()=>{if(e!==Ft(t()))return r.getTranslations(e)})))),{createActions:zt,createReducer:Vt,selectState:qt}=h("translations"),[Wt,Gt]=zt("translate",{enable:e=>({locale:e}),disable:()=>({})}),[Kt,Yt]=zt("event",{enable:e=>({payloadId:e}),disable:e=>({payloadId:e})}),{createAction:Jt,createThunk:Qt,createReducer:Xt,selectState:Zt}=h("app"),er=T(Zt,(e=>e.userHasResponded));function tr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tr(Object(r),!0).forEach((function(t){nr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function nr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const or=e=>e.state,ir=()=>ee(or),sr=T(or,D,er,(({events:e,serviceData:t},r,n)=>{if(n||"inline"===r.layoutMode||!t.suggestion||!t.suggestion?.body.length)return e;const o={type:"service_data",payload:t.suggestion};return[...e,o]})),ar=T(sr,D,((e,t)=>{const{enabled:r,threshold:n}=t?.messages?.timeIndicator??{};if(!r)return e;const o=[];let i=null;return e.forEach(((e,t)=>{if(0===t)o.push(rr(rr({},e),{},{timeIndicator:e.payload.occurredAt}));else{const t=i&&pe(e.payload.occurredAt-i.payload.occurredAt)>=n?e.payload.occurredAt:void 0;o.push(rr(rr({},e),{},{timeIndicator:t}))}i=e})),o})),cr=()=>ee(ar,[]),lr=()=>ir().headerTitles,ur=()=>ir().unreadEvents,pr=()=>ir().skiplinkTargetId,fr=T(ar,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),dr=()=>{const{participants:e,currentAgent:t}=ir().participantInfo;return t?e[t]:null},hr=e=>ir().serviceData[e],yr=()=>{const{layoutMode:e}=re();return{isInline:"inline"===e,isWindow:"window"===e,isResolving:!e}},{createAction:br,createActions:mr,createThunk:gr,createReducer:vr,selectState:Or}=h("visibility"),jr=({hasResponded:e,previousVisibility:t,requestedVisibility:r,config:n})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=n,{visible:a}=o||{};if("app"===i&&!t)return C.open;if("window"===i&&s&&r!==C.open)return e?r||t||C.open:C.hidden;if("inline"===i&&e&&!r)return t||C.open;const c=C.minimized;return r||t||a||c},wr=T(Or,(e=>e.visibility)),_r=T(Or,(e=>e.showInlineView));function Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Er(Object(r),!0).forEach((function(t){Sr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Sr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Tr=br("setFromStorage",(e=>({visibility:e}))),Pr=br("setShowInlineView"),Cr=[C.open,C.minimized,C.hidden],Ar=gr("set",((e,{getState:t,extra:{api:r,eventBus:n}})=>{const o=t(),i=wr(o),s=er(o),a=r.hasConversation(),c=D(o),{visibilityCallback:l=jr,layoutMode:u}=c,{unreadEvents:p}=or(o),f=l({hasConversation:a,hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(Cr.includes(f)){if(i!==f)return r.store.set(P,xr(xr({},r.store.get(P)||{}),{},{[u]:e})),e&&n.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:p}),f}else console.error('The visibilityCallback function should return "open", "minimized" or "hidden".')})),Ir=gr("initialize",(async(e,{dispatch:t,getState:r,extra:{api:n}})=>{const{layoutMode:o}=D(r()),i=n.store.get(P)?.[o];i&&t(Tr(i)),t(Ar(C.initialize))}));class Nr extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,Nr),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}class Dr extends Error{constructor(e,...t){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`),e?.error&&(this.originalError=e.error)}}class kr extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}const{createAction:Rr,createReducer:Lr,selectState:Mr}=h("interrupt"),Ur=Rr("set",(e=>({error:e}))),Fr=Rr("clear"),Br=Jt("setHasResponded",(e=>({hasResponded:e}))),Hr=Qt("initialize",(async(e,{dispatch:t,extra:{api:r,config:n}})=>{t(v(n));let o=n?.context?.locale;try{const{features:e,defaultLocale:n,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c}=await r.getConfig();t({type:He.SET_FEATURES,features:e}),o=o||n,t(Bt(o)),t(j(i.map((e=>({type:"message",payload:e}))))),t(O({agentParticipant:s,userParticipant:a,startChatIcon:c})),s?.name&&t({type:He.SET_HEADER_SUB_TITLE,title:s.name})}catch(e){throw new Nr}try{if(r.hasConversation()){const e=await r.getConversationIntitialState();t({type:He.SET_INITIAL_STATE,initialState:e}),o=e.translation?.locale||o,"userResponded"in e&&t(Br(e.userResponded))}else n?.context?.topic&&r.send("action",{type:ke,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),n?.context?.translationLocale&&(o=n.context.translationLocale,r.send("action",{type:Re,body:{enabled:!0,locale:o}}),t(Wt(o)))}catch(e){if(e instanceof kr)throw e;throw new Nr}finally{await t($t(o)),t(Ir())}})),$r=Qt("reset",(async(e,{dispatch:t,extra:{api:r}})=>{try{await r.disconnect(),await r.clearStore(),t(Hr())}catch(e){t(Ur(e))}})),zr=["messages"];function Vr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vr(Object(r),!0).forEach((function(t){Wr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Wr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Gr=qr(qr({},{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}}}),{},{hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showFaq:!1,customComponents:{},defaults:{},preChatEvents:[]}),Kr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showFaq","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon"],Yr=(e,{config:t})=>{const r=(i=t,Kr.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:n}=r,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,zr);var i;let s=e;return Object.keys(o).length>0&&(s=qr(qr({},s),o)),n&&(s=qr(qr({},s),{},{messages:qr(qr({},s.messages),n)})),s},Jr=m({[v]:(e,t)=>Yr(e,t),[O]:(e,t)=>Yr(e,t),[Hr.pending]:()=>Gr,[j]:(e,{events:t})=>qr(qr({},e),{},{preChatEvents:t})},Gr),Qr=require("preact/compat"),Xr=(...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(oe)>-1?e:[oe,e].join("-"))).join(" "),Zr=(0,e.createContext)(null),en=(0,e.createContext)(""),tn=()=>(0,i.useContext)(Zr),rn=()=>tn().store||{},nn=()=>{const{get:e}=rn();return e?e("conversationUrl"):null},on=()=>!!nn(),sn=Z,an=()=>re().appContainerClassNames,cn=e=>{const{fromClient:t}=e.payload,r=["message"];return"info"===e.type?r.push("message--source-info"):t?r.push("message--source-user"):r.push("message--source-agent"),r};function ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function un(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ln(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ln(e,t):void 0}}(e,t)||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.")}()}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function dn(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?dn(t):t)}),[])}function hn(e){var t={};return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var i=n.length?n.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(t,i))return t[i];var s=e.apply(void 0,n);return t[i]=s,s}}function yn(e){for(var t=function(e){return/\s/.test(e)},r=[],n={},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=bn(e,a);if(-1===l)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));n[i]=e.slice(a+1,l),a=l,i=null}else i&&(r.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&r.push(i),{args:r,cases:n}}function bn(e,t){for(var r=0,n=t+1;n<e.length;n++){var o=e.charAt(n);if("}"===o){if(0===r)return n;r--}else"{"===o&&r++}return-1}function mn(e){return gn(e.slice(1,-1),",",3)}function gn(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return n;if(1===r)return n.push(e),n;var o=e.indexOf(t);if(-1===o)return n.push(e),n;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return n.push(i),gn(s,t,r-1,n)}var vn;function On(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?On(Object(r),!0).forEach((function(t){B(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):On(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wn=0,_n="other";function En(e,t){for(var r=0,n="",o=0,i={};r<e.length;){if("#"!==e[r]||o)n+=e[r];else{var s="__hashToken".concat(wn++);n+="{".concat(s,", number}"),i[s]=t}"{"===e[r]?o++:"}"===e[r]&&o--,r++}return{caseBody:n,numberValues:i}}var xn="other";const Sn=new(function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pn(this,e),B(this,"format",hn((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return dn(r.process(e,t)).join("")}))),this.locale=t,this.typeHandlers=n}var t,r;return t=e,r=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var r=e.indexOf("{");if(-1!==r){var n=bn(e,r);if(-1===n)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var o=e.substring(r,n+1);if(o){var i=[],s=e.substring(0,r);s&&i.push(s);var a=mn(o),c=un(a,3),l=c[0],u=c[1],p=c[2],f=t[l];null==f&&(f="");var d=u&&this.typeHandlers[u];i.push(d?d(f,p,this.locale,t,this.process.bind(this)):f);var h=e.substring(n+1);return h&&i.push(this.process(h,t)),i}}return[e]}}],r&&fn(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}())("en-GB",{plural:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=yn(t),s=i.args,a=i.cases,c=parseInt(e);s.forEach((function(e){e.startsWith("offset:")&&(c-=parseInt(e.slice("offset:".length)))}));var l=[];if("PluralRules"in Intl){void 0!==vn&&vn.resolvedOptions().locale===r||(vn=new Intl.PluralRules(r));var u=vn.select(c);u!==_n&&l.push(u)}1===c&&l.push("one"),l.push("=".concat(c),_n);for(var p=0;p<l.length;p++){var f=l[p];if(f in a){var d=En(a[f],c),h=d.caseBody,y=d.numberValues;return o(h,jn(jn({},n),y))}}return e},select:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,o=yn(t),i=o.cases;return e in i?n(i[e],r):xn in i?n(i.other,r):e}});function Tn(){const e=ee(Mt),t=ee(Ft),r=ee(Ut);return{t:(0,i.useCallback)(((r,n={})=>{const o=e[r];return o?Sn.format(o,n):(console.warn(`Translation key: ${r} is missing in locale: ${t}`),null)}),[e,t]),locale:t,initialLocale:r}}function Pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Cn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pn(Object(r),!0).forEach((function(t){An(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function An(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const In={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},Nn=Rt({[Bt]:(e,{locale:t})=>Cn(Cn({},e),{},{initialLocale:t}),[$t.pending]:e=>Cn(Cn({},e),{},{isLoading:!0}),[$t.fulfilled]:(e,{payload:t,meta:{arg:r}})=>Cn(Cn({},e),{},t?{isLoading:!1,locale:r,translations:Object.keys(t).sort().reduce(((e,r)=>Cn(Cn({},e),{},{[r]:t[r]})),{})}:{isLoading:!1}),[$t.rejected]:e=>Cn(Cn({},e),{},{isLoading:!1}),[Hr.pending]:()=>In},In),{SET_SEAMLY_CONTAINER_ELEMENT:Dn}=He,kn=e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{const t="string"==typeof e?document.getElementById(e):e;ve(t)}))}))},Rn=()=>{const{seamlyContainerElement:e}=ir(),t=sn();return[e,(0,i.useCallback)((e=>{t({type:Dn,element:e})}),[t])]},Ln=e=>(0,i.useCallback)((()=>{kn(e)}),[e]),Mn=()=>{const e=pr();return Ln(e)};function Un(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Un(Object(r),!0).forEach((function(t){Bn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Un(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_USER_SELECTED_OPTION:Hn,SET_USER_SELECTED_OPTIONS:$n,SHOW_OPTION:zn,HIDE_OPTION:Vn}=He,qn=()=>{const{t:e}=Tn(),{options:t}=ir(),{panelActive:r,optionActive:n,userSelectedOptions:o,features:s}=t,{cobrowsing:a,sendTranscript:c}=s,l={cobrowsing:a,sendTranscript:c},u=Object.keys(l).filter((e=>l[e])).map((t=>({name:t,title:e(`options.${t}.menuTitle`),available:l[t].enabled}))),p=a||c,f=sn(),{get:d,set:h}=rn();return{allowOptionSelection:p,userSelectedOptions:o,features:s,menuOptions:u,initUserSelectedOptions:(0,i.useCallback)((()=>{const e=d("options")||{};f({type:$n,options:e})}),[d,f]),setUserSelectedOptions:(0,i.useCallback)((e=>{f({type:$n,options:e}),h("options",e)}),[h,f]),setUserSelectedOption:(0,i.useCallback)(((e,t)=>{const r=d("options")||{};h("options",Fn(Fn({},r),{},{[e]:t})),f({type:Hn,option:e,value:t})}),[f,d,h]),showOption:e=>{f({type:zn,optionName:e})},hideOption:()=>{f({type:Vn})},panelActive:r,optionActive:n}},Wn=()=>{const{optionsButtonId:e}=ir();return{id:e,focusButton:Ln(e)}},Gn=(0,e.createContext)({});function Kn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kn(Object(r),!0).forEach((function(t){Jn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Jn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{CLEAR_ALL_UPLOADS:Qn}=He,Xn=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:r},options:{features:{uploads:n}}}=ir(),{allowedMimeTypes:o,maxSize:i}=r.upload||{},{enabled:s,enabledFromEntry:a}=n||{},{allowedMimeTypes:c,maxSize:l}=Yn(Yn(Yn({},t.upload||{allowedMimeTypes:[],maxSize:0}),o?{allowedMimeTypes:o}:{}),i?{maxSize:i}:{});return{showFileUpload:e,accountAllowsUploads:!!n,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:l}},Zn=()=>{const{currentUploads:e}=ir(),t=sn(),r=(0,i.useContext)(Gn);return{uploadFile:(0,i.useCallback)((e=>{r(e)}),[r]),clearUploads:(0,i.useCallback)((()=>{t({type:Qn})}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},eo=T(Mr,(({error:e})=>e));function to(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ro(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?to(Object(r),!0).forEach((function(t){no(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):to(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function no(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oo(){const{t:e}=Tn(),t=ee(eo);return{hasInterrupt:Boolean(t),meta:(0,i.useMemo)((()=>{if(!t)return{};const{langKey:r,action:n}=t,o=e(`${r}.title`),i=e(`${r}.message`),s=e(`${r}.srText`),a=e(`${r}.buttonText`);return ro(ro(ro(ro({},r?{title:o,message:i,srText:s}:{}),n?{action:n}:{}),n&&r?{buttonText:a}:{}),{},{originalError:t})}),[e,t]),error:t}}class io extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class so extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class ao extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}class co extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const lo=[io,so,kr,ao,co,Nr];function uo({api:e}){return()=>t=>r=>{const{error:n}=r;if(n){if(!lo.some((e=>n instanceof e)))throw n;"reset"===n.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(r)}}function po(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?po(Object(r),!0).forEach((function(t){ho(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):po(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ho(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yo={error:void 0},bo=(e,{error:t})=>fo(fo({},e),{},{error:t}),mo=Lr({[Ur]:bo,[Hr.rejected]:bo,[Fr]:()=>yo,[Hr.pending]:()=>yo},yo);function go(){return ee(er)}const vo=()=>{const e=Z(),t=ee(wr);return{isVisible:!!t&&t!==C.hidden,isOpen:t===C.open,isMinimized:t===C.minimized,visible:t,setVisibility:(0,i.useCallback)((t=>e(Ar(t))),[e])}},Oo=()=>{const e=Z(),{connectWhenInView:t}=re(),r=ee(_r),{containerRef:n,isVisible:o}=(({freezeOnceVisible:e=!1,enabled:t=!0})=>{const[r,n]=(0,i.useState)(null),o=(0,i.useRef)(null),s=!!r?.isIntersecting||!t,a=s&&e,c=([e])=>n(e);return(0,i.useEffect)((()=>{const e=o?.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()}),[t,a]),{isVisible:s,containerRef:o}})({enabled:t,freezeOnceVisible:!0});return(0,i.useEffect)((()=>{o&&e(Pr())}),[e,o]),{containerRef:n,showInlineView:r}};function jo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jo(Object(r),!0).forEach((function(t){_o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Eo={visibility:C.initialize,showInlineView:!1},xo=vr({[Tr]:(e,{visibility:t})=>wo(wo({},e),{},{visibility:t}),[Ar.fulfilled]:(e,{payload:t})=>t?wo(wo({},e),{},{visibility:t}):e,[Pr]:e=>wo(wo({},e),{},{showInlineView:!0})},Eo),So=()=>{const[e]=(0,i.useState)((()=>s()));return e},To=e=>{const t=(0,i.useRef)();t.current=e;const r="function"==typeof e;return(0,i.useMemo)((()=>r?(...e)=>t.current(...e):void 0),[r])};function Po(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Co(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Po(Object(r),!0).forEach((function(t){Ao(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Po(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ao(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{ADD_EVENT:Io,SET_INITIAL_STATE:No}=He,Do=()=>{const e=tn(),t=re(),r=sn(),n=(0,i.useContext)(en),o=go(),a=on(),{visible:c,setVisibility:l}=vo(),u=ur(),p=(0,i.useCallback)(((...e)=>{n.emit(...e)}),[n]),f=To((()=>{e.sendContext(t.context||{}),p("ui.beforeStart",{visibility:c,hasConversation:a,hasResponded:o,unreadMessageCount:u}),e.send("start"),p("ui.start",{visibility:c,hasConversation:a,hasResponded:o,unreadMessageCount:u})})),d=(0,i.useCallback)((async()=>{r($r())}),[r]),h=(0,i.useCallback)((e=>({type:e,id:s(),transactionId:s(),participant:se,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),y=(0,i.useCallback)((e=>Co(Co({},h("text")),{},{body:{text:e}})),[h]),b=(0,i.useCallback)((({body:t,config:n={}})=>{if(""===t.trim())return;const o=Co(Co({},y(t)),n);e.send("message",o),p("message",o),r({type:Io,event:{type:"message",payload:Co(Co({},o),{},{optimisticallyInjected:!0})}})}),[e,r,p,y]),m=(0,i.useCallback)((e=>{r({type:Io,event:{type:"message",payload:y(e)}})}),[r,y]),g=(0,i.useCallback)(((e,t,n,o,i,s,a)=>{r({type:Io,event:{type:"message",payload:{type:"upload",id:e,transactionId:t,participant:se,fromClient:!0,occurredAt:n,meta:{},body:{contentType:o,filename:i,filesize:s,url:a}}}})}),[r]),v=(0,i.useCallback)((e=>{const t={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:s(),transactionId:s(),type:"divider"};r({type:Io,event:{type:"info",payload:t}})}),[r]),O=(0,i.useCallback)((({type:t,subtype:r})=>{const n={type:t,subtype:r,id:s(),transactionId:s(),participant:se,fromClient:!0};e.send("info",n)}),[e]),j=(0,i.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:r}=t;r!==Ie&&r!==Ne&&p(`action.${r}`,t)}),[e,p]),w=(0,i.useCallback)((t=>{e.sendContext(t)}),[e]),_=(0,i.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(r({type:No,initialState:e}),e.userResponded&&(r(Br(e.userResponded)),l(C.open)))})).catch((e=>{r(Ur(e))}))),[e,r,l]);return{connect:_,start:f,sendMessage:b,sendInfo:O,sendAction:j,sendContext:w,reset:d,emitEvent:p,addMessageBubble:m,addUploadBubble:g,addDivider:v,apiConnected:e.connected,apiConfigReady:e.configReady}},ko=(0,e.createContext)(null),Ro=()=>{const e=(0,i.useContext)(ko);return{sendPolite:(0,i.useCallback)((t=>{e({ariaLive:Ue,messageText:t})}),[e]),sendAssertive:(0,i.useCallback)((t=>{e({ariaLive:Me,messageText:t})}),[e])}},Lo=(0,e.createContext)(null),Mo=()=>(0,i.useContext)(Lo);function Uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_BLOCK_AUTO_ENTRY_SWITCH:Bo,SET_ACTIVE_ENTRY_TYPE:Ho,SET_USER_ENTRY_TYPE:$o}=He,zo=()=>{const{default:e,active:t,userSelected:r,options:n,optionsOverride:o}=ir().entryMeta,s=sn(),a=r||t||e,c=o[a]||n[a]||{},l=(0,i.useCallback)((e=>{s({type:Bo,value:e})}),[s]),u=(0,i.useCallback)((e=>{s({type:Ho,entryType:e})}),[s]),p=(0,i.useCallback)((e=>{s({type:$o,entryType:e})}),[s]),f=(0,i.useCallback)((()=>{r?p(null):u(e)}),[r,e,p,u]);return{activeEntry:a,activeEntryOptions:c,setActiveEntryType:u,setUserEntryType:p,cancelEntrySelection:f,setBlockAutoEntrySwitch:l}},{SET_IS_LOADING:Vo}=He,qo=()=>{const{t:e}=Tn(),{isInline:t,isWindow:r}=yr(),{isOpen:n,isVisible:o,setVisibility:s}=vo(),a=ee(_r),c=sn(),l=cr(),u=(0,i.useRef)(null),{start:p,connect:f,apiConfigReady:d,apiConnected:h}=Do(),y=on(),b=(0,i.useRef)(null),m=(0,i.useRef)(null),g=(0,i.useRef)(!1),{sendAssertive:v}=Ro(),O=l.length>0;(0,i.useEffect)((()=>{o&&setTimeout((()=>{v(e("window.srTexts.onLoad"))}),500)}),[o,v,e]),(0,i.useEffect)((()=>{if(o!==m.current)return b.current=n,void(m.current=o);null!==b.current&&v(e(n?"window.srTexts.onOpen":"window.srTexts.onClose")),b.current=n,m.current=o}),[n,o,v,e]),(0,i.useEffect)((()=>{u.current=setTimeout((()=>{c({type:Vo,isLoading:!0})}),500)}),[c]),(0,i.useEffect)((()=>{O&&(clearTimeout(u.current),c({type:Vo,isLoading:!1}))}),[O,c]),(0,i.useEffect)((()=>{d&&h||(g.current=!1)}),[d,h]);const j=(0,i.useCallback)((async()=>{h||await f(),(n||o&&t)&&(p(),g.current=!0)}),[h,f,t,n,o,p]);return(0,i.useEffect)((()=>{!d||g.current||r&&!n&&!y||t&&!a||(y&&n&&(clearTimeout(u.current),c({type:Vo,isLoading:!1})),j())}),[d,j,c,y,t,n,r,a]),{openChat:()=>{s(C.open)},closeChat:()=>{s(C.minimized)}}};function Wo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Go(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wo(Object(r),!0).forEach((function(t){Ko(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ko(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{CLEAR_IDLE_DETACH_COUNTDOWN:Yo,INIT_IDLE_DETACH_COUNTDOWN:Jo,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:Qo,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:Xo}=He,Zo=()=>{const e=sn(),{idleDetachCountdown:t}=ir(),{isOpen:r}=vo(),n=(0,i.useRef)({});n.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:r};const{emitEvent:o,sendAction:s}=Do(),{t:a}=Tn(),{sendAssertive:c,sendPolite:l}=Ro(),u=(0,i.useCallback)((e=>{const{isOpen:t}=n.current;t&&c(e)}),[c]),p=(0,i.useCallback)((e=>{const{isOpen:t}=n.current;t&&l(e)}),[l]),f=(0,i.useCallback)((t=>{const r=(e=>Math.ceil(e/1e3))(t),n=fe(r);e({type:Jo,delaySeconds:r,delayTime:n}),o("idleTimer.start"),u(`${a("idleDetachWarning.countdownTitle")} ${a("idleDetachWarning.countdownText")} ${a("idleDetachWarning.countdownTimer",n)}`)}),[e,o,u,a]),d=(0,i.useCallback)(((t,r)=>{const{hasCountdown:i,wasStopped:c}=n.current;i&&(t||(r||s({type:De}),u(a("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e({type:Yo}))}),[e,s,o,u,a]),h=(0,i.useCallback)((()=>{const{remaining:t}=n.current;if(t<=0)return;const r=t-1;r%10==0&&u(`${a("idleDetachWarning.countdownText")} ${a("idleDetachWarning.countdownTimer",fe(r))}`),e({type:Qo})}),[e,u,a]),y=(0,i.useCallback)((()=>{const{isActive:t,remaining:r}=n.current;t&&(e({type:Xo}),r&&(o("idleTimer.stop"),p(a("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,p,a]);return Go(Go({},t),{},{initCountdown:f,endCountdown:d,decrementCountdown:h,stopCountdown:y})},{CLEAR_RESUME_CONVERSATION_PROMPT:ei}=He,ti=()=>{const e=sn(),t=ir().resumeConversationPrompt,{sendAction:r}=Do(),{t:n}=Tn(),{sendAssertive:o}=Ro();return{continueChat:()=>{r({type:"dismiss",body:{type:"resume_conversation_prompt"}}),e({type:ei})},hasPrompt:t,restartChat:()=>{o(n("resumeConversationPrompt.srNotifyRestartText")),r({type:De}),e({type:ei})}}},ri=(e,t)=>{const r=tn();(0,i.useEffect)((()=>{r.stream&&(t?r.stream().filter(t).subscribe({next:e}):r.stream().subscribe({next:e}))}),[r,e,t])};function ni(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ni(Object(r),!0).forEach((function(t){ii(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ni(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ii(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const si=Xt({[Br]:(e,{hasResponded:t})=>oi(oi({},e),{},{userHasResponded:t})},{userHasResponded:!1}),ai=(e,t)=>(r,n)=>n[e]||t,ci=qt,li=T(ci,(e=>e.originalPayloadIds)),ui=T(li,ai("payloadId"),((e,t)=>!e.includes(t)));function pi(){const{sendAction:e}=Do(),t=Z(),r=To((r=>{e({type:Re,body:{enabled:!0,locale:r}}),t(Wt(r))})),n=To((()=>{e({type:Re,body:{enabled:!1}}),t(Gt())})),{languages:o,isActive:i,isAvailable:s,currentLocale:a}=ee(ci,[]);return{languages:o,isActive:i,isAvailable:s,currentLocale:a,enableTranslations:r,disableTranslations:n}}function fi({payload:e}={}){const t=e?.id;let r,n;"participant"===e?.type?(r=e.participant.introduction,n=e.participant.translatedIntroduction):(r=e?.body,n=e?.translatedBody);const o=!!n,i=te(ui,{payloadId:t},[t]),s=Z(),a=To((()=>{s(i?Yt(t):Kt(t))}));return[o&&i?n?.data:r,{hasTranslation:o,isTranslated:i&&o,toggleTranslation:a,translatedBy:n?.translatedBy,locale:n?.locale}]}function di(){const e=ee(ci,[]).containerId;return{id:e,focusContainer:Ln(e)}}function hi(e){const{languages:t}=pi();return(0,i.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}function yi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function bi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yi(Object(r),!0).forEach((function(t){mi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gi={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],originalPayloadIds:[],containerId:s()},vi=Vt({[He.SET_FEATURES]:(e,t)=>{const r=t?.features?.translation;return r?bi(bi({},e),{},{isAvailable:!0===r.enabled,languages:r.languages||[]}):e},[He.CLEAR_FEATURES]:()=>gi,[Wt]:(e,{locale:t})=>bi(bi({},e),{},{isActive:!0,currentLocale:t}),[Gt]:e=>bi(bi({},e),{},{isActive:!1,currentLocale:void 0}),[Kt]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?bi(bi({},e),{},{originalPayloadIds:e.originalPayloadIds.filter((e=>e!==t))}):e,[Yt]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?e:bi(bi({},e),{},{originalPayloadIds:[...e.originalPayloadIds,t]}),[Hr.pending]:()=>gi},gi),Oi={send32:'<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>',balloon32:'<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>',newTopic32:'<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>',newTranslation16:'<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>',newTranslation32:'<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>',avatar32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#003A5D" d="M0,4.717C0,2.112,2.112,0,4.717,0h22.566C29.888,0,32,2.112,32,4.717v22.566C32,29.887,29.888,32,27.283,32 H4.717C2.113,32,0,29.887,0,27.283V4.717z"/><path fill="#FFF" d="M10.103,14.901c-1.107,0-2.004-0.897-2.004-2.004s0.897-2.005,2.004-2.005c1.107,0,2.005,0.897,2.005,2.005 C12.108,14.004,11.211,14.901,10.103,14.901z M16,14.901c1.107,0,2.005-0.897,2.005-2.004S17.108,10.892,16,10.892 c-1.108,0-2.005,0.897-2.005,2.005C13.995,14.004,14.892,14.901,16,14.901z M21.896,10.892c-1.106,0-2.004,0.897-2.004,2.005 c0,1.107,0.896,2.004,2.004,2.004c1.109,0,2.005-0.897,2.005-2.004C23.901,11.789,23.005,10.892,21.896,10.892z M21.408,18.207 H10.783C11.83,23.973,20.361,23.973,21.408,18.207z"/></svg>',chevronDown8:'<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>',chevronDown32:'<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>',chevronRight8:'<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>',chevronRight16:'<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>',close8:'<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>',close16:'<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>',enlarge32:'<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>',options32:'<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>',file32:'<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>',upload32:'<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>',download16:'<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>',error16:'<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>',arrowLeft16:'<?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',arrowRight16:'<?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'},ji=({name:e,size:t="32",className:r,alt:n})=>{const o=`${e}${t}`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{"aria-hidden":"true",className:r||Xr("icon"),dangerouslySetInnerHTML:{__html:Oi[o]}}),n&&(0,U.jsx)("span",{className:Xr("visually-hidden"),children:n})]})},wi={visible:Xr("transition--visible"),in:Xr("transition--in"),visuallyHidden:Xr("visually-hidden")},_i=Object.values(wi),Ei="notRendered",xi="rendered",Si="visuallyHidden",Ti=({children:t,isActive:r,timeout:n,transitionStartState:o="notRendered",onInTransitionComplete:s,onOutTransitionComplete:a})=>{const c=(0,i.useRef)(!1),l=n?parseInt(n,10):300,u=To(s),p=To(a),f=o===Si,[d,h]=(0,i.useState)((()=>f?[wi.visuallyHidden]:[])),y="notRendered"!==o||d.length>0;return(0,i.useEffect)((()=>{let e=null,t=null;return c.current&&!r&&(h([wi.visible]),e=setTimeout((()=>{h([...f?[wi.visuallyHidden]:[]]),p&&(t=requestAnimationFrame((()=>{p()})))}),l)),!c.current&&r&&(h([wi.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{h([wi.visible,wi.in]),u&&(e=setTimeout((()=>{u()}),l))}))}))),c.current=r,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[r,f,l,u,p]),y&&(0,e.toChildArray)(t).map((t=>{const{className:r=""}=t.props,n=r.split(" ").filter((e=>!_i.includes(e)));return(0,e.cloneElement)(t,{className:[...n,...d].join(" ")})}))},Pi=({className:e,children:t,onCancel:r,headingText:n,cancelButtonText:o,disableButtonFocusing:s,cancelButtonRef:a,position:c="right"})=>{const l=(0,i.useRef)(null),u=So(),{hideOption:p}=qn(),{focusButton:f}=Wn();return(0,i.useEffect)((()=>{ve(l.current)}),[]),(0,U.jsx)("section",{className:Xr("options",{"options--right":"left"!==c,"options--left":"left"===c},e),"aria-labelledby":u,tabIndex:"-1",ref:l,children:(0,U.jsxs)("div",{className:Xr("options__body"),children:[(0,U.jsx)("h2",{id:u,className:Xr("options__title"),children:n}),(0,U.jsxs)("button",{type:"button",onClick:()=>{r&&r(),p(),s||f()},"aria-describedby":u,className:Xr("button","options__close"),ref:e=>{a&&(a.current=e)},children:[(0,U.jsx)(ji,{name:"close",size:"16"}),(0,U.jsx)("span",{children:o})]}),(0,U.jsx)("div",{className:Xr("options__wrapper"),children:t})]})})},{createActions:Ci,createReducer:Ai,selectState:Ii}=h("forms"),[Ni,Di]=Ci("form",{register:(e,t)=>({formId:e,persistData:t}),deregister:e=>({formId:e})}),[ki,Ri,Li,Mi]=Ci("control",{register:(e,t)=>({formId:e,name:t}),deregister:(e,t)=>({formId:e,name:t}),updateValue:(e,t,r)=>({formId:e,name:t,value:r}),updateTouched:(e,t,r)=>({formId:e,name:t,touched:r})}),Ui=T(Ii,ai("formId"),((e,t)=>e[t])),Fi=T(Ui,(e=>e?.controls||{})),Bi=T(Fi,(e=>{const t={};return Object.entries(e).forEach((([e,{value:r}])=>{t[e]=r})),t})),Hi=T(Fi,ai("name"),((e,t)=>e[t]?.value)),$i=T(Fi,ai("name"),((e,t)=>e[t]?.touched)),zi=(0,e.createContext)({}),Vi=zi,{Provider:qi,Consumer:Wi}=zi;function Gi(){return(0,i.useContext)(Vi)}function Ki(e){const t=Z(),{formId:r,updateControlValue:n,updateControlTouched:o,errors:s}=Gi(),a=!!te(Ui,{formId:r},[r]),c=(0,i.useRef)();c.current=a;const l=te(Hi,{formId:r,name:e},[r,e]),u=te($i,{formId:r,name:e},[r,e]),p=s?.[e],f=!p;(0,i.useEffect)((()=>{c.current&&t(ki(r,e))}),[a,r,e,t]),(0,i.useLayoutEffect)((()=>()=>{t(Ri(r,e))}),[a,r,e,t]);const d=(0,i.useCallback)((t=>n(e,t.target.value)),[e,n]),h=(0,i.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,i.useMemo)((()=>({name:e,onInput:d,onBlur:h,value:l})),[e,d,h,l]),(0,i.useMemo)((()=>({isValid:f,error:p,touched:u})),[f,p,u])]}const Yi=["children","formId","persistData","onError","onSubmit","validationSchema"];function Ji(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Qi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ji(Object(r),!0).forEach((function(t){Xi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ji(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Xi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zi(e){let{children:t,formId:r,persistData:n,onError:o,onSubmit:s,validationSchema:a}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Yi);const l=Z(),u=te(Bi,{formId:r},[r]),[p,f]=(0,i.useState)(!1),[d,h]=(0,i.useState)({}),{isValid:y,errors:b}=function(e,t){const r=(0,i.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[r,n])=>{n&&!Array.isArray(n)&&(n=[n]);for(let o=0;o<n?.length;o++)if(!n[o].fn(e[r],n[o].compareValue)){t[r]=n[o].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(r).length,errors:r}}(u,a),m=(0,i.useMemo)((()=>Qi(Qi({},b),d)),[b,d]);(0,i.useLayoutEffect)((()=>{l(Ni(r,n))}),[r,n,l]),(0,i.useEffect)((()=>()=>{l(Di(r))}),[r,n,l]);const g=(0,i.useCallback)(((e,t)=>{l(Li(r,e,t))}),[r,l]),v=(0,i.useCallback)(((e,t)=>{l(Mi(r,e,t))}),[l,r]),O=(0,i.useCallback)(((e,t)=>{h((r=>Qi(Qi({},r),{},{[e]:t})))}),[h]),j=(0,i.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter?.ariaDisabled;f(!t),!t&&y&&(l(Br(!0)),s(u,{updateControlValue:g,setError:O}))}),[y,l,s,u,g,O]);(0,i.useEffect)((()=>{o&&o({errors:m,isSubmitted:p,isValid:0===Object.keys(m).length})}),[p,m,o]);const w=(0,i.useMemo)((()=>({formId:r,values:u,errors:m,isValid:0===Object.keys(m).length,isSubmitted:p,handleSubmit:j,validationSchema:a,updateControlValue:g,updateControlTouched:v})),[r,u,m,p,j,a,g,v]);return r?s?(0,U.jsx)(qi,Qi(Qi({},c),{},{value:w,children:t})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}function es(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ts(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?es(Object(r),!0).forEach((function(t){rs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):es(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ns={},os={controls:{}},is={value:"",touched:!1};function ss(e,t,r,n){const o=e[t]?.controls[r]||is;return ts(ts({},e),{},{[t]:ts(ts({},e[t]),{},{controls:ts(ts({},e[t].controls),{},{[r]:ts(ts({},o),n)})})})}const as=Ai({[Ni]:(e,{formId:t,persistData:r})=>{const n=r?e[t]??ts(ts({},os),{},{persistData:r}):ts(ts({},os),{},{persistData:r});return ts(ts({},e),{},{[t]:n})},[Di]:(e,{formId:t})=>{const r=ts({},e);return r[t]?.persistData||delete r[t],r},[ki]:(e,{name:t,formId:r})=>ss(e,r,t),[Ri]:(e,{formId:t,name:r})=>{const n=e[t];if(!n)return e;if(n.persistData)return e;const o=ts({},n.controls);return delete o[r],ts(ts({},e),{},{[t]:ts(ts({},n),{},{controls:o})})},[Li]:(e,{formId:t,name:r,value:n})=>ss(e,t,r,{value:n}),[Mi]:(e,{formId:t,name:r,touched:n})=>ss(e,t,r,{touched:n}),[Hr.pending]:()=>ns},ns),{REGISTER_FORM:cs,DE_REGISTER_FORM:ls,REGISTER:us,DE_REGISTER:ps,SET_VALUE:fs,SET_VALIDITY:ds,SET_STATE:hs,SET_SUBMITTED:ys,SET_PERSIST_FORM_DATA:bs}={REGISTER_FORM:"REGISTER_FORM",DE_REGISTER_FORM:"DE_REGISTER_FORM",REGISTER:"REGISTER",DE_REGISTER:"DEREGISTER",SET_VALUE:"SET_VALUE",SET_VALIDITY:"SET_VALIDITY",SET_STATE:"SET_STATE",SET_SUBMITTED:"SET_SUBMITTED",SET_PERSIST_FORM_DATA:"SET_PERSIST_FORM_DATA"},ms=(e,t,r=null)=>({fn:e,errorText:t,compareValue:r}),gs=(e,t)=>{let r=!0;for(let n=0;n<e.length;n++)e[n].size>t&&(r=!1);return r},vs=e=>!!e?.length>0,Os=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))},js=e=>!!e,ws=["className","disableValidationClasses"];function _s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Es(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const xs=function(e){let{className:t,disableValidationClasses:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,ws);const{handleSubmit:o,isValid:i,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:r}=Gi();return{handleSubmit:e,isSubmitted:t,isValid:r}}(),a=["form"];return!r&&s&&(a.push("form--submitted"),i?a.push("form--valid"):a.push("form--invalid")),(0,U.jsx)("form",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_s(Object(r),!0).forEach((function(t){Es(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({onSubmit:o,className:Xr([...a,t])},n))};function Ss({id:e,error:t}){const[r,n]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{const e=setTimeout((()=>n(!0)),300);return()=>clearTimeout(e)}),[]),(0,U.jsx)("div",{className:Xr("error"),"aria-live":"assertive","aria-atomic":"true",children:r&&t&&(0,U.jsxs)("span",{id:e,className:Xr("error__message"),children:[(0,U.jsx)(ji,{name:"error",size:"16"}),t]})})}const Ts=({contentHint:e,id:t,labelText:r,labelClass:n=Xr("label"),validity:o,errorText:i,children:s})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("label",{htmlFor:t,className:n,children:r}),e&&(0,U.jsx)("span",{id:`${t}-content-hint`,className:Xr("input__content-hint"),children:e}),(0,U.jsx)(Ss,{id:`${t}-error`,error:!o&&i}),s]}),Ps=["id","name","labelText","labelClass","contentHint","aria-describedby","options"];function Cs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function As(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cs(Object(r),!0).forEach((function(t){Is(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Is(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ns=e=>{let{id:t,name:r,labelText:n,labelClass:o,contentHint:i,"aria-describedby":s,options:a=[]}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Ps);const{isSubmitted:l}=Gi(),[u,{error:p}]=Ki(r),f=l&&p,d=[];return s&&d.push(s),i&&d.push(`${t}-content-hint`),f&&d.push(`${t}-error`),(0,U.jsx)(Ts,{id:t,contentHint:i,validity:!f,errorText:p,labelText:n,labelClass:o,children:(0,U.jsx)("select",As(As(As({id:t,name:r,"aria-invalid":f?"true":"false","aria-describedby":d.join(" ")||null},u),c),{},{children:a.map((e=>(0,U.jsx)("option",{value:e.value,children:e.label},e.value)))}))})},Ds=function({controlName:e,descriptionId:t}){const{t:r}=Tn(),{isActive:n,languages:o,currentLocale:s}=pi(),{locale:a}=Tn(),c=hi(s),l=(0,i.useMemo)((()=>[{value:"",label:r("translations.settings.defaultOptionLabel")},...o.filter((e=>e.locale.toLowerCase()!==String(a).toLowerCase())).map((e=>({value:e.locale,label:e.nativeName})))]),[r,o,a]);return(0,U.jsxs)(xs,{noValidate:"true",className:Xr("options__form"),children:[(0,U.jsx)("p",{className:Xr("options__description"),id:t,children:r("translations.settings.description")}),n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("h3",{children:r("translations.settings.currentTranslationLabel")}),(0,U.jsx)("p",{className:Xr("options__active-language"),children:c})]}):(0,U.jsx)(Ns,{name:e,type:"text",className:Xr("input__select"),"aria-describedby":t,labelClass:Xr("label"),labelText:r("translations.settings.inputLabel"),options:l,defaultValue:s||""}),(0,U.jsx)("div",{className:Xr("options__actions"),children:(0,U.jsx)("button",{type:"submit",className:Xr("button","button--primary","options__submit"),children:r(n?"translations.settings.endButtonText":"translations.settings.startButtonText")})})]})},ks="translation-settings",Rs="locale",Ls=function({onClose:e}){const[t,r]=(0,i.useState)(void 0),{t:n}=Tn(),{isActive:o,enableTranslations:s,disableTranslations:a}=pi(),c=So(),{focusContainer:l}=di(),u=(0,i.useCallback)((({isValid:e,isSubmitted:t})=>{r(t&&!e?"options--error":void 0)}),[r]),p=(0,i.useRef)(0),f=(0,i.useMemo)((()=>(p.current+=1,o?{}:{[Rs]:ms(js,n("translations.settings.noLocaleText"))})),[o,n]);return(0,U.jsx)(Pi,{className:t,onCancel:e,formName:ks,headingText:n("translations.settings.title"),cancelButtonText:n("translations.settings.cancelButtonText"),position:"left",disableButtonFocusing:!0,children:(0,U.jsx)(Zi,{onSubmit:({locale:t})=>{o?a():(s(t),e(),l())},formId:ks,validationSchema:f,onError:u,children:(0,U.jsx)(Ds,{controlName:Rs,descriptionId:c})},p.current)})};function Ms(){const{t:e,locale:t}=Tn(),[r,n]=(0,i.useState)(!1),o=(0,i.useRef)(null),s=So(),a=hi(t);return(0,U.jsxs)("div",{className:Xr("translations__container"),onKeyDown:e=>{r&&ge(e)===me.Escape&&(n(!1),ve(o.current))},children:[(0,U.jsx)(Ti,{transitionStartState:Ei,isActive:r,children:(0,U.jsx)("div",{className:Xr("options__dialog"),role:"dialog",children:(0,U.jsx)(Ls,{onClose:()=>{n(!1)}})})}),(0,U.jsxs)("button",{type:"button",className:Xr(["button","button--secondary","chat__options__button"]),id:s,onClick:()=>{n((e=>!e))},onKeyDown:e=>{ge(e)===me.ArrowDown&&(n(!0),e.preventDefault())},ref:o,"aria-haspopup":"dialog","aria-expanded":r.toString(),children:[(0,U.jsx)(ji,{name:"newTranslation",size:"16"}),(0,U.jsx)("span",{className:Xr("button__text"),children:e("translations.settings.openButtonText",{hasLanguage:!!a,language:a})})]})]})}function Us({id:e,label:t,onButtonClick:r,buttonText:n,srButtonText:o,type:i}){const s=So();return(0,U.jsxs)("section",{className:Xr("chat-status",i&&`chat-status--${i}`),id:e,tabIndex:"-1","aria-labelledby":s,children:[(0,U.jsx)("h2",{className:Xr("chat-status__title"),id:s,children:t}),(0,U.jsxs)("button",{type:"button",className:Xr("button","button--tertiary"),onClick:r,children:[(0,U.jsx)("span",{"aria-hidden":o?"true":void 0,children:n}),o&&(0,U.jsx)("span",{className:Xr("visually-hidden"),children:o})]})]})}function Fs(){const{t:e}=Tn(),{id:t}=di(),{hasInterrupt:r}=oo(),{isActive:n,disableTranslations:o,currentLocale:s}=pi(),a=hi(s),c=Mn(),l=(0,i.useCallback)((()=>{o(),c()}),[o,c]);return!n||r?null:(0,U.jsx)(Us,{type:"translations",id:t,label:e("translations.status.label",{language:a}),onButtonClick:l,buttonText:e("translations.status.stopText"),srButtonText:e("translations.status.srStopText")})}const Bs=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Hs=({id:e,categories:t=[],question:r,onClick:n,hasIcon:o})=>{const s=(0,i.useMemo)((()=>["suggestions__item",...t.map(Bs)]),[t]),a=(0,i.useCallback)((()=>{n&&n({id:e,question:r})}),[e,r,n]);return(0,U.jsx)("li",{className:Xr(s),children:(0,U.jsxs)("button",{type:"button",onClick:a,className:Xr("button","button--primary"),children:[o&&(0,U.jsx)(ji,{name:"chevronRight",size:"8"}),r]})})};function $s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Vs=({className:e,suggestions:t=[],onClickSuggestion:r,hasIcon:n=!0})=>(0,U.jsx)("ul",{className:Xr("suggestions__list",e),children:t.map((e=>(0,U.jsx)(Hs,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$s(Object(r),!0).forEach((function(t){zs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({hasIcon:n,onClick:r},e),e.id)))}),qs=({isAside:e})=>{const{layoutMode:t}=re(),{t:r}=Tn(),{sendAction:n,addMessageBubble:o}=Do(),{isOpen:s,setVisibility:a}=vo(),c=So(),l=Mn(),u=(0,i.useRef)(null),{sendPolite:p}=Ro(),{hasInterrupt:f}=oo(),{hasCountdown:d,endCountdown:h}=Zo(),{hasPrompt:y,continueChat:b}=ti(),m=go(),g=hr("suggestion"),[v]=fi({payload:g}),O=(0,i.useMemo)((()=>g&&!f?v:[]),[g,f,v]),j=(0,i.useRef)(null),w=(0,i.useRef)(!1),_=(0,i.useRef)([]),E=!!O.length,x="inline"===t?(m||s)&&!e:m,S=(0,i.useRef)(x),T=E&&!x,P=E?O:_.current;_.current=P;const A=(0,i.useCallback)((({id:e,question:t})=>{d&&h(!0),y&&b(),n({type:Ae,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),o(t),s||a(C.open),l()}),[o,b,h,l,d,y,g,n,a,s]);(0,i.useEffect)((()=>{if(j.current!==O&&!x){if(E){const e=w.current?r("suggestions.srUpdatedText"):r("suggestions.srAvailableText");setTimeout((()=>{p(e)}),30)}else w.current&&p(r("suggestions.srUnavailableText"));j.current=O}!S.current&&x?(Oe(u.current,l),p(r("suggestions.srUnavailableText"))):!E&&w.current&&Oe(u.current,l),w.current=E,S.current=x}),[O,E,x,l,p,r]);const I=r("suggestions.headingText"),N=r("suggestions.footerText"),D=I?"section":"div";return(0,U.jsx)(Ti,{isActive:T,transitionStartState:Ei,children:(0,U.jsxs)(D,{className:Xr("suggestions"),"aria-labelledby":I?c:null,ref:u,children:[I&&(0,U.jsx)("p",{id:c,className:Xr("suggestions__heading"),children:I}),!!P.length&&(0,U.jsx)(Vs,{suggestions:P,onClickSuggestion:A}),N&&!s&&(0,U.jsx)("p",{className:Xr("suggestions__footer"),children:N})]})})},Ws=(0,Qr.forwardRef)((({children:e,className:t=""},r)=>{const{isOpen:n,isVisible:o,setVisibility:i}=vo(),{namespace:s,layoutMode:a}=re(),{isInline:c}=yr(),l=an(),u=go(),{t:p}=Tn(),f=["chat",`chat--layout-${a}`,`namespace--${s}`,...l,t];return n||"app"===a||f.push("chat--collapsed"),u&&f.push("chat--user-responded"),o&&(0,U.jsxs)("section",{className:Xr(f),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&n&&i(C.minimized)},tabIndex:"-1",ref:r,"aria-label":p("chat.srLabel"),children:[(0,U.jsx)("div",{className:Xr("chat-wrapper"),children:e}),"inline"===a&&n&&(0,U.jsx)(qs,{isAside:!0})]})})),Gs=({originalError:e,title:t,message:r,buttonText:n,action:o,srText:s})=>{const a=Do(),c=So(),{sendPolite:l}=Ro(),u=Mn(),p=e instanceof kr;return(0,i.useEffect)((()=>{p&&a[o]()}),[o,a,p]),(0,i.useEffect)((()=>{!p&&s&&setTimeout((()=>{l(s)}),200)}),[l,s,p]),!p&&(0,U.jsx)("section",{className:Xr("interrupt"),"aria-labelledby":c,children:(0,U.jsxs)("div",{className:Xr("interrupt__body"),children:[(0,U.jsx)("h2",{id:c,className:Xr("interrupt__title"),children:t}),(0,U.jsx)("p",{className:Xr("interrupt__message"),children:r}),n&&o&&(0,U.jsx)("div",{className:Xr("interrupt__actions"),children:(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{a[o](),u()},children:n})})]})})},Ks=()=>{const{t:e}=Tn(),{showDisclaimer:t}=re();return t&&(0,U.jsxs)("div",{className:Xr("disclaimer"),tabIndex:"0",children:[(0,U.jsx)("h2",{className:Xr("disclaimer__title"),children:e("disclaimer.title")}),(0,U.jsx)("div",{className:Xr("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]})},Ys=(0,e.createContext)({}),Js=e=>{const t=(0,i.useContext)(Ys);let r=null;"choice_prompt"===e.payload.type&&(r=t[e.type][e.payload.body.prompt.type]);const n=t[e.type][e.payload.type]||t.fallback;return[n&&"function"!=typeof n?n[e.payload.body.type]||t.fallback:n,r]};function Qs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qs(Object(r),!0).forEach((function(t){Zs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Zs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ea({children:e,childrenHTML:t,className:r,graphicSrc:n,graphicType:o="icon",iconName:i,iconSize:s,iconClassName:a,dividerType:c}){const l=Boolean(i||n),u=t?{dangerouslySetInnerHTML:{__html:t}}:{children:e};return(0,U.jsxs)("div",{className:Xr("divider",c&&`divider--type-${c}`,r),children:[l&&(0,U.jsx)("span",{className:Xr("divider__graphic"),children:i?(0,U.jsx)(ji,{name:i,size:s,className:a}):(0,U.jsx)("img",{src:n,className:Xr({icon:"icon"===o,avatar:"avatar"===o},a)})}),(0,U.jsx)("div",Xs({className:Xr("divider__body")},u))]})}const ta={month:"long",day:"numeric",year:"numeric"},ra={hour:"numeric",minute:"numeric"},na=({event:e})=>{const t=(()=>{const[e,t]=(0,i.useReducer)((e=>e+1),0);return(0,i.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:r,time:n,timeUntilMidnight:o,srText:s}=(e=>{const{t}=Tn(),r=re()?.context?.locale??[],n=new Date(e),o=new Date,i=new Date(o);i.setHours(24,0,0,0);const s=i-o,a=n.toString(),c=new Intl.DateTimeFormat(r,ra).format(n);let l=((e,t)=>{const r=new Date(t).setHours(0,0,0,0),n=e.getTime(),o=864e5;return n>=r+o?e:n>r?"today":n>r-o?"yesterday":e})(n,o);switch(l){case"today":l=t("dateTime.today");break;case"yesterday":l=t("dateTime.yesterday");break;default:l=new Intl.DateTimeFormat(r,ta).format(n)}return{date:l,srText:t("dateTime.srText",{date:l,time:c}),time:c,fullDateTime:a,timeUntilMidnight:s}})(pe(e.timeIndicator));return(0,i.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,U.jsxs)(ea,{dividerType:"time-indicator",children:[(0,U.jsxs)("p",{className:Xr("divider__time"),"aria-hidden":"true",children:[(0,U.jsx)("span",{children:r}),(0,U.jsx)("span",{children:n})]}),(0,U.jsx)("p",{className:Xr("visually-hidden"),children:s})]})},oa=({event:e,newParticipant:t})=>{const[r,n]=Js(e);if(!r)return null;const o=["conversation__item"];return"info"===e.type?o.push("conversation__item--source-info"):e.payload.fromClient?o.push("conversation__item--source-user"):o.push("conversation__item--source-agent"),t&&o.push("conversation__item--new-participant"),(0,U.jsxs)("li",{className:Xr(o),children:[e.timeIndicator&&(0,U.jsx)(na,{event:e}),(0,U.jsx)(r,{event:e,children:(0,U.jsx)(n,{event:e})})]})},ia=({eventPayload:e})=>{const{t}=Tn(),{fromClient:r,participant:n}=e,o=(e=>ir().participantInfo.participants[e])(n)||{},{messages:i}=re(),s=r?t("participants.user.name"):o&&o.name,{showAvatar:a,showName:c}=i[r?"user":"agent"]||{};if(!a&&!c)return null;const l=[];return a&&s&&o.avatar&&l.push((0,U.jsx)("span",{className:Xr("message__avatar"),children:(0,U.jsx)("img",{src:o.avatar,className:Xr("avatar"),alt:""})})),c&&l.push((0,U.jsx)("span",{className:Xr("message__author-name"),children:s})),l.length>0&&(0,U.jsx)("div",{className:Xr("message__author"),children:l})},sa=()=>{const{id:e}=dr()||{};return(0,U.jsx)("li",{className:Xr("conversation__item","conversation__item--source-agent"),children:(0,U.jsxs)("div",{className:Xr("message","message--source-agent","message--type-loading"),children:[(0,U.jsx)(ia,{eventPayload:{fromClient:!1,participant:e}}),(0,U.jsx)("div",{className:Xr("message__body"),children:(0,U.jsxs)("span",{className:Xr("loader"),children:[(0,U.jsx)("span",{className:Xr("loader__part","one")}),(0,U.jsx)("span",{className:Xr("loader__part","two")}),(0,U.jsx)("span",{className:Xr("loader__part","three")}),(0,U.jsx)("span",{className:Xr("loader__part","four")})]})})]})})},aa=["showParticipant","showTranslationToggle","event","type","modifiers","children","bodyProps","info"];function ca(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function la(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ca(Object(r),!0).forEach((function(t){ua(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ca(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ua(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pa=function(e){let{showParticipant:t=!0,showTranslationToggle:r=!0,event:n,type:o,modifiers:i,children:s,bodyProps:a={},info:c}=e,l=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,aa);const u=cn(n),{t:p}=Tn(),[,{hasTranslation:f,isTranslated:d,toggleTranslation:h,locale:y}]=fi(n);return o&&u.push("message--type-"+o),i&&("string"==typeof i&&(i=i.split(" ").filter((e=>e.length))),i.forEach((e=>{u.push("message--"+e)}))),d&&u.push("message--is-translated"),f&&u.push("message--has-translation"),d&&(a=la(la({},a),{},{lang:y})),(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",la(la({className:Xr(u)},l),{},{children:[t&&(0,U.jsx)(ia,{eventPayload:n.payload}),(0,U.jsx)("div",la(la({className:Xr("message__body")},a),{},{children:s})),c&&(0,U.jsx)("div",{"aria-hidden":"true",className:Xr("message__info"),children:c}),r&&f&&(0,U.jsx)("div",{className:Xr("message__translation-info"),children:(0,U.jsx)("button",{className:Xr("message__translation-toggle","button","button--secondary"),onClick:h,children:p(d?"translations.toggle.hideButtonText":"translations.toggle.showButtonText")})})]}))})},fa=["event","children"];function da(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?da(Object(r),!0).forEach((function(t){ya(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):da(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ya(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ba=e=>{const{payload:t}=e,[r,n]=(0,i.useState)(!1),{sendAction:o,addMessageBubble:s,addDivider:a}=Do(),{activeServiceSessionId:c}=ir().serviceInfo,l=ee(fr),[u]=fi(e),{service:p}=t,f=(0,i.useMemo)((()=>ha(ha({},e),{},{payload:ha(ha({},e.payload),{},{body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&ha(ha({},e.payload.translatedBody),{},{data:e.payload.translatedBody.data.prompt})})})),[e]),d=u.chooseAgain&&c===p.serviceSessionId&&t.id!==l;return(0,i.useEffect)((()=>{n(t.id===l)}),[t,l]),{body:u,subEvent:f,showOptions:r,chooseAgain:d,onChoiceClickHandler:e=>{d&&a("new_topic"),s(e.text),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:d}}),n(!1)},onChooseAgainClickHandler:()=>{n((e=>!e))}}},ma=e=>{const{sendAction:t}=Do();return r=>{r.target&&r.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:r.target.dataset.linkId,url:r.target.getAttribute("href")}})}},ga=["event"];function va(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Oa(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?va(Object(r),!0).forEach((function(t){ja(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):va(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ja(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const wa=e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,ga);const[n]=fi(t),o=ma(t.payload.id),s=(0,i.useMemo)((()=>t.payload.optimisticallyInjected?{children:(0,U.jsx)("p",{children:n.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n.text}}}),[n,t]);return(0,U.jsx)(pa,Oa(Oa({type:"text",event:t,onClick:o},r),s))};var _a=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],Ea=_a.join(","),xa="undefined"==typeof Element,Sa=xa?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ta=!xa&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},Pa=function(e,t,r){var n=Array.prototype.slice.apply(e.querySelectorAll(Ea));return t&&Sa.call(e,Ea)&&n.unshift(e),n.filter(r)},Ca=function e(t,r,n){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if("SLOT"===s.tagName){var a=s.assignedElements(),c=e(a.length?a:s.children,!0,n);n.flatten?o.push.apply(o,c):o.push({scope:s,candidates:c})}else{Sa.call(s,Ea)&&n.filter(s)&&(r||!t.includes(s))&&o.push(s);var l=s.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(s),u=!n.shadowRootFilter||n.shadowRootFilter(s);if(l&&u){var p=e(!0===l?s.children:l.children,!0,n);n.flatten?o.push.apply(o,p):o.push({scope:s,candidates:p})}else i.unshift.apply(i,s.children)}}return o},Aa=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},Ia=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Na=function(e){return"INPUT"===e.tagName},Da=function(e){var t=e.getBoundingClientRect(),r=t.width,n=t.height;return 0===r&&0===n},ka=function(e,t){return!(t.disabled||function(e){return Na(e)&&"hidden"===e.type}(t)||function(e,t){var r=t.displayCheck,n=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Sa.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Sa.call(o,"details:not([open]) *"))return!0;var i=Ta(e).host,s=(null==i?void 0:i.ownerDocument.contains(i))||e.ownerDocument.contains(e);if(r&&"full"!==r){if("non-zero-area"===r)return Da(e)}else{if("function"==typeof n){for(var a=e;e;){var c=e.parentElement,l=Ta(e);if(c&&!c.shadowRoot&&!0===n(c))return Da(e);e=e.assignedSlot?e.assignedSlot:c||l===e.ownerDocument?c:l.host}e=a}if(s)return!e.getClientRects().length}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 r=0;r<t.children.length;r++){var n=t.children.item(r);if("LEGEND"===n.tagName)return!!Sa.call(t,"fieldset[disabled] *")||!n.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ra=function(e,t){return!(function(e){return function(e){return Na(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,r=e.form||Ta(e),n=function(e){return r.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=n(window.CSS.escape(e.name));else try{t=n(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 r=0;r<e.length;r++)if(e[r].checked&&e[r].form===t)return e[r]}(t,e.form);return!o||o===e}(e)}(t)||Aa(t)<0||!ka(e,t))},La=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ma=function e(t){var r=[],n=[];return t.forEach((function(t,o){var i=!!t.scope,s=i?t.scope:t,a=Aa(s,i),c=i?e(t.candidates):s;0===a?i?r.push.apply(r,c):r.push(s):n.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:c})})),n.sort(Ia).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(r)},Ua=function(e,t){var r;return r=(t=t||{}).getShadowRoot?Ca([e],t.includeContainer,{filter:Ra.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:La}):Pa(e,t.includeContainer,Ra.bind(null,t)),Ma(r)},Fa=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Sa.call(e,Ea)&&Ra(t,e)},Ba=_a.concat("iframe").join(","),Ha=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Sa.call(e,Ba)&&ka(t,e)};function $a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function za(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$a(Object(r),!0).forEach((function(t){Va(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Va(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var qa,Wa=(qa=[],{activateTrap:function(e){if(qa.length>0){var t=qa[qa.length-1];t!==e&&t.pause()}var r=qa.indexOf(e);-1===r||qa.splice(r,1),qa.push(e)},deactivateTrap:function(e){var t=qa.indexOf(e);-1!==t&&qa.splice(t,1),qa.length>0&&qa[qa.length-1].unpause()}}),Ga=function(e){return setTimeout(e,0)},Ka=function(e,t){var r=-1;return e.every((function(e,n){return!t(e)||(r=n,!1)})),r},Ya=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e?e.apply(void 0,r):e},Ja=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target};function Qa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xa(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qa(Object(r),!0).forEach((function(t){Za(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qa(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Za(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ec=({children:t,onClose:r,"aria-label":n,"aria-labelledby":o,fallBackFocusRef:s})=>{const a=So(),c=(0,i.useRef)(null),l=(0,i.useRef)(null),[u,p]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{return u&&(l.current=(e=c.current,t={initialFocus:s&&s.current?s.current:null},n=(null==t?void 0:t.document)||document,o=za({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},a=function(e,t,r){return e&&void 0!==e[t]?e[t]:o[r||t]},p=function(e){return i.containerGroups.findIndex((function(t){var r=t.container,n=t.tabbableNodes;return r.contains(e)||n.find((function(t){return t===e}))}))},f=function(e){var t=o[e];if("function"==typeof t){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];t=t.apply(void 0,i)}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=n.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return a},d=function(){var e=f("initialFocus");if(!1===e)return!1;if(void 0===e)if(p(n.activeElement)>=0)e=n.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||f("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},h=function(){if(i.containerGroups=i.containers.map((function(e){var t=Ua(e,o.tabbableOptions),r=function(e,t){return(t=t||{}).getShadowRoot?Ca([e],t.includeContainer,{filter:ka.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Pa(e,t.includeContainer,ka.bind(null,t))}(e,o.tabbableOptions);return{container:e,tabbableNodes:t,focusableNodes:r,firstTabbableNode:t.length>0?t[0]:null,lastTabbableNode:t.length>0?t[t.length-1]:null,nextTabbableNode:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=r.findIndex((function(t){return t===e}));if(!(n<0))return t?r.slice(n+1).find((function(e){return Fa(e,o.tabbableOptions)})):r.slice(0,n).reverse().find((function(e){return Fa(e,o.tabbableOptions)}))}}})),i.tabbableGroups=i.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),i.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},y=function e(t){!1!==t&&t!==n.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(d()))},b=function(e){var t=f("setReturnFocus",e);return t||!1!==t&&e},m=function(e){var t=Ja(e);p(t)>=0||(Ya(o.clickOutsideDeactivates,e)?r.deactivate({returnFocus:o.returnFocusOnDeactivate&&!Ha(t,o.tabbableOptions)}):Ya(o.allowOutsideClick,e)||e.preventDefault())},g=function(e){var t=Ja(e),r=p(t)>=0;r||t instanceof Document?r&&(i.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),y(i.mostRecentlyFocusedNode||d()))},v=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==Ya(o.escapeDeactivates,e))return e.preventDefault(),void r.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=Ja(e);h();var r=null;if(i.tabbableGroups.length>0){var n=p(t),s=n>=0?i.containerGroups[n]:void 0;if(n<0)r=e.shiftKey?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var a=Ka(i.tabbableGroups,(function(e){var r=e.firstTabbableNode;return t===r}));if(a<0&&(s.container===t||Ha(t,o.tabbableOptions)&&!Fa(t,o.tabbableOptions)&&!s.nextTabbableNode(t,!1))&&(a=n),a>=0){var c=0===a?i.tabbableGroups.length-1:a-1;r=i.tabbableGroups[c].lastTabbableNode}}else{var l=Ka(i.tabbableGroups,(function(e){var r=e.lastTabbableNode;return t===r}));if(l<0&&(s.container===t||Ha(t,o.tabbableOptions)&&!Fa(t,o.tabbableOptions)&&!s.nextTabbableNode(t))&&(l=n),l>=0){var u=l===i.tabbableGroups.length-1?0:l+1;r=i.tabbableGroups[u].firstTabbableNode}}}else r=f("fallbackFocus");r&&(e.preventDefault(),y(r))}(e)},O=function(e){var t=Ja(e);p(t)>=0||Ya(o.clickOutsideDeactivates,e)||Ya(o.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},j=function(){if(i.active)return Wa.activateTrap(r),i.delayInitialFocusTimer=o.delayInitialFocus?Ga((function(){y(d())})):y(d()),n.addEventListener("focusin",g,!0),n.addEventListener("mousedown",m,{capture:!0,passive:!1}),n.addEventListener("touchstart",m,{capture:!0,passive:!1}),n.addEventListener("click",O,{capture:!0,passive:!1}),n.addEventListener("keydown",v,{capture:!0,passive:!1}),r},w=function(){if(i.active)return n.removeEventListener("focusin",g,!0),n.removeEventListener("mousedown",m,!0),n.removeEventListener("touchstart",m,!0),n.removeEventListener("click",O,!0),n.removeEventListener("keydown",v,!0),r},r={get active(){return i.active},get paused(){return i.paused},activate:function(e){if(i.active)return this;var t=a(e,"onActivate"),r=a(e,"onPostActivate"),o=a(e,"checkCanFocusTrap");o||h(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,t&&t();var s=function(){o&&h(),j(),r&&r()};return o?(o(i.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!i.active)return this;var t=za({onDeactivate:o.onDeactivate,onPostDeactivate:o.onPostDeactivate,checkCanReturnFocus:o.checkCanReturnFocus},e);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,w(),i.active=!1,i.paused=!1,Wa.deactivateTrap(r);var n=a(t,"onDeactivate"),s=a(t,"onPostDeactivate"),c=a(t,"checkCanReturnFocus"),l=a(t,"returnFocus","returnFocusOnDeactivate");n&&n();var u=function(){Ga((function(){l&&y(b(i.nodeFocusedBeforeActivation)),s&&s()}))};return l&&c?(c(b(i.nodeFocusedBeforeActivation)).then(u,u),this):(u(),this)},pause:function(){return i.paused||!i.active||(i.paused=!0,w()),this},unpause:function(){return i.paused&&i.active?(i.paused=!1,h(),j(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"==typeof e?n.querySelector(e):e})),i.active&&h(),this}},r.updateContainerElements(e),r),l.current.activate()),()=>{l.current&&l.current.deactivate()};var e,t,r,n,o,i,a,p,f,d,h,y,b,m,g,v,O,j,w}),[u,s]),(0,i.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((r=>{const n=r.getAttribute("aria-hidden");null!==n&&"false"!==n||(e.push(n),t.push(r),r.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,r)=>{const n=e[r];null===n?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",n)}))}})();return()=>{e()}}),[u]),(0,i.useEffect)((()=>{u&&c.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&r()}))}),[u,r]),(0,i.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",a),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),n&&t.setAttribute("aria-label",n),o&&t.setAttribute("aria-labelledby",o),e.appendChild(t),c.current=t,p(!0),()=>{c.current&&(e.removeChild(c.current),c.current=null)}}),[n,o,a]),"function"==typeof t?t({onClose:r,modalRenderFn:t=>c.current&&(0,e.render)(t,c.current)}):c.current&&(0,e.render)((0,e.toChildArray)(t).map((e=>(e.props=Xa(Xa({},e.props),{},{onClose:r}),e))),c.current)},tc=({url:e,description:t,onClose:r})=>{const{zIndex:n,layoutMode:o,namespace:s}=re(),a=Mo(),c=an(),l=(0,i.useRef)(null),{t:u}=Tn(),p=["modal",`app--layout-${o}`,`namespace--${s}`,...c],f=e=>{e.stopPropagation()},d=()=>{r()},h=n?{zIndex:n+1}:void 0;return(0,U.jsx)(ec,{onClose:r,"aria-label":u("lightbox.heading"),fallBackFocusRef:l,children:({onClose:r,modalRenderFn:n})=>n((r=>(0,U.jsx)("div",{className:Xr(p),onClick:d,style:h,children:(0,U.jsxs)("div",{className:Xr("modal__float"),tabIndex:"-1",onMouseDown:a,onKeyDown:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,ref:l,children:[(0,U.jsx)("div",{className:Xr("modal__inner"),onClick:f,children:(0,U.jsx)("img",{className:Xr("modal__image"),src:e,alt:t})}),(0,U.jsxs)("button",{type:"button",className:Xr("modal__close"),onClick:r,children:[(0,U.jsx)(ji,{name:"close",size:"16"}),u("lightbox.closeLabel")]})]})}))(r))})},rc=({description:e,url:t})=>{const{t:r}=Tn(),[n,o]=(0,i.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("button",{type:"button",className:Xr("modal__enlarge"),onClick:()=>{o(!0)},children:[r("message.image.srTextEnlargeButtonLabel",{description:e}),(0,U.jsx)(ji,{name:"enlarge",size:"32"})]}),n&&(0,U.jsx)(tc,{url:t,description:e,onClose:()=>{o(!1)}})]})},nc=["event","descriptorId"];function oc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ic(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oc(Object(r),!0).forEach((function(t){sc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_LOADED_IMAGE_EVENT_IDS:ac}=He,cc=["event","descriptorId"];function lc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function uc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lc(Object(r),!0).forEach((function(t){pc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function pc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fc={[Fe.new_topic]:"newtopic"},dc=["event"];function hc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const bc={default:({event:e})=>{const{t}=Tn(),{subtype:r}=e.payload.body,n=fc[Fe[r]];return(0,U.jsx)(ea,{dividerType:n,iconName:Fe[r],children:(0,U.jsx)("p",{children:t(`dividerKeys.${Fe[r]}`)})})},[Fe.new_translation]:({event:e})=>{const{t}=Tn(),{translationEnabled:r,translationLocale:n,text:o}=e.payload.body,{enableTranslations:i}=pi(),s=hi(n);return(0,U.jsxs)(ea,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,U.jsx)("p",{className:Xr("divider__title"),children:t(r?"translations.divider.startText":"translations.divider.stopText",{language:s})}),r?(0,U.jsx)("p",{children:o}):(0,U.jsx)("button",{className:Xr("button","button--secondary"),onClick:()=>{i(n)},children:t("translations.divider.restartButtonText")})]})}},mc=["event"];function gc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gc(Object(r),!0).forEach((function(t){Oc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Oc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const jc=["event"];function wc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wc(Object(r),!0).forEach((function(t){Ec(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ec(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const xc=["event"];function Sc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Tc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sc(Object(r),!0).forEach((function(t){Pc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Cc=({children:e,url:t,target:r})=>t?(0,U.jsx)("a",{href:t,download:!0,target:r||void 0,className:Xr(["download","download-link"]),children:e}):(0,U.jsx)("span",{className:Xr("download"),children:e});function Ac(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ic(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ac(Object(r),!0).forEach((function(t){Nc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ac(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Nc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Dc=({id:e,action:t,buttonText:r,description:n,hasFocus:o,image:s,title:a,isCarouselItem:c})=>{const l=(0,i.useRef)(null),{sendMessage:u,sendAction:p,emitEvent:f}=Do(),d=So(),h=(0,i.useRef)(),y=t.type===$e?"a":"button",b=(0,i.useCallback)((()=>f("action.click_card",{type:Le,originMessage:e,action:t})),[f,e,t]),m=(0,i.useCallback)((()=>{if(b(),"ask"===t.type)u({body:t.ask});else if("topic"===t.type){const{topic:e,fallbackMessage:r}=t;p({type:ke,body:{name:e,fallbackMessage:r}})}}),[u,t,p,b]),g=(0,i.useMemo)((()=>t.type===$e?{href:t.link,rel:"noopener noreferrer",target:t.newTab?"_blank":"_self",onClick:b}:{onClick:m}),[t,m,b]);return(0,i.useEffect)((()=>{c&&(o&&h.current?window.requestAnimationFrame((()=>l.current.focus())):l.current.blur()),h.current=!0}),[o,c]),(0,U.jsxs)("div",{className:Xr("card__wrapper"),id:e,tabIndex:"-1",ref:l,children:[(0,U.jsx)("img",{className:Xr("card__image"),src:s,alt:""}),(0,U.jsxs)("div",{className:Xr("card__content"),id:e,children:[a&&(0,U.jsx)("h2",{className:Xr("card__title"),children:a}),n&&(0,U.jsx)("div",{className:Xr("card__description"),dangerouslySetInnerHTML:{__html:n}}),(0,U.jsx)(y,Ic(Ic({tabIndex:c&&!o?"-1":void 0,className:Xr("button","button--primary"),"aria-describedby":d},g),{},{children:r}))]})]})};function kc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Rc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kc(Object(r),!0).forEach((function(t){Lc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Lc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mc({item:e,items:t,index:r,isActive:n}){const{t:o}=Tn();return(0,U.jsx)("div",{className:Xr("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":o("carousel.slide.label",{index:r+1,total:t.length}),children:(0,U.jsx)(Dc,Rc(Rc({},e),{},{isCarouselItem:!0,hasFocus:n}))})}function Uc({items:e,currentIndex:t,onChange:r,getItemKey:n,getItemLabel:o}){const s=e.length,a=(0,i.useCallback)((e=>{const n=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,n));o!==t&&r(o)}),[s,t,r]);return(0,U.jsx)("div",{className:Xr("carousel-pagination__wrapper"),role:"group",children:(0,U.jsx)("ul",{className:Xr("carousel-pagination"),children:e.map(((e,r)=>{const i=t===r;return(0,U.jsx)("li",{className:Xr("carousel-pagination__item",i?"is-active":void 0),children:(0,U.jsx)("button",{className:Xr("carousel-pagination__button"),type:"button",onClick:a,"data-item":r,"aria-disabled":i?"true":void 0,"aria-label":o(e,r)})},n(e,r,"pagination-item-"))}))})})}function Fc({items:e,currentIndex:t,onChange:r,children:n}){const{t:o}=Tn(),i=e.length;return(0,U.jsxs)("div",{className:Xr("carousel-controls"),children:[(0,U.jsx)("button",{className:Xr("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{r((t-1+i)%i)},children:(0,U.jsx)(ji,{name:"arrowLeft",size:"16"})}),n,(0,U.jsx)("button",{className:Xr("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{r((t+1)%i)},children:(0,U.jsx)(ji,{name:"arrowRight",size:"16"})})]})}const Bc=(e,t,r)=>`${r}${t}`,Hc=e=>e.label,$c=({target:e})=>{e.scrollLeft=0};function zc({currentIndex:t,onChange:r,getItemKey:n=Bc,getItemLabel:o=Hc,items:s}){const a=So(),c=s.length,[l,u]=(0,i.useState)(Number(t||"0"));(0,i.useEffect)((()=>{u(Number(t||"0"))}),[u,t]);const p=(0,i.useRef)([]);p.current=(0,i.useMemo)((()=>Array(c).fill(1).map((()=>(0,e.createRef)()))),[c]);const f=(0,i.useRef)(!0),d=(0,i.useRef)();return d.current=r,(0,i.useEffect)((()=>{f.current?f.current=!1:d.current&&d.current(l)}),[l]),(0,U.jsxs)("div",{className:Xr("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,U.jsx)("div",{className:Xr("carousel__slides-wrapper"),onScroll:$c,children:(0,U.jsx)("div",{id:a,className:Xr("carousel__slides"),style:{width:100*c+"%",left:-100*l+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((e,t)=>{const r=l===t;return(0,U.jsx)("div",{ref:p.current[t],className:Xr("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,U.jsx)(Mc,{item:e,items:s,currentIndex:l,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,U.jsx)("div",{className:Xr("carousel__controls"),children:(0,U.jsx)(Fc,{currentIndex:l,items:s,onChange:u,controlId:a,children:(0,U.jsx)("div",{className:Xr("carousel__pagination"),children:(0,U.jsx)(Uc,{currentIndex:l,items:s,onChange:u,getItemKey:n,getItemLabel:o})})})})]})}const Vc=(e,t,r="")=>`${r}${e.title}:${t}`,qc=e=>e.title;function Wc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Gc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wc(Object(r),!0).forEach((function(t){Kc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Kc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Yc=["event"];function Jc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Qc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jc(Object(r),!0).forEach((function(t){Xc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Xc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function el(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Zc(Object(r),!0).forEach((function(t){tl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function tl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const rl={message:{choice_prompt:t=>{let{event:r,children:n}=t,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,fa);const{t:i}=Tn(),s=So(),{body:a,subEvent:c,showOptions:l,chooseAgain:u,onChoiceClickHandler:p,onChooseAgainClickHandler:f}=ba(r);return(0,U.jsxs)(U.Fragment,{children:[(0,e.toChildArray)(n).map((e=>(e.props=ha(ha({},e.props),{},{event:c,descriptorId:s,showTranslationToggle:!1}),e))),u&&(0,U.jsxs)("button",{type:"button",className:Xr("button","button--secondary","button--choose-again"),"aria-expanded":l?"true":"false",onClick:f,"aria-describedby":s,children:[i(l?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,U.jsx)(ji,{name:"chevronDown",size:"8"})]}),l&&(0,U.jsx)(pa,ha(ha({type:"choice-prompt",showParticipant:!1,event:r},o),{},{children:(0,U.jsx)("ul",{className:Xr("choice-prompt","choice-prompt--many"),children:a.choices.map((e=>(0,U.jsx)("li",{className:Xr("choice-prompt__item",{[`choice-prompt__item--${e.category}`]:e.category}),children:(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{p(e)},children:e.text})},e.id)))})}))]})},text:wa,image:e=>{let{event:t,descriptorId:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,nc);const[o]=fi(t),{description:s,url:a,isZoomable:c}=o,[l,u]=(0,i.useState)(!1),p=Z();return(0,U.jsxs)(pa,ic(ic({event:t,type:"image"},n),{},{children:[(0,U.jsx)("img",{src:a,id:r,alt:s,onLoad:()=>{p({type:ac,eventId:t.payload.id}),u(!0)}}),c&&l&&(0,U.jsx)(rc,{description:s,url:a})]}))},splash:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,jc);const{payload:n}=t,[o]=fi(t),i=ma(n.id);return(0,U.jsx)(pa,_c(_c({type:"splash",event:t,onClick:i},r),{},{bodyProps:{dangerouslySetInnerHTML:{__html:o.text}}}))},video:e=>{let{event:t,descriptorId:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,cc);const[o]=fi(t),{description:i,url:s}=o;return cn(t).push("message--type-video"),(0,U.jsxs)(pa,uc(uc({event:t,type:"video"},n),{},{children:[(0,U.jsx)("div",{id:r,className:Xr("visually-hidden"),children:i}),(0,U.jsx)("iframe",{title:i,src:s,allow:"autoplay; encrypted-media",allowFullScreen:!0})]}))},upload:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,xc);const{t:n}=Tn(),[o]=fi(t),{fromClient:s}=t.payload,{filename:a,url:c}=o,l=(0,i.useMemo)((()=>n(c?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:a})),[c,a,n]);return(0,U.jsx)(pa,Tc(Tc({event:t,type:"upload"},r),{},{children:(0,U.jsxs)(Cc,{url:c,target:s?void 0:"_blank",children:[(0,U.jsx)(ji,{name:"download",size:"16"}),(0,U.jsx)("span",{"aria-hidden":"true",className:Xr("file-download"),children:a}),(0,U.jsx)("span",{className:Xr("visually-hidden"),children:l})]})}))},cta:({event:e})=>{const[t]=fi(e),r=ma(e.payload.id),{emitEvent:n}=Do(),o=So(),s=(0,i.useCallback)((()=>n("action.click_cta",{type:Le,originMessage:e.payload.id,link:{url:t.buttonLink}})),[n,t,e]);return(0,U.jsxs)(pa,{type:"cta",event:e,children:[(0,U.jsx)("div",{className:Xr("cta__content"),id:o,dangerouslySetInnerHTML:{__html:t.description},onClick:r}),(0,U.jsx)("a",{className:Xr("button","button--primary"),"aria-describedby":o,href:t.buttonLink,rel:"noreferrer",target:t.buttonNewTab?"_blank":"_self",onClick:s,children:t.buttonText})]})},carousel:({event:e})=>{const[t]=fi(e),r=t.cards;return(0,U.jsx)(pa,{event:e,modifiers:"type-carousel",children:(0,U.jsx)(zc,{items:r,ItemComponent:Mc,getItemKey:Vc,getItemLabel:qc})})},card:({event:e})=>{const[t]=fi(e),r=So();return(0,U.jsx)(pa,{type:"card",event:e,children:(0,U.jsx)(Dc,Gc({id:r},t))})}},info:{text:wa,divider:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,dc);const n=bc[Fe[t.payload.body.subtype]]||bc.default;return(0,U.jsx)(n,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hc(Object(r),!0).forEach((function(t){yc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({event:t},r))},translation:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,mc);const{t:n}=Tn(),[o]=fi(t);return(0,U.jsx)(pa,vc(vc({type:"text",event:t},r),{},{children:n(o.key.join("."),o.variables)}))},timeIndicator:na},participant:{participant:({event:e})=>{const{participant:t}=e.payload,[r]=fi(e);return r?(0,U.jsx)(ea,{graphicSrc:t.avatar,graphicType:t.avatar?"avatar":void 0,iconName:t.avatar?void 0:"balloon",childrenHTML:r,dividerType:"participant"}):null}},service_data:{suggestion:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Yc);const[n,o]=(0,i.useState)(!0),s=sn(),a=go(),{sendAction:c,addMessageBubble:l}=Do(),{suggestions:u,payload:p}=(e=>{const{payload:t}=e,[r]=fi(e);return{suggestions:r,payload:t}})(t),f=cr(),{t:d}=Tn(),h=d("suggestions.headingText"),y=d("suggestions.footerText"),b=(0,i.useMemo)((()=>f.some((({payload:e})=>e?.transactionLast))),[f]),m=(0,i.useCallback)((({id:e,question:t})=>{o(!1),s(Br(!0)),c({type:Ae,originMessage:p.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),l(t)}),[s,c,p.id,l]);return n&&!a&&b?(0,U.jsxs)("div",{className:Xr("suggestions","suggestions--conversation"),children:[h&&(0,U.jsx)("p",{className:Xr("suggestions__heading"),children:h}),(0,U.jsxs)(pa,Qc(Qc({type:"suggestions",showParticipant:!1,event:t},r),{},{children:[(0,U.jsx)(Vs,{className:"suggestions__list--conversation",onClickSuggestion:m,suggestions:u}),y&&(0,U.jsx)("p",{className:Xr("suggestions__footer"),children:y})]}))]}):null}}},nl=({children:e})=>{const{customComponents:t}=re(),r=(0,i.useMemo)((()=>Object.keys(rl).reduce(((e,r)=>el(el({},e),{},{[r]:el(el({},rl[r]),t?t[r]:{})})),{fallback:wa})),[t]);return(0,U.jsx)(Ys.Provider,{value:r,children:e})},ol=()=>{const{t:e}=Tn(),t=(0,i.useRef)(null),r=cr(),n=ir().isLoading,{isOpen:o}=vo(),s=pr(),a=Mn(),c=ir().loadedImageEventIds;return(0,i.useEffect)((()=>{const e=t.current;e&&(e.scrollTop=e.scrollHeight)}),[r,n,o,c]),(0,U.jsxs)(U.Fragment,{children:[o&&(0,U.jsx)("a",{className:Xr("skip-link"),href:`#${s}`,onClick:e=>{e.preventDefault(),a()},children:e("skiplinkText")}),(0,U.jsx)("div",{className:Xr("chat__body"),ref:t,children:(0,U.jsxs)("div",{className:Xr("conversation__container"),children:[(0,U.jsx)(Ks,{}),(0,U.jsxs)("ol",{className:Xr("conversation"),children:[(0,U.jsx)(nl,{children:(()=>{let e=null;return r.map((t=>{const{type:r,payload:n}=t,{participant:o,fromClient:i}=n;let s=!1;if("participant"!==r){const r=i?"seamly-client-participant":o;"info"!==t.type&&e!==r&&(s=!0),e=r}return(0,U.jsx)(oa,{event:t,newParticipant:s},t.payload.id)}))})()}),n&&(0,U.jsx)(sa,{})]})]})})]})},il=({baseClassName:e,children:t,title:r})=>{const n=pr(),o=So();return(0,U.jsxs)("section",{id:n,className:Xr(e),"aria-describedby":o,tabIndex:"-1",children:[(0,U.jsx)("h2",{className:Xr(`${e}__title`),id:o,children:r}),t]})},sl=()=>{const{t:e}=Tn(),t=Mn(),r=Mo(),{emitEvent:n}=Do(),{isActive:o,remaining:i,timer:s,endCountdown:a}=Zo(),c=i>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,U.jsx)(il,{baseClassName:"idle",title:l,children:c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:Xr("idle__count-container"),children:o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:Xr("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,U.jsx)("span",{className:Xr("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",s)})]})}),(0,U.jsxs)("div",{className:Xr("idle__options"),children:[(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{r(),a(!0),t(),n("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{a(),t(),n("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},al=()=>{const{t:e}=Tn(),t=Mo(),{name:r}=dr()||{},{continueChat:n,restartChat:o}=ti();return(0,U.jsx)(il,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:r}),children:(0,U.jsxs)("div",{className:Xr("prompt__options"),children:[(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{t(),n()},children:e("resumeConversationPrompt.continueButton")}),(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},cl=["id","name","type","labelText","labelClass","contentHint","aria-describedby"];function ll(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ul(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ll(Object(r),!0).forEach((function(t){pl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ll(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function pl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fl=function(e){let{id:t,name:r,type:n,labelText:o,labelClass:i,contentHint:s,"aria-describedby":a}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,cl);const{isSubmitted:l}=Gi(),[u,{error:p}]=Ki(r),f=l&&p,d=[];return a&&d.push(a),s&&d.push(`${t}-content-hint`),f&&d.push(`${t}-error`),(0,U.jsx)(Ts,{id:t,contentHint:s,validity:!f,errorText:p,labelText:o,labelClass:i,children:(0,U.jsx)("input",ul(ul({id:t,name:r,type:n,"aria-invalid":f?"true":"false","aria-describedby":d.join(" ")||null},u),c))})};function dl({controlName:e,skipLinkId:t}){const{t:r}=Tn(),{sendAssertive:n}=Ro(),{emitEvent:o}=Do(),s=(()=>{const{sendAction:e}=Do(),{features:t}=qn(),{typingPeekahead:r}=t||{},n=(0,i.useRef)(null),o=(0,i.useRef)(null),s=(0,i.useRef)(!1),a=(0,i.useRef)(null);(0,i.useEffect)((()=>()=>{clearInterval(a.current),clearTimeout(n.current),clearTimeout(o.current)}),[]);const c=(t,n)=>{e(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Uo(Object(r),!0).forEach((function(t){Fo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Uo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:Ie,state:t},r&&r.enabled?{body:{currentMessage:n}}:{}))};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(s.current=!0,a.current||(c(!0,e.target.value),a.current=setInterval((()=>{s.current?r&&r.enabled&&c(!0,e.target.value):(clearInterval(a.current),a.current=null)}),2e3)),clearTimeout(n.current),clearTimeout(o.current),n.current=setTimeout((()=>{s.current=!1}),300),o.current=setTimeout((()=>{c(!1,e.target.value)}),2e3))}})(),{setBlockAutoEntrySwitch:a}=zo(),{hasCharacterLimit:c,characterLimit:l,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:f}=function(e){const{t}=Tn(),{sendAssertive:r}=Ro(),{hasLimit:n,limit:o}=(()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=ir(),{limit:r}=t||e||{limit:null};return{hasLimit:null!==r,limit:null!==r?r:null}})(),s=(0,i.useMemo)((()=>ue(r,300)),[r]),a=(0,i.useMemo)((()=>ue(((e,r)=>{e&&s(t("input.srCharacterLimitText",{limit:r}))}),300)),[s,t]),[{value:c}]=Ki(e),l=n&&c?o-c.length:o,u=!!n&&l<=50,p=!!n&&l<0;return(0,i.useEffect)((()=>{a(u,l)}),[u,l,a]),{hasCharacterLimit:n,characterLimit:o,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:l}}(e),[{value:d}]=Ki(e),h=!!d,y=(0,i.useCallback)((()=>{u&&n(r("input.srCharacterLimitText",{limit:f})),o("ui.inputFocus")}),[r,n,u,f,o]),b=(0,i.useMemo)((()=>r("input.inputPlaceholder",{hasLimit:c,limit:c?l:null})),[r,c,l]),m=(0,i.useMemo)((()=>r("input.inputLabel",{hasLimit:c,limit:c?l:null})),[r,c,l]);return(0,i.useLayoutEffect)((()=>(a(h),()=>{a(!1)})),[a,h]),(0,U.jsxs)(xs,{className:Xr("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,U.jsxs)("div",{className:Xr(["input--text__container",...u&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,U.jsx)(fl,{id:t,type:"text",name:e,className:Xr("input__text"),autocomplete:"off",placeholder:b,labelText:m,labelClass:Xr("visually-hidden"),"aria-invalid":c?p:null,onKeyUp:s,onFocus:y}),(0,U.jsx)("div",{className:Xr("character-count"),children:u&&(0,U.jsx)("span",{children:f})})]}),(0,U.jsx)("button",{className:Xr("button","input__submit"),type:"submit",onPointerDown:e=>{e.preventDefault()},"aria-disabled":!h||p?"true":null,children:(0,U.jsx)(ji,{name:"send",size:"32",alt:r("input.sendMessage")})})]})}function hl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hl(Object(r),!0).forEach((function(t){bl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function bl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ml(){return ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ml.apply(this,arguments)}const gl="userText";function vl(e){let t=ml({},e);const{isOpen:r,setVisibility:n}=vo(),o=pr(),s=Mn(),{sendMessage:a}=Do(),c=(0,i.useCallback)(((e,{updateControlValue:t})=>{a({body:e.userText}),t(gl,""),s(),r||n(C.open)}),[a,s,r,n]);return(0,U.jsx)(Zi,yl(yl({},t),{},{formId:"textEntry",persistData:!0,onSubmit:c,children:(0,U.jsx)(dl,{controlName:gl,skipLinkId:o})}))}const Ol=()=>{const{t:e}=Tn(),{showFileUpload:t,serviceAllowsUploads:r}=Xn(),[n,o]=(0,i.useState)(r),s=Mn(),a=(0,i.useRef)(null),{setUserEntryType:c,activeEntry:l}=zo(),u=(0,i.useRef)(null),{sendPolite:p}=Ro(),f=!!dr();return(0,i.useEffect)((()=>{Oe(u.current,(()=>{r||s()})),o(r)}),[r,s]),(0,i.useEffect)((()=>{a.current&&!r&&p(e("fileUpload.srUnavailableText")),!1===a.current&&r&&p(e("fileUpload.srAvailableText")),f&&(a.current=r)}),[r,f,p,e]),!t&&l!==Te&&(0,U.jsx)(Ti,{isActive:n,transitionStartState:xi,children:(0,U.jsx)("div",{className:Xr("upload-toggle-wrapper"),children:(0,U.jsx)(Ti,{isActive:n,transitionStartState:Si,children:(0,U.jsx)("button",{className:Xr(["button","button--secondary","upload-toggle"]),ref:u,"aria-disabled":n?null:"true",type:"button",onClick:n?()=>{c(Te),s()}:null,children:(0,U.jsx)(ji,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},jl=()=>{const{t:e}=Tn(),{currentUploads:t}=Zn();return(0,U.jsx)("div",{className:Xr("progress"),children:t.map((({id:t,name:r,progress:n,uploading:o,error:i})=>(0,U.jsxs)("div",{className:Xr("progress_container"),children:[(0,U.jsxs)("div",{className:Xr("progress__text"),children:[(0,U.jsx)("span",{className:Xr("progress__text--file-name"),children:r}),(0,U.jsx)("span",{className:Xr("progress__text--percentage"),children:`${n}%`})]}),(0,U.jsx)(Ss,{error:i}),(0,U.jsx)("progress",{className:Xr("progress__bar"),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-label":e("fileUpload.srProgressLabel",{fileName:r}),max:"100","aria-valuenow":n,value:n,"aria-busy":o,children:`${n}%`})]},t)))})};function wl({id:e,name:t,labelText:r,contentHint:n,outputText:o,accept:s}){const{isSubmitted:a}=Gi(),[c,l]=(0,i.useState)(!1),[{onInput:u,onBlur:p},{error:f}]=Ki(t),d=So(),h=So(),y=So(),b=a&&f,m=[y];n&&m.push(h),b&&m.push(d);const g=(0,i.useCallback)((()=>{l(!0)}),[l]),v=(0,i.useCallback)((()=>{l(!1),p()}),[l,p]),O=(0,i.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,U.jsxs)("div",{className:Xr("upload__container"),children:[n&&(0,U.jsx)("span",{className:Xr("upload__content-hint"),id:h,children:n}),(0,U.jsx)(Ss,{id:d,error:b&&f}),(0,U.jsx)("div",{className:Xr(["file-upload",...c?["focus-within"]:[]]),children:(0,U.jsxs)("label",{htmlFor:e,className:Xr("upload__label"),children:[(0,U.jsx)(ji,{name:"upload",size:"32"}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{className:Xr(["upload__label--text"]),children:r}),(0,U.jsx)("input",{id:e,className:Xr("upload__input"),type:"file",name:t,onChange:O,"aria-invalid":b?"true":"false","aria-describedby":m.join(" "),accept:s||null,onFocus:g,onBlur:v}),(0,U.jsx)("span",{className:Xr("upload__output"),"aria-hidden":"true",id:y,children:o})]})]})})]})}function _l({skiplinkId:e,controlName:t,accept:r,contentHint:n,isUploading:o,isComplete:i,onClickCancel:s}){const{t:a}=Tn(),[{value:c}]=Ki(t),l=c&&c.length>0,u=l?c[0].name:"";return(0,U.jsxs)(xs,{className:Xr("upload-form"),children:[(0,U.jsx)(wl,{name:t,id:e,accept:r,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:n}),(0,U.jsxs)("div",{className:Xr("upload__button-container"),children:[(0,U.jsx)("button",{id:o||!i?e:void 0,type:"button",onClick:s,className:Xr("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,U.jsx)("button",{className:Xr("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})}const El="fileListForm",xl="fileList",Sl=()=>{const{t:e}=Tn(),{sendPolite:t,sendAssertive:r}=Ro(),n=pr(),o=Mn(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:c}=Xn(),l=(0,i.useRef)(null),u=(0,i.useRef)(s),{cancelEntrySelection:p}=zo(),{uploadFile:f,clearUploads:d,isUploading:h,isComplete:y}=Zn(),{hasFile:b,selectedFileName:m,uploadHandle:g,hasServerError:v,progress:O}=((e,t)=>{const r=te(Hi,{formId:e,name:t},[e,t]),{currentUploads:n}=Zn(),o=r&&r.length>0;let i=null,s=!1,a=0;if(n&&n.length>0){const e=n[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?r[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(El,xl),j=So(),w=(0,i.useRef)(!0),_=e("fileUpload.contentHint",{size:de(c)}),E=(0,i.useRef)(""),x=(0,i.useRef)(null);(0,i.useEffect)((()=>{E.current&&x.current.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&r(_),E.current=_}),[_,r]),(0,i.useEffect)((()=>{O>0&&t(1===O?e("fileUpload.srStartedText"):`${O}%`)}),[O,t,e]),(0,i.useEffect)((()=>{w.current||h||!y||(d(),p(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),w.current=y}),[h,y,d,p,o,t,e]);const S=(0,i.useCallback)((({fileList:e})=>{f(e[0]),o()}),[f,!1,o]),T=(0,i.useCallback)((()=>{g&&g.abort(),d(),p(),o()}),[g,d,p,o]),P=(0,i.useMemo)((()=>({[xl]:[ms((()=>s),e("fileUpload.errors.unavailable")),ms(vs,e("fileUpload.errors.noFile")),ms(gs,e("fileUpload.errors.tooLarge"),c)]})),[c,s,e]);return(0,U.jsx)("div",{className:Xr(["upload",...v?["upload--error"]:[]]),ref:x,children:(0,U.jsxs)(Zi,{formId:El,persistData:!0,onSubmit:S,validationSchema:P,children:[(h||!y)&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(jl,{}),(0,U.jsx)("div",{className:Xr("upload__button-container"),children:(0,U.jsx)("button",{id:h||!y?n:void 0,type:"button",onClick:T,ref:l,className:Xr("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&y&&(0,U.jsx)(_l,{controlName:xl,skiplinkId:n,accept:a.join(", "),contentHint:_,isComplete:y,isUploading:h,outputText:e("fileUpload.selectedText",{hasFile:b,filename:m}),onClickCancel:T}),!u.current&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:Xr("notification"),id:j,children:e("fileUpload.unavailableText")}),(0,U.jsx)("div",{className:Xr("upload__button-container"),children:(0,U.jsx)("button",{id:h||!y?n:void 0,type:"button",onClick:T,className:Xr("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})};function Tl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tl(Object(r),!0).forEach((function(t){Cl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Cl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Al=()=>{const{isOpen:e}=vo(),t=(0,i.useRef)(null),{hasCountdown:r}=Zo(),[n,o]=(0,i.useState)(r),{hasPrompt:s}=ti(),[a,c]=(0,i.useState)(s),l=Mn(),u=(0,i.useRef)(!1),{activeEntry:p}=zo(),[f,d]=(0,i.useState)({text:vl,upload:Sl}),[h,y]=(0,i.useState)((()=>p)),b=re(),{accountAllowsUploads:m}=Xn(),g=(0,i.useCallback)((()=>{Oe(t.current,(()=>{l()}))}),[l]);(0,i.useEffect)((()=>{const{customComponents:e}=b,{entry:t}=e||{};t&&d((e=>Pl(Pl({},e),t)))}),[b]),(0,i.useEffect)((()=>{g(),o(r),c(s)}),[r,s,g]),(0,i.useEffect)((()=>{y(p),g()}),[p,g,t]),u.current=!(!t.current||!t.current.contains(document.activeElement));const v=f[h];return(0,U.jsxs)("div",{className:Xr("chat__entry"),ref:t,children:[n&&(0,U.jsx)(sl,{}),a&&(0,U.jsx)(al,{}),(0,U.jsxs)("div",{className:Xr(["entry__body",...r||s?["entry__body--hidden"]:[]]),children:[h!==Te&&m&&e&&(0,U.jsx)(Ol,{}),(0,U.jsx)(v,{})]})]})};function Il({controlName:e,describedById:t}){const{t:r}=Tn();return(0,U.jsxs)(xs,{noValidate:"true",className:Xr("options__form"),children:[(0,U.jsx)(fl,{name:e,type:"email",className:Xr("transcript__input"),"aria-describedby":t,labelClass:Xr("label"),labelText:r("options.sendTranscript.label")}),(0,U.jsx)("div",{className:Xr("options__actions"),children:(0,U.jsx)("button",{type:"submit",className:Xr("button","button--primary","options__submit"),children:r("options.sendTranscript.sendButtonText")})})]})}const Nl="email",Dl={sendTranscript:()=>{const[e,t]=(0,i.useState)(void 0),{hideOption:r}=qn(),{focusButton:n}=Wn(),{t:o}=Tn(),s=So(),{sendAction:a}=Do(),c=(0,i.useMemo)((()=>({[Nl]:[ms(js,o("options.sendTranscript.noEmailText")),ms(Os,o("options.sendTranscript.invalidEmailText"))]})),[o]),l=(0,i.useCallback)((e=>{const t=e.email.trim();a({type:"send_transcript",body:{emailAddress:t}}),r(),n()}),[a,r,n]),u=(0,i.useCallback)((({isValid:e,isSubmitted:r})=>{t(r&&!e?"options--error":void 0)}),[t]);return(0,U.jsxs)(Pi,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),children:[(0,U.jsx)("p",{className:Xr("options__description"),id:s,children:o("options.sendTranscript.description")}),(0,U.jsx)(Zi,{formId:"sendTranscript",onSubmit:l,validationSchema:c,onError:u,children:(0,U.jsx)(Il,{controlName:Nl,describedById:s})})]})}},kl=()=>{const{optionActive:e}=qn(),t=(0,i.useRef)(null),r=Dl[e||t.current];return e&&(t.current=e),r?(0,U.jsx)(r,{}):null},Rl=()=>{const{t}=Tn(),{menuOptions:r,showOption:n,panelActive:o,hideOption:s}=qn(),{id:a}=Wn(),c=(0,i.useRef)(null),[l,u]=(0,i.useState)(!1),p=(0,i.useRef)(null),f=r.length,d=(0,i.useRef)(Array.from({length:f},(()=>(0,e.createRef)()))),h=(0,i.useRef)(!1),y=f>1,b=r[0],m=(0,i.useMemo)((()=>b?.name?.trim().replace(/\s+/g,"")),[b]);return(0,i.useEffect)((()=>()=>{clearTimeout(c.current)}),[]),(0,i.useEffect)((()=>{l&&!h.current&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{const e=r.findIndex((e=>e.available)),t=-1===e?0:e;ve(d.current[t])}))})),h.current=l}),[l,r]),f?(0,U.jsxs)("div",{className:Xr("options__container"),onKeyDown:e=>{l&&(ge(e)===me.Escape&&(u(!1),ve(p.current)),ge(e)===me.Home&&(ve(d.current[0]),e.preventDefault()),ge(e)===me.End&&(ve(d.current[f-1]),e.preventDefault()))},onfocusout:()=>{y&&(c.current=setTimeout((()=>{u(!1)}),200))},onfocusin:()=>{clearTimeout(c.current)},children:[(0,U.jsx)(Ti,{transitionStartState:Ei,isActive:o,children:(0,U.jsx)("div",{className:Xr("options__dialog"),children:(0,U.jsx)(kl,{})})}),y&&(0,U.jsx)(Ti,{isActive:l,transitionStartState:Ei,children:(0,U.jsx)("ul",{className:Xr(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":a,children:r.map((({name:e,title:o,available:i},s)=>(0,U.jsx)("li",{className:Xr("options__menu__item"),role:"menuitem","data-testid":e,children:(0,U.jsxs)("button",{type:"button",ref:e=>{d.current[s]=e},className:Xr(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(ge(e)===me.ArrowDown){const r=Math.min(f-1,t+1);ve(d.current[t===r?0:r]),e.preventDefault()}if(ge(e)===me.ArrowUp){const r=Math.max(0,t-1);ve(d.current[t===r?f-1:r]),e.preventDefault()}})(e,s),onKeyPress:e=>((e,t)=>{const n=String.fromCharCode(e.charCode);if(1!==n.length||!n.match(/\S/))return;let o=-1;r.forEach(((e,r)=>{r>t&&e.title.charAt(0).toLowerCase()===n.toLowerCase()&&-1===o&&(o=r)})),-1!==o&&ve(d.current[o])})(e,s),onClick:()=>((e,t)=>{t&&(u(!1),n(e))})(e,i),"aria-disabled":i?null:"true",children:[(0,U.jsxs)("span",{className:Xr("button__text"),children:[o,!i&&" "]}),!i&&(0,U.jsx)("span",{className:Xr("button__state"),children:t("options.unavailableText")})]})},e)))})}),(0,U.jsxs)("button",{type:"button",className:Xr(["button","button--secondary","chat__options__button",...!y&&m?[`chat__options__button--${m}`]:[]]),id:a,onClick:()=>{o&&s(),y?u((e=>!e)):b.available&&n(b.name)},onKeyDown:y?e=>{ge(e)===me.ArrowDown&&(u(!0),e.preventDefault())}:null,ref:p,"aria-haspopup":y?"menu":null,"aria-expanded":y?l.toString():null,"aria-disabled":y||b.available?null:"true",children:[y&&(0,U.jsx)(ji,{name:"options",size:"32"}),(0,U.jsx)("span",{className:Xr("button__text"),children:y?t("options.openButtonText"):`${b.title}${b.available?"":" "}`}),!y&&!b.available&&(0,U.jsx)("span",{className:Xr("button__state"),children:t("options.unavailableText")})]})]}):null};function Ll(){const{menuOptions:e,allowOptionSelection:t}=qn(),{isAvailable:r}=pi();return r||t&&e.length?(0,U.jsxs)("div",{className:Xr("chat__options"),children:[r&&(0,U.jsx)("div",{className:Xr("chat__options-item","chat__options-item--left"),children:(0,U.jsx)(Ms,{})}),t&&(0,U.jsx)("div",{className:Xr("chat__options-item","chat__options-item--right"),children:(0,U.jsx)(Rl,{})})]}):null}function Ml(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ul(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fl=function({children:e,interruptComponent:t}){const{hasInterrupt:r,meta:n}=oo(),{isOpen:o}=vo();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Fs,{}),(0,U.jsx)("div",{className:Xr("chat__container"),children:r?o?(0,U.jsx)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ml(Object(r),!0).forEach((function(t){Ul(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ml(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},n)):null:e}),o&&(0,U.jsx)(Ll,{})]})};function Bl(){const{preChatEvents:e,layoutMode:t}=re(),{hasInterrupt:r}=oo(),{isOpen:n}=vo(),o=!(r||!e.length||n);return o&&(0,U.jsx)("ul",{className:Xr("pre-chat-messages",`pre-chat-messages--${t}`),"aria-hidden":!o,children:e.map((e=>(0,U.jsx)("li",{className:Xr("pre-chat-messages__message"),children:(0,U.jsx)(Hl,{event:e})},e.payload.id)))})}function Hl({event:e}){const[t]=Js(e);return(0,U.jsx)(t,{event:e})}function $l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Vl=()=>{const e=ne(),t=dr(),{hasInterrupt:r}=oo(),n=t&&!r,o=n?t.avatar:e;return o?(0,U.jsx)("img",{className:Xr(n?"avatar":"icon"),src:o,alt:""}):(0,U.jsx)(ji,{name:"avatar",size:"32"})},ql=({onClick:e})=>{const t=on(),{t:r}=Tn(),n=r(t?"window.openButton.srContinue":"window.openButton.srStart"),o=Mn(),{isOpen:s}=vo(),a=ur(),c=(0,i.useCallback)((()=>{e(),o()}),[o,e]);return(0,U.jsx)(Ti,{isActive:!s,transitionStartState:xi,children:(0,U.jsxs)("button",{className:Xr("window-open-button"),"aria-label":n,"aria-hidden":s,onClick:c,children:[(0,U.jsx)("span",{className:Xr("message-count"),"aria-hidden":"true",children:!!a&&a}),(0,U.jsx)(Vl,{})]})})},Wl=({onClick:e})=>{const{t}=Tn(),r=(0,i.useCallback)((()=>e()),[e]);return(0,U.jsx)("button",{type:"button",className:Xr("button","collapse-button"),onClick:r,children:(0,U.jsx)(ji,{name:"chevronDown",size:"32",alt:t("window.srCollapseButton")})})},Gl={app:()=>(qo(),(0,U.jsx)(Ws,{children:(0,U.jsxs)(Fl,{interruptComponent:Gs,children:[(0,U.jsx)(ol,{}),(0,U.jsx)(Al,{})]})})),inline:()=>{qo();const{showInlineView:e,containerRef:t}=Oo(),{isOpen:r}=vo(),{hasInterrupt:n,meta:o}=oo();return n&&!r?(0,U.jsx)(Gs,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$l(Object(r),!0).forEach((function(t){zl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},o)):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ti,{isActive:!r,transitionStartState:xi,children:(0,U.jsxs)("div",{ref:t,className:Xr("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,U.jsx)(Bl,{}),(0,U.jsx)(qs,{})]})}),(0,U.jsx)(Ti,{isActive:r,transitionStartState:xi,children:(0,U.jsx)(Ws,{ref:t,children:e&&(0,U.jsxs)(Fl,{interruptComponent:Gs,children:[r&&(0,U.jsx)(ol,{}),(0,U.jsx)(Al,{})]})})})]})},window:()=>{const{openChat:e,closeChat:t}=qo(),{isOpen:r}=vo(),n=go(),{t:o}=Tn(),s=o("window.chat.continue"),a=(0,i.useMemo)((()=>({payload:{body:{text:s}}})),[s]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ql,{onClick:e}),(0,U.jsx)(Ti,{isActive:!r&&!n,transitionStartState:xi,children:(0,U.jsx)("div",{className:Xr("unstarted-wrapper","unstarted-wrapper--window"),children:(0,U.jsx)(Bl,{})})}),(0,U.jsx)(Ti,{isActive:!r&&n,transitionStartState:Ei,children:(0,U.jsx)("div",{className:Xr("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,U.jsx)(wa,{event:a})})}),(0,U.jsx)(Ti,{isActive:r,transitionStartState:Ei,children:(0,U.jsxs)(Ws,{children:[r&&(0,U.jsx)(Wl,{onClick:t}),(0,U.jsxs)(Fl,{interruptComponent:Gs,children:[(0,U.jsx)(ol,{}),(0,U.jsx)(Al,{})]})]})})]})}},Kl=({children:e})=>{const[,t]=Rn(),{namespace:r,layoutMode:n,zIndex:o}=re(),{isOpen:s,isVisible:a}=vo(),c=an(),l=go(),{locale:u}=Tn(),p=Gl[n],f=(0,i.useCallback)((e=>{t(e)}),[t]),d=(0,i.useMemo)((()=>{if(u&&document.querySelector("html").getAttribute("lang")!==u)return u}),[u]);if(!p)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const h=["app",`app--layout-${n}`,`namespace--${r}`,...c];return s||"app"===n||h.push("app--collapsed"),l&&h.push("app--user-responded"),a&&(0,U.jsx)("div",{className:Xr(h),lang:d,tabIndex:"-1","data-nosnippet":!0,style:{zIndex:o},ref:f,children:e||(0,U.jsx)(p,{})})},{createAction:Yl}=h("errors"),Jl=Yl("catch-error",(e=>({error:e})));function Ql({api:e}){return({getState:t})=>{const r=r=>{const{errorCallback:n,namespace:o,api:i,layoutMode:s}=D(t());n?.(r.error,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:r.type?r:void 0})};return e=>t=>{try{return t.error&&r(t),e(t)}catch(e){throw r({error:e}),e}}}}function Xl(e,t,r=[]){const n=(0,i.useContext)(en),o=(0,i.useRef)();o.current=t,(0,i.useEffect)((()=>{if(!r.every(Boolean))return;const t=(...e)=>o.current?.(...e);return n.emit("function.register",e,t),()=>n.emit("function.unregister",e,t)}),[n,e,...r])}const Zl=()=>{const e=re(),{sendMessage:t,sendContext:r,sendAction:n}=Do(),{setVisibility:o,visible:s}=vo(),a=(0,i.useRef)(s),c=(0,i.useContext)(en),l=tn(),u=ur(),p=(0,i.useRef)(null),f=(0,i.useRef)(null),{isInline:d,isResolving:h}=yr(),{hasInterrupt:y}=oo(),b=nn(),m=(0,i.useRef)(null),g=Mo(),{enableTranslations:v,disableTranslations:O}=pi();return(0,i.useEffect)((()=>{a.current=s}),[s]),Xl("askText",(e=>{t({body:e})}),[l?.send]),Xl("setVariables",(e=>{r({variables:e})}),[l?.send]),Xl("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),Xl("setVisibility",(e=>{Object.values(C).includes(e)?(g(),o(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e?.api]),Xl("sendCustomAction",((e,t)=>{n({type:"custom",body:{type:e,body:t}})}),[l.send]),Xl("setTopic",(({name:e,fallbackMessage:t})=>{e&&t?n({type:ke,body:{name:e,fallbackMessage:t}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),Xl("setTranslation",(({enabled:e,locale:t})=>{e?v(t):O()}),[l.send]),(0,i.useEffect)((()=>{h||y||(m.current&&m.current!==b&&c.emit("unreadMessageCount",u),s===C.open&&s!==f.current&&0!==p.current&&c.emit("unreadMessageCount",0),s!==C.open&&u!==p.current&&c.emit("unreadMessageCount",u),f.current=s,p.current=u,m.current=b)}),[u,s,c,d,h,y,b]),null},{SET_EVENTS_READ:eu}=He,tu=()=>{const{t:e}=Tn(),t=cr(),r=sn(),{isOpen:n,isVisible:o}=vo(),{sendAction:s}=Do(),a=ur(),{sendPolite:c}=Ro(),l=(0,i.useMemo)((()=>ue(c,2e3)),[c]),u=(0,i.useRef)(null),p=(0,i.useRef)(null);return(0,i.useEffect)((()=>{if(!n)return;const e=t.filter((e=>Pt(e)&&e.payload.messageStatus===Pe)).map((e=>e.payload.id));e.length>0&&(r({type:eu,ids:e}),s({type:Ne,events:e}))}),[t,r,n,s]),(0,i.useEffect)((()=>{u.current!==o&&!o&&p.current&&p.current(),0!==a&&!n&&o&&(p.current=l(e("message.srTextUnreadCount",{unreadCount:a}))),u.current=o}),[a,n,o,l,e]),null},ru=()=>{const{t:e}=Tn(),t=cr(),r=(0,i.useRef)(0),n=(0,i.useRef)(0),o=ir().historyLoaded,{sendPolite:s}=Ro(),{isOpen:a}=vo(),c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useMemo)((()=>ue((t=>{const r=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;r>n.current&&(s(e("message.srNewEventCount",{newCount:r-n.current})),n.current=r)}),1e3)),[s,e]);return(0,i.useEffect)((()=>{t.length>r.current&&(a&&(l.current=u(t)),r.current=t.length)}),[t,u,a]),(0,i.useEffect)((()=>{c.current&&!a&&l.current&&(l.current(!0),l.current=null)}),[a]),(0,i.useEffect)((()=>{o&&setTimeout((()=>{s(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,s]),null},nu=({children:e})=>{const t=(0,i.useContext)(en),[r,n]=(0,i.useState)({}),o=(0,i.useRef)(!0),s=(0,i.useCallback)((e=>{o.current&&(n(e),t.emit("aria-live",e))}),[n,t]);(0,i.useEffect)((()=>{let e=null;return r&&r.messageText&&(e=setTimeout((()=>{s({}),clearTimeout(e)}),500)),()=>{clearTimeout(e)}}),[r,s]),(0,i.useEffect)((()=>()=>{o.current=!1}),[]);const{ariaLive:a,messageText:c}=r;return(0,U.jsxs)(ko.Provider,{value:s,children:[e,(0,U.jsxs)("div",{className:Xr("app__live-container"),children:[(0,U.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Xr("visually-hidden"),children:a===Me?c:null}),(0,U.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Xr("visually-hidden"),children:a===Ue?c:null})]})]})},ou=()=>{const{hasCountdown:e,isActive:t,remaining:r,decrementCountdown:n}=Zo();return((e,t)=>{const r=(0,i.useRef)(e);(0,i.useEffect)((()=>{r.current=e}),[e]),(0,i.useEffect)((()=>{if(null!==t){const e=setInterval((function(){r.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{n()}),e&&t&&r>0?1e3:null),null},iu=({children:e})=>{const t=(0,i.useRef)(0),{sendAction:r}=Do(),{hasCountdown:n,isActive:o,stopCountdown:s}=Zo(),a=(0,i.useCallback)((()=>{const e=(new Date).getTime(),i=()=>{r({type:"interactivity_update"}),t.current=e};n&&o&&(i(),s()),e-t.current>15e3&&i()}),[r,n,o,s]);return(0,U.jsx)("div",{className:Xr("activity-monitor"),tabIndex:"-1",onMouseDown:a,onKeyUp:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,children:(0,U.jsx)(Lo.Provider,{value:a,children:e})})},su=()=>{const{initUserSelectedOptions:e}=qn(),t=(0,i.useRef)(!1),r=re();return(0,i.useEffect)((()=>{r.api&&!t.current&&(t.current=!0,e())}),[e,r]),null},au=["serviceSettings"];const{ADD_EVENT:cu,ACK_EVENT:lu,SET_IS_LOADING:uu,SET_PARTICIPANT:pu,SET_HEADER_SUB_TITLE:fu,SET_ACTIVE_SERVICE:du,INIT_RESUME_CONVERSATION_PROMPT:hu,CLEAR_EVENTS:yu,SET_SERVICE_DATA_ITEM:bu,SET_FEATURE_ENABLED_STATE:mu,SET_SERVICE_ENTRY_METADATA:gu,SET_HISTORY:vu}=He,Ou=["text","choice_prompt","image","video"],ju=({eventBus:e})=>{const{t}=Tn(),r=tn(),n=sn(),o=cr(),s=(0,i.useRef)(null),{setUserSelectedOption:a}=qn(),{initCountdown:c,endCountdown:l}=Zo(),{emitEvent:u}=Do();return(0,i.useEffect)((()=>{if(r.connectionInfo){const t=e=>{const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:r,participant:o}=t;!r&&o.name&&n({type:fu,title:o.name}),n({type:pu,participant:o,fromClient:r}),o.introduction&&n({type:cu,event:e})};r.stream().subscribe({next:r=>{const{type:o,payload:i}=r;switch(o){case"ui":switch(i.state&&i.state.hasOwnProperty("loading")&&n({type:uu,isLoading:i.state.loading}),i.type){case"idle_detach_countdown":c(i.body.duration);break;case"idle_detach_countdown_elapsed":l(void 0,!0);break;case"resume_conversation_prompt":n({type:hu});break;case"user_first_response":n(Br(!0)),e.emit("system.userFirstResponse",i.body)}break;case"message":switch(t(i),i.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":i.service&&i.service.serviceSessionId&&n({type:du,activeServiceSessionId:i.service.serviceSessionId}),n({type:cu,event:r})}break;case"participant":t(r);break;case"service_data":i.persist&&n({type:bu,payload:i});break;case"ack":n({type:lu,event:r});break;case"system":if("service_changed"===i.type){const{serviceSettings:e}=i,t=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(i,au),{uploads:r,entry:o}=e;n({type:mu,key:Be,enabled:!(!r||!r.enabled)}),n({type:gu,entryMeta:o}),n({type:du,activeServiceSessionId:i.serviceSessionId}),u("system.serviceChanged",t)}break;case"info":"divider"!==i.type&&"text"!==i.type&&"translation"!==i.type||n({type:cu,event:r});break;case"error":switch(i.type){case"find_conversation_erred":n(Ur(new kr(r)));break;case"seamly_offline":n(Ur(new ao(r))),n({type:yu});break;default:n(Ur(new io(r)))}break;case"socket_opened":n(Fr())}}}),r.stream().filter((e=>"message"===e.type&&Ou.includes(e.payload.type))).subscribe({next:({payload:t})=>{t.id!==s.current&&e.emit("message",t),s.current=t.id}})}}),[n,r,e,t,a,c,l,u]),(0,i.useEffect)((()=>{if(r.stream){const e=r.stream().filter((e=>"sync"===e.type)).subscribe({next:e=>{const{payload:t}=e,i=o[o.length-1],{id:s}=t.lastEvent;i&&s===i.payload.id||r.getConversation().then((e=>{e&&n({type:vu,history:e})})).catch((e=>{n(Ur(e))}))}});return()=>{e.unsubscribe()}}return()=>{}}),[r,o,n]),null},{REGISTER_UPLOAD:wu,SET_UPLOAD_PROGRESS:_u,SET_UPLOAD_ERROR:Eu,SET_UPLOAD_COMPLETE:xu}=He,Su=({children:e})=>{const{t}=Tn(),r=sn(),n=tn(),{addUploadBubble:o}=Do();return(0,U.jsx)(Gn.Provider,{value:e=>{const i=s(),a=n.uploadFile(e,(e=>{r({type:_u,fileId:i,progress:Math.ceil(e)})}),(e=>{const{id:t,transactionId:n,occurredAt:s,body:{contentType:a,filename:c,filesize:l,url:u}}=e.body;r({type:xu,fileId:i}),o(t,n,s,a,c,l,u)}),(e=>{let n;switch(e&&e.body?e.body.error:""){case"file_uploads_are_disabled":n=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":n=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":n=t("fileUpload.errors.wrongType");break;case"virus_found":n=t("fileUpload.errors.virusFound");break;default:n=t("fileUpload.errors.general")}r({type:Eu,fileId:i,errorText:n})}));r({type:wu,fileId:i,fileName:e.name,uploadHandle:a})},children:e})},Tu=({store:e,children:t,config:r,eventBus:n,api:o})=>((0,i.useErrorBoundary)((t=>e.dispatch(Jl(t)))),(0,U.jsx)(F,{store:e,children:(0,U.jsx)(en.Provider,{value:n,children:(0,U.jsx)(Zr.Provider,{value:o,children:(0,U.jsx)(nu,{children:(0,U.jsxs)(nl,{children:[(0,U.jsx)(su,{config:r}),(0,U.jsx)(ju,{eventBus:n}),(0,U.jsx)(tu,{}),(0,U.jsx)(ru,{}),(0,U.jsx)(ou,{}),(0,U.jsxs)(iu,{children:[(0,U.jsx)(Zl,{}),(0,U.jsx)(Su,{children:t})]})]})})})})}));function Pu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Cu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pu(Object(r),!0).forEach((function(t){Au(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Au(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Iu=e=>(0,U.jsx)(Tu,Cu(Cu({},e),{},{children:(0,U.jsx)(Kl,{})}));var Nu=r(813),Du=r.n(Nu),ku=r(766),Ru=r.n(ku);function Lu(e){const t="cvco."+e;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let r;do{r=sessionStorage.getItem(e[0])}while(e.shift()&&!r);return JSON.parse(r)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}var Mu=r(905),Uu=r.n(Mu),Fu=e=>"function"==typeof e?e:function(){return e},Bu="undefined"!=typeof self?self:null,Hu="undefined"!=typeof window?window:null,$u=Bu||Hu||void 0,zu="closed",Vu="errored",qu="joined",Wu="joining",Gu="leaving",Ku="phx_close",Yu="phx_error",Ju="phx_reply",Qu="phx_leave",Xu=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,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:r}){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})}},Zu=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))}},ep=class{static request(e,t,r,n,o,i,s){if($u.XDomainRequest){let r=new $u.XDomainRequest;this.xdomainRequest(r,e,t,n,o,i,s)}else{let a=new $u.XMLHttpRequest;this.xhrRequest(a,e,t,r,n,o,i,s)}}static xdomainRequest(e,t,r,n,o,i,s){e.timeout=o,e.open(t,r),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n)}static xhrRequest(e,t,r,n,o,i,s,a){e.open(t,r,!0),e.timeout=i,e.setRequestHeader("Content-Type",n),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)}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 r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let o=t?`${t}[${n}]`:n,i=e[n];"object"==typeof i?r.push(this.serialize(i,o)):r.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},tp=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/websocket"),"$1/longpoll")}endpointURL(){return ep.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(){this.close(),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry()}poll(){1!==this.readyState&&0!==this.readyState||ep.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),(e=>{if(e){var{status:t,token:r,messages:n}=e;this.token=r}else t=0;switch(t){case 200:n.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(),this.close();break;case 0:case 500:this.onerror(),this.closeAndRetry();break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){ep.request("POST",this.endpointURL(),"application/json",e,this.timeout,this.onerror.bind(this,"timeout"),(e=>{e&&200===e.status||(this.onerror(e&&e.status),this.closeAndRetry())}))}close(e,t){this.readyState=3,this.onclose()}},rp={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 r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,o,i,s]=JSON.parse(e);return t({join_ref:r,ref:n,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+r.length+o.length+n.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++,r.length),c.setUint8(l++,o.length),c.setUint8(l++,n.length),Array.from(t,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(o,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(n,(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),r=t.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(e.slice(s,s+n));s+=n;let c=r.decode(e.slice(s,s+o));s+=o;let l=r.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,r){let n=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(e.slice(a,a+n));a+=n;let l=r.decode(e.slice(a,a+o));a+=o;let u=r.decode(e.slice(a,a+i));a+=i;let p=r.decode(e.slice(a,a+s));a+=s;let f=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:Ju,payload:{status:p,response:f}}},decodeBroadcast(e,t,r){let n=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=r.decode(e.slice(i,i+n));i+=n;let a=r.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}};function np(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function op(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?np(Object(r),!0).forEach((function(t){ip(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):np(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ip(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ap(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sp(Object(r),!0).forEach((function(t){cp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function cp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const lp=Uu()("seamly");class up{constructor(e,t,r,n){this.url=e,this.accessToken=n,this.channelName=t,this.channelTopic=r,this.connect(),this.socket.onError((e=>{lp("[SOCKET][ERROR]",e),this.emit({type:"error",payload:{type:"seamly_offline",error:e}})})),this.socket.onOpen((()=>{lp("[SOCKET]OPEN"),this.emit({type:"socket_opened"})})),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&this.emit({type:"connection",connected:!0,ready:!0})})),this.socket.onClose((()=>{lp("[SOCKET]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onClose((()=>{lp("[CHANNEL]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onError((e=>{lp("[CHANNEL][ERROR]",e),this.emit({type:"connection",connected:!1,ready:!1})})),this.listenTo("ack"),this.listenTo("ui"),this.listenTo("error"),this.listenTo("participant",((e,t)=>ap(ap({},t),{},{type:e}))),this.listenTo("message"),this.listenTo("service_data"),this.listenTo("system"),this.listenTo("info"),this.listenTo("sync")}start(e){this.listener=e,this.channel.join().receive("ok",(()=>{lp("[CHANNEL][JOIN] OK"),this.emit({type:"connection",connected:!0,ready:!1})})).receive("error",(e=>{lp("[CHANNEL][JOIN] ERROR",e),this.emit({type:"error",payload:{type:"join_channel_erred",error:e}}),this.emit({type:"connection",connected:!1,ready:!1}),this.channel.socket.disconnect()})).receive("timeout",(()=>{lp("[CHANEL][JOIN] Networking issue. Still waiting...")}))}stop(){this.listener=null}connect(){const{url:e,params:t}=(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[r,n]=t.split("=");return op(op({},e),{},{[r]:decodeURIComponent(n)})}),{})}})(this.url);this.socket=new 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||$u.WebSocket||tp,this.establishedConnections=0,this.defaultEncoder=rp.encode.bind(rp),this.defaultDecoder=rp.decode.bind(rp),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==tp?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Hu&&Hu.addEventListener&&(Hu.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),r=this.connectClock)})),Hu.addEventListener("pageshow",(e=>{r===this.connectClock&&(r=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.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Fu(t.params||{}),this.endPoint=`${e}/websocket`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Zu((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}replaceTransport(e){this.disconnect(),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=ep.appendParams(ep.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,r){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,r)}connect(e){this.connectClock++,e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Fu(e)),this.conn||(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))}log(e,t,r){this.logger(e,t,r)}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}onConnOpen(){this.hasLogger()&&this.log("transport",`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.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,r||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(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(),clearTimeout(this.heartbeatTimer),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,r=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,n])=>{n(e,t,r)})),(t===this.transport||r>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Yu)}))}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 r=new class{constructor(e,t,r){this.state=zu,this.topic=e,this.params=Fu(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Xu(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Zu((()=>{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=qu,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Vu,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=zu,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=Vu,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 Xu(this,Qu,Fu({}),this.timeout).send(),this.state=Vu,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(Ju,((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(Ku,e)}onError(e){return this.on(Yu,(t=>e(t)))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter((r=>!(r.event===e&&(void 0===t||t===r.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=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 n=new Xu(this,e,(function(){return t}),r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Gu;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ku,"leave")},r=new Xu(this,Qu,Fu({}),e);return r.receive("ok",(()=>t())).receive("timeout",(()=>t())),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}isMember(e,t,r,n){return!(this.topic!==e||n&&n!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Wu,this.joinPush.resend(e))}trigger(e,t,r,n){let o=this.onMessage(e,t,r,n);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,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===zu}isErrored(){return this.state===Vu}isJoined(){return this.state===qu}isJoining(){return this.state===Wu}isLeaving(){return this.state===Gu}}(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:o,join_ref:i}=e;this.log("push",`${t} ${r} (${i}, ${o})`,n)}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.heartbeatTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}abnormalClose(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,e)}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:r,payload:n,ref:o,join_ref:i}=e;o&&o===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${t} ${r} ${o&&"("+o+")"||""}`,n);for(let e=0;e<this.channels.length;e++){const s=this.channels[e];s.isMember(t,r,n,i)&&s.trigger(r,n,o,i)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,r]=this.stateChangeCallbacks.message[t];r(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())}}(e,{params:ap(ap({},t),{},{v:ie})}),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName})}disconnect(){return new Promise((e=>{this.socket.disconnect(e)}))}listenTo(e,t=null){this.channel.on(e,(r=>{lp("[RECEIVE]",e,r),this.emit({type:e,payload:t?t(e,r):r})}))}emit(e){this.listener&&this.listener.next(e)}push(e,t,r){this.channel.push(e,t,r)}}class pp{constructor(e){this.name=e}emit(e){this.listener&&this.listener.next(e)}start(e){this.listener=e}stop(){this.listener=null}}function fp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function dp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fp(Object(r),!0).forEach((function(t){hp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yp=Uu()("seamly");function bp(){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 mp{constructor({layoutMode:e,namespace:t,config:r={},context:n={}}){this.store=function(e,t){const r=t(e),n=r.get()||{};return{get:e=>void 0===e?n:n[e],set:(e,t)=>(n[e]=t,r.set(n),t),delete(e){const t=this.get(e);return delete n[e],r.set(n),t}}}(`${t}.connection${n.locale?"."+n.locale:""}`,r.storageProvider||Lu),this.connectionInfo={apiKey:r.key,domain:r.domain||"api.seamly-app.com",secure:!1!==r.secure&&(r.secure||!0)},this.config={sendEnvironment:r.sendEnvironment??!0,context:dp(dp({},n),{},{channelName:n.channelName||"web"})},this.connected=!1,this.configReady=!1,this.externalId=r.externalId,this.layoutMode=e,this.userResponded=!1,this.internalProducer=new pp("API"),this.internal$=Du().create(this.internalProducer).flatten(),this.connection$=this.internal$.filter((e=>"connection"===e.type)),this.connection$.subscribe({next:({connected:e,ready:t})=>{this.connected=e,this.ready=t}}),this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getAccessToken(){return this.store.get("accessToken")}setAccessToken(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}setConversationUrl(e){this.store.set("conversationUrl",e)}hasConversation(){return!!this.getConversationUrl()}getChannelTopic(){return this.store.get("channelTopic")||this.store.get("channelName")}setChannelTopic(e){this.store.set("channelTopic",e)}getLocale=e=>e||this.locale;clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}getUrlPrefix(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}updateUrls({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:r}])=>dp(dp({},e),{},{[t]:r})),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversationProducer&&await this.conversationProducer.disconnect(),this.connected=!1,this.configReady=!1}async createConversation(){try{const e=Ru().post(`${this.getUrlPrefix("http")}${this.URLS.conversations}`).set("Content-Type","application/json").query({v:ie}).withCredentials().send({externalId:this.externalId||void 0}),{body:t}=await e,{conversation:r}=t,n=dp({},r);return delete n.accessToken,delete n.channelTopic,this.setAccessToken(r.accessToken),this.setChannelTopic(r.channelTopic),this.updateUrls(t),this.setConversationUrl(this.URLS.conversation),this.locale=r.translation?.locale,this.userResponded=r.userResponded,n}catch(e){if(e.status>=500)throw new io(e);throw e}}getConfig(){return Ru().post(`${this.getUrlPrefix("http")}/client/${this.connectionInfo.apiKey}/configs`).set("Content-Type","application/json").query({v:ie}).send({context:dp(dp({},this.config.context),{},{environment:!0===this.config.sendEnvironment?this.getEnvironment():this.config.sendEnvironment})}).then((({body:e})=>(this.updateUrls(e),this.configReady=!0,e.config))).catch((e=>{if(404===e.status)throw new so;if(e.status>=500)throw new io(e);throw e}))}async getConversation(){if(!this.hasConversation())return null;try{const{body:e}=await Ru().get(`${this.getUrlPrefix("http")}${this.URLS.history}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:ie});this.updateUrls(e);const{messages:t,participants:r,activeServiceSessionId:n,activeServiceSettings:o,serviceData:i,ui:s,translation:a}=e.history;return{events:t.map((([e,t])=>({type:e,payload:dp(dp({},t),{},{type:"participant"===e?e:t.type})}))),participants:r,activeServiceSessionId:n,activeServiceSettings:o,serviceData:i,resumeConversationPrompt:!!s&&Boolean(s.resumeConversationPrompt),translation:a}}catch(e){if(401===e.status)throw new co(e);if(404===e.status)throw new kr(e);if(e.status>=500)throw new io(e);throw e}}async connect(){this.connected=!1;let e=null;return this.hasConversation()||(e=await this.createConversation()),this.conversationProducer=new up(`${this.getUrlPrefix("ws")}${this.URLS.socket}`,this.config.context.channelName,this.getChannelTopic(),this.getAccessToken()),this.internalProducer.emit(Du().create(this.conversationProducer)),this.config.sendEnvironment&&this.send("context",{environment:!0===this.config.sendEnvironment?this.getEnvironment():this.config.sendEnvironment},!1),e}uploadFile(e,t,r,n){const o=new FormData;o.append("upload",e);const i=Ru().post(`${this.getUrlPrefix("http")}${this.URLS.uploads}`).set("Authorization",`Bearer ${this.getAccessToken()}`).send(o);return i.on("progress",(function(e){const{direction:r,percent:n}=e;"upload"===r&&"function"==typeof t&&t(n)})),i.then((e=>{r&&r(e)})).catch((e=>{if(!n)throw e;n(e.response)})),i}getConversationIntitialState(){return Ru().get(`${this.getUrlPrefix("http")}${this.getConversationUrl()}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:ie}).then((({body:e})=>{return this.updateUrls(e),this.userResponded=e.conversation.userResponded,t=e.conversation,r=["accessToken","channelTopic"],Object.keys(t).reduce(((e,n)=>(r.includes(n)||(e[n]=t[n]),e)),{});var t,r})).catch((e=>{if(401===e.status)throw new co(e);if(404===e.status)throw new kr(e);if(e.status>=500)throw new io(e);throw e}))}async getTranslations(e){try{const t=`${this.getUrlPrefix("http")}${this.URLS.translations}`.replace("{version}",String(1)).replace("{locale}",this.getLocale(e)),r=Ru().get(t),{body:n}=await r;return n.translations}catch(e){if(e.status>=500)throw new io(e);throw e}}send(e,t,r=!0){!this.connected||r&&!this.ready?this.connection$.filter((e=>r?e.connected&&e.ready:e.connected)).take(1).subscribe({next:()=>this.send(e,t,r)}):(yp("[SEND]",e,t),this.conversationProducer.push(e,function(e,t){if("message"!==e)return t;const{type:r,body:n}=t;let{transactionId:o}=t;return o||(o=s()),{type:r,body:n,transactionId:o}}(e,t),1e4))}sendContext(e={}){const{locale:t,variables:r}=e,n={};if(t){if("string"!=typeof t)throw new Error("Locale must be a string");n.locale=t}if(r){if("object"!=typeof r)throw new Error("Variables must be an object");n.variables=r}0===Object.keys(n).length&&n.constructor===Object||this.send("context",n,!1)}stream(){return this.internal$.filter((e=>"connection"!==e.type))}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.layoutMode,clientVersion:"20.5.0",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:bp(),userAgent:navigator.userAgent}}}function gp(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var vp=gp();vp.withExtraArgument=gp;const Op=vp;function jp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jp(Object(r),!0).forEach((function(t){_p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ep({api:e}){return()=>t=>r=>{const n=t(r);switch(r.type){case He.SET_USER_SELECTED_OPTIONS:e.store.set("options",r.options);break;case He.SET_USER_SELECTED_OPTION:e.store.set("options",wp(wp({},e.store.get("options")||{}),{},{[r.option]:r.value}))}return n}}const xp={events:[],initialState:{},unreadEvents:0,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:s(),optionsButtonId:s(),headerCollapseButtonId:s(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],entryMeta:{default:Se,active:Se,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{}},seamlyContainerElement:null};function Sp(e=xp,t){return t.type===String(Hr.pending)?xp:((e,t)=>{switch(t.type){case ze:const{type:r,payload:n}=t.event,o=e.options.features.hasOwnProperty(Be),i=Nt(e.entryMeta,n);let s=we({},e.options);if(o&&(r===Ee.message||r===Ee.participant)&&!n.fromClient){const{type:e}=n.entry||{};s=we(we({},s),{},{features:we(we({},s.features),{},{uploads:we(we({},s.features.uploads),{},{enabledFromEntry:e===Te})})})}const a=Pt(t.event);return e.events.find((e=>e.payload.id===n.id))?e:we(we({},e),{},{entryMeta:o||i.active!==Te?i:we({},e.entryMeta),options:s,unreadEvents:a?e.unreadEvents+1:e.unreadEvents,events:[...e.events,we(we({},t.event),{},{payload:we(we({},a&&{messageStatus:n.fromClient?Ce:Pe}),n)})]});case Ke:if(!t.event.payload.transactionId)return console.warn("ACK received without transaction ID."),e;const c=e.events.find((e=>e.payload.transactionId===t.event.payload.transactionId)),{id:l,occurredAt:u}=t.event.payload;return c?we(we({},e),{},{events:Ct(e.events.map((e=>e.payload.id===c.payload.id?we(we({},e),{},{payload:we(we({},e.payload),{},{id:l,occurredAt:u})}):e)))}):e;case Ve:return we(we({},e),{},{unreadEvents:0,loadedImageEventIds:[],events:[]});case We:return we(we({},e),{},{unreadEvents:0,events:e.events.map((e=>-1!==t.ids.indexOf(e.payload.id)?we(we({},e),{},{payload:we(we({},e.payload),e.payload.messageStatus===Pe&&{messageStatus:Ce})}):e))});case Ge:return we(we({},e),{},{loadedImageEventIds:[...e.loadedImageEventIds,t.eventId]});case qe:const{events:p,participants:f,activeServiceSessionId:d,activeServiceSettings:h={},serviceData:y,resumeConversationPrompt:b}=t.history,m=((e,t)=>{const r=e.filter((e=>!t.some((t=>t.payload.id===e.payload.id)))),n=t.filter((e=>!("participant"===e.type&&!e.payload.participant.introduction))).reverse();return Ct([...n,...r])})(e.events,p),g=we(we({},e.participantInfo.participants),f),v=m.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let O=null;v&&("message"===v.type&&(O=v.payload.participant),"participant"===v.type&&(O=v.payload.participant.id));const{entry:j,uploads:w}=h,_=Nt(we(we(we({},e.entryMeta),j),{},{active:j.default||xe,options:we({},j&&j.options?j.options:{})}),m[m.length-1].payload);let E=we({},e.options.features);const x=E.hasOwnProperty(Be);if(x){const{payload:e}=v,{type:t}=e.entry||{};E=we(we({},E),{},{uploads:{enabled:!(!w||!w.enabled),enabledFromEntry:t===Te}})}const S=we(we({},e),{},{unreadEvents:m.filter((e=>"message"===e.type&&e.payload.messageStatus===Pe)).length,events:m.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),participantInfo:we(we(we({},e.participantInfo),O?At(e.participantInfo,{type:Qe,participant:g[O]}):{}),{},{participants:g}),historyLoaded:!0,serviceInfo:we(we({},e.serviceInfo),{},{activeServiceSessionId:d}),serviceData:y||{},options:we(we({},e.options),{},{features:E}),entryMeta:x||_.active!==Te?_:we({},e.entryMeta),resumeConversationPrompt:b||!1});return O&&(S.headerTitles=It(e.headerTitles,{type:Ze,title:g[O].name})),S;case et:return we(we({},e),{},{historyLoaded:!1});case Ye:return we(we({},e),{},{isLoading:t.isLoading});case rt:const{delaySeconds:T,delayTime:P}=t;return we(we({},e),{},{idleDetachCountdown:{hasCountdown:!0,isActive:!0,wasStopped:!1,count:T,remaining:T,timer:P}});case nt:const{idleDetachCountdown:C}=e,{remaining:A}=C,I=A-1;return we(we({},e),{},{idleDetachCountdown:we(we({},e.idleDetachCountdown),{},{remaining:I,timer:fe(I)})});case ot:return we(we({},e),{},{idleDetachCountdown:we(we({},e.idleDetachCountdown),{},{isActive:!1,wasStopped:!0})});case it:return we(we({},e),{},{idleDetachCountdown:{hasCountdown:!1,isActive:!1}});case st:return we(we({},e),{},{resumeConversationPrompt:!0});case at:return we(we({},e),{},{resumeConversationPrompt:!1});case Qe:case Je:return we(we({},e),{},{participantInfo:At(e.participantInfo,t)});case tt:return e.serviceInfo.activeServiceSessionId!==t.activeServiceSessionId?we(we({},e),{},{serviceInfo:we(we({},e.serviceInfo),{},{activeServiceSessionId:t.activeServiceSessionId})}):e;case Xe:case Ze:return we(we({},e),{},{headerTitles:It(e.headerTitles,t)});case ft:const{initialState:N}=t;return we(we({},e),{},{initialState:N,unreadEvents:N.unreadMessageCount});case ct:return we(we({},e),{},{serviceData:we(we({},e.serviceData),{},{[t.payload.type]:t.payload})});case lt:return we(we({},e),{},{options:we(we({},e.options),{},{features:t.features})});case ut:return e.options.features.hasOwnProperty(t.key)?we(we({},e),{},{options:we(we({},e.options),{},{features:we(we({},e.options.features),{},{[t.key]:we(we({},e.options.features[t.key]||{}),{},{enabled:t.enabled})})})}):e;case pt:return we(we({},e),{},{options:we(we({},e.options),{},{features:{}})});case yt:return we(we({},e),{},{options:we(we({},e.options),{},{panelActive:!0,optionActive:t.optionName})});case bt:return we(we({},e),{},{options:we(we({},e.options),{},{panelActive:!1,optionActive:""})});case ht:return we(we({},e),{},{options:we(we({},e.options),{},{userSelectedOptions:t.options})});case dt:const{option:D,value:k}=t;return we(we({},e),{},{options:we(we({},e.options),{},{userSelectedOptions:we(we({},e.options.userSelectedOptions),{},{[D]:k})})});case mt:const{value:R}=t;return we(we({},e),{},{entryMeta:we(we({},e.entryMeta),{},{blockAutoEntrySwitch:R})});case Ot:const{entryMeta:L}=t;return we(we({},e),{},{entryMeta:we(we(we({},e.entryMeta),L),{},{active:L.default,options:we({},L.options||{}),overrideOptions:{}})});case vt:const{entryType:M}=t;return we(we({},e),{},{entryMeta:we(we({},e.entryMeta),{},{active:M})});case gt:const{entryType:U}=t;return we(we({},e),{},{entryMeta:we(we({},e.entryMeta),{},{userSelected:U})});case jt:return we(we({},e),{},{currentUploads:[...e.currentUploads,{id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle}]});case wt:return we(we({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?we(we({},e),{},{progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}):e))});case Et:return we(we({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?we(we({},e),{},{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))});case _t:return we(we({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?we(we({},e),{},{complete:!0}):e))});case xt:return we(we({},e),{},{currentUploads:e.currentUploads.filter((e=>e.id!==t.fileId))});case St:return we(we({},e),{},{currentUploads:[]});case Tt:return we(we({},e),{},{seamlyContainerElement:t.element});default:return e}})(e,t)}const Tp=["namespace","parentElement","showFaq"],Pp=["view"];function Cp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ap(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cp(Object(r),!0).forEach((function(t){Ip(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ip(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Np(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}class Dp{constructor(e,t){const{namespace:r="",parentElement:n,showFaq:i}=e,s=Np(e,Tp);this.config=Ap(Ap({},s),{},{namespace:r,showFaq:!1!==i}),this.namespace=r,this.parentElement=n,this.externalApi=t,this.api=new mp({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)))}async render(){const t=this.config.customComponents||{},{view:r}=t,n=Np(t,Pp),o=Ap(Ap({},this.config),{},{customComponents:Object.keys(n).length?n:void 0}),i=function({initialState:e,api:t,eventBus:r,config:n}={}){const o=Q({reducers:{state:Sp,[String(si)]:si,[String(Jr)]:Jr,[String(as)]:as,[String(vi)]:vi,[String(Nn)]:Nn,[String(mo)]:mo,[String(xo)]:xo},initialState:e,middlewares:[Ql({api:t}),Op.withExtraArgument({api:t,eventBus:r,config:n}),uo({api:t}),Ep({api:t}),({dispatch:e,getState:t})=>r=>n=>{const o=r(n);switch(n.type){case String(He.SET_HISTORY):n.history?.translation?.enabled&&e(Wt(n.history.translation.locale));break;case String(He.SET_INITIAL_STATE):n.initialState?.translation?.enabled&&(e(Wt(n.initialState.translation.locale)),e($t(n.locale)));break;case String(He.ADD_EVENT):"info"===n.event.type&&"new_translation"===n.event?.payload?.body?.subtype&&n.event.payload.body.translationEnabled&&e($t(n.event.payload.body.translationLocale));break;case String(Gt):const r=Ut(t());e($t(r))}return o}]});return o}({api:this.api,eventBus:this.eventBus,config:o});await i.dispatch(Hr()),r?(0,e.render)((0,U.jsx)(Tu,{config:o,eventBus:this.eventBus,store:i,api:this.api,children:(0,U.jsx)(r,{})}),this.parentElement):(0,e.render)((0,U.jsx)(Iu,{config:o,eventBus:this.eventBus,store:i,api:this.api}),this.parentElement)}destroy(){(0,e.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 r=this.functions[e];r&&r.length&&(this.functions[e]=r.filter((e=>e!==t)))}execFunction(e,...t){const r=this.functions[e];return!(!r||!r.length||(r.forEach((r=>{try{r(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}function kp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Rp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kp(Object(r),!0).forEach((function(t){Lp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Lp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Mp=e=>"object"==typeof e&&"action"in e,Up=e=>Rp(Rp({},e),{},{args:Array.isArray(e.args)?e.args:[e.args]}),Fp=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(Mp).map(Up)).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)}}))}setContext(e,t){switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:r,locale:n}=t;return r&&n&&(this.context.translationLocale=n),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables=Rp({},t)),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),r=this.getCombinedConfig(t),{parentElement:n,namespace:o}=r||t;if(o?Object.values(this._instances).forEach((e=>{e.parentElement!==n&&e.namespace!==o||this.destroy(e)})):this.destroy(),r){const e=this.createInstance(r);this._instances[r.namespace]=e,this.context={},e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:r,args:n}=e,o=Object.values(this._instances);return!r&&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=>(!r||e.namespace===r)&&e.execFunction(t,...n))).some(Boolean)}createInstance(e){return new Dp(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=Rp(Rp({},e.context||this.appConfig.context),this.context),r=this.getMergedVariables(e);Object.keys(r).length>0&&(t.variables=r);const n=Rp(Rp({},this.appConfig.defaults),e.defaults),o=Rp(Rp(Rp({},this.appConfig),e),{},{api:Rp(Rp({},this.appConfig.api),e.api),context:Object.keys(t).length?t:void 0,defaults:Object.keys(n).length?n:void 0});return"function"==typeof this.appConfig?this.appConfig(o):o}getMergedVariables(e){return Rp(Rp(Rp({},this.appConfig.context?.variables||{}),e.context?.variables||{}),this.context.variables||{})}},Bp=()=>{const{t:e}=Tn(),{title:t,subTitle:r}=lr(),n=ur(),{isOpen:o}=vo(),i=dr(),{hasInterrupt:s}=oo(),a=ne(),c=i?.avatar??a,l=s?"":r,u=["message-count"];return o&&u.push("message-count__hide"),0===n&&u.push("message-count__empty"),(l||!o)&&(0,U.jsxs)("div",{className:Xr("agent-info"),children:[(0,U.jsxs)("div",{className:Xr("agent-info__graphic"),children:[c?(0,U.jsx)("img",{className:Xr(i?.avatar?"avatar":"icon"),src:c,alt:""}):(0,U.jsx)(ji,{name:"avatar",size:"32"}),(0,U.jsx)("span",{className:Xr(u),"aria-hidden":"true",children:n})]}),(0,U.jsxs)("div",{className:Xr("agent-info__body"),children:[(0,U.jsx)("p",{className:Xr("agent-info__heading"),children:t??e("header.title")}),(0,U.jsx)("p",{className:Xr("agent-info__text"),children:l})]})]})},Hp=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:r}=ir(),n=(0,i.useRef)(null),{t:o}=Tn();return(0,U.jsxs)("header",{className:Xr("chat__header"),children:[e,(0,U.jsx)("div",{className:Xr("header-controls"),children:(0,U.jsx)("button",{type:"button",className:Xr("button","header-controls__collapse"),onClick:t,ref:n,id:r,children:(0,U.jsx)(ji,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},$p=({onOpenChat:e})=>{const{t}=Tn(),r=So(),{isOpen:n}=vo(),o=(0,i.useRef)(null),s=(0,i.useRef)(null),a=(0,i.useRef)(),c=Mn(),l=(()=>{const e=(0,i.useRef)(null),[t]=Rn();return e.current=t,(0,i.useCallback)((t=>{Oe(e.current,(()=>{kn(t)}))}),[])})(),u=dr(),p=lr().subTitle,{hasInterrupt:f}=oo(),{headerCollapseButtonId:d}=ir(),h=u&&!f;return(0,i.useLayoutEffect)((()=>{!1===n&&!0===o.current&&l(s.current),o.current=n}),[n,l]),(0,U.jsxs)("div",{className:Xr("toggle-button"),children:[(0,U.jsxs)("div",{id:r,children:[(0,U.jsx)("p",{className:Xr("toggle-button__title"),children:t(h?"toggleButton.resumeTitle":"toggleButton.title")}),(0,U.jsx)("p",{className:Xr("toggle-button__subtitle"),children:h?p:t("toggleButton.subtitle")})]}),(0,U.jsx)("button",{type:"button","aria-labelledby":r,className:Xr("toggle-button__button"),ref:s,onMouseUp:()=>{a.current="mouse"},onKeyUp:()=>{a.current="key"},onClick:()=>{e(),"mouse"===a.current?c():"key"===a.current&&l(d)}})]})},zp=["categories"];function Vp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vp(Object(r),!0).forEach((function(t){Wp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Wp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Gp=()=>{const{t:e}=Tn(),{sendAction:t,addMessageBubble:r}=Do(),n=So(),o=Mn(),{sendPolite:s}=Ro(),{hasInterrupt:a}=oo(),{hasCountdown:c,endCountdown:l}=Zo(),{hasPrompt:u,continueChat:p}=ti(),f=hr("suggestion"),[d]=fi({payload:f}),h=(0,i.useMemo)((()=>(f&&!a?d:[]).map((e=>{let{categories:t=[]}=e;return qp(qp({},function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,zp)),{},{categories:t,classNames:["faqs__item",...t.map((e=>`faqs__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`))]})}))),[f,a,d]),y=(0,i.useRef)(null),b=(0,i.useRef)(!1),{isInline:m}=yr(),g=go(),v=!m&&g,O=(0,i.useRef)(v),j=!!h.length,w=j&&!v,_=(0,i.useRef)([]),E=j?h:_.current;_.current=E;const x=(0,i.useRef)(null);(0,i.useEffect)((()=>{if(y.current!==h&&!v){if(j){const t=b.current?e("faq.srUpdatedText"):e("faq.srAvailableText");setTimeout((()=>{s(t)}),30)}else b.current&&s(e("faq.srUnavailableText"));y.current=h}!O.current&&v?(Oe(x.current,o),s(e("faq.srUnavailableText"))):!j&&b.current&&Oe(x.current,o),b.current=j,O.current=v}),[j,h,v,o,s,e]);const S=e("faq.headingText"),T=S?"section":"div";return(0,U.jsx)(Ti,{isActive:w,transitionStartState:Ei,children:(0,U.jsxs)(T,{className:Xr("faqs"),"aria-labelledby":S?n:null,ref:x,children:[S&&(0,U.jsx)("h2",{id:n,className:Xr("faqs__heading"),children:S}),!!E.length&&(0,U.jsx)("ul",{className:Xr("faqs__list"),children:E.map((e=>(0,U.jsx)("li",{className:Xr(e.classNames),children:(0,U.jsxs)("button",{type:"button",onClick:()=>{(({id:e,question:n})=>{c&&l(!0),u&&p(),t({type:Ae,originMessage:f.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:n}}}),r(n),o()})(e)},className:Xr("button","button--secondary"),children:[(0,U.jsx)(ji,{name:"chevronRight",size:"8"}),e.question]})},e.id.toString())))})]})})},Kp=({children:e})=>{const[,t]=Rn(),{isOpen:r,isVisible:n,setVisibility:o}=vo(),{zIndex:s,showFaq:a,layoutMode:c}=re(),{isInline:l}=yr(),u=an(),p=go(),{locale:f}=Tn(),d=(0,i.useCallback)((e=>{t(e)}),[t]),h=(0,i.useMemo)((()=>{if(f&&document.querySelector("html").getAttribute("lang")!==f)return f}),[f]),y=["app","app--deprecated",...u];return r||"window"!==c||y.push("app--collapsed"),p&&y.push("app--user-responded"),y.push(`app--layout-${c}`),n&&(0,U.jsxs)("section",{className:Xr(y),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&r&&o(C.minimized)},lang:h,tabIndex:"-1",ref:d,style:{zIndex:s},"data-nosnippet":!0,children:[(0,U.jsx)("div",{className:Xr("app-wrapper"),children:e}),a&&(0,U.jsx)(Gp,{})]})},Yp=()=>{const{isVisible:e}=vo(),{openChat:t,closeChat:r}=qo(),{showInlineView:n,containerRef:o}=Oo();return e&&(0,U.jsx)("div",{ref:o,children:n&&(0,U.jsxs)(Kp,{children:[(0,U.jsx)($p,{onOpenChat:t}),(0,U.jsx)(Hp,{onCloseChat:r,children:(0,U.jsx)(Bp,{})}),(0,U.jsxs)(Fl,{interruptComponent:Gs,children:[(0,U.jsx)(ol,{}),(0,U.jsx)(Al,{})]})]})})},Jp=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:[],r=new Fp(e);window.seamly={push:r.push.bind(r)},r.push(...t)}})(),module.exports=n})();
|
|
2
|
+
(()=>{var e={574:e=>{"use strict";function t(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n(){this._defaults=[]}for(var o=function(){var e=s[i];n.prototype[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return this._defaults.push({fn:e,args:r}),this}},i=0,s=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];i<s.length;i++)o();n.prototype._setDefaults=function(e){var n,o,i=function(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=t(e))){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}(this._defaults);try{for(i.s();!(n=i.n()).done;){var s=n.value;e[s.fn].apply(e,function(e){if(Array.isArray(e))return r(e)}(o=s.args)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||t(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}catch(e){i.e(e)}finally{i.f()}},e.exports=n},766:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var i;"undefined"!=typeof window?i=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),i=void 0):i=self;var s=r(767),a=r(445),c=r(501),l=r(842),u=r(244),p=u.isObject,f=u.mixin,d=u.hasOwn,h=r(253),y=r(574);function b(){}e.exports=function(e,r){return"function"==typeof r?new t.Request("GET",e).end(r):1===arguments.length?new t.Request("GET",e):new t.Request(e,r)};var m=t=e.exports;t.Request=E,m.getXHR=function(){if(i.XMLHttpRequest&&(!i.location||"file:"!==i.location.protocol))return new XMLHttpRequest;throw new Error("Browser-only version of superagent could not find XHR")};var g="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function v(e){if(!p(e))return e;var t=[];for(var r in e)d(e,r)&&O(t,r,e[r]);return t.join("&")}function O(e,t,r){if(void 0!==r)if(null!==r)if(Array.isArray(r)){var n,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}(r);try{for(i.s();!(n=i.n()).done;)O(e,t,n.value)}catch(e){i.e(e)}finally{i.f()}}else if(p(r))for(var s in r)d(r,s)&&O(e,"".concat(t,"[").concat(s,"]"),r[s]);else e.push(encodeURI(t)+"="+encodeURIComponent(r));else e.push(encodeURI(t))}function j(e){for(var t,r,n={},o=e.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(t=o[i]).indexOf("="))?n[decodeURIComponent(t)]="":n[decodeURIComponent(t.slice(0,r))]=decodeURIComponent(t.slice(r+1));return n}function w(e){return/[/+]json($|[^-\w])/i.test(e)}function _(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){for(var t,r,n,o,i=e.split(/\r?\n/),s={},a=0,c=i.length;a<c;++a)-1!==(t=(r=i[a]).indexOf(":"))&&(n=r.slice(0,t).toLowerCase(),o=g(r.slice(t+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function E(e,t){var r=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,n=null;try{n=new _(r)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,r.xhr?(t.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,t.status=r.xhr.status?r.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),r.callback(t)}r.emit("response",n);try{r._isResponseOK(n)||(e=new Error(n.statusText||n.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=n,e.status=e.status||n.status,r.callback(e,n)):r.callback(null,n)}))}m.serializeObject=v,m.parseString=j,m.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},m.serialize={"application/x-www-form-urlencoded":c.stringify,"application/json":a},m.parse={"application/x-www-form-urlencoded":j,"application/json":JSON.parse},f(_.prototype,h.prototype),_.prototype._parseBody=function(e){var t=m.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&w(this.type)&&(t=m.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},_.prototype.toError=function(){var e=this.req,t=e.method,r=e.url,n="cannot ".concat(t," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=t,o.url=r,o},m.Response=_,s(E.prototype),f(E.prototype,l.prototype),E.prototype.type=function(e){return this.set("Content-Type",m.types[e]||e),this},E.prototype.accept=function(e){return this.set("Accept",m.types[e]||e),this},E.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===n(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=r.encoder?r.encoder:function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,o)},E.prototype.query=function(e){return"string"!=typeof e&&(e=v(e)),e&&this._query.push(e),this},E.prototype.attach=function(e,t,r){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,r||t.name)}return this},E.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},E.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var r=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),r(e,t)},E.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},E.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},E.prototype.ca=E.prototype.agent,E.prototype.buffer=E.prototype.ca,E.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},E.prototype.pipe=E.prototype.write,E.prototype._isHost=function(e){return e&&"object"===n(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},E.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||b,this._finalizeQueryString(),this._end()},E.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},E.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=m.getXHR();var t=this.xhr,r=this._formData||this._data;this._setTimeouts(),t.addEventListener("readystatechange",(function(){var r=t.readyState;if(r>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}}));var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(e._uploadTimeoutTimer)),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.addEventListener("progress",n.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",n.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||m.serialize[o?o.split(";")[0]:""];!i&&w(o)&&(i=m.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&d(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===r?null:r)},m.agent=function(){return new y};for(var x=function(){var e=T[S];y.prototype[e.toLowerCase()]=function(t,r){var n=new m.Request(e,t);return this._setDefaults(n),r&&n.end(r),n}},S=0,T=["GET","POST","OPTIONS","PATCH","PUT","DELETE"];S<T.length;S++)x();function P(e,t,r){var n=m("DELETE",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}y.prototype.del=y.prototype.delete,m.get=function(e,t,r){var n=m("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},m.head=function(e,t,r){var n=m("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},m.options=function(e,t,r){var n=m("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},m.del=P,m.delete=P,m.patch=function(e,t,r){var n=m("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},m.post=function(e,t,r){var n=m("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},m.put=function(e,t,r){var n=m("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},842:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var o=r(695),i=r(244),s=i.isObject,a=i.hasOwn;function c(){}e.exports=c,c.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},c.prototype.parse=function(e){return this._parser=e,this},c.prototype.responseType=function(e){return this._responseType=e,this},c.prototype.serialize=function(e){return this._serializer=e,this},c.prototype.timeout=function(e){if(!e||"object"!==n(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(a(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},c.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var l=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),u=new Set([408,413,429,500,502,503,504,521,522,524]);c.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(e,t);if(!0===r)return!0;if(!1===r)return!1}catch(e){console.error(e)}if(t&&t.status&&u.has(t.status))return!0;if(e){if(e.code&&l.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},c.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},c.prototype.then=function(e,t){var r=this;if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){n.on("abort",(function(){if(!(r._maxRetries&&r._maxRetries>r._retries))if(r.timedout&&r.timedoutError)t(r.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=r.status,e.method=r.method,e.url=r.url,t(e)}})),n.end((function(r,n){r?t(r):e(n)}))}))}return this._fullfilledPromise.then(e,t)},c.prototype.catch=function(e){return this.then(void 0,e)},c.prototype.use=function(e){return e(this),this},c.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},c.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},c.prototype.get=function(e){return this._header[e.toLowerCase()]},c.prototype.getHeader=c.prototype.get,c.prototype.set=function(e,t){if(s(e)){for(var r in e)a(e,r)&&this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},c.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},c.prototype.field=function(e,t,r){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(s(e)){for(var n in e)a(e,n)&&this.field(n,e[n]);return this}if(Array.isArray(t)){for(var o in t)a(t,o)&&this.field(e,t[o]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),r?this._getFormData().append(e,t,r):this._getFormData().append(e,t),this},c.prototype.abort=function(){if(this._aborted)return this;if(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req){if(o.gte(process.version,"v13.0.0")&&o.lt(process.version,"v14.0.0"))throw new Error("Superagent does not work in v13 properly with abort() due to Node.js core changes");o.gte(process.version,"v14.0.0")&&(this.req.destroyed=!0),this.req.abort()}return this.clearTimeout(),this.emit("abort"),this},c.prototype._auth=function(e,t,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},c.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},c.prototype.redirects=function(e){return this._maxRedirects=e,this},c.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},c.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},c.prototype.send=function(e){var t=s(e),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&s(this._data))for(var n in e)a(e,n)&&(this._data[n]=e[n]);else"string"==typeof e?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||r||this.type("json"),this},c.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},c.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.slice(t+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.slice(0,t)+"?"+r.join("&")}}},c.prototype._appendQueryString=function(){console.warn("Unsupported")},c.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error("".concat(e+t,"ms exceeded"));n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.timedoutError=n,this.abort(),this.callback(n)}},c.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},253:(e,t,r)=>{"use strict";var n=r(244);function o(){}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=n.type(t);var r=n.params(t);for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(this[o]=r[o]);this.links={};try{e.link&&(this.links=n.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){var t=Math.trunc(e/100);this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},244:(e,t)=>{"use strict";function r(e){return r="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},r(e)}function n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){var t,r={},o=n(e.split(/ *; */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *= */),s=i.shift(),a=i.shift();s&&a&&(r[s]=a)}}catch(e){o.e(e)}finally{o.f()}return r},t.parseLinks=function(e){var t,r={},o=n(e.split(/ *, */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *; */),s=i[0].slice(1,-1);r[i[1].split(/ *= */)[1].slice(1,-1)]=s}}catch(e){o.e(e)}finally{o.f()}return r},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e},t.isObject=function(e){return null!==e&&"object"===r(e)},t.hasOwn=Object.hasOwn||function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(new Object(e),t)},t.mixin=function(e,r){for(var n in r)t.hasOwn(r,n)&&(e[n]=r[n])}},718:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC3986";e.exports={default:n,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:n}},501:(e,t,r)=>{"use strict";var n=r(383),o=r(409),i=r(718);e.exports={formats:i,parse:o,stringify:n}},409:(e,t,r)=>{"use strict";var n=r(753),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},l=function(e,t,r,n){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(i),l=a?i.slice(0,a.index):i,u=[];if(l){if(!r.plainObjects&&o.call(Object.prototype,l)&&!r.allowPrototypes)return;u.push(l)}for(var p=0;r.depth>0&&null!==(a=s.exec(i))&&p<r.depth;){if(p+=1,!r.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(a[1])}return a&&u.push("["+i.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:c(t,r),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&r.parseArrays)s=[].concat(o);else{s=r.plainObjects?Object.create(null):{};var l="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=parseInt(l,10);r.parseArrays||""!==l?!isNaN(u)&&a!==l&&String(u)===l&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(s=[])[u]=o:"__proto__"!==l&&(s[l]=o):s={0:o}}o=s}return o}(u,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var r,l={},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,f=u.split(t.delimiter,p),d=-1,h=t.charset;if(t.charsetSentinel)for(r=0;r<f.length;++r)0===f[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===f[r]?h="utf-8":"utf8=%26%2310003%3B"===f[r]&&(h="iso-8859-1"),d=r,r=f.length);for(r=0;r<f.length;++r)if(r!==d){var y,b,m=f[r],g=m.indexOf("]="),v=-1===g?m.indexOf("="):g+1;-1===v?(y=t.decoder(m,s.decoder,h,"key"),b=t.strictNullHandling?null:""):(y=t.decoder(m.slice(0,v),s.decoder,h,"key"),b=n.maybeMap(c(m.slice(v+1),t),(function(e){return t.decoder(e,s.decoder,h,"value")}))),b&&t.interpretNumericEntities&&"iso-8859-1"===h&&(b=a(b)),m.indexOf("[]=")>-1&&(b=i(b)?[b]:b),o.call(l,y)?l[y]=n.combine(l[y],b):l[y]=b}return l}(e,r):e,p=r.plainObjects?Object.create(null):{},f=Object.keys(u),d=0;d<f.length;++d){var h=f[d],y=l(h,u[h],r,"string"==typeof e);p=n.merge(p,y,r)}return!0===r.allowSparse?p:n.compact(p)}},383:(e,t,r)=>{"use strict";var n=r(478),o=r(753),i=r(718),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,l=String.prototype.split,u=Array.prototype.push,p=function(e,t){u.apply(e,c(t)?t:[t])},f=Date.prototype.toISOString,d=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return f.call(e)},skipNulls:!1,strictNullHandling:!1},y={},b=function e(t,r,i,s,a,u,f,d,b,m,g,v,O,j,w){for(var _,E=t,x=w,S=0,T=!1;void 0!==(x=x.get(y))&&!T;){var P=x.get(t);if(S+=1,void 0!==P){if(P===S)throw new RangeError("Cyclic object value");T=!0}void 0===x.get(y)&&(S=0)}if("function"==typeof f?E=f(r,E):E instanceof Date?E=m(E):"comma"===i&&c(E)&&(E=o.maybeMap(E,(function(e){return e instanceof Date?m(e):e}))),null===E){if(s)return u&&!O?u(r,h.encoder,j,"key",g):r;E=""}if("string"==typeof(_=E)||"number"==typeof _||"boolean"==typeof _||"symbol"==typeof _||"bigint"==typeof _||o.isBuffer(E)){if(u){var C=O?r:u(r,h.encoder,j,"key",g);if("comma"===i&&O){for(var A=l.call(String(E),","),I="",N=0;N<A.length;++N)I+=(0===N?"":",")+v(u(A[N],h.encoder,j,"value",g));return[v(C)+(c(E)&&1===A.length?"[]":"")+"="+I]}return[v(C)+"="+v(u(E,h.encoder,j,"value",g))]}return[v(r)+"="+v(String(E))]}var D,k=[];if(void 0===E)return k;if("comma"===i&&c(E))D=[{value:E.length>0?E.join(",")||null:void 0}];else if(c(f))D=f;else{var R=Object.keys(E);D=d?R.sort(d):R}for(var L="comma"===i&&c(E)&&1===E.length?r+"[]":r,M=0;M<D.length;++M){var U=D[M],F="object"==typeof U&&void 0!==U.value?U.value:E[U];if(!a||null!==F){var B=c(E)?"function"==typeof i?i(L,U):L:L+(b?"."+U:"["+U+"]");w.set(t,S);var H=n();H.set(y,w),p(k,e(F,B,i,s,a,u,f,d,b,m,g,v,O,j,H))}}return k};e.exports=function(e,t){var r,o=e,l=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=i.formatters[r],o=h.filter;return("function"==typeof e.filter||c(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof l.filter?o=(0,l.filter)("",o):c(l.filter)&&(r=l.filter);var u,f=[];if("object"!=typeof o||null===o)return"";u=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var d=a[u];r||(r=Object.keys(o)),l.sort&&r.sort(l.sort);for(var y=n(),m=0;m<r.length;++m){var g=r[m];l.skipNulls&&null===o[g]||p(f,b(o[g],g,d,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,y))}var v=f.join(l.delimiter),O=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?O+="utf8=%26%2310003%3B&":O+="utf8=%E2%9C%93&"),v.length>0?O+v:""}},753:(e,t,r)=>{"use strict";var n=r(718),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var l=a[c],u=s[l];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:s,prop:l}),r.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===r)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",l=0;l<a.length;++l){var u=a.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===n.RFC1738&&(40===u||41===u)?c+=a.charAt(l):u<128?c+=s[u]:u<2048?c+=s[192|u>>6]+s[128|63&u]:u<55296||u>=57344?c+=s[224|u>>12]+s[128|u>>6&63]+s[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&a.charCodeAt(l)),c+=s[240|u>>18]+s[128|u>>12&63]+s[128|u>>6&63]+s[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return i(t)&&!i(r)&&(s=a(t,n)),i(t)&&i(r)?(r.forEach((function(r,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&r&&"object"==typeof r?t[i]=e(s,r,n):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var s=r[i];return o.call(t,i)?t[i]=e(t[i],s,n):t[i]=s,t}),s)}}},905:e=>{e.exports=()=>()=>null},698:e=>{e.exports=null},924:(e,t,r)=>{"use strict";var n=r(210),o=r(559),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},559:(e,t,r)=>{"use strict";var n=r(612),o=r(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||n.call(s,i),c=o("%Object.getOwnPropertyDescriptor%",!0),l=o("%Object.defineProperty%",!0),u=o("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){var t=a(n,s,arguments);if(c&&l){var r=c(t,"length");r.configurable&&l(t,"length",{value:1+u(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(n,i,arguments)};l?l(e.exports,"apply",{value:p}):e.exports.apply=p},767:e=>{function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<n.length;o++)if((r=n[o])===t||r.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}},289:(e,t,r)=>{"use strict";var n=r(215),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,a=Object.defineProperty,c=r(44)(),l=a&&c,u=function(e,t,r,n){var o;(!(t in e)||"function"==typeof(o=n)&&"[object Function]"===i.call(o)&&n())&&(l?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},p=function(e,t){var r=arguments.length>2?arguments[2]:{},i=n(t);o&&(i=s.call(i,Object.getOwnPropertySymbols(t)));for(var a=0;a<i.length;a+=1)u(e,i[a],t[i[a]],r[i[a]])};p.supportsDescriptors=!!l,e.exports=p},445:e=>{e.exports=s,s.default=s,s.stable=u,s.stableStringify=u;var t="[...]",r="[Circular]",n=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,r,s){var a;void 0===s&&(s=i()),c(e,"",0,[],void 0,0,s);try{a=0===o.length?JSON.stringify(e,t,r):JSON.stringify(e,f(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==n.length;){var l=n.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function a(e,t,r,i){var s=Object.getOwnPropertyDescriptor(i,r);void 0!==s.get?s.configurable?(Object.defineProperty(i,r,{value:e}),n.push([i,r,t,s])):o.push([t,r,e]):(i[r]=e,n.push([i,r,t]))}function c(e,n,o,i,s,l,u){var p;if(l+=1,"object"==typeof e&&null!==e){for(p=0;p<i.length;p++)if(i[p]===e)return void a(r,e,n,s);if(void 0!==u.depthLimit&&l>u.depthLimit)return void a(t,e,n,s);if(void 0!==u.edgesLimit&&o+1>u.edgesLimit)return void a(t,e,n,s);if(i.push(e),Array.isArray(e))for(p=0;p<e.length;p++)c(e[p],p,p,i,e,l,u);else{var f=Object.keys(e);for(p=0;p<f.length;p++){var d=f[p];c(e[d],d,p,i,e,l,u)}}i.pop()}}function l(e,t){return e<t?-1:e>t?1:0}function u(e,t,r,s){void 0===s&&(s=i());var a,c=p(e,"",0,[],void 0,0,s)||e;try{a=0===o.length?JSON.stringify(c,t,r):JSON.stringify(c,f(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==n.length;){var l=n.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function p(e,o,i,s,c,u,f){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;d<s.length;d++)if(s[d]===e)return void a(r,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&u>f.depthLimit)return void a(t,e,o,c);if(void 0!==f.edgesLimit&&i+1>f.edgesLimit)return void a(t,e,o,c);if(s.push(e),Array.isArray(e))for(d=0;d<e.length;d++)p(e[d],d,d,s,e,u,f);else{var h={},y=Object.keys(e).sort(l);for(d=0;d<y.length;d++){var b=y[d];p(e[b],b,d,s,e,u,f),h[b]=e[b]}if(void 0===c)return h;n.push([c,o,e]),c[o]=h}s.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(o.length>0)for(var n=0;n<o.length;n++){var i=o[n];if(i[1]===t&&i[0]===r){r=i[2],o.splice(n,1);break}}return e.call(this,t,r)}}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(t+i);for(var s,a=r.call(arguments,1),c=function(){if(this instanceof s){var t=i.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(r.call(arguments)))},l=Math.max(0,i.length-a.length),u=[],p=0;p<l;p++)u.push("$"+p);if(s=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(c),i.prototype){var f=function(){};f.prototype=i.prototype,s.prototype=new f,f.prototype=null}return s}},612:(e,t,r)=>{"use strict";var n=r(648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var l=function(){throw new s},u=c?function(){try{return l}catch(e){try{return c(arguments,"callee").get}catch(e){return l}}}():l,p=r(405)(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},h="undefined"==typeof Uint8Array?n:f(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":p?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?f(""[Symbol.iterator]()):n,"%Symbol%":p?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":u,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},b=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=f(o.prototype))}return y[t]=r,r},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=r(612),v=r(642),O=g.call(Function.call,Array.prototype.concat),j=g.call(Function.apply,Array.prototype.splice),w=g.call(Function.call,String.prototype.replace),_=g.call(Function.call,String.prototype.slice),E=g.call(Function.call,RegExp.prototype.exec),x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,T=function(e){var t=_(e,0,1),r=_(e,-1);if("%"===t&&"%"!==r)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return w(e,x,(function(e,t,r,o){n[n.length]=r?w(o,S,"$1"):t||e})),n},P=function(e,t){var r,n=e;if(v(m,n)&&(n="%"+(r=m[n])[0]+"%"),v(y,n)){var i=y[n];if(i===d&&(i=b(n)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===E(/^%?[^%]*%?$/g,e))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=T(e),n=r.length>0?r[0]:"",i=P("%"+n+"%",t),a=i.name,l=i.value,u=!1,p=i.alias;p&&(n=p[0],j(r,O([0,1],p)));for(var f=1,d=!0;f<r.length;f+=1){var h=r[f],b=_(h,0,1),m=_(h,-1);if(('"'===b||"'"===b||"`"===b||'"'===m||"'"===m||"`"===m)&&b!==m)throw new o("property names with quotes must have matching quotes");if("constructor"!==h&&d||(u=!0),v(y,a="%"+(n+="."+h)+"%"))l=y[a];else if(null!=l){if(!(h in l)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&f+1>=r.length){var g=c(l,h);l=(d=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:l[h]}else d=v(l,h),l=l[h];d&&!u&&(y[a]=l)}}return l}},221:e=>{"use strict";"undefined"!=typeof self?e.exports=self:"undefined"!=typeof window?e.exports=window:e.exports=Function("return this")()},503:(e,t,r)=>{"use strict";var n=r(289),o=r(221),i=r(168),s=r(471),a=i(),c=function(){return a};n(c,{getPolyfill:i,implementation:o,shim:s}),e.exports=c},168:(e,t,r)=>{"use strict";var n=r(221);e.exports=function(){return"object"==typeof r.g&&r.g&&r.g.Math===Math&&r.g.Array===Array?r.g:n}},471:(e,t,r)=>{"use strict";var n=r(289),o=r(168);e.exports=function(){var e=o();if(n.supportsDescriptors){var t=Object.getOwnPropertyDescriptor(e,"globalThis");t&&(!t.configurable||!t.enumerable&&t.writable&&globalThis===e)||Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else"object"==typeof globalThis&&globalThis===e||(e.globalThis=e);return e}},44:(e,t,r)=>{"use strict";var n=r(210)("%Object.defineProperty%",!0),o=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};o.hasArrayLengthDefineBug=function(){if(!o())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=o},405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,r)=>{"use strict";var n=r(612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},679:e=>{e.exports=function(e){var t={},r=[];(e=e||this).on=function(r,n,o){return(t[r]=t[r]||[]).push([n,o]),e},e.off=function(n,o){n||(t={});for(var i=t[n]||r,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(n){for(var o,i=t[n]||r,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],r.slice.call(arguments,1));return e}}},631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=n&&o&&"function"==typeof o.get?o.get:null,s=n&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=a&&c&&"function"==typeof c.get?c.get:null,u=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,f="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,b=Function.prototype.toString,m=String.prototype.match,g=String.prototype.slice,v=String.prototype.replace,O=String.prototype.toUpperCase,j=String.prototype.toLowerCase,w=RegExp.prototype.test,_=Array.prototype.concat,E=Array.prototype.join,x=Array.prototype.slice,S=Math.floor,T="function"==typeof BigInt?BigInt.prototype.valueOf:null,P=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,A="function"==typeof Symbol&&"object"==typeof Symbol.iterator,I="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,D=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function k(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-S(-e):S(e);if(n!==e){var o=String(n),i=g.call(t,o.length+1);return v.call(o,r,"$&_")+"."+v.call(v.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(t,r,"$&_")}var R=r(654),L=R.custom,M=$(L)?L:null;function U(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function F(e){return v.call(String(e),/"/g,""")}function B(e){return!("[object Array]"!==q(e)||I&&"object"==typeof e&&I in e)}function H(e){return!("[object RegExp]"!==q(e)||I&&"object"==typeof e&&I in e)}function $(e){if(A)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!C)return!1;try{return C.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,n,o){var a=r||{};if(V(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!V(a,"customInspect")||a.customInspect;if("boolean"!=typeof c&&"symbol"!==c)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var y=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return G(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var O=String(t);return y?k(t,O):O}if("bigint"==typeof t){var w=String(t)+"n";return y?k(t,w):w}var S=void 0===a.depth?5:a.depth;if(void 0===n&&(n=0),n>=S&&S>0&&"object"==typeof t)return B(t)?"[Array]":"[Object]";var P,L=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=E.call(Array(e.indent+1)," ")}return{base:r,prev:E.call(Array(t+1),r)}}(a,n);if(void 0===o)o=[];else if(W(o,t)>=0)return"[Circular]";function z(t,r,i){if(r&&(o=x.call(o)).push(r),i){var s={depth:a.depth};return V(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,n+1,o)}return e(t,a,n+1,o)}if("function"==typeof t&&!H(t)){var K=function(e){if(e.name)return e.name;var t=m.call(b.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ee=Z(t,z);return"[Function"+(K?": "+K:" (anonymous)")+"]"+(ee.length>0?" { "+E.call(ee,", ")+" }":"")}if($(t)){var te=A?v.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(t);return"object"!=typeof t||A?te:Y(te)}if((P=t)&&"object"==typeof P&&("undefined"!=typeof HTMLElement&&P instanceof HTMLElement||"string"==typeof P.nodeName&&"function"==typeof P.getAttribute)){for(var re="<"+j.call(String(t.nodeName)),ne=t.attributes||[],oe=0;oe<ne.length;oe++)re+=" "+ne[oe].name+"="+U(F(ne[oe].value),"double",a);return re+=">",t.childNodes&&t.childNodes.length&&(re+="..."),re+"</"+j.call(String(t.nodeName))+">"}if(B(t)){if(0===t.length)return"[]";var ie=Z(t,z);return L&&!function(e){for(var t=0;t<e.length;t++)if(W(e[t],"\n")>=0)return!1;return!0}(ie)?"["+X(ie,L)+"]":"[ "+E.call(ie,", ")+" ]"}if(function(e){return!("[object Error]"!==q(e)||I&&"object"==typeof e&&I in e)}(t)){var se=Z(t,z);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+E.call(se,", ")+" }":"{ ["+String(t)+"] "+E.call(_.call("[cause]: "+z(t.cause),se),", ")+" }"}if("object"==typeof t&&c){if(M&&"function"==typeof t[M]&&R)return R(t,{depth:S-n});if("symbol"!==c&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{l.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ae=[];return s.call(t,(function(e,r){ae.push(z(r,t,!0)+" => "+z(e,t))})),Q("Map",i.call(t),ae,L)}if(function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ce=[];return u.call(t,(function(e){ce.push(z(e,t))})),Q("Set",l.call(t),ce,L)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return J("WeakMap");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return J("WeakSet");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{return d.call(e),!0}catch(e){}return!1}(t))return J("WeakRef");if(function(e){return!("[object Number]"!==q(e)||I&&"object"==typeof e&&I in e)}(t))return Y(z(Number(t)));if(function(e){if(!e||"object"!=typeof e||!T)return!1;try{return T.call(e),!0}catch(e){}return!1}(t))return Y(z(T.call(t)));if(function(e){return!("[object Boolean]"!==q(e)||I&&"object"==typeof e&&I in e)}(t))return Y(h.call(t));if(function(e){return!("[object String]"!==q(e)||I&&"object"==typeof e&&I in e)}(t))return Y(z(String(t)));if(!function(e){return!("[object Date]"!==q(e)||I&&"object"==typeof e&&I in e)}(t)&&!H(t)){var le=Z(t,z),ue=D?D(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",fe=!ue&&I&&Object(t)===t&&I in t?g.call(q(t),8,-1):pe?"Object":"",de=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(fe||pe?"["+E.call(_.call([],fe||[],pe||[]),": ")+"] ":"");return 0===le.length?de+"{}":L?de+"{"+X(le,L)+"}":de+"{ "+E.call(le,", ")+" }"}return String(t)};var z=Object.prototype.hasOwnProperty||function(e){return e in this};function V(e,t){return z.call(e,t)}function q(e){return y.call(e)}function W(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function G(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return G(g.call(e,0,t.maxStringLength),t)+n}return U(v.call(v.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,K),"single",t)}function K(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+O.call(t.toString(16))}function Y(e){return"Object("+e+")"}function J(e){return e+" { ? }"}function Q(e,t,r,n){return e+" ("+t+") {"+(n?X(r,n):E.call(r,", "))+"}"}function X(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+E.call(e,","+r)+"\n"+t.prev}function Z(e,t){var r=B(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=V(e,o)?t(e[o],e):""}var i,s="function"==typeof P?P(e):[];if(A){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var c in e)V(e,c)&&(r&&String(Number(c))===c&&c<e.length||A&&i["$"+c]instanceof Symbol||(w.call(/[^\w$]/,c)?n.push(t(c,e)+": "+t(e[c],e)):n.push(c+": "+t(e[c],e))));if("function"==typeof P)for(var l=0;l<s.length;l++)N.call(e,s[l])&&n.push("["+t(s[l])+"]: "+t(e[s[l]],e));return n}},987:(e,t,r)=>{"use strict";var n;if(!Object.keys){var o=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=r(414),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),l=a.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(e){var t=e.constructor;return t&&t.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&o.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{p(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===i.call(e),n=s(e),a=t&&"[object String]"===i.call(e),f=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var h=l&&r;if(a&&e.length>0&&!o.call(e,0))for(var y=0;y<e.length;++y)f.push(String(y));if(n&&e.length>0)for(var b=0;b<e.length;++b)f.push(String(b));else for(var m in e)h&&"prototype"===m||!o.call(e,m)||f.push(String(m));if(c)for(var g=function(e){if("undefined"==typeof window||!d)return p(e);try{return p(e)}catch(e){return!1}}(e),v=0;v<u.length;++v)g&&"constructor"===u[v]||!o.call(e,u[v])||f.push(u[v]);return f}}e.exports=n},215:(e,t,r)=>{"use strict";var n=Array.prototype.slice,o=r(414),i=Object.keys,s=i?function(e){return i(e)}:r(987),a=Object.keys;s.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return o(e)?a(n.call(e)):a(e)})}else Object.keys=s;return Object.keys||s},e.exports=s},414:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},478:(e,t,r)=>{"use strict";var n=r(210),o=r(924),i=r(631),s=n("%TypeError%"),a=n("%WeakMap%",!0),c=n("%Map%",!0),l=o("WeakMap.prototype.get",!0),u=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),f=o("Map.prototype.get",!0),d=o("Map.prototype.set",!0),h=o("Map.prototype.has",!0),y=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new s("Side channel does not contain "+i(e))},get:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return l(e,n)}else if(c){if(t)return f(t,n)}else if(r)return function(e,t){var r=y(e,t);return r&&r.value}(r,n)},has:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return p(e,n)}else if(c){if(t)return h(t,n)}else if(r)return function(e,t){return!!y(e,t)}(r,n);return!1},set:function(n,o){a&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new a),u(e,n,o)):c?(t||(t=new c),d(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=y(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n}},839:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,r=e.Symbol;if("function"==typeof r)if(r.observable)t=r.observable;else{t=r.for("https://github.com/benlesh/symbol-observable");try{r.observable=t}catch(e){}}else t="@@observable";return t}},868:(e,t,r)=>{e.exports=r(839)},813:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},n(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NO_IL=t.NO=t.MemoryStream=t.Stream=void 0;var i=r(868),s=r(503),a=i.default(s.getPolyfill()),c={};function l(){}function u(e){for(var t=e.length,r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function p(e,t,r){try{return e.f(t)}catch(e){return r._e(e),c}}t.NO=c;var f={_n:l,_e:l,_c:l};function d(e){e._start=function(e){e.next=e._n,e.error=e._e,e.complete=e._c,this.start(e)},e._stop=e.stop}t.NO_IL=f;var h=function(){function e(e,t){this._stream=e,this._listener=t}return e.prototype.unsubscribe=function(){this._stream._remove(this._listener)},e}(),y=function(){function e(e){this._listener=e}return e.prototype.next=function(e){this._listener._n(e)},e.prototype.error=function(e){this._listener._e(e)},e.prototype.complete=function(){this._listener._c()},e}(),b=function(){function e(e){this.type="fromObservable",this.ins=e,this.active=!1}return e.prototype._start=function(e){this.out=e,this.active=!0,this._sub=this.ins.subscribe(new y(e)),this.active||this._sub.unsubscribe()},e.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},e}(),m=function(){function e(e){this.type="merge",this.insArr=e,this.out=c,this.ac=0}return e.prototype._start=function(e){this.out=e;var t=this.insArr,r=t.length;this.ac=r;for(var n=0;n<r;n++)t[n]._add(this)},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,r=0;r<t;r++)e[r]._remove(this);this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){if(--this.ac<=0){var e=this.out;if(e===c)return;e._c()}},e}(),g=function(){function e(e,t,r){this.i=e,this.out=t,this.p=r,r.ils.push(this)}return e.prototype._n=function(e){var t=this.p,r=this.out;if(r!==c&&t.up(e,this.i)){var n=u(t.vals);r._n(n)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.p;e.out!==c&&0==--e.Nc&&e.out._c()},e}(),v=function(){function e(e){this.type="combine",this.insArr=e,this.out=c,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return e.prototype.up=function(e,t){var r=this.vals[t],n=this.Nn?r===c?--this.Nn:this.Nn:0;return this.vals[t]=e,0===n},e.prototype._start=function(e){this.out=e;var t=this.insArr,r=this.Nc=this.Nn=t.length,n=this.vals=new Array(r);if(0===r)e._n([]),e._c();else for(var o=0;o<r;o++)n[o]=c,t[o]._add(new g(o,e,this))},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,r=this.ils,n=0;n<t;n++)e[n]._remove(r[n]);this.out=c,this.ils=[],this.vals=[]},e}(),O=function(){function e(e){this.type="fromArray",this.a=e}return e.prototype._start=function(e){for(var t=this.a,r=0,n=t.length;r<n;r++)e._n(t[r]);e._c()},e.prototype._stop=function(){},e}(),j=function(){function e(e){this.type="fromPromise",this.on=!1,this.p=e}return e.prototype._start=function(e){var t=this;this.on=!0,this.p.then((function(r){t.on&&(e._n(r),e._c())}),(function(t){e._e(t)})).then(l,(function(e){setTimeout((function(){throw e}))}))},e.prototype._stop=function(){this.on=!1},e}(),w=function(){function e(e){this.type="periodic",this.period=e,this.intervalID=-1,this.i=0}return e.prototype._start=function(e){var t=this;this.intervalID=setInterval((function(){e._n(t.i++)}),this.period)},e.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},e}(),_=function(){function e(e,t){this.type="debug",this.ins=e,this.out=c,this.s=l,this.l="","string"==typeof t?this.l=t:"function"==typeof t&&(this.s=t)}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=this.s,n=this.l;if(r!==l)try{r(e)}catch(e){t._e(e)}else n?console.log(n+":",e):console.log(e);t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),E=function(){function e(e,t){this.type="drop",this.ins=t,this.out=c,this.max=e,this.dropped=0}return e.prototype._start=function(e){this.out=e,this.dropped=0,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&this.dropped++>=this.max&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),x=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(){this.op.end()},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.end()},e}(),S=function(){function e(e,t){this.type="endWhen",this.ins=t,this.out=c,this.o=e,this.oil=f}return e.prototype._start=function(e){this.out=e,this.o._add(this.oil=new x(e,this)),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=c,this.oil=f},e.prototype.end=function(){var e=this.out;e!==c&&e._c()},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.end()},e}(),T=function(){function e(e,t){this.type="filter",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&r&&t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),P=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(e){this.out._n(e)},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.inner=c,this.op.less()},e}(),C=function(){function e(e){this.type="flatten",this.ins=e,this.out=c,this.open=!0,this.inner=c,this.il=f}return e.prototype._start=function(e){this.out=e,this.open=!0,this.inner=c,this.il=f,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.inner!==c&&this.inner._remove(this.il),this.out=c,this.open=!0,this.inner=c,this.il=f},e.prototype.less=function(){var e=this.out;e!==c&&(this.open||this.inner!==c||e._c())},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=this.inner,n=this.il;r!==c&&n!==f&&r._remove(n),(this.inner=e)._add(this.il=new P(t,this))}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.open=!1,this.less()},e}(),A=function(){function e(e,t,r){var n=this;this.type="fold",this.ins=r,this.out=c,this.f=function(t){return e(n.acc,t)},this.acc=this.seed=t}return e.prototype._start=function(e){this.out=e,this.acc=this.seed,e._n(this.acc),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.acc=this.seed},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&t._n(this.acc=r)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),I=function(){function e(e){this.type="last",this.ins=e,this.out=c,this.has=!1,this.val=c}return e.prototype._start=function(e){this.out=e,this.has=!1,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.val=c},e.prototype._n=function(e){this.has=!0,this.val=e},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&(this.has?(e._n(this.val),e._c()):e._e(new Error("last() failed because input stream completed")))},e}(),N=function(){function e(e,t){this.type="map",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&t._n(r)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),D=function(){function e(e){this.type="remember",this.ins=e,this.out=c}return e.prototype._start=function(e){this.out=e,this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),k=function(){function e(e,t){this.type="replaceError",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;if(t!==c)try{this.ins._remove(this),(this.ins=this.f(e))._add(this)}catch(e){t._e(e)}},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),R=function(){function e(e,t){this.type="startWith",this.ins=e,this.out=c,this.val=t}return e.prototype._start=function(e){this.out=e,this.out._n(this.val),this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),L=function(){function e(e,t){this.type="take",this.ins=t,this.out=c,this.max=e,this.taken=0}return e.prototype._start=function(e){this.out=e,this.taken=0,this.max<=0?e._c():this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=++this.taken;r<this.max?t._n(e):r===this.max&&(t._n(e),t._c())}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),M=function(){function e(e){this._prod=e||c,this._ils=[],this._stopID=c,this._dl=c,this._d=!1,this._target=null,this._err=c}return e.prototype._n=function(e){var t=this._ils,r=t.length;if(this._d&&this._dl._n(e),1==r)t[0]._n(e);else{if(0==r)return;for(var n=u(t),o=0;o<r;o++)n[o]._n(e)}},e.prototype._e=function(e){if(this._err===c){this._err=e;var t=this._ils,r=t.length;if(this._x(),this._d&&this._dl._e(e),1==r)t[0]._e(e);else{if(0==r)return;for(var n=u(t),o=0;o<r;o++)n[o]._e(e)}if(!this._d&&0==r)throw this._err}},e.prototype._c=function(){var e=this._ils,t=e.length;if(this._x(),this._d&&this._dl._c(),1==t)e[0]._c();else{if(0==t)return;for(var r=u(e),n=0;n<t;n++)r[n]._c()}},e.prototype._x=function(){0!==this._ils.length&&(this._prod!==c&&this._prod._stop(),this._err=c,this._ils=[])},e.prototype._stopNow=function(){this._prod._stop(),this._err=c,this._stopID=c},e.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var r=this._ils;if(r.push(e),!(r.length>1))if(this._stopID!==c)clearTimeout(this._stopID),this._stopID=c;else{var n=this._prod;n!==c&&n._start(this)}},e.prototype._remove=function(e){var t=this,r=this._target;if(r)return r._remove(e);var n=this._ils,o=n.indexOf(e);o>-1&&(n.splice(o,1),this._prod!==c&&n.length<=0?(this._err=c,this._stopID=setTimeout((function(){return t._stopNow()}))):1===n.length&&this._pruneCycles())},e.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},e.prototype._hasNoSinks=function(e,t){if(-1!==t.indexOf(e))return!0;if(e.out===this)return!0;if(e.out&&e.out!==c)return this._hasNoSinks(e.out,t.concat(e));if(e._ils){for(var r=0,n=e._ils.length;r<n;r++)if(!this._hasNoSinks(e._ils[r],t.concat(e)))return!1;return!0}return!1},e.prototype.ctor=function(){return this instanceof U?U:e},e.prototype.addListener=function(e){e._n=e.next||l,e._e=e.error||l,e._c=e.complete||l,this._add(e)},e.prototype.removeListener=function(e){this._remove(e)},e.prototype.subscribe=function(e){return this.addListener(e),new h(this,e)},e.prototype[a]=function(){return this},e.create=function(t){if(t){if("function"!=typeof t.start||"function"!=typeof t.stop)throw new Error("producer requires both start and stop functions");d(t)}return new e(t)},e.createWithMemory=function(e){return e&&d(e),new U(e)},e.never=function(){return new e({_start:l,_stop:l})},e.empty=function(){return new e({_start:function(e){e._c()},_stop:l})},e.throw=function(t){return new e({_start:function(e){e._e(t)},_stop:l})},e.from=function(t){if("function"==typeof t[a])return e.fromObservable(t);if("function"==typeof t.then)return e.fromPromise(t);if(Array.isArray(t))return e.fromArray(t);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},e.of=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.fromArray(t)},e.fromArray=function(t){return new e(new O(t))},e.fromPromise=function(t){return new e(new j(t))},e.fromObservable=function(t){if(void 0!==t.endWhen)return t;var r="function"==typeof t[a]?t[a]():t;return new e(new b(r))},e.periodic=function(t){return new e(new w(t))},e.prototype._map=function(e){return new(this.ctor())(new N(e,this))},e.prototype.map=function(e){return this._map(e)},e.prototype.mapTo=function(e){var t=this.map((function(){return e}));return t._prod.type="mapTo",t},e.prototype.filter=function(t){var r,n,o=this._prod;return new e(o instanceof T?new T((r=o.f,n=t,function(e){return r(e)&&n(e)}),o.ins):new T(t,this))},e.prototype.take=function(e){return new(this.ctor())(new L(e,this))},e.prototype.drop=function(t){return new e(new E(t,this))},e.prototype.last=function(){return new e(new I(this))},e.prototype.startWith=function(e){return new U(new R(this,e))},e.prototype.endWhen=function(e){return new(this.ctor())(new S(e,this))},e.prototype.fold=function(e,t){return new U(new A(e,t,this))},e.prototype.replaceError=function(e){return new(this.ctor())(new k(e,this))},e.prototype.flatten=function(){return new e(new C(this))},e.prototype.compose=function(e){return e(this)},e.prototype.remember=function(){return new U(new D(this))},e.prototype.debug=function(e){return new(this.ctor())(new _(this,e))},e.prototype.imitate=function(e){if(e instanceof U)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=e;for(var t=this._ils,r=t.length,n=0;n<r;n++)e._add(t[n]);this._ils=[]},e.prototype.shamefullySendNext=function(e){this._n(e)},e.prototype.shamefullySendError=function(e){this._e(e)},e.prototype.shamefullySendComplete=function(){this._c()},e.prototype.setDebugListener=function(e){e?(this._d=!0,e._n=e.next||l,e._e=e.error||l,e._c=e.complete||l,this._dl=e):(this._d=!1,this._dl=c)},e.merge=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(new m(t))},e.combine=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(new v(t))},e}();t.Stream=M;var U=function(e){function t(t){var r=e.call(this,t)||this;return r._has=!1,r}return o(t,e),t.prototype._n=function(t){this._v=t,this._has=!0,e.prototype._n.call(this,t)},t.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var r=this._ils;if(r.push(e),r.length>1)this._has&&e._n(this._v);else if(this._stopID!==c)this._has&&e._n(this._v),clearTimeout(this._stopID),this._stopID=c;else if(this._has)e._n(this._v);else{var n=this._prod;n!==c&&n._start(this)}},t.prototype._stopNow=function(){this._has=!1,e.prototype._stopNow.call(this)},t.prototype._x=function(){this._has=!1,e.prototype._x.call(this)},t.prototype.map=function(e){return this._map(e)},t.prototype.mapTo=function(t){return e.prototype.mapTo.call(this,t)},t.prototype.take=function(t){return e.prototype.take.call(this,t)},t.prototype.endWhen=function(t){return e.prototype.endWhen.call(this,t)},t.prototype.replaceError=function(t){return e.prototype.replaceError.call(this,t)},t.prototype.remember=function(){return this},t.prototype.debug=function(t){return e.prototype.debug.call(this,t)},t}(M);t.MemoryStream=U;var F=M;t.default=F},654:()=>{},695:()=>{}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{API:()=>vp,AgentInfo:()=>$p,Chat:()=>Gs,ChatFrame:()=>Hl,ComponentFilter:()=>ol,Conversation:()=>sl,DeprecatedToggleButton:()=>Vp,DeprecatedView:()=>Qp,Engine:()=>Rp,EntryContainer:()=>Nl,EventParticipant:()=>sa,ExternalApi:()=>Hp,Header:()=>zp,Icon:()=>wi,Interrupt:()=>Ks,MessageContainer:()=>fa,SeamlyApiContext:()=>Zr,SeamlyEventBusContext:()=>en,SeamlyGeneralError:()=>io,SeamlyLiveRegionContext:()=>ko,SeamlyOfflineError:()=>ao,StoreProvider:()=>F,Text:()=>_a,View:()=>Jl,calculateVisibility:()=>jr,className:()=>Xr,createReduxStore:()=>Q,default:()=>Xp,eventTypes:()=>Ee,getUrlParams:()=>he,getUrlSearchString:()=>ye,randomId:()=>s,seamlyActions:()=>He,useChoicePrompt:()=>ma,useDispatch:()=>sn,useEvents:()=>cr,useGeneratedId:()=>So,useI18n:()=>Tn,useSeamlyChat:()=>qo,useSeamlyCommands:()=>Do,useSeamlyConfig:()=>re,useSeamlyEventStream:()=>ri,useSeamlyIdleDetachCountdown:()=>Zo,useSeamlyMessageContainerClassNames:()=>cn,useSeamlyOptions:()=>qn,useSeamlyVisibility:()=>vo,useTranslatedEventData:()=>fi,useTranslations:()=>pi,useTranslationsContainer:()=>di,visibilityStates:()=>C}),r(698);const e=require("preact");var t=r(679),o=r.n(t);const i=require("preact/hooks");function s(){return"_"+(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const l="//";function u(e,t,r="/"){return(n,...o)=>t(e+r+n,...o)}function p(e,t=(e=>({payload:e}))){const r=(...r)=>function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:e},t(...r));return r.toString=()=>String(e),r.match=t=>(null==t?void 0:t.type)===String(e),r}function f(e,...t){const r=[];t.forEach((e=>{const t=typeof e;if("string"===t)return r.push([e]);"object"!==t||e instanceof Array||Object.keys(e).forEach((t=>r.push([t,e[t]])))}));const n=u(e,p,"/");return r.map((e=>n(...e)))}function d(e,t){const[r,n,o]=f(e,{pending:(e,t)=>({meta:{arg:e,requestId:t,status:"pending"}}),fulfilled:(e,t,r)=>({payload:t,meta:{arg:e,requestId:r,status:"fulfilled"}}),rejected:(e,t,r)=>({error:t,meta:{arg:e,requestId:r,status:"rejected",error:String(t)}})});return Object.assign((i=>(a,c,l)=>{const u=s(),p=(async()=>{let e;try{a(r(i,u));const o=t(i,{dispatch:a,getState:c,extra:l}),s=await o;e=n(i,s,u)}catch(t){e=o(i,t,u)}return a(e),e})();return Object.assign(p,{type:e,arg:i,requestId:u})}),{type:e,pending:r,fulfilled:n,rejected:o})}function h(e){return{createAction:u(e,p,l),createActions:u(e,f,l),createThunk:u(e,d,l),createReducer:(t,r)=>function(e,t={},r){const n=(e=r,n)=>{const o=null==t?void 0:t[null==n?void 0:n.type];return o?o(e,n):e};return n.toString=()=>e,n}(e,t,r),selectState:t=>t[e]}}const{createAction:y,createThunk:b,createReducer:m,selectState:g}=h("config"),v=y("initialize",(e=>({config:e}))),O=y("update",(e=>({config:e}))),j=y("setPreChatEvents",(e=>({events:e})));var w="NOT_FOUND",_=function(e,t){return e===t};function E(e,t){var r,n,o="object"==typeof t?t:{equalityCheck:t},i=o.equalityCheck,s=void 0===i?_:i,a=o.maxSize,c=void 0===a?1:a,l=o.resultEqualityCheck,u=function(e){return function(t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;o<n;o++)if(!e(t[o],r[o]))return!1;return!0}}(s),p=1===c?(r=u,{get:function(e){return n&&r(n.key,e)?n.value:w},put:function(e,t){n={key:e,value:t}},getEntries:function(){return n?[n]:[]},clear:function(){n=void 0}}):function(e,t){var r=[];function n(e){var n=r.findIndex((function(r){return t(e,r.key)}));if(n>-1){var o=r[n];return n>0&&(r.splice(n,1),r.unshift(o)),o.value}return w}return{get:n,put:function(t,o){n(t)===w&&(r.unshift({key:t,value:o}),r.length>e&&r.pop())},getEntries:function(){return r},clear:function(){r=[]}}}(c,u);function f(){var t=p.get(arguments);if(t===w){if(t=e.apply(null,arguments),l){var r=p.getEntries(),n=r.find((function(e){return l(e.value,t)}));n&&(t=n.value)}p.put(arguments,t)}return t}return f.clearCache=function(){return p.clear()},f}function x(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return"function"==typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ");throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+r+"]")}return t}function S(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];var i,s=0,a={memoizeOptions:void 0},c=n.pop();if("object"==typeof c&&(a=c,c=n.pop()),"function"!=typeof c)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof c+"]");var l=a,u=l.memoizeOptions,p=void 0===u?r:u,f=Array.isArray(p)?p:[p],d=x(n),h=e.apply(void 0,[function(){return s++,c.apply(null,arguments)}].concat(f)),y=e((function(){for(var e=[],t=d.length,r=0;r<t;r++)e.push(d[r].apply(null,arguments));return i=h.apply(null,e)}));return Object.assign(y,{resultFunc:c,memoizedResultFunc:h,dependencies:d,lastResult:function(){return i},recomputations:function(){return s},resetRecomputations:function(){return s=0}}),y};return o}var T=S(E);const P="visibility",C={hidden:"hidden",minimized:"minimized",open:"open",initialize:null};function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const D=T(g,(e=>{let t=I({visible:"inline"===(null==e?void 0:e.layoutMode)?C.open:C.minimized,appContainerClassNames:e.appContainerClassNames||[]},e);return"function"==typeof t.appContainerClassNames&&(t=I(I({},t),{},{appContainerClassNames:t.appContainerClassNames(t)})),t})),k=(0,e.createContext)(void 0),R=k,{Provider:L,Consumer:M}=k,U=require("preact/jsx-runtime");function F({store:e,children:t}){return(0,U.jsx)(L,{value:e,children:t})}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach((function(t){B(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(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 V="function"==typeof Symbol&&Symbol.observable||"@@observable",q=function(){return Math.random().toString(36).substring(7).split("").join(".")},W={INIT:"@@redux/INIT"+q(),REPLACE:"@@redux/REPLACE"+q(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+q()}};function G(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function K(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(z(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(z(1));return r(K)(e,t)}if("function"!=typeof e)throw new Error(z(2));var o=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(z(3));return i}function p(e){if("function"!=typeof e)throw new Error(z(4));if(c)throw new Error(z(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(z(6));t=!1,l();var r=a.indexOf(e);a.splice(r,1),s=null}}}function f(e){if(!G(e))throw new Error(z(7));if(void 0===e.type)throw new Error(z(8));if(c)throw new Error(z(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,r=0;r<t.length;r++)(0,t[r])();return e}function d(e){if("function"!=typeof e)throw new Error(z(10));o=e,f({type:W.REPLACE})}function h(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(z(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[V]=function(){return this},e}return f({type:W.INIT}),(n={dispatch:f,subscribe:p,getState:u,replaceReducer:d})[V]=h,n}function Y(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}let J=Y;function Q({reducers:e={},initialState:t={},middlewares:r=[]}={}){return K(function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var i,s=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:W.INIT}))throw new Error(z(12));if(void 0===r(void 0,{type:W.PROBE_UNKNOWN_ACTION()}))throw new Error(z(13))}))}(r)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},a=0;a<s.length;a++){var c=s[a],l=r[c],u=e[c],p=l(u,t);if(void 0===p)throw t&&t.type,new Error(z(14));o[c]=p,n=n||p!==u}return(n=n||s.length!==Object.keys(e).length)?o:e}}(e),t,J(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw new Error(z(15))},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return n=Y.apply(void 0,i)(r.dispatch),$($({},r),{},{dispatch:n})}}}(...r)))}function X(){return(0,i.useContext)(R)}function Z(){return X().dispatch}function ee(e,t=[]){const r=X(),[,n]=(0,i.useReducer)((e=>e+1),0),o=(0,i.useRef)(),s=(0,i.useCallback)(e,t),a=(0,i.useRef)(),c=(0,i.useRef)(),l=r.getState();return a.current===s&&c.current===l||(c.current=l,o.current=s(c.current),a.current=s),(0,i.useLayoutEffect)((()=>r.subscribe((()=>{var e;if(r.getState()===c.current)return;const t=null===(e=a.current)||void 0===e?void 0:e.call(a,r.getState());t!==o.current&&(o.current=t,n())}))),[r]),o.current}const te=function(e,t,r=[]){return ee((0,i.useCallback)((r=>e(r,t)),r),r)};function re(){return ee(D)}function ne(){const{startChatIcon:e}=ee(D);return e}const oe="cvco",ie="2",se="seamly-client-participant";function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(r),!0).forEach((function(t){le(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ue=(e,t)=>{let r;return function(...n){const o=this;let i=!1;return clearTimeout(r),r=setTimeout((()=>{r=null,i||e.apply(o,n),i=!1}),t),t=>{i=!0,t&&e.apply(o,n)}}},pe=e=>Math.ceil(e/1e3),fe=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},de=(e,t=2)=>{if(0===e)return"0 Bytes";const r=t<0?0:t,n=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/1024**n).toFixed(r))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]},he=()=>{const{search:e}=window.location;return e?e.slice(e.indexOf("?")+1).split("&").reduce(((e,t)=>{const[r,n]=t.split("=");return ce(ce({},e),{},{[r]:decodeURIComponent(n)})}),{}):{}},ye=e=>Object.keys(e).reduce(((t,r)=>`${t}${t?"&":""}${r}=${encodeURIComponent(e[r])}`),""),be={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},me={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},ge=e=>e.code?me[e.code]:be[e.keyCode],ve=e=>{e&&e.focus()},Oe=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function we(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?je(Object(r),!0).forEach((function(t){_e(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ee={info:"info",message:"message",participant:"participant",system:"system"},xe="text",Se="text",Te="upload",Pe="received",Ce="read",Ae="custom",Ie="typing",Ne="read",De="detach_service",ke="set_topic",Re="set_translation",Le="click_cta",Me="assertive",Ue="polite",Fe={new_topic:"newTopic",new_translation:"newTranslation"},Be="uploads",He={ADD_EVENT:"ADD_EVENT",CLEAR_EVENTS:"CLEAR_EVENTS",SET_HISTORY:"SET_HISTORY",SET_EVENTS_READ:"SET_EVENTS_READ",SET_LOADED_IMAGE_EVENT_IDS:"SET_LOADED_IMAGE_EVENT_IDS",ACK_EVENT:"ACK_EVENT",SET_IS_LOADING:"SET_IS_LOADING",CLEAR_PARTICIPANTS:"CLEAR_PARTICIPANTS",SET_PARTICIPANT:"SET_PARTICIPANT",SET_HEADER_TITLE:"SET_HEADER_TITLE",SET_HEADER_SUB_TITLE:"SET_HEADER_SUB_TITLE",RESET_HISTORY_LOADED_FLAG:"RESET_HISTORY_LOADED_FLAG",SET_ACTIVE_SERVICE:"SET_ACTIVE_SERVICE",INIT_IDLE_DETACH_COUNTDOWN:"INIT_IDLE_DETACH_COUNTDOWN",DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:"DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER",STOP_IDLE_DETACH_COUNTDOWN_COUNTER:"STOP_IDLE_DETACH_COUNTDOWN_COUNTER",CLEAR_IDLE_DETACH_COUNTDOWN:"CLEAR_IDLE_DETACH_COUNTDOWN",INIT_RESUME_CONVERSATION_PROMPT:"INIT_RESUME_CONVERSATION_PROMPT",CLEAR_RESUME_CONVERSATION_PROMPT:"CLEAR_RESUME_CONVERSATION_PROMPT",SET_SERVICE_DATA_ITEM:"SET_SERVICE_DATA_ITEM",SET_FEATURES:"SET_FEATURES",SET_FEATURE_ENABLED_STATE:"SET_FEATURE_ENABLED_STATE",CLEAR_FEATURES:"CLEAR_FEATURES",SET_INITIAL_STATE:"SET_INITIAL_STATE",SET_USER_SELECTED_OPTIONS:"SET_USER_SELECTED_OPTIONS",SET_USER_SELECTED_OPTION:"SET_USER_SELECTED_OPTION",SHOW_OPTION:"SHOW_OPTION",HIDE_OPTION:"HIDE_OPTION",SET_SERVICE_ENTRY_METADATA:"SET_SERVICE_ENTRY_METADATA",SET_BLOCK_AUTO_ENTRY_SWITCH:"SET_BLOCK_AUTO_ENTRY_SWITCH",SET_ACTIVE_ENTRY_TYPE:"SET_ACTIVE_ENTRY_TYPE",SET_USER_ENTRY_TYPE:"SET_USER_ENTRY_TYPE",REGISTER_UPLOAD:"REGISTER_UPLOAD",SET_UPLOAD_PROGRESS:"SET_UPLOAD_PROGRESS",SET_UPLOAD_COMPLETE:"SET_UPLOAD_COMPLETE",SET_UPLOAD_ERROR:"SET_UPLOAD_ERROR",CLEAR_UPLOAD:"CLEAR_UPLOAD",CLEAR_ALL_UPLOADS:"CLEAR_ALL_UPLOADS",SET_SEAMLY_CONTAINER_ELEMENT:"SET_SEAMLY_CONTAINER_ELEMENT"},$e="navigate",{ADD_EVENT:ze,CLEAR_EVENTS:Ve,SET_HISTORY:qe,SET_EVENTS_READ:We,SET_LOADED_IMAGE_EVENT_IDS:Ge,ACK_EVENT:Ke,SET_IS_LOADING:Ye,CLEAR_PARTICIPANTS:Je,SET_PARTICIPANT:Qe,SET_HEADER_TITLE:Xe,SET_HEADER_SUB_TITLE:Ze,RESET_HISTORY_LOADED_FLAG:et,SET_ACTIVE_SERVICE:tt,INIT_IDLE_DETACH_COUNTDOWN:rt,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:nt,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:ot,CLEAR_IDLE_DETACH_COUNTDOWN:it,INIT_RESUME_CONVERSATION_PROMPT:st,CLEAR_RESUME_CONVERSATION_PROMPT:at,SET_SERVICE_DATA_ITEM:ct,SET_FEATURES:lt,SET_FEATURE_ENABLED_STATE:ut,CLEAR_FEATURES:pt,SET_INITIAL_STATE:ft,SET_USER_SELECTED_OPTION:dt,SET_USER_SELECTED_OPTIONS:ht,SHOW_OPTION:yt,HIDE_OPTION:bt,SET_BLOCK_AUTO_ENTRY_SWITCH:mt,SET_USER_ENTRY_TYPE:gt,SET_ACTIVE_ENTRY_TYPE:vt,SET_SERVICE_ENTRY_METADATA:Ot,REGISTER_UPLOAD:jt,SET_UPLOAD_PROGRESS:wt,SET_UPLOAD_COMPLETE:_t,SET_UPLOAD_ERROR:Et,CLEAR_UPLOAD:xt,CLEAR_ALL_UPLOADS:St,SET_SEAMLY_CONTAINER_ELEMENT:Tt}=He,Pt=({type:e,payload:t})=>e===Ee.message&&!t.fromClient||e===Ee.info&&t.type===xe,Ct=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),At=(e,t)=>{switch(t.type){case Je:return{participants:{},currentAgent:""};case Qe:if(!e)return{participants:{},currentAgent:""};const{participants:r}=e||{participants:{}},{id:n,avatar:o,name:i,introduction:s}=t.participant,a=r[n],c=we(we({},r),{},{[n]:a?we(we(we(we({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return we(we({},e),{},{participants:c,currentAgent:e.currentAgent===n||t.fromClient?e.currentAgent:n});default:return e}},It=(e,t)=>{switch(t.type){case Xe:return we(we({},e),{},{title:t.title});case Ze:return we(we({},e),{},{subTitle:t.title});default:return e}},Nt=(e,t)=>{const{entry:r}=t,{blockAutoEntrySwitch:n}=e;if(!r)return we(we({},e),{},{optionsOverride:{}});const{type:o,options:i}=r;let s=e.active;return n||o===e.userSelected||(s=o),we(we({},e),{},{active:s,optionsOverride:we(we({},e.optionsOverride),{},{[o]:i||{}})})},{createAction:Dt,createThunk:kt,createReducer:Rt,selectState:Lt}=h("i18n"),Mt=T(Lt,(e=>e.translations)),Ut=T(Lt,(e=>e.initialLocale)),Ft=T(Lt,(e=>e.locale)),Bt=Dt("setInitialLocale",(e=>({locale:e}))),Ht=function(){let e=!1;const t=[],r=async()=>{if(!e)for(;t.length;){const r=t.shift();e=!0,await r().catch((()=>{})),e=!1}};return{next:r,runExclusively:async e=>{const n=new Promise(((r,n)=>{t.push((async()=>{try{r(await e())}catch(e){n(e)}}))}));return r(),n}}}(),$t=kt("setLocale",(async(e,{getState:t,extra:{api:r}})=>Ht.runExclusively((()=>{if(e!==Ft(t()))return r.getTranslations(e)})))),{createActions:zt,createReducer:Vt,selectState:qt}=h("translations"),[Wt,Gt]=zt("translate",{enable:e=>({locale:e}),disable:()=>({})}),[Kt,Yt]=zt("event",{enable:e=>({payloadId:e}),disable:e=>({payloadId:e})}),{createAction:Jt,createThunk:Qt,createReducer:Xt,selectState:Zt}=h("app"),er=T(Zt,(e=>e.userHasResponded));function tr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tr(Object(r),!0).forEach((function(t){nr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function nr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const or=e=>e.state,ir=()=>ee(or),sr=T(or,D,er,(({events:e,serviceData:t},r,n)=>{var o;if(n||"inline"===r.layoutMode||!t.suggestion||null===(o=t.suggestion)||void 0===o||!o.body.length)return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),ar=T(sr,D,((e,t)=>{var r;const{enabled:n,threshold:o}=(null==t||null===(r=t.messages)||void 0===r?void 0:r.timeIndicator)??{};if(!n)return e;const i=[];let s=null;return e.forEach(((e,t)=>{if(0===t)i.push(rr(rr({},e),{},{timeIndicator:e.payload.occurredAt}));else{const t=s&&pe(e.payload.occurredAt-s.payload.occurredAt)>=o?e.payload.occurredAt:void 0;i.push(rr(rr({},e),{},{timeIndicator:t}))}s=e})),i})),cr=()=>ee(ar,[]),lr=()=>ir().headerTitles,ur=()=>ir().unreadEvents,pr=()=>ir().skiplinkTargetId,fr=T(ar,(e=>{var t;const r=e.filter((e=>"message"===e.type));return null===(t=r[r.length-1])||void 0===t?void 0:t.payload.id})),dr=()=>{const{participants:e,currentAgent:t}=ir().participantInfo;return t?e[t]:null},hr=e=>ir().serviceData[e],yr=()=>{const{layoutMode:e}=re();return{isInline:"inline"===e,isWindow:"window"===e,isResolving:!e}},{createAction:br,createActions:mr,createThunk:gr,createReducer:vr,selectState:Or}=h("visibility"),jr=({hasResponded:e,previousVisibility:t,requestedVisibility:r,config:n})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=n,{visible:a}=o||{};if("app"===i&&!t)return C.open;if("window"===i&&s&&r!==C.open)return e?r||t||C.open:C.hidden;if("inline"===i&&e&&!r)return t||C.open;const c=C.minimized;return r||t||a||c},wr=T(Or,(e=>e.visibility)),_r=T(Or,(e=>e.showInlineView));function Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Er(Object(r),!0).forEach((function(t){Sr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Sr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Tr=br("setFromStorage",(e=>({visibility:e}))),Pr=br("setShowInlineView"),Cr=[C.open,C.minimized,C.hidden],Ar=gr("set",((e,{getState:t,extra:{api:r,eventBus:n}})=>{const o=t(),i=wr(o),s=er(o),a=r.hasConversation(),c=D(o),{visibilityCallback:l=jr,layoutMode:u}=c,{unreadEvents:p}=or(o),f=l({hasConversation:a,hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(Cr.includes(f)){if(i!==f)return r.store.set(P,xr(xr({},r.store.get(P)||{}),{},{[u]:e})),e&&n.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:p}),f}else console.error('The visibilityCallback function should return "open", "minimized" or "hidden".')})),Ir=gr("initialize",(async(e,{dispatch:t,getState:r,extra:{api:n}})=>{var o;const{layoutMode:i}=D(r()),s=null===(o=n.store.get(P))||void 0===o?void 0:o[i];s&&t(Tr(s)),t(Ar(C.initialize))}));class Nr extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,Nr),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}class Dr extends Error{constructor(e,...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Object.getPrototypeOf(this)),this.originalError=e,null!=e&&e.payload&&(this.originalEvent=e,this.originalError=e.payload.error,this.message=`Event of type ${e.payload.type} encountered`),null!=e&&e.error&&(this.originalError=e.error)}}class kr extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}const{createAction:Rr,createReducer:Lr,selectState:Mr}=h("interrupt"),Ur=Rr("set",(e=>({error:e}))),Fr=Rr("clear"),Br=Jt("setHasResponded",(e=>({hasResponded:e}))),Hr=Qt("initialize",(async(e,{dispatch:t,extra:{api:r,config:n}})=>{var o;t(v(n));let i=null==n||null===(o=n.context)||void 0===o?void 0:o.locale;try{const{features:e,defaultLocale:n,preChat:o,agentParticipant:s,userParticipant:a,startChatIcon:c}=await r.getConfig();t({type:He.SET_FEATURES,features:e}),i=i||n,t(Bt(i)),t(j(o.map((e=>({type:"message",payload:e}))))),t(O({agentParticipant:s,userParticipant:a,startChatIcon:c})),null!=s&&s.name&&t({type:He.SET_HEADER_SUB_TITLE,title:s.name})}catch(e){throw new Nr}try{if(r.hasConversation()){var s;const e=await r.getConversationIntitialState();t({type:He.SET_INITIAL_STATE,initialState:e}),i=(null===(s=e.translation)||void 0===s?void 0:s.locale)||i,"userResponded"in e&&t(Br(e.userResponded))}else{var a,c;null!=n&&null!==(a=n.context)&&void 0!==a&&a.topic&&r.send("action",{type:ke,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),null!=n&&null!==(c=n.context)&&void 0!==c&&c.translationLocale&&(i=n.context.translationLocale,r.send("action",{type:Re,body:{enabled:!0,locale:i}}),t(Wt(i)))}}catch(e){if(e instanceof kr)throw e;throw new Nr}finally{await t($t(i)),t(Ir())}})),$r=Qt("reset",(async(e,{dispatch:t,extra:{api:r}})=>{try{await r.disconnect(),await r.clearStore(),t(Hr())}catch(e){t(Ur(e))}})),zr=["messages"];function Vr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vr(Object(r),!0).forEach((function(t){Wr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Wr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Gr=qr(qr({},{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}}}),{},{hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showFaq:!1,customComponents:{},defaults:{},preChatEvents:[]}),Kr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showFaq","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon"],Yr=(e,{config:t})=>{const r=(i=t,Kr.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:n}=r,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,zr);var i;let s=e;return Object.keys(o).length>0&&(s=qr(qr({},s),o)),n&&(s=qr(qr({},s),{},{messages:qr(qr({},s.messages),n)})),s},Jr=m({[v]:(e,t)=>Yr(e,t),[O]:(e,t)=>Yr(e,t),[Hr.pending]:()=>Gr,[j]:(e,{events:t})=>qr(qr({},e),{},{preChatEvents:t})},Gr),Qr=require("preact/compat"),Xr=(...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(oe)>-1?e:[oe,e].join("-"))).join(" "),Zr=(0,e.createContext)(null),en=(0,e.createContext)(""),tn=()=>(0,i.useContext)(Zr),rn=()=>tn().store||{},nn=()=>{const{get:e}=rn();return e?e("conversationUrl"):null},on=()=>!!nn(),sn=Z,an=()=>re().appContainerClassNames,cn=e=>{const{fromClient:t}=e.payload,r=["message"];return"info"===e.type?r.push("message--source-info"):t?r.push("message--source-user"):r.push("message--source-agent"),r};function ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function un(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ln(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ln(e,t):void 0}}(e,t)||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.")}()}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function dn(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?dn(t):t)}),[])}function hn(e){var t={};return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var i=n.length?n.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(t,i))return t[i];var s=e.apply(void 0,n);return t[i]=s,s}}function yn(e){for(var t=function(e){return/\s/.test(e)},r=[],n={},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=bn(e,a);if(-1===l)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));n[i]=e.slice(a+1,l),a=l,i=null}else i&&(r.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&r.push(i),{args:r,cases:n}}function bn(e,t){for(var r=0,n=t+1;n<e.length;n++){var o=e.charAt(n);if("}"===o){if(0===r)return n;r--}else"{"===o&&r++}return-1}function mn(e){return gn(e.slice(1,-1),",",3)}function gn(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return n;if(1===r)return n.push(e),n;var o=e.indexOf(t);if(-1===o)return n.push(e),n;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return n.push(i),gn(s,t,r-1,n)}var vn;function On(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?On(Object(r),!0).forEach((function(t){B(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):On(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wn=0,_n="other";function En(e,t){for(var r=0,n="",o=0,i={};r<e.length;){if("#"!==e[r]||o)n+=e[r];else{var s="__hashToken".concat(wn++);n+="{".concat(s,", number}"),i[s]=t}"{"===e[r]?o++:"}"===e[r]&&o--,r++}return{caseBody:n,numberValues:i}}var xn="other";const Sn=new(function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pn(this,e),B(this,"format",hn((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return dn(r.process(e,t)).join("")}))),this.locale=t,this.typeHandlers=n}var t,r;return t=e,r=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var r=e.indexOf("{");if(-1!==r){var n=bn(e,r);if(-1===n)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var o=e.substring(r,n+1);if(o){var i=[],s=e.substring(0,r);s&&i.push(s);var a=mn(o),c=un(a,3),l=c[0],u=c[1],p=c[2],f=t[l];null==f&&(f="");var d=u&&this.typeHandlers[u];i.push(d?d(f,p,this.locale,t,this.process.bind(this)):f);var h=e.substring(n+1);return h&&i.push(this.process(h,t)),i}}return[e]}}],r&&fn(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}())("en-GB",{plural:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=yn(t),s=i.args,a=i.cases,c=parseInt(e);s.forEach((function(e){e.startsWith("offset:")&&(c-=parseInt(e.slice("offset:".length)))}));var l=[];if("PluralRules"in Intl){void 0!==vn&&vn.resolvedOptions().locale===r||(vn=new Intl.PluralRules(r));var u=vn.select(c);u!==_n&&l.push(u)}1===c&&l.push("one"),l.push("=".concat(c),_n);for(var p=0;p<l.length;p++){var f=l[p];if(f in a){var d=En(a[f],c),h=d.caseBody,y=d.numberValues;return o(h,jn(jn({},n),y))}}return e},select:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,o=yn(t),i=o.cases;return e in i?n(i[e],r):xn in i?n(i.other,r):e}});function Tn(){const e=ee(Mt),t=ee(Ft),r=ee(Ut);return{t:(0,i.useCallback)(((r,n={})=>{const o=e[r];return o?Sn.format(o,n):(console.warn(`Translation key: ${r} is missing in locale: ${t}`),null)}),[e,t]),locale:t,initialLocale:r}}function Pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Cn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pn(Object(r),!0).forEach((function(t){An(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function An(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const In={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},Nn=Rt({[Bt]:(e,{locale:t})=>Cn(Cn({},e),{},{initialLocale:t}),[$t.pending]:e=>Cn(Cn({},e),{},{isLoading:!0}),[$t.fulfilled]:(e,{payload:t,meta:{arg:r}})=>Cn(Cn({},e),{},t?{isLoading:!1,locale:r,translations:Object.keys(t).sort().reduce(((e,r)=>Cn(Cn({},e),{},{[r]:t[r]})),{})}:{isLoading:!1}),[$t.rejected]:e=>Cn(Cn({},e),{},{isLoading:!1}),[Hr.pending]:()=>In},In),{SET_SEAMLY_CONTAINER_ELEMENT:Dn}=He,kn=e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{const t="string"==typeof e?document.getElementById(e):e;ve(t)}))}))},Rn=()=>{const{seamlyContainerElement:e}=ir(),t=sn();return[e,(0,i.useCallback)((e=>{t({type:Dn,element:e})}),[t])]},Ln=e=>(0,i.useCallback)((()=>{kn(e)}),[e]),Mn=()=>{const e=pr();return Ln(e)};function Un(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Un(Object(r),!0).forEach((function(t){Bn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Un(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_USER_SELECTED_OPTION:Hn,SET_USER_SELECTED_OPTIONS:$n,SHOW_OPTION:zn,HIDE_OPTION:Vn}=He,qn=()=>{const{t:e}=Tn(),{options:t}=ir(),{panelActive:r,optionActive:n,userSelectedOptions:o,features:s}=t,{cobrowsing:a,sendTranscript:c}=s,l={cobrowsing:a,sendTranscript:c},u=Object.keys(l).filter((e=>l[e])).map((t=>({name:t,title:e(`options.${t}.menuTitle`),available:l[t].enabled}))),p=a||c,f=sn(),{get:d,set:h}=rn();return{allowOptionSelection:p,userSelectedOptions:o,features:s,menuOptions:u,initUserSelectedOptions:(0,i.useCallback)((()=>{const e=d("options")||{};f({type:$n,options:e})}),[d,f]),setUserSelectedOptions:(0,i.useCallback)((e=>{f({type:$n,options:e}),h("options",e)}),[h,f]),setUserSelectedOption:(0,i.useCallback)(((e,t)=>{const r=d("options")||{};h("options",Fn(Fn({},r),{},{[e]:t})),f({type:Hn,option:e,value:t})}),[f,d,h]),showOption:e=>{f({type:zn,optionName:e})},hideOption:()=>{f({type:Vn})},panelActive:r,optionActive:n}},Wn=()=>{const{optionsButtonId:e}=ir();return{id:e,focusButton:Ln(e)}},Gn=(0,e.createContext)({});function Kn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kn(Object(r),!0).forEach((function(t){Jn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Jn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{CLEAR_ALL_UPLOADS:Qn}=He,Xn=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:r},options:{features:{uploads:n}}}=ir(),{allowedMimeTypes:o,maxSize:i}=r.upload||{},{enabled:s,enabledFromEntry:a}=n||{},{allowedMimeTypes:c,maxSize:l}=Yn(Yn(Yn({},t.upload||{allowedMimeTypes:[],maxSize:0}),o?{allowedMimeTypes:o}:{}),i?{maxSize:i}:{});return{showFileUpload:e,accountAllowsUploads:!!n,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:l}},Zn=()=>{const{currentUploads:e}=ir(),t=sn(),r=(0,i.useContext)(Gn);return{uploadFile:(0,i.useCallback)((e=>{r(e)}),[r]),clearUploads:(0,i.useCallback)((()=>{t({type:Qn})}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},eo=T(Mr,(({error:e})=>e));function to(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ro(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?to(Object(r),!0).forEach((function(t){no(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):to(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function no(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oo(){const{t:e}=Tn(),t=ee(eo);return{hasInterrupt:Boolean(t),meta:(0,i.useMemo)((()=>{if(!t)return{};const{langKey:r,action:n}=t,o=e(`${r}.title`),i=e(`${r}.message`),s=e(`${r}.srText`),a=e(`${r}.buttonText`);return ro(ro(ro(ro({},r?{title:o,message:i,srText:s}:{}),n?{action:n}:{}),n&&r?{buttonText:a}:{}),{},{originalError:t})}),[e,t]),error:t}}class io extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class so extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class ao extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}class co extends Dr{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const lo=[io,so,kr,ao,co,Nr];function uo({api:e}){return()=>t=>r=>{const{error:n}=r;if(n){if(!lo.some((e=>n instanceof e)))throw n;"reset"===n.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(r)}}function po(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?po(Object(r),!0).forEach((function(t){ho(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):po(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ho(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yo={error:void 0},bo=(e,{error:t})=>fo(fo({},e),{},{error:t}),mo=Lr({[Ur]:bo,[Hr.rejected]:bo,[Fr]:()=>yo,[Hr.pending]:()=>yo},yo);function go(){return ee(er)}const vo=()=>{const e=Z(),t=ee(wr);return{isVisible:!!t&&t!==C.hidden,isOpen:t===C.open,isMinimized:t===C.minimized,visible:t,setVisibility:(0,i.useCallback)((t=>e(Ar(t))),[e])}},Oo=()=>{const e=Z(),{connectWhenInView:t}=re(),r=ee(_r),{containerRef:n,isVisible:o}=(({freezeOnceVisible:e=!1,enabled:t=!0})=>{const[r,n]=(0,i.useState)(null),o=(0,i.useRef)(null),s=!(null==r||!r.isIntersecting)||!t,a=s&&e,c=([e])=>n(e);return(0,i.useEffect)((()=>{const e=null==o?void 0:o.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()}),[t,a]),{isVisible:s,containerRef:o}})({enabled:t,freezeOnceVisible:!0});return(0,i.useEffect)((()=>{o&&e(Pr())}),[e,o]),{containerRef:n,showInlineView:r}};function jo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jo(Object(r),!0).forEach((function(t){_o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Eo={visibility:C.initialize,showInlineView:!1},xo=vr({[Tr]:(e,{visibility:t})=>wo(wo({},e),{},{visibility:t}),[Ar.fulfilled]:(e,{payload:t})=>t?wo(wo({},e),{},{visibility:t}):e,[Pr]:e=>wo(wo({},e),{},{showInlineView:!0})},Eo),So=()=>{const[e]=(0,i.useState)((()=>s()));return e},To=e=>{const t=(0,i.useRef)();t.current=e;const r="function"==typeof e;return(0,i.useMemo)((()=>r?(...e)=>t.current(...e):void 0),[r])};function Po(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Co(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Po(Object(r),!0).forEach((function(t){Ao(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Po(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ao(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{ADD_EVENT:Io,SET_INITIAL_STATE:No}=He,Do=()=>{const e=tn(),t=re(),r=sn(),n=(0,i.useContext)(en),o=go(),a=on(),{visible:c,setVisibility:l}=vo(),u=ur(),p=(0,i.useCallback)(((...e)=>{n.emit(...e)}),[n]),f=To((()=>{e.sendContext(t.context||{}),p("ui.beforeStart",{visibility:c,hasConversation:a,hasResponded:o,unreadMessageCount:u}),e.send("start"),p("ui.start",{visibility:c,hasConversation:a,hasResponded:o,unreadMessageCount:u})})),d=(0,i.useCallback)((async()=>{r($r())}),[r]),h=(0,i.useCallback)((e=>({type:e,id:s(),transactionId:s(),participant:se,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),y=(0,i.useCallback)((e=>Co(Co({},h("text")),{},{body:{text:e}})),[h]),b=(0,i.useCallback)((({body:t,config:n={}})=>{if(""===t.trim())return;const o=Co(Co({},y(t)),n);e.send("message",o),p("message",o),r({type:Io,event:{type:"message",payload:Co(Co({},o),{},{optimisticallyInjected:!0})}})}),[e,r,p,y]),m=(0,i.useCallback)((e=>{r({type:Io,event:{type:"message",payload:y(e)}})}),[r,y]),g=(0,i.useCallback)(((e,t,n,o,i,s,a)=>{r({type:Io,event:{type:"message",payload:{type:"upload",id:e,transactionId:t,participant:se,fromClient:!0,occurredAt:n,meta:{},body:{contentType:o,filename:i,filesize:s,url:a}}}})}),[r]),v=(0,i.useCallback)((e=>{const t={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:s(),transactionId:s(),type:"divider"};r({type:Io,event:{type:"info",payload:t}})}),[r]),O=(0,i.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:r}=t;r!==Ie&&r!==Ne&&p(`action.${r}`,t)}),[e,p]),j=(0,i.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,i.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(r({type:No,initialState:e}),e.userResponded&&(r(Br(e.userResponded)),l(C.open)))})).catch((e=>{r(Ur(e))}))),[e,r,l]);return{connect:w,start:f,sendMessage:b,sendAction:O,sendContext:j,reset:d,emitEvent:p,addMessageBubble:m,addUploadBubble:g,addDivider:v,apiConnected:e.connected,apiConfigReady:e.configReady}},ko=(0,e.createContext)(null),Ro=()=>{const e=(0,i.useContext)(ko);return{sendPolite:(0,i.useCallback)((t=>{e({ariaLive:Ue,messageText:t})}),[e]),sendAssertive:(0,i.useCallback)((t=>{e({ariaLive:Me,messageText:t})}),[e])}},Lo=(0,e.createContext)(null),Mo=()=>(0,i.useContext)(Lo);function Uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_BLOCK_AUTO_ENTRY_SWITCH:Bo,SET_ACTIVE_ENTRY_TYPE:Ho,SET_USER_ENTRY_TYPE:$o}=He,zo=()=>{const{default:e,active:t,userSelected:r,options:n,optionsOverride:o}=ir().entryMeta,s=sn(),a=r||t||e,c=o[a]||n[a]||{},l=(0,i.useCallback)((e=>{s({type:Bo,value:e})}),[s]),u=(0,i.useCallback)((e=>{s({type:Ho,entryType:e})}),[s]),p=(0,i.useCallback)((e=>{s({type:$o,entryType:e})}),[s]),f=(0,i.useCallback)((()=>{r?p(null):u(e)}),[r,e,p,u]);return{activeEntry:a,activeEntryOptions:c,setActiveEntryType:u,setUserEntryType:p,cancelEntrySelection:f,setBlockAutoEntrySwitch:l}},{SET_IS_LOADING:Vo}=He,qo=()=>{const{t:e}=Tn(),{isInline:t,isWindow:r}=yr(),{isOpen:n,isVisible:o,setVisibility:s}=vo(),a=ee(_r),c=sn(),l=cr(),u=(0,i.useRef)(null),{start:p,connect:f,apiConfigReady:d,apiConnected:h}=Do(),y=on(),b=(0,i.useRef)(null),m=(0,i.useRef)(null),g=(0,i.useRef)(!1),{sendAssertive:v}=Ro(),O=l.length>0;(0,i.useEffect)((()=>{o&&setTimeout((()=>{v(e("window.srTexts.onLoad"))}),500)}),[o,v,e]),(0,i.useEffect)((()=>{if(o!==m.current)return b.current=n,void(m.current=o);null!==b.current&&v(e(n?"window.srTexts.onOpen":"window.srTexts.onClose")),b.current=n,m.current=o}),[n,o,v,e]),(0,i.useEffect)((()=>{u.current=setTimeout((()=>{c({type:Vo,isLoading:!0})}),500)}),[c]),(0,i.useEffect)((()=>{O&&(clearTimeout(u.current),c({type:Vo,isLoading:!1}))}),[O,c]),(0,i.useEffect)((()=>{d&&h||(g.current=!1)}),[d,h]);const j=(0,i.useCallback)((async()=>{h||await f(),(n||o&&t)&&(p(),g.current=!0)}),[h,f,t,n,o,p]);return(0,i.useEffect)((()=>{!d||g.current||r&&!n&&!y||t&&!a||(y&&n&&(clearTimeout(u.current),c({type:Vo,isLoading:!1})),j())}),[d,j,c,y,t,n,r,a]),{openChat:()=>{s(C.open)},closeChat:()=>{s(C.minimized)}}};function Wo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Go(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wo(Object(r),!0).forEach((function(t){Ko(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ko(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{CLEAR_IDLE_DETACH_COUNTDOWN:Yo,INIT_IDLE_DETACH_COUNTDOWN:Jo,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:Qo,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:Xo}=He,Zo=()=>{const e=sn(),{idleDetachCountdown:t}=ir(),{isOpen:r}=vo(),n=(0,i.useRef)({});n.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:r};const{emitEvent:o,sendAction:s}=Do(),{t:a}=Tn(),{sendAssertive:c,sendPolite:l}=Ro(),u=(0,i.useCallback)((e=>{const{isOpen:t}=n.current;t&&c(e)}),[c]),p=(0,i.useCallback)((e=>{const{isOpen:t}=n.current;t&&l(e)}),[l]),f=(0,i.useCallback)((t=>{const r=(e=>Math.ceil(e/1e3))(t),n=fe(r);e({type:Jo,delaySeconds:r,delayTime:n}),o("idleTimer.start"),u(`${a("idleDetachWarning.countdownTitle")} ${a("idleDetachWarning.countdownText")} ${a("idleDetachWarning.countdownTimer",n)}`)}),[e,o,u,a]),d=(0,i.useCallback)(((t,r)=>{const{hasCountdown:i,wasStopped:c}=n.current;i&&(t||(r||s({type:De}),u(a("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e({type:Yo}))}),[e,s,o,u,a]),h=(0,i.useCallback)((()=>{const{remaining:t}=n.current;if(t<=0)return;const r=t-1;r%10==0&&u(`${a("idleDetachWarning.countdownText")} ${a("idleDetachWarning.countdownTimer",fe(r))}`),e({type:Qo})}),[e,u,a]),y=(0,i.useCallback)((()=>{const{isActive:t,remaining:r}=n.current;t&&(e({type:Xo}),r&&(o("idleTimer.stop"),p(a("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,p,a]);return Go(Go({},t),{},{initCountdown:f,endCountdown:d,decrementCountdown:h,stopCountdown:y})},{CLEAR_RESUME_CONVERSATION_PROMPT:ei}=He,ti=()=>{const e=sn(),t=ir().resumeConversationPrompt,{sendAction:r}=Do(),{t:n}=Tn(),{sendAssertive:o}=Ro();return{continueChat:()=>{r({type:"dismiss",body:{type:"resume_conversation_prompt"}}),e({type:ei})},hasPrompt:t,restartChat:()=>{o(n("resumeConversationPrompt.srNotifyRestartText")),r({type:De}),e({type:ei})}}},ri=(e,t)=>{const r=tn();(0,i.useEffect)((()=>{r.stream&&(t?r.stream().filter(t).subscribe({next:e}):r.stream().subscribe({next:e}))}),[r,e,t])};function ni(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ni(Object(r),!0).forEach((function(t){ii(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ni(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ii(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const si=Xt({[Br]:(e,{hasResponded:t})=>oi(oi({},e),{},{userHasResponded:t})},{userHasResponded:!1}),ai=(e,t)=>(r,n)=>n[e]||t,ci=qt,li=T(ci,(e=>e.originalPayloadIds)),ui=T(li,ai("payloadId"),((e,t)=>!e.includes(t)));function pi(){const{sendAction:e}=Do(),t=Z(),r=To((r=>{e({type:Re,body:{enabled:!0,locale:r}}),t(Wt(r))})),n=To((()=>{e({type:Re,body:{enabled:!1}}),t(Gt())})),{languages:o,isActive:i,isAvailable:s,currentLocale:a}=ee(ci,[]);return{languages:o,isActive:i,isAvailable:s,currentLocale:a,enableTranslations:r,disableTranslations:n}}function fi({payload:e}={}){var t,r,n;const o=null==e?void 0:e.id;let i,s;"participant"===(null==e?void 0:e.type)?(i=e.participant.introduction,s=e.participant.translatedIntroduction):(i=null==e?void 0:e.body,s=null==e?void 0:e.translatedBody);const a=!!s,c=te(ui,{payloadId:o},[o]),l=Z(),u=To((()=>{l(c?Yt(o):Kt(o))}));return[a&&c?null===(t=s)||void 0===t?void 0:t.data:i,{hasTranslation:a,isTranslated:c&&a,toggleTranslation:u,translatedBy:null===(r=s)||void 0===r?void 0:r.translatedBy,locale:null===(n=s)||void 0===n?void 0:n.locale}]}function di(){const e=ee(ci,[]).containerId;return{id:e,focusContainer:Ln(e)}}function hi(e){const{languages:t}=pi();return(0,i.useMemo)((()=>{var r;return null==t||null===(r=t.find((t=>t.locale===e)))||void 0===r?void 0:r.nativeName}),[e,t])}function yi({dispatch:e,getState:t}){return r=>n=>{var o,i,s,a,c,l,u;const p=r(n);switch(n.type){case String(He.SET_HISTORY):null!==(o=n.history)&&void 0!==o&&null!==(i=o.translation)&&void 0!==i&&i.enabled&&(e(Wt(n.history.translation.locale)),e($t(n.history.translation.locale)));break;case String(He.SET_INITIAL_STATE):null!==(s=n.initialState)&&void 0!==s&&null!==(a=s.translation)&&void 0!==a&&a.enabled&&(e(Wt(n.initialState.translation.locale)),e($t(n.locale)));break;case String(He.ADD_EVENT):"info"===n.event.type&&"new_translation"===(null===(c=n.event)||void 0===c||null===(l=c.payload)||void 0===l||null===(u=l.body)||void 0===u?void 0:u.subtype)&&n.event.payload.body.translationEnabled&&e($t(n.event.payload.body.translationLocale));break;case String(Gt):const r=Ut(t());e($t(r))}return p}}function bi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function mi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(r),!0).forEach((function(t){gi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function gi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vi={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],originalPayloadIds:[],containerId:s()},Oi=Vt({[He.SET_FEATURES]:(e,t)=>{var r;const n=null==t||null===(r=t.features)||void 0===r?void 0:r.translation;return n?mi(mi({},e),{},{isAvailable:!0===n.enabled,languages:n.languages||[]}):e},[He.CLEAR_FEATURES]:()=>vi,[Wt]:(e,{locale:t})=>mi(mi({},e),{},{isActive:!0,currentLocale:t}),[Gt]:e=>mi(mi({},e),{},{isActive:!1,currentLocale:void 0}),[Kt]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?mi(mi({},e),{},{originalPayloadIds:e.originalPayloadIds.filter((e=>e!==t))}):e,[Yt]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?e:mi(mi({},e),{},{originalPayloadIds:[...e.originalPayloadIds,t]}),[Hr.pending]:()=>vi},vi),ji={send32:'<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>',balloon32:'<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>',newTopic32:'<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>',newTranslation16:'<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>',newTranslation32:'<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>',avatar32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#003A5D" d="M0,4.717C0,2.112,2.112,0,4.717,0h22.566C29.888,0,32,2.112,32,4.717v22.566C32,29.887,29.888,32,27.283,32 H4.717C2.113,32,0,29.887,0,27.283V4.717z"/><path fill="#FFF" d="M10.103,14.901c-1.107,0-2.004-0.897-2.004-2.004s0.897-2.005,2.004-2.005c1.107,0,2.005,0.897,2.005,2.005 C12.108,14.004,11.211,14.901,10.103,14.901z M16,14.901c1.107,0,2.005-0.897,2.005-2.004S17.108,10.892,16,10.892 c-1.108,0-2.005,0.897-2.005,2.005C13.995,14.004,14.892,14.901,16,14.901z M21.896,10.892c-1.106,0-2.004,0.897-2.004,2.005 c0,1.107,0.896,2.004,2.004,2.004c1.109,0,2.005-0.897,2.005-2.004C23.901,11.789,23.005,10.892,21.896,10.892z M21.408,18.207 H10.783C11.83,23.973,20.361,23.973,21.408,18.207z"/></svg>',chevronDown8:'<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>',chevronDown32:'<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>',chevronRight8:'<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>',chevronRight16:'<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>',close8:'<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>',close16:'<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>',enlarge32:'<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>',options32:'<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>',file32:'<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>',upload32:'<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>',download16:'<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>',error16:'<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>',arrowLeft16:'<?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',arrowRight16:'<?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'},wi=({name:e,size:t="32",className:r,alt:n})=>{const o=`${e}${t}`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{"aria-hidden":"true",className:r||Xr("icon"),dangerouslySetInnerHTML:{__html:ji[o]}}),n&&(0,U.jsx)("span",{className:Xr("visually-hidden"),children:n})]})},_i={visible:Xr("transition--visible"),in:Xr("transition--in"),visuallyHidden:Xr("visually-hidden")},Ei=Object.values(_i),xi="notRendered",Si="rendered",Ti="visuallyHidden",Pi=({children:t,isActive:r,timeout:n,transitionStartState:o="notRendered",onInTransitionComplete:s,onOutTransitionComplete:a})=>{const c=(0,i.useRef)(!1),l=n?parseInt(n,10):300,u=To(s),p=To(a),f=o===Ti,[d,h]=(0,i.useState)((()=>f?[_i.visuallyHidden]:[])),y="notRendered"!==o||d.length>0;return(0,i.useEffect)((()=>{let e=null,t=null;return c.current&&!r&&(h([_i.visible]),e=setTimeout((()=>{h([...f?[_i.visuallyHidden]:[]]),p&&(t=requestAnimationFrame((()=>{p()})))}),l)),!c.current&&r&&(h([_i.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{h([_i.visible,_i.in]),u&&(e=setTimeout((()=>{u()}),l))}))}))),c.current=r,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[r,f,l,u,p]),y&&(0,e.toChildArray)(t).map((t=>{const{className:r=""}=t.props,n=r.split(" ").filter((e=>!Ei.includes(e)));return(0,e.cloneElement)(t,{className:[...n,...d].join(" ")})}))},Ci=({className:e,children:t,onCancel:r,headingText:n,cancelButtonText:o,disableButtonFocusing:s,cancelButtonRef:a,position:c="right"})=>{const l=(0,i.useRef)(null),u=So(),{hideOption:p}=qn(),{focusButton:f}=Wn();return(0,i.useEffect)((()=>{ve(l.current)}),[]),(0,U.jsx)("section",{className:Xr("options",{"options--right":"left"!==c,"options--left":"left"===c},e),"aria-labelledby":u,tabIndex:"-1",ref:l,children:(0,U.jsxs)("div",{className:Xr("options__body"),children:[(0,U.jsx)("h2",{id:u,className:Xr("options__title"),children:n}),(0,U.jsxs)("button",{type:"button",onClick:()=>{r&&r(),p(),s||f()},"aria-describedby":u,className:Xr("button","options__close"),ref:e=>{a&&(a.current=e)},children:[(0,U.jsx)(wi,{name:"close",size:"16"}),(0,U.jsx)("span",{children:o})]}),(0,U.jsx)("div",{className:Xr("options__wrapper"),children:t})]})})},{createActions:Ai,createReducer:Ii,selectState:Ni}=h("forms"),[Di,ki]=Ai("form",{register:(e,t)=>({formId:e,persistData:t}),deregister:e=>({formId:e})}),[Ri,Li,Mi,Ui]=Ai("control",{register:(e,t)=>({formId:e,name:t}),deregister:(e,t)=>({formId:e,name:t}),updateValue:(e,t,r)=>({formId:e,name:t,value:r}),updateTouched:(e,t,r)=>({formId:e,name:t,touched:r})}),Fi=T(Ni,ai("formId"),((e,t)=>e[t])),Bi=T(Fi,(e=>(null==e?void 0:e.controls)||{})),Hi=T(Bi,(e=>{const t={};return Object.entries(e).forEach((([e,{value:r}])=>{t[e]=r})),t})),$i=T(Bi,ai("name"),((e,t)=>{var r;return null===(r=e[t])||void 0===r?void 0:r.value})),zi=T(Bi,ai("name"),((e,t)=>{var r;return null===(r=e[t])||void 0===r?void 0:r.touched})),Vi=(0,e.createContext)({}),qi=Vi,{Provider:Wi,Consumer:Gi}=Vi;function Ki(){return(0,i.useContext)(qi)}function Yi(e){const t=Z(),{formId:r,updateControlValue:n,updateControlTouched:o,errors:s}=Ki(),a=!!te(Fi,{formId:r},[r]),c=(0,i.useRef)();c.current=a;const l=te($i,{formId:r,name:e},[r,e]),u=te(zi,{formId:r,name:e},[r,e]),p=null==s?void 0:s[e],f=!p;(0,i.useEffect)((()=>{c.current&&t(Ri(r,e))}),[a,r,e,t]),(0,i.useLayoutEffect)((()=>()=>{t(Li(r,e))}),[a,r,e,t]);const d=(0,i.useCallback)((t=>n(e,t.target.value)),[e,n]),h=(0,i.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,i.useMemo)((()=>({name:e,onInput:d,onBlur:h,value:l})),[e,d,h,l]),(0,i.useMemo)((()=>({isValid:f,error:p,touched:u})),[f,p,u])]}const Ji=["children","formId","persistData","onError","onSubmit","validationSchema"];function Qi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qi(Object(r),!0).forEach((function(t){Zi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Zi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function es(e){let{children:t,formId:r,persistData:n,onError:o,onSubmit:s,validationSchema:a}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Ji);const l=Z(),u=te(Hi,{formId:r},[r]),[p,f]=(0,i.useState)(!1),[d,h]=(0,i.useState)({}),{isValid:y,errors:b}=function(e,t){const r=(0,i.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[r,n])=>{n&&!Array.isArray(n)&&(n=[n]);for(let i=0;i<(null===(o=n)||void 0===o?void 0:o.length);i++){var o;if(!n[i].fn(e[r],n[i].compareValue)){t[r]=n[i].errorText;break}}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(r).length,errors:r}}(u,a),m=(0,i.useMemo)((()=>Xi(Xi({},b),d)),[b,d]);(0,i.useLayoutEffect)((()=>{l(Di(r,n))}),[r,n,l]),(0,i.useEffect)((()=>()=>{l(ki(r))}),[r,n,l]);const g=(0,i.useCallback)(((e,t)=>{l(Mi(r,e,t))}),[r,l]),v=(0,i.useCallback)(((e,t)=>{l(Ui(r,e,t))}),[l,r]),O=(0,i.useCallback)(((e,t)=>{h((r=>Xi(Xi({},r),{},{[e]:t})))}),[h]),j=(0,i.useCallback)((e=>{var t;e.preventDefault();const r="true"===(null===(t=e.submitter)||void 0===t?void 0:t.ariaDisabled);f(!r),!r&&y&&(l(Br(!0)),s(u,{updateControlValue:g,setError:O}))}),[y,l,s,u,g,O]);(0,i.useEffect)((()=>{o&&o({errors:m,isSubmitted:p,isValid:0===Object.keys(m).length})}),[p,m,o]);const w=(0,i.useMemo)((()=>({formId:r,values:u,errors:m,isValid:0===Object.keys(m).length,isSubmitted:p,handleSubmit:j,validationSchema:a,updateControlValue:g,updateControlTouched:v})),[r,u,m,p,j,a,g,v]);return r?s?(0,U.jsx)(Wi,Xi(Xi({},c),{},{value:w,children:t})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}function ts(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ts(Object(r),!0).forEach((function(t){ns(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ts(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ns(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const os={},is={controls:{}},ss={value:"",touched:!1};function as(e,t,r,n){var o;const i=(null===(o=e[t])||void 0===o?void 0:o.controls[r])||ss;return rs(rs({},e),{},{[t]:rs(rs({},e[t]),{},{controls:rs(rs({},e[t].controls),{},{[r]:rs(rs({},i),n)})})})}const cs=Ii({[Di]:(e,{formId:t,persistData:r})=>{const n=r?e[t]??rs(rs({},is),{},{persistData:r}):rs(rs({},is),{},{persistData:r});return rs(rs({},e),{},{[t]:n})},[ki]:(e,{formId:t})=>{var r;const n=rs({},e);return null!==(r=n[t])&&void 0!==r&&r.persistData||delete n[t],n},[Ri]:(e,{name:t,formId:r})=>as(e,r,t),[Li]:(e,{formId:t,name:r})=>{const n=e[t];if(!n)return e;if(n.persistData)return e;const o=rs({},n.controls);return delete o[r],rs(rs({},e),{},{[t]:rs(rs({},n),{},{controls:o})})},[Mi]:(e,{formId:t,name:r,value:n})=>as(e,t,r,{value:n}),[Ui]:(e,{formId:t,name:r,touched:n})=>as(e,t,r,{touched:n}),[Hr.pending]:()=>os},os),{REGISTER_FORM:ls,DE_REGISTER_FORM:us,REGISTER:ps,DE_REGISTER:fs,SET_VALUE:ds,SET_VALIDITY:hs,SET_STATE:ys,SET_SUBMITTED:bs,SET_PERSIST_FORM_DATA:ms}={REGISTER_FORM:"REGISTER_FORM",DE_REGISTER_FORM:"DE_REGISTER_FORM",REGISTER:"REGISTER",DE_REGISTER:"DEREGISTER",SET_VALUE:"SET_VALUE",SET_VALIDITY:"SET_VALIDITY",SET_STATE:"SET_STATE",SET_SUBMITTED:"SET_SUBMITTED",SET_PERSIST_FORM_DATA:"SET_PERSIST_FORM_DATA"},gs=(e,t,r=null)=>({fn:e,errorText:t,compareValue:r}),vs=(e,t)=>{let r=!0;for(let n=0;n<e.length;n++)e[n].size>t&&(r=!1);return r},Os=e=>!(null==e||!e.length)>0,js=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))},ws=e=>!!e,_s=["className","disableValidationClasses"];function Es(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ss=function(e){let{className:t,disableValidationClasses:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,_s);const{handleSubmit:o,isValid:i,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:r}=Ki();return{handleSubmit:e,isSubmitted:t,isValid:r}}(),a=["form"];return!r&&s&&(a.push("form--submitted"),i?a.push("form--valid"):a.push("form--invalid")),(0,U.jsx)("form",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Es(Object(r),!0).forEach((function(t){xs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Es(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({onSubmit:o,className:Xr([...a,t])},n))};function Ts({id:e,error:t}){const[r,n]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{const e=setTimeout((()=>n(!0)),300);return()=>clearTimeout(e)}),[]),(0,U.jsx)("div",{className:Xr("error"),"aria-live":"assertive","aria-atomic":"true",children:r&&t&&(0,U.jsxs)("span",{id:e,className:Xr("error__message"),children:[(0,U.jsx)(wi,{name:"error",size:"16"}),t]})})}const Ps=({contentHint:e,id:t,labelText:r,labelClass:n=Xr("label"),validity:o,errorText:i,children:s})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("label",{htmlFor:t,className:n,children:r}),e&&(0,U.jsx)("span",{id:`${t}-content-hint`,className:Xr("input__content-hint"),children:e}),(0,U.jsx)(Ts,{id:`${t}-error`,error:!o&&i}),s]}),Cs=["id","name","labelText","labelClass","contentHint","aria-describedby","options"];function As(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Is(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?As(Object(r),!0).forEach((function(t){Ns(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):As(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ns(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ds=e=>{let{id:t,name:r,labelText:n,labelClass:o,contentHint:i,"aria-describedby":s,options:a=[]}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Cs);const{isSubmitted:l}=Ki(),[u,{error:p}]=Yi(r),f=l&&p,d=[];return s&&d.push(s),i&&d.push(`${t}-content-hint`),f&&d.push(`${t}-error`),(0,U.jsx)(Ps,{id:t,contentHint:i,validity:!f,errorText:p,labelText:n,labelClass:o,children:(0,U.jsx)("select",Is(Is(Is({id:t,name:r,"aria-invalid":f?"true":"false","aria-describedby":d.join(" ")||null},u),c),{},{children:a.map((e=>(0,U.jsx)("option",{value:e.value,children:e.label},e.value)))}))})},ks=function({controlName:e,descriptionId:t}){const{t:r}=Tn(),{isActive:n,languages:o,currentLocale:s}=pi(),{locale:a}=Tn(),c=hi(s),l=(0,i.useMemo)((()=>[{value:"",label:r("translations.settings.defaultOptionLabel")},...o.filter((e=>e.locale.toLowerCase()!==String(a).toLowerCase())).map((e=>({value:e.locale,label:e.nativeName})))]),[r,o,a]);return(0,U.jsxs)(Ss,{noValidate:"true",className:Xr("options__form"),children:[(0,U.jsx)("p",{className:Xr("options__description"),id:t,children:r("translations.settings.description")}),n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("h3",{children:r("translations.settings.currentTranslationLabel")}),(0,U.jsx)("p",{className:Xr("options__active-language"),children:c})]}):(0,U.jsx)(Ds,{name:e,type:"text",className:Xr("input__select"),"aria-describedby":t,labelClass:Xr("label"),labelText:r("translations.settings.inputLabel"),options:l,defaultValue:s||""}),(0,U.jsx)("div",{className:Xr("options__actions"),children:(0,U.jsx)("button",{type:"submit",className:Xr("button","button--primary","options__submit"),children:r(n?"translations.settings.endButtonText":"translations.settings.startButtonText")})})]})},Rs="translation-settings",Ls="locale",Ms=function({onClose:e}){const[t,r]=(0,i.useState)(void 0),{t:n}=Tn(),{isActive:o,enableTranslations:s,disableTranslations:a}=pi(),c=So(),{focusContainer:l}=di(),u=(0,i.useCallback)((({isValid:e,isSubmitted:t})=>{r(t&&!e?"options--error":void 0)}),[r]),p=(0,i.useRef)(0),f=(0,i.useMemo)((()=>(p.current+=1,o?{}:{[Ls]:gs(ws,n("translations.settings.noLocaleText"))})),[o,n]);return(0,U.jsx)(Ci,{className:t,onCancel:e,formName:Rs,headingText:n("translations.settings.title"),cancelButtonText:n("translations.settings.cancelButtonText"),position:"left",disableButtonFocusing:!0,children:(0,U.jsx)(es,{onSubmit:({locale:t})=>{o?a():(s(t),e(),l())},formId:Rs,validationSchema:f,onError:u,children:(0,U.jsx)(ks,{controlName:Ls,descriptionId:c})},p.current)})};function Us(){const{t:e,locale:t}=Tn(),[r,n]=(0,i.useState)(!1),o=(0,i.useRef)(null),s=So(),a=hi(t);return(0,U.jsxs)("div",{className:Xr("translations__container"),onKeyDown:e=>{r&&ge(e)===me.Escape&&(n(!1),ve(o.current))},children:[(0,U.jsx)(Pi,{transitionStartState:xi,isActive:r,children:(0,U.jsx)("div",{className:Xr("options__dialog"),role:"dialog",children:(0,U.jsx)(Ms,{onClose:()=>{n(!1)}})})}),(0,U.jsxs)("button",{type:"button",className:Xr(["button","button--secondary","chat__options__button"]),id:s,onClick:()=>{n((e=>!e))},onKeyDown:e=>{ge(e)===me.ArrowDown&&(n(!0),e.preventDefault())},ref:o,"aria-haspopup":"dialog","aria-expanded":r.toString(),children:[(0,U.jsx)(wi,{name:"newTranslation",size:"16"}),(0,U.jsx)("span",{className:Xr("button__text"),children:e("translations.settings.openButtonText",{hasLanguage:!!a,language:a})})]})]})}function Fs({id:e,label:t,onButtonClick:r,buttonText:n,srButtonText:o,type:i}){const s=So();return(0,U.jsxs)("section",{className:Xr("chat-status",i&&`chat-status--${i}`),id:e,tabIndex:"-1","aria-labelledby":s,children:[(0,U.jsx)("h2",{className:Xr("chat-status__title"),id:s,children:t}),(0,U.jsxs)("button",{type:"button",className:Xr("button","button--tertiary"),onClick:r,children:[(0,U.jsx)("span",{"aria-hidden":o?"true":void 0,children:n}),o&&(0,U.jsx)("span",{className:Xr("visually-hidden"),children:o})]})]})}function Bs(){const{t:e}=Tn(),{id:t}=di(),{hasInterrupt:r}=oo(),{isActive:n,disableTranslations:o,currentLocale:s}=pi(),a=hi(s),c=Mn(),l=(0,i.useCallback)((()=>{o(),c()}),[o,c]);return!n||r?null:(0,U.jsx)(Fs,{type:"translations",id:t,label:e("translations.status.label",{language:a}),onButtonClick:l,buttonText:e("translations.status.stopText"),srButtonText:e("translations.status.srStopText")})}const Hs=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,$s=({id:e,categories:t=[],question:r,onClick:n,hasIcon:o})=>{const s=(0,i.useMemo)((()=>["suggestions__item",...t.map(Hs)]),[t]),a=(0,i.useCallback)((()=>{n&&n({id:e,question:r})}),[e,r,n]);return(0,U.jsx)("li",{className:Xr(s),children:(0,U.jsxs)("button",{type:"button",onClick:a,className:Xr("button","button--primary"),children:[o&&(0,U.jsx)(wi,{name:"chevronRight",size:"8"}),r]})})};function zs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Vs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const qs=({className:e,suggestions:t=[],onClickSuggestion:r,hasIcon:n=!0})=>(0,U.jsx)("ul",{className:Xr("suggestions__list",e),children:t.map((e=>(0,U.jsx)($s,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zs(Object(r),!0).forEach((function(t){Vs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({hasIcon:n,onClick:r},e),e.id)))}),Ws=({isAside:e=!1})=>{const{isInline:t}=yr(),{t:r}=Tn(),{sendAction:n,addMessageBubble:o}=Do(),{isOpen:s,setVisibility:a}=vo(),c=So(),l=Mn(),u=(0,i.useRef)(null),{sendPolite:p}=Ro(),{hasInterrupt:f}=oo(),{hasCountdown:d,endCountdown:h}=Zo(),{hasPrompt:y,continueChat:b}=ti(),m=go(),g=hr("suggestion"),[v]=fi({payload:g}),O=(0,i.useMemo)((()=>g&&!f?v:[]),[g,f,v]),j=(0,i.useRef)(null),w=(0,i.useRef)(!1),_=(0,i.useRef)([]),E=!!O.length,x=t?(m||s)&&!e:m,S=(0,i.useRef)(x),T=E&&!x,P=E?O:_.current;_.current=P;const A=(0,i.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Xr(t)}),[e]),I=(0,i.useCallback)((({id:e,question:t})=>{d&&h(!0),y&&b(),n({type:Ae,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),o(t),s||a(C.open),l()}),[o,b,h,l,d,y,g,n,a,s]);(0,i.useEffect)((()=>{if(j.current!==O&&!x){if(E){const e=w.current?r("suggestions.srUpdatedText"):r("suggestions.srAvailableText");setTimeout((()=>{p(e)}),30)}else w.current&&p(r("suggestions.srUnavailableText"));j.current=O}!S.current&&x?(Oe(u.current,l),p(r("suggestions.srUnavailableText"))):!E&&w.current&&Oe(u.current,l),w.current=E,S.current=x}),[O,E,x,l,p,r]);const N=r("suggestions.headingText"),D=r("suggestions.footerText"),k=N?"section":"div";return(0,U.jsx)(Pi,{isActive:T,transitionStartState:xi,children:(0,U.jsxs)(k,{className:A,"aria-labelledby":N?c:null,ref:u,children:[N&&(0,U.jsx)("p",{id:c,className:Xr("suggestions__heading"),children:N}),!!P.length&&(0,U.jsx)(qs,{suggestions:P,onClickSuggestion:I}),D&&!s&&(0,U.jsx)("p",{className:Xr("suggestions__footer"),children:D})]})})},Gs=(0,Qr.forwardRef)((({children:e,className:t=""},r)=>{const{isOpen:n,isVisible:o,setVisibility:i}=vo(),{namespace:s,layoutMode:a}=re(),{isInline:c}=yr(),l=an(),u=go(),{t:p}=Tn(),f=["chat",`chat--layout-${a}`,`namespace--${s}`,...l,t];return n||"app"===a||f.push("chat--collapsed"),u&&f.push("chat--user-responded"),o&&(0,U.jsxs)("section",{className:Xr(f),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&n&&i(C.minimized)},tabIndex:"-1",ref:r,"aria-label":p("chat.srLabel"),children:[(0,U.jsx)("div",{className:Xr("chat-wrapper"),children:e}),"inline"===a&&n&&(0,U.jsx)(Ws,{isAside:!0})]})})),Ks=({originalError:e,title:t,message:r,buttonText:n,action:o,srText:s})=>{const a=Do(),c=So(),{sendPolite:l}=Ro(),u=Mn(),p=e instanceof kr;return(0,i.useEffect)((()=>{p&&a[o]()}),[o,a,p]),(0,i.useEffect)((()=>{!p&&s&&setTimeout((()=>{l(s)}),200)}),[l,s,p]),!p&&(0,U.jsx)("section",{className:Xr("interrupt"),"aria-labelledby":c,children:(0,U.jsxs)("div",{className:Xr("interrupt__body"),children:[(0,U.jsx)("h2",{id:c,className:Xr("interrupt__title"),children:t}),(0,U.jsx)("p",{className:Xr("interrupt__message"),children:r}),n&&o&&(0,U.jsx)("div",{className:Xr("interrupt__actions"),children:(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{a[o](),u()},children:n})})]})})},Ys=()=>{const{t:e}=Tn(),{showDisclaimer:t}=re();return t&&(0,U.jsxs)("div",{className:Xr("disclaimer"),tabIndex:"0",children:[(0,U.jsx)("h2",{className:Xr("disclaimer__title"),children:e("disclaimer.title")}),(0,U.jsx)("div",{className:Xr("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]})},Js=(0,e.createContext)({}),Qs=e=>{const t=(0,i.useContext)(Js);let r=null;"choice_prompt"===e.payload.type&&(r=t[e.type][e.payload.body.prompt.type]);const n=t[e.type][e.payload.type]||t.fallback;return[n&&"function"!=typeof n?n[e.payload.body.type]||t.fallback:n,r]};function Xs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Zs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xs(Object(r),!0).forEach((function(t){ea(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ea(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ta({children:e,childrenHTML:t,className:r,graphicSrc:n,graphicType:o="icon",iconName:i,iconSize:s,iconClassName:a,dividerType:c}){const l=Boolean(i||n),u=t?{dangerouslySetInnerHTML:{__html:t}}:{children:e};return(0,U.jsxs)("div",{className:Xr("divider",c&&`divider--type-${c}`,r),children:[l&&(0,U.jsx)("span",{className:Xr("divider__graphic"),children:i?(0,U.jsx)(wi,{name:i,size:s,className:a}):(0,U.jsx)("img",{src:n,className:Xr({icon:"icon"===o,avatar:"avatar"===o},a)})}),(0,U.jsx)("div",Zs({className:Xr("divider__body")},u))]})}const ra={month:"long",day:"numeric",year:"numeric"},na={hour:"numeric",minute:"numeric"},oa=({event:e})=>{const t=(()=>{const[e,t]=(0,i.useReducer)((e=>e+1),0);return(0,i.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:r,time:n,timeUntilMidnight:o,srText:s}=(e=>{var t;const{t:r}=Tn(),n=re(),o=(null==n||null===(t=n.context)||void 0===t?void 0:t.locale)??[],i=new Date(e),s=new Date,a=new Date(s);a.setHours(24,0,0,0);const c=a-s,l=i.toString(),u=new Intl.DateTimeFormat(o,na).format(i);let p=((e,t)=>{const r=new Date(t).setHours(0,0,0,0),n=e.getTime(),o=864e5;return n>=r+o?e:n>r?"today":n>r-o?"yesterday":e})(i,s);switch(p){case"today":p=r("dateTime.today");break;case"yesterday":p=r("dateTime.yesterday");break;default:p=new Intl.DateTimeFormat(o,ra).format(i)}return{date:p,srText:r("dateTime.srText",{date:p,time:u}),time:u,fullDateTime:l,timeUntilMidnight:c}})(pe(e.timeIndicator));return(0,i.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,U.jsxs)(ta,{dividerType:"time-indicator",children:[(0,U.jsxs)("p",{className:Xr("divider__time"),"aria-hidden":"true",children:[(0,U.jsx)("span",{children:r}),(0,U.jsx)("span",{children:n})]}),(0,U.jsx)("p",{className:Xr("visually-hidden"),children:s})]})},ia=({event:e,newParticipant:t})=>{const[r,n]=Qs(e);if(!r)return null;const o=["conversation__item"];return"info"===e.type?o.push("conversation__item--source-info"):e.payload.fromClient?o.push("conversation__item--source-user"):o.push("conversation__item--source-agent"),t&&o.push("conversation__item--new-participant"),(0,U.jsxs)("li",{className:Xr(o),children:[e.timeIndicator&&(0,U.jsx)(oa,{event:e}),(0,U.jsx)(r,{event:e,children:(0,U.jsx)(n,{event:e})})]})},sa=({eventPayload:e})=>{const{t}=Tn(),{fromClient:r,participant:n}=e,o=(e=>ir().participantInfo.participants[e])(n)||{},{messages:i}=re(),s=r?t("participants.user.name"):o&&o.name,{showAvatar:a,showName:c}=i[r?"user":"agent"]||{};if(!a&&!c)return null;const l=[];return a&&s&&o.avatar&&l.push((0,U.jsx)("span",{className:Xr("message__avatar"),children:(0,U.jsx)("img",{src:o.avatar,className:Xr("avatar"),alt:""})})),c&&l.push((0,U.jsx)("span",{className:Xr("message__author-name"),children:s})),l.length>0&&(0,U.jsx)("div",{className:Xr("message__author"),children:l})},aa=()=>{const{id:e}=dr()||{};return(0,U.jsx)("li",{className:Xr("conversation__item","conversation__item--source-agent"),children:(0,U.jsxs)("div",{className:Xr("message","message--source-agent","message--type-loading"),children:[(0,U.jsx)(sa,{eventPayload:{fromClient:!1,participant:e}}),(0,U.jsx)("div",{className:Xr("message__body"),children:(0,U.jsxs)("span",{className:Xr("loader"),children:[(0,U.jsx)("span",{className:Xr("loader__part","one")}),(0,U.jsx)("span",{className:Xr("loader__part","two")}),(0,U.jsx)("span",{className:Xr("loader__part","three")}),(0,U.jsx)("span",{className:Xr("loader__part","four")})]})})]})})},ca=["showParticipant","showTranslationToggle","event","type","modifiers","children","bodyProps","info"];function la(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ua(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?la(Object(r),!0).forEach((function(t){pa(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):la(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function pa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fa=function(e){let{showParticipant:t=!0,showTranslationToggle:r=!0,event:n,type:o,modifiers:i,children:s,bodyProps:a={},info:c}=e,l=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,ca);const u=cn(n),{t:p}=Tn(),[,{hasTranslation:f,isTranslated:d,toggleTranslation:h,locale:y}]=fi(n);return o&&u.push("message--type-"+o),i&&("string"==typeof i&&(i=i.split(" ").filter((e=>e.length))),i.forEach((e=>{u.push("message--"+e)}))),d&&u.push("message--is-translated"),f&&u.push("message--has-translation"),d&&(a=ua(ua({},a),{},{lang:y})),(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",ua(ua({className:Xr(u)},l),{},{children:[t&&(0,U.jsx)(sa,{eventPayload:n.payload}),(0,U.jsx)("div",ua(ua({className:Xr("message__body")},a),{},{children:s})),c&&(0,U.jsx)("div",{"aria-hidden":"true",className:Xr("message__info"),children:c}),r&&f&&(0,U.jsx)("div",{className:Xr("message__translation-info"),children:(0,U.jsx)("button",{className:Xr("message__translation-toggle","button","button--secondary"),onClick:h,children:p(d?"translations.toggle.hideButtonText":"translations.toggle.showButtonText")})})]}))})},da=["event","children"];function ha(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ya(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ha(Object(r),!0).forEach((function(t){ba(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ha(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ba(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ma=e=>{const{payload:t}=e,[r,n]=(0,i.useState)(!1),{sendAction:o,addMessageBubble:s,addDivider:a}=Do(),{activeServiceSessionId:c}=ir().serviceInfo,l=ee(fr),[u]=fi(e),{service:p}=t,f=(0,i.useMemo)((()=>{var t;return ya(ya({},e),{},{payload:ya(ya({},e.payload),{},{body:null===(t=e.payload.body)||void 0===t?void 0:t.prompt,translatedBody:e.payload.translatedBody&&ya(ya({},e.payload.translatedBody),{},{data:e.payload.translatedBody.data.prompt})})})}),[e]),d=u.chooseAgain&&c===p.serviceSessionId&&t.id!==l;return(0,i.useEffect)((()=>{n(t.id===l)}),[t,l]),{body:u,subEvent:f,showOptions:r,chooseAgain:d,onChoiceClickHandler:e=>{d&&a("new_topic"),s(e.text),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:d}}),n(!1)},onChooseAgainClickHandler:()=>{n((e=>!e))}}},ga=e=>{const{sendAction:t}=Do();return r=>{r.target&&r.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:r.target.dataset.linkId,url:r.target.getAttribute("href")}})}},va=["event"];function Oa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ja(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oa(Object(r),!0).forEach((function(t){wa(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oa(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function wa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _a=e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,va);const[n]=fi(t),o=ga(t.payload.id),s=(0,i.useMemo)((()=>t.payload.optimisticallyInjected?{children:(0,U.jsx)("p",{children:n.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n.text}}}),[n,t]);return(0,U.jsx)(fa,ja(ja({type:"text",event:t,onClick:o},r),s))};var Ea=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],xa=Ea.join(","),Sa="undefined"==typeof Element,Ta=Sa?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Pa=!Sa&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},Ca=function(e,t,r){var n=Array.prototype.slice.apply(e.querySelectorAll(xa));return t&&Ta.call(e,xa)&&n.unshift(e),n.filter(r)},Aa=function e(t,r,n){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if("SLOT"===s.tagName){var a=s.assignedElements(),c=e(a.length?a:s.children,!0,n);n.flatten?o.push.apply(o,c):o.push({scope:s,candidates:c})}else{Ta.call(s,xa)&&n.filter(s)&&(r||!t.includes(s))&&o.push(s);var l=s.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(s),u=!n.shadowRootFilter||n.shadowRootFilter(s);if(l&&u){var p=e(!0===l?s.children:l.children,!0,n);n.flatten?o.push.apply(o,p):o.push({scope:s,candidates:p})}else i.unshift.apply(i,s.children)}}return o},Ia=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},Na=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Da=function(e){return"INPUT"===e.tagName},ka=function(e){var t=e.getBoundingClientRect(),r=t.width,n=t.height;return 0===r&&0===n},Ra=function(e,t){return!(t.disabled||function(e){return Da(e)&&"hidden"===e.type}(t)||function(e,t){var r=t.displayCheck,n=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Ta.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ta.call(o,"details:not([open]) *"))return!0;var i=Pa(e).host,s=(null==i?void 0:i.ownerDocument.contains(i))||e.ownerDocument.contains(e);if(r&&"full"!==r){if("non-zero-area"===r)return ka(e)}else{if("function"==typeof n){for(var a=e;e;){var c=e.parentElement,l=Pa(e);if(c&&!c.shadowRoot&&!0===n(c))return ka(e);e=e.assignedSlot?e.assignedSlot:c||l===e.ownerDocument?c:l.host}e=a}if(s)return!e.getClientRects().length}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 r=0;r<t.children.length;r++){var n=t.children.item(r);if("LEGEND"===n.tagName)return!!Ta.call(t,"fieldset[disabled] *")||!n.contains(e)}return!0}t=t.parentElement}return!1}(t))},La=function(e,t){return!(function(e){return function(e){return Da(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,r=e.form||Pa(e),n=function(e){return r.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=n(window.CSS.escape(e.name));else try{t=n(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 r=0;r<e.length;r++)if(e[r].checked&&e[r].form===t)return e[r]}(t,e.form);return!o||o===e}(e)}(t)||Ia(t)<0||!Ra(e,t))},Ma=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ua=function e(t){var r=[],n=[];return t.forEach((function(t,o){var i=!!t.scope,s=i?t.scope:t,a=Ia(s,i),c=i?e(t.candidates):s;0===a?i?r.push.apply(r,c):r.push(s):n.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:c})})),n.sort(Na).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(r)},Fa=function(e,t){var r;return r=(t=t||{}).getShadowRoot?Aa([e],t.includeContainer,{filter:La.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ma}):Ca(e,t.includeContainer,La.bind(null,t)),Ua(r)},Ba=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Ta.call(e,xa)&&La(t,e)},Ha=Ea.concat("iframe").join(","),$a=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Ta.call(e,Ha)&&Ra(t,e)};function za(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Va(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?za(Object(r),!0).forEach((function(t){qa(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):za(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Wa,Ga=(Wa=[],{activateTrap:function(e){if(Wa.length>0){var t=Wa[Wa.length-1];t!==e&&t.pause()}var r=Wa.indexOf(e);-1===r||Wa.splice(r,1),Wa.push(e)},deactivateTrap:function(e){var t=Wa.indexOf(e);-1!==t&&Wa.splice(t,1),Wa.length>0&&Wa[Wa.length-1].unpause()}}),Ka=function(e){return setTimeout(e,0)},Ya=function(e,t){var r=-1;return e.every((function(e,n){return!t(e)||(r=n,!1)})),r},Ja=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e?e.apply(void 0,r):e},Qa=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target};function Xa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Za(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xa(Object(r),!0).forEach((function(t){ec(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xa(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ec(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const tc=({children:t,onClose:r,"aria-label":n,"aria-labelledby":o,fallBackFocusRef:s})=>{const a=So(),c=(0,i.useRef)(null),l=(0,i.useRef)(null),[u,p]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{return u&&(l.current=(e=c.current,t={initialFocus:s&&s.current?s.current:null},n=(null==t?void 0:t.document)||document,o=Va({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},a=function(e,t,r){return e&&void 0!==e[t]?e[t]:o[r||t]},p=function(e){return i.containerGroups.findIndex((function(t){var r=t.container,n=t.tabbableNodes;return r.contains(e)||n.find((function(t){return t===e}))}))},f=function(e){var t=o[e];if("function"==typeof t){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];t=t.apply(void 0,i)}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=n.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return a},d=function(){var e=f("initialFocus");if(!1===e)return!1;if(void 0===e)if(p(n.activeElement)>=0)e=n.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||f("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},h=function(){if(i.containerGroups=i.containers.map((function(e){var t=Fa(e,o.tabbableOptions),r=function(e,t){return(t=t||{}).getShadowRoot?Aa([e],t.includeContainer,{filter:Ra.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Ca(e,t.includeContainer,Ra.bind(null,t))}(e,o.tabbableOptions);return{container:e,tabbableNodes:t,focusableNodes:r,firstTabbableNode:t.length>0?t[0]:null,lastTabbableNode:t.length>0?t[t.length-1]:null,nextTabbableNode:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=r.findIndex((function(t){return t===e}));if(!(n<0))return t?r.slice(n+1).find((function(e){return Ba(e,o.tabbableOptions)})):r.slice(0,n).reverse().find((function(e){return Ba(e,o.tabbableOptions)}))}}})),i.tabbableGroups=i.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),i.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},y=function e(t){!1!==t&&t!==n.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(d()))},b=function(e){var t=f("setReturnFocus",e);return t||!1!==t&&e},m=function(e){var t=Qa(e);p(t)>=0||(Ja(o.clickOutsideDeactivates,e)?r.deactivate({returnFocus:o.returnFocusOnDeactivate&&!$a(t,o.tabbableOptions)}):Ja(o.allowOutsideClick,e)||e.preventDefault())},g=function(e){var t=Qa(e),r=p(t)>=0;r||t instanceof Document?r&&(i.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),y(i.mostRecentlyFocusedNode||d()))},v=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==Ja(o.escapeDeactivates,e))return e.preventDefault(),void r.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=Qa(e);h();var r=null;if(i.tabbableGroups.length>0){var n=p(t),s=n>=0?i.containerGroups[n]:void 0;if(n<0)r=e.shiftKey?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var a=Ya(i.tabbableGroups,(function(e){var r=e.firstTabbableNode;return t===r}));if(a<0&&(s.container===t||$a(t,o.tabbableOptions)&&!Ba(t,o.tabbableOptions)&&!s.nextTabbableNode(t,!1))&&(a=n),a>=0){var c=0===a?i.tabbableGroups.length-1:a-1;r=i.tabbableGroups[c].lastTabbableNode}}else{var l=Ya(i.tabbableGroups,(function(e){var r=e.lastTabbableNode;return t===r}));if(l<0&&(s.container===t||$a(t,o.tabbableOptions)&&!Ba(t,o.tabbableOptions)&&!s.nextTabbableNode(t))&&(l=n),l>=0){var u=l===i.tabbableGroups.length-1?0:l+1;r=i.tabbableGroups[u].firstTabbableNode}}}else r=f("fallbackFocus");r&&(e.preventDefault(),y(r))}(e)},O=function(e){var t=Qa(e);p(t)>=0||Ja(o.clickOutsideDeactivates,e)||Ja(o.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},j=function(){if(i.active)return Ga.activateTrap(r),i.delayInitialFocusTimer=o.delayInitialFocus?Ka((function(){y(d())})):y(d()),n.addEventListener("focusin",g,!0),n.addEventListener("mousedown",m,{capture:!0,passive:!1}),n.addEventListener("touchstart",m,{capture:!0,passive:!1}),n.addEventListener("click",O,{capture:!0,passive:!1}),n.addEventListener("keydown",v,{capture:!0,passive:!1}),r},w=function(){if(i.active)return n.removeEventListener("focusin",g,!0),n.removeEventListener("mousedown",m,!0),n.removeEventListener("touchstart",m,!0),n.removeEventListener("click",O,!0),n.removeEventListener("keydown",v,!0),r},r={get active(){return i.active},get paused(){return i.paused},activate:function(e){if(i.active)return this;var t=a(e,"onActivate"),r=a(e,"onPostActivate"),o=a(e,"checkCanFocusTrap");o||h(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,t&&t();var s=function(){o&&h(),j(),r&&r()};return o?(o(i.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!i.active)return this;var t=Va({onDeactivate:o.onDeactivate,onPostDeactivate:o.onPostDeactivate,checkCanReturnFocus:o.checkCanReturnFocus},e);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,w(),i.active=!1,i.paused=!1,Ga.deactivateTrap(r);var n=a(t,"onDeactivate"),s=a(t,"onPostDeactivate"),c=a(t,"checkCanReturnFocus"),l=a(t,"returnFocus","returnFocusOnDeactivate");n&&n();var u=function(){Ka((function(){l&&y(b(i.nodeFocusedBeforeActivation)),s&&s()}))};return l&&c?(c(b(i.nodeFocusedBeforeActivation)).then(u,u),this):(u(),this)},pause:function(){return i.paused||!i.active||(i.paused=!0,w()),this},unpause:function(){return i.paused&&i.active?(i.paused=!1,h(),j(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"==typeof e?n.querySelector(e):e})),i.active&&h(),this}},r.updateContainerElements(e),r),l.current.activate()),()=>{l.current&&l.current.deactivate()};var e,t,r,n,o,i,a,p,f,d,h,y,b,m,g,v,O,j,w}),[u,s]),(0,i.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((r=>{const n=r.getAttribute("aria-hidden");null!==n&&"false"!==n||(e.push(n),t.push(r),r.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,r)=>{const n=e[r];null===n?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",n)}))}})();return()=>{e()}}),[u]),(0,i.useEffect)((()=>{u&&c.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&r()}))}),[u,r]),(0,i.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",a),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),n&&t.setAttribute("aria-label",n),o&&t.setAttribute("aria-labelledby",o),e.appendChild(t),c.current=t,p(!0),()=>{c.current&&(e.removeChild(c.current),c.current=null)}}),[n,o,a]),"function"==typeof t?t({onClose:r,modalRenderFn:t=>c.current&&(0,e.render)(t,c.current)}):c.current&&(0,e.render)((0,e.toChildArray)(t).map((e=>(e.props=Za(Za({},e.props),{},{onClose:r}),e))),c.current)},rc=({url:e,description:t,onClose:r})=>{const{zIndex:n,layoutMode:o,namespace:s}=re(),a=Mo(),c=an(),l=(0,i.useRef)(null),{t:u}=Tn(),p=["modal",`app--layout-${o}`,`namespace--${s}`,...c],f=e=>{e.stopPropagation()},d=()=>{r()},h=n?{zIndex:n+1}:void 0;return(0,U.jsx)(tc,{onClose:r,"aria-label":u("lightbox.heading"),fallBackFocusRef:l,children:({onClose:r,modalRenderFn:n})=>n((r=>(0,U.jsx)("div",{className:Xr(p),onClick:d,style:h,children:(0,U.jsxs)("div",{className:Xr("modal__float"),tabIndex:"-1",onMouseDown:a,onKeyDown:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,ref:l,children:[(0,U.jsx)("div",{className:Xr("modal__inner"),onClick:f,children:(0,U.jsx)("img",{className:Xr("modal__image"),src:e,alt:t})}),(0,U.jsxs)("button",{type:"button",className:Xr("modal__close"),onClick:r,children:[(0,U.jsx)(wi,{name:"close",size:"16"}),u("lightbox.closeLabel")]})]})}))(r))})},nc=({description:e,url:t})=>{const{t:r}=Tn(),[n,o]=(0,i.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("button",{type:"button",className:Xr("modal__enlarge"),onClick:()=>{o(!0)},children:[r("message.image.srTextEnlargeButtonLabel",{description:e}),(0,U.jsx)(wi,{name:"enlarge",size:"32"})]}),n&&(0,U.jsx)(rc,{url:t,description:e,onClose:()=>{o(!1)}})]})},oc=["event","descriptorId"];function ic(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ic(Object(r),!0).forEach((function(t){ac(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ic(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ac(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_LOADED_IMAGE_EVENT_IDS:cc}=He,lc=["event","descriptorId"];function uc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?uc(Object(r),!0).forEach((function(t){fc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function fc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const dc={[Fe.new_topic]:"newtopic"},hc=["event"];function yc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function bc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const mc={default:({event:e})=>{const{t}=Tn(),{subtype:r}=e.payload.body,n=dc[Fe[r]];return(0,U.jsx)(ta,{dividerType:n,iconName:Fe[r],children:(0,U.jsx)("p",{children:t(`dividerKeys.${Fe[r]}`)})})},[Fe.new_translation]:({event:e})=>{const{t}=Tn(),{translationEnabled:r,translationLocale:n,text:o}=e.payload.body,{enableTranslations:i}=pi(),s=hi(n);return(0,U.jsxs)(ta,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,U.jsx)("p",{className:Xr("divider__title"),children:t(r?"translations.divider.startText":"translations.divider.stopText",{language:s})}),r?(0,U.jsx)("p",{children:o}):(0,U.jsx)("button",{className:Xr("button","button--secondary"),onClick:()=>{i(n)},children:t("translations.divider.restartButtonText")})]})}},gc=["event"];function vc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Oc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vc(Object(r),!0).forEach((function(t){jc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function jc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const wc=["event"];function _c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ec(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_c(Object(r),!0).forEach((function(t){xc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function xc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Sc=["event"];function Tc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tc(Object(r),!0).forEach((function(t){Cc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Cc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ac=({children:e,url:t,target:r})=>t?(0,U.jsx)("a",{href:t,download:!0,target:r||void 0,className:Xr(["download","download-link"]),children:e}):(0,U.jsx)("span",{className:Xr("download"),children:e});function Ic(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Nc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ic(Object(r),!0).forEach((function(t){Dc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ic(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kc=({id:e,action:t,buttonText:r,description:n,hasFocus:o,image:s,title:a,isCarouselItem:c})=>{const l=(0,i.useRef)(null),{sendMessage:u,sendAction:p,emitEvent:f}=Do(),d=So(),h=(0,i.useRef)(),y=t.type===$e?"a":"button",b=(0,i.useCallback)((()=>f("action.click_card",{type:Le,originMessage:e,action:t})),[f,e,t]),m=(0,i.useCallback)((()=>{if(b(),"ask"===t.type)u({body:t.ask});else if("topic"===t.type){const{topic:e,fallbackMessage:r}=t;p({type:ke,body:{name:e,fallbackMessage:r}})}}),[u,t,p,b]),g=(0,i.useMemo)((()=>t.type===$e?{href:t.link,rel:"noopener noreferrer",target:t.newTab?"_blank":"_self",onClick:b}:{onClick:m}),[t,m,b]);return(0,i.useEffect)((()=>{c&&(o&&h.current?window.requestAnimationFrame((()=>l.current.focus())):l.current.blur()),h.current=!0}),[o,c]),(0,U.jsxs)("div",{className:Xr("card__wrapper"),id:e,tabIndex:"-1",ref:l,children:[(0,U.jsx)("img",{className:Xr("card__image"),src:s,alt:""}),(0,U.jsxs)("div",{className:Xr("card__content"),id:e,children:[a&&(0,U.jsx)("h2",{className:Xr("card__title"),children:a}),n&&(0,U.jsx)("div",{className:Xr("card__description"),dangerouslySetInnerHTML:{__html:n}}),(0,U.jsx)(y,Nc(Nc({tabIndex:c&&!o?"-1":void 0,className:Xr("button","button--primary"),"aria-describedby":d},g),{},{children:r}))]})]})};function Rc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Lc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rc(Object(r),!0).forEach((function(t){Mc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Uc({item:e,items:t,index:r,isActive:n}){const{t:o}=Tn();return(0,U.jsx)("div",{className:Xr("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":o("carousel.slide.label",{index:r+1,total:t.length}),children:(0,U.jsx)(kc,Lc(Lc({},e),{},{isCarouselItem:!0,hasFocus:n}))})}function Fc({items:e,currentIndex:t,onChange:r,getItemKey:n,getItemLabel:o}){const s=e.length,a=(0,i.useCallback)((e=>{const n=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,n));o!==t&&r(o)}),[s,t,r]);return(0,U.jsx)("div",{className:Xr("carousel-pagination__wrapper"),role:"group",children:(0,U.jsx)("ul",{className:Xr("carousel-pagination"),children:e.map(((e,r)=>{const i=t===r;return(0,U.jsx)("li",{className:Xr("carousel-pagination__item",i?"is-active":void 0),children:(0,U.jsx)("button",{className:Xr("carousel-pagination__button"),type:"button",onClick:a,"data-item":r,"aria-disabled":i?"true":void 0,"aria-label":o(e,r)})},n(e,r,"pagination-item-"))}))})})}function Bc({items:e,currentIndex:t,onChange:r,children:n}){const{t:o}=Tn(),i=e.length;return(0,U.jsxs)("div",{className:Xr("carousel-controls"),children:[(0,U.jsx)("button",{className:Xr("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{r((t-1+i)%i)},children:(0,U.jsx)(wi,{name:"arrowLeft",size:"16"})}),n,(0,U.jsx)("button",{className:Xr("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{r((t+1)%i)},children:(0,U.jsx)(wi,{name:"arrowRight",size:"16"})})]})}const Hc=(e,t,r)=>`${r}${t}`,$c=e=>e.label,zc=({target:e})=>{e.scrollLeft=0};function Vc({currentIndex:t,onChange:r,getItemKey:n=Hc,getItemLabel:o=$c,items:s}){const a=So(),c=s.length,[l,u]=(0,i.useState)(Number(t||"0"));(0,i.useEffect)((()=>{u(Number(t||"0"))}),[u,t]);const p=(0,i.useRef)([]);p.current=(0,i.useMemo)((()=>Array(c).fill(1).map((()=>(0,e.createRef)()))),[c]);const f=(0,i.useRef)(!0),d=(0,i.useRef)();return d.current=r,(0,i.useEffect)((()=>{f.current?f.current=!1:d.current&&d.current(l)}),[l]),(0,U.jsxs)("div",{className:Xr("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,U.jsx)("div",{className:Xr("carousel__slides-wrapper"),onScroll:zc,children:(0,U.jsx)("div",{id:a,className:Xr("carousel__slides"),style:{width:100*c+"%",left:-100*l+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((e,t)=>{const r=l===t;return(0,U.jsx)("div",{ref:p.current[t],className:Xr("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,U.jsx)(Uc,{item:e,items:s,currentIndex:l,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,U.jsx)("div",{className:Xr("carousel__controls"),children:(0,U.jsx)(Bc,{currentIndex:l,items:s,onChange:u,controlId:a,children:(0,U.jsx)("div",{className:Xr("carousel__pagination"),children:(0,U.jsx)(Fc,{currentIndex:l,items:s,onChange:u,getItemKey:n,getItemLabel:o})})})})]})}const qc=(e,t,r="")=>`${r}${e.title}:${t}`,Wc=e=>e.title;function Gc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Kc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Gc(Object(r),!0).forEach((function(t){Yc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Yc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Jc=["event"];function Qc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qc(Object(r),!0).forEach((function(t){Zc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Zc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function el(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?el(Object(r),!0).forEach((function(t){rl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):el(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const nl={message:{choice_prompt:t=>{let{event:r,children:n}=t,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,da);const{t:i}=Tn(),s=So(),{body:a,subEvent:c,showOptions:l,chooseAgain:u,onChoiceClickHandler:p,onChooseAgainClickHandler:f}=ma(r);return(0,U.jsxs)(U.Fragment,{children:[(0,e.toChildArray)(n).map((e=>(e.props=ya(ya({},e.props),{},{event:c,descriptorId:s,showTranslationToggle:!1}),e))),u&&(0,U.jsxs)("button",{type:"button",className:Xr("button","button--secondary","button--choose-again"),"aria-expanded":l?"true":"false",onClick:f,"aria-describedby":s,children:[i(l?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,U.jsx)(wi,{name:"chevronDown",size:"8"})]}),l&&(0,U.jsx)(fa,ya(ya({type:"choice-prompt",showParticipant:!1,event:r},o),{},{children:(0,U.jsx)("ul",{className:Xr("choice-prompt","choice-prompt--many"),children:a.choices.map((e=>(0,U.jsx)("li",{className:Xr("choice-prompt__item",{[`choice-prompt__item--${e.category}`]:e.category}),children:(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{p(e)},children:e.text})},e.id)))})}))]})},text:_a,image:e=>{let{event:t,descriptorId:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,oc);const[o]=fi(t),{description:s,url:a,isZoomable:c}=o,[l,u]=(0,i.useState)(!1),p=Z();return(0,U.jsxs)(fa,sc(sc({event:t,type:"image"},n),{},{children:[(0,U.jsx)("img",{src:a,id:r,alt:s,onLoad:()=>{p({type:cc,eventId:t.payload.id}),u(!0)}}),c&&l&&(0,U.jsx)(nc,{description:s,url:a})]}))},splash:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,wc);const{payload:n}=t,[o]=fi(t),i=ga(n.id);return(0,U.jsx)(fa,Ec(Ec({type:"splash",event:t,onClick:i},r),{},{bodyProps:{dangerouslySetInnerHTML:{__html:o.text}}}))},video:e=>{let{event:t,descriptorId:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,lc);const[o]=fi(t),{description:i,url:s}=o;return cn(t).push("message--type-video"),(0,U.jsxs)(fa,pc(pc({event:t,type:"video"},n),{},{children:[(0,U.jsx)("div",{id:r,className:Xr("visually-hidden"),children:i}),(0,U.jsx)("iframe",{title:i,src:s,allow:"autoplay; encrypted-media",allowFullScreen:!0})]}))},upload:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Sc);const{t:n}=Tn(),[o]=fi(t),{fromClient:s}=t.payload,{filename:a,url:c}=o,l=(0,i.useMemo)((()=>n(c?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:a})),[c,a,n]);return(0,U.jsx)(fa,Pc(Pc({event:t,type:"upload"},r),{},{children:(0,U.jsxs)(Ac,{url:c,target:s?void 0:"_blank",children:[(0,U.jsx)(wi,{name:"download",size:"16"}),(0,U.jsx)("span",{"aria-hidden":"true",className:Xr("file-download"),children:a}),(0,U.jsx)("span",{className:Xr("visually-hidden"),children:l})]})}))},cta:({event:e})=>{const[t]=fi(e),r=ga(e.payload.id),{emitEvent:n}=Do(),o=So(),s=(0,i.useCallback)((()=>n("action.click_cta",{type:Le,originMessage:e.payload.id,link:{url:t.buttonLink}})),[n,t,e]);return(0,U.jsxs)(fa,{type:"cta",event:e,children:[(0,U.jsx)("div",{className:Xr("cta__content"),id:o,dangerouslySetInnerHTML:{__html:t.description},onClick:r}),(0,U.jsx)("a",{className:Xr("button","button--primary"),"aria-describedby":o,href:t.buttonLink,rel:"noreferrer",target:t.buttonNewTab?"_blank":"_self",onClick:s,children:t.buttonText})]})},carousel:({event:e})=>{const[t]=fi(e),r=t.cards;return(0,U.jsx)(fa,{event:e,modifiers:"type-carousel",children:(0,U.jsx)(Vc,{items:r,ItemComponent:Uc,getItemKey:qc,getItemLabel:Wc})})},card:({event:e})=>{const[t]=fi(e),r=So();return(0,U.jsx)(fa,{type:"card",event:e,children:(0,U.jsx)(kc,Kc({id:r},t))})}},info:{text:_a,divider:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,hc);const n=mc[Fe[t.payload.body.subtype]]||mc.default;return(0,U.jsx)(n,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yc(Object(r),!0).forEach((function(t){bc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({event:t},r))},translation:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,gc);const{t:n}=Tn(),[o]=fi(t);return(0,U.jsx)(fa,Oc(Oc({type:"text",event:t},r),{},{children:n(o.key.join("."),o.variables)}))},timeIndicator:oa},participant:{participant:({event:e})=>{const{participant:t}=e.payload,[r]=fi(e);return r?(0,U.jsx)(ta,{graphicSrc:t.avatar,graphicType:t.avatar?"avatar":void 0,iconName:t.avatar?void 0:"balloon",childrenHTML:r,dividerType:"participant"}):null}},service_data:{suggestion:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Jc);const[n,o]=(0,i.useState)(!0),s=sn(),a=go(),{sendAction:c,addMessageBubble:l}=Do(),{suggestions:u,payload:p}=(e=>{const{payload:t}=e,[r]=fi(e);return{suggestions:r,payload:t}})(t),f=cr(),{t:d}=Tn(),h=d("suggestions.headingText"),y=d("suggestions.footerText"),b=(0,i.useMemo)((()=>f.some((({payload:e})=>null==e?void 0:e.transactionLast))),[f]),m=(0,i.useCallback)((({id:e,question:t})=>{o(!1),s(Br(!0)),c({type:Ae,originMessage:p.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),l(t)}),[s,c,p.id,l]);return n&&!a&&b?(0,U.jsxs)("div",{className:Xr("suggestions","suggestions--conversation"),children:[h&&(0,U.jsx)("p",{className:Xr("suggestions__heading"),children:h}),(0,U.jsxs)(fa,Xc(Xc({type:"suggestions",showParticipant:!1,event:t},r),{},{children:[(0,U.jsx)(qs,{className:"suggestions__list--conversation",onClickSuggestion:m,suggestions:u}),y&&(0,U.jsx)("p",{className:Xr("suggestions__footer"),children:y})]}))]}):null}}},ol=({children:e})=>{const{customComponents:t}=re(),r=(0,i.useMemo)((()=>Object.keys(nl).reduce(((e,r)=>tl(tl({},e),{},{[r]:tl(tl({},nl[r]),t?t[r]:{})})),{fallback:_a})),[t]);return(0,U.jsx)(Js.Provider,{value:r,children:e})},il=()=>{const e=cr();let t=null;return e.map((e=>{const{type:r,payload:n}=e,{participant:o,fromClient:i}=n;let s=!1;if("participant"!==r){const r=i?"seamly-client-participant":o;"info"!==e.type&&t!==r&&(s=!0),t=r}return(0,U.jsx)(ia,{event:e,newParticipant:s},e.payload.key||e.payload.id)}))},sl=()=>{const{t:e}=Tn(),t=(0,i.useRef)(null),r=cr(),n=ir().isLoading,{isOpen:o}=vo(),s=pr(),a=Mn(),c=ir().loadedImageEventIds;return(0,i.useEffect)((()=>{const e=t.current;e&&(e.scrollTop=e.scrollHeight)}),[r,n,o,c]),(0,U.jsxs)(U.Fragment,{children:[o&&(0,U.jsx)("a",{className:Xr("skip-link"),href:`#${s}`,onClick:e=>{e.preventDefault(),a()},children:e("skiplinkText")}),(0,U.jsx)("div",{className:Xr("chat__body"),ref:t,children:(0,U.jsxs)("div",{className:Xr("conversation__container"),children:[(0,U.jsx)(Ys,{}),(0,U.jsxs)("ol",{className:Xr("conversation"),children:[(0,U.jsx)(ol,{children:(0,U.jsx)(il,{})}),n&&(0,U.jsx)(aa,{})]})]})})]})},al=({baseClassName:e,children:t,title:r})=>{const n=pr(),o=So();return(0,U.jsxs)("section",{id:n,className:Xr(e),"aria-describedby":o,tabIndex:"-1",children:[(0,U.jsx)("h2",{className:Xr(`${e}__title`),id:o,children:r}),t]})},cl=()=>{const{t:e}=Tn(),t=Mn(),r=Mo(),{emitEvent:n}=Do(),{isActive:o,remaining:i,timer:s,endCountdown:a}=Zo(),c=i>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,U.jsx)(al,{baseClassName:"idle",title:l,children:c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:Xr("idle__count-container"),children:o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:Xr("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,U.jsx)("span",{className:Xr("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",s)})]})}),(0,U.jsxs)("div",{className:Xr("idle__options"),children:[(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{r(),a(!0),t(),n("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{a(),t(),n("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},ll=()=>{const{t:e}=Tn(),t=Mo(),{name:r}=dr()||{},{continueChat:n,restartChat:o}=ti();return(0,U.jsx)(al,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:r}),children:(0,U.jsxs)("div",{className:Xr("prompt__options"),children:[(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:()=>{t(),n()},children:e("resumeConversationPrompt.continueButton")}),(0,U.jsx)("button",{type:"button",className:Xr("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},ul=["id","name","type","labelText","labelClass","contentHint","aria-describedby"];function pl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pl(Object(r),!0).forEach((function(t){dl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function dl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const hl=function(e){let{id:t,name:r,type:n,labelText:o,labelClass:i,contentHint:s,"aria-describedby":a}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,ul);const{isSubmitted:l}=Ki(),[u,{error:p}]=Yi(r),f=l&&p,d=[];return a&&d.push(a),s&&d.push(`${t}-content-hint`),f&&d.push(`${t}-error`),(0,U.jsx)(Ps,{id:t,contentHint:s,validity:!f,errorText:p,labelText:o,labelClass:i,children:(0,U.jsx)("input",fl(fl({id:t,name:r,type:n,"aria-invalid":f?"true":"false","aria-describedby":d.join(" ")||null},u),c))})};function yl({controlName:e,skipLinkId:t}){const{t:r}=Tn(),{sendAssertive:n}=Ro(),{emitEvent:o}=Do(),s=(()=>{const{sendAction:e}=Do(),{features:t}=qn(),{typingPeekahead:r}=t||{},n=(0,i.useRef)(null),o=(0,i.useRef)(null),s=(0,i.useRef)(!1),a=(0,i.useRef)(null);(0,i.useEffect)((()=>()=>{clearInterval(a.current),clearTimeout(n.current),clearTimeout(o.current)}),[]);const c=(t,n)=>{e(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Uo(Object(r),!0).forEach((function(t){Fo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Uo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:Ie,state:t},r&&r.enabled?{body:{currentMessage:n}}:{}))};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(s.current=!0,a.current||(c(!0,e.target.value),a.current=setInterval((()=>{s.current?r&&r.enabled&&c(!0,e.target.value):(clearInterval(a.current),a.current=null)}),2e3)),clearTimeout(n.current),clearTimeout(o.current),n.current=setTimeout((()=>{s.current=!1}),300),o.current=setTimeout((()=>{c(!1,e.target.value)}),2e3))}})(),{setBlockAutoEntrySwitch:a}=zo(),{hasCharacterLimit:c,characterLimit:l,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:f}=function(e){const{t}=Tn(),{sendAssertive:r}=Ro(),{hasLimit:n,limit:o}=(()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=ir(),{limit:r}=t||e||{limit:null};return{hasLimit:null!==r,limit:null!==r?r:null}})(),s=(0,i.useMemo)((()=>ue(r,300)),[r]),a=(0,i.useMemo)((()=>ue(((e,r)=>{e&&s(t("input.srCharacterLimitText",{limit:r}))}),300)),[s,t]),[{value:c}]=Yi(e),l=n&&c?o-c.length:o,u=!!n&&l<=50,p=!!n&&l<0;return(0,i.useEffect)((()=>{a(u,l)}),[u,l,a]),{hasCharacterLimit:n,characterLimit:o,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:l}}(e),[{value:d}]=Yi(e),h=!!d,y=(0,i.useCallback)((()=>{u&&n(r("input.srCharacterLimitText",{limit:f})),o("ui.inputFocus")}),[r,n,u,f,o]),b=(0,i.useMemo)((()=>r("input.inputPlaceholder",{hasLimit:c,limit:c?l:null})),[r,c,l]),m=(0,i.useMemo)((()=>r("input.inputLabel",{hasLimit:c,limit:c?l:null})),[r,c,l]);return(0,i.useLayoutEffect)((()=>(a(h),()=>{a(!1)})),[a,h]),(0,U.jsxs)(Ss,{className:Xr("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,U.jsxs)("div",{className:Xr(["input--text__container",...u&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,U.jsx)(hl,{id:t,type:"text",name:e,className:Xr("input__text"),autocomplete:"off",placeholder:b,labelText:m,labelClass:Xr("visually-hidden"),"aria-invalid":c?p:null,onKeyUp:s,onFocus:y}),(0,U.jsx)("div",{className:Xr("character-count"),children:u&&(0,U.jsx)("span",{children:f})})]}),(0,U.jsx)("button",{className:Xr("button","input__submit"),type:"submit",onPointerDown:e=>{e.preventDefault()},"aria-disabled":!h||p?"true":null,children:(0,U.jsx)(wi,{name:"send",size:"32",alt:r("input.sendMessage")})})]})}function bl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ml(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bl(Object(r),!0).forEach((function(t){gl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function gl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vl(){return vl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vl.apply(this,arguments)}const Ol="userText";function jl(e){let t=vl({},e);const{isOpen:r,setVisibility:n}=vo(),o=pr(),s=Mn(),{sendMessage:a}=Do(),c=(0,i.useCallback)(((e,{updateControlValue:t})=>{a({body:e.userText}),t(Ol,""),s(),r||n(C.open)}),[a,s,r,n]);return(0,U.jsx)(es,ml(ml({},t),{},{formId:"textEntry",persistData:!0,onSubmit:c,children:(0,U.jsx)(yl,{controlName:Ol,skipLinkId:o})}))}const wl=()=>{const{t:e}=Tn(),{showFileUpload:t,serviceAllowsUploads:r}=Xn(),[n,o]=(0,i.useState)(r),s=Mn(),a=(0,i.useRef)(null),{setUserEntryType:c,activeEntry:l}=zo(),u=(0,i.useRef)(null),{sendPolite:p}=Ro(),f=!!dr();return(0,i.useEffect)((()=>{Oe(u.current,(()=>{r||s()})),o(r)}),[r,s]),(0,i.useEffect)((()=>{a.current&&!r&&p(e("fileUpload.srUnavailableText")),!1===a.current&&r&&p(e("fileUpload.srAvailableText")),f&&(a.current=r)}),[r,f,p,e]),!t&&l!==Te&&(0,U.jsx)(Pi,{isActive:n,transitionStartState:Si,children:(0,U.jsx)("div",{className:Xr("upload-toggle-wrapper"),children:(0,U.jsx)(Pi,{isActive:n,transitionStartState:Ti,children:(0,U.jsx)("button",{className:Xr(["button","button--secondary","upload-toggle"]),ref:u,"aria-disabled":n?null:"true",type:"button",onClick:n?()=>{c(Te),s()}:null,children:(0,U.jsx)(wi,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},_l=()=>{const{t:e}=Tn(),{currentUploads:t}=Zn();return(0,U.jsx)("div",{className:Xr("progress"),children:t.map((({id:t,name:r,progress:n,uploading:o,error:i})=>(0,U.jsxs)("div",{className:Xr("progress_container"),children:[(0,U.jsxs)("div",{className:Xr("progress__text"),children:[(0,U.jsx)("span",{className:Xr("progress__text--file-name"),children:r}),(0,U.jsx)("span",{className:Xr("progress__text--percentage"),children:`${n}%`})]}),(0,U.jsx)(Ts,{error:i}),(0,U.jsx)("progress",{className:Xr("progress__bar"),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-label":e("fileUpload.srProgressLabel",{fileName:r}),max:"100","aria-valuenow":n,value:n,"aria-busy":o,children:`${n}%`})]},t)))})};function El({id:e,name:t,labelText:r,contentHint:n,outputText:o,accept:s}){const{isSubmitted:a}=Ki(),[c,l]=(0,i.useState)(!1),[{onInput:u,onBlur:p},{error:f}]=Yi(t),d=So(),h=So(),y=So(),b=a&&f,m=[y];n&&m.push(h),b&&m.push(d);const g=(0,i.useCallback)((()=>{l(!0)}),[l]),v=(0,i.useCallback)((()=>{l(!1),p()}),[l,p]),O=(0,i.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,U.jsxs)("div",{className:Xr("upload__container"),children:[n&&(0,U.jsx)("span",{className:Xr("upload__content-hint"),id:h,children:n}),(0,U.jsx)(Ts,{id:d,error:b&&f}),(0,U.jsx)("div",{className:Xr(["file-upload",...c?["focus-within"]:[]]),children:(0,U.jsxs)("label",{htmlFor:e,className:Xr("upload__label"),children:[(0,U.jsx)(wi,{name:"upload",size:"32"}),(0,U.jsxs)("div",{children:[(0,U.jsx)("span",{className:Xr(["upload__label--text"]),children:r}),(0,U.jsx)("input",{id:e,className:Xr("upload__input"),type:"file",name:t,onChange:O,"aria-invalid":b?"true":"false","aria-describedby":m.join(" "),accept:s||null,onFocus:g,onBlur:v}),(0,U.jsx)("span",{className:Xr("upload__output"),"aria-hidden":"true",id:y,children:o})]})]})})]})}function xl({skiplinkId:e,controlName:t,accept:r,contentHint:n,isUploading:o,isComplete:i,onClickCancel:s}){const{t:a}=Tn(),[{value:c}]=Yi(t),l=c&&c.length>0,u=l?c[0].name:"";return(0,U.jsxs)(Ss,{className:Xr("upload-form"),children:[(0,U.jsx)(El,{name:t,id:e,accept:r,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:n}),(0,U.jsxs)("div",{className:Xr("upload__button-container"),children:[(0,U.jsx)("button",{id:o||!i?e:void 0,type:"button",onClick:s,className:Xr("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,U.jsx)("button",{className:Xr("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})}const Sl="fileListForm",Tl="fileList",Pl=()=>{const{t:e}=Tn(),{sendPolite:t,sendAssertive:r}=Ro(),n=pr(),o=Mn(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:c}=Xn(),l=(0,i.useRef)(null),u=(0,i.useRef)(s),{cancelEntrySelection:p}=zo(),{uploadFile:f,clearUploads:d,isUploading:h,isComplete:y}=Zn(),{hasFile:b,selectedFileName:m,uploadHandle:g,hasServerError:v,progress:O}=((e,t)=>{const r=te($i,{formId:e,name:t},[e,t]),{currentUploads:n}=Zn(),o=r&&r.length>0;let i=null,s=!1,a=0;if(n&&n.length>0){const e=n[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?r[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(Sl,Tl),j=So(),w=(0,i.useRef)(!0),_=e("fileUpload.contentHint",{size:de(c)}),E=(0,i.useRef)(""),x=(0,i.useRef)(null);(0,i.useEffect)((()=>{E.current&&x.current.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&r(_),E.current=_}),[_,r]),(0,i.useEffect)((()=>{O>0&&t(1===O?e("fileUpload.srStartedText"):`${O}%`)}),[O,t,e]),(0,i.useEffect)((()=>{w.current||h||!y||(d(),p(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),w.current=y}),[h,y,d,p,o,t,e]);const S=(0,i.useCallback)((({fileList:e})=>{f(e[0]),o()}),[f,!1,o]),T=(0,i.useCallback)((()=>{g&&g.abort(),d(),p(),o()}),[g,d,p,o]),P=(0,i.useMemo)((()=>({[Tl]:[gs((()=>s),e("fileUpload.errors.unavailable")),gs(Os,e("fileUpload.errors.noFile")),gs(vs,e("fileUpload.errors.tooLarge"),c)]})),[c,s,e]);return(0,U.jsx)("div",{className:Xr(["upload",...v?["upload--error"]:[]]),ref:x,children:(0,U.jsxs)(es,{formId:Sl,persistData:!0,onSubmit:S,validationSchema:P,children:[(h||!y)&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(_l,{}),(0,U.jsx)("div",{className:Xr("upload__button-container"),children:(0,U.jsx)("button",{id:h||!y?n:void 0,type:"button",onClick:T,ref:l,className:Xr("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&y&&(0,U.jsx)(xl,{controlName:Tl,skiplinkId:n,accept:a.join(", "),contentHint:_,isComplete:y,isUploading:h,outputText:e("fileUpload.selectedText",{hasFile:b,filename:m}),onClickCancel:T}),!u.current&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:Xr("notification"),id:j,children:e("fileUpload.unavailableText")}),(0,U.jsx)("div",{className:Xr("upload__button-container"),children:(0,U.jsx)("button",{id:h||!y?n:void 0,type:"button",onClick:T,className:Xr("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})};function Cl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Al(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cl(Object(r),!0).forEach((function(t){Il(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Il(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Nl=()=>{const{isOpen:e}=vo(),t=(0,i.useRef)(null),{hasCountdown:r}=Zo(),[n,o]=(0,i.useState)(r),{hasPrompt:s}=ti(),[a,c]=(0,i.useState)(s),l=Mn(),u=(0,i.useRef)(!1),{activeEntry:p}=zo(),[f,d]=(0,i.useState)({text:jl,upload:Pl}),[h,y]=(0,i.useState)((()=>p)),b=re(),{accountAllowsUploads:m}=Xn(),g=(0,i.useCallback)((()=>{Oe(t.current,(()=>{l()}))}),[l]);(0,i.useEffect)((()=>{const{customComponents:e}=b,{entry:t}=e||{};t&&d((e=>Al(Al({},e),t)))}),[b]),(0,i.useEffect)((()=>{g(),o(r),c(s)}),[r,s,g]),(0,i.useEffect)((()=>{y(p),g()}),[p,g,t]),u.current=!(!t.current||!t.current.contains(document.activeElement));const v=f[h];return(0,U.jsxs)("div",{className:Xr("chat__entry"),ref:t,children:[n&&(0,U.jsx)(cl,{}),a&&(0,U.jsx)(ll,{}),(0,U.jsxs)("div",{className:Xr(["entry__body",...r||s?["entry__body--hidden"]:[]]),children:[h!==Te&&m&&e&&(0,U.jsx)(wl,{}),(0,U.jsx)(v,{})]})]})};function Dl({controlName:e,describedById:t}){const{t:r}=Tn();return(0,U.jsxs)(Ss,{noValidate:"true",className:Xr("options__form"),children:[(0,U.jsx)(hl,{name:e,type:"email",className:Xr("transcript__input"),"aria-describedby":t,labelClass:Xr("label"),labelText:r("options.sendTranscript.label")}),(0,U.jsx)("div",{className:Xr("options__actions"),children:(0,U.jsx)("button",{type:"submit",className:Xr("button","button--primary","options__submit"),children:r("options.sendTranscript.sendButtonText")})})]})}const kl="email",Rl={sendTranscript:()=>{const[e,t]=(0,i.useState)(void 0),{hideOption:r}=qn(),{focusButton:n}=Wn(),{t:o}=Tn(),s=So(),{sendAction:a}=Do(),c=(0,i.useMemo)((()=>({[kl]:[gs(ws,o("options.sendTranscript.noEmailText")),gs(js,o("options.sendTranscript.invalidEmailText"))]})),[o]),l=(0,i.useCallback)((e=>{const t=e.email.trim();a({type:"send_transcript",body:{emailAddress:t}}),r(),n()}),[a,r,n]),u=(0,i.useCallback)((({isValid:e,isSubmitted:r})=>{t(r&&!e?"options--error":void 0)}),[t]);return(0,U.jsxs)(Ci,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),children:[(0,U.jsx)("p",{className:Xr("options__description"),id:s,children:o("options.sendTranscript.description")}),(0,U.jsx)(es,{formId:"sendTranscript",onSubmit:l,validationSchema:c,onError:u,children:(0,U.jsx)(Dl,{controlName:kl,describedById:s})})]})}},Ll=()=>{const{optionActive:e}=qn(),t=(0,i.useRef)(null),r=Rl[e||t.current];return e&&(t.current=e),r?(0,U.jsx)(r,{}):null},Ml=()=>{const{t}=Tn(),{menuOptions:r,showOption:n,panelActive:o,hideOption:s}=qn(),{id:a}=Wn(),c=(0,i.useRef)(null),[l,u]=(0,i.useState)(!1),p=(0,i.useRef)(null),f=r.length,d=(0,i.useRef)(Array.from({length:f},(()=>(0,e.createRef)()))),h=(0,i.useRef)(!1),y=f>1,b=r[0],m=(0,i.useMemo)((()=>{var e;return null==b||null===(e=b.name)||void 0===e?void 0:e.trim().replace(/\s+/g,"")}),[b]);return(0,i.useEffect)((()=>()=>{clearTimeout(c.current)}),[]),(0,i.useEffect)((()=>{l&&!h.current&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{const e=r.findIndex((e=>e.available)),t=-1===e?0:e;ve(d.current[t])}))})),h.current=l}),[l,r]),f?(0,U.jsxs)("div",{className:Xr("options__container"),onKeyDown:e=>{l&&(ge(e)===me.Escape&&(u(!1),ve(p.current)),ge(e)===me.Home&&(ve(d.current[0]),e.preventDefault()),ge(e)===me.End&&(ve(d.current[f-1]),e.preventDefault()))},onfocusout:()=>{y&&(c.current=setTimeout((()=>{u(!1)}),200))},onfocusin:()=>{clearTimeout(c.current)},children:[(0,U.jsx)(Pi,{transitionStartState:xi,isActive:o,children:(0,U.jsx)("div",{className:Xr("options__dialog"),children:(0,U.jsx)(Ll,{})})}),y&&(0,U.jsx)(Pi,{isActive:l,transitionStartState:xi,children:(0,U.jsx)("ul",{className:Xr(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":a,children:r.map((({name:e,title:o,available:i},s)=>(0,U.jsx)("li",{className:Xr("options__menu__item"),role:"menuitem","data-testid":e,children:(0,U.jsxs)("button",{type:"button",ref:e=>{d.current[s]=e},className:Xr(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(ge(e)===me.ArrowDown){const r=Math.min(f-1,t+1);ve(d.current[t===r?0:r]),e.preventDefault()}if(ge(e)===me.ArrowUp){const r=Math.max(0,t-1);ve(d.current[t===r?f-1:r]),e.preventDefault()}})(e,s),onKeyPress:e=>((e,t)=>{const n=String.fromCharCode(e.charCode);if(1!==n.length||!n.match(/\S/))return;let o=-1;r.forEach(((e,r)=>{r>t&&e.title.charAt(0).toLowerCase()===n.toLowerCase()&&-1===o&&(o=r)})),-1!==o&&ve(d.current[o])})(e,s),onClick:()=>((e,t)=>{t&&(u(!1),n(e))})(e,i),"aria-disabled":i?null:"true",children:[(0,U.jsxs)("span",{className:Xr("button__text"),children:[o,!i&&" "]}),!i&&(0,U.jsx)("span",{className:Xr("button__state"),children:t("options.unavailableText")})]})},e)))})}),(0,U.jsxs)("button",{type:"button",className:Xr(["button","button--secondary","chat__options__button",...!y&&m?[`chat__options__button--${m}`]:[]]),id:a,onClick:()=>{o&&s(),y?u((e=>!e)):b.available&&n(b.name)},onKeyDown:y?e=>{ge(e)===me.ArrowDown&&(u(!0),e.preventDefault())}:null,ref:p,"aria-haspopup":y?"menu":null,"aria-expanded":y?l.toString():null,"aria-disabled":y||b.available?null:"true",children:[y&&(0,U.jsx)(wi,{name:"options",size:"32"}),(0,U.jsx)("span",{className:Xr("button__text"),children:y?t("options.openButtonText"):`${b.title}${b.available?"":" "}`}),!y&&!b.available&&(0,U.jsx)("span",{className:Xr("button__state"),children:t("options.unavailableText")})]})]}):null};function Ul(){const{menuOptions:e,allowOptionSelection:t}=qn(),{isAvailable:r}=pi();return r||t&&e.length?(0,U.jsxs)("div",{className:Xr("chat__options"),children:[r&&(0,U.jsx)("div",{className:Xr("chat__options-item","chat__options-item--left"),children:(0,U.jsx)(Us,{})}),t&&(0,U.jsx)("div",{className:Xr("chat__options-item","chat__options-item--right"),children:(0,U.jsx)(Ml,{})})]}):null}function Fl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Bl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Hl=function({children:e,interruptComponent:t}){const{hasInterrupt:r,meta:n}=oo(),{isOpen:o}=vo();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Bs,{}),(0,U.jsx)("div",{className:Xr("chat__container"),children:r?o?(0,U.jsx)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fl(Object(r),!0).forEach((function(t){Bl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},n)):null:e}),o&&(0,U.jsx)(Ul,{})]})};function $l(){const{preChatEvents:e,layoutMode:t}=re(),{hasInterrupt:r}=oo(),{isOpen:n}=vo(),o=!(r||!e.length||n);return o&&(0,U.jsx)("ul",{className:Xr("pre-chat-messages",`pre-chat-messages--${t}`),"aria-hidden":!o,children:e.map((e=>(0,U.jsx)("li",{className:Xr("pre-chat-messages__message"),children:(0,U.jsx)(zl,{event:e})},e.payload.id)))})}function zl({event:e}){const[t]=Qs(e);return(0,U.jsx)(t,{event:e})}function Vl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ql(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Wl=()=>{const e=ne(),t=dr(),{hasInterrupt:r}=oo(),n=t&&!r,o=n?t.avatar:e;return o?(0,U.jsx)("img",{className:Xr(n?"avatar":"icon"),src:o,alt:""}):(0,U.jsx)(wi,{name:"avatar",size:"32"})},Gl=({onClick:e})=>{const t=on(),{t:r}=Tn(),n=r(t?"window.openButton.srContinue":"window.openButton.srStart"),o=Mn(),{isOpen:s}=vo(),a=ur(),c=(0,i.useCallback)((()=>{e(),o()}),[o,e]);return(0,U.jsx)(Pi,{isActive:!s,transitionStartState:Si,children:(0,U.jsxs)("button",{className:Xr("window-open-button"),"aria-label":n,"aria-hidden":s,onClick:c,children:[(0,U.jsx)("span",{className:Xr("message-count"),"aria-hidden":"true",children:!!a&&a}),(0,U.jsx)(Wl,{})]})})},Kl=({onClick:e})=>{const{t}=Tn(),r=(0,i.useCallback)((()=>e()),[e]);return(0,U.jsx)("button",{type:"button",className:Xr("button","collapse-button"),onClick:r,children:(0,U.jsx)(wi,{name:"chevronDown",size:"32",alt:t("window.srCollapseButton")})})},Yl={app:()=>(qo(),(0,U.jsx)(Gs,{children:(0,U.jsxs)(Hl,{interruptComponent:Ks,children:[(0,U.jsx)(sl,{}),(0,U.jsx)(Nl,{})]})})),inline:()=>{qo();const{showInlineView:e,containerRef:t}=Oo(),{isOpen:r}=vo(),{hasInterrupt:n,meta:o}=oo();return n&&!r?(0,U.jsx)(Ks,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vl(Object(r),!0).forEach((function(t){ql(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},o)):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Pi,{isActive:!r,transitionStartState:Si,children:(0,U.jsxs)("div",{ref:t,className:Xr("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,U.jsx)($l,{}),(0,U.jsx)(Ws,{})]})}),(0,U.jsx)(Pi,{isActive:r,transitionStartState:Si,children:(0,U.jsx)(Gs,{ref:t,children:e&&(0,U.jsxs)(Hl,{interruptComponent:Ks,children:[r&&(0,U.jsx)(sl,{}),(0,U.jsx)(Nl,{})]})})})]})},window:()=>{const{openChat:e,closeChat:t}=qo(),{isOpen:r}=vo(),n=go(),{t:o}=Tn(),s=o("window.chat.continue"),a=(0,i.useMemo)((()=>({payload:{body:{text:s}}})),[s]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gl,{onClick:e}),(0,U.jsx)(Pi,{isActive:!r&&!n,transitionStartState:Si,children:(0,U.jsx)("div",{className:Xr("unstarted-wrapper","unstarted-wrapper--window"),children:(0,U.jsx)($l,{})})}),(0,U.jsx)(Pi,{isActive:!r&&n,transitionStartState:xi,children:(0,U.jsx)("div",{className:Xr("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,U.jsx)(_a,{event:a})})}),(0,U.jsx)(Pi,{isActive:r,transitionStartState:xi,children:(0,U.jsxs)(Gs,{children:[r&&(0,U.jsx)(Kl,{onClick:t}),(0,U.jsxs)(Hl,{interruptComponent:Ks,children:[(0,U.jsx)(sl,{}),(0,U.jsx)(Nl,{})]})]})})]})}},Jl=({children:e})=>{const[,t]=Rn(),{namespace:r,layoutMode:n,zIndex:o}=re(),{isOpen:s,isVisible:a}=vo(),c=an(),l=go(),{locale:u}=Tn(),p=Yl[n],f=(0,i.useCallback)((e=>{t(e)}),[t]),d=(0,i.useMemo)((()=>{if(u&&document.querySelector("html").getAttribute("lang")!==u)return u}),[u]);if(!p)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const h=["app",`app--layout-${n}`,`namespace--${r}`,...c];return s||"app"===n||h.push("app--collapsed"),l&&h.push("app--user-responded"),a&&(0,U.jsx)("div",{className:Xr(h),lang:d,tabIndex:"-1","data-nosnippet":!0,style:{zIndex:o},ref:f,children:e||(0,U.jsx)(p,{})})},{createAction:Ql}=h("errors"),Xl=Ql("catch-error",(e=>({error:e})));function Zl({api:e}){return({getState:t})=>{const r=r=>{const{errorCallback:n,namespace:o,api:i,layoutMode:s}=D(t());null==n||n(r.error,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:r.type?r:void 0})};return e=>t=>{try{return t.error&&r(t),e(t)}catch(e){throw r({error:e}),e}}}}function eu(e,t,r=[]){const n=(0,i.useContext)(en),o=(0,i.useRef)();o.current=t,(0,i.useEffect)((()=>{if(!r.every(Boolean))return;const t=(...e)=>{var t;return null===(t=o.current)||void 0===t?void 0:t.call(o,...e)};return n.emit("function.register",e,t),()=>n.emit("function.unregister",e,t)}),[n,e,...r])}const tu=()=>{const e=re(),{sendMessage:t,sendContext:r,sendAction:n}=Do(),{setVisibility:o,visible:s}=vo(),a=(0,i.useRef)(s),c=(0,i.useContext)(en),l=tn(),u=ur(),p=(0,i.useRef)(null),f=(0,i.useRef)(null),{isInline:d,isResolving:h}=yr(),{hasInterrupt:y}=oo(),b=nn(),m=(0,i.useRef)(null),g=Mo(),{enableTranslations:v,disableTranslations:O}=pi();return(0,i.useEffect)((()=>{a.current=s}),[s]),eu("askText",(e=>{t({body:e})}),[null==l?void 0:l.send]),eu("setVariables",(e=>{r({variables:e})}),[null==l?void 0:l.send]),eu("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),eu("setVisibility",(e=>{Object.values(C).includes(e)?(g(),o(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[null==e?void 0:e.api]),eu("sendCustomAction",((e,t)=>{n({type:"custom",body:{type:e,body:t}})}),[l.send]),eu("setTopic",(({name:e,fallbackMessage:t})=>{e&&t?n({type:ke,body:{name:e,fallbackMessage:t}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),eu("setTranslation",(({enabled:e,locale:t})=>{e?v(t):O()}),[l.send]),(0,i.useEffect)((()=>{h||y||(m.current&&m.current!==b&&c.emit("unreadMessageCount",u),s===C.open&&s!==f.current&&0!==p.current&&c.emit("unreadMessageCount",0),s!==C.open&&u!==p.current&&c.emit("unreadMessageCount",u),f.current=s,p.current=u,m.current=b)}),[u,s,c,d,h,y,b]),null},{SET_EVENTS_READ:ru}=He,nu=()=>{const{t:e}=Tn(),t=cr(),r=sn(),{isOpen:n,isVisible:o}=vo(),{sendAction:s}=Do(),a=ur(),{sendPolite:c}=Ro(),l=(0,i.useMemo)((()=>ue(c,2e3)),[c]),u=(0,i.useRef)(null),p=(0,i.useRef)(null);return(0,i.useEffect)((()=>{if(!n)return;const e=t.filter((e=>Pt(e)&&e.payload.messageStatus===Pe)).map((e=>e.payload.id));e.length>0&&(r({type:ru,ids:e}),s({type:Ne,events:e}))}),[t,r,n,s]),(0,i.useEffect)((()=>{u.current!==o&&!o&&p.current&&p.current(),0!==a&&!n&&o&&(p.current=l(e("message.srTextUnreadCount",{unreadCount:a}))),u.current=o}),[a,n,o,l,e]),null},ou=()=>{const{t:e}=Tn(),t=cr(),r=(0,i.useRef)(0),n=(0,i.useRef)(0),o=ir().historyLoaded,{sendPolite:s}=Ro(),{isOpen:a}=vo(),c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useMemo)((()=>ue((t=>{const r=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;r>n.current&&(s(e("message.srNewEventCount",{newCount:r-n.current})),n.current=r)}),1e3)),[s,e]);return(0,i.useEffect)((()=>{t.length>r.current&&(a&&(l.current=u(t)),r.current=t.length)}),[t,u,a]),(0,i.useEffect)((()=>{c.current&&!a&&l.current&&(l.current(!0),l.current=null)}),[a]),(0,i.useEffect)((()=>{o&&setTimeout((()=>{s(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,s]),null},iu=({children:e})=>{const t=(0,i.useContext)(en),[r,n]=(0,i.useState)({}),o=(0,i.useRef)(!0),s=(0,i.useCallback)((e=>{o.current&&(n(e),t.emit("aria-live",e))}),[n,t]);(0,i.useEffect)((()=>{let e=null;return r&&r.messageText&&(e=setTimeout((()=>{s({}),clearTimeout(e)}),500)),()=>{clearTimeout(e)}}),[r,s]),(0,i.useEffect)((()=>()=>{o.current=!1}),[]);const{ariaLive:a,messageText:c}=r;return(0,U.jsxs)(ko.Provider,{value:s,children:[e,(0,U.jsxs)("div",{className:Xr("app__live-container"),children:[(0,U.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Xr("visually-hidden"),children:a===Me?c:null}),(0,U.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Xr("visually-hidden"),children:a===Ue?c:null})]})]})},su=()=>{const{hasCountdown:e,isActive:t,remaining:r,decrementCountdown:n}=Zo();return((e,t)=>{const r=(0,i.useRef)(e);(0,i.useEffect)((()=>{r.current=e}),[e]),(0,i.useEffect)((()=>{if(null!==t){const e=setInterval((function(){r.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{n()}),e&&t&&r>0?1e3:null),null},au=({children:e})=>{const t=(0,i.useRef)(0),{sendAction:r}=Do(),{hasCountdown:n,isActive:o,stopCountdown:s}=Zo(),a=(0,i.useCallback)((()=>{const e=(new Date).getTime(),i=()=>{r({type:"interactivity_update"}),t.current=e};n&&o&&(i(),s()),e-t.current>15e3&&i()}),[r,n,o,s]);return(0,U.jsx)("div",{className:Xr("activity-monitor"),tabIndex:"-1",onMouseDown:a,onKeyUp:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,children:(0,U.jsx)(Lo.Provider,{value:a,children:e})})},cu=()=>{const{initUserSelectedOptions:e}=qn(),t=(0,i.useRef)(!1),r=re();return(0,i.useEffect)((()=>{r.api&&!t.current&&(t.current=!0,e())}),[e,r]),null},lu=["serviceSettings"];const{ADD_EVENT:uu,ACK_EVENT:pu,SET_IS_LOADING:fu,SET_PARTICIPANT:du,SET_HEADER_SUB_TITLE:hu,SET_ACTIVE_SERVICE:yu,INIT_RESUME_CONVERSATION_PROMPT:bu,CLEAR_EVENTS:mu,SET_SERVICE_DATA_ITEM:gu,SET_FEATURE_ENABLED_STATE:vu,SET_SERVICE_ENTRY_METADATA:Ou,SET_HISTORY:ju}=He,wu=["text","choice_prompt","image","video"],_u=({eventBus:e})=>{const{t}=Tn(),r=tn(),n=sn(),o=cr(),s=(0,i.useRef)(null),{setUserSelectedOption:a}=qn(),{initCountdown:c,endCountdown:l}=Zo(),{emitEvent:u}=Do();return(0,i.useEffect)((()=>{if(r.connectionInfo){const t=e=>{const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:r,participant:o}=t;!r&&o.name&&n({type:hu,title:o.name}),n({type:du,participant:o,fromClient:r}),o.introduction&&n({type:uu,event:e})};r.stream().subscribe({next:r=>{const{type:o,payload:i}=r;switch(o){case"ui":switch(i.state&&i.state.hasOwnProperty("loading")&&n({type:fu,isLoading:i.state.loading}),i.type){case"idle_detach_countdown":c(i.body.duration);break;case"idle_detach_countdown_elapsed":l(void 0,!0);break;case"resume_conversation_prompt":n({type:bu});break;case"user_first_response":n(Br(!0)),e.emit("system.userFirstResponse",i.body)}break;case"message":switch(t(i),i.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":i.service&&i.service.serviceSessionId&&n({type:yu,activeServiceSessionId:i.service.serviceSessionId}),n({type:uu,event:r})}break;case"participant":t(r);break;case"service_data":i.persist&&n({type:gu,payload:i});break;case"ack":n({type:pu,event:r});break;case"system":if("service_changed"===i.type){const{serviceSettings:e}=i,t=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(i,lu),{uploads:r,entry:o}=e;n({type:vu,key:Be,enabled:!(!r||!r.enabled)}),n({type:Ou,entryMeta:o}),n({type:yu,activeServiceSessionId:i.serviceSessionId}),u("system.serviceChanged",t)}break;case"info":"divider"!==i.type&&"text"!==i.type&&"translation"!==i.type||n({type:uu,event:r});break;case"error":switch(i.type){case"find_conversation_erred":n(Ur(new kr(r)));break;case"seamly_offline":n(Ur(new ao(r))),n({type:mu});break;default:n(Ur(new io(r)))}break;case"socket_opened":n(Fr())}}}),r.stream().filter((e=>"message"===e.type&&wu.includes(e.payload.type))).subscribe({next:({payload:t})=>{t.id!==s.current&&e.emit("message",t),s.current=t.id}})}}),[n,r,e,t,a,c,l,u]),(0,i.useEffect)((()=>{if(r.stream){const e=r.stream().filter((e=>"sync"===e.type)).subscribe({next:e=>{const{payload:t}=e,i=o[o.length-1],{id:s}=t.lastEvent;i&&s===i.payload.id||r.getConversation().then((e=>{e&&n({type:ju,history:e})})).catch((e=>{n(Ur(e))}))}});return()=>{e.unsubscribe()}}return()=>{}}),[r,o,n]),null},{REGISTER_UPLOAD:Eu,SET_UPLOAD_PROGRESS:xu,SET_UPLOAD_ERROR:Su,SET_UPLOAD_COMPLETE:Tu}=He,Pu=({children:e})=>{const{t}=Tn(),r=sn(),n=tn(),{addUploadBubble:o}=Do();return(0,U.jsx)(Gn.Provider,{value:e=>{const i=s(),a=n.uploadFile(e,(e=>{r({type:xu,fileId:i,progress:Math.ceil(e)})}),(e=>{const{id:t,transactionId:n,occurredAt:s,body:{contentType:a,filename:c,filesize:l,url:u}}=e.body;r({type:Tu,fileId:i}),o(t,n,s,a,c,l,u)}),(e=>{let n;switch(e&&e.body?e.body.error:""){case"file_uploads_are_disabled":n=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":n=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":n=t("fileUpload.errors.wrongType");break;case"virus_found":n=t("fileUpload.errors.virusFound");break;default:n=t("fileUpload.errors.general")}r({type:Su,fileId:i,errorText:n})}));r({type:Eu,fileId:i,fileName:e.name,uploadHandle:a})},children:e})},Cu=({store:e,children:t,config:r,eventBus:n,api:o})=>((0,i.useErrorBoundary)((t=>e.dispatch(Xl(t)))),(0,U.jsx)(F,{store:e,children:(0,U.jsx)(en.Provider,{value:n,children:(0,U.jsx)(Zr.Provider,{value:o,children:(0,U.jsx)(iu,{children:(0,U.jsxs)(ol,{children:[(0,U.jsx)(cu,{config:r}),(0,U.jsx)(_u,{eventBus:n}),(0,U.jsx)(nu,{}),(0,U.jsx)(ou,{}),(0,U.jsx)(su,{}),(0,U.jsxs)(au,{children:[(0,U.jsx)(tu,{}),(0,U.jsx)(Pu,{children:t})]})]})})})})}));function Au(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Iu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Au(Object(r),!0).forEach((function(t){Nu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Au(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Nu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Du=e=>(0,U.jsx)(Cu,Iu(Iu({},e),{},{children:(0,U.jsx)(Jl,{})}));var ku=r(813),Ru=r.n(ku),Lu=r(766),Mu=r.n(Lu);function Uu(e){const t="cvco."+e;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let r;do{r=sessionStorage.getItem(e[0])}while(e.shift()&&!r);return JSON.parse(r)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}var Fu=r(905),Bu=r.n(Fu),Hu=e=>"function"==typeof e?e:function(){return e},$u="undefined"!=typeof self?self:null,zu="undefined"!=typeof window?window:null,Vu=$u||zu||Vu,qu="closed",Wu="errored",Gu="joined",Ku="joining",Yu="leaving",Ju="phx_close",Qu="phx_error",Xu="phx_reply",Zu="phx_leave",ep=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,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:r}){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})}},tp=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))}},rp=class{static request(e,t,r,n,o,i,s){if(Vu.XDomainRequest){let r=new Vu.XDomainRequest;return this.xdomainRequest(r,e,t,n,o,i,s)}{let a=new Vu.XMLHttpRequest;return this.xhrRequest(a,e,t,r,n,o,i,s)}}static xdomainRequest(e,t,r,n,o,i,s){return e.timeout=o,e.open(t,r),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,o,i,s,a){return e.open(t,r,!0),e.timeout=i,e.setRequestHeader("Content-Type",n),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 r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let o=t?`${t}[${n}]`:n,i=e[n];"object"==typeof i?r.push(this.serialize(i,o)):r.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},np=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/websocket"),"$1/longpoll")}endpointURL(){return rp.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return 1===this.readyState||0===this.readyState}poll(){this.ajax("GET",null,(()=>this.ontimeout()),(e=>{if(e){var{status:t,token:r,messages:n}=e;this.token=r}else t=0;switch(t){case 200:n.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){this.ajax("POST",e,(()=>this.onerror("timeout")),(e=>{e&&200===e.status||(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))}))}close(e,t,r){for(let e of this.reqs)e.abort();this.readyState=3;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,r,n){let o;o=rp.request(e,this.endpointURL(),"application/json",t,this.timeout,(()=>{this.reqs.delete(o),r()}),(e=>{this.reqs.delete(o),this.isActive()&&n(e)})),this.reqs.add(o)}},op={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 r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,o,i,s]=JSON.parse(e);return t({join_ref:r,ref:n,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+r.length+o.length+n.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++,r.length),c.setUint8(l++,o.length),c.setUint8(l++,n.length),Array.from(t,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(o,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(n,(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),r=t.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(e.slice(s,s+n));s+=n;let c=r.decode(e.slice(s,s+o));s+=o;let l=r.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,r){let n=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(e.slice(a,a+n));a+=n;let l=r.decode(e.slice(a,a+o));a+=o;let u=r.decode(e.slice(a,a+i));a+=i;let p=r.decode(e.slice(a,a+s));a+=s;let f=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:Xu,payload:{status:p,response:f}}},decodeBroadcast(e,t,r){let n=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=r.decode(e.slice(i,i+n));i+=n;let a=r.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}};function ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ip(Object(r),!0).forEach((function(t){ap(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ip(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ap(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cp(Object(r),!0).forEach((function(t){up(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function up(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pp=Bu()("seamly");class fp{constructor(e,t,r,n){this.url=e,this.accessToken=n,this.channelName=t,this.channelTopic=r,this.connect(),this.socket.onError((e=>{pp("[SOCKET][ERROR]",e),this.emit({type:"error",payload:{type:"seamly_offline",error:e}})})),this.socket.onOpen((()=>{pp("[SOCKET]OPEN"),this.emit({type:"socket_opened"})})),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&this.emit({type:"connection",connected:!0,ready:!0})})),this.socket.onClose((()=>{pp("[SOCKET]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onClose((()=>{pp("[CHANNEL]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onError((e=>{pp("[CHANNEL][ERROR]",e),this.emit({type:"connection",connected:!1,ready:!1})})),this.listenTo("ack"),this.listenTo("ui"),this.listenTo("error"),this.listenTo("participant",((e,t)=>lp(lp({},t),{},{type:e}))),this.listenTo("message"),this.listenTo("service_data"),this.listenTo("system"),this.listenTo("info"),this.listenTo("sync")}start(e){this.listener=e,this.channel.join().receive("ok",(()=>{pp("[CHANNEL][JOIN] OK"),this.emit({type:"connection",connected:!0,ready:!1})})).receive("error",(e=>{pp("[CHANNEL][JOIN] ERROR",e),this.emit({type:"error",payload:{type:"join_channel_erred",error:e}}),this.emit({type:"connection",connected:!1,ready:!1}),this.channel.socket.disconnect()})).receive("timeout",(()=>{pp("[CHANEL][JOIN] Networking issue. Still waiting...")}))}stop(){this.listener=null}connect(){const{url:e,params:t}=(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[r,n]=t.split("=");return sp(sp({},e),{},{[r]:decodeURIComponent(n)})}),{})}})(this.url);this.socket=new 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||Vu.WebSocket||np,this.establishedConnections=0,this.defaultEncoder=op.encode.bind(op),this.defaultDecoder=op.decode.bind(op),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==np?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;zu&&zu.addEventListener&&(zu.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),r=this.connectClock)})),zu.addEventListener("pageshow",(e=>{r===this.connectClock&&(r=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.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Hu(t.params||{}),this.endPoint=`${e}/websocket`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new tp((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return np}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=rp.appendParams(rp.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,r){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Hu(e)),this.conn||(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))}log(e,t,r){this.logger(e,t,r)}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(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage((o=>{o.ref===t&&(this.off([n]),e(Date.now()-r))}));return!0}onConnOpen(){this.hasLogger()&&this.log("transport",`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.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,r||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(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(),clearTimeout(this.heartbeatTimer),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,r=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,n])=>{n(e,t,r)})),(t===this.transport||r>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Qu)}))}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 r=new class{constructor(e,t,r){this.state=qu,this.topic=e,this.params=Hu(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ep(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new tp((()=>{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=Gu,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Wu,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=qu,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=Wu,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 ep(this,Zu,Hu({}),this.timeout).send(),this.state=Wu,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(Xu,((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(Ju,e)}onError(e){return this.on(Qu,(t=>e(t)))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter((r=>!(r.event===e&&(void 0===t||t===r.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=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 n=new ep(this,e,(function(){return t}),r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Yu;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ju,"leave")},r=new ep(this,Zu,Hu({}),e);return r.receive("ok",(()=>t())).receive("timeout",(()=>t())),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}isMember(e,t,r,n){return!(this.topic!==e||n&&n!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Ku,this.joinPush.resend(e))}trigger(e,t,r,n){let o=this.onMessage(e,t,r,n);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,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===qu}isErrored(){return this.state===Wu}isJoined(){return this.state===Gu}isJoining(){return this.state===Ku}isLeaving(){return this.state===Yu}}(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:o,join_ref:i}=e;this.log("push",`${t} ${r} (${i}, ${o})`,n)}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.heartbeatTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}abnormalClose(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,e)}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:r,payload:n,ref:o,join_ref:i}=e;o&&o===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${t} ${r} ${o&&"("+o+")"||""}`,n);for(let e=0;e<this.channels.length;e++){const s=this.channels[e];s.isMember(t,r,n,i)&&s.trigger(r,n,o,i)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,r]=this.stateChangeCallbacks.message[t];r(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())}}(e,{params:lp(lp({},t),{},{v:ie})}),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName})}disconnect(){return new Promise((e=>{this.socket.disconnect(e)}))}listenTo(e,t=null){this.channel.on(e,(r=>{pp("[RECEIVE]",e,r),this.emit({type:e,payload:t?t(e,r):r})}))}emit(e){this.listener&&this.listener.next(e)}push(e,t,r){this.channel.push(e,t,r)}}class dp{constructor(e){this.name=e}emit(e){this.listener&&this.listener.next(e)}start(e){this.listener=e}stop(){this.listener=null}}function hp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hp(Object(r),!0).forEach((function(t){bp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function bp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const mp=Bu()("seamly");function gp(){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 vp{constructor({layoutMode:e,namespace:t,config:r={},context:n={}}){this.store=function(e,t){const r=t(e),n=r.get()||{};return{get:e=>void 0===e?n:n[e],set:(e,t)=>(n[e]=t,r.set(n),t),delete(e){const t=this.get(e);return delete n[e],r.set(n),t}}}(`${t}.connection${n.locale?"."+n.locale:""}`,r.storageProvider||Uu),this.connectionInfo={apiKey:r.key,domain:r.domain||"api.seamly-app.com",secure:!1!==r.secure&&(r.secure||!0)},this.config={sendEnvironment:r.sendEnvironment??!0,context:yp(yp({},n),{},{channelName:n.channelName||"web"})},this.connected=!1,this.configReady=!1,this.externalId=r.externalId,this.layoutMode=e,this.userResponded=!1,this.internalProducer=new dp("API"),this.internal$=Ru().create(this.internalProducer).flatten(),this.connection$=this.internal$.filter((e=>"connection"===e.type)),this.connection$.subscribe({next:({connected:e,ready:t})=>{this.connected=e,this.ready=t}}),this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getAccessToken(){return this.store.get("accessToken")}setAccessToken(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}setConversationUrl(e){this.store.set("conversationUrl",e)}hasConversation(){return!!this.getConversationUrl()}getChannelTopic(){return this.store.get("channelTopic")||this.store.get("channelName")}setChannelTopic(e){this.store.set("channelTopic",e)}getLocale=e=>e||this.locale;clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}getUrlPrefix(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}updateUrls({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:r}])=>yp(yp({},e),{},{[t]:r})),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversationProducer&&await this.conversationProducer.disconnect(),this.connected=!1,this.configReady=!1}async createConversation(){try{var e;const t=Mu().post(`${this.getUrlPrefix("http")}${this.URLS.conversations}`).set("Content-Type","application/json").query({v:ie}).withCredentials().send({externalId:this.externalId||void 0}),{body:r}=await t,{conversation:n}=r,o=yp({},n);return delete o.accessToken,delete o.channelTopic,this.setAccessToken(n.accessToken),this.setChannelTopic(n.channelTopic),this.updateUrls(r),this.setConversationUrl(this.URLS.conversation),this.locale=null===(e=n.translation)||void 0===e?void 0:e.locale,this.userResponded=n.userResponded,o}catch(e){if(e.status>=500)throw new io(e);throw e}}getConfig(){return Mu().post(`${this.getUrlPrefix("http")}/client/${this.connectionInfo.apiKey}/configs`).set("Content-Type","application/json").query({v:ie}).send({context:yp(yp({},this.config.context),{},{environment:!0===this.config.sendEnvironment?this.getEnvironment():this.config.sendEnvironment})}).then((({body:e})=>(this.updateUrls(e),this.configReady=!0,e.config))).catch((e=>{if(404===e.status)throw new so;if(e.status>=500)throw new io(e);throw e}))}async getConversation(){if(!this.hasConversation())return null;try{const{body:e}=await Mu().get(`${this.getUrlPrefix("http")}${this.URLS.history}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:ie});this.updateUrls(e);const{messages:t,participants:r,activeServiceSessionId:n,activeServiceSettings:o,serviceData:i,ui:s,translation:a}=e.history;return{events:t.map((([e,t])=>({type:e,payload:yp(yp({},t),{},{type:"participant"===e?e:t.type})}))),participants:r,activeServiceSessionId:n,activeServiceSettings:o,serviceData:i,resumeConversationPrompt:!!s&&Boolean(s.resumeConversationPrompt),translation:a}}catch(e){if(401===e.status)throw new co(e);if(404===e.status)throw new kr(e);if(e.status>=500)throw new io(e);throw e}}async connect(){this.connected=!1;let e=null;return this.hasConversation()||(e=await this.createConversation()),this.conversationProducer=new fp(`${this.getUrlPrefix("ws")}${this.URLS.socket}`,this.config.context.channelName,this.getChannelTopic(),this.getAccessToken()),this.internalProducer.emit(Ru().create(this.conversationProducer)),this.config.sendEnvironment&&this.send("context",{environment:!0===this.config.sendEnvironment?this.getEnvironment():this.config.sendEnvironment},!1),e}uploadFile(e,t,r,n){const o=new FormData;o.append("upload",e);const i=Mu().post(`${this.getUrlPrefix("http")}${this.URLS.uploads}`).set("Authorization",`Bearer ${this.getAccessToken()}`).send(o);return i.on("progress",(function(e){const{direction:r,percent:n}=e;"upload"===r&&"function"==typeof t&&t(n)})),i.then((e=>{r&&r(e)})).catch((e=>{if(!n)throw e;n(e.response)})),i}getConversationIntitialState(){return Mu().get(`${this.getUrlPrefix("http")}${this.getConversationUrl()}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:ie}).then((({body:e})=>{return this.updateUrls(e),this.userResponded=e.conversation.userResponded,t=e.conversation,r=["accessToken","channelTopic"],Object.keys(t).reduce(((e,n)=>(r.includes(n)||(e[n]=t[n]),e)),{});var t,r})).catch((e=>{if(401===e.status)throw new co(e);if(404===e.status)throw new kr(e);if(e.status>=500)throw new io(e);throw e}))}async getTranslations(e){try{const t=`${this.getUrlPrefix("http")}${this.URLS.translations}`.replace("{version}",String(1)).replace("{locale}",this.getLocale(e)),r=Mu().get(t),{body:n}=await r;return n.translations}catch(e){if(e.status>=500)throw new io(e);throw e}}send(e,t,r=!0){!this.connected||r&&!this.ready?this.connection$.filter((e=>r?e.connected&&e.ready:e.connected)).take(1).subscribe({next:()=>this.send(e,t,r)}):(mp("[SEND]",e,t),this.conversationProducer.push(e,function(e,t){if("message"!==e)return t;const{type:r,body:n}=t;let{transactionId:o}=t;return o||(o=s()),{type:r,body:n,transactionId:o}}(e,t),1e4))}sendContext(e={}){const{locale:t,variables:r}=e,n={};if(t){if("string"!=typeof t)throw new Error("Locale must be a string");n.locale=t}if(r){if("object"!=typeof r)throw new Error("Variables must be an object");n.variables=r}0===Object.keys(n).length&&n.constructor===Object||this.send("context",n,!1)}stream(){return this.internal$.filter((e=>"connection"!==e.type))}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.layoutMode,clientVersion:"20.7.0",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:gp(),userAgent:navigator.userAgent}}}function Op(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Op(Object(r),!0).forEach((function(t){wp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Op(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function wp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _p({api:e}){return()=>t=>r=>{const n=t(r);switch(r.type){case He.SET_USER_SELECTED_OPTIONS:e.store.set("options",r.options);break;case He.SET_USER_SELECTED_OPTION:e.store.set("options",jp(jp({},e.store.get("options")||{}),{},{[r.option]:r.value}))}return n}}function Ep(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var xp=Ep();xp.withExtraArgument=Ep;const Sp=xp,Tp={events:[],initialState:{},unreadEvents:0,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:s(),optionsButtonId:s(),headerCollapseButtonId:s(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],entryMeta:{default:Se,active:Se,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{}},seamlyContainerElement:null};function Pp(e=Tp,t){return t.type===String(Hr.pending)?Tp:((e,t)=>{switch(t.type){case ze:const{type:i,payload:a}=t.event,c=e.options.features.hasOwnProperty(Be),l=Nt(e.entryMeta,a);let u=we({},e.options);if(c&&(i===Ee.message||i===Ee.participant)&&!a.fromClient){var r;const e=null==a||null===(r=a.entry)||void 0===r?void 0:r.type;u=we(we({},u),{},{features:we(we({},u.features),{},{uploads:we(we({},u.features.uploads),{},{enabledFromEntry:e===Te})})})}const p=Pt(t.event);return e.events.find((e=>e.payload.id===a.id))?e:we(we({},e),{},{entryMeta:c||l.active!==Te?l:we({},e.entryMeta),options:u,unreadEvents:p?e.unreadEvents+1:e.unreadEvents,events:[...e.events,we(we({},t.event),{},{payload:we(we({},p&&{messageStatus:a.fromClient?Ce:Pe}),{},{key:s()},a)})]});case Ke:if(!t.event.payload.transactionId)return console.warn("ACK received without transaction ID."),e;const f=e.events.find((e=>e.payload.transactionId===t.event.payload.transactionId)),{id:d,occurredAt:h}=t.event.payload;return f?we(we({},e),{},{events:Ct(e.events.map((e=>e.payload.id===f.payload.id?we(we({},e),{},{payload:we(we({},e.payload),{},{id:d,occurredAt:h})}):e)))}):e;case Ve:return we(we({},e),{},{unreadEvents:0,loadedImageEventIds:[],events:[]});case We:return we(we({},e),{},{unreadEvents:0,events:e.events.map((e=>-1!==t.ids.indexOf(e.payload.id)?we(we({},e),{},{payload:we(we({},e.payload),e.payload.messageStatus===Pe&&{messageStatus:Ce})}):e))});case Ge:return we(we({},e),{},{loadedImageEventIds:[...e.loadedImageEventIds,t.eventId]});case qe:const{events:y,participants:b,activeServiceSessionId:m,activeServiceSettings:g={},serviceData:v,resumeConversationPrompt:O}=t.history,j=((e,t)=>{const r=e.filter((e=>!t.some((t=>t.payload.id===e.payload.id)))),n=t.filter((e=>!("participant"===e.type&&!e.payload.participant.introduction))).reverse();return Ct([...n,...r])})(e.events,y),w=we(we({},e.participantInfo.participants),b),_=j.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let E=null;_&&("message"===_.type&&(E=_.payload.participant),"participant"===_.type&&(E=_.payload.participant.id));const{entry:x,uploads:S}=g,T=Nt(we(we(we({},e.entryMeta),x),{},{active:x.default||xe,options:we({},x&&x.options?x.options:{})}),j[j.length-1].payload);let P=we({},e.options.features);const C=P.hasOwnProperty(Be);if(C){var n,o;const e=null==_||null===(n=_.payload)||void 0===n||null===(o=n.entry)||void 0===o?void 0:o.type;P=we(we({},P),{},{uploads:{enabled:!(!S||!S.enabled),enabledFromEntry:e===Te}})}const A=we(we({},e),{},{unreadEvents:j.filter((e=>"message"===e.type&&e.payload.messageStatus===Pe)).length,events:j.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),participantInfo:we(we(we({},e.participantInfo),E?At(e.participantInfo,{type:Qe,participant:w[E]}):{}),{},{participants:w}),historyLoaded:!0,serviceInfo:we(we({},e.serviceInfo),{},{activeServiceSessionId:m}),serviceData:v||{},options:we(we({},e.options),{},{features:P}),entryMeta:C||T.active!==Te?T:we({},e.entryMeta),resumeConversationPrompt:O||!1});return E&&(A.headerTitles=It(e.headerTitles,{type:Ze,title:w[E].name})),A;case et:return we(we({},e),{},{historyLoaded:!1});case Ye:return we(we({},e),{},{isLoading:t.isLoading});case rt:const{delaySeconds:I,delayTime:N}=t;return we(we({},e),{},{idleDetachCountdown:{hasCountdown:!0,isActive:!0,wasStopped:!1,count:I,remaining:I,timer:N}});case nt:const{idleDetachCountdown:D}=e,{remaining:k}=D,R=k-1;return we(we({},e),{},{idleDetachCountdown:we(we({},e.idleDetachCountdown),{},{remaining:R,timer:fe(R)})});case ot:return we(we({},e),{},{idleDetachCountdown:we(we({},e.idleDetachCountdown),{},{isActive:!1,wasStopped:!0})});case it:return we(we({},e),{},{idleDetachCountdown:{hasCountdown:!1,isActive:!1}});case st:return we(we({},e),{},{resumeConversationPrompt:!0});case at:return we(we({},e),{},{resumeConversationPrompt:!1});case Qe:case Je:return we(we({},e),{},{participantInfo:At(e.participantInfo,t)});case tt:return e.serviceInfo.activeServiceSessionId!==t.activeServiceSessionId?we(we({},e),{},{serviceInfo:we(we({},e.serviceInfo),{},{activeServiceSessionId:t.activeServiceSessionId})}):e;case Xe:case Ze:return we(we({},e),{},{headerTitles:It(e.headerTitles,t)});case ft:const{initialState:L}=t;return we(we({},e),{},{initialState:L,unreadEvents:L.unreadMessageCount});case ct:return we(we({},e),{},{serviceData:we(we({},e.serviceData),{},{[t.payload.type]:t.payload})});case lt:return we(we({},e),{},{options:we(we({},e.options),{},{features:t.features})});case ut:return e.options.features.hasOwnProperty(t.key)?we(we({},e),{},{options:we(we({},e.options),{},{features:we(we({},e.options.features),{},{[t.key]:we(we({},e.options.features[t.key]||{}),{},{enabled:t.enabled})})})}):e;case pt:return we(we({},e),{},{options:we(we({},e.options),{},{features:{}})});case yt:return we(we({},e),{},{options:we(we({},e.options),{},{panelActive:!0,optionActive:t.optionName})});case bt:return we(we({},e),{},{options:we(we({},e.options),{},{panelActive:!1,optionActive:""})});case ht:return we(we({},e),{},{options:we(we({},e.options),{},{userSelectedOptions:t.options})});case dt:const{option:M,value:U}=t;return we(we({},e),{},{options:we(we({},e.options),{},{userSelectedOptions:we(we({},e.options.userSelectedOptions),{},{[M]:U})})});case mt:const{value:F}=t;return we(we({},e),{},{entryMeta:we(we({},e.entryMeta),{},{blockAutoEntrySwitch:F})});case Ot:const{entryMeta:B}=t;return we(we({},e),{},{entryMeta:we(we(we({},e.entryMeta),B),{},{active:B.default,options:we({},B.options||{}),overrideOptions:{}})});case vt:const{entryType:H}=t;return we(we({},e),{},{entryMeta:we(we({},e.entryMeta),{},{active:H})});case gt:const{entryType:$}=t;return we(we({},e),{},{entryMeta:we(we({},e.entryMeta),{},{userSelected:$})});case jt:return we(we({},e),{},{currentUploads:[...e.currentUploads,{id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle}]});case wt:return we(we({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?we(we({},e),{},{progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}):e))});case Et:return we(we({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?we(we({},e),{},{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))});case _t:return we(we({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?we(we({},e),{},{complete:!0}):e))});case xt:return we(we({},e),{},{currentUploads:e.currentUploads.filter((e=>e.id!==t.fileId))});case St:return we(we({},e),{},{currentUploads:[]});case Tt:return we(we({},e),{},{seamlyContainerElement:t.element});default:return e}})(e,t)}const Cp=["namespace","parentElement","showFaq"],Ap=["view"];function Ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Np(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ip(Object(r),!0).forEach((function(t){Dp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ip(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kp(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}class Rp{constructor(e,t){const{namespace:r="",parentElement:n,showFaq:i}=e,s=kp(e,Cp);this.config=Np(Np({},s),{},{namespace:r,showFaq:!1!==i}),this.namespace=r,this.parentElement=n,this.externalApi=t,this.api=new vp({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)))}async render(){const t=this.config.customComponents||{},{view:r}=t,n=kp(t,Ap),o=Np(Np({},this.config),{},{customComponents:Object.keys(n).length?n:void 0}),i=function({initialState:e,api:t,eventBus:r,config:n}={}){return Q({reducers:{state:Pp,[String(si)]:si,[String(Jr)]:Jr,[String(cs)]:cs,[String(Oi)]:Oi,[String(Nn)]:Nn,[String(mo)]:mo,[String(xo)]:xo},initialState:e,middlewares:[Zl({api:t}),Sp.withExtraArgument({api:t,eventBus:r,config:n}),uo({api:t}),_p({api:t}),yi]})}({api:this.api,eventBus:this.eventBus,config:o});await i.dispatch(Hr()),r?(0,e.render)((0,U.jsx)(Cu,{config:o,eventBus:this.eventBus,store:i,api:this.api,children:(0,U.jsx)(r,{})}),this.parentElement):(0,e.render)((0,U.jsx)(Du,{config:o,eventBus:this.eventBus,store:i,api:this.api}),this.parentElement)}destroy(){(0,e.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 r=this.functions[e];r&&r.length&&(this.functions[e]=r.filter((e=>e!==t)))}execFunction(e,...t){const r=this.functions[e];return!(!r||!r.length||(r.forEach((r=>{try{r(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}function Lp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lp(Object(r),!0).forEach((function(t){Up(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Up(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fp=e=>"object"==typeof e&&"action"in e,Bp=e=>Mp(Mp({},e),{},{args:Array.isArray(e.args)?e.args:[e.args]}),Hp=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(Fp).map(Bp)).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)}}))}setContext(e,t){switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:r,locale:n}=t;return r&&n&&(this.context.translationLocale=n),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables=Mp({},t)),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),r=this.getCombinedConfig(t),{parentElement:n,namespace:o}=r||t;if(o?Object.values(this._instances).forEach((e=>{e.parentElement!==n&&e.namespace!==o||this.destroy(e)})):this.destroy(),r){const e=this.createInstance(r);this._instances[r.namespace]=e,this.context={},e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:r,args:n}=e,o=Object.values(this._instances);return!r&&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=>(!r||e.namespace===r)&&e.execFunction(t,...n))).some(Boolean)}createInstance(e){return new Rp(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=Mp(Mp({},e.context||this.appConfig.context),this.context),r=this.getMergedVariables(e);Object.keys(r).length>0&&(t.variables=r);const n=Mp(Mp({},this.appConfig.defaults),e.defaults),o=Mp(Mp(Mp({},this.appConfig),e),{},{api:Mp(Mp({},this.appConfig.api),e.api),context:Object.keys(t).length?t:void 0,defaults:Object.keys(n).length?n:void 0});return"function"==typeof this.appConfig?this.appConfig(o):o}getMergedVariables(e){var t,r;return Mp(Mp(Mp({},(null===(t=this.appConfig.context)||void 0===t?void 0:t.variables)||{}),(null===(r=e.context)||void 0===r?void 0:r.variables)||{}),this.context.variables||{})}},$p=()=>{const{t:e}=Tn(),{title:t,subTitle:r}=lr(),n=ur(),{isOpen:o}=vo(),i=dr(),{hasInterrupt:s}=oo(),a=ne(),c=(null==i?void 0:i.avatar)??a,l=s?"":r,u=["message-count"];return o&&u.push("message-count__hide"),0===n&&u.push("message-count__empty"),(l||!o)&&(0,U.jsxs)("div",{className:Xr("agent-info"),children:[(0,U.jsxs)("div",{className:Xr("agent-info__graphic"),children:[c?(0,U.jsx)("img",{className:Xr(null!=i&&i.avatar?"avatar":"icon"),src:c,alt:""}):(0,U.jsx)(wi,{name:"avatar",size:"32"}),(0,U.jsx)("span",{className:Xr(u),"aria-hidden":"true",children:n})]}),(0,U.jsxs)("div",{className:Xr("agent-info__body"),children:[(0,U.jsx)("p",{className:Xr("agent-info__heading"),children:t??e("header.title")}),(0,U.jsx)("p",{className:Xr("agent-info__text"),children:l})]})]})},zp=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:r}=ir(),n=(0,i.useRef)(null),{t:o}=Tn();return(0,U.jsxs)("header",{className:Xr("chat__header"),children:[e,(0,U.jsx)("div",{className:Xr("header-controls"),children:(0,U.jsx)("button",{type:"button",className:Xr("button","header-controls__collapse"),onClick:t,ref:n,id:r,children:(0,U.jsx)(wi,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},Vp=({onOpenChat:e})=>{const{t}=Tn(),r=So(),{isOpen:n}=vo(),o=(0,i.useRef)(null),s=(0,i.useRef)(null),a=(0,i.useRef)(),c=Mn(),l=(()=>{const e=(0,i.useRef)(null),[t]=Rn();return e.current=t,(0,i.useCallback)((t=>{Oe(e.current,(()=>{kn(t)}))}),[])})(),u=dr(),p=lr().subTitle,{hasInterrupt:f}=oo(),{headerCollapseButtonId:d}=ir(),h=u&&!f;return(0,i.useLayoutEffect)((()=>{!1===n&&!0===o.current&&l(s.current),o.current=n}),[n,l]),(0,U.jsxs)("div",{className:Xr("toggle-button"),children:[(0,U.jsxs)("div",{id:r,children:[(0,U.jsx)("p",{className:Xr("toggle-button__title"),children:t(h?"toggleButton.resumeTitle":"toggleButton.title")}),(0,U.jsx)("p",{className:Xr("toggle-button__subtitle"),children:h?p:t("toggleButton.subtitle")})]}),(0,U.jsx)("button",{type:"button","aria-labelledby":r,className:Xr("toggle-button__button"),ref:s,onMouseUp:()=>{a.current="mouse"},onKeyUp:()=>{a.current="key"},onClick:()=>{e(),"mouse"===a.current?c():"key"===a.current&&l(d)}})]})},qp=["categories"];function Wp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Gp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wp(Object(r),!0).forEach((function(t){Kp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Kp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Yp=()=>{const{t:e}=Tn(),{sendAction:t,addMessageBubble:r}=Do(),n=So(),o=Mn(),{sendPolite:s}=Ro(),{hasInterrupt:a}=oo(),{hasCountdown:c,endCountdown:l}=Zo(),{hasPrompt:u,continueChat:p}=ti(),f=hr("suggestion"),[d]=fi({payload:f}),h=(0,i.useMemo)((()=>(f&&!a?d:[]).map((e=>{let{categories:t=[]}=e;return Gp(Gp({},function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,qp)),{},{categories:t,classNames:["faqs__item",...t.map((e=>`faqs__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`))]})}))),[f,a,d]),y=(0,i.useRef)(null),b=(0,i.useRef)(!1),{isInline:m}=yr(),g=go(),v=!m&&g,O=(0,i.useRef)(v),j=!!h.length,w=j&&!v,_=(0,i.useRef)([]),E=j?h:_.current;_.current=E;const x=(0,i.useRef)(null);(0,i.useEffect)((()=>{if(y.current!==h&&!v){if(j){const t=b.current?e("faq.srUpdatedText"):e("faq.srAvailableText");setTimeout((()=>{s(t)}),30)}else b.current&&s(e("faq.srUnavailableText"));y.current=h}!O.current&&v?(Oe(x.current,o),s(e("faq.srUnavailableText"))):!j&&b.current&&Oe(x.current,o),b.current=j,O.current=v}),[j,h,v,o,s,e]);const S=e("faq.headingText"),T=S?"section":"div";return(0,U.jsx)(Pi,{isActive:w,transitionStartState:xi,children:(0,U.jsxs)(T,{className:Xr("faqs"),"aria-labelledby":S?n:null,ref:x,children:[S&&(0,U.jsx)("h2",{id:n,className:Xr("faqs__heading"),children:S}),!!E.length&&(0,U.jsx)("ul",{className:Xr("faqs__list"),children:E.map((e=>(0,U.jsx)("li",{className:Xr(e.classNames),children:(0,U.jsxs)("button",{type:"button",onClick:()=>{(({id:e,question:n})=>{c&&l(!0),u&&p(),t({type:Ae,originMessage:f.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:n}}}),r(n),o()})(e)},className:Xr("button","button--secondary"),children:[(0,U.jsx)(wi,{name:"chevronRight",size:"8"}),e.question]})},e.id.toString())))})]})})},Jp=({children:e})=>{const[,t]=Rn(),{isOpen:r,isVisible:n,setVisibility:o}=vo(),{zIndex:s,showFaq:a,layoutMode:c}=re(),{isInline:l}=yr(),u=an(),p=go(),{locale:f}=Tn(),d=(0,i.useCallback)((e=>{t(e)}),[t]),h=(0,i.useMemo)((()=>{if(f&&document.querySelector("html").getAttribute("lang")!==f)return f}),[f]),y=["app","app--deprecated",...u];return r||"window"!==c||y.push("app--collapsed"),p&&y.push("app--user-responded"),y.push(`app--layout-${c}`),n&&(0,U.jsxs)("section",{className:Xr(y),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&r&&o(C.minimized)},lang:h,tabIndex:"-1",ref:d,style:{zIndex:s},"data-nosnippet":!0,children:[(0,U.jsx)("div",{className:Xr("app-wrapper"),children:e}),a&&(0,U.jsx)(Yp,{})]})},Qp=()=>{const{isVisible:e}=vo(),{openChat:t,closeChat:r}=qo(),{showInlineView:n,containerRef:o}=Oo();return e&&(0,U.jsx)("div",{ref:o,children:n&&(0,U.jsxs)(Jp,{children:[(0,U.jsx)(Vp,{onOpenChat:t}),(0,U.jsx)(zp,{onCloseChat:r,children:(0,U.jsx)($p,{})}),(0,U.jsxs)(Hl,{interruptComponent:Ks,children:[(0,U.jsx)(sl,{}),(0,U.jsx)(Nl,{})]})]})})},Xp=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:[],r=new Hp(e);window.seamly={push:r.push.bind(r)},r.push(...t)}})(),module.exports=n})();
|