@botfabrik/engine-webclient 4.104.27 → 4.104.29

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.
@@ -58,7 +58,7 @@ ${Ee.current.stack}
58
58
  `},...z),{processed:!0,newPos:C(t,u),wasBlank:!1}}let A=M6(t,i,v,M,E,_);if(A!==null)return{processed:!0,newPos:A,wasBlank:!1};let D=e$(M,E,_,{inline:!1,list:!0});if(D.length>0){if(T&&D[0].type===W.paragraph){let z=D[0];v.push({type:W.text,text:`
59
59
  `},...z.children),D.length>1&&v.push(...D.slice(1))}else if(!x&&D[0].type===W.paragraph&&v.length>0){let z=v[v.length-1],L=D[0];z.type===W.paragraph?z.children.push({type:W.text,text:`
60
60
  `},...L.children):z.type===W.heading?v.push(...L.children):m9(v)?v.push(...D):v.push({type:W.text,text:" "},...L.children),D.length>1&&v.push(...D.slice(1))}else v.push(...D);return{processed:!0,newPos:C(t,u),wasBlank:!1}}if(x){let z=W$(E,!0,()=>k1(M,0,M.length,E,_));v.push({type:W.paragraph,children:z})}else K$(M,v,E,_);return{processed:!0,newPos:C(t,u),wasBlank:!1}}function o$(t,i,u,c){if(u.inline)return null;var p=u.inList;if(u.inList=!0,i>0){var g=b(t,i-1);if(g!==d&&g!==X0)return u.inList=p,null}var v=I(t,i),x=n(t,i,v);if(x.spaceEquivalent>3&&!u.inList)return u.inList=p,null;var E=t.slice(i,v),_=x.charCount,T=E.slice(_),w=C$(T);if(!w)return u.inList=p,null;var{match:R,ordered:M,listItemRegex:k}=w,A=x.spaceEquivalent,D=M?parseInt(R[1],10):void 0,z=M?R[2]:void 0,L=M?void 0:R[1],U=M?R[3]==="":R[2]==="";function V(ye,De){if(ye===0)return!0;var He=b(t,ye-1);if(He!==d)return!1;if(!De)return!0;for(var Ce=ye-2;Ce>=0;){var Ne=b(t,Ce);if(Ne!==f&&Ne!==l)break;Ce--}return Ce<0||b(t,Ce)===d}if(U&&!V(i,!0))return u.inList=p,null;if(M&&D!==1&&!V(i,!1)||!M&&IZ(R,L))return null;var Q=R.index||0,Z=M?Q+R[1].length+R[2].length+1:U?Q+R[1].length:Q+R[1].length+1,F=i+_+Z,Y=j$(t,F,v,A,Z),ne=Y.contentStartColumn,fe=A+Q+R[1].length,oe=M?fe+R[2].length+1:U?fe:fe+1,le=[],Se=[];function ve(ye,De,He){return He?ye>=De:ye>De}function _e(){return le[le.length-1]}function K(){return Se[Se.length-1]??ne}function pe(ye,De){let He=lZ(De),Ce=u.inList;u.inList=!0;let Ne=o$(t,ye,u,c);return u.inList=Ce,Ne?(He.push(Ne),Ne):null}for(var te=C(t,v),Re=te,Ae=!1;Re<t.length;){var H=I(t,Re),ie=t.slice(Re,H);if(ie.trim()===""){for(var ue=C(t,H);ue<t.length;){var be=b(t,ue);if(be!==d){if(!x6.has(t[ue]))break}ue++}var me=I(t,ue),Ee=t.slice(ue,me),Te=n(t,ue,me),ke=Ee.slice(Te.charCount);if(o1(ke,Te,M,L,z,A,k))Ae=!0;else{var Me=s$(t,ue,me,Te,ke,u,c);if(Me){for(var Ve=Me;Ve<t.length&&b(t,Ve)===d;)Ve++;if(Ve<t.length){var ft=I(t,Ve),je=t.slice(Ve,ft),vt=n(t,Ve,ft),At=je.slice(vt.charCount);o1(At,vt,M,L,z,A,k)&&(Ae=!0)}}}break}var Ue=n(t,Re,H),dt=ie.slice(Ue.charCount),un=C$(dt);if(!un)break;var _n=un.match;if(M){if(_n[2]!==z)break}else if(_n[1]!==L)break;Re=C(t,H)}var Ye=M?R[3]:R[2];Ye=Ye.trimStart();for(var Zt=i+_+(R.index||0),wt=M?Zt+R[1].length+R[2].length:Zt+R[1].length,cn=wt;cn<t.length;){var be=b(t,cn);if(be!==f&&be!==l)break;cn++}for(var Tt=0,ot=wt;ot<v;){var be=b(t,ot);if(be===l)Tt+=4-Tt%4;else if(be===f)Tt++;else break;ot++}var An=!1;if(wt<t.length&&b(t,wt)===l){for(var Xt=1,Dt=wt+1;Dt<t.length&&b(t,Dt)===l;)Xt++,Dt++;Xt>=2&&(Ye=" "+Ye,An=!0)}M||(U=U&&Tt===0),Tt>=4&&!An&&(Ye=" ".repeat(Tt-1)+Ye.trimStart()),Ye.trim();let Pt=Ae;if(!Ae&&te<t.length)for(var pn=te;pn<t.length;){var mn=I(t,pn),Yn=t.slice(pn,mn);if(W1(t,pn,mn)){for(var at=C(t,mn);at<t.length;){var gn=I(t,at);if(W1(t,at,gn))at=C(t,gn);else break}if(at<t.length){var bt=n(t,at,t.length),pt=bt.spaceEquivalent;if(pt>=A){for(var tt=t.slice(at,I(t,at)),nt=tt.slice(bt.charCount).match(k),fn=nt&&(M?nt[2]===z:nt[1]===L),yn=null,qt=te;qt<pn;qt=I(t,qt)+1){var rt=I(t,qt),Jt=n(t,qt,rt),Ct=t.slice(qt,rt).slice(Jt.charCount).match(k),Cn=Ct&&Jt.spaceEquivalent>A&&Jt.spaceEquivalent>=ne&&(M?Ct[2]===z:Ct[1]===L);if(Cn){var On=Jt.spaceEquivalent+1,mt=M?On+Ct[1].length+Ct[2].length+1:On+Ct[1].length+1,dn=qt+Jt.charCount+Ct[0].length,Kn=j$(t,dn,rt,On,mt-On);yn=Kn.contentStartColumn;break}}var wn=Tt>=5?oe:ne;!fn&&pt>=wn&&(yn===null||pt+1<yn)&&(Pt=!0)}}break}var Zn=n(t,pn,mn),Ut=Zn.spaceEquivalent,$t=Yn.slice(Zn.charCount),vn=$t.match(k),Nt=vn&&(M?vn[2]===z:vn[1]===L);if(Nt&&Ut<=A)break;pn=C(t,mn)}var Ie=Ye;if(s(Ye,"```")||s(Ye,"~~~")){var kt=M?R[1].length+R[2].length+1:R[1].length+1,tn=dZ(t,Ye,te,kt);Ie=tn.content,te=tn.endPos}var It=!U&&Ye.trim()===""&&Tt>0&&Tt<5;if(!Pt)for(var ht=Ie.length>0?Ie[0]:"",Ke=ht===">",i=te;i<t.length;){var v=I(t,i),E=t.slice(i,v);if(E.trim()==="")break;var x=n(t,i,v);if(x.spaceEquivalent<oe)break;var T=E.slice(x.charCount);if(x.spaceEquivalent<=A&&o1(T,x,M,L,z,A,k)||g$(T)&&x.spaceEquivalent>A)break;var nn=T.length>0?T[0]:"",Lt=nn===">"&&Ke;if(nn===">"&&!Lt||nn==="#"||s(T,"```")||s(T,"~~~"))break;Ie+=`
61
- `+T,te=i=C(t,v)}if(le.push(iZ(Ie,Pt,u,c)),Se.push(ne),Pt&&(Tt>=5||It)){let ye=_e();te=xZ(t,ye,oe,te,A,M,L,z,k,u,c,!0)}else if(!Pt){let ye=oe-1;for(;te<t.length;){let De=I(t,te),He=t.slice(te,De),Ce=n(t,te,De),Ne=Ce.spaceEquivalent,We=He.slice(Ce.charCount);if(He.trim()===""||Ne<=A&&o1(We,Ce,M,L,z,A,k)||g$(We)&&Ne>A||Ne<ye)break;let Et=_e(),ze=V$(t,te,De,Ce,ye,ne,Et,!1,u,c,!0);if(ze.processed)te=ze.newPos;else break}}for(var Ze=!1;te<t.length;){let ye=I(t,te),De=t.slice(te,ye),He=n(t,te,ye),Ce=He.charCount,Ne=He.spaceEquivalent;if(De.trim()==="")Ae=!0,Ze=!0,te=C(t,ye);else if(Ne<A){let We=De.slice(Ce);if(We.startsWith("<")&&EZ(t,te,Ce,A,Ne,c))break;let Et=We.trim();if(Et.length>0&&le.length>0&&!u9(Et[0])&&!o1(We,He,M,L,z,A,k)){let ze=_e();if(ze.length>0){let ut=ze[ze.length-1];if(!Ze&&(ut.type===W.paragraph||ut.type===W.text)){K$(We,ze,u,c),Ze=!1,te=C(t,ye);continue}}}break}else{let We=De.slice(Ce);if(le.length>0){let Ge=Se[le.length-1]||ne;if(Ne+1>=Ge&&!o1(We,He,M,L,z,A,k)){let Ot=_e();if(Ot.length>0&&cZ(Ot,We,c)){te=C(t,ye);continue}}}if(D$(t,te))break;if(Ze){let Ge=s$(t,te,ye,He,We,u,c);if(Ge){te=Ge,Ze=!1;continue}}if(Ne<=A){if(We.startsWith("<")&&EZ(t,te,Ce,A,Ne,c))break;if(!o1(We,He,M,L,z,A,k)){if(Ne===A&&!Ze){let Ge=We.trim();if(Ge.length>0&&!u9(Ge[0])){let Ot=d9(t,te,u,c);if(Ot&&Ot.type!==W.paragraph)break;let Bt=_e();if(Bt.length>0&&!m9(Bt)){K$(We,Bt,u,c,!1),Ze=!1,te=C(t,ye);continue}}}break}}if(TZ(le,U,Ze,Ye))break;let Et=C$(We),ze=Et?Et.match:null,ut=ze&&(M?ze[2]===z:ze[1]===L);if(ut&&Ne>3&&Ze)break;if(ut&&Ne<=A+3){if(Ne>=4&&Ze)break;if(Ne===A){let Ge=M?ze[3]:ze[2];if(Ge=Ge.trimStart(),te=Y$(t,le,Se,Ge,te,ye,Ne,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1,Ge.trim()===""){let Ot=le[le.length-1],Bt=K();te=xZ(t,Ot,Bt,te,A,M,L,z,k,u,c)}continue}if(Ne>A){if(Ze){let Fe=M?ze[3]:ze[2];Fe=Fe.trimStart(),te=Y$(t,le,Se,Fe,te,ye,Ne,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1;continue}let Ge=_e(),Ot=Ne+1,Bt=ve(Ot,K(),m9(Ge));if(Bt){let Fe=pe(te,Ge);if(Fe){te=Fe.endPos,Ze=!1;continue}}if(!Bt&&ut){let Fe=M?ze[3]:ze[2];if(Fe=Fe.trimStart(),!Ae){let bn=C(t,ye);for(;bn<t.length;){let Vt=I(t,bn),Ht=t.slice(bn,Vt),Qt=n(t,bn,Vt),Ba=Qt.spaceEquivalent;if(Ht.trim()===""){let kn=C(t,Vt);if(kn<t.length){let za=n(t,kn,t.length).spaceEquivalent,Nn=Ne+(M?ze[1].length+ze[2].length+1:ze[1].length+1);if(za+1>Nn)break}break}else if(Ba<=A){let kn=Ht.slice(Qt.charCount).match(k);if(kn&&(M?kn[2]===z:kn[1]===L)&&Ba<=A)break}bn=C(t,Vt)}}te=Y$(t,le,Se,Fe,te,ye,Ne,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1;continue}else if(!Bt&&!ut)break;{let Fe=_e(),bn=Fe.length===0;if(bn&&TZ(le,U,Ze,Ye))break;let Vt=Fe.some(Qt=>Qt.type===W.codeBlock||Qt.type===W.paragraph||Qt.type===W.blockQuote||Qt.type===W.orderedList||Qt.type===W.unorderedList||Qt.type===W.heading),Ht=bn&&le.length===1?oe:ne;if(Vt?Ne>=Ht:Ne>Ht){let Qt=V$(t,te,ye,He,Ht,ne,_e(),Ze,u,c,void 0);if(Qt.processed){Ze=Qt.wasBlank,te=Qt.newPos;continue}}else break}}else if(Ne===A){if(!M&&ze&&IZ(ze,ze[1]))break;let Ge=M?ze[3]:ze[2];Ge=Ge.trimStart(),te=Y$(t,le,Se,Ge,te,ye,A,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1}}else if(Ne>A){let Ge=_e();if(g$(We)){let Bt=Ne+1;if(ve(Bt,K(),m9(Ge))){let Fe=pe(te,Ge);if(Fe){te=Fe.endPos,Ze=!1;continue}}if(Ne-A>3){let Fe=Ge.length>0?Ge[Ge.length-1]:null;if(Fe&&(Fe.type===W.paragraph||Fe.type===W.text)){K$(We,Ge,u,c),Ze=!1,te=C(t,ye);continue}}else break}else{let Bt=pe(te,Ge);if(Bt){te=Bt.endPos,Ze=!1;continue}}let Ot=ne;if(m9(Ge)?Ne>=Ot-1:Ne>Ot-1){let Bt=V$(t,te,ye,He,Ot-1,ne,_e(),Ze,u,c,void 0);if(Bt.processed){Ze=Bt.wasBlank,te=Bt.newPos;continue}}else break}else break}}if(Ae&&le.length>1&&le[0].length>0&&le[0][0].type!==W.paragraph){for(var jn=1;jn<le.length;jn++)if(le[jn].length>0&&le[jn][0].type===W.paragraph){for(var Dn=!1,xe=0;xe<le[0].length;xe++){var q=le[0][xe].type;if(q===W.codeBlock||q===W.heading||q===W.blockQuote||q===W.orderedList||q===W.unorderedList||q===W.htmlBlock||q===W.breakThematic){Dn=!0;break}}Dn||(le[0]=[{type:W.paragraph,children:le[0]}]);break}}let ge=M?{type:W.orderedList,items:le,ordered:!0,start:D}:{type:W.unorderedList,items:le,ordered:!1};return u.inList=p,{...ge,endPos:te}}function aZ(t,i,u,c){if(u.inline)return null;let p=[],g=i;for(;g<t.length;){let k=I(t,g);if(W1(t,g,k))break;let A=t.slice(g,k).trim();if(!(A.indexOf("|")!==-1||p.length>=3&&A&&!u9(A[0])))break;p.push(A),g=C(t,k)}if(p.length<2)return null;let v=k=>k[0]==="|"&&k[k.length-1]==="|"?k.slice(1,-1):k,x=k=>{let A=[],D="",z=!1;for(let L=0;L<k.length;L++){let U=k[L];U==="\\"&&L+1<k.length&&k[L+1]==="|"?(D+="|",L++):U==="`"?(z=!z,D+=U):U==="|"&&!z?(A.push(D.trim()),D=""):D+=U}return A.push(D.trim()),A},E=x(v(p[0]));if(!E.length)return null;let _=x(v(p[1]));if(_.length!==E.length||_.some(k=>!/^:?-+:?$/.test(k)))return null;let T=_.map(k=>{let A=k[0]===":",D=k[k.length-1]===":";return A&&D?"center":A?"left":D?"right":null}),w=k=>W$(u,!0,()=>k.map(A=>k1(A,0,A.length,u,c))),R=w(E),M=p.slice(2).map(k=>{let A=k.indexOf("|")!==-1?x(v(k)):[k.trim()],D=E.length;for(;A.length<D;)A.push("");return A.length=D,w(A)});return{type:W.table,header:R,cells:M,align:T,endPos:g}}var l6=["div","p","section","article","aside","nav","header","footer","main","h1","h2","h3","h4","h5","h6","blockquote","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","td","th","form","fieldset","hr","pre","details","summary","figure","figcaption"],d6=new Set(["pre","script","style","textarea"]);function h9(t){return l6.indexOf(t.toLowerCase())!==-1}function A9(t){return d6.has(t)}function W1(t,i,u){for(var c=i;c<u;c++){let p=b(t,c);if(p!==f&&p!==l&&p!==X0)return!1}return!0}function W$(t,i,u){let c=t.inline;t.inline=i;try{return u()}finally{t.inline=c}}function k$(t,i,u){for(var c=i;c<u;){var p=I(t,c);if(W1(t,c,p))return c;c=C(t,p)}return u}function m$(t,i,u){return{type:W.htmlComment,text:g1(t),endPos:i,...u}}function M9(t,i,u,c,p,g,v,x,E){var _=g1(i),T=_;if(x&&x.forceBlock&&i&&!g){var w=new RegExp("^<"+t.toLowerCase()+"(\\s[^>]*)?>$","i");w.test(i.trim())&&(T="")}var R=T,M=t.toLowerCase(),k=new RegExp("^<"+M+"[\\s>]","i");if(k.test(R)){var A=R.indexOf(">");if(A!==-1){R=R.slice(A+1);var D="</"+M+">",z=R.indexOf(D);z!==-1&&(R=R.slice(0,z))}}else{var L="</"+M+">",U=R.indexOf(L);U!==-1&&(R=R.slice(0,U))}var V=[];if(R&&x){var Q=E||{inline:!1,inHTML:!0,inAnchor:!1},Z=R.trim(),F=F$.test(Z),Y=O$.test(Z),ne=H$.test(Z);if(F||Y||ne){var fe={...Q,inline:!1,inHTML:!0,inAnchor:Q.inAnchor||M==="a"};V=i9(Z,fe,x)}else if(Z){var oe={...Q,inline:!0,inAnchor:Q.inAnchor||M==="a"};V=k1(Z,0,Z.length,oe,x)}}return{type:W.htmlBlock,tag:t,attrs:c||{},rawAttrs:p,children:V,rawText:T,text:R,verbatim:!0,isClosingTag:g,canInterruptParagraph:v,endPos:u}}function p9(t){let i=O$.test(t),u=F$.test(t),c=N6.test(t);return i||u&&!c}function fZ(t,i,u,c,p,g,v,x,E,_){if(!x.inHTML&&!x.inline&&!n9(p,`
61
+ `+T,te=i=C(t,v)}if(le.push(iZ(Ie,Pt,u,c)),Se.push(ne),Pt&&(Tt>=5||It)){let ye=_e();te=xZ(t,ye,oe,te,A,M,L,z,k,u,c,!0)}else if(!Pt){let ye=oe-1;for(;te<t.length;){let De=I(t,te),He=t.slice(te,De),Ce=n(t,te,De),Ne=Ce.spaceEquivalent,We=He.slice(Ce.charCount);if(He.trim()===""||Ne<=A&&o1(We,Ce,M,L,z,A,k)||g$(We)&&Ne>A||Ne<ye)break;let Et=_e(),ze=V$(t,te,De,Ce,ye,ne,Et,!1,u,c,!0);if(ze.processed)te=ze.newPos;else break}}for(var Ze=!1;te<t.length;){let ye=I(t,te),De=t.slice(te,ye),He=n(t,te,ye),Ce=He.charCount,Ne=He.spaceEquivalent;if(De.trim()==="")Ae=!0,Ze=!0,te=C(t,ye);else if(Ne<A){let We=De.slice(Ce);if(We.startsWith("<")&&EZ(t,te,Ce,A,Ne,c))break;let Et=We.trim();if(Et.length>0&&le.length>0&&!u9(Et[0])&&!o1(We,He,M,L,z,A,k)){let ze=_e();if(ze.length>0){let ut=ze[ze.length-1];if(!Ze&&(ut.type===W.paragraph||ut.type===W.text)){K$(We,ze,u,c),Ze=!1,te=C(t,ye);continue}}}break}else{let We=De.slice(Ce);if(le.length>0){let Ge=Se[le.length-1]||ne;if(Ne+1>=Ge&&!o1(We,He,M,L,z,A,k)){let Ot=_e();if(Ot.length>0&&cZ(Ot,We,c)){te=C(t,ye);continue}}}if(D$(t,te))break;if(Ze){let Ge=s$(t,te,ye,He,We,u,c);if(Ge){te=Ge,Ze=!1;continue}}if(Ne<=A){if(We.startsWith("<")&&EZ(t,te,Ce,A,Ne,c))break;if(!o1(We,He,M,L,z,A,k)){if(Ne===A&&!Ze){let Ge=We.trim();if(Ge.length>0&&!u9(Ge[0])){let Ot=d9(t,te,u,c);if(Ot&&Ot.type!==W.paragraph)break;let Bt=_e();if(Bt.length>0&&!m9(Bt)){K$(We,Bt,u,c,!0),Ze=!1,te=C(t,ye);continue}}}break}}if(TZ(le,U,Ze,Ye))break;let Et=C$(We),ze=Et?Et.match:null,ut=ze&&(M?ze[2]===z:ze[1]===L);if(ut&&Ne>3&&Ze)break;if(ut&&Ne<=A+3){if(Ne>=4&&Ze)break;if(Ne===A){let Ge=M?ze[3]:ze[2];if(Ge=Ge.trimStart(),te=Y$(t,le,Se,Ge,te,ye,Ne,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1,Ge.trim()===""){let Ot=le[le.length-1],Bt=K();te=xZ(t,Ot,Bt,te,A,M,L,z,k,u,c)}continue}if(Ne>A){if(Ze){let Fe=M?ze[3]:ze[2];Fe=Fe.trimStart(),te=Y$(t,le,Se,Fe,te,ye,Ne,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1;continue}let Ge=_e(),Ot=Ne+1,Bt=ve(Ot,K(),m9(Ge));if(Bt){let Fe=pe(te,Ge);if(Fe){te=Fe.endPos,Ze=!1;continue}}if(!Bt&&ut){let Fe=M?ze[3]:ze[2];if(Fe=Fe.trimStart(),!Ae){let bn=C(t,ye);for(;bn<t.length;){let Vt=I(t,bn),Ht=t.slice(bn,Vt),Qt=n(t,bn,Vt),Ba=Qt.spaceEquivalent;if(Ht.trim()===""){let kn=C(t,Vt);if(kn<t.length){let za=n(t,kn,t.length).spaceEquivalent,Nn=Ne+(M?ze[1].length+ze[2].length+1:ze[1].length+1);if(za+1>Nn)break}break}else if(Ba<=A){let kn=Ht.slice(Qt.charCount).match(k);if(kn&&(M?kn[2]===z:kn[1]===L)&&Ba<=A)break}bn=C(t,Vt)}}te=Y$(t,le,Se,Fe,te,ye,Ne,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1;continue}else if(!Bt&&!ut)break;{let Fe=_e(),bn=Fe.length===0;if(bn&&TZ(le,U,Ze,Ye))break;let Vt=Fe.some(Qt=>Qt.type===W.codeBlock||Qt.type===W.paragraph||Qt.type===W.blockQuote||Qt.type===W.orderedList||Qt.type===W.unorderedList||Qt.type===W.heading),Ht=bn&&le.length===1?oe:ne;if(Vt?Ne>=Ht:Ne>Ht){let Qt=V$(t,te,ye,He,Ht,ne,_e(),Ze,u,c,void 0);if(Qt.processed){Ze=Qt.wasBlank,te=Qt.newPos;continue}}else break}}else if(Ne===A){if(!M&&ze&&IZ(ze,ze[1]))break;let Ge=M?ze[3]:ze[2];Ge=Ge.trimStart(),te=Y$(t,le,Se,Ge,te,ye,A,Ce,ze,M,Ae,u,c).newCurrentPos,Ze=!1}}else if(Ne>A){let Ge=_e();if(g$(We)){let Bt=Ne+1;if(ve(Bt,K(),m9(Ge))){let Fe=pe(te,Ge);if(Fe){te=Fe.endPos,Ze=!1;continue}}if(Ne-A>3){let Fe=Ge.length>0?Ge[Ge.length-1]:null;if(Fe&&(Fe.type===W.paragraph||Fe.type===W.text)){K$(We,Ge,u,c),Ze=!1,te=C(t,ye);continue}}else break}else{let Bt=pe(te,Ge);if(Bt){te=Bt.endPos,Ze=!1;continue}}let Ot=ne;if(m9(Ge)?Ne>=Ot-1:Ne>Ot-1){let Bt=V$(t,te,ye,He,Ot-1,ne,_e(),Ze,u,c,void 0);if(Bt.processed){Ze=Bt.wasBlank,te=Bt.newPos;continue}}else break}else break}}if(Ae&&le.length>1&&le[0].length>0&&le[0][0].type!==W.paragraph){for(var jn=1;jn<le.length;jn++)if(le[jn].length>0&&le[jn][0].type===W.paragraph){for(var Dn=!1,xe=0;xe<le[0].length;xe++){var q=le[0][xe].type;if(q===W.codeBlock||q===W.heading||q===W.blockQuote||q===W.orderedList||q===W.unorderedList||q===W.htmlBlock||q===W.breakThematic){Dn=!0;break}}Dn||(le[0]=[{type:W.paragraph,children:le[0]}]);break}}let ge=M?{type:W.orderedList,items:le,ordered:!0,start:D}:{type:W.unorderedList,items:le,ordered:!1};return u.inList=p,{...ge,endPos:te}}function aZ(t,i,u,c){if(u.inline)return null;let p=[],g=i;for(;g<t.length;){let k=I(t,g);if(W1(t,g,k))break;let A=t.slice(g,k).trim();if(!(A.indexOf("|")!==-1||p.length>=3&&A&&!u9(A[0])))break;p.push(A),g=C(t,k)}if(p.length<2)return null;let v=k=>k[0]==="|"&&k[k.length-1]==="|"?k.slice(1,-1):k,x=k=>{let A=[],D="",z=!1;for(let L=0;L<k.length;L++){let U=k[L];U==="\\"&&L+1<k.length&&k[L+1]==="|"?(D+="|",L++):U==="`"?(z=!z,D+=U):U==="|"&&!z?(A.push(D.trim()),D=""):D+=U}return A.push(D.trim()),A},E=x(v(p[0]));if(!E.length)return null;let _=x(v(p[1]));if(_.length!==E.length||_.some(k=>!/^:?-+:?$/.test(k)))return null;let T=_.map(k=>{let A=k[0]===":",D=k[k.length-1]===":";return A&&D?"center":A?"left":D?"right":null}),w=k=>W$(u,!0,()=>k.map(A=>k1(A,0,A.length,u,c))),R=w(E),M=p.slice(2).map(k=>{let A=k.indexOf("|")!==-1?x(v(k)):[k.trim()],D=E.length;for(;A.length<D;)A.push("");return A.length=D,w(A)});return{type:W.table,header:R,cells:M,align:T,endPos:g}}var l6=["div","p","section","article","aside","nav","header","footer","main","h1","h2","h3","h4","h5","h6","blockquote","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","td","th","form","fieldset","hr","pre","details","summary","figure","figcaption"],d6=new Set(["pre","script","style","textarea"]);function h9(t){return l6.indexOf(t.toLowerCase())!==-1}function A9(t){return d6.has(t)}function W1(t,i,u){for(var c=i;c<u;c++){let p=b(t,c);if(p!==f&&p!==l&&p!==X0)return!1}return!0}function W$(t,i,u){let c=t.inline;t.inline=i;try{return u()}finally{t.inline=c}}function k$(t,i,u){for(var c=i;c<u;){var p=I(t,c);if(W1(t,c,p))return c;c=C(t,p)}return u}function m$(t,i,u){return{type:W.htmlComment,text:g1(t),endPos:i,...u}}function M9(t,i,u,c,p,g,v,x,E){var _=g1(i),T=_;if(x&&x.forceBlock&&i&&!g){var w=new RegExp("^<"+t.toLowerCase()+"(\\s[^>]*)?>$","i");w.test(i.trim())&&(T="")}var R=T,M=t.toLowerCase(),k=new RegExp("^<"+M+"[\\s>]","i");if(k.test(R)){var A=R.indexOf(">");if(A!==-1){R=R.slice(A+1);var D="</"+M+">",z=R.indexOf(D);z!==-1&&(R=R.slice(0,z))}}else{var L="</"+M+">",U=R.indexOf(L);U!==-1&&(R=R.slice(0,U))}var V=[];if(R&&x){var Q=E||{inline:!1,inHTML:!0,inAnchor:!1},Z=R.trim(),F=F$.test(Z),Y=O$.test(Z),ne=H$.test(Z);if(F||Y||ne){var fe={...Q,inline:!1,inHTML:!0,inAnchor:Q.inAnchor||M==="a"};V=i9(Z,fe,x)}else if(Z){var oe={...Q,inline:!0,inAnchor:Q.inAnchor||M==="a"};V=k1(Z,0,Z.length,oe,x)}}return{type:W.htmlBlock,tag:t,attrs:c||{},rawAttrs:p,children:V,rawText:T,text:R,verbatim:!0,isClosingTag:g,canInterruptParagraph:v,endPos:u}}function p9(t){let i=O$.test(t),u=F$.test(t),c=N6.test(t);return i||u&&!c}function fZ(t,i,u,c,p,g,v,x,E,_){if(!x.inHTML&&!x.inline&&!n9(p,`
62
62
  `)){let Te=g,ke=v.length;for(;Te<ke;){let Me=I(v,Te);if(W1(v,Te,Me))break;let Ve=v.slice(Te,Me).trim();if(Ve.length>0&&u9(Ve[0])){let ft=M$(v,Te,x,_);if(ft){Te=ft.endPos;continue}let je=n1(v,Te);if(je){Te=je.endPos;continue}return null}Te=C(v,Me)}}let T=i,w=A9(T);var R=!w&&!W9(i),M=void 0;if(p){var k=p.indexOf(">");if(k!==-1){var A=p.slice(0,k+1);A.indexOf(`
