1import{C as e,D as t,E as n,Et as r,F as i,H as a,Ot as o,Pt as s,S as c,Y as l,at as u,b as d,h as f,jt as p,m,p as h,q as g,t as _,yt as v,z as y}from"./vue.esm-bundler-DbaDmJgJ.js";import{Gt as b}from"./talk-to-us-DZ9TbE96.js";import{t as x}from"./paperclip-CB35-wYS.js";import{t as S}from"./upload-s2oLSsiP.js";import{a as C}from"./dist-CvOv_Xn3.js";var w=s({default:()=>V});_();var T={class:`tw-border-t tw-border-gray-200 tw-p-3`},E={key:0,class:`tw-mb-2 tw-flex tw-flex-col tw-gap-1`},D={class:`tw-flex-1 tw-truncate tw-text-xs tw-text-gray-600`},O=[`onClick`],k={key:0,class:`tw-flex tw-items-center tw-gap-1.5 tw-rounded-lg tw-border tw-border-gray-200 tw-bg-gray-50 tw-px-2.5 tw-py-1.5`},A={class:`tw-flex-1 tw-truncate tw-text-xs tw-text-gray-400`},j=[`value`,`placeholder`,`onKeydown`],M={class:`tw-flex tw-items-center tw-justify-between tw-gap-2 tw-px-2 tw-pb-2 tw-pt-1`},N=[`disabled`,`title`],P={key:0,class:`tw-absolute tw-bottom-full tw-left-0 tw-z-10 tw-mb-2 tw-w-64 tw-overflow-hidden tw-rounded-xl tw-border tw-border-gray-200 tw-bg-white tw-shadow-custom-medium`},F={class:`tw-flex tw-size-9 tw-shrink-0 tw-items-center tw-justify-center tw-rounded-lg tw-bg-green-50`},I={class:`tw-flex tw-flex-col`},L={class:`tw-text-sm tw-font-medium tw-text-gray-800`},R={class:`tw-text-xs tw-text-gray-500`},z=[`disabled`,`title`],B={class:`tw-mt-1 tw-text-center tw-text-xs tw-text-gray-400`},V={__name:`ai-chat-composer`,props:{modelValue:{type:String,default:``},attachments:{type:Array,default:()=>[]},isSending:{type:Boolean,default:!1},isUploadingAttachment:{type:Boolean,default:!1},canAttach:{type:Boolean,default:!0},attachDisabledTitle:{type:String,default:``},placeholder:{type:String,default:``}},emits:[`update:modelValue`,`submit`,`file-selected`,`remove-attachment`],setup(s,{expose:_,emit:w}){let V=i(`i18n`),H=s,U=w,W=v(null),G=v(null),K=v(null),q=v(null),J=v(!1);_({focus:()=>W.value?.focus()});let Y=()=>{W.value&&(W.value.style.height=`auto`,W.value.style.height=`${W.value.scrollHeight}px`)};u(()=>H.modelValue,()=>y(Y));let{isOverDropZone:X}=C(K,{onDrop(e){e?.length&&H.canAttach&&!H.isSending&&!H.isUploadingAttachment&&U(`file-selected`,e[0])}}),Z=()=>{H.modelValue.trim()&&!H.isSending&&U(`submit`)},Q=e=>{let t=e.target.files?.[0];t&&U(`file-selected`,t),G.value&&(G.value.value=``)},$=e=>{q.value&&!q.value.contains(e.target)&&(J.value=!1,document.removeEventListener(`click`,$))},ee=()=>{!H.canAttach||H.isSending||H.isUploadingAttachment||(J.value=!J.value,J.value?y(()=>document.addEventListener(`click`,$)):document.removeEventListener(`click`,$))},te=()=>{J.value=!1,document.removeEventListener(`click`,$),G.value?.click()};return a(()=>{document.removeEventListener(`click`,$)}),(i,a)=>(g(),e(`div`,T,[d(`input`,{ref_key:`fileInputRef`,ref:G,type:`file`,accept:`.txt,.md,.csv,.xlsx,.xls,text/plain,text/markdown,text/csv`,class:`tw-hidden`,onChange:Q},null,544),s.attachments.length>0||s.isUploadingAttachment?(g(),e(`div`,E,[(g(!0),e(f,null,l(s.attachments,n=>(g(),e(`div`,{key:n.id,class:`tw-flex tw-items-center tw-gap-1.5 tw-rounded-lg tw-border tw-border-gray-200 tw-bg-gray-50 tw-px-2.5 tw-py-1.5`},[t(r(x),{class:`tw-size-4 tw-shrink-0 tw-text-gray-400`}),d(`span`,D,p(n.filename),1),d(`button`,{type:`button`,class:`tw-text-gray-400 hover:tw-text-gray-600`,onClick:e=>U(`remove-attachment`,n.id)},[...a[1]||=[d(`svg`,{class:`tw-size-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"stroke-width":`2.5`},[d(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,d:`M6 18L18 6M6 6l12 12`})],-1)]],8,O)]))),128)),s.isUploadingAttachment?(g(),e(`div`,k,[t(r(x),{class:`tw-size-4 tw-shrink-0 tw-text-gray-400`}),d(`span`,A,p(r(V).trans(`frontend.ai-chat.composer.uploading`)),1)])):c(``,!0)])):c(``,!0),d(`div`,{ref_key:`composerRef`,ref:K,class:o([`tw-flex tw-flex-col tw-rounded-xl tw-border tw-border-gray-200 tw-bg-white tw-transition-colors focus-within:tw-border-green-500`,{"tw-border-green-500 tw-bg-green-50/50":r(X)}])},[d(`textarea`,{ref_key:`inputRef`,ref:W,value:s.modelValue,rows:`1`,placeholder:s.placeholder||r(V).trans(`frontend.ai-chat.composer.placeholder`),class:`tw-resize-none tw-border-0 tw-bg-transparent tw-px-3.5 tw-pt-3 tw-text-base tw-text-blue-500 tw-outline-none focus:!tw-border-0 focus:!tw-shadow-none focus:tw-ring-0 sm:tw-text-sm`,style:{"max-height":`160px`,"overflow-y":`auto`},onInput:a[0]||=e=>U(`update:modelValue`,e.target.value),onKeydown:h(m(Z,[`exact`,`prevent`]),[`enter`])},null,40,j),d(`div`,M,[d(`div`,{ref_key:`menuRef`,ref:q,class:`tw-relative`},[d(`button`,{type:`button`,class:o([`tw-flex tw-items-center tw-gap-1 tw-rounded-full tw-px-2.5 tw-py-1.5 tw-text-xs tw-font-medium tw-transition-colors disabled:tw-cursor-not-allowed disabled:tw-opacity-40`,J.value?`tw-bg-green-50 tw-text-green-600`:`tw-text-gray-500 hover:tw-bg-gray-100 hover:tw-text-gray-700`]),disabled:!s.canAttach||s.isSending||s.isUploadingAttachment,title:s.canAttach?``:s.attachDisabledTitle,onClick:ee},[(g(),e(`svg`,{class:o([`tw-size-3.5 tw-transition-transform`,{"tw-rotate-45":J.value}]),fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"stroke-width":`2`},[...a[2]||=[d(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,d:`M12 4v16m8-8H4`}
1,null,-1)]],2)),n(` `+p(r(V).trans(`frontend.ai-chat.composer.add_button`)),1)],10,N),J.value?(g(),e(`div`,P,[d(`button`,{type:`button`,class:`tw-flex tw-w-full tw-items-center tw-gap-3 tw-px-3 tw-py-2.5 tw-text-left tw-transition-colors hover:tw-bg-gray-50`,onClick:te},[d(`span`,F,[t(r(S),{class:`tw-size-4 tw-shrink-0 tw-text-green-600`})]),d(`span`,I,[d(`span`,L,p(r(V).trans(`frontend.ai-chat.composer.upload_file`)),1),d(`span`,R,p(r(V).trans(`frontend.ai-chat.composer.upload_from_device`)),1)])])])):c(``,!0)],512),d(`button`,{type:`button`,class:`tw-flex tw-size-8 tw-shrink-0 tw-items-center tw-justify-center tw-rounded-lg tw-text-green-500 tw-transition-colors hover:tw-bg-green-50 hover:tw-text-green-600 disabled:tw-opacity-30`,disabled:!s.modelValue.trim()||s.isSending,title:s.isSending?r(V).trans(`frontend.ai-chat.composer.send_disabled_hint`):``,onClick:Z},[t(r(b),{class:`tw-size-4`})],8,z)])],2),d(`p`,B,p(r(V).trans(`frontend.ai-chat.composer.ai_disclaimer`)),1)]))}};export{w as n,V as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.