@telelogx/analytick-widget 1.0.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/README.md +727 -0
- package/dist/analytick-widget.css +1 -0
- package/dist/analytick-widget.es.js +8326 -0
- package/dist/analytick-widget.umd.js +1 -0
- package/dist/demo.html +123 -0
- package/dist/vite.svg +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AnalytickWidget={})}(this,function(e){"use strict";var t,r,n,i,o,a,s,l,c,d,u,h,g=Object.defineProperty,p=Object.defineProperties,m=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,b=Math.pow,w=(e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>{for(var r in t||(t={}))v.call(t,r)&&w(e,r,t[r]);if(f)for(var r of f(t))y.call(t,r)&&w(e,r,t[r]);return e},_=(e,t)=>p(e,m(t)),k=(e,t,r)=>w(e,"symbol"!=typeof t?t+"":t,r),C=(e,t,r)=>new Promise((n,i)=>{var o=e=>{try{s(r.next(e))}catch(Ne){i(Ne)}},a=e=>{try{s(r.throw(e))}catch(Ne){i(Ne)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,a);s((r=r.apply(e,t)).next())}),S={},N=[],E=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,T=Array.isArray;function L(e,t){for(var r in t)e[r]=t[r];return e}function I(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function O(e,r,n){var i,o,a,s={};for(a in r)"key"==a?i=r[a]:"ref"==a?o=r[a]:s[a]=r[a];if(arguments.length>2&&(s.children=arguments.length>3?t.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===s[a]&&(s[a]=e.defaultProps[a]);return $(e,s,i,o,null)}function $(e,t,i,o,a){var s={type:e,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==a?++n:a,__i:-1,__u:0};return null==a&&null!=r.vnode&&r.vnode(s),s}function R(e){return e.children}function A(e,t){this.props=e,this.context=t}function F(e,t){if(null==t)return e.__?F(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?F(e):null}function D(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return D(e)}}function z(e){(!e.__d&&(e.__d=!0)&&i.push(e)&&!M.__r++||o!=r.debounceRendering)&&((o=r.debounceRendering)||a)(M)}function M(){for(var e,t,n,o,a,l,c,d=1;i.length;)i.length>d&&i.sort(s),e=i.shift(),d=i.length,e.__d&&(n=void 0,a=(o=(t=e).__v).__e,l=[],c=[],t.__P&&((n=L({},o)).__v=o.__v+1,r.vnode&&r.vnode(n),q(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[a]:null,l,null==a?F(o):a,!!(32&o.__u),c),n.__v=o.__v,n.__.__k[n.__i]=n,K(l,n,c),n.__e!=a&&D(n)));M.__r=0}function B(e,t,r,n,i,o,a,s,l,c,d){var u,h,g,p,m,f,v,y=n&&n.__k||N,b=t.length;for(l=function(e,t,r,n,i){var o,a,s,l,c,d=r.length,u=d,h=0;for(e.__k=new Array(i),o=0;o<i;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?(l=o+h,(a=e.__k[o]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?$(null,a,null,null,null):T(a)?$(R,{children:a},null,null,null):null==a.constructor&&a.__b>0?$(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,-1!=(c=a.__i=U(a,r,l,u))&&(u--,(s=r[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(i>d?h--:i<d&&h++),"function"!=typeof a.type&&(a.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.__u|=4))):e.__k[o]=null;if(u)for(o=0;o<d;o++)null!=(s=r[o])&&!(2&s.__u)&&(s.__e==n&&(n=F(s)),X(s,s));return n}(r,t,y,l,b),u=0;u<b;u++)null!=(g=r.__k[u])&&(h=-1==g.__i?S:y[g.__i]||S,g.__i=u,f=q(e,g,h,i,o,a,s,l,c,d),p=g.__e,g.ref&&h.ref!=g.ref&&(h.ref&&J(h.ref,null,g),d.push(g.ref,g.__c||p,g)),null==m&&null!=p&&(m=p),(v=!!(4&g.__u))||h.__k===g.__k?l=H(g,l,e,v):"function"==typeof g.type&&void 0!==f?l=f:p&&(l=p.nextSibling),g.__u&=-7);return r.__e=m,l}function H(e,t,r,n){var i,o;if("function"==typeof e.type){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=H(i[o],t,r,n));return t}e.__e!=t&&(n&&(t&&e.type&&!t.parentNode&&(t=F(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function P(e,t){return t=t||[],null==e||"boolean"==typeof e||(T(e)?e.some(function(e){P(e,t)}):t.push(e)),t}function U(e,t,r,n){var i,o,a,s=e.key,l=e.type,c=t[r],d=null!=c&&!(2&c.__u);if(null===c&&null==e.key||d&&s==c.key&&l==c.type)return r;if(n>(d?1:0))for(i=r-1,o=r+1;i>=0||o<t.length;)if(null!=(c=t[a=i>=0?i--:o++])&&!(2&c.__u)&&s==c.key&&l==c.type)return a;return-1}function W(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||E.test(t)?r:r+"px"}function j(e,t,r,n,i){var o,a;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||W(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||W(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(l,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.u=n.u:(r.u=c,e.addEventListener(t,o?u:d,o)):e.removeEventListener(t,o?u:d,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(s){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function V(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=c++;else if(t.t<n.u)return;return n(r.event?r.event(t):t)}}}function q(e,n,i,o,a,s,l,c,d,u){var h,g,p,m,f,v,y,b,w,x,_,k,C,N,E,O,$,D=n.type;if(null!=n.constructor)return null;128&i.__u&&(d=!!(32&i.__u),s=[c=n.__e=i.__e]),(h=r.__b)&&h(n);e:if("function"==typeof D)try{if(b=n.props,w="prototype"in D&&D.prototype.render,x=(h=D.contextType)&&o[h.__c],_=h?x?x.props.value:h.__:o,i.__c?y=(g=n.__c=i.__c).__=g.__E:(w?n.__c=g=new D(b,_):(n.__c=g=new A(b,_),g.constructor=D,g.render=Y),x&&x.sub(g),g.props=b,g.state||(g.state={}),g.context=_,g.__n=o,p=g.__d=!0,g.__h=[],g._sb=[]),w&&null==g.__s&&(g.__s=g.state),w&&null!=D.getDerivedStateFromProps&&(g.__s==g.state&&(g.__s=L({},g.__s)),L(g.__s,D.getDerivedStateFromProps(b,g.__s))),m=g.props,f=g.state,g.__v=n,p)w&&null==D.getDerivedStateFromProps&&null!=g.componentWillMount&&g.componentWillMount(),w&&null!=g.componentDidMount&&g.__h.push(g.componentDidMount);else{if(w&&null==D.getDerivedStateFromProps&&b!==m&&null!=g.componentWillReceiveProps&&g.componentWillReceiveProps(b,_),!g.__e&&null!=g.shouldComponentUpdate&&!1===g.shouldComponentUpdate(b,g.__s,_)||n.__v==i.__v){for(n.__v!=i.__v&&(g.props=b,g.state=g.__s,g.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some(function(e){e&&(e.__=n)}),k=0;k<g._sb.length;k++)g.__h.push(g._sb[k]);g._sb=[],g.__h.length&&l.push(g);break e}null!=g.componentWillUpdate&&g.componentWillUpdate(b,g.__s,_),w&&null!=g.componentDidUpdate&&g.__h.push(function(){g.componentDidUpdate(m,f,v)})}if(g.context=_,g.props=b,g.__P=e,g.__e=!1,C=r.__r,N=0,w){for(g.state=g.__s,g.__d=!1,C&&C(n),h=g.render(g.props,g.state,g.context),E=0;E<g._sb.length;E++)g.__h.push(g._sb[E]);g._sb=[]}else do{g.__d=!1,C&&C(n),h=g.render(g.props,g.state,g.context),g.state=g.__s}while(g.__d&&++N<25);g.state=g.__s,null!=g.getChildContext&&(o=L(L({},o),g.getChildContext())),w&&!p&&null!=g.getSnapshotBeforeUpdate&&(v=g.getSnapshotBeforeUpdate(m,f)),O=h,null!=h&&h.type===R&&null==h.key&&(O=Q(h.props.children)),c=B(e,T(O)?O:[O],n,i,o,a,s,l,c,d,u),g.base=n.__e,n.__u&=-161,g.__h.length&&l.push(g),y&&(g.__E=g.__=null)}catch(z){if(n.__v=null,d||null!=s)if(z.then){for(n.__u|=d?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,n.__e=c}else{for($=s.length;$--;)I(s[$]);G(n)}else n.__e=i.__e,n.__k=i.__k,z.then||G(n);r.__e(z,n,i)}else null==s&&n.__v==i.__v?(n.__k=i.__k,n.__e=i.__e):c=n.__e=function(e,n,i,o,a,s,l,c,d){var u,h,g,p,m,f,v,y=i.props,b=n.props,w=n.type;if("svg"==w?a="http://www.w3.org/2000/svg":"math"==w?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=s)for(u=0;u<s.length;u++)if((m=s[u])&&"setAttribute"in m==!!w&&(w?m.localName==w:3==m.nodeType)){e=m,s[u]=null;break}if(null==e){if(null==w)return document.createTextNode(b);e=document.createElementNS(a,w,b.is&&b),c&&(r.__m&&r.__m(n,s),c=!1),s=null}if(null==w)y===b||c&&e.data==b||(e.data=b);else{if(s=s&&t.call(e.childNodes),y=i.props||S,!c&&null!=s)for(y={},u=0;u<e.attributes.length;u++)y[(m=e.attributes[u]).name]=m.value;for(u in y)if(m=y[u],"children"==u);else if("dangerouslySetInnerHTML"==u)g=m;else if(!(u in b)){if("value"==u&&"defaultValue"in b||"checked"==u&&"defaultChecked"in b)continue;j(e,u,null,m,a)}for(u in b)m=b[u],"children"==u?p=m:"dangerouslySetInnerHTML"==u?h=m:"value"==u?f=m:"checked"==u?v=m:c&&"function"!=typeof m||y[u]===m||j(e,u,m,y[u],a);if(h)c||g&&(h.__html==g.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(g&&(e.innerHTML=""),B("template"==n.type?e.content:e,T(p)?p:[p],n,i,o,"foreignObject"==w?"http://www.w3.org/1999/xhtml":a,s,l,s?s[0]:i.__k&&F(i,0),c,d),null!=s)for(u=s.length;u--;)I(s[u]);c||(u="value","progress"==w&&null==f?e.removeAttribute("value"):null!=f&&(f!==e[u]||"progress"==w&&!f||"option"==w&&f!=y[u])&&j(e,u,f,y[u],a),u="checked",null!=v&&v!=e[u]&&j(e,u,v,y[u],a))}return e}(i.__e,n,i,o,a,s,l,d,u);return(h=r.diffed)&&h(n),128&n.__u?void 0:c}function G(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(G)}function K(e,t,n){for(var i=0;i<n.length;i++)J(n[i],n[++i],n[++i]);r.__c&&r.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(n){r.__e(n,t.__v)}})}function Q(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:T(e)?e.map(Q):L({},e)}function J(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(o){r.__e(o,n)}}function X(e,t,n){var i,o;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||J(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(a){r.__e(a,t)}i.base=i.__P=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&X(i[o],t,n||"function"!=typeof e.type);n||I(e.__e),e.__c=e.__=e.__e=void 0}function Y(e,t,r){return this.constructor(e,r)}function Z(e,n,i){var o,a,s;n==document&&(n=document.documentElement),r.__&&r.__(e,n),o=!1?null:n.__k,a=[],s=[],q(n,e=n.__k=O(R,null,[e]),o||S,S,n.namespaceURI,o?null:n.firstChild?t.call(n.childNodes):null,a,o?o.__e:n.firstChild,false,s),K(a,e,s)}function ee(e){function t(e){var r,n;return this.getChildContext||(r=new Set,(n={})[t.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach(function(e){e.__e=!0,z(e)})},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+h++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}t=N.slice,r={__e:function(e,t,r,n){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},n=0,A.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=L({},this.state),"function"==typeof e&&(e=e(L({},r),this.props)),e&&L(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),z(this))},A.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),z(this))},A.prototype.render=R,i=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,s=function(e,t){return e.__v.__b-t.__v.__b},M.__r=0,l=/(PointerCapture)$|Capture$/i,c=0,d=V(!1),u=V(!0),h=0;var te=0;function re(e,t,n,i,o,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?s=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--te,__i:-1,__u:0,__source:o,__self:a};if("function"==typeof e&&(s=e.defaultProps))for(l in s)void 0===c[l]&&(c[l]=s[l]);return r.vnode&&r.vnode(d),d}const ne="\n",ie="\0";class oe{get body(){return!this._body&&this.isBinaryBody&&(this._body=(new TextDecoder).decode(this._binaryBody)),this._body||""}get binaryBody(){return this._binaryBody||this.isBinaryBody||(this._binaryBody=(new TextEncoder).encode(this._body)),this._binaryBody}constructor(e){const{command:t,headers:r,body:n,binaryBody:i,escapeHeaderValues:o,skipContentLengthHeader:a}=e;this.command=t,this.headers=Object.assign({},r||{}),i?(this._binaryBody=i,this.isBinaryBody=!0):(this._body=n||"",this.isBinaryBody=!1),this.escapeHeaderValues=o||!1,this.skipContentLengthHeader=a||!1}static fromRawFrame(e,t){const r={},n=e=>e.replace(/^\s+|\s+$/g,"");for(const i of e.headers.reverse()){i.indexOf(":");const o=n(i[0]);let a=n(i[1]);t&&"CONNECT"!==e.command&&"CONNECTED"!==e.command&&(a=oe.hdrValueUnEscape(a)),r[o]=a}return new oe({command:e.command,headers:r,binaryBody:e.binaryBody,escapeHeaderValues:t})}toString(){return this.serializeCmdAndHeaders()}serialize(){const e=this.serializeCmdAndHeaders();return this.isBinaryBody?oe.toUnit8Array(e,this._binaryBody).buffer:e+this._body+ie}serializeCmdAndHeaders(){const e=[this.command];this.skipContentLengthHeader&&delete this.headers["content-length"];for(const t of Object.keys(this.headers||{})){const r=this.headers[t];this.escapeHeaderValues&&"CONNECT"!==this.command&&"CONNECTED"!==this.command?e.push(`${t}:${oe.hdrValueEscape(`${r}`)}`):e.push(`${t}:${r}`)}return(this.isBinaryBody||!this.isBodyEmpty()&&!this.skipContentLengthHeader)&&e.push(`content-length:${this.bodyLength()}`),e.join(ne)+ne+ne}isBodyEmpty(){return 0===this.bodyLength()}bodyLength(){const e=this.binaryBody;return e?e.length:0}static sizeOfUTF8(e){return e?(new TextEncoder).encode(e).length:0}static toUnit8Array(e,t){const r=(new TextEncoder).encode(e),n=new Uint8Array([0]),i=new Uint8Array(r.length+t.length+n.length);return i.set(r),i.set(t,r.length),i.set(n,r.length+t.length),i}static marshall(e){return new oe(e).serialize()}static hdrValueEscape(e){return e.replace(/\\/g,"\\\\").replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/:/g,"\\c")}static hdrValueUnEscape(e){return e.replace(/\\r/g,"\r").replace(/\\n/g,"\n").replace(/\\c/g,":").replace(/\\\\/g,"\\")}}class ae{constructor(e,t){this.onFrame=e,this.onIncomingPing=t,this._encoder=new TextEncoder,this._decoder=new TextDecoder,this._token=[],this._initState()}parseChunk(e,t=!1){let r;if(r="string"==typeof e?this._encoder.encode(e):new Uint8Array(e),t&&0!==r[r.length-1]){const e=new Uint8Array(r.length+1);e.set(r,0),e[r.length]=0,r=e}for(let n=0;n<r.length;n++){const e=r[n];this._onByte(e)}}_collectFrame(e){0!==e&&13!==e&&(10!==e?(this._onByte=this._collectCommand,this._reinjectByte(e)):this.onIncomingPing())}_collectCommand(e){if(13!==e)return 10===e?(this._results.command=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaders)):void this._consumeByte(e)}_collectHeaders(e){13!==e&&(10!==e?(this._onByte=this._collectHeaderKey,this._reinjectByte(e)):this._setupCollectBody())}_reinjectByte(e){this._onByte(e)}_collectHeaderKey(e){if(58===e)return this._headerKey=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaderValue);this._consumeByte(e)}_collectHeaderValue(e){if(13!==e)return 10===e?(this._results.headers.push([this._headerKey,this._consumeTokenAsUTF8()]),this._headerKey=void 0,void(this._onByte=this._collectHeaders)):void this._consumeByte(e)}_setupCollectBody(){const e=this._results.headers.filter(e=>"content-length"===e[0])[0];e?(this._bodyBytesRemaining=parseInt(e[1],10),this._onByte=this._collectBodyFixedSize):this._onByte=this._collectBodyNullTerminated}_collectBodyNullTerminated(e){0!==e?this._consumeByte(e):this._retrievedBody()}_collectBodyFixedSize(e){0!==this._bodyBytesRemaining--?this._consumeByte(e):this._retrievedBody()}_retrievedBody(){this._results.binaryBody=this._consumeTokenAsRaw();try{this.onFrame(this._results)}catch(e){}this._initState()}_consumeByte(e){this._token.push(e)}_consumeTokenAsUTF8(){return this._decoder.decode(this._consumeTokenAsRaw())}_consumeTokenAsRaw(){const e=new Uint8Array(this._token);return this._token=[],e}_initState(){this._results={command:void 0,headers:[],binaryBody:void 0},this._token=[],this._headerKey=void 0,this._onByte=this._collectFrame}}var se,le,ce,de,ue,he,ge,pe;(le=se||(se={}))[le.CONNECTING=0]="CONNECTING",le[le.OPEN=1]="OPEN",le[le.CLOSING=2]="CLOSING",le[le.CLOSED=3]="CLOSED",(de=ce||(ce={}))[de.ACTIVE=0]="ACTIVE",de[de.DEACTIVATING=1]="DEACTIVATING",de[de.INACTIVE=2]="INACTIVE",(he=ue||(ue={}))[he.LINEAR=0]="LINEAR",he[he.EXPONENTIAL=1]="EXPONENTIAL",(pe=ge||(ge={})).Interval="interval",pe.Worker="worker";class me{constructor(e,t=ge.Interval,r){this._interval=e,this._strategy=t,this._debug=r,this._workerScript=`\n var startTime = Date.now();\n setInterval(function() {\n self.postMessage(Date.now() - startTime);\n }, ${this._interval});\n `}start(e){this.stop(),this.shouldUseWorker()?this.runWorker(e):this.runInterval(e)}stop(){this.disposeWorker(),this.disposeInterval()}shouldUseWorker(){return"undefined"!=typeof Worker&&this._strategy===ge.Worker}runWorker(e){this._debug("Using runWorker for outgoing pings"),this._worker||(this._worker=new Worker(URL.createObjectURL(new Blob([this._workerScript],{type:"text/javascript"}))),this._worker.onmessage=t=>e(t.data))}runInterval(e){if(this._debug("Using runInterval for outgoing pings"),!this._timer){const t=Date.now();this._timer=setInterval(()=>{e(Date.now()-t)},this._interval)}}disposeWorker(){this._worker&&(this._worker.terminate(),delete this._worker,this._debug("Outgoing ping disposeWorker"))}disposeInterval(){this._timer&&(clearInterval(this._timer),delete this._timer,this._debug("Outgoing ping disposeInterval"))}}class fe{constructor(e){this.versions=e}supportedVersions(){return this.versions.join(",")}protocolVersions(){return this.versions.map(e=>`v${e.replace(".","")}.stomp`)}}fe.V1_0="1.0",fe.V1_1="1.1",fe.V1_2="1.2",fe.default=new fe([fe.V1_2,fe.V1_1,fe.V1_0]);class ve{get connectedVersion(){return this._connectedVersion}get connected(){return this._connected}constructor(e,t,r){this._client=e,this._webSocket=t,this._connected=!1,this._serverFrameHandlers={CONNECTED:e=>{this.debug(`connected to server ${e.headers.server}`),this._connected=!0,this._connectedVersion=e.headers.version,this._connectedVersion===fe.V1_2&&(this._escapeHeaderValues=!0),this._setupHeartbeat(e.headers),this.onConnect(e)},MESSAGE:e=>{const t=e.headers.subscription,r=this._subscriptions[t]||this.onUnhandledMessage,n=e,i=this,o=this._connectedVersion===fe.V1_2?n.headers.ack:n.headers["message-id"];n.ack=(e={})=>i.ack(o,t,e),n.nack=(e={})=>i.nack(o,t,e),r(n)},RECEIPT:e=>{const t=this._receiptWatchers[e.headers["receipt-id"]];t?(t(e),delete this._receiptWatchers[e.headers["receipt-id"]]):this.onUnhandledReceipt(e)},ERROR:e=>{this.onStompError(e)}},this._counter=0,this._subscriptions={},this._receiptWatchers={},this._partialData="",this._escapeHeaderValues=!1,this._lastServerActivityTS=Date.now(),this.debug=r.debug,this.stompVersions=r.stompVersions,this.connectHeaders=r.connectHeaders,this.disconnectHeaders=r.disconnectHeaders,this.heartbeatIncoming=r.heartbeatIncoming,this.heartbeatOutgoing=r.heartbeatOutgoing,this.splitLargeFrames=r.splitLargeFrames,this.maxWebSocketChunkSize=r.maxWebSocketChunkSize,this.forceBinaryWSFrames=r.forceBinaryWSFrames,this.logRawCommunication=r.logRawCommunication,this.appendMissingNULLonIncoming=r.appendMissingNULLonIncoming,this.discardWebsocketOnCommFailure=r.discardWebsocketOnCommFailure,this.onConnect=r.onConnect,this.onDisconnect=r.onDisconnect,this.onStompError=r.onStompError,this.onWebSocketClose=r.onWebSocketClose,this.onWebSocketError=r.onWebSocketError,this.onUnhandledMessage=r.onUnhandledMessage,this.onUnhandledReceipt=r.onUnhandledReceipt,this.onUnhandledFrame=r.onUnhandledFrame}start(){const e=new ae(e=>{const t=oe.fromRawFrame(e,this._escapeHeaderValues);this.logRawCommunication||this.debug(`<<< ${t}`);(this._serverFrameHandlers[t.command]||this.onUnhandledFrame)(t)},()=>{this.debug("<<< PONG")});this._webSocket.onmessage=t=>{if(this.debug("Received data"),this._lastServerActivityTS=Date.now(),this.logRawCommunication){const e=t.data instanceof ArrayBuffer?(new TextDecoder).decode(t.data):t.data;this.debug(`<<< ${e}`)}e.parseChunk(t.data,this.appendMissingNULLonIncoming)},this._webSocket.onclose=e=>{this.debug(`Connection closed to ${this._webSocket.url}`),this._cleanUp(),this.onWebSocketClose(e)},this._webSocket.onerror=e=>{this.onWebSocketError(e)},this._webSocket.onopen=()=>{const e=Object.assign({},this.connectHeaders);this.debug("Web Socket Opened..."),e["accept-version"]=this.stompVersions.supportedVersions(),e["heart-beat"]=[this.heartbeatOutgoing,this.heartbeatIncoming].join(","),this._transmit({command:"CONNECT",headers:e})}}_setupHeartbeat(e){if(e.version!==fe.V1_1&&e.version!==fe.V1_2)return;if(!e["heart-beat"])return;const[t,r]=e["heart-beat"].split(",").map(e=>parseInt(e,10));if(0!==this.heartbeatOutgoing&&0!==r){const e=Math.max(this.heartbeatOutgoing,r);this.debug(`send PING every ${e}ms`),this._pinger=new me(e,this._client.heartbeatStrategy,this.debug),this._pinger.start(()=>{this._webSocket.readyState===se.OPEN&&(this._webSocket.send(ne),this.debug(">>> PING"))})}if(0!==this.heartbeatIncoming&&0!==t){const e=Math.max(this.heartbeatIncoming,t);this.debug(`check PONG every ${e}ms`),this._ponger=setInterval(()=>{const t=Date.now()-this._lastServerActivityTS;t>2*e&&(this.debug(`did not receive server activity for the last ${t}ms`),this._closeOrDiscardWebsocket())},e)}}_closeOrDiscardWebsocket(){this.discardWebsocketOnCommFailure?(this.debug("Discarding websocket, the underlying socket may linger for a while"),this.discardWebsocket()):(this.debug("Issuing close on the websocket"),this._closeWebsocket())}forceDisconnect(){this._webSocket&&(this._webSocket.readyState!==se.CONNECTING&&this._webSocket.readyState!==se.OPEN||this._closeOrDiscardWebsocket())}_closeWebsocket(){this._webSocket.onmessage=()=>{},this._webSocket.close()}discardWebsocket(){var e,t;"function"!=typeof this._webSocket.terminate&&(e=this._webSocket,t=e=>this.debug(e),e.terminate=function(){const r=()=>{};this.onerror=r,this.onmessage=r,this.onopen=r;const n=new Date,i=Math.random().toString().substring(2,8),o=this.onclose;this.onclose=e=>{const r=(new Date).getTime()-n.getTime();t(`Discarded socket (#${i}) closed after ${r}ms, with code/reason: ${e.code}/${e.reason}`)},this.close(),null==o||o.call(e,{code:4001,reason:`Quick discarding socket (#${i}) without waiting for the shutdown sequence.`,wasClean:!1})}),this._webSocket.terminate()}_transmit(e){const{command:t,headers:r,body:n,binaryBody:i,skipContentLengthHeader:o}=e,a=new oe({command:t,headers:r,body:n,binaryBody:i,escapeHeaderValues:this._escapeHeaderValues,skipContentLengthHeader:o});let s=a.serialize();if(this.logRawCommunication?this.debug(`>>> ${s}`):this.debug(`>>> ${a}`),this.forceBinaryWSFrames&&"string"==typeof s&&(s=(new TextEncoder).encode(s)),"string"==typeof s&&this.splitLargeFrames){let e=s;for(;e.length>0;){const t=e.substring(0,this.maxWebSocketChunkSize);e=e.substring(this.maxWebSocketChunkSize),this._webSocket.send(t),this.debug(`chunk sent = ${t.length}, remaining = ${e.length}`)}}else this._webSocket.send(s)}dispose(){if(this.connected)try{const e=Object.assign({},this.disconnectHeaders);e.receipt||(e.receipt="close-"+this._counter++),this.watchForReceipt(e.receipt,e=>{this._closeWebsocket(),this._cleanUp(),this.onDisconnect(e)}),this._transmit({command:"DISCONNECT",headers:e})}catch(e){this.debug(`Ignoring error during disconnect ${e}`)}else this._webSocket.readyState!==se.CONNECTING&&this._webSocket.readyState!==se.OPEN||this._closeWebsocket()}_cleanUp(){this._connected=!1,this._pinger&&(this._pinger.stop(),this._pinger=void 0),this._ponger&&(clearInterval(this._ponger),this._ponger=void 0)}publish(e){const{destination:t,headers:r,body:n,binaryBody:i,skipContentLengthHeader:o}=e,a=Object.assign({destination:t},r);this._transmit({command:"SEND",headers:a,body:n,binaryBody:i,skipContentLengthHeader:o})}watchForReceipt(e,t){this._receiptWatchers[e]=t}subscribe(e,t,r={}){(r=Object.assign({},r)).id||(r.id="sub-"+this._counter++),r.destination=e,this._subscriptions[r.id]=t,this._transmit({command:"SUBSCRIBE",headers:r});const n=this;return{id:r.id,unsubscribe:e=>n.unsubscribe(r.id,e)}}unsubscribe(e,t={}){t=Object.assign({},t),delete this._subscriptions[e],t.id=e,this._transmit({command:"UNSUBSCRIBE",headers:t})}begin(e){const t=e||"tx-"+this._counter++;this._transmit({command:"BEGIN",headers:{transaction:t}});const r=this;return{id:t,commit(){r.commit(t)},abort(){r.abort(t)}}}commit(e){this._transmit({command:"COMMIT",headers:{transaction:e}})}abort(e){this._transmit({command:"ABORT",headers:{transaction:e}})}ack(e,t,r={}){r=Object.assign({},r),this._connectedVersion===fe.V1_2?r.id=e:r["message-id"]=e,r.subscription=t,this._transmit({command:"ACK",headers:r})}nack(e,t,r={}){return r=Object.assign({},r),this._connectedVersion===fe.V1_2?r.id=e:r["message-id"]=e,r.subscription=t,this._transmit({command:"NACK",headers:r})}}class ye{get webSocket(){var e;return null==(e=this._stompHandler)?void 0:e._webSocket}get disconnectHeaders(){return this._disconnectHeaders}set disconnectHeaders(e){this._disconnectHeaders=e,this._stompHandler&&(this._stompHandler.disconnectHeaders=this._disconnectHeaders)}get connected(){return!!this._stompHandler&&this._stompHandler.connected}get connectedVersion(){return this._stompHandler?this._stompHandler.connectedVersion:void 0}get active(){return this.state===ce.ACTIVE}_changeState(e){this.state=e,this.onChangeState(e)}constructor(e={}){this.stompVersions=fe.default,this.connectionTimeout=0,this.reconnectDelay=5e3,this._nextReconnectDelay=0,this.maxReconnectDelay=9e5,this.reconnectTimeMode=ue.LINEAR,this.heartbeatIncoming=1e4,this.heartbeatOutgoing=1e4,this.heartbeatStrategy=ge.Interval,this.splitLargeFrames=!1,this.maxWebSocketChunkSize=8192,this.forceBinaryWSFrames=!1,this.appendMissingNULLonIncoming=!1,this.discardWebsocketOnCommFailure=!1,this.state=ce.INACTIVE;const t=()=>{};this.debug=t,this.beforeConnect=t,this.onConnect=t,this.onDisconnect=t,this.onUnhandledMessage=t,this.onUnhandledReceipt=t,this.onUnhandledFrame=t,this.onStompError=t,this.onWebSocketClose=t,this.onWebSocketError=t,this.logRawCommunication=!1,this.onChangeState=t,this.connectHeaders={},this._disconnectHeaders={},this.configure(e)}configure(e){Object.assign(this,e),this.maxReconnectDelay>0&&this.maxReconnectDelay<this.reconnectDelay&&(this.debug(`Warning: maxReconnectDelay (${this.maxReconnectDelay}ms) is less than reconnectDelay (${this.reconnectDelay}ms). Using reconnectDelay as the maxReconnectDelay delay.`),this.maxReconnectDelay=this.reconnectDelay)}activate(){const e=()=>{this.active?this.debug("Already ACTIVE, ignoring request to activate"):(this._changeState(ce.ACTIVE),this._nextReconnectDelay=this.reconnectDelay,this._connect())};this.state===ce.DEACTIVATING?(this.debug("Waiting for deactivation to finish before activating"),this.deactivate().then(()=>{e()})):e()}_connect(){return C(this,null,function*(){if(yield this.beforeConnect(this),this._stompHandler)return void this.debug("There is already a stompHandler, skipping the call to connect");if(!this.active)return void this.debug("Client has been marked inactive, will not attempt to connect");this.connectionTimeout>0&&(this._connectionWatcher&&clearTimeout(this._connectionWatcher),this._connectionWatcher=setTimeout(()=>{this.connected||(this.debug(`Connection not established in ${this.connectionTimeout}ms, closing socket`),this.forceDisconnect())},this.connectionTimeout)),this.debug("Opening Web Socket...");const e=this._createWebSocket();this._stompHandler=new ve(this,e,{debug:this.debug,stompVersions:this.stompVersions,connectHeaders:this.connectHeaders,disconnectHeaders:this._disconnectHeaders,heartbeatIncoming:this.heartbeatIncoming,heartbeatOutgoing:this.heartbeatOutgoing,heartbeatStrategy:this.heartbeatStrategy,splitLargeFrames:this.splitLargeFrames,maxWebSocketChunkSize:this.maxWebSocketChunkSize,forceBinaryWSFrames:this.forceBinaryWSFrames,logRawCommunication:this.logRawCommunication,appendMissingNULLonIncoming:this.appendMissingNULLonIncoming,discardWebsocketOnCommFailure:this.discardWebsocketOnCommFailure,onConnect:e=>{if(this._connectionWatcher&&(clearTimeout(this._connectionWatcher),this._connectionWatcher=void 0),!this.active)return this.debug("STOMP got connected while deactivate was issued, will disconnect now"),void this._disposeStompHandler();this.onConnect(e)},onDisconnect:e=>{this.onDisconnect(e)},onStompError:e=>{this.onStompError(e)},onWebSocketClose:e=>{this._stompHandler=void 0,this.state===ce.DEACTIVATING&&this._changeState(ce.INACTIVE),this.onWebSocketClose(e),this.active&&this._schedule_reconnect()},onWebSocketError:e=>{this.onWebSocketError(e)},onUnhandledMessage:e=>{this.onUnhandledMessage(e)},onUnhandledReceipt:e=>{this.onUnhandledReceipt(e)},onUnhandledFrame:e=>{this.onUnhandledFrame(e)}}),this._stompHandler.start()})}_createWebSocket(){let e;if(this.webSocketFactory)e=this.webSocketFactory();else{if(!this.brokerURL)throw new Error("Either brokerURL or webSocketFactory must be provided");e=new WebSocket(this.brokerURL,this.stompVersions.protocolVersions())}return e.binaryType="arraybuffer",e}_schedule_reconnect(){this._nextReconnectDelay>0&&(this.debug(`STOMP: scheduling reconnection in ${this._nextReconnectDelay}ms`),this._reconnector=setTimeout(()=>{this.reconnectTimeMode===ue.EXPONENTIAL&&(this._nextReconnectDelay=2*this._nextReconnectDelay,0!==this.maxReconnectDelay&&(this._nextReconnectDelay=Math.min(this._nextReconnectDelay,this.maxReconnectDelay))),this._connect()},this._nextReconnectDelay))}deactivate(){return C(this,arguments,function*(e={}){var t;const r=e.force||!1,n=this.active;let i;if(this.state===ce.INACTIVE)return this.debug("Already INACTIVE, nothing more to do"),Promise.resolve();if(this._changeState(ce.DEACTIVATING),this._nextReconnectDelay=0,this._reconnector&&(clearTimeout(this._reconnector),this._reconnector=void 0),!this._stompHandler||this.webSocket.readyState===se.CLOSED)return this._changeState(ce.INACTIVE),Promise.resolve();{const e=this._stompHandler.onWebSocketClose;i=new Promise((t,r)=>{this._stompHandler.onWebSocketClose=r=>{e(r),t()}})}return r?null==(t=this._stompHandler)||t.discardWebsocket():n&&this._disposeStompHandler(),i})}forceDisconnect(){this._stompHandler&&this._stompHandler.forceDisconnect()}_disposeStompHandler(){this._stompHandler&&this._stompHandler.dispose()}publish(e){this._checkConnection(),this._stompHandler.publish(e)}_checkConnection(){if(!this.connected)throw new TypeError("There is no underlying STOMP connection")}watchForReceipt(e,t){this._checkConnection(),this._stompHandler.watchForReceipt(e,t)}subscribe(e,t,r={}){return this._checkConnection(),this._stompHandler.subscribe(e,t,r)}unsubscribe(e,t={}){this._checkConnection(),this._stompHandler.unsubscribe(e,t)}begin(e){return this._checkConnection(),this._stompHandler.begin(e)}commit(e){this._checkConnection(),this._stompHandler.commit(e)}abort(e){this._checkConnection(),this._stompHandler.abort(e)}ack(e,t,r={}){this._checkConnection(),this._stompHandler.ack(e,t,r)}nack(e,t,r={}){this._checkConnection(),this._stompHandler.nack(e,t,r)}}var be,we,xe,_e,ke=0,Ce=[],Se=r,Ne=Se.__b,Ee=Se.__r,Te=Se.diffed,Le=Se.__c,Ie=Se.unmount,Oe=Se.__;function $e(e,t){Se.__h&&Se.__h(we,e,ke||t),ke=0;var r=we.__H||(we.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Re(e){return ke=1,Ae(qe,e)}function Ae(e,t,r){var n=$e(be++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):qe(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=we,!we.__f)){var i=function(e,t,r){if(!n.__c.__H)return!0;var i=n.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!o||o.call(this,e,t,r);var a=n.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),o&&o.call(this,e,t,r)||a};we.__f=!0;var o=we.shouldComponentUpdate,a=we.componentWillUpdate;we.componentWillUpdate=function(e,t,r){if(this.__e){var n=o;o=void 0,i(e,t,r),o=n}a&&a.call(this,e,t,r)},we.shouldComponentUpdate=i}return n.__N||n.__}function Fe(e,t){var r=$e(be++,3);!Se.__s&&Ve(r.__H,t)&&(r.__=e,r.u=t,we.__H.__h.push(r))}function De(e){return ke=5,ze(function(){return{current:e}},[])}function ze(e,t){var r=$e(be++,7);return Ve(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Me(e,t){return ke=8,ze(function(){return e},t)}function Be(e){var t=we.context[e.__c],r=$e(be++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(we)),t.props.value):e.__}function He(){for(var e;e=Ce.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(We),e.__H.__h.forEach(je),e.__H.__h=[]}catch(t){e.__H.__h=[],Se.__e(t,e.__v)}}Se.__b=function(e){we=null,Ne&&Ne(e)},Se.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Oe&&Oe(e,t)},Se.__r=function(e){Ee&&Ee(e),be=0;var t=(we=e.__c).__H;t&&(xe===we?(t.__h=[],we.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(We),t.__h.forEach(je),t.__h=[],be=0)),xe=we},Se.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Ce.push(t)&&_e===Se.requestAnimationFrame||((_e=Se.requestAnimationFrame)||Ue)(He)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),xe=we=null},Se.__c=function(e,t){t.some(function(e){try{e.__h.forEach(We),e.__h=e.__h.filter(function(e){return!e.__||je(e)})}catch(r){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Se.__e(r,e.__v)}}),Le&&Le(e,t)},Se.unmount=function(e){Ie&&Ie(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(e){try{We(e)}catch(r){t=r}}),r.__H=void 0,t&&Se.__e(t,r.__v))};var Pe="function"==typeof requestAnimationFrame;function Ue(e){var t,r=function(){clearTimeout(n),Pe&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);Pe&&(t=requestAnimationFrame(r))}function We(e){var t=we,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),we=t}function je(e){var t=we;e.__c=e.__(),we=t}function Ve(e,t){return!e||e.length!==t.length||t.some(function(t,r){return t!==e[r]})}function qe(e,t){return"function"==typeof t?t(e):t}const Ge=ee(null),Ke=()=>{const e=Be(Ge);if(!e)throw new Error("useStompConnectionContext must be used within StompConnectionProvider");return e},Qe=({children:e})=>{const[t,r]=Re("disconnected"),n=De(null),i=De(null),o=De(null),a=De(!1),s=De("disconnected"),l=De(new Map),c=De(new Set),d=De(new Set),u=De(new Set),h=Me(e=>{s.current!==e&&(s.current=e,r(e))},[]),g=Me(()=>{var e;l.current.forEach(e=>{e()}),l.current.clear(),(null==(e=n.current)?void 0:e.connected)&&n.current.deactivate(),n.current=null,a.current=!1},[]),p=Me(()=>{g(),h("disconnected")},[g,h]),m=Me(()=>{const e=n.current;if(!e||!e.connected)return;const t=e.subscribe("/user/notify",e=>{var t,r,n,i;try{const o=JSON.parse(e.body);if("user_login"===(null==(t=o.target)?void 0:t.toLowerCase())&&"system"===(null==(r=o.type)?void 0:r.toLowerCase())&&(null==(n=o.metadata)?void 0:n.token)){const e=o.metadata.token;return void u.current.forEach(t=>{t(e)})}if("new_message"===o.target&&(null==(i=o.metadata)?void 0:i.messageContent)){const e=o.metadata.messageContent,t={id:e.id,content:{type:e.content.type,body:e.content.body||e.content.content},metadata:{senderId:e.metadata.senderId,receiverId:e.metadata.receiverId||"",status:e.metadata.status,channel:e.metadata.channel,direction:e.metadata.direction,type:e.metadata.type},timestamp:e.createdAt||(new Date).toISOString()};c.current.forEach(e=>{e(t)})}}catch(o){}});l.current.set("/user/notify",()=>t.unsubscribe())},[]),f=Me((e,t)=>C(null,null,function*(){var r,l;if(!(a.current||"connected"===s.current||"connecting"===s.current||i.current&&o.current&&i.current.orgId===e.orgId&&i.current.widgetId===e.widgetId&&i.current.baseUrl===e.baseUrl&&o.current.id===t.id&&o.current.token===t.token&&(null==(r=n.current)?void 0:r.connected))){a.current=!0,h("connecting");try{g(),i.current=e,o.current=t;const r=((null==(l=t.token)?void 0:l.replace("Bearer ",""))||t.token||"").trim(),c=`${`${e.baseUrl}/ws`.replace("http://","ws://").replace("https://","wss://")}?token=${encodeURIComponent(r)}`,d=new ye({brokerURL:c,connectHeaders:{token:r,"Accept-Version":"1.2","Heart-Beat":"4000,4000"},debug:e=>{},reconnectDelay:0,heartbeatIncoming:4e3,heartbeatOutgoing:4e3,connectionTimeout:1e4});d.onConnect=e=>{a.current=!1,h("connected"),m()},d.onStompError=e=>{a.current=!1,h("error")},d.onDisconnect=e=>{a.current=!1,"disconnected"!==s.current&&h("disconnected")},d.onWebSocketClose=e=>{a.current=!1,"connected"===s.current&&h("error")},d.onWebSocketError=e=>{a.current=!1,h("error")},n.current=d,d.activate()}catch(c){throw a.current=!1,h("error"),c}}}),[h,g,m]),v=Me((e,t)=>{const r=n.current;if(!r||!r.connected)return;const i={id:null,_class:"website_message",orgId:t.orgId,conversationId:t.conversationId,inboxId:t.channelId,content:e,metadata:{senderId:t.senderId,receiverId:"",status:"DELIVERED",channel:"WEBSITE",direction:"INBOUND",type:e.type},sourceMetaData:{id:`wamid.${Date.now()}`,source:"website",type:"website_message"},inboxType:"WEBSITE"},o={orgId:t.orgId,content:JSON.stringify(i)};r.publish({destination:"/analytick/website/message",body:JSON.stringify(o)})},[]),y=Me(e=>(c.current.add(e),()=>{c.current.delete(e)}),[]),b=Me(e=>(d.current.add(e),()=>{d.current.delete(e)}),[]),w=Me(e=>(u.current.add(e),()=>{u.current.delete(e)}),[]),k=Me(e=>C(null,null,function*(){const t=i.current,r=o.current;t&&r&&(o.current=_(x({},r),{token:e}),yield f(t,_(x({},r),{token:e})))}),[f]);Fe(()=>()=>{g()},[g]);const S={connectionState:t,isConnected:"connected"===t,initializeConnection:f,disconnect:p,refreshConnection:k,sendMessage:v,onMessage:y,onAnnouncement:b,onTokenRefresh:w};return re(Ge.Provider,{value:S,children:e})},Je=ee(null),Xe=({value:e,children:t})=>re(Je.Provider,{value:e,children:t}),Ye=()=>{const e=Be(Je);if(!e)throw new Error("useWidgetContext must be used within a WidgetProvider");return e};ee(null);const Ze=e=>"string"==typeof e,et=()=>{let e,t;const r=new Promise((r,n)=>{e=r,t=n});return r.resolve=e,r.reject=t,r},tt=e=>null==e?"":""+e,rt=/###/g,nt=e=>e&&e.indexOf("###")>-1?e.replace(rt,"."):e,it=e=>!e||Ze(e),ot=(e,t,r)=>{const n=Ze(t)?t.split("."):t;let i=0;for(;i<n.length-1;){if(it(e))return{};const t=nt(n[i]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return it(e)?{}:{obj:e,k:nt(n[i])}},at=(e,t,r)=>{const{obj:n,k:i}=ot(e,t,Object);if(void 0!==n||1===t.length)return void(n[i]=r);let o=t[t.length-1],a=t.slice(0,t.length-1),s=ot(e,a,Object);for(;void 0===s.obj&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),s=ot(e,a,Object),(null==s?void 0:s.obj)&&void 0!==s.obj[`${s.k}.${o}`]&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=r},st=(e,t)=>{const{obj:r,k:n}=ot(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},lt=(e,t,r)=>{for(const n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?Ze(e[n])||e[n]instanceof String||Ze(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):lt(e[n],t[n],r):e[n]=t[n]);return e},ct=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var dt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ut=e=>Ze(e)?e.replace(/[&<>"'\/]/g,e=>dt[e]):e;const ht=[" ",",","?","!",";"],gt=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}(20),pt=(e,t,r=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const n=t.split(r);let i=e;for(let o=0;o<n.length;){if(!i||"object"!=typeof i)return;let e,t="";for(let a=o;a<n.length;++a)if(a!==o&&(t+=r),t+=n[a],e=i[t],void 0!==e){if(["string","number","boolean"].indexOf(typeof e)>-1&&a<n.length-1)continue;o+=a-o+1;break}i=e}return i},mt=e=>null==e?void 0:e.replace("_","-"),ft={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var r,n;null==(n=null==(r=null==console?void 0:console[e])?void 0:r.apply)||n.call(r,console,t)}};class vt{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||ft,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,r,n){return n&&!this.debug?null:(Ze(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new vt(this.logger,x(x({},{prefix:`${this.prefix}:${e}:`}),this.options))}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new vt(this.logger,e)}}var yt=new vt;class bt{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const r=this.observers[e].get(t)||0;this.observers[e].set(t,r+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,r])=>{for(let n=0;n<r;n++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([r,n])=>{for(let i=0;i<n;i++)r.apply(r,[e,...t])})}}}class wt extends bt{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,r,n={}){var i,o;const a=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,s=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,t],r&&(Array.isArray(r)?l.push(...r):Ze(r)&&a?l.push(...r.split(a)):l.push(r)));const c=st(this.data,l);return!c&&!t&&!r&&e.indexOf(".")>-1&&(e=l[0],t=l[1],r=l.slice(2).join(".")),!c&&s&&Ze(r)?pt(null==(o=null==(i=this.data)?void 0:i[e])?void 0:o[t],r,a):c}addResource(e,t,r,n,i={silent:!1}){const o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator;let a=[e,t];r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."),n=t,t=a[1]),this.addNamespaces(t),at(this.data,a,n),i.silent||this.emit("added",e,t,r,n)}addResources(e,t,r,n={silent:!1}){for(const i in r)(Ze(r[i])||Array.isArray(r[i]))&&this.addResource(e,t,i,r[i],{silent:!0});n.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,n,i,o={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),n=r,r=t,t=a[1]),this.addNamespaces(t);let s=st(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?lt(s,r,i):s=x(x({},s),r),at(this.data,a,s),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var xt={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(e=>{var o,a;t=null!=(a=null==(o=this.processors[e])?void 0:o.process(t,r,n,i))?a:t}),t}};const _t=Symbol("i18next/PATH_KEY");function kt(e,t){var r;const{[_t]:n}=e(function(){const e=[],t=Object.create(null);let r;return t.get=(n,i)=>{var o;return null==(o=null==r?void 0:r.revoke)||o.call(r),i===_t?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)},Proxy.revocable(Object.create(null),t).proxy}());return n.join(null!=(r=null==t?void 0:t.keySeparator)?r:".")}const Ct={},St=e=>!Ze(e)&&"boolean"!=typeof e&&"number"!=typeof e;class Nt extends bt{constructor(e,t={}){var r,n;super(),r=e,n=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{r[e]&&(n[e]=r[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=yt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const r=x({},t);if(null==e)return!1;const n=this.resolve(e,r);return void 0!==(null==n?void 0:n.res)}extractFromKey(e,t){let r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");const n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let i=t.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,r)=>{t=t||"",r=r||"";const n=ht.filter(e=>t.indexOf(e)<0&&r.indexOf(e)<0);if(0===n.length)return!0;const i=gt.getRegExp(`(${n.map(e=>"?"===e?"\\?":e).join("|")})`);let o=!i.test(e);if(!o){const t=e.indexOf(r);t>0&&!i.test(e.substring(0,t))&&(o=!0)}return o})(e,r,n));if(o&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Ze(i)?[i]:i};const o=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(o[0])>-1)&&(i=o.shift()),e=o.join(n)}return{key:e,namespaces:Ze(i)?[i]:i}}translate(e,t,r){let n="object"==typeof t?x({},t):t;if("object"!=typeof n&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof n&&(n=x({},n)),n||(n={}),null==e)return"";"function"==typeof e&&(e=kt(e,x(x({},this.options),n))),Array.isArray(e)||(e=[String(e)]);const i=void 0!==n.returnDetails?n.returnDetails:this.options.returnDetails,o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(e[e.length-1],n),l=s[s.length-1];let c=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const d=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===(null==d?void 0:d.toLowerCase()))return u?i?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${c}${a}`:i?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:a;const h=this.resolve(e,n);let g=null==h?void 0:h.res;const p=(null==h?void 0:h.usedKey)||a,m=(null==h?void 0:h.exactUsedKey)||a,f=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==n.count&&!Ze(n.count),b=Nt.hasDefaultValue(n),w=y?this.pluralResolver.getSuffix(d,n.count,n):"",k=n.ordinal&&y?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",C=y&&!n.ordinal&&0===n.count,S=C&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${w}`]||n[`defaultValue${k}`]||n.defaultValue;let N=g;v&&!g&&b&&(N=S);const E=St(N),T=Object.prototype.toString.apply(N);if(!(v&&N&&E&&["[object Number]","[object Function]","[object RegExp]"].indexOf(T)<0)||Ze(f)&&Array.isArray(N))if(v&&Ze(f)&&Array.isArray(g))g=g.join(f),g&&(g=this.extendTranslation(g,e,n,r));else{let t=!1,i=!1;!this.isValidLookup(g)&&b&&(t=!0,g=S),this.isValidLookup(g)||(i=!0,g=a);const s=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&i?void 0:g,u=b&&S!==g&&this.options.updateMissing;if(i||t||u){if(this.logger.log(u?"updateKey":"missingKey",d,l,a,u?S:g),o){const e=this.resolve(a,_(x({},n),{keySeparator:!1}));e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(n.lng||this.language):e.push(n.lng||this.language);const r=(e,t,r)=>{var i;const o=b&&r!==g?r:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,o,u,n):(null==(i=this.backendConnector)?void 0:i.saveMissing)&&this.backendConnector.saveMissing(e,l,t,o,u,n),this.emit("missingKey",e,l,t,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,n);C&&n[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{r([e],a+t,n[`defaultValue${t}`]||S)})}):r(e,a,S))}g=this.extendTranslation(g,e,n,h,r),i&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${l}${c}${a}`),(i||t)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,t?g:void 0,n))}else{if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,N,_(x({},n),{ns:s})):`key '${a} (${this.language})' returned an object instead of string.`;return i?(h.res=e,h.usedParams=this.getUsedParamsDetails(n),h):e}if(o){const e=Array.isArray(N),t=e?[]:{},r=e?m:p;for(const i in N)if(Object.prototype.hasOwnProperty.call(N,i)){const e=`${r}${o}${i}`;t[i]=b&&!g?this.translate(e,x(_(x({},n),{defaultValue:St(S)?S[i]:void 0}),{joinArrays:!1,ns:s})):this.translate(e,x(x({},n),{joinArrays:!1,ns:s})),t[i]===e&&(t[i]=N[i])}g=t}}return i?(h.res=g,h.usedParams=this.getUsedParamsDetails(n),h):g}extendTranslation(e,t,r,n,i){var o,a;if(null==(o=this.i18nFormat)?void 0:o.parse)e=this.i18nFormat.parse(e,x(x({},this.options.interpolation.defaultVariables),r),r.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(x(x({},r),{interpolation:x(x({},this.options.interpolation),r.interpolation)}));const o=Ze(e)&&(void 0!==(null==(a=null==r?void 0:r.interpolation)?void 0:a.skipOnVariables)?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(o){const t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let l=r.replace&&!Ze(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(l=x(x({},this.options.interpolation.defaultVariables),l)),e=this.interpolator.interpolate(e,l,r.lng||this.language||n.usedLng,r),o){const t=e.match(this.interpolator.nestingRegexp);s<(t&&t.length)&&(r.nest=!1)}!r.lng&&n&&n.res&&(r.lng=this.language||n.usedLng),!1!==r.nest&&(e=this.interpolator.nest(e,(...e)=>(null==i?void 0:i[0])!==e[0]||r.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),r)),r.interpolation&&this.interpolator.reset()}const s=r.postProcess||this.options.postProcess,l=Ze(s)?[s]:s;return null!=e&&(null==l?void 0:l.length)&&!1!==r.applyPostProcessor&&(e=xt.handle(l,e,t,this.options&&this.options.postProcessPassResolved?x({i18nResolved:_(x({},n),{usedParams:this.getUsedParamsDetails(r)})},r):r,this)),e}resolve(e,t={}){let r,n,i,o,a;return Ze(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(r))return;const s=this.extractFromKey(e,t),l=s.key;n=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const d=void 0!==t.count&&!Ze(t.count),u=d&&!t.ordinal&&0===t.count,h=void 0!==t.context&&(Ze(t.context)||"number"==typeof t.context)&&""!==t.context,g=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{var s,c;this.isValidLookup(r)||(a=e,Ct[`${g[0]}-${e}`]||!(null==(s=this.utils)?void 0:s.hasLoadedNamespace)||(null==(c=this.utils)?void 0:c.hasLoadedNamespace(a))||(Ct[`${g[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(n=>{var a;if(this.isValidLookup(r))return;o=n;const s=[l];if(null==(a=this.i18nFormat)?void 0:a.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,n,e,t);else{let e;d&&(e=this.pluralResolver.getSuffix(n,t.count,t));const r=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&0===e.indexOf(i)&&s.push(l+e.replace(i,this.options.pluralSeparator)),s.push(l+e),u&&s.push(l+r)),h){const n=`${l}${this.options.contextSeparator||"_"}${t.context}`;s.push(n),d&&(t.ordinal&&0===e.indexOf(i)&&s.push(n+e.replace(i,this.options.pluralSeparator)),s.push(n+e),u&&s.push(n+r))}}let c;for(;c=s.pop();)this.isValidLookup(r)||(i=c,r=this.getResource(n,e,c,t))}))})}),{res:r,usedKey:n,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,r,n={}){var i;return(null==(i=this.i18nFormat)?void 0:i.getResource)?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!Ze(e.replace);let n=r?e.replace:e;if(r&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n=x(x({},this.options.interpolation.defaultVariables),n)),!r){n=x({},n);for(const e of t)delete n[e]}return n}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,12)&&void 0!==e[r])return!0;return!1}}class Et{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=yt.create("languageUtils")}getScriptPartFromCode(e){if(!(e=mt(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=mt(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Ze(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch(t){}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const r=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(r)||(t=r)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const r=this.getScriptPartFromCode(e);if(this.isSupportedCode(r))return t=r;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Ze(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),n=[],i=e=>{e&&(this.isSupportedCode(e)?n.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Ze(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):Ze(e)&&i(this.formatLanguageCode(e)),r.forEach(e=>{n.indexOf(e)<0&&i(this.formatLanguageCode(e))}),n}}const Tt={zero:0,one:1,two:2,few:3,many:4,other:5},Lt={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class It{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=yt.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=mt("dev"===e?"en":e),n=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:n});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:n})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Lt;if(!e.match(/-|_/))return Lt;const r=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(r,t)}return this.pluralRulesCache[i]=o,o}needsPlural(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),(null==r?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,r={}){return this.getSuffixes(e,r).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?r.resolvedOptions().pluralCategories.sort((e,t)=>Tt[e]-Tt[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,r={}){const n=this.getRule(e,r);return n?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,r))}}const Ot=(e,t,r,n=".",i=!0)=>{let o=((e,t,r)=>{const n=st(e,r);return void 0!==n?n:st(t,r)})(e,t,r);return!o&&i&&Ze(r)&&(o=pt(e,r,n),void 0===o&&(o=pt(t,r,n))),o},$t=e=>e.replace(/\$/g,"$$$$");class Rt{constructor(e={}){var t;this.logger=yt.create("interpolator"),this.options=e,this.format=(null==(t=null==e?void 0:e.interpolation)?void 0:t.format)||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:r,useRawValueToEscape:n,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:u,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:p,nestingOptionsSeparator:m,maxReplaces:f,alwaysFormat:v}=e.interpolation;this.escape=void 0!==t?t:ut,this.escapeValue=void 0===r||r,this.useRawValueToEscape=void 0!==n&&n,this.prefix=i?ct(i):o||"{{",this.suffix=a?ct(a):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=u?ct(u):h||ct("$t("),this.nestingSuffix=g?ct(g):p||ct(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=f||1e3,this.alwaysFormat=void 0!==v&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>(null==e?void 0:e.source)===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,r,n){var i;let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){const i=Ot(t,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,r,_(x(x({},n),t),{interpolationkey:e})):i}const i=e.split(this.formatSeparator),o=i.shift().trim(),a=i.join(this.formatSeparator).trim();return this.format(Ot(t,l,o,this.options.keySeparator,this.options.ignoreJSONStructure),a,r,_(x(x({},n),t),{interpolationkey:o}))};this.resetRegExp();const d=(null==n?void 0:n.missingInterpolationHandler)||this.options.missingInterpolationHandler,u=void 0!==(null==(i=null==n?void 0:n.interpolation)?void 0:i.skipOnVariables)?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>$t(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?$t(this.escape(e)):$t(e)}].forEach(t=>{for(s=0;o=t.regex.exec(e);){const r=o[1].trim();if(a=c(r),void 0===a)if("function"==typeof d){const t=d(e,o,n);a=Ze(t)?t:""}else if(n&&Object.prototype.hasOwnProperty.call(n,r))a="";else{if(u){a=o[0];continue}this.logger.warn(`missed to pass in variable ${r} for interpolating ${e}`),a=""}else Ze(a)||this.useRawValueToEscape||(a=tt(a));const i=t.safeValue(a);if(e=e.replace(o[0],i),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,t,r={}){let n,i,o;const a=(e,t)=>{var r;const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const i=e.split(new RegExp(`${n}[ ]*{`));let a=`{${i[1]}`;e=i[0],a=this.interpolate(a,o);const s=a.match(/'/g),l=a.match(/"/g);((null!=(r=null==s?void 0:s.length)?r:0)%2==0&&!l||l.length%2!=0)&&(a=a.replace(/'/g,'"'));try{o=JSON.parse(a),t&&(o=x(x({},t),o))}catch(c){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,c),`${e}${n}${a}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let s=[];o=x({},r),o=o.replace&&!Ze(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const l=/{.*}/.test(n[1])?n[1].lastIndexOf("}")+1:n[1].indexOf(this.formatSeparator);if(-1!==l&&(s=n[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),n[1]=n[1].slice(0,l)),i=t(a.call(this,n[1].trim(),o),o),i&&n[0]===e&&!Ze(i))return i;Ze(i)||(i=tt(i)),i||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),i=""),s.length&&(i=s.reduce((e,t)=>this.format(e,t,r.lng,_(x({},r),{interpolationkey:n[1].trim()})),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}const At=e=>{const t={};return(r,n,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o=_(x({},o),{[i.interpolationkey]:void 0}));const a=n+JSON.stringify(o);let s=t[a];return s||(s=e(mt(n),i),t[a]=s),s(r)}},Ft=e=>(t,r,n)=>e(mt(r),n)(t);class Dt{constructor(e={}){this.logger=yt.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?At:Ft;this.formats={number:r((e,t)=>{const r=new Intl.NumberFormat(e,x({},t));return e=>r.format(e)}),currency:r((e,t)=>{const r=new Intl.NumberFormat(e,_(x({},t),{style:"currency"}));return e=>r.format(e)}),datetime:r((e,t)=>{const r=new Intl.DateTimeFormat(e,x({},t));return e=>r.format(e)}),relativetime:r((e,t)=>{const r=new Intl.RelativeTimeFormat(e,x({},t));return e=>r.format(e,t.range||"day")}),list:r((e,t)=>{const r=new Intl.ListFormat(e,x({},t));return e=>r.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=At(t)}format(e,t,r,n={}){const i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(e=>e.indexOf(")")>-1)){const e=i.findIndex(e=>e.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{var i;const{formatName:o,formatOptions:a}=(e=>{let t=e.toLowerCase().trim();const r={};if(e.indexOf("(")>-1){const n=e.split("(");t=n[0].toLowerCase().trim();const i=n[1].substring(0,n[1].length-1);"currency"===t&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(e=>{if(e){const[t,...n]=e.split(":"),i=n.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();r[o]||(r[o]=i),"false"===i&&(r[o]=!1),"true"===i&&(r[o]=!0),isNaN(i)||(r[o]=parseInt(i,10))}})}return{formatName:t,formatOptions:r}})(t);if(this.formats[o]){let t=e;try{const s=(null==(i=null==n?void 0:n.formatParams)?void 0:i[n.interpolationkey])||{},l=s.locale||s.lng||n.locale||n.lng||r;t=this.formats[o](e,l,x(x(x({},a),n),s))}catch(s){this.logger.warn(s)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e)}}class zt extends bt{constructor(e,t,r,n={}){var i,o;super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=n,this.logger=yt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],null==(o=null==(i=this.backend)?void 0:i.init)||o.call(i,r,n.backend,n)}queueLoad(e,t,r,n){const i={},o={},a={},s={};return e.forEach(e=>{let n=!0;t.forEach(t=>{const a=`${e}|${t}`;!r.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===o[a]&&(o[a]=!0):(this.state[a]=1,n=!1,void 0===o[a]&&(o[a]=!0),void 0===i[a]&&(i[a]=!0),void 0===s[t]&&(s[t]=!0)))}),n||(a[e]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,t,r){const n=e.split("|"),i=n[0],o=n[1];t&&this.emit("failedLoading",i,o,t),!t&&r&&this.store.addResourceBundle(i,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0);const a={};this.queue.forEach(r=>{((e,t,r)=>{const{obj:n,k:i}=ot(e,t,Object);n[i]=n[i]||[],n[i].push(r)})(r.loaded,[i],o),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(r,e),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(e=>{a[e]||(a[e]={});const t=r.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,r,n=0,i=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:r,tried:n,wait:i,callback:o});this.readingCalls++;const a=(a,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&s&&n<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,r,n+1,2*i,o)},i):o(a,s)},s=this.backend[r].bind(this.backend);if(2!==s.length)return s(e,t,a);try{const r=s(e,t);r&&"function"==typeof r.then?r.then(e=>a(null,e)).catch(a):a(null,r)}catch(l){a(l)}}prepareLoading(e,t,r={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();Ze(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ze(t)&&(t=[t]);const i=this.queueLoad(e,t,r,n);if(!i.toLoad.length)return i.pending.length||n(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e,t=""){const r=e.split("|"),n=r[0],i=r[1];this.read(n,i,"read",void 0,void 0,(r,o)=>{r&&this.logger.warn(`${t}loading namespace ${i} for language ${n} failed`,r),!r&&o&&this.logger.log(`${t}loaded namespace ${i} for language ${n}`,o),this.loaded(e,r,o)})}saveMissing(e,t,r,n,i,o={},a=()=>{}){var s,l,c,d,u;if(!(null==(l=null==(s=this.services)?void 0:s.utils)?void 0:l.hasLoadedNamespace)||(null==(d=null==(c=this.services)?void 0:c.utils)?void 0:d.hasLoadedNamespace(t))){if(null!=r&&""!==r){if(null==(u=this.backend)?void 0:u.create){const s=_(x({},o),{isUpdate:i}),l=this.backend.create.bind(this.backend);if(l.length<6)try{let i;i=5===l.length?l(e,t,r,n,s):l(e,t,r,n),i&&"function"==typeof i.then?i.then(e=>a(null,e)).catch(a):a(null,i)}catch(h){a(h)}else l(e,t,r,n,a,s)}e&&e[0]&&this.store.addResource(e[0],t,r,n)}}else this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const Mt=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Ze(e[1])&&(t.defaultValue=e[1]),Ze(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const r=e[3]||e[2];Object.keys(r).forEach(e=>{t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Bt=e=>{var t,r;return Ze(e.ns)&&(e.ns=[e.ns]),Ze(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ze(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),(null==(r=null==(t=e.supportedLngs)?void 0:t.indexOf)?void 0:r.call(t,"cimode"))<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e},Ht=()=>{};class Pt extends bt{constructor(e={},t){var r;if(super(),this.options=Bt(e),this.services={},this.logger=yt,this.modules={external:[]},r=this,Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(e=>{"function"==typeof r[e]&&(r[e]=r[e].bind(r))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Ze(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=Mt();this.options=x(x(x({},r),this.options),Bt(e)),this.options.interpolation=x(x({},r.interpolation),this.options.interpolation),void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);const n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?yt.init(n(this.modules.logger),this.options):yt.init(null,this.options),e=this.modules.formatter?this.modules.formatter:Dt;const t=new Et(this.options);this.store=new wt(this.options.resources,this.options);const i=this.services;i.logger=yt,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new It(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=n(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new Rt(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new zt(n(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=n(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=n(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Nt(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Ht),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const i=et(),o=()=>{const e=(e,r)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(r),t(e,r)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),i}loadResources(e,t=Ht){var r,n;let i=t;const o=Ze(e)?e:this.language;if("function"==typeof e&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===(null==o?void 0:o.toLowerCase())&&(!this.options.preload||0===this.options.preload.length))return i();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(o)t(o);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}null==(n=null==(r=this.options.preload)?void 0:r.forEach)||n.call(r,e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),i(e)})}else i(null)}reloadResources(e,t,r){const n=et();return"function"==typeof e&&(r=e,e=void 0),"function"==typeof t&&(r=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),r||(r=Ht),this.services.backendConnector.reload(e,t,e=>{n.resolve(),r(e)}),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&xt.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const r=et();this.emit("languageChanging",e);const n=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,o)=>{o?this.isLanguageChangingTo===e&&(n(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,r.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},o=t=>{var r,o;e||t||!this.services.languageDetector||(t=[]);const a=Ze(t)?t:t&&t[0],s=this.store.hasLanguageSomeTranslations(a)?a:this.services.languageUtils.getBestMatchFromCodes(Ze(t)?[t]:t);s&&(this.language||n(s),this.translator.language||this.translator.changeLanguage(s),null==(o=null==(r=this.services.languageDetector)?void 0:r.cacheUserLanguage)||o.call(r,s)),this.loadResources(s,e=>{i(e,s)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}getFixedT(e,t,r){const n=(e,t,...i)=>{let o;o="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(i)):x({},t),o.lng=o.lng||n.lng,o.lngs=o.lngs||n.lngs,o.ns=o.ns||n.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||r||n.keyPrefix);const a=this.options.keySeparator||".";let s;return o.keyPrefix&&Array.isArray(e)?s=e.map(e=>("function"==typeof e&&(e=kt(e,x(x({},this.options),t))),`${o.keyPrefix}${a}${e}`)):("function"==typeof e&&(e=kt(e,x(x({},this.options),t))),s=o.keyPrefix?`${o.keyPrefix}${a}${e}`:e),this.t(s,o)};return Ze(e)?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=r,n}t(...e){var t;return null==(t=this.translator)?void 0:t.translate(...e)}exists(...e){var t;return null==(t=this.translator)?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],n=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;const o=(e,t)=>{const r=this.services.backendConnector.state[`${e}|${t}`];return-1===r||0===r||2===r};if(t.precheck){const e=t.precheck(this,o);if(void 0!==e)return e}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(r,e)||n&&!o(i,e)))}loadNamespaces(e,t){const r=et();return this.options.ns?(Ze(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=et();Ze(e)&&(e=[e]);const n=this.options.preload||[],i=e.filter(e=>n.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=n.concat(i),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}dir(e){var t,r;if(e||(e=this.resolvedLanguage||((null==(t=this.languages)?void 0:t.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(i){}const n=(null==(r=this.services)?void 0:r.languageUtils)||new Et(Mt());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new Pt(e,t)}cloneInstance(e={},t=Ht){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const n=x(x(x({},this.options),e),{isClone:!0}),i=new Pt(n);void 0===e.debug&&void 0===e.prefix||(i.logger=i.logger.clone(e));if(["store","services","language"].forEach(e=>{i[e]=this[e]}),i.services=x({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]=x({},this.store.data[t]),e[t]=Object.keys(e[t]).reduce((r,n)=>(r[n]=x({},e[t][n]),r),e[t]),e),{});i.store=new wt(e,n),i.services.resourceStore=i.store}return i.translator=new Nt(i.services,n),i.translator.on("*",(e,...t)=>{i.emit(e,...t)}),i.init(n,t),i.translator.options=n,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ut=Pt.createInstance();Ut.createInstance=Pt.createInstance,Ut.createInstance,Ut.dir,Ut.init,Ut.loadResources,Ut.reloadResources,Ut.use,Ut.changeLanguage,Ut.getFixedT,Ut.t,Ut.exists,Ut.setDefaultNamespace,Ut.hasLoadedNamespace,Ut.loadNamespaces,Ut.loadLanguages;const{slice:Wt,forEach:jt}=[];const Vt=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,qt={create(e,t,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+60*r*1e3)),n&&(i.domain=n),document.cookie=function(e,t){const r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{path:"/"};let n=`${e}=${encodeURIComponent(t)}`;if(r.maxAge>0){const e=r.maxAge-0;if(Number.isNaN(e))throw new Error("maxAge should be a Number");n+=`; Max-Age=${Math.floor(e)}`}if(r.domain){if(!Vt.test(r.domain))throw new TypeError("option domain is invalid");n+=`; Domain=${r.domain}`}if(r.path){if(!Vt.test(r.path))throw new TypeError("option path is invalid");n+=`; Path=${r.path}`}if(r.expires){if("function"!=typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");n+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.sameSite)switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:n+="; SameSite=Strict";break;case"lax":n+="; SameSite=Lax";break;case"strict":n+="; SameSite=Strict";break;case"none":n+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(n+="; Partitioned"),n}(e,t,i)},read(e){const t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let e=r[n];for(;" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(t))return e.substring(t.length,e.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var Gt={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&"undefined"!=typeof document)return qt.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:n,cookieDomain:i,cookieOptions:o}=t;r&&"undefined"!=typeof document&&qt.create(r,e,n,i,o)}},Kt={name:"querystring",lookup(e){var t;let r,{lookupQuerystring:n}=e;if("undefined"!=typeof window){let{search:e}=window.location;!window.location.search&&(null==(t=window.location.hash)?void 0:t.indexOf("?"))>-1&&(e=window.location.hash.substring(window.location.hash.indexOf("?")));const i=e.substring(1).split("&");for(let t=0;t<i.length;t++){const e=i[t].indexOf("=");if(e>0){i[t].substring(0,e)===n&&(r=i[t].substring(e+1))}}}return r}},Qt={name:"hash",lookup(e){var t;let r,{lookupHash:n,lookupFromHashIndex:i}=e;if("undefined"!=typeof window){const{hash:e}=window.location;if(e&&e.length>2){const o=e.substring(1);if(n){const e=o.split("&");for(let t=0;t<e.length;t++){const i=e[t].indexOf("=");if(i>0){e[t].substring(0,i)===n&&(r=e[t].substring(i+1))}}}if(r)return r;if(!r&&i>-1){const r=e.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(r))return;return null==(t=r["number"==typeof i?i:0])?void 0:t.replace("/","")}}}return r}};let Jt=null;const Xt=()=>{if(null!==Jt)return Jt;try{if(Jt="undefined"!=typeof window&&null!==window.localStorage,!Jt)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){Jt=!1}return Jt};var Yt={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Xt())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&Xt()&&window.localStorage.setItem(r,e)}};let Zt=null;const er=()=>{if(null!==Zt)return Zt;try{if(Zt="undefined"!=typeof window&&null!==window.sessionStorage,!Zt)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){Zt=!1}return Zt};var tr={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&er())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&er()&&window.sessionStorage.setItem(r,e)}},rr={name:"navigator",lookup(e){const t=[];if("undefined"!=typeof navigator){const{languages:e,userLanguage:r,language:n}=navigator;if(e)for(let i=0;i<e.length;i++)t.push(e[i]);r&&t.push(r),n&&t.push(n)}return t.length>0?t:void 0}},nr={name:"htmlTag",lookup(e){let t,{htmlTag:r}=e;const n=r||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},ir={name:"path",lookup(e){var t;let{lookupFromPathIndex:r}=e;if("undefined"==typeof window)return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(n))return;return null==(t=n["number"==typeof r?r:0])?void 0:t.replace("/","")}},or={name:"subdomain",lookup(e){var t,r;let{lookupFromSubdomainIndex:n}=e;const i="number"==typeof n?n+1:1,o="undefined"!=typeof window&&(null==(r=null==(t=window.location)?void 0:t.hostname)?void 0:r.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(o)return o[i]}};let ar=!1;try{document.cookie,ar=!0}catch(Li){}const sr=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];ar||sr.splice(1,1);class lr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{languageUtils:{}},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return jt.call(Wt.call(arguments,1),t=>{if(t)for(const r in t)void 0===e[r]&&(e[r]=t[r])}),e}(t,this.options||{},{order:sr,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=e=>e.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(Gt),this.addDetector(Kt),this.addDetector(Yt),this.addDetector(tr),this.addDetector(rr),this.addDetector(nr),this.addDetector(ir),this.addDetector(or),this.addDetector(Qt)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let r=this.detectors[e].lookup(this.options);r&&"string"==typeof r&&(r=[r]),r&&(t=t.concat(r))}}),t=t.filter(e=>{return null!=e&&!("string"==typeof(t=e)&&[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(e=>e.test(t)));var t}).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}}function cr(e,t){for(var r in e)if("__source"!==r&&!(r in t))return!0;for(var n in t)if("__source"!==n&&e[n]!==t[n])return!0;return!1}function dr(e,t){this.props=e,this.context=t}lr.type="languageDetector",(dr.prototype=new A).isPureReactComponent=!0,dr.prototype.shouldComponentUpdate=function(e,t){return cr(this.props,e)||cr(this.state,t)};var ur=r.__b;r.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ur&&ur(e)};var hr=r.__e;r.__e=function(e,t,r,n){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t);hr(e,t,r,n)};var gr=r.unmount;function pr(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,t){for(var r in t)e[r]=t[r];return e}({},e)).__c&&(e.__c.__P===r&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return pr(e,t,r)})),e}function mr(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return mr(e,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function fr(){this.__u=0,this.o=null,this.__b=null}function vr(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function yr(){this.i=null,this.l=null}r.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),gr&&gr(e)},(fr.prototype=new A).__c=function(e,t){var r=t.__c,n=this;null==n.o&&(n.o=[]),n.o.push(r);var i=vr(n.__v),o=!1,a=function(){o||(o=!0,r.__R=null,i?i(s):s())};r.__R=a;var s=function(){if(! --n.__u){if(n.state.__a){var e=n.state.__a;n.__v.__k[0]=mr(e,e.__c.__P,e.__c.__O)}var t;for(n.setState({__a:n.__b=null});t=n.o.pop();)t.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(a,a)},fr.prototype.componentWillUnmount=function(){this.o=[]},fr.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=pr(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&O(R,null,e.fallback);return i&&(i.__u&=-33),[O(R,null,t.__a?null:e.children),i]};var br=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(yr.prototype=new A).__a=function(e){var t=this,r=vr(t.__v),n=t.l.get(e);return n[0]++,function(i){var o=function(){t.props.revealOrder?(n.push(i),br(t,e,n)):i()};r?r(o):o()}},yr.prototype.render=function(e){this.i=null,this.l=new Map;var t=P(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},yr.prototype.componentDidUpdate=yr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){br(e,r,t)})};var wr="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,xr=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,_r=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,kr=/[A-Z0-9]/g,Cr="undefined"!=typeof document,Sr=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};A.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(A.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Nr=r.event;function Er(){}function Tr(){return this.cancelBubble}function Lr(){return this.defaultPrevented}r.event=function(e){return Nr&&(e=Nr(e)),e.persist=Er,e.isPropagationStopped=Tr,e.isDefaultPrevented=Lr,e.nativeEvent=e};var Ir={enumerable:!1,configurable:!0,get:function(){return this.class}},Or=r.vnode;r.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,r=e.type,n={},i=-1===r.indexOf("-");for(var o in t){var a=t[o];if(!("value"===o&&"defaultValue"in t&&null==a||Cr&&"children"===o&&"noscript"===r||"class"===o||"className"===o)){var s=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===a?a="":"translate"===s&&"no"===a?a=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?o="ondblclick":"onchange"!==s||"input"!==r&&"textarea"!==r||Sr(t.type)?"onfocus"===s?o="onfocusin":"onblur"===s?o="onfocusout":_r.test(o)&&(o=s):s=o="oninput":i&&xr.test(o)?o=o.replace(kr,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===s&&n[o=s]&&(o="oninputCapture"),n[o]=a}}"select"==r&&n.multiple&&Array.isArray(n.value)&&(n.value=P(t.children).forEach(function(e){e.props.selected=-1!=n.value.indexOf(e.props.value)})),"select"==r&&null!=n.defaultValue&&(n.value=P(t.children).forEach(function(e){e.props.selected=n.multiple?-1!=n.defaultValue.indexOf(e.props.value):n.defaultValue==e.props.value})),t.class&&!t.className?(n.class=t.class,Object.defineProperty(n,"className",Ir)):(t.className&&!t.class||t.class&&t.className)&&(n.class=n.className=t.className),e.props=n}(e),e.$$typeof=wr,Or&&Or(e)};var $r=r.__r;r.__r=function(e){$r&&$r(e),e.__c};var Rr=r.diffed;r.diffed=function(e){Rr&&Rr(e);var t=e.props,r=e.__e;null!=r&&"textarea"===e.type&&"value"in t&&t.value!==r.value&&(r.value=null==t.value?"":t.value)};const Ar={},Fr=(e,t,r,n)=>{Br(r)&&Ar[r]||(Br(r)&&(Ar[r]=new Date),((e,t,r,n)=>{var i,o,a,s;const l=[r,x({code:t},n||{})];if(null==(o=null==(i=null==e?void 0:e.services)?void 0:i.logger)?void 0:o.forward)return e.services.logger.forward(l,"warn","react-i18next::",!0);Br(l[0])&&(l[0]=`react-i18next:: ${l[0]}`),(null==(s=null==(a=null==e?void 0:e.services)?void 0:a.logger)?void 0:s.warn)?e.services.logger.warn(...l):null==console||console.warn})(e,t,r,n))},Dr=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},zr=(e,t,r)=>{e.loadNamespaces(t,Dr(e,r))},Mr=(e,t,r,n)=>{if(Br(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return zr(e,r,n);r.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Dr(e,n))},Br=e=>"string"==typeof e,Hr=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Pr={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ur=e=>Pr[e];let Wr={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(Hr,Ur)};let jr;const Vr={type:"3rdParty",init(e){((e={})=>{Wr=x(x({},Wr),e)})(e.options.react),(e=>{jr=e})(e)}},qr=ee();class Gr{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Kr=(e,t,r,n)=>e.getFixedT(t,r,n),Qr=(e,t={})=>{var r,n,i,o;const{i18n:a}=t,{i18n:s,defaultNS:l}=Be(qr)||{},c=a||s||jr;if(c&&!c.reportNamespaces&&(c.reportNamespaces=new Gr),!c){Fr(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>{return Br(t)?t:"object"==typeof(r=t)&&null!==r&&Br(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e;var r},t=[e,{},!1];return t.t=e,t.i18n={},t.ready=!1,t}(null==(r=c.options.react)?void 0:r.wait)&&Fr(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d=x(x(x({},Wr),c.options.react),t),{useSuspense:u,keyPrefix:h}=d;let g=l||(null==(n=c.options)?void 0:n.defaultNS);g=Br(g)?[g]:g||["translation"],null==(o=(i=c.reportNamespaces).addUsedNamespaces)||o.call(i,g);const p=(c.isInitialized||c.initializedStoreOnce)&&g.every(e=>((e,t,r={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:r.lng,precheck:(t,n)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(Fr(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,c,d)),m=((e,t,r,n)=>Me(Kr(e,t,r,n),[e,t,r,n]))(c,t.lng||null,"fallback"===d.nsMode?g:g[0],h),f=()=>m,v=()=>Kr(c,t.lng||null,"fallback"===d.nsMode?g:g[0],h),[y,b]=Re(f);let w=g.join();t.lng&&(w=`${t.lng}${w}`);const _=((e,t)=>{const r=De();return Fe(()=>{r.current=e},[e,t]),r.current})(w),k=De(!0);Fe(()=>{const{bindI18n:e,bindI18nStore:r}=d;k.current=!0,p||u||(t.lng?Mr(c,t.lng,g,()=>{k.current&&b(v)}):zr(c,g,()=>{k.current&&b(v)})),p&&_&&_!==w&&k.current&&b(v);const n=()=>{k.current&&b(v)};return e&&(null==c||c.on(e,n)),r&&(null==c||c.store.on(r,n)),()=>{k.current=!1,c&&e&&(null==e||e.split(" ").forEach(e=>c.off(e,n))),r&&c&&r.split(" ").forEach(e=>c.store.off(e,n))}},[c,w]),Fe(()=>{k.current&&p&&b(f)},[c,h,p]);const C=[y,c,p];if(C.t=y,C.i18n=c,C.ready=p,p)return C;if(!p&&!u)return C;throw new Promise(e=>{t.lng?Mr(c,t.lng,g,()=>e()):zr(c,g,()=>e())})},Jr=()=>{var e;const t=document.documentElement.lang;if(t)return t.split("-")[0];const r=navigator.language||(null==(e=navigator.languages)?void 0:e[0]);return r?r.split("-")[0]:"en"},Xr=e=>["ar","he","fa","ur","ku","dv"].includes(e.toLowerCase()),Yr=(e,t)=>{var r;const n={en:{home:"Home",messages:"Messages",help:"Help",news:"News"},ar:{home:"الرئيسية",messages:"الرسائل",help:"المساعدة",news:"الأخبار"}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},Zr=(e,t)=>{var r;const n={en:{loading:"Loading...",error:"Something went wrong",retry:"Try again",close:"Close",send:"Send",search:"Search"},ar:{loading:"جاري التحميل...",error:"حدث خطأ ما",retry:"حاول مرة أخرى",close:"إغلاق",send:"إرسال",search:"بحث"}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},en=(e,t)=>{var r;const n={en:{placeholder:"Type your message...",typing:"Typing...",offline:"Offline",online:"Online"},ar:{placeholder:"اكتب رسالتك...",typing:"يكتب...",offline:"غير متصل",online:"متصل"}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},tn=(e,t)=>{var r;const n={en:{"search.placeholder":"Search our articles...","no.results":"No articles found","search.results":"Search results"},ar:{"search.placeholder":"ابحث في مقالاتنا...","no.results":"لم يتم العثور على مقالات","search.results":"نتائج البحث"}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},rn=(e,t)=>{var r;const n={en:{greeting:"Hello there",question:"How can we help?",sendMessage:"Send us a message",replyTime:"We typically reply within a day",searchHelp:"Search for help",helpArticle1:"A/B test different message variations",helpArticle2:"Reuse bot content by linking Custom Bots",helpArticle3:"Custom Bots explained",helpArticle4:"Install and configure the Salesforce app"},ar:{greeting:"مرحباً",question:"كيف يمكننا مساعدتك؟",sendMessage:"أرسل لنا رسالة",replyTime:"نرد عادة خلال يوم واحد",searchHelp:"ابحث عن المساعدة",helpArticle1:"اختبار A/B لتنويعات الرسائل المختلفة",helpArticle2:"إعادة استخدام محتوى البوت بربط البوتات المخصصة",helpArticle3:"شرح البوتات المخصصة",helpArticle4:"تثبيت وتكوين تطبيق Salesforce"}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},nn=(e,t)=>{var r;const n={en:{"boundary.title":"Something went wrong","boundary.message":"The widget encountered an unexpected error","boundary.retry":"Try Again","boundary.reset":"Reset Widget"},ar:{"boundary.title":"حدث خطأ ما","boundary.message":"واجهت الأداة خطأ غير متوقع","boundary.retry":"حاول مرة أخرى","boundary.reset":"إعادة تعيين الأداة"}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},on=(e,t)=>{var r;const n={en:{connecting:"Connecting...",connecting_message:"Establishing connection to chat service",error:"Connection Issue",failed:"Connection Failed",max_retries_message:"Unable to connect after multiple attempts",retry:"Retry Connection",retry_in:"Retrying in {{seconds}} seconds"},ar:{connecting:"جاري الاتصال...",connecting_message:"جاري إنشاء اتصال بخدمة الدردشة",error:"مشكلة في الاتصال",failed:"فشل الاتصال",max_retries_message:"غير قادر على الاتصال بعد محاولات متعددة",retry:"إعادة المحاولة",retry_in:"إعادة المحاولة خلال {{seconds}} ثانية"}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},an=(e,t)=>{var r;const n={en:{temporary:"Temporary Error",failed:"Request Failed",retry_attempt:"Attempt {{current}} of {{max}}",retry_in:"Retrying in {{seconds}} seconds",retrying:"Retrying...",retry_now:"Retry Now",dismiss:"Dismiss",bad_request:"Invalid request. Please try again.",unauthorized:"Authentication required. Please refresh the page.",forbidden:"Access denied. Please contact support.",not_found:"Service not found. Please try again later.",rate_limited:"Too many requests. Please wait a moment.",server_error:"Server error. Please try again later.",service_unavailable:"Service temporarily unavailable. Please try again later.",generic:"An error occurred. Please try again."},ar:{temporary:"خطأ مؤقت",failed:"فشل الطلب",retry_attempt:"المحاولة {{current}} من {{max}}",retry_in:"إعادة المحاولة خلال {{seconds}} ثانية",retrying:"جاري إعادة المحاولة...",retry_now:"أعد المحاولة الآن",dismiss:"إغلاق",bad_request:"طلب غير صالح. يرجى المحاولة مرة أخرى.",unauthorized:"مطلوب المصادقة. يرجى تحديث الصفحة.",forbidden:"تم رفض الوصول. يرجى الاتصال بالدعم.",not_found:"الخدمة غير موجودة. يرجى المحاولة لاحقاً.",rate_limited:"طلبات كثيرة جداً. يرجى الانتظار قليلاً.",server_error:"خطأ في الخادم. يرجى المحاولة لاحقاً.",service_unavailable:"الخدمة غير متاحة مؤقتاً. يرجى المحاولة لاحقاً.",generic:"حدث خطأ. يرجى المحاولة مرة أخرى."}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},sn=(e,t)=>{var r;const n={en:{unavailable:"Service Unavailable",failure_message:"{{service}} is currently unavailable. Please try again later."},ar:{unavailable:"الخدمة غير متاحة",failure_message:"{{service}} غير متاحة حالياً. يرجى المحاولة لاحقاً."}};return(null==(r=n[e])?void 0:r[t])||n.en[t]||t},ln=e=>({"header.text":Zr(e,"loading"),"welcome.message":rn(e,"greeting"),"button.text":Zr(e,"send"),"navigation.home":Yr(e,"home"),"navigation.messages":Yr(e,"messages"),"navigation.help":Yr(e,"help"),"navigation.news":Yr(e,"news"),"common.loading":Zr(e,"loading"),"common.error":Zr(e,"error"),"common.retry":Zr(e,"retry"),"common.close":Zr(e,"close"),"common.send":Zr(e,"send"),"common.search":Zr(e,"search"),"chat.placeholder":en(e,"placeholder"),"chat.typing":en(e,"typing"),"chat.offline":en(e,"offline"),"chat.online":en(e,"online"),"faq.search.placeholder":tn(e,"search.placeholder"),"faq.no.results":tn(e,"no.results"),"faq.search.results":tn(e,"search.results"),"home.greeting":rn(e,"greeting"),"home.question":rn(e,"question"),"home.sendMessage":rn(e,"sendMessage"),"home.replyTime":rn(e,"replyTime"),"home.searchHelp":rn(e,"searchHelp"),"home.helpArticle1":rn(e,"helpArticle1"),"home.helpArticle2":rn(e,"helpArticle2"),"home.helpArticle3":rn(e,"helpArticle3"),"home.helpArticle4":rn(e,"helpArticle4"),"error.boundary.title":nn(e,"boundary.title"),"error.boundary.message":nn(e,"boundary.message"),"error.boundary.retry":nn(e,"boundary.retry"),"error.boundary.reset":nn(e,"boundary.reset"),"connection.connecting":on(e,"connecting"),"connection.connecting_message":on(e,"connecting_message"),"connection.error":on(e,"error"),"connection.failed":on(e,"failed"),"connection.max_retries_message":on(e,"max_retries_message"),"connection.retry":on(e,"retry"),"connection.retry_in":on(e,"retry_in"),"api.error.temporary":an(e,"temporary"),"api.error.failed":an(e,"failed"),"api.error.retry_attempt":an(e,"retry_attempt"),"api.error.retry_in":an(e,"retry_in"),"api.error.retrying":an(e,"retrying"),"api.error.retry_now":an(e,"retry_now"),"api.error.dismiss":an(e,"dismiss"),"api.error.bad_request":an(e,"bad_request"),"api.error.unauthorized":an(e,"unauthorized"),"api.error.forbidden":an(e,"forbidden"),"api.error.not_found":an(e,"not_found"),"api.error.rate_limited":an(e,"rate_limited"),"api.error.server_error":an(e,"server_error"),"api.error.service_unavailable":an(e,"service_unavailable"),"api.error.generic":an(e,"generic"),"service.unavailable":sn(e,"unavailable"),"service.failure_message":sn(e,"failure_message")}),cn=()=>ze(()=>(()=>{let e=!1;return{initializeI18n:(t,...r)=>C(null,[t,...r],function*(t,r={fallbackLanguage:"en"}){if(e)return Object.keys(t).forEach(e=>{Ut.addResourceBundle(e,"translation",t[e].translation,!0,!0)}),void(r.language&&r.language!==Ut.language&&(yield Ut.changeLanguage(r.language)));const n=r.language||Jr();yield Ut.use(lr).use(Vr).init({resources:t,lng:n,fallbackLng:r.fallbackLanguage,debug:r.debug||!1,detection:{order:["htmlTag","navigator"],caches:[],lookupFromPathIndex:0,lookupFromSubdomainIndex:0},interpolation:{escapeValue:!1},react:{useSuspense:!1}}),e=!0}),isRTL:e=>Xr(e),getCurrentLanguage:()=>Ut.language||"en",changeLanguage:e=>C(null,null,function*(){yield Ut.changeLanguage(e)})}})(),[]),dn=()=>{const{t:e,i18n:t,ready:r}=Qr(),n=t.language||"en",i=Xr(n);return{t:e,i18n:t,isRTL:i,currentLanguage:n,changeLanguage:e=>C(null,null,function*(){yield t.changeLanguage(e)}),ready:r}},un={primary:"#3C5BFF",primaryHover:"#334BFA",secondary:"#6B7280",white:"#FFFFFF",black:"#000000",gray:{50:"#FAFAFA",100:"#F2F2F2",200:"#E8EAFD",300:"#E1E1E1",400:"#D8D8D8",500:"#737376",600:"#686868",700:"#737373",800:"#1A1A1A"},text:{primary:"#000000",secondary:"#686868",muted:"#737376"},background:{primary:"#FFFFFF",secondary:"#FAFAFA"},button:{primary:"#3C5BFF"},border:{light:"#E1E1E1",medium:"#D8D8D8"},shadow:{sm:"0px 2px 8px 0px rgba(35, 47, 53, 0.09)",md:"0px 1px 6px 0px rgba(0, 0, 0, 0.06), 0px 2px 32px 0px rgba(0, 0, 0, 0.16)",lg:"0px 5px 40px 0px rgba(0, 0, 0, 0.16)",card:"0px 0px 0px 1px rgba(0, 0, 0, 0.08), 0px 2px 8px 0px rgba(0, 0, 0, 0.06)"}},hn={xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"20px","2xl":"24px","3xl":"32px","4xl":"40px"},gn={sm:"3px",md:"6px",lg:"8px",xl:"10px","2xl":"16px",full:"50%",button:"100px"},pn={fontFamily:{primary:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif",display:"SF Pro Display, -apple-system, BlinkMacSystemFont, sans-serif"},fontSize:{xs:"12px",sm:"13px",base:"14px",lg:"16px",xl:"32px"},fontWeight:{normal:"400",medium:"600",bold:"700"},lineHeight:{tight:"1.2",normal:"1.4",relaxed:"1.5"}},mn={widget:2147483647,modal:1e3,dropdown:100},fn={duration:{fast:"0.15s",normal:"0.2s",slow:"0.3s"},easing:{easeInOut:"ease-in-out"}},vn=e=>{const t=(null==e?void 0:e.primaryColor)||un.primary,r=(null==e?void 0:e.secondaryColor)||un.secondary,n=(e=>{if(e.startsWith("#")){const t=e.slice(1),r=parseInt(t,16);return`#${(Math.max(0,(r>>16)-20)<<16|Math.max(0,(r>>8&255)-20)<<8|Math.max(0,(255&r)-20)).toString(16).padStart(6,"0")}`}return e})(t),i=(e=>{if(e.startsWith("#")){const t=e.slice(1),r=parseInt(t,16);return`#${(Math.min(255,200+(r>>16))<<16|Math.min(255,200+(r>>8&255))<<8|Math.min(255,200+(255&r))).toString(16).padStart(6,"0")}`}return e})(t);return`\n\t\t/* Core theme colors */\n\t\t--widget-primary-color: ${t};\n\t\t--widget-primary-hover: ${n};\n\t\t--widget-primary-light: ${i};\n\t\t--widget-secondary-color: ${r};\n\t\t\n\t\t/* Button colors - use primary for all button states */\n\t\t--widget-button-primary: ${t};\n\t\t--widget-button-primary-hover: ${n};\n\t\t--widget-button-secondary: ${i};\n\t\t--widget-button-secondary-text: ${t};\n\t\t\n\t\t/* Message and chat colors */\n\t\t--widget-message-user-bg: ${t};\n\t\t--widget-message-user-text: ${un.white};\n\t\t--widget-message-bot-bg: ${r};\n\t\t--widget-message-bot-text: ${un.white};\n\t\t\n\t\t/* Input and form colors */\n\t\t--widget-input-border: ${r};\n\t\t--widget-input-border-focus: ${t};\n\t\t--widget-input-bg: ${un.background.primary};\n\t\t\n\t\t/* Header and trigger colors */\n\t\t--widget-header-bg: ${t};\n\t\t--widget-header-text: ${un.white};\n\t\t--widget-trigger-bg: ${t};\n\t\t--widget-trigger-hover: ${n};\n\t\t\n\t\t/* Link and accent colors */\n\t\t--widget-link-color: ${t};\n\t\t--widget-link-hover: ${n};\n\t\t--widget-accent-color: ${t};\n\t\t\n\t\t/* Status and state colors */\n\t\t--widget-online-color: #28a745;\n\t\t--widget-offline-color: ${r};\n\t\t--widget-typing-color: ${t};\n\t\t\n\t\t/* Base colors */\n\t\t--widget-white: ${un.white};\n\t\t--widget-black: ${un.black};\n\t\t--widget-gray-50: ${un.gray[50]};\n\t\t--widget-gray-100: ${un.gray[100]};\n\t\t--widget-gray-200: ${un.gray[200]};\n\t\t--widget-gray-300: ${un.gray[300]};\n\t\t--widget-gray-400: ${un.gray[400]};\n\t\t--widget-gray-500: ${un.gray[500]};\n\t\t--widget-gray-600: ${un.gray[600]};\n\t\t--widget-gray-700: ${un.gray[700]};\n\t\t--widget-gray-800: ${un.gray[800]};\n\t\t\n\t\t/* Text colors */\n\t\t--widget-text-primary: ${un.text.primary};\n\t\t--widget-text-secondary: ${un.text.secondary};\n\t\t--widget-text-muted: ${un.text.muted};\n\t\t\n\t\t/* Background colors */\n\t\t--widget-bg-primary: ${un.background.primary};\n\t\t--widget-bg-secondary: ${un.background.secondary};\n\t\t--widget-bg-gradient: linear-gradient(135deg, ${t} 0%, ${n} 100%);\n\t\t--widget-bg-gradient-new: linear-gradient(118deg, ${n} 0%, ${t} 60%, ${i} 100%);\n\t\t\n\t\t/* Border colors */\n\t\t--widget-border-light: ${un.border.light};\n\t\t--widget-border-medium: ${un.border.medium};\n\t\t--widget-border-primary: ${t};\n\t\t\n\t\t/* Shadow colors */\n\t\t--widget-shadow-sm: ${un.shadow.sm};\n\t\t--widget-shadow-md: ${un.shadow.md};\n\t\t--widget-shadow-lg: ${un.shadow.lg};\n\t\t--widget-shadow-card: ${un.shadow.card};\n\t\t\n\t\t/* Border radius */\n\t\t--widget-border-radius-sm: ${gn.sm};\n\t\t--widget-border-radius-md: ${gn.md};\n\t\t--widget-border-radius-lg: ${gn.lg};\n\t\t--widget-border-radius-xl: ${gn.xl};\n\t\t--widget-border-radius-2xl: ${gn["2xl"]};\n\t\t--widget-border-radius-full: ${gn.full};\n\t\t--widget-border-radius-button: ${gn.button};\n\t\t\n\t\t/* Typography */\n\t\t--widget-font-family: ${pn.fontFamily.primary};\n\t\t--widget-font-family-display: ${pn.fontFamily.display};\n\t\t--widget-font-size-xs: ${pn.fontSize.xs};\n\t\t--widget-font-size-sm: ${pn.fontSize.sm};\n\t\t--widget-font-size-base: ${pn.fontSize.base};\n\t\t--widget-font-size-lg: ${pn.fontSize.lg};\n\t\t--widget-font-size-xl: ${pn.fontSize.xl};\n\t\t--widget-font-weight-normal: ${pn.fontWeight.normal};\n\t\t--widget-font-weight-medium: ${pn.fontWeight.medium};\n\t\t--widget-font-weight-bold: ${pn.fontWeight.bold};\n\t\t--widget-line-height-tight: ${pn.lineHeight.tight};\n\t\t--widget-line-height-normal: ${pn.lineHeight.normal};\n\t\t--widget-line-height-relaxed: ${pn.lineHeight.relaxed};\n\t\t\n\t\t/* Spacing */\n\t\t--widget-spacing-xs: ${hn.xs};\n\t\t--widget-spacing-sm: ${hn.sm};\n\t\t--widget-spacing-md: ${hn.md};\n\t\t--widget-spacing-lg: ${hn.lg};\n\t\t--widget-spacing-xl: ${hn.xl};\n\t\t--widget-spacing-2xl: ${hn["2xl"]};\n\t\t--widget-spacing-3xl: ${hn["3xl"]};\n\t\t--widget-spacing-4xl: ${hn["4xl"]};\n\t\t\n\t\t/* Z-index */\n\t\t--widget-z-index: ${mn.widget};\n\t\t--widget-z-index-modal: ${mn.modal};\n\t\t--widget-z-index-dropdown: ${mn.dropdown};\n\t\t\n\t\t/* Animation */\n\t\t--widget-animation-duration-fast: ${fn.duration.fast};\n\t\t--widget-animation-duration-normal: ${fn.duration.normal};\n\t\t--widget-animation-duration-slow: ${fn.duration.slow};\n\t\t--widget-animation-easing: ${fn.easing.easeInOut};\n\t`},yn={primaryColor:un.primary,secondaryColor:un.secondary,textColor:un.text.primary,backgroundColor:un.background.primary,borderRadius:gn.lg,grayTextColor:un.text.secondary,lightGrayColor:un.gray[800],buttonColor:un.button.primary,gradientStart:un.primary,gradientEnd:un.primaryHover},bn=(e,t,r)=>({message:e,status:t,code:r}),wn=e=>new Promise(t=>setTimeout(t,e)),xn=(e,t,r)=>{const n=t*b(2,e)*(.5+.5*Math.random());return Math.min(n,r)},_n=e=>e&&"object"==typeof e&&"message"in e?e:e instanceof Error?bn(e.message):bn("Unknown error occurred"),kn=(e,t,r)=>e<t&&(e=>!e.status||e.status>=500||429===e.status)(r),Cn=(e,t)=>C(null,null,function*(){let r;for(let i=0;i<=t.maxRetries;i++)try{return yield e()}catch(n){const e=_n(n);if(r=e,!kn(i,t.maxRetries,e))throw e;const o=xn(i,t.baseDelay,t.maxDelay);yield wn(o)}throw r||bn("Operation failed after all retries")}),Sn={maxRetries:3,baseDelay:1e3,maxDelay:1e4},Nn=e=>ze(()=>{const t=(e,...t)=>C(null,[e,...t],function*(e,t={}){const r=yield fetch(e,_(x({},t),{headers:x({"Content-Type":"application/json"},t.headers)}));if(!r.ok)throw yield(e=>C(null,null,function*(){let t,r=`HTTP ${e.status}: ${e.statusText}`;try{const n=yield e.json();n.message&&(r=n.message),n.code&&(t=n.code)}catch(Li){}return bn(r,e.status,t)}))(r);return r});return{registerGuest:(r,n)=>C(null,null,function*(){return Cn(()=>C(null,null,function*(){const i=`${e.baseUrl}/api/v1/org/${e.orgId}/auth/guest/register`,o=JSON.stringify({username:r,email:n}),a=yield t(i,{method:"POST",body:o}),s=a.headers.get("token");if(!s)throw bn("No token received from server",a.status);const l=yield a.json();return _(x({},l),{token:s})}),Sn)}),getPublicWidgetConfig:(r,n)=>C(null,null,function*(){return Cn(()=>C(null,null,function*(){const i=`${e.baseUrl}/api/v1/org/${r}/chat/inboxes/website/widgets/${n}/public`;return(yield t(i)).json()}),Sn)}),searchKnowledgeBase:r=>C(null,null,function*(){if(!r.trim())return[];return Cn(()=>C(null,null,function*(){const n=`${e.baseUrl}/api/v1/org/${e.orgId}/knowledge-base/search`,i=JSON.stringify({query:r}),o=yield t(n,{method:"POST",body:i});return(yield o.json()).results||[]}),Sn)}),getUngroupedFAQs:r=>C(null,null,function*(){return Cn(()=>C(null,null,function*(){const n=`${e.baseUrl}/api/v1/org/${r}/helpcenter/fqa/ungrouped`;return(yield t(n)).json()}),Sn)}),getLogoUrl:(t,r)=>r?`${e.baseUrl}/api/v1/org/${t}/attachments/${r}`:`${e.baseUrl}/api/v1/organization/${t}/logo`}},[e.baseUrl,e.orgId]),En=({error:e,errorInfo:t,retryCount:r,maxRetries:n,onRetry:i,onReset:o,showDetails:a=!1})=>{const s=r<n,l=r>=n;return re("div",{className:"fixed bottom-5 right-5 bg-white border border-red-200 rounded-lg shadow-lg p-4 max-w-sm z-[1000]",children:re("div",{className:"flex items-start",children:[re("div",{className:"flex-shrink-0",children:re("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:re("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),re("div",{className:"ml-3 flex-1",children:[re("h3",{className:"text-sm font-medium text-red-800",children:l?"Widget Error":"Temporary Error"}),re("div",{className:"mt-2 text-sm text-red-700",children:[re("p",{children:l?"The widget encountered an error and couldn't recover automatically.":"The widget encountered an error but will retry automatically."}),r>0&&re("p",{className:"mt-1 text-xs text-red-600",children:["Retry attempt: ",r,"/",n]})]}),a&&e&&re("details",{className:"mt-2",children:[re("summary",{className:"text-xs text-red-600 cursor-pointer hover:text-red-800",children:"Show technical details"}),re("div",{className:"mt-1 text-xs text-red-600 font-mono bg-red-50 p-2 rounded border",children:[re("p",{className:"font-semibold",children:"Error:"}),re("p",{className:"mb-2",children:e.message}),(null==t?void 0:t.componentStack)&&re(R,{children:[re("p",{className:"font-semibold",children:"Component Stack:"}),re("pre",{className:"whitespace-pre-wrap text-xs",children:t.componentStack})]})]})]}),re("div",{className:"mt-3 flex space-x-2",children:[s&&re("button",{type:"button",onClick:i,className:"inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded text-red-700 bg-red-100 hover:bg-red-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500",children:"Retry Now"}),re("button",{type:"button",onClick:o,className:"inline-flex items-center px-3 py-1.5 border border-red-300 text-xs font-medium rounded text-red-700 bg-white hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500",children:"Reset Widget"})]})]})]})})};class Tn extends A{constructor(e){super(e),k(this,"resetTimeoutId",null),k(this,"handleRetry",()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.resetTimeoutId&&(clearTimeout(this.resetTimeoutId),this.resetTimeoutId=null)}),k(this,"handleReset",()=>{this.setState({hasError:!1,error:null,errorInfo:null,retryCount:0,lastErrorTime:0}),this.resetTimeoutId&&(clearTimeout(this.resetTimeoutId),this.resetTimeoutId=null)}),this.state={hasError:!1,error:null,errorInfo:null,retryCount:0,lastErrorTime:0}}static getDerivedStateFromError(e){return{hasError:!0,error:e,lastErrorTime:Date.now()}}componentDidCatch(e,t){var r,n,i,o;const a={componentStack:t.componentStack||"",errorBoundary:this.constructor.name,errorBoundaryStack:t.errorBoundaryStack||""};this.setState(e=>({errorInfo:a,retryCount:e.retryCount+1})),null==(n=(r=this.props).onError)||n.call(r,e,a);const s=null!=(i=this.props.maxRetries)?i:3,l=null!=(o=this.props.resetTimeoutMs)?o:5e3;this.state.retryCount<s&&(this.resetTimeoutId=window.setTimeout(()=>{this.handleRetry()},l))}componentWillUnmount(){this.resetTimeoutId&&clearTimeout(this.resetTimeoutId)}render(){var e;return this.state.hasError?this.props.fallback?this.props.fallback:re(En,{error:this.state.error,errorInfo:this.state.errorInfo,retryCount:this.state.retryCount,maxRetries:null!=(e=this.props.maxRetries)?e:3,onRetry:this.handleRetry,onReset:this.handleReset}):this.props.children}}const Ln={maxRetries:3,baseDelay:1e3,maxDelay:1e4,enableUserFeedback:!0,enableAutoRetry:!0},In=e=>!e.status||(e.status>=500||(429===e.status||!(e.status>=400&&e.status<500))),On=e=>({user:e.user,messages:e.messages,unreadCount:e.unreadCount,currentWindow:e.currentWindow,lastActivity:Date.now()}),$n=(e,t)=>(e=>{const{storageKey:t,expirationHours:r}=e,n=()=>{try{localStorage.removeItem(t)}catch(e){}},i=e=>{const t=Date.now(),n=60*r*60*1e3;return t>e.lastActivity+n};return{saveState:e=>{try{const r=JSON.stringify(_(x({},e),{lastActivity:Date.now()}));localStorage.setItem(t,r)}catch(r){}},loadState:()=>{try{const e=localStorage.getItem(t);if(!e)return null;const r=JSON.parse(e);return i(r)?(n(),null):r}catch(e){return n(),null}},clearState:n,isStateExpired:i}})({storageKey:`analytick-widget-${e}-${t}`,expirationHours:24}),Rn=()=>re("svg",{width:"29",height:"31",viewBox:"0 0 29 31",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-7 h-8",role:"img","aria-label":"Chat",children:[re("title",{children:"Chat"}),re("path",{d:"M28.093 31C28.093 31 23.3641 29.2031 19.5382 27.7637H3.44856C1.54359 27.7637 0 26.182 0 24.232V3.53064C0 1.58163 1.54359 0 3.44856 0H24.6424C26.5474 0 28.092 1.58163 28.092 3.53064V21.36L28.093 21.359V31ZM23.9407 19.392C23.6104 18.9976 23.0288 18.9526 22.6444 19.2899C22.6143 19.3159 19.6192 21.8886 14.0445 21.8886C8.54082 21.8886 5.49968 19.334 5.44462 19.2879C5.05922 18.9516 4.48062 18.9986 4.15028 19.392C3.81894 19.7874 3.86499 20.381 4.25039 20.7204C4.39353 20.8445 7.80005 23.7715 14.0445 23.7715C20.2919 23.7715 23.6995 20.8445 23.8406 20.7204C24.226 20.381 24.2721 19.7874 23.9407 19.392Z",fill:"white"})]}),An=()=>re("svg",{width:"16",height:"10",viewBox:"0 0 16 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-2.5",role:"img","aria-label":"Close",children:[re("title",{children:"Close"}),re("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 1.79401L1.79401 0L8 6.20599L14.206 0L16 1.79401L8 9.79401L0 1.79401Z",fill:"white"})]}),Fn=({count:e,isRTL:t})=>{const r=t?"-top-1 -left-1":"-top-1 -right-1",n=e>9?"9+":e.toString();return re("output",{className:`absolute ${r} bg-red-500 text-white rounded-full w-5 h-5 text-xs flex items-center justify-center font-bold min-w-5`,"aria-label":`${e} unread messages`,children:n})},Dn=()=>{const{state:e,dispatch:t}=Ye(),{isRTL:r}=dn(),n=Me(()=>{t({type:"TOGGLE_WIDGET"})},[t]);return re("button",{type:"button",className:`fixed ${(()=>{var t,r;const n="max-sm:bottom-4 max-sm:landscape:bottom-2";switch((null==(r=null==(t=e.widgetConfig)?void 0:t.uiConfigs)?void 0:r.position)||"bottom-right"){case"bottom-left":return`bottom-5 left-5 max-sm:left-4 max-sm:landscape:left-4 ${n}`;case"top-right":return"top-5 right-5 max-sm:top-4 max-sm:right-4 max-sm:landscape:top-2 max-sm:landscape:right-4";case"top-left":return"top-5 left-5 max-sm:top-4 max-sm:left-4 max-sm:landscape:top-2 max-sm:landscape:left-4";default:return`bottom-5 right-5 max-sm:right-4 max-sm:landscape:right-4 ${n}`}})()} \n\t\t\t\tw-15 h-15 max-sm:w-14 max-sm:h-14\n\t\t\t\trounded-full border-0 cursor-pointer \n\t\t\t\tflex items-center justify-center \n\t\t\t\ttransition-all duration-200 ease-in-out z-[1000] \n\t\t\t\thover:scale-105 active:scale-95 \n\t\t\t\tselect-none touch-manipulation\n\t\t\t\tmin-h-[44px] min-w-[44px]\n\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-offset-2\n\t\t\t\tmotion-reduce:transition-none motion-reduce:hover:scale-100 motion-reduce:active:scale-100\n\t\t\t\t${e.isOpen?"active":""}`,onClick:n,style:{backgroundColor:"var(--widget-trigger-bg, var(--widget-primary-color, #3C5BFF))",boxShadow:"0px 1px 6px 0px rgba(0, 0, 0, 0.06), 0px 2px 32px 0px rgba(0, 0, 0, 0.16)",WebkitTapHighlightColor:"transparent",touchAction:"manipulation"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--widget-trigger-hover, var(--widget-primary-hover, #334BFA))"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="var(--widget-trigger-bg, var(--widget-primary-color, #3C5BFF))"},"aria-label":e.isOpen?"Close chat":"Open chat",children:[e.isOpen?re(An,{}):re(Rn,{}),e.unreadCount>0&&!e.isOpen&&re(Fn,{count:e.unreadCount,isRTL:r})]})},zn=()=>{const{state:e,dispatch:t}=Ye(),{sendMessage:r,isConnected:n}=Ke(),i=De(null),o=Me(o=>C(null,null,function*(){if(!(e.user&&e.widgetConfig&&e.channelId&&n))return;i.current&&clearTimeout(i.current);const a={id:`temp_${Date.now()}_${Math.random().toString(36).substring(2,11)}`,content:o,metadata:{senderId:e.user.id,receiverId:"",status:"SENT",channel:"WEBSITE",direction:"INBOUND",type:o.type},timestamp:(new Date).toISOString()};t({type:"ADD_MESSAGE",payload:a});try{r(o,{orgId:e.widgetConfig.orgId,conversationId:e.user.conversationId||"",channelId:e.channelId,senderId:e.user.id,receiverId:""})}catch(s){t({type:"UPDATE_MESSAGE_STATUS",payload:{messageContent:"TEXT"===o.type?o.body:"message",status:"FAILED"}}),i.current&&(clearTimeout(i.current),i.current=null),t({type:"SET_WRITING_STATE",payload:!1})}}),[e.user,e.widgetConfig,e.channelId,n,r,t]);return Fe(()=>{!e.isWriting&&i.current&&(clearTimeout(i.current),i.current=null)},[e.isWriting]),Fe(()=>()=>{i.current&&clearTimeout(i.current)},[]),{handleSendMessage:o}},Mn=({onSendMessage:e,disabled:t=!1,placeholder:r,className:n="",isWriting:i=!1})=>{const[o,a]=Re(""),s=De(null),{t:l,isRTL:c}=dn(),d=r=>{r.preventDefault();const n=o.trim();!n||t||i||(e(n),a(""))};return re("div",{className:`border-t border-gray-200 p-4 max-sm:p-3 ${n}`,children:re("form",{onSubmit:d,className:"flex items-start gap-2 max-sm:gap-1.5",children:[re("div",{className:"flex-1",children:re("textarea",{ref:s,value:o,onChange:e=>{const t=e.target.value;a(t)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),d(e))},placeholder:r||l("chat.input.placeholder","Type a message..."),disabled:t||i,rows:2,className:`\n w-full px-3 py-2 max-sm:px-2.5 max-sm:py-1.5 border rounded-lg resize-none\n focus:outline-none focus:ring-2 focus:border-transparent\n disabled:bg-gray-100 disabled:cursor-not-allowed\n leading-5\n scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100\n hover:scrollbar-thumb-gray-400\n ${c?"text-right":"text-left"}\n `,style:{borderColor:"var(--widget-input-border, var(--widget-secondary-color, #6B7280))","--tw-ring-color":"var(--widget-input-border-focus, var(--widget-secondary-color, #6B7280))",color:"var(--widget-text-color, #000000)",fontFamily:"var(--widget-font-family, Arial, sans-serif)",fontSize:"var(--widget-font-size, 14px)",height:"45px",direction:c?"rtl":"ltr",overflowY:"auto"}})}),re("button",{type:"submit",disabled:t||!o.trim()||i,className:"\n p-2 max-sm:p-2 text-white rounded-lg\n disabled:bg-gray-300 disabled:cursor-not-allowed\n transition-colors flex-shrink-0 touch-manipulation select-none\n min-h-[44px] min-w-[44px]\n motion-reduce:transition-none focus:outline-none focus:ring-2 focus:ring-offset-2\n ",style:{backgroundColor:"var(--widget-button-primary, var(--widget-primary-color, #3C5BFF))","--tw-ring-color":"var(--widget-button-primary, var(--widget-primary-color, #3C5BFF))",WebkitTapHighlightColor:"transparent",touchAction:"manipulation"},onMouseEnter:e=>{e.currentTarget.disabled||(e.currentTarget.style.backgroundColor="var(--widget-button-primary-hover, var(--widget-primary-hover, #334BFA))")},onMouseLeave:e=>{e.currentTarget.disabled||(e.currentTarget.style.backgroundColor="var(--widget-button-primary, var(--widget-primary-color, #3C5BFF))")},"aria-label":l("chat.input.send","Send message"),children:re("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"max-sm:w-5 max-sm:h-5 "+(c?"rotate-180":""),"aria-hidden":"true",children:re("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z",fill:"currentColor"})})})]})})},Bn=()=>{const{handleSendMessage:e}=zn();return{handleButtonClick:Me((t,r)=>{e({type:"TEXT",body:r})},[e]),handleSelectOption:Me((t,r)=>{e({type:"TEXT",body:r})},[e]),handleDownload:Me((e,t)=>{const r=document.createElement("a");r.href=e,r.download=t,r.target="_blank",document.body.appendChild(r),r.click(),document.body.removeChild(r)},[])}},Hn=({content:e,className:t=""})=>{const{handleButtonClick:r}=Bn();return re("div",{className:`button-message ${t}`,children:[e.text&&re("p",{className:"leading-relaxed mb-3",style:{fontFamily:"var(--widget-font-family, Arial, sans-serif)",fontSize:"var(--widget-font-size, 14px)"},children:e.text}),re("div",{className:"space-y-2",children:e.buttons.map(e=>re("button",{type:"button",onClick:()=>{return t=e.id,n=e.payload,void r(t,n);var t,n},className:"\n\t\t\t\t\t\t\tw-full px-4 py-2 text-sm font-medium rounded-lg\n\t\t\t\t\t\t\ttransition-colors duration-150\n\t\t\t\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-offset-2\n\t\t\t\t\t\t",style:{color:"var(--widget-button-secondary-text, var(--widget-primary-color, #3C5BFF))",backgroundColor:"var(--widget-button-secondary, var(--widget-primary-light, #E8EAFD))",borderColor:"var(--widget-border-primary, var(--widget-primary-color, #3C5BFF))",borderWidth:"1px",borderStyle:"solid"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--widget-primary-light, #E8EAFD)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="var(--widget-button-secondary, var(--widget-primary-light, #E8EAFD))"},children:e.title},e.id))})]})},Pn=({content:e,className:t=""})=>{const{handleDownload:r}=Bn();return re("div",{className:`document-message ${t}`,children:re("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 max-w-sm",children:re("div",{className:"flex items-center space-x-3",children:[re("div",{className:"flex-shrink-0",children:re("div",{className:"w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center",children:re("svg",{className:"w-5 h-5 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})})}),re("div",{className:"flex-1 min-w-0",children:[re("p",{className:"font-medium text-gray-900 truncate",style:{fontFamily:"var(--widget-font-family, Arial, sans-serif)",fontSize:"var(--widget-font-size, 14px)"},children:e.filename}),re("div",{className:"flex items-center space-x-2 text-gray-500",style:{fontFamily:"var(--widget-font-family, Arial, sans-serif)",fontSize:"calc(var(--widget-font-size, 14px) * 0.8)"},children:[re("span",{children:(n=e.filename,(null==(i=n.split(".").pop())?void 0:i.toUpperCase())||"FILE")}),re("span",{children:"•"}),re("span",{children:(e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/b(1024,t)).toFixed(2))} ${["Bytes","KB","MB","GB"][t]}`})(e.size)})]})]}),re("button",{type:"button",onClick:()=>{r(e.url,e.filename)},className:"flex-shrink-0 p-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",title:"Download file",children:re("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})})]})})});var n,i},Un=({content:e,className:t=""})=>{const[r,n]=Re(!0),[i,o]=Re(!1);return re("div",i?{className:`image-message ${t}`,children:[re("div",{className:"bg-gray-100 border border-gray-200 rounded-lg p-4 text-center",children:re("div",{className:"text-gray-500 text-sm",children:[re("svg",{className:"w-8 h-8 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),re("p",{children:"Image could not be loaded"})]})}),e.caption&&re("p",{className:"text-sm text-gray-600 mt-2",children:e.caption})]}:{className:`image-message ${t}`,children:[re("div",{className:"relative max-w-sm",children:[r&&re("div",{className:"absolute inset-0 bg-gray-100 rounded-lg flex items-center justify-center",children:re("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}),re("button",{type:"button",onClick:()=>{window.open(e.url,"_blank")},className:"w-full h-auto rounded-lg cursor-pointer hover:opacity-90 transition-opacity border-none bg-transparent p-0","aria-label":`Open image in new tab: ${e.caption||"Shared image"}`,style:{display:r?"none":"block"},children:re("img",{src:e.url,alt:e.caption||"Shared image",className:"w-full h-auto rounded-lg",onLoad:()=>{n(!1)},onError:()=>{n(!1),o(!0)}})})]}),e.caption&&re("p",{className:"text-sm text-gray-600 mt-2",children:e.caption})]})},Wn=({content:e,className:t=""})=>{const{handleSelectOption:r}=Bn(),[n,i]=Re(null);return re("div",{className:`select-message ${t}`,children:[e.text&&re("p",{className:"leading-relaxed mb-3",style:{fontFamily:"var(--widget-font-family, Arial, sans-serif)",fontSize:"var(--widget-font-size, 14px)"},children:e.text}),re("div",{className:"space-y-2",children:e.options.map(e=>re("button",{type:"button",onClick:()=>{return t=e.id,n=e.title,i(t),void r(t,n);var t,n},disabled:null!==n,className:`\n\t\t\t\t\t\t\tw-full p-3 text-left rounded-lg border transition-colors duration-150\n\t\t\t\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2\n\t\t\t\t\t\t\t${n===e.id?"bg-blue-50 border-blue-500 text-blue-700":null!==n?"bg-gray-50 border-gray-200 text-gray-400 cursor-not-allowed":"bg-white border-gray-200 hover:bg-gray-50 hover:border-gray-300"}\n\t\t\t\t\t\t`,children:re("div",{className:"flex items-start justify-between",children:[re("div",{className:"flex-1",children:[re("p",{className:"text-sm font-medium",children:e.title}),e.description&&re("p",{className:"text-xs text-gray-500 mt-1",children:e.description})]}),n===e.id&&re("div",{className:"flex-shrink-0 ml-2",children:re("svg",{className:"w-4 h-4 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})})]})},e.id))}),n&&re("p",{className:"text-xs text-gray-500 mt-2",children:"Option selected. Your response has been sent."})]})},jn=e=>{let t=e.match(/^(.*?)\*\*(.*?)\*\*(.*)/);return t||(t=e.match(/^(.*?)__(.*?)__(.*)/)),{match:t,type:"bold"}},Vn=e=>{let t=e.match(/^(.*?)\*(.*?)\*(.*)/);return t||(t=e.match(/^(.*?)_(.*?)_(.*)/)),{match:t,type:"italic"}},qn=e=>({match:e.match(/^(.*?)`([^`]+)`(.*)/),type:"code"}),Gn=e=>({match:e.match(/^(.*?)\[([^\]]+)\]\(([^)]+)\)(.*)/),type:"link"}),Kn=(e,t,r,n)=>t?(e.push({type:"text",content:t,id:`${r}-${n}-text`}),n+1):n,Qn=(e,t,r,n,i,o)=>(e.push({type:t,content:r,href:n,id:`${i}-${o}-${t}`}),o+1),Jn=(e,t,r,n,i)=>{let o=i;return o=Kn(r,e[1],n,o),"link"===t?(o=Qn(r,t,e[2],e[3],n,o),{newElementIndex:o,remainingLine:e[4]}):(o=Qn(r,t,e[2],void 0,n,o),{newElementIndex:o,remainingLine:e[3]})},Xn=(e,t,r)=>{let n=0,i=e;for(;i.length>0;){const e=[jn,Vn,qn,Gn];let o=!1;for(const a of e){const{match:e,type:s}=a(i);if(e){const a=Jn(e,s,t,r,n);n=a.newElementIndex,i=a.remainingLine,o=!0;break}}if(!o){Kn(t,i,r,n);break}}},Yn=({content:e,className:t=""})=>re("div",{className:`text-message ${t}`,children:re("div",{className:"leading-relaxed break-words",style:{fontFamily:"var(--widget-font-family, Arial, sans-serif)",fontSize:"var(--widget-font-size, 14px)"},children:ze(()=>(e=>{const t=[],r=e.split("\n");for(let n=0;n<r.length;n++){n>0&&t.push({type:"br",content:"",id:`${n}-br`});const e=r[n];Xn(e,t,n)}return t})(e.body),[e.body]).map(e=>{switch(e.type){case"bold":return re("strong",{className:"font-semibold",style:{color:"inherit"},children:e.content},e.id);case"italic":return re("em",{className:"italic",style:{color:"inherit"},children:e.content},e.id);case"code":return re("code",{className:"bg-widget-gray-100 px-1 py-0.5 rounded text-xs",style:{color:"inherit"},children:e.content},e.id);case"link":return re("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"text-widget-primary no-underline hover:underline",children:e.content},e.id);case"br":return re("br",{},e.id);default:return re("span",{style:{color:"inherit"},children:e.content},e.id)}})})}),Zn=({status:e})=>re("div",{className:"flex items-center gap-1 text-xs opacity-70",children:[(()=>{switch(e){case"SENT":return re("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",className:"animate-spin","aria-hidden":"true",children:[re("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"31.416",strokeDashoffset:"31.416",className:"opacity-25"}),re("path",{d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",fill:"currentColor"})]});case"DELIVERED":return re("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:re("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",fill:"currentColor"})});case"READ":return re("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:re("path",{d:"M18 7l-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41L6 19l1.41-1.41L1.83 12 .41 13.41z",fill:"currentColor"})});default:return null}})(),re("span",{className:"sr-only",children:(()=>{switch(e){case"SENT":return"SENT...";case"DELIVERED":return"Delivered";case"READ":return"Read";default:return""}})()})]}),ei=({message:e,isRTL:t})=>{const r="INBOUND"===e.metadata.direction;return re("div",{className:"flex items-center gap-2 "+(r?t?"justify-start":"justify-end":t?"justify-end":"justify-start"),children:re("div",{className:"max-w-xs lg:max-w-sm px-4 py-2 rounded-lg "+(t?r?"rounded-bl-sm":"rounded-br-sm":r?"rounded-br-sm":"rounded-bl-sm"),style:{backgroundColor:r?"var(--widget-message-user-bg, var(--widget-primary-color, #3C5BFF))":"var(--widget-message-bot-bg, var(--widget-secondary-color, #6C757D))",color:"var(--widget-text-color, #FFFFFF)"},children:[(()=>{switch(e.content.type){case"TEXT":return re(Yn,{content:e.content});case"IMAGE":return re(Un,{content:e.content});case"DOCUMENT":return re(Pn,{content:e.content});case"BUTTON":return re(Hn,{content:e.content});case"SELECT":return re(Wn,{content:e.content});case"ARTICLE":case"CARDS":case"FORM":return re("p",{className:"text-sm leading-relaxed italic text-gray-500",children:[e.content.type," message (not yet implemented)"]});default:return re("p",{className:"text-sm leading-relaxed italic text-gray-500",children:"Unknown message type"})}})(),r&&re("div",{className:"flex items-center gap-1 mt-1 "+(t?"justify-start":"justify-end"),children:re(Zn,{status:e.metadata.status})})]})})},ti=({messages:e,className:t=""})=>{const{isRTL:r}=dn(),{state:n}=Ye(),i=De(null);return Fe(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e]),re("div",{ref:i,className:`\n flex-1 overflow-y-auto p-2 space-y-3\n ${t}\n `,style:{backgroundColor:(null==(a=null==(o=n.widgetConfig)?void 0:o.uiConfigs)?void 0:a.backgroundColor)||"#ffffff"},children:e.map(e=>re(ei,{message:e,isRTL:r},e.id))});var o,a},ri=()=>{const{t:e}=dn();return re("div",{className:"flex items-center gap-2 px-4 py-2 text-sm text-gray-500",children:[re("div",{className:"flex gap-1",children:[re("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),re("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),re("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),re("span",{children:e("chat.writing","Writing...")})]})},ni=({title:e,subtitle:t,onClose:r,className:n="",logoUrl:i})=>{const{isRTL:o,currentLanguage:a,changeLanguage:s}=dn(),{services:l}=Ye();return re("div",{className:`\n flex items-center justify-between p-4 max-sm:p-3\n text-white border-b\n ${n}\n `,style:{background:"linear-gradient(to right, var(--widget-primary-color, #3C5BFF), var(--widget-primary-color, #3C5BFF))",borderBottomColor:"rgba(0, 0, 0, 0.1)"},children:[re("div",{className:"flex items-center gap-3 max-sm:gap-2",children:[re("div",{className:"w-8 h-8 max-sm:w-7 max-sm:h-7 bg-white rounded-full flex items-center justify-center overflow-hidden",children:[i?re("img",{src:i,alt:"Company logo",className:"w-full h-full object-cover",onError:e=>{var t;e.currentTarget.style.display="none",null==(t=e.currentTarget.nextElementSibling)||t.classList.remove("hidden")}}):null,re("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",className:"text-blue-600 max-sm:w-3.5 max-sm:h-3.5 "+(i?"hidden":""),"aria-hidden":"true",children:re("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",fill:"currentColor"})})]}),re("div",{className:"flex flex-col",children:[e&&re("h2",{className:"text-lg max-sm:text-base font-semibold leading-tight",style:{color:"var(--widget-text-color, #FFFFFF)"},children:e}),t&&re("p",{className:"text-sm max-sm:text-xs opacity-80 leading-tight",style:{color:"var(--widget-text-color, #FFFFFF)"},children:t})]})]}),re("div",{className:`flex items-center ${o?"ml-2":"mr-2"} gap-2`,children:[re("button",{type:"button",onClick:()=>C(null,null,function*(){const e=(null==a?void 0:a.startsWith("ar"))?"en":"ar";yield s(e),null==l||l.themeService.applyRTLLayout(e.startsWith("ar"))}),className:"px-2 py-1 text-xs font-medium rounded-md bg-white/15 hover:bg-white/25 transition-colors\n\t\t\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-white/50 focus:ring-offset-2 focus:ring-offset-blue-600",style:{color:"var(--widget-text-color, #FFFFFF)"},"aria-label":"Toggle language",children:(null==a?void 0:a.startsWith("ar"))?"EN":"AR"}),r&&re("button",{type:"button",onClick:r,className:"\n\t\t\t\t\t\t\tp-2 max-sm:p-1.5 hover:bg-white/10 active:bg-white/20 rounded-full transition-colors\n\t\t\t\t\t\t\ttouch-manipulation select-none min-h-[44px] min-w-[44px] max-sm:min-h-[40px] max-sm:min-w-[40px]\n\t\t\t\t\t\t\tmotion-reduce:transition-none focus:outline-none focus:ring-2 focus:ring-white/50 focus:ring-offset-2 focus:ring-offset-blue-600\n\t\t\t\t\t\t",style:{WebkitTapHighlightColor:"transparent",touchAction:"manipulation"},"aria-label":"Close chat",children:re("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",className:"text-white max-sm:w-4 max-sm:h-4","aria-hidden":"true",children:re("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},ii=({className:e=""})=>{const{state:t,dispatch:r,config:n}=Ye(),{t:i,isRTL:o,currentLanguage:a}=dn(),{handleSendMessage:s}=zn(),l=[((e="Operator",t="Hi there 👋",r="What brings you to Intercom today?")=>({id:"operator-greeting-default",content:{type:"TEXT",body:`${t}\n\n${r}`},metadata:{senderId:"operator",receiverId:"user",status:"DELIVERED",channel:"WEBSITE",direction:"OUTBOUND",type:"TEXT"},timestamp:(new Date).toISOString()}))(i("chat.operator","Operator"),(()=>{var e,r;if(null==(r=null==(e=t.widgetConfig)?void 0:e.messageConfig)?void 0:r.welcomeMessage){const e=t.widgetConfig.messageConfig.welcomeMessage;return e[a]||e.en||"Hi there 👋\n\nWhat brings you to Intercom today?"}return"Hi there 👋\n\nWhat brings you to Intercom today?"})(),""),...t.messages];return re("div",{className:`\n flex flex-col h-full bg-white rounded-lg overflow-hidden\n ${o?"rtl":"ltr"}\n ${e}\n `,dir:o?"rtl":"ltr",children:[re(ni,{title:(()=>{var e,r;if(null==(r=null==(e=t.widgetConfig)?void 0:e.messageConfig)?void 0:r.headerText){const e=t.widgetConfig.messageConfig.headerText;return e[a]||e.en||i("chat.title","Messages")}return i("chat.title","Messages")})(),subtitle:"connected"===t.connectionState?i("chat.online","Online"):i("chat.offline","Offline"),onClose:()=>{r({type:"TOGGLE_WIDGET"})},logoUrl:(()=>{var e,r;if(null==(r=null==(e=t.widgetConfig)?void 0:e.uiConfigs)?void 0:r.logoId)return`${n.baseUrl}/api/v1/org/${n.orgId}/attachments/${t.widgetConfig.uiConfigs.logoId}`})()}),re("div",{className:"flex-1 flex flex-col pb-[81px] max-sm:pb-[72px]",children:[re("div",{className:"flex-1 overflow-hidden max-h-[475px] relative",children:[re(ti,{messages:l,className:"h-full"}),t.isWriting&&re("div",{className:"absolute bottom-0 left-0 right-0 bg-white",children:re(ri,{})})]}),re("div",{className:"absolute bottom-[69px] left-0 right-0 bg-white",children:re(Mn,{onSendMessage:e=>{s({type:"TEXT",body:e})},disabled:"connected"!==t.connectionState,placeholder:(()=>{var e,r;if(null==(r=null==(e=t.widgetConfig)?void 0:e.messageConfig)?void 0:r.buttonText){const e=t.widgetConfig.messageConfig.buttonText;return e[a]||e.en||i("chat.input.placeholder","Type a message...")}return i("chat.input.placeholder","Type a message...")})(),isWriting:t.isWriting})})]})]})},oi=({item:e,isExpanded:t=!1,onToggle:r})=>{const{i18n:n,isRTL:i}=dn(),[o,a]=Re(t),s="ar"===n.language,l=s&&e.questionInArabic||e.question,c=s&&e.answerInArabic||e.answer,d=r?t:o;return re("div",{className:"border-b border-gray-100 last:border-b-0",children:[re("button",{type:"button",onClick:r||(()=>a(!o)),className:"w-full p-4 text-left hover:bg-gray-50 transition-colors "+(i?"text-right":""),"aria-expanded":d,children:re("div",{className:"flex items-center justify-between gap-3",children:[re("h3",{className:"text-sm font-medium text-gray-900 flex-1",children:l}),re("div",{className:"flex-shrink-0 transition-transform duration-200 "+(d?"rotate-180":""),children:re("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-label":d?"Collapse":"Expand",children:[re("title",{children:d?"Collapse":"Expand"}),re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})]})})]})}),d&&re("div",{className:"px-4 pb-4 "+(i?"text-right":""),children:re("div",{className:"text-sm text-gray-600 leading-relaxed",children:c})})]})},ai=({items:e,title:t,showAll:r=!1,maxItems:n=5,enableScrolling:i=!0})=>{const{t:o,isRTL:a}=dn(),[s,l]=Re(new Set),[c,d]=Re(r),u=c?e:e.slice(0,n),h=e.length>n;return 0===e.length?re("div",{className:"text-center py-8 text-gray-500 "+(a?"text-right":""),children:re("p",{className:"text-sm",children:o("faq.noItems","No FAQ items available")})}):re("div",{className:"bg-white "+(i?"h-full overflow-y-auto":""),children:[t&&re("div",{className:"px-4 py-3 border-b border-gray-200 "+(a?"text-right":""),children:re("h2",{className:"text-lg font-semibold text-gray-900",children:t})}),re("div",{className:"divide-y divide-gray-100",children:u.map((e,t)=>re(oi,{item:e,isExpanded:s.has(t),onToggle:()=>(e=>{const t=new Set(s);t.has(e)?t.delete(e):t.add(e),l(t)})(t)},`${e.question}-${t}`))}),h&&!c&&re("div",{className:"p-4 border-t border-gray-100",children:re("button",{type:"button",onClick:()=>d(!0),className:"w-full py-2 px-4 text-sm font-medium text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:[o("faq.showMore","Show more FAQs")," (",e.length-n,")"]})})]})},si=({value:e,onChange:t,onSearch:r,isLoading:n=!1,placeholder:i})=>{const{t:o,isRTL:a}=dn(),s=Me(e=>{e.preventDefault()},[]),l=Me(e=>{const n=e.target.value;t(n),r(n)},[t,r]),c=Me(()=>{t(""),r("")},[t,r]);return re("div",{className:"p-4 border-b border-gray-200",children:re("form",{onSubmit:s,className:"relative",children:re("div",{className:"relative",children:[re("input",{type:"text",value:e,onChange:l,placeholder:i||o("faq.search.placeholder","Search FAQs..."),className:`w-full py-3 ${a?"pl-12 pr-4":"pr-12 pl-4"} border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-colors ${a?"text-right":"text-left"}`,disabled:n}),e&&!n&&re("button",{type:"button",onClick:c,className:`absolute ${a?"left-8":"right-8"} top-1/2 transform -translate-y-1/2 p-1 text-gray-400 hover:text-gray-600 transition-colors`,"aria-label":o("faq.search.clear","Clear"),children:re("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),re("div",{className:`absolute ${a?"left-3":"right-3"} top-1/2 transform -translate-y-1/2 pointer-events-none`,children:n?re("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500"}):re("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})})})},li=({results:e,isLoading:t,hasSearched:r})=>{const{t:n,isRTL:i}=dn();return t?re("div",{className:"flex-1 flex items-center justify-center p-8",children:re("div",{className:"text-center",children:[re("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-4"}),re("p",{className:"text-sm text-gray-500",children:n("faq.search.searching","Searching...")})]})}):r?0===e.length?re("div",{className:"flex-1 flex items-center justify-center p-8 "+(i?"text-right":""),children:re("div",{className:"text-center text-gray-500",children:[re("svg",{className:"w-16 h-16 mx-auto mb-4 text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-label":n("faq.search.noResults.icon","No results icon"),children:[re("title",{children:n("faq.search.noResults.icon","No results icon")}),re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0112 15c-2.34 0-4.291-1.007-5.691-2.566M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),re("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:n("faq.search.noResults.title","No results found")}),re("p",{className:"text-sm",children:n("faq.search.noResults.description","No FAQs found. Try different keywords.")})]})}):re("div",{className:"flex-1 max-h-[475px] flex flex-col",children:[re("div",{className:"p-4 border-b border-gray-100 flex-shrink-0 "+(i?"text-right":""),children:re("p",{className:"text-sm text-gray-600",children:1===e.length?n("faq.search.results.single","1 result found"):n("faq.search.results.multiple","{count} results found").replace("{count}",e.length.toString())})}),re("div",{className:"flex-1 min-h-0",children:re(ai,{items:e,showAll:!0})})]}):re("div",{className:"flex-1 flex items-center justify-center p-8 "+(i?"text-right":""),children:re("div",{className:"text-center text-gray-500",children:[re("svg",{className:"w-16 h-16 mx-auto mb-4 text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-label":n("faq.search.icon","Search icon"),children:[re("title",{children:n("faq.search.icon","Search icon")}),re("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})]}),re("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:n("faq.search.prompt.title","Search FAQs")}),re("p",{className:"text-sm",children:n("faq.search.prompt.description","Enter a question or keyword to find relevant FAQs")})]})})},ci=()=>{const{config:e}=Ye(),t=Nn(e),[r,n]=Re([]),[i,o]=Re(!1),[a,s]=Re(null),l=Me(()=>C(null,null,function*(){o(!0),s(null);try{const r=yield t.getUngroupedFAQs(e.orgId);n(r)}catch(r){s(r instanceof Error?r.message:"Failed to fetch FAQs")}finally{o(!1)}}),[t,e.orgId]),c=Me((e=5)=>{if(!r.length)return[];return r.flatMap(e=>e.data).filter(e=>e.isPopular).sort((e,t)=>e.order-t.order).slice(0,e)},[r]),d=Me(()=>{if(!r.length)return[];return r.flatMap(e=>e.data).sort((e,t)=>e.order-t.order)},[r]),u=Me(e=>{if(!e.trim()||!r.length)return[];const t=e.toLowerCase().trim();return r.flatMap(e=>e.data).filter(e=>{const r=e.question.toLowerCase(),n=e.questionInArabic.toLowerCase(),i=e.answer.toLowerCase(),o=e.answerInArabic.toLowerCase();return r.includes(t)||n.includes(t)||i.includes(t)||o.includes(t)})},[r]),h=Me(()=>r,[r]);return Fe(()=>{l()},[l]),{faqCategories:r,isLoading:i,error:a,refetch:l,getPopularFAQs:c,getAllFAQs:d,searchFAQs:u,getFAQsByCategory:h}},di=()=>{const{t:e,isRTL:t}=dn(),{getAllFAQs:r,searchFAQs:n,isLoading:i,error:o}=ci(),[a,s]=Re(""),[l,c]=Re([]),[d,u]=Re(!1),[h,g]=Re(!1),p=De(),m=r(),f=Me(e=>{if(!e.trim())return c([]),u(!1),void g(!1);g(!0),u(!0);const t=n(e.trim());c(t),g(!1)},[n]),v=Me(e=>{p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{f(e)},300)},[f]),y=Me(e=>{s(e)},[]);return Fe(()=>()=>{p.current&&clearTimeout(p.current)},[]),re("div",i?{className:"flex flex-col h-full bg-white "+(t?"rtl":""),children:[re("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:re("h2",{className:"text-lg font-semibold text-gray-900",children:e("faq.title","Frequently Asked Questions")})}),re("div",{className:"flex-1 flex items-center justify-center",children:re("div",{className:"text-center",children:[re("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-4"}),re("p",{className:"text-sm text-gray-500",children:e("faq.loading","Loading FAQs...")})]})})]}:o?{className:"flex flex-col h-full bg-white "+(t?"rtl":""),children:[re("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:re("h2",{className:"text-lg font-semibold text-gray-900",children:e("faq.title","Frequently Asked Questions")})}),re("div",{className:"flex-1 flex items-center justify-center",children:re("div",{className:"text-center p-4 "+(t?"text-right":""),children:[re("p",{className:"text-sm text-red-600 mb-2",children:e("faq.error","Failed to load FAQs")}),re("p",{className:"text-xs text-gray-500",children:o})]})})]}:{className:"flex flex-col h-full bg-white "+(t?"rtl":""),children:[re("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[re("h2",{className:"text-lg font-semibold text-gray-900",children:e("faq.title","Frequently Asked Questions")}),re("div",{className:"w-6 h-6 text-gray-400",children:re("svg",{fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:re("path",{d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zM12 17.25h.007v.008H12v-.008z"})})})]}),re(si,{value:a,onChange:y,onSearch:v,isLoading:h,placeholder:e("faq.search.placeholder","Search FAQs...")}),d?re(li,{results:l,isLoading:h,hasSearched:d,query:a}):re("div",{className:"flex-1 max-h-[475px]",children:re(ai,{items:m,showAll:!0})})]})},ui=()=>{var e,t;const{config:r,state:n,services:i}=Ye(),[o,a]=Re(!1),s=null==(t=null==(e=n.widgetConfig)?void 0:e.uiConfigs)?void 0:t.logoId,l=null==i?void 0:i.apiService.getLogoUrl(r.orgId,s);return o?re("div",{className:"w-8 h-8 max-sm:w-6 max-sm:h-6 bg-white rounded"}):re("img",{src:l,alt:"Organization logo",className:"w-8 h-8 max-sm:w-6 max-sm:h-6 rounded object-contain",onError:()=>{a(!0)}})},hi=({maxItems:e=3,onClick:t})=>{const{t:r,isRTL:n}=dn(),{getPopularFAQs:i,isLoading:o,error:a}=ci(),s=i(e);return o?re("div",{className:"bg-white/10 bg-gray-100 rounded-lg p-4 "+(n?"text-right":""),children:re("div",{className:"animate-pulse",children:[re("div",{className:"h-4 bg-white/20 rounded mb-3"}),re("div",{className:"space-y-2",children:[re("div",{className:"h-3 bg-white/20 rounded"}),re("div",{className:"h-3 bg-white/20 rounded w-3/4"})]})]})}):a||0===s.length?null:re("div",{className:"bg-white/10 bg-gray-100 rounded-lg",children:[re("button",{type:"button",onClick:t,className:"flex items-center justify-between w-full bg-gray-100 rounded-t-lg p-3 max-sm:p-2.5 hover:bg-gray-200 active:bg-gray-300 transition-colors touch-manipulation select-none min-h-[44px] motion-reduce:transition-none focus:outline-none focus:ring-2 focus:ring-offset-2",style:{WebkitTapHighlightColor:"transparent",touchAction:"manipulation","--tw-ring-color":"var(--widget-primary-color, #3C5BFF)"},children:[re("h4",{className:"text-sm max-sm:text-sm font-semibold text-gray-900",children:r("home.searchHelp","Search for help")}),re("div",{className:"w-4 h-4 max-sm:w-5 max-sm:h-5 flex-shrink-0",style:{color:"var(--widget-primary-color, #3C5BFF)"},children:re("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",children:[re("circle",{cx:"7",cy:"7",r:"5"}),re("path",{d:"M13 13l-3-3"})]})})]}),re("div",{className:"bg-white/5",children:re(ai,{items:s,maxItems:e,showAll:!1,enableScrolling:!1})})]})},gi=({onClick:e})=>{const{t:t}=dn();return re("button",{type:"button",onClick:e,className:"flex items-center justify-between bg-white rounded-lg p-4 max-sm:p-3 shadow-sm border border-gray-200 hover:shadow-md active:bg-gray-50 transition-all touch-manipulation select-none min-h-[44px] motion-reduce:transition-none focus:outline-none focus:ring-2 focus:ring-offset-2",style:{WebkitTapHighlightColor:"transparent",touchAction:"manipulation","--tw-ring-color":"var(--widget-primary-color, #3C5BFF)"},children:[re("div",{className:"flex flex-col items-start",children:[re("h4",{className:"text-sm max-sm:text-sm font-semibold text-gray-900",children:t("home.sendMessage","Send us a message")}),re("p",{className:"text-sm max-sm:text-xs text-gray-600 mt-1",children:t("home.replyTime","We typically reply within a day")})]}),re("div",{className:"w-4 h-4 max-sm:w-5 max-sm:h-5 flex-shrink-0",style:{color:"var(--widget-primary-color, #3C5BFF)"},children:re("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:re("path",{d:"M6 3l6 5-6 5V3z"})})})]})},pi=({onSendMessage:e,onSearchHelp:t})=>re("div",{className:"flex flex-col gap-3 p-4 max-sm:p-3 max-sm:gap-2",children:[re(gi,{onClick:e}),re(hi,{maxItems:3,onClick:t})]}),mi=()=>{const{t:e}=dn();return re("div",{className:"text-white",children:[re("h2",{className:"text-2xl max-sm:text-xl font-bold opacity-70 mb-1",children:e("home.greeting","Hello there")}),re("h3",{className:"text-2xl max-sm:text-xl font-bold",children:e("home.question","How can we help?")})]})},fi=()=>{const{dispatch:e}=Ye(),{isRTL:t}=dn();return re("div",{className:"flex flex-col h-full "+(t?"rtl":""),children:[re("div",{className:"absolute inset-0",style:{background:"var(--widget-bg-gradient, linear-gradient(135deg, #3C5BFF 0%, rgba(29, 49, 185, 1) 100%))"}}),re("div",{className:"relative flex flex-col h-full overflow-y-auto overflow-x-hidden",children:[re("div",{className:"flex flex-col gap-6 p-5 max-sm:p-4 pt-5 max-sm:pt-4 flex-shrink-0",children:[re("div",{className:"flex justify-between items-end",children:re(ui,{})}),re(mi,{})]}),re("div",{className:"flex-1 min-h-0 bg-white",children:re(pi,{onSendMessage:()=>{e({type:"SET_CURRENT_WINDOW",payload:"chat"})},onSearchHelp:()=>{e({type:"SET_CURRENT_WINDOW",payload:"faq"})}})})]})]})},vi=({isActive:e=!1,className:t=""})=>{const r=e?"var(--widget-secondary-color, #6B7280)":"var(--widget-text-primary, #1A1A1A)";return re("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:t,role:"img","aria-label":"Help",children:[re("title",{children:"Help"}),re("circle",{cx:"12",cy:"12",r:"9.25",stroke:r,strokeWidth:"1.7"}),re("path",{d:"M9.66 9C9.66 7.34315 10.9932 6 12.66 6C14.3268 6 15.66 7.34315 15.66 9C15.66 10.6569 14.3268 12 12.66 12",stroke:r,strokeWidth:"1.7",strokeLinecap:"round"}),re("circle",{cx:"12.66",cy:"16",r:"1.77",fill:r})]})},yi=({isActive:e=!1,className:t=""})=>{const r=e?"var(--widget-secondary-color, #6B7280)":"var(--widget-text-primary, #1A1A1A)";return re("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:t,role:"img","aria-label":"Home",children:[re("title",{children:"Home"}),re("path",{d:"M2 12L12 2L22 12",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),re("path",{d:"M3 21V9L12 2L21 9V21H15V16C15 15.4477 14.5523 15 14 15H10C9.44772 15 9 15.4477 9 16V21H3Z",fill:e?r:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})},bi=({isActive:e=!1,className:t=""})=>{const r=e?"var(--widget-secondary-color, #6B7280)":"var(--widget-text-primary, #1A1A1A)";return re("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:t,role:"img","aria-label":"Messages",children:[re("title",{children:"Messages"}),re("path",{d:"M21 15C21 15.5304 20.7893 16.0391 20.4142 16.4142C20.0391 16.7893 19.5304 17 19 17H7L3 21V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V15Z",fill:e?r:"none",stroke:r,strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),e&&re("circle",{cx:"11.04",cy:"16",r:"1.77",fill:r})]})},wi=({count:e,className:t=""})=>{if(e<=0)return null;return re("div",{className:`absolute -top-1 -right-1 bg-red-500 text-white text-xs font-medium rounded-full min-w-[18px] h-[18px] flex items-center justify-center px-1 ${t}`,style:{fontSize:"10px",lineHeight:"1"},children:e>99?"99+":e.toString()})},xi=({className:e=""})=>{const{state:t,dispatch:r}=Ye(),{t:n,isRTL:i}=dn(),o=Me(e=>{r({type:"SET_CURRENT_WINDOW",payload:e})},[r]);return re("nav",{className:`\n absolute bottom-0 left-0 right-0 \n bg-white border-t border-gray-100 \n flex items-stretch justify-stretch\n h-[81px] max-sm:h-[72px] z-10\n ${i?"rtl":"ltr"}\n ${e}\n `,style:{boxShadow:"0px 0px 25px 0px rgba(0, 0, 0, 0.05)"},children:[{id:"home",label:n("navigation.home","Home"),icon:yi,showBadge:!1},{id:"chat",label:n("navigation.messages","Messages"),icon:bi,showBadge:!0},{id:"faq",label:n("navigation.help","Help"),icon:vi,showBadge:!1}].map(e=>{const r=t.currentWindow===e.id,n=e.icon;return re("button",{type:"button",onClick:()=>o(e.id),className:"\n flex-1 flex flex-col items-center justify-center gap-2\n py-[18px] px-[2px] max-sm:py-[14px] max-sm:px-[1px] relative\n transition-colors duration-200\n hover:bg-gray-50 active:bg-gray-100\n focus:outline-none\n touch-manipulation select-none\n min-h-[44px]\n motion-reduce:transition-none\n ",style:{WebkitTapHighlightColor:"transparent",touchAction:"manipulation",color:r?"var(--widget-secondary-color)":"var(--widget-text-primary)"},"aria-label":e.label,"aria-current":r?"page":void 0,children:[re("div",{className:"relative",children:[re(n,{isActive:r,className:"w-6 h-6"}),e.showBadge&&t.unreadCount>0&&re(wi,{count:t.unreadCount})]}),re("span",{className:"text-sm max-sm:text-xs font-medium leading-none",style:{fontSize:"14px",lineHeight:"1.5",color:r?"var(--widget-secondary-color)":"var(--widget-text-primary)"},children:e.label})]},e.id)})})},_i=()=>{const{state:e}=Ye();return re("div",{className:"flex-1 overflow-hidden relative flex flex-col",children:[re("div",{className:"flex-1 overflow-hidden",children:(()=>{switch(e.currentWindow){case"home":default:return re(fi,{});case"chat":return re(ii,{});case"faq":return re(di,{});case"news":return re("div",{className:"flex-1 p-4",children:"News Window - Coming Soon"})}})()}),re(xi,{})]})},ki={isOpen:!1,currentWindow:"home",connectionState:"disconnected",user:null,messages:[],unreadCount:0,widgetConfig:null,channelId:null,isWriting:!1},Ci=(e,t)=>{switch(t.type){case"TOGGLE_WIDGET":return _(x({},e),{isOpen:!e.isOpen});case"SET_CURRENT_WINDOW":return _(x({},e),{currentWindow:t.payload});case"SET_USER":return _(x({},e),{user:t.payload});case"REFRESH_TOKEN":return _(x({},e),{user:e.user?_(x({},e.user),{token:t.payload}):null});case"ADD_MESSAGE":return _(x({},e),{messages:[...e.messages,t.payload],unreadCount:e.isOpen?e.unreadCount:e.unreadCount+1});case"UPDATE_MESSAGE":{const r=t.payload,n=e.messages.findIndex(e=>e.id===r.id);if(-1!==n){const t=[...e.messages];return t[n]=r,_(x({},e),{messages:t})}return _(x({},e),{messages:[...e.messages,r],unreadCount:e.isOpen?e.unreadCount:e.unreadCount+1})}case"REPLACE_MESSAGE":{const{oldMessageId:r,newMessage:n}=t.payload,i=e.messages.findIndex(e=>e.id===r);if(-1!==i){const t=[...e.messages];return t[i]=n,_(x({},e),{messages:t})}return _(x({},e),{messages:[...e.messages,n],unreadCount:e.isOpen?e.unreadCount:e.unreadCount+1})}case"UPDATE_MESSAGE_STATUS":return _(x({},e),{messages:e.messages.map(e=>"TEXT"===e.content.type&&e.content.body===t.payload.messageContent?_(x({},e),{metadata:_(x({},e.metadata),{status:t.payload.status})}):e)});case"SET_CONNECTION_STATE":return _(x({},e),{connectionState:t.payload});case"SET_WIDGET_CONFIG":return _(x({},e),{widgetConfig:t.payload,channelId:t.payload.channelId});case"SET_CHANNEL_ID":return _(x({},e),{channelId:t.payload});case"SET_UNREAD_COUNT":return _(x({},e),{unreadCount:t.payload});case"RESTORE_MESSAGES":return _(x({},e),{messages:t.payload});case"CLEAR_CONVERSATION":return _(x({},e),{messages:[],unreadCount:0,user:null,currentWindow:"home"});case"SET_WRITING_STATE":return _(x({},e),{isWriting:t.payload});default:return e}},Si=({config:e})=>{const[t,r]=Ae(Ci,ki),[n,i]=Re(!1),[o,a]=Re(null),s=Nn(e),l=(()=>{const e=e=>{Object.entries(e).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)})};return{applyTheme:t=>{document.querySelectorAll("analytick-widget").forEach(e=>{const r=e;"function"==typeof r.updateThemeFromBackend&&r.updateThemeFromBackend({primaryColor:t.uiConfigs.primaryColor,secondaryColor:t.uiConfigs.secondaryColor,backgroundColor:t.uiConfigs.backgroundColor,textColor:t.uiConfigs.textColor,fontFamily:t.uiConfigs.fontFamily,fontSize:t.uiConfigs.fontSize,position:t.uiConfigs.position,size:t.uiConfigs.size,visibility:t.uiConfigs.visibility,animation:t.uiConfigs.animation,cssStyles:t.uiConfigs.cssStyles,logoId:t.uiConfigs.logoId,headerText:t.messageConfig.headerText,welcomeMessage:t.messageConfig.welcomeMessage,buttonText:t.messageConfig.buttonText})});const r={"--widget-position":t.uiConfigs.position||"bottom-right","--widget-size":t.uiConfigs.size||"medium","--widget-secondary-color":t.uiConfigs.secondaryColor||"#6C757D","--widget-text-color":t.uiConfigs.textColor||"#FFFFFF","--widget-font-family":t.uiConfigs.fontFamily||"Arial, sans-serif","--widget-font-size":t.uiConfigs.fontSize||"14px"};e(r)},detectRTL:e=>{const t=e.toLowerCase().split("-")[0];return Xr(t)},updateCSSProperties:e,getThemeFromConfig:e=>({primaryColor:e.uiConfigs.primaryColor||yn.primaryColor,secondaryColor:e.uiConfigs.secondaryColor||yn.secondaryColor,textColor:yn.textColor,backgroundColor:yn.backgroundColor,borderRadius:yn.borderRadius,grayTextColor:yn.grayTextColor,lightGrayColor:yn.lightGrayColor,buttonColor:e.uiConfigs.primaryColor||yn.buttonColor,gradientStart:e.uiConfigs.primaryColor||yn.gradientStart,gradientEnd:yn.gradientEnd}),applyRTLLayout:t=>{e({"--widget-text-direction":t?"rtl":"ltr","--widget-trigger-position":t?"bottom-left":"bottom-right","--widget-align-items":t?"flex-start":"flex-end"}),t?document.documentElement.classList.add("widget-rtl"):document.documentElement.classList.remove("widget-rtl")},getFallbackTheme:()=>x({},yn)}})(),c=cn(),d=$n(e.orgId,e.widgetId),{withErrorHandling:u,clearError:h}=((e={})=>{const t=x(x({},Ln),e),[r,n]=Re(null),i=Me(e=>{const r=t.baseDelay*b(2,e)*(.5+.5*Math.random());return Math.min(r,t.maxDelay)},[t.baseDelay,t.maxDelay]),o=Me((e,r=0)=>{const n=In(e)&&r<t.maxRetries,o=n?i(r):null;return _(x({},e),{retryCount:r,maxRetries:t.maxRetries,nextRetryTime:o?Date.now()+o:null,isRetrying:!1,canRetry:n})},[t.maxRetries,i]),a=Me((e,t=0)=>{const r=o(e,t);return n(r),r},[o]),s=Me(e=>C(null,null,function*(){if(!r||!r.canRetry)throw new Error("Cannot retry: no retryable error");n(e=>e?_(x({},e),{isRetrying:!0}):null);try{const t=yield e();return n(null),t}catch(t){const e=t,i=r.retryCount+1,a=o(e,i);throw n(a),a}}),[r,o]),l=Me(()=>{n(null)},[]),c=Me(e=>C(null,null,function*(){try{const t=yield e();return r&&n(null),t}catch(t){throw a(t)}}),[r,a]);return{currentError:r,handleError:a,retryOperation:s,clearError:l,withErrorHandling:c,config:t}})({maxRetries:3,enableUserFeedback:!0,enableAutoRetry:!0}),{loadPersistedState:g}=(({state:e,dispatch:t,storageService:r,orgId:n,widgetId:i})=>{const o=`analytick-widget-${n}-${i}`,a=De(e),s=De(t);a.current=e,s.current=t;const l=Me(()=>C(null,null,function*(){const e=r.loadState();if(null==e?void 0:e.user)try{e.user?((e,t)=>{e.user&&t({type:"SET_USER",payload:e.user}),e.messages.length>0&&t({type:"RESTORE_MESSAGES",payload:e.messages}),e.unreadCount>0&&t({type:"SET_UNREAD_COUNT",payload:e.unreadCount}),"home"!==e.currentWindow&&t({type:"SET_CURRENT_WINDOW",payload:e.currentWindow})})(e,s.current):r.clearState()}catch(t){((e,t)=>{t.clearState()})(0,r)}}),[r]),c=Me(()=>{if(!a.current.user)return;const e=On(a.current);r.saveState(e)},[r]),d=Me(()=>{r.clearState()},[r]);return Fe(()=>{if(!e.user)return;const t=On(e);r.saveState(t)},[e.user,e.messages,e.unreadCount,e.currentWindow,r,e]),Fe(()=>{const e=()=>{if("hidden"===document.visibilityState&&a.current.user){const e=On(a.current);r.saveState(e)}},t=()=>{if(a.current.user){const e=On(a.current);r.saveState(e)}};return document.addEventListener("visibilitychange",e),window.addEventListener("beforeunload",t),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("beforeunload",t)}},[r]),{loadPersistedState:l,saveState:c,clearPersistedState:d,storageKey:o}})({state:t,dispatch:r,storageService:d,orgId:e.orgId,widgetId:e.widgetId,baseUrl:e.baseUrl}),p=Me(()=>C(null,null,function*(){try{yield u(()=>C(null,null,function*(){yield g()}));const t=yield u(()=>C(null,null,function*(){return yield s.getPublicWidgetConfig(e.orgId,e.widgetId)}));r({type:"SET_WIDGET_CONFIG",payload:t}),l.applyTheme(t);const n=e.language||Jr(),o=l.detectRTL(n);l.applyRTLLayout(o);const a=(e=>{const t={};if(!e||!e.messageConfig||!e.messageConfig.headerText)return{en:{translation:ln("en")},ar:{translation:ln("ar")}};const r=Object.keys(e.messageConfig.headerText);return 0===r.length?{en:{translation:ln("en")},ar:{translation:ln("ar")}}:(r.forEach(r=>{var n,i,o;t[r]={translation:{"header.text":(null==(n=e.messageConfig.headerText)?void 0:n[r])||"","welcome.message":(null==(i=e.messageConfig.welcomeMessage)?void 0:i[r])||"","button.text":(null==(o=e.messageConfig.buttonText)?void 0:o[r])||"","navigation.home":Yr(r,"home"),"navigation.messages":Yr(r,"messages"),"navigation.help":Yr(r,"help"),"navigation.news":Yr(r,"news"),"common.loading":Zr(r,"loading"),"common.error":Zr(r,"error"),"common.retry":Zr(r,"retry"),"common.close":Zr(r,"close"),"common.send":Zr(r,"send"),"common.search":Zr(r,"search"),"chat.placeholder":en(r,"placeholder"),"chat.typing":en(r,"typing"),"chat.offline":en(r,"offline"),"chat.online":en(r,"online"),"faq.search.placeholder":tn(r,"search.placeholder"),"faq.no.results":tn(r,"no.results"),"faq.search.results":tn(r,"search.results"),"home.greeting":rn(r,"greeting"),"home.question":rn(r,"question"),"home.sendMessage":rn(r,"sendMessage"),"home.replyTime":rn(r,"replyTime"),"home.searchHelp":rn(r,"searchHelp"),"home.helpArticle1":rn(r,"helpArticle1"),"home.helpArticle2":rn(r,"helpArticle2"),"home.helpArticle3":rn(r,"helpArticle3"),"home.helpArticle4":rn(r,"helpArticle4"),"error.boundary.title":nn(r,"boundary.title"),"error.boundary.message":nn(r,"boundary.message"),"error.boundary.retry":nn(r,"boundary.retry"),"error.boundary.reset":nn(r,"boundary.reset"),"connection.connecting":on(r,"connecting"),"connection.connecting_message":on(r,"connecting_message"),"connection.error":on(r,"error"),"connection.failed":on(r,"failed"),"connection.max_retries_message":on(r,"max_retries_message"),"connection.retry":on(r,"retry"),"connection.retry_in":on(r,"retry_in"),"api.error.temporary":an(r,"temporary"),"api.error.failed":an(r,"failed"),"api.error.retry_attempt":an(r,"retry_attempt"),"api.error.retry_in":an(r,"retry_in"),"api.error.retrying":an(r,"retrying"),"api.error.retry_now":an(r,"retry_now"),"api.error.dismiss":an(r,"dismiss"),"api.error.bad_request":an(r,"bad_request"),"api.error.unauthorized":an(r,"unauthorized"),"api.error.forbidden":an(r,"forbidden"),"api.error.not_found":an(r,"not_found"),"api.error.rate_limited":an(r,"rate_limited"),"api.error.server_error":an(r,"server_error"),"api.error.service_unavailable":an(r,"service_unavailable"),"api.error.generic":an(r,"generic"),"service.unavailable":sn(r,"unavailable"),"service.failure_message":sn(r,"failure_message")}}}),t)})(t);yield u(()=>C(null,null,function*(){yield c.initializeI18n(a,{language:n,fallbackLanguage:"en"})})),h(),i(!0)}catch(t){a(t instanceof Error?t.message:"Failed to initialize widget");const e=l.getFallbackTheme();l.updateCSSProperties({"--widget-primary-color":e.primaryColor,"--widget-secondary-color":e.secondaryColor})}}),[e,s,l,c,g,u,h]);return Fe(()=>{if(n&&!t.user){(()=>C(null,null,function*(){try{const e=yield u(()=>C(null,null,function*(){return yield s.registerGuest(`guest_${Date.now()}`)}));r({type:"SET_USER",payload:e})}catch(e){}}))()}else n&&t.user},[n,t.user,s,u]),Fe(()=>{p()},[]),o?re("div",{className:"fixed bottom-5 right-5 bg-red-50 border border-red-200 rounded-lg p-4 max-w-sm z-[1000]",children:re("div",{className:"flex items-center",children:[re("div",{className:"flex-shrink-0",children:re("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor","aria-label":"Error icon",children:[re("title",{children:"Error"}),re("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})]})}),re("div",{className:"ml-3",children:[re("h3",{className:"text-sm font-medium text-red-800",children:"Widget Error"}),re("p",{className:"text-sm text-red-700 mt-1",children:o})]})]})}):n?re(Tn,{maxRetries:3,resetTimeoutMs:5e3,onError:(e,t)=>{},children:re("div",{className:"font-widget text-widget-base leading-relaxed text-widget-text-primary",children:re(Xe,{value:{state:t,dispatch:r,config:e,services:{apiService:s,themeService:l,i18nService:c,persistenceService:d}},children:re(Ni,{})})})}):re("div",{className:"fixed bottom-5 right-5 w-14 h-14 rounded-full bg-gray-200 animate-pulse z-[1000]"})},Ni=()=>{const{state:e,dispatch:t,config:r}=Ye(),{initializeConnection:n,connectionState:i,onMessage:o,onTokenRefresh:a,refreshConnection:s}=Ke(),l=De(!1);Fe(()=>{e.user&&e.widgetConfig&&r&&!l.current&&(l.current=!0,n(r,e.user).catch(e=>{l.current=!1}))},[e.user,e.widgetConfig,r,n]),Fe(()=>{t({type:"SET_CONNECTION_STATE",payload:i})},[i,t]),Fe(()=>a(e=>C(null,null,function*(){t({type:"REFRESH_TOKEN",payload:e});try{yield s(e)}catch(r){}})),[a,s,t]),Fe(()=>o(r=>{const n=e.messages.slice().reverse().find(e=>!(!e.id||!r.id||e.id!==r.id)||"INBOUND"===e.metadata.direction&&"TEXT"===e.content.type&&"TEXT"===r.content.type&&e.content.body===r.content.body);if(n){const e=_(x({},r),{metadata:x({},r.metadata)});t({type:"REPLACE_MESSAGE",payload:{oldMessageId:n.id,newMessage:e}})}else{const e=_(x({},r),{metadata:x({},r.metadata)});t({type:"ADD_MESSAGE",payload:e})}}),[o,t,e.messages,e.user]);const c=()=>{var t,r;switch((null==(r=null==(t=e.widgetConfig)?void 0:t.uiConfigs)?void 0:r.size)||"medium"){case"small":return{width:"w-[320px]",height:"h-[500px]"};case"large":return{width:"w-[480px]",height:"h-[800px]"};default:return{width:"w-[400px]",height:"h-[704px]"}}};return re(R,{children:[re(Dn,{}),e.isOpen&&re("div",{className:`${(()=>{const t=(null==(n=null==(r=e.widgetConfig)?void 0:r.uiConfigs)?void 0:n.position)||"bottom-right";var r,n;const{width:i,height:o}=c();switch(t){case"bottom-left":return`fixed bottom-20 left-5 ${i} ${o}`;case"top-right":return`fixed top-20 right-5 ${i} ${o}`;case"top-left":return`fixed top-20 left-5 ${i} ${o}`;default:return`fixed bottom-20 right-5 ${i} ${o}`}})()} bg-white rounded-2xl shadow-xl border border-gray-200 z-[999] flex flex-col overflow-hidden\n\t\t\t\t\tsm:${c().width} sm:${c().height}\n\t\t\t\t\tmd:${c().width} md:${c().height}\n\t\t\t\t\tmax-sm:fixed max-sm:inset-4 max-sm:bottom-20 max-sm:w-auto max-sm:h-auto max-sm:max-h-[calc(100vh-8rem)] max-sm:rounded-xl\n\t\t\t\t\tmax-sm:landscape:inset-2 max-sm:landscape:bottom-16 max-sm:landscape:max-h-[calc(100vh-4rem)]\n\t\t\t\t\tscrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100`,children:re(_i,{})})]})};class Ei extends HTMLElement{constructor(){super(),k(this,"shadowRoot"),k(this,"config",null),k(this,"isInitialized",!1),this.shadowRoot=this.attachShadow({mode:"closed"})}get orgId(){return this.getAttribute("org-id")}set orgId(e){e?this.setAttribute("org-id",e):this.removeAttribute("org-id")}get widgetId(){return this.getAttribute("widget-id")}set widgetId(e){e?this.setAttribute("widget-id",e):this.removeAttribute("widget-id")}get baseUrl(){return this.getAttribute("base-url")}set baseUrl(e){e?this.setAttribute("base-url",e):this.removeAttribute("base-url")}get primaryColor(){return this.getAttribute("primary-color")}set primaryColor(e){e?this.setAttribute("primary-color",e):this.removeAttribute("primary-color")}get secondaryColor(){return this.getAttribute("secondary-color")}set secondaryColor(e){e?this.setAttribute("secondary-color",e):this.removeAttribute("secondary-color")}static get observedAttributes(){return["org-id","widget-id","base-url","primary-color","secondary-color"]}connectedCallback(){this.isInitialized||this.initializeWidget()}disconnectedCallback(){setTimeout(()=>{!this.isConnected&&this.shadowRoot&&(Z(null,this.shadowRoot),this.isInitialized=!1,this.config=null)},100)}attributeChangedCallback(e,t,r){t!==r&&this.isConnected&&("primary-color"!==e&&"secondary-color"!==e?"org-id"!==e&&"widget-id"!==e&&"base-url"!==e||(this.isInitialized=!1,this.initializeWidget()):this.updateTheme())}initializeWidget(){if(this.isInitialized)return;const e=this.getAttribute("org-id"),t=this.getAttribute("widget-id"),r=this.getAttribute("base-url");if(!e||!t||!r)return void this.renderError("Missing required configuration attributes");try{new URL(r)}catch(Li){return void this.renderError("Invalid base URL configuration")}const n=this.detectLanguage();this.config={orgId:e.trim(),widgetId:t.trim(),baseUrl:r.trim(),language:n},this.setupShadowDOM();try{Z(re(Qe,{children:re(Si,{config:this.config})}),this.shadowRoot),this.isInitialized=!0}catch(i){this.renderError("Failed to initialize widget")}}detectLanguage(){var e;const t=document.documentElement.lang;if(null==t?void 0:t.trim())return t.split("-")[0].toLowerCase();const r=null==(e=document.querySelector('meta[http-equiv="content-language"]'))?void 0:e.getAttribute("content");if(null==r?void 0:r.trim())return r.split("-")[0].toLowerCase();const n=navigator,i=n.language||n.userLanguage;return(null==i?void 0:i.trim())?i.split("-")[0].toLowerCase():"en"}setupShadowDOM(){var e;this.shadowRoot.innerHTML="";const t=document.createElement("style");t.textContent=this.generateBaseStyles(),this.shadowRoot.appendChild(t);const r=(null==(e=this.config)?void 0:e.language)||"en";this.isRTLLanguage(r)?this.setAttribute("dir","rtl"):this.removeAttribute("dir")}generateBaseStyles(){var e;return`\n\t\t\t/*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-cyan-200:oklch(91.7% .08 205.041);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--shadow-sm:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--shadow-md:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.top-1{top:calc(var(--spacing)*1)}.top-1\\/2{top:50%}.top-4{top:calc(var(--spacing)*4)}.top-5{top:calc(var(--spacing)*5)}.top-20{top:calc(var(--spacing)*20)}.-right-1{right:calc(var(--spacing)*-1)}.right-0{right:calc(var(--spacing)*0)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-5{right:calc(var(--spacing)*5)}.right-8{right:calc(var(--spacing)*8)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-5{bottom:calc(var(--spacing)*5)}.bottom-20{bottom:calc(var(--spacing)*20)}.bottom-\\[69px\\]{bottom:69px}.-left-1{left:calc(var(--spacing)*-1)}.left-0{left:calc(var(--spacing)*0)}.left-1{left:calc(var(--spacing)*1)}.left-1\\/2{left:50%}.left-3{left:calc(var(--spacing)*3)}.left-5{left:calc(var(--spacing)*5)}.left-8{left:calc(var(--spacing)*8)}.z-10{z-index:10}.z-\\[999\\]{z-index:999}.z-\\[1000\\]{z-index:1000}.z-\\[1001\\]{z-index:1001}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.-ml-1{margin-left:calc(var(--spacing)*-1)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.h-2{height:calc(var(--spacing)*2)}.h-2\\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-10{height:calc(var(--spacing)*10)}.h-14{height:calc(var(--spacing)*14)}.h-15{height:calc(var(--spacing)*15)}.h-16{height:calc(var(--spacing)*16)}.h-\\[18px\\]{height:18px}.h-\\[81px\\]{height:81px}.h-\\[500px\\]{height:500px}.h-\\[704px\\]{height:704px}.h-\\[800px\\]{height:800px}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[475px\\]{max-height:475px}.max-h-\\[704px\\]{max-height:704px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\\[44px\\]{min-height:44px}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\\/4{width:75%}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-10{width:calc(var(--spacing)*10)}.w-14{width:calc(var(--spacing)*14)}.w-15{width:calc(var(--spacing)*15)}.w-16{width:calc(var(--spacing)*16)}.w-96{width:calc(var(--spacing)*96)}.w-\\[320px\\]{width:320px}.w-\\[400px\\]{width:400px}.w-\\[480px\\]{width:480px}.w-full{width:100%}.max-w-\\[calc\\(100vw-2\\.5rem\\)\\]{max-width:calc(100vw - 2.5rem)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-5{min-width:calc(var(--spacing)*5)}.min-w-\\[18px\\]{min-width:18px}.min-w-\\[44px\\]{min-width:44px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.-translate-x-1{--tw-translate-x:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-1\\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-bounce{animation:var(--animate-bounce)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-manipulation{touch-action:manipulation}.resize{resize:both}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.justify-stretch{justify-content:stretch}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-6{gap:calc(var(--spacing)*6)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*3)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-br-sm{border-bottom-right-radius:var(--radius-sm)}.rounded-bl-sm{border-bottom-left-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-3{border-style:var(--tw-border-style);border-width:3px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-600{border-color:var(--color-blue-600)}.border-blue-800{border-color:var(--color-blue-800)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-transparent{border-color:#0000}.border-yellow-200{border-color:var(--color-yellow-200)}.border-t-blue-500{border-top-color:var(--color-blue-500)}.bg-\\[var\\(--widget-primary-color\\)\\]{background-color:var(--widget-primary-color)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\\/15{background-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.bg-white\\/15{background-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.bg-white\\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-blue-600{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-900{--tw-gradient-from:var(--color-blue-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-blue-600{--tw-gradient-via:var(--color-blue-600);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-700{--tw-gradient-to:var(--color-blue-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-blue-800{--tw-gradient-to:var(--color-blue-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-200{--tw-gradient-to:var(--color-cyan-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-\\[2px\\]{padding-inline:2px}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-8{padding-block:calc(var(--spacing)*8)}.py-\\[18px\\]{padding-block:18px}.pt-5{padding-top:calc(var(--spacing)*5)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-12{padding-right:calc(var(--spacing)*12)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-\\[81px\\]{padding-bottom:81px}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-12{padding-left:calc(var(--spacing)*12)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-5{--tw-leading:calc(var(--spacing)*5);line-height:calc(var(--spacing)*5)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.break-words{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-black{color:var(--color-black)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-red-400{color:var(--color-red-400)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-white{color:var(--color-white)}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.opacity-25{opacity:.25}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media (hover:hover){.hover\\:-translate-y-0\\.5:hover{--tw-translate-y:calc(var(--spacing)*-.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\:border-blue-300:hover{border-color:var(--color-blue-300)}.hover\\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\\:bg-\\[var\\(--widget-primary-color\\)\\]\\/90:hover{background-color:var(--widget-primary-color)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-\\[var\\(--widget-primary-color\\)\\]\\/90:hover{background-color:color-mix(in oklab,var(--widget-primary-color)90%,transparent)}}.hover\\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\\:bg-red-200:hover{background-color:var(--color-red-200)}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\\:bg-white\\/25:hover{background-color:#ffffff40}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/25:hover{background-color:color-mix(in oklab,var(--color-white)25%,transparent)}}.hover\\:bg-yellow-200:hover{background-color:var(--color-yellow-200)}.hover\\:text-blue-500:hover{color:var(--color-blue-500)}.hover\\:text-blue-700:hover{color:var(--color-blue-700)}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-red-800:hover{color:var(--color-red-800)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\\:border-transparent:focus{border-color:#0000}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\\:ring-gray-500:focus{--tw-ring-color:var(--color-gray-500)}.focus\\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\\:ring-white\\/50:focus{--tw-ring-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.focus\\:ring-white\\/50:focus{--tw-ring-color:color-mix(in oklab,var(--color-white)50%,transparent)}}.focus\\:ring-yellow-500:focus{--tw-ring-color:var(--color-yellow-500)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\:ring-offset-blue-600:focus{--tw-ring-offset-color:var(--color-blue-600)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\\:translate-y-0:active{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.active\\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\\:bg-gray-50:active{background-color:var(--color-gray-50)}.active\\:bg-gray-100:active{background-color:var(--color-gray-100)}.active\\:bg-gray-300:active{background-color:var(--color-gray-300)}.active\\:bg-white\\/20:active{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.active\\:bg-white\\/20:active{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.active\\:text-blue-600:active{color:var(--color-blue-600)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{background-color:var(--color-gray-100)}.disabled\\:bg-gray-300:disabled{background-color:var(--color-gray-300)}.disabled\\:opacity-50:disabled{opacity:.5}@media (hover:hover){.disabled\\:hover\\:text-gray-400:disabled:hover{color:var(--color-gray-400)}}@media (prefers-reduced-motion:reduce){.motion-reduce\\:transition-none{transition-property:none}@media (hover:hover){.motion-reduce\\:hover\\:scale-100:hover{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}}.motion-reduce\\:active\\:scale-100:active{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}}@media not all and (min-width:40rem){.max-sm\\:fixed{position:fixed}.max-sm\\:inset-4{inset:calc(var(--spacing)*4)}.max-sm\\:top-4{top:calc(var(--spacing)*4)}.max-sm\\:right-2{right:calc(var(--spacing)*2)}.max-sm\\:right-4{right:calc(var(--spacing)*4)}.max-sm\\:bottom-4{bottom:calc(var(--spacing)*4)}.max-sm\\:bottom-16{bottom:calc(var(--spacing)*16)}.max-sm\\:bottom-20{bottom:calc(var(--spacing)*20)}.max-sm\\:left-2{left:calc(var(--spacing)*2)}.max-sm\\:left-4{left:calc(var(--spacing)*4)}.max-sm\\:mb-2{margin-bottom:calc(var(--spacing)*2)}.max-sm\\:h-3{height:calc(var(--spacing)*3)}.max-sm\\:h-3\\.5{height:calc(var(--spacing)*3.5)}.max-sm\\:h-4{height:calc(var(--spacing)*4)}.max-sm\\:h-5{height:calc(var(--spacing)*5)}.max-sm\\:h-6{height:calc(var(--spacing)*6)}.max-sm\\:h-7{height:calc(var(--spacing)*7)}.max-sm\\:h-14{height:calc(var(--spacing)*14)}.max-sm\\:h-\\[72px\\]{height:72px}.max-sm\\:h-auto{height:auto}.max-sm\\:max-h-\\[calc\\(100vh-8rem\\)\\]{max-height:calc(100vh - 8rem)}.max-sm\\:min-h-\\[40px\\]{min-height:40px}.max-sm\\:w-3{width:calc(var(--spacing)*3)}.max-sm\\:w-3\\.5{width:calc(var(--spacing)*3.5)}.max-sm\\:w-4{width:calc(var(--spacing)*4)}.max-sm\\:w-5{width:calc(var(--spacing)*5)}.max-sm\\:w-6{width:calc(var(--spacing)*6)}.max-sm\\:w-7{width:calc(var(--spacing)*7)}.max-sm\\:w-14{width:calc(var(--spacing)*14)}.max-sm\\:w-\\[calc\\(100vw-2\\.5rem\\)\\]{width:calc(100vw - 2.5rem)}.max-sm\\:w-auto{width:auto}.max-sm\\:min-w-\\[40px\\]{min-width:40px}.max-sm\\:gap-1\\.5{gap:calc(var(--spacing)*1.5)}.max-sm\\:gap-2{gap:calc(var(--spacing)*2)}:where(.max-sm\\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}.max-sm\\:rounded-xl{border-radius:var(--radius-xl)}.max-sm\\:p-1{padding:calc(var(--spacing)*1)}.max-sm\\:p-1\\.5{padding:calc(var(--spacing)*1.5)}.max-sm\\:p-2{padding:calc(var(--spacing)*2)}.max-sm\\:p-2\\.5{padding:calc(var(--spacing)*2.5)}.max-sm\\:p-3{padding:calc(var(--spacing)*3)}.max-sm\\:p-4{padding:calc(var(--spacing)*4)}.max-sm\\:px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.max-sm\\:px-3{padding-inline:calc(var(--spacing)*3)}.max-sm\\:px-\\[1px\\]{padding-inline:1px}.max-sm\\:py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.max-sm\\:py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.max-sm\\:py-\\[14px\\]{padding-block:14px}.max-sm\\:pt-4{padding-top:calc(var(--spacing)*4)}.max-sm\\:pr-3{padding-right:calc(var(--spacing)*3)}.max-sm\\:pr-10{padding-right:calc(var(--spacing)*10)}.max-sm\\:pb-\\[72px\\]{padding-bottom:72px}.max-sm\\:pl-10{padding-left:calc(var(--spacing)*10)}.max-sm\\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.max-sm\\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.max-sm\\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.max-sm\\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}}@media (min-width:40rem){.sm\\:h-\\[704px\\]{height:704px}.sm\\:w-96{width:calc(var(--spacing)*96)}}@media (min-width:48rem){.md\\:h-\\[704px\\]{height:704px}}@media (min-width:64rem){.lg\\:max-w-sm{max-width:var(--container-sm)}}@media not all and (min-width:40rem){@media (orientation:landscape){.max-sm\\:landscape\\:inset-2{inset:calc(var(--spacing)*2)}.max-sm\\:landscape\\:top-2{top:calc(var(--spacing)*2)}.max-sm\\:landscape\\:right-4{right:calc(var(--spacing)*4)}.max-sm\\:landscape\\:bottom-2{bottom:calc(var(--spacing)*2)}.max-sm\\:landscape\\:bottom-16{bottom:calc(var(--spacing)*16)}.max-sm\\:landscape\\:left-4{left:calc(var(--spacing)*4)}.max-sm\\:landscape\\:max-h-\\[calc\\(100vh-4rem\\)\\]{max-height:calc(100vh - 4rem)}}}.\\[\\&_\\*\\]\\:text-right *{text-align:right}}:host{all:initial;z-index:var(--widget-z-index,2147480000);font-family:var(--widget-font-family,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell",sans-serif);font-size:var(--widget-font-size-base,14px);color:var(--widget-text-primary,#000);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;pointer-events:none;direction:ltr;line-height:1.4;display:block;position:fixed;bottom:0;right:0}:host([dir=rtl]){direction:rtl;left:0;right:auto}:host *{pointer-events:auto}:host *,:host :before,:host :after{box-sizing:border-box}:host .fixed{position:fixed}:host .absolute{position:absolute}:host .relative{position:relative}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}\n\t\t\t\n\t\t\t:host {\n\t\t\t\t${vn(null==(e=this.config)?void 0:e.theme)}\n\t\t\t}\n\t\t`}updateTheme(){if(!this.isInitialized||!this.config)return;const e=this.getAttribute("primary-color"),t=this.getAttribute("secondary-color");this.config.theme={primaryColor:null==e?void 0:e.trim(),secondaryColor:null==t?void 0:t.trim()};const r=this.shadowRoot.querySelector("style");r&&(r.textContent=this.generateBaseStyles())}updateThemeFromBackend(e){if(!this.config)return;const t=this.getAttribute("primary-color"),r=this.getAttribute("secondary-color"),n={primaryColor:(null==t?void 0:t.trim())||e.primaryColor||void 0,secondaryColor:(null==r?void 0:r.trim())||e.secondaryColor||void 0};if(this.config.theme=n,this.isInitialized){const e=this.shadowRoot.querySelector("style");e&&(e.textContent=this.generateBaseStyles())}}isRTLLanguage(e){return["ar","he","fa","ur","yi"].includes(e.toLowerCase())}renderError(e){this.shadowRoot.innerHTML=`\n\t\t\t<style>\n\t\t\t\t.widget-error {\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\tbottom: 20px;\n\t\t\t\t\tright: 20px;\n\t\t\t\t\tbackground: #ff4444;\n\t\t\t\t\tcolor: white;\n\t\t\t\t\tpadding: 12px 16px;\n\t\t\t\t\tborder-radius: 8px;\n\t\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, sans-serif;\n\t\t\t\t\tfont-size: 14px;\n\t\t\t\t\tz-index: 2147483647;\n\t\t\t\t\tmax-width: 300px;\n\t\t\t\t\tbox-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class="widget-error">\n\t\t\t\t<strong>Widget Error:</strong> ${e}\n\t\t\t</div>\n\t\t`}}const Ti=e=>{if("undefined"!=typeof window&&(customElements.get("analytick-widget")||customElements.define("analytick-widget",Ei),e)){const t=document.createElement("analytick-widget");t.setAttribute("org-id",e.orgId),t.setAttribute("widget-id",e.widgetId),t.setAttribute("base-url",e.baseUrl),e.primaryColor&&t.setAttribute("primary-color",e.primaryColor),e.secondaryColor&&t.setAttribute("secondary-color",e.secondaryColor);return(e.container||document.body).appendChild(t),t}};if("undefined"==typeof window||customElements.get("analytick-widget")||customElements.define("analytick-widget",Ei),"undefined"!=typeof window){const e={AnalytickWidget:Ei,init:Ti,version:"1.0.0"},t=window;t.AnalytickWidget=e,t.Widget=t.Widget||{},t.Widget.Analytick=e}e.AnalytickWidget=Ei,e.init=Ti,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|