63
63
  `)!==-1&&(M=A);for(var D=k,z=1;z<k;z++){var L=A[z];if(L===" "||L===" "||L===`
64
64
  `||L===">"){D=z;break}}u=A.slice(D,k)}}var U=u.replace(/^[\s\n\r\t]+/,""),V=C1(U,i,t,_),Q={...V},Z=!1,F=!1;if(R&&c.length>0){var Y="</"+T,ne=c.indexOf(Y);if(ne>=0){for(var fe=ne+Y.length;fe<c.length&&(c[fe]===" "||c[fe]===" ");)fe++;if(fe<c.length&&c[fe]===">"){var oe=c.slice(0,ne);p9(oe)?(c=oe,F=!0):Z=!0}}if(!F){var le=c.length-1;if(c[le]===`
@@ -118,7 +118,7 @@ ${Ee.current.stack}
118
118
  `).map((p,g)=>jsxRuntimeExports.jsxs("span",{className:styles$e.text,children:[p,jsxRuntimeExports.jsx("br",{})]},g))]})},TextMessage=({text:t,commands:i,sources:u,onLinkClick:c})=>jsxRuntimeExports.jsxs("div",{className:styles$k.bubbleContent,children:[jsxRuntimeExports.jsx(Text$1,{text:t,commands:i}),jsxRuntimeExports.jsx(MessageSources,{sources:u,onLinkClick:c})]}),Message=reactExports.forwardRef(({message:t,commands:i,isFirstMessage:u,isLastMessage:c,isFirstMessageBySender:p,isLastMessageBySender:g,onReaction:v,onButtonClick:x,onLinkClick:E},_)=>{const T=getMessageCmp(t._id,t,i,x,E),w=R=>{v(t._id,R)};return t.sender.type===UserType$1.GUEST?jsxRuntimeExports.jsx(UserMessage,{ref:_,isFirstMessageBySender:p,isLastMessageBySender:g,children:T}):jsxRuntimeExports.jsx(BotMessage,{ref:_,message:t,isAnimated:!1,isFirstMessage:u,isLastMessage:c,isFirstMessageBySender:p,isLastMessageBySender:g,onReaction:w,children:T})}),getMessageCmp=(t,i,u,c,p)=>{switch(i.type){case MessageTypeEnum.TEXT:{const g=i;return jsxRuntimeExports.jsx(TextMessage,{text:g.text,commands:u,sources:i.sources||[],onLinkClick:p})}case MessageTypeEnum.DETAIL:{const g=i;return jsxRuntimeExports.jsx(DetailMessage,{title:g.title,text:g.text,imageUrl:g.imageUrl,itemUrl:g.itemUrl,buttons:g.buttons,sources:i.sources||[],onButtonClick:c,onLinkClick:p})}case MessageTypeEnum.MARKDOWN:{const g=i;return jsxRuntimeExports.jsx(MarkdownMessage,{actionId:t,markdown:g.markdown,sources:g.sources||[],onLinkClick:p})}}},areEqual=(t,i)=>t.message._id===i.message._id&&t.message.reaction===i.message.reaction&&t.isFirstMessage===i.isFirstMessage&&t.isLastMessage===i.isLastMessage&&t.isFirstMessageBySender===i.isFirstMessageBySender&&t.isLastMessageBySender===i.isLastMessageBySender,Message$1=React.memo(Message,areEqual),ticontainer="_ticontainer_xg0dn_1",tiblock="_tiblock_xg0dn_5",tidot="_tidot_xg0dn_12",styles$d={ticontainer,tiblock,tidot},TypingIndicator=({isTyping:t=!1})=>jsxRuntimeExports.jsx("div",{className:styles$d.ticontainer,children:jsxRuntimeExports.jsx("div",{className:styles$d.tiblock,children:t?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:clsx(styles$d.tidot,"chat__typingIndicator"),"aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:clsx(styles$d.tidot,"chat__typingIndicator"),"aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:clsx(styles$d.tidot,"chat__typingIndicator"),"aria-hidden":"true"})]}):null})}),BotTypingMessage=Object.assign({_id:"typing-indicator"},new TextMessage$1("",new BotUser)),Conversation=({messages:t,isBotTyping:i,commands:u,onTranscriptItemReaction:c,onButtonClick:p,onLinkClick:g})=>{const v=useTranslation(),x=reactExports.useRef(0),E=reactExports.useRef(!0),_=reactExports.useRef(null),T=reactExports.useRef(null),w=reactExports.useRef(null),R=useAppSelector(A=>A.settings.enableGeneralConditions);reactExports.useLayoutEffect(()=>{if(t.length&&_.current&&(x.current<t.length||i)){if(T.current){const A=T.current.offsetTop;_.current.scrollTop=A}else if(w.current){const A=w.current.offsetTop;_.current.scrollTop=A}E.current&&(E.current=!1),x.current=t.length}},[t,E,i]);let M;const k=t.length;return jsxRuntimeExports.jsxs("div",{ref:_,className:clsx(styles$m.messageContainer,"chat__messageContainer"),style:{scrollBehavior:t.length&&E.current?"auto":"smooth"},id:"MessageContainer","aria-label":v("conversation.label"),children:[R&&jsxRuntimeExports.jsx(GeneralConditions,{}),jsxRuntimeExports.jsxs("ul",{className:styles$m.messages,role:"list",children:[t.map((A,D)=>{const z=getIsFirstMessageBySender(A,M),L=getIsLastMessageBySender(A,D,t,i);M=A.sender.type;const U=D+1===k,V=D===0,Q=A._id||`added-${D}`;return jsxRuntimeExports.jsx(Message$1,{ref:U?w:null,message:A,commands:u,isFirstMessage:V,isLastMessage:U,isFirstMessageBySender:z,isLastMessageBySender:L,onButtonClick:p,onLinkClick:g,onReaction:c},Q)}),i&&jsxRuntimeExports.jsx(BotMessage,{ref:T,message:BotTypingMessage,isFirstMessage:!1,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:M!==UserType$1.BOT,isLastMessageBySender:!0,children:jsxRuntimeExports.jsx(TypingIndicator,{isTyping:!0})},"last")]})]})},getIsFirstMessageBySender=(t,i)=>!i||i!==t.sender.type,getIsLastMessageBySender=(t,i,u,c)=>{const p=t.sender.type,g=u.length;return i+1===g?!(p===UserType$1.BOT&&c):p!==u.at(i+1)?.sender.type},bottomSheet="_bottomSheet_jp8dl_1",bottomSheetOpen="_bottomSheetOpen_jp8dl_15",bottomSheetClose="_bottomSheetClose_jp8dl_20",bottomSheetStyles={bottomSheet,bottomSheetOpen,bottomSheetClose},container$4="_container_xc2nx_1",styles$c={container:container$4},Drawer=({contentUrl:t})=>{const i=useAppSelector(g=>g.connection.sessionId),[u,c]=reactExports.useState(!1);reactExports.useEffect(()=>{c(g=>g||!!t)},[t]);const p=reactExports.useMemo(()=>{if(t&&i){const g=new URL(t,document.baseURI);return g.searchParams.set("sessionId",i),g.toString()}else return},[t,i]);return jsxRuntimeExports.jsx("div",{className:clsx(styles$c.container,bottomSheetStyles.bottomSheet,{[bottomSheetStyles.bottomSheetOpen]:!!t,[bottomSheetStyles.bottomSheetClose]:u&&!t}),children:p&&jsxRuntimeExports.jsx("iframe",{title:"Drawer",id:"form-drawer",src:p,className:styles$c.iframe})})},container$3="_container_vvbth_1",styles$b={container:container$3},Link$1=({title:t,href:i,children:u})=>jsxRuntimeExports.jsx("a",{href:i,title:t,target:"_blank",rel:"noopener noreferrer",children:u}),PoweredBy=()=>{const i=useTranslation()("powered-by");return i&&i.length?jsxRuntimeExports.jsx("div",{className:clsx(styles$b.container,"chat__poweredBy"),children:jsxRuntimeExports.jsx(X5,{options:{overrides:{a:Link$1}},children:i})}):null},markdownToPlainText=t=>t.replace(/^#{1,6}\s+/gm,"").replace(/(\*\*|__)(.*?)\1/g,"$2").replace(/(\*|_)(.*?)\1/g,"$2").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^>\s+/gm,"").replace(/^(-{3,}|_{3,}|\*{3,})$/gm,"").replace(/^[\s]*[-*+]\s+/gm,"").replace(/^[\s]*\d+\.\s+/gm,"").replace(/\n{3,}/g,`
119
119
 
