widget-chatbot 1.0.4 → 2.0.0-alpha.1

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.
@@ -0,0 +1 @@
1
+ (function(n,z){typeof exports=="object"&&typeof module<"u"?module.exports=z(require("react/jsx-runtime"),require("axios"),require("react"),require("dayjs"),require("antd"),require("socket.io-client"),require("react-markdown"),require("remark-gfm"),require("react-syntax-highlighter"),require("@ant-design/icons"),require("@ant-design/plots"),require("crypto-js"),require("@emoji-mart/react")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","axios","react","dayjs","antd","socket.io-client","react-markdown","remark-gfm","react-syntax-highlighter","@ant-design/icons","@ant-design/plots","crypto-js","@emoji-mart/react"],z):(n=typeof globalThis<"u"?globalThis:n||self,n["widget-chatbot"]=z(n.jsxRuntime,n.axios,n.React,n.dayjs,n.antd,n.io,n.ReactMarkdown,n.remarkGfm,n.ReactSyntaxHighlighter,n.icons,n.Plots,n.CryptoJS,n.EmojiMartReact))})(this,function(n,z,c,K,f,nn,tn,on,sn,ln,cn,ee,rn){"use strict";const an="2.0.0-alpha.1",_e="chat_session",dn="user_uttered",un="bot_uttered",fn="ehelp_bot_uttered",gn="https://sfchatbot.dataon.com",Cn=[{label:"Didn’t address my question",value:"Didn’t address my question"},{label:"Inaccurate Answer",value:"Inaccurate Answer"},{label:"The response unclear",value:"The response unclear"},{label:"The information is incomplete",value:"The information is incomplete"},{label:"I’d like to explain further",value:"another"}],ne=f.version,te=c.version,Tn=an,yn="https://sfchatbot.dataon.com/openai-service-dev/",ue="https://res.cloudinary.com/dcvolkyfb/image/upload/v1740135794/svg/bot_profile_hlnyop.png",ye="YYYY-MM-DD",fe="HH:mm",De="N/A",he=[".jpg",".jpeg",".png",".gif",".bmp",".tiff",".tif",".webp",".heif",".heic",".jp2",".ico",".dds",".raw",".cr2",".nef",".arw",".orf",".psd",".xcf"],be="w-widget-content-container",ke="w-ticket-detail-content-container",hn="w-wrapper-body",bn="w-wrapper-body-helpdesk",ce="w-header",Se={FADE_IN:"w-fade-in-animate"},kn="https://placehold.co/600x400?text=No+Image",re=3,Sn="GoHRDev2025WorkPlazeDataOnDotCom",oe="(Helpdesk Widget Chatbot)",En=e=>JSON.parse((e==null?void 0:e.replaceAll("/get_started",""))||"{}"),Me=e=>{var t;try{return(t=new URL(e))==null?void 0:t.host}catch{return Me(gn)}},Y=(e,t)=>{var o,s,r;return((o=Object.keys(e||{}))==null?void 0:o.length)>0?(r=(s=Object==null?void 0:Object.prototype)==null?void 0:s.hasOwnProperty)==null?void 0:r.call(e,t):!1},se=e=>{var o;const t=e==null?void 0:e.attachment;return{text:((o=Object.keys(e||{}))==null?void 0:o.length)>0&&(e==null?void 0:e.type)==="text",upload:Y(e,"attachment")&&Y(t,"type")&&(t==null?void 0:t.type)==="fileuploader",password:(t==null?void 0:t.type)==="show_password_wp",filedownload:Y(t,"type")&&(t==null?void 0:t.type)==="filedownloader",chart:(t==null?void 0:t.type)==="charts"&&Y(t,"chartType")}},Oe=e=>{var t,o,s,r;if(e){const i=e==null?void 0:e.split(".")[1],l=(t=i==null?void 0:i.replace(/-/g,"+"))==null?void 0:t.replace(/_/g,"/"),a=decodeURIComponent((r=(s=(o=window==null?void 0:window.atob(l))==null?void 0:o.split(""))==null?void 0:s.map(d=>"%"+("00"+d.charCodeAt(0).toString(16)).slice(-2)))==null?void 0:r.join(""));return JSON==null?void 0:JSON.parse(a||"{}")}return{}},Ee=({downloadURL:e="",fileName:t="",isOpenNewTab:o=!1})=>{var r;const s=document==null?void 0:document.createElement("a");s.href=e,s.download=t||e,o&&(s.target="_blank"),(r=document==null?void 0:document.body)==null||r.appendChild(s),s.click(),document.body.removeChild(s)},An=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=crypto.getRandomValues(new Uint8Array(1))[0]%16;return(e==="x"?t:t&3|8).toString(16)}),Ae=({ArrObj:e,key:t,ignoreCaseSensitive:o=!1})=>(e==null?void 0:e.length)>0?[...new Map(e.map(s=>{var r;return[o?(r=String(s[t]))==null?void 0:r.toLowerCase():s[t],s]})).values()]:[],wn=(e=[])=>{const t={},o=[],s=[];e==null||e.forEach(i=>{var l;Y(i,"chats")?(l=i==null?void 0:i.chats)==null||l.forEach(a=>{s==null||s.push(a)}):s==null||s.push(i)}),s==null||s.forEach((i,l)=>{var d,u,C;const a=i==null?void 0:i.generated_id;a?(t[a]||(t[a]=[]),(u=t[a])==null||u.push({...i,indexChat:l,...!(i!=null&&i.timestamp)&&{timestamp:(d=K())==null?void 0:d.format("hh:mm A")}}),o==null||o.push({keyItem:a??l,type:"text",sender:"response",...a&&{generated_id:a},chats:t==null?void 0:t[a]})):o==null||o.push({...i,keyItem:l,...!(i!=null&&i.timestamp)&&{timestamp:(C=K())==null?void 0:C.format("hh:mm A")}})});const r=Ae({ArrObj:o,key:"keyItem"});return r==null||r.forEach(i=>{i==null||delete i.keyItem}),r},ge=(e={})=>{const o={...me(),...e};localStorage==null||localStorage.setItem(_e,JSON.stringify(o||{}))},me=()=>{const e=localStorage==null?void 0:localStorage.getItem(_e);return JSON.parse(e||"{}")},pn=(e="")=>{var t;try{const o=new URL(e);return(t=o==null?void 0:o.protocol)!=null&&t.includes("https")?"wss":"ws"}catch{return"wss"}};let Fe=null;const Z=(e=".w-wrapper-body")=>{const t=document.querySelector(e);clearTimeout(Fe),Fe=setTimeout(()=>{t&&t.scrollTo({top:t.scrollHeight,behavior:"smooth"})},0)},xn=e=>{const t=new Uint8Array(e);let o="";for(let s=0;s<t.byteLength;s++)o+=String.fromCharCode(t[s]);return btoa(o)},Ln=async(e,t)=>{var d;const o=typeof e=="object"?JSON==null?void 0:JSON.stringify(e||{}):e,s=new TextEncoder,r=s==null?void 0:s.encode(o),i=s==null?void 0:s.encode(t);if(i.length!==32)throw new Error("Key length must be 32 bytes for AES-256");const l=await((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.importKey("raw",i,{name:"AES-CBC"},!1,["encrypt"])),a=await crypto.subtle.encrypt({name:"AES-CBC",iv:new Uint8Array(16)},l,r);return xn(a)},Ce=e=>{const t={},o=Ne(e),s=o==null?void 0:o.map(r=>{var l;const i=r==null?void 0:r.CREATED_DATE;return{...r,DATE_KEY:(l=K(i))==null?void 0:l.format("YYYY-MM-DD")}});return s==null||s.forEach(r=>{var i;t[r==null?void 0:r.DATE_KEY]||(t[r==null?void 0:r.DATE_KEY]=[]),(i=t[r==null?void 0:r.DATE_KEY])==null||i.push(r)}),t},we=e=>{var t;return(t=Object.values(e||{}))==null?void 0:t.flat()},Ne=e=>e==null?void 0:e.sort((t,o)=>K(t==null?void 0:t.CREATED_DATE)-K(o==null?void 0:o.CREATED_DATE)),He=e=>{if(e&&typeof e=="string"){const t=e==null?void 0:e.split("."),o=t[(t==null?void 0:t.length)-1];return e==null?void 0:e.replaceAll(`.${o}`,`_avatar.${o}`)}return e},pe=e=>`https://ui-avatars.com/api/?background=e5e5e5&color=000${e&&typeof e=="string"?`&name=${e.replaceAll(" ","+")}`:""}`,Be=c.createContext({}),F=()=>c.useContext(Be),vn=({children:e,getStartedPayload:t,socketURL:o,socketPath:s,onPayslipFn:r,title:i,subTitle:l,keyEncrypt:a,history:d,isSF:u})=>{const[C,h]=c.useState(!1),[b,k]=c.useState("va"),[S,x]=c.useState(!1),[p,w]=c.useState({}),[T,g]=c.useState(!1),[y,E]=c.useState(!1),v=c.useRef(!1),_=c.useMemo(()=>({getStartedPayload:t,socketURL:o,socketPath:s,onPayslipFn:r,title:i,subTitle:l,keyEncrypt:a,isSF:u}),[t,o,s,r,i,l,a,u]),M=c.useMemo(()=>Oe(p==null?void 0:p.access_token),[p==null?void 0:p.access_token]);return c.useEffect(()=>{w(En(t))},[t]),c.useEffect(()=>{ge({chatbot_version:Tn})},[]),n.jsx(Be.Provider,{value:{objInitPayload:p,setOpenWidget:h,isOpenWidget:C,activeTab:b,setActiveTab:k,isExpand:S,setExpand:x,setObjInitPayload:w,parsedJWT:M,widgetProps:_,isFirstOpenWidget:T,setFirstOpenWidget:g,isFirstRenderHelpdesk:v,history:d,showReadyWSHD:y,setShowReadyWSHD:E},children:e})},Ie=c.createContext({}),_n=()=>c.useContext(Ie),Dn=({children:e})=>{const{objInitPayload:t}=F(),[o,s]=c.useState({}),r=()=>{var l;(l=z(`${(t==null?void 0:t.uriService)||yn}optional/translations`))==null||l.then(({data:a})=>{var d;if(a){const u=Object.keys((d=Object.values(a))==null?void 0:d[0]),C={};u==null||u.forEach(h=>{var b;(b=Object.keys(a))==null||b.forEach(k=>{var S;C[h==null?void 0:h.toLowerCase()]=(S=a==null?void 0:a[k])==null?void 0:S[h]})}),s(C)}})},i=()=>{const l=window.indexedDB.open("language");l.onsuccess=a=>{var u;const d=a.target.result;try{const h=d.transaction("keyvaluepairs","readonly").objectStore("keyvaluepairs"),b=h==null?void 0:h.get((u=t==null?void 0:t.lang)==null?void 0:u.toLowerCase());b.onsuccess=()=>{s(b==null?void 0:b.result)},b.onerror=()=>{r()}}catch{r()}},l.onerror=()=>{r()}};return c.useEffect(()=>{i()},[t==null?void 0:t.uriService,t==null?void 0:t.lang]),n.jsx(Ie.Provider,{value:{langDatas:o},children:e})},$e=c.createContext({}),q=()=>c.useContext($e),Mn=({children:e})=>{var m;const[t,o]=c.useState([]),[s,r]=c.useState(!1),[i,l]=c.useState(!1),[a,d]=c.useState({}),[u,C]=c.useState(!1),[h,b]=c.useState(!1),{objInitPayload:k,widgetProps:S,setOpenWidget:x,setFirstOpenWidget:p,isFirstRenderHelpdesk:w}=F(),T=c.useRef(null),g=c.useRef(""),y=c.useRef(""),E=L=>{const D=Y(L,"text_feedback_link")&&Y(L,"text");o(I=>{const O=[...I,{...L,...D&&{type:"text"},sender:"response"}];return wn(O)}),r(!1),l(!1),Z()},v=()=>{var L,D,I,O;(L=T==null?void 0:T.current)==null||L.emit("session_request",{session_id:null}),(D=T==null?void 0:T.current)==null||D.on("session_confirm",N=>{g.current=N,ge({session_id:N==null?void 0:N.session_id})}),(I=T==null?void 0:T.current)==null||I.on(un,E),(O=T==null?void 0:T.current)==null||O.on(fn,N=>{const U=JSON.parse(N||"{}");Y(U,"iswidget")&&b(U==null?void 0:U.iswidget)}),u||C(!0),p(!1)},_=({msg:L,additionalConfig:D={},isShowLoadingResponse:I=!0})=>{var O;(O=T==null?void 0:T.current)==null||O.emit(dn,{customData:{language:k==null?void 0:k.lang},message:L,session_id:g==null?void 0:g.current,...D}),I?r(!0):l(!0)},M=()=>{var D,I;T.current&&((D=T==null?void 0:T.current)==null||D.off(),(I=T==null?void 0:T.current)==null||I.disconnect(),T.current=null),w.current=!1;const L=nn.io(`${pn(S==null?void 0:S.socketURL)}://${Me(S==null?void 0:S.socketURL)}`,{path:S==null?void 0:S.socketPath,transports:["websocket"],reconnection:!0,reconnectionAttempts:1});L.on("connect",v),L.on("connect_error",O=>{console.error("connect_error widget-chatbot : ",{err:O,socketURL:S==null?void 0:S.socketURL,socketPath:S==null?void 0:S.widgetProps})}),L.io.on("reconnect",()=>{console.error("reconnect widget-chatbot : ",{socketURL:S==null?void 0:S.socketURL,socketPath:S==null?void 0:S.widgetProps})}),T.current=L},B=()=>{var L;(!((L=T==null?void 0:T.current)!=null&&L.connected)||!u)&&(M(),x(!1))},H=()=>{C(!1)};return c.useEffect(()=>(x(!1),M(),window.addEventListener("online",B),window.addEventListener("offline",H),()=>{var L,D;T.current&&((L=T.current)==null||L.off("connect",v),(D=T.current)==null||D.disconnect(),T.current=null),window.removeEventListener("online",B),window.removeEventListener("offline",H)}),[JSON.stringify(k||{}),S==null?void 0:S.socketURL,S==null?void 0:S.socketPath]),n.jsx($e.Provider,{value:{setChats:o,chats:t,onSendMsg:_,isWaitResponse:s,socket:T==null?void 0:T.current,sessionId:(m=g==null?void 0:g.current)==null?void 0:m.session_id,loadingRegenerate:i,file:a,setFile:d,connected:u,isHandshakeWidget:h,createSocket:M,currRegenerateId:y},children:e})},On={'pre[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",background:"#1e1e1e"},'code[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'pre[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},':not(pre) > code[class*="language-"]':{padding:".1em .3em",borderRadius:".3em",color:"#db4c69",background:"#1e1e1e"},".namespace":{Opacity:".7"},"doctype.doctype-tag":{color:"#569CD6"},"doctype.name":{color:"#9cdcfe"},comment:{color:"#6a9955"},prolog:{color:"#6a9955"},punctuation:{color:"#d4d4d4"},".language-html .language-css .token.punctuation":{color:"#d4d4d4"},".language-html .language-javascript .token.punctuation":{color:"#d4d4d4"},property:{color:"#9cdcfe"},tag:{color:"#569cd6"},boolean:{color:"#569cd6"},number:{color:"#b5cea8"},constant:{color:"#9cdcfe"},symbol:{color:"#b5cea8"},inserted:{color:"#b5cea8"},unit:{color:"#b5cea8"},selector:{color:"#d7ba7d"},"attr-name":{color:"#9cdcfe"},string:{color:"#ce9178"},char:{color:"#ce9178"},builtin:{color:"#ce9178"},deleted:{color:"#ce9178"},".language-css .token.string.url":{textDecoration:"underline"},operator:{color:"#d4d4d4"},entity:{color:"#569cd6"},"operator.arrow":{color:"#569CD6"},atrule:{color:"#ce9178"},"atrule.rule":{color:"#c586c0"},"atrule.url":{color:"#9cdcfe"},"atrule.url.function":{color:"#dcdcaa"},"atrule.url.punctuation":{color:"#d4d4d4"},keyword:{color:"#569CD6"},"keyword.module":{color:"#c586c0"},"keyword.control-flow":{color:"#c586c0"},function:{color:"#dcdcaa"},"function.maybe-class-name":{color:"#dcdcaa"},regex:{color:"#d16969"},important:{color:"#569cd6"},italic:{fontStyle:"italic"},"class-name":{color:"#4ec9b0"},"maybe-class-name":{color:"#4ec9b0"},console:{color:"#9cdcfe"},parameter:{color:"#9cdcfe"},interpolation:{color:"#9cdcfe"},"punctuation.interpolation-punctuation":{color:"#569cd6"},variable:{color:"#9cdcfe"},"imports.maybe-class-name":{color:"#9cdcfe"},"exports.maybe-class-name":{color:"#9cdcfe"},escape:{color:"#d7ba7d"},"tag.punctuation":{color:"#808080"},cdata:{color:"#808080"},"attr-value":{color:"#ce9178"},"attr-value.punctuation":{color:"#ce9178"},"attr-value.punctuation.attr-equals":{color:"#d4d4d4"},namespace:{color:"#4ec9b0"},'pre[class*="language-javascript"]':{color:"#9cdcfe"},'code[class*="language-javascript"]':{color:"#9cdcfe"},'pre[class*="language-jsx"]':{color:"#9cdcfe"},'code[class*="language-jsx"]':{color:"#9cdcfe"},'pre[class*="language-typescript"]':{color:"#9cdcfe"},'code[class*="language-typescript"]':{color:"#9cdcfe"},'pre[class*="language-tsx"]':{color:"#9cdcfe"},'code[class*="language-tsx"]':{color:"#9cdcfe"},'pre[class*="language-css"]':{color:"#ce9178"},'code[class*="language-css"]':{color:"#ce9178"},'pre[class*="language-html"]':{color:"#d4d4d4"},'code[class*="language-html"]':{color:"#d4d4d4"},".language-regex .token.anchor":{color:"#dcdcaa"},".language-html .token.punctuation":{color:"#808080"},'pre[class*="language-"] > code[class*="language-"]':{position:"relative",zIndex:"1"},".line-highlight.line-highlight":{background:"#f7ebc6",boxShadow:"inset 5px 0 0 #f7d87c",zIndex:"0"}},mn=e=>e.replace(/[^a-zA-Z0-9_]/g,"").trim(),A=(e="",t)=>{var l;const{langDatas:o}=_n(),s=localStorage==null?void 0:localStorage.getItem("show_text_id"),r=mn(String(e)),i=(o==null?void 0:o[r==null?void 0:r.toUpperCase()])||t;return((l=Object.keys(o||{}))==null?void 0:l.length)>0?s?`WPUI_${r}`:i:t},Fn=({isFeedback:e=!1,open:t,...o})=>{var r;const s=c.useMemo(()=>e?"w-modal-container-feedback":"",[e]);return ne!=null&&ne.startsWith("5")?n.jsx(f.Modal,{rootClassName:s,...o,open:t,getContainer:"#w-widget-content",maskProps:{style:{backdropFilter:"blur(4px)"}},width:300,style:{...Object.keys((o==null?void 0:o.style)||{}).length>0&&{...o==null?void 0:o.style},top:20}}):n.jsx(f.Modal,{getContainer:"#w-widget-content",width:300,...o,...te!=null&&te.startsWith("18")?{open:t}:{visible:t},maskStyle:{backdropFilter:"blur(4x)",...((r=Object.keys((o==null?void 0:o.maskStyle)||{}))==null?void 0:r.length)>0&&{...o==null?void 0:o.maskStyle}},style:{...Object.keys((o==null?void 0:o.style)||{}).length>0&&{...o==null?void 0:o.style},top:20}})},Ue=c.memo(Fn),We=({props:e,isModal:t=!1})=>{const o=(s,r)=>{var i;return(i=c.Children)==null?void 0:i.map(s,l=>{var a,d,u;return!c.isValidElement(l)||((a=Object.keys((l==null?void 0:l.props)||{}))==null?void 0:a.length)===0?l:c.cloneElement(l,{...l==null?void 0:l.props,...(l==null?void 0:l.type)==="thead"&&{className:"ant-table-thead"},...((l==null?void 0:l.type)==="th"||(l==null?void 0:l.type)==="td")&&{className:"ant-table-cell",...(l==null?void 0:l.type)==="th"&&{style:{background:"var(--primary-color, #395ebc)",color:"#ffffff",minWidth:180}}},...l.type==="tr"&&r==="tbody"&&{className:"ant-table-row"},...(l==null?void 0:l.type)==="tbody"&&{className:"ant-table-tbody"},children:(d=l==null?void 0:l.props)!=null&&d.children?o((u=l==null?void 0:l.props)==null?void 0:u.children,l==null?void 0:l.type):l==null?void 0:l.props})})};return n.jsx(n.Fragment,{children:n.jsx("div",{className:"ant-table",children:n.jsx("div",{className:"ant-table-container",children:n.jsx("div",{className:"ant-table-content",style:{overflow:"scroll",maxWidth:t?"100%":330,maxHeight:t?"100%":360},children:n.jsx("table",{className:"wp-md-table",...e,children:o(e==null?void 0:e.children,"")})})})})})},Nn=({children:e})=>{const t=A("OpenDetailTable","Open Detail Table"),o=A("TableDetail","Tabel Detail"),[s,r]=c.useState(!1),i={table:({...l})=>n.jsxs(n.Fragment,{children:[n.jsx(We,{props:l}),n.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"5px 0px 10px 0px"},children:n.jsx(f.Button,{onClick:()=>{r(!0)},children:t})}),n.jsx(Ue,{getContainer:()=>document.body,footer:null,title:o,width:800,open:s,onCancel:()=>{r(!1)},children:n.jsx(We,{props:l,isModal:!0})})]}),code:({...l})=>{const{children:a,className:d,...u}=l,C=/language-(\w+)/.exec(d||"");return C?n.jsx(sn.Prism,{...u,PreTag:"div",language:C[1],style:On,children:String(a).replace(/\n$/,"")}):n.jsx(f.Typography.Text,{code:!0,children:l==null?void 0:l.children})}};return n.jsx(tn,{remarkPlugins:[on],components:i,children:e})},Ge=c.memo(Nn),Hn=()=>n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.25 4.5H18.75C19.5 4.5 19.5 5.44772 19.5 6V18C19.5 18.5523 19.5 19.5 18.75 19.5H5.25C4.5 19.5 4.5 18.5523 4.5 18V6C4.5 5.44772 4.5 4.5 5.25 4.5ZM3 6C3 4.34315 4.34315 3 6 3H18C19.6569 3 21 4.34315 21 6V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6ZM17 17V15.75H7V17H17Z",fill:"white"})}),Bn=()=>n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:"rotate(0deg)",transition:"300ms"},children:n.jsx("path",{d:"M11.325 21H5.175C3.9735 21 3 20.0265 3 18.825V5.175C3 3.9735 3.9735 3 5.175 3H18.825C20.0265 3 21 3.9735 21 5.175V18.825C21 20.0265 20.0265 21 18.825 21H11.325ZM4.35 5.175V12H9.825C11.0265 12 12 12.9735 12 14.175V19.65H18.825C19.281 19.65 19.65 19.281 19.65 18.825V5.175C19.65 4.71975 19.281 4.35 18.825 4.35H5.175C4.71975 4.35 4.35 4.719 4.35 5.175V5.175ZM4.35 18.825C4.35 19.281 4.719 19.65 5.175 19.65H10.65V14.175C10.65 13.719 10.281 13.35 9.825 13.35H4.35V18.825ZM12.4882 11.5117C12.366 11.3895 12.2902 11.2207 12.2902 11.034C12.2902 10.8472 12.366 10.6785 12.4882 10.5562L15.9863 7.059H14.364C13.9913 7.059 13.689 6.75675 13.689 6.384C13.689 6.01125 13.9913 5.709 14.364 5.709H17.616C17.709 5.709 17.7975 5.7285 17.8785 5.763L17.874 5.7615C17.958 5.79675 18.0293 5.8455 18.09 5.90475C18.1508 5.9655 18.1995 6.03825 18.2333 6.11925L18.2347 6.12375C18.2677 6.1995 18.2872 6.28875 18.2872 6.38175V9.633C18.2872 10.0057 17.985 10.308 17.6122 10.308C17.2395 10.308 16.9373 10.0057 16.9373 9.633V8.0115L13.4393 11.5095C13.317 11.631 13.1483 11.7068 12.9623 11.7068C12.7778 11.7068 12.6105 11.6325 12.489 11.5125L12.4882 11.5117Z",fill:"white"})}),In=()=>n.jsxs("svg",{viewBox:"64 64 896 896",focusable:"false",width:"14",height:"14","aria-hidden":"true",fill:"white",children:[n.jsx("defs",{children:n.jsx("style",{})}),n.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"})]}),$n=()=>n.jsxs("svg",{viewBox:"-2.4 -2.4 28.80 28.80",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"}),n.jsx("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("g",{id:"SVGRepo_iconCarrier",children:n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM8.58579 8.58579C8 9.17157 8 10.1144 8 12C8 13.8856 8 14.8284 8.58579 15.4142C9.17157 16 10.1144 16 12 16C13.8856 16 14.8284 16 15.4142 15.4142C16 14.8284 16 13.8856 16 12C16 10.1144 16 9.17157 15.4142 8.58579C14.8284 8 13.8856 8 12 8C10.1144 8 9.17157 8 8.58579 8.58579Z",fill:"rgb(57, 94, 188)"})})]}),Un=()=>n.jsx("span",{role:"img","aria-label":"sync",className:"anticon anticon-sync",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z"})})}),Wn=()=>n.jsx("span",{role:"img","aria-label":"left",className:"anticon anticon-left",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"})})}),Gn=()=>n.jsx("span",{role:"img","aria-label":"right",className:"anticon anticon-right",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"})})}),Vn=({...e})=>n.jsx("span",{role:"img","aria-label":"like",className:"anticon anticon-like",children:n.jsxs("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"like",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:[n.jsx("path",{d:"M273 495.9v428l.3-428zm538.2-88.3H496.8l9.6-198.4c.6-11.9-4.7-23.1-14.6-30.5-6.1-4.5-13.6-6.8-21.1-6.7-19.6.1-36.9 13.4-42.2 32.3-37.1 134.4-64.9 235.2-83.5 302.5V852h399.4a56.85 56.85 0 0033.6-51.8c0-9.7-2.3-18.9-6.9-27.3l-13.9-25.4 21.9-19a56.76 56.76 0 0019.6-43c0-9.7-2.3-18.9-6.9-27.3l-13.9-25.4 21.9-19a56.76 56.76 0 0019.6-43c0-9.7-2.3-18.9-6.9-27.3l-14-25.5 21.9-19a56.76 56.76 0 0019.6-43c0-19.1-11-37.5-28.8-48.4z",fill:(e==null?void 0:e.feedback)==="like"?"green":"#fff"}),n.jsx("path",{d:"M112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32zm773.9 5.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.5-65.5-111a67.67 67.67 0 00-34.3-9.3H572.3l6-122.9c1.5-29.7-9-57.9-29.5-79.4a106.4 106.4 0 00-77.9-33.4c-52 0-98 35-111.8 85.1l-85.8 310.8-.3 428h472.1c9.3 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37zM820.4 499l-21.9 19 14 25.5a56.2 56.2 0 016.9 27.3c0 16.5-7.1 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 16.5-7.1 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 22.4-13.2 42.6-33.6 51.8H345V506.8c18.6-67.2 46.4-168 83.5-302.5a44.28 44.28 0 0142.2-32.3c7.5-.1 15 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.1 32.2-19.6 43z",fill:(e==null?void 0:e.feedback)==="like"?"green":"black"})]})}),zn=({...e})=>n.jsx("span",{role:"img","aria-label":"dislike",className:"anticon anticon-dislike",children:n.jsxs("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"dislike",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:[n.jsx("path",{d:"M273 100.1v428h.3l-.3-428zM820.4 525l-21.9-19 14-25.5a56.2 56.2 0 006.9-27.3c0-16.5-7.1-32.2-19.6-43l-21.9-19 13.9-25.4a56.2 56.2 0 006.9-27.3c0-16.5-7.1-32.2-19.6-43l-21.9-19 13.9-25.4a56.2 56.2 0 006.9-27.3c0-22.4-13.2-42.6-33.6-51.8H345v345.2c18.6 67.2 46.4 168 83.5 302.5a44.28 44.28 0 0042.2 32.3c7.5.1 15-2.2 21.1-6.7 9.9-7.4 15.2-18.6 14.6-30.5l-9.6-198.4h314.4C829 605.5 840 587.1 840 568c0-16.5-7.1-32.2-19.6-43z",fill:(e==null?void 0:e.feedback)==="dislike"?"red":"#fff"}),n.jsx("path",{d:"M112 132v364c0 17.7 14.3 32 32 32h65V100h-65c-17.7 0-32 14.3-32 32zm773.9 358.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 00-26.5-5.4H273l.3 428 85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zm-74.7 126.1H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 01-42.2-32.3c-37.1-134.4-64.9-235.2-83.5-302.5V172h399.4a56.85 56.85 0 0133.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0119.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0119.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0119.6 43c0 19.1-11 37.5-28.8 48.4z",fill:(e==null?void 0:e.feedback)==="dislike"?"red":"black"})]})}),Kn=()=>n.jsx("span",{role:"img","aria-label":"delete",className:"anticon anticon-delete",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})})}),Yn=()=>n.jsx("span",{role:"img","aria-label":"close",className:"anticon anticon-close",children:n.jsx("svg",{fillRule:"evenodd",viewBox:"64 64 896 896",focusable:"false","data-icon":"close",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"})})}),qn=()=>n.jsx("span",{role:"img","aria-label":"upload",className:"anticon anticon-upload",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"})})}),Qn=()=>n.jsx("span",{role:"img","aria-label":"filter",className:"anticon anticon-filter",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"})})}),Zn=()=>n.jsx("span",{role:"img","aria-label":"down",className:"anticon anticon-down",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"})})}),Jn=()=>n.jsx("span",{role:"img","aria-label":"paper-clip",className:"anticon anticon-paper-clip",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"})})}),Xn=()=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 32 32",fill:"none",children:n.jsx("path",{d:"M13.083 1C10.9876 0.99919 8.92848 1.54638 7.10994 2.58726C5.2914 3.62814 3.7767 5.12652 2.71618 6.93367C1.65565 8.74083 1.08618 10.7939 1.06429 12.8892C1.0424 14.9844 1.56884 17.0489 2.59138 18.8778L1.12189 22.7262C0.999579 23.0461 0.968553 23.3937 1.03227 23.7303C1.096 24.0668 1.25196 24.379 1.48276 24.632C1.71356 24.885 2.01013 25.069 2.33938 25.1633C2.66863 25.2576 3.0176 25.2586 3.34738 25.1661L7.94438 23.8778C9.57274 24.6472 11.3532 25.0407 13.1542 25.0291C14.9551 25.0176 16.7304 24.6013 18.3488 23.8111C19.9671 23.0209 21.3871 21.8769 22.5038 20.4639C23.6204 19.0509 24.4051 17.4049 24.7998 15.6477C25.1944 13.8905 25.189 12.0671 24.7839 10.3122C24.3788 8.5574 23.5844 6.9161 22.4595 5.50971C21.3345 4.10332 19.9077 2.96783 18.2847 2.18722C16.6617 1.40662 14.8839 1.00088 13.083 1ZM13.0682 8.21066C12.4064 8.34005 11.6819 8.76888 11.1126 9.77442C11.0526 9.88001 10.9724 9.97275 10.8766 10.0474C10.7808 10.122 10.6713 10.177 10.5542 10.2092C10.4372 10.2415 10.3149 10.2504 10.1944 10.2354C10.0739 10.2204 9.95753 10.1819 9.85194 10.1219C9.74635 10.062 9.6536 9.98179 9.57899 9.88599C9.50439 9.79019 9.44938 9.68064 9.41711 9.56358C9.38484 9.44652 9.37594 9.32425 9.39093 9.20375C9.40591 9.08326 9.44448 8.96689 9.50444 8.8613C10.3196 7.42693 11.4785 6.63766 12.7133 6.39737C13.8622 6.18019 15.0505 6.41957 16.0256 7.06464C16.9203 7.65613 17.643 8.62285 17.6652 9.78181C17.6892 10.9925 16.9535 12.0849 15.5968 12.8871C14.6763 13.4306 14.3177 13.8003 14.1643 14.0461C14.0349 14.2531 14.0072 14.4417 14.0072 14.8631C14.0072 15.1082 13.9098 15.3433 13.7365 15.5166C13.5632 15.6899 13.3281 15.7873 13.083 15.7873C12.8379 15.7873 12.6028 15.6899 12.4295 15.5166C12.2561 15.3433 12.1588 15.1082 12.1588 14.8631C12.1588 14.3603 12.1846 13.7356 12.5968 13.0701C12.985 12.4472 13.6486 11.8927 14.6578 11.2957C15.6467 10.7097 15.826 10.1533 15.8205 9.82062C15.8131 9.438 15.558 8.97035 15.0072 8.60622C14.4369 8.22892 13.7426 8.08716 13.07 8.21066H13.0682ZM13.5432 20.4083C13.1755 20.4083 12.8229 20.2623 12.563 20.0023C12.303 19.7423 12.1569 19.3897 12.1569 19.022C12.1569 18.6544 12.303 18.3017 12.563 18.0418C12.8229 17.7818 13.1755 17.6357 13.5432 17.6357C13.9109 17.6357 14.2635 17.7818 14.5235 18.0418C14.7835 18.3017 14.9295 18.6544 14.9295 19.022C14.9295 19.3897 14.7835 19.7423 14.5235 20.0023C14.2635 20.2623 13.9109 20.4083 13.5432 20.4083ZM9.45084 26.3972C10.5776 27.7093 11.975 28.762 13.547 29.4831C15.119 30.2042 16.8285 30.5765 18.558 30.5746C20.3934 30.5746 22.1365 30.1624 23.6966 29.423L28.2917 30.7114C28.6215 30.8038 28.9705 30.8028 29.2997 30.7085C29.629 30.6142 29.9255 30.4303 30.1563 30.1772C30.3871 29.9242 30.5431 29.612 30.6068 29.2755C30.6705 28.939 30.6395 28.5914 30.5172 28.2715L29.0477 24.4231C30.05 22.6316 30.5751 20.6127 30.5726 18.5599C30.5726 14.974 29.0015 11.7541 26.508 9.5526C26.7814 10.6172 26.9272 11.7105 26.9424 12.8095C28.0662 14.4454 28.7242 16.4269 28.7242 18.5599C28.7242 20.5008 28.1808 22.314 27.2363 23.8575L26.9997 24.2456L28.7926 28.9314L23.5062 27.4526L23.1827 27.6153C21.7964 28.3251 20.2252 28.7262 18.558 28.7262C16.4617 28.7294 14.4162 28.0816 12.704 26.8722C11.6046 26.8435 10.5126 26.684 9.45084 26.3972Z",fill:"white"})}),jn=()=>n.jsx("span",{role:"img","aria-label":"smile",className:"anticon anticon-smile",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 00-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 00-8-8.4z"})})}),Pn=()=>n.jsx("span",{role:"img","aria-label":"file",className:"anticon anticon-file",children:n.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:24,height:24,fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"})})}),Rn=({...e})=>n.jsx("span",{role:"img","aria-label":"loading",...e,children:n.jsx("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"loading",width:52,height:52,fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})})}),$=({type:e="",chatProps:t,...o})=>{const s=c.useMemo(()=>({minimize:Hn,expand:Bn,send:In,stop:$n,sync:Un,left:Wn,right:Gn,like:()=>n.jsx(Vn,{...t}),dislike:()=>n.jsx(zn,{...t}),delete:Kn,close:Yn,upload:qn,filter:Qn,down:Zn,"paper-clip":Jn,"chat-bubble":Xn,smile:jn,file:Pn,loading:()=>n.jsx(Rn,{...o})}),[e,t]);return n.jsx(ln,{component:s==null?void 0:s[e],...o})},Ve=c.createContext({}),J=()=>c.useContext(Ve),et=({children:e})=>{const[t,o]=c.useState("va"),s=c.useMemo(()=>t==="va",[t]);return n.jsx(Ve.Provider,{value:{activeTab:t,setActiveTab:o,isActiveTabVA:s},children:e})},nt=({...e})=>{const t=A("WeLoveToHearAboutYourExperienceWithTheSunfishChatbot","We'd love to hear about your experience with the Sunfish chatbot"),o=A("ShareAnyCommentsOrSuggestionsToHelpUsImprove","Share any comments or suggestions to help us improve"),s=A("Submit","Submit"),r=A("ThankFeedback","Thank You for your feedback"),i=A("AdditionalFeedback","Additional Feedback"),[l]=f.Form.useForm(),[a,d]=c.useState(!1),[u,C]=c.useState(""),{setChats:h}=q(),{objInitPayload:b}=F(),{activeTab:k}=J(),S=c.useMemo(()=>{var g;const T=Y(e,"feedback")?(e==null?void 0:e.feedback)==="like"||(e==null?void 0:e.feedback)==="":!0;return typeof(e==null?void 0:e.text_thumbsup_link)=="string"&&((g=e==null?void 0:e.text_thumbsup_link)==null?void 0:g.trim())!==""&&T},[e]),x=c.useMemo(()=>{var g;const T=Y(e,"feedback")?(e==null?void 0:e.feedback)==="dislike"||(e==null?void 0:e.feedback)==="":!0;return typeof(e==null?void 0:e.text_thumbsdown_link)=="string"&&((g=e==null?void 0:e.text_thumbsdown_link)==null?void 0:g.trim())!==""&&T},[e]),p=c.useMemo(()=>{if(b!=null&&b.uriBackend)try{return new URL(b.uriBackend).origin}catch{return""}return""},[b==null?void 0:b.uriBackend]),w=T=>{var m;const g=T==="like"?e==null?void 0:e.text_thumbsup_link:e==null?void 0:e.text_thumbsdown_link,{access_token:y="",companycode:E="",companyid:v="",uriBackend:_="",uriBackendEnt:M="",lang:B=""}=b||{},H=u==="another"?l==null?void 0:l.getFieldValue("ADDITIONAL_FEEDBACK"):u;(m=z({method:"POST",url:g,data:{message_id:e==null?void 0:e.id,response_type:T==="like"?"up":"down",...T==="dislike"&&{additional_feedback:H}},headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`,"company-code":`${E}`,"company-id":`${v}`,uriBackend:`${_}`,uriBackendEnt:`${M}`,"custom-origin":`${p}`,"Acc-Name":`${E.toUpperCase()}`,Language:`${B}`}}))==null||m.then(L=>{var D,I,O;(L==null?void 0:L.status)===200&&(a&&d(!1),(D=f.notification)==null||D.destroy(),(I=f.notification)==null||I.config({getContainer:()=>document.querySelector(".w-widget-content-container"),top:28,placement:"top",duration:3}),(O=f.notification)==null||O.success({message:r,className:"w-notification-content"}),h(N=>{var U;return(U=N==null?void 0:N.map(W=>{var G;if(Y(W,"chats")){const R=(G=W==null?void 0:W.chats)==null?void 0:G.map(j=>(j==null?void 0:j.indexChat)===(e==null?void 0:e.indexChat)?{...j,feedback:T}:j);return{...W,chats:R}}return(e==null?void 0:e.message_id)===(W==null?void 0:W.message_id)?{...W,feedback:T}:W}))==null?void 0:U.flat()}))})};return c.useEffect(()=>{var T;(T=f.notification)==null||T.destroy()},[k]),n.jsxs(n.Fragment,{children:[S&&n.jsx(f.Button,{icon:n.jsx($,{type:"like",chatProps:e}),onClick:()=>{(e==null?void 0:e.feedback)!=="like"&&w("like")}}),x&&n.jsx(f.Button,{icon:n.jsx($,{type:"dislike",chatProps:e}),onClick:()=>{(e==null?void 0:e.feedback)!=="dislike"&&d(!0)}}),n.jsxs(Ue,{open:a,isFeedback:!0,okText:s,onCancel:()=>{d(!1)},onOk:()=>{w("dislike")},children:[n.jsx("p",{style:{textAlign:"center",fontWeight:600,fontSize:14},children:t}),n.jsxs("p",{style:{textAlign:"center"},children:[o,"!"]}),n.jsx(f.Radio.Group,{className:"w-list-feedback-suggestion",options:Cn,optionType:"button",buttonStyle:"solid",onChange:T=>{var g;C((g=T==null?void 0:T.target)==null?void 0:g.value)}}),u==="another"&&n.jsxs(n.Fragment,{children:[n.jsx(f.Divider,{children:i}),n.jsx(f.Form,{form:l,layout:"vertical",children:n.jsx(f.Form.Item,{name:"ADDITIONAL_FEEDBACK",children:n.jsx(f.Input.TextArea,{rows:3})})})]})]})]})},tt=c.memo(nt),ot=({showFeedback:e=!0,showRegenerate:t=!0,position:o="left",...s})=>{const r=An(),{chats:i,onSendMsg:l,setChats:a,loadingRegenerate:d,currRegenerateId:u}=q(),C=c.useMemo(()=>s==null?void 0:s.sender,[s]),h=c.useMemo(()=>i==null?void 0:i.filter(p=>(p==null?void 0:p.sender)==="client"),[i]),b=c.useMemo(()=>t&&C==="response"&&(h==null?void 0:h.length)>0&&(s==null?void 0:s.indexChat)===(i==null?void 0:i.length)-1,[C,h,i,s==null?void 0:s.indexChat,t]),k=c.useMemo(()=>{switch(o){case"left":return"flex-start";case"center":return"center";case"right":return"flex-end"}},[o]),S=c.useMemo(()=>e&&(s==null?void 0:s.text_FeedbackIcons)==="hidup",[s,e]),x=()=>{const p=h==null?void 0:h[(h==null?void 0:h.length)-1],w=i==null?void 0:i[(i==null?void 0:i.length)-1];a((T=[])=>T==null?void 0:T.map((g,y)=>y===(T==null?void 0:T.length)-1&&(g==null?void 0:g.sender)==="response"?{...g,generated_id:(w==null?void 0:w.generated_id)??r}:g)),u.current=(w==null?void 0:w.generated_id)??r,l({msg:p==null?void 0:p.text,additionalConfig:{generate_id:(w==null?void 0:w.generated_id)??r},isShowLoadingResponse:d}),Z()};return n.jsx(n.Fragment,{children:n.jsxs("div",{style:{display:"flex",gap:8,justifyContent:k},children:[b&&n.jsx(f.Button,{loading:d,icon:n.jsx($,{type:"sync"}),onClick:()=>{x()}}),S&&n.jsx(tt,{...s})]})})},xe=c.memo(ot),st=({nameFallback:e="",...t})=>n.jsx(f.Image,{...typeof(t==null?void 0:t.onError)!="function"&&{fallback:pe(e)},placeholder:n.jsx(f.Skeleton.Image,{style:{width:"100%",height:"100%"}}),loading:"lazy",...t}),Le=c.memo(st),lt=({nameFallback:e="",...t})=>{const o=c.useRef(0);return n.jsx(f.Avatar,{...t,src:n.jsx(Le,{src:t==null?void 0:t.src,nameFallback:e,...t,onError:s=>{o.current+=1,(o==null?void 0:o.current)<3?s.target.src=He(t==null?void 0:t.src):s.target.src=pe(e)}})})},P=c.memo(lt);P.Group=f.Avatar.Group;const ct=()=>n.jsxs("div",{className:"lds-ellipsis",children:[n.jsx("div",{}),n.jsx("div",{}),n.jsx("div",{}),n.jsx("div",{})]}),ze=c.memo(ct),rt=()=>{const{widgetProps:e}=F();return n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n.jsx(P,{src:ue,nameFallback:e==null?void 0:e.title}),n.jsx(ze,{})]})},ve=c.memo(rt),it=({src:e,name:t})=>n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n.jsx(P,{src:e,preview:!1,nameFallback:t}),n.jsx(f.Typography.Text,{children:t})]}),ie=c.memo(it),at=({...e})=>{var C,h;const[t,o]=c.useState(1),{loadingRegenerate:s,currRegenerateId:r}=q(),{isExpand:i,widgetProps:l}=F(),a=c.useMemo(()=>e==null?void 0:e.sender,[e]),d=c.useMemo(()=>e==null?void 0:e.chats,[e==null?void 0:e.chats]),u=c.useMemo(()=>{const b=d==null?void 0:d[(d==null?void 0:d.length)-1];return(b==null?void 0:b.generated_id)===r.current},[d,e,r.current]);return c.useEffect(()=>{!s&&(d==null?void 0:d.length)>0&&(o(d==null?void 0:d.length),Z())},[s]),s&&u?n.jsx(ve,{}):n.jsxs(n.Fragment,{children:[a==="response"&&n.jsx(ie,{name:l==null?void 0:l.title,src:ue}),n.jsx("div",{style:{display:"flex",gap:8},children:d==null?void 0:d.map((b,k)=>{var p;const S=k===((p=e==null?void 0:e.chats)==null?void 0:p.length)-1,x=t===k+1;return n.jsxs("div",{style:{display:x?"flex":"none",flexDirection:"column",gap:8},className:"w-fade-in-animate",children:[n.jsx("div",{...S&&{className:`w-regenerate-chat-last ${i?"w-regenerate-chat-last-expand":""}`},children:n.jsxs("div",{className:`w-bubble-chat w-bubble-chat-regenerate ${`w-${a}`} ${i?"w-bubble-chat-regenerate-expand":""}`,children:[n.jsx(Ge,{children:b==null?void 0:b.text}),a==="response"&&n.jsx("span",{style:{fontSize:12,color:"rgba(0,0,0,0.4)"},children:b==null?void 0:b.timestamp})]})}),n.jsx(xe,{showFeedback:!0,showRegenerate:!1,...b})]},k)})}),n.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[n.jsx(xe,{showRegenerate:!0,showFeedback:!1,...e}),n.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[n.jsx(f.Button,{size:"small",shape:"circle",disabled:t===1,icon:n.jsx($,{type:"left"}),onClick:()=>{t>1&&o(b=>b-1)}}),n.jsxs(f.Typography.Text,{children:[t," / ",(C=e==null?void 0:e.chats)==null?void 0:C.length]}),n.jsx(f.Button,{size:"small",shape:"circle",disabled:t===((h=e==null?void 0:e.chats)==null?void 0:h.length),icon:n.jsx($,{type:"right"}),onClick:()=>{var b;t<((b=e==null?void 0:e.chats)==null?void 0:b.length)&&o(k=>k+1)}})]})]})]})},dt=c.memo(at),ut=({date:e,format:t,sender:o,...s})=>{var r,i;return n.jsx(f.Typography.Text,{...s,type:"secondary",style:{display:"block",fontSize:12,...o==="client"&&{textAlign:"right"},...((r=Object.keys((s==null?void 0:s.style)||{}))==null?void 0:r.length)>0&&{...s==null?void 0:s.style}},children:t?(i=K(e))==null?void 0:i.format(t):e})},ae=c.memo(ut),ft=({...e})=>{var l;const{loadingRegenerate:t,chats:o}=q(),{widgetProps:s}=F(),r=c.useMemo(()=>(o==null?void 0:o.length)-1===(e==null?void 0:e.indexChat),[o]),i=c.useMemo(()=>e==null?void 0:e.sender,[e]);return((l=e==null?void 0:e.chats)==null?void 0:l.length)>0?n.jsx(dt,{...e}):t&&r?n.jsx(ve,{}):n.jsxs(n.Fragment,{children:[i==="response"&&n.jsx(ie,{name:s==null?void 0:s.title,src:ue}),n.jsxs("div",{className:`w-bubble-chat ${`w-${i}`}`,children:[n.jsx(Ge,{children:e==null?void 0:e.text}),n.jsx(ae,{date:e==null?void 0:e.timestamp,sender:i})]}),n.jsx(xe,{...e})]})},de=c.memo(ft),gt=()=>{const e=A("PleaseUploadFile","Please upload specify file that needed to complete your request"),t=A("ClickToUpload","Click to upload"),o=A("ContinueWithoutUpload","Continue without upload"),{onSendMsg:s,setFile:r}=q(),i=()=>{s({msg:"CANCEL UPLOAD"})};return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:12},children:[n.jsx(de,{sender:"response",text:`${e}...`}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx(f.Upload,{className:"btn_upload",beforeUpload:()=>!1,fileList:[],accept:".doc, .jpg, .ods, .png, .txt, .docx, .pdf",onChange:l=>{r(l==null?void 0:l.file)},children:n.jsx(f.Button,{icon:n.jsx($,{type:"upload"}),children:t})}),n.jsx(f.Button,{type:"dashed",onClick:i,children:o})]})]})},Ct=c.memo(gt),Tt=()=>{const[e,t]=c.useState(!1),[o,s]=c.useState(!1),[r,i]=c.useState(!1),[l,a]=c.useState(3),[d,u]=c.useState(!1),[C,h]=c.useState(""),{widgetProps:b}=F(),{onSendMsg:k,chats:S}=q(),{onSubmitPYPwd:x=()=>{},onCheckPYAccess:p=()=>{}}=(b==null?void 0:b.onPayslipFn)||{},w=A("ProvidePasswordPayslip","Please provide your password account to access the download"),T=A("Cancel","Cancel"),g=A("Submit","Submit"),y=A("Password","Password"),E=A("IsRequired","Is Required"),v=A("PasswordPayslipValid","Your password is valid. Please download the payslip file"),_=A("AttemptPasswordExceeded","Your attempt to enter the password exceeded the limit"),M=A("VerifyAccessPayslip","Please wait, verifying access to your payslip"),B=A("WrongPwdPayslip","The password you entered is incorrect. Please try again or contact support if you need assistance"),H=A("SessionExpired","Session expired. Please log in again to continue"),[m]=f.Form.useForm(),L=()=>{var O,N,U;i(!0),u(!0),(U=(N=(O=p())==null?void 0:O.then(W=>{var G,R;const V=(R=(G=W==null?void 0:W.data)==null?void 0:G.DATA)==null?void 0:R.RESULT;V&&k({msg:"Valid"}),t(V),h("")}))==null?void 0:N.catch(W=>{h(W==null?void 0:W.toString())}))==null||U.finally(()=>{s(!1),u(!1)})},D=()=>{k({msg:"cancel"}),i(!1)},I=()=>{var N;const O=m==null?void 0:m.getFieldValue("pwd");(N=m==null?void 0:m.validateFields())==null||N.then(()=>{var U,W;s(!0),(W=(U=x(O))==null?void 0:U.then(({data:V})=>{var G;(G=V==null?void 0:V.DATA)!=null&&G.ISVALID?L():(h(B),a(l-1),s(!1))}))==null||W.catch(V=>{var R,j,Pe,Re,en;const G=V==null?void 0:V.response;if((G==null?void 0:G.status)===401){const Bo=(j=(R=G==null?void 0:G.data)==null?void 0:R.ERRORS)==null?void 0:j.includes("ACCESS_TOKEN_EXPIRED"),Io=(en=(Re=(Pe=G==null?void 0:G.data)==null?void 0:Pe.MESSAGE)==null?void 0:Re.toLowerCase())==null?void 0:en.includes("invalid password");Bo&&h(H),Io&&(h(B),a(l-1),s(!1))}else h(V==null?void 0:V.toString());s(!1)})})};return c.useEffect(()=>{var N;const O=S==null?void 0:S[(S==null?void 0:S.length)-1];((N=O==null?void 0:O.attachment)==null?void 0:N.type)==="show_password_wp"&&L()},[]),r?d?n.jsx(de,{sender:"response",text:`${M}...`}):l===0?n.jsx(de,{sender:"response",text:_}):C?n.jsx(de,{sender:"response",text:C}):n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx(f.Form,{form:m,layout:"vertical",children:n.jsx(f.Form.Item,{name:"pwd",label:e?v:w,rules:[{required:!0,message:`${y} ${E}`}],children:n.jsx(f.Input.Password,{...e&&{disabled:!0,style:{display:"none"}}})})}),!e&&n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx(f.Button,{disabled:o,onClick:D,children:T}),n.jsx(f.Button,{type:"primary",onClick:I,loading:o,children:g})]})]}):null},yt=c.memo(Tt),ht=({...e})=>{const{objInitPayload:t}=F(),o=c.useMemo(()=>Oe(t==null?void 0:t.access_token),[t]),s=()=>{var i,l;const r=e==null?void 0:e.attachment;(l=z({method:"POST",url:r==null?void 0:r.endpoint,data:r==null?void 0:r.body,headers:{Authorization:`Bearer ${t==null?void 0:t.access_token}`,"Content-Type":r==null?void 0:r.headers["Content-Type"],coid:t==null?void 0:t.companyid,"Company-Id":t==null?void 0:t.companyid,"Acc-Name":(i=o==null?void 0:o.INSTANCE)==null?void 0:i.toLowerCase()},responseType:"blob"}))==null||l.then(a=>{var b;const d=(b=r==null?void 0:r.body)==null?void 0:b.media,u=`${r==null?void 0:r.filename}.${d}`,C=new Blob([a==null?void 0:a.data]),h=URL==null?void 0:URL.createObjectURL(C);Ee({downloadURL:h,fileName:u}),URL.revokeObjectURL(h)})};return n.jsx(f.Button,{onClick:s,children:"Download file"})},bt=c.memo(ht),kt=({...e})=>{const t=c.useRef(),o=A("DownloadChart","Download Chart"),s=c.useMemo(()=>e==null?void 0:e.attachment,[e==null?void 0:e.attachment]),r=c.useMemo(()=>{var l;return(l=s==null?void 0:s.data)==null?void 0:l.map((a,d)=>{var u,C;return{label:(u=s==null?void 0:s.labels)==null?void 0:u[d],value:a,color:(C=s==null?void 0:s.colors)==null?void 0:C[d]}})},[s]),i=()=>{var a;const l=(a=document==null?void 0:document.querySelector(".chart_widget canvas"))==null?void 0:a.toDataURL();Ee({fileName:s==null?void 0:s.title,downloadURL:l})};return n.jsxs(n.Fragment,{children:[n.jsx(cn.Pie,{className:"chart_widget",ref:t,data:r,angleField:"value",colorField:"label",label:{text:"label",style:{fontWeight:"bold"}},legend:{color:{title:!0,position:"bottom",rowPadding:5}}}),n.jsx("div",{style:{textAlign:"center"},children:n.jsx(f.Button,{onClick:()=>{i()},children:o})})]})},St=c.memo(kt),Et=({...e})=>{var t,o,s,r,i;switch(!0){case((t=se(e))==null?void 0:t.text):return n.jsx(de,{...e});case((o=se(e))==null?void 0:o.upload):return n.jsx(Ct,{...e});case((s=se(e))==null?void 0:s.password):return n.jsx(yt,{...e});case((r=se(e))==null?void 0:r.filedownload):return n.jsx(bt,{...e});case((i=se(e))==null?void 0:i.chart):return n.jsx(St,{...e});default:return null}},At=c.memo(Et),wt=()=>{const{isOpenWidget:e,widgetProps:t}=F(),{chats:o,isWaitResponse:s}=q(),{activeTab:r}=J();return c.useEffect(()=>{Z()},[r]),e?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-bubble-chat-container",children:o==null?void 0:o.map((i,l)=>{var d;const a=(d=se(i))==null?void 0:d.text;return n.jsxs(c.Fragment,{children:[(i==null?void 0:i.sender)==="response"&&!a&&n.jsx(ie,{name:t==null?void 0:t.title,src:ue}),n.jsx(At,{indexChat:l,...i})]},l)})}),s&&n.jsx(ve,{})]}):null},pt=c.memo(wt),xt=()=>{var g;const e=A("ContinueWithoutUpload","Continue without Upload"),{onSendMsg:t,setChats:o,isWaitResponse:s,loadingRegenerate:r,file:i,setFile:l,chats:a,connected:d}=q(),{isActiveTabVA:u}=J(),C=c.useMemo(()=>{var E;const y=a==null?void 0:a[(a==null?void 0:a.length)-1];return(y==null?void 0:y.sender)==="response"&&((E=y==null?void 0:y.attachment)==null?void 0:E.type)==="fileuploader"},[a]),h=c.useRef(),[b,k]=c.useState(!1),[S,x]=c.useState(!1),p=c.useMemo(()=>s||!S,[S,s]),w=()=>{var v,_,M,B;const y=(M=(_=(v=h==null?void 0:h.current)==null?void 0:v.resizableTextArea)==null?void 0:_.textArea)==null?void 0:M.value;if(!(y!=null&&y.trim())||s)return;x(!1),t({msg:y}),k(!b);const E={text:y,sender:"client",type:"text",timestamp:(B=K())==null?void 0:B.format("hh:mm A")};o(H=>[...H,E]),Z()},T=()=>{t({msg:"SKIP_WAITING_RESPONSE"})};return c.useEffect(()=>{var y;h!=null&&h.current&&u&&((y=h==null?void 0:h.current)==null||y.focus())},[u]),C?n.jsxs("div",{className:"w-input-container",style:{alignItems:"center"},children:[n.jsx(f.Typography.Text,{children:i==null?void 0:i.name}),((g=Object==null?void 0:Object.keys(i||{}))==null?void 0:g.length)>0?n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n.jsx(f.Button,{danger:!0,icon:n.jsx($,{type:"delete"}),shape:"circle",onClick:()=>l({})}),n.jsx(f.Button,{className:"w-send-btn",style:{backgroundColor:"var(--primary-color, #395ebc)"},icon:n.jsx($,{type:"send"}),shape:"circle",onClick:w})]}):n.jsx(f.Tooltip,{title:e,children:n.jsx(f.Button,{icon:n.jsx($,{type:"close"}),shape:"circle",onClick:()=>{t({msg:"CANCEL UPLOAD"})}})})]}):n.jsxs("div",{className:"w-input-container",children:[n.jsx(f.Input.TextArea,{className:"w-input-widget",disabled:!d,ref:h,placeholder:"Type a message...",onKeyDown:y=>{((y==null?void 0:y.code)==="Enter"||(y==null?void 0:y.key)==="Enter")&&!(y!=null&&y.shiftKey)&&w()},onChange:({target:{value:y}})=>{const E=/\S/;ge({input_va_value:y}),y&&(E!=null&&E.test(y))?x(!0):y!=null&&y.trim()||x(!1)}},b),s||r?n.jsx(f.Button,{style:{border:"none"},icon:n.jsx($,{type:"stop"}),shape:"circle",onClick:T,size:"large"}):n.jsx(f.Button,{className:`w-send-btn ${p?"w-send-btn-disabled":""}`,disabled:p,style:{backgroundColor:"var(--primary-color, #395ebc)"},icon:n.jsx($,{type:"send"}),shape:"circle",onClick:w})]})},Lt=c.memo(xt),vt=({taskStatus:e})=>{const t=A("InProgress","In Progress"),o=A("New","New"),s=A("Closed","Closed"),r=A("Done","Done"),i=A("HDCancelled","Cancelled"),l={"In Progress":t,Open:o,New:o,Closed:s,Fixed:r,Cancelled:i},a={"In Progress":"#FFF2D6",Responded:"#FFF2D6",Open:"#e9e2f8",Reopen:"#e9e2f8",Closed:"#e1ebfd",Fixed:"#bbfab7",Done:"#bbfab7",Cancelled:"#FFF2D6"},d=c.useMemo(()=>a[e]||a.Closed,[e]),u=c.useMemo(()=>l[e]||e,[e]);return n.jsx(f.Tag,{color:d,children:n.jsx(f.Typography.Text,{className:"primary-color-active",style:{width:"100%",textAlign:"center"},ellipsis:{tooltip:u},children:u})},e)},Ke=c.memo(vt),_t=({onClick:e,...t})=>n.jsxs("div",{className:"w-ticket-card-container",...typeof e=="function"&&{onClick:e},children:[n.jsx(f.Typography.Text,{strong:!0,style:{color:"var(--primary-color, #395ebc)",fontSize:16,marginBottom:10,display:"block"},children:t==null?void 0:t.TASK_NAME}),n.jsxs("div",{className:"w-ticket-card-content-container",children:[n.jsxs("div",{className:"w-ticket-card-cat-code",children:[n.jsx(f.Typography.Text,{children:(t==null?void 0:t.TASK_CATEGORY)||De}),n.jsx(f.Typography.Text,{children:(t==null?void 0:t.TASK_CODE)||De})]}),n.jsxs("div",{className:"w-ticket-card-status-date",style:{alignItems:"flex-end"},children:[n.jsx(Ke,{taskStatus:t==null?void 0:t.TASK_STATUS}),n.jsx(f.Typography.Text,{children:t==null?void 0:t.CREATED_DATE})]})]})]}),Dt=c.memo(_t),Ye=()=>{const{objInitPayload:e,setObjInitPayload:t,parsedJWT:o}=F(),s=c.useMemo(()=>{var i;return{Authorization:`Bearer ${e==null?void 0:e.access_token}`,coid:o==null?void 0:o.COID,"Acc-Name":(i=o==null?void 0:o.INSTANCE)==null?void 0:i.toLowerCase(),"Company-Id":e==null?void 0:e.companyid,Language:e==null?void 0:e.lang}},[e]);return async i=>{var u,C,h;const{onSuccess:l,onError:a,onFinally:d}=i??{};(h=(C=(u=z({url:e==null?void 0:e.uriBackend,params:{ofid:"sfsystem.RefreshToken",accname:e==null?void 0:e.companycode},data:{refreshtoken:(e==null?void 0:e.refresh_token)||"4D8C30EE29749D0F06B4F6E2527516B397C09D4DB148D42214E2941C7A86139D3CB512D925E1B098C6090A45E6BCC545723222FA3BABDC2A"},headers:s,method:"POST"}))==null?void 0:u.then(b=>{var x;const k=(x=b==null?void 0:b.data)==null?void 0:x.DATA,S={access_token:k==null?void 0:k.JWT_TOKEN,refresh_token:e==null?void 0:e.refresh_token,uagent:e==null?void 0:e.uagent,uriBackend:e==null?void 0:e.uriBackend,uriService:e==null?void 0:e.uriService,companyid:e==null?void 0:e.companyid,companycode:e==null?void 0:e.companycode,lang:e==null?void 0:e.lang,uriBackendEnt:e==null?void 0:e.uriBackendEnt,uriBackendHRMGO:e==null?void 0:e.uriBackendHRMGO,config:e==null?void 0:e.config};t(S),typeof l=="function"&&l(b)}))==null?void 0:C.catch(b=>{typeof a=="function"&&a(b)}))==null||h.finally(()=>{typeof d=="function"&&d()})}},Te=()=>{var l;const e=c.useRef(new AbortController),{objInitPayload:t,parsedJWT:o}=F(),s=Ye(),r={Authorization:`Bearer ${t==null?void 0:t.access_token}`,coid:o==null?void 0:o.COID,"Acc-Name":(l=o==null?void 0:o.INSTANCE)==null?void 0:l.toLowerCase(),"Company-Id":t==null?void 0:t.companyid,Language:t==null?void 0:t.lang},i=async({url:a,endpoint:d,method:u="POST",headers:C,...h})=>{var x,p,w,T,g;const b={url:a||`${t==null?void 0:t.uriBackendHRMGO}${d}`,...e.current&&{signal:(x=e==null?void 0:e.current)==null?void 0:x.signal},headers:{...r,...C,"Company-Code":t==null?void 0:t.companycode},method:u,...h},k=z==null?void 0:z.create(b);return(w=(p=k==null?void 0:k.interceptors)==null?void 0:p.request)==null||w.use(y=>(t!=null&&t.access_token&&(y.headers.Authorization=`Bearer ${t==null?void 0:t.access_token}`),y),y=>{Promise.reject(y)}),(g=(T=k==null?void 0:k.interceptors)==null?void 0:T.response)==null||g.use(y=>y,async y=>{var v;const E=y==null?void 0:y.config;if(((v=y==null?void 0:y.response)==null?void 0:v.status)===401){const _=await s();return E.headers.Authorization=`Bearer ${_}`,z(E)}return Promise==null?void 0:Promise.reject(y)}),await(k==null?void 0:k.request(b))};return i.abort=()=>{var a;e!=null&&e.current&&((a=e==null?void 0:e.current)==null||a.abort(),e.current=new AbortController)},c.useEffect(()=>()=>i.abort(),[]),i},qe=c.createContext({}),Q=()=>c.useContext(qe),Mt=({children:e})=>{const t=Te(),[o,s]=c.useState([]),[r,i]=c.useState(""),[l,a]=c.useState(!1),[d,u]=c.useState(!0),[C,h]=c.useState(0),b=k=>{var S,x,p,w;u(!0),(w=(p=t({endpoint:"/helpdesk/myticket/ticket-list",method:"POST",data:{LIMIT:20,PAGE:1,SEARCH:{MY_TICKET:!0,TASK_MODULE:"HD",...((S=Object.keys(k||{}))==null?void 0:S.length)>0&&{...k,...(k==null?void 0:k.CREATED_DATE)&&{CREATED_DATE:(x=K(k==null?void 0:k.CREATED_DATE))==null?void 0:x.format(ye)}}},SORT:{FIELD:"t.created_date",ORDER:"DESC"}}}))==null?void 0:p.then(T=>{var g,y,E;(g=T==null?void 0:T.data)!=null&&g.DATA&&s((E=(y=T==null?void 0:T.data)==null?void 0:y.DATA)==null?void 0:E.LIST)}))==null||w.finally(()=>{u(!1)})};return c.useEffect(()=>{b()},[]),n.jsx(qe.Provider,{value:{listTicket:o,ticketId:r,setTicketId:i,getListTicket:b,openFilter:l,setOpenFilter:a,loadingListTicket:d,countFilters:C,setCountFilters:h},children:e})},Ot=()=>{const e=A("SubjectSearch","Subject Search"),t=A("AdvanceFilter","Advance Filter"),o=c.useRef(null),{getListTicket:s,setOpenFilter:r,loadingListTicket:i,countFilters:l}=Q();return n.jsx(n.Fragment,{children:n.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12},children:[n.jsx(f.Input,{placeholder:e,onChange:({target:{value:a}})=>{clearTimeout(o==null?void 0:o.current),o.current=setTimeout(()=>{s({TASK_NAME:a})},250)},allowClear:!0}),n.jsx(f.Tooltip,{title:`${t} (${l})`,children:n.jsx(f.Badge,{count:l,children:n.jsx(f.Button,{loading:i,icon:n.jsx($,{type:"filter"}),onClick:()=>{r(!0)}})})})]})})},mt=c.memo(Ot),Qe=c.createContext({}),X=()=>c.useContext(Qe),Ft=({children:e})=>{const t=c.useRef(null),o=c.useRef(0),s=c.useRef(!1),r=c.useRef(null),[i,l]=c.useState([]),[a,d]=c.useState(0),{objInitPayload:u,parsedJWT:C,isFirstRenderHelpdesk:h,setShowReadyWSHD:b}=F(),k=Ye(),S=T=>{const g=new WebSocket(T);g.onopen=()=>{s.current=!0,o.current=0,d(0),b(!0)},g.onerror=y=>{b(!1),console.error(`${oe} - WebSocket error:`,y)},g.onclose=y=>{console.warn(`${oe} - WebSocket disconnected:`,y),s.current=!1,b(!1),!(y!=null&&y.wasClean)&&(o==null?void 0:o.current)<re&&(o.current+=1,d(E=>E+1),clearTimeout(r.current),r.current=setTimeout(x,2e3))},g.onmessage=p(g),t.current=g},x=async()=>{var H,m,L;if(((H=t.current)==null?void 0:H.readyState)===(WebSocket==null?void 0:WebSocket.CONNECTING))return;const{access_token:T,companyid:g="",companycode:y="",lang:E="",uriBackendHRMGO:v=""}=u??{};if(!T||!g||!y){console.warn(`${oe} - Missing required WebSocket credentials.`);return}const _=`Bearer ${T}`,M=(m=`${v}/ws`)==null?void 0:m.replace("https://","wss://"),B={COMPANY_ID:g.toString(),COMPANY_CODE:y.toLowerCase(),LANGUAGE:E,ACC_NAME:(L=C==null?void 0:C.INSTANCE)==null?void 0:L.toLowerCase(),TOKEN:_};try{const D=await Ln(B,Sn);if(!D||s.current||(o==null?void 0:o.current)>=re){console.warn(`${oe} - Skipping WebSocket connection attempt.`);return}t.current&&t.current.close(),S(`${M}?t=${D}`)}catch(D){console.error(`${oe} - Failed to encrypt token:`,D)}},p=T=>g=>{var y;try{if((g==null?void 0:g.data)==="PING")T.send("PONG");else{const{DATA:E,EVENT:v}=JSON.parse(g.data||"{}");!h.current&&v==="USER_ONLINE_NOTIF"&&Array.isArray(E==null?void 0:E.EMPLOYEES)&&(l((y=E==null?void 0:E.EMPLOYEES)==null?void 0:y.filter(Boolean)),h.current=!0),v==="TOKEN_EXPIRED"&&k({onSuccess:()=>{x()}})}}catch{console.error(`${oe} - Invalid WebSocket message:`,g.data)}},w=({event:T,data:g,module:y="HELPDESK_CHAT"})=>{var E;(E=t==null?void 0:t.current)==null||E.send(JSON.stringify({EVENT:T,DATA:g,MODULE:y}))};return c.useEffect(()=>{h.current||x()},[]),n.jsx(Qe.Provider,{value:{ws:t==null?void 0:t.current,onSendMsg:w,userOnline:i,connectWebSocket:x,retryCountState:a,setRetryCountState:d,retryCountRef:o},children:e})},Nt=()=>{var l;const{widgetProps:e}=F(),{listTicket:t,setTicketId:o,loadingListTicket:s}=Q(),{onSendMsg:r}=X(),{xs:i}=f.Grid.useBreakpoint();return n.jsxs(n.Fragment,{children:[n.jsx(mt,{}),s?n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:(l=Array.from({length:5}))==null?void 0:l.map((a,d)=>n.jsx(f.Skeleton.Input,{style:{height:80,width:"100%",borderRadius:8}},d))}):n.jsx("div",{className:`w-list-ticket-container ${e!=null&&e.isSF?"w-list-ticket-container-sf":""} ${i?"w-list-ticket-container-mobile":""}`,...(t==null?void 0:t.length)===0&&{style:{justifyContent:"center"}},children:(t==null?void 0:t.length)>0?t==null?void 0:t.map((a,d)=>c.createElement(Dt,{...a,key:d,onClick:()=>{r({event:"JOIN_ROOM",data:{TASK_ID:a==null?void 0:a.TASK_ID}}),o(a==null?void 0:a.TASK_ID)}})):n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",flex:1},children:n.jsx(f.Empty,{})})})]})},Ht=c.memo(Nt),Bt=({children:e,open:t,onClose:o,footer:s,styleContainer:r})=>{var b;const[i,l]=c.useState(!1),a=c.useRef(),d=c.useRef(null),u=c.useRef(),C=c.useMemo(()=>t?"w-fade-in-animate":"w-fade-out-animate",[t]),h=k=>{k.code==="Escape"&&!k.shiftKey&&!k.altKey&&!k.ctrlKey&&k.key==="Escape"&&(k.stopPropagation(),typeof o=="function"&&o())};return c.useEffect(()=>{const k=u.current;return k&&(clearTimeout(d.current),d.current=setTimeout(()=>{k==null||k.focus()},250),k==null||k.addEventListener("keydown",h)),t&&l(!1),clearTimeout(a==null?void 0:a.current),a.current=setTimeout(()=>{t||l(!0)},300),()=>{k&&(k==null||k.removeEventListener("keydown",h))}},[t]),n.jsxs("div",{className:`${C}`,tabIndex:1,ref:u,style:{display:i?"none":"block",height:"100%",...((b=Object==null?void 0:Object.keys(r||{}))==null?void 0:b.length)>0&&{...r}},children:[e,s&&s]})},Ze=c.memo(Bt),Je=c.createContext({}),le=()=>c.useContext(Je),It=({children:e})=>{const[t,o]=c.useState([]),[s,r]=c.useState({}),[i,l]=c.useState(!0),a=c.useRef(!1),d=Te(),{ticketId:u}=Q(),{ws:C}=X(),h=c.useMemo(()=>{var y;const p=(s==null?void 0:s.CREATED_BY)??{},w=(s==null?void 0:s.ASSIGNEE)??{},T=(s==null?void 0:s.OTHER_ASSIGNEE)??[],g=(y=[p,w,...T].map(E=>({...E})))==null?void 0:y.filter(E=>{var v;return((v=Object.keys(E||{}))==null?void 0:v.length)>0});return Ae({ArrObj:g,key:"EMP_ID"})},[s]),b=()=>{var p,w;l(!0),(w=(p=d({endpoint:"/helpdesk/chat/list",method:"POST",data:{LIMIT:10,PAGE:1,TASK_ID:u}}))==null?void 0:p.then(T=>{var g,y,E,v,_,M;if(((E=(y=(g=T==null?void 0:T.data)==null?void 0:g.DATA)==null?void 0:y.LIST)==null?void 0:E.length)>0){const B=(M=(_=(v=T==null?void 0:T.data)==null?void 0:v.DATA)==null?void 0:_.LIST)==null?void 0:M.map(H=>({...H,ACTOR:{...H==null?void 0:H.ACTOR}}));o(Ce(B))}else o({})}))==null||w.finally(()=>{l(!1)})},k=()=>{var p;(p=d({endpoint:"/helpdesk/myticket/get",method:"POST",data:{TASK_ID:u}}))==null||p.then(w=>{var T,g,y;if((T=w==null?void 0:w.data)!=null&&T.DATA){const E=(y=(g=w==null?void 0:w.data)==null?void 0:g.DATA)==null?void 0:y.LIST;r(E)}else r({})})},S=p=>{a.current||o(w=>{const g=[...we(w),{...p,CHAT_ALIGN:"from"}];return Ce(g)}),a.current=!1},x=p=>{if((p==null?void 0:p.data)!=="PING"){const w=JSON.parse((p==null?void 0:p.data)||"{}"),{DATA:T={},EVENT:g=""}=w??{};(g==="RECEIVE_MESSAGE"||g==="RECEIVE_ANOTHER_MESSAGE")&&S(T)}};return c.useEffect(()=>(u&&(b(),k()),C&&u&&(C==null||C.addEventListener("message",x)),()=>{C&&u&&(C==null||C.removeEventListener("message",x))}),[u]),n.jsx(Je.Provider,{value:{chats:t,setChats:o,detailTicket:s,employees:h,isFromSelf:a,loadingChats:i},children:e})},$t=()=>{const{xs:e}=f.Grid.useBreakpoint(),{employees:t,detailTicket:o,loadingChats:s}=le(),{setTicketId:r}=Q(),{userOnline:i}=X(),l=c.useMemo(()=>{var d;return(d=t==null?void 0:t.map(u=>u==null?void 0:u.FULL_NAME))==null?void 0:d.join(", ")},[t]),a=c.useMemo(()=>e?"click":"hover",[e]);return s?n.jsxs("div",{className:"w-ticket-detail-header-container",children:[n.jsx(f.Skeleton.Avatar,{}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx(f.Skeleton.Input,{}),n.jsx(f.Skeleton.Input,{size:"small"})]}),n.jsx(f.Skeleton.Input,{})]}):n.jsxs("div",{className:"w-ticket-detail-header-container",children:[n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx(f.Button,{icon:n.jsx($,{type:"down"}),style:{border:"none"},onClick:()=>{r("")}}),n.jsx(P.Group,{maxCount:2,maxPopoverTrigger:a,maxStyle:{color:"#f56a00",backgroundColor:"#fde3cf",cursor:"pointer"},children:t==null?void 0:t.map((d,u)=>{const C=i==null?void 0:i.includes(d==null?void 0:d.EMP_ID);return n.jsx(f.Tooltip,{title:d==null?void 0:d.FULL_NAME,trigger:a,children:c.createElement(P,{...C&&{style:{border:"2px solid green",borderRadius:"50%"}},src:d==null?void 0:d.PHOTO,key:u,nameFallback:d==null?void 0:d.FULL_NAME})},u)})}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",width:150},children:[n.jsx(f.Tooltip,{title:`${o==null?void 0:o.TASK_CODE} - ${o==null?void 0:o.SUBJECT}`,trigger:a,children:n.jsxs(f.Typography.Text,{className:"w-ticket-detail-header-text",children:[o==null?void 0:o.TASK_CODE," - ",o==null?void 0:o.SUBJECT]})}),n.jsx(f.Tooltip,{title:l,trigger:a,children:n.jsx(f.Typography.Text,{type:"secondary",className:"w-ticket-detail-header-text",style:{fontSize:12},children:l})})]})]}),n.jsx(Ke,{taskStatus:o==null?void 0:o.STATUS})]})},Ut=c.memo($t),Wt=({...e})=>{const t=c.useMemo(()=>(e==null?void 0:e.CHAT_ALIGN)==="to"?"client":"response",[e]);return n.jsxs("div",{className:`w-bubble-chat ${`w-${t}`}`,children:[n.jsx("p",{dangerouslySetInnerHTML:{__html:e==null?void 0:e.MESSAGE}}),n.jsx(ae,{date:e==null?void 0:e.CREATED_DATE,format:fe,sender:t})]})},Gt=c.memo(Wt),Vt=({...e})=>{const t=A("Download","Download"),o=c.useMemo(()=>(e==null?void 0:e.CHAT_ALIGN)==="to"?"client":"response",[e]),s=c.useMemo(()=>{var d;const a=e==null?void 0:e.ATTACHMENT;if(a)try{const u=new URL(a),C=(d=u==null?void 0:u.pathname)==null?void 0:d.split("/");return C==null?void 0:C[(C==null?void 0:C.length)-1]}catch{return a}return""},[e]),r=c.useMemo(()=>{if(s!=null&&s.includes(".")){const a=s==null?void 0:s.split(".");return`.${a==null?void 0:a[(a==null?void 0:a.length)-1]}`}return""},[e,s]),i=c.useMemo(()=>he==null?void 0:he.includes(r),[e,r]),l=()=>{Ee({downloadURL:e==null?void 0:e.ATTACHMENT,fileName:s,isOpenNewTab:!0})};return n.jsx(n.Fragment,{children:n.jsxs("div",{className:`w-bubble-chat ${`w-${o}`}`,style:{display:"flex",flexDirection:"column"},children:[i?n.jsx(Le,{src:e==null?void 0:e.ATTACHMENT,fallback:kn}):n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n.jsx($,{type:"file"}),n.jsx(f.Typography.Link,{onClick:l,style:{display:"block",width:160},children:s})]}),i&&n.jsx(f.Button,{onClick:l,style:{display:"block",margin:"10px auto 0px"},children:t}),n.jsx(ae,{date:e==null?void 0:e.CREATED_DATE,format:fe,...o==="client"&&{style:{alignSelf:"flex-end"}}})]})})},zt=c.memo(Vt),Kt=({...e})=>{const t=c.useMemo(()=>(e==null?void 0:e.CHAT_ALIGN)==="to"?"client":"response",[e]);return n.jsxs("div",{className:"w-ticket-info-chat-container",children:[n.jsx(ae,{date:e==null?void 0:e.CREATED_DATE,format:fe,sender:t}),n.jsx(f.Typography.Text,{children:e==null?void 0:e.MESSAGE})]})},Yt=c.memo(Kt),Xe=()=>{const{widgetProps:e}=F(),t=ee.enc.Hex.parse(ee.enc.Utf8.parse(e==null?void 0:e.keyEncrypt).toString()),o={mode:ee.mode.ECB,padding:ee.pad.Pkcs7},s=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|GreatDayHR/i.test(navigator.userAgent),r=l=>{if(typeof l=="number"&&(l=l.toString()),!l)return"";if(s)return window.encodeURIComponent(l);const a=ee.enc.Utf8.parse(l),d=ee.AES.encrypt(a,t,o).toString();return window.encodeURIComponent(`$${d}`)};return{paramsEncrypt:l=>{const[a,d=null]=l.split("?"),u=a.split("/").map(C=>{const[,h=null]=C.split(":");return h&&(e!=null&&e.keyEncrypt)?r(h):C}).join("/");return d?`${u}?${d}`:u},encrypt:r}},qt=({...e})=>{const t=A("ViewFAQ","View FAQ"),o=A("FAQUnavailable","FAQ unavailable"),s=A("ThisFAQIsUnavailable","This FAQ is unavailable"),{paramsEncrypt:r}=Xe(),{history:i}=F(),l=c.useMemo(()=>(e==null?void 0:e.CHAT_ALIGN)==="to"?"client":"response",[e]),a=c.useMemo(()=>e==null?void 0:e.FAQ_ID,[e]);return n.jsxs("div",{className:`w-bubble-chat ${`w-${l}`}`,children:[n.jsx(f.Typography.Text,{style:{backgroundColor:"rgb(244, 245, 246)",padding:8,borderRadius:8,fontWeight:600,marginBottom:8,display:"block"},children:a?e==null?void 0:e.MESSAGE:o}),a?n.jsx(f.Button,{block:!0,onClick:()=>{typeof i<"u"&&i.push(r(`/standard/hrm.helpdesk.FAQ-detail/:${a}`))},children:t}):n.jsx(f.Typography.Text,{children:s}),n.jsx(ae,{date:e==null?void 0:e.CREATED_DATE,format:fe,sender:l})]})},Qt=c.memo(qt),Zt=({...e})=>{switch(e==null?void 0:e.CHAT_TYPE){case"info":return n.jsx(Yt,{...e});case"faq":return n.jsx(Qt,{...e});case"chat":return e!=null&&e.ATTACHMENT?n.jsx(zt,{...e}):n.jsx(Gt,{...e});default:return null}},Jt=c.memo(Zt),Xt=()=>{const{employees:e}=le(),[t,o]=c.useState([]),s=A("And","and"),r=A("IsTyping","Is Typing"),i=A("People","People"),{ws:l}=X(),a=c.useMemo(()=>{const u=t==null?void 0:t.map(C=>C==null?void 0:C.FULL_NAME);if((t==null?void 0:t.length)>2){const C=u==null?void 0:u.filter((b,k)=>k<=1),h=u==null?void 0:u.filter((b,k)=>k>1);return`${C==null?void 0:C.join(", ")}, ${s} ${h==null?void 0:h.length} ${i} ${r}`}return`${u==null?void 0:u.join(", ")} ${r}`},[t]),d=u=>{if((u==null?void 0:u.data)!=="PING"){const C=JSON.parse((u==null?void 0:u.data)||"{}"),{DATA:h={},EVENT:b=""}=C??{};if(b==="TYPING"){const k=e==null?void 0:e.find(x=>(x==null?void 0:x.EMP_ID)===(h==null?void 0:h.EMPLOYEE_ID)),S={...h,...k};o(x=>{const p=[...x,S],w=Ae({ArrObj:p,key:"EMPLOYEE_ID"});return w==null?void 0:w.filter(T=>T==null?void 0:T.IS_TYPING)})}}};return c.useEffect(()=>(l&&(l==null||l.addEventListener("message",d)),()=>{l&&(l==null||l.removeEventListener("message",d))}),[e]),(t==null?void 0:t.length)===0?null:n.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n.jsx(P.Group,{maxCount:2,maxPopoverTrigger:"click",maxStyle:{color:"#f56a00",backgroundColor:"#fde3cf",cursor:"pointer"},children:t==null?void 0:t.map((u,C)=>n.jsx(f.Tooltip,{title:u==null?void 0:u.FULL_NAME,children:n.jsx(P,{src:u==null?void 0:u.PHOTO,nameFallback:u==null?void 0:u.FULL_NAME})},C))}),n.jsx(f.Typography.Text,{children:a}),(t==null?void 0:t.length)>0?n.jsx(ze,{}):null]})},jt=c.memo(Xt),Pt=()=>{var i;const{chats:e}=le(),{widgetProps:t}=F(),{activeTab:o}=J(),s=c.useRef(),{xs:r}=f.Grid.useBreakpoint();return c.useEffect(()=>{clearTimeout(s.current),s.current=setTimeout(()=>{Z(".w-ticket-detail-content-container")},350)},[o]),n.jsxs("div",{className:`w-ticket-detail-content-container ${r?t!=null&&t.isSF?"w-ticket-detail-content-container-sf-mobile":"w-ticket-detail-content-container-mobile":""} `,children:[(i=Object.keys(e||{}))==null?void 0:i.map(l=>{var d,u;const a=e==null?void 0:e[l];return n.jsxs(c.Fragment,{children:[n.jsx("div",{className:"w-datekey-chats",children:(d=K(l))==null?void 0:d.format("ddd, DD MMMM YYYY")}),n.jsx("div",{className:"w-bubble-chat-container",children:(u=Ne(a))==null?void 0:u.map((C,h)=>{var S,x;const b=(C==null?void 0:C.CHAT_ALIGN)==="to"?"client":"response",k=C==null?void 0:C.CHAT_TYPE;return n.jsxs(c.Fragment,{children:[b==="response"&&k!=="info"&&n.jsx(ie,{src:(S=C==null?void 0:C.ACTOR)==null?void 0:S.PHOTO,name:(x=C==null?void 0:C.ACTOR)==null?void 0:x.FULL_NAME}),n.jsx(Jt,{...C})]},h)})})]},l)}),n.jsx(jt,{})]})},Rt=c.memo(Pt),eo=()=>{var i,l;const{chats:e,loadingChats:t}=le(),{widgetProps:o}=F(),{xs:s}=f.Grid.useBreakpoint(),r=c.useMemo(()=>{var d;const a=[ke];return s&&(o!=null&&o.isSF?a==null||a.push(`${ke}-sf-mobile`):a==null||a.push(`${ke}-mobile`)),(d=a==null?void 0:a.filter(Boolean))==null?void 0:d.join(" ")},[s,o==null?void 0:o.isSF]);return t?n.jsx("div",{className:`${r} w-ticket-detail-loading-chats`,children:(i=Array.from({length:3}))==null?void 0:i.map((a,d)=>{const u=d%2===0;return n.jsxs("div",{style:{display:"flex",gap:8,...u&&{alignSelf:"flex-end"}},children:[n.jsx("div",{style:{order:u?2:1},children:n.jsx(f.Skeleton.Avatar,{})}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,order:u?1:2},children:[n.jsx(f.Skeleton.Input,{style:{width:120,borderRadius:8}}),n.jsx(f.Skeleton.Input,{style:{height:50,width:"100%",borderRadius:8}})]})]},d)})}):((l=Object.keys(e||{}))==null?void 0:l.length)===0?n.jsx("div",{className:r,style:{display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsx(f.Empty,{})}):n.jsx(Rt,{})},no=c.memo(eo),to=({...e})=>{const t=c.useRef(0);return n.jsxs("div",{style:{display:"flex",gap:8},onClick:o=>{o==null||o.stopPropagation()},children:[n.jsx(Le,{nameFallback:e==null?void 0:e.FULL_NAME,src:e==null?void 0:e.PHOTO,width:80,placeholder:n.jsx(f.Skeleton.Image,{style:{width:"100%",height:"100%"}}),style:{borderRadius:8},preview:!1,loading:"lazy",onError:o=>{t.current+=1,(t==null?void 0:t.current)<3?o.target.src=He(e==null?void 0:e.PHOTO):o.target.src=pe(e==null?void 0:e.FULL_NAME)}}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx(f.Typography.Text,{strong:!0,style:{fontSize:18},children:e==null?void 0:e.FULL_NAME}),n.jsx(f.Typography.Text,{children:e==null?void 0:e.POSITION_NAME},e==null?void 0:e.POSITION_NAME),n.jsx(f.Typography.Text,{children:e==null?void 0:e.DEPT_NAME}),n.jsx(f.Typography.Text,{children:e==null?void 0:e.WORKLOCATION})]})]})},oo=c.memo(to),so=({setLoadingUpload:e,isLoadingUpload:t})=>{var w,T;const o=Te(),[s,r]=c.useState({}),i=c.useRef(null),l=A("ImageMustSmallerThan","Image must smaller than"),a=A("MaximumFileSizeExceeded","Maximum file size exceeded"),{onSendMsg:d}=X(),{employees:u,setChats:C,isFromSelf:h}=le(),{ticketId:b}=Q(),{activeTab:k}=J(),S=()=>{var g;(g=o({endpoint:"/upload/get-upload-config",data:{LIMIT:1,PAGE:1,SEARCH:{UPLOAD_CODE:"helpdesk"}}}))==null||g.then(y=>{var v,_;const E=(_=(v=y==null?void 0:y.data)==null?void 0:v.DATA)==null?void 0:_.LIST;(E==null?void 0:E.length)>0&&r(E==null?void 0:E[0])})},x=g=>{var v,_,M;const y=g.size/1024/1024,E=(s==null?void 0:s.MAXFILESIZE)/1024;return y>E&&((v=f.notification)==null||v.destroy(),(_=f.notification)==null||_.config({getContainer:()=>document.querySelector(".w-widget-content-container"),top:28,placement:"top"}),(M=f.notification)==null||M.error({message:a,description:`${l} ${E==null?void 0:E.toFixed(1)} MB!`,className:"w-notification-content",duration:3})),!1},p=g=>{var E,v;e(!0);const y=new FormData;y.append("UPLOAD_CODE",s==null?void 0:s.UPLOAD_CODE),y.append("UPLOAD_TYPE",s==null?void 0:s.UPLOAD_TYPE),y.append("FILE",g),(v=(E=o({endpoint:"/upload/temp",data:y,headers:{"Content-Type":"multipart/form-data"}}))==null?void 0:E.then(_=>{var M,B,H,m,L;if((B=(M=_==null?void 0:_.data)==null?void 0:M.DATA)!=null&&B.LIST){const D=(m=(H=_==null?void 0:_.data)==null?void 0:H.DATA)==null?void 0:m.LIST,I={ATTACHMENT:D==null?void 0:D.VIEW_PATH,FAQ_ID:null,MESSAGE:"",CREATED_DATE:(L=K())==null?void 0:L.format(`${ye} HH:mm:ss`),CHAT_ALIGN:"to",CHAT_TYPE:"chat"};C(O=>{const U=[...we(O),I];return Ce(U)}),h.current=!0,d({event:"SEND_MESSAGE",data:{ATTACHMENT:D==null?void 0:D.TEMP_PATH,FAQ_ID:null,MESSAGE:"",EMPLOYEES:u==null?void 0:u.map(O=>O==null?void 0:O.EMP_ID),TASK_ID:b}}),clearTimeout(i.current),i.current=setTimeout(()=>{Z(".w-ticket-detail-content-container")},350)}}))==null||v.finally(()=>{e(!1)})};return c.useEffect(()=>{S()},[]),c.useEffect(()=>{var g;(g=f.notification)==null||g.destroy()},[k]),n.jsx(f.Upload,{beforeUpload:x,fileList:[],accept:(T=(w=s==null?void 0:s.EXT_LIST)==null?void 0:w.split(","))==null?void 0:T.map(g=>`.${g}`),onChange:g=>{p(g==null?void 0:g.file)},children:n.jsx(f.Button,{loading:t,icon:n.jsx($,{type:"paper-clip"}),shape:"circle",style:{border:"none"}})})},lo=c.memo(so),co=({refInput:e})=>{const{xs:t}=f.Grid.useBreakpoint(),o=c.useMemo(()=>t?"click":"hover",[t]),s=()=>{var b;const i=(b=e==null?void 0:e.current)==null?void 0:b.textarea;if(!i)return!1;const{selectionStart:l,selectionEnd:a,value:d}=i,u=d==null?void 0:d.substring(0,l),C=d==null?void 0:d.substring(l,a),h=d==null?void 0:d.substring(a);return{before:u,selectedText:C,after:h,selectionStart:l,selectionEnd:a,text:d}},r=i=>{var h,b;(h=e==null?void 0:e.current)==null||h.focus();const l=(b=e==null?void 0:e.current)==null?void 0:b.textarea,a=i==null?void 0:i.native;if(!l)return;const{before:d,after:u}=s(),C=`${d}${a}${u}`;typeof document.execCommand=="function"?document.execCommand("insertText",!1,a):l.value=C};return n.jsx(f.Popover,{trigger:o,content:n.jsx(rn,{onEmojiSelect:i=>{r(i)},theme:"auto"}),children:n.jsx(f.Button,{icon:n.jsx($,{type:"smile"}),style:{border:"none"}})})},ro=c.memo(co),io=()=>{const[e,t]=c.useState(0),[o,s]=c.useState(!1),r=c.useRef(null),i=c.useRef(null),l=c.useRef(!1),a=c.useRef(null),{onSendMsg:d}=X(),{ticketId:u}=Q(),{isActiveTabVA:C}=J(),{employees:h,setChats:b,isFromSelf:k,detailTicket:S}=le(),x=c.useMemo(()=>{var g;return((g=S==null?void 0:S.STATUS)==null?void 0:g.toString().toLowerCase())==="closed"},[S==null?void 0:S.STATUS]),p=c.useMemo(()=>h==null?void 0:h.map(g=>({...g,label:n.jsx(f.Popover,{placement:"left",content:n.jsx(oo,{...g}),children:n.jsx("div",{children:n.jsx(ie,{src:g==null?void 0:g.PHOTO,name:g==null?void 0:g.FULL_NAME})})}),value:g==null?void 0:g.FULL_NAME})),[h]),w=()=>{var E,v,_;const g=(v=(E=r==null?void 0:r.current)==null?void 0:E.textarea)==null?void 0:v.value;d({event:"SEND_MESSAGE",data:{ATTACHMENT:"",FAQ_ID:null,MESSAGE:g,EMPLOYEES:h==null?void 0:h.map(M=>M==null?void 0:M.EMP_ID),TASK_ID:u}});const y={ATTACHMENT:"",FAQ_ID:null,MESSAGE:g,CREATED_DATE:(_=K())==null?void 0:_.format(`${ye} HH:mm:ss`),CHAT_ALIGN:"to",CHAT_TYPE:"chat"};b(M=>{const H=[...we(M),y];return Ce(H)}),k.current=!0,Z(".w-ticket-detail-content-container"),t(M=>M+1)},T=()=>{window.clearTimeout(i.current),l.current||(l.current=!0,d({event:"TYPING",data:{TASK_ID:u,IS_TYPING:!0}})),i.current=setTimeout(()=>{d({event:"TYPING",data:{TASK_ID:u,IS_TYPING:!1}}),l.current=!1},250)};return c.useEffect(()=>{r!=null&&r.current&&!C&&u&&(clearTimeout(a.current),a.current=setTimeout(()=>{var g;(g=r==null?void 0:r.current)==null||g.focus()},500))},[C,u]),x?null:n.jsxs("div",{className:"w-input-container",style:{margin:0},children:[n.jsx(ro,{refInput:r}),n.jsx(lo,{setLoadingUpload:s,isLoadingUpload:o}),n.jsx(f.Mentions,{autoSize:{maxRows:3},ref:r,className:"w-input-helpdesk",placeholder:"Type a message...",onChange:()=>{T()},onKeyDown:g=>{((g==null?void 0:g.code)==="Enter"||(g==null?void 0:g.key)==="Enter")&&!(g!=null&&g.shiftKey)&&w()},filterOption:(g,y)=>{var _,M,B;const E=(_=g==null?void 0:g.toString())==null?void 0:_.toLowerCase(),v=(B=(M=y==null?void 0:y.FULL_NAME)==null?void 0:M.toString())==null?void 0:B.toLowerCase();return v==null?void 0:v.includes(E)},children:p==null?void 0:p.map((g,y)=>n.jsx(f.Mentions.Option,{...g,children:g==null?void 0:g.label},y))},e),n.jsx(f.Button,{loading:o,disabled:o,className:"w-send-btn ",style:{backgroundColor:"var(--primary-color, #395ebc)"},icon:n.jsx($,{type:"send"}),shape:"circle",onClick:w})]})},ao=c.memo(io),uo=({title:e,subTitle:t,onClose:o,open:s,styleWrapper:r})=>{var i;return s?n.jsx("div",{className:"w-banner-container",...((i=Object.keys(r||{}))==null?void 0:i.length)>0&&{style:r},children:n.jsxs("div",{className:"w-banner-content",children:[e&&n.jsx(f.Typography.Text,{style:{fontSize:16,fontWeight:600},children:e}),t&&n.jsx("div",{className:"w-banner-subtitle",children:t}),typeof o=="function"&&n.jsx("div",{className:"w-banner-close-btn",children:n.jsx(f.Button,{style:{border:"none",background:"transparent"},icon:n.jsx($,{type:"close"}),onClick:()=>o()})})]})}):null},je=c.memo(uo),fo=()=>{const e=A("ForMoreInformationOfThisTicket","For more information of this ticket"),t=A("ClickHere","Click here"),{ticketId:o}=Q(),{history:s}=F(),{encrypt:r}=Xe();return n.jsx(je,{subTitle:n.jsxs(n.Fragment,{children:[n.jsx(f.Typography.Text,{children:e}),n.jsx(f.Typography.Link,{strong:!0,className:"w-reconnect-manual",onClick:()=>{const i=r(o);s.push(`/standard/hrm.helpdesk.my-ticket.ticket-details?id=${i}`)},children:t})]}),open:!0,styleWrapper:{position:"sticky"}})},go=c.memo(fo),Co=({onClose:e,visible:t})=>n.jsx(Ze,{open:t,onClose:e,children:n.jsxs(It,{children:[n.jsx(Ut,{}),n.jsx(go,{}),n.jsx(no,{}),n.jsx(ao,{})]})}),To=c.memo(Co),yo=()=>{const e=A("AdvanceFilter","Advance Filter"),t=A("Subject","Subject"),o=A("TicketCategory","Ticket Category"),s=A("TicketStatus","Ticket Status"),r=A("CreatedDate","Created Date"),i=A("New","New"),l=A("Open","Open"),a=A("Reopen","Reopen"),d=A("InProgress","In Progress"),u=A("Responded","Responded"),C=A("Fixed","Fixed"),h=A("Done","Done"),b=A("Closed","Closed"),k=A("HDCancelled","Cancelled"),S=A("Clear","Clear"),x=A("Filter","Filter"),p=Te(),[w]=f.Form.useForm(),{openFilter:T,setOpenFilter:g,getListTicket:y,setCountFilters:E}=Q(),[v,_]=c.useState([]),M=c.useMemo(()=>{const m=`${i}/${l}/${a}`,L=`${d}/${u}`,D=`${C}/${h}`;return[{value:3,label:m},{value:1,label:L},{value:4,label:D},{value:6,label:b},{value:8,label:k}]},[]),B=()=>{var m;(m=p({endpoint:"/helpdesk/category/list",data:{LIMIT:999999,PAGE:1,SELECTOR:"*",SORT:{FIELD:"ORDER_NO",ORDER:"ASC"}}}))==null||m.then(L=>{var D,I,O;if((D=L==null?void 0:L.data)!=null&&D.DATA){const N=(O=(I=L==null?void 0:L.data)==null?void 0:I.DATA)==null?void 0:O.LIST;_(N==null?void 0:N.map(U=>({label:U==null?void 0:U.CATEGORY_NAME,value:U==null?void 0:U.CATEGORY_CODE})))}})},H=()=>{var D,I;const m=w==null?void 0:w.getFieldsValue(!0);y(m);const L=(I=(D=Object.values(m||{}))==null?void 0:D.flat())==null?void 0:I.filter(Boolean);E(L==null?void 0:L.length)};return c.useEffect(()=>{B()},[]),n.jsxs(Ze,{styleContainer:{height:"calc(100% - 50px)"},open:T,onClose:()=>{g(!1)},footer:n.jsxs("div",{className:"w-ticket-list-advance-filter-footer",children:[n.jsx(f.Button,{onClick:()=>{w==null||w.resetFields(),H()},children:S},"clear"),n.jsx(f.Button,{type:"primary",onClick:()=>{H(),g(!1)},children:x},"filter")]}),children:[n.jsx(f.Typography.Text,{strong:!0,style:{fontSize:16},children:e}),n.jsx("div",{className:"w-ticket-list-advance-filter-form-container",children:n.jsxs(f.Form,{form:w,layout:"vertical",children:[n.jsx(f.Form.Item,{label:t,name:"TASK_NAME",children:n.jsx(f.Input,{allowClear:!0})}),n.jsx(f.Form.Item,{label:o,name:"CATEGORY_CODE",children:n.jsx(f.Select,{options:v,mode:"multiple",allowClear:!0})}),n.jsx(f.Form.Item,{label:s,name:"TASK_STATUS",children:n.jsx(f.Select,{options:M,mode:"multiple",allowClear:!0})}),n.jsx(f.Form.Item,{label:r,name:"CREATED_DATE",children:n.jsx(f.DatePicker,{style:{width:"100%"},allowClear:!0})})]})})]})},ho=c.memo(yo),bo=()=>{const e=A("ReconnectManually","Reconnect Manually"),t=A("HelpdeskWebsocket","Helpdesk Websocket"),o=A("NotConnected","Not Connected"),s=A("Connecting","Connecting"),{connectWebSocket:r,retryCountState:i,setRetryCountState:l,retryCountRef:a}=X(),d=c.useMemo(()=>i===re?`${t} ${o}`:`${t} ${s}`,[i]);return n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:n.jsx(f.Result,{...i===re?{status:"warning"}:{icon:null},title:d,extra:i===re?n.jsx(f.Button,{type:"primary",onClick:()=>{a.current=0,l(0),r()},children:e},"reconnect"):n.jsx($,{type:"loading",className:"w-spin-animate",style:{paddingTop:8}})})})},ko=c.memo(bo),So=()=>{const{setTicketId:e,ticketId:t,openFilter:o}=Q(),{onSendMsg:s}=X(),{showReadyWSHD:r}=F();return r?n.jsxs(n.Fragment,{children:[n.jsx(To,{visible:t,onClose:()=>{e(""),s({event:"LEAVE_ROOM",data:{TASK_ID:t}})}}),n.jsx("div",{style:{display:!t&&!o?"block":"none"},children:n.jsx(Ht,{})}),n.jsx(ho,{})]}):n.jsx(ko,{})},Eo=c.memo(So),Ao=()=>{const e=A("NeedHelp","Need Help"),t=A("WidgetDisconnected","Widget Disconnected"),[o,s]=c.useState(!1),r=c.useRef(),{widgetProps:i,setOpenWidget:l,isFirstOpenWidget:a,setFirstOpenWidget:d}=F(),{onSendMsg:u,connected:C,isHandshakeWidget:h}=q(),b=()=>{l(!0),u({msg:i==null?void 0:i.getStartedPayload})};return c.useEffect(()=>{s(!C),window.clearTimeout(r.current),r.current=setTimeout(()=>{s(!1)},2e3)},[C]),n.jsx(f.Popover,{open:o&&h,content:t,placement:"right",children:n.jsxs("div",{className:"w-launcher-container",onClick:()=>{a||(d(!0),b()),l(!0)},children:[n.jsx($,{type:"chat-bubble"}),n.jsxs(f.Typography.Text,{style:{fontWeight:600,color:"#fff"},children:[e,"?"]})]})})},wo=c.memo(Ao),po=()=>{const e=A("NotConnected","Not Connected"),t=A("CannotAutoReconnect","Cannot auto reconnect"),o=A("ReconnectManually","Reconnect Manually"),[s,r]=c.useState(!1),{connected:i,createSocket:l}=q(),{widgetProps:a}=F();return c.useEffect(()=>{r(!i)},[i]),n.jsx(je,{title:`${a==null?void 0:a.title} ${e}`,subTitle:n.jsxs(n.Fragment,{children:[n.jsxs(f.Typography.Text,{children:[t,"?"]}),n.jsx(f.Typography.Link,{strong:!0,className:"w-reconnect-manual",onClick:()=>{l()},children:o})]}),onClose:()=>r(!1),open:!i&&s})},xo=c.memo(po),Lo=()=>{const{xs:e}=f.Grid.useBreakpoint(),[t,o]=c.useState(!1),{isOpenWidget:s,widgetProps:r}=F(),{isActiveTabVA:i}=J(),l=c.useRef(null),a=c.useMemo(()=>{var C;const u=[be];return e&&(r!=null&&r.isSF?u==null||u.push(`${be}-sf-mobile`):u==null||u.push(`${be}-mobile`)),(C=u==null?void 0:u.filter(Boolean))==null?void 0:C.join(" ")},[e,r==null?void 0:r.isSF]),d=c.useCallback(u=>{var h;const C=[u,Se==null?void 0:Se.FADE_IN];return r!=null&&r.isSF&&(C==null||C.push(`${u}-sf`)),e&&(r!=null&&r.isSF?C==null||C.push(`${u}-sf-mobile`):C==null||C.push(`${u}-mobile`)),(h=C==null?void 0:C.filter(Boolean))==null?void 0:h.join(" ")},[r==null?void 0:r.isSF,e]);return c.useEffect(()=>{s&&o(s),clearTimeout(l.current),l.current=setTimeout(()=>{s||o(s)},250)},[s]),t?n.jsxs("div",{className:a,children:[n.jsxs("div",{style:{display:i?"block":"none"},children:[n.jsx("div",{className:d(hn),children:n.jsx(pt,{})}),n.jsx(Lt,{})]}),n.jsx("div",{style:{display:i?"none":"block"},children:n.jsx("div",{className:d(bn),children:n.jsx(Ft,{children:n.jsx(Mt,{children:n.jsx(Eo,{})})})})}),n.jsx(xo,{})]}):n.jsx(wo,{})},vo=c.memo(Lo),_o=({items:e,...t})=>ne!=null&&ne.startsWith("5")||te!=null&&te.startsWith("18")?n.jsx(f.Tabs,{...t,items:e}):n.jsx(f.Tabs,{...t,children:e==null?void 0:e.map(({...o})=>c.createElement(f.Tabs.TabPane,{...o,key:o==null?void 0:o.key,tab:o==null?void 0:o.label}))}),Do=c.memo(_o),Mo=()=>{const{isOpenWidget:e}=F(),{setActiveTab:t,activeTab:o}=J(),s=A("VirtualAssistant","Virtual Assistant"),r=A("Helpdesk","Helpdesk"),{xs:i}=f.Grid.useBreakpoint();return c.useEffect(()=>{const l=me();t((l==null?void 0:l.activeTab)??o)},[]),e?n.jsx("div",{className:"w-widget-tab-footer-container",...i&&{style:{borderRadius:0}},children:n.jsx(Do,{activeKey:o,onChange:l=>{t(l),ge({activeTab:l})},items:[{label:s,key:"va"},{label:r,key:"helpdesk"}]})}):null},Oo=c.memo(Mo),mo=()=>{const{isOpenWidget:e,setOpenWidget:t,setExpand:o,isExpand:s,widgetProps:r}=F(),{xs:i}=f.Grid.useBreakpoint();return e?n.jsxs("div",{className:`${ce}-container`,...i&&{style:{borderRadius:0}},children:[n.jsxs("div",{className:`${ce}-text`,children:[n.jsx("h4",{className:`${ce}-title`,children:r==null?void 0:r.title}),n.jsx("span",{className:`${ce}-subtitle`,children:r==null?void 0:r.subTitle})]}),n.jsxs("div",{className:`${ce}-action`,children:[!i&&n.jsx($,{type:"expand",style:{transform:s?"rotate(180deg)":"rotate(0deg)",transition:"all 300ms"},onClick:()=>{o(l=>!l)}}),n.jsx($,{type:"minimize",onClick:()=>{t(!1)}})]})]}):null},Fo=c.memo(mo),No=()=>{const{isExpand:e,isOpenWidget:t,isFirstOpenWidget:o,setOpenWidget:s}=F(),{xs:r}=f.Grid.useBreakpoint(),i=c.useMemo(()=>{var a;const l=[r&&"w-container-widget-mobile",o&&(t?"w-show-animate":"w-close-animate"),"w-container-widget",e&&"w-container-widget-expand"];return(a=l==null?void 0:l.filter(Boolean))==null?void 0:a.join(" ")},[e,r,o,t]);return n.jsxs("div",{className:i,onKeyDown:l=>{(l==null?void 0:l.code)==="Escape"&&!(l!=null&&l.shiftKey)&&!(l!=null&&l.altKey)&&!(l!=null&&l.ctrlKey)&&(l==null?void 0:l.key)==="Escape"&&s(!1)},tabIndex:0,children:[n.jsx(Fo,{}),n.jsx("div",{id:"w-widget-content",children:n.jsxs(et,{children:[n.jsx(Mn,{children:n.jsx(vo,{})}),n.jsx(Oo,{})]})})]})},Ho=c.memo(No);return({getStartedPayload:e,socketURL:t,socketPath:o,onPayslipFn:s,title:r,subTitle:i,keyEncrypt:l,history:a,isSF:d=!1})=>n.jsx(vn,{getStartedPayload:e,socketURL:t,socketPath:o,onPayslipFn:s,title:r,subTitle:i,keyEncrypt:l,history:a,isSF:d,children:n.jsx(Dn,{children:n.jsx(Ho,{})})})});
package/package.json CHANGED
@@ -1,202 +1,54 @@
1
1
  {
2
- "name": "widget-chatbot",
3
- "version": "1.0.4",
4
- "description": "Custom rasa chat widget",
5
- "module": "module/index.js",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "author": {
12
- "name": "Restu Averian Putra",
13
- "email": "restuaverianputra123@gmail.com",
14
- "url": "https://github.com/Restu-Averian"
15
- },
16
- "license": "Apache-2.0",
17
- "scripts": {
18
- "dev": "webpack-dev-server --config webpack.dev.js",
19
- "build": "webpack --config webpack.prod.js",
20
- "test": "jest",
21
- "prepare": "npm run build",
22
- "release": "standard-version"
23
- },
24
- "keywords": [
25
- "react",
26
- "chat",
27
- "widget",
28
- "javascript"
29
- ],
30
- "dependencies": {
31
- "@ant-design/charts": "^1.1.13",
32
- "@babel/plugin-proposal-class-properties": "^7.18.6",
33
- "@reduxjs/toolkit": "^2.2.7",
34
- "@stomp/stompjs": "^5.4.2",
35
- "antd": "^4.20.0",
36
- "axios": "^1.6.0",
37
- "babel-plugin-import": "^1.13.8",
38
- "chart.js": "^4.4.4",
39
- "crypto-js": "^4.2.0",
40
- "file-saver": "^2.0.5",
41
- "immutable": "^3.8.2",
42
- "object-hash": "^1.1.5",
43
- "os": "^0.1.2",
44
- "prop-types": "^15.7.2",
45
- "react": "^17.0.2",
46
- "react-dom": "^17.0.2",
47
- "react-draggable": "^4.4.6",
48
- "react-immutable-proptypes": "^2.2.0",
49
- "react-markdown": "^8.0.3",
50
- "react-redux": "^7.2.5",
51
- "react-textarea-autosize": "^8.5.3",
52
- "react-use-websocket": "^4.8.1",
53
- "redux": "^4.0.5",
54
- "socket.io": "^4.7.5",
55
- "socket.io-client": "^4.7.5",
56
- "sockjs-client": "^1.4.0",
57
- "webhook": "^0.0.2"
58
- },
59
- "devDependencies": {
60
- "@babel/cli": "7.17.6",
61
- "@babel/core": "7.17.7",
62
- "@babel/plugin-proposal-object-rest-spread": "7.17.3",
63
- "@babel/preset-env": "7.16.11",
64
- "@babel/preset-react": "7.16.7",
65
- "@commitlint/cli": "^19.2.1",
66
- "@commitlint/config-conventional": "16.2.1",
67
- "babel-eslint": "^10.1.0",
68
- "babel-jest": "27.5.1",
69
- "babel-loader": "8.2.3",
70
- "babel-plugin-module-resolver": "^5.0.0",
71
- "babel-plugin-transform-class-properties": "^6.24.1",
72
- "babel-preset-stage-0": "^6.24.1",
73
- "clean-webpack-plugin": "^0.1.19",
74
- "copy-webpack-plugin": "^13.0.0",
75
- "css-loader": "^6.10.0",
76
- "eslint": "8.11.0",
77
- "eslint-config-airbnb": "19.0.4",
78
- "eslint-config-prettier": "^1.6.0",
79
- "eslint-import-resolver-babel-module": "^5.1.2",
80
- "eslint-plugin-flowtype": "^2.50.3",
81
- "eslint-plugin-import": "^2.18.2",
82
- "eslint-plugin-jsx-a11y": "^6.7.1",
83
- "eslint-plugin-prettier": "^2.7.0",
84
- "eslint-plugin-react": "^7.32.2",
85
- "file-loader": "^6.2.0",
86
- "html-webpack-plugin": "^5.6.0",
87
- "husky": "^3.1.0",
88
- "jest": "^29.7.0",
89
- "lodash-webpack-plugin": "^0.11.5",
90
- "standard-version": "^9.3.1",
91
- "string-replace-loader": "^3.1.0",
92
- "style-loader": "^3.3.4",
93
- "terser-webpack-plugin": "^5.3.10",
94
- "url-loader": "^4.1.1",
95
- "webpack": "^5.90.3",
96
- "webpack-bundle-analyzer": "^4.10.2",
97
- "webpack-cli": "^5.1.4",
98
- "webpack-dev-server": "^5.0.3"
99
- },
100
- "jest": {
101
- "verbose": true,
102
- "moduleNameMapper": {
103
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/mocks/fileMock.js",
104
- "\\.(css|scss)$": "<rootDir>/mocks/styleMock.js"
105
- },
106
- "keywords": [
107
- "react",
108
- "chat",
109
- "widget",
110
- "javascript"
111
- ],
112
- "dependencies": {
113
- "@ant-design/charts": "^1.1.13",
114
- "@babel/plugin-proposal-class-properties": "^7.18.6",
115
- "@popperjs/core": "^2.4.0",
116
- "@reduxjs/toolkit": "^2.2.7",
117
- "@stomp/stompjs": "^5.4.2",
118
- "antd": "^4.20.0",
119
- "axios": "^1.6.0",
120
- "babel-plugin-import": "^1.13.8",
121
- "chart.js": "^4.4.4",
122
- "crypto-js": "^4.2.0",
123
- "file-saver": "^2.0.5",
124
- "immutable": "^3.8.2",
125
- "object-hash": "^1.1.5",
126
- "os": "^0.1.2",
127
- "prop-types": "^15.7.2",
128
- "react": "^17.0.2",
129
- "react-chartjs-2": "^5.2.0",
130
- "react-dom": "^17.0.2",
131
- "react-draggable": "^4.4.6",
132
- "react-immutable-proptypes": "^2.2.0",
133
- "react-markdown": "^8.0.3",
134
- "react-popper": "^2.2.3",
135
- "react-redux": "^7.2.5",
136
- "react-router-dom": "5.2.0",
137
- "react-textarea-autosize": "^8.5.3",
138
- "react-use-websocket": "^4.8.1",
139
- "redux": "^4.0.5",
140
- "socket.io": "^4.7.5",
141
- "socket.io-client": "^4.7.5",
142
- "sockjs-client": "^1.4.0",
143
- "webhook": "^0.0.2"
144
- },
145
- "devDependencies": {
146
- "@babel/cli": "7.17.6",
147
- "@babel/core": "7.17.7",
148
- "@babel/plugin-proposal-object-rest-spread": "7.17.3",
149
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
150
- "@babel/preset-env": "7.16.11",
151
- "@babel/preset-react": "7.16.7",
152
- "@commitlint/cli": "^19.2.1",
153
- "@commitlint/config-conventional": "16.2.1",
154
- "babel-eslint": "^10.1.0",
155
- "babel-jest": "27.5.1",
156
- "babel-loader": "8.2.3",
157
- "babel-plugin-module-resolver": "^5.0.0",
158
- "babel-plugin-transform-class-properties": "^6.24.1",
159
- "babel-preset-stage-0": "^6.24.1",
160
- "clean-webpack-plugin": "^0.1.19",
161
- "css-loader": "^6.10.0",
162
- "eslint": "8.11.0",
163
- "eslint-config-airbnb": "19.0.4",
164
- "eslint-config-prettier": "^1.6.0",
165
- "eslint-import-resolver-babel-module": "^5.1.2",
166
- "eslint-plugin-flowtype": "^2.50.3",
167
- "eslint-plugin-import": "^2.18.2",
168
- "eslint-plugin-jsx-a11y": "^6.7.1",
169
- "eslint-plugin-prettier": "^2.7.0",
170
- "eslint-plugin-react": "^7.32.2",
171
- "file-loader": "^6.2.0",
172
- "html-webpack-plugin": "^5.6.0",
173
- "husky": "^3.1.0",
174
- "install": "^0.13.0",
175
- "jest": "^29.7.0",
176
- "lodash-webpack-plugin": "^0.11.5",
177
- "npm": "^11.1.0",
178
- "standard-version": "^9.3.1",
179
- "string-replace-loader": "^3.1.0",
180
- "style-loader": "^3.3.4",
181
- "terser-webpack-plugin": "^5.3.10",
182
- "url-loader": "^4.1.1",
183
- "webpack": "^5.90.3",
184
- "webpack-bundle-analyzer": "^4.10.2",
185
- "webpack-cli": "^5.1.4",
186
- "webpack-dev-server": "^5.0.3"
187
- },
188
- "jest": {
189
- "verbose": true,
190
- "moduleNameMapper": {
191
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/mocks/fileMock.js",
192
- "\\.(css|scss)$": "<rootDir>/mocks/styleMock.js"
193
- },
194
- "setupTestFrameworkScriptFile": "<rootDir>/test-setup.js"
195
- },
196
- "husky": {
197
- "hooks": {
198
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
199
- }
200
- }
201
- }
2
+ "name": "widget-chatbot",
3
+ "version": "2.0.0-alpha.1",
4
+ "type": "module",
5
+ "license": "Apache-2.0",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "keywords": [
10
+ "widget-chatbot",
11
+ "chatbot",
12
+ "react",
13
+ "react-component",
14
+ "component"
15
+ ],
16
+ "types": "dist/index.d.ts",
17
+ "main": "dist/widget-chatbot.cjs.js",
18
+ "module": "dist/widget-chatbot.es.js",
19
+ "author": "Restu Averian Putra <restuaverianputra123@gmail.com>",
20
+ "scripts": {
21
+ "start": "vite",
22
+ "build": "vite build",
23
+ "lint": "eslint .",
24
+ "preview": "vite preview"
25
+ },
26
+ "peerDependencies": {
27
+ "@ant-design/plots": "^2.3.3",
28
+ "@emoji-mart/react": "^1.1.1",
29
+ "antd": "^4.20.5",
30
+ "axios": "^1.9.0",
31
+ "react": "^18.2.0",
32
+ "react-dom": "^18.2.0",
33
+ "react-markdown": "^10.1.0",
34
+ "remark-gfm": "^4.0.1"
35
+ },
36
+ "dependencies": {
37
+ "crypto-js": "^4.1.1",
38
+ "dayjs": "^1.11.13",
39
+ "react-syntax-highlighter": "^15.6.1",
40
+ "socket.io-client": "^4.8.1"
41
+ },
42
+ "devDependencies": {
43
+ "@eslint/js": "^9.22.0",
44
+ "@types/react": "^18.2.40",
45
+ "@types/react-dom": "^18.2.18",
46
+ "@vitejs/plugin-react-swc": "^3.8.0",
47
+ "eslint": "^9.22.0",
48
+ "eslint-plugin-react-hooks": "^5.2.0",
49
+ "eslint-plugin-react-refresh": "^0.4.19",
50
+ "globals": "^16.0.0",
51
+ "rollup-plugin-visualizer": "^5.14.0",
52
+ "vite": "^6.3.1"
53
+ }
202
54
  }