@botfabrik/engine-webclient 4.123.2 → 4.123.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,7 +58,7 @@ ${w.current.stack}
|
|
|
58
58
|
`}if(n.optimizeForStreaming){var s=o.lastIndexOf(`<`);s!==-1&&o.indexOf(`>`,s)===-1&&(o=o.slice(0,s)),s=e.lastIndexOf(`<`),s!==-1&&e.indexOf(`>`,s)===-1&&(e=e.slice(0,s))}return wc(gc(t?e:o,{inline:t,refs:a},i),{...i,forceInline:t})}let a={};return i(e)}var Ec=({children:e,options:t,...n})=>{if(!(typeof x.useContext<`u`)){let r={...t,overrides:{...t?.overrides},wrapperProps:{...t?.wrapperProps,...n}};return Tc(e??``,r)}let r=x.useContext(bc),i=x.useMemo(()=>({...r,...t,overrides:{...r?.overrides,...t?.overrides},wrapperProps:{...r?.wrapperProps,...t?.wrapperProps,...n}}),[r,t,n]),a=e??``;return x.useMemo(()=>Tc(a,i),[a,i])},Dc={generalConditionsContainer:`_generalConditionsContainer_55hjg_1`,generalConditions:`_generalConditions_55hjg_1`,generalConditionsHeader:`_generalConditionsHeader_55hjg_15`,generalConditionsBody:`_generalConditionsBody_55hjg_26`,generalConditionsAccept:`_generalConditionsAccept_55hjg_35`},Oc=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Z=o(((e,t)=>{t.exports=Oc()}))(),kc=()=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1rem`,height:`1rem`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.jsx)(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`})}),Ac=()=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1rem`,height:`1rem`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.jsx)(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`})}),jc=`general-conditions.header`,Mc=`general-conditions.body`,Nc=`general-conditions.accept-conditions-note`,Pc=()=>{let e=ta(),[t,n]=(0,x.useState)(!1),r=()=>n(!t),i=e=>{e.key===`ArrowDown`||e.key===`ArrowRight`?n(!0):e.key===`ArrowUp`||e.key===`ArrowLeft`||e.key===`Escape`?n(!1):(e.key===`Enter`||e.key===`Space`||e.key===` `)&&r()},a=e(jc),o=e(Nc);return(0,Z.jsxs)(`div`,{className:R(Dc.generalConditionsContainer,`chat__generalConditions`),children:[!!a?.length&&(0,Z.jsxs)(`div`,{className:Dc.generalConditions,children:[(0,Z.jsxs)(`div`,{role:`button`,onClick:r,onKeyDown:i,tabIndex:0,className:R(Dc.generalConditionsHeader,`chat__generalConditions__header`),"aria-controls":`general-conditions-body`,"aria-expanded":t?`true`:`false`,"aria-pressed":t?`true`:`false`,children:[(0,Z.jsx)(Ec,{children:a}),t?(0,Z.jsx)(Ac,{}):(0,Z.jsx)(kc,{})]}),(0,Z.jsx)(`div`,{className:R(Dc.generalConditionsBody,`chat__generalConditions__body`),id:`general-conditions-body`,role:`region`,tabIndex:-1,children:t&&(0,Z.jsx)(Ec,{children:e(Mc)||``})})]}),!!o?.length&&(0,Z.jsx)(`div`,{className:R(Dc.generalConditionsAccept,`chat__generalConditions__accept`),tabIndex:0,children:(0,Z.jsx)(Ec,{children:e(Nc)||``})})]})},Q={messageContainer:`_messageContainer_1rxi5_1`,message:`_message_1rxi5_1`,messageBot:`_messageBot_1rxi5_14`,messageBotLast:`_messageBotLast_1rxi5_45`,avatar:`_avatar_1rxi5_45`,messageBotFirst:`_messageBotFirst_1rxi5_54`,messageBotAnimated:`_messageBotAnimated_1rxi5_67`,fadeInLeft:`_fadeInLeft_1rxi5_1`,messageGuest:`_messageGuest_1rxi5_78`,messageGuestFirst:`_messageGuestFirst_1rxi5_84`,messageGuestLast:`_messageGuestLast_1rxi5_90`,botAvatar:`_botAvatar_1rxi5_104`,agentAvatar:`_agentAvatar_1rxi5_108`,bubble:`_bubble_1rxi5_112`,bubbleContent:`_bubbleContent_1rxi5_118`,bubbleLeft:`_bubbleLeft_1rxi5_132`,leftText:`_leftText_1rxi5_143`,bubbleRight:`_bubbleRight_1rxi5_150`,rightText:`_rightText_1rxi5_160`,sourceInfoReference:`_sourceInfoReference_1rxi5_192`,sourceInfoReferenceActive:`_sourceInfoReferenceActive_1rxi5_204`},Fc=(e,t)=>{(0,x.useEffect)(()=>{let n=n=>{e.current&&!e.current.contains(n.target)&&t()};return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e,t])};function Ic(e,t){let n=null,r=null,i=(...i)=>{r=i,n&&clearTimeout(n),n=setTimeout(()=>{e(...r),n=null,r=null},t)};return i.flush=()=>{n&&r&&(clearTimeout(n),e(...r),n=null,r=null)},i}function Lc(e,t){let n=0,r=null;return((...i)=>{let a=Date.now(),o=a-n;o>=t?(n=a,e(...i)):(r&&clearTimeout(r),r=setTimeout(()=>{n=Date.now(),e(...i)},t-o))})}var Rc={container:`_container_131ib_1`,categoryContainer:`_categoryContainer_131ib_13`,categoryButton:`_categoryButton_131ib_20`,active:`_active_131ib_35`,commentTextarea:`_commentTextarea_131ib_44`},zc=(e,t,n)=>{(0,x.useEffect)(()=>{if(e){let e=()=>{let e=[`button:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`,`a[href]`,`input:not([disabled])`,`select:not([disabled])`].join(`,`),r=t.current?Array.from(t.current.querySelectorAll(e)):[],i=n.current?Array.from(n.current.querySelectorAll(e)):[];return[...r,...i]},r=t=>{if(t.key===`Tab`){let n=e();if(n.length>0){let e=n[0],r=n[n.length-1],i=document.activeElement;!t.shiftKey&&i===r?(t.preventDefault(),e.focus()):t.shiftKey&&i===e&&(t.preventDefault(),r.focus())}}};return document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`keydown`,r,!0)}}},[e,t,n])},Bc=({open:e,actionsRef:t,reaction:n,onReaction:r})=>{let i=ta(),a=(0,x.useRef)(null),o=Ic(e=>{r({...n,comment:e})},300);(0,x.useEffect)(()=>()=>o.flush(),[o]),zc(e,t,a);let s=e=>{r({...n,category:n.category===e?void 0:e})};return e?(0,Z.jsxs)(`div`,{ref:a,className:Rc.container,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`bad-reaction-title`,children:[(0,Z.jsx)(`h2`,{id:`bad-reaction-title`,children:i(`bot-bubble.reaction.say-more`)}),(0,Z.jsx)(`div`,{className:Rc.categoryContainer,role:`radiogroup`,children:[`WRONG_INFORMATION`,`MISSING_INFORMATION`,`OLD_INFORMATION`,`UNCLEAR`,`OFF_TOPIC`].map(e=>(0,Z.jsx)(`button`,{className:R(Rc.categoryButton,n?.category===e&&Rc.active),onClick:()=>s(e),"aria-pressed":n?.category===e,"aria-label":i(`bot-bubble.reaction.category.${e}`),tabIndex:0,role:`radio`,children:i(`bot-bubble.reaction.category.${e}`)},e))}),(0,Z.jsx)(`textarea`,{id:`comment`,name:`comment`,placeholder:i(`bot-bubble.reaction.comment`),defaultValue:n?.comment,onChange:e=>o(e.target.value),className:Rc.commentTextarea,rows:3,"aria-label":i(`bot-bubble.reaction.comment`)})]}):null},Vc={botMessageActionContainer:`_botMessageActionContainer_g6hpe_1`,alwaysVisible:`_alwaysVisible_g6hpe_15`,active:`_active_g6hpe_19`,botMessageActionInnerContainer:`_botMessageActionInnerContainer_g6hpe_27`,header:`_header_g6hpe_52`,botMessageActions:`_botMessageActions_g6hpe_57`,reported:`_reported_g6hpe_68`,action:`_action_g6hpe_72`,anyReport:`_anyReport_g6hpe_120`,closeButton:`_closeButton_g6hpe_136`},Hc=({isSubmitting:e,onClick:t})=>{let n=ta();return(0,Z.jsx)(`button`,{className:R(Vc.action,Vc.closeButton,`tooltip--bottom-left`),"aria-label":n(`bot-bubble.reaction.close`),"data-title":n(`bot-bubble.reaction.close`),tabIndex:0,onClick:t,children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:e?(0,Z.jsx)(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}):(0,Z.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`})})})},Uc=({alwaysVisible:e,senderType:t,reaction:n,botMessageRef:r,message:i,onReaction:a})=>{let o=ta(),[s,c]=(0,x.useState)(!1),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(!1),p=(0,x.useRef)(null),m=(0,x.useRef)(null);Fc(p,()=>{f(!1)});let h=e=>{e.key===`Escape`&&f(!1)};(0,x.useEffect)(()=>(document.addEventListener(`keydown`,h),()=>{document.removeEventListener(`keydown`,h)}),[]),(0,x.useEffect)(()=>{d&&p.current?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})},[d]);let g=e=>{m.current&&clearTimeout(m.current),u(!0),a(e),m.current=setTimeout(()=>{u(!1)},1e3)},_=(0,x.useCallback)(async()=>{if(r.current)try{c(!0);let e=r.current.innerHTML,t=r.current.innerText;await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})]),await new Promise(e=>setTimeout(e,1500))}finally{c(!1)}},[r]),v=()=>{f(!1),a(n?.type===`GOOD`?null:{type:`GOOD`})},y=()=>{a({...i.reaction,type:`BAD`}),f(!d)},b=e=>t=>{(t.key===`Enter`||t.key===` `)&&e()};return(0,Z.jsx)(`div`,{ref:p,className:R(Vc.botMessageActionContainer,e&&Vc.alwaysVisible,d&&Vc.active),"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:R(Vc.botMessageActionInnerContainer,e&&Vc.alwaysVisible,d&&Vc.active,n&&Vc.reported),role:`group`,"aria-label":o(`bot-bubble.actions.label`),children:[(0,Z.jsxs)(`div`,{className:Vc.header,children:[(0,Z.jsxs)(`div`,{className:R(Vc.botMessageActions,n&&Vc.reported),children:[t===ra.BOT&&(0,Z.jsx)(`button`,{className:R(Vc.action,n?.type&&Vc.anyReport,n?.type===`GOOD`&&Vc.reported,`tooltip--top-right`),tabIndex:0,"aria-label":o(n?.type===`GOOD`?`bot-bubble.reaction.remove`:`bot-bubble.reaction.good`),"aria-pressed":n?.type===`GOOD`,"data-title":o(n?.type===`GOOD`?`bot-bubble.reaction.remove`:`bot-bubble.reaction.good`),onPointerDown:v,onKeyDown:b(v),children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:n?.type===`GOOD`?(0,Z.jsx)(`path`,{d:`M234,80.12A24,24,0,0,0,216,72H160V56a40,40,0,0,0-40-40,8,8,0,0,0-7.16,4.42L75.06,96H32a16,16,0,0,0-16,16v88a16,16,0,0,0,16,16H204a24,24,0,0,0,23.82-21l12-96A24,24,0,0,0,234,80.12ZM32,112H72v88H32Z`}):(0,Z.jsx)(`path`,{d:`M234,80.12A24,24,0,0,0,216,72H160V56a40,40,0,0,0-40-40,8,8,0,0,0-7.16,4.42L75.06,96H32a16,16,0,0,0-16,16v88a16,16,0,0,0,16,16H204a24,24,0,0,0,23.82-21l12-96A24,24,0,0,0,234,80.12ZM32,112H72v88H32ZM223.94,97l-12,96a8,8,0,0,1-7.94,7H88V105.89l36.71-73.43A24,24,0,0,1,144,56V80a8,8,0,0,0,8,8h64a8,8,0,0,1,7.94,9Z`})})}),t===ra.BOT&&(0,Z.jsx)(`button`,{className:R(Vc.action,n?.type&&Vc.anyReport,n?.type===`BAD`&&Vc.reported,`tooltip--top-right`),tabIndex:0,"aria-label":o(`bot-bubble.reaction.bad`),"aria-pressed":n?.type===`BAD`,"data-title":o(`bot-bubble.reaction.bad`),onPointerDown:y,onKeyDown:b(y),children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:n?.type===`BAD`?(0,Z.jsx)(`path`,{d:`M239.82,157l-12-96A24,24,0,0,0,204,40H32A16,16,0,0,0,16,56v88a16,16,0,0,0,16,16H75.06l37.78,75.58A8,8,0,0,0,120,240a40,40,0,0,0,40-40V184h56a24,24,0,0,0,23.82-27ZM72,144H32V56H72Z`}):(0,Z.jsx)(`path`,{d:`M239.82,157l-12-96A24,24,0,0,0,204,40H32A16,16,0,0,0,16,56v88a16,16,0,0,0,16,16H75.06l37.78,75.58A8,8,0,0,0,120,240a40,40,0,0,0,40-40V184h56a24,24,0,0,0,23.82-27ZM72,144H32V56H72Zm150,21.29a7.88,7.88,0,0,1-6,2.71H152a8,8,0,0,0-8,8v24a24,24,0,0,1-19.29,23.54L88,150.11V56H204a8,8,0,0,1,7.94,7l12,96A7.87,7.87,0,0,1,222,165.29Z`})})}),(0,Z.jsx)(`button`,{className:R(Vc.action,`tooltip--top-right`),style:{visibility:d?`hidden`:`visible`},tabIndex:0,"aria-label":o(`bot-bubble.copy`),"data-title":o(`bot-bubble.copy`),onClick:_,children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:s?(0,Z.jsx)(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}):(0,Z.jsx)(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`})})})]}),d&&(0,Z.jsx)(Hc,{isSubmitting:l,onClick:()=>f(!1)})]}),i.reaction&&(0,Z.jsx)(Bc,{open:d,actionsRef:p,reaction:i.reaction,onReaction:g})]})})},Wc=(0,x.forwardRef)(({message:e,isAnimated:t,isLastMessage:n,isFirstMessageBySender:r,isLastMessageBySender:i,children:a,onReaction:o},s)=>{let c=ta(),l=(0,x.useRef)(null),u=e.sender.type===ot.BOT;return(0,Z.jsxs)(`li`,{ref:s,className:R(Q.message,Q.messageBot,n&&Q.lastMessage,r&&Q.messageBotFirst,i&&Q.messageBotLast,`chat__bubbleContainer`,t&&Q.messageBotAnimated,t&&`chat__bubbleContainer--animated`,u?`chat__botBubbleContainer`:`chat__agentBubbleContainer`,r&&`chat__bubbleContainer--first`,i&&`chat__bubbleContainer--last`),role:`article`,children:[(0,Z.jsx)(`img`,{className:R(Q.avatar,u?Q.botAvatar:Q.agentAvatar,`chat__avatar`,u?`chat__botAvatar`:`chat__agentAvatar`),src:`${e.sender.avatar}`,alt:u?`Bot`:`Agent`,referrerPolicy:`no-referrer`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:Q.messageContainer,children:[(0,Z.jsx)(`div`,{ref:l,className:R(Q.bubble,Q.bubbleLeft,`chat__bubble`,u?`chat__botBubble`:`chat__agentBubble`),tabIndex:0,role:`group`,"aria-label":c(u?`bot-bubble.label`:`agent-bubble.label`),children:(0,Z.jsx)(`div`,{className:R(Q.leftText),children:a})}),o&&(0,Z.jsx)(Uc,{alwaysVisible:n&&i,senderType:e.sender.type,reaction:e.reaction,message:e,botMessageRef:l,onReaction:o})]})]})}),Gc={sourceList:`_sourceList_1sc0q_1`,source:`_source_1sc0q_1`,label:`_label_1sc0q_39`},Kc=e=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,Z.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`})}),qc=e=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,Z.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`})}),Jc=e=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,Z.jsx)(`path`,{d:`M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Z`})}),Yc=e=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,Z.jsx)(`path`,{d:`M222,152a6,6,0,0,1-6,6H190v20h18a6,6,0,0,1,0,12H190v18a6,6,0,0,1-12,0V152a6,6,0,0,1,6-6h32A6,6,0,0,1,222,152ZM90,172a26,26,0,0,1-26,26H54v10a6,6,0,0,1-12,0V152a6,6,0,0,1,6-6H64A26,26,0,0,1,90,172Zm-12,0a14,14,0,0,0-14-14H54v28H64A14,14,0,0,0,78,172Zm84,8a34,34,0,0,1-34,34H112a6,6,0,0,1-6-6V152a6,6,0,0,1,6-6h16A34,34,0,0,1,162,180Zm-12,0a22,22,0,0,0-22-22H118v44h10A22,22,0,0,0,150,180ZM42,112V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88v24a6,6,0,0,1-12,0V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2v72a6,6,0,0,1-12,0ZM158,82h35.52L158,46.48Z`})}),Xc=({type:e,...t})=>{switch(e){case`WEBSITE`:return(0,Z.jsx)(Kc,{...t});case`PDF`:return(0,Z.jsx)(Yc,{...t});case`DOCX`:return(0,Z.jsx)(qc,{...t});default:return(0,Z.jsx)(Jc,{...t})}},Zc=({sources:e,onLinkClick:t})=>{let n=ta(),r=e=>()=>{t(e.url)},i=e=>n=>{(n.key===`Enter`||n.key===` `)&&t(e.url)};return e.length?(0,Z.jsx)(`ul`,{className:Gc.sourceList,"aria-label":n(`bot-bubble.sources`),children:e.map(e=>(0,Z.jsx)(`li`,{className:Gc.source,children:(0,Z.jsxs)(`a`,{role:`button`,tabIndex:0,"aria-label":`${n(`bot-bubble.source.open`)}: ${e.label}`,onClick:r(e),onKeyDown:i(e),children:[(0,Z.jsx)(Xc,{type:e.type,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:Gc.label,children:e.label})]})},e.url))}):null},Qc={button:`_button_3ui4g_1`,buttonDefault:`_buttonDefault_3ui4g_13`,buttonPrimary:`_buttonPrimary_3ui4g_28`},$c=({className:e,children:t,...n})=>(0,Z.jsx)(`button`,{className:R(Qc.button,e),type:`button`,role:`button`,...n,children:t}),el={title:`_title_137pi_1`,buttons:`_buttons_137pi_6`,button:`_button_137pi_6`,imageContainer:`_imageContainer_137pi_29`,image:`_image_137pi_29`,video_container:`_video_container_137pi_44`,video:`_video_137pi_44`,only:`_only_137pi_58`},tl=({buttons:e,onButtonClick:t})=>(0,Z.jsx)(`div`,{className:R(el.buttons,`chat__bubbleButtons`),children:e.map((e,n)=>(0,Z.jsx)($c,{className:R(el.button,`chat__bubbleButton`),onClick:()=>t(e),children:e.title},n))}),nl=`newtab#`,rl=({markdown:e,markdownOptions:t={},onLinkClick:n})=>{let r=e=>t=>(t.preventDefault(),e&&n(e),!1),i=({title:e,href:t,children:n})=>t.indexOf(nl)===0?(0,Z.jsx)(`a`,{href:t.slice(7),title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}):(0,Z.jsx)(`a`,{onClick:r(t),title:e,href:t,children:n});return(0,Z.jsx)(Ec,{options:{...t,overrides:{a:i}},children:e})},il=({text:e,onLinkClick:t})=>e?(0,Z.jsx)(`div`,{children:(0,Z.jsx)(rl,{markdown:e,onLinkClick:t})}):null,al=({title:e})=>e?(0,Z.jsx)(`h1`,{className:el.title,children:e}):null,ol=({title:e,text:t,buttons:n,onButtonClick:r,onLinkClick:i})=>e?.length||t?.length||n?.length?(0,Z.jsxs)(`div`,{className:R(Q.bubbleContent),children:[(0,Z.jsx)(al,{title:e}),(0,Z.jsx)(il,{text:t,onLinkClick:i}),(0,Z.jsx)(tl,{buttons:n,onButtonClick:r})]}):null,sl=({alt:e,imageUrl:t,itemUrl:n,hasBody:r})=>t?n?n.indexOf(`youtube.com`)>-1?(0,Z.jsx)(`div`,{className:el.video_container,children:(0,Z.jsx)(`iframe`,{className:R(el.video,{[el.only]:!r}),title:`Youtube`,width:`100%`,src:n+`?rel=0`,frameBorder:`0`,allowFullScreen:!0})}):(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:(0,Z.jsx)(`div`,{className:el.imageContainer,children:(0,Z.jsx)(`img`,{className:R(el.image,{[el.only]:!r}),src:t,alt:e})})}):(0,Z.jsx)(`div`,{className:el.imageContainer,children:(0,Z.jsx)(`img`,{className:R(el.image,{[el.only]:!r}),src:t,alt:e})}):null,cl=({title:e,text:t,imageUrl:n,itemUrl:r,buttons:i,sources:a,onButtonClick:o,onLinkClick:s})=>{let c=!!e?.length||!!t?.length||!!i?.length;return(0,Z.jsxs)(`div`,{className:R(el.detailMessage),children:[(0,Z.jsx)(sl,{hasBody:c,imageUrl:n,itemUrl:r,alt:e||``}),c&&(0,Z.jsx)(ol,{title:e,text:t,buttons:i,onLinkClick:s,onButtonClick:o}),(0,Z.jsx)(Zc,{sources:a,onLinkClick:s})]})},ll=(0,x.forwardRef)(({isFirstMessageBySender:e,isLastMessageBySender:t,children:n},r)=>{let i=ta();return(0,Z.jsx)(`li`,{ref:r,className:R(Q.message,Q.messageGuest,e&&Q.messageGuestFirst,t&&Q.messageGuestLast,`chat__bubbleContainer`,`chat__guestBubbleContainer`,e&&`chat__bubbleContainer--first`,t&&`chat__bubbleContainer--last`),role:`article`,children:(0,Z.jsx)(`div`,{className:R(Q.bubble,Q.bubbleRight,`chat__bubble`,`chat__guestBubble`),tabIndex:0,role:`group`,"aria-label":i(`guest-bubble.label`),children:(0,Z.jsx)(`div`,{className:R(Q.rightText),children:n})})})}),ul=()=>(0,x.useMemo)(()=>Zt(),[]),dl={markdown:`_markdown_nw7vg_1`},fl=`source-info-reference`,pl=({actionId:e,markdown:t,sources:n,onLinkClick:r})=>{let i=ul(),a=$i(),o=ml(),s=ea(e=>{let t=e.chat.sourceInfos;if(t?.type===`loaded`||t?.type===`loading`)return t.chunkId}),c=t=>n=>{let r=n.key;(r===`ArrowDown`||r===`ArrowRight`||r===`Enter`||r===` `||r===`Space`)&&(n.stopPropagation(),a(Mi(i,e,t)))},l=t=>()=>{a(Mi(i,e,t))};return(0,x.useLayoutEffect)(()=>{document.querySelectorAll(`.${fl}`).forEach(e=>{let t=e.previousSibling;t&&t.nodeType===Node.TEXT_NODE&&t.textContent?.endsWith(` `)&&t.textContent?.trim().length&&e.classList.add(`${fl}--before-space`);let n=e.nextSibling;n&&n.nodeType===Node.TEXT_NODE&&n.textContent?.startsWith(` `)&&n.textContent?.trim().length&&e.classList.add(`${fl}--after-space`)})},[t]),(0,Z.jsxs)(`div`,{className:Q.bubbleContent,children:[(0,Z.jsx)(`div`,{className:dl.markdown,children:(0,Z.jsx)(rl,{markdown:t,onLinkClick:r,markdownOptions:{renderRule(e,t,n,r){if(t.type===J.footnoteReference){let e=t.text===s;return(0,Z.jsx)(`span`,{className:R(Q.sourceInfoReference,e&&Q.sourceInfoReferenceActive,fl),children:(0,Z.jsx)(`a`,{type:`button`,tabIndex:0,onClick:l(t.text),onKeyDown:c(t.text),children:o(t.text)})},r.key)}return e()}}})}),(0,Z.jsx)(Zc,{sources:n,onLinkClick:r})]})},ml=()=>{let e=[];return t=>{let n=e.indexOf(t);return n>-1?n+1:(e.push(t),e.length)}},hl={text:`_text_gp0s0_1`,command:`_command_gp0s0_5`},gl=({text:e,commands:t=[]})=>{let n=t.find(t=>e.startsWith(`/${t}`)),r=n?e.slice(n.length+1):e;return(0,Z.jsxs)(`div`,{children:[n&&(0,Z.jsxs)(`code`,{className:hl.command,children:[`/`,n]}),r.split(`
|
|
59
59
|
`).map((e,t)=>(0,Z.jsxs)(`span`,{className:hl.text,children:[e,(0,Z.jsx)(`br`,{})]},t))]})},_l=({text:e,commands:t,sources:n,onLinkClick:r})=>(0,Z.jsxs)(`div`,{className:Q.bubbleContent,children:[(0,Z.jsx)(gl,{text:e,commands:t}),(0,Z.jsx)(Zc,{sources:n,onLinkClick:r})]}),vl=(0,x.forwardRef)(({message:e,commands:t,isLastMessage:n,isFirstMessageBySender:r,isLastMessageBySender:i,onReaction:a,onButtonClick:o,onLinkClick:s},c)=>{let l=yl(e._id,e,t,o,s),u=t=>{a(e._id,t)};switch(e.sender.type){case ot.GUEST:return(0,Z.jsx)(ll,{ref:c,isFirstMessageBySender:r,isLastMessageBySender:i,children:l});default:return(0,Z.jsx)(Wc,{ref:c,message:e,isAnimated:!1,isLastMessage:n,isFirstMessageBySender:r,isLastMessageBySender:i,onReaction:u,children:l})}}),yl=(e,t,n,r,i)=>{switch(t.type){case ct.TEXT:return(0,Z.jsx)(_l,{text:t.text,commands:n,sources:t.sources||[],onLinkClick:i});case ct.DETAIL:{let e=t;return(0,Z.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,Z.jsx)(pl,{actionId:e,markdown:n.markdown,sources:n.sources||[],onLinkClick:i})}}},bl=x.memo(vl,(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),xl={ticontainer:`_ticontainer_xg0dn_1`,tiblock:`_tiblock_xg0dn_5`,tidot:`_tidot_xg0dn_12`,mercuryTypingAnimation:`_mercuryTypingAnimation_xg0dn_1`},Sl=({isTyping:e=!1})=>(0,Z.jsx)(`div`,{className:xl.ticontainer,children:(0,Z.jsx)(`div`,{className:xl.tiblock,children:e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:R(xl.tidot,`chat__typingIndicator`),"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:R(xl.tidot,`chat__typingIndicator`),"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:R(xl.tidot,`chat__typingIndicator`),"aria-hidden":`true`})]}):null})}),Cl=Object.assign({_id:`typing-indicator`},new pt(``,new ut)),wl=({messages:e,isBotTyping:t,commands:n,onTranscriptItemReaction:r,onButtonClick:i,onLinkClick:a})=>{let o=ta(),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=ea(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,Z.jsxs)(`div`,{ref:l,className:R(aa.messageContainer,`chat__messageContainer`),style:{scrollBehavior:e.length&&c.current?`auto`:`smooth`},id:`MessageContainer`,"aria-label":o(`conversation.label`),children:[f&&(0,Z.jsx)(Pc,{}),(0,Z.jsxs)(`ul`,{className:aa.messages,role:`list`,children:[e.map((o,s)=>{let c=Tl(o,p),l=El(o,s,e,t);p=o.sender.type;let u=s+1===m,f=o._id||`added-${s}`;return(0,Z.jsx)(bl,{ref:u?d:null,message:o,commands:n,isLastMessage:u,isFirstMessageBySender:c,isLastMessageBySender:l,onButtonClick:i,onLinkClick:a,onReaction:r},f)}),t&&(0,Z.jsx)(Wc,{ref:u,message:Cl,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:p!==ot.BOT,isLastMessageBySender:!0,children:(0,Z.jsx)(Sl,{isTyping:!0})},`last`)]})]})},Tl=(e,t)=>!t||t!==e.sender.type,El=(e,t,n,r)=>{let i=e.sender.type,a=n.length;return t+1===a?!(i===ot.BOT&&r):i!==n.at(t+1)?.sender.type},Dl={bottomSheet:`_bottomSheet_jp8dl_1`,bottomSheetOpen:`_bottomSheetOpen_jp8dl_15`,"slide-in":`_slide-in_jp8dl_1`,bottomSheetClose:`_bottomSheetClose_jp8dl_20`,"slide-out":`_slide-out_jp8dl_1`},Ol={container:`_container_xc2nx_1`},kl=({contentUrl:e})=>{let t=ea(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,Z.jsx)(`div`,{className:R(Ol.container,Dl.bottomSheet,{[Dl.bottomSheetOpen]:!!e,[Dl.bottomSheetClose]:n&&!e}),children:i&&(0,Z.jsx)(`iframe`,{title:`Drawer`,id:`form-drawer`,src:i,className:Ol.iframe})})},Al={container:`_container_1634s_1`},jl=({title:e,href:t,children:n})=>(0,Z.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),Ml=()=>{let e=ta()(`powered-by`);return e&&e.length?(0,Z.jsx)(`div`,{className:R(Al.container,`chat__poweredBy`),children:(0,Z.jsx)(Ec,{options:{overrides:{a:jl}},children:e})}):null},Nl=(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,`
|
|
60
60
|
|
|
61
|
-
`).trim()},Pl=({messages:e,isBotTyping:t})=>{let n=(0,x.useRef)(``),r=ta(),i=r(`bot-bubble.footnote`),a=e=>{switch(e.type){case`TEXT`:return e.text||``;case`MARKDOWN`:return Nl(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===ra.BOT);return n?a(n):``})();return(0,x.useEffect)(()=>{o!==n.current&&(n.current=o)},[o]),(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:o})},Fl=({className:e,children:t,...n})=>(0,Z.jsx)($c,{className:R(Qc.buttonDefault,e),type:`button`,...n,children:t}),Il=({className:e,children:t,...n})=>(0,Z.jsx)($c,{className:R(Qc.buttonPrimary,e),...n,children:t}),Ll={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`},Rl=({visible:e,onEmailExport:t,onClose:n})=>{let r=ta(),[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,Z.jsxs)(`div`,{className:R(Ll.container,Dl.bottomSheet,{[Dl.bottomSheetOpen]:i===!0,[Dl.bottomSheetClose]:i===!1}),children:[(0,Z.jsx)(`h2`,{children:r(`export-transcript.email.title`)}),(0,Z.jsx)(Ec,{className:Ll.description,children:r(`export-transcript.email.description`)||``}),(0,Z.jsxs)(`form`,{onSubmit:d,className:Ll.formContainer,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`input`,{disabled:o,ref:u,type:`email`,placeholder:r(`export-transcript.email.placeholder`),className:Ll.emailInput,onChange:f}),c?.length===0?(0,Z.jsx)(`div`,{className:Ll.validationError,children:r(`export-transcript.email.invalid`)}):null]}),(0,Z.jsxs)(`div`,{className:Ll.actions,children:[(0,Z.jsx)(Fl,{onClick:n,children:r(`export-transcript.email.cancel`)}),(0,Z.jsx)(Il,{type:`submit`,disabled:o||c===void 0||c.length===0,children:r(`export-transcript.email.send`)})]})]}),o&&(0,Z.jsx)(`div`,{className:Ll.submitted,children:r(`export-transcript.email.success`)})]})},zl={inputContainer:`_inputContainer_fi5ao_1`},Bl={blockUserInput:`_blockUserInput_pot9c_1`,"append-animate":`_append-animate_pot9c_1`},Vl=({visible:e})=>{let t=ta();return e?(0,Z.jsx)(`div`,{className:R(Bl.blockUserInput,`chat__blockUserInput`),children:t(`block-user-input.title`)}):null},Hl={commandsDropdown:`_commandsDropdown_fmklx_1`,commands:`_commands_fmklx_1`,command:`_command_fmklx_1`,commandActive:`_commandActive_fmklx_49`},Ul=(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])},Wl=({text:e,commands:t,onSelectCommand:n,onVisibilityChange:r})=>{let i=(0,x.useRef)(null),a=ta(),[o,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(Gl(t)),[u,d]=(0,x.useState)(0),f=e=>n(`/${e}`);return Fc(i,()=>s([])),Ul(o,u,f,d,s),(0,x.useEffect)(()=>{l(Gl(t))},[t]),(0,x.useEffect)(()=>{let n=e.length||0;n===0||n>c||!e.startsWith(`/`)?s([]):s(t.filter(Kl(e))),d(0)},[t,e,c]),(0,x.useEffect)(()=>{r(!!o.length)},[o,r]),o.length?(0,Z.jsx)(`div`,{ref:i,className:Hl.commandsDropdown,children:(0,Z.jsx)(`ul`,{id:`command-list`,className:Hl.commands,role:`listbox`,children:o.map((e,t)=>(0,Z.jsxs)(`li`,{className:R([Hl.command,u===t&&Hl.commandActive]),role:`option`,onClick:()=>f(e),onMouseOver:()=>d(t),children:[(0,Z.jsxs)(`h1`,{children:[`/`,e]}),(0,Z.jsx)(`p`,{children:a(`commands.${e}`)})]},e))})}):null},Gl=e=>Math.max(...e.map(e=>e.length+1)),Kl=e=>t=>{let n=`/${t}`;return n.startsWith(e)&&n.length>=e.length},ql={callToActionContainer:`_callToActionContainer_d8izj_1`,"append-animate":`_append-animate_d8izj_1`,callToActionTitle:`_callToActionTitle_d8izj_23`,rateOverlay:`_rateOverlay_d8izj_30`,body:`_body_d8izj_52`,footer:`_footer_d8izj_60`,actions:`_actions_d8izj_75`,bubbles:`_bubbles_d8izj_89`,rateFeedbackBotBubble:`_rateFeedbackBotBubble_d8izj_118`,rateFeedbackGuestBubble:`_rateFeedbackGuestBubble_d8izj_124`,avatar:`_avatar_d8izj_130`,fadeInLeft:`_fadeInLeft_d8izj_1`,bubble:`_bubble_d8izj_89`,appear:`_appear_d8izj_1`,botBubble:`_botBubble_d8izj_156`,guestBubble:`_guestBubble_d8izj_167`,rateText:`_rateText_d8izj_186`,stars:`_stars_d8izj_191`,starsSmall:`_starsSmall_d8izj_205`,starsLarge:`_starsLarge_d8izj_211`,star:`_star_d8izj_191`,starReadonly:`_starReadonly_d8izj_225`,starIcon:`_starIcon_d8izj_235`,starsDescriptionContainer:`_starsDescriptionContainer_d8izj_253`,starsDescription:`_starsDescription_d8izj_253`},Jl=({value:e,index:t,count:n,readonly:r,onHover:i,onClick:a})=>{let o=e=>{a&&e.key===`Enter`&&a()};return(0,Z.jsx)(`li`,{className:R(ql.star,{[ql.starReadonly]:r},`chat__conversationRating__star`),children:(0,Z.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,Z.jsx)(`span`,{role:`img`,"aria-label":`Star`,className:R(ql.starIcon),children:(0,Z.jsx)(`svg`,{viewBox:`64 64 896 896`,focusable:`false`,"data-icon":`star`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,children:(0,Z.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`})})})})})},Yl=5,Xl=({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,Z.jsx)(`ul`,{tabIndex:0,role:`radiogroup`,className:R(ql.stars,{[ql.starsSmall]:t===`small`,[ql.starsLarge]:t===`large`},`chat__conversationRating__stars`,{chat__conversationRating__stars__small:t===`small`,chat__conversationRating__stars__large:t===`large`}),onMouseOut:o,children:Array(Yl).fill(0).map((t,r)=>(0,Z.jsx)(Jl,{value:i===void 0?e:i,index:r,count:Yl,readonly:n,onHover:s(r),onClick:c(r)},r))})},Zl=({visible:e,onRate:t})=>{let n=ta();return e?(0,Z.jsxs)(`div`,{className:R(ql.callToActionContainer,`chat__conversationRating__callToAction`),children:[(0,Z.jsx)(`div`,{className:R(ql.callToActionTitle,`chat__conversationRating__callToAction__title`),children:n(`conversation-rating.call-to-action.title`)}),(0,Z.jsx)(Xl,{value:0,size:`small`,onChange:t})]}):null},Ql=({isFirstMessageBySender:e,isLastMessageBySender:t,children:n})=>(0,Z.jsxs)(`div`,{className:R(Q.message,Q.messageBot,e&&Q.messageBotFirst,t&&Q.messageBotLast,`chat__bubbleContainer`,`chat__botBubbleContainer`,e&&`chat__bubbleContainer--first`,t&&`chat__bubbleContainer--last`),children:[(0,Z.jsx)(`img`,{className:R(Q.avatar,Q.botAvatar),src:`bot.svg`,alt:`Bot`}),(0,Z.jsx)(`div`,{className:R(Q.bubble,Q.bubbleLeft,`chat__bubble`,`chat__botBubble`),children:(0,Z.jsx)(`div`,{className:R(Q.leftText,Q.bubbleContent),children:n})})]}),$l=({children:e})=>(0,Z.jsx)(`div`,{className:R(Q.message,Q.messageGuest,Q.messageGuestFirst,Q.messageGuestLast,`chat__bubbleContainer`,`chat__guestBubbleContainer`,`chat__bubbleContainer--first`,`chat__bubbleContainer--last`),children:(0,Z.jsx)(`div`,{className:R(Q.bubble,Q.bubbleRight,`chat__bubble`,`chat__guestBubble`),children:(0,Z.jsx)(`div`,{className:R(Q.rightText,Q.bubbleContent),children:e})})}),eu=()=>{let e=ta(),t=$i(),n=ea(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(Ft(r,n)),u({submitted:!0,feedback:n})},h=()=>{n.opener===`CLOSE_CHAT`?t(Di()):n.opener===`RESTART_CHAT`?t(Zi()):t(ji())};return(0,Z.jsx)(`div`,{className:R(ql.rateOverlay,Dl.bottomSheet,`chat__conversationRating__overlay`,{[Dl.bottomSheetOpen]:s===!0,[Dl.bottomSheetClose]:s===!1}),children:(0,Z.jsxs)(`form`,{onSubmit:m,children:[(0,Z.jsxs)(`div`,{className:R(ql.body,`chat__conversationRating__overlay__body`),children:[(0,Z.jsx)(`div`,{}),(0,Z.jsx)(`div`,{className:R(ql.bubbles),children:n.opener&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ql,{isFirstMessageBySender:!0,isLastMessageBySender:!a,children:[(0,Z.jsx)(`h2`,{children:e(`conversation-rating.overlay.title`)}),(0,Z.jsxs)(`div`,{className:R(ql.starsDescriptionContainer),children:[(0,Z.jsx)(Xl,{value:r,size:`large`,readonly:l.submitted,onChange:i}),(0,Z.jsxs)(`div`,{className:R(ql.starsDescription),children:[(0,Z.jsx)(`div`,{children:e(`conversation-rating.overlay.star.very-bad`)}),(0,Z.jsx)(`div`,{children:e(`conversation-rating.overlay.star.very-good`)})]})]})]}),a&&(0,Z.jsx)(Ql,{isFirstMessageBySender:!1,isLastMessageBySender:!f||!!l.feedback.length,children:(0,Z.jsx)(`div`,{children:a})}),!!l.feedback.length&&(0,Z.jsx)($l,{children:l.feedback}),f&&(0,Z.jsx)(Ql,{isFirstMessageBySender:!!l.feedback.length,isLastMessageBySender:!0,children:(0,Z.jsx)(`div`,{children:e(`conversation-rating.overlay.bot-message.submit-feedback`)})})]})})]}),(0,Z.jsxs)(`div`,{className:R(ql.footer,`chat__conversationRating__overlay__footer`),children:[!l.submitted&&(0,Z.jsx)(`input`,{ref:d,defaultValue:n.rating?.feedback||``,placeholder:e(`conversation-rating.overlay.guest-feedback.input-placeholder`)}),(0,Z.jsxs)(`div`,{className:R(ql.actions,`chat__conversationRating__overlay__footer__actions`),children:[l.submitted?(0,Z.jsx)(Il,{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,Z.jsx)(Il,{type:`submit`,disabled:!r,children:e(`conversation-rating.overlay.action.submit`)},`submit-button`),n.opener!==`CHAT`&&!l.submitted&&(0,Z.jsx)(Fl,{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`)})]})]})]})})},tu=(0,x.memo)(({numberOfMessagesFromGuest:e})=>{let t=$i(),n=ea(e=>e.chat.conversationRating),r=e=>{t(Ai(`CHAT`,e))},i=!n.rating?.value&&e>=1;return n.enabled?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zl,{visible:i,onRate:r}),(0,Z.jsx)(eu,{})]}):null}),nu={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`},ru={audioRecorder:`_audioRecorder_g845f_1`,audioButton:`_audioButton_g845f_6`,recorderIcon:`_recorderIcon_g845f_37`,pulse:`_pulse_g845f_1`,spinning:`_spinning_g845f_60`,spin:`_spin_g845f_60`},iu=2048,au=16e3,ou=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(iu,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+=iu}}handleClickSubmitAudio(){let e=su(uu(lu(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,Z.jsxs)(`div`,{className:ru.audioRecorder,children:[this.state.recordingState===`none`&&(0,Z.jsx)(`button`,{className:R(ru.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,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.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,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]})}),this.state.recordingState===`connecting`&&(0,Z.jsxs)(`svg`,{className:ru.spinning,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.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,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]}),this.state.recordingState===`recording`&&(0,Z.jsxs)(`div`,{className:ru.audioRecorder,children:[(0,Z.jsx)(`button`,{className:R(ru.audioButton),onClick:this.handleClickStopAudio,"aria-label":this.props.translate(`message-input.actions.stop-audio-recording.label`),tabIndex:0,children:(0,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.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,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]})}),(0,Z.jsx)(`div`,{className:ru.recorderIcon}),(0,Z.jsx)(`button`,{className:R(ru.audioButton),type:`submit`,onClick:this.handleClickSubmitAudio,"aria-label":this.props.translate(`message-input.actions.submit-audio-recording.label`),tabIndex:0,autoFocus:!0,children:(0,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,Z.jsx)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`})]})})]})]})}},su=e=>{let t=new ArrayBuffer(44+e.length*2),n=new DataView(t);cu(n,0,`RIFF`),n.setUint32(4,44+e.length*2,!0),cu(n,8,`WAVE`),cu(n,12,`fmt `),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,au,!0),n.setUint32(28,au*4,!0),n.setUint16(32,4,!0),n.setUint16(34,16,!0),cu(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`})},cu=(e,t,n)=>{for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))},lu=(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},uu=(e,t)=>{if(au===t)return e;let n=t/au,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},du=({onClick:e})=>{let t=ta();return(0,Z.jsxs)(`button`,{onClick:e,type:`button`,"aria-label":t(`message-input.actions.command.label`),children:[(0,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`32`,height:`32`,fill:`#000000`,viewBox:`0 0 256 256`,children:[(0,Z.jsx)(`rect`,{x:`32`,y:`32`,width:`192`,height:`192`,rx:`16`,ry:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`16`}),(0,Z.jsx)(`line`,{x1:`80`,y1:`176`,x2:`176`,y2:`80`,stroke:`currentColor`,"stroke-width":`16`,"stroke-linecap":`round`})]}),(0,Z.jsx)(`span`,{children:t(`message-input.actions.command.label`)})]})},fu=()=>window.matchMedia(`(min-width: 768px)`).matches,pu=({disabled:e,textInput:t,commandsVisible:n,hasCommands:r,onTextInput:i,onTextInputSubmit:a,onAudioRecorded:o})=>{let s=ta(),c=(0,x.useRef)(null),l=(0,x.useRef)(0),{enableSpeechSupport:u}=ea(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),fu()&&e.focus())},[t]);let f=()=>{let e=c.current;e&&t.trim().length>=1&&a(t.trim())&&(e.value=``,e.style.height=``,fu()&&e.focus())};return(0,Z.jsxs)(`form`,{className:R(nu.inputWrapper,n&&nu.withOpenCommands,`chat__textInput`),onSubmit:e=>{e.preventDefault(),f()},children:[(0,Z.jsxs)(`div`,{className:nu.messageInputWrapper,children:[(0,Z.jsx)(`textarea`,{id:`user_input`,ref:c,className:nu.messageInput,tabIndex:0,placeholder:s(`message-input-placeholder`),value:t,onChange:e=>{let t=e.target.value;i(t),d(e.target)},onKeyDown:e=>{e.code===`Enter`&&!e.shiftKey?(e.repeat||f(),e.preventDefault()):n&&(e.code===`ArrowUp`||e.code===`ArrowDown`)&&e.preventDefault()},"aria-label":s(`message-input-label`),"aria-controls":r?`command-list`:void 0,"aria-haspopup":r?`listbox`:void 0}),r&&(0,Z.jsx)(`div`,{className:nu.actions,children:(0,Z.jsx)(du,{onClick:()=>{t.startsWith(`/`)?i(``):i(`/`)}})})]}),(0,Z.jsx)(`div`,{className:R(nu.buttons,`chat__buttons`),children:t.length||!u||navigator.mediaDevices===void 0?(0,Z.jsx)(`button`,{className:R(nu.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,Z.jsx)(`svg`,{viewBox:`64 64 896 896`,focusable:`false`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,children:(0,Z.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,Z.jsx)(ou,{translate:s,onAudioRecorded:o})})]})},mu={quickReplies:`_quickReplies_83npe_1`,quickReply:`_quickReply_83npe_9`},hu=({quickReplies:e,onQuickReplyClick:t})=>e.length?(0,Z.jsx)(`div`,{className:R(mu.quickReplies,`chat__quickReplies`),children:e.map(e=>(0,Z.jsx)($c,{tabIndex:0,className:R(mu.quickReply,`chat__button`,`chat__quickReply`),onClick:()=>t(e),children:e.label},e.label))}):null,gu=5e3,_u=1e3,vu=({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>gu?u(!1):setTimeout(()=>{u(!1)},gu-e)}},[l,e]),(0,x.useEffect)(()=>{l&&(p.current=Date.now())},[l]),(0,Z.jsxs)(`div`,{className:R(zl.inputContainer),children:[(0,Z.jsx)(hu,{quickReplies:t,onQuickReplyClick:a}),(0,Z.jsx)(Vl,{visible:l}),!l&&(0,Z.jsx)(tu,{numberOfMessagesFromGuest:n}),!!r?.length&&(0,Z.jsx)(Wl,{text:s,commands:r,onSelectCommand:e=>{c(e+` `)},onVisibilityChange:f}),(0,Z.jsx)(pu,{textInput:s,disabled:l,commandsVisible:d,hasCommands:!!r?.length,onTextInput:c,onTextInputSubmit:t=>{let n=Date.now()-m.current<_u;return d?!1:e||n?(u(!0),!1):(i(t),c(``),m.current=Date.now(),!0)},onAudioRecorded:o})]})},yu=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(Zi()),onMessageFromUser:t=>e(gt(t)),onAudioRecorded:t=>e(At(t)),onActionFromUser:t=>e(t),onQuickReplyClick:t=>e(ht(t)),onNluEvent:t=>e(It(t)),onButtonClick:t=>e(Rt(t)),onLinkClick:t=>e(zt(t)),onTranscriptExport:t=>e(Mt(t)),onTranscriptItemReaction:(t,n)=>{e(mt.transcriptItemGuestReaction(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=$i(),p=ea(e=>e.connection.connectionState),{enableTranscriptExportEmail:m,commands:h}=ea(e=>e.settings),{showTranscriptMailOverlay:g,conversationRating:_}=ea(e=>e.chat),v=t.filter(e=>e.sender.type===ra.GUEST).length;return(0,x.useEffect)(()=>{p===na.CONNECTED&&f(Xi(e))},[e,p,f]),(0,Z.jsxs)(`div`,{className:ia.container,children:[(0,Z.jsx)(Pl,{messages:t,isBotTyping:r}),(0,Z.jsxs)(`div`,{className:R([ia.chatcontent,(g||_?.opener)&&ia.accessabilityHidden]),children:[(0,Z.jsx)(wl,{messages:t,isBotTyping:r,commands:h,onButtonClick:s,onLinkClick:c,onTranscriptItemReaction:d}),(0,Z.jsx)(vu,{isBotTyping:r,quickReplies:r?[]:n,numberOfMessagesFromGuest:v,commands:h,onQuickReplyClick:o,onTextInput:a,onAudioRecorded:l}),(0,Z.jsx)(Ml,{})]}),m&&(0,Z.jsx)(Rl,{visible:!!g,onEmailExport:u,onClose:()=>{f(ki())}}),(0,Z.jsx)(kl,{contentUrl:i})]})}),bu=()=>(0,x.useMemo)(()=>{try{return window.self!==window.top}catch{return!0}},[]),xu=e=>t=>{let n=t.key;(n===`ArrowDown`||n===`ArrowRight`||n===`Enter`||n===` `||n===`Space`)&&(t.stopPropagation(),e())},Su=({onClick:e})=>{let t=ta();return bu()?(0,Z.jsx)(`button`,{className:`tooltip--bottom-left`,"aria-label":t(`header.close-chat`),"data-title":t(`header.close-chat`),tabIndex:0,onClick:e,onKeyDown:xu(e),children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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},Cu={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`},wu=({icon:e})=>{switch(e){case`arrow-counter-clockwise`:return(0,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.jsx)(`div`,{})}},Tu=(0,x.forwardRef)(({selected:e,item:t,onClick:n},r)=>{let i=ta();return(0,Z.jsx)(`li`,{"aria-selected":e,role:`option`,className:t.withDivider?Cu.divider:void 0,children:(0,Z.jsxs)(`a`,{ref:r,type:`button`,role:`button`,tabIndex:-1,onClick:e=>{e.preventDefault(),n()},children:[(0,Z.jsx)(wu,{icon:t.icon}),(0,Z.jsx)(`span`,{children:i(`header.menu.${t.id}`)})]})})}),Eu=(e,t)=>{let n=bu(),{menuItems:r,enableStandaloneView:i,enableTranscriptExportPdf:a,enableTranscriptExportEmail:o}=ea(e=>e.settings),s=ea(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])},Du=({chatStarted:e,hasGuestMessages:t})=>{let n=$i(),r=ta(),{enabled:i,opener:a}=ea(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=Eu(e,t);(0,x.useEffect)(()=>{f.current[c]?.focus()},[c]);let m=(0,x.useCallback)(()=>{n(t&&i&&!a?Ai(`RESTART_CHAT`):Zi()),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(Nt());break;case`send-transcript`:n(ki());break;case`rate-conversation`:n(Ai(`MENU`));break;case`link`:n(zt(e.url));break;case`action`:n(JSON.parse(JSON.stringify(e.action)));break;default:break}s(!1)},[n,m,s]);return(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]),Fc(d,()=>s(!1)),p.length?(0,Z.jsxs)(`div`,{className:R(Cu.menuContainer),ref:d,children:[(0,Z.jsx)(`button`,{ref:u,className:R(o&&Cu.active,o?`tooltip-hidden`:`tooltip--bottom-left`),"aria-label":r(`header.menu.title`),"data-title":r(`header.menu.title`),onClick:()=>{s(e=>!e)},onBlur:()=>{setTimeout(()=>{let e=document.activeElement;d.current&&!d.current.contains(e)&&s(!1)},0)},children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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,Z.jsx)(`nav`,{className:Cu.menu,"aria-label":r(`header.menu.title`),children:(0,Z.jsx)(`ul`,{tabIndex:0,children:p.map((e,t)=>(0,Z.jsx)(Tu,{ref:e=>{f.current[t]=e},selected:c===t,item:e,onClick:()=>h(e)},e.id))})})]}):null},Ou=({className:e,chatStarted:t,...n})=>{let r=$i(),i=ea(e=>e.chat.conversationRating),a=ea(e=>e.chat.messages.some(e=>e.sender.type===ot.GUEST)),o=()=>{i.enabled&&!i.opener&&a?r(Ai(`CLOSE_CHAT`)):r(Di())};return(0,Z.jsxs)(`div`,{className:R(Cu.header,e),...n,children:[(0,Z.jsx)(`div`,{className:Cu.logoContainer,children:(0,Z.jsx)(`div`,{className:Cu.logo})}),(0,Z.jsxs)(`div`,{className:Cu.actions,children:[(0,Z.jsx)(Du,{chatStarted:t,hasGuestMessages:a}),(0,Z.jsx)(Su,{onClick:o})]})]})},ku={chatwindow:`_chatwindow_rkbir_1`,chatwindowWithAside:`_chatwindowWithAside_rkbir_21`},Au=()=>{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},ju={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`},Mu=({onClick:e})=>{let t=ta();return(0,Z.jsx)(`button`,{className:R(ju.closeSourceInfosButton,`tooltip--bottom-left`),"aria-label":t(`source-infos.close`),"data-title":t(`source-infos.close`),tabIndex:0,onClick:e,children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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`})})})},Nu=(0,x.forwardRef)(({sourceInfos:e,onClose:t,...n},r)=>(0,Z.jsxs)(`div`,{className:ju.sourceHeader,...n,ref:r,children:[(0,Z.jsx)(`div`,{children:e?(0,Z.jsx)(`p`,{id:`source-info-title`,children:e.title}):(0,Z.jsx)(`p`,{children:`\xA0`})}),(0,Z.jsx)(Mu,{onClick:t})]})),Pu=({loading:e})=>(0,Z.jsx)(`div`,{className:ju.highlightLoader,children:e&&(0,Z.jsx)(`div`,{className:ju.highlightLoaderLoading})});function Fu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Iu(e){if(Array.isArray(e))return e}function Lu(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Ru(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
61
|
+
`).trim()},Pl=({messages:e,isBotTyping:t})=>{let n=(0,x.useRef)(``),r=ta(),i=r(`bot-bubble.footnote`),a=e=>{switch(e.type){case`TEXT`:return e.text||``;case`MARKDOWN`:return Nl(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===ra.BOT);return n?a(n):``})();return(0,x.useEffect)(()=>{o!==n.current&&(n.current=o)},[o]),(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:o})},Fl=({className:e,children:t,...n})=>(0,Z.jsx)($c,{className:R(Qc.buttonDefault,e),type:`button`,...n,children:t}),Il=({className:e,children:t,...n})=>(0,Z.jsx)($c,{className:R(Qc.buttonPrimary,e),...n,children:t}),Ll={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`},Rl=({visible:e,onEmailExport:t,onClose:n})=>{let r=ta(),[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,Z.jsxs)(`div`,{className:R(Ll.container,Dl.bottomSheet,{[Dl.bottomSheetOpen]:i===!0,[Dl.bottomSheetClose]:i===!1}),children:[(0,Z.jsx)(`h2`,{children:r(`export-transcript.email.title`)}),(0,Z.jsx)(Ec,{className:Ll.description,children:r(`export-transcript.email.description`)||``}),(0,Z.jsxs)(`form`,{onSubmit:d,className:Ll.formContainer,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`input`,{disabled:o,ref:u,type:`email`,placeholder:r(`export-transcript.email.placeholder`),className:Ll.emailInput,onChange:f}),c?.length===0?(0,Z.jsx)(`div`,{className:Ll.validationError,children:r(`export-transcript.email.invalid`)}):null]}),(0,Z.jsxs)(`div`,{className:Ll.actions,children:[(0,Z.jsx)(Fl,{onClick:n,children:r(`export-transcript.email.cancel`)}),(0,Z.jsx)(Il,{type:`submit`,disabled:o||c===void 0||c.length===0,children:r(`export-transcript.email.send`)})]})]}),o&&(0,Z.jsx)(`div`,{className:Ll.submitted,children:r(`export-transcript.email.success`)})]})},zl={inputContainer:`_inputContainer_fi5ao_1`},Bl={blockUserInput:`_blockUserInput_pot9c_1`,"append-animate":`_append-animate_pot9c_1`},Vl=({visible:e})=>{let t=ta();return e?(0,Z.jsx)(`div`,{className:R(Bl.blockUserInput,`chat__blockUserInput`),children:t(`block-user-input.title`)}):null},Hl={commandsDropdown:`_commandsDropdown_fmklx_1`,commands:`_commands_fmklx_1`,command:`_command_fmklx_1`,commandActive:`_commandActive_fmklx_49`},Ul=(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])},Wl=({text:e,commands:t,onSelectCommand:n,onVisibilityChange:r})=>{let i=(0,x.useRef)(null),a=ta(),[o,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(Gl(t)),[u,d]=(0,x.useState)(0),f=e=>n(`/${e}`);return Fc(i,()=>s([])),Ul(o,u,f,d,s),(0,x.useEffect)(()=>{l(Gl(t))},[t]),(0,x.useEffect)(()=>{let n=e.length||0;n===0||n>c||!e.startsWith(`/`)?s([]):s(t.filter(Kl(e))),d(0)},[t,e,c]),(0,x.useEffect)(()=>{r(!!o.length)},[o,r]),o.length?(0,Z.jsx)(`div`,{ref:i,className:Hl.commandsDropdown,children:(0,Z.jsx)(`ul`,{id:`command-list`,className:Hl.commands,role:`listbox`,children:o.map((e,t)=>(0,Z.jsxs)(`li`,{className:R([Hl.command,u===t&&Hl.commandActive]),role:`option`,onClick:()=>f(e),onMouseOver:()=>d(t),children:[(0,Z.jsxs)(`h1`,{children:[`/`,e]}),(0,Z.jsx)(`p`,{children:a(`commands.${e}`)})]},e))})}):null},Gl=e=>Math.max(...e.map(e=>e.length+1)),Kl=e=>t=>{let n=`/${t}`;return n.startsWith(e)&&n.length>=e.length},ql={callToActionContainer:`_callToActionContainer_d8izj_1`,"append-animate":`_append-animate_d8izj_1`,callToActionTitle:`_callToActionTitle_d8izj_23`,rateOverlay:`_rateOverlay_d8izj_30`,body:`_body_d8izj_52`,footer:`_footer_d8izj_60`,actions:`_actions_d8izj_75`,bubbles:`_bubbles_d8izj_89`,rateFeedbackBotBubble:`_rateFeedbackBotBubble_d8izj_118`,rateFeedbackGuestBubble:`_rateFeedbackGuestBubble_d8izj_124`,avatar:`_avatar_d8izj_130`,fadeInLeft:`_fadeInLeft_d8izj_1`,bubble:`_bubble_d8izj_89`,appear:`_appear_d8izj_1`,botBubble:`_botBubble_d8izj_156`,guestBubble:`_guestBubble_d8izj_167`,rateText:`_rateText_d8izj_186`,stars:`_stars_d8izj_191`,starsSmall:`_starsSmall_d8izj_205`,starsLarge:`_starsLarge_d8izj_211`,star:`_star_d8izj_191`,starReadonly:`_starReadonly_d8izj_225`,starIcon:`_starIcon_d8izj_235`,starsDescriptionContainer:`_starsDescriptionContainer_d8izj_253`,starsDescription:`_starsDescription_d8izj_253`},Jl=({value:e,index:t,count:n,readonly:r,onHover:i,onClick:a})=>{let o=e=>{a&&e.key===`Enter`&&a()};return(0,Z.jsx)(`li`,{className:R(ql.star,{[ql.starReadonly]:r},`chat__conversationRating__star`),children:(0,Z.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,Z.jsx)(`span`,{role:`img`,"aria-label":`Star`,className:R(ql.starIcon),children:(0,Z.jsx)(`svg`,{viewBox:`64 64 896 896`,focusable:`false`,"data-icon":`star`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,children:(0,Z.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`})})})})})},Yl=5,Xl=({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,Z.jsx)(`ul`,{tabIndex:0,role:`radiogroup`,className:R(ql.stars,{[ql.starsSmall]:t===`small`,[ql.starsLarge]:t===`large`},`chat__conversationRating__stars`,{chat__conversationRating__stars__small:t===`small`,chat__conversationRating__stars__large:t===`large`}),onMouseOut:o,children:Array(Yl).fill(0).map((t,r)=>(0,Z.jsx)(Jl,{value:i===void 0?e:i,index:r,count:Yl,readonly:n,onHover:s(r),onClick:c(r)},r))})},Zl=({visible:e,onRate:t})=>{let n=ta();return e?(0,Z.jsxs)(`div`,{className:R(ql.callToActionContainer,`chat__conversationRating__callToAction`),children:[(0,Z.jsx)(`div`,{className:R(ql.callToActionTitle,`chat__conversationRating__callToAction__title`),children:n(`conversation-rating.call-to-action.title`)}),(0,Z.jsx)(Xl,{value:0,size:`small`,onChange:t})]}):null},Ql=({isFirstMessageBySender:e,isLastMessageBySender:t,children:n})=>(0,Z.jsxs)(`div`,{className:R(Q.message,Q.messageBot,e&&Q.messageBotFirst,t&&Q.messageBotLast,`chat__bubbleContainer`,`chat__botBubbleContainer`,e&&`chat__bubbleContainer--first`,t&&`chat__bubbleContainer--last`),children:[(0,Z.jsx)(`img`,{className:R(Q.avatar,Q.botAvatar),src:`bot.svg`,alt:`Bot`}),(0,Z.jsx)(`div`,{className:R(Q.bubble,Q.bubbleLeft,`chat__bubble`,`chat__botBubble`),children:(0,Z.jsx)(`div`,{className:R(Q.leftText,Q.bubbleContent),children:n})})]}),$l=({children:e})=>(0,Z.jsx)(`div`,{className:R(Q.message,Q.messageGuest,Q.messageGuestFirst,Q.messageGuestLast,`chat__bubbleContainer`,`chat__guestBubbleContainer`,`chat__bubbleContainer--first`,`chat__bubbleContainer--last`),children:(0,Z.jsx)(`div`,{className:R(Q.bubble,Q.bubbleRight,`chat__bubble`,`chat__guestBubble`),children:(0,Z.jsx)(`div`,{className:R(Q.rightText,Q.bubbleContent),children:e})})}),eu=()=>{let e=ta(),t=$i(),n=ea(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(Ft(r,n)),u({submitted:!0,feedback:n})},h=()=>{n.opener===`CLOSE_CHAT`?t(Di()):n.opener===`RESTART_CHAT`?t(Zi()):t(ji())};return(0,Z.jsx)(`div`,{className:R(ql.rateOverlay,Dl.bottomSheet,`chat__conversationRating__overlay`,{[Dl.bottomSheetOpen]:s===!0,[Dl.bottomSheetClose]:s===!1}),children:(0,Z.jsxs)(`form`,{onSubmit:m,children:[(0,Z.jsxs)(`div`,{className:R(ql.body,`chat__conversationRating__overlay__body`),children:[(0,Z.jsx)(`div`,{}),(0,Z.jsx)(`div`,{className:R(ql.bubbles),children:n.opener&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ql,{isFirstMessageBySender:!0,isLastMessageBySender:!a,children:[(0,Z.jsx)(`h2`,{children:e(`conversation-rating.overlay.title`)}),(0,Z.jsxs)(`div`,{className:R(ql.starsDescriptionContainer),children:[(0,Z.jsx)(Xl,{value:r,size:`large`,readonly:l.submitted,onChange:i}),(0,Z.jsxs)(`div`,{className:R(ql.starsDescription),children:[(0,Z.jsx)(`div`,{children:e(`conversation-rating.overlay.star.very-bad`)}),(0,Z.jsx)(`div`,{children:e(`conversation-rating.overlay.star.very-good`)})]})]})]}),a&&(0,Z.jsx)(Ql,{isFirstMessageBySender:!1,isLastMessageBySender:!f||!!l.feedback.length,children:(0,Z.jsx)(`div`,{children:a})}),!!l.feedback.length&&(0,Z.jsx)($l,{children:l.feedback}),f&&(0,Z.jsx)(Ql,{isFirstMessageBySender:!!l.feedback.length,isLastMessageBySender:!0,children:(0,Z.jsx)(`div`,{children:e(`conversation-rating.overlay.bot-message.submit-feedback`)})})]})})]}),(0,Z.jsxs)(`div`,{className:R(ql.footer,`chat__conversationRating__overlay__footer`),children:[!l.submitted&&(0,Z.jsx)(`input`,{ref:d,defaultValue:n.rating?.feedback||``,placeholder:e(`conversation-rating.overlay.guest-feedback.input-placeholder`)}),(0,Z.jsxs)(`div`,{className:R(ql.actions,`chat__conversationRating__overlay__footer__actions`),children:[l.submitted?(0,Z.jsx)(Il,{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,Z.jsx)(Il,{type:`submit`,disabled:!r,children:e(`conversation-rating.overlay.action.submit`)},`submit-button`),n.opener!==`CHAT`&&!l.submitted&&(0,Z.jsx)(Fl,{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`)})]})]})]})})},tu=(0,x.memo)(({numberOfMessagesFromGuest:e})=>{let t=$i(),n=ea(e=>e.chat.conversationRating),r=e=>{t(Ai(`CHAT`,e))},i=!n.rating?.value&&e>=1;return n.enabled?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zl,{visible:i,onRate:r}),(0,Z.jsx)(eu,{})]}):null}),nu={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`},ru={audioRecorder:`_audioRecorder_g845f_1`,audioButton:`_audioButton_g845f_6`,recorderIcon:`_recorderIcon_g845f_37`,pulse:`_pulse_g845f_1`,spinning:`_spinning_g845f_60`,spin:`_spin_g845f_60`},iu=2048,au=16e3,ou=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(iu,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+=iu}}handleClickSubmitAudio(){let e=su(uu(lu(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,Z.jsxs)(`div`,{className:ru.audioRecorder,children:[this.state.recordingState===`none`&&(0,Z.jsx)(`button`,{className:R(ru.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,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.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,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]})}),this.state.recordingState===`connecting`&&(0,Z.jsxs)(`svg`,{className:ru.spinning,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.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,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]}),this.state.recordingState===`recording`&&(0,Z.jsxs)(`div`,{className:ru.audioRecorder,children:[(0,Z.jsx)(`button`,{className:R(ru.audioButton),onClick:this.handleClickStopAudio,"aria-label":this.props.translate(`message-input.actions.stop-audio-recording.label`),tabIndex:0,children:(0,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.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,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`})]})}),(0,Z.jsx)(`div`,{className:ru.recorderIcon}),(0,Z.jsx)(`button`,{className:R(ru.audioButton),type:`submit`,onClick:this.handleClickSubmitAudio,"aria-label":this.props.translate(`message-input.actions.submit-audio-recording.label`),tabIndex:0,autoFocus:!0,children:(0,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,children:[(0,Z.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,Z.jsx)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`})]})})]})]})}},su=e=>{let t=new ArrayBuffer(44+e.length*2),n=new DataView(t);cu(n,0,`RIFF`),n.setUint32(4,44+e.length*2,!0),cu(n,8,`WAVE`),cu(n,12,`fmt `),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,au,!0),n.setUint32(28,au*4,!0),n.setUint16(32,4,!0),n.setUint16(34,16,!0),cu(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`})},cu=(e,t,n)=>{for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))},lu=(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},uu=(e,t)=>{if(au===t)return e;let n=t/au,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},du=({onClick:e})=>{let t=ta();return(0,Z.jsxs)(`button`,{onClick:e,type:`button`,"aria-label":t(`message-input.actions.command.label`),children:[(0,Z.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`32`,height:`32`,fill:`#000000`,viewBox:`0 0 256 256`,children:[(0,Z.jsx)(`rect`,{x:`32`,y:`32`,width:`192`,height:`192`,rx:`16`,ry:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`16`}),(0,Z.jsx)(`line`,{x1:`80`,y1:`176`,x2:`176`,y2:`80`,stroke:`currentColor`,"stroke-width":`16`,"stroke-linecap":`round`})]}),(0,Z.jsx)(`span`,{children:t(`message-input.actions.command.label`)})]})},fu=({disabled:e,textInput:t,commandsVisible:n,hasCommands:r,onTextInput:i,onTextInputSubmit:a,onAudioRecorded:o})=>{let s=ta(),c=(0,x.useRef)(null),l=(0,x.useRef)(0),{enableSpeechSupport:u}=ea(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),pu()&&e.focus())},[t]);let f=()=>{let e=c.current;e&&t.trim().length>=1&&a(t.trim())&&(e.value=``,e.style.height=``,pu()&&e.focus())};return(0,Z.jsxs)(`form`,{className:R(nu.inputWrapper,n&&nu.withOpenCommands,`chat__textInput`),onSubmit:e=>{e.preventDefault(),f()},children:[(0,Z.jsxs)(`div`,{className:nu.messageInputWrapper,children:[(0,Z.jsx)(`textarea`,{id:`user_input`,ref:c,className:nu.messageInput,tabIndex:0,placeholder:s(`message-input-placeholder`),value:t,onChange:e=>{let t=e.target.value;i(t),d(e.target)},onKeyDown:e=>{e.code===`Enter`&&!e.shiftKey?(e.repeat||f(),e.preventDefault()):n&&(e.code===`ArrowUp`||e.code===`ArrowDown`)&&e.preventDefault()},"aria-label":s(`message-input-label`),"aria-controls":r?`command-list`:void 0,"aria-haspopup":r?`listbox`:void 0}),r&&(0,Z.jsx)(`div`,{className:nu.actions,children:(0,Z.jsx)(du,{onClick:()=>{t.startsWith(`/`)?i(``):i(`/`)}})})]}),(0,Z.jsx)(`div`,{className:R(nu.buttons,`chat__buttons`),children:t.length||!u||navigator.mediaDevices===void 0?(0,Z.jsx)(`button`,{className:R(nu.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,Z.jsx)(`svg`,{viewBox:`64 64 896 896`,focusable:`false`,width:`1em`,height:`1em`,fill:`currentColor`,"aria-hidden":`true`,children:(0,Z.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,Z.jsx)(ou,{translate:s,onAudioRecorded:o})})]})},pu=()=>{let e=new URLSearchParams(window.location.search).get(`deviceType`);return e===null?window.matchMedia(`(min-width: 768px)`).matches:e===`desktop`},mu={quickReplies:`_quickReplies_83npe_1`,quickReply:`_quickReply_83npe_9`},hu=({quickReplies:e,onQuickReplyClick:t})=>e.length?(0,Z.jsx)(`div`,{className:R(mu.quickReplies,`chat__quickReplies`),children:e.map(e=>(0,Z.jsx)($c,{tabIndex:0,className:R(mu.quickReply,`chat__button`,`chat__quickReply`),onClick:()=>t(e),children:e.label},e.label))}):null,gu=5e3,_u=1e3,vu=({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>gu?u(!1):setTimeout(()=>{u(!1)},gu-e)}},[l,e]),(0,x.useEffect)(()=>{l&&(p.current=Date.now())},[l]),(0,Z.jsxs)(`div`,{className:R(zl.inputContainer),children:[(0,Z.jsx)(hu,{quickReplies:t,onQuickReplyClick:a}),(0,Z.jsx)(Vl,{visible:l}),!l&&(0,Z.jsx)(tu,{numberOfMessagesFromGuest:n}),!!r?.length&&(0,Z.jsx)(Wl,{text:s,commands:r,onSelectCommand:e=>{c(e+` `)},onVisibilityChange:f}),(0,Z.jsx)(fu,{textInput:s,disabled:l,commandsVisible:d,hasCommands:!!r?.length,onTextInput:c,onTextInputSubmit:t=>{let n=Date.now()-m.current<_u;return d?!1:e||n?(u(!0),!1):(i(t),c(``),m.current=Date.now(),!0)},onAudioRecorded:o})]})},yu=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(Zi()),onMessageFromUser:t=>e(gt(t)),onAudioRecorded:t=>e(At(t)),onActionFromUser:t=>e(t),onQuickReplyClick:t=>e(ht(t)),onNluEvent:t=>e(It(t)),onButtonClick:t=>e(Rt(t)),onLinkClick:t=>e(zt(t)),onTranscriptExport:t=>e(Mt(t)),onTranscriptItemReaction:(t,n)=>{e(mt.transcriptItemGuestReaction(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=$i(),p=ea(e=>e.connection.connectionState),{enableTranscriptExportEmail:m,commands:h}=ea(e=>e.settings),{showTranscriptMailOverlay:g,conversationRating:_}=ea(e=>e.chat),v=t.filter(e=>e.sender.type===ra.GUEST).length;return(0,x.useEffect)(()=>{p===na.CONNECTED&&f(Xi(e))},[e,p,f]),(0,Z.jsxs)(`div`,{className:ia.container,children:[(0,Z.jsx)(Pl,{messages:t,isBotTyping:r}),(0,Z.jsxs)(`div`,{className:R([ia.chatcontent,(g||_?.opener)&&ia.accessabilityHidden]),children:[(0,Z.jsx)(wl,{messages:t,isBotTyping:r,commands:h,onButtonClick:s,onLinkClick:c,onTranscriptItemReaction:d}),(0,Z.jsx)(vu,{isBotTyping:r,quickReplies:r?[]:n,numberOfMessagesFromGuest:v,commands:h,onQuickReplyClick:o,onTextInput:a,onAudioRecorded:l}),(0,Z.jsx)(Ml,{})]}),m&&(0,Z.jsx)(Rl,{visible:!!g,onEmailExport:u,onClose:()=>{f(ki())}}),(0,Z.jsx)(kl,{contentUrl:i})]})}),bu=()=>(0,x.useMemo)(()=>{try{return window.self!==window.top}catch{return!0}},[]),xu=e=>t=>{let n=t.key;(n===`ArrowDown`||n===`ArrowRight`||n===`Enter`||n===` `||n===`Space`)&&(t.stopPropagation(),e())},Su=({onClick:e})=>{let t=ta();return bu()?(0,Z.jsx)(`button`,{className:`tooltip--bottom-left`,"aria-label":t(`header.close-chat`),"data-title":t(`header.close-chat`),tabIndex:0,onClick:e,onKeyDown:xu(e),children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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},Cu={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`},wu=({icon:e})=>{switch(e){case`arrow-counter-clockwise`:return(0,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.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,Z.jsx)(`div`,{})}},Tu=(0,x.forwardRef)(({selected:e,item:t,onClick:n},r)=>{let i=ta();return(0,Z.jsx)(`li`,{"aria-selected":e,role:`option`,className:t.withDivider?Cu.divider:void 0,children:(0,Z.jsxs)(`a`,{ref:r,type:`button`,role:`button`,tabIndex:-1,onClick:e=>{e.preventDefault(),n()},children:[(0,Z.jsx)(wu,{icon:t.icon}),(0,Z.jsx)(`span`,{children:i(`header.menu.${t.id}`)})]})})}),Eu=(e,t)=>{let n=bu(),{menuItems:r,enableStandaloneView:i,enableTranscriptExportPdf:a,enableTranscriptExportEmail:o}=ea(e=>e.settings),s=ea(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])},Du=({chatStarted:e,hasGuestMessages:t})=>{let n=$i(),r=ta(),{enabled:i,opener:a}=ea(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=Eu(e,t);(0,x.useEffect)(()=>{f.current[c]?.focus()},[c]);let m=(0,x.useCallback)(()=>{n(t&&i&&!a?Ai(`RESTART_CHAT`):Zi()),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(Nt());break;case`send-transcript`:n(ki());break;case`rate-conversation`:n(Ai(`MENU`));break;case`link`:n(zt(e.url));break;case`action`:n(JSON.parse(JSON.stringify(e.action)));break;default:break}s(!1)},[n,m,s]);return(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]),Fc(d,()=>s(!1)),p.length?(0,Z.jsxs)(`div`,{className:R(Cu.menuContainer),ref:d,children:[(0,Z.jsx)(`button`,{ref:u,className:R(o&&Cu.active,o?`tooltip-hidden`:`tooltip--bottom-left`),"aria-label":r(`header.menu.title`),"data-title":r(`header.menu.title`),onClick:()=>{s(e=>!e)},onBlur:()=>{setTimeout(()=>{let e=document.activeElement;d.current&&!d.current.contains(e)&&s(!1)},0)},children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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,Z.jsx)(`nav`,{className:Cu.menu,"aria-label":r(`header.menu.title`),children:(0,Z.jsx)(`ul`,{tabIndex:0,children:p.map((e,t)=>(0,Z.jsx)(Tu,{ref:e=>{f.current[t]=e},selected:c===t,item:e,onClick:()=>h(e)},e.id))})})]}):null},Ou=({className:e,chatStarted:t,...n})=>{let r=$i(),i=ea(e=>e.chat.conversationRating),a=ea(e=>e.chat.messages.some(e=>e.sender.type===ot.GUEST)),o=()=>{i.enabled&&!i.opener&&a?r(Ai(`CLOSE_CHAT`)):r(Di())};return(0,Z.jsxs)(`div`,{className:R(Cu.header,e),...n,children:[(0,Z.jsx)(`div`,{className:Cu.logoContainer,children:(0,Z.jsx)(`div`,{className:Cu.logo})}),(0,Z.jsxs)(`div`,{className:Cu.actions,children:[(0,Z.jsx)(Du,{chatStarted:t,hasGuestMessages:a}),(0,Z.jsx)(Su,{onClick:o})]})]})},ku={chatwindow:`_chatwindow_rkbir_1`,chatwindowWithAside:`_chatwindowWithAside_rkbir_21`},Au=()=>{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},ju={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`},Mu=({onClick:e})=>{let t=ta();return(0,Z.jsx)(`button`,{className:R(ju.closeSourceInfosButton,`tooltip--bottom-left`),"aria-label":t(`source-infos.close`),"data-title":t(`source-infos.close`),tabIndex:0,onClick:e,children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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`})})})},Nu=(0,x.forwardRef)(({sourceInfos:e,onClose:t,...n},r)=>(0,Z.jsxs)(`div`,{className:ju.sourceHeader,...n,ref:r,children:[(0,Z.jsx)(`div`,{children:e?(0,Z.jsx)(`p`,{id:`source-info-title`,children:e.title}):(0,Z.jsx)(`p`,{children:`\xA0`})}),(0,Z.jsx)(Mu,{onClick:t})]})),Pu=({loading:e})=>(0,Z.jsx)(`div`,{className:ju.highlightLoader,children:e&&(0,Z.jsx)(`div`,{className:ju.highlightLoaderLoading})});function Fu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Iu(e){if(Array.isArray(e))return e}function Lu(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Ru(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
62
62
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zu(e,t){return Iu(e)||Lu(e,t)||Bu(e,t)||Ru()}function Bu(e,t){if(e){if(typeof e==`string`)return Fu(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fu(e,t):void 0}}var Vu=Object.entries,Hu=Object.setPrototypeOf,Uu=Object.isFrozen,Wu=Object.getPrototypeOf,Gu=Object.getOwnPropertyDescriptor,Ku=Object.freeze,qu=Object.seal,Ju=Object.create,Yu=typeof Reflect<`u`&&Reflect,Xu=Yu.apply,Zu=Yu.construct;Ku||=function(e){return e},qu||=function(e){return e},Xu||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Zu||=function(e){return new e(...[...arguments].slice(1))};var Qu=vd(Array.prototype.forEach),$u=vd(Array.prototype.lastIndexOf),ed=vd(Array.prototype.pop),td=vd(Array.prototype.push),nd=vd(Array.prototype.splice),rd=Array.isArray,id=vd(String.prototype.toLowerCase),ad=vd(String.prototype.toString),od=vd(String.prototype.match),sd=vd(String.prototype.replace),cd=vd(String.prototype.indexOf),ld=vd(String.prototype.trim),ud=vd(Number.prototype.toString),dd=vd(Boolean.prototype.toString),fd=typeof BigInt>`u`?null:vd(BigInt.prototype.toString),pd=typeof Symbol>`u`?null:vd(Symbol.prototype.toString),md=vd(Object.prototype.hasOwnProperty),hd=vd(Object.prototype.toString),gd=vd(RegExp.prototype.test),_d=yd(TypeError);function vd(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Xu(e,t,n)}}function yd(e){return function(){return Zu(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:id;if(Hu&&Hu(e,null),!rd(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Uu(t)||(t[r]=e),i=e)}e[i]=!0}return e}function bd(e){for(let t=0;t<e.length;t++)md(e,t)||(e[t]=null);return e}function xd(e){let t=Ju(null);for(let r of Vu(e)){var n=zu(r,2);let i=n[0],a=n[1];md(e,i)&&(rd(a)?t[i]=bd(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=xd(a):t[i]=a)}return t}function Sd(e){switch(typeof e){case`string`:return e;case`number`:return ud(e);case`boolean`:return dd(e);case`bigint`:return fd?fd(e):`0`;case`symbol`:return pd?pd(e):`Symbol()`;case`undefined`:return hd(e);case`function`:case`object`:{if(e===null)return hd(e);let t=e,n=Cd(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:hd(e)}return hd(e)}default:return hd(e)}}function Cd(e,t){for(;e!==null;){let n=Gu(e,t);if(n){if(n.get)return vd(n.get);if(typeof n.value==`function`)return vd(n.value)}e=Wu(e)}function n(){return null}return n}function wd(e){try{return gd(e,``),!0}catch{return!1}}var Td=Ku(`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(`.`)),Ed=Ku(`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(`.`)),Dd=Ku([`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`]),Od=Ku([`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`]),kd=Ku(`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(`.`)),Ad=Ku([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),jd=Ku([`#text`]),Md=Ku(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.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`.split(`.`)),Nd=Ku(`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(`.`)),Pd=Ku(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.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(`.`)),Fd=Ku([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Id=qu(/{{[\w\W]*|^[\w\W]*}}/g),Ld=qu(/<%[\w\W]*|^[\w\W]*%>/g),Rd=qu(/\${[\w\W]*/g),zd=qu(/^data-[\-\w.\u00B7-\uFFFF]+$/),Bd=qu(/^aria-[\-\w]+$/),Vd=qu(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hd=qu(/^(?:\w+script|data):/i),Ud=qu(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wd=qu(/^html$/i),Gd=qu(/^[a-z][.\w]*(-[.\w]+)+$/i),Kd={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},qd=function(){return typeof window>`u`?null:window},Jd=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}},Yd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Xd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qd(),t=e=>Xd(e);if(t.version=`3.4.6`,t.removed=[],!e||!e.document||e.document.nodeType!==Kd.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Cd(d,`cloneNode`),p=Cd(d,`remove`),m=Cd(d,`nextSibling`),h=Cd(d,`childNodes`),g=Cd(d,`parentNode`),_=Cd(d,`shadowRoot`),v=Cd(d,`attributes`),y=o&&o.prototype?Cd(o.prototype,`nodeType`):null,b=o&&o.prototype?Cd(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C=n,w=C.implementation,T=C.createNodeIterator,E=C.createDocumentFragment,D=C.getElementsByTagName,O=r.importNode,k=Yd();t.isSupported=typeof Vu==`function`&&typeof g==`function`&&w&&w.createHTMLDocument!==void 0;let ee=Id,te=Ld,A=Rd,ne=zd,re=Bd,ie=Hd,j=Ud,M=Gd,ae=Vd,N=null,oe=$({},[...Td,...Ed,...Dd,...kd,...jd]),P=null,F=$({},[...Md,...Nd,...Pd,...Fd]),I=Object.seal(Ju(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}})),se=null,ce=null,le=Object.seal(Ju(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ue=!0,de=!0,fe=!1,L=!0,pe=!1,me=!0,he=!1,ge=!1,_e=!1,ve=!1,ye=!1,be=!1,xe=!0,Se=!1,Ce=`user-content-`,we=!0,Te=!1,Ee={},De=null,Oe=$({},[`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`]),ke=null,Ae=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),je=null,Me=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ne=`http://www.w3.org/1998/Math/MathML`,Pe=`http://www.w3.org/2000/svg`,Fe=`http://www.w3.org/1999/xhtml`,Ie=Fe,Le=!1,Re=null,ze=$({},[Ne,Pe,Fe],ad),Be=$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Ve=$({},[`annotation-xml`]),He=$({},[`title`,`style`,`font`,`a`,`script`]),Ue=null,We=[`application/xhtml+xml`,`text/html`],Ge=null,Ke=null,qe=n.createElement(`form`),Je=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ke&&Ke===e)return;(!e||typeof e!=`object`)&&(e={}),e=xd(e),Ue=We.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Ge=Ue===`application/xhtml+xml`?ad:id,N=md(e,`ALLOWED_TAGS`)&&rd(e.ALLOWED_TAGS)?$({},e.ALLOWED_TAGS,Ge):oe,P=md(e,`ALLOWED_ATTR`)&&rd(e.ALLOWED_ATTR)?$({},e.ALLOWED_ATTR,Ge):F,Re=md(e,`ALLOWED_NAMESPACES`)&&rd(e.ALLOWED_NAMESPACES)?$({},e.ALLOWED_NAMESPACES,ad):ze,je=md(e,`ADD_URI_SAFE_ATTR`)&&rd(e.ADD_URI_SAFE_ATTR)?$(xd(Me),e.ADD_URI_SAFE_ATTR,Ge):Me,ke=md(e,`ADD_DATA_URI_TAGS`)&&rd(e.ADD_DATA_URI_TAGS)?$(xd(Ae),e.ADD_DATA_URI_TAGS,Ge):Ae,De=md(e,`FORBID_CONTENTS`)&&rd(e.FORBID_CONTENTS)?$({},e.FORBID_CONTENTS,Ge):Oe,se=md(e,`FORBID_TAGS`)&&rd(e.FORBID_TAGS)?$({},e.FORBID_TAGS,Ge):xd({}),ce=md(e,`FORBID_ATTR`)&&rd(e.FORBID_ATTR)?$({},e.FORBID_ATTR,Ge):xd({}),Ee=md(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?xd(e.USE_PROFILES):e.USE_PROFILES:!1,ue=e.ALLOW_ARIA_ATTR!==!1,de=e.ALLOW_DATA_ATTR!==!1,fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,L=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=e.SAFE_FOR_TEMPLATES||!1,me=e.SAFE_FOR_XML!==!1,he=e.WHOLE_DOCUMENT||!1,ve=e.RETURN_DOM||!1,ye=e.RETURN_DOM_FRAGMENT||!1,be=e.RETURN_TRUSTED_TYPE||!1,_e=e.FORCE_BODY||!1,xe=e.SANITIZE_DOM!==!1,Se=e.SANITIZE_NAMED_PROPS||!1,we=e.KEEP_CONTENT!==!1,Te=e.IN_PLACE||!1,ae=wd(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Vd,Ie=typeof e.NAMESPACE==`string`?e.NAMESPACE:Fe,Be=md(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?xd(e.MATHML_TEXT_INTEGRATION_POINTS):$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Ve=md(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?xd(e.HTML_INTEGRATION_POINTS):$({},[`annotation-xml`]);let t=md(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?xd(e.CUSTOM_ELEMENT_HANDLING):Ju(null);if(I=Ju(null),md(t,`tagNameCheck`)&&Je(t.tagNameCheck)&&(I.tagNameCheck=t.tagNameCheck),md(t,`attributeNameCheck`)&&Je(t.attributeNameCheck)&&(I.attributeNameCheck=t.attributeNameCheck),md(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(I.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),pe&&(de=!1),ye&&(ve=!0),Ee&&(N=$({},jd),P=Ju(null),Ee.html===!0&&($(N,Td),$(P,Md)),Ee.svg===!0&&($(N,Ed),$(P,Nd),$(P,Fd)),Ee.svgFilters===!0&&($(N,Dd),$(P,Nd),$(P,Fd)),Ee.mathMl===!0&&($(N,kd),$(P,Pd),$(P,Fd))),le.tagCheck=null,le.attributeCheck=null,md(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?le.tagCheck=e.ADD_TAGS:rd(e.ADD_TAGS)&&(N===oe&&(N=xd(N)),$(N,e.ADD_TAGS,Ge))),md(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?le.attributeCheck=e.ADD_ATTR:rd(e.ADD_ATTR)&&(P===F&&(P=xd(P)),$(P,e.ADD_ATTR,Ge))),md(e,`ADD_URI_SAFE_ATTR`)&&rd(e.ADD_URI_SAFE_ATTR)&&$(je,e.ADD_URI_SAFE_ATTR,Ge),md(e,`FORBID_CONTENTS`)&&rd(e.FORBID_CONTENTS)&&(De===Oe&&(De=xd(De)),$(De,e.FORBID_CONTENTS,Ge)),md(e,`ADD_FORBID_CONTENTS`)&&rd(e.ADD_FORBID_CONTENTS)&&(De===Oe&&(De=xd(De)),$(De,e.ADD_FORBID_CONTENTS,Ge)),we&&(N[`#text`]=!0),he&&$(N,[`html`,`head`,`body`]),N.table&&($(N,[`tbody`]),delete se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw _d(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw _d(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);x=e.TRUSTED_TYPES_POLICY,S=x.createHTML(``)}else x===void 0&&(x=Jd(u,i)),x!==null&&typeof S==`string`&&(S=x.createHTML(``));Ku&&Ku(e),Ke=e},Xe=$({},[...Ed,...Dd,...Od]),Ze=$({},[...kd,...Ad]),Qe=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ie,tagName:`template`});let n=id(e.tagName),r=id(t.tagName);return Re[e.namespaceURI]?e.namespaceURI===Pe?t.namespaceURI===Fe?n===`svg`:t.namespaceURI===Ne?n===`svg`&&(r===`annotation-xml`||Be[r]):!!Xe[n]:e.namespaceURI===Ne?t.namespaceURI===Fe?n===`math`:t.namespaceURI===Pe?n===`math`&&Ve[r]:!!Ze[n]:e.namespaceURI===Fe?t.namespaceURI===Pe&&!Ve[r]||t.namespaceURI===Ne&&!Be[r]?!1:!Ze[n]&&(He[n]||!Xe[n]):!!(Ue===`application/xhtml+xml`&&Re[e.namespaceURI]):!1},$e=function(e){td(t.removed,{element:e});try{g(e).removeChild(e)}catch{p(e)}},et=function(e,n){try{td(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{td(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(ve||ye)try{$e(n)}catch{}else try{n.setAttribute(e,``)}catch{}},tt=function(e){let t=null,r=null;if(_e)e=`<remove></remove>`+e;else{let t=od(e,/^[\r\n\t ]+/);r=t&&t[0]}Ue===`application/xhtml+xml`&&Ie===Fe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?x.createHTML(e):e;if(Ie===Fe)try{t=new l().parseFromString(i,Ue)}catch{}if(!t||!t.documentElement){t=w.createDocument(Ie,`template`,null);try{t.documentElement.innerHTML=Le?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ie===Fe?D.call(t,he?`html`:`body`)[0]:he?t.documentElement:a},nt=function(e){return T.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},rt=function(e){e.normalize();let t=T.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;){let e=n.data;Qu([ee,te,A],t=>{e=sd(e,t,` `)}),n.data=e,n=t.nextNode()}},R=function(e){let t=b?b(e):null;return typeof t!=`string`||Ge(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.childNodes!==h(e)},it=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===Kd.documentFragment}catch{return!1}},at=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function ot(e,n,r){Qu(e,e=>{e.call(t,n,r,Ke)})}let st=function(e){let n=null;if(ot(k.beforeSanitizeElements,e,null),R(e))return $e(e),!0;let r=Ge(e.nodeName);if(ot(k.uponSanitizeElement,e,{tagName:r,allowedTags:N}),me&&e.hasChildNodes()&&!at(e.firstElementChild)&&gd(/<[/\w!]/g,e.innerHTML)&&gd(/<[/\w!]/g,e.textContent)||me&&e.namespaceURI===Fe&&r===`style`&&at(e.firstElementChild)||e.nodeType===Kd.progressingInstruction||me&&e.nodeType===Kd.comment&&gd(/<[/\w]/g,e.data))return $e(e),!0;if(se[r]||!(le.tagCheck instanceof Function&&le.tagCheck(r))&&!N[r]){if(!se[r]&&ut(r)&&(I.tagNameCheck instanceof RegExp&&gd(I.tagNameCheck,r)||I.tagNameCheck instanceof Function&&I.tagNameCheck(r)))return!1;if(we&&!De[r]){let t=g(e)||e.parentNode,n=h(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=f(n[i],!0);t.insertBefore(r,m(e))}}}return $e(e),!0}return(y?y(e):e.nodeType)===Kd.element&&!Qe(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&gd(/<\/no(script|embed|frames)/i,e.innerHTML)?($e(e),!0):(pe&&e.nodeType===Kd.text&&(n=e.textContent,Qu([ee,te,A],e=>{n=sd(n,e,` `)}),e.textContent!==n&&(td(t.removed,{element:e.cloneNode()}),e.textContent=n)),ot(k.afterSanitizeElements,e,null),!1)},ct=function(e,t,r){if(ce[t]||xe&&(t===`id`||t===`name`)&&(r in n||r in qe))return!1;let i=P[t]||le.attributeCheck instanceof Function&&le.attributeCheck(t,e);if(!(de&&!ce[t]&&gd(ne,t))&&!(ue&&gd(re,t))){if(!i||ce[t]){if(!(ut(e)&&(I.tagNameCheck instanceof RegExp&&gd(I.tagNameCheck,e)||I.tagNameCheck instanceof Function&&I.tagNameCheck(e))&&(I.attributeNameCheck instanceof RegExp&&gd(I.attributeNameCheck,t)||I.attributeNameCheck instanceof Function&&I.attributeNameCheck(t,e))||t===`is`&&I.allowCustomizedBuiltInElements&&(I.tagNameCheck instanceof RegExp&&gd(I.tagNameCheck,r)||I.tagNameCheck instanceof Function&&I.tagNameCheck(r))))return!1}else if(!je[t]&&!gd(ae,sd(r,j,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&cd(r,`data:`)===0&&ke[e])&&!(fe&&!gd(ie,sd(r,j,``)))&&r)return!1}return!0},lt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),ut=function(e){return!lt[id(e)]&&gd(M,e)},dt=function(e){ot(k.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||R(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0},i=n.length;for(;i--;){let a=n[i],o=a.name,s=a.namespaceURI,c=a.value,l=Ge(o),d=c,f=o===`value`?d:ld(d);if(r.attrName=l,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,ot(k.uponSanitizeAttribute,e,r),f=r.attrValue,Se&&(l===`id`||l===`name`)&&cd(f,Ce)!==0&&(et(o,e),f=Ce+f),me&&gd(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){et(o,e);continue}if(l===`attributename`&&od(f,`href`)){et(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){et(o,e);continue}if(!L&&gd(/\/>/i,f)){et(o,e);continue}pe&&Qu([ee,te,A],e=>{f=sd(f,e,` `)});let p=Ge(e.nodeName);if(!ct(p,l,f)){et(o,e);continue}if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!s)switch(u.getAttributeType(p,l)){case`TrustedHTML`:f=x.createHTML(f);break;case`TrustedScriptURL`:f=x.createScriptURL(f);break}if(f!==d)try{s?e.setAttributeNS(s,o,f):e.setAttribute(o,f),R(e)?$e(e):ed(t.removed)}catch{et(o,e)}}ot(k.afterSanitizeAttributes,e,null)},ft=function(e){let t=null,n=nt(e);for(ot(k.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)ot(k.uponSanitizeShadowNode,t,null),st(t),dt(t),it(t.content)&&ft(t.content);ot(k.afterSanitizeShadowDOM,e,null)},pt=function(e){if((y?y(e):e.nodeType)===Kd.element){let t=_?_(e):e.shadowRoot;it(t)&&(pt(t),ft(t))}let t=h?h(e):e.childNodes;if(!t)return;let n=[];Qu(t,e=>{td(n,e)});for(let e of n)pt(e)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Le=!e,Le&&(e=`<!-->`),typeof e!=`string`&&!at(e)&&(e=Sd(e),typeof e!=`string`))throw _d(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(ge||Ye(n),t.removed=[],typeof e==`string`&&(Te=!1),Te){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=Ge(t);if(!N[e]||se[e])throw _d(`root node is forbidden and cannot be sanitized in-place`)}if(R(e))throw _d(`root node is clobbered and cannot be sanitized in-place`);pt(e)}else if(at(e))i=tt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Kd.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),pt(a);else{if(!ve&&!pe&&!he&&e.indexOf(`<`)===-1)return x&&be?x.createHTML(e):e;if(i=tt(e),!i)return ve?null:be?S:``}i&&_e&&$e(i.firstChild);let c=nt(Te?e:i);for(;o=c.nextNode();)st(o),dt(o),it(o.content)&&ft(o.content);if(Te)return pe&&rt(e),e;if(ve){if(pe&&rt(i),ye)for(s=E.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(P.shadowroot||P.shadowrootmode)&&(s=O.call(r,s,!0)),s}let l=he?i.outerHTML:i.innerHTML;return he&&N[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&gd(Wd,i.ownerDocument.doctype.name)&&(l=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
63
63
|
`+l),pe&&Qu([ee,te,A],e=>{l=sd(l,e,` `)}),x&&be?x.createHTML(l):l},t.setConfig=function(){Ye(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),ge=!0},t.clearConfig=function(){Ke=null,ge=!1},t.isValidAttribute=function(e,t,n){return Ke||Ye({}),ct(Ge(e),Ge(t),n)},t.addHook=function(e,t){typeof t==`function`&&td(k[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=$u(k[e],t);return n===-1?void 0:nd(k[e],n,1)[0]}return ed(k[e])},t.removeHooks=function(e){k[e]=[]},t.removeAllHooks=function(){k=Yd()},t}var Zd=Xd(),Qd=({onClose:e})=>{let t=ta();return(0,Z.jsxs)(`div`,{className:ju.highlightLoadingInfo,onClick:e,children:[(0,Z.jsx)(`div`,{className:ju.highlightLoadingInfoCloseIcon,children:(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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,Z.jsxs)(`div`,{className:ju.highlightLoadingInfoInnerContainer,children:[(0,Z.jsxs)(`div`,{className:ju.highlightLoadingInfoContent,children:[(0,Z.jsx)(`h3`,{children:t(`source-infos.highlight-loading.title`)}),(0,Z.jsx)(`p`,{children:t(`source-infos.highlight-loading.description`)})]}),(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`#000000`,viewBox:`0 0 256 256`,children:(0,Z.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`})})]})]})},$d=({title:e,href:t,children:n})=>(0,Z.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),ef=({className:e,children:t,...n})=>(0,Z.jsx)(`a`,{className:R(Qc.button,Qc.buttonDefault,e),type:`button`,role:`button`,...n,children:t}),tf=e=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,Z.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`})}),nf=e=>(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,...e,children:(0,Z.jsx)(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm81.57,64H169.19a132.58,132.58,0,0,0-25.73-50.67A90.29,90.29,0,0,1,209.57,90ZM218,128a89.7,89.7,0,0,1-3.83,26H171.81a155.43,155.43,0,0,0,0-52h42.36A89.7,89.7,0,0,1,218,128Zm-90,87.83a110,110,0,0,1-15.19-19.45A124.24,124.24,0,0,1,99.35,166h57.3a124.24,124.24,0,0,1-13.46,30.38A110,110,0,0,1,128,215.83ZM96.45,154a139.18,139.18,0,0,1,0-52h63.1a139.18,139.18,0,0,1,0,52ZM38,128a89.7,89.7,0,0,1,3.83-26H84.19a155.43,155.43,0,0,0,0,52H41.83A89.7,89.7,0,0,1,38,128Zm90-87.83a110,110,0,0,1,15.19,19.45A124.24,124.24,0,0,1,156.65,90H99.35a124.24,124.24,0,0,1,13.46-30.38A110,110,0,0,1,128,40.17Zm-15.46-.84A132.58,132.58,0,0,0,86.81,90H46.43A90.29,90.29,0,0,1,112.54,39.33ZM46.43,166H86.81a132.58,132.58,0,0,0,25.73,50.67A90.29,90.29,0,0,1,46.43,166Zm97,50.67A132.58,132.58,0,0,0,169.19,166h40.38A90.29,90.29,0,0,1,143.46,216.67Z`})}),rf=({type:e,...t})=>{switch(e){case`WEBSITE`:return(0,Z.jsx)(nf,{...t});case`PDF`:return(0,Z.jsx)(Yc,{...t});case`DOCX`:return(0,Z.jsx)(qc,{...t});case`TEXT`:return(0,Z.jsx)(tf,{...t});default:return(0,Z.jsx)(Jc,{...t})}},af=({url:e,knowledgeBaseType:t})=>{let n=ta();return(0,Z.jsx)(ef,{className:ju.openSourceButton,href:e,target:`_blank`,children:(0,Z.jsxs)(`div`,{className:ju.sourceButtonLabel,children:[(0,Z.jsx)(`div`,{className:ju.sourceHeaderIcon,children:(0,Z.jsx)(rf,{type:t})}),(0,Z.jsx)(`p`,{children:n(`source-infos.open-source`)})]})})},of=({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=Zd.sanitize(e,{USE_PROFILES:{html:!0}});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:R(ju.sourceContent,dl.markdown),children:[(0,Z.jsx)(Ec,{options:{overrides:{a:$d}},children:o}),i&&(0,Z.jsx)(Qd,{onClose:()=>a(!1)})]}),(0,Z.jsx)(af,{url:t,knowledgeBaseType:n})]})},sf=``+new URL(`undraw_fixing-bugs-D_eYxJc6.svg`,import.meta.url).href,cf=()=>{let e=ta();return(0,Z.jsxs)(`div`,{className:ju.loadingError,children:[(0,Z.jsx)(`h1`,{children:e(`source-infos.error.title`)}),(0,Z.jsx)(`img`,{src:sf,title:e(`source-infos.error.title`)}),(0,Z.jsx)(`p`,{children:e(`source-infos.error.info`)})]})},lf=()=>(0,Z.jsx)(`div`,{className:ju.loadingSourceInfos,children:(0,Z.jsx)(`svg`,{className:ju.loading,xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,children:(0,Z.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 uf({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 df=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},ff=()=>{let e=$i(),t=ea(e=>e.chat.sourceInfos),n=Au(),r=(0,x.useRef)(null),i=df(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(Pi()))},[e,n]),{ref:o,dragOffsetY:s}=uf({onClose:a,sourceInfos:t});return t?(0,Z.jsx)(`dialog`,{ref:r,className:R(ju.sourceInfos,i?ju.waitForLoading:t.type===`loading`?ju.loadingContent:``),style:n&&s?{transform:`translateY(${s}px)`}:{},onClose:a,autoFocus:!0,role:`dialog`,"aria-labelledby":`source-info-title`,children:i?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nu,{ref:o,tabIndex:-1,sourceInfos:t.type===`loaded`?t:void 0,onClose:a}),t.type===`loading`?(0,Z.jsx)(lf,{}):t.type===`loading-error`?(0,Z.jsx)(cf,{}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pu,{loading:!t.highlighted}),(0,Z.jsx)(of,{sourceInfos:t})]})]})}):null},pf={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`},mf=({name:e,label:t,defaultValue:n,required:r,onChange:i})=>(0,Z.jsxs)(`label`,{className:R(pf.checkbox,`chat__startScreen__checkbox`),htmlFor:e,children:[(0,Z.jsx)(`input`,{type:`checkbox`,id:e,name:e,defaultChecked:n===`true`,required:r,onChange:e=>{i(e.currentTarget.checked?`true`:`false`)}}),(0,Z.jsx)(`div`,{children:t})]}),hf=({type:e,name:t,label:n,defaultValue:r,placeholder:i,required:a,multiple:o,min:s,max:c,pattern:l,onChange:u})=>(0,Z.jsxs)(`label`,{className:R(pf.input,`chat__startScreen__input`),htmlFor:t,children:[(0,Z.jsx)(`div`,{className:R(pf.inputLabel),children:n}),(0,Z.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)}})]}),gf=({name:e,value:t,label:n,defaultChecked:r,required:i,onChange:a})=>{let o=`${e}-${t}`;return(0,Z.jsxs)(`label`,{className:R(pf.radio,`chat__startScreen__radio`),htmlFor:o,children:[(0,Z.jsx)(`input`,{id:o,type:`radio`,name:e,value:t,defaultChecked:r,required:i,onChange:e=>{a(e.target.value)}}),(0,Z.jsx)(`span`,{className:R(pf.label),children:n})]})},_f=({name:e,label:t,defaultValue:n,required:r,multiple:i,options:a,onChange:o})=>(0,Z.jsxs)(`label`,{className:R(pf.select,`chat__startScreen__select`),htmlFor:e,children:[(0,Z.jsx)(`div`,{className:R(pf.selectLabel),children:t}),(0,Z.jsx)(`div`,{className:R(pf.selectWrapper),children:(0,Z.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,Z.jsx)(`option`,{value:e,selected:t===n,children:t}))})})]}),vf=`start-screen.intro`,yf=`start-screen.start-chat`,bf=`start-screen.waiting-for-login`,xf=`start-screen.footnote`,Sf=`start-screen.form`,Cf=`${Sf}.fields`,wf=()=>{let e=ta(),t=$i(),n=ul(),r=ea(e=>e.startScreen.loginRequestToken),i=ea(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(xi()),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?bi({loginRequestToken:Yt(),formValues:e}):_i({formValues:e}))},c=e(vf),l=e(r?bf:yf),u=e(xf),d=(0,x.useMemo)(()=>e(Cf)?.split(`;`).map(e=>e.trim())??[],[e(Cf)]);(0,x.useEffect)(()=>{d.length&&Object.keys(a).length===0&&o(d.reduce((t,n)=>({...t,[n]:Ef(n,e)}),{}))},[e,d,a]);let f=e=>{e.preventDefault(),s()},p=e=>t=>{o(n=>({...n,[e]:{...n[e],value:t}}))};return(0,Z.jsxs)(`form`,{onSubmit:f,className:R(pf.container,u&&pf.containerWithFootnote,`chat__startScreen`),children:[(0,Z.jsxs)(`div`,{className:R(pf.body,`chat__startScreen__body`),children:[c&&(0,Z.jsx)(`div`,{className:R(pf.intro,`chat__startScreen__intro`),children:(0,Z.jsx)(Ec,{options:{overrides:{a:Tf}},children:c})}),(0,Z.jsx)(`div`,{className:R(pf.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,Z.jsx)(`div`,{className:R(pf.formField,`chat__startScreen__field`),children:(()=>{switch(e){case`radio`:return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{children:n}),Object.entries(a||{}).map(([e,n])=>(0,Z.jsx)(gf,{name:t,value:e,label:n,defaultChecked:e===i,required:o,onChange:p(t)},e))]});case`checkbox`:return(0,Z.jsx)(mf,{name:t,label:n,defaultValue:i,required:o,onChange:p(t)});case`select`:return(0,Z.jsx)(_f,{name:t,label:n,defaultValue:i,required:o,multiple:s,options:a,onChange:p(t)});default:return(0,Z.jsx)(hf,{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,Z.jsxs)(`div`,{className:R(pf.footer,`chat__startScreen__footer`),children:[(0,Z.jsxs)(Il,{type:`submit`,className:pf.startChatButton,disabled:!!r,children:[!!r&&(0,Z.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,viewBox:`0 0 256 256`,className:pf.spinner,children:(0,Z.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,Z.jsx)(`div`,{children:l})]}),u&&(0,Z.jsx)(`div`,{className:pf.footnote,children:(0,Z.jsx)(Ec,{options:{overrides:{a:Tf}},children:u})})]})]})},Tf=({title:e,href:t,children:n})=>(0,Z.jsx)(`a`,{href:t,title:e,target:`_blank`,rel:`noopener noreferrer`,children:n}),Ef=(e,t)=>{let n=t(`${Sf}.${e}.type`)||`text`,r=t(`${Sf}.${e}.required`)===`true`,i=t(`${Sf}.${e}.multiple`)===`true`,a=t(`${Sf}.${e}.placeholder`),o=t(`${Sf}.${e}.label`)||``,s=t(`${Sf}.${e}.defaultValue`),c=t(`${Sf}.${e}.min`),l=t(`${Sf}.${e}.max`),u=t(`${Sf}.${e}.pattern`),d=Of(t(`${Sf}.${e}.options`));return{name:e,label:o,placeholder:a,value:Df(n,s,d)||``,defaultValue:s,options:d,type:n,required:r,multiple:i,min:c,max:l,pattern:u}},Df=(e,t,n)=>t||e===`select`&&Object.keys(n)[0]||``,Of=(e=``)=>e.split(`;`).map(e=>e.trim()).reduce((e,t)=>{let[n,r]=t.split(`:`).map(e=>e.trim());return{...e,[n]:r}},{}),kf=()=>{let e=ea(e=>e.intl.locale);(0,x.useEffect)(()=>{window.document.documentElement.lang=e},[e])},Af={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`},jf=({clientName:e})=>{kf();let t=$i(),n=ea(e=>e.intl.messages),r=ta(),i=ea(e=>e.settings.enableStartScreen),a=ea(e=>e.startScreen.startScreenStatus),o=ea(e=>e.connection.queryString),s=ea(e=>e.settings.allowedEmbedOrigins),c=(0,x.useMemo)(()=>new URLSearchParams(o||`?`).get(`cssClassName`),[o]);(0,x.useEffect)(()=>{let n=new URLSearchParams(o||``);t(Wi(e,Object.fromEntries(n.entries())))},[e,o,t]),(0,x.useEffect)(()=>{let e=e=>{if(!e.data?.type||!Object.values(Af).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 Af.TRIGGER_ACTION:t(e.data.action);break;case Af.TRIGGER_STORY:t(It(e.data.story));break;case Af.ON_CHAT_WINDOW_OPEN:t({type:`webclient.chatwindow.opened`});break;case Af.ON_CHAT_WINDOW_CLOSE:t({type:`webclient.chatwindow.closed`});break;case Af.CHAT_MESSAGE_FROM_GUEST:t(gt(e.data.text));break;case Af.RESTART_CHAT:t(Zi());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,Z.jsx)(`div`,{className:R(ku.chatwindow,u&&ku.chatwindowWithAside,`chat__chatwindow`,c),children:l?null:u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`header`,{children:(0,Z.jsx)(Ou,{chatStarted:!0})}),(0,Z.jsx)(`main`,{children:(0,Z.jsx)(yu,{clientName:e})}),(0,Z.jsx)(`aside`,{children:(0,Z.jsx)(ff,{})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`header`,{children:(0,Z.jsx)(Ou,{chatStarted:!1})}),(0,Z.jsx)(`main`,{children:(0,Z.jsx)(wf,{})})]})})},Mf=()=>{let e=ul(),t=Au();return(0,Z.jsx)(`div`,{className:R([it.app,t?`chat__small`:`chat__large`]),children:(0,Z.jsx)(jf,{clientName:e})})},Nf={"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
64
|
|
|
@@ -72,5 +72,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
72
72
|
- Ne saisissez aucune information personnelle dans la fenêtre de chat (mots de passe, date de naissance, etc.).`,"general-conditions.accept-conditions-note":`En utilisant le chat, vous acceptez les conditions d'utilisation.`,"block-user-input.title":`Veuillez attendre la réponse du chatbot.`,"conversation-rating.call-to-action.title":`Notez ce chat`,"conversation-rating.overlay.title":`Dans quelle mesure êtes-vous satisfait de ce chat ?`,"conversation-rating.overlay.guest-feedback.input-placeholder":`Veuillez saisir vos commentaires ici (facultatif)`,"conversation-rating.overlay.star.very-bad":`Très mauvais`,"conversation-rating.overlay.star.very-good":`Très bien`,"conversation-rating.overlay.bot-message.rate-feedback.value-1":`Oh, ça ne sonne pas bien. Merci de me donner un feedback pour que je puisse en apprendre davantage.`,"conversation-rating.overlay.bot-message.rate-feedback.value-2":`Oh, ça ne sonne pas bien. Merci de me donner un feedback pour que je puisse en apprendre davantage.`,"conversation-rating.overlay.bot-message.rate-feedback.value-3":`La moyenne n'est pas mon objectif, que puis-je encore améliorer ?`,"conversation-rating.overlay.bot-message.rate-feedback.value-4":`Le rater de peu, c'est le rater aussi. Que puis-je encore améliorer pour obtenir toutes les étoiles la prochaine fois ?`,"conversation-rating.overlay.bot-message.rate-feedback.value-5":`Parfait ! Alors j'espère pouvoir vous conseiller aussi bien une fois de plus.`,"conversation-rating.overlay.bot-message.submit-feedback":`Merci beaucoup pour votre feed-back. Je m'efforce de m'améliorer en permanence.`,"conversation-rating.overlay.action.submit":`Envoyer`,"conversation-rating.overlay.action.back-to-chat":`Fermer`,"conversation-rating.overlay.action.close-chat":`Minimiser le chat`,"conversation-rating.overlay.action.restart-chat":`Redémarrer le chat`,"conversation-rating.overlay.action.cancel":`Annuler`,"start-screen.intro":``,"start-screen.start-chat":`Démarrer le chat`,"start-screen.waiting-for-login":`En attente de connexion ...`,"header.close-chat":`Minimiser le chat`,"header.menu.title":`Menu`,"header.menu.restart-chat":`Redémarrer le chat`,"header.menu.expand-chat-window":`Agrandir la fenêtre`,"header.menu.download-transcript":`Télécharger l'historique du chat`,"header.menu.send-transcript":`Envoyer l'historique du chat`,"header.menu.export-transcript":`Exporter l'historique du chat`,"header.menu.rate-conversation":`Évaluer le chat`,"source-infos.close":`Fermer`,"source-infos.open-source":`Ouvrir source`,"source-infos.error.title":`Erreur`,"source-infos.error.info":`Oups ! Quelque chose s'est mal passé. Merci de réessayer ou de contacter le support si le problème persiste.`,"source-infos.highlight-loading.title":`Contenus pertinents en surbrillance...`,"source-infos.highlight-loading.description":`Un instant - la source est analysée`,"commands.show-more.action":`Plus`,"commands.show-more.tooltip":`Afficher plus de commandes`,"commands.show-less.action":`Moins`,"commands.show-less.tooltip":`Afficher moins de commandes`},Lf={"page.title":`Bubble Chat Chatbot`,"message-input-label":`Input dell'utente`,"message-input-placeholder":`Inserire un messaggio`,"message-input.actions.submit.label":`Invia messaggio`,"message-input.actions.start-audio-recording.label":`Avviare l'input vocale`,"message-input.actions.stop-audio-recording.label":`Interrompere l'input vocale`,"message-input.actions.submit-audio-recording.label":`Trasmettere l'input vocale`,"message-input.actions.command.label":`Esegui azione`,"guest-bubble.label":`Il tuo messaggio`,"bot-bubble.label":`Messaggio del chatbot`,"bot-bubble.actions.label":`Azioni del messaggio`,"bot-bubble.reaction.good":`Mi piace`,"bot-bubble.reaction.bad":`Non mi piace`,"bot-bubble.reaction.remove":`Rimuovere il marcatore`,"bot-bubble.reaction.say-more":`Disci più, per favore`,"bot-bubble.reaction.category.WRONG_INFORMATION":`Errate`,"bot-bubble.reaction.category.MISSING_INFORMATION":`Incompleto`,"bot-bubble.reaction.category.OLD_INFORMATION":`Obsoleta`,"bot-bubble.reaction.category.UNCLEAR":`Poco chiaro`,"bot-bubble.reaction.category.OFF_TOPIC":`Non pertinente alla domanda`,"bot-bubble.reaction.comment":`Condividete con noi i vostri pensieri...`,"bot-bubble.reaction.close":`Chiudere`,"bot-bubble.copy":`Copia`,"bot-bubble.sources":`Elenco delle fonti`,"bot-bubble.source.open":`Fonte aperta`,"bot-bubble.footnote":`Nota a piè di pagina`,"agent-bubble.label":`Messaggio dell'agente dal vivo`,"conversation.label":`Cronologia chat`,"chatbot.typing":`Il chatbot sta scrivendo`,"export-transcript.email.title":`Ricevere la cronologia della chat`,"export-transcript.email.description":`Inserire l'indirizzo e-mail a cui inviare la cronologia della chat.`,"export-transcript.email.cancel":`Annulla`,"export-transcript.email.send":`Invia`,"export-transcript.email.placeholder":`E-mail`,"export-transcript.email.invalid":`Inserire un indirizzo e-mail valido.`,"export-transcript.email.success":`La cronologia della chat è stata inviata all'indirizzo e-mail fornito.`,"general-conditions.header":`**Condizioni di utilizzo**`,"general-conditions.body":`Si prega di considerare i seguenti punti:
|
|
73
73
|
|
|
74
74
|
- La cronologia delle chat è memorizzata nell'area UE e può essere visualizzata solo da persone autorizzate.
|
|
75
|
-
- 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`},Rf=[`de`,`en`,`fr`,`it`],zf={locale:`de`,messages:Nf},Bf=(e,t)=>{if(Rf.includes(e)){let n=Vf(e),r=Ff(t);return{...n,...r}}return t},Vf=e=>{switch(e.toString()){case`en`:return Pf;case`fr`:return If;case`it`:return Lf;default:return Nf}},Hf=(e=Uf,t)=>{switch(t.type){case Ii:return Object.assign({},e,{connectionState:na.CONNECTING});case Li:return Object.assign({},e,{connectionState:na.CONNECTED});case Ri:return Object.assign({},e,{connectionState:na.DISCONNECTED});case zi:return Object.assign({},e,{connectionState:na.RECONNECTED});case Bi:return Object.assign({},e,{sessionId:t.sessionId});case Vi:return Object.assign({},e,{sessionId:t.payload.sessionId,userId:t.payload.userId});case Hi:return Object.assign({},e,{sessionId:void 0});default:return e}},Uf={connectionState:na.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},Wf=(e=Yf,t)=>{switch(t.type){case Ci:return Yf;case Vi:return Kf({type:`webclient.chat.started`}),e;case Hi:return Kf({type:`webclient.chat.ended`}),e;case at.TYPING_ON:return Object.assign({},e,{isBotTyping:!0});case at.TYPING_OFF:return Object.assign({},e,{isBotTyping:!1});case at.MESSAGE_FROM_GUEST:case at.MESSAGE_WITHOUT_ANALYSIS_FROM_GUEST:return Gf(e,t.message,t.meta);case at.MESSAGE_TO_GUEST:{Kf(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 vt:{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 _t:return Kf(t.message),e;case at.EVENT_TO_GUEST:return Kf(t.event),e;case at.DRAWER_OPEN:return Object.assign({},e,{drawerContentUrl:t.payload.parameters.contentUrl});case at.DRAWER_CLOSE:return Object.assign({},e,{drawerContentUrl:void 0});case at.GUEST_LOCALE_CHANGED:return Object.assign({},e,{locale:t.payload.locale});case Et:return Kf(t),e;case Dt:return Kf(t),{...e,conversationRating:{...e.conversationRating,opener:void 0}};case bt:{let n=new pt(t.transcription,new dt);return Gf(e,Object.assign({},n,{_id:Yt()}))}case at.TRANSCRIPT_ITEM_GUEST_REACTION:{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 xt:{let n={enabled:!0,rating:t.payload.rating};return Object.assign({},e,{conversationRating:n})}case at.CONVERSATION_RATING_FROM_GUEST:{let n={...e.conversationRating,rating:t.payload};return Object.assign({},e,{conversationRating:n})}case Ti:{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 Ei:{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 Ct:{let{highlighted:n}=t.payload;return e.sourceInfos?.type===`loaded`&&n?{...e,sourceInfos:{...e.sourceInfos,highlighted:!0}}:{...e,sourceInfos:{type:`loading-error`}}}case St:{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 Tt:return{...e,sourceInfos:void 0};case wi:return{...e,showTranscriptMailOverlay:!e.showTranscriptMailOverlay,conversationRating:{...e.conversationRating,opener:void 0}};default:return e}},Gf=(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:[]})},Kf=e=>{if(Jf()){let t=qf();window.top?.postMessage(e,t)}else e.type===`webclient.change.url`&&window.open(e.url)},qf=()=>{try{return document.referrer?new URL(document.referrer).origin:`*`}catch{return`*`}},Jf=()=>typeof window<`u`&&window.self!==window.top,Yf={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},Xf=ti({name:`intl`,initialState:zf,reducers:{updateIntl:(e,t)=>{e.locale=t.payload.language,e.messages=t.payload.messages}}}),{updateIntl:Zf}=Xf.actions,Qf=Xf.reducer,$f=ti({name:`settings`,initialState:{version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[],allowedEmbedOrigins:[]},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:ep}=$f.actions,tp=$f.reducer,np=sn({settings:tp,chat:Wf,startScreen:Si,connection:Hf,intl:Qf}),rp=`bubble-chat`,ip=`state-last-saved-at`,ap=`state`,op=e=>{try{if(!lp()||cp(up(e,ip)))return;{let t=up(e,ap);if(t===null)return;let n=JSON.parse(t),r=n.connection?.queryString;if(r!==void 0&&!pp(r,window.location.search)){console.log(`Ignoring persisted state due to different query string`);return}else return n}}catch(e){console.error(e);return}},sp=(e,t)=>{try{dp(e,ap,JSON.stringify(t)),dp(e,ip,new Date().toISOString())}catch(e){console.error(e)}},cp=e=>{if(e===null)return!1;let t=new Date(e);return t.setHours(t.getHours()+12),new Date>t},lp=()=>typeof localStorage<`u`,up=(e,t)=>{let n=fp(e,t);return localStorage.getItem(n)},dp=(e,t,n)=>{let r=fp(e,t);return localStorage.setItem(r,n)},fp=(e,t)=>`${rp}-${e}-${t}`,pp=(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},mp=Object.create(null);mp.open=`0`,mp.close=`1`,mp.ping=`2`,mp.pong=`3`,mp.message=`4`,mp.upgrade=`5`,mp.noop=`6`;var hp=Object.create(null);Object.keys(mp).forEach(e=>{hp[mp[e]]=e});var gp={type:`error`,data:`parser error`},_p=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,vp=typeof ArrayBuffer==`function`,yp=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,bp=({type:e,data:t},n,r)=>_p&&t instanceof Blob?n?r(t):xp(t,r):vp&&(t instanceof ArrayBuffer||yp(t))?n?r(t):xp(new Blob([t]),r):r(mp[e]+(t||``)),xp=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function Sp(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Cp;function wp(e,t){if(_p&&e.data instanceof Blob)return e.data.arrayBuffer().then(Sp).then(t);if(vp&&(e.data instanceof ArrayBuffer||yp(e.data)))return t(Sp(e.data));bp(e,!1,e=>{Cp||=new TextEncoder,t(Cp.encode(e))})}var Tp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ep=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Ep[Tp.charCodeAt(e)]=e;var Dp=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=Ep[e.charCodeAt(r)],o=Ep[e.charCodeAt(r+1)],s=Ep[e.charCodeAt(r+2)],c=Ep[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},Op=typeof ArrayBuffer==`function`,kp=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:jp(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Ap(e.substring(1),t)}:hp[n]?e.length>1?{type:hp[n],data:e.substring(1)}:{type:hp[n]}:gp},Ap=(e,t)=>Op?jp(Dp(e),t):{base64:!0,data:e},jp=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Mp=``,Np=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{bp(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Mp))})})},Pp=(e,t)=>{let n=e.split(Mp),r=[];for(let e=0;e<n.length;e++){let i=kp(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Fp(){return new TransformStream({transform(e,t){wp(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 Ip;function Lp(e){return e.reduce((e,t)=>e+t.length,0)}function Rp(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 zp(e,t){Ip||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Lp(n)<1)break;let e=Rp(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Lp(n)<2)break;let e=Rp(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Lp(n)<8)break;let e=Rp(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(gp);break}i=a*2**32+t.getUint32(4),r=3}else{if(Lp(n)<i)break;let e=Rp(n,i);s.enqueue(kp(a?e:Ip.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(gp);break}}}})}function Bp(e){if(e)return Vp(e)}function Vp(e){for(var t in Bp.prototype)e[t]=Bp.prototype[t];return e}Bp.prototype.on=Bp.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Bp.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Bp.prototype.off=Bp.prototype.removeListener=Bp.prototype.removeAllListeners=Bp.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},Bp.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},Bp.prototype.emitReserved=Bp.prototype.emit,Bp.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Bp.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Hp=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Up=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Wp=`arraybuffer`;function Gp(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Kp=Up.setTimeout,qp=Up.clearTimeout;function Jp(e,t){t.useNativeTimers?(e.setTimeoutFn=Kp.bind(Up),e.clearTimeoutFn=qp.bind(Up)):(e.setTimeoutFn=Up.setTimeout.bind(Up),e.clearTimeoutFn=Up.clearTimeout.bind(Up))}var Yp=1.33;function Xp(e){return typeof e==`string`?Zp(e):Math.ceil((e.byteLength||e.size)*Yp)}function Zp(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 Qp(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function $p(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function em(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 tm=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},nm=class extends Bp{constructor(e){super(),this.writable=!1,Jp(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 tm(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=kp(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=$p(e);return t.length?`?`+t:``}},rm=class extends nm{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){Pp(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,Np(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]=Qp()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},im=!1;try{im=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var am=im;function om(){}var sm=class extends rm{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}},cm=class e extends Bp{constructor(e,t,n){super(),this.createRequest=e,Jp(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=Gp(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=om,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(cm.requestsCount=0,cm.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,lm);else if(typeof addEventListener==`function`){let e=`onpagehide`in Up?`pagehide`:`unload`;addEventListener(e,lm,!1)}}function lm(){for(let e in cm.requests)cm.requests.hasOwnProperty(e)&&cm.requests[e].abort()}var um=(function(){let e=fm({xdomain:!1});return e&&e.responseType!==null})(),dm=class extends sm{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=um&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cm(fm,this.uri(),e)}};function fm(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||am))return new XMLHttpRequest}catch{}if(!t)try{return new Up[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var pm=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,mm=class extends nm{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=pm?{}:Gp(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;bp(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&Hp(()=>{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]=Qp()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},hm=Up.WebSocket||Up.MozWebSocket,gm={websocket:class extends mm{createSocket(e,t,n){return pm?new hm(e,t,n):t?new hm(e,t):new hm(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends nm{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=zp(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Fp();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&&Hp(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:dm},_m=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vm=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function ym(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=_m.exec(e||``),a={},o=14;for(;o--;)a[vm[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=bm(a,a.path),a.queryKey=xm(a,a.query),a}function bm(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 xm(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var Sm=typeof addEventListener==`function`&&typeof removeEventListener==`function`,Cm=[];Sm&&addEventListener(`offline`,()=>{Cm.forEach(e=>e())},!1);var wm=class e extends Bp{constructor(e,t){if(super(),this.binaryType=Wp,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=ym(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=ym(t.host).host);Jp(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=em(this.opts.query)),Sm&&(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`})},Cm.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+=Xp(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,Hp(()=>{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(),Sm&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=Cm.indexOf(this._offlineEventListener);e!==-1&&Cm.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};wm.protocol=4;var Tm=class extends wm{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;wm.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;wm.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}},Em=class extends Tm{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=>gm[e]).filter(e=>!!e)),super(e,n)}};Em.protocol;function Dm(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=ym(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 Om=typeof ArrayBuffer==`function`,km=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Am=Object.prototype.toString,jm=typeof Blob==`function`||typeof Blob<`u`&&Am.call(Blob)===`[object BlobConstructor]`,Mm=typeof File==`function`||typeof File<`u`&&Am.call(File)===`[object FileConstructor]`;function Nm(e){return Om&&(e instanceof ArrayBuffer||km(e))||jm&&e instanceof Blob||Mm&&e instanceof File}function Pm(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Pm(e[t]))return!0;return!1}if(Nm(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return Pm(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Pm(e[t]))return!0;return!1}function Fm(e){let t=[],n=e.data,r=e;return r.data=Im(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Im(e,t){if(!e)return e;if(Nm(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]=Im(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]=Im(e[r],t));return n}return e}function Lm(e,t){return e.data=Rm(e.data,t),delete e.attachments,e}function Rm(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]=Rm(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Rm(e[n],t));return e}var zm=s({Decoder:()=>Um,Encoder:()=>Hm,PacketType:()=>Vm,isPacketValid:()=>Xm,protocol:()=>5}),Bm=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],Vm;(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`})(Vm||={});var Hm=class{constructor(e){this.replacer=e}encode(e){return(e.type===Vm.EVENT||e.type===Vm.ACK)&&Pm(e)?this.encodeAsBinary({type:e.type===Vm.EVENT?Vm.BINARY_EVENT:Vm.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===Vm.BINARY_EVENT||e.type===Vm.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=Fm(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},Um=class e extends Bp{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===Vm.BINARY_EVENT;n||t.type===Vm.BINARY_ACK?(t.type=n?Vm.EVENT:Vm.ACK,this.reconstructor=new Wm(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(Nm(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(Vm[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===Vm.BINARY_EVENT||r.type===Vm.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(!Km(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 Vm.CONNECT:return Jm(t);case Vm.DISCONNECT:return t===void 0;case Vm.CONNECT_ERROR:return typeof t==`string`||Jm(t);case Vm.EVENT:case Vm.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&Bm.indexOf(t[0])===-1);case Vm.ACK:case Vm.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},Wm=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=Lm(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Gm(e){return typeof e==`string`}var Km=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function qm(e){return e===void 0||Km(e)}function Jm(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ym(e,t){switch(e){case Vm.CONNECT:return t===void 0||Jm(t);case Vm.DISCONNECT:return t===void 0;case Vm.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&Bm.indexOf(t[0])===-1);case Vm.ACK:return Array.isArray(t);case Vm.CONNECT_ERROR:return typeof t==`string`||Jm(t);default:return!1}}function Xm(e){return Gm(e.nsp)&&qm(e.id)&&Ym(e.type,e.data)}function Zm(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Qm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),$m=class extends Bp{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=[Zm(e,`open`,this.onopen.bind(this)),Zm(e,`packet`,this.onpacket.bind(this)),Zm(e,`error`,this.onerror.bind(this)),Zm(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(Qm.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:Vm.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:Vm.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 Vm.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 Vm.EVENT:case Vm.BINARY_EVENT:this.onevent(e);break;case Vm.ACK:case Vm.BINARY_ACK:this.onack(e);break;case Vm.DISCONNECT:this.ondisconnect();break;case Vm.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:Vm.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:Vm.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 eh(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}eh.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},eh.prototype.reset=function(){this.attempts=0},eh.prototype.setMin=function(e){this.ms=e},eh.prototype.setMax=function(e){this.max=e},eh.prototype.setJitter=function(e){this.jitter=e};var th=class extends Bp{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,Jp(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 eh({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||zm;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 Em(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=Zm(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=Zm(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(Zm(e,`ping`,this.onping.bind(this)),Zm(e,`data`,this.ondata.bind(this)),Zm(e,`error`,this.onerror.bind(this)),Zm(e,`close`,this.onclose.bind(this)),Zm(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){Hp(()=>{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 $m(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)}},nh={};function rh(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=Dm(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=nh[i]&&a in nh[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new th(r,t):(nh[i]||(nh[i]=new th(r,t)),c=nh[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(rh,{Manager:th,Socket:$m,io:rh,connect:rh});var ih=[at.MESSAGE_TO_GUEST,at.EVENT_TO_GUEST,at.TYPING_ON,at.TYPING_OFF,at.RESTART_CHAT_REQUEST,...Ui,...kt,`@@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(Ki()),r=rh({path:`/website-messenger/${i.clientName}/socket.io`,query:i.querystrings}),r.on(`action`,e),r.on(`connect`,()=>e(qi())),r.on(`disconnect`,()=>e(Ji())),r.on(`reconnect`,()=>e(Yi())),r.on(`set-translations`,(t,n)=>{e(Zf({language:t,messages:Bf(t,n)}))}),r.on(`set-settings`,t=>{e(ep(t))}),r.on(`enable-conversation-rating`,t=>e(Pt(t))),r.on(`speech-transcription`,t=>e(jt(t))),r.on(`restore-client-state`,t=>{e(Gi(t.sessionId)),e(Lt(t.messages))}),r.on(`expand-window`,({devices:t,initial:n=!1})=>{e({type:Et,devices:t,initial:n})}),r.on(`restart-chat`,()=>{e(Zi())}),r.on(`login-success`,t=>{e(vi({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===at.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=Zt(),n=new URL(`/${encodeURIComponent(t)}/transcript-pdf/${encodeURIComponent(e)}`,window.location.origin);window.location.href=n.toString()}}else ih.indexOf(i.type)===-1&&i.meta===void 0&&r&&r.emit(`action`,JSON.stringify(i));return a}},oh=Zt(),sh=qr({middleware:e=>e().concat(ah),reducer:np,preloadedState:{...op(oh),intl:zf}});sh.subscribe(Lc(()=>{let e=sh.getState();sp(oh,{connection:e.connection,startScreen:e.startScreen})},1e3)),(0,b.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(qe,{store:sh,children:(0,Z.jsx)(Mf,{})}));
|
|
76
|
-
//# sourceMappingURL=index-
|
|
75
|
+
- 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`},Rf=[`de`,`en`,`fr`,`it`],zf={locale:`de`,messages:Nf},Bf=(e,t)=>{if(Rf.includes(e)){let n=Vf(e),r=Ff(t);return{...n,...r}}return t},Vf=e=>{switch(e.toString()){case`en`:return Pf;case`fr`:return If;case`it`:return Lf;default:return Nf}},Hf=(e=Uf,t)=>{switch(t.type){case Ii:return Object.assign({},e,{connectionState:na.CONNECTING});case Li:return Object.assign({},e,{connectionState:na.CONNECTED});case Ri:return Object.assign({},e,{connectionState:na.DISCONNECTED});case zi:return Object.assign({},e,{connectionState:na.RECONNECTED});case Bi:return Object.assign({},e,{sessionId:t.sessionId});case Vi:return Object.assign({},e,{sessionId:t.payload.sessionId,userId:t.payload.userId});case Hi:return Object.assign({},e,{sessionId:void 0});default:return e}},Uf={connectionState:na.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},Wf=(e=Yf,t)=>{switch(t.type){case Ci:return Yf;case Vi:return Kf({type:`webclient.chat.started`}),e;case Hi:return Kf({type:`webclient.chat.ended`}),e;case at.TYPING_ON:return Object.assign({},e,{isBotTyping:!0});case at.TYPING_OFF:return Object.assign({},e,{isBotTyping:!1});case at.MESSAGE_FROM_GUEST:case at.MESSAGE_WITHOUT_ANALYSIS_FROM_GUEST:return Gf(e,t.message,t.meta);case at.MESSAGE_TO_GUEST:{Kf(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 vt:{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 _t:return Kf(t.message),e;case at.EVENT_TO_GUEST:return Kf(t.event),e;case at.DRAWER_OPEN:return Object.assign({},e,{drawerContentUrl:t.payload.parameters.contentUrl});case at.DRAWER_CLOSE:return Object.assign({},e,{drawerContentUrl:void 0});case at.GUEST_LOCALE_CHANGED:return Object.assign({},e,{locale:t.payload.locale});case Et:return Kf(t),e;case Dt:return Kf(t),{...e,conversationRating:{...e.conversationRating,opener:void 0}};case bt:{let n=new pt(t.transcription,new dt);return Gf(e,Object.assign({},n,{_id:Yt()}))}case at.TRANSCRIPT_ITEM_GUEST_REACTION:{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 xt:{let n={enabled:!0,rating:t.payload.rating};return Object.assign({},e,{conversationRating:n})}case at.CONVERSATION_RATING_FROM_GUEST:{let n={...e.conversationRating,rating:t.payload};return Object.assign({},e,{conversationRating:n})}case Ti:{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 Ei:{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 Ct:{let{highlighted:n}=t.payload;return e.sourceInfos?.type===`loaded`&&n?{...e,sourceInfos:{...e.sourceInfos,highlighted:!0}}:{...e,sourceInfos:{type:`loading-error`}}}case St:{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 Tt:return{...e,sourceInfos:void 0};case wi:return{...e,showTranscriptMailOverlay:!e.showTranscriptMailOverlay,conversationRating:{...e.conversationRating,opener:void 0}};default:return e}},Gf=(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:[]})},Kf=e=>{if(Jf()){let t=qf();window.top?.postMessage(e,t)}else e.type===`webclient.change.url`&&window.open(e.url)},qf=()=>{try{return document.referrer?new URL(document.referrer).origin:`*`}catch{return`*`}},Jf=()=>typeof window<`u`&&window.self!==window.top,Yf={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},Xf=ti({name:`intl`,initialState:zf,reducers:{updateIntl:(e,t)=>{e.locale=t.payload.language,e.messages=t.payload.messages}}}),{updateIntl:Zf}=Xf.actions,Qf=Xf.reducer,$f=ti({name:`settings`,initialState:{version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[],allowedEmbedOrigins:[]},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:ep}=$f.actions,tp=$f.reducer,np=sn({settings:tp,chat:Wf,startScreen:Si,connection:Hf,intl:Qf}),rp=`bubble-chat`,ip=`state-last-saved-at`,ap=`state`,op=e=>{try{if(!lp()||cp(up(e,ip)))return;{let t=up(e,ap);if(t===null)return;let n=JSON.parse(t),r=n.connection?.queryString;if(r!==void 0&&!pp(r,window.location.search)){console.log(`Ignoring persisted state due to different query string`);return}else return n}}catch(e){console.error(e);return}},sp=(e,t)=>{try{dp(e,ap,JSON.stringify(t)),dp(e,ip,new Date().toISOString())}catch(e){console.error(e)}},cp=e=>{if(e===null)return!1;let t=new Date(e);return t.setHours(t.getHours()+12),new Date>t},lp=()=>typeof localStorage<`u`,up=(e,t)=>{let n=fp(e,t);return localStorage.getItem(n)},dp=(e,t,n)=>{let r=fp(e,t);return localStorage.setItem(r,n)},fp=(e,t)=>`${rp}-${e}-${t}`,pp=(e,t)=>{let n=new URLSearchParams(e),r=new URLSearchParams(t);n.delete(`referrer`),r.delete(`referrer`),n.delete(`deviceType`),r.delete(`deviceType`);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},mp=Object.create(null);mp.open=`0`,mp.close=`1`,mp.ping=`2`,mp.pong=`3`,mp.message=`4`,mp.upgrade=`5`,mp.noop=`6`;var hp=Object.create(null);Object.keys(mp).forEach(e=>{hp[mp[e]]=e});var gp={type:`error`,data:`parser error`},_p=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,vp=typeof ArrayBuffer==`function`,yp=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,bp=({type:e,data:t},n,r)=>_p&&t instanceof Blob?n?r(t):xp(t,r):vp&&(t instanceof ArrayBuffer||yp(t))?n?r(t):xp(new Blob([t]),r):r(mp[e]+(t||``)),xp=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function Sp(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Cp;function wp(e,t){if(_p&&e.data instanceof Blob)return e.data.arrayBuffer().then(Sp).then(t);if(vp&&(e.data instanceof ArrayBuffer||yp(e.data)))return t(Sp(e.data));bp(e,!1,e=>{Cp||=new TextEncoder,t(Cp.encode(e))})}var Tp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ep=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Ep[Tp.charCodeAt(e)]=e;var Dp=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=Ep[e.charCodeAt(r)],o=Ep[e.charCodeAt(r+1)],s=Ep[e.charCodeAt(r+2)],c=Ep[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},Op=typeof ArrayBuffer==`function`,kp=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:jp(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Ap(e.substring(1),t)}:hp[n]?e.length>1?{type:hp[n],data:e.substring(1)}:{type:hp[n]}:gp},Ap=(e,t)=>Op?jp(Dp(e),t):{base64:!0,data:e},jp=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Mp=``,Np=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{bp(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Mp))})})},Pp=(e,t)=>{let n=e.split(Mp),r=[];for(let e=0;e<n.length;e++){let i=kp(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Fp(){return new TransformStream({transform(e,t){wp(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 Ip;function Lp(e){return e.reduce((e,t)=>e+t.length,0)}function Rp(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 zp(e,t){Ip||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Lp(n)<1)break;let e=Rp(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Lp(n)<2)break;let e=Rp(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Lp(n)<8)break;let e=Rp(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(gp);break}i=a*2**32+t.getUint32(4),r=3}else{if(Lp(n)<i)break;let e=Rp(n,i);s.enqueue(kp(a?e:Ip.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(gp);break}}}})}function Bp(e){if(e)return Vp(e)}function Vp(e){for(var t in Bp.prototype)e[t]=Bp.prototype[t];return e}Bp.prototype.on=Bp.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Bp.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Bp.prototype.off=Bp.prototype.removeListener=Bp.prototype.removeAllListeners=Bp.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},Bp.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},Bp.prototype.emitReserved=Bp.prototype.emit,Bp.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Bp.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Hp=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Up=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Wp=`arraybuffer`;function Gp(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Kp=Up.setTimeout,qp=Up.clearTimeout;function Jp(e,t){t.useNativeTimers?(e.setTimeoutFn=Kp.bind(Up),e.clearTimeoutFn=qp.bind(Up)):(e.setTimeoutFn=Up.setTimeout.bind(Up),e.clearTimeoutFn=Up.clearTimeout.bind(Up))}var Yp=1.33;function Xp(e){return typeof e==`string`?Zp(e):Math.ceil((e.byteLength||e.size)*Yp)}function Zp(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 Qp(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function $p(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function em(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 tm=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},nm=class extends Bp{constructor(e){super(),this.writable=!1,Jp(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 tm(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=kp(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=$p(e);return t.length?`?`+t:``}},rm=class extends nm{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){Pp(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,Np(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]=Qp()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},im=!1;try{im=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var am=im;function om(){}var sm=class extends rm{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}},cm=class e extends Bp{constructor(e,t,n){super(),this.createRequest=e,Jp(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=Gp(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=om,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(cm.requestsCount=0,cm.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,lm);else if(typeof addEventListener==`function`){let e=`onpagehide`in Up?`pagehide`:`unload`;addEventListener(e,lm,!1)}}function lm(){for(let e in cm.requests)cm.requests.hasOwnProperty(e)&&cm.requests[e].abort()}var um=(function(){let e=fm({xdomain:!1});return e&&e.responseType!==null})(),dm=class extends sm{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=um&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cm(fm,this.uri(),e)}};function fm(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||am))return new XMLHttpRequest}catch{}if(!t)try{return new Up[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var pm=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,mm=class extends nm{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=pm?{}:Gp(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;bp(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&Hp(()=>{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]=Qp()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},hm=Up.WebSocket||Up.MozWebSocket,gm={websocket:class extends mm{createSocket(e,t,n){return pm?new hm(e,t,n):t?new hm(e,t):new hm(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends nm{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=zp(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Fp();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&&Hp(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:dm},_m=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vm=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function ym(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=_m.exec(e||``),a={},o=14;for(;o--;)a[vm[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=bm(a,a.path),a.queryKey=xm(a,a.query),a}function bm(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 xm(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var Sm=typeof addEventListener==`function`&&typeof removeEventListener==`function`,Cm=[];Sm&&addEventListener(`offline`,()=>{Cm.forEach(e=>e())},!1);var wm=class e extends Bp{constructor(e,t){if(super(),this.binaryType=Wp,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=ym(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=ym(t.host).host);Jp(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=em(this.opts.query)),Sm&&(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`})},Cm.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+=Xp(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,Hp(()=>{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(),Sm&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=Cm.indexOf(this._offlineEventListener);e!==-1&&Cm.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};wm.protocol=4;var Tm=class extends wm{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;wm.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;wm.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}},Em=class extends Tm{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=>gm[e]).filter(e=>!!e)),super(e,n)}};Em.protocol;function Dm(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=ym(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 Om=typeof ArrayBuffer==`function`,km=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Am=Object.prototype.toString,jm=typeof Blob==`function`||typeof Blob<`u`&&Am.call(Blob)===`[object BlobConstructor]`,Mm=typeof File==`function`||typeof File<`u`&&Am.call(File)===`[object FileConstructor]`;function Nm(e){return Om&&(e instanceof ArrayBuffer||km(e))||jm&&e instanceof Blob||Mm&&e instanceof File}function Pm(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Pm(e[t]))return!0;return!1}if(Nm(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return Pm(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Pm(e[t]))return!0;return!1}function Fm(e){let t=[],n=e.data,r=e;return r.data=Im(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Im(e,t){if(!e)return e;if(Nm(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]=Im(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]=Im(e[r],t));return n}return e}function Lm(e,t){return e.data=Rm(e.data,t),delete e.attachments,e}function Rm(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]=Rm(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Rm(e[n],t));return e}var zm=s({Decoder:()=>Um,Encoder:()=>Hm,PacketType:()=>Vm,isPacketValid:()=>Xm,protocol:()=>5}),Bm=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],Vm;(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`})(Vm||={});var Hm=class{constructor(e){this.replacer=e}encode(e){return(e.type===Vm.EVENT||e.type===Vm.ACK)&&Pm(e)?this.encodeAsBinary({type:e.type===Vm.EVENT?Vm.BINARY_EVENT:Vm.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===Vm.BINARY_EVENT||e.type===Vm.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=Fm(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},Um=class e extends Bp{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===Vm.BINARY_EVENT;n||t.type===Vm.BINARY_ACK?(t.type=n?Vm.EVENT:Vm.ACK,this.reconstructor=new Wm(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(Nm(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(Vm[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===Vm.BINARY_EVENT||r.type===Vm.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(!Km(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 Vm.CONNECT:return Jm(t);case Vm.DISCONNECT:return t===void 0;case Vm.CONNECT_ERROR:return typeof t==`string`||Jm(t);case Vm.EVENT:case Vm.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&Bm.indexOf(t[0])===-1);case Vm.ACK:case Vm.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},Wm=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=Lm(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Gm(e){return typeof e==`string`}var Km=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function qm(e){return e===void 0||Km(e)}function Jm(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ym(e,t){switch(e){case Vm.CONNECT:return t===void 0||Jm(t);case Vm.DISCONNECT:return t===void 0;case Vm.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&Bm.indexOf(t[0])===-1);case Vm.ACK:return Array.isArray(t);case Vm.CONNECT_ERROR:return typeof t==`string`||Jm(t);default:return!1}}function Xm(e){return Gm(e.nsp)&&qm(e.id)&&Ym(e.type,e.data)}function Zm(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Qm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),$m=class extends Bp{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=[Zm(e,`open`,this.onopen.bind(this)),Zm(e,`packet`,this.onpacket.bind(this)),Zm(e,`error`,this.onerror.bind(this)),Zm(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(Qm.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:Vm.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:Vm.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 Vm.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 Vm.EVENT:case Vm.BINARY_EVENT:this.onevent(e);break;case Vm.ACK:case Vm.BINARY_ACK:this.onack(e);break;case Vm.DISCONNECT:this.ondisconnect();break;case Vm.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:Vm.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:Vm.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 eh(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}eh.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},eh.prototype.reset=function(){this.attempts=0},eh.prototype.setMin=function(e){this.ms=e},eh.prototype.setMax=function(e){this.max=e},eh.prototype.setJitter=function(e){this.jitter=e};var th=class extends Bp{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,Jp(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 eh({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||zm;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 Em(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=Zm(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=Zm(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(Zm(e,`ping`,this.onping.bind(this)),Zm(e,`data`,this.ondata.bind(this)),Zm(e,`error`,this.onerror.bind(this)),Zm(e,`close`,this.onclose.bind(this)),Zm(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){Hp(()=>{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 $m(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)}},nh={};function rh(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=Dm(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=nh[i]&&a in nh[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new th(r,t):(nh[i]||(nh[i]=new th(r,t)),c=nh[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(rh,{Manager:th,Socket:$m,io:rh,connect:rh});var ih=[at.MESSAGE_TO_GUEST,at.EVENT_TO_GUEST,at.TYPING_ON,at.TYPING_OFF,at.RESTART_CHAT_REQUEST,...Ui,...kt,`@@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(Ki()),r=rh({path:`/website-messenger/${i.clientName}/socket.io`,query:i.querystrings}),r.on(`action`,e),r.on(`connect`,()=>e(qi())),r.on(`disconnect`,()=>e(Ji())),r.on(`reconnect`,()=>e(Yi())),r.on(`set-translations`,(t,n)=>{e(Zf({language:t,messages:Bf(t,n)}))}),r.on(`set-settings`,t=>{e(ep(t))}),r.on(`enable-conversation-rating`,t=>e(Pt(t))),r.on(`speech-transcription`,t=>e(jt(t))),r.on(`restore-client-state`,t=>{e(Gi(t.sessionId)),e(Lt(t.messages))}),r.on(`expand-window`,({devices:t,initial:n=!1})=>{e({type:Et,devices:t,initial:n})}),r.on(`restart-chat`,()=>{e(Zi())}),r.on(`login-success`,t=>{e(vi({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===at.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=Zt(),n=new URL(`/${encodeURIComponent(t)}/transcript-pdf/${encodeURIComponent(e)}`,window.location.origin);window.location.href=n.toString()}}else ih.indexOf(i.type)===-1&&i.meta===void 0&&r&&r.emit(`action`,JSON.stringify(i));return a}},oh=Zt(),sh=qr({middleware:e=>e().concat(ah),reducer:np,preloadedState:{...op(oh),intl:zf}});sh.subscribe(Lc(()=>{let e=sh.getState();sp(oh,{connection:e.connection,startScreen:e.startScreen})},1e3)),(0,b.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(qe,{store:sh,children:(0,Z.jsx)(Mf,{})}));
|
|
76
|
+
//# sourceMappingURL=index-BQbm5HN_.js.map
|