120
120
  `).trim(),ScreenReaderAnnouncer=({messages:t,isBotTyping:i})=>{const u=reactExports.useRef(""),c=useTranslation(),p=x=>{switch(x.type){case"TEXT":return x.text||"";case"MARKDOWN":{const E=x.markdown||"";return markdownToPlainText(E)}case"DETAIL":return x.text||x.title||"";default:return""}},v=(()=>{if(i)return c("chatbot.typing")??"Chatbot is typing";const x=[...t].reverse().find(E=>E.sender.type===UserType.BOT);return x?p(x):""})();return reactExports.useEffect(()=>{v!==u.current&&(u.current=v)},[v]),jsxRuntimeExports.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:v})},DefaultButton=({className:t,children:i,...u})=>jsxRuntimeExports.jsx(Button,{className:clsx(styles$g.buttonDefault,t),type:"button",...u,children:i}),PrimaryButton=({className:t,children:i,...u})=>jsxRuntimeExports.jsx(Button,{className:clsx(styles$g.buttonPrimary,t),...u,children:i}),container$2="_container_h23mk_1",formContainer="_formContainer_h23mk_17",emailInput="_emailInput_h23mk_22",description="_description_h23mk_52",actions$3="_actions_h23mk_57",validationError="_validationError_h23mk_67",submitted="_submitted_h23mk_74",styles$a={container:container$2,formContainer,emailInput,description,actions:actions$3,validationError,submitted},TranscriptExport=({visible:t,onEmailExport:i,onClose:u})=>{const c=useTranslation(),[p,g]=reactExports.useState(void 0),[v,x]=reactExports.useState(!1),[E,_]=reactExports.useState(void 0),T=reactExports.useRef(null);reactExports.useEffect(()=>{t?(T.current?.focus(),x(!1),g(t)):p===!0&&g(!1)},[t,p]);const w=M=>{M.preventDefault(),E&&E.length>0&&(i(E),x(!0),setTimeout(u,3*1e3))},R=M=>{const k=M.target.value.trim(),A=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(k);_(A?k:"")};return jsxRuntimeExports.jsxs("div",{className:clsx(styles$a.container,bottomSheetStyles.bottomSheet,{[bottomSheetStyles.bottomSheetOpen]:p===!0,[bottomSheetStyles.bottomSheetClose]:p===!1}),children:[jsxRuntimeExports.jsx("h2",{children:c("export-transcript.email.title")}),jsxRuntimeExports.jsx(X5,{className:styles$a.description,children:c("export-transcript.email.description")||""}),jsxRuntimeExports.jsxs("form",{onSubmit:w,className:styles$a.formContainer,children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("input",{disabled:v,ref:T,type:"email",placeholder:c("export-transcript.email.placeholder"),className:styles$a.emailInput,onChange:R}),E?.length===0?jsxRuntimeExports.jsx("div",{className:styles$a.validationError,children:c("export-transcript.email.invalid")}):null]}),jsxRuntimeExports.jsxs("div",{className:styles$a.actions,children:[jsxRuntimeExports.jsx(DefaultButton,{onClick:u,children:c("export-transcript.email.cancel")}),jsxRuntimeExports.jsx(PrimaryButton,{type:"submit",disabled:v||E===void 0||E.length===0,children:c("export-transcript.email.send")})]})]}),v&&jsxRuntimeExports.jsx("div",{className:styles$a.submitted,children:c("export-transcript.email.success")})]})},inputContainer="_inputContainer_fi5ao_1",styles$9={inputContainer},blockUserInput="_blockUserInput_pot9c_1",styles$8={blockUserInput},BlockUserInput=({visible:t})=>{const i=useTranslation();return t?jsxRuntimeExports.jsx("div",{className:clsx(styles$8.blockUserInput,"chat__blockUserInput"),children:i("block-user-input.title")}):null},commandsDropdown="_commandsDropdown_fmklx_1",commands="_commands_fmklx_1",command="_command_fmklx_1",commandActive="_commandActive_fmklx_49",style={commandsDropdown,commands,command,commandActive},useKeyboardEffect=(t,i,u,c,p)=>{reactExports.useEffect(()=>{const g=v=>{if(t.length)switch(v.key){case"Enter":u(t[i]);break;case"ArrowUp":c(x=>x>0?x-1:t.length-1);break;case"ArrowDown":c(x=>x<t.length-1?x+1:0);break;case"Escape":p([]);break}};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[t,i,u,c,p])},CommandsDropdown=({text:t,commands:i,onSelectCommand:u,onVisibilityChange:c})=>{const p=reactExports.useRef(null),g=useTranslation(),[v,x]=reactExports.useState([]),[E,_]=reactExports.useState(calcMaxCommandLength(i)),[T,w]=reactExports.useState(0),R=M=>u(`/${M}`);return useClickOutsideEventListener(p,()=>x([])),useKeyboardEffect(v,T,R,w,x),reactExports.useEffect(()=>{_(calcMaxCommandLength(i))},[i]),reactExports.useEffect(()=>{const M=t.length||0;M===0||M>E||!t.startsWith("/")?x([]):x(i.filter(byText(t))),w(0)},[i,t,E]),reactExports.useEffect(()=>{c(!!v.length)},[v,c]),v.length?jsxRuntimeExports.jsx("div",{ref:p,className:style.commandsDropdown,children:jsxRuntimeExports.jsx("ul",{id:"command-list",className:style.commands,role:"listbox",children:v.map((M,k)=>jsxRuntimeExports.jsxs("li",{className:clsx([style.command,T===k&&style.commandActive]),role:"option",onClick:()=>R(M),onMouseOver:()=>w(k),children:[jsxRuntimeExports.jsxs("h1",{children:["/",M]}),jsxRuntimeExports.jsx("p",{children:g(`commands.${M}`)})]},M))})}):null},calcMaxCommandLength=t=>Math.max(...t.map(i=>i.length+1)),byText=t=>i=>{const u=`/${i}`;return u.startsWith(t)&&u.length>=t.length},callToActionContainer="_callToActionContainer_d8izj_1",callToActionTitle="_callToActionTitle_d8izj_23",rateOverlay="_rateOverlay_d8izj_30",body$1="_body_d8izj_52",footer$1="_footer_d8izj_60",actions$2="_actions_d8izj_75",bubbles="_bubbles_d8izj_89",stars="_stars_d8izj_191",starsSmall="_starsSmall_d8izj_205",starsLarge="_starsLarge_d8izj_211",star="_star_d8izj_191",starReadonly="_starReadonly_d8izj_225",starIcon="_starIcon_d8izj_235",starsDescriptionContainer="_starsDescriptionContainer_d8izj_253",starsDescription="_starsDescription_d8izj_253",styles$7={callToActionContainer,callToActionTitle,rateOverlay,body:body$1,footer:footer$1,actions:actions$2,bubbles,stars,starsSmall,starsLarge,star,starReadonly,starIcon,starsDescriptionContainer,starsDescription},Star=({value:t,index:i,count:u,readonly:c,onHover:p,onClick:g})=>{const v=x=>{g&&x.key==="Enter"&&g()};return jsxRuntimeExports.jsx("li",{className:clsx(styles$7.star,{[styles$7.starReadonly]:c},"chat__conversationRating__star"),children:jsxRuntimeExports.jsx("div",{role:"radio","aria-checked":t>i?"true":"false","aria-posinset":i+1,"aria-setsize":u,tabIndex:0,onMouseOver:p,onKeyDown:v,onClick:g,children:jsxRuntimeExports.jsx("span",{role:"img","aria-label":"Star",className:clsx(styles$7.starIcon),children:jsxRuntimeExports.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"star",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:jsxRuntimeExports.jsx("path",{d:"M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"})})})})})},STAR_COUNT=5,Stars=({value:t,size:i,readonly:u=!1,onChange:c})=>{const[p,g]=reactExports.useState(void 0),v=()=>{g(void 0)},x=_=>()=>{if(!u){const T=_+1;g(T)}},E=_=>()=>{c&&!u&&(c(_===0&&t===1?0:_+1),g(void 0))};return jsxRuntimeExports.jsx("ul",{tabIndex:0,role:"radiogroup",className:clsx(styles$7.stars,{[styles$7.starsSmall]:i==="small",[styles$7.starsLarge]:i==="large"},"chat__conversationRating__stars",{chat__conversationRating__stars__small:i==="small",chat__conversationRating__stars__large:i==="large"}),onMouseOut:v,children:Array(STAR_COUNT).fill(0).map((_,T)=>jsxRuntimeExports.jsx(Star,{value:p===void 0?t:p,index:T,count:STAR_COUNT,readonly:u,onHover:x(T),onClick:E(T)},T))})},CallToAction=({visible:t,onRate:i})=>{const u=useTranslation();return t?jsxRuntimeExports.jsxs("div",{className:clsx(styles$7.callToActionContainer,"chat__conversationRating__callToAction"),children:[jsxRuntimeExports.jsx("div",{className:clsx(styles$7.callToActionTitle,"chat__conversationRating__callToAction__title"),children:u("conversation-rating.call-to-action.title")}),jsxRuntimeExports.jsx(Stars,{value:0,size:"small",onChange:i})]}):null},BotBubble=({isFirstMessageBySender:t,isLastMessageBySender:i,children:u})=>jsxRuntimeExports.jsxs("div",{className:clsx(styles$k.message,styles$k.messageBot,t&&styles$k.messageBotFirst,i&&styles$k.messageBotLast,"chat__bubbleContainer","chat__botBubbleContainer",t&&"chat__bubbleContainer--first",i&&"chat__bubbleContainer--last"),children:[jsxRuntimeExports.jsx("img",{className:clsx(styles$k.avatar,styles$k.botAvatar),src:"bot.svg",alt:"Bot"}),jsxRuntimeExports.jsx("div",{className:clsx(styles$k.bubble,styles$k.bubbleLeft,"chat__bubble","chat__botBubble"),children:jsxRuntimeExports.jsx("div",{className:clsx(styles$k.leftText,styles$k.bubbleContent),children:u})})]}),GuestBubble=({children:t})=>jsxRuntimeExports.jsx("div",{className:clsx(styles$k.message,styles$k.messageGuest,styles$k.messageGuestFirst,styles$k.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer","chat__bubbleContainer--first","chat__bubbleContainer--last"),children:jsxRuntimeExports.jsx("div",{className:clsx(styles$k.bubble,styles$k.bubbleRight,"chat__bubble","chat__guestBubble"),children:jsxRuntimeExports.jsx("div",{className:clsx(styles$k.rightText,styles$k.bubbleContent),children:t})})}),RateOverlay=()=>{const t=useTranslation(),i=useAppDispatch(),u=useAppSelector(D=>D.chat.conversationRating),[c,p]=reactExports.useState(u.rating?.value||0),[g,v]=reactExports.useState(void 0),[x,E]=reactExports.useState(void 0),[_,T]=reactExports.useState({submitted:!1,feedback:""}),w=reactExports.useRef(null),[R,M]=reactExports.useState(!1);reactExports.useEffect(()=>{u.opener?(T({submitted:!1,feedback:""}),E(!0)):x===!0&&E(!1)},[u.opener,x]),reactExports.useEffect(()=>{p(u.rating?.value||0)},[u.rating?.value,u.opener]),reactExports.useEffect(()=>{w.current&&(w.current.value=u.rating?.feedback||"")},[u.rating?.feedback]),reactExports.useEffect(()=>{const D=c>0?t(`conversation-rating.overlay.bot-message.rate-feedback.value-${c}`):void 0;v(D?.length?D:void 0)},[c,t]),reactExports.useEffect(()=>{_.submitted?setTimeout(()=>M(!0),_.feedback.length?500:0):M(!1)},[_]);const k=D=>{D.preventDefault();const z=w.current?.value?.trim()||"";i(handleRatingFromUser(c,z)),T({submitted:!0,feedback:z})},A=()=>{u.opener==="CLOSE_CHAT"?i(closeChatWindow()):u.opener==="RESTART_CHAT"?i(restartChat()):i(hideConversationRatingOverlay())};return jsxRuntimeExports.jsx("div",{className:clsx(styles$7.rateOverlay,bottomSheetStyles.bottomSheet,"chat__conversationRating__overlay",{[bottomSheetStyles.bottomSheetOpen]:x===!0,[bottomSheetStyles.bottomSheetClose]:x===!1}),children:jsxRuntimeExports.jsxs("form",{onSubmit:k,children:[jsxRuntimeExports.jsxs("div",{className:clsx(styles$7.body,"chat__conversationRating__overlay__body"),children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{className:clsx(styles$7.bubbles),children:u.opener&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(BotBubble,{isFirstMessageBySender:!0,isLastMessageBySender:!g,children:[jsxRuntimeExports.jsx("h2",{children:t("conversation-rating.overlay.title")}),jsxRuntimeExports.jsxs("div",{className:clsx(styles$7.starsDescriptionContainer),children:[jsxRuntimeExports.jsx(Stars,{value:c,size:"large",readonly:_.submitted,onChange:p}),jsxRuntimeExports.jsxs("div",{className:clsx(styles$7.starsDescription),children:[jsxRuntimeExports.jsx("div",{children:t("conversation-rating.overlay.star.very-bad")}),jsxRuntimeExports.jsx("div",{children:t("conversation-rating.overlay.star.very-good")})]})]})]}),g&&jsxRuntimeExports.jsx(BotBubble,{isFirstMessageBySender:!1,isLastMessageBySender:!R||!!_.feedback.length,children:jsxRuntimeExports.jsx("div",{children:g})}),!!_.feedback.length&&jsxRuntimeExports.jsx(GuestBubble,{children:_.feedback}),R&&jsxRuntimeExports.jsx(BotBubble,{isFirstMessageBySender:!!_.feedback.length,isLastMessageBySender:!0,children:jsxRuntimeExports.jsx("div",{children:t("conversation-rating.overlay.bot-message.submit-feedback")})})]})})]}),jsxRuntimeExports.jsxs("div",{className:clsx(styles$7.footer,"chat__conversationRating__overlay__footer"),children:[!_.submitted&&jsxRuntimeExports.jsx("input",{ref:w,defaultValue:u.rating?.feedback||"",placeholder:t("conversation-rating.overlay.guest-feedback.input-placeholder")}),jsxRuntimeExports.jsxs("div",{className:clsx(styles$7.actions,"chat__conversationRating__overlay__footer__actions"),children:[_.submitted?jsxRuntimeExports.jsx(PrimaryButton,{type:"button",disabled:!c,onClick:A,children:u.opener==="CLOSE_CHAT"?t("conversation-rating.overlay.action.close-chat"):u.opener==="RESTART_CHAT"?t("conversation-rating.overlay.action.restart-chat"):t("conversation-rating.overlay.action.back-to-chat")},"close-button"):jsxRuntimeExports.jsx(PrimaryButton,{type:"submit",disabled:!c,children:t("conversation-rating.overlay.action.submit")},"submit-button"),u.opener!=="CHAT"&&!_.submitted&&jsxRuntimeExports.jsx(DefaultButton,{onClick:A,children:u.opener==="CLOSE_CHAT"?t("conversation-rating.overlay.action.close-chat"):u.opener==="RESTART_CHAT"?t("conversation-rating.overlay.action.restart-chat"):t("conversation-rating.overlay.action.cancel")})]})]})]})})},ConversationRating=({numberOfMessagesFromGuest:t})=>{const i=useAppDispatch(),u=useAppSelector(g=>g.chat.conversationRating),c=g=>{i(showConversationRatingOverlay("CHAT",g))},p=!u.rating?.value&&t>=1;return u.enabled?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(CallToAction,{visible:p,onRate:c}),jsxRuntimeExports.jsx(RateOverlay,{})]}):null},ConversationRating$1=reactExports.memo(ConversationRating),inputWrapper="_inputWrapper_m3q4d_1",withOpenCommands="_withOpenCommands_m3q4d_13",actions$1="_actions_m3q4d_18",messageInputWrapper="_messageInputWrapper_m3q4d_53",messageInput="_messageInput_m3q4d_53",buttons="_buttons_m3q4d_78",button="_button_m3q4d_78",styles$6={inputWrapper,withOpenCommands,actions:actions$1,messageInputWrapper,messageInput,buttons,button},audioRecorder="_audioRecorder_g845f_1",audioButton="_audioButton_g845f_6",recorderIcon="_recorderIcon_g845f_37",spinning="_spinning_g845f_60",styles$5={audioRecorder,audioButton,recorderIcon,spinning},BUFFER_SIZE=2048,OUTPUT_SAMPLE_RATE=16e3;class AudioRecorder extends React.Component{audioInput=null;volume=null;leftchannel=[];recorder=null;recordingLength=0;sampleRate=null;mediaStream=null;constructor(i){super(i),this.state={recordingState:"none"},this.triggerAudioRecording=this.triggerAudioRecording.bind(this),this.triggerAudioRecordingSuccess=this.triggerAudioRecordingSuccess.bind(this),this.initRecording=this.initRecording.bind(this),this.processRecordingInput=this.processRecordingInput.bind(this),this.handleClickSubmitAudio=this.handleClickSubmitAudio.bind(this),this.handleClickStopAudio=this.handleClickStopAudio.bind(this)}triggerAudioRecording(){this.setState({recordingState:"connecting"}),navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(this.triggerAudioRecordingSuccess)}triggerAudioRecordingSuccess(i){this.mediaStream=i,this.leftchannel.length=0,this.recordingLength=0,this.initRecording(i)}initRecording(i){const u=window.AudioContext||window.webkitAudioContext,c=new u;this.sampleRate=c.sampleRate,this.volume=c.createGain(),this.audioInput=c.createMediaStreamSource(i),this.audioInput.connect(this.volume),this.recorder=c.createScriptProcessor(BUFFER_SIZE,1,1),this.recorder.onaudioprocess=this.processRecordingInput,this.volume.connect(this.recorder),this.recorder.connect(c.destination)}processRecordingInput(i){if(this.state.recordingState==="connecting"&&this.setState({recordingState:"recording"}),this.state.recordingState!=="none"){const u=i.inputBuffer.getChannelData(0);this.leftchannel.push(new Float32Array(u)),this.recordingLength+=BUFFER_SIZE}}handleClickSubmitAudio(){const i=mergeBuffers(this.leftchannel,this.recordingLength),u=downsampleBuffer(i,this.sampleRate||0),c=createWav(u);this.props.onAudioRecorded(c),this.handleClickStopAudio()}handleClickStopAudio(){this.setState({recordingState:"none"}),this.audioInput?.disconnect(),this.volume?.disconnect(),this.recorder?.disconnect(),this.mediaStream&&this.mediaStream?.getAudioTracks().forEach(i=>{i.stop()})}render(){return jsxRuntimeExports.jsxs("div",{className:styles$5.audioRecorder,children:[this.state.recordingState==="none"&&jsxRuntimeExports.jsx("button",{className:clsx(styles$5.audioButton,"chat__button"),type:"submit","aria-label":this.props.translate("message-input.actions.start-audio-recording.label"),"data-title":this.props.translate("message-input.actions.start-audio-recording.label"),tabIndex:0,onClick:this.triggerAudioRecording,children:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[jsxRuntimeExports.jsx("path",{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"}),jsxRuntimeExports.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),this.state.recordingState==="connecting"&&jsxRuntimeExports.jsxs("svg",{className:styles$5.spinning,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[jsxRuntimeExports.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),jsxRuntimeExports.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]}),this.state.recordingState==="recording"&&jsxRuntimeExports.jsxs("div",{className:styles$5.audioRecorder,children:[jsxRuntimeExports.jsx("button",{className:clsx(styles$5.audioButton),onClick:this.handleClickStopAudio,"aria-label":this.props.translate("message-input.actions.stop-audio-recording.label"),tabIndex:0,children:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[jsxRuntimeExports.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),jsxRuntimeExports.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),jsxRuntimeExports.jsx("div",{className:styles$5.recorderIcon}),jsxRuntimeExports.jsx("button",{className:clsx(styles$5.audioButton),type:"submit",onClick:this.handleClickSubmitAudio,"aria-label":this.props.translate("message-input.actions.submit-audio-recording.label"),tabIndex:0,autoFocus:!0,children:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[jsxRuntimeExports.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),jsxRuntimeExports.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})]})})]})]})}}const createWav=t=>{const i=new ArrayBuffer(44+t.length*2),u=new DataView(i);writeUTFBytes(u,0,"RIFF"),u.setUint32(4,44+t.length*2,!0),writeUTFBytes(u,8,"WAVE"),writeUTFBytes(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,1,!0),u.setUint32(24,OUTPUT_SAMPLE_RATE,!0),u.setUint32(28,OUTPUT_SAMPLE_RATE*4,!0),u.setUint16(32,4,!0),u.setUint16(34,16,!0),writeUTFBytes(u,36,"data"),u.setUint32(40,t.length*2,!0);const c=t.length;let p=44;const g=1;for(let v=0;v<c;v++)u.setInt16(p,t[v]*(32767*g),!0),p+=2;return new Blob([u],{type:"audio/wav"})},writeUTFBytes=(t,i,u)=>{for(let c=0;c<u.length;c++)t.setUint8(i+c,u.charCodeAt(c))},mergeBuffers=(t,i)=>{const u=new Float32Array(i);let c=0;const p=t.length;for(let g=0;g<p;g++){const v=t[g];u.set(v,c),c+=v.length}return u},downsampleBuffer=(t,i)=>{if(OUTPUT_SAMPLE_RATE===i)return t;const u=i/OUTPUT_SAMPLE_RATE,c=Math.round(t.length/u),p=new Float32Array(c);let g=0,v=0;for(;g<p.length;){const x=Math.round((g+1)*u);let E=0,_=0;for(let T=v;T<x&&T<t.length;T++)E+=t[T],_++;p[g]=E/_,g++,v=x}return p},CommandButton=({onClick:t})=>{const i=useTranslation();return jsxRuntimeExports.jsxs("button",{onClick:t,type:"button","aria-label":i("message-input.actions.command.label"),children:[jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",fill:"#000000",viewBox:"0 0 256 256",children:[jsxRuntimeExports.jsx("rect",{x:"32",y:"32",width:"192",height:"192",rx:"16",ry:"16",fill:"none",stroke:"currentColor","stroke-width":"16"}),jsxRuntimeExports.jsx("line",{x1:"80",y1:"176",x2:"176",y2:"80",stroke:"currentColor","stroke-width":"16","stroke-linecap":"round"})]}),jsxRuntimeExports.jsx("span",{children:i("message-input.actions.command.label")})]})},TextInput=({disabled:t,textInput:i,commandsVisible:u,hasCommands:c,onTextInput:p,onTextInputSubmit:g,onAudioRecorded:v})=>{const x=useTranslation(),E=reactExports.useRef(null),{enableSpeechSupport:_}=useAppSelector(A=>A.settings);reactExports.useEffect(()=>{E.current?.focus()},[i]);const T=()=>{const A=E.current;A&&i.trim().length>=1&&g(i.trim())&&(A.value="",A.style.height="",A.focus())},w=A=>{A.preventDefault(),T()},R=A=>{const D=A.target.value;p(D),A.target.style.height="";const{scrollHeight:z}=A.target;A.target.style.height=`${z>150?150:z}px`},M=A=>{A.code==="Enter"&&!A.shiftKey?(A.repeat||T(),A.preventDefault()):u&&(A.code==="ArrowUp"||A.code==="ArrowDown")&&A.preventDefault()},k=()=>{i.startsWith("/")?p(""):p("/")};return jsxRuntimeExports.jsxs("form",{className:clsx(styles$6.inputWrapper,u&&styles$6.withOpenCommands,"chat__textInput"),onSubmit:w,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.messageInputWrapper,children:[jsxRuntimeExports.jsx("textarea",{id:"user_input",ref:E,className:styles$6.messageInput,tabIndex:0,placeholder:x("message-input-placeholder"),value:i,onChange:R,onKeyDown:M,"aria-label":x("message-input-label"),"aria-controls":c?"command-list":void 0,"aria-haspopup":c?"listbox":void 0}),c&&jsxRuntimeExports.jsx("div",{className:styles$6.actions,children:jsxRuntimeExports.jsx(CommandButton,{onClick:k})})]}),jsxRuntimeExports.jsx("div",{className:clsx(styles$6.buttons,"chat__buttons"),children:i.length||!_||navigator.mediaDevices===void 0?jsxRuntimeExports.jsx("button",{className:clsx(styles$6.button,"chat__button"),type:"submit","aria-label":x("message-input.actions.submit.label"),"data-title":x("message-input.actions.submit.label"),tabIndex:0,disabled:t,children:jsxRuntimeExports.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:jsxRuntimeExports.jsx("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})})}):_&&navigator.mediaDevices!==void 0&&jsxRuntimeExports.jsx(AudioRecorder,{translate:x,onAudioRecorded:v})})]})},quickReplies="_quickReplies_83npe_1",quickReply="_quickReply_83npe_9",styles$4={quickReplies,quickReply},QuickReplies=({quickReplies:t,onQuickReplyClick:i})=>t.length?jsxRuntimeExports.jsx("div",{className:clsx(styles$4.quickReplies,"chat__quickReplies"),children:t.map(u=>jsxRuntimeExports.jsx(Button,{tabIndex:0,className:clsx(styles$4.quickReply,"chat__button","chat__quickReply"),onClick:()=>i(u),children:u.label},u.label))}):null,MIN_USER_BLOCKED_TIME=5e3,MIN_TIME_BETWEEN_USER_REQUESTS=1e3,UserInput=({isBotTyping:t,quickReplies:i,numberOfMessagesFromGuest:u,commands:c,onTextInput:p,onQuickReplyClick:g,onAudioRecorded:v})=>{const[x,E]=reactExports.useState(""),[_,T]=reactExports.useState(!1),[w,R]=reactExports.useState(!1),M=reactExports.useRef(0),k=reactExports.useRef(0);reactExports.useEffect(()=>{if(_&&!t){const z=M.current?Date.now()-M.current:0;z>MIN_USER_BLOCKED_TIME?T(!1):setTimeout(()=>{T(!1)},MIN_USER_BLOCKED_TIME-z)}},[_,t]),reactExports.useEffect(()=>{_&&(M.current=Date.now())},[_]);const A=z=>{const L=Date.now()-k.current<MIN_TIME_BETWEEN_USER_REQUESTS;return w?!1:t||L?(T(!0),!1):(p(z),E(""),k.current=Date.now(),!0)},D=z=>{E(z+" ")};return jsxRuntimeExports.jsxs("div",{className:clsx(styles$9.inputContainer),children:[jsxRuntimeExports.jsx(QuickReplies,{quickReplies:i,onQuickReplyClick:g}),jsxRuntimeExports.jsx(BlockUserInput,{visible:_}),!_&&jsxRuntimeExports.jsx(ConversationRating$1,{numberOfMessagesFromGuest:u}),!!c?.length&&jsxRuntimeExports.jsx(CommandsDropdown,{text:x,commands:c,onSelectCommand:D,onVisibilityChange:R}),jsxRuntimeExports.jsx(TextInput,{textInput:x,disabled:_,commandsVisible:w,hasCommands:!!c?.length,onTextInput:E,onTextInputSubmit:A,onAudioRecorded:v})]})},ChatComponent=({clientName:t,messages:i,quickReplies:u,isBotTyping:c,drawerContentUrl:p,onMessageFromUser:g,onQuickReplyClick:v,onButtonClick:x,onLinkClick:E,onAudioRecorded:_,onTranscriptExport:T,onTranscriptItemReaction:w})=>{const R=useAppDispatch(),M=useAppSelector(V=>V.connection.connectionState),{enableTranscriptExportEmail:k,commands:A}=useAppSelector(V=>V.settings),{showTranscriptMailOverlay:D,conversationRating:z}=useAppSelector(V=>V.chat),L=i.filter(V=>V.sender.type===UserType.GUEST).length;reactExports.useEffect(()=>{M===ConnectionStateEnum.CONNECTED&&R(startChat(t))},[t,M,R]);const U=()=>{R(toggleTranscriptMailOverlay())};return jsxRuntimeExports.jsxs("div",{className:styles$n.container,children:[jsxRuntimeExports.jsx(ScreenReaderAnnouncer,{messages:i,isBotTyping:c}),jsxRuntimeExports.jsxs("div",{className:clsx([styles$n.chatcontent,(D||z?.opener)&&styles$n.accessabilityHidden]),children:[jsxRuntimeExports.jsx(Conversation,{messages:i,isBotTyping:c,commands:A,onButtonClick:x,onLinkClick:E,onTranscriptItemReaction:w}),jsxRuntimeExports.jsx(UserInput,{isBotTyping:c,quickReplies:c?[]:u,numberOfMessagesFromGuest:L,commands:A,onQuickReplyClick:v,onTextInput:g,onAudioRecorded:_}),jsxRuntimeExports.jsx(PoweredBy,{})]}),k&&jsxRuntimeExports.jsx(TranscriptExport,{visible:!!D,onEmailExport:T,onClose:U}),jsxRuntimeExports.jsx(Drawer,{contentUrl:p})]})},mapStateToProps=t=>{const{messages:i,quickReplies:u,isBotTyping:c,drawerContentUrl:p}=t.chat;return{messages:i,quickReplies:u,isBotTyping:c,drawerContentUrl:p}},bindAction=t=>({onRestartChat:()=>t(restartChat()),onMessageFromUser:i=>t(sendMessageFromUser(i)),onAudioRecorded:i=>t(sendAudioMessageFromUser(i)),onActionFromUser:i=>t(i),onQuickReplyClick:i=>t(handleQuickReplyClick(i)),onNluEvent:i=>t(requestNLUEvent(i)),onButtonClick:i=>t(handleButtonClick(i)),onLinkClick:i=>t(handleLinkClick(i)),onTranscriptExport:i=>t(exportTranscript(i)),onTranscriptItemReaction:(i,u)=>{t(transcriptItemGuestReaction(i,u?.type||null,u?.category,u?.comment))}}),Chat=connect_default(mapStateToProps,bindAction)(ChatComponent),useIsInIframe=()=>reactExports.useMemo(()=>{try{return window.self!==window.top}catch{return!0}},[]),onButtonKeyDownHandler=t=>i=>{const u=i.key;(u==="ArrowDown"||u==="ArrowRight"||u==="Enter"||u===" "||u==="Space")&&(i.stopPropagation(),t())},CloseChatWindowButton=({onClick:t})=>{const i=useTranslation();return useIsInIframe()?jsxRuntimeExports.jsx("button",{className:"tooltip--bottom-left","aria-label":i("header.close-chat"),"data-title":i("header.close-chat"),tabIndex:0,onClick:t,onKeyDown:onButtonKeyDownHandler(t),children:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"})})}):null},header="_header_3gvbz_1",logoContainer="_logoContainer_3gvbz_14",logo="_logo_3gvbz_14",actions="_actions_3gvbz_28",active="_active_3gvbz_43",menuContainer="_menuContainer_3gvbz_56",menu="_menu_3gvbz_56",divider="_divider_3gvbz_86",styles$3={header,logoContainer,logo,actions,active,menuContainer,menu,divider},MenuItemIcon=({icon:t})=>{switch(t){case"arrow-counter-clockwise":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"})});case"download":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"})});case"expand":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M214,48V96a6,6,0,0,1-12,0V62.48l-53.76,53.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM107.76,139.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l53.76-53.76a6,6,0,0,0-8.48-8.48Z"})});case"mail":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"})});case"phone":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M144.27,45.93a8,8,0,0,1,9.8-5.66,86.22,86.22,0,0,1,61.66,61.66,8,8,0,0,1-5.66,9.8A8.23,8.23,0,0,1,208,112a8,8,0,0,1-7.73-5.94,70.35,70.35,0,0,0-50.33-50.33A8,8,0,0,1,144.27,45.93Zm-2.33,41.8c13.79,3.68,22.65,12.54,26.33,26.33A8,8,0,0,0,176,120a8.23,8.23,0,0,0,2.07-.27,8,8,0,0,0,5.66-9.8c-5.12-19.16-18.5-32.54-37.66-37.66a8,8,0,1,0-4.13,15.46Zm81.94,95.35A56.26,56.26,0,0,1,168,232C88.6,232,24,167.4,24,88A56.26,56.26,0,0,1,72.92,32.12a16,16,0,0,1,16.62,9.52l21.12,47.15,0,.12A16,16,0,0,1,109.39,104c-.18.27-.37.52-.57.77L88,129.45c7.49,15.22,23.41,31,38.83,38.51l24.34-20.71a8.12,8.12,0,0,1,.75-.56,16,16,0,0,1,15.17-1.4l.13.06,47.11,21.11A16,16,0,0,1,223.88,183.08Zm-15.88-2s-.07,0-.11,0h0l-47-21.05-24.35,20.71a8.44,8.44,0,0,1-.74.56,16,16,0,0,1-15.75,1.14c-18.73-9.05-37.4-27.58-46.46-46.11a16,16,0,0,1,1-15.7,6.13,6.13,0,0,1,.57-.77L96,95.15l-21-47a.61.61,0,0,1,0-.12A40.2,40.2,0,0,0,40,88,128.14,128.14,0,0,0,168,216,40.21,40.21,0,0,0,208,181.07Z"})});case"scroll":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M96,104a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H104A8,8,0,0,1,96,104Zm8,40h64a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16Zm128,48a32,32,0,0,1-32,32H88a32,32,0,0,1-32-32V64a16,16,0,0,0-32,0c0,5.74,4.83,9.62,4.88,9.66h0A8,8,0,0,1,24,88a7.89,7.89,0,0,1-4.79-1.61h0C18.05,85.54,8,77.61,8,64A32,32,0,0,1,40,32H176a32,32,0,0,1,32,32V168h8a8,8,0,0,1,4.8,1.6C222,170.46,232,178.39,232,192ZM96.26,173.48A8.07,8.07,0,0,1,104,168h88V64a16,16,0,0,0-16-16H67.69A31.71,31.71,0,0,1,72,64V192a16,16,0,0,0,32,0c0-5.74-4.83-9.62-4.88-9.66A7.82,7.82,0,0,1,96.26,173.48ZM216,192a12.58,12.58,0,0,0-3.23-8h-94a26.92,26.92,0,0,1,1.21,8,31.82,31.82,0,0,1-4.29,16H200A16,16,0,0,0,216,192Z"})});case"star":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"})});case"link":return jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"})});default:return jsxRuntimeExports.jsx("div",{})}},MenuItem=reactExports.forwardRef(({selected:t,item:i,onClick:u},c)=>{const p=useTranslation(),g=v=>{v.preventDefault(),u()};return jsxRuntimeExports.jsx("li",{"aria-selected":t,role:"option",className:i.withDivider?styles$3.divider:void 0,children:jsxRuntimeExports.jsxs("a",{ref:c,type:"button",role:"button",tabIndex:-1,onClick:g,children:[jsxRuntimeExports.jsx(MenuItemIcon,{icon:i.icon}),jsxRuntimeExports.jsx("span",{children:p(`header.menu.${i.id}`)})]})})}),useMenuItems=(t,i)=>{const u=useIsInIframe(),{menuItems:c,enableStandaloneView:p,enableTranscriptExportPdf:g,enableTranscriptExportEmail:v}=useAppSelector(_=>_.settings),x=useAppSelector(_=>_.chat.conversationRating.enabled);return reactExports.useMemo(()=>{const _=[],T=c.filter(({visibility:w})=>t?w==="always"||w==="chat-only":w==="always"||w==="start-screen-only");if(t&&(_.push({id:"restart-chat",type:"restart-chat",icon:"arrow-counter-clockwise",visibility:"chat-only"}),u&&p&&_.push({id:"expand-chat-window",type:"expand-chat-window",icon:"expand",visibility:"always"}),i&&g&&_.push({id:"download-transcript",type:"download-transcript",icon:"download",visibility:"chat-only"}),i&&v&&_.push({id:"send-transcript",type:"send-transcript",icon:"mail",visibility:"chat-only"}),i&&x&&_.push({id:"rate-conversation",type:"rate-conversation",icon:"star",visibility:"chat-only"}),_.length>0&&T.length)){const w=_.pop();w&&c.length&&_.push({...w,withDivider:!0})}return _.push(...T),_},[t,i,g,v,p,x,u,c])},Menu=({chatStarted:t,hasGuestMessages:i})=>{const u=useAppDispatch(),c=useTranslation(),{enabled:p,opener:g}=useAppSelector(L=>L.chat.conversationRating),[v,x]=reactExports.useState(!1),[E,_]=reactExports.useState(-1),T=reactExports.useRef(null),w=reactExports.useRef(null),R=reactExports.useRef([]),M=useMenuItems(t,i);reactExports.useEffect(()=>{R.current[E]?.focus()},[E]);const k=reactExports.useCallback(()=>{u(i&&p&&!g?showConversationRatingOverlay("RESTART_CHAT"):restartChat()),x(!1),_(0)},[i,p,g,u]),A=reactExports.useCallback(L=>{switch(L.type){case"restart-chat":{k();break}case"expand-chat-window":{const U=new URL(window.location.origin);U.pathname=window.location.pathname,U.search=window.location.search,U.hash=window.location.hash,window.open(U.href,"_blank");break}case"download-transcript":{u(downloadTranscriptPdf());break}case"send-transcript":{u(toggleTranscriptMailOverlay());break}case"rate-conversation":{u(showConversationRatingOverlay("MENU"));break}case"link":{u(handleLinkClick(L.url));break}case"action":{u(JSON.parse(JSON.stringify(L.action)));break}}x(!1)},[u,k,x]);reactExports.useEffect(()=>{const L=U=>{if(v)switch(U.key){case"Enter":U.preventDefault(),A(M[E]);break;case"ArrowUp":_(V=>V>0?V-1:M.length-1);break;case"ArrowDown":_(V=>V<M.length-1?V+1:0);break;case"Escape":x(!1);break;case"Tab":E>-1&&x(!1);break}};return document.addEventListener("keydown",L),()=>{document.removeEventListener("keydown",L)}},[v,E,M,_,x,A]),reactExports.useEffect(()=>{v||_(-1)},[v,E]),useClickOutsideEventListener(w,()=>x(!1));const D=()=>{x(L=>!L)},z=()=>{setTimeout(()=>{const L=document.activeElement;w.current&&!w.current.contains(L)&&x(!1)},0)};return M.length?jsxRuntimeExports.jsxs("div",{className:clsx(styles$3.menuContainer),ref:w,children:[jsxRuntimeExports.jsx("button",{ref:T,className:clsx(v&&styles$3.active,v?"tooltip-hidden":"tooltip--bottom-left"),"aria-label":c("header.menu.title"),"data-title":c("header.menu.title"),onClick:D,onBlur:z,children:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"})})}),v&&jsxRuntimeExports.jsx("nav",{className:styles$3.menu,"aria-label":c("header.menu.title"),children:jsxRuntimeExports.jsx("ul",{tabIndex:0,children:M.map((L,U)=>jsxRuntimeExports.jsx(MenuItem,{ref:V=>{R.current[U]=V},selected:E===U,item:L,onClick:()=>A(L)},L.id))})})]}):null},Header$1=({className:t,chatStarted:i,...u})=>{const c=useAppDispatch(),p=useAppSelector(x=>x.chat.conversationRating),g=useAppSelector(x=>x.chat.messages.some(E=>E.sender.type===UserType$1.GUEST)),v=()=>{p.enabled&&!p.opener&&g?c(showConversationRatingOverlay("CLOSE_CHAT")):c(closeChatWindow())};return jsxRuntimeExports.jsxs("div",{className:clsx(styles$3.header,t),...u,children:[jsxRuntimeExports.jsx("div",{className:styles$3.logoContainer,children:jsxRuntimeExports.jsx("div",{className:styles$3.logo})}),jsxRuntimeExports.jsxs("div",{className:styles$3.actions,children:[jsxRuntimeExports.jsx(Menu,{chatStarted:i,hasGuestMessages:g}),jsxRuntimeExports.jsx(CloseChatWindowButton,{onClick:v})]})]})},chatwindow="_chatwindow_rkbir_1",chatwindowWithAside="_chatwindowWithAside_rkbir_21",styles$2={chatwindow,chatwindowWithAside},useIsSmallScreen=()=>{const[t,i]=reactExports.useState(!1);return reactExports.useEffect(()=>{const u=window.matchMedia("(max-width: 1023px)"),c=()=>i(u.matches);return c(),u.addEventListener("change",c),()=>u.removeEventListener("change",c)},[]),t},sourceInfos="_sourceInfos_vei0l_1",waitForLoading="_waitForLoading_vei0l_24",loadingContent="_loadingContent_vei0l_28",sourceHeader="_sourceHeader_vei0l_37",sourceHeaderIcon="_sourceHeaderIcon_vei0l_57",sourceContent="_sourceContent_vei0l_61",openSourceButton="_openSourceButton_vei0l_69",sourceButtonLabel="_sourceButtonLabel_vei0l_79",closeSourceInfosButton="_closeSourceInfosButton_vei0l_101",loadingSourceInfos="_loadingSourceInfos_vei0l_125",loading="_loading_vei0l_28",loadingError="_loadingError_vei0l_139",highlightLoadingInfo="_highlightLoadingInfo_vei0l_155",highlightLoadingInfoInnerContainer="_highlightLoadingInfoInnerContainer_vei0l_169",highlightLoadingInfoContent="_highlightLoadingInfoContent_vei0l_178",highlightLoadingInfoCloseIcon="_highlightLoadingInfoCloseIcon_vei0l_198",highlightLoader="_highlightLoader_vei0l_203",highlightLoaderLoading="_highlightLoaderLoading_vei0l_210",styles$1={sourceInfos,waitForLoading,loadingContent,sourceHeader,sourceHeaderIcon,sourceContent,openSourceButton,sourceButtonLabel,closeSourceInfosButton,loadingSourceInfos,loading,loadingError,highlightLoadingInfo,highlightLoadingInfoInnerContainer,highlightLoadingInfoContent,highlightLoadingInfoCloseIcon,highlightLoader,highlightLoaderLoading},CloseSourceInfosButton=({onClick:t})=>{const i=useTranslation();return jsxRuntimeExports.jsx("button",{className:clsx(styles$1.closeSourceInfosButton,"tooltip--bottom-left"),"aria-label":i("source-infos.close"),"data-title":i("source-infos.close"),tabIndex:0,onClick:t,children:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})})},Header=reactExports.forwardRef(({sourceInfos:t,onClose:i,...u},c)=>jsxRuntimeExports.jsxs("div",{className:styles$1.sourceHeader,...u,ref:c,children:[jsxRuntimeExports.jsx("div",{children:t?jsxRuntimeExports.jsx("p",{id:"source-info-title",children:t.title}):jsxRuntimeExports.jsx("p",{children:" "})}),jsxRuntimeExports.jsx(CloseSourceInfosButton,{onClick:i})]})),HighlightLoader=({loading:t})=>jsxRuntimeExports.jsx("div",{className:styles$1.highlightLoader,children:t&&jsxRuntimeExports.jsx("div",{className:styles$1.highlightLoaderLoading})});const{entries,setPrototypeOf,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create}=Object,{apply,construct}=typeof Reflect<"u"&&Reflect;freeze||(freeze=function(i){return i});seal||(seal=function(i){return i});apply||(apply=function(i,u){for(var c=arguments.length,p=new Array(c>2?c-2:0),g=2;g<c;g++)p[g-2]=arguments[g];return i.apply(u,p)});construct||(construct=function(i){for(var u=arguments.length,c=new Array(u>1?u-1:0),p=1;p<u;p++)c[p-1]=arguments[p];return new i(...c)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var u=arguments.length,c=new Array(u>1?u-1:0),p=1;p<u;p++)c[p-1]=arguments[p];return apply(t,i,c)}}function unconstruct(t){return function(){for(var i=arguments.length,u=new Array(i),c=0;c<i;c++)u[c]=arguments[c];return construct(t,u)}}function addToSet(t,i){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:stringToLowerCase;setPrototypeOf&&setPrototypeOf(t,null);let c=i.length;for(;c--;){let p=i[c];if(typeof p=="string"){const g=u(p);g!==p&&(isFrozen(i)||(i[c]=g),p=g)}t[p]=!0}return t}function cleanArray(t){for(let i=0;i<t.length;i++)objectHasOwnProperty(t,i)||(t[i]=null);return t}function clone(t){const i=create(null);for(const[u,c]of entries(t))objectHasOwnProperty(t,u)&&(Array.isArray(c)?i[u]=cleanArray(c):c&&typeof c=="object"&&c.constructor===Object?i[u]=clone(c):i[u]=c);return i}function lookupGetter(t,i){for(;t!==null;){const c=getOwnPropertyDescriptor(t,i);if(c){if(c.get)return unapply(c.get);if(typeof c.value=="function")return unapply(c.value)}t=getPrototypeOf(t)}function u(){return null}return u}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE={element:1,text:3,progressingInstruction:7,comment:8,document:9},getGlobal=function t(){return typeof window>"u"?null:window},_createTrustedTypesPolicy=function t(i,u){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let c=null;const p="data-tt-policy-suffix";u&&u.hasAttribute(p)&&(c=u.getAttribute(p));const g="dompurify"+(c?"#"+c:"");try{return i.createPolicy(g,{createHTML(v){return v},createScriptURL(v){return v}})}catch{return console.warn("TrustedTypes policy "+g+" could not be created."),null}},_createHooksMap=function t(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function createDOMPurify(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:getGlobal();const i=xe=>createDOMPurify(xe);if(i.version="3.3.1",i.removed=[],!t||!t.document||t.document.nodeType!==NODE_TYPE.document||!t.Element)return i.isSupported=!1,i;let{document:u}=t;const c=u,p=c.currentScript,{DocumentFragment:g,HTMLTemplateElement:v,Node:x,Element:E,NodeFilter:_,NamedNodeMap:T=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:w,DOMParser:R,trustedTypes:M}=t,k=E.prototype,A=lookupGetter(k,"cloneNode"),D=lookupGetter(k,"remove"),z=lookupGetter(k,"nextSibling"),L=lookupGetter(k,"childNodes"),U=lookupGetter(k,"parentNode");if(typeof v=="function"){const xe=u.createElement("template");xe.content&&xe.content.ownerDocument&&(u=xe.content.ownerDocument)}let V,Q="";const{implementation:Z,createNodeIterator:F,createDocumentFragment:Y,getElementsByTagName:ne}=u,{importNode:fe}=c;let oe=_createHooksMap();i.isSupported=typeof entries=="function"&&typeof U=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:le,ERB_EXPR:Se,TMPLIT_EXPR:ve,DATA_ATTR:_e,ARIA_ATTR:K,IS_SCRIPT_OR_DATA:pe,ATTR_WHITESPACE:te,CUSTOM_ELEMENT:Re}=EXPRESSIONS;let{IS_ALLOWED_URI:Ae}=EXPRESSIONS,H=null;const ie=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let ue=null;const be=addToSet({},[...html,...svg,...mathMl,...xml]);let me=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ee=null,Te=null;const ke=Object.seal(create(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Me=!0,Ve=!0,ft=!1,je=!0,vt=!1,At=!0,Ue=!1,dt=!1,un=!1,_n=!1,Ye=!1,Zt=!1,wt=!0,cn=!1;const Tt="user-content-";let ot=!0,An=!1,Xt={},Dt=null;const Pt=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pn=null;const mn=addToSet({},["audio","video","img","source","image","track"]);let Yn=null;const at=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gn="http://www.w3.org/1998/Math/MathML",bt="http://www.w3.org/2000/svg",pt="http://www.w3.org/1999/xhtml";let tt=pt,nt=!1,fn=null;const yn=addToSet({},[gn,bt,pt],stringToString);let qt=addToSet({},["mi","mo","mn","ms","mtext"]),rt=addToSet({},["annotation-xml"]);const Jt=addToSet({},["title","style","font","a","script"]);let Ct=null;const Cn=["application/xhtml+xml","text/html"],On="text/html";let mt=null,dn=null;const Kn=u.createElement("form"),wn=function(q){return q instanceof RegExp||q instanceof Function},Zn=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(dn&&dn===q)){if((!q||typeof q!="object")&&(q={}),q=clone(q),Ct=Cn.indexOf(q.PARSER_MEDIA_TYPE)===-1?On:q.PARSER_MEDIA_TYPE,mt=Ct==="application/xhtml+xml"?stringToString:stringToLowerCase,H=objectHasOwnProperty(q,"ALLOWED_TAGS")?addToSet({},q.ALLOWED_TAGS,mt):ie,ue=objectHasOwnProperty(q,"ALLOWED_ATTR")?addToSet({},q.ALLOWED_ATTR,mt):be,fn=objectHasOwnProperty(q,"ALLOWED_NAMESPACES")?addToSet({},q.ALLOWED_NAMESPACES,stringToString):yn,Yn=objectHasOwnProperty(q,"ADD_URI_SAFE_ATTR")?addToSet(clone(at),q.ADD_URI_SAFE_ATTR,mt):at,pn=objectHasOwnProperty(q,"ADD_DATA_URI_TAGS")?addToSet(clone(mn),q.ADD_DATA_URI_TAGS,mt):mn,Dt=objectHasOwnProperty(q,"FORBID_CONTENTS")?addToSet({},q.FORBID_CONTENTS,mt):Pt,Ee=objectHasOwnProperty(q,"FORBID_TAGS")?addToSet({},q.FORBID_TAGS,mt):clone({}),Te=objectHasOwnProperty(q,"FORBID_ATTR")?addToSet({},q.FORBID_ATTR,mt):clone({}),Xt=objectHasOwnProperty(q,"USE_PROFILES")?q.USE_PROFILES:!1,Me=q.ALLOW_ARIA_ATTR!==!1,Ve=q.ALLOW_DATA_ATTR!==!1,ft=q.ALLOW_UNKNOWN_PROTOCOLS||!1,je=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,vt=q.SAFE_FOR_TEMPLATES||!1,At=q.SAFE_FOR_XML!==!1,Ue=q.WHOLE_DOCUMENT||!1,_n=q.RETURN_DOM||!1,Ye=q.RETURN_DOM_FRAGMENT||!1,Zt=q.RETURN_TRUSTED_TYPE||!1,un=q.FORCE_BODY||!1,wt=q.SANITIZE_DOM!==!1,cn=q.SANITIZE_NAMED_PROPS||!1,ot=q.KEEP_CONTENT!==!1,An=q.IN_PLACE||!1,Ae=q.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,tt=q.NAMESPACE||pt,qt=q.MATHML_TEXT_INTEGRATION_POINTS||qt,rt=q.HTML_INTEGRATION_POINTS||rt,me=q.CUSTOM_ELEMENT_HANDLING||{},q.CUSTOM_ELEMENT_HANDLING&&wn(q.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(me.tagNameCheck=q.CUSTOM_ELEMENT_HANDLING.tagNameCheck),q.CUSTOM_ELEMENT_HANDLING&&wn(q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(me.attributeNameCheck=q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),vt&&(Ve=!1),Ye&&(_n=!0),Xt&&(H=addToSet({},text),ue=[],Xt.html===!0&&(addToSet(H,html$1),addToSet(ue,html)),Xt.svg===!0&&(addToSet(H,svg$1),addToSet(ue,svg),addToSet(ue,xml)),Xt.svgFilters===!0&&(addToSet(H,svgFilters),addToSet(ue,svg),addToSet(ue,xml)),Xt.mathMl===!0&&(addToSet(H,mathMl$1),addToSet(ue,mathMl),addToSet(ue,xml))),q.ADD_TAGS&&(typeof q.ADD_TAGS=="function"?ke.tagCheck=q.ADD_TAGS:(H===ie&&(H=clone(H)),addToSet(H,q.ADD_TAGS,mt))),q.ADD_ATTR&&(typeof q.ADD_ATTR=="function"?ke.attributeCheck=q.ADD_ATTR:(ue===be&&(ue=clone(ue)),addToSet(ue,q.ADD_ATTR,mt))),q.ADD_URI_SAFE_ATTR&&addToSet(Yn,q.ADD_URI_SAFE_ATTR,mt),q.FORBID_CONTENTS&&(Dt===Pt&&(Dt=clone(Dt)),addToSet(Dt,q.FORBID_CONTENTS,mt)),q.ADD_FORBID_CONTENTS&&(Dt===Pt&&(Dt=clone(Dt)),addToSet(Dt,q.ADD_FORBID_CONTENTS,mt)),ot&&(H["#text"]=!0),Ue&&addToSet(H,["html","head","body"]),H.table&&(addToSet(H,["tbody"]),delete Ee.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');V=q.TRUSTED_TYPES_POLICY,Q=V.createHTML("")}else V===void 0&&(V=_createTrustedTypesPolicy(M,p)),V!==null&&typeof Q=="string"&&(Q=V.createHTML(""));freeze&&freeze(q),dn=q}},Ut=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),$t=addToSet({},[...mathMl$1,...mathMlDisallowed]),vn=function(q){let ge=U(q);(!ge||!ge.tagName)&&(ge={namespaceURI:tt,tagName:"template"});const ye=stringToLowerCase(q.tagName),De=stringToLowerCase(ge.tagName);return fn[q.namespaceURI]?q.namespaceURI===bt?ge.namespaceURI===pt?ye==="svg":ge.namespaceURI===gn?ye==="svg"&&(De==="annotation-xml"||qt[De]):!!Ut[ye]:q.namespaceURI===gn?ge.namespaceURI===pt?ye==="math":ge.namespaceURI===bt?ye==="math"&&rt[De]:!!$t[ye]:q.namespaceURI===pt?ge.namespaceURI===bt&&!rt[De]||ge.namespaceURI===gn&&!qt[De]?!1:!$t[ye]&&(Jt[ye]||!Ut[ye]):!!(Ct==="application/xhtml+xml"&&fn[q.namespaceURI]):!1},Nt=function(q){arrayPush(i.removed,{element:q});try{U(q).removeChild(q)}catch{D(q)}},Ie=function(q,ge){try{arrayPush(i.removed,{attribute:ge.getAttributeNode(q),from:ge})}catch{arrayPush(i.removed,{attribute:null,from:ge})}if(ge.removeAttribute(q),q==="is")if(_n||Ye)try{Nt(ge)}catch{}else try{ge.setAttribute(q,"")}catch{}},kt=function(q){let ge=null,ye=null;if(un)q="<remove></remove>"+q;else{const Ce=stringMatch(q,/^[\r\n\t ]+/);ye=Ce&&Ce[0]}Ct==="application/xhtml+xml"&&tt===pt&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const De=V?V.createHTML(q):q;if(tt===pt)try{ge=new R().parseFromString(De,Ct)}catch{}if(!ge||!ge.documentElement){ge=Z.createDocument(tt,"template",null);try{ge.documentElement.innerHTML=nt?Q:De}catch{}}const He=ge.body||ge.documentElement;return q&&ye&&He.insertBefore(u.createTextNode(ye),He.childNodes[0]||null),tt===pt?ne.call(ge,Ue?"html":"body")[0]:Ue?ge.documentElement:He},tn=function(q){return F.call(q.ownerDocument||q,q,_.SHOW_ELEMENT|_.SHOW_COMMENT|_.SHOW_TEXT|_.SHOW_PROCESSING_INSTRUCTION|_.SHOW_CDATA_SECTION,null)},It=function(q){return q instanceof w&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof T)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},ht=function(q){return typeof x=="function"&&q instanceof x};function Ke(xe,q,ge){arrayForEach(xe,ye=>{ye.call(i,q,ge,dn)})}const nn=function(q){let ge=null;if(Ke(oe.beforeSanitizeElements,q,null),It(q))return Nt(q),!0;const ye=mt(q.nodeName);if(Ke(oe.uponSanitizeElement,q,{tagName:ye,allowedTags:H}),At&&q.hasChildNodes()&&!ht(q.firstElementChild)&&regExpTest(/<[/\w!]/g,q.innerHTML)&&regExpTest(/<[/\w!]/g,q.textContent)||q.nodeType===NODE_TYPE.progressingInstruction||At&&q.nodeType===NODE_TYPE.comment&&regExpTest(/<[/\w]/g,q.data))return Nt(q),!0;if(!(ke.tagCheck instanceof Function&&ke.tagCheck(ye))&&(!H[ye]||Ee[ye])){if(!Ee[ye]&&Ze(ye)&&(me.tagNameCheck instanceof RegExp&&regExpTest(me.tagNameCheck,ye)||me.tagNameCheck instanceof Function&&me.tagNameCheck(ye)))return!1;if(ot&&!Dt[ye]){const De=U(q)||q.parentNode,He=L(q)||q.childNodes;if(He&&De){const Ce=He.length;for(let Ne=Ce-1;Ne>=0;--Ne){const We=A(He[Ne],!0);We.__removalCount=(q.__removalCount||0)+1,De.insertBefore(We,z(q))}}}return Nt(q),!0}return q instanceof E&&!vn(q)||(ye==="noscript"||ye==="noembed"||ye==="noframes")&&regExpTest(/<\/no(script|embed|frames)/i,q.innerHTML)?(Nt(q),!0):(vt&&q.nodeType===NODE_TYPE.text&&(ge=q.textContent,arrayForEach([le,Se,ve],De=>{ge=stringReplace(ge,De," ")}),q.textContent!==ge&&(arrayPush(i.removed,{element:q.cloneNode()}),q.textContent=ge)),Ke(oe.afterSanitizeElements,q,null),!1)},Lt=function(q,ge,ye){if(wt&&(ge==="id"||ge==="name")&&(ye in u||ye in Kn))return!1;if(!(Ve&&!Te[ge]&&regExpTest(_e,ge))){if(!(Me&&regExpTest(K,ge))){if(!(ke.attributeCheck instanceof Function&&ke.attributeCheck(ge,q))){if(!ue[ge]||Te[ge]){if(!(Ze(q)&&(me.tagNameCheck instanceof RegExp&&regExpTest(me.tagNameCheck,q)||me.tagNameCheck instanceof Function&&me.tagNameCheck(q))&&(me.attributeNameCheck instanceof RegExp&&regExpTest(me.attributeNameCheck,ge)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(ge,q))||ge==="is"&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&regExpTest(me.tagNameCheck,ye)||me.tagNameCheck instanceof Function&&me.tagNameCheck(ye))))return!1}else if(!Yn[ge]){if(!regExpTest(Ae,stringReplace(ye,te,""))){if(!((ge==="src"||ge==="xlink:href"||ge==="href")&&q!=="script"&&stringIndexOf(ye,"data:")===0&&pn[q])){if(!(ft&&!regExpTest(pe,stringReplace(ye,te,"")))){if(ye)return!1}}}}}}}return!0},Ze=function(q){return q!=="annotation-xml"&&stringMatch(q,Re)},jn=function(q){Ke(oe.beforeSanitizeAttributes,q,null);const{attributes:ge}=q;if(!ge||It(q))return;const ye={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ue,forceKeepAttr:void 0};let De=ge.length;for(;De--;){const He=ge[De],{name:Ce,namespaceURI:Ne,value:We}=He,Et=mt(Ce),ze=We;let ut=Ce==="value"?ze:stringTrim(ze);if(ye.attrName=Et,ye.attrValue=ut,ye.keepAttr=!0,ye.forceKeepAttr=void 0,Ke(oe.uponSanitizeAttribute,q,ye),ut=ye.attrValue,cn&&(Et==="id"||Et==="name")&&(Ie(Ce,q),ut=Tt+ut),At&&regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i,ut)){Ie(Ce,q);continue}if(Et==="attributename"&&stringMatch(ut,"href")){Ie(Ce,q);continue}if(ye.forceKeepAttr)continue;if(!ye.keepAttr){Ie(Ce,q);continue}if(!je&&regExpTest(/\/>/i,ut)){Ie(Ce,q);continue}vt&&arrayForEach([le,Se,ve],Ot=>{ut=stringReplace(ut,Ot," ")});const Ge=mt(q.nodeName);if(!Lt(Ge,Et,ut)){Ie(Ce,q);continue}if(V&&typeof M=="object"&&typeof M.getAttributeType=="function"&&!Ne)switch(M.getAttributeType(Ge,Et)){case"TrustedHTML":{ut=V.createHTML(ut);break}case"TrustedScriptURL":{ut=V.createScriptURL(ut);break}}if(ut!==ze)try{Ne?q.setAttributeNS(Ne,Ce,ut):q.setAttribute(Ce,ut),It(q)?Nt(q):arrayPop(i.removed)}catch{Ie(Ce,q)}}Ke(oe.afterSanitizeAttributes,q,null)},Dn=function xe(q){let ge=null;const ye=tn(q);for(Ke(oe.beforeSanitizeShadowDOM,q,null);ge=ye.nextNode();)Ke(oe.uponSanitizeShadowNode,ge,null),nn(ge),jn(ge),ge.content instanceof g&&xe(ge.content);Ke(oe.afterSanitizeShadowDOM,q,null)};return i.sanitize=function(xe){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ge=null,ye=null,De=null,He=null;if(nt=!xe,nt&&(xe="<!-->"),typeof xe!="string"&&!ht(xe))if(typeof xe.toString=="function"){if(xe=xe.toString(),typeof xe!="string")throw typeErrorCreate("dirty is not a string, aborting")}else throw typeErrorCreate("toString is not a function");if(!i.isSupported)return xe;if(dt||Zn(q),i.removed=[],typeof xe=="string"&&(An=!1),An){if(xe.nodeName){const We=mt(xe.nodeName);if(!H[We]||Ee[We])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(xe instanceof x)ge=kt("<!---->"),ye=ge.ownerDocument.importNode(xe,!0),ye.nodeType===NODE_TYPE.element&&ye.nodeName==="BODY"||ye.nodeName==="HTML"?ge=ye:ge.appendChild(ye);else{if(!_n&&!vt&&!Ue&&xe.indexOf("<")===-1)return V&&Zt?V.createHTML(xe):xe;if(ge=kt(xe),!ge)return _n?null:Zt?Q:""}ge&&un&&Nt(ge.firstChild);const Ce=tn(An?xe:ge);for(;De=Ce.nextNode();)nn(De),jn(De),De.content instanceof g&&Dn(De.content);if(An)return xe;if(_n){if(Ye)for(He=Y.call(ge.ownerDocument);ge.firstChild;)He.appendChild(ge.firstChild);else He=ge;return(ue.shadowroot||ue.shadowrootmode)&&(He=fe.call(c,He,!0)),He}let Ne=Ue?ge.outerHTML:ge.innerHTML;return Ue&&H["!doctype"]&&ge.ownerDocument&&ge.ownerDocument.doctype&&ge.ownerDocument.doctype.name&&regExpTest(DOCTYPE_NAME,ge.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+ge.ownerDocument.doctype.name+`>
