exports.id=111,exports.ids=[111],exports.modules={86111:(t,e,a)=>{"use strict";a.r(e),a.d(e,{ContextPrompts:()=>H,MaskAvatar:()=>A,MaskConfig:()=>E,MaskPage:()=>L});var s=a(95344),n=a(70580),i=a(99668),c=a(94313),o=a.n(c),l=a(13262),r=a(81757),h=a(9127),m=a(32263),d=a(26989),_=a(12670),x=a(32168),p=a(81482),g=a(59880),k=a(1566),u=a(33362),j=a(31604),C=a(6068),b=a(67938),f=a(9719),v=a(17304),y=a(93949),Z=a.n(y),M=a(3729),P=a(25166),N=a(85962),w=a(99608),T=a(50197),S=a(23463),I=a(56815);function A(t){return t.avatar!==k._G?s.jsx(b.qE,{avatar:t.avatar}):s.jsx(b.qE,{model:t.model})}function E(t){let[e,a]=(0,M.useState)(!1),i=(0,u.MG)();return(0,s.jsxs)(s.Fragment,{children:[s.jsx(H,{context:t.mask.context,updateContext:e=>{let a=t.mask.context.slice();e(a),t.updateMask(t=>t.context=a)}}),(0,s.jsxs)(C.aV,{children:[s.jsx(C.HC,{title:f.ZP.Mask.Config.Avatar,children:s.jsx(C.J2,{content:s.jsx(b.aR,{onEmojiClick:e=>{t.updateMask(t=>t.avatar=e),a(!1)}}),open:e,onClose:()=>a(!1),children:s.jsx("div",{tabIndex:0,"aria-label":f.ZP.Mask.Config.Avatar,onClick:()=>a(!0),style:{cursor:"pointer"},children:s.jsx(A,{avatar:t.mask.avatar,model:t.mask.modelConfig.model})})})}),s.jsx(C.HC,{title:f.ZP.Mask.Config.Name,children:s.jsx("input",{"aria-label":f.ZP.Mask.Config.Name,type:"text",value:t.mask.name,onInput:e=>t.updateMask(t=>{t.name=e.currentTarget.value})})}),s.jsx(C.HC,{title:f.ZP.Mask.Config.HideContext.Title,subTitle:f.ZP.Mask.Config.HideContext.SubTitle,children:s.jsx("input",{"aria-label":f.ZP.Mask.Config.HideContext.Title,type:"checkbox",checked:t.mask.hideContext,onChange:e=>{t.updateMask(t=>{t.hideContext=e.currentTarget.checked})}})}),i.enableArtifacts&&s.jsx(C.HC,{title:f.ZP.Mask.Config.Artifacts.Title,subTitle:f.ZP.Mask.Config.Artifacts.SubTitle,children:s.jsx("input",{"aria-label":f.ZP.Mask.Config.Artifacts.Title,type:"checkbox",checked:!1!==t.mask.enableArtifacts,onChange:e=>{t.updateMask(t=>{t.enableArtifacts=e.currentTarget.checked})}})}),i.enableCodeFold&&s.jsx(C.HC,{title:f.ZP.Mask.Config.CodeFold.Title,subTitle:f.ZP.Mask.Config.CodeFold.SubTitle,children:s.jsx("input",{"aria-label":f.ZP.Mask.Config.CodeFold.Title,type:"checkbox",checked:!1!==t.mask.enableCodeFold,onChange:e=>{t.updateMask(t=>{t.enableCodeFold=e.currentTarget.checked})}})}),t.shouldSyncFromGlobal?null:s.jsx(C.HC,{title:f.ZP.Mask.Config.Share.Title,subTitle:f.ZP.Mask.Config.Share.SubTitle,children:s.jsx(n.h,{aria:f.ZP.Mask.Config.Share.Title,icon:s.jsx(p.Z,{}),text:f.ZP.Mask.Config.Share.Action,onClick:()=>{let e=`${location.protocol}//${location.host}/#${w.y$.NewChat}?mask=${t.mask.id}`;(0,P.vQ)(e)}})}),t.shouldSyncFromGlobal?s.jsx(C.HC,{title:f.ZP.Mask.Config.Sync.Title,subTitle:f.ZP.Mask.Config.Sync.SubTitle,children:s.jsx("input",{"aria-label":f.ZP.Mask.Config.Sync.Title,type:"checkbox",checked:t.mask.syncGlobalConfig,onChange:async e=>{let a=e.currentTarget.checked;a&&await (0,C.i0)(f.ZP.Mask.Config.Sync.Confirm)?t.updateMask(t=>{t.syncGlobalConfig=a,t.modelConfig={...i.modelConfig}}):a||t.updateMask(t=>{t.syncGlobalConfig=a})}})}):null]}),(0,s.jsxs)(C.aV,{children:[s.jsx(N.j,{modelConfig:{...t.mask.modelConfig},updateConfig:e=>{if(t.readonly)return;let a={...t.mask.modelConfig};e(a),t.updateMask(t=>{t.modelConfig=a,t.syncGlobalConfig=!1})}}),t.extraListItems]})]})}function F(t){let[e,a]=(0,M.useState)(!1);return(0,s.jsxs)("div",{className:Z()["context-prompt-row"],children:[!e&&(0,s.jsxs)(s.Fragment,{children:[s.jsx("div",{className:Z()["context-drag"],children:s.jsx(g.Z,{})}),s.jsx(C.Ph,{value:t.prompt.role,className:Z()["context-role"],onChange:e=>t.update({...t.prompt,role:e.target.value}),children:j.K$.map(t=>s.jsx("option",{value:t,children:t},t))})]}),s.jsx(C.II,{value:(0,P.YK)(t.prompt),type:"text",className:Z()["context-content"],rows:e?5:1,onFocus:()=>a(!0),onBlur:()=>{a(!1),window?.getSelection()?.removeAllRanges()},onInput:e=>t.update({...t.prompt,content:e.currentTarget.value})}),!e&&s.jsx(n.h,{icon:s.jsx(_.Z,{}),className:Z()["context-delete-button"],onClick:()=>t.remove(),bordered:!0})]})}function H(t){let e=t.context,a=(e,a)=>{t.updateContext(t=>t.splice(a,0,e))},i=e=>{t.updateContext(t=>t.splice(e,1))},c=(e,a)=>{t.updateContext(t=>{let s=(0,P.Bs)(t[e]);if(t[e]=a,s.length>0){let a=[{type:"text",text:(0,P.YK)(t[e])}];for(let t of s)a.push({type:"image_url",image_url:{url:t}});t[e].content=a}})};return s.jsx(s.Fragment,{children:(0,s.jsxs)("div",{className:Z()["context-prompt"],style:{marginBottom:20},children:[s.jsx(S.Z5,{onDragEnd:a=>{if(!a.destination)return;let s=function(t,e,a){let s=[...t],[n]=s.splice(e,1);return s.splice(a,0,n),s}(e,a.source.index,a.destination.index);t.updateContext(t=>{t.splice(0,t.length,...s)})},children:s.jsx(S.bK,{droppableId:"context-prompt-list",children:t=>(0,s.jsxs)("div",{ref:t.innerRef,...t.droppableProps,children:[e.map((t,e)=>s.jsx(S._l,{draggableId:t.id||e.toString(),index:e,children:n=>(0,s.jsxs)("div",{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,children:[s.jsx(F,{index:e,prompt:t,update:t=>c(e,t),remove:()=>i(e)}),s.jsx("div",{className:Z()["context-prompt-insert"],onClick:()=>{a((0,u.tn)({role:"user",content:"",date:new Date().toLocaleString()}),e+1)},children:s.jsx(m.Z,{})})]})},t.id)),t.placeholder]})})}),0===t.context.length&&s.jsx("div",{className:Z()["context-prompt-row"],children:s.jsx(n.h,{icon:s.jsx(m.Z,{}),text:f.ZP.Context.Add,bordered:!0,className:Z()["context-prompt-button"],onClick:()=>a((0,u.tn)({role:"user",content:"",date:""}),t.context.length)})})]})})}function L(){let t=(0,v.s0)(),e=(0,k.Zy)(),a=(0,u.aK)(),c=e.language,g=e.getAll().filter(t=>!c||t.lang===c),[j,b]=(0,M.useState)([]),[y,Z]=(0,M.useState)(""),N=y.length>0?j:g,S=t=>{Z(t),t.length>0?b(g.filter(e=>e.name.toLowerCase().includes(t.toLowerCase()))):b(g)},[F,H]=(0,M.useState)(),L=e.get(F)??T.$n.get(F),R=()=>{(0,P.j2)().then(t=>{try{let a=JSON.parse(t);if(Array.isArray(a)){for(let t of a)t.name&&e.create(t);return}a.name&&e.create(a)}catch{}})};return(0,s.jsxs)(i.S,{children:[(0,s.jsxs)("div",{className:o()["mask-page"],children:[(0,s.jsxs)("div",{className:"window-header",children:[(0,s.jsxs)("div",{className:"window-header-title",children:[s.jsx("div",{className:"window-header-main-title",children:f.ZP.Mask.Page.Title}),s.jsx("div",{className:"window-header-submai-title",children:f.ZP.Mask.Page.SubTitle(g.length)})]}),(0,s.jsxs)("div",{className:"window-actions",children:[s.jsx("div",{className:"window-action-button",children:s.jsx(n.h,{icon:s.jsx(l.Z,{}),bordered:!0,onClick:()=>{(0,P.CP)(JSON.stringify(N.filter(t=>!t.builtin)),w.dJ.Masks)},text:f.ZP.UI.Export})}),s.jsx("div",{className:"window-action-button",children:s.jsx(n.h,{icon:s.jsx(r.Z,{}),text:f.ZP.UI.Import,bordered:!0,onClick:()=>R()})}),s.jsx("div",{className:"window-action-button",children:s.jsx(n.h,{icon:s.jsx(d.Z,{}),bordered:!0,onClick:()=>t(-1)})})]})]}),(0,s.jsxs)("div",{className:o()["mask-page-body"],children:[(0,s.jsxs)("div",{className:o()["mask-filter"],children:[s.jsx("input",{type:"text",className:o()["search-bar"],placeholder:f.ZP.Mask.Page.Search,autoFocus:!0,onInput:t=>S(t.currentTarget.value)}),(0,s.jsxs)(C.Ph,{className:o()["mask-filter-lang"],value:c??f.ZP.Settings.Lang.All,onChange:t=>{let a=t.currentTarget.value;a===f.ZP.Settings.Lang.All?e.setLanguage(void 0):e.setLanguage(a)},children:[s.jsx("option",{value:f.ZP.Settings.Lang.All,children:f.ZP.Settings.Lang.All},"all"),f.DC.map(t=>s.jsx("option",{value:t,children:f.nW[t]},t))]}),s.jsx(n.h,{className:o()["mask-create"],icon:s.jsx(m.Z,{}),text:f.ZP.Mask.Page.Create,bordered:!0,onClick:()=>{H(e.create().id)}})]}),s.jsx("div",{children:N.map(i=>(0,s.jsxs)("div",{className:o()["mask-item"],children:[(0,s.jsxs)("div",{className:o()["mask-header"],children:[s.jsx("div",{className:o()["mask-icon"],children:s.jsx(A,{avatar:i.avatar,model:i.modelConfig.model})}),(0,s.jsxs)("div",{className:o()["mask-title"],children:[s.jsx("div",{className:o()["mask-name"],children:i.name}),s.jsx("div",{className:(0,I.Z)(o()["mask-info"],"one-line"),children:`${f.ZP.Mask.Item.Info(i.context.length)} / ${f.nW[i.lang]} / ${i.modelConfig.model}`})]})]}),(0,s.jsxs)("div",{className:o()["mask-actions"],children:[s.jsx(n.h,{icon:s.jsx(m.Z,{}),text:f.ZP.Mask.Item.Chat,onClick:()=>{a.newSession(i),t(w.y$.Chat)}}),i.builtin?s.jsx(n.h,{icon:s.jsx(x.Z,{}),text:f.ZP.Mask.Item.View,onClick:()=>H(i.id)}):s.jsx(n.h,{icon:s.jsx(h.Z,{}),text:f.ZP.Mask.Item.Edit,onClick:()=>H(i.id)}),!i.builtin&&s.jsx(n.h,{icon:s.jsx(_.Z,{}),text:f.ZP.Mask.Item.Delete,onClick:async()=>{await (0,C.i0)(f.ZP.Mask.Item.DeleteConfirm)&&e.delete(i.id)}})]})]},i.id))})]})]}),L&&s.jsx("div",{className:"modal-mask",children:s.jsx(C.u_,{title:f.ZP.Mask.EditModal.Title(L?.builtin),onClose:()=>H(void 0),actions:[s.jsx(n.h,{icon:s.jsx(l.Z,{}),text:f.ZP.Mask.EditModal.Download,bordered:!0,onClick:()=>(0,P.CP)(JSON.stringify(L),`${L.name}.json`)},"export"),s.jsx(n.h,{icon:s.jsx(p.Z,{}),bordered:!0,text:f.ZP.Mask.EditModal.Clone,onClick:()=>{t(w.y$.Masks),e.create(L),H(void 0)}},"copy")],children:s.jsx(E,{mask:L,updateMask:t=>e.updateMask(F,t),readonly:L.builtin})})})]})}},93949:t=>{t.exports={"attach-images":"chat_attach-images__UtJds","attach-image":"chat_attach-image__5zxeG","attach-image-mask":"chat_attach-image-mask__cOlWM","delete-image":"chat_delete-image__IBtAc","chat-input-actions":"chat_chat-input-actions__mwYC_","chat-input-actions-end":"chat_chat-input-actions-end__gqGc3","chat-input-action":"chat_chat-input-action__DMW7Y","slide-in":"chat_slide-in__nvZgA",text:"chat_text__TkPfN",icon:"chat_icon__Ly3TN","prompt-toast":"chat_prompt-toast___VCUf","prompt-toast-inner":"chat_prompt-toast-inner__f17E6","slide-in-from-top":"chat_slide-in-from-top__Q0KCt","prompt-toast-content":"chat_prompt-toast-content__9sp_w","section-title":"chat_section-title__BiPko","section-title-action":"chat_section-title-action__bmruw","context-prompt":"chat_context-prompt__cbach","context-prompt-insert":"chat_context-prompt-insert__UmNJi","context-prompt-row":"chat_context-prompt-row__3Kbix","context-drag":"chat_context-drag__BX7lh","context-role":"chat_context-role__7_IR9","context-content":"chat_context-content__sNXUy","context-delete-button":"chat_context-delete-button__C_BmS","context-prompt-button":"chat_context-prompt-button__AoPsw","memory-prompt":"chat_memory-prompt__vOzcn","memory-prompt-content":"chat_memory-prompt-content__kUVKj","clear-context":"chat_clear-context__ke8Iw","clear-context-tips":"chat_clear-context-tips__L1A_i","clear-context-revert-btn":"chat_clear-context-revert-btn___Wna1",chat:"chat_chat__ZebHg","chat-body":"chat_chat-body__QFv5x","chat-body-main-title":"chat_chat-body-main-title__jUL6h","chat-body-title":"chat_chat-body-title__d2ItC","chat-message":"chat_chat-message__dg8rL","chat-message-user":"chat_chat-message-user__ZtTEj","chat-message-header":"chat_chat-message-header__Dny_K","chat-message-actions":"chat_chat-message-actions__H90hg","chat-model-name":"chat_chat-model-name__U4gmR","chat-message-container":"chat_chat-message-container__O_X8_","chat-message-edit":"chat_chat-message-edit__h58of","chat-message-avatar":"chat_chat-message-avatar__3QeMq","chat-message-status":"chat_chat-message-status__zc9Ad","chat-message-tools":"chat_chat-message-tools__YMVVa","chat-message-tool":"chat_chat-message-tool__Rjc5q","chat-message-item":"chat_chat-message-item__dKqMl","chat-message-audio":"chat_chat-message-audio__Rbvwc","chat-message-item-image":"chat_chat-message-item-image__2jbb0","chat-message-item-images":"chat_chat-message-item-images__EtEM4","chat-message-item-image-multi":"chat_chat-message-item-image-multi__DOIxY","chat-message-action-date":"chat_chat-message-action-date__RsXTn","chat-input-panel":"chat_chat-input-panel__rO72m","prompt-hints":"chat_prompt-hints__VT_Oi","prompt-hint":"chat_prompt-hint__2616t","hint-title":"chat_hint-title__E53ZK","hint-content":"chat_hint-content__y2yj4","prompt-hint-selected":"chat_prompt-hint-selected__o3vYi","chat-input-panel-inner":"chat_chat-input-panel-inner___IQHi","chat-input-panel-inner-attach":"chat_chat-input-panel-inner-attach__mZheu","chat-input":"chat_chat-input__PQ_oF","chat-input-send":"chat_chat-input-send__GFQZo","shortcut-key-container":"chat_shortcut-key-container__nYZUJ","shortcut-key-grid":"chat_shortcut-key-grid__VmUMG","shortcut-key-item":"chat_shortcut-key-item__diQqm","shortcut-key-title":"chat_shortcut-key-title__nauQT","shortcut-key-keys":"chat_shortcut-key-keys__vW8SN","shortcut-key":"chat_shortcut-key__DtMUQ","chat-main":"chat_chat-main__i_Cp2","chat-body-container":"chat_chat-body-container__6ZZad","chat-side-panel":"chat_chat-side-panel__YrWNL","chat-side-panel-show":"chat_chat-side-panel-show__cl5MF"}},94313:t=>{t.exports={"mask-page":"mask_mask-page__ou14k","mask-page-body":"mask_mask-page-body__kBXsJ","mask-filter":"mask_mask-filter__OdpU3","slide-in":"mask_slide-in__unpXH","search-bar":"mask_search-bar__7_Msn","mask-filter-lang":"mask_mask-filter-lang__mRxyv","mask-create":"mask_mask-create__BjAzk","mask-item":"mask_mask-item__dinia","mask-header":"mask_mask-header__RXJXI","mask-icon":"mask_mask-icon__wO1ER","mask-title":"mask_mask-title__IDEbR","mask-name":"mask_mask-name__77Rjh","mask-info":"mask_mask-info__2gtiu","mask-actions":"mask_mask-actions__rsWn_","slide-in-from-top":"mask_slide-in-from-top__DOEYB"}}};