(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9183,2386,4838],{24333:function(e,t,n){"use strict";var s,a,r=n(52846);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},[t,n]=(0,a.lr)();(0,s.useEffect)(()=>{let s=!1;t.forEach((n,a)=>{"function"==typeof e[a]&&(e[a](n),t.delete(a),s=!0)}),s&&n(t)},[t,e])}let o=/^[::]/;function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};function t(e){return e.match(o)?e.slice(1):e}return{match:function(n){let s=t(n),a="function"==typeof e[s];return{matched:a,invoke:()=>a&&e[s](n)}},search:function(n){let s=t(n),a=r.ZP.Chat.Commands;return Object.keys(e).filter(e=>e.startsWith(s)).map(e=>({title:a[e],content:":"+e}))}}}},54838:function(e,t,n){"use strict";let s,a;n.r(t),n.d(t,{Chat:function(){return t$},ChatAction:function(){return tG},ChatActions:function(){return tX},DeleteImageButton:function(){return tY},EditMessageModal:function(){return tq},PromptHints:function(){return tW},SessionConfigModel:function(){return tz},ShortcutKeyModal:function(){return tQ}});var r,i,o,l,c,d,u,h,m,p,g,f,v,x,w,y,_,k,j,C,b,E,S,N,M,P,O,Z,T,A,L,I,D,K,R,F,B,H,z,U,W,V,G,X=n(57437),q=n(38648),Y=n(2265),Q=n(52846);function J(){return(J=Object.assign?Object.assign.bind():function(e){for(var t=1;te.content&&!e.isError&&!e.streaming,s=(0,Y.useMemo)(()=>{var e;let n=Math.max(0,null!==(e=t.clearContextIndex)&&void 0!==e?e:0);return n===t.messages.length-1&&(n=0),t.messages.slice(n)},[t.messages,t.clearContextIndex]),a=(0,Y.useMemo)(()=>s.filter((e,t)=>e.id&&n(e)&&(t>=s.length-1||n(s[t+1]))),[s]),r=a.length,i=(0,eB.MG)(),[o,l]=(0,Y.useState)(""),[c,d]=(0,Y.useState)(new Set),u=e=>0===o.length||c.has(e),h=e=>{let t=new Set;e.length>0&&a.forEach(n=>(0,eH.YK)(n).includes(e)?t.add(n.id):null),d(t)},{startIndex:m,endIndex:p,onClickIndex:g}=function(){let[e,t]=(0,Y.useState)(),[n,s]=(0,Y.useState)(),[a,r]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let e=e=>{"Shift"===e.key&&r(!0)},n=e=>{"Shift"===e.key&&(r(!1),t(void 0),s(void 0))};return window.addEventListener("keyup",n),window.addEventListener("keydown",e),()=>{window.removeEventListener("keyup",n),window.removeEventListener("keydown",e)}},[]),{onClickIndex:n=>{a&&void 0!==e?s(n):(t(n),s(void 0))},startIndex:e,endIndex:n}}(),f=()=>{e.updateSelection(e=>a.forEach(t=>e.add(t.id)))};return(0,Y.useEffect)(()=>{e.defaultSelectAll&&f()},[]),(0,Y.useEffect)(()=>{if(void 0===m||void 0===p)return;let[t,n]=[m,p].sort((e,t)=>e-t);e.updateSelection(e=>{for(let r=t;r<=n;r+=1){var s;e.add(null!==(s=a[r].id)&&void 0!==s?s:r)}})},[m,p]),(0,X.jsxs)("div",{className:tt()["message-selector"],children:[(0,X.jsxs)("div",{className:tt()["message-filter"],children:[(0,X.jsx)("input",{type:"text",placeholder:eG.ZP.Select.Search,className:(0,tn.Z)(tt()["filter-item"],tt()["search-bar"]),value:o,onInput:e=>{l(e.currentTarget.value),h(e.currentTarget.value)}}),(0,X.jsxs)("div",{className:tt().actions,children:[(0,X.jsx)(eX.h,{text:eG.ZP.Select.All,bordered:!0,className:tt()["filter-item"],onClick:f}),(0,X.jsx)(eX.h,{text:eG.ZP.Select.Latest,bordered:!0,className:tt()["filter-item"],onClick:()=>e.updateSelection(e=>{e.clear(),a.slice(r-4).forEach(t=>e.add(t.id))})}),(0,X.jsx)(eX.h,{text:eG.ZP.Select.Clear,bordered:!0,className:tt()["filter-item"],onClick:()=>e.updateSelection(e=>e.clear())})]})]}),(0,X.jsx)("div",{className:tt().messages,children:a.map((n,s)=>{var a;if(!u(n.id))return null;let r=null!==(a=n.id)&&void 0!==a?a:s,o=e.selection.has(r);return(0,X.jsxs)("div",{className:(0,tn.Z)(tt().message,{[tt()["message-selected"]]:e.selection.has(n.id)}),onClick:()=>{e.updateSelection(e=>{e.has(r)?e.delete(r):e.add(r)}),g(s)},children:[(0,X.jsx)("div",{className:tt().avatar,children:"user"===n.role?(0,X.jsx)(e0.qE,{avatar:i.avatar}):(0,X.jsx)(e1.MaskAvatar,{avatar:t.mask.avatar,model:n.model||t.mask.modelConfig.model})}),(0,X.jsxs)("div",{className:tt().body,children:[(0,X.jsx)("div",{className:tt().date,children:new Date(n.date).toLocaleString()}),(0,X.jsx)("div",{className:(0,tn.Z)(tt().content,"one-line"),children:(0,eH.YK)(n)})]}),(0,X.jsx)("div",{className:tt().checkbox,children:(0,X.jsx)("input",{type:"checkbox",checked:o,readOnly:!0})})]},s)})})]})}var ta=n(20703),tr=n(99823),ti=n(94880),to=n(42882);let tl=(0,eU.default)(async()=>(await Promise.all([n.e(721),n.e(3954),n.e(6991),n.e(6303)]).then(n.bind(n,42896))).Markdown,{loadableGenerated:{webpack:()=>[42896]},loading:()=>(0,X.jsx)(eu.Z,{})});function tc(e){return(0,X.jsx)("div",{className:"modal-mask",children:(0,X.jsx)(eQ.u_,{title:eG.ZP.Export.Title,onClose:e.onClose,footer:(0,X.jsx)("div",{style:{width:"100%",textAlign:"center",fontSize:14,opacity:.5},children:eG.ZP.Exporter.Description.Title}),children:(0,X.jsx)("div",{style:{minHeight:"40vh"},children:(0,X.jsx)(tu,{})})})})}function td(e){let t=e.steps,n=t.length;return(0,X.jsxs)("div",{className:e8().steps,children:[(0,X.jsx)("div",{className:e8()["steps-progress"],children:(0,X.jsx)("div",{className:e8()["steps-progress-inner"],style:{width:"".concat((e.index+1)/n*100,"%")}})}),(0,X.jsx)("div",{className:e8()["steps-inner"],children:t.map((t,n)=>(0,X.jsxs)("div",{className:(0,tn.Z)("clickable",e8().step,{[e8()["step-finished"]]:n<=e.index,[e8()["step-current"]]:n===e.index}),onClick:()=>{var t;null===(t=e.onStepChange)||void 0===t||t.call(e,n)},role:"button",children:[(0,X.jsx)("span",{className:e8()["step-index"],children:n+1}),(0,X.jsx)("span",{className:e8()["step-name"],children:t.name})]},n))})]})}function tu(){let e=[{name:eG.ZP.Export.Steps.Select,value:"select"},{name:eG.ZP.Export.Steps.Preview,value:"preview"}],{currentStep:t,setCurrentStepIndex:n,currentStepIndex:s}=function(e){let t=e.length,[n,s]=(0,Y.useState)(0);return{currentStepIndex:n,setCurrentStepIndex:s,nextStep:()=>s((n+1)%t),prevStep:()=>s((n-1+t)%t),currentStep:e[n]}}(e),[a,r]=(0,Y.useState)({format:"image",includeContext:!0});function i(e){let t={...a};e(t),r(t)}let o=(0,eB.aK)().currentSession(),{selection:l,updateSelection:c}=function(){let[e,t]=(0,Y.useState)(new Set);return{selection:e,updateSelection:n=>{let s=new Set(e);n(s),t(s)}}}(),d=(0,Y.useMemo)(()=>{let e=[];return a.includeContext&&e.push(...o.mask.context),e.push(...o.messages.filter(e=>l.has(e.id))),e},[a.includeContext,o.messages,o.mask.context,l]);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(td,{steps:e,index:s,onStepChange:n}),(0,X.jsxs)("div",{className:e8()["message-exporter-body"],style:"select"!==t.value?{display:"none"}:{},children:[(0,X.jsxs)(eQ.aV,{children:[(0,X.jsx)(eQ.HC,{title:eG.ZP.Export.Format.Title,subTitle:eG.ZP.Export.Format.SubTitle,children:(0,X.jsx)(eQ.Ph,{value:a.format,onChange:e=>i(t=>t.format=e.currentTarget.value),children:["text","image","json"].map(e=>(0,X.jsx)("option",{value:e,children:e},e))})}),(0,X.jsx)(eQ.HC,{title:eG.ZP.Export.IncludeContext.Title,subTitle:eG.ZP.Export.IncludeContext.SubTitle,children:(0,X.jsx)("input",{type:"checkbox",checked:a.includeContext,onChange:e=>{i(t=>t.includeContext=e.currentTarget.checked)}})})]}),(0,X.jsx)(ts,{selection:l,updateSelection:c,defaultSelectAll:!0})]}),"preview"===t.value&&(0,X.jsx)("div",{className:e8()["message-exporter-body"],children:"text"===a.format?(0,X.jsx)(tf,{messages:d,topic:o.topic}):"json"===a.format?(0,X.jsx)(tv,{messages:d,topic:o.topic}):(0,X.jsx)(tg,{messages:d,topic:o.topic})})]})}function th(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(!t.current)return;let n=Array.from(t.current.getElementsByClassName(e$.yY));if(n.length!==e.messages.length)return;let s=n.map((e,t)=>{var n;let[s,a]=e.id.split(":");return{id:t.toString(),role:s,content:"user"===s?null!==(n=e.textContent)&&void 0!==n?n:"":e.innerHTML,date:""}});e.onRender(s)},[]),(0,X.jsx)("div",{ref:t,children:e.messages.map((e,t)=>(0,X.jsx)("div",{id:"".concat(e.role,":").concat(t),className:e$.yY,children:(0,X.jsx)(tl,{content:(0,eH.YK)(e),defaultShow:!0})},t))})}function tm(e){var t;let[n,s]=(0,Y.useState)(!1),[a,r]=(0,Y.useState)(!1),i=(0,eB.MG)(),o=async()=>{var t;(null===(t=e.messages)||void 0===t?void 0:t.length)&&(s(!0),r(!0))};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:e8()["preview-actions"],children:[e.showCopy&&(0,X.jsx)(eX.h,{text:eG.ZP.Export.Copy,bordered:!0,shadow:!0,icon:(0,X.jsx)(ei.Z,{}),onClick:e.copy}),(0,X.jsx)(eX.h,{text:eG.ZP.Export.Download,bordered:!0,shadow:!0,icon:(0,X.jsx)(e5.Z,{}),onClick:e.download}),(0,X.jsx)(eX.h,{text:eG.ZP.Export.Share,bordered:!0,shadow:!0,icon:n?(0,X.jsx)(eu.Z,{}):(0,X.jsx)(ea.Z,{}),onClick:o})]}),(0,X.jsx)("div",{style:{position:"fixed",right:"200vw",pointerEvents:"none"},children:a&&(0,X.jsx)(th,{messages:null!==(t=e.messages)&&void 0!==t?t:[],onRender:e=>{r(!1),(0,to.Lw)(i.modelConfig.providerName).share(e).then(e=>{e&&((0,eQ.K4)({title:eG.ZP.Export.Share,children:[(0,X.jsx)("input",{type:"text",value:e,style:{width:"100%",maxWidth:"unset"},readOnly:!0,onClick:e=>e.currentTarget.select()},"input")],actions:[(0,X.jsx)(eX.h,{icon:(0,X.jsx)(ei.Z,{}),text:eG.ZP.Chat.Actions.Copy,onClick:()=>(0,eH.vQ)(e)},"copy")]}),setTimeout(()=>{window.open(e,"_blank")},800))}).catch(e=>{console.error("[Share]",e),(0,eQ.CF)((0,e2.B)(e))}).finally(()=>s(!1))}})})]})}function tp(e){return e.avatar===e3._G?(0,X.jsx)("img",{src:e9.src,width:30,height:30,alt:"bot",className:"user-avatar"}):(0,X.jsx)(e0.qE,{avatar:e.avatar})}function tg(e){var t,n;let s=(0,eB.aK)().currentSession(),a=s.mask,r=(0,eB.MG)(),i=(0,Y.useRef)(null),o=(0,eH.S0)(),l=async()=>{var t;(0,eQ.CF)(eG.ZP.Export.Image.Toast);let n=i.current;if(!n)return;let s=null===(t=(0,ti.Z)())||void 0===t?void 0:t.isApp;try{let t=await (0,tr.YM)(n);if(!t)return;if(o||s&&window.__TAURI__){if(s&&window.__TAURI__){let n=await window.__TAURI__.dialog.save({defaultPath:"".concat(e.topic,".png"),filters:[{name:"PNG Files",extensions:["png"]},{name:"All Files",extensions:["*"]}]});if(null!==n){let e=await fetch(t),s=await e.arrayBuffer(),a=new Uint8Array(s);await window.__TAURI__.fs.writeBinaryFile(n,a),(0,eQ.CF)(eG.ZP.Download.Success)}else(0,eQ.CF)(eG.ZP.Download.Failed)}else(0,eQ.vi)(t)}else{let n=document.createElement("a");n.download="".concat(e.topic,".png"),n.href=t,n.click(),c()}}catch(e){(0,eQ.CF)(eG.ZP.Download.Failed)}},c=()=>{let e=i.current;e&&(e.innerHTML=e.innerHTML)};return(0,X.jsxs)("div",{className:e8()["image-previewer"],children:[(0,X.jsx)(tm,{copy:()=>{(0,eQ.CF)(eG.ZP.Export.Image.Toast);let e=i.current;e&&(0,tr.SE)(e).then(e=>{if(e)try{navigator.clipboard.write([new ClipboardItem({"image/png":e})]).then(()=>{(0,eQ.CF)(eG.ZP.Copy.Success),c()})}catch(e){console.error("[Copy Image] ",e),(0,eQ.CF)(eG.ZP.Copy.Failed)}})},download:l,showCopy:!o,messages:e.messages}),(0,X.jsxs)("div",{className:(0,tn.Z)(e8()["preview-body"],e8()["default-theme"]),ref:i,children:[(0,X.jsxs)("div",{className:e8()["chat-info"],children:[(0,X.jsx)("div",{className:(0,tn.Z)(e8().logo,"no-dark"),children:(0,X.jsx)(ta.default,{src:e7.Z.src,alt:"logo",width:50,height:50})}),(0,X.jsxs)("div",{children:[(0,X.jsx)("div",{className:e8()["main-title"],children:"NextChat"}),(0,X.jsx)("div",{className:e8()["sub-title"],children:"github.com/ChatGPTNextWeb/ChatGPT-Next-Web"}),(0,X.jsxs)("div",{className:e8().icons,children:[(0,X.jsx)(tp,{avatar:r.avatar}),(0,X.jsx)("span",{className:e8()["icon-space"],children:"&"}),(0,X.jsx)(tp,{avatar:a.avatar})]})]}),(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{className:e8()["chat-info-item"],children:[eG.ZP.Exporter.Model,": ",a.modelConfig.model]}),(0,X.jsxs)("div",{className:e8()["chat-info-item"],children:[eG.ZP.Exporter.Messages,": ",e.messages.length]}),(0,X.jsxs)("div",{className:e8()["chat-info-item"],children:[eG.ZP.Exporter.Topic,": ",s.topic]}),(0,X.jsxs)("div",{className:e8()["chat-info-item"],children:[eG.ZP.Exporter.Time,":"," ",new Date(null!==(n=null===(t=e.messages.at(-1))||void 0===t?void 0:t.date)&&void 0!==n?n:Date.now()).toLocaleString()]})]})]}),e.messages.map((e,t)=>(0,X.jsxs)("div",{className:(0,tn.Z)(e8().message,e8()["message-"+e.role]),children:[(0,X.jsx)("div",{className:e8().avatar,children:(0,X.jsx)(tp,{avatar:"user"===e.role?r.avatar:a.avatar})}),(0,X.jsxs)("div",{className:e8().body,children:[(0,X.jsx)(tl,{content:(0,eH.YK)(e),fontSize:r.fontSize,fontFamily:r.fontFamily,defaultShow:!0}),1==(0,eH.Bs)(e).length&&(0,X.jsx)("img",{src:(0,eH.Bs)(e)[0],alt:"message",className:e8()["message-image"]},t),(0,eH.Bs)(e).length>1&&(0,X.jsx)("div",{className:e8()["message-images"],style:{"--image-count":(0,eH.Bs)(e).length},children:(0,eH.Bs)(e).map((e,t)=>(0,X.jsx)("img",{src:e,alt:"message",className:e8()["message-image-multi"]},t))})]})]},t))]})]})}function tf(e){let t="# ".concat(e.topic,"\n\n")+e.messages.map(e=>"user"===e.role?"## ".concat(eG.ZP.Export.MessageFromYou,":\n").concat((0,eH.YK)(e)):"## ".concat(eG.ZP.Export.MessageFromChatGPT,":\n").concat((0,eH.YK)(e).trim())).join("\n\n");return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(tm,{copy:()=>{(0,eH.vQ)(t)},download:()=>{(0,eH.CP)(t,"".concat(e.topic,".md"))},showCopy:!0,messages:e.messages}),(0,X.jsx)("div",{className:"markdown-body",children:(0,X.jsx)("pre",{className:e8()["export-content"],children:t})})]})}function tv(e){let t={messages:[{role:"system",content:"".concat(eG.ZP.FineTuned.Sysmessage," ").concat(e.topic)},...e.messages.map(e=>({role:e.role,content:e.content}))]},n="```json\n"+JSON.stringify(t,null,2)+"\n```",s=JSON.stringify(t),a=()=>{(0,eH.vQ)(s)};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(tm,{copy:a,download:()=>{(0,eH.CP)(JSON.stringify(t),"".concat(e.topic,".json"))},showCopy:!1,messages:e.messages}),(0,X.jsx)("div",{className:"markdown-body",onClick:a,children:(0,X.jsx)(tl,{content:n})})]})}var tx=n(20234),tw=n(8620),ty=n(27815),t_=n(37906);(r=R||(R={})).SILENT="silent",r.X_SOFT="x-soft",r.SOFT="soft",r.MEDIUM="medium",r.LOUD="loud",r.X_LOUD="x-LOUD",r.DEFAULT="default",(i=F||(F={})).X_SLOW="x-slow",i.SLOW="slow",i.MEDIUM="medium",i.FAST="fast",i.X_FAST="x-fast",i.DEFAULT="default",(o=B||(B={})).X_LOW="x-low",o.LOW="low",o.MEDIUM="medium",o.HIGH="high",o.X_HIGH="x-high",o.DEFAULT="default",(l=H||(H={})).AUDIO_24KHZ_48KBITRATE_MONO_MP3="audio-24khz-48kbitrate-mono-mp3",l.AUDIO_24KHZ_96KBITRATE_MONO_MP3="audio-24khz-96kbitrate-mono-mp3",l.WEBM_24KHZ_16BIT_MONO_OPUS="webm-24khz-16bit-mono-opus";class tk{constructor(){this.pitch="+0Hz",this.rate=1,this.volume=100}}class tj{_log(){for(var e=arguments.length,t=Array(e),n=0;n{this._ws.onopen=()=>{this._log("Connected in",(Date.now()-this._startTime)/1e3,"seconds"),this._send('Content-Type:application/json; charset=utf-8\r\nPath:speech.config\r\n\r\n\n {\n "context": {\n "synthesis": {\n "audio": {\n "metadataoptions": {\n "sentenceBoundaryEnabled": "false",\n "wordBoundaryEnabled": "false"\n },\n "outputFormat": "'.concat(this._outputFormat,'" \n }\n }\n }\n }\n ')).then(e)},this._ws.onmessage=e=>{let t=tw.Buffer.from(e.data),n=t.toString(),s=/X-RequestId:(.*?)\r\n/gm.exec(n)[1];n.includes("Path:turn.start")||(n.includes("Path:turn.end")?this._streams[s].push(null):n.includes("Path:response")||(n.includes("Path:audio")&&e.data instanceof ArrayBuffer?this._pushAudioData(t,s):this._log("UNKNOWN MESSAGE",n)))},this._ws.onclose=()=>{for(let e in this._log("disconnected after:",(Date.now()-this._startTime)/1e3,"seconds"),this._streams)this._streams[e].push(null)},this._ws.onerror=function(e){t("Connect Error: "+e)}})}_pushAudioData(e,t){let n=e.indexOf(tj.BINARY_DELIM)+tj.BINARY_DELIM.length,s=e.subarray(n);this._streams[t].push(s),this._log("received audio chunk, size: ",null==s?void 0:s.length)}_SSMLTemplate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t={...new tk,...t},'\n \n \n ').concat(e,"\n \n \n ")}getVoices(){return fetch(tj.VOICES_URL).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e.json()}).then(e=>e).catch(e=>{throw e})}async setMetadata(e,t,n){let s=this._voice,a=this._voiceLocale,r=this._outputFormat;if(this._voice=e,this._voiceLocale=n,!this._voiceLocale){let e=tj.VOICE_LANG_REGEX.exec(this._voice);if(!e)throw Error("Could not infer voiceLocale from voiceName!");this._voiceLocale=e[0]}this._outputFormat=t,(s!==this._voice||a!==this._voiceLocale||r!==this._outputFormat||this._ws.readyState!==this._ws.OPEN)&&(this._startTime=Date.now(),await this._initClient())}_metadataCheck(){if(!this._ws)throw Error("Speech synthesis not configured yet. Run setMetadata before calling toStream or toFile.")}close(){this._ws.close()}toStream(e,t){let{stream:n}=this._rawSSMLRequest(this._SSMLTemplate(e,t));return n}toArrayBuffer(e,t){return new Promise((n,s)=>{let a=[],r=this.toStream(e,t);r.on("data",e=>{a.push(e)}),r.on("end",()=>{n(tw.Buffer.concat(a).buffer)}),r.on("error",e=>{s(e)})})}rawToStream(e){let{stream:t}=this._rawSSMLRequest(e);return t}_rawSSMLRequest(e){this._metadataCheck();let t=(0,ty.randomBytes)(16).toString("hex"),n="X-RequestId:".concat(t,"\r\nContent-Type:application/ssml+xml\r\nPath:ssml\r\n\r\n\n ")+e.trim(),s=this,a=new t_.Readable({read(){},destroy(e,n){delete s._streams[t],n(e)}});return this._streams[t]=a,this._send(n).then(),{stream:a,requestId:t}}constructor(e=!1){this._streams={},this._startTime=0,this._enableLogger=e}}tj.OUTPUT_FORMAT=H,tj.TRUSTED_CLIENT_TOKEN="6A5AA1D4EAFF4E9FB37E23D68491D6F4",tj.VOICES_URL="https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=".concat(tj.TRUSTED_CLIENT_TOKEN),tj.SYNTH_URL="wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=".concat(tj.TRUSTED_CLIENT_TOKEN),tj.BINARY_DELIM="Path:audio\r\n",tj.VOICE_LANG_REGEX=/\w{2}-\w{2}/;var tC=n(10307),tb=n(85564);function tE(){return(tE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if("audio"===t.data.eventType){let n=t.data.audioData,s=new Int16Array(n.length);for(let e=0;ee.stop())}startStreamingPlayback(){this.isPlaying=!0,this.nextPlayTime=this.context.currentTime}stopStreamingPlayback(){this.isPlaying=!1,this.playbackQueue.forEach(e=>e.stop()),this.playbackQueue=[],this.playBuffer=[]}playChunk(e){if(!this.isPlaying)return;let t=new Int16Array(e.buffer);this.playBuffer.push.apply(this.playBuffer,t);let n=new Float32Array(t.length);for(let e=0;e{let e=this.playbackQueue.indexOf(a);e>-1&&this.playbackQueue.splice(e,1)},this.nextPlayTime+=r,this.nextPlayTime1&&void 0!==arguments[1]?arguments[1]:16,n=e.buffer.byteLength,s=new Uint8Array(44),a=new DataView(s.buffer);return a.setUint32(0,1380533830,!1),a.setUint32(4,36+n,!0),a.setUint32(8,1463899717,!1),a.setUint32(12,1718449184,!1),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,this.sampleRate,!0),a.setUint32(28,4*this.sampleRate,!0),a.setUint16(32,2,!0),a.setUint16(34,t,!0),a.setUint32(36,1684108385,!1),a.setUint32(40,n,!0),new Blob([a,e.buffer],{type:"audio/mpeg"})}savePlayFile(){return this._saveData(new Int16Array(this.playBuffer))}saveRecordFile(e,t){let n=e?Math.floor(e*this.sampleRate/1e3):0,s=t?Math.floor(t*this.sampleRate/1e3):this.recordBuffer.length;return this._saveData(new Int16Array(this.recordBuffer.slice(n,s)))}async close(){var e,t,n;this.recordBuffer=[],null===(e=this.workletNode)||void 0===e||e.disconnect(),null===(t=this.source)||void 0===t||t.disconnect(),null===(n=this.stream)||void 0===n||n.getTracks().forEach(e=>e.stop()),await this.context.close()}constructor(){this.workletNode=null,this.stream=null,this.source=null,this.recordBuffer=[],this.sampleRate=24e3,this.nextPlayTime=0,this.isPlaying=!1,this.playbackQueue=[],this.playBuffer=[],this.context=new AudioContext({sampleRate:this.sampleRate}),this.mergeNode=new ChannelMergerNode(this.context,{numberOfInputs:2}),this.analyser=new AnalyserNode(this.context,{fftSize:256}),this.analyserData=new Uint8Array(this.analyser.frequencyBinCount),this.mergeNode.connect(this.analyser)}}var tI=n(69927),tD=n.n(tI);function tK(e){let{frequencies:t,isActive:n}=e,s=(0,Y.useRef)(null),a=(0,Y.useRef)([]),r=(0,Y.useRef)(10),i=(0,Y.useRef)(),o=(0,Y.useCallback)(e=>{a.current.push(e),a.current.length>r.current&&a.current.shift()},[]);return(0,Y.useEffect)(()=>{let e=s.current;if(!e)return;let r=e.getContext("2d");if(!r)return;let l=window.devicePixelRatio||1;e.width=e.offsetWidth*l,e.height=e.offsetHeight*l,r.scale(l,l);let c=()=>{if(r.clearRect(0,0,e.width,e.height),!t||!n){a.current=[];return}o(Array.from(t));let s=[],l=e.height/2,d=e.width/(t.length-1);r.beginPath(),r.moveTo(0,l);for(let n=0;n0&&(o=(o+a.current.map(e=>e[n]||0).reduce((e,t)=>e+t,0))/(a.current.length+1));let c=o/255,u=l+e.height/2*c*Math.sin(.2*n+.002*Date.now());if(s.push([i,u]),0===n)r.moveTo(i,u);else{let e=s[n-1],t=(e[0]+i)/2;r.quadraticCurveTo(e[0],e[1],t,(e[1]+u)/2)}}for(let e=s.length-1;e>=0;e--){let[t,n]=s[e],a=l-(n-l);if(e===s.length-1)r.lineTo(t,a);else{let a=s[e+1],i=(a[0]+t)/2;r.quadraticCurveTo(a[0],l-(a[1]-l),i,l-((a[1]+n)/2-l))}}r.closePath();let u=r.createLinearGradient(0,0,e.width,0);u.addColorStop(0,"rgba(100, 180, 255, 0.95)"),u.addColorStop(.5,"rgba(140, 200, 255, 0.9)"),u.addColorStop(1,"rgba(180, 220, 255, 0.95)"),r.fillStyle=u,r.fill(),i.current=requestAnimationFrame(c)};return c(),()=>{i.current&&cancelAnimationFrame(i.current)}},[t,n,o]),(0,X.jsx)("div",{className:tD()["voice-print"],children:(0,X.jsx)("canvas",{ref:s})})}function tR(e){let{onClose:t,onStartVoice:n,onPausedVoice:s}=e,a=(0,eB.aK)(),r=a.currentSession(),i=(0,eB.MG)(),[o,l]=(0,Y.useState)(""),[c,d]=(0,Y.useState)(!1),[u,h]=(0,Y.useState)(!1),[m,p]=(0,Y.useState)(!1),[g,f]=(0,Y.useState)("audio"),[v,x]=(0,Y.useState)(!0),[w,y]=(0,Y.useState)(),_=(0,Y.useRef)(null),k=(0,Y.useRef)(null),j=(0,Y.useRef)(!1),C=i.realtimeConfig.temperature,b=i.realtimeConfig.apiKey,E=i.realtimeConfig.model,S="Azure"===i.realtimeConfig.provider,N=i.realtimeConfig.azure.endpoint,M=i.realtimeConfig.azure.deployment,P=i.realtimeConfig.voice,O=async()=>{if(!m){if(u)await Z();else try{p(!0),_.current=S?new tA.G2(new URL(N),{key:b},{deployment:M}):new tA.G2({key:b},{model:E}),await _.current.configure({instructions:"",voice:P,input_audio_transcription:{model:"whisper-1"},turn_detection:v?{type:"server_vad"}:null,tools:[],temperature:C,modalities:"audio"===g?["text","audio"]:["text"]}),T(),h(!0)}catch(e){console.error("Connection failed:",e),l("Connection failed")}finally{p(!1)}}},Z=async()=>{if(_.current)try{await _.current.close(),_.current=null,h(!1)}catch(e){console.error("Disconnect failed:",e)}},T=async()=>{if(_.current)try{for await(let e of _.current.events())"response"===e.type?await A(e):"input_audio"===e.type&&await L(e)}catch(e){_.current&&console.error("Response iteration error:",e)}},A=async e=>{for await(let n of e)if("message"===n.type&&"assistant"===n.role){let e=(0,eB.tn)({role:n.role,content:""});a.updateTargetSession(r,t=>{t.messages=t.messages.concat([e])});let s=!1;for await(let t of n){if("text"===t.type)for await(let n of t.textChunks())e.content+=n;else if("audio"===t.type){let n=async()=>{for await(let n of t.transcriptChunks())e.content+=n},a=async()=>{var e,n;for await(let a of(null===(e=k.current)||void 0===e||e.startStreamingPlayback(),t.audioChunks()))s=!0,null===(n=k.current)||void 0===n||n.playChunk(a)};await Promise.all([n(),a()])}a.updateTargetSession(r,e=>{e.messages=e.messages.concat()})}if(s){var t;let n=null===(t=k.current)||void 0===t?void 0:t.savePlayFile();(0,ez.Ix)(n).then(t=>{e.audio_url=t,a.updateTargetSession(r,e=>{e.messages=e.messages.concat()})})}}},L=async e=>{var t,n;if(await e.waitForCompletion(),e.transcription){let t=(0,eB.tn)({role:"user",content:e.transcription});a.updateTargetSession(r,e=>{e.messages=e.messages.concat([t])});let{audioStartMillis:s,audioEndMillis:i}=e,o=null===(n=k.current)||void 0===n?void 0:n.saveRecordFile(s,i);(0,ez.Ix)(o).then(e=>{t.audio_url=e,a.updateTargetSession(r,e=>{e.messages=e.messages.concat()})})}null===(t=k.current)||void 0===t||t.stopStreamingPlayback()},I=async()=>{if(!c&&_.current)try{k.current||(k.current=new tL,await k.current.initialize()),await k.current.startRecording(async e=>{var t;await (null===(t=_.current)||void 0===t?void 0:t.sendAudio(e))}),d(!0)}catch(e){console.error("Failed to start recording:",e)}else if(k.current)try{if(k.current.stopRecording(),!v){var e,t;let n=await (null===(e=_.current)||void 0===e?void 0:e.commitAudio());await L(n),await (null===(t=_.current)||void 0===t?void 0:t.generateResponse())}d(!1)}catch(e){console.error("Failed to stop recording:",e)}};(0,Y.useEffect)(()=>{if(!j.current)return j.current=!0,(async()=>{let e=new tL;await e.initialize(),k.current=e,await O(),await I()})().catch(e=>{l(e),console.error(e)}),()=>{var e;c&&I(),null===(e=k.current)||void 0===e||e.close().catch(console.error),Z()}},[]),(0,Y.useEffect)(()=>{let e;if(u&&c){let t=()=>{k.current&&y(k.current.getByteFrequencyData()),e=requestAnimationFrame(t)};e=requestAnimationFrame(t)}else y(void 0);return()=>{e&&cancelAnimationFrame(e)}},[u,c]),(0,Y.useEffect)(()=>{var e;null===(e=_.current)||void 0===e||e.configure({voice:P})},[P]),(0,Y.useEffect)(()=>{var e;null===(e=_.current)||void 0===e||e.configure({temperature:C})},[C]);let D=async()=>{null==t||t(),c&&await I(),Z().catch(console.error)};return(0,X.jsxs)("div",{className:tT()["realtime-chat"],children:[(0,X.jsx)("div",{className:(0,tn.Z)(tT()["circle-mic"],{[tT().pulse]:c}),children:(0,X.jsx)(tK,{frequencies:w,isActive:c})}),(0,X.jsxs)("div",{className:tT()["bottom-icons"],children:[(0,X.jsx)("div",{children:(0,X.jsx)(eX.h,{icon:c?(0,X.jsx)(tS,{}):(0,X.jsx)(tM,{}),onClick:I,disabled:!u,shadow:!0,bordered:!0})}),(0,X.jsx)("div",{className:tT()["icon-center"],children:o}),(0,X.jsx)("div",{children:(0,X.jsx)(eX.h,{icon:(0,X.jsx)(tO,{}),onClick:D,shadow:!0,bordered:!0})})]})]})}n(94386);let tF=(0,eH.EN)(),tB=(s=null,a=null,{init:()=>{(s=new(window.AudioContext||window.webkitAudioContext)).suspend()},play:async(e,t)=>{a&&(a.stop(),a.disconnect());let n=await s.decodeAudioData(e);(a=s.createBufferSource()).buffer=n,a.connect(s.destination),s.resume().then(()=>{a.start()}),a.onended=t},stop:()=>{a&&(a.stop(),a.disconnect(),a=null),s&&(s.close(),s=null)}}),tH=(0,eU.default)(async()=>(await Promise.all([n.e(721),n.e(3954),n.e(6991),n.e(6303)]).then(n.bind(n,42896))).Markdown,{loadableGenerated:{webpack:()=>[42896]},loading:()=>(0,X.jsx)(eu.Z,{})});function tz(e){let t=(0,eB.aK)(),n=t.currentSession(),s=(0,e3.Zy)(),a=(0,eJ.s0)();return(0,X.jsx)("div",{className:"modal-mask",children:(0,X.jsx)(eQ.u_,{title:eG.ZP.Context.Edit,onClose:()=>e.onClose(),actions:[(0,X.jsx)(eX.h,{icon:(0,X.jsx)(eg.Z,{}),bordered:!0,text:eG.ZP.Chat.Config.Reset,onClick:async()=>{await (0,eQ.i0)(eG.ZP.Memory.ResetConfirm)&&t.updateTargetSession(n,e=>e.memoryPrompt="")}},"reset"),(0,X.jsx)(eX.h,{icon:(0,X.jsx)(ei.Z,{}),bordered:!0,text:eG.ZP.Chat.Config.SaveAs,onClick:()=>{a(e$.y$.Masks),setTimeout(()=>{s.create(n.mask)},500)}},"copy")],children:(0,X.jsx)(e1.MaskConfig,{mask:n.mask,updateMask:e=>{let s={...n.mask};e(s),t.updateTargetSession(n,e=>e.mask=s)},shouldSyncFromGlobal:!0,extraListItems:n.mask.modelConfig.sendMemory?(0,X.jsx)(eQ.HC,{className:"copyable",title:"".concat(eG.ZP.Memory.Title," (").concat(n.lastSummarizeIndex," of ").concat(n.messages.length,")"),subTitle:n.memoryPrompt||eG.ZP.Memory.EmptyContent}):(0,X.jsx)(X.Fragment,{})})})})}function tU(e){let t=(0,eB.aK)().currentSession().mask.context;return(0,X.jsxs)("div",{className:eY()["prompt-toast"],children:[e.showToast&&t.length>0&&(0,X.jsxs)("div",{className:(0,tn.Z)(eY()["prompt-toast-inner"],"clickable"),role:"button",onClick:()=>e.setShowModal(!0),children:[(0,X.jsx)(et,{}),(0,X.jsx)("span",{className:eY()["prompt-toast-content"],children:eG.ZP.Context.Toast(t.length)})]}),e.showModal&&(0,X.jsx)(tz,{onClose:()=>e.setShowModal(!1)})]},"prompt-toast")}function tW(e){let t=0===e.prompts.length,[n,s]=(0,Y.useState)(0),a=(0,Y.useRef)(null);return((0,Y.useEffect)(()=>{s(0)},[e.prompts.length]),(0,Y.useEffect)(()=>{let r=r=>{if(t||r.metaKey||r.altKey||r.ctrlKey)return;let i=t=>{var i;r.stopPropagation(),r.preventDefault(),s(Math.max(0,Math.min(e.prompts.length-1,n+t))),null===(i=a.current)||void 0===i||i.scrollIntoView({block:"center"})};if("ArrowUp"===r.key)i(1);else if("ArrowDown"===r.key)i(-1);else if("Enter"===r.key){let t=e.prompts.at(n);t&&e.onPromptSelect(t)}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e.prompts.length,n]),t)?null:(0,X.jsx)("div",{className:eY()["prompt-hints"],children:e.prompts.map((t,r)=>(0,X.jsxs)("div",{ref:r===n?a:null,className:(0,tn.Z)(eY()["prompt-hint"],{[eY()["prompt-hint-selected"]]:r===n}),onClick:()=>e.onPromptSelect(t),onMouseEnter:()=>s(r),children:[(0,X.jsx)("div",{className:eY()["hint-title"],children:t.title}),(0,X.jsx)("div",{className:eY()["hint-content"],children:t.content})]},t.title+r.toString()))})}function tV(){let e=(0,eB.aK)(),t=e.currentSession();return(0,X.jsxs)("div",{className:eY()["clear-context"],onClick:()=>e.updateTargetSession(t,e=>e.clearContextIndex=void 0),children:[(0,X.jsx)("div",{className:eY()["clear-context-tips"],children:eG.ZP.Context.Clear}),(0,X.jsx)("div",{className:eY()["clear-context-revert-btn"],children:eG.ZP.Context.Revert})]})}function tG(e){let t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),[s,a]=(0,Y.useState)({full:16,icon:16});function r(){if(!t.current||!n.current)return;let e=n.current.getBoundingClientRect().width,s=t.current.getBoundingClientRect().width;a({full:e+s,icon:s})}return(0,X.jsxs)("div",{className:(0,tn.Z)(eY()["chat-input-action"],"clickable"),onClick:()=>{e.onClick(),setTimeout(r,1)},onMouseEnter:r,onTouchStart:r,style:{"--icon-width":"".concat(s.icon,"px"),"--full-width":"".concat(s.full,"px")},children:[(0,X.jsx)("div",{ref:t,className:eY().icon,children:e.icon}),(0,X.jsx)("div",{className:eY().text,ref:n,children:e.text})]})}function tX(e){var t,n,s,a,r,i,o,l;let c=(0,eB.MG)(),d=(0,eJ.s0)(),u=(0,eB.aK)(),h=(0,eB.RQ)(),m=u.currentSession();c.theme;let p=eW.L.hasPending(),g=m.mask.modelConfig.model,f=(null===(t=m.mask.modelConfig)||void 0===t?void 0:t.providerName)||e$.UT.OpenAI,v=(0,tx.l)(),x=(0,Y.useMemo)(()=>{let e=v.filter(e=>e.available),t=e.find(e=>e.isDefault);return t?[t,...e.filter(e=>e!==t)]:e},[v]),w=(0,Y.useMemo)(()=>{var e;let t=x.find(e=>{var t;return e.name==g&&(null==e?void 0:null===(t=e.provider)||void 0===t?void 0:t.providerName)==f});return null!==(e=null==t?void 0:t.displayName)&&void 0!==e?e:""},[x,g,f]),[y,_]=(0,Y.useState)(!1),[k,j]=(0,Y.useState)(!1),[C,b]=(0,Y.useState)(!1),[E,S]=(0,Y.useState)(!1),[N,M]=(0,Y.useState)(!1),[P,O]=(0,Y.useState)(!1),Z=(0,eH.h1)(g),T=null!==(i=null===(n=m.mask.modelConfig)||void 0===n?void 0:n.size)&&void 0!==i?i:"1024x1024",A=null!==(o=null===(s=m.mask.modelConfig)||void 0===s?void 0:s.quality)&&void 0!==o?o:"standard",L=null!==(l=null===(a=m.mask.modelConfig)||void 0===a?void 0:a.style)&&void 0!==l?l:"vivid";return(0,eH.S0)(),(0,Y.useEffect)(()=>{let t=(0,eH.Xf)(g);if(b(t),t||(e.setAttachImages([]),e.setUploading(!1)),!x.some(e=>e.name===g)&&x.length>0){var n;let e=x.find(e=>e.isDefault)||x[0];u.updateTargetSession(m,t=>{var n;t.mask.modelConfig.model=e.name,t.mask.modelConfig.providerName=null==e?void 0:null===(n=e.provider)||void 0===n?void 0:n.providerName}),(0,eQ.CF)((null==e?void 0:null===(n=e.provider)||void 0===n?void 0:n.providerName)=="ByteDance"?e.displayName:e.name)}},[u,g,x,m]),(0,X.jsxs)("div",{className:eY()["chat-input-actions"],children:[(0,X.jsxs)(X.Fragment,{children:[p&&(0,X.jsx)(tG,{onClick:()=>eW.L.stopAll(),text:eG.ZP.Chat.InputActions.Stop,icon:(0,X.jsx)(eN.Z,{})}),!e.hitBottom&&(0,X.jsx)(tG,{onClick:e.scrollToBottom,text:eG.ZP.Chat.InputActions.ToBottom,icon:(0,X.jsx)(eS,{})}),e.hitBottom&&(0,X.jsx)(tG,{onClick:e.showPromptModal,text:eG.ZP.Chat.InputActions.Settings,icon:(0,X.jsx)(ev,{})}),C&&(0,X.jsx)(tG,{onClick:e.uploadImage,text:eG.ZP.Chat.InputActions.UploadImage,icon:e.uploading?(0,X.jsx)(eh.Z,{}):(0,X.jsx)(eb,{})}),(0,X.jsx)(tG,{onClick:()=>_(!0),text:w,icon:(0,X.jsx)(eP,{})}),y&&(0,X.jsx)(eQ.Qf,{defaultSelectedValue:"".concat(g,"@").concat(f),items:x.map(e=>{var t,n,s;return{title:"".concat(e.displayName).concat((null==e?void 0:null===(t=e.provider)||void 0===t?void 0:t.providerName)?" ("+(null==e?void 0:null===(n=e.provider)||void 0===n?void 0:n.providerName)+")":""),value:"".concat(e.name,"@").concat(null==e?void 0:null===(s=e.provider)||void 0===s?void 0:s.providerName)}}),onClose:()=>_(!1),onSelection:e=>{if(0===e.length)return;let[t,n]=(0,tb.En)(e[0]);if(u.updateTargetSession(m,e=>{e.mask.modelConfig.model=t,e.mask.modelConfig.providerName=n,e.mask.syncGlobalConfig=!1}),"ByteDance"==n){var s;let e=x.find(e=>{var s;return e.name==t&&(null==e?void 0:null===(s=e.provider)||void 0===s?void 0:s.providerName)==n});(0,eQ.CF)(null!==(s=null==e?void 0:e.displayName)&&void 0!==s?s:"")}else(0,eQ.CF)(t)}}),(0,eH.ZT)(g)&&(0,X.jsx)(tG,{onClick:()=>S(!0),text:T,icon:(0,X.jsx)(eZ,{})}),E&&(0,X.jsx)(eQ.Qf,{defaultSelectedValue:T,items:Z.map(e=>({title:e,value:e})),onClose:()=>S(!1),onSelection:e=>{if(0===e.length)return;let t=e[0];u.updateTargetSession(m,e=>{e.mask.modelConfig.size=t}),(0,eQ.CF)(t)}}),(0,eH.Wu)(g)&&(0,X.jsx)(tG,{onClick:()=>M(!0),text:A,icon:(0,X.jsx)(eA,{})}),N&&(0,X.jsx)(eQ.Qf,{defaultSelectedValue:A,items:["standard","hd"].map(e=>({title:e,value:e})),onClose:()=>M(!1),onSelection:e=>{if(0===e.length)return;let t=e[0];u.updateTargetSession(m,e=>{e.mask.modelConfig.quality=t}),(0,eQ.CF)(t)}}),(0,eH.Wu)(g)&&(0,X.jsx)(tG,{onClick:()=>O(!0),text:L,icon:(0,X.jsx)(eI,{})}),P&&(0,X.jsx)(eQ.Qf,{defaultSelectedValue:L,items:["vivid","natural"].map(e=>({title:e,value:e})),onClose:()=>O(!1),onSelection:e=>{if(0===e.length)return;let t=e[0];u.updateTargetSession(m,e=>{e.mask.modelConfig.style=t}),(0,eQ.CF)(t)}}),(0,eH.up)(f,g)&&(0,X.jsx)(tG,{onClick:()=>{0==h.getAll().length?d(e$.y$.Plugins):j(!0)},text:eG.ZP.Plugin.Name,icon:(0,X.jsx)(eK,{})}),k&&(0,X.jsx)(eQ.Qf,{multiple:!0,defaultSelectedValue:null===(r=u.currentSession().mask)||void 0===r?void 0:r.plugin,items:h.getAll().map(e=>({title:"".concat(null==e?void 0:e.title,"@").concat(null==e?void 0:e.version),value:null==e?void 0:e.id})),onClose:()=>j(!1),onSelection:e=>{u.updateTargetSession(m,t=>{t.mask.plugin=e})}})]}),(0,X.jsx)("div",{className:eY()["chat-input-actions-end"],children:c.realtimeConfig.enable&&(0,X.jsx)(tG,{onClick:()=>e.setShowChatSidePanel(!0),text:"Realtime Chat",icon:(0,X.jsx)(eF,{})})})]})}function tq(e){let t=(0,eB.aK)(),n=t.currentSession(),[s,a]=(0,Y.useState)(n.messages.slice());return(0,X.jsx)("div",{className:"modal-mask",children:(0,X.jsxs)(eQ.u_,{title:eG.ZP.Chat.EditMessage.Title,onClose:e.onClose,actions:[(0,X.jsx)(eX.h,{text:eG.ZP.UI.Cancel,icon:(0,X.jsx)(ej.Z,{}),onClick:()=>{e.onClose()}},"cancel"),(0,X.jsx)(eX.h,{type:"primary",text:eG.ZP.UI.Confirm,icon:(0,X.jsx)(e_.Z,{}),onClick:()=>{t.updateTargetSession(n,e=>e.messages=s),e.onClose()}},"ok")],children:[(0,X.jsx)(eQ.aV,{children:(0,X.jsx)(eQ.HC,{title:eG.ZP.Chat.EditMessage.Topic.Title,subTitle:eG.ZP.Chat.EditMessage.Topic.SubTitle,children:(0,X.jsx)("input",{type:"text",value:n.topic,onInput:e=>t.updateTargetSession(n,t=>t.topic=e.currentTarget.value)})})}),(0,X.jsx)(e1.ContextPrompts,{context:s,updateContext:e=>{let t=s.slice();e(t),a(t)}})]})})}function tY(e){return(0,X.jsx)("div",{className:eY()["delete-image"],onClick:e.deleteImage,children:(0,X.jsx)(ex.Z,{})})}function tQ(e){let t=navigator.platform.toUpperCase().indexOf("MAC")>=0,n=[{title:eG.ZP.Chat.ShortcutKey.newChat,keys:t?["⌘","Shift","O"]:["Ctrl","Shift","O"]},{title:eG.ZP.Chat.ShortcutKey.focusInput,keys:["Shift","Esc"]},{title:eG.ZP.Chat.ShortcutKey.copyLastCode,keys:t?["⌘","Shift",";"]:["Ctrl","Shift",";"]},{title:eG.ZP.Chat.ShortcutKey.copyLastMessage,keys:t?["⌘","Shift","C"]:["Ctrl","Shift","C"]},{title:eG.ZP.Chat.ShortcutKey.showShortcutKey,keys:t?["⌘","/"]:["Ctrl","/"]},{title:eG.ZP.Chat.ShortcutKey.clearContext,keys:t?["⌘","Shift","backspace"]:["Ctrl","Shift","backspace"]}];return(0,X.jsx)("div",{className:"modal-mask",children:(0,X.jsx)(eQ.u_,{title:eG.ZP.Chat.ShortcutKey.Title,onClose:e.onClose,actions:[(0,X.jsx)(eX.h,{type:"primary",text:eG.ZP.UI.Confirm,icon:(0,X.jsx)(e_.Z,{}),onClick:()=>{e.onClose()}},"ok")],children:(0,X.jsx)("div",{className:eY()["shortcut-key-container"],children:(0,X.jsx)("div",{className:eY()["shortcut-key-grid"],children:n.map((e,t)=>(0,X.jsxs)("div",{className:eY()["shortcut-key-item"],children:[(0,X.jsx)("div",{className:eY()["shortcut-key-title"],children:e.title}),(0,X.jsx)("div",{className:eY()["shortcut-key-keys"],children:e.keys.map((e,t)=>(0,X.jsx)("div",{className:eY()["shortcut-key"],children:(0,X.jsx)("span",{children:e})},t))})]},t))})})})})}function tJ(){var e,t,s;let a=(0,eB.aK)(),r=a.currentSession(),i=(0,eB.MG)(),o=i.fontSize,l=i.fontFamily,[c,d]=(0,Y.useState)(!1),u=(0,Y.useRef)(null),[h,m]=(0,Y.useState)(""),[p,g]=(0,Y.useState)(!1),{submitKey:f,shouldSubmit:v}=function(){let e=(0,eB.MG)(),t=e.submitKey,n=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{let e=()=>{n.current=!0},t=()=>{n.current=!1};return window.addEventListener("compositionstart",e),window.addEventListener("compositionend",t),()=>{window.removeEventListener("compositionstart",e),window.removeEventListener("compositionend",t)}},[]),{submitKey:t,shouldSubmit:t=>229!=t.keyCode&&"Enter"===t.key&&("Enter"!==t.key||!t.nativeEvent.isComposing&&!n.current)&&(e.submitKey===eB.mQ.AltEnter&&t.altKey||e.submitKey===eB.mQ.CtrlEnter&&t.ctrlKey||e.submitKey===eB.mQ.ShiftEnter&&t.shiftKey||e.submitKey===eB.mQ.MetaEnter&&t.metaKey||e.submitKey===eB.mQ.Enter&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey)}}(),x=(0,Y.useRef)(null),w=null!=x&&!!x.current&&1>=Math.abs(x.current.scrollHeight-(x.current.scrollTop+x.current.clientHeight)),y=(0,Y.useMemo)(()=>{var e;let t=null===(e=x.current)||void 0===e?void 0:e.lastElementChild;return null!=x&&!!x.current&&!!t&&t.getBoundingClientRect().top-x.current.getBoundingClientRect().top<100},[null==x?void 0:null===(e=x.current)||void 0===e?void 0:e.scrollHeight]),_=""!==h,{setAutoScroll:k,scrollDomToBottom:j}=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,[s,a]=(0,Y.useState)(!0),r=(0,Y.useCallback)(()=>{let t=e.current;t&&requestAnimationFrame(()=>{a(!0),t.scrollTo(0,t.scrollHeight)})},[e]);(0,Y.useEffect)(()=>{s&&!t&&r()});let i=(0,Y.useRef)(n.length);return(0,Y.useEffect)(()=>{n.length>i.current&&!t&&r(),i.current=n.length},[n.length,t,r]),{scrollRef:e,autoScroll:s,setAutoScroll:a,scrollDomToBottom:r}}(x,(w||y)&&!_,r.messages),[C,b]=(0,Y.useState)(!0),E=(0,eH.S0)(),S=(0,eJ.s0)(),[N,M]=(0,Y.useState)([]),[P,O]=(0,Y.useState)(!1),Z=(0,eV.f)(),[T,A]=(0,Y.useState)([]),L=(0,q.y1)(e=>{A(Z.search(e))},100,{leading:!0,trailing:!0}),[I,D]=(0,Y.useState)(2),K=(0,q.y1)(()=>{let e=u.current?(0,eH.lx)(u.current):1;D(Math.min(20,Math.max(2+Number(!E),e)))},100,{leading:!0,trailing:!0});(0,Y.useEffect)(K,[h]);let R=(0,e6.UK)({new:()=>a.newSession(),newm:()=>S(e$.y$.NewChat),prev:()=>a.nextSession(-1),next:()=>a.nextSession(1),clear:()=>a.updateTargetSession(r,e=>e.clearContextIndex=e.messages.length),fork:()=>a.forkSession(),del:()=>a.deleteSession(a.currentSessionIndex)}),F=e=>{m(e);let t=e.trim().length;0===t?A([]):e.match(e6.x6)?A(R.search(e)):!i.disablePromptHint&&t<30&&e.startsWith("/")&&L(e.slice(1))},B=e=>{var t;if(""===e.trim()&&(0,tC.Z)(N))return;let n=R.match(e);if(n.matched){m(""),A([]),n.invoke();return}g(!0),a.onUserInput(e,N).then(()=>g(!1)),M([]),a.setLastInput(e),m(""),A([]),E||null===(t=u.current)||void 0===t||t.focus(),k(!0)},z=e=>{eW.L.stop(r.id,e)};(0,Y.useEffect)(()=>{a.updateTargetSession(r,e=>{let t=Date.now()-e$.tb;e.messages.forEach(e=>{(e.isError||new Date(e.date).getTime()=0;e-=1)if("user"===r.messages[e].role){n=r.messages[e];break}}else if("user"===e.role){n=e;for(let e=i;eg(!1)),null===(t=u.current)||void 0===t||t.focus()},G=e=>{a.updateTargetSession(r,t=>t.mask.context.push(e)),(0,eQ.CF)(eG.ZP.Chat.Actions.PinToastContent,{text:eG.ZP.Chat.Actions.PinToastAction,onClick:()=>{eM(!0)}})},Q=(0,eB._X)(),[J,ee]=(0,Y.useState)(!1),[et,en]=(0,Y.useState)(!1);async function eo(e){if(J)tB.stop(),ee(!1);else{var t;let s;t=new to.ti(e$.k8.GPT);let a=eB.MG.getState();en(!0),tB.init();let{markdownToTxt:r}=n(69549),i=r(e);if(a.ttsConfig.engine!==e$.Xu){let e=Q.edgeVoiceName(),t=new tj;await t.setMetadata(e,H.AUDIO_24KHZ_96KBITRATE_MONO_MP3),s=await t.toArrayBuffer(i)}else s=await t.llm.speech({model:a.ttsConfig.model,input:i,voice:a.ttsConfig.voice,speed:a.ttsConfig.speed});ee(!0),tB.play(s,()=>{ee(!1)}).catch(e=>{console.error("[OpenAI Speech]",e),(0,eQ.CF)((0,e2.B)(e)),ee(!1)}).finally(()=>en(!1))}}let ec=(0,Y.useMemo)(()=>r.mask.hideContext?[]:r.mask.context.slice(),[r.mask.context,r.mask.hideContext]);if(0===ec.length&&(null===(t=r.messages.at(0))||void 0===t?void 0:t.content)!==eB.ux.content){let e=Object.assign({},eB.ux);Q.isAuthorized()||(e.content=eG.ZP.Error.Unauthorized),ec.push(e)}let eu=(0,Y.useMemo)(()=>ec.concat(r.messages).concat(p?[{...(0,eB.tn)({role:"assistant",content:"……"}),preview:!0}]:[]).concat(h.length>0&&i.sendPreviewBubble?[{...(0,eB.tn)({role:"user",content:h}),preview:!0}]:[]),[i.sendPreviewBubble,ec,p,r.messages,h]),[ef,ev]=(0,Y.useState)(Math.max(0,eu.length-e$.nS));function ew(e){ev(e=Math.max(0,e=Math.min(eu.length-e$.nS,e)))}let ej=(0,Y.useMemo)(()=>{let e=Math.min(ef+3*e$.nS,eu.length);return eu.slice(ef,e)},[ef,eu]),eC=e=>{let t=e.scrollTop+e.clientHeight,n=e.clientHeight,s=e.scrollTop<=n,a=t>=e.scrollHeight-n,r=t>=e.scrollHeight-(E?4:10),i=ef-e$.nS,o=ef+e$.nS;s&&!a?ew(i):a&&ew(o),b(r),k(r)};function eb(){ew(eu.length-e$.nS),j()}let eE=(null!==(s=r.clearContextIndex)&&void 0!==s?s:-1)>=0?r.clearContextIndex+ec.length-ef:-1,[eS,eM]=(0,Y.useState)(!1),eP=(0,Y.useMemo)(()=>(0,ti.Z)(),[]),eO=!E,eZ=!E&&!(null==eP?void 0:eP.isApp);(0,e6.YZ)({fill:m,submit:e=>{B(e)},code:e=>{Q.disableFastLink||(console.log("[Command] got code from url: ",e),(0,eQ.i0)(eG.ZP.URLCommand.Code+"code = ".concat(e)).then(t=>{t&&Q.update(t=>t.accessCode=e)}))},settings:e=>{if(!Q.disableFastLink)try{let t=JSON.parse(e);console.log("[Command] got settings from url: ",t),(t.key||t.url)&&(0,eQ.i0)(eG.ZP.URLCommand.Settings+"\n".concat(JSON.stringify(t,null,4))).then(e=>{e&&(t.key&&Q.update(e=>e.openaiApiKey=t.key),t.url&&Q.update(e=>e.openaiUrl=t.url),Q.update(e=>e.useCustomConfig=!0))})}catch(t){console.error("[Command] failed to get settings from url: ",e)}}});let[eT,eA]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e=(0,e$.AI)(r.id),t=tF.getItem(e);t&&0===h.length&&(m(t),tF.removeItem(e));let n=u.current;return()=>{var t;tF.setItem(e,null!==(t=null==n?void 0:n.value)&&void 0!==t?t:"")}},[]);let eL=(0,Y.useCallback)(async e=>{let t=a.currentSession().mask.modelConfig.model;if((0,eH.Xf)(t)){for(let t of(e.clipboardData||window.clipboardData).items)if("file"===t.kind&&t.type.startsWith("image/")){e.preventDefault();let n=t.getAsFile();if(n){let e=[];e.push(...N),e.push(...await new Promise((e,t)=>{O(!0);let s=[];(0,ez.Ix)(n).then(t=>{s.push(t),O(!1),e(s)}).catch(e=>{O(!1),t(e)})}));let t=e.length;t>3&&e.splice(3,t-3),M(e)}}}},[N,a]);async function eI(){let e=[];e.push(...N),e.push(...await new Promise((e,t)=>{let n=document.createElement("input");n.type="file",n.accept="image/png, image/jpeg, image/webp, image/heic, image/heif",n.multiple=!0,n.onchange=n=>{O(!0);let s=n.target.files,a=[];for(let r=0;r{a.push(t),(3===a.length||a.length===s.length)&&(O(!1),e(a))}).catch(e=>{O(!1),t(e)})}},n.click()}));let t=e.length;t>3&&e.splice(3,t-3),M(e)}let[eD,eK]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.shiftKey&&"o"===e.key.toLowerCase())e.preventDefault(),setTimeout(()=>{a.newSession(),S(e$.y$.Chat)},10);else if(e.shiftKey&&"escape"===e.key.toLowerCase()){var t;e.preventDefault(),null===(t=u.current)||void 0===t||t.focus()}else if((e.metaKey||e.ctrlKey)&&e.shiftKey&&"Semicolon"===e.code){e.preventDefault();let t=document.querySelectorAll(".copy-code-button");t.length>0&&t[t.length-1].click()}else if((e.metaKey||e.ctrlKey)&&e.shiftKey&&"c"===e.key.toLowerCase()){e.preventDefault();let t=ej.filter(e=>"user"!==e.role).pop();if(t){let e=(0,eH.YK)(t);(0,eH.vQ)(e)}}else(e.metaKey||e.ctrlKey)&&"/"===e.key?(e.preventDefault(),eK(!0)):(e.metaKey||e.ctrlKey)&&e.shiftKey&&"backspace"===e.key.toLowerCase()&&(e.preventDefault(),a.updateTargetSession(r,e=>{e.clearContextIndex===e.messages.length?e.clearContextIndex=void 0:(e.clearContextIndex=e.messages.length,e.memoryPrompt="")}))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[ej,a,S,r]);let[eR,eF]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:eY().chat,children:[(0,X.jsxs)("div",{className:"window-header","data-tauri-drag-region":!0,children:[E&&(0,X.jsx)("div",{className:"window-actions",children:(0,X.jsx)("div",{className:"window-action-button",children:(0,X.jsx)(eX.h,{icon:(0,X.jsx)(er.Z,{}),bordered:!0,title:eG.ZP.Chat.Actions.ChatList,onClick:()=>S(e$.y$.Home)})})}),(0,X.jsxs)("div",{className:(0,tn.Z)("window-header-title",eY()["chat-body-title"]),children:[(0,X.jsx)("div",{className:(0,tn.Z)("window-header-main-title",eY()["chat-body-main-title"]),onClickCapture:()=>eA(!0),children:r.topic?r.topic:eB.HX}),(0,X.jsx)("div",{className:"window-header-sub-title",children:eG.ZP.Chat.SubTitle(r.messages.length)})]}),(0,X.jsxs)("div",{className:"window-actions",children:[(0,X.jsx)("div",{className:"window-action-button",children:(0,X.jsx)(eX.h,{icon:(0,X.jsx)(eg.Z,{}),bordered:!0,title:eG.ZP.Chat.Actions.RefreshTitle,onClick:()=>{(0,eQ.CF)(eG.ZP.Chat.Actions.RefreshToast),a.summarizeSession(!0,r)}})}),!E&&(0,X.jsx)("div",{className:"window-action-button",children:(0,X.jsx)(eX.h,{icon:(0,X.jsx)(es,{}),bordered:!0,title:eG.ZP.Chat.EditMessage.Title,aria:eG.ZP.Chat.EditMessage.Title,onClick:()=>eA(!0)})}),(0,X.jsx)("div",{className:"window-action-button",children:(0,X.jsx)(eX.h,{icon:(0,X.jsx)(ea.Z,{}),bordered:!0,title:eG.ZP.Chat.Actions.Export,onClick:()=>{d(!0)}})}),eZ&&(0,X.jsx)("div",{className:"window-action-button",children:(0,X.jsx)(eX.h,{icon:i.tightBorder?(0,X.jsx)(ep.Z,{}):(0,X.jsx)(em.Z,{}),bordered:!0,title:eG.ZP.Chat.Actions.FullScreen,aria:eG.ZP.Chat.Actions.FullScreen,onClick:()=>{i.update(e=>e.tightBorder=!e.tightBorder)}})})]}),(0,X.jsx)(tU,{showToast:!C,showModal:eS,setShowModal:eM})]}),(0,X.jsxs)("div",{className:eY()["chat-main"],children:[(0,X.jsxs)("div",{className:eY()["chat-body-container"],children:[(0,X.jsx)("div",{className:eY()["chat-body"],ref:x,onScroll:e=>eC(e.currentTarget),onMouseDown:()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.blur()},onTouchStart:()=>{var e;null===(e=u.current)||void 0===e||e.blur(),k(!1)},children:ej.map((e,t)=>{var n,s,c;let d="user"===e.role,u=t0&&!(e.preview||0===e.content.length)&&!u,p=e.preview||e.streaming;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)("div",{className:d?eY()["chat-message-user"]:eY()["chat-message"],children:(0,X.jsxs)("div",{className:eY()["chat-message-container"],children:[(0,X.jsxs)("div",{className:eY()["chat-message-header"],children:[(0,X.jsxs)("div",{className:eY()["chat-message-avatar"],children:[(0,X.jsx)("div",{className:eY()["chat-message-edit"],children:(0,X.jsx)(eX.h,{icon:(0,X.jsx)(es,{}),aria:eG.ZP.Chat.Actions.Edit,onClick:async()=>{let t=await (0,eQ.G5)(eG.ZP.Chat.Actions.Edit,(0,eH.YK)(e),10),n=t,s=(0,eH.Bs)(e);if(s.length>0){n=[{type:"text",text:t}];for(let e=0;e{let s=t.mask.context.concat(t.messages).find(t=>t.id===e.id);s&&(s.content=n)})}})}),d?(0,X.jsx)(e0.qE,{avatar:i.avatar}):(0,X.jsx)(X.Fragment,{children:["system"].includes(e.role)?(0,X.jsx)(e0.qE,{avatar:"2699-fe0f"}):(0,X.jsx)(e1.MaskAvatar,{avatar:r.mask.avatar,model:e.model||r.mask.modelConfig.model})})]}),!d&&(0,X.jsx)("div",{className:eY()["chat-model-name"],children:e.model}),h&&(0,X.jsx)("div",{className:eY()["chat-message-actions"],children:(0,X.jsx)("div",{className:eY()["chat-input-actions"],children:e.streaming?(0,X.jsx)(tG,{text:eG.ZP.Chat.Actions.Stop,icon:(0,X.jsx)(eN.Z,{}),onClick:()=>{var n;return z(null!==(n=e.id)&&void 0!==n?n:t)}}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(tG,{text:eG.ZP.Chat.Actions.Retry,icon:(0,X.jsx)(eg.Z,{}),onClick:()=>V(e)}),(0,X.jsx)(tG,{text:eG.ZP.Chat.Actions.Delete,icon:(0,X.jsx)(ex.Z,{}),onClick:()=>{var n;return W(null!==(n=e.id)&&void 0!==n?n:t)}}),(0,X.jsx)(tG,{text:eG.ZP.Chat.Actions.Pin,icon:(0,X.jsx)(ey,{}),onClick:()=>G(e)}),(0,X.jsx)(tG,{text:eG.ZP.Chat.Actions.Copy,icon:(0,X.jsx)(ei.Z,{}),onClick:()=>(0,eH.vQ)((0,eH.YK)(e))}),i.ttsConfig.enable&&(0,X.jsx)(tG,{text:J?eG.ZP.Chat.Actions.StopSpeech:eG.ZP.Chat.Actions.Speech,icon:J?(0,X.jsx)(ed,{}):(0,X.jsx)(el,{}),onClick:()=>eo((0,eH.YK)(e))})]})})})]}),(null==e?void 0:null===(n=e.tools)||void 0===n?void 0:n.length)==0&&p&&(0,X.jsx)("div",{className:eY()["chat-message-status"],children:eG.ZP.Chat.Typing}),(null==e?void 0:null===(s=e.tools)||void 0===s?void 0:s.length)>0&&(0,X.jsx)("div",{className:eY()["chat-message-tools"],children:null==e?void 0:null===(c=e.tools)||void 0===c?void 0:c.map(e=>{var t;return(0,X.jsxs)("div",{title:null==e?void 0:e.errorMsg,className:eY()["chat-message-tool"],children:[!1===e.isError?(0,X.jsx)(e_.Z,{}):!0===e.isError?(0,X.jsx)(ek.Z,{}):(0,X.jsx)(eh.Z,{}),(0,X.jsx)("span",{children:null==e?void 0:null===(t=e.function)||void 0===t?void 0:t.name})]},e.id)})}),(0,X.jsxs)("div",{className:eY()["chat-message-item"],children:[(0,X.jsx)(tH,{content:(0,eH.YK)(e),loading:(e.preview||e.streaming)&&0===e.content.length&&!d,onDoubleClickCapture:()=>{E&&m((0,eH.YK)(e))},fontSize:o,fontFamily:l,parentRef:x,defaultShow:t>=ej.length-6},e.streaming?"loading":"done"),1==(0,eH.Bs)(e).length&&(0,X.jsx)("img",{className:eY()["chat-message-item-image"],src:(0,eH.Bs)(e)[0],alt:""}),(0,eH.Bs)(e).length>1&&(0,X.jsx)("div",{className:eY()["chat-message-item-images"],style:{"--image-count":(0,eH.Bs)(e).length},children:(0,eH.Bs)(e).map((e,t)=>(0,X.jsx)("img",{className:eY()["chat-message-item-image-multi"],src:e,alt:""},t))})]}),(null==e?void 0:e.audio_url)&&(0,X.jsx)("div",{className:eY()["chat-message-audio"],children:(0,X.jsx)("audio",{src:e.audio_url,controls:!0})}),(0,X.jsx)("div",{className:eY()["chat-message-action-date"],children:u?eG.ZP.Chat.IsContext:e.date.toLocaleString()})]})}),t===eE-1&&(0,X.jsx)(tV,{})]},e.id)})}),(0,X.jsxs)("div",{className:eY()["chat-input-panel"],children:[(0,X.jsx)(tW,{prompts:T,onPromptSelect:e=>{setTimeout(()=>{var t;A([]);let n=R.match(e.content);n.matched?(n.invoke(),m("")):m(e.content),null===(t=u.current)||void 0===t||t.focus()},30)}}),(0,X.jsx)(tX,{uploadImage:eI,setAttachImages:M,setUploading:O,showPromptModal:()=>eM(!0),scrollToBottom:eb,hitBottom:C,uploading:P,showPromptHints:()=>{var e;if(T.length>0){A([]);return}null===(e=u.current)||void 0===e||e.focus(),m("/"),L("")},setShowShortcutKeyModal:eK,setUserInput:m,setShowChatSidePanel:eF}),(0,X.jsxs)("label",{className:(0,tn.Z)(eY()["chat-input-panel-inner"],{[eY()["chat-input-panel-inner-attach"]]:0!==N.length}),htmlFor:"chat-input",children:[(0,X.jsx)("textarea",{id:"chat-input",ref:u,className:eY()["chat-input"],placeholder:eG.ZP.Chat.Input(f),onInput:e=>F(e.currentTarget.value),value:h,onKeyDown:e=>{if("ArrowUp"===e.key&&h.length<=0&&!(e.metaKey||e.altKey||e.ctrlKey)){var t;m(null!==(t=a.lastInput)&&void 0!==t?t:""),e.preventDefault();return}v(e)&&0===T.length&&(B(h),e.preventDefault())},onFocus:eb,onClick:eb,onPaste:eL,rows:I,autoFocus:eO,style:{fontSize:i.fontSize,fontFamily:i.fontFamily}}),0!=N.length&&(0,X.jsx)("div",{className:eY()["attach-images"],children:N.map((e,t)=>(0,X.jsx)("div",{className:eY()["attach-image"],style:{backgroundImage:'url("'.concat(e,'")')},children:(0,X.jsx)("div",{className:eY()["attach-image-mask"],children:(0,X.jsx)(tY,{deleteImage:()=>{M(N.filter((e,n)=>n!==t))}})})},t))}),(0,X.jsx)(eX.h,{icon:(0,X.jsx)($,{}),text:eG.ZP.Chat.Send,className:eY()["chat-input-send"],type:"primary",onClick:()=>B(h)})]})]})]}),(0,X.jsx)("div",{className:(0,tn.Z)(eY()["chat-side-panel"],{[eY().mobile]:E,[eY()["chat-side-panel-show"]]:eR}),children:eR&&(0,X.jsx)(tR,{onClose:()=>{eF(!1)},onStartVoice:async()=>{console.log("start voice")}})})]})]},r.id),c&&(0,X.jsx)(tc,{onClose:()=>d(!1)}),eT&&(0,X.jsx)(tq,{onClose:()=>{eA(!1)}}),eD&&(0,X.jsx)(tQ,{onClose:()=>eK(!1)})]})}function t$(){let e=(0,eB.aK)().currentSession();return(0,X.jsx)(tJ,{},e.id)}},79296:function(e){e.exports={"message-exporter-body":"exporter_message-exporter-body__ieezO","export-content":"exporter_export-content__bLZvx",steps:"exporter_steps__6n3hv","steps-progress":"exporter_steps-progress__BaZCB","steps-progress-inner":"exporter_steps-progress-inner__Bx3Y4","steps-inner":"exporter_steps-inner__EVqvK",step:"exporter_step__WhCEO","step-finished":"exporter_step-finished__eBg9d","step-current":"exporter_step-current__oh5Mc","step-index":"exporter_step-index__bWRYR","step-name":"exporter_step-name__aj81m","preview-actions":"exporter_preview-actions__EdSLJ","image-previewer":"exporter_image-previewer__uKfNQ","preview-body":"exporter_preview-body__qK5Zf","chat-info":"exporter_chat-info__N_j5m",icons:"exporter_icons__7WRoV",logo:"exporter_logo__zu13e","main-title":"exporter_main-title__jjxAd","sub-title":"exporter_sub-title__p1RCl","icon-space":"exporter_icon-space__u_tMK","chat-info-item":"exporter_chat-info-item__3D12j",message:"exporter_message__3aahS",avatar:"exporter_avatar__fGOtt",body:"exporter_body__gcKIl","message-image":"exporter_message-image__ofOeC","message-images":"exporter_message-images__oJoIX","message-image-multi":"exporter_message-image-multi__jzQdX","message-assistant":"exporter_message-assistant__sDmHi","message-user":"exporter_message-user__2t254"}},88809:function(e){e.exports={"message-selector":"message-selector_message-selector__dOKbo","message-filter":"message-selector_message-filter__Q5XSd","search-bar":"message-selector_search-bar__4E5gq",actions:"message-selector_actions__MyZCT",messages:"message-selector_messages__GbOLr",message:"message-selector_message___TaV9","message-selected":"message-selector_message-selected__b3mDv",avatar:"message-selector_avatar__HCJ8t",body:"message-selector_body__rKEIZ",date:"message-selector_date__vc48w",content:"message-selector_content__Z9W8L",checkbox:"message-selector_checkbox__erPyd"}},2366:function(e){e.exports={"realtime-chat":"realtime-chat_realtime-chat__g_U_c","circle-mic":"realtime-chat_circle-mic__SfmZp","icon-center":"realtime-chat_icon-center__3JpXN","bottom-icons":"realtime-chat_bottom-icons__siVHg","icon-left":"realtime-chat_icon-left__O_fpx","icon-right":"realtime-chat_icon-right__3eC9i",mobile:"realtime-chat_mobile__WtJW9",pulse:"realtime-chat_pulse__DSlz2"}},69927:function(e){e.exports={"voice-print":"voice-print_voice-print__GHMDU"}}}]);