121
- `+Ne),vt&&arrayForEach([le,Se,ve],We=>{Ne=stringReplace(Ne,We," ")}),V&&Zt?V.createHTML(Ne):Ne},i.setConfig=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zn(xe),dt=!0},i.clearConfig=function(){dn=null,dt=!1},i.isValidAttribute=function(xe,q,ge){dn||Zn({});const ye=mt(xe),De=mt(q);return Lt(ye,De,ge)},i.addHook=function(xe,q){typeof q=="function"&&arrayPush(oe[xe],q)},i.removeHook=function(xe,q){if(q!==void 0){const ge=arrayLastIndexOf(oe[xe],q);return ge===-1?void 0:arraySplice(oe[xe],ge,1)[0]}return arrayPop(oe[xe])},i.removeHooks=function(xe){oe[xe]=[]},i.removeAllHooks=function(){oe=_createHooksMap()},i}var purify=createDOMPurify();const HighlightLoadingInfo=({onClose:t})=>{const i=useTranslation();return jsxRuntimeExports.jsxs("div",{className:styles$1.highlightLoadingInfo,onClick:t,children:[jsxRuntimeExports.jsx("div",{className:styles$1.highlightLoadingInfoCloseIcon,children:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})}),jsxRuntimeExports.jsxs("div",{className:styles$1.highlightLoadingInfoInnerContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.highlightLoadingInfoContent,children:[jsxRuntimeExports.jsx("h3",{children:i("source-infos.highlight-loading.title")}),jsxRuntimeExports.jsx("p",{children:i("source-infos.highlight-loading.description")})]}),jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"#000000",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M253.66,106.34a8,8,0,0,0-11.32,0L192,156.69,107.31,72l50.35-50.34a8,8,0,1,0-11.32-11.32L96,60.69A16,16,0,0,0,93.18,79.5L72,100.69a16,16,0,0,0,0,22.62L76.69,128,18.34,186.34a8,8,0,0,0,3.13,13.25l72,24A7.88,7.88,0,0,0,96,224a8,8,0,0,0,5.66-2.34L136,187.31l4.69,4.69a16,16,0,0,0,22.62,0l21.19-21.18A16,16,0,0,0,203.31,168l50.35-50.34A8,8,0,0,0,253.66,106.34ZM93.84,206.85l-55-18.35L88,139.31,124.69,176ZM152,180.69,83.31,112,104,91.31,172.69,160Z"})})]})]})},MarkdownLink=({title:t,href:i,children:u})=>jsxRuntimeExports.jsx("a",{href:i,title:t,target:"_blank",rel:"noopener noreferrer",children:u}),DefaultLinkButton=({className:t,children:i,...u})=>jsxRuntimeExports.jsx("a",{className:clsx(styles$g.button,styles$g.buttonDefault,t),type:"button",role:"button",...u,children:i}),Text=t=>jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...t,children:jsxRuntimeExports.jsx("path",{d:"M52,146H36a6,6,0,0,0-6,6v56a6,6,0,0,0,6,6H52a34,34,0,0,0,0-68Zm0,56H42V158H52a22,22,0,0,1,0,44Zm168.15-5.46a6,6,0,0,1,.18,8.48A28.06,28.06,0,0,1,200,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a28.06,28.06,0,0,1,20.33,9,6,6,0,0,1-8.66,8.3A16.23,16.23,0,0,0,200,158c-9.93,0-18,9.87-18,22s8.07,22,18,22a16.23,16.23,0,0,0,11.67-5.28A6,6,0,0,1,220.15,196.54ZM128,146c-16.54,0-30,15.25-30,34s13.46,34,30,34,30-15.25,30-34S144.54,146,128,146Zm0,56c-9.93,0-18-9.87-18-22s8.07-22,18-22,18,9.87,18,22S137.93,202,128,202ZM48,118a6,6,0,0,0,6-6V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72A6,6,0,0,0,48,118ZM158,46.48,193.52,82H158Z"})}),KnowledgeBaseTypeIcon=({type:t,...i})=>{switch(t){case"WEBSITE":return jsxRuntimeExports.jsx(Web,{...i});case"PDF":return jsxRuntimeExports.jsx(Pdf,{...i});case"DOCX":return jsxRuntimeExports.jsx(Docx,{...i});case"TEXT":return jsxRuntimeExports.jsx(Text,{...i});default:return jsxRuntimeExports.jsx(File$1,{...i})}},OpenButton=({url:t,knowledgeBaseType:i})=>{const u=useTranslation();return jsxRuntimeExports.jsx(DefaultLinkButton,{className:styles$1.openSourceButton,href:t,target:"_blank",children:jsxRuntimeExports.jsxs("div",{className:styles$1.sourceButtonLabel,children:[jsxRuntimeExports.jsx("div",{className:styles$1.sourceHeaderIcon,children:jsxRuntimeExports.jsx(KnowledgeBaseTypeIcon,{type:i})}),jsxRuntimeExports.jsx("p",{children:u("source-infos.open-source")})]})})},LoadedSourceInfos=({sourceInfos:{content:t,url:i,knowledgeBaseType:u,highlighted:c}})=>{const[p,g]=reactExports.useState(!c);reactExports.useEffect(()=>{c&&g(!1)},[c]);const v=purify.sanitize(t,{USE_PROFILES:{html:!0}});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:clsx(styles$1.sourceContent,markdownStyle.markdown),children:[jsxRuntimeExports.jsx(X5,{options:{overrides:{a:MarkdownLink}},children:v}),p&&jsxRuntimeExports.jsx(HighlightLoadingInfo,{onClose:()=>g(!1)})]}),jsxRuntimeExports.jsx(OpenButton,{url:i,knowledgeBaseType:u})]})},fixingError=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,LoadingError=()=>{const t=useTranslation();return jsxRuntimeExports.jsxs("div",{className:styles$1.loadingError,children:[jsxRuntimeExports.jsx("h1",{children:t("source-infos.error.title")}),jsxRuntimeExports.jsx("img",{src:fixingError,title:t("source-infos.error.title")}),jsxRuntimeExports.jsx("p",{children:t("source-infos.error.info")})]})},LoadingSourceInfos=()=>jsxRuntimeExports.jsx("div",{className:styles$1.loadingSourceInfos,children:jsxRuntimeExports.jsx("svg",{className:styles$1.loading,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"})})});function useSwipeToClose({sourceInfos:t,onClose:i,threshold:u=100}){const c=reactExports.useRef(null),[p,g]=reactExports.useState(0),[v,x]=reactExports.useState(!1),E=reactExports.useRef(null),_=reactExports.useRef(null),T=reactExports.useCallback(k=>{E.current=k,x(!0)},[]),w=reactExports.useCallback(k=>{if(E.current!==null&&v){const A=k-E.current;A>0&&g(A)}},[v]),R=reactExports.useCallback(()=>{x(!1),p>u&&i(),g(0),E.current=null},[p,u,i]),M=reactExports.useCallback(k=>{const A=Q=>T(Q.touches[0].clientY),D=Q=>w(Q.touches[0].clientY),z=()=>R(),L=Q=>{Q.preventDefault(),T(Q.clientY),window.addEventListener("mousemove",U),window.addEventListener("mouseup",V)},U=Q=>w(Q.clientY),V=()=>{R(),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",V)};k.addEventListener("touchstart",A),k.addEventListener("touchmove",D),k.addEventListener("touchend",z),k.addEventListener("mousedown",L),_.current=()=>{k.removeEventListener("touchstart",A),k.removeEventListener("touchmove",D),k.removeEventListener("touchend",z),k.removeEventListener("mousedown",L),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",V)}},[T,w,R]);return reactExports.useEffect(()=>{let k;return c.current?(_.current?.(),M(c.current)):(k=new MutationObserver(()=>{c.current&&(_.current?.(),M(c.current),k?.disconnect())}),k.observe(document.body,{childList:!0,subtree:!0})),()=>{k?.disconnect(),_.current?.()}},[M,t]),{ref:c,dragOffsetY:p,isDragging:v}}const useWaitForLoadingEffect=t=>{const[i,u]=reactExports.useState(!0);return reactExports.useEffect(()=>{let c=null;return t?.type==="loading"?(u(!0),c=setTimeout(()=>{u(!1)},300)):u(!t),()=>{c&&clearTimeout(c)}},[t]),i},SourceInfos=()=>{const t=useAppDispatch(),i=useAppSelector(E=>E.chat.sourceInfos),u=useIsSmallScreen(),c=reactExports.useRef(null),p=useWaitForLoadingEffect(i);reactExports.useEffect(()=>{c.current&&i?.type==="loading"&&(u?c.current.showModal():(c.current.setAttribute("open","true"),c.current?.focus()))},[i,u]);const g=reactExports.useCallback(()=>{c.current&&(u?c.current.close():c.current.removeAttribute("open"),t(closeSourceInfos()))},[t,u]),{ref:v,dragOffsetY:x}=useSwipeToClose({onClose:g,sourceInfos:i});return i?jsxRuntimeExports.jsx("dialog",{ref:c,className:clsx(styles$1.sourceInfos,p?styles$1.waitForLoading:i.type==="loading"?styles$1.loadingContent:""),style:u&&x?{transform:`translateY(${x}px)`}:{},onClose:g,autoFocus:!0,role:"dialog","aria-labelledby":"source-info-title",children:p?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Header,{ref:v,tabIndex:-1,sourceInfos:i.type==="loaded"?i:void 0,onClose:g}),i.type==="loading"?jsxRuntimeExports.jsx(LoadingSourceInfos,{}):i.type==="loading-error"?jsxRuntimeExports.jsx(LoadingError,{}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HighlightLoader,{loading:!i.highlighted}),jsxRuntimeExports.jsx(LoadedSourceInfos,{sourceInfos:i})]})]})}):null},container$1="_container_1aof3_1",body="_body_1aof3_7",intro="_intro_1aof3_14",footer="_footer_1aof3_39",footnote="_footnote_1aof3_43",containerWithFootnote="_containerWithFootnote_1aof3_58",startChatButton="_startChatButton_1aof3_73",spinner="_spinner_1aof3_88",formFields="_formFields_1aof3_92",formField="_formField_1aof3_92",radio="_radio_1aof3_104",checkbox="_checkbox_1aof3_111",input="_input_1aof3_119",inputLabel="_inputLabel_1aof3_153",selectWrapper="_selectWrapper_1aof3_157",select="_select_1aof3_157",selectLabel="_selectLabel_1aof3_203",styles={container:container$1,body,intro,footer,footnote,containerWithFootnote,startChatButton,spinner,formFields,formField,radio,checkbox,input,inputLabel,selectWrapper,select,selectLabel},Checkbox=({name:t,label:i,defaultValue:u,required:c,onChange:p})=>{const g=v=>{p(v.currentTarget.checked?"true":"false")};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.checkbox,"chat__startScreen__checkbox"),htmlFor:t,children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:t,name:t,defaultChecked:u==="true",required:c,onChange:g}),jsxRuntimeExports.jsx("div",{children:i})]})},Input=({type:t,name:i,label:u,defaultValue:c,placeholder:p,required:g,multiple:v,min:x,max:E,pattern:_,onChange:T})=>{const w=R=>{T(R.target.value)};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.input,"chat__startScreen__input"),htmlFor:i,children:[jsxRuntimeExports.jsx("div",{className:clsx(styles.inputLabel),children:u}),jsxRuntimeExports.jsx("input",{type:t,id:i,name:i,defaultValue:c,placeholder:p,required:g,multiple:v,min:x,max:E,pattern:_,onChange:w})]})},Radio=({name:t,value:i,label:u,defaultChecked:c,required:p,onChange:g})=>{const v=`${t}-${i}`,x=E=>{g(E.target.value)};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.radio,"chat__startScreen__radio"),htmlFor:v,children:[jsxRuntimeExports.jsx("input",{id:v,type:"radio",name:t,value:i,defaultChecked:c,required:p,onChange:x}),jsxRuntimeExports.jsx("span",{className:clsx(styles.label),children:u})]})},Select=({name:t,label:i,defaultValue:u,required:c,multiple:p,options:g,onChange:v})=>{const x=E=>{v(E.target.value)};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.select,"chat__startScreen__select"),htmlFor:t,children:[jsxRuntimeExports.jsx("div",{className:clsx(styles.selectLabel),children:i}),jsxRuntimeExports.jsx("div",{className:clsx(styles.selectWrapper),children:jsxRuntimeExports.jsx("select",{id:t,name:t,defaultValue:u,required:c,multiple:p,onChange:x,children:Object.entries(g||{}).map(([E,_])=>jsxRuntimeExports.jsx("option",{value:E,selected:_===u,children:_}))})})]})},INTRO_KEY="start-screen.intro",START_CHAT_KEY="start-screen.start-chat",WAITING_FOR_LOGIN_KEY="start-screen.waiting-for-login",FOOTNOTE_KEY="start-screen.footnote",FORM_KEY="start-screen.form",FORM_FIELDS_KEY=`${FORM_KEY}.fields`,StartScreen=()=>{const t=useTranslation(),i=useAppDispatch(),u=useClientName(),c=useAppSelector(k=>k.startScreen.loginRequestToken),p=useAppSelector(k=>k.settings.requiresUserAuthentication);reactExports.useEffect(()=>{let k;if(c){const z=window.screenX+(window.outerWidth-600)/2,L=window.screenY+(window.outerHeight-700)/2,U=encodeURIComponent(u),V=new URL(window.location.origin);V.pathname=`/${U}/auth/login`,V.searchParams.set("loginRequestToken",c);const Q=window.open(V.href,"Login",`width=600,height=700,left=${z},top=${L},resizable=yes,scrollbars=yes`);k=setInterval(()=>{Q?.closed&&(i(loginWindowClosed()),clearInterval(k))},500)}return()=>{k&&clearInterval(k)}},[u,c,i]);const[g,v]=reactExports.useState({}),x=()=>{const k=Object.entries(g).reduce((A,[D,z])=>({...A,[D]:z.value}),{});i(p?requestLogin({loginRequestToken:v4(),formValues:k}):startChat$1({formValues:k}))},E=t(INTRO_KEY),_=t(c?WAITING_FOR_LOGIN_KEY:START_CHAT_KEY),T=t(FOOTNOTE_KEY),w=reactExports.useMemo(()=>t(FORM_FIELDS_KEY)?.split(";").map(k=>k.trim())??[],[t(FORM_FIELDS_KEY)]);reactExports.useEffect(()=>{w.length&&Object.keys(g).length===0&&v(w.reduce((k,A)=>({...k,[A]:toFormField(A,t)}),{}))},[t,w,g]);const R=k=>{k.preventDefault(),x()},M=k=>A=>{v(D=>({...D,[k]:{...D[k],value:A}}))};return jsxRuntimeExports.jsxs("form",{onSubmit:R,className:clsx(styles.container,T&&styles.containerWithFootnote,"chat__startScreen"),children:[jsxRuntimeExports.jsxs("div",{className:clsx(styles.body,"chat__startScreen__body"),children:[E&&jsxRuntimeExports.jsx("div",{className:clsx(styles.intro,"chat__startScreen__intro"),children:jsxRuntimeExports.jsx(X5,{options:{overrides:{a:Link}},children:E})}),jsxRuntimeExports.jsx("div",{className:clsx(styles.formFields,"chat__startScreen__fields"),children:Object.values(g).map(({type:k,name:A,label:D,placeholder:z,defaultValue:L,options:U,required:V,multiple:Q,min:Z,max:F,pattern:Y})=>jsxRuntimeExports.jsx("div",{className:clsx(styles.formField,"chat__startScreen__field"),children:(()=>{switch(k){case"radio":return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{children:D}),Object.entries(U||{}).map(([ne,fe])=>jsxRuntimeExports.jsx(Radio,{name:A,value:ne,label:fe,defaultChecked:ne===L,required:V,onChange:M(A)},ne))]});case"checkbox":return jsxRuntimeExports.jsx(Checkbox,{name:A,label:D,defaultValue:L,required:V,onChange:M(A)});case"select":return jsxRuntimeExports.jsx(Select,{name:A,label:D,defaultValue:L,required:V,multiple:Q,options:U,onChange:M(A)});default:return jsxRuntimeExports.jsx(Input,{type:k,name:A,label:D,placeholder:z,defaultValue:L,required:V,multiple:Q,min:Z,max:F,pattern:Y,onChange:M(A)})}})()},A))})]}),jsxRuntimeExports.jsxs("div",{className:clsx(styles.footer,"chat__startScreen__footer"),children:[jsxRuntimeExports.jsxs(PrimaryButton,{type:"submit",className:styles.startChatButton,disabled:!!c,children:[!!c&&jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",className:styles.spinner,children:jsxRuntimeExports.jsx("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"})}),jsxRuntimeExports.jsx("div",{children:_})]}),T&&jsxRuntimeExports.jsx("div",{className:styles.footnote,children:jsxRuntimeExports.jsx(X5,{options:{overrides:{a:Link}},children:T})})]})]})},Link=({title:t,href:i,children:u})=>jsxRuntimeExports.jsx("a",{href:i,title:t,target:"_blank",rel:"noopener noreferrer",children:u}),toFormField=(t,i)=>{const u=i(`${FORM_KEY}.${t}.type`)||"text",c=i(`${FORM_KEY}.${t}.required`)==="true",p=i(`${FORM_KEY}.${t}.multiple`)==="true",g=i(`${FORM_KEY}.${t}.placeholder`),v=i(`${FORM_KEY}.${t}.label`)||"",x=i(`${FORM_KEY}.${t}.defaultValue`),E=i(`${FORM_KEY}.${t}.min`),_=i(`${FORM_KEY}.${t}.max`),T=i(`${FORM_KEY}.${t}.pattern`),w=toFormFieldOptions(i(`${FORM_KEY}.${t}.options`));return{name:t,label:v,placeholder:g,value:getTypeSpecificValue(u,x,w)||"",defaultValue:x,options:w,type:u,required:c,multiple:p,min:E,max:_,pattern:T}},getTypeSpecificValue=(t,i,u)=>i||t==="select"&&Object.keys(u)[0]||"",toFormFieldOptions=(t="")=>t.split(";").map(i=>i.trim()).reduce((i,u)=>{const[c,p]=u.split(":").map(g=>g.trim());return{...i,[c]:p}},{}),useSetDocumentLanguageEffect=()=>{const t=useAppSelector(i=>i.intl.locale);reactExports.useEffect(()=>{window.document.documentElement.lang=t},[t])},INCOMMING_EVENTS={TRIGGER_ACTION:"TRIGGER_ACTION",TRIGGER_STORY:"TRIGGER_STORY",CHAT_MESSAGE_FROM_GUEST:"CHAT_MESSAGE_FROM_GUEST",ON_CHAT_WINDOW_OPEN:"ON_CHAT_WINDOW_OPEN",ON_CHAT_WINDOW_CLOSE:"ON_CHAT_WINDOW_CLOSE",RESTART_CHAT:"RESTART_CHAT"},RootScene=({clientName:t})=>{useSetDocumentLanguageEffect();const i=useAppDispatch(),u=useAppSelector(T=>T.intl.messages),c=useTranslation(),p=useAppSelector(T=>T.settings.enableStartScreen),g=useAppSelector(T=>T.startScreen.startScreenStatus),v=useAppSelector(T=>T.connection.queryString),x=reactExports.useMemo(()=>new URLSearchParams(v||"?").get("cssClassName"),[v]);reactExports.useEffect(()=>{const T=new URLSearchParams(v||""),w=Object.fromEntries(T.entries()),R=M=>{if(M.origin!==window.location.origin&&M.source!==window.parent){console.warn("Rejected postMessage from untrusted origin:",M.origin);return}switch(M.data.type){case INCOMMING_EVENTS.TRIGGER_ACTION:i(M.data.action);break;case INCOMMING_EVENTS.TRIGGER_STORY:i(requestNLUEvent(M.data.story));break;case INCOMMING_EVENTS.ON_CHAT_WINDOW_OPEN:i({type:"webclient.chatwindow.opened"});break;case INCOMMING_EVENTS.ON_CHAT_WINDOW_CLOSE:i({type:"webclient.chatwindow.closed"});break;case INCOMMING_EVENTS.CHAT_MESSAGE_FROM_GUEST:i(sendMessageFromUser(M.data.text));break;case INCOMMING_EVENTS.RESTART_CHAT:i(restartChat());break}};return i(connect(t,w)),window.addEventListener("message",R,!1),()=>window.removeEventListener("message",R)},[t,v,i]),reactExports.useEffect(()=>{const T=c("page.title");T&&document&&(document.title=T)},[u,c]);const E=p===void 0,_=p===!1||g==="HIDDEN";return jsxRuntimeExports.jsx("div",{className:clsx(styles$2.chatwindow,_&&styles$2.chatwindowWithAside,"chat__chatwindow",x),children:E?null:_?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("header",{children:jsxRuntimeExports.jsx(Header$1,{chatStarted:!0})}),jsxRuntimeExports.jsx("main",{children:jsxRuntimeExports.jsx(Chat,{clientName:t})}),jsxRuntimeExports.jsx("aside",{children:jsxRuntimeExports.jsx(SourceInfos,{})})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("header",{children:jsxRuntimeExports.jsx(Header$1,{chatStarted:!1})}),jsxRuntimeExports.jsx("main",{children:jsxRuntimeExports.jsx(StartScreen,{})})]})})},App=()=>{const t=useClientName(),i=useIsSmallScreen();return jsxRuntimeExports.jsx("div",{className:clsx([styles$o.app,i?"chat__small":"chat__large"]),children:jsxRuntimeExports.jsx(RootScene,{clientName:t})})},de={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht eingeben","message-input.actions.submit.label":"Nachricht senden","message-input.actions.start-audio-recording.label":"Spracheingabe starten","message-input.actions.stop-audio-recording.label":"Spracheingabe stoppen","message-input.actions.submit-audio-recording.label":"Spracheingabe übermitteln","message-input.actions.command.label":"Aktion ausführen","guest-bubble.label":"Ihre Nachricht","bot-bubble.label":"Nachricht des Chatbots","bot-bubble.actions.label":"Nachricht-Aktionen","bot-bubble.reaction.good":"Gefällt mir","bot-bubble.reaction.bad":"Gefällt mir nicht","bot-bubble.reaction.remove":"Markierung entfernen","bot-bubble.reaction.say-more":"Erzähle mir bitte mehr","bot-bubble.reaction.category.WRONG_INFORMATION":"Falsch","bot-bubble.reaction.category.MISSING_INFORMATION":"Unvollständig","bot-bubble.reaction.category.OLD_INFORMATION":"Veraltet","bot-bubble.reaction.category.UNCLEAR":"Unklar","bot-bubble.reaction.category.OFF_TOPIC":"Nicht zur Frage passend","bot-bubble.reaction.comment":"Gedanken mit mir teilen...","bot-bubble.reaction.close":"Schliessen","bot-bubble.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","agent-bubble.label":"Nachricht des Live-Agenten","conversation.label":"Chat Verlauf","chatbot.typing":"Chatbot schreibt","export-transcript.email.title":"Chatverlauf per E-Mail versenden","export-transcript.email.description":"Bitte E-Mail-Adresse angeben, an die der Chatverlauf gesendet werden soll.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Der Chatverlauf wurde an die hinterlegte E-Mail-Adresse übermittelt.","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
121
+ `+Ne),vt&&arrayForEach([le,Se,ve],We=>{Ne=stringReplace(Ne,We," ")}),V&&Zt?V.createHTML(Ne):Ne},i.setConfig=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zn(xe),dt=!0},i.clearConfig=function(){dn=null,dt=!1},i.isValidAttribute=function(xe,q,ge){dn||Zn({});const ye=mt(xe),De=mt(q);return Lt(ye,De,ge)},i.addHook=function(xe,q){typeof q=="function"&&arrayPush(oe[xe],q)},i.removeHook=function(xe,q){if(q!==void 0){const ge=arrayLastIndexOf(oe[xe],q);return ge===-1?void 0:arraySplice(oe[xe],ge,1)[0]}return arrayPop(oe[xe])},i.removeHooks=function(xe){oe[xe]=[]},i.removeAllHooks=function(){oe=_createHooksMap()},i}var purify=createDOMPurify();const HighlightLoadingInfo=({onClose:t})=>{const i=useTranslation();return jsxRuntimeExports.jsxs("div",{className:styles$1.highlightLoadingInfo,onClick:t,children:[jsxRuntimeExports.jsx("div",{className:styles$1.highlightLoadingInfoCloseIcon,children:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})}),jsxRuntimeExports.jsxs("div",{className:styles$1.highlightLoadingInfoInnerContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.highlightLoadingInfoContent,children:[jsxRuntimeExports.jsx("h3",{children:i("source-infos.highlight-loading.title")}),jsxRuntimeExports.jsx("p",{children:i("source-infos.highlight-loading.description")})]}),jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"#000000",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M253.66,106.34a8,8,0,0,0-11.32,0L192,156.69,107.31,72l50.35-50.34a8,8,0,1,0-11.32-11.32L96,60.69A16,16,0,0,0,93.18,79.5L72,100.69a16,16,0,0,0,0,22.62L76.69,128,18.34,186.34a8,8,0,0,0,3.13,13.25l72,24A7.88,7.88,0,0,0,96,224a8,8,0,0,0,5.66-2.34L136,187.31l4.69,4.69a16,16,0,0,0,22.62,0l21.19-21.18A16,16,0,0,0,203.31,168l50.35-50.34A8,8,0,0,0,253.66,106.34ZM93.84,206.85l-55-18.35L88,139.31,124.69,176ZM152,180.69,83.31,112,104,91.31,172.69,160Z"})})]})]})},MarkdownLink=({title:t,href:i,children:u})=>jsxRuntimeExports.jsx("a",{href:i,title:t,target:"_blank",rel:"noopener noreferrer",children:u}),DefaultLinkButton=({className:t,children:i,...u})=>jsxRuntimeExports.jsx("a",{className:clsx(styles$g.button,styles$g.buttonDefault,t),type:"button",role:"button",...u,children:i}),Text=t=>jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...t,children:jsxRuntimeExports.jsx("path",{d:"M52,146H36a6,6,0,0,0-6,6v56a6,6,0,0,0,6,6H52a34,34,0,0,0,0-68Zm0,56H42V158H52a22,22,0,0,1,0,44Zm168.15-5.46a6,6,0,0,1,.18,8.48A28.06,28.06,0,0,1,200,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a28.06,28.06,0,0,1,20.33,9,6,6,0,0,1-8.66,8.3A16.23,16.23,0,0,0,200,158c-9.93,0-18,9.87-18,22s8.07,22,18,22a16.23,16.23,0,0,0,11.67-5.28A6,6,0,0,1,220.15,196.54ZM128,146c-16.54,0-30,15.25-30,34s13.46,34,30,34,30-15.25,30-34S144.54,146,128,146Zm0,56c-9.93,0-18-9.87-18-22s8.07-22,18-22,18,9.87,18,22S137.93,202,128,202ZM48,118a6,6,0,0,0,6-6V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72A6,6,0,0,0,48,118ZM158,46.48,193.52,82H158Z"})}),KnowledgeBaseTypeIcon=({type:t,...i})=>{switch(t){case"WEBSITE":return jsxRuntimeExports.jsx(Web,{...i});case"PDF":return jsxRuntimeExports.jsx(Pdf,{...i});case"DOCX":return jsxRuntimeExports.jsx(Docx,{...i});case"TEXT":return jsxRuntimeExports.jsx(Text,{...i});default:return jsxRuntimeExports.jsx(File$1,{...i})}},OpenButton=({url:t,knowledgeBaseType:i})=>{const u=useTranslation();return jsxRuntimeExports.jsx(DefaultLinkButton,{className:styles$1.openSourceButton,href:t,target:"_blank",children:jsxRuntimeExports.jsxs("div",{className:styles$1.sourceButtonLabel,children:[jsxRuntimeExports.jsx("div",{className:styles$1.sourceHeaderIcon,children:jsxRuntimeExports.jsx(KnowledgeBaseTypeIcon,{type:i})}),jsxRuntimeExports.jsx("p",{children:u("source-infos.open-source")})]})})},LoadedSourceInfos=({sourceInfos:{content:t,url:i,knowledgeBaseType:u,highlighted:c}})=>{const[p,g]=reactExports.useState(!c);reactExports.useEffect(()=>{c&&g(!1)},[c]);const v=purify.sanitize(t,{USE_PROFILES:{html:!0}});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:clsx(styles$1.sourceContent,markdownStyle.markdown),children:[jsxRuntimeExports.jsx(X5,{options:{overrides:{a:MarkdownLink}},children:v}),p&&jsxRuntimeExports.jsx(HighlightLoadingInfo,{onClose:()=>g(!1)})]}),jsxRuntimeExports.jsx(OpenButton,{url:i,knowledgeBaseType:u})]})},fixingError=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,LoadingError=()=>{const t=useTranslation();return jsxRuntimeExports.jsxs("div",{className:styles$1.loadingError,children:[jsxRuntimeExports.jsx("h1",{children:t("source-infos.error.title")}),jsxRuntimeExports.jsx("img",{src:fixingError,title:t("source-infos.error.title")}),jsxRuntimeExports.jsx("p",{children:t("source-infos.error.info")})]})},LoadingSourceInfos=()=>jsxRuntimeExports.jsx("div",{className:styles$1.loadingSourceInfos,children:jsxRuntimeExports.jsx("svg",{className:styles$1.loading,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:jsxRuntimeExports.jsx("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"})})});function useSwipeToClose({sourceInfos:t,onClose:i,threshold:u=100}){const c=reactExports.useRef(null),[p,g]=reactExports.useState(0),[v,x]=reactExports.useState(!1),E=reactExports.useRef(null),_=reactExports.useRef(null),T=reactExports.useCallback(k=>{E.current=k,x(!0)},[]),w=reactExports.useCallback(k=>{if(E.current!==null&&v){const A=k-E.current;A>0&&g(A)}},[v]),R=reactExports.useCallback(()=>{x(!1),p>u&&i(),g(0),E.current=null},[p,u,i]),M=reactExports.useCallback(k=>{const A=Q=>T(Q.touches[0].clientY),D=Q=>w(Q.touches[0].clientY),z=()=>R(),L=Q=>{Q.preventDefault(),T(Q.clientY),window.addEventListener("mousemove",U),window.addEventListener("mouseup",V)},U=Q=>w(Q.clientY),V=()=>{R(),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",V)};k.addEventListener("touchstart",A),k.addEventListener("touchmove",D),k.addEventListener("touchend",z),k.addEventListener("mousedown",L),_.current=()=>{k.removeEventListener("touchstart",A),k.removeEventListener("touchmove",D),k.removeEventListener("touchend",z),k.removeEventListener("mousedown",L),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",V)}},[T,w,R]);return reactExports.useEffect(()=>{let k;return c.current?(_.current?.(),M(c.current)):(k=new MutationObserver(()=>{c.current&&(_.current?.(),M(c.current),k?.disconnect())}),k.observe(document.body,{childList:!0,subtree:!0})),()=>{k?.disconnect(),_.current?.()}},[M,t]),{ref:c,dragOffsetY:p,isDragging:v}}const useWaitForLoadingEffect=t=>{const[i,u]=reactExports.useState(!0);return reactExports.useEffect(()=>{let c=null;return t?.type==="loading"?(u(!0),c=setTimeout(()=>{u(!1)},300)):u(!t),()=>{c&&clearTimeout(c)}},[t]),i},SourceInfos=()=>{const t=useAppDispatch(),i=useAppSelector(E=>E.chat.sourceInfos),u=useIsSmallScreen(),c=reactExports.useRef(null),p=useWaitForLoadingEffect(i);reactExports.useEffect(()=>{c.current&&i?.type==="loading"&&(u?c.current.showModal():(c.current.setAttribute("open","true"),c.current?.focus()))},[i,u]);const g=reactExports.useCallback(()=>{c.current&&(u?c.current.close():c.current.removeAttribute("open"),t(closeSourceInfos()))},[t,u]),{ref:v,dragOffsetY:x}=useSwipeToClose({onClose:g,sourceInfos:i});return i?jsxRuntimeExports.jsx("dialog",{ref:c,className:clsx(styles$1.sourceInfos,p?styles$1.waitForLoading:i.type==="loading"?styles$1.loadingContent:""),style:u&&x?{transform:`translateY(${x}px)`}:{},onClose:g,autoFocus:!0,role:"dialog","aria-labelledby":"source-info-title",children:p?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Header,{ref:v,tabIndex:-1,sourceInfos:i.type==="loaded"?i:void 0,onClose:g}),i.type==="loading"?jsxRuntimeExports.jsx(LoadingSourceInfos,{}):i.type==="loading-error"?jsxRuntimeExports.jsx(LoadingError,{}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HighlightLoader,{loading:!i.highlighted}),jsxRuntimeExports.jsx(LoadedSourceInfos,{sourceInfos:i})]})]})}):null},container$1="_container_1aof3_1",body="_body_1aof3_7",intro="_intro_1aof3_14",footer="_footer_1aof3_39",footnote="_footnote_1aof3_43",containerWithFootnote="_containerWithFootnote_1aof3_58",startChatButton="_startChatButton_1aof3_73",spinner="_spinner_1aof3_88",formFields="_formFields_1aof3_92",formField="_formField_1aof3_92",radio="_radio_1aof3_104",checkbox="_checkbox_1aof3_111",input="_input_1aof3_119",inputLabel="_inputLabel_1aof3_153",selectWrapper="_selectWrapper_1aof3_157",select="_select_1aof3_157",selectLabel="_selectLabel_1aof3_203",styles={container:container$1,body,intro,footer,footnote,containerWithFootnote,startChatButton,spinner,formFields,formField,radio,checkbox,input,inputLabel,selectWrapper,select,selectLabel},Checkbox=({name:t,label:i,defaultValue:u,required:c,onChange:p})=>{const g=v=>{p(v.currentTarget.checked?"true":"false")};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.checkbox,"chat__startScreen__checkbox"),htmlFor:t,children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:t,name:t,defaultChecked:u==="true",required:c,onChange:g}),jsxRuntimeExports.jsx("div",{children:i})]})},Input=({type:t,name:i,label:u,defaultValue:c,placeholder:p,required:g,multiple:v,min:x,max:E,pattern:_,onChange:T})=>{const w=R=>{T(R.target.value)};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.input,"chat__startScreen__input"),htmlFor:i,children:[jsxRuntimeExports.jsx("div",{className:clsx(styles.inputLabel),children:u}),jsxRuntimeExports.jsx("input",{type:t,id:i,name:i,defaultValue:c,placeholder:p,required:g,multiple:v,min:x,max:E,pattern:_,onChange:w})]})},Radio=({name:t,value:i,label:u,defaultChecked:c,required:p,onChange:g})=>{const v=`${t}-${i}`,x=E=>{g(E.target.value)};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.radio,"chat__startScreen__radio"),htmlFor:v,children:[jsxRuntimeExports.jsx("input",{id:v,type:"radio",name:t,value:i,defaultChecked:c,required:p,onChange:x}),jsxRuntimeExports.jsx("span",{className:clsx(styles.label),children:u})]})},Select=({name:t,label:i,defaultValue:u,required:c,multiple:p,options:g,onChange:v})=>{const x=E=>{v(E.target.value)};return jsxRuntimeExports.jsxs("label",{className:clsx(styles.select,"chat__startScreen__select"),htmlFor:t,children:[jsxRuntimeExports.jsx("div",{className:clsx(styles.selectLabel),children:i}),jsxRuntimeExports.jsx("div",{className:clsx(styles.selectWrapper),children:jsxRuntimeExports.jsx("select",{id:t,name:t,defaultValue:u,required:c,multiple:p,onChange:x,children:Object.entries(g||{}).map(([E,_])=>jsxRuntimeExports.jsx("option",{value:E,selected:_===u,children:_}))})})]})},INTRO_KEY="start-screen.intro",START_CHAT_KEY="start-screen.start-chat",WAITING_FOR_LOGIN_KEY="start-screen.waiting-for-login",FOOTNOTE_KEY="start-screen.footnote",FORM_KEY="start-screen.form",FORM_FIELDS_KEY=`${FORM_KEY}.fields`,StartScreen=()=>{const t=useTranslation(),i=useAppDispatch(),u=useClientName(),c=useAppSelector(k=>k.startScreen.loginRequestToken),p=useAppSelector(k=>k.settings.requiresUserAuthentication);reactExports.useEffect(()=>{let k;if(c){const z=window.screenX+(window.outerWidth-600)/2,L=window.screenY+(window.outerHeight-700)/2,U=encodeURIComponent(u),V=new URL(window.location.origin);V.pathname=`/${U}/auth/login`,V.searchParams.set("loginRequestToken",c);const Q=window.open(V.href,"Login",`width=600,height=700,left=${z},top=${L},resizable=yes,scrollbars=yes`);k=setInterval(()=>{Q?.closed&&(i(loginWindowClosed()),clearInterval(k))},500)}return()=>{k&&clearInterval(k)}},[u,c,i]);const[g,v]=reactExports.useState({}),x=()=>{const k=Object.entries(g).reduce((A,[D,z])=>({...A,[D]:z.value}),{});i(p?requestLogin({loginRequestToken:v4(),formValues:k}):startChat$1({formValues:k}))},E=t(INTRO_KEY),_=t(c?WAITING_FOR_LOGIN_KEY:START_CHAT_KEY),T=t(FOOTNOTE_KEY),w=reactExports.useMemo(()=>t(FORM_FIELDS_KEY)?.split(";").map(k=>k.trim())??[],[t(FORM_FIELDS_KEY)]);reactExports.useEffect(()=>{w.length&&Object.keys(g).length===0&&v(w.reduce((k,A)=>({...k,[A]:toFormField(A,t)}),{}))},[t,w,g]);const R=k=>{k.preventDefault(),x()},M=k=>A=>{v(D=>({...D,[k]:{...D[k],value:A}}))};return jsxRuntimeExports.jsxs("form",{onSubmit:R,className:clsx(styles.container,T&&styles.containerWithFootnote,"chat__startScreen"),children:[jsxRuntimeExports.jsxs("div",{className:clsx(styles.body,"chat__startScreen__body"),children:[E&&jsxRuntimeExports.jsx("div",{className:clsx(styles.intro,"chat__startScreen__intro"),children:jsxRuntimeExports.jsx(X5,{options:{overrides:{a:Link}},children:E})}),jsxRuntimeExports.jsx("div",{className:clsx(styles.formFields,"chat__startScreen__fields"),children:Object.values(g).map(({type:k,name:A,label:D,placeholder:z,defaultValue:L,options:U,required:V,multiple:Q,min:Z,max:F,pattern:Y})=>jsxRuntimeExports.jsx("div",{className:clsx(styles.formField,"chat__startScreen__field"),children:(()=>{switch(k){case"radio":return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{children:D}),Object.entries(U||{}).map(([ne,fe])=>jsxRuntimeExports.jsx(Radio,{name:A,value:ne,label:fe,defaultChecked:ne===L,required:V,onChange:M(A)},ne))]});case"checkbox":return jsxRuntimeExports.jsx(Checkbox,{name:A,label:D,defaultValue:L,required:V,onChange:M(A)});case"select":return jsxRuntimeExports.jsx(Select,{name:A,label:D,defaultValue:L,required:V,multiple:Q,options:U,onChange:M(A)});default:return jsxRuntimeExports.jsx(Input,{type:k,name:A,label:D,placeholder:z,defaultValue:L,required:V,multiple:Q,min:Z,max:F,pattern:Y,onChange:M(A)})}})()},A))})]}),jsxRuntimeExports.jsxs("div",{className:clsx(styles.footer,"chat__startScreen__footer"),children:[jsxRuntimeExports.jsxs(PrimaryButton,{type:"submit",className:styles.startChatButton,disabled:!!c,children:[!!c&&jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",className:styles.spinner,children:jsxRuntimeExports.jsx("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"})}),jsxRuntimeExports.jsx("div",{children:_})]}),T&&jsxRuntimeExports.jsx("div",{className:styles.footnote,children:jsxRuntimeExports.jsx(X5,{options:{overrides:{a:Link}},children:T})})]})]})},Link=({title:t,href:i,children:u})=>jsxRuntimeExports.jsx("a",{href:i,title:t,target:"_blank",rel:"noopener noreferrer",children:u}),toFormField=(t,i)=>{const u=i(`${FORM_KEY}.${t}.type`)||"text",c=i(`${FORM_KEY}.${t}.required`)==="true",p=i(`${FORM_KEY}.${t}.multiple`)==="true",g=i(`${FORM_KEY}.${t}.placeholder`),v=i(`${FORM_KEY}.${t}.label`)||"",x=i(`${FORM_KEY}.${t}.defaultValue`),E=i(`${FORM_KEY}.${t}.min`),_=i(`${FORM_KEY}.${t}.max`),T=i(`${FORM_KEY}.${t}.pattern`),w=toFormFieldOptions(i(`${FORM_KEY}.${t}.options`));return{name:t,label:v,placeholder:g,value:getTypeSpecificValue(u,x,w)||"",defaultValue:x,options:w,type:u,required:c,multiple:p,min:E,max:_,pattern:T}},getTypeSpecificValue=(t,i,u)=>i||t==="select"&&Object.keys(u)[0]||"",toFormFieldOptions=(t="")=>t.split(";").map(i=>i.trim()).reduce((i,u)=>{const[c,p]=u.split(":").map(g=>g.trim());return{...i,[c]:p}},{}),useSetDocumentLanguageEffect=()=>{const t=useAppSelector(i=>i.intl.locale);reactExports.useEffect(()=>{window.document.documentElement.lang=t},[t])},INCOMING_EVENTS={TRIGGER_ACTION:"TRIGGER_ACTION",TRIGGER_STORY:"TRIGGER_STORY",CHAT_MESSAGE_FROM_GUEST:"CHAT_MESSAGE_FROM_GUEST",ON_CHAT_WINDOW_OPEN:"ON_CHAT_WINDOW_OPEN",ON_CHAT_WINDOW_CLOSE:"ON_CHAT_WINDOW_CLOSE",RESTART_CHAT:"RESTART_CHAT"},RootScene=({clientName:t})=>{useSetDocumentLanguageEffect();const i=useAppDispatch(),u=useAppSelector(T=>T.intl.messages),c=useTranslation(),p=useAppSelector(T=>T.settings.enableStartScreen),g=useAppSelector(T=>T.startScreen.startScreenStatus),v=useAppSelector(T=>T.connection.queryString),x=reactExports.useMemo(()=>new URLSearchParams(v||"?").get("cssClassName"),[v]);reactExports.useEffect(()=>{const T=new URLSearchParams(v||""),w=Object.fromEntries(T.entries()),R=M=>{if(!(!M.data?.type||!Object.values(INCOMING_EVENTS).includes(M.data.type))){if(M.origin!==window.location.origin&&M.source!==window.parent){console.warn("Rejected postMessage from untrusted origin:",M.origin);return}switch(M.data.type){case INCOMING_EVENTS.TRIGGER_ACTION:i(M.data.action);break;case INCOMING_EVENTS.TRIGGER_STORY:i(requestNLUEvent(M.data.story));break;case INCOMING_EVENTS.ON_CHAT_WINDOW_OPEN:i({type:"webclient.chatwindow.opened"});break;case INCOMING_EVENTS.ON_CHAT_WINDOW_CLOSE:i({type:"webclient.chatwindow.closed"});break;case INCOMING_EVENTS.CHAT_MESSAGE_FROM_GUEST:i(sendMessageFromUser(M.data.text));break;case INCOMING_EVENTS.RESTART_CHAT:i(restartChat());break}}};return i(connect(t,w)),window.addEventListener("message",R,!1),()=>window.removeEventListener("message",R)},[t,v,i]),reactExports.useEffect(()=>{const T=c("page.title");T&&document&&(document.title=T)},[u,c]);const E=p===void 0,_=p===!1||g==="HIDDEN";return jsxRuntimeExports.jsx("div",{className:clsx(styles$2.chatwindow,_&&styles$2.chatwindowWithAside,"chat__chatwindow",x),children:E?null:_?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("header",{children:jsxRuntimeExports.jsx(Header$1,{chatStarted:!0})}),jsxRuntimeExports.jsx("main",{children:jsxRuntimeExports.jsx(Chat,{clientName:t})}),jsxRuntimeExports.jsx("aside",{children:jsxRuntimeExports.jsx(SourceInfos,{})})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("header",{children:jsxRuntimeExports.jsx(Header$1,{chatStarted:!1})}),jsxRuntimeExports.jsx("main",{children:jsxRuntimeExports.jsx(StartScreen,{})})]})})},App=()=>{const t=useClientName(),i=useIsSmallScreen();return jsxRuntimeExports.jsx("div",{className:clsx([styles$o.app,i?"chat__small":"chat__large"]),children:jsxRuntimeExports.jsx(RootScene,{clientName:t})})},de={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht eingeben","message-input.actions.submit.label":"Nachricht senden","message-input.actions.start-audio-recording.label":"Spracheingabe starten","message-input.actions.stop-audio-recording.label":"Spracheingabe stoppen","message-input.actions.submit-audio-recording.label":"Spracheingabe übermitteln","message-input.actions.command.label":"Aktion ausführen","guest-bubble.label":"Ihre Nachricht","bot-bubble.label":"Nachricht des Chatbots","bot-bubble.actions.label":"Nachricht-Aktionen","bot-bubble.reaction.good":"Gefällt mir","bot-bubble.reaction.bad":"Gefällt mir nicht","bot-bubble.reaction.remove":"Markierung entfernen","bot-bubble.reaction.say-more":"Erzähle mir bitte mehr","bot-bubble.reaction.category.WRONG_INFORMATION":"Falsch","bot-bubble.reaction.category.MISSING_INFORMATION":"Unvollständig","bot-bubble.reaction.category.OLD_INFORMATION":"Veraltet","bot-bubble.reaction.category.UNCLEAR":"Unklar","bot-bubble.reaction.category.OFF_TOPIC":"Nicht zur Frage passend","bot-bubble.reaction.comment":"Gedanken mit mir teilen...","bot-bubble.reaction.close":"Schliessen","bot-bubble.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","agent-bubble.label":"Nachricht des Live-Agenten","conversation.label":"Chat Verlauf","chatbot.typing":"Chatbot schreibt","export-transcript.email.title":"Chatverlauf per E-Mail versenden","export-transcript.email.description":"Bitte E-Mail-Adresse angeben, an die der Chatverlauf gesendet werden soll.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Der Chatverlauf wurde an die hinterlegte E-Mail-Adresse übermittelt.","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
122
122
 
123
123
  - Der Chatverlauf wird im EU-Raum gespeichert und kann nur von autorisierten Personen eingesehen werden.
124
124
  - Geben Sie im Chatfenster keine persönlichen Daten ein (Passwörter, Geburtsdatum usw.).`,"general-conditions.accept-conditions-note":"Mit der Verwendung des Chats erklären Sie sich mit den Nutzungsbedingungen einverstanden.","block-user-input.title":"Bitte auf die Antwort des Chatbots warten.","conversation-rating.call-to-action.title":"Bewerten Sie diesen Chat","conversation-rating.overlay.title":"Wie zufrieden sind Sie mit diesem Chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Feedback bitte hier eingeben (optional)","conversation-rating.overlay.star.very-bad":"Sehr schlecht","conversation-rating.overlay.star.very-good":"Sehr gut","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, das tönt nicht gut. Bitte geben Sie mir doch ein schriftliches Feedback, damit ich dazulernen kann.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, das tönt nicht gut. Bitte geben Sie mir doch ein schriftliches Feedback, damit ich dazulernen kann.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"Durchschnitt ist nicht mein Ziel, was kann ich noch verbessern?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Knapp daneben ist auch vorbei. Was kann ich noch verbessern, um das nächste Mal alle Sterne zu erreichen?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfekt! Dann hoffe ich, dass ich Sie wieder einmal so gut beraten kann.","conversation-rating.overlay.bot-message.submit-feedback":"Vielen Dank für die Rückmeldung. Ich bin bestrebt, mich ständig zu verbessern.","conversation-rating.overlay.action.submit":"Bewertung senden","conversation-rating.overlay.action.back-to-chat":"Zurück zum Chat","conversation-rating.overlay.action.close-chat":"Chat minimieren","conversation-rating.overlay.action.restart-chat":"Chat neu starten","conversation-rating.overlay.action.cancel":"Abbrechen","start-screen.intro":"","start-screen.start-chat":"Chat starten","start-screen.waiting-for-login":"Warte auf Login ...","header.close-chat":"Chat minimieren","header.menu.title":"Menü","header.menu.restart-chat":"Chat neu starten","header.menu.expand-chat-window":"Fenster maximieren","header.menu.download-transcript":"Chatverlauf herunterladen","header.menu.send-transcript":"Chatverlauf versenden","header.menu.export-transcript":"Chatverlauf exportieren","header.menu.rate-conversation":"Chat bewerten","source-infos.close":"Schliessen","source-infos.open-source":"Quelle öffnen","source-infos.error.title":"Fehler","source-infos.error.info":"Oops! Etwas ist schiefgelaufen. Bitte versuche es erneut oder kontaktiere den Support, falls das Problem weiterhin besteht.","source-infos.highlight-loading.title":"Relevante Inhalte werden markiert...","source-infos.highlight-loading.description":"Einen Moment – die Quelle wird analysiert.","commands.show-more.action":"Weitere ...","commands.show-more.tooltip":"Weitere Befehle anzeigen","commands.show-less.action":"Weniger ...","commands.show-less.tooltip":"Weniger Befehle anzeigen"},en={"page.title":"Bubble Chat Chatbot","message-input-label":"User input","message-input-placeholder":"Enter a message","message-input.actions.submit.label":"Send message","message-input.actions.start-audio-recording.label":"Start voice input","message-input.actions.stop-audio-recording.label":"Stop voice input","message-input.actions.submit-audio-recording.label":"Transmit voice input","guest-bubble.label":"Your message","message-input.actions.command.label":"Perform action","bot-bubble.label":"Message from the chatbot","bot-bubble.actions.label":"Message actions","bot-bubble.reaction.good":"I like","bot-bubble.reaction.bad":"I don't like it","bot-bubble.reaction.remove":"Remove marker","bot-bubble.reaction.say-more":"Please tell us more","bot-bubble.reaction.category.WRONG_INFORMATION":"Wrong","bot-bubble.reaction.category.MISSING_INFORMATION":"Incomplete","bot-bubble.reaction.category.OLD_INFORMATION":"Outdated","bot-bubble.reaction.category.UNCLEAR":"Unclear","bot-bubble.reaction.category.OFF_TOPIC":"Not relevant to the question","bot-bubble.reaction.comment":"Share your thoughts with us...","bot-bubble.reaction.close":"Close","bot-bubble.copy":"Copy","bot-bubble.sources":"Source list","bot-bubble.source.open":"Open source","agent-bubble.label":"Message from the live agent","conversation.label":"Chat history","chatbot.typing":"Chatbot is typing","export-transcript.email.title":"Receive chat history","export-transcript.email.description":"Please enter the e-mail address to which the chat history should be sent.","export-transcript.email.cancel":"Cancel","export-transcript.email.send":"Send","export-transcript.email.placeholder":"E-mail address","export-transcript.email.invalid":"Please enter a valid e-mail address.","export-transcript.email.success":"The chat history was sent to the e-mail address provided.","general-conditions.header":"**Terms of use**","general-conditions.body":`Please consider the following points:
@@ -131,4 +131,4 @@ ${Ee.current.stack}
131
131
 
132
132
  - La cronologia delle chat è memorizzata nell'area UE e può essere visualizzata solo da persone autorizzate.
133
133
  - Non inserire dati personali nella finestra di chat (password, data di nascita, ecc.).`,"general-conditions.accept-conditions-note":"Utilizzando la chat si accettano le condizioni d'uso.","block-user-input.title":"Attendere la risposta del chatbot.","conversation-rating.call-to-action.title":"Valuta questa chat","conversation-rating.overlay.title":"Quanto sei soddisfatto di questa chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Inserisci qui il tuo feedback (opzionale)","conversation-rating.overlay.star.very-bad":"Molto male","conversation-rating.overlay.star.very-good":"Molto buono","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"La media non è il mio obiettivo, cosa posso ancora migliorare?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Anche l'assenza è finita. Cosa posso migliorare per ottenere tutte le stelle la prossima volta?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfetto! Allora spero di potervi consigliare ancora una volta bene.","conversation-rating.overlay.bot-message.submit-feedback":"Grazie mille per il feedback. Mi impegno costantemente per migliorare.","conversation-rating.overlay.action.submit":"Invia","conversation-rating.overlay.action.back-to-chat":"Chiudere","conversation-rating.overlay.action.close-chat":"Minimizzare la chat","conversation-rating.overlay.action.restart-chat":"Riavviare la chat","conversation-rating.overlay.action.cancel":"Annulla","start-screen.intro":"","start-screen.start-chat":"Avviare la chat","start-screen.waiting-for-login":"In attesa di login ...","header.close-chat":"Minimizzare la chat","header.menu.title":"Menu","header.menu.restart-chat":"Riavviare la chat","header.menu.expand-chat-window":"Espandere la finestra","header.menu.download-transcript":"Scaricare la trascrizione","header.menu.send-transcript":"Inviare la trascrizione","header.menu.export-transcript":"Esportare la trascrizione","header.menu.rate-conversation":"Valutare la conversazione","source-infos.close":"Chiudere","source-infos.open-source":"Fonte aperta","source-infos.error.title":"Errore","source-infos.error.info":"Ops! Qualcosa è andato storto. Riprovare o contattare l'assistenza se il problema persiste.","source-infos.highlight-loading.title":"Il contenuto rilevante è evidenziato...","source-infos.highlight-loading.description":"Un momento - la fonte è in fase di analisi","commands.show-more.action":"Di più","commands.show-more.tooltip":"Mostra più comandi","commands.show-less.action":"Meno","commands.show-less.tooltip":"Mostra meno comandi"},supportedLocales=["de","en","fr","it"],initialState$3={locale:"de",messages:de},mergeMessages=(t,i)=>{if(supportedLocales.includes(t)){const u=getMessagesByLanguage(t),c=flattenObject(i);return{...u,...c}}return i},getMessagesByLanguage=t=>{switch(t.toString()){case"en":return en;case"fr":return fr;case"it":return it;default:return de}},backendConnectionReducer=(t=initialState$2,i)=>{switch(i.type){case CONNECTING:return Object.assign({},t,{connectionState:ConnectionStateEnum.CONNECTING});case CONNECTED:return Object.assign({},t,{connectionState:ConnectionStateEnum.CONNECTED});case DISCONNECTED:return Object.assign({},t,{connectionState:ConnectionStateEnum.DISCONNECTED});case RECONNECTED:return Object.assign({},t,{connectionState:ConnectionStateEnum.RECONNECTED});case RESTORE_SESSION_ID:return Object.assign({},t,{sessionId:i.sessionId});case START:return Object.assign({},t,{sessionId:i.payload.sessionId,userId:i.payload.userId});case TERMINATE_SESSION:return Object.assign({},t,{sessionId:void 0});default:return t}},initialState$2={connectionState:ConnectionStateEnum.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},chatReducer=(t=initialState$1,i)=>{switch(i.type){case RESET_CHAT_STATE:return initialState$1;case START:return sendToParentPage({type:"webclient.chat.started"}),t;case TERMINATE_SESSION:return sendToParentPage({type:"webclient.chat.ended"}),t;case TYPING_ON:return Object.assign({},t,{isBotTyping:!0});case TYPING_OFF:return Object.assign({},t,{isBotTyping:!1});case MESSAGE_FROM_GUEST:case MESSAGE_WITHOUT_ANALYSIS_FROM_GUEST:return appendMessageFromGuestToState(t,i.message);case MESSAGE_TO_GUEST:{sendToParentPage(i);const u=Object.assign({},i.message,{_id:i.meta.actionId}),c=t.messages.filter(p=>p._id===i.meta.actionId).length>0;return Object.assign({},t,{isBotTyping:!1,messages:c?t.messages:t.messages.concat([u]),quickReplies:u.quickReplies?u.quickReplies:[]})}case RESTORE_PREVIOUS_CHAT_MESSAGES:{const u=i.messages,c=u.length?u[u.length-1]:void 0;return Object.assign({},t,{isBotTyping:!1,messages:u,quickReplies:c?.quickReplies||[]})}case MESSAGE_TO_PARENT_PAGE:return sendToParentPage(i.message),t;case EVENT_TO_GUEST:return sendToParentPage(i.event),t;case DRAWER_OPEN:return Object.assign({},t,{drawerContentUrl:i.payload.parameters.contentUrl});case DRAWER_CLOSE:return Object.assign({},t,{drawerContentUrl:void 0});case GUEST_LOCALE_CHANGED:return Object.assign({},t,{locale:i.payload.locale});case EXPAND_WINDOW:return sendToParentPage(i),t;case CLOSE_WINDOW:return sendToParentPage(i),{...t,conversationRating:{...t.conversationRating,opener:void 0}};case RECEIVE_SPEECH_TRANSCRIPTION:{const u=new TextMessage$1(i.transcription,new GuestUser),c=Object.assign({},u,{_id:v4()});return appendMessageFromGuestToState(t,c)}case TRANSCRIPT_ITEM_GUEST_REACTION:{const u=t.messages.map(c=>c._id===i.payload.actionId?Object.assign({},c,i.payload.reaction?{reaction:{type:i.payload.reaction,category:i.payload.category,comment:i.payload.comment}}:{reaction:void 0}):c);return Object.assign({},t,{messages:u})}case ENABLE_CONVERSATION_RATING:{const u={enabled:!0,rating:i.payload.rating};return Object.assign({},t,{conversationRating:u})}case CONVERSATION_RATING_FROM_GUEST:{const u={...t.conversationRating,rating:i.payload};return Object.assign({},t,{conversationRating:u})}case SHOW_CONVERSATION_RATING_OVERLAY:{const u={...t.conversationRating,opener:i.payload.opener,...i.payload.defaultRating?{rating:{value:i.payload.defaultRating,feedback:t.conversationRating.rating?.feedback||""}}:{}};return Object.assign({},t,{conversationRating:u})}case HIDE_CONVERSATION_RATING_OVERLAY:{const u={...t.conversationRating,opener:void 0};return Object.assign({},t,{conversationRating:u})}case LOAD_SOURCE_INFOS_REQUEST:return{...t,sourceInfos:{type:"loading",chunkId:i.payload.chunkId}};case LOAD_SOURCE_INFOS_ERROR:{const{highlighted:u}=i.payload;return t.sourceInfos?.type==="loaded"&&u?{...t,sourceInfos:{...t.sourceInfos,highlighted:!0}}:{...t,sourceInfos:{type:"loading-error"}}}case LOAD_SOURCE_INFOS_RESPONSE:{const u=t.sourceInfos?.type,{chunkId:c,knowledgeBaseType:p,title:g,content:v,highlighted:x,url:E}=i.payload,_=t.sourceInfos?.type==="loading"||t.sourceInfos?.type==="loaded"?t.sourceInfos?.chunkId:void 0;return _&&_!==c?t:u==="loading"||u==="loaded"&&x?{...t,sourceInfos:{type:"loaded",chunkId:c,knowledgeBaseType:p,title:g,content:v,highlighted:x,url:E}}:t}case CLOSE_SOURCE_INFOS:return{...t,sourceInfos:void 0};case TOGGLE_TRANSCRIPT_MAIL_OVERLAY:return{...t,showTranscriptMailOverlay:!t.showTranscriptMailOverlay,conversationRating:{...t.conversationRating,opener:void 0}};default:return t}},appendMessageFromGuestToState=(t,i)=>{const u=t.messages[t.messages.length-1],c=u?.text===i.text;return u&&u.sender.type===i.sender.type&&c?t:Object.assign({},t,{messages:t.messages.concat([i]),quickReplies:[]})},sendToParentPage=t=>{isIframe()?window.top?.postMessage(t,"*"):t.type==="webclient.change.url"&&window.open(t.url)},isIframe=()=>typeof window<"u"&&window.self!==window.top,initialState$1={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},counterSlice=createSlice({name:"intl",initialState:initialState$3,reducers:{updateIntl:(t,i)=>{t.locale=i.payload.language,t.messages=i.payload.messages}}}),{updateIntl}=counterSlice.actions,intlReducer=counterSlice.reducer,initialState={version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[]},settingsSlice=createSlice({name:"settings",initialState,reducers:{setSettings(t,i){t.version&&t.version!==i.payload.version?(console.log("version changed, reloading chat window"),window.location.reload()):(t.version=i.payload.version,t.requiresUserAuthentication=i.payload.requiresUserAuthentication,t.enableStartScreen=i.payload.enableStartScreen,t.enableStandaloneView=i.payload.enableStandaloneView,t.enableTranscriptExportEmail=i.payload.enableTranscriptExportEmail,t.enableTranscriptExportPdf=i.payload.enableTranscriptExportPdf,t.enableGeneralConditions=i.payload.enableGeneralConditions,t.enableSpeechSupport=i.payload.enableSpeechSupport,t.commands=i.payload.commands,t.menuItems=i.payload.menuItems||[])}}}),{setSettings}=settingsSlice.actions,settingsSlice$1=settingsSlice.reducer,rootReducer=combineReducers({settings:settingsSlice$1,chat:chatReducer,startScreen:startScreenReducer,connection:backendConnectionReducer,intl:intlReducer}),LOCAL_STORAGE_ITEM_PREFIX="bubble-chat",LOCAL_STORAGE_LAST_SAVED_ITEM_NAME="state-last-saved-at",LOCAL_STORAGE_STATE_ITEM_NAME="state",loadState=t=>{try{if(!supportsLocalStorage())return;const i=getStoreItem(t,LOCAL_STORAGE_LAST_SAVED_ITEM_NAME);if(isExpired(i))return;{const u=getStoreItem(t,LOCAL_STORAGE_STATE_ITEM_NAME);if(u===null)return;const c=JSON.parse(u),p=c.connection?.queryString;if(p!==void 0&&!queryStringsMatchIgnoringReferrer(p,window.location.search)){console.log("Ignoring persisted state due to different query string");return}else return c}}catch(i){console.error(i);return}},saveState=(t,i)=>{try{const u=JSON.stringify(i);setStoreItem(t,LOCAL_STORAGE_STATE_ITEM_NAME,u);const c=new Date().toISOString();setStoreItem(t,LOCAL_STORAGE_LAST_SAVED_ITEM_NAME,c)}catch(u){console.error(u)}},isExpired=t=>{if(t===null)return!1;const i=new Date(t);return i.setHours(i.getHours()+12),new Date>i},supportsLocalStorage=()=>typeof localStorage<"u",getStoreItem=(t,i)=>{const u=getStoreItemName(t,i);return localStorage.getItem(u)},setStoreItem=(t,i,u)=>{const c=getStoreItemName(t,i);return localStorage.setItem(c,u)},getStoreItemName=(t,i)=>`${LOCAL_STORAGE_ITEM_PREFIX}-${t}-${i}`,queryStringsMatchIgnoringReferrer=(t,i)=>{const u=new URLSearchParams(t),c=new URLSearchParams(i);u.delete("referrer"),c.delete("referrer");const p=Array.from(u.entries()).sort(),g=Array.from(c.entries()).sort();return p.length!==g.length?!1:p.every(([v,x],E)=>{const[_,T]=g[E];return v===_&&x===T})},PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(t=>{PACKET_TYPES_REVERSE[PACKET_TYPES[t]]=t});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,encodePacket=({type:t,data:i},u,c)=>withNativeBlob$1&&i instanceof Blob?u?c(i):encodeBlobAsBase64(i,c):withNativeArrayBuffer$2&&(i instanceof ArrayBuffer||isView$1(i))?u?c(i):encodeBlobAsBase64(new Blob([i]),c):c(PACKET_TYPES[t]+(i||"")),encodeBlobAsBase64=(t,i)=>{const u=new FileReader;return u.onload=function(){const c=u.result.split(",")[1];i("b"+(c||""))},u.readAsDataURL(t)};function toArray(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(t,i){if(withNativeBlob$1&&t.data instanceof Blob)return t.data.arrayBuffer().then(toArray).then(i);if(withNativeArrayBuffer$2&&(t.data instanceof ArrayBuffer||isView$1(t.data)))return i(toArray(t.data));encodePacket(t,!1,u=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),i(TEXT_ENCODER.encode(u))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<chars.length;t++)lookup$1[chars.charCodeAt(t)]=t;const decode$1=t=>{let i=t.length*.75,u=t.length,c,p=0,g,v,x,E;t[t.length-1]==="="&&(i--,t[t.length-2]==="="&&i--);const _=new ArrayBuffer(i),T=new Uint8Array(_);for(c=0;c<u;c+=4)g=lookup$1[t.charCodeAt(c)],v=lookup$1[t.charCodeAt(c+1)],x=lookup$1[t.charCodeAt(c+2)],E=lookup$1[t.charCodeAt(c+3)],T[p++]=g<<2|v>>4,T[p++]=(v&15)<<4|x>>2,T[p++]=(x&3)<<6|E&63;return _},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(t,i)=>{if(typeof t!="string")return{type:"message",data:mapBinary(t,i)};const u=t.charAt(0);return u==="b"?{type:"message",data:decodeBase64Packet(t.substring(1),i)}:PACKET_TYPES_REVERSE[u]?t.length>1?{type:PACKET_TYPES_REVERSE[u],data:t.substring(1)}:{type:PACKET_TYPES_REVERSE[u]}:ERROR_PACKET},decodeBase64Packet=(t,i)=>{if(withNativeArrayBuffer$1){const u=decode$1(t);return mapBinary(u,i)}else return{base64:!0,data:t}},mapBinary=(t,i)=>i==="blob"?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,SEPARATOR="",encodePayload=(t,i)=>{const u=t.length,c=new Array(u);let p=0;t.forEach((g,v)=>{encodePacket(g,!1,x=>{c[v]=x,++p===u&&i(c.join(SEPARATOR))})})},decodePayload=(t,i)=>{const u=t.split(SEPARATOR),c=[];for(let p=0;p<u.length;p++){const g=decodePacket(u[p],i);if(c.push(g),g.type==="error")break}return c};function createPacketEncoderStream(){return new TransformStream({transform(t,i){encodePacketToBinary(t,u=>{const c=u.length;let p;if(c<126)p=new Uint8Array(1),new DataView(p.buffer).setUint8(0,c);else if(c<65536){p=new Uint8Array(3);const g=new DataView(p.buffer);g.setUint8(0,126),g.setUint16(1,c)}else{p=new Uint8Array(9);const g=new DataView(p.buffer);g.setUint8(0,127),g.setBigUint64(1,BigInt(c))}t.data&&typeof t.data!="string"&&(p[0]|=128),i.enqueue(p),i.enqueue(u)})}})}let TEXT_DECODER;function totalLength(t){return t.reduce((i,u)=>i+u.length,0)}function concatChunks(t,i){if(t[0].length===i)return t.shift();const u=new Uint8Array(i);let c=0;for(let p=0;p<i;p++)u[p]=t[0][c++],c===t[0].length&&(t.shift(),c=0);return t.length&&c<t[0].length&&(t[0]=t[0].slice(c)),u}function createPacketDecoderStream(t,i){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const u=[];let c=0,p=-1,g=!1;return new TransformStream({transform(v,x){for(u.push(v);;){if(c===0){if(totalLength(u)<1)break;const E=concatChunks(u,1);g=(E[0]&128)===128,p=E[0]&127,p<126?c=3:p===126?c=1:c=2}else if(c===1){if(totalLength(u)<2)break;const E=concatChunks(u,2);p=new DataView(E.buffer,E.byteOffset,E.length).getUint16(0),c=3}else if(c===2){if(totalLength(u)<8)break;const E=concatChunks(u,8),_=new DataView(E.buffer,E.byteOffset,E.length),T=_.getUint32(0);if(T>Math.pow(2,21)-1){x.enqueue(ERROR_PACKET);break}p=T*Math.pow(2,32)+_.getUint32(4),c=3}else{if(totalLength(u)<p)break;const E=concatChunks(u,p);x.enqueue(decodePacket(g?E:TEXT_DECODER.decode(E),i)),c=0}if(p===0||p>t){x.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(t){if(t)return mixin(t)}function mixin(t){for(var i in Emitter.prototype)t[i]=Emitter.prototype[i];return t}Emitter.prototype.on=Emitter.prototype.addEventListener=function(t,i){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(i),this};Emitter.prototype.once=function(t,i){function u(){this.off(t,u),i.apply(this,arguments)}return u.fn=i,this.on(t,u),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(t,i){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var u=this._callbacks["$"+t];if(!u)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var c,p=0;p<u.length;p++)if(c=u[p],c===i||c.fn===i){u.splice(p,1);break}return u.length===0&&delete this._callbacks["$"+t],this};Emitter.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var i=new Array(arguments.length-1),u=this._callbacks["$"+t],c=1;c<arguments.length;c++)i[c-1]=arguments[c];if(u){u=u.slice(0);for(var c=0,p=u.length;c<p;++c)u[c].apply(this,i)}return this};Emitter.prototype.emitReserved=Emitter.prototype.emit;Emitter.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Emitter.prototype.hasListeners=function(t){return!!this.listeners(t).length};const nextTick=typeof Promise=="function"&&typeof Promise.resolve=="function"?i=>Promise.resolve().then(i):(i,u)=>u(i,0),globalThisShim=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),defaultBinaryType="arraybuffer";function createCookieJar(){}function pick(t,...i){return i.reduce((u,c)=>(t.hasOwnProperty(c)&&(u[c]=t[c]),u),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(t,i){i.useNativeTimers?(t.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),t.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(t.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),t.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(t){return typeof t=="string"?utf8Length(t):Math.ceil((t.byteLength||t.size)*BASE64_OVERHEAD)}function utf8Length(t){let i=0,u=0;for(let c=0,p=t.length;c<p;c++)i=t.charCodeAt(c),i<128?u+=1:i<2048?u+=2:i<55296||i>=57344?u+=3:(c++,u+=4);return u}function randomString(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function encode(t){let i="";for(let u in t)t.hasOwnProperty(u)&&(i.length&&(i+="&"),i+=encodeURIComponent(u)+"="+encodeURIComponent(t[u]));return i}function decode(t){let i={},u=t.split("&");for(let c=0,p=u.length;c<p;c++){let g=u[c].split("=");i[decodeURIComponent(g[0])]=decodeURIComponent(g[1])}return i}class TransportError extends Error{constructor(i,u,c){super(i),this.description=u,this.context=c,this.type="TransportError"}}class Transport extends Emitter{constructor(i){super(),this.writable=!1,installTimerFunctions(this,i),this.opts=i,this.query=i.query,this.socket=i.socket,this.supportsBinary=!i.forceBase64}onError(i,u,c){return super.emitReserved("error",new TransportError(i,u,c)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(i){this.readyState==="open"&&this.write(i)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(i){const u=decodePacket(i,this.socket.binaryType);this.onPacket(u)}onPacket(i){super.emitReserved("packet",i)}onClose(i){this.readyState="closed",super.emitReserved("close",i)}pause(i){}createUri(i,u={}){return i+"://"+this._hostname()+this._port()+this.opts.path+this._query(u)}_hostname(){const i=this.opts.hostname;return i.indexOf(":")===-1?i:"["+i+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(i){const u=encode(i);return u.length?"?"+u:""}}class Polling extends Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(i){this.readyState="pausing";const u=()=>{this.readyState="paused",i()};if(this._polling||!this.writable){let c=0;this._polling&&(c++,this.once("pollComplete",function(){--c||u()})),this.writable||(c++,this.once("drain",function(){--c||u()}))}else u()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(i){const u=c=>{if(this.readyState==="opening"&&c.type==="open"&&this.onOpen(),c.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(c)};decodePayload(i,this.socket.binaryType).forEach(u),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const i=()=>{this.write([{type:"close"}])};this.readyState==="open"?i():this.once("open",i)}write(i){this.writable=!1,encodePayload(i,u=>{this.doWrite(u,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const i=this.opts.secure?"https":"http",u=this.query||{};return this.opts.timestampRequests!==!1&&(u[this.opts.timestampParam]=randomString()),!this.supportsBinary&&!u.sid&&(u.b64=1),this.createUri(i,u)}}let value=!1;try{value=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(t){}const hasCORS=value;function empty(){}class BaseXHR extends Polling{constructor(i){if(super(i),typeof location<"u"){const u=location.protocol==="https:";let c=location.port;c||(c=u?"443":"80"),this.xd=typeof location<"u"&&i.hostname!==location.hostname||c!==i.port}}doWrite(i,u){const c=this.request({method:"POST",data:i});c.on("success",u),c.on("error",(p,g)=>{this.onError("xhr post error",p,g)})}doPoll(){const i=this.request();i.on("data",this.onData.bind(this)),i.on("error",(u,c)=>{this.onError("xhr poll error",u,c)}),this.pollXhr=i}}class Request extends Emitter{constructor(i,u,c){super(),this.createRequest=i,installTimerFunctions(this,c),this._opts=c,this._method=c.method||"GET",this._uri=u,this._data=c.data!==void 0?c.data:null,this._create()}_create(){var i;const u=pick(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");u.xdomain=!!this._opts.xd;const c=this._xhr=this.createRequest(u);try{c.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){c.setDisableHeaderCheck&&c.setDisableHeaderCheck(!0);for(let p in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(p)&&c.setRequestHeader(p,this._opts.extraHeaders[p])}}catch{}if(this._method==="POST")try{c.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{c.setRequestHeader("Accept","*/*")}catch{}(i=this._opts.cookieJar)===null||i===void 0||i.addCookies(c),"withCredentials"in c&&(c.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(c.timeout=this._opts.requestTimeout),c.onreadystatechange=()=>{var p;c.readyState===3&&((p=this._opts.cookieJar)===null||p===void 0||p.parseCookies(c.getResponseHeader("set-cookie"))),c.readyState===4&&(c.status===200||c.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof c.status=="number"?c.status:0)},0))},c.send(this._data)}catch(p){this.setTimeoutFn(()=>{this._onError(p)},0);return}typeof document<"u"&&(this._index=Request.requestsCount++,Request.requests[this._index]=this)}_onError(i){this.emitReserved("error",i,this._xhr),this._cleanup(!0)}_cleanup(i){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=empty,i)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this._index],this._xhr=null}}_onLoad(){const i=this._xhr.responseText;i!==null&&(this.emitReserved("data",i),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Request.requestsCount=0;Request.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const t="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(t,unloadHandler,!1)}}function unloadHandler(){for(let t in Request.requests)Request.requests.hasOwnProperty(t)&&Request.requests[t].abort()}const hasXHR2=(function(){const t=newRequest({xdomain:!1});return t&&t.responseType!==null})();class XHR extends BaseXHR{constructor(i){super(i);const u=i&&i.forceBase64;this.supportsBinary=hasXHR2&&!u}request(i={}){return Object.assign(i,{xd:this.xd},this.opts),new Request(newRequest,this.uri(),i)}}function newRequest(t){const i=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!i||hasCORS))return new XMLHttpRequest}catch{}if(!i)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class BaseWS extends Transport{get name(){return"websocket"}doOpen(){const i=this.uri(),u=this.opts.protocols,c=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(c.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(i,u,c)}catch(p){return this.emitReserved("error",p)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=i=>this.onClose({description:"websocket connection closed",context:i}),this.ws.onmessage=i=>this.onData(i.data),this.ws.onerror=i=>this.onError("websocket error",i)}write(i){this.writable=!1;for(let u=0;u<i.length;u++){const c=i[u],p=u===i.length-1;encodePacket(c,this.supportsBinary,g=>{try{this.doWrite(c,g)}catch{}p&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const i=this.opts.secure?"wss":"ws",u=this.query||{};return this.opts.timestampRequests&&(u[this.opts.timestampParam]=randomString()),this.supportsBinary||(u.b64=1),this.createUri(i,u)}}const WebSocketCtor=globalThisShim.WebSocket||globalThisShim.MozWebSocket;class WS extends BaseWS{createSocket(i,u,c){return isReactNative?new WebSocketCtor(i,u,c):u?new WebSocketCtor(i,u):new WebSocketCtor(i)}doWrite(i,u){this.ws.send(u)}}class WT extends Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(i){return this.emitReserved("error",i)}this._transport.closed.then(()=>{this.onClose()}).catch(i=>{this.onError("webtransport error",i)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(i=>{const u=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),c=i.readable.pipeThrough(u).getReader(),p=createPacketEncoderStream();p.readable.pipeTo(i.writable),this._writer=p.writable.getWriter();const g=()=>{c.read().then(({done:x,value:E})=>{x||(this.onPacket(E),g())}).catch(x=>{})};g();const v={type:"open"};this.query.sid&&(v.data=`{"sid":"${this.query.sid}"}`),this._writer.write(v).then(()=>this.onOpen())})})}write(i){this.writable=!1;for(let u=0;u<i.length;u++){const c=i[u],p=u===i.length-1;this._writer.write(c).then(()=>{p&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var i;(i=this._transport)===null||i===void 0||i.close()}}const transports={websocket:WS,webtransport:WT,polling:XHR},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse(t){if(t.length>8e3)throw"URI too long";const i=t,u=t.indexOf("["),c=t.indexOf("]");u!=-1&&c!=-1&&(t=t.substring(0,u)+t.substring(u,c).replace(/:/g,";")+t.substring(c,t.length));let p=re.exec(t||""),g={},v=14;for(;v--;)g[parts[v]]=p[v]||"";return u!=-1&&c!=-1&&(g.source=i,g.host=g.host.substring(1,g.host.length-1).replace(/;/g,":"),g.authority=g.authority.replace("[","").replace("]","").replace(/;/g,":"),g.ipv6uri=!0),g.pathNames=pathNames(g,g.path),g.queryKey=queryKey(g,g.query),g}function pathNames(t,i){const u=/\/{2,9}/g,c=i.replace(u,"/").split("/");return(i.slice(0,1)=="/"||i.length===0)&&c.splice(0,1),i.slice(-1)=="/"&&c.splice(c.length-1,1),c}function queryKey(t,i){const u={};return i.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(c,p,g){p&&(u[p]=g)}),u}const withEventListeners=typeof addEventListener=="function"&&typeof removeEventListener=="function",OFFLINE_EVENT_LISTENERS=[];withEventListeners&&addEventListener("offline",()=>{OFFLINE_EVENT_LISTENERS.forEach(t=>t())},!1);class SocketWithoutUpgrade extends Emitter{constructor(i,u){if(super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,i&&typeof i=="object"&&(u=i,i=null),i){const c=parse(i);u.hostname=c.host,u.secure=c.protocol==="https"||c.protocol==="wss",u.port=c.port,c.query&&(u.query=c.query)}else u.host&&(u.hostname=parse(u.host).host);installTimerFunctions(this,u),this.secure=u.secure!=null?u.secure:typeof location<"u"&&location.protocol==="https:",u.hostname&&!u.port&&(u.port=this.secure?"443":"80"),this.hostname=u.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=u.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},u.transports.forEach(c=>{const p=c.prototype.name;this.transports.push(p),this._transportsByName[p]=c}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},u),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode(this.opts.query)),withEventListeners&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},OFFLINE_EVENT_LISTENERS.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(i){const u=Object.assign({},this.opts.query);u.EIO=protocol$1,u.transport=i,this.id&&(u.sid=this.id);const c=Object.assign({},this.opts,{query:u,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[i]);return new this._transportsByName[i](c)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const i=this.opts.rememberUpgrade&&SocketWithoutUpgrade.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const u=this.createTransport(i);u.open(),this.setTransport(u)}setTransport(i){this.transport&&this.transport.removeAllListeners(),this.transport=i,i.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",u=>this._onClose("transport close",u))}onOpen(){this.readyState="open",SocketWithoutUpgrade.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",i),this.emitReserved("heartbeat"),i.type){case"open":this.onHandshake(JSON.parse(i.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const u=new Error("server error");u.code=i.data,this._onError(u);break;case"message":this.emitReserved("data",i.data),this.emitReserved("message",i.data);break}}onHandshake(i){this.emitReserved("handshake",i),this.id=i.sid,this.transport.query.sid=i.sid,this._pingInterval=i.pingInterval,this._pingTimeout=i.pingTimeout,this._maxPayload=i.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const i=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+i,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},i),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const i=this._getWritablePackets();this.transport.send(i),this._prevBufferLen=i.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let u=1;for(let c=0;c<this.writeBuffer.length;c++){const p=this.writeBuffer[c].data;if(p&&(u+=byteLength(p)),c>0&&u>this._maxPayload)return this.writeBuffer.slice(0,c);u+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const i=Date.now()>this._pingTimeoutTime;return i&&(this._pingTimeoutTime=0,nextTick(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),i}write(i,u,c){return this._sendPacket("message",i,u,c),this}send(i,u,c){return this._sendPacket("message",i,u,c),this}_sendPacket(i,u,c,p){if(typeof u=="function"&&(p=u,u=void 0),typeof c=="function"&&(p=c,c=null),this.readyState==="closing"||this.readyState==="closed")return;c=c||{},c.compress=c.compress!==!1;const g={type:i,data:u,options:c};this.emitReserved("packetCreate",g),this.writeBuffer.push(g),p&&this.once("flush",p),this.flush()}close(){const i=()=>{this._onClose("forced close"),this.transport.close()},u=()=>{this.off("upgrade",u),this.off("upgradeError",u),i()},c=()=>{this.once("upgrade",u),this.once("upgradeError",u)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?c():i()}):this.upgrading?c():i()),this}_onError(i){if(SocketWithoutUpgrade.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",i),this._onClose("transport error",i)}_onClose(i,u){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),withEventListeners&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const c=OFFLINE_EVENT_LISTENERS.indexOf(this._offlineEventListener);c!==-1&&OFFLINE_EVENT_LISTENERS.splice(c,1)}this.readyState="closed",this.id=null,this.emitReserved("close",i,u),this.writeBuffer=[],this._prevBufferLen=0}}}SocketWithoutUpgrade.protocol=protocol$1;class SocketWithUpgrade extends SocketWithoutUpgrade{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let i=0;i<this._upgrades.length;i++)this._probe(this._upgrades[i])}_probe(i){let u=this.createTransport(i),c=!1;SocketWithoutUpgrade.priorWebsocketSuccess=!1;const p=()=>{c||(u.send([{type:"ping",data:"probe"}]),u.once("packet",w=>{if(!c)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",u),!u)return;SocketWithoutUpgrade.priorWebsocketSuccess=u.name==="websocket",this.transport.pause(()=>{c||this.readyState!=="closed"&&(T(),this.setTransport(u),u.send([{type:"upgrade"}]),this.emitReserved("upgrade",u),u=null,this.upgrading=!1,this.flush())})}else{const R=new Error("probe error");R.transport=u.name,this.emitReserved("upgradeError",R)}}))};function g(){c||(c=!0,T(),u.close(),u=null)}const v=w=>{const R=new Error("probe error: "+w);R.transport=u.name,g(),this.emitReserved("upgradeError",R)};function x(){v("transport closed")}function E(){v("socket closed")}function _(w){u&&w.name!==u.name&&g()}const T=()=>{u.removeListener("open",p),u.removeListener("error",v),u.removeListener("close",x),this.off("close",E),this.off("upgrading",_)};u.once("open",p),u.once("error",v),u.once("close",x),this.once("close",E),this.once("upgrading",_),this._upgrades.indexOf("webtransport")!==-1&&i!=="webtransport"?this.setTimeoutFn(()=>{c||u.open()},200):u.open()}onHandshake(i){this._upgrades=this._filterUpgrades(i.upgrades),super.onHandshake(i)}_filterUpgrades(i){const u=[];for(let c=0;c<i.length;c++)~this.transports.indexOf(i[c])&&u.push(i[c]);return u}}let Socket$1=class extends SocketWithUpgrade{constructor(i,u={}){const c=typeof i=="object"?i:u;(!c.transports||c.transports&&typeof c.transports[0]=="string")&&(c.transports=(c.transports||["polling","websocket","webtransport"]).map(p=>transports[p]).filter(p=>!!p)),super(i,c)}};function url(t,i="",u){let c=t;u=u||typeof location<"u"&&location,t==null&&(t=u.protocol+"//"+u.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=u.protocol+t:t=u.host+t),/^(https?|wss?):\/\//.test(t)||(typeof u<"u"?t=u.protocol+"//"+t:t="https://"+t),c=parse(t)),c.port||(/^(http|ws)$/.test(c.protocol)?c.port="80":/^(http|ws)s$/.test(c.protocol)&&(c.port="443")),c.path=c.path||"/";const g=c.host.indexOf(":")!==-1?"["+c.host+"]":c.host;return c.id=c.protocol+"://"+g+":"+c.port+i,c.href=c.protocol+"://"+g+(u&&u.port===c.port?"":":"+c.port),c}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,toString=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString.call(File)==="[object FileConstructor]";function isBinary(t){return withNativeArrayBuffer&&(t instanceof ArrayBuffer||isView(t))||withNativeBlob&&t instanceof Blob||withNativeFile&&t instanceof File}function hasBinary(t,i){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let u=0,c=t.length;u<c;u++)if(hasBinary(t[u]))return!0;return!1}if(isBinary(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return hasBinary(t.toJSON(),!0);for(const u in t)if(Object.prototype.hasOwnProperty.call(t,u)&&hasBinary(t[u]))return!0;return!1}function deconstructPacket(t){const i=[],u=t.data,c=t;return c.data=_deconstructPacket(u,i),c.attachments=i.length,{packet:c,buffers:i}}function _deconstructPacket(t,i){if(!t)return t;if(isBinary(t)){const u={_placeholder:!0,num:i.length};return i.push(t),u}else if(Array.isArray(t)){const u=new Array(t.length);for(let c=0;c<t.length;c++)u[c]=_deconstructPacket(t[c],i);return u}else if(typeof t=="object"&&!(t instanceof Date)){const u={};for(const c in t)Object.prototype.hasOwnProperty.call(t,c)&&(u[c]=_deconstructPacket(t[c],i));return u}return t}function reconstructPacket(t,i){return t.data=_reconstructPacket(t.data,i),delete t.attachments,t}function _reconstructPacket(t,i){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<i.length)return i[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let u=0;u<t.length;u++)t[u]=_reconstructPacket(t[u],i);else if(typeof t=="object")for(const u in t)Object.prototype.hasOwnProperty.call(t,u)&&(t[u]=_reconstructPacket(t[u],i));return t}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(i){this.replacer=i}encode(i){return(i.type===PacketType.EVENT||i.type===PacketType.ACK)&&hasBinary(i)?this.encodeAsBinary({type:i.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:i.nsp,data:i.data,id:i.id}):[this.encodeAsString(i)]}encodeAsString(i){let u=""+i.type;return(i.type===PacketType.BINARY_EVENT||i.type===PacketType.BINARY_ACK)&&(u+=i.attachments+"-"),i.nsp&&i.nsp!=="/"&&(u+=i.nsp+","),i.id!=null&&(u+=i.id),i.data!=null&&(u+=JSON.stringify(i.data,this.replacer)),u}encodeAsBinary(i){const u=deconstructPacket(i),c=this.encodeAsString(u.packet),p=u.buffers;return p.unshift(c),p}}class Decoder extends Emitter{constructor(i){super(),this.reviver=i}add(i){let u;if(typeof i=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");u=this.decodeString(i);const c=u.type===PacketType.BINARY_EVENT;c||u.type===PacketType.BINARY_ACK?(u.type=c?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(u),u.attachments===0&&super.emitReserved("decoded",u)):super.emitReserved("decoded",u)}else if(isBinary(i)||i.base64)if(this.reconstructor)u=this.reconstructor.takeBinaryData(i),u&&(this.reconstructor=null,super.emitReserved("decoded",u));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+i)}decodeString(i){let u=0;const c={type:Number(i.charAt(0))};if(PacketType[c.type]===void 0)throw new Error("unknown packet type "+c.type);if(c.type===PacketType.BINARY_EVENT||c.type===PacketType.BINARY_ACK){const g=u+1;for(;i.charAt(++u)!=="-"&&u!=i.length;);const v=i.substring(g,u);if(v!=Number(v)||i.charAt(u)!=="-")throw new Error("Illegal attachments");c.attachments=Number(v)}if(i.charAt(u+1)==="/"){const g=u+1;for(;++u&&!(i.charAt(u)===","||u===i.length););c.nsp=i.substring(g,u)}else c.nsp="/";const p=i.charAt(u+1);if(p!==""&&Number(p)==p){const g=u+1;for(;++u;){const v=i.charAt(u);if(v==null||Number(v)!=v){--u;break}if(u===i.length)break}c.id=Number(i.substring(g,u+1))}if(i.charAt(++u)){const g=this.tryParse(i.substr(u));if(Decoder.isPayloadValid(c.type,g))c.data=g;else throw new Error("invalid payload")}return c}tryParse(i){try{return JSON.parse(i,this.reviver)}catch{return!1}}static isPayloadValid(i,u){switch(i){case PacketType.CONNECT:return isObject(u);case PacketType.DISCONNECT:return u===void 0;case PacketType.CONNECT_ERROR:return typeof u=="string"||isObject(u);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(u)&&(typeof u[0]=="number"||typeof u[0]=="string"&&RESERVED_EVENTS$1.indexOf(u[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(u)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(i){this.packet=i,this.buffers=[],this.reconPack=i}takeBinaryData(i){if(this.buffers.push(i),this.buffers.length===this.reconPack.attachments){const u=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),u}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function isNamespaceValid(t){return typeof t=="string"}const isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function isAckIdValid(t){return t===void 0||isInteger(t)}function isObject(t){return Object.prototype.toString.call(t)==="[object Object]"}function isDataValid(t,i){switch(t){case PacketType.CONNECT:return i===void 0||isObject(i);case PacketType.DISCONNECT:return i===void 0;case PacketType.EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&RESERVED_EVENTS$1.indexOf(i[0])===-1);case PacketType.ACK:return Array.isArray(i);case PacketType.CONNECT_ERROR:return typeof i=="string"||isObject(i);default:return!1}}function isPacketValid(t){return isNamespaceValid(t.nsp)&&isAckIdValid(t.id)&&isDataValid(t.type,t.data)}const parser=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},isPacketValid,protocol},Symbol.toStringTag,{value:"Module"}));function on(t,i,u){return t.on(i,u),function(){t.off(i,u)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(i,u,c){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=i,this.nsp=u,c&&c.auth&&(this.auth=c.auth),this._opts=Object.assign({},c),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const i=this.io;this.subs=[on(i,"open",this.onopen.bind(this)),on(i,"packet",this.onpacket.bind(this)),on(i,"error",this.onerror.bind(this)),on(i,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...i){return i.unshift("message"),this.emit.apply(this,i),this}emit(i,...u){var c,p,g;if(RESERVED_EVENTS.hasOwnProperty(i))throw new Error('"'+i.toString()+'" is a reserved event name');if(u.unshift(i),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(u),this;const v={type:PacketType.EVENT,data:u};if(v.options={},v.options.compress=this.flags.compress!==!1,typeof u[u.length-1]=="function"){const T=this.ids++,w=u.pop();this._registerAckCallback(T,w),v.id=T}const x=(p=(c=this.io.engine)===null||c===void 0?void 0:c.transport)===null||p===void 0?void 0:p.writable,E=this.connected&&!(!((g=this.io.engine)===null||g===void 0)&&g._hasPingExpired());return this.flags.volatile&&!x||(E?(this.notifyOutgoingListeners(v),this.packet(v)):this.sendBuffer.push(v)),this.flags={},this}_registerAckCallback(i,u){var c;const p=(c=this.flags.timeout)!==null&&c!==void 0?c:this._opts.ackTimeout;if(p===void 0){this.acks[i]=u;return}const g=this.io.setTimeoutFn(()=>{delete this.acks[i];for(let x=0;x<this.sendBuffer.length;x++)this.sendBuffer[x].id===i&&this.sendBuffer.splice(x,1);u.call(this,new Error("operation has timed out"))},p),v=(...x)=>{this.io.clearTimeoutFn(g),u.apply(this,x)};v.withError=!0,this.acks[i]=v}emitWithAck(i,...u){return new Promise((c,p)=>{const g=(v,x)=>v?p(v):c(x);g.withError=!0,u.push(g),this.emit(i,...u)})}_addToQueue(i){let u;typeof i[i.length-1]=="function"&&(u=i.pop());const c={id:this._queueSeq++,tryCount:0,pending:!1,args:i,flags:Object.assign({fromQueue:!0},this.flags)};i.push((p,...g)=>(this._queue[0],p!==null?c.tryCount>this._opts.retries&&(this._queue.shift(),u&&u(p)):(this._queue.shift(),u&&u(null,...g)),c.pending=!1,this._drainQueue())),this._queue.push(c),this._drainQueue()}_drainQueue(i=!1){if(!this.connected||this._queue.length===0)return;const u=this._queue[0];u.pending&&!i||(u.pending=!0,u.tryCount++,this.flags=u.flags,this.emit.apply(this,u.args))}packet(i){i.nsp=this.nsp,this.io._packet(i)}onopen(){typeof this.auth=="function"?this.auth(i=>{this._sendConnectPacket(i)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(i){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},i):i})}onerror(i){this.connected||this.emitReserved("connect_error",i)}onclose(i,u){this.connected=!1,delete this.id,this.emitReserved("disconnect",i,u),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(i=>{if(!this.sendBuffer.some(c=>String(c.id)===i)){const c=this.acks[i];delete this.acks[i],c.withError&&c.call(this,new Error("socket has been disconnected"))}})}onpacket(i){if(i.nsp===this.nsp)switch(i.type){case PacketType.CONNECT:i.data&&i.data.sid?this.onconnect(i.data.sid,i.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(i);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(i);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const c=new Error(i.data.message);c.data=i.data.data,this.emitReserved("connect_error",c);break}}onevent(i){const u=i.data||[];i.id!=null&&u.push(this.ack(i.id)),this.connected?this.emitEvent(u):this.receiveBuffer.push(Object.freeze(u))}emitEvent(i){if(this._anyListeners&&this._anyListeners.length){const u=this._anyListeners.slice();for(const c of u)c.apply(this,i)}super.emit.apply(this,i),this._pid&&i.length&&typeof i[i.length-1]=="string"&&(this._lastOffset=i[i.length-1])}ack(i){const u=this;let c=!1;return function(...p){c||(c=!0,u.packet({type:PacketType.ACK,id:i,data:p}))}}onack(i){const u=this.acks[i.id];typeof u=="function"&&(delete this.acks[i.id],u.withError&&i.data.unshift(null),u.apply(this,i.data))}onconnect(i,u){this.id=i,this.recovered=u&&this._pid===u,this._pid=u,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(i=>this.emitEvent(i)),this.receiveBuffer=[],this.sendBuffer.forEach(i=>{this.notifyOutgoingListeners(i),this.packet(i)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(i=>i()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(i){return this.flags.compress=i,this}get volatile(){return this.flags.volatile=!0,this}timeout(i){return this.flags.timeout=i,this}onAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(i),this}prependAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(i),this}offAny(i){if(!this._anyListeners)return this;if(i){const u=this._anyListeners;for(let c=0;c<u.length;c++)if(i===u[c])return u.splice(c,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(i),this}prependAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(i),this}offAnyOutgoing(i){if(!this._anyOutgoingListeners)return this;if(i){const u=this._anyOutgoingListeners;for(let c=0;c<u.length;c++)if(i===u[c])return u.splice(c,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(i){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const u=this._anyOutgoingListeners.slice();for(const c of u)c.apply(this,i.data)}}}function Backoff(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var i=Math.random(),u=Math.floor(i*this.jitter*t);t=(Math.floor(i*10)&1)==0?t-u:t+u}return Math.min(t,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(t){this.ms=t};Backoff.prototype.setMax=function(t){this.max=t};Backoff.prototype.setJitter=function(t){this.jitter=t};class Manager extends Emitter{constructor(i,u){var c;super(),this.nsps={},this.subs=[],i&&typeof i=="object"&&(u=i,i=void 0),u=u||{},u.path=u.path||"/socket.io",this.opts=u,installTimerFunctions(this,u),this.reconnection(u.reconnection!==!1),this.reconnectionAttempts(u.reconnectionAttempts||1/0),this.reconnectionDelay(u.reconnectionDelay||1e3),this.reconnectionDelayMax(u.reconnectionDelayMax||5e3),this.randomizationFactor((c=u.randomizationFactor)!==null&&c!==void 0?c:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(u.timeout==null?2e4:u.timeout),this._readyState="closed",this.uri=i;const p=u.parser||parser;this.encoder=new p.Encoder,this.decoder=new p.Decoder,this._autoConnect=u.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(i){return arguments.length?(this._reconnection=!!i,i||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(i){return i===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=i,this)}reconnectionDelay(i){var u;return i===void 0?this._reconnectionDelay:(this._reconnectionDelay=i,(u=this.backoff)===null||u===void 0||u.setMin(i),this)}randomizationFactor(i){var u;return i===void 0?this._randomizationFactor:(this._randomizationFactor=i,(u=this.backoff)===null||u===void 0||u.setJitter(i),this)}reconnectionDelayMax(i){var u;return i===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=i,(u=this.backoff)===null||u===void 0||u.setMax(i),this)}timeout(i){return arguments.length?(this._timeout=i,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(i){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const u=this.engine,c=this;this._readyState="opening",this.skipReconnect=!1;const p=on(u,"open",function(){c.onopen(),i&&i()}),g=x=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",x),i?i(x):this.maybeReconnectOnOpen()},v=on(u,"error",g);if(this._timeout!==!1){const x=this._timeout,E=this.setTimeoutFn(()=>{p(),g(new Error("timeout")),u.close()},x);this.opts.autoUnref&&E.unref(),this.subs.push(()=>{this.clearTimeoutFn(E)})}return this.subs.push(p),this.subs.push(v),this}connect(i){return this.open(i)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const i=this.engine;this.subs.push(on(i,"ping",this.onping.bind(this)),on(i,"data",this.ondata.bind(this)),on(i,"error",this.onerror.bind(this)),on(i,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(i){try{this.decoder.add(i)}catch(u){this.onclose("parse error",u)}}ondecoded(i){nextTick(()=>{this.emitReserved("packet",i)},this.setTimeoutFn)}onerror(i){this.emitReserved("error",i)}socket(i,u){let c=this.nsps[i];return c?this._autoConnect&&!c.active&&c.connect():(c=new Socket(this,i,u),this.nsps[i]=c),c}_destroy(i){const u=Object.keys(this.nsps);for(const c of u)if(this.nsps[c].active)return;this._close()}_packet(i){const u=this.encoder.encode(i);for(let c=0;c<u.length;c++)this.engine.write(u[c],i.options)}cleanup(){this.subs.forEach(i=>i()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(i,u){var c;this.cleanup(),(c=this.engine)===null||c===void 0||c.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",i,u),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const i=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const u=this.backoff.duration();this._reconnecting=!0;const c=this.setTimeoutFn(()=>{i.skipReconnect||(this.emitReserved("reconnect_attempt",i.backoff.attempts),!i.skipReconnect&&i.open(p=>{p?(i._reconnecting=!1,i.reconnect(),this.emitReserved("reconnect_error",p)):i.onreconnect()}))},u);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}}onreconnect(){const i=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",i)}}const cache={};function lookup(t,i){typeof t=="object"&&(i=t,t=void 0),i=i||{};const u=url(t,i.path||"/socket.io"),c=u.source,p=u.id,g=u.path,v=cache[p]&&g in cache[p].nsps,x=i.forceNew||i["force new connection"]||i.multiplex===!1||v;let E;return x?E=new Manager(c,i):(cache[p]||(cache[p]=new Manager(c,i)),E=cache[p]),u.query&&!i.query&&(i.query=u.queryKey),E.socket(u.path,i)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const blacklist=[MESSAGE_TO_GUEST,EVENT_TO_GUEST,TYPING_ON,TYPING_OFF,RESTART_CHAT_REQUEST,...INTERNAL_ACTIONS,...INTERNAL_ACTIONS$1,"@@localize/SET_ACTIVE_LANGUAGE","@@localize/ADD_TRANSLATION_FOR_LANGUAGE"],socketMiddleware=({dispatch:t,getState:i})=>u=>{let c=null;return p=>{const g=u(p);if(p.type===CONNECT){c?.disconnect(),t(connecting());const v=`/chat?${new URLSearchParams(p.querystrings).toString()}`;c=lookup(`/${p.clientName}${v}`),c.on("action",t),c.on("connect",()=>t(connected())),c.on("disconnect",()=>t(disconnected())),c.on("reconnect",()=>t(reconnected())),c.on("set-translations",(x,E)=>{t(updateIntl({language:x,messages:mergeMessages(x,E)}))}),c.on("set-settings",x=>{t(setSettings(x))}),c.on("enable-conversation-rating",x=>t(enableConversationRating(x))),c.on("speech-transcription",x=>t(receiveSpeechTranscription(x))),c.on("restore-client-state",x=>{t(restoreSessionId(x.sessionId)),t(restorePreviousChatMessages(x.messages))}),c.on("expand-window",({devices:x,initial:E=!1})=>{t({type:EXPAND_WINDOW,devices:x,initial:E})}),c.on("restart-chat",()=>{t(restartChat())}),c.on("login-success",x=>{t(startAuthenticatedChat({loginToken:x.loginToken}))})}else if(p.type==="start-screen/requestLogin")c?.emit("login-requested",p.payload);else if(p.type===START)c?.emit("start-chat",p.payload);else if(p.type===TERMINATE_SESSION)c?.emit("terminate-session",p.payload);else if(p.type===GET_STARTED)c?.emit("get-started",JSON.stringify(p));else if(p.type===AUDIO_MESSAGE_FROM_USER)c?.emit("audio-message",p.buffer);else if(p.type===CONVERSATION_RATING_FROM_GUEST)c?.emit("conversation-rating",p.payload);else if(p.type===DOWNLOAD_TRANSCRIPT_PDF){const{connection:{sessionId:v}}=i();window.location.href=`/transcript-pdf/${v}`}else blacklist.indexOf(p.type)===-1&&p.meta===void 0&&c&&c.emit("action",JSON.stringify(p));return g}},clientName=getClientName(),preloadedState={...loadState(clientName),intl:initialState$3},store=configureStore({middleware:t=>t().concat(socketMiddleware),reducer:rootReducer,preloadedState});store.subscribe(throttle(()=>{const t=store.getState();saveState(clientName,{connection:t.connection,startScreen:t.startScreen})},1e3));const container=document.getElementById("root"),root=clientExports.createRoot(container);root.render(jsxRuntimeExports.jsx(Provider_default,{store,children:jsxRuntimeExports.jsx(App,{})}));
134
- //# sourceMappingURL=index-Cg1x9cJp.js.map
134
+ //# sourceMappingURL=index-CyH54x-W.js.map