@botfabrik/engine-webclient 4.115.6 → 4.115.8

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.
@@ -61,7 +61,8 @@ ${w.current.stack}
61
61
  `).map((e,t)=>(0,X.jsxs)(`span`,{className:Al.text,children:[e,(0,X.jsx)(`br`,{})]},t))]})},Ml=({text:e,commands:t,sources:n,onLinkClick:r})=>(0,X.jsxs)(`div`,{className:Z.bubbleContent,children:[(0,X.jsx)(jl,{text:e,commands:t}),(0,X.jsx)(fl,{sources:n,onLinkClick:r})]}),Nl=(0,x.forwardRef)(({message:e,commands:t,isLastMessage:n,isFirstMessageBySender:r,isLastMessageBySender:i,onReaction:a,onButtonClick:o,onLinkClick:s},c)=>{let l=Pl(e._id,e,t,o,s),u=t=>{a(e._id,t)};switch(e.sender.type){case Dt.GUEST:return(0,X.jsx)(wl,{ref:c,isFirstMessageBySender:r,isLastMessageBySender:i,children:l});default:return(0,X.jsx)(al,{ref:c,message:e,isAnimated:!1,isLastMessage:n,isFirstMessageBySender:r,isLastMessageBySender:i,onReaction:u,children:l})}}),Pl=(e,t,n,r,i)=>{switch(t.type){case Ct.TEXT:return(0,X.jsx)(Ml,{text:t.text,commands:n,sources:t.sources||[],onLinkClick:i});case Ct.DETAIL:{let e=t;return(0,X.jsx)(Cl,{title:e.title,text:e.text,imageUrl:e.imageUrl,itemUrl:e.itemUrl,buttons:e.buttons,sources:t.sources||[],onButtonClick:r,onLinkClick:i})}case Ct.MARKDOWN:{let n=t;return(0,X.jsx)(Ol,{actionId:e,markdown:n.markdown,sources:n.sources||[],onLinkClick:i})}}},Fl=x.memo(Nl,(e,t)=>e.message._id===t.message._id&&e.message.reaction===t.message.reaction&&e.isLastMessage===t.isLastMessage&&e.isFirstMessageBySender===t.isFirstMessageBySender&&e.isLastMessageBySender===t.isLastMessageBySender),Q={ticontainer:`_ticontainer_xg0dn_1`,tiblock:`_tiblock_xg0dn_5`,tidot:`_tidot_xg0dn_12`,mercuryTypingAnimation:`_mercuryTypingAnimation_xg0dn_1`},Il=({isTyping:e=!1})=>(0,X.jsx)(`div`,{className:Q.ticontainer,children:(0,X.jsx)(`div`,{className:Q.tiblock,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:R(Q.tidot,`chat__typingIndicator`),"aria-hidden":`true`}),(0,X.jsx)(`div`,{className:R(Q.tidot,`chat__typingIndicator`),"aria-hidden":`true`}),(0,X.jsx)(`div`,{className:R(Q.tidot,`chat__typingIndicator`),"aria-hidden":`true`})]}):null})}),Ll=Object.assign({_id:`typing-indicator`},new St(``,new Tt)),Rl=({messages:e,isBotTyping:t,commands:n,onTranscriptItemReaction:r,onButtonClick:i,onLinkClick:a})=>{let o=Sa(),s=(0,x.useRef)(0),c=(0,x.useRef)(!0),l=(0,x.useRef)(null),u=(0,x.useRef)(null),d=(0,x.useRef)(null),f=xa(e=>e.settings.enableGeneralConditions);(0,x.useLayoutEffect)(()=>{if(e.length&&l.current&&(s.current<e.length||t)){if(u.current){let e=u.current.offsetTop;l.current.scrollTop=e}else if(d.current){let e=d.current.offsetTop;l.current.scrollTop=e}c.current&&=!1,s.current=e.length}},[e,c,t]);let p,m=e.length;return(0,X.jsxs)(`div`,{ref:l,className:R(Ea.messageContainer,`chat__messageContainer`),style:{scrollBehavior:e.length&&c.current?`auto`:`smooth`},id:`MessageContainer`,"aria-label":o(`conversation.label`),children:[f&&(0,X.jsx)(Yc,{}),(0,X.jsxs)(`ul`,{className:Ea.messages,role:`list`,children:[e.map((o,s)=>{let c=zl(o,p),l=Bl(o,s,e,t);p=o.sender.type;let u=s+1===m,f=o._id||`added-${s}`;return(0,X.jsx)(Fl,{ref:u?d:null,message:o,commands:n,isLastMessage:u,isFirstMessageBySender:c,isLastMessageBySender:l,onButtonClick:i,onLinkClick:a,onReaction:r},f)}),t&&(0,X.jsx)(al,{ref:u,message:Ll,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:p!==Dt.BOT,isLastMessageBySender:!0,children:(0,X.jsx)(Il,{isTyping:!0})},`last`)]})]})},zl=(e,t)=>!t||t!==e.sender.type,Bl=(e,t,n,r)=>{let i=e.sender.type,a=n.length;return t+1===a?!(i===Dt.BOT&&r):i!==n.at(t+1)?.sender.type},Vl=`_bottomSheet_jp8dl_1`,Hl=`_bottomSheetOpen_jp8dl_15`,Ul=`_bottomSheetClose_jp8dl_20`,Wl={bottomSheet:Vl,bottomSheetOpen:Hl,"slide-in":`_slide-in_jp8dl_1`,bottomSheetClose:Ul,"slide-out":`_slide-out_jp8dl_1`},Gl={container:`_container_xc2nx_1`},Kl=({contentUrl:e})=>{let t=xa(e=>e.connection.sessionId),[n,r]=(0,x.useState)(!1);(0,x.useEffect)(()=>{r(t=>t||!!e)},[e]);let i=(0,x.useMemo)(()=>{if(e&&t){let n=new URL(e,document.baseURI);return n.searchParams.set(`sessionId`,t),n.toString()}else return},[e,t]);return(0,X.jsx)(`div`,{className:R(Gl.container,Wl.bottomSheet,{[Wl.bottomSheetOpen]:!!e,[Wl.bottomSheetClose]:n&&!e}),children:i&&(0,X.jsx)(`iframe`,{title:`Drawer`,id:`form-drawer`,src:i,className:Gl.iframe})})},ql={container:`_container_1634s_1`},Jl=({title:e,href:t,children:n})=>(0,X.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),Yl=()=>{let e=Sa()(`powered-by`);return e&&e.length?(0,X.jsx)(`div`,{className:R(ql.container,`chat__poweredBy`),children:(0,X.jsx)(Vc,{options:{overrides:{a:Jl}},children:e})}):null},Xl=(e,t)=>{let n=new Map,r=0;return e.replace(/^#{1,6}\s+/gm,``).replace(/(\*\*|__)(.*?)\1/g,`$2`).replace(/(\*|_)(.*?)\1/g,`$2`).replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`).replace(/\[\^([^\]]+)\]/g,(e,i)=>(n.has(i)||n.set(i,++r),`(${t} ${n.get(i)})`)).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,`
62
62
 
63
63
  `).trim()},Zl=({messages:e,isBotTyping:t})=>{let n=(0,x.useRef)(``),r=Sa(),i=r(`bot-bubble.footnote`),a=e=>{switch(e.type){case`TEXT`:return e.text||``;case`MARKDOWN`:return Xl(e.markdown||``,i);case`DETAIL`:return e.text||e.title||``;default:return``}},o=(()=>{if(t)return r(`chatbot.typing`)??`Chatbot is typing`;let n=[...e].reverse().find(e=>e.sender.type===wa.BOT);return n?a(n):``})();return(0,x.useEffect)(()=>{o!==n.current&&(n.current=o)},[o]),(0,X.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:o})},Ql=({className:e,children:t,...n})=>(0,X.jsx)(ml,{className:R(pl.buttonDefault,e),type:`button`,...n,children:t}),$l=({className:e,children:t,...n})=>(0,X.jsx)(ml,{className:R(pl.buttonPrimary,e),...n,children:t}),eu={container:`_container_h23mk_1`,formContainer:`_formContainer_h23mk_17`,emailInput:`_emailInput_h23mk_22`,description:`_description_h23mk_52`,actions:`_actions_h23mk_57`,validationError:`_validationError_h23mk_67`,submitted:`_submitted_h23mk_74`},tu=({visible:e,onEmailExport:t,onClose:n})=>{let r=Sa(),[i,a]=(0,x.useState)(void 0),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(void 0),u=(0,x.useRef)(null);(0,x.useEffect)(()=>{e?(u.current?.focus(),s(!1),a(e)):i===!0&&a(!1)},[e,i]);let d=e=>{e.preventDefault(),c&&c.length>0&&(t(c),s(!0),setTimeout(n,3*1e3))},f=e=>{let t=e.target.value.trim();l(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(t)?t:``)};return(0,X.jsxs)(`div`,{className:R(eu.container,Wl.bottomSheet,{[Wl.bottomSheetOpen]:i===!0,[Wl.bottomSheetClose]:i===!1}),children:[(0,X.jsx)(`h2`,{children:r(`export-transcript.email.title`)}),(0,X.jsx)(Vc,{className:eu.description,children:r(`export-transcript.email.description`)||``}),(0,X.jsxs)(`form`,{onSubmit:d,className:eu.formContainer,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`input`,{disabled:o,ref:u,type:`email`,placeholder:r(`export-transcript.email.placeholder`),className:eu.emailInput,onChange:f}),c?.length===0?(0,X.jsx)(`div`,{className:eu.validationError,children:r(`export-transcript.email.invalid`)}):null]}),(0,X.jsxs)(`div`,{className:eu.actions,children:[(0,X.jsx)(Ql,{onClick:n,children:r(`export-transcript.email.cancel`)}),(0,X.jsx)($l,{type:`submit`,disabled:o||c===void 0||c.length===0,children:r(`export-transcript.email.send`)})]})]}),o&&(0,X.jsx)(`div`,{className:eu.submitted,children:r(`export-transcript.email.success`)})]})},nu={inputContainer:`_inputContainer_fi5ao_1`},ru={blockUserInput:`_blockUserInput_pot9c_1`,"append-animate":`_append-animate_pot9c_1`},iu=({visible:e})=>{let t=Sa();return e?(0,X.jsx)(`div`,{className:R(ru.blockUserInput,`chat__blockUserInput`),children:t(`block-user-input.title`)}):null},au={commandsDropdown:`_commandsDropdown_fmklx_1`,commands:`_commands_fmklx_1`,command:`_command_fmklx_1`,commandActive:`_commandActive_fmklx_49`},ou=(e,t,n,r,i)=>{(0,x.useEffect)(()=>{let a=a=>{if(e.length)switch(a.key){case`Enter`:n(e[t]);break;case`ArrowUp`:r(t=>t>0?t-1:e.length-1);break;case`ArrowDown`:r(t=>t<e.length-1?t+1:0);break;case`Escape`:i([]);break;default:break}};return document.addEventListener(`keydown`,a),()=>{document.removeEventListener(`keydown`,a)}},[e,t,n,r,i])},su=({text:e,commands:t,onSelectCommand:n,onVisibilityChange:r})=>{let i=(0,x.useRef)(null),a=Sa(),[o,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(cu(t)),[u,d]=(0,x.useState)(0),f=e=>n(`/${e}`);return Xc(i,()=>s([])),ou(o,u,f,d,s),(0,x.useEffect)(()=>{l(cu(t))},[t]),(0,x.useEffect)(()=>{let n=e.length||0;n===0||n>c||!e.startsWith(`/`)?s([]):s(t.filter(lu(e))),d(0)},[t,e,c]),(0,x.useEffect)(()=>{r(!!o.length)},[o,r]),o.length?(0,X.jsx)(`div`,{ref:i,className:au.commandsDropdown,children:(0,X.jsx)(`ul`,{id:`command-list`,className:au.commands,role:`listbox`,children:o.map((e,t)=>(0,X.jsxs)(`li`,{className:R([au.command,u===t&&au.commandActive]),role:`option`,onClick:()=>f(e),onMouseOver:()=>d(t),children:[(0,X.jsxs)(`h1`,{children:[`/`,e]}),(0,X.jsx)(`p`,{children:a(`commands.${e}`)})]},e))})}):null},cu=e=>Math.max(...e.map(e=>e.length+1)),lu=e=>t=>{let n=`/${t}`;return n.startsWith(e)&&n.length>=e.length},uu=`_callToActionContainer_d8izj_1`,du=`_callToActionTitle_d8izj_23`,fu=`_rateOverlay_d8izj_30`,pu=`_body_d8izj_52`,mu=`_footer_d8izj_60`,hu=`_actions_d8izj_75`,gu=`_bubbles_d8izj_89`,_u=`_rateFeedbackBotBubble_d8izj_118`,vu=`_rateFeedbackGuestBubble_d8izj_124`,yu=`_avatar_d8izj_130`,bu=`_fadeInLeft_d8izj_1`,xu=`_bubble_d8izj_89`,Su=`_appear_d8izj_1`,Cu=`_botBubble_d8izj_156`,wu=`_guestBubble_d8izj_167`,Tu=`_rateText_d8izj_186`,Eu=`_stars_d8izj_191`,Du=`_starsSmall_d8izj_205`,Ou=`_starsLarge_d8izj_211`,ku=`_star_d8izj_191`,Au=`_starReadonly_d8izj_225`,ju=`_starIcon_d8izj_235`,Mu=`_starsDescriptionContainer_d8izj_253`,Nu=`_starsDescription_d8izj_253`,Pu={callToActionContainer:uu,"append-animate":`_append-animate_d8izj_1`,callToActionTitle:du,rateOverlay:fu,body:pu,footer:mu,actions:hu,bubbles:gu,rateFeedbackBotBubble:_u,rateFeedbackGuestBubble:vu,avatar:yu,fadeInLeft:bu,bubble:xu,appear:Su,botBubble:Cu,guestBubble:wu,rateText:Tu,stars:Eu,starsSmall:Du,starsLarge:Ou,star:ku,starReadonly:Au,starIcon:ju,starsDescriptionContainer:Mu,starsDescription:Nu},Fu=({value:e,index:t,count:n,readonly:r,onHover:i,onClick:a})=>{let o=e=>{a&&e.key===`Enter`&&a()};return(0,X.jsx)(`li`,{className:R(Pu.star,{[Pu.starReadonly]:r},`chat__conversationRating__star`),children:(0,X.jsx)(`div`,{role:`radio`,"aria-checked":e>t?`true`:`false`,"aria-posinset":t+1,"aria-setsize":n,tabIndex:0,onMouseOver:i,onKeyDown:o,onClick:a,children:(0,X.jsx)(`span`,{role:`img`,"aria-label":`Star`,className:R(Pu.starIcon),children:(0,X.jsx)(`svg`,{viewBox:`64 64 896 896`,focusable:`false`,"data-icon":`star`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,children:(0,X.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`})})})})})},Iu=5,Lu=({value:e,size:t,readonly:n=!1,onChange:r})=>{let[i,a]=(0,x.useState)(void 0),o=()=>{a(void 0)},s=e=>()=>{n||a(e+1)},c=t=>()=>{r&&!n&&(r(t===0&&e===1?0:t+1),a(void 0))};return(0,X.jsx)(`ul`,{tabIndex:0,role:`radiogroup`,className:R(Pu.stars,{[Pu.starsSmall]:t===`small`,[Pu.starsLarge]:t===`large`},`chat__conversationRating__stars`,{chat__conversationRating__stars__small:t===`small`,chat__conversationRating__stars__large:t===`large`}),onMouseOut:o,children:Array(Iu).fill(0).map((t,r)=>(0,X.jsx)(Fu,{value:i===void 0?e:i,index:r,count:Iu,readonly:n,onHover:s(r),onClick:c(r)},r))})},Ru=({visible:e,onRate:t})=>{let n=Sa();return e?(0,X.jsxs)(`div`,{className:R(Pu.callToActionContainer,`chat__conversationRating__callToAction`),children:[(0,X.jsx)(`div`,{className:R(Pu.callToActionTitle,`chat__conversationRating__callToAction__title`),children:n(`conversation-rating.call-to-action.title`)}),(0,X.jsx)(Lu,{value:0,size:`small`,onChange:t})]}):null},zu=({isFirstMessageBySender:e,isLastMessageBySender:t,children:n})=>(0,X.jsxs)(`div`,{className:R(Z.message,Z.messageBot,e&&Z.messageBotFirst,t&&Z.messageBotLast,`chat__bubbleContainer`,`chat__botBubbleContainer`,e&&`chat__bubbleContainer--first`,t&&`chat__bubbleContainer--last`),children:[(0,X.jsx)(`img`,{className:R(Z.avatar,Z.botAvatar),src:`bot.svg`,alt:`Bot`}),(0,X.jsx)(`div`,{className:R(Z.bubble,Z.bubbleLeft,`chat__bubble`,`chat__botBubble`),children:(0,X.jsx)(`div`,{className:R(Z.leftText,Z.bubbleContent),children:n})})]}),Bu=({children:e})=>(0,X.jsx)(`div`,{className:R(Z.message,Z.messageGuest,Z.messageGuestFirst,Z.messageGuestLast,`chat__bubbleContainer`,`chat__guestBubbleContainer`,`chat__bubbleContainer--first`,`chat__bubbleContainer--last`),children:(0,X.jsx)(`div`,{className:R(Z.bubble,Z.bubbleRight,`chat__bubble`,`chat__guestBubble`),children:(0,X.jsx)(`div`,{className:R(Z.rightText,Z.bubbleContent),children:e})})}),Vu=()=>{let e=Sa(),t=ba(),n=xa(e=>e.chat.conversationRating),[r,i]=(0,x.useState)(n.rating?.value||0),[a,o]=(0,x.useState)(void 0),[s,c]=(0,x.useState)(void 0),[l,u]=(0,x.useState)({submitted:!1,feedback:``}),d=(0,x.useRef)(null),[f,p]=(0,x.useState)(!1);(0,x.useEffect)(()=>{n.opener?(u({submitted:!1,feedback:``}),c(!0)):s===!0&&c(!1)},[n.opener,s]),(0,x.useEffect)(()=>{i(n.rating?.value||0)},[n.rating?.value,n.opener]),(0,x.useEffect)(()=>{d.current&&(d.current.value=n.rating?.feedback||``)},[n.rating?.feedback]),(0,x.useEffect)(()=>{let t=r>0?e(`conversation-rating.overlay.bot-message.rate-feedback.value-${r}`):void 0;o(t?.length?t:void 0)},[r,e]),(0,x.useEffect)(()=>{l.submitted?setTimeout(()=>p(!0),l.feedback.length?500:0):p(!1)},[l]);let m=e=>{e.preventDefault();let n=d.current?.value?.trim()||``;t(tn(r,n)),u({submitted:!0,feedback:n})},h=()=>{n.opener===`CLOSE_CHAT`?t(Ji()):n.opener===`RESTART_CHAT`?t(va()):t(Qi())};return(0,X.jsx)(`div`,{className:R(Pu.rateOverlay,Wl.bottomSheet,`chat__conversationRating__overlay`,{[Wl.bottomSheetOpen]:s===!0,[Wl.bottomSheetClose]:s===!1}),children:(0,X.jsxs)(`form`,{onSubmit:m,children:[(0,X.jsxs)(`div`,{className:R(Pu.body,`chat__conversationRating__overlay__body`),children:[(0,X.jsx)(`div`,{}),(0,X.jsx)(`div`,{className:R(Pu.bubbles),children:n.opener&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(zu,{isFirstMessageBySender:!0,isLastMessageBySender:!a,children:[(0,X.jsx)(`h2`,{children:e(`conversation-rating.overlay.title`)}),(0,X.jsxs)(`div`,{className:R(Pu.starsDescriptionContainer),children:[(0,X.jsx)(Lu,{value:r,size:`large`,readonly:l.submitted,onChange:i}),(0,X.jsxs)(`div`,{className:R(Pu.starsDescription),children:[(0,X.jsx)(`div`,{children:e(`conversation-rating.overlay.star.very-bad`)}),(0,X.jsx)(`div`,{children:e(`conversation-rating.overlay.star.very-good`)})]})]})]}),a&&(0,X.jsx)(zu,{isFirstMessageBySender:!1,isLastMessageBySender:!f||!!l.feedback.length,children:(0,X.jsx)(`div`,{children:a})}),!!l.feedback.length&&(0,X.jsx)(Bu,{children:l.feedback}),f&&(0,X.jsx)(zu,{isFirstMessageBySender:!!l.feedback.length,isLastMessageBySender:!0,children:(0,X.jsx)(`div`,{children:e(`conversation-rating.overlay.bot-message.submit-feedback`)})})]})})]}),(0,X.jsxs)(`div`,{className:R(Pu.footer,`chat__conversationRating__overlay__footer`),children:[!l.submitted&&(0,X.jsx)(`input`,{ref:d,defaultValue:n.rating?.feedback||``,placeholder:e(`conversation-rating.overlay.guest-feedback.input-placeholder`)}),(0,X.jsxs)(`div`,{className:R(Pu.actions,`chat__conversationRating__overlay__footer__actions`),children:[l.submitted?(0,X.jsx)($l,{type:`button`,disabled:!r,onClick:h,children:n.opener===`CLOSE_CHAT`?e(`conversation-rating.overlay.action.close-chat`):n.opener===`RESTART_CHAT`?e(`conversation-rating.overlay.action.restart-chat`):e(`conversation-rating.overlay.action.back-to-chat`)},`close-button`):(0,X.jsx)($l,{type:`submit`,disabled:!r,children:e(`conversation-rating.overlay.action.submit`)},`submit-button`),n.opener!==`CHAT`&&!l.submitted&&(0,X.jsx)(Ql,{onClick:h,children:n.opener===`CLOSE_CHAT`?e(`conversation-rating.overlay.action.close-chat`):n.opener===`RESTART_CHAT`?e(`conversation-rating.overlay.action.restart-chat`):e(`conversation-rating.overlay.action.cancel`)})]})]})]})})},Hu=(0,x.memo)(({numberOfMessagesFromGuest:e})=>{let t=ba(),n=xa(e=>e.chat.conversationRating),r=e=>{t(Zi(`CHAT`,e))},i=!n.rating?.value&&e>=1;return n.enabled?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ru,{visible:i,onRate:r}),(0,X.jsx)(Vu,{})]}):null}),Uu={inputWrapper:`_inputWrapper_18j9q_1`,withOpenCommands:`_withOpenCommands_18j9q_13`,actions:`_actions_18j9q_18`,messageInputWrapper:`_messageInputWrapper_18j9q_53`,messageInput:`_messageInput_18j9q_53`,buttons:`_buttons_18j9q_78`,button:`_button_18j9q_78`},Wu={audioRecorder:`_audioRecorder_g845f_1`,audioButton:`_audioButton_g845f_6`,recorderIcon:`_recorderIcon_g845f_37`,pulse:`_pulse_g845f_1`,spinning:`_spinning_g845f_60`,spin:`_spin_g845f_60`},Gu=2048,Ku=16e3,qu=class extends x.Component{audioInput=null;volume=null;leftchannel=[];recorder=null;recordingLength=0;sampleRate=null;mediaStream=null;constructor(e){super(e),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(e){this.mediaStream=e,this.leftchannel.length=0,this.recordingLength=0,this.initRecording(e)}initRecording(e){let t=new(window.AudioContext||window.webkitAudioContext);this.sampleRate=t.sampleRate,this.volume=t.createGain(),this.audioInput=t.createMediaStreamSource(e),this.audioInput.connect(this.volume),this.recorder=t.createScriptProcessor(Gu,1,1),this.recorder.onaudioprocess=this.processRecordingInput,this.volume.connect(this.recorder),this.recorder.connect(t.destination)}processRecordingInput(e){if(this.state.recordingState===`connecting`&&this.setState({recordingState:`recording`}),this.state.recordingState!==`none`){let t=e.inputBuffer.getChannelData(0);this.leftchannel.push(new Float32Array(t)),this.recordingLength+=Gu}}handleClickSubmitAudio(){let e=Ju(Zu(Xu(this.leftchannel,this.recordingLength),this.sampleRate||0));this.props.onAudioRecorded(e),this.handleClickStopAudio()}handleClickStopAudio(){this.setState({recordingState:`none`}),this.audioInput?.disconnect(),this.volume?.disconnect(),this.recorder?.disconnect(),this.mediaStream&&this.mediaStream?.getAudioTracks().forEach(e=>{e.stop()})}render(){return(0,X.jsxs)(`div`,{className:Wu.audioRecorder,children:[this.state.recordingState===`none`&&(0,X.jsx)(`button`,{className:R(Wu.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:(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,X.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`}),(0,X.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]})}),this.state.recordingState===`connecting`&&(0,X.jsxs)(`svg`,{className:Wu.spinning,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,X.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`}),(0,X.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]}),this.state.recordingState===`recording`&&(0,X.jsxs)(`div`,{className:Wu.audioRecorder,children:[(0,X.jsx)(`button`,{className:R(Wu.audioButton),onClick:this.handleClickStopAudio,"aria-label":this.props.translate(`message-input.actions.stop-audio-recording.label`),tabIndex:0,children:(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,X.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`}),(0,X.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]})}),(0,X.jsx)(`div`,{className:Wu.recorderIcon}),(0,X.jsx)(`button`,{className:R(Wu.audioButton),type:`submit`,onClick:this.handleClickSubmitAudio,"aria-label":this.props.translate(`message-input.actions.submit-audio-recording.label`),tabIndex:0,autoFocus:!0,children:(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,X.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,X.jsx)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`})]})})]})]})}},Ju=e=>{let t=new ArrayBuffer(44+e.length*2),n=new DataView(t);Yu(n,0,`RIFF`),n.setUint32(4,44+e.length*2,!0),Yu(n,8,`WAVE`),Yu(n,12,`fmt `),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,Ku,!0),n.setUint32(28,Ku*4,!0),n.setUint16(32,4,!0),n.setUint16(34,16,!0),Yu(n,36,`data`),n.setUint32(40,e.length*2,!0);let r=e.length,i=44;for(let t=0;t<r;t++)n.setInt16(i,e[t]*(32767*1),!0),i+=2;return new Blob([n],{type:`audio/wav`})},Yu=(e,t,n)=>{for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))},Xu=(e,t)=>{let n=new Float32Array(t),r=0,i=e.length;for(let t=0;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n},Zu=(e,t)=>{if(Ku===t)return e;let n=t/Ku,r=Math.round(e.length/n),i=new Float32Array(r),a=0,o=0;for(;a<i.length;){let t=Math.round((a+1)*n),r=0,s=0;for(let n=o;n<t&&n<e.length;n++)r+=e[n],s++;i[a]=r/s,a++,o=t}return i},Qu=({onClick:e})=>{let t=Sa();return(0,X.jsxs)(`button`,{onClick:e,type:`button`,"aria-label":t(`message-input.actions.command.label`),children:[(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`32`,height:`32`,fill:`#000000`,viewBox:`0 0 256 256`,children:[(0,X.jsx)(`rect`,{x:`32`,y:`32`,width:`192`,height:`192`,rx:`16`,ry:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`16`}),(0,X.jsx)(`line`,{x1:`80`,y1:`176`,x2:`176`,y2:`80`,stroke:`currentColor`,"stroke-width":`16`,"stroke-linecap":`round`})]}),(0,X.jsx)(`span`,{children:t(`message-input.actions.command.label`)})]})},$u=({disabled:e,textInput:t,commandsVisible:n,hasCommands:r,onTextInput:i,onTextInputSubmit:a,onAudioRecorded:o})=>{let s=Sa(),c=(0,x.useRef)(null),l=(0,x.useRef)(0),{enableSpeechSupport:u}=xa(e=>e.settings),d=e=>{e.style.height=``;let{scrollHeight:t}=e,n=Math.max(l.current,Math.min(t,150));e.style.height=`${n}px`,e.style.overflowY=t>150?`auto`:`hidden`};(0,x.useEffect)(()=>{let e=c.current;e&&(l.current===0&&(l.current=e.scrollHeight),d(e),e.focus())},[t]);let f=()=>{let e=c.current;e&&t.trim().length>=1&&a(t.trim())&&(e.value=``,e.style.height=``,e.focus())},p=e=>{e.preventDefault(),f()},m=e=>{let t=e.target.value;i(t),d(e.target)},h=e=>{e.code===`Enter`&&!e.shiftKey?(e.repeat||f(),e.preventDefault()):n&&(e.code===`ArrowUp`||e.code===`ArrowDown`)&&e.preventDefault()},g=()=>{t.startsWith(`/`)?i(``):i(`/`)};return(0,X.jsxs)(`form`,{className:R(Uu.inputWrapper,n&&Uu.withOpenCommands,`chat__textInput`),onSubmit:p,children:[(0,X.jsxs)(`div`,{className:Uu.messageInputWrapper,children:[(0,X.jsx)(`textarea`,{id:`user_input`,ref:c,className:Uu.messageInput,tabIndex:0,placeholder:s(`message-input-placeholder`),value:t,onChange:m,onKeyDown:h,"aria-label":s(`message-input-label`),"aria-controls":r?`command-list`:void 0,"aria-haspopup":r?`listbox`:void 0}),r&&(0,X.jsx)(`div`,{className:Uu.actions,children:(0,X.jsx)(Qu,{onClick:g})})]}),(0,X.jsx)(`div`,{className:R(Uu.buttons,`chat__buttons`),children:t.length||!u||navigator.mediaDevices===void 0?(0,X.jsx)(`button`,{className:R(Uu.button,`chat__button`),type:`submit`,"aria-label":s(`message-input.actions.submit.label`),"data-title":s(`message-input.actions.submit.label`),tabIndex:0,disabled:e,children:(0,X.jsx)(`svg`,{viewBox:`64 64 896 896`,focusable:`false`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,children:(0,X.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`})})}):u&&navigator.mediaDevices!==void 0&&(0,X.jsx)(qu,{translate:s,onAudioRecorded:o})})]})},ed={quickReplies:`_quickReplies_83npe_1`,quickReply:`_quickReply_83npe_9`},td=({quickReplies:e,onQuickReplyClick:t})=>e.length?(0,X.jsx)(`div`,{className:R(ed.quickReplies,`chat__quickReplies`),children:e.map(e=>(0,X.jsx)(ml,{tabIndex:0,className:R(ed.quickReply,`chat__button`,`chat__quickReply`),onClick:()=>t(e),children:e.label},e.label))}):null,nd=5e3,rd=1e3,id=({isBotTyping:e,quickReplies:t,numberOfMessagesFromGuest:n,commands:r,onTextInput:i,onQuickReplyClick:a,onAudioRecorded:o})=>{let[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(!1),p=(0,x.useRef)(0),m=(0,x.useRef)(0);return(0,x.useEffect)(()=>{if(l&&!e){let e=p.current?Date.now()-p.current:0;e>nd?u(!1):setTimeout(()=>{u(!1)},nd-e)}},[l,e]),(0,x.useEffect)(()=>{l&&(p.current=Date.now())},[l]),(0,X.jsxs)(`div`,{className:R(nu.inputContainer),children:[(0,X.jsx)(td,{quickReplies:t,onQuickReplyClick:a}),(0,X.jsx)(iu,{visible:l}),!l&&(0,X.jsx)(Hu,{numberOfMessagesFromGuest:n}),!!r?.length&&(0,X.jsx)(su,{text:s,commands:r,onSelectCommand:e=>{c(e+` `)},onVisibilityChange:f}),(0,X.jsx)($u,{textInput:s,disabled:l,commandsVisible:d,hasCommands:!!r?.length,onTextInput:c,onTextInputSubmit:t=>{let n=Date.now()-m.current<rd;return d?!1:e||n?(u(!0),!1):(i(t),c(``),m.current=Date.now(),!0)},onAudioRecorded:o})]})},ad=Ge(e=>{let{messages:t,quickReplies:n,isBotTyping:r,drawerContentUrl:i}=e.chat;return{messages:t,quickReplies:n,isBotTyping:r,drawerContentUrl:i}},e=>({onRestartChat:()=>e(va()),onMessageFromUser:t=>e(It(t)),onAudioRecorded:t=>e(Xt(t)),onActionFromUser:t=>e(t),onQuickReplyClick:t=>e(Ft(t)),onNluEvent:t=>e(nn(t)),onButtonClick:t=>e(an(t)),onLinkClick:t=>e(on(t)),onTranscriptExport:t=>e(Qt(t)),onTranscriptItemReaction:(t,n)=>{e(jt(t,n?.type||null,n?.category,n?.comment))}}))(({clientName:e,messages:t,quickReplies:n,isBotTyping:r,drawerContentUrl:i,onMessageFromUser:a,onQuickReplyClick:o,onButtonClick:s,onLinkClick:c,onAudioRecorded:l,onTranscriptExport:u,onTranscriptItemReaction:d})=>{let f=ba(),p=xa(e=>e.connection.connectionState),{enableTranscriptExportEmail:m,commands:h}=xa(e=>e.settings),{showTranscriptMailOverlay:g,conversationRating:_}=xa(e=>e.chat),v=t.filter(e=>e.sender.type===wa.GUEST).length;return(0,x.useEffect)(()=>{p===Ca.CONNECTED&&f(_a(e))},[e,p,f]),(0,X.jsxs)(`div`,{className:Ta.container,children:[(0,X.jsx)(Zl,{messages:t,isBotTyping:r}),(0,X.jsxs)(`div`,{className:R([Ta.chatcontent,(g||_?.opener)&&Ta.accessabilityHidden]),children:[(0,X.jsx)(Rl,{messages:t,isBotTyping:r,commands:h,onButtonClick:s,onLinkClick:c,onTranscriptItemReaction:d}),(0,X.jsx)(id,{isBotTyping:r,quickReplies:r?[]:n,numberOfMessagesFromGuest:v,commands:h,onQuickReplyClick:o,onTextInput:a,onAudioRecorded:l}),(0,X.jsx)(Yl,{})]}),m&&(0,X.jsx)(tu,{visible:!!g,onEmailExport:u,onClose:()=>{f(Xi())}}),(0,X.jsx)(Kl,{contentUrl:i})]})}),od=()=>(0,x.useMemo)(()=>{try{return window.self!==window.top}catch{return!0}},[]),sd=e=>t=>{let n=t.key;(n===`ArrowDown`||n===`ArrowRight`||n===`Enter`||n===` `||n===`Space`)&&(t.stopPropagation(),e())},cd=({onClick:e})=>{let t=Sa();return od()?(0,X.jsx)(`button`,{className:`tooltip--bottom-left`,"aria-label":t(`header.close-chat`),"data-title":t(`header.close-chat`),tabIndex:0,onClick:e,onKeyDown:sd(e),children:(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,X.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},ld={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`},ud=({icon:e})=>{switch(e){case`arrow-counter-clockwise`:return(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,viewBox:`0 0 256 256`,children:(0,X.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(0,X.jsx)(`div`,{})}},dd=(0,x.forwardRef)(({selected:e,item:t,onClick:n},r)=>{let i=Sa(),a=e=>{e.preventDefault(),n()};return(0,X.jsx)(`li`,{"aria-selected":e,role:`option`,className:t.withDivider?ld.divider:void 0,children:(0,X.jsxs)(`a`,{ref:r,type:`button`,role:`button`,tabIndex:-1,onClick:a,children:[(0,X.jsx)(ud,{icon:t.icon}),(0,X.jsx)(`span`,{children:i(`header.menu.${t.id}`)})]})})}),fd=(e,t)=>{let n=od(),{menuItems:r,enableStandaloneView:i,enableTranscriptExportPdf:a,enableTranscriptExportEmail:o}=xa(e=>e.settings),s=xa(e=>e.chat.conversationRating.enabled);return(0,x.useMemo)(()=>{let c=[],l=r.filter(({visibility:t})=>e?t===`always`||t===`chat-only`:t===`always`||t===`start-screen-only`);if(e&&(c.push({id:`restart-chat`,type:`restart-chat`,icon:`arrow-counter-clockwise`,visibility:`chat-only`}),n&&i&&c.push({id:`expand-chat-window`,type:`expand-chat-window`,icon:`expand`,visibility:`always`}),t&&a&&c.push({id:`download-transcript`,type:`download-transcript`,icon:`download`,visibility:`chat-only`}),t&&o&&c.push({id:`send-transcript`,type:`send-transcript`,icon:`mail`,visibility:`chat-only`}),t&&s&&c.push({id:`rate-conversation`,type:`rate-conversation`,icon:`star`,visibility:`chat-only`}),c.length>0&&l.length)){let e=c.pop();e&&r.length&&c.push({...e,withDivider:!0})}return c.push(...l),c},[e,t,a,o,i,s,n,r])},pd=({chatStarted:e,hasGuestMessages:t})=>{let n=ba(),r=Sa(),{enabled:i,opener:a}=xa(e=>e.chat.conversationRating),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(-1),u=(0,x.useRef)(null),d=(0,x.useRef)(null),f=(0,x.useRef)([]),p=fd(e,t);(0,x.useEffect)(()=>{f.current[c]?.focus()},[c]);let m=(0,x.useCallback)(()=>{n(t&&i&&!a?Zi(`RESTART_CHAT`):va()),s(!1),l(0)},[t,i,a,n]),h=(0,x.useCallback)(e=>{switch(e.type){case`restart-chat`:m();break;case`expand-chat-window`:{let e=new URL(window.location.origin);e.pathname=window.location.pathname,e.search=window.location.search,e.hash=window.location.hash,window.open(e.href,`_blank`);break}case`download-transcript`:n($t());break;case`send-transcript`:n(Xi());break;case`rate-conversation`:n(Zi(`MENU`));break;case`link`:n(on(e.url));break;case`action`:n(JSON.parse(JSON.stringify(e.action)));break;default:break}s(!1)},[n,m,s]);(0,x.useEffect)(()=>{let e=e=>{if(o)switch(e.key){case`Enter`:e.preventDefault(),h(p[c]);break;case`ArrowUp`:l(e=>e>0?e-1:p.length-1);break;case`ArrowDown`:l(e=>e<p.length-1?e+1:0);break;case`Escape`:s(!1);break;case`Tab`:c>-1&&s(!1);break;default:break}};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[o,c,p,l,s,h]),(0,x.useEffect)(()=>{o||l(-1)},[o,c]),Xc(d,()=>s(!1));let g=()=>{s(e=>!e)},_=()=>{setTimeout(()=>{let e=document.activeElement;d.current&&!d.current.contains(e)&&s(!1)},0)};return p.length?(0,X.jsxs)(`div`,{className:R(ld.menuContainer),ref:d,children:[(0,X.jsx)(`button`,{ref:u,className:R(o&&ld.active,o?`tooltip-hidden`:`tooltip--bottom-left`),"aria-label":r(`header.menu.title`),"data-title":r(`header.menu.title`),onClick:g,onBlur:_,children:(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,X.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`})})}),o&&(0,X.jsx)(`nav`,{className:ld.menu,"aria-label":r(`header.menu.title`),children:(0,X.jsx)(`ul`,{tabIndex:0,children:p.map((e,t)=>(0,X.jsx)(dd,{ref:e=>{f.current[t]=e},selected:c===t,item:e,onClick:()=>h(e)},e.id))})})]}):null},md=({className:e,chatStarted:t,...n})=>{let r=ba(),i=xa(e=>e.chat.conversationRating),a=xa(e=>e.chat.messages.some(e=>e.sender.type===Dt.GUEST)),o=()=>{i.enabled&&!i.opener&&a?r(Zi(`CLOSE_CHAT`)):r(Ji())};return(0,X.jsxs)(`div`,{className:R(ld.header,e),...n,children:[(0,X.jsx)(`div`,{className:ld.logoContainer,children:(0,X.jsx)(`div`,{className:ld.logo})}),(0,X.jsxs)(`div`,{className:ld.actions,children:[(0,X.jsx)(pd,{chatStarted:t,hasGuestMessages:a}),(0,X.jsx)(cd,{onClick:o})]})]})},hd={chatwindow:`_chatwindow_rkbir_1`,chatwindowWithAside:`_chatwindowWithAside_rkbir_21`},gd=()=>{let[e,t]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{let e=window.matchMedia(`(max-width: 1023px)`),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e},_d={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`,rotate:`_rotate_vei0l_1`,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`,loadingAnim:`_loadingAnim_vei0l_1`},vd=({onClick:e})=>{let t=Sa();return(0,X.jsx)(`button`,{className:R(_d.closeSourceInfosButton,`tooltip--bottom-left`),"aria-label":t(`source-infos.close`),"data-title":t(`source-infos.close`),tabIndex:0,onClick:e,children:(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,X.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`})})})},yd=(0,x.forwardRef)(({sourceInfos:e,onClose:t,...n},r)=>(0,X.jsxs)(`div`,{className:_d.sourceHeader,...n,ref:r,children:[(0,X.jsx)(`div`,{children:e?(0,X.jsx)(`p`,{id:`source-info-title`,children:e.title}):(0,X.jsx)(`p`,{children:`\xA0`})}),(0,X.jsx)(vd,{onClick:t})]})),bd=({loading:e})=>(0,X.jsx)(`div`,{className:_d.highlightLoader,children:e&&(0,X.jsx)(`div`,{className:_d.highlightLoaderLoading})}),{entries:xd,setPrototypeOf:Sd,isFrozen:Cd,getPrototypeOf:wd,getOwnPropertyDescriptor:Td}=Object,{freeze:Ed,seal:Dd,create:Od}=Object,{apply:kd,construct:Ad}=typeof Reflect<`u`&&Reflect;Ed||=function(e){return e},Dd||=function(e){return e},kd||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Ad||=function(e){return new e(...[...arguments].slice(1))};var jd=Gd(Array.prototype.forEach),Md=Gd(Array.prototype.lastIndexOf),Nd=Gd(Array.prototype.pop),Pd=Gd(Array.prototype.push),Fd=Gd(Array.prototype.splice),Id=Gd(String.prototype.toLowerCase),Ld=Gd(String.prototype.toString),Rd=Gd(String.prototype.match),zd=Gd(String.prototype.replace),Bd=Gd(String.prototype.indexOf),Vd=Gd(String.prototype.trim),Hd=Gd(Object.prototype.hasOwnProperty),Ud=Gd(RegExp.prototype.test),Wd=Kd(TypeError);function Gd(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return kd(e,t,n)}}function Kd(e){return function(){return Ad(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Id;Sd&&Sd(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Cd(t)||(t[r]=e),i=e)}e[i]=!0}return e}function qd(e){for(let t=0;t<e.length;t++)Hd(e,t)||(e[t]=null);return e}function Jd(e){let t=Od(null);for(let[n,r]of xd(e))Hd(e,n)&&(Array.isArray(r)?t[n]=qd(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=Jd(r):t[n]=r);return t}function Yd(e,t){for(;e!==null;){let n=Td(e,t);if(n){if(n.get)return Gd(n.get);if(typeof n.value==`function`)return Gd(n.value)}e=wd(e)}function n(){return null}return n}var Xd=Ed(`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`.split(`.`)),Zd=Ed(`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`.split(`.`)),Qd=Ed([`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`]),$d=Ed([`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`]),ef=Ed(`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`.split(`.`)),tf=Ed([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),nf=Ed([`#text`]),rf=Ed(`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`.split(`.`)),af=Ed(`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`.split(`.`)),of=Ed(`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`.split(`.`)),sf=Ed([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),cf=Dd(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lf=Dd(/<%[\w\W]*|[\w\W]*%>/gm),uf=Dd(/\$\{[\w\W]*/gm),df=Dd(/^data-[\-\w.\u00B7-\uFFFF]+$/),ff=Dd(/^aria-[\-\w]+$/),pf=Dd(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mf=Dd(/^(?:\w+script|data):/i),hf=Dd(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gf=Dd(/^html$/i),_f=Dd(/^[a-z][.\w]*(-[.\w]+)+$/i),vf=Object.freeze({__proto__:null,ARIA_ATTR:ff,ATTR_WHITESPACE:hf,CUSTOM_ELEMENT:_f,DATA_ATTR:df,DOCTYPE_NAME:gf,ERB_EXPR:lf,IS_ALLOWED_URI:pf,IS_SCRIPT_OR_DATA:mf,MUSTACHE_EXPR:cf,TMPLIT_EXPR:uf}),yf={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},bf=function(){return typeof window>`u`?null:window},xf=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Sf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bf(),t=e=>Cf(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==yf.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=Yd(m,`cloneNode`),g=Yd(m,`remove`),_=Yd(m,`nextSibling`),v=Yd(m,`childNodes`),y=Yd(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=Sf();t.isSupported=typeof xd==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:O,ERB_EXPR:ee,TMPLIT_EXPR:te,DATA_ATTR:ne,ARIA_ATTR:k,IS_SCRIPT_OR_DATA:re,ATTR_WHITESPACE:ie,CUSTOM_ELEMENT:ae}=vf,{IS_ALLOWED_URI:A}=vf,j=null,oe=$({},[...Xd,...Zd,...Qd,...ef,...nf]),M=null,se=$({},[...rf,...af,...of,...sf]),N=Object.seal(Od(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}})),P=null,F=null,I=Object.seal(Od(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ce=!0,le=!0,ue=!1,de=!0,fe=!1,L=!0,pe=!1,me=!1,he=!1,ge=!1,_e=!1,ve=!1,ye=!0,be=!1,xe=!0,Se=!1,Ce={},we=null,Te=$({},[`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`]),Ee=null,De=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Oe=null,ke=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ae=`http://www.w3.org/1998/Math/MathML`,je=`http://www.w3.org/2000/svg`,Me=`http://www.w3.org/1999/xhtml`,Ne=Me,Pe=!1,Fe=null,Ie=$({},[Ae,je,Me],Ld),Le=$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Re=$({},[`annotation-xml`]),ze=$({},[`title`,`style`,`font`,`a`,`script`]),Be=null,Ve=[`application/xhtml+xml`,`text/html`],He=null,Ue=null,We=n.createElement(`form`),Ge=function(e){return e instanceof RegExp||e instanceof Function},Ke=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ue&&Ue===e)){if((!e||typeof e!=`object`)&&(e={}),e=Jd(e),Be=Ve.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,He=Be===`application/xhtml+xml`?Ld:Id,j=Hd(e,`ALLOWED_TAGS`)?$({},e.ALLOWED_TAGS,He):oe,M=Hd(e,`ALLOWED_ATTR`)?$({},e.ALLOWED_ATTR,He):se,Fe=Hd(e,`ALLOWED_NAMESPACES`)?$({},e.ALLOWED_NAMESPACES,Ld):Ie,Oe=Hd(e,`ADD_URI_SAFE_ATTR`)?$(Jd(ke),e.ADD_URI_SAFE_ATTR,He):ke,Ee=Hd(e,`ADD_DATA_URI_TAGS`)?$(Jd(De),e.ADD_DATA_URI_TAGS,He):De,we=Hd(e,`FORBID_CONTENTS`)?$({},e.FORBID_CONTENTS,He):Te,P=Hd(e,`FORBID_TAGS`)?$({},e.FORBID_TAGS,He):Jd({}),F=Hd(e,`FORBID_ATTR`)?$({},e.FORBID_ATTR,He):Jd({}),Ce=Hd(e,`USE_PROFILES`)?e.USE_PROFILES:!1,ce=e.ALLOW_ARIA_ATTR!==!1,le=e.ALLOW_DATA_ATTR!==!1,ue=e.ALLOW_UNKNOWN_PROTOCOLS||!1,de=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=e.SAFE_FOR_TEMPLATES||!1,L=e.SAFE_FOR_XML!==!1,pe=e.WHOLE_DOCUMENT||!1,ge=e.RETURN_DOM||!1,_e=e.RETURN_DOM_FRAGMENT||!1,ve=e.RETURN_TRUSTED_TYPE||!1,he=e.FORCE_BODY||!1,ye=e.SANITIZE_DOM!==!1,be=e.SANITIZE_NAMED_PROPS||!1,xe=e.KEEP_CONTENT!==!1,Se=e.IN_PLACE||!1,A=e.ALLOWED_URI_REGEXP||pf,Ne=e.NAMESPACE||Me,Le=e.MATHML_TEXT_INTEGRATION_POINTS||Le,Re=e.HTML_INTEGRATION_POINTS||Re,N=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ge(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(N.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ge(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(N.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(N.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),fe&&(le=!1),_e&&(ge=!0),Ce&&(j=$({},nf),M=Od(null),Ce.html===!0&&($(j,Xd),$(M,rf)),Ce.svg===!0&&($(j,Zd),$(M,af),$(M,sf)),Ce.svgFilters===!0&&($(j,Qd),$(M,af),$(M,sf)),Ce.mathMl===!0&&($(j,ef),$(M,of),$(M,sf))),Hd(e,`ADD_TAGS`)||(I.tagCheck=null),Hd(e,`ADD_ATTR`)||(I.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?I.tagCheck=e.ADD_TAGS:(j===oe&&(j=Jd(j)),$(j,e.ADD_TAGS,He))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?I.attributeCheck=e.ADD_ATTR:(M===se&&(M=Jd(M)),$(M,e.ADD_ATTR,He))),e.ADD_URI_SAFE_ATTR&&$(Oe,e.ADD_URI_SAFE_ATTR,He),e.FORBID_CONTENTS&&(we===Te&&(we=Jd(we)),$(we,e.FORBID_CONTENTS,He)),e.ADD_FORBID_CONTENTS&&(we===Te&&(we=Jd(we)),$(we,e.ADD_FORBID_CONTENTS,He)),xe&&(j[`#text`]=!0),pe&&$(j,[`html`,`head`,`body`]),j.table&&($(j,[`tbody`]),delete P.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Wd(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Wd(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=xf(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));Ed&&Ed(e),Ue=e}},qe=$({},[...Zd,...Qd,...$d]),Je=$({},[...ef,...tf]),Ye=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Ne,tagName:`template`});let n=Id(e.tagName),r=Id(t.tagName);return Fe[e.namespaceURI]?e.namespaceURI===je?t.namespaceURI===Me?n===`svg`:t.namespaceURI===Ae?n===`svg`&&(r===`annotation-xml`||Le[r]):!!qe[n]:e.namespaceURI===Ae?t.namespaceURI===Me?n===`math`:t.namespaceURI===je?n===`math`&&Re[r]:!!Je[n]:e.namespaceURI===Me?t.namespaceURI===je&&!Re[r]||t.namespaceURI===Ae&&!Le[r]?!1:!Je[n]&&(ze[n]||!qe[n]):!!(Be===`application/xhtml+xml`&&Fe[e.namespaceURI]):!1},Xe=function(e){Pd(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},Ze=function(e,n){try{Pd(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Pd(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(ge||_e)try{Xe(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Qe=function(e){let t=null,r=null;if(he)e=`<remove></remove>`+e;else{let t=Rd(e,/^[\r\n\t ]+/);r=t&&t[0]}Be===`application/xhtml+xml`&&Ne===Me&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(Ne===Me)try{t=new f().parseFromString(i,Be)}catch{}if(!t||!t.documentElement){t=S.createDocument(Ne,`template`,null);try{t.documentElement.innerHTML=Pe?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ne===Me?T.call(t,pe?`html`:`body`)[0]:pe?t.documentElement:a},$e=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},et=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},tt=function(e){return typeof s==`function`&&e instanceof s};function nt(e,n,r){jd(e,e=>{e.call(t,n,r,Ue)})}let rt=function(e){let n=null;if(nt(D.beforeSanitizeElements,e,null),et(e))return Xe(e),!0;let r=He(e.nodeName);if(nt(D.uponSanitizeElement,e,{tagName:r,allowedTags:j}),L&&e.hasChildNodes()&&!tt(e.firstElementChild)&&Ud(/<[/\w!]/g,e.innerHTML)&&Ud(/<[/\w!]/g,e.textContent)||e.nodeType===yf.progressingInstruction||L&&e.nodeType===yf.comment&&Ud(/<[/\w]/g,e.data))return Xe(e),!0;if(!(I.tagCheck instanceof Function&&I.tagCheck(r))&&(!j[r]||P[r])){if(!P[r]&&it(r)&&(N.tagNameCheck instanceof RegExp&&Ud(N.tagNameCheck,r)||N.tagNameCheck instanceof Function&&N.tagNameCheck(r)))return!1;if(xe&&!we[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,_(e))}}}return Xe(e),!0}return e instanceof c&&!Ye(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Ud(/<\/no(script|embed|frames)/i,e.innerHTML)?(Xe(e),!0):(fe&&e.nodeType===yf.text&&(n=e.textContent,jd([O,ee,te],e=>{n=zd(n,e,` `)}),e.textContent!==n&&(Pd(t.removed,{element:e.cloneNode()}),e.textContent=n)),nt(D.afterSanitizeElements,e,null),!1)},R=function(e,t,r){if(F[t]||ye&&(t===`id`||t===`name`)&&(r in n||r in We))return!1;if(!(le&&!F[t]&&Ud(ne,t))&&!(ce&&Ud(k,t))&&!(I.attributeCheck instanceof Function&&I.attributeCheck(t,e))){if(!M[t]||F[t]){if(!(it(e)&&(N.tagNameCheck instanceof RegExp&&Ud(N.tagNameCheck,e)||N.tagNameCheck instanceof Function&&N.tagNameCheck(e))&&(N.attributeNameCheck instanceof RegExp&&Ud(N.attributeNameCheck,t)||N.attributeNameCheck instanceof Function&&N.attributeNameCheck(t,e))||t===`is`&&N.allowCustomizedBuiltInElements&&(N.tagNameCheck instanceof RegExp&&Ud(N.tagNameCheck,r)||N.tagNameCheck instanceof Function&&N.tagNameCheck(r))))return!1}else if(!Oe[t]&&!Ud(A,zd(r,ie,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Bd(r,`data:`)===0&&Ee[e])&&!(ue&&!Ud(re,zd(r,ie,``)))&&r)return!1}return!0},it=function(e){return e!==`annotation-xml`&&Rd(e,ae)},at=function(e){nt(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||et(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=He(a),l=s,u=a===`value`?l:Vd(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,nt(D.uponSanitizeAttribute,e,r),u=r.attrValue,be&&(c===`id`||c===`name`)&&(Ze(a,e),u=`user-content-`+u),L&&Ud(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){Ze(a,e);continue}if(c===`attributename`&&Rd(u,`href`)){Ze(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ze(a,e);continue}if(!de&&Ud(/\/>/i,u)){Ze(a,e);continue}fe&&jd([O,ee,te],e=>{u=zd(u,e,` `)});let d=He(e.nodeName);if(!R(d,c,u)){Ze(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),et(e)?Xe(e):Nd(t.removed)}catch{Ze(a,e)}}nt(D.afterSanitizeAttributes,e,null)},ot=function e(t){let n=null,r=$e(t);for(nt(D.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)nt(D.uponSanitizeShadowNode,n,null),rt(n),at(n),n.content instanceof a&&e(n.content);nt(D.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(Pe=!e,Pe&&(e=`<!-->`),typeof e!=`string`&&!tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Wd(`dirty is not a string, aborting`)}else throw Wd(`toString is not a function`);if(!t.isSupported)return e;if(me||Ke(n),t.removed=[],typeof e==`string`&&(Se=!1),Se){if(e.nodeName){let t=He(e.nodeName);if(!j[t]||P[t])throw Wd(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=Qe(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===yf.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!ge&&!fe&&!pe&&e.indexOf(`<`)===-1)return b&&ve?b.createHTML(e):e;if(i=Qe(e),!i)return ge?null:ve?x:``}i&&he&&Xe(i.firstChild);let u=$e(Se?e:i);for(;c=u.nextNode();)rt(c),at(c),c.content instanceof a&&ot(c.content);if(Se)return e;if(ge){if(_e)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(M.shadowroot||M.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=pe?i.outerHTML:i.innerHTML;return pe&&j[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Ud(gf,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
64
- `+d),fe&&jd([O,ee,te],e=>{d=zd(d,e,` `)}),b&&ve?b.createHTML(d):d},t.setConfig=function(){Ke(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),me=!0},t.clearConfig=function(){Ue=null,me=!1},t.isValidAttribute=function(e,t,n){return Ue||Ke({}),R(He(e),He(t),n)},t.addHook=function(e,t){typeof t==`function`&&Pd(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=Md(D[e],t);return n===-1?void 0:Fd(D[e],n,1)[0]}return Nd(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=Sf()},t}var wf=Cf(),Tf=({onClose:e})=>{let t=Sa();return(0,X.jsxs)(`div`,{className:_d.highlightLoadingInfo,onClick:e,children:[(0,X.jsx)(`div`,{className:_d.highlightLoadingInfoCloseIcon,children:(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,X.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`})})}),(0,X.jsxs)(`div`,{className:_d.highlightLoadingInfoInnerContainer,children:[(0,X.jsxs)(`div`,{className:_d.highlightLoadingInfoContent,children:[(0,X.jsx)(`h3`,{children:t(`source-infos.highlight-loading.title`)}),(0,X.jsx)(`p`,{children:t(`source-infos.highlight-loading.description`)})]}),(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`#000000`,viewBox:`0 0 256 256`,children:(0,X.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`})})]})]})},Ef=({title:e,href:t,children:n})=>(0,X.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),Df=({className:e,children:t,...n})=>(0,X.jsx)(`a`,{className:R(pl.button,pl.buttonDefault,e),type:`button`,role:`button`,...n,children:t}),Of=e=>(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,X.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`})}),kf=({type:e,...t})=>{switch(e){case`WEBSITE`:return(0,X.jsx)(ul,{...t});case`PDF`:return(0,X.jsx)(ll,{...t});case`DOCX`:return(0,X.jsx)(sl,{...t});case`TEXT`:return(0,X.jsx)(Of,{...t});default:return(0,X.jsx)(cl,{...t})}},Af=({url:e,knowledgeBaseType:t})=>{let n=Sa();return(0,X.jsx)(Df,{className:_d.openSourceButton,href:e,target:`_blank`,children:(0,X.jsxs)(`div`,{className:_d.sourceButtonLabel,children:[(0,X.jsx)(`div`,{className:_d.sourceHeaderIcon,children:(0,X.jsx)(kf,{type:t})}),(0,X.jsx)(`p`,{children:n(`source-infos.open-source`)})]})})},jf=({sourceInfos:{content:e,url:t,knowledgeBaseType:n,highlighted:r}})=>{let[i,a]=(0,x.useState)(!r);(0,x.useEffect)(()=>{r&&a(!1)},[r]);let o=wf.sanitize(e,{USE_PROFILES:{html:!0}});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:R(_d.sourceContent,El.markdown),children:[(0,X.jsx)(Vc,{options:{overrides:{a:Ef}},children:o}),i&&(0,X.jsx)(Tf,{onClose:()=>a(!1)})]}),(0,X.jsx)(Af,{url:t,knowledgeBaseType:n})]})},Mf=``+new URL(`undraw_fixing-bugs-D_eYxJc6.svg`,import.meta.url).href,Nf=()=>{let e=Sa();return(0,X.jsxs)(`div`,{className:_d.loadingError,children:[(0,X.jsx)(`h1`,{children:e(`source-infos.error.title`)}),(0,X.jsx)(`img`,{src:Mf,title:e(`source-infos.error.title`)}),(0,X.jsx)(`p`,{children:e(`source-infos.error.info`)})]})},Pf=()=>(0,X.jsx)(`div`,{className:_d.loadingSourceInfos,children:(0,X.jsx)(`svg`,{className:_d.loading,xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,X.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 Ff({sourceInfos:e,onClose:t,threshold:n=100}){let r=(0,x.useRef)(null),[i,a]=(0,x.useState)(0),[o,s]=(0,x.useState)(!1),c=(0,x.useRef)(null),l=(0,x.useRef)(null),u=(0,x.useCallback)(e=>{c.current=e,s(!0)},[]),d=(0,x.useCallback)(e=>{if(c.current!==null&&o){let t=e-c.current;t>0&&a(t)}},[o]),f=(0,x.useCallback)(()=>{s(!1),i>n&&t(),a(0),c.current=null},[i,n,t]),p=(0,x.useCallback)(e=>{let t=e=>u(e.touches[0].clientY),n=e=>d(e.touches[0].clientY),r=()=>f(),i=e=>{e.preventDefault(),u(e.clientY),window.addEventListener(`mousemove`,a),window.addEventListener(`mouseup`,o)},a=e=>d(e.clientY),o=()=>{f(),window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o)};e.addEventListener(`touchstart`,t),e.addEventListener(`touchmove`,n),e.addEventListener(`touchend`,r),e.addEventListener(`mousedown`,i),l.current=()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchmove`,n),e.removeEventListener(`touchend`,r),e.removeEventListener(`mousedown`,i),window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o)}},[u,d,f]);return(0,x.useEffect)(()=>{let e;return r.current?(l.current?.(),p(r.current)):(e=new MutationObserver(()=>{r.current&&(l.current?.(),p(r.current),e?.disconnect())}),e.observe(document.body,{childList:!0,subtree:!0})),()=>{e?.disconnect(),l.current?.()}},[p,e]),{ref:r,dragOffsetY:i,isDragging:o}}var If=e=>{let[t,n]=(0,x.useState)(!0);return(0,x.useEffect)(()=>{let t=null;return e?.type===`loading`?(n(!0),t=setTimeout(()=>{n(!1)},300)):n(!e),()=>{t&&clearTimeout(t)}},[e]),t},Lf=()=>{let e=ba(),t=xa(e=>e.chat.sourceInfos),n=gd(),r=(0,x.useRef)(null),i=If(t);(0,x.useEffect)(()=>{r.current&&t?.type===`loading`&&(n?r.current.showModal():(r.current.setAttribute(`open`,`true`),r.current?.focus()))},[t,n]);let a=(0,x.useCallback)(()=>{r.current&&(n?r.current.close():r.current.removeAttribute(`open`),e(ta()))},[e,n]),{ref:o,dragOffsetY:s}=Ff({onClose:a,sourceInfos:t});return t?(0,X.jsx)(`dialog`,{ref:r,className:R(_d.sourceInfos,i?_d.waitForLoading:t.type===`loading`?_d.loadingContent:``),style:n&&s?{transform:`translateY(${s}px)`}:{},onClose:a,autoFocus:!0,role:`dialog`,"aria-labelledby":`source-info-title`,children:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yd,{ref:o,tabIndex:-1,sourceInfos:t.type===`loaded`?t:void 0,onClose:a}),t.type===`loading`?(0,X.jsx)(Pf,{}):t.type===`loading-error`?(0,X.jsx)(Nf,{}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(bd,{loading:!t.highlighted}),(0,X.jsx)(jf,{sourceInfos:t})]})]})}):null},Rf={container:`_container_5axup_1`,body:`_body_5axup_7`,intro:`_intro_5axup_14`,footer:`_footer_5axup_48`,footnote:`_footnote_5axup_52`,containerWithFootnote:`_containerWithFootnote_5axup_72`,startChatButton:`_startChatButton_5axup_87`,spinner:`_spinner_5axup_102`,spin:`_spin_5axup_102`,formFields:`_formFields_5axup_106`,formField:`_formField_5axup_106`,radio:`_radio_5axup_118`,checkbox:`_checkbox_5axup_125`,input:`_input_5axup_133`,inputLabel:`_inputLabel_5axup_167`,selectWrapper:`_selectWrapper_5axup_171`,select:`_select_5axup_171`,selectLabel:`_selectLabel_5axup_217`},zf=({name:e,label:t,defaultValue:n,required:r,onChange:i})=>(0,X.jsxs)(`label`,{className:R(Rf.checkbox,`chat__startScreen__checkbox`),htmlFor:e,children:[(0,X.jsx)(`input`,{type:`checkbox`,id:e,name:e,defaultChecked:n===`true`,required:r,onChange:e=>{i(e.currentTarget.checked?`true`:`false`)}}),(0,X.jsx)(`div`,{children:t})]}),Bf=({type:e,name:t,label:n,defaultValue:r,placeholder:i,required:a,multiple:o,min:s,max:c,pattern:l,onChange:u})=>(0,X.jsxs)(`label`,{className:R(Rf.input,`chat__startScreen__input`),htmlFor:t,children:[(0,X.jsx)(`div`,{className:R(Rf.inputLabel),children:n}),(0,X.jsx)(`input`,{type:e,id:t,name:t,defaultValue:r,placeholder:i,required:a,multiple:o,min:s,max:c,pattern:l,onChange:e=>{u(e.target.value)}})]}),Vf=({name:e,value:t,label:n,defaultChecked:r,required:i,onChange:a})=>{let o=`${e}-${t}`;return(0,X.jsxs)(`label`,{className:R(Rf.radio,`chat__startScreen__radio`),htmlFor:o,children:[(0,X.jsx)(`input`,{id:o,type:`radio`,name:e,value:t,defaultChecked:r,required:i,onChange:e=>{a(e.target.value)}}),(0,X.jsx)(`span`,{className:R(Rf.label),children:n})]})},Hf=({name:e,label:t,defaultValue:n,required:r,multiple:i,options:a,onChange:o})=>(0,X.jsxs)(`label`,{className:R(Rf.select,`chat__startScreen__select`),htmlFor:e,children:[(0,X.jsx)(`div`,{className:R(Rf.selectLabel),children:t}),(0,X.jsx)(`div`,{className:R(Rf.selectWrapper),children:(0,X.jsx)(`select`,{id:e,name:e,defaultValue:n,required:r,multiple:i,onChange:e=>{o(e.target.value)},children:Object.entries(a||{}).map(([e,t])=>(0,X.jsx)(`option`,{value:e,selected:t===n,children:t}))})})]}),Uf=`start-screen.intro`,Wf=`start-screen.start-chat`,Gf=`start-screen.waiting-for-login`,Kf=`start-screen.footnote`,qf=`start-screen.form`,Jf=`${qf}.fields`,Yf=()=>{let e=Sa(),t=ba(),n=Tl(),r=xa(e=>e.startScreen.loginRequestToken),i=xa(e=>e.settings.requiresUserAuthentication);(0,x.useEffect)(()=>{let e;if(r){let i=window.screenX+(window.outerWidth-600)/2,a=window.screenY+(window.outerHeight-700)/2,o=encodeURIComponent(n),s=new URL(window.location.origin);s.pathname=`/${o}/auth/login`,s.searchParams.set(`loginRequestToken`,r);let c=window.open(s.href,`Login`,`width=600,height=700,left=${i},top=${a},resizable=yes,scrollbars=yes`);e=setInterval(()=>{c?.closed&&(t(Hi()),clearInterval(e))},500)}return()=>{e&&clearInterval(e)}},[n,r,t]);let[a,o]=(0,x.useState)({}),s=()=>{let e=Object.entries(a).reduce((e,[t,n])=>({...e,[t]:n.value}),{});t(i?Vi({loginRequestToken:yn(),formValues:e}):Ri({formValues:e}))},c=e(Uf),l=e(r?Gf:Wf),u=e(Kf),d=(0,x.useMemo)(()=>e(Jf)?.split(`;`).map(e=>e.trim())??[],[e(Jf)]);(0,x.useEffect)(()=>{d.length&&Object.keys(a).length===0&&o(d.reduce((t,n)=>({...t,[n]:Zf(n,e)}),{}))},[e,d,a]);let f=e=>{e.preventDefault(),s()},p=e=>t=>{o(n=>({...n,[e]:{...n[e],value:t}}))};return(0,X.jsxs)(`form`,{onSubmit:f,className:R(Rf.container,u&&Rf.containerWithFootnote,`chat__startScreen`),children:[(0,X.jsxs)(`div`,{className:R(Rf.body,`chat__startScreen__body`),children:[c&&(0,X.jsx)(`div`,{className:R(Rf.intro,`chat__startScreen__intro`),children:(0,X.jsx)(Vc,{options:{overrides:{a:Xf}},children:c})}),(0,X.jsx)(`div`,{className:R(Rf.formFields,`chat__startScreen__fields`),children:Object.values(a).map(({type:e,name:t,label:n,placeholder:r,defaultValue:i,options:a,required:o,multiple:s,min:c,max:l,pattern:u})=>(0,X.jsx)(`div`,{className:R(Rf.formField,`chat__startScreen__field`),children:(()=>{switch(e){case`radio`:return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{children:n}),Object.entries(a||{}).map(([e,n])=>(0,X.jsx)(Vf,{name:t,value:e,label:n,defaultChecked:e===i,required:o,onChange:p(t)},e))]});case`checkbox`:return(0,X.jsx)(zf,{name:t,label:n,defaultValue:i,required:o,onChange:p(t)});case`select`:return(0,X.jsx)(Hf,{name:t,label:n,defaultValue:i,required:o,multiple:s,options:a,onChange:p(t)});default:return(0,X.jsx)(Bf,{type:e,name:t,label:n,placeholder:r,defaultValue:i,required:o,multiple:s,min:c,max:l,pattern:u,onChange:p(t)})}})()},t))})]}),(0,X.jsxs)(`div`,{className:R(Rf.footer,`chat__startScreen__footer`),children:[(0,X.jsxs)($l,{type:`submit`,className:Rf.startChatButton,disabled:!!r,children:[!!r&&(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,className:Rf.spinner,children:(0,X.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`})}),(0,X.jsx)(`div`,{children:l})]}),u&&(0,X.jsx)(`div`,{className:Rf.footnote,children:(0,X.jsx)(Vc,{options:{overrides:{a:Xf}},children:u})})]})]})},Xf=({title:e,href:t,children:n})=>(0,X.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),Zf=(e,t)=>{let n=t(`${qf}.${e}.type`)||`text`,r=t(`${qf}.${e}.required`)===`true`,i=t(`${qf}.${e}.multiple`)===`true`,a=t(`${qf}.${e}.placeholder`),o=t(`${qf}.${e}.label`)||``,s=t(`${qf}.${e}.defaultValue`),c=t(`${qf}.${e}.min`),l=t(`${qf}.${e}.max`),u=t(`${qf}.${e}.pattern`),d=$f(t(`${qf}.${e}.options`));return{name:e,label:o,placeholder:a,value:Qf(n,s,d)||``,defaultValue:s,options:d,type:n,required:r,multiple:i,min:c,max:l,pattern:u}},Qf=(e,t,n)=>t||e===`select`&&Object.keys(n)[0]||``,$f=(e=``)=>e.split(`;`).map(e=>e.trim()).reduce((e,t)=>{let[n,r]=t.split(`:`).map(e=>e.trim());return{...e,[n]:r}},{}),ep=()=>{let e=xa(e=>e.intl.locale);(0,x.useEffect)(()=>{window.document.documentElement.lang=e},[e])},tp={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`},np=({clientName:e})=>{ep();let t=ba(),n=xa(e=>e.intl.messages),r=Sa(),i=xa(e=>e.settings.enableStartScreen),a=xa(e=>e.startScreen.startScreenStatus),o=xa(e=>e.connection.queryString),s=xa(e=>e.settings.allowedEmbedOrigins),c=(0,x.useMemo)(()=>new URLSearchParams(o||`?`).get(`cssClassName`),[o]);(0,x.useEffect)(()=>{let n=new URLSearchParams(o||``);t(da(e,Object.fromEntries(n.entries())))},[e,o,t]),(0,x.useEffect)(()=>{let e=e=>{if(!e.data?.type||!Object.values(tp).includes(e.data.type))return;let n=e.origin===window.location.origin,r=e.source===window.parent,i=s===void 0||s.includes(e.origin);if(!(n||r&&i)){console.warn(`Rejected postMessage from untrusted origin:`,e.origin);return}switch(e.data.type){case tp.TRIGGER_ACTION:t(e.data.action);break;case tp.TRIGGER_STORY:t(nn(e.data.story));break;case tp.ON_CHAT_WINDOW_OPEN:t({type:`webclient.chatwindow.opened`});break;case tp.ON_CHAT_WINDOW_CLOSE:t({type:`webclient.chatwindow.closed`});break;case tp.CHAT_MESSAGE_FROM_GUEST:t(It(e.data.text));break;case tp.RESTART_CHAT:t(va());break}};return window.addEventListener(`message`,e,!1),()=>window.removeEventListener(`message`,e)},[s,t]),(0,x.useEffect)(()=>{let e=r(`page.title`);e&&document&&(document.title=e)},[n,r]);let l=i===void 0,u=i===!1||a===`HIDDEN`;return(0,X.jsx)(`div`,{className:R(hd.chatwindow,u&&hd.chatwindowWithAside,`chat__chatwindow`,c),children:l?null:u?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`header`,{children:(0,X.jsx)(md,{chatStarted:!0})}),(0,X.jsx)(`main`,{children:(0,X.jsx)(ad,{clientName:e})}),(0,X.jsx)(`aside`,{children:(0,X.jsx)(Lf,{})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`header`,{children:(0,X.jsx)(md,{chatStarted:!1})}),(0,X.jsx)(`main`,{children:(0,X.jsx)(Yf,{})})]})})},rp=()=>{let e=Tl(),t=gd();return(0,X.jsx)(`div`,{className:R([it.app,t?`chat__small`:`chat__large`]),children:(0,X.jsx)(np,{clientName:e})})},ip={"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`,"bot-bubble.footnote":`Fussnote`,"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:
64
+ `+d),fe&&jd([O,ee,te],e=>{d=zd(d,e,` `)}),b&&ve?b.createHTML(d):d},t.setConfig=function(){Ke(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),me=!0},t.clearConfig=function(){Ue=null,me=!1},t.isValidAttribute=function(e,t,n){return Ue||Ke({}),R(He(e),He(t),n)},t.addHook=function(e,t){typeof t==`function`&&Pd(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=Md(D[e],t);return n===-1?void 0:Fd(D[e],n,1)[0]}return Nd(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=Sf()},t}var wf=Cf(),Tf=({onClose:e})=>{let t=Sa();return(0,X.jsxs)(`div`,{className:_d.highlightLoadingInfo,onClick:e,children:[(0,X.jsx)(`div`,{className:_d.highlightLoadingInfoCloseIcon,children:(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,X.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`})})}),(0,X.jsxs)(`div`,{className:_d.highlightLoadingInfoInnerContainer,children:[(0,X.jsxs)(`div`,{className:_d.highlightLoadingInfoContent,children:[(0,X.jsx)(`h3`,{children:t(`source-infos.highlight-loading.title`)}),(0,X.jsx)(`p`,{children:t(`source-infos.highlight-loading.description`)})]}),(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`#000000`,viewBox:`0 0 256 256`,children:(0,X.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`})})]})]})},Ef=({title:e,href:t,children:n})=>(0,X.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),Df=({className:e,children:t,...n})=>(0,X.jsx)(`a`,{className:R(pl.button,pl.buttonDefault,e),type:`button`,role:`button`,...n,children:t}),Of=e=>(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,X.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`})}),kf=({type:e,...t})=>{switch(e){case`WEBSITE`:return(0,X.jsx)(ul,{...t});case`PDF`:return(0,X.jsx)(ll,{...t});case`DOCX`:return(0,X.jsx)(sl,{...t});case`TEXT`:return(0,X.jsx)(Of,{...t});default:return(0,X.jsx)(cl,{...t})}},Af=({url:e,knowledgeBaseType:t})=>{let n=Sa();return(0,X.jsx)(Df,{className:_d.openSourceButton,href:e,target:`_blank`,children:(0,X.jsxs)(`div`,{className:_d.sourceButtonLabel,children:[(0,X.jsx)(`div`,{className:_d.sourceHeaderIcon,children:(0,X.jsx)(kf,{type:t})}),(0,X.jsx)(`p`,{children:n(`source-infos.open-source`)})]})})},jf=({sourceInfos:{content:e,url:t,knowledgeBaseType:n,highlighted:r}})=>{let[i,a]=(0,x.useState)(!r);(0,x.useEffect)(()=>{r&&a(!1)},[r]);let o=wf.sanitize(e,{USE_PROFILES:{html:!0}}).replace(/<hr>(?!\n)/gi,`<hr>
65
+ `);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:R(_d.sourceContent,El.markdown),children:[(0,X.jsx)(Vc,{options:{overrides:{a:Ef}},children:o}),i&&(0,X.jsx)(Tf,{onClose:()=>a(!1)})]}),(0,X.jsx)(Af,{url:t,knowledgeBaseType:n})]})},Mf=``+new URL(`undraw_fixing-bugs-D_eYxJc6.svg`,import.meta.url).href,Nf=()=>{let e=Sa();return(0,X.jsxs)(`div`,{className:_d.loadingError,children:[(0,X.jsx)(`h1`,{children:e(`source-infos.error.title`)}),(0,X.jsx)(`img`,{src:Mf,title:e(`source-infos.error.title`)}),(0,X.jsx)(`p`,{children:e(`source-infos.error.info`)})]})},Pf=()=>(0,X.jsx)(`div`,{className:_d.loadingSourceInfos,children:(0,X.jsx)(`svg`,{className:_d.loading,xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,X.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 Ff({sourceInfos:e,onClose:t,threshold:n=100}){let r=(0,x.useRef)(null),[i,a]=(0,x.useState)(0),[o,s]=(0,x.useState)(!1),c=(0,x.useRef)(null),l=(0,x.useRef)(null),u=(0,x.useCallback)(e=>{c.current=e,s(!0)},[]),d=(0,x.useCallback)(e=>{if(c.current!==null&&o){let t=e-c.current;t>0&&a(t)}},[o]),f=(0,x.useCallback)(()=>{s(!1),i>n&&t(),a(0),c.current=null},[i,n,t]),p=(0,x.useCallback)(e=>{let t=e=>u(e.touches[0].clientY),n=e=>d(e.touches[0].clientY),r=()=>f(),i=e=>{e.preventDefault(),u(e.clientY),window.addEventListener(`mousemove`,a),window.addEventListener(`mouseup`,o)},a=e=>d(e.clientY),o=()=>{f(),window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o)};e.addEventListener(`touchstart`,t),e.addEventListener(`touchmove`,n),e.addEventListener(`touchend`,r),e.addEventListener(`mousedown`,i),l.current=()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchmove`,n),e.removeEventListener(`touchend`,r),e.removeEventListener(`mousedown`,i),window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o)}},[u,d,f]);return(0,x.useEffect)(()=>{let e;return r.current?(l.current?.(),p(r.current)):(e=new MutationObserver(()=>{r.current&&(l.current?.(),p(r.current),e?.disconnect())}),e.observe(document.body,{childList:!0,subtree:!0})),()=>{e?.disconnect(),l.current?.()}},[p,e]),{ref:r,dragOffsetY:i,isDragging:o}}var If=e=>{let[t,n]=(0,x.useState)(!0);return(0,x.useEffect)(()=>{let t=null;return e?.type===`loading`?(n(!0),t=setTimeout(()=>{n(!1)},300)):n(!e),()=>{t&&clearTimeout(t)}},[e]),t},Lf=()=>{let e=ba(),t=xa(e=>e.chat.sourceInfos),n=gd(),r=(0,x.useRef)(null),i=If(t);(0,x.useEffect)(()=>{r.current&&t?.type===`loading`&&(n?r.current.showModal():(r.current.setAttribute(`open`,`true`),r.current?.focus()))},[t,n]);let a=(0,x.useCallback)(()=>{r.current&&(n?r.current.close():r.current.removeAttribute(`open`),e(ta()))},[e,n]),{ref:o,dragOffsetY:s}=Ff({onClose:a,sourceInfos:t});return t?(0,X.jsx)(`dialog`,{ref:r,className:R(_d.sourceInfos,i?_d.waitForLoading:t.type===`loading`?_d.loadingContent:``),style:n&&s?{transform:`translateY(${s}px)`}:{},onClose:a,autoFocus:!0,role:`dialog`,"aria-labelledby":`source-info-title`,children:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yd,{ref:o,tabIndex:-1,sourceInfos:t.type===`loaded`?t:void 0,onClose:a}),t.type===`loading`?(0,X.jsx)(Pf,{}):t.type===`loading-error`?(0,X.jsx)(Nf,{}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(bd,{loading:!t.highlighted}),(0,X.jsx)(jf,{sourceInfos:t})]})]})}):null},Rf={container:`_container_5axup_1`,body:`_body_5axup_7`,intro:`_intro_5axup_14`,footer:`_footer_5axup_48`,footnote:`_footnote_5axup_52`,containerWithFootnote:`_containerWithFootnote_5axup_72`,startChatButton:`_startChatButton_5axup_87`,spinner:`_spinner_5axup_102`,spin:`_spin_5axup_102`,formFields:`_formFields_5axup_106`,formField:`_formField_5axup_106`,radio:`_radio_5axup_118`,checkbox:`_checkbox_5axup_125`,input:`_input_5axup_133`,inputLabel:`_inputLabel_5axup_167`,selectWrapper:`_selectWrapper_5axup_171`,select:`_select_5axup_171`,selectLabel:`_selectLabel_5axup_217`},zf=({name:e,label:t,defaultValue:n,required:r,onChange:i})=>(0,X.jsxs)(`label`,{className:R(Rf.checkbox,`chat__startScreen__checkbox`),htmlFor:e,children:[(0,X.jsx)(`input`,{type:`checkbox`,id:e,name:e,defaultChecked:n===`true`,required:r,onChange:e=>{i(e.currentTarget.checked?`true`:`false`)}}),(0,X.jsx)(`div`,{children:t})]}),Bf=({type:e,name:t,label:n,defaultValue:r,placeholder:i,required:a,multiple:o,min:s,max:c,pattern:l,onChange:u})=>(0,X.jsxs)(`label`,{className:R(Rf.input,`chat__startScreen__input`),htmlFor:t,children:[(0,X.jsx)(`div`,{className:R(Rf.inputLabel),children:n}),(0,X.jsx)(`input`,{type:e,id:t,name:t,defaultValue:r,placeholder:i,required:a,multiple:o,min:s,max:c,pattern:l,onChange:e=>{u(e.target.value)}})]}),Vf=({name:e,value:t,label:n,defaultChecked:r,required:i,onChange:a})=>{let o=`${e}-${t}`;return(0,X.jsxs)(`label`,{className:R(Rf.radio,`chat__startScreen__radio`),htmlFor:o,children:[(0,X.jsx)(`input`,{id:o,type:`radio`,name:e,value:t,defaultChecked:r,required:i,onChange:e=>{a(e.target.value)}}),(0,X.jsx)(`span`,{className:R(Rf.label),children:n})]})},Hf=({name:e,label:t,defaultValue:n,required:r,multiple:i,options:a,onChange:o})=>(0,X.jsxs)(`label`,{className:R(Rf.select,`chat__startScreen__select`),htmlFor:e,children:[(0,X.jsx)(`div`,{className:R(Rf.selectLabel),children:t}),(0,X.jsx)(`div`,{className:R(Rf.selectWrapper),children:(0,X.jsx)(`select`,{id:e,name:e,defaultValue:n,required:r,multiple:i,onChange:e=>{o(e.target.value)},children:Object.entries(a||{}).map(([e,t])=>(0,X.jsx)(`option`,{value:e,selected:t===n,children:t}))})})]}),Uf=`start-screen.intro`,Wf=`start-screen.start-chat`,Gf=`start-screen.waiting-for-login`,Kf=`start-screen.footnote`,qf=`start-screen.form`,Jf=`${qf}.fields`,Yf=()=>{let e=Sa(),t=ba(),n=Tl(),r=xa(e=>e.startScreen.loginRequestToken),i=xa(e=>e.settings.requiresUserAuthentication);(0,x.useEffect)(()=>{let e;if(r){let i=window.screenX+(window.outerWidth-600)/2,a=window.screenY+(window.outerHeight-700)/2,o=encodeURIComponent(n),s=new URL(window.location.origin);s.pathname=`/${o}/auth/login`,s.searchParams.set(`loginRequestToken`,r);let c=window.open(s.href,`Login`,`width=600,height=700,left=${i},top=${a},resizable=yes,scrollbars=yes`);e=setInterval(()=>{c?.closed&&(t(Hi()),clearInterval(e))},500)}return()=>{e&&clearInterval(e)}},[n,r,t]);let[a,o]=(0,x.useState)({}),s=()=>{let e=Object.entries(a).reduce((e,[t,n])=>({...e,[t]:n.value}),{});t(i?Vi({loginRequestToken:yn(),formValues:e}):Ri({formValues:e}))},c=e(Uf),l=e(r?Gf:Wf),u=e(Kf),d=(0,x.useMemo)(()=>e(Jf)?.split(`;`).map(e=>e.trim())??[],[e(Jf)]);(0,x.useEffect)(()=>{d.length&&Object.keys(a).length===0&&o(d.reduce((t,n)=>({...t,[n]:Zf(n,e)}),{}))},[e,d,a]);let f=e=>{e.preventDefault(),s()},p=e=>t=>{o(n=>({...n,[e]:{...n[e],value:t}}))};return(0,X.jsxs)(`form`,{onSubmit:f,className:R(Rf.container,u&&Rf.containerWithFootnote,`chat__startScreen`),children:[(0,X.jsxs)(`div`,{className:R(Rf.body,`chat__startScreen__body`),children:[c&&(0,X.jsx)(`div`,{className:R(Rf.intro,`chat__startScreen__intro`),children:(0,X.jsx)(Vc,{options:{overrides:{a:Xf}},children:c})}),(0,X.jsx)(`div`,{className:R(Rf.formFields,`chat__startScreen__fields`),children:Object.values(a).map(({type:e,name:t,label:n,placeholder:r,defaultValue:i,options:a,required:o,multiple:s,min:c,max:l,pattern:u})=>(0,X.jsx)(`div`,{className:R(Rf.formField,`chat__startScreen__field`),children:(()=>{switch(e){case`radio`:return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{children:n}),Object.entries(a||{}).map(([e,n])=>(0,X.jsx)(Vf,{name:t,value:e,label:n,defaultChecked:e===i,required:o,onChange:p(t)},e))]});case`checkbox`:return(0,X.jsx)(zf,{name:t,label:n,defaultValue:i,required:o,onChange:p(t)});case`select`:return(0,X.jsx)(Hf,{name:t,label:n,defaultValue:i,required:o,multiple:s,options:a,onChange:p(t)});default:return(0,X.jsx)(Bf,{type:e,name:t,label:n,placeholder:r,defaultValue:i,required:o,multiple:s,min:c,max:l,pattern:u,onChange:p(t)})}})()},t))})]}),(0,X.jsxs)(`div`,{className:R(Rf.footer,`chat__startScreen__footer`),children:[(0,X.jsxs)($l,{type:`submit`,className:Rf.startChatButton,disabled:!!r,children:[!!r&&(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,className:Rf.spinner,children:(0,X.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`})}),(0,X.jsx)(`div`,{children:l})]}),u&&(0,X.jsx)(`div`,{className:Rf.footnote,children:(0,X.jsx)(Vc,{options:{overrides:{a:Xf}},children:u})})]})]})},Xf=({title:e,href:t,children:n})=>(0,X.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),Zf=(e,t)=>{let n=t(`${qf}.${e}.type`)||`text`,r=t(`${qf}.${e}.required`)===`true`,i=t(`${qf}.${e}.multiple`)===`true`,a=t(`${qf}.${e}.placeholder`),o=t(`${qf}.${e}.label`)||``,s=t(`${qf}.${e}.defaultValue`),c=t(`${qf}.${e}.min`),l=t(`${qf}.${e}.max`),u=t(`${qf}.${e}.pattern`),d=$f(t(`${qf}.${e}.options`));return{name:e,label:o,placeholder:a,value:Qf(n,s,d)||``,defaultValue:s,options:d,type:n,required:r,multiple:i,min:c,max:l,pattern:u}},Qf=(e,t,n)=>t||e===`select`&&Object.keys(n)[0]||``,$f=(e=``)=>e.split(`;`).map(e=>e.trim()).reduce((e,t)=>{let[n,r]=t.split(`:`).map(e=>e.trim());return{...e,[n]:r}},{}),ep=()=>{let e=xa(e=>e.intl.locale);(0,x.useEffect)(()=>{window.document.documentElement.lang=e},[e])},tp={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`},np=({clientName:e})=>{ep();let t=ba(),n=xa(e=>e.intl.messages),r=Sa(),i=xa(e=>e.settings.enableStartScreen),a=xa(e=>e.startScreen.startScreenStatus),o=xa(e=>e.connection.queryString),s=xa(e=>e.settings.allowedEmbedOrigins),c=(0,x.useMemo)(()=>new URLSearchParams(o||`?`).get(`cssClassName`),[o]);(0,x.useEffect)(()=>{let n=new URLSearchParams(o||``);t(da(e,Object.fromEntries(n.entries())))},[e,o,t]),(0,x.useEffect)(()=>{let e=e=>{if(!e.data?.type||!Object.values(tp).includes(e.data.type))return;let n=e.origin===window.location.origin,r=e.source===window.parent,i=s===void 0||s.includes(e.origin);if(!(n||r&&i)){console.warn(`Rejected postMessage from untrusted origin:`,e.origin);return}switch(e.data.type){case tp.TRIGGER_ACTION:t(e.data.action);break;case tp.TRIGGER_STORY:t(nn(e.data.story));break;case tp.ON_CHAT_WINDOW_OPEN:t({type:`webclient.chatwindow.opened`});break;case tp.ON_CHAT_WINDOW_CLOSE:t({type:`webclient.chatwindow.closed`});break;case tp.CHAT_MESSAGE_FROM_GUEST:t(It(e.data.text));break;case tp.RESTART_CHAT:t(va());break}};return window.addEventListener(`message`,e,!1),()=>window.removeEventListener(`message`,e)},[s,t]),(0,x.useEffect)(()=>{let e=r(`page.title`);e&&document&&(document.title=e)},[n,r]);let l=i===void 0,u=i===!1||a===`HIDDEN`;return(0,X.jsx)(`div`,{className:R(hd.chatwindow,u&&hd.chatwindowWithAside,`chat__chatwindow`,c),children:l?null:u?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`header`,{children:(0,X.jsx)(md,{chatStarted:!0})}),(0,X.jsx)(`main`,{children:(0,X.jsx)(ad,{clientName:e})}),(0,X.jsx)(`aside`,{children:(0,X.jsx)(Lf,{})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`header`,{children:(0,X.jsx)(md,{chatStarted:!1})}),(0,X.jsx)(`main`,{children:(0,X.jsx)(Yf,{})})]})})},rp=()=>{let e=Tl(),t=gd();return(0,X.jsx)(`div`,{className:R([it.app,t?`chat__small`:`chat__large`]),children:(0,X.jsx)(np,{clientName:e})})},ip={"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`,"bot-bubble.footnote":`Fussnote`,"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:
65
66
 
66
67
  - Der Chatverlauf wird im EU-Raum gespeichert und kann nur von autorisierten Personen eingesehen werden.
67
68
  - 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`},ap={"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`,"bot-bubble.footnote":`Footnote`,"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:
@@ -74,4 +75,4 @@ ${w.current.stack}
74
75
 
75
76
  - La cronologia delle chat è memorizzata nell'area UE e può essere visualizzata solo da persone autorizzate.
76
77
  - 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`},lp=[`de`,`en`,`fr`,`it`],up={locale:`de`,messages:ip},dp=(e,t)=>{if(lp.includes(e)){let n=fp(e),r=op(t);return{...n,...r}}return t},fp=e=>{switch(e.toString()){case`en`:return ap;case`fr`:return sp;case`it`:return cp;default:return ip}},pp=(e=mp,t)=>{switch(t.type){case ra:return Object.assign({},e,{connectionState:Ca.CONNECTING});case ia:return Object.assign({},e,{connectionState:Ca.CONNECTED});case aa:return Object.assign({},e,{connectionState:Ca.DISCONNECTED});case oa:return Object.assign({},e,{connectionState:Ca.RECONNECTED});case sa:return Object.assign({},e,{sessionId:t.sessionId});case ca:return Object.assign({},e,{sessionId:t.payload.sessionId,userId:t.payload.userId});case la:return Object.assign({},e,{sessionId:void 0});default:return e}},mp={connectionState:Ca.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},hp=(e=bp,t)=>{switch(t.type){case Wi:return bp;case ca:return _p({type:`webclient.chat.started`}),e;case la:return _p({type:`webclient.chat.ended`}),e;case at:return Object.assign({},e,{isBotTyping:!0});case ot:return Object.assign({},e,{isBotTyping:!1});case st:case ct:return gp(e,t.message,t.meta);case lt:{_p(t);let n=Object.assign({},t.message,{_id:t.meta.actionId}),r=e.messages.filter(e=>e._id===t.meta.actionId).length>0;return Object.assign({},e,{isBotTyping:!1,messages:r?e.messages:e.messages.concat([n]),quickReplies:n.quickReplies?n.quickReplies:[]})}case Rt:{let n=t.messages,r=n.length?n[n.length-1]:void 0;return Object.assign({},e,{isBotTyping:!1,messages:n,quickReplies:r?.quickReplies||[]})}case Lt:return _p(t.message),e;case dt:return _p(t.event),e;case gt:return Object.assign({},e,{drawerContentUrl:t.payload.parameters.contentUrl});case _t:return Object.assign({},e,{drawerContentUrl:void 0});case vt:return Object.assign({},e,{locale:t.payload.locale});case Kt:return _p(t),e;case qt:return _p(t),{...e,conversationRating:{...e.conversationRating,opener:void 0}};case Bt:{let n=new St(t.transcription,new Et);return gp(e,Object.assign({},n,{_id:yn()}))}case mt:{let n=e.messages.map(e=>e._id===t.payload.actionId?Object.assign({},e,t.payload.reaction?{reaction:{type:t.payload.reaction,category:t.payload.category,comment:t.payload.comment}}:{reaction:void 0}):e);return Object.assign({},e,{messages:n})}case Vt:{let n={enabled:!0,rating:t.payload.rating};return Object.assign({},e,{conversationRating:n})}case ht:{let n={...e.conversationRating,rating:t.payload};return Object.assign({},e,{conversationRating:n})}case Ki:{let n={...e.conversationRating,opener:t.payload.opener,...t.payload.defaultRating?{rating:{value:t.payload.defaultRating,feedback:e.conversationRating.rating?.feedback||``}}:{}};return Object.assign({},e,{conversationRating:n})}case qi:{let t={...e.conversationRating,opener:void 0};return Object.assign({},e,{conversationRating:t})}case Wt:return{...e,sourceInfos:{type:`loading`,chunkId:t.payload.chunkId}};case Ut:{let{highlighted:n}=t.payload;return e.sourceInfos?.type===`loaded`&&n?{...e,sourceInfos:{...e.sourceInfos,highlighted:!0}}:{...e,sourceInfos:{type:`loading-error`}}}case Ht:{let n=e.sourceInfos?.type,{chunkId:r,knowledgeBaseType:i,title:a,content:o,highlighted:s,url:c}=t.payload,l=e.sourceInfos?.type===`loading`||e.sourceInfos?.type===`loaded`?e.sourceInfos?.chunkId:void 0;return l&&l!==r?e:n===`loading`||n===`loaded`&&s?{...e,sourceInfos:{type:`loaded`,chunkId:r,knowledgeBaseType:i,title:a,content:o,highlighted:s,url:c}}:e}case Gt:return{...e,sourceInfos:void 0};case Gi:return{...e,showTranscriptMailOverlay:!e.showTranscriptMailOverlay,conversationRating:{...e.conversationRating,opener:void 0}};default:return e}},gp=(e,t,n)=>{let r=e.messages[e.messages.length-1],i=r?.text===t.text,a=!!n?.actionId,o=r&&!r._id&&r.sender.type===t.sender.type;if(a&&o){let r=Object.assign({},t,{_id:n.actionId}),i=[...e.messages];return i[i.length-1]=r,Object.assign({},e,{messages:i,quickReplies:[]})}return r&&r.sender.type===t.sender.type&&i?e:Object.assign({},e,{messages:e.messages.concat([t]),quickReplies:[]})},_p=e=>{if(yp()){let t=vp();window.top?.postMessage(e,t)}else e.type===`webclient.change.url`&&window.open(e.url)},vp=()=>{try{return document.referrer?new URL(document.referrer).origin:`*`}catch{return`*`}},yp=()=>typeof window<`u`&&window.self!==window.top,bp={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},xp=Si({name:`intl`,initialState:up,reducers:{updateIntl:(e,t)=>{e.locale=t.payload.language,e.messages=t.payload.messages}}}),{updateIntl:Sp}=xp.actions,Cp=xp.reducer,wp=Si({name:`settings`,initialState:{version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[],allowedEmbedOrigins:void 0},reducers:{setSettings(e,t){e.version&&e.version!==t.payload.version?(console.log(`version changed, reloading chat window`),window.location.reload()):(e.version=t.payload.version,e.requiresUserAuthentication=t.payload.requiresUserAuthentication,e.enableStartScreen=t.payload.enableStartScreen,e.enableStandaloneView=t.payload.enableStandaloneView,e.enableTranscriptExportEmail=t.payload.enableTranscriptExportEmail,e.enableTranscriptExportPdf=t.payload.enableTranscriptExportPdf,e.enableGeneralConditions=t.payload.enableGeneralConditions,e.enableSpeechSupport=t.payload.enableSpeechSupport,e.commands=t.payload.commands,e.menuItems=t.payload.menuItems||[],e.allowedEmbedOrigins=t.payload.allowedEmbedOrigins)}}}),{setSettings:Tp}=wp.actions,Ep=wp.reducer,Dp=kn({settings:Ep,chat:hp,startScreen:Ui,connection:pp,intl:Cp}),Op=`bubble-chat`,kp=`state-last-saved-at`,Ap=`state`,jp=e=>{try{if(!Pp()||Np(Fp(e,kp)))return;{let t=Fp(e,Ap);if(t===null)return;let n=JSON.parse(t),r=n.connection?.queryString;if(r!==void 0&&!Rp(r,window.location.search)){console.log(`Ignoring persisted state due to different query string`);return}else return n}}catch(e){console.error(e);return}},Mp=(e,t)=>{try{Ip(e,Ap,JSON.stringify(t)),Ip(e,kp,new Date().toISOString())}catch(e){console.error(e)}},Np=e=>{if(e===null)return!1;let t=new Date(e);return t.setHours(t.getHours()+12),new Date>t},Pp=()=>typeof localStorage<`u`,Fp=(e,t)=>{let n=Lp(e,t);return localStorage.getItem(n)},Ip=(e,t,n)=>{let r=Lp(e,t);return localStorage.setItem(r,n)},Lp=(e,t)=>`${Op}-${e}-${t}`,Rp=(e,t)=>{let n=new URLSearchParams(e),r=new URLSearchParams(t);n.delete(`referrer`),r.delete(`referrer`);let i=Array.from(n.entries()).sort(),a=Array.from(r.entries()).sort();return i.length===a.length?i.every(([e,t],n)=>{let[r,i]=a[n];return e===r&&t===i}):!1},zp=Object.create(null);zp.open=`0`,zp.close=`1`,zp.ping=`2`,zp.pong=`3`,zp.message=`4`,zp.upgrade=`5`,zp.noop=`6`;var Bp=Object.create(null);Object.keys(zp).forEach(e=>{Bp[zp[e]]=e});var Vp={type:`error`,data:`parser error`},Hp=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,Up=typeof ArrayBuffer==`function`,Wp=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Gp=({type:e,data:t},n,r)=>Hp&&t instanceof Blob?n?r(t):Kp(t,r):Up&&(t instanceof ArrayBuffer||Wp(t))?n?r(t):Kp(new Blob([t]),r):r(zp[e]+(t||``)),Kp=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function qp(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Jp;function Yp(e,t){if(Hp&&e.data instanceof Blob)return e.data.arrayBuffer().then(qp).then(t);if(Up&&(e.data instanceof ArrayBuffer||Wp(e.data)))return t(qp(e.data));Gp(e,!1,e=>{Jp||=new TextEncoder,t(Jp.encode(e))})}var Xp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Zp=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Zp[Xp.charCodeAt(e)]=e;var Qp=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=Zp[e.charCodeAt(r)],o=Zp[e.charCodeAt(r+1)],s=Zp[e.charCodeAt(r+2)],c=Zp[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},$p=typeof ArrayBuffer==`function`,em=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:nm(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:tm(e.substring(1),t)}:Bp[n]?e.length>1?{type:Bp[n],data:e.substring(1)}:{type:Bp[n]}:Vp},tm=(e,t)=>$p?nm(Qp(e),t):{base64:!0,data:e},nm=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},rm=``,im=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{Gp(e,!1,e=>{r[a]=e,++i===n&&t(r.join(rm))})})},am=(e,t)=>{let n=e.split(rm),r=[];for(let e=0;e<n.length;e++){let i=em(n[e],t);if(r.push(i),i.type===`error`)break}return r};function om(){return new TransformStream({transform(e,t){Yp(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var sm;function cm(e){return e.reduce((e,t)=>e+t.length,0)}function lm(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function um(e,t){sm||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(cm(n)<1)break;let e=lm(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(cm(n)<2)break;let e=lm(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(cm(n)<8)break;let e=lm(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(Vp);break}i=a*2**32+t.getUint32(4),r=3}else{if(cm(n)<i)break;let e=lm(n,i);s.enqueue(em(a?e:sm.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(Vp);break}}}})}function dm(e){if(e)return fm(e)}function fm(e){for(var t in dm.prototype)e[t]=dm.prototype[t];return e}dm.prototype.on=dm.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},dm.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},dm.prototype.off=dm.prototype.removeListener=dm.prototype.removeAllListeners=dm.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},dm.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},dm.prototype.emitReserved=dm.prototype.emit,dm.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},dm.prototype.hasListeners=function(e){return!!this.listeners(e).length};var pm=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),mm=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),hm=`arraybuffer`;function gm(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var _m=mm.setTimeout,vm=mm.clearTimeout;function ym(e,t){t.useNativeTimers?(e.setTimeoutFn=_m.bind(mm),e.clearTimeoutFn=vm.bind(mm)):(e.setTimeoutFn=mm.setTimeout.bind(mm),e.clearTimeoutFn=mm.clearTimeout.bind(mm))}var bm=1.33;function xm(e){return typeof e==`string`?Sm(e):Math.ceil((e.byteLength||e.size)*bm)}function Sm(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function Cm(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function wm(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function Tm(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var Em=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},Dm=class extends dm{constructor(e){super(),this.writable=!1,ym(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new Em(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=em(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_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(e){let t=wm(e);return t.length?`?`+t:``}},Om=class extends Dm{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){am(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,im(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Cm()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},km=!1;try{km=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Am=km;function jm(){}var Mm=class extends Om{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},Nm=class e extends dm{constructor(e,t,n){super(),this.createRequest=e,ym(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=gm(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=jm,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(Nm.requestsCount=0,Nm.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,Pm);else if(typeof addEventListener==`function`){let e=`onpagehide`in mm?`pagehide`:`unload`;addEventListener(e,Pm,!1)}}function Pm(){for(let e in Nm.requests)Nm.requests.hasOwnProperty(e)&&Nm.requests[e].abort()}var Fm=(function(){let e=Lm({xdomain:!1});return e&&e.responseType!==null})(),Im=class extends Mm{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Fm&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Nm(Lm,this.uri(),e)}};function Lm(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Am))return new XMLHttpRequest}catch{}if(!t)try{return new mm[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var Rm=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,zm=class extends Dm{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=Rm?{}:gm(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;Gp(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&pm(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Cm()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Bm=mm.WebSocket||mm.MozWebSocket,Vm={websocket:class extends zm{createSocket(e,t,n){return Rm?new Bm(e,t,n):t?new Bm(e,t):new Bm(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Dm{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=um(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=om();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&pm(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:Im},Hm=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Um=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function Wm(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=Hm.exec(e||``),a={},o=14;for(;o--;)a[Um[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=Gm(a,a.path),a.queryKey=Km(a,a.query),a}function Gm(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function Km(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var qm=typeof addEventListener==`function`&&typeof removeEventListener==`function`,Jm=[];qm&&addEventListener(`offline`,()=>{Jm.forEach(e=>e())},!1);var Ym=class e extends dm{constructor(e,t){if(super(),this.binaryType=hm,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=Wm(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Wm(t.host).host);ym(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),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},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=Tm(this.opts.query)),qm&&(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`})},Jm.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),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){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=xm(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,pm(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){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(),qm&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=Jm.indexOf(this._offlineEventListener);e!==-1&&Jm.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};Ym.protocol=4;var Xm=class extends Ym{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Ym.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;Ym.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},Zm=class extends Xm{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>Vm[e]).filter(e=>!!e)),super(e,n)}};Zm.protocol;function Qm(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=Wm(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var $m=typeof ArrayBuffer==`function`,eh=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,th=Object.prototype.toString,nh=typeof Blob==`function`||typeof Blob<`u`&&th.call(Blob)===`[object BlobConstructor]`,rh=typeof File==`function`||typeof File<`u`&&th.call(File)===`[object FileConstructor]`;function ih(e){return $m&&(e instanceof ArrayBuffer||eh(e))||nh&&e instanceof Blob||rh&&e instanceof File}function ah(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(ah(e[t]))return!0;return!1}if(ih(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return ah(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&ah(e[t]))return!0;return!1}function oh(e){let t=[],n=e.data,r=e;return r.data=sh(n,t),r.attachments=t.length,{packet:r,buffers:t}}function sh(e,t){if(!e)return e;if(ih(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=sh(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=sh(e[r],t));return n}return e}function ch(e,t){return e.data=lh(e.data,t),delete e.attachments,e}function lh(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=lh(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=lh(e[n],t));return e}var uh=s({Decoder:()=>mh,Encoder:()=>ph,PacketType:()=>fh,isPacketValid:()=>xh,protocol:()=>5}),dh=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],fh;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(fh||={});var ph=class{constructor(e){this.replacer=e}encode(e){return(e.type===fh.EVENT||e.type===fh.ACK)&&ah(e)?this.encodeAsBinary({type:e.type===fh.EVENT?fh.BINARY_EVENT:fh.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===fh.BINARY_EVENT||e.type===fh.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=oh(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},mh=class e extends dm{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===fh.BINARY_EVENT;n||t.type===fh.BINARY_ACK?(t.type=n?fh.EVENT:fh.ACK,this.reconstructor=new hh(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(ih(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(fh[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===fh.BINARY_EVENT||r.type===fh.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!_h(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case fh.CONNECT:return yh(t);case fh.DISCONNECT:return t===void 0;case fh.CONNECT_ERROR:return typeof t==`string`||yh(t);case fh.EVENT:case fh.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&dh.indexOf(t[0])===-1);case fh.ACK:case fh.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},hh=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=ch(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function gh(e){return typeof e==`string`}var _h=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function vh(e){return e===void 0||_h(e)}function yh(e){return Object.prototype.toString.call(e)===`[object Object]`}function bh(e,t){switch(e){case fh.CONNECT:return t===void 0||yh(t);case fh.DISCONNECT:return t===void 0;case fh.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&dh.indexOf(t[0])===-1);case fh.ACK:return Array.isArray(t);case fh.CONNECT_ERROR:return typeof t==`string`||yh(t);default:return!1}}function xh(e){return gh(e.nsp)&&vh(e.id)&&bh(e.type,e.data)}function Sh(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Ch=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),wh=class extends dm{constructor(e,t,n){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=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[Sh(e,`open`,this.onopen.bind(this)),Sh(e,`packet`,this.onpacket.bind(this)),Sh(e,`error`,this.onerror.bind(this)),Sh(e,`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(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(Ch.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:fh.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:fh.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case fh.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,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 fh.EVENT:case fh.BINARY_EVENT:this.onevent(e);break;case fh.ACK:case fh.BINARY_ACK:this.onack(e);break;case fh.DISCONNECT:this.ondisconnect();break;case fh.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:fh.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:fh.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function Th(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Th.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},Th.prototype.reset=function(){this.attempts=0},Th.prototype.setMin=function(e){this.ms=e},Th.prototype.setMax=function(e){this.max=e},Th.prototype.setJitter=function(e){this.jitter=e};var Eh=class extends dm{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,ym(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new Th({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||uh;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new Zm(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=Sh(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=Sh(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(Sh(e,`ping`,this.onping.bind(this)),Sh(e,`data`,this.ondata.bind(this)),Sh(e,`error`,this.onerror.bind(this)),Sh(e,`close`,this.onclose.bind(this)),Sh(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){pm(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new wh(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},Dh={};function Oh(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=Qm(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=Dh[i]&&a in Dh[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new Eh(r,t):(Dh[i]||(Dh[i]=new Eh(r,t)),c=Dh[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Oh,{Manager:Eh,Socket:wh,io:Oh,connect:Oh});var kh=[lt,dt,at,ot,ft,...ua,...Yt,`@@localize/SET_ACTIVE_LANGUAGE`,`@@localize/ADD_TRANSLATION_FOR_LANGUAGE`],Ah=({dispatch:e,getState:t})=>n=>{let r=null;return i=>{let a=n(i);if(i.type===`CONNECT`)r?.disconnect(),e(pa()),r=Oh({path:`/website-messenger/${i.clientName}/socket.io`,query:i.querystrings}),r.on(`action`,e),r.on(`connect`,()=>e(ma())),r.on(`disconnect`,()=>e(ha())),r.on(`reconnect`,()=>e(ga())),r.on(`set-translations`,(t,n)=>{e(Sp({language:t,messages:dp(t,n)}))}),r.on(`set-settings`,t=>{e(Tp(t))}),r.on(`enable-conversation-rating`,t=>e(en(t))),r.on(`speech-transcription`,t=>e(Zt(t))),r.on(`restore-client-state`,t=>{e(fa(t.sessionId)),e(rn(t.messages))}),r.on(`expand-window`,({devices:t,initial:n=!1})=>{e({type:Kt,devices:t,initial:n})}),r.on(`restart-chat`,()=>{e(va())}),r.on(`login-success`,t=>{e(zi({loginToken:t.loginToken}))});else if(i.type===`start-screen/requestLogin`)r?.emit(`login-requested`,i.payload);else if(i.type===`START`)r?.emit(`start-chat`,i.payload);else if(i.type===`CLEAR_SESSION_ID`)r?.emit(`terminate-session`,i.payload);else if(i.type===`webclient.get.started`)r?.emit(`get-started`,JSON.stringify(i));else if(i.type===`AUDIO_MESSAGE_FROM_USER`)r?.emit(`audio-message`,i.buffer);else if(i.type===`core.conversation.rating.from.guest`)r?.emit(`conversation-rating`,i.payload);else if(i.type===`webclient.transcript.pdf.download`){let{connection:{sessionId:e}}=t();if(e){let t=bn(),n=new URL(`/${encodeURIComponent(t)}/transcript-pdf/${encodeURIComponent(e)}`,window.location.origin);window.location.href=n.toString()}}else kh.indexOf(i.type)===-1&&i.meta===void 0&&r&&r.emit(`action`,JSON.stringify(i));return a}},jh=bn(),Mh=mi({middleware:e=>e().concat(Ah),reducer:Dp,preloadedState:{...jp(jh),intl:up}});Mh.subscribe(Qc(()=>{let e=Mh.getState();Mp(jh,{connection:e.connection,startScreen:e.startScreen})},1e3)),(0,b.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(qe,{store:Mh,children:(0,X.jsx)(rp,{})}));
77
- //# sourceMappingURL=index-C67kLnKc.js.map
78
+ //# sourceMappingURL=index-DyOSmgo1.